Skip to content

Typesense v1#83

Open
clarkd wants to merge 2 commits into
mainfrom
work/dc/typesense
Open

Typesense v1#83
clarkd wants to merge 2 commits into
mainfrom
work/dc/typesense

Conversation

@clarkd

@clarkd clarkd commented Jul 2, 2026

Copy link
Copy Markdown
Member

🔌 Plugin overview

  • Plugin name: Typesense
  • Purpose / problem solved: Query documents from Typesense collections directly in SquaredUp. Runs structured searches, raw multi_search JSON queries, and result-count summaries against a Typesense Cloud (or self-hosted) instance — without ever needing admin access to the cluster.
  • Primary audience: Teams running Typesense-powered search (platform/product teams and SREs) who want to surface search data and monitor collections in SquaredUp.
  • Authentication method(s): API Key — a search-only key (documents:search action) sent in the X-TYPESENSE-API-KEY header.

🖼️ Plugin screenshots

Plugin configuration

To add: screenshot of the Host URL / Search API Key / Collection setup form.

Default dashboards

To add: screenshot of the Overview dashboard (Total Documents + Search Time KPIs, Documents table).


🧪 Testing

Every stream was built and tested against a live, authenticated tenant (region dev) using squaredup test, against a real collection (companies-production-en-us, ~10,633 documents):

  • Config validationq=* search against the configured collection returns 200 OK; confirms host, key, and collection in one probe.
  • documentSearch — returns one row per matching document with dynamic per-collection columns plus a relevance score; verified that unset optional params (query_by/filter_by/sort_by) are correctly dropped, and that relevance populates on real text queries.
  • multiSearch — raw POST /multi_search from a JSON blob; verified the configured collection is auto-injected as a query-arg default, so a minimal {"searches":[{"q":"*"}]} blob queries the right collection with nothing extra.
  • searchSummary — single count row (found / out_of / search_time_ms); verified per_page=0 returns counts with zero hits transferred.
  • squaredup validate --json passes: 4 data streams, icon, UI config, config validation, and default content all present.

⚠️ Known limitations

  • Search-only scope. No cluster health/metrics/stats, no API-key or alias management, and no collection/document import into the graph — a search key can't list collections (collections:list needs an admin key). This is a query-on-demand plugin with no imported objects (hence no perspectives).
  • Result size. A single search returns at most 250 documents per page (per_page); search is designed to return the most relevant results, not to bulk-export a collection.
  • Response size. Very large result sets can exceed SquaredUp's ~6MB per-request limit — keep per_page and field counts reasonable, or narrow with filter_by.
  • No time range. Typesense search has no time-range parameter, so streams return current results with no timeframe picker (timeframes: false). To restrict by time, add a filter_by on a timestamp field.
  • Future scope. Admin-key features (collection import, cluster monitoring) are intentionally deferred to a later version.

📚 Checklist

  • Plugin, datastream and UI naming follow SquaredUp guidelines
  • Logo added
  • One or more dashboards added
  • README added including configuration guidance
  • No secrets or credentials included
  • I agree to the Code of Conduct

Summary by CodeRabbit

  • New Features
    • Added Typesense integration for secure, search-only access to a configured collection.
    • Added document search, multi-search, and search summary capabilities.
    • Added an Overview dashboard with document counts, search performance, and searchable document results.
    • Added configuration fields for host URL, API key, and collection.
    • Added connection validation with clear success and error messages.
  • Documentation
    • Added setup guidance, prerequisites, supported searches, and usage limitations.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Typesense v1 plugin with search-only configuration, validation, document, multi-search, and summary data streams, response-processing scripts, documentation, and a default Overview dashboard.

Changes

Typesense v1 integration

Layer / File(s) Summary
Plugin registration and configuration
plugins/Typesense/v1/metadata.json, plugins/Typesense/v1/ui.json, plugins/Typesense/v1/docs/README.md
Defines plugin metadata, host/API key/collection inputs, and search-only integration documentation.
Search data streams and validation
plugins/Typesense/v1/configValidation.json, plugins/Typesense/v1/dataStreams/*
Adds collection authentication validation, document search, multi-search, and search summary streams with response-processing scripts and metadata fields.
Default dashboard content
plugins/Typesense/v1/defaultContent/*
Adds the Overview dashboard with document, count, and search-time tiles, registers it in the manifest, and sets scopes to an explicit empty array.

Sequence Diagram(s)

sequenceDiagram
  participant Dashboard
  participant DataStream
  participant TypesenseAPI
  participant PostRequestScript
  Dashboard->>DataStream: Request search data
  DataStream->>TypesenseAPI: Send configured HTTP request
  TypesenseAPI-->>PostRequestScript: Return search response
  PostRequestScript-->>Dashboard: Return flattened rows or summary metadata
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too generic and doesn't indicate that this PR adds a new Typesense plugin and data streams. Rename it to something specific like "Add Typesense v1 plugin" or "Add Typesense v1 data streams and dashboard".
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description matches the new-plugin template and includes overview, screenshots, testing, limitations, and checklist details.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

Comment thread plugins/Typesense/v1/ui.json Outdated
@clarkd
clarkd marked this pull request as ready for review July 21, 2026 14:58
@clarkd
clarkd requested a review from a team July 21, 2026 14:58
@clarkd clarkd added the new-plugin Used to PR newly added plugins label Jul 21, 2026
@clarkd
clarkd requested a review from andrewmumblebee July 21, 2026 14:58
@github-actions

Copy link
Copy Markdown

🧩 Plugin PR Summary

📦 Modified Plugins

  • plugins/Typesense/v1

📋 Results

Step Status
Validation ✅ Passed
Deployment 🚀 Deployed

🔍 Validation Details

typesense
{
  "valid": true,
  "pluginName": "typesense",
  "pluginType": "hybrid",
  "summary": {
    "Data Streams": 4,
    "Import Definitions": 0,
    "UI Configuration": true,
    "Has Icon": true,
    "Has Default Content": true,
    "Config Validation": true,
    "Custom Types": false
  }
}

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/Typesense/v1/dataStreams/documentSearch.json`:
- Around line 11-15: Require a non-empty query_by whenever q is not "*", while
preserving wildcard searches without query_by, in the request parameter mappings
for plugins/Typesense/v1/dataStreams/documentSearch.json lines 11-15 and
plugins/Typesense/v1/dataStreams/searchSummary.json lines 11-14; update both
streams consistently so invalid Typesense requests cannot be produced.

In `@plugins/Typesense/v1/dataStreams/scripts/multiSearch.js`:
- Around line 5-6: Update the _search assignment in the multi-search result
mapping to use 1-based numbering by assigning i + 1, so the first search is
displayed as Search `#1` while preserving the existing result mapping.

In `@plugins/Typesense/v1/docs/README.md`:
- Around line 21-33: Update the two setup examples in the README to use bash
language identifiers on their fenced code blocks and add blank lines immediately
before and after each fence. Preserve the existing curl commands and surrounding
setup text.

In `@plugins/Typesense/v1/ui.json`:
- Around line 13-18: Update the URL pattern in the validation configuration to
accept only https:// Typesense host URLs, while preserving the existing
host-only and no-trailing-slash/path constraints. Keep the validation message
aligned with the HTTPS-only requirement.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 30ec68aa-4563-480f-837b-3a4fa3b57e05

📥 Commits

Reviewing files that changed from the base of the PR and between eb6d864 and 16a4f47.

⛔ Files ignored due to path filters (1)
  • plugins/Typesense/v1/icon.svg is excluded by !**/*.svg
📒 Files selected for processing (14)
  • plugins/Typesense/v1/configValidation.json
  • plugins/Typesense/v1/dataStreams/documentSearch.json
  • plugins/Typesense/v1/dataStreams/multiSearch.json
  • plugins/Typesense/v1/dataStreams/scripts/documentSearch.js
  • plugins/Typesense/v1/dataStreams/scripts/multiSearch.js
  • plugins/Typesense/v1/dataStreams/scripts/searchSummary.js
  • plugins/Typesense/v1/dataStreams/searchSummary.json
  • plugins/Typesense/v1/dataStreams/searchValidation.json
  • plugins/Typesense/v1/defaultContent/manifest.json
  • plugins/Typesense/v1/defaultContent/overviewDashboard.dash.json
  • plugins/Typesense/v1/defaultContent/scopes.json
  • plugins/Typesense/v1/docs/README.md
  • plugins/Typesense/v1/metadata.json
  • plugins/Typesense/v1/ui.json

Comment on lines +11 to +15
{ "key": "q", "value": "{{q || '*'}}" },
{ "key": "query_by", "value": "{{query_by || null}}" },
{ "key": "filter_by", "value": "{{filter_by || null}}" },
{ "key": "sort_by", "value": "{{sort_by || null}}" },
{ "key": "per_page", "value": "{{per_page || 50}}" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- files ---\n'
git ls-files 'plugins/Typesense/v1/dataStreams/*.json'

printf '\n--- relevant snippets ---\n'
for f in plugins/Typesense/v1/dataStreams/documentSearch.json plugins/Typesense/v1/dataStreams/searchSummary.json; do
  echo "FILE: $f"
  nl -ba "$f" | sed -n '1,120p'
  echo
done

printf '\n--- search for query_by validation / docs references ---\n'
rg -n '"query_by"|query_by|filter_by|q != "\*"' plugins/Typesense/v1 -g '*.json' -g '*.md' -g '*.ts' -g '*.js'

Repository: squaredup/plugins

Length of output: 246


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- file sizes ---\n'
wc -l plugins/Typesense/v1/dataStreams/documentSearch.json plugins/Typesense/v1/dataStreams/searchSummary.json

printf '\n--- surrounding content: documentSearch.json ---\n'
sed -n '1,120p' plugins/Typesense/v1/dataStreams/documentSearch.json | nl -ba

printf '\n--- surrounding content: searchSummary.json ---\n'
sed -n '1,120p' plugins/Typesense/v1/dataStreams/searchSummary.json | nl -ba

printf '\n--- query_by references ---\n'
rg -n '"query_by"|query_by|filter_by|q' plugins/Typesense/v1 -g '*.json'

Repository: squaredup/plugins

Length of output: 246


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Focus on the two stream files and nearby plugin metadata.
printf '--- plugin tree ---\n'
find plugins/Typesense -maxdepth 3 -type f | sort

printf '\n--- documentSearch.json ---\n'
cat -n plugins/Typesense/v1/dataStreams/documentSearch.json | sed -n '1,120p'

printf '\n--- searchSummary.json ---\n'
cat -n plugins/Typesense/v1/dataStreams/searchSummary.json | sed -n '1,120p'

printf '\n--- metadata/version files ---\n'
cat -n plugins/Typesense/v1/metadata.json 2>/dev/null || true

Repository: squaredup/plugins

Length of output: 246


🌐 Web query:

Typesense search API q wildcard query_by required documentation

💡 Result:

In the Typesense Search API, both the 'q' and 'query_by' parameters are required [1][2][3]. The 'q' parameter accepts the text you wish to search for [1][4]. To perform a wildcard search that returns all documents (typically used in combination with filters), you should set 'q' to '*' [1][2]. The 'query_by' parameter is used to specify one or more field names that Typesense should query against [1][2]. You can provide multiple fields by separating them with a comma (e.g., 'field1,field2') [1][2]. The order of these fields determines relevance, where matches in earlier fields are ranked higher than those in later fields [1][2]. Only string and string array fields are supported for full-text search in this parameter [1][2].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Look for the same pattern in other Typesense stream definitions.
rg -n '"key": "query_by"|query_by.*required|required.*query_by|q.*\*' plugins/Typesense -g '*.json' -g '*.md' | sed -n '1,200p'

Repository: squaredup/plugins

Length of output: 2425


Require query_by for non-* searches
Both streams accept q values other than * while leaving query_by empty, which makes Typesense reject the request.

  • plugins/Typesense/v1/dataStreams/documentSearch.json
  • plugins/Typesense/v1/dataStreams/searchSummary.json
📍 Affects 2 files
  • plugins/Typesense/v1/dataStreams/documentSearch.json#L11-L15 (this comment)
  • plugins/Typesense/v1/dataStreams/searchSummary.json#L11-L14
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/Typesense/v1/dataStreams/documentSearch.json` around lines 11 - 15,
Require a non-empty query_by whenever q is not "*", while preserving wildcard
searches without query_by, in the request parameter mappings for
plugins/Typesense/v1/dataStreams/documentSearch.json lines 11-15 and
plugins/Typesense/v1/dataStreams/searchSummary.json lines 11-14; update both
streams consistently so invalid Typesense requests cannot be produced.

Comment on lines +5 to +6
result = (data.results || []).flatMap((r, i) =>
(r.hits || []).map((h) => ({ ...h.document, _search: i, _relevance: h.text_match })));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use 1-based search numbering.

multiSearch.json displays _search as “Search #”, but the script assigns zero-based i, so the first search appears as 0. Use i + 1, or rename the field to indicate that it is a zero-based index.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/Typesense/v1/dataStreams/scripts/multiSearch.js` around lines 5 - 6,
Update the _search assignment in the multi-search result mapping to use 1-based
numbering by assigning i + 1, so the first search is displayed as Search `#1`
while preserving the existing result mapping.

Comment on lines +21 to +33
```
curl "https://<host>/keys" \
-X POST \
-H "X-TYPESENSE-API-KEY: <ADMIN_KEY>" \
-H "Content-Type: application/json" \
-d '{"description":"SquaredUp search key","actions":["documents:search"],"collections":["<your-collection>"]}'
```
- Copy the returned `value` — this is your search-only key. It is shown only once.
4. Confirm the key works:
```
curl "https://<host>/collections/<your-collection>/documents/search?q=*&per_page=1" \
-H "X-TYPESENSE-API-KEY: <SEARCH_KEY>"
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Make the setup code fences lint-clean.

The two fenced examples need bash language identifiers and blank lines before and after the fences. Markdownlint reports MD031 and MD040 for these lines.

Proposed formatting fix
    - Using an admin key, call the [Create API Key](https://typesense.org/docs/latest/api/api-keys.html) endpoint with the `documents:search` action, scoped to the collection(s) you want to expose. Example:
+     
-     ```
+     ```bash
      curl "https://<host>/keys" \
...
      -d '{"description":"SquaredUp search key","actions":["documents:search"],"collections":["<your-collection>"]}'
-     ```
+     
...
  4. Confirm the key works:
-  ```
+  
+  ```bash
    curl "https://<host>/collections/<your-collection>/documents/search?q=*&per_page=1" \
      -H "X-TYPESENSE-API-KEY: <SEARCH_KEY>"
-  ```
+  
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
curl "https://<host>/keys" \
-X POST \
-H "X-TYPESENSE-API-KEY: <ADMIN_KEY>" \
-H "Content-Type: application/json" \
-d '{"description":"SquaredUp search key","actions":["documents:search"],"collections":["<your-collection>"]}'
```
- Copy the returned `value` — this is your search-only key. It is shown only once.
4. Confirm the key works:
```
curl "https://<host>/collections/<your-collection>/documents/search?q=*&per_page=1" \
-H "X-TYPESENSE-API-KEY: <SEARCH_KEY>"
```
🧰 Tools
🪛 markdownlint-cli2 (0.23.0)

[warning] 21-21: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 21-21: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 27-27: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 30-30: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


[warning] 30-30: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 33-33: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/Typesense/v1/docs/README.md` around lines 21 - 33, Update the two
setup examples in the README to use bash language identifiers on their fenced
code blocks and add blank lines immediately before and after each fence.
Preserve the existing curl commands and surrounding setup text.

Source: Linters/SAST tools

Comment on lines +13 to +18
"validation": {
"required": true,
"pattern": {
"value": "^https?://[^\\s/]+$",
"message": "Enter the base URL including https:// and no trailing slash or path"
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## Files\n'
git ls-files 'plugins/Typesense/v1/*' | sed 's#^`#-` #'

printf '\n## ui.json (excerpt)\n'
nl -ba plugins/Typesense/v1/ui.json | sed -n '1,120p'

printf '\n## metadata.json\n'
if [ -f plugins/Typesense/v1/metadata.json ]; then
  nl -ba plugins/Typesense/v1/metadata.json | sed -n '1,200p'
fi

printf '\n## Search for Typesense host/url handling\n'
rg -n '"value": "\\^https\\?://|X-TYPESENSE-API-KEY|Typesense' plugins/Typesense -S

Repository: squaredup/plugins

Length of output: 975


🏁 Script executed:

#!/bin/bash
set -euo pipefail
git ls-files 'plugins/Typesense/v1/*'

Repository: squaredup/plugins

Length of output: 873


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## ui.json\n'
sed -n '1,220p' plugins/Typesense/v1/ui.json

printf '\n## metadata.json\n'
sed -n '1,220p' plugins/Typesense/v1/metadata.json

printf '\n## docs/README.md (relevant mentions)\n'
rg -n 'http|https|api key|X-TYPESENSE-API-KEY|base URL|Typesense' plugins/Typesense/v1/docs/README.md -n -C 2

printf '\n## configValidation.json\n'
sed -n '1,220p' plugins/Typesense/v1/configValidation.json

Repository: squaredup/plugins

Length of output: 5932


Require HTTPS for the Typesense host URL.
ui.json still accepts http://, but this connection sends X-TYPESENSE-API-KEY on every request. The help text and docs already describe an https:// base URL, so the validator should match that and reject plaintext HTTP.

Proposed fix
-                "value": "^https?://[^\\s/]+$",
+                "value": "^https://[^\\s/]+$",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"validation": {
"required": true,
"pattern": {
"value": "^https?://[^\\s/]+$",
"message": "Enter the base URL including https:// and no trailing slash or path"
}
"validation": {
"required": true,
"pattern": {
"value": "^https://[^\\s/]+$",
"message": "Enter the base URL including https:// and no trailing slash or path"
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/Typesense/v1/ui.json` around lines 13 - 18, Update the URL pattern in
the validation configuration to accept only https:// Typesense host URLs, while
preserving the existing host-only and no-trailing-slash/path constraints. Keep
the validation message aligned with the HTTPS-only requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-plugin Used to PR newly added plugins

Development

Successfully merging this pull request may close these issues.

1 participant