@dbx-tools/shared-search 0.9.131 → 0.9.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -25
- package/index.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# @dbx-tools/shared-search
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Validate Databricks AI Search requests, results, index catalogs, and document
|
|
4
|
+
writes in browser and server code. It defines the browser-safe extension
|
|
5
|
+
contracts shared by [@dbx-tools/search](../../node/search), Mastra tools, and
|
|
6
|
+
[@dbx-tools/ui/search](../../ui/appkit).
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
with [`@dbx-tools/search`](../../node/search).
|
|
8
|
-
|
|
9
|
-
## Quick Start
|
|
8
|
+
## Quick start
|
|
10
9
|
|
|
11
10
|
```ts
|
|
12
11
|
import { searchSchemas } from "@dbx-tools/shared-search";
|
|
@@ -18,7 +17,7 @@ const request = searchSchemas.searchRequestSchema.parse({
|
|
|
18
17
|
});
|
|
19
18
|
```
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
The schemas cover:
|
|
22
21
|
|
|
23
22
|
- Shared `SearchRequest` / `SearchResult` contract with `{ id, score, fields }`
|
|
24
23
|
hits, so an autocomplete box, a docs lookup, and a Mastra tool speak one shape.
|
|
@@ -27,12 +26,12 @@ Key features:
|
|
|
27
26
|
- `UniversalSearchRequest` for federated search across several indexes at once.
|
|
28
27
|
- `SearchDocument` / `UpsertResult` for adding and updating direct-access index
|
|
29
28
|
contents.
|
|
30
|
-
- `SearchIndexInfo` / `SearchClientConfig` for the boot-time index
|
|
29
|
+
- `SearchIndexInfo` / `SearchClientConfig` for the boot-time index catalog a
|
|
31
30
|
search box reads with no server round-trip.
|
|
32
31
|
- Model/tool-friendly schemas that avoid JSON Schema constraints known to cause
|
|
33
32
|
problems with some serving endpoints.
|
|
34
33
|
|
|
35
|
-
##
|
|
34
|
+
## Validate request options
|
|
36
35
|
|
|
37
36
|
```ts
|
|
38
37
|
import { searchSchemas, type SearchRequest } from "@dbx-tools/shared-search";
|
|
@@ -46,40 +45,52 @@ const request: SearchRequest = searchSchemas.searchRequestSchema.parse({
|
|
|
46
45
|
});
|
|
47
46
|
```
|
|
48
47
|
|
|
49
|
-
## Validate
|
|
48
|
+
## Validate search results
|
|
50
49
|
|
|
51
50
|
```ts
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
import { searchSchemas } from "@dbx-tools/shared-search";
|
|
52
|
+
|
|
53
|
+
const response = await fetch("/api/ai-search/docs/query", {
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers: { "content-type": "application/json" },
|
|
56
|
+
body: JSON.stringify({ query: "reset my password", limit: 5 }),
|
|
57
|
+
});
|
|
58
|
+
if (!response.ok) throw new Error(`Search failed with ${response.status}`);
|
|
59
|
+
const result = searchSchemas.searchResultSchema.parse(await response.json());
|
|
60
|
+
const titles = result.hits.map((hit) => hit.fields.title);
|
|
56
61
|
```
|
|
57
62
|
|
|
58
63
|
`searchHitSchema` returns the requested columns under `fields`, keyed by column
|
|
59
64
|
name, plus the primary-key `id` and a relevance `score`. A federated hit also
|
|
60
65
|
carries the `index` it came from.
|
|
61
66
|
|
|
62
|
-
## Read
|
|
67
|
+
## Read the index catalog
|
|
63
68
|
|
|
64
69
|
```ts
|
|
65
|
-
|
|
70
|
+
import { searchSchemas } from "@dbx-tools/shared-search";
|
|
71
|
+
|
|
72
|
+
const config = searchSchemas.searchClientConfigSchema.parse(
|
|
66
73
|
await fetch("/api/search/indexes").then((r) => r.json()),
|
|
67
74
|
);
|
|
68
75
|
```
|
|
69
76
|
|
|
70
|
-
`searchClientConfigSchema`
|
|
71
|
-
Single-index UI queries read
|
|
77
|
+
`searchClientConfigSchema` validates the extension catalog used for universal
|
|
78
|
+
search. Single-index UI queries read AppKit's published `aiSearch` client
|
|
79
|
+
configuration instead.
|
|
80
|
+
|
|
81
|
+
## Runtime boundary
|
|
72
82
|
|
|
73
|
-
|
|
83
|
+
This package doesn't query indexes, read Databricks credentials, or choose a
|
|
84
|
+
search backend. Use [@dbx-tools/search](../../node/search) for runtime search,
|
|
85
|
+
index management, Mastra tools, and the AppKit plugin. Use
|
|
86
|
+
[@dbx-tools/ui/search](../../ui/appkit) for React controls.
|
|
74
87
|
|
|
75
|
-
|
|
88
|
+
## Package exports
|
|
89
|
+
|
|
90
|
+
- `searchSchemas`: `searchModeSchema`, `searchRequestSchema`, `searchHitSchema`,
|
|
76
91
|
`searchResultSchema`, `universalSearchRequestSchema`, `searchDocumentSchema`,
|
|
77
92
|
`upsertResultSchema`, `searchIndexInfoSchema`, `searchClientConfigSchema`, and
|
|
78
|
-
`toAiSearchQueryType`,
|
|
93
|
+
`toAiSearchQueryType`, and
|
|
79
94
|
the flat inferred types (`SearchMode`, `SearchRequest`, `SearchHit`,
|
|
80
95
|
`SearchResult`, `UniversalSearchRequest`, `SearchDocument`, `UpsertResult`,
|
|
81
96
|
`SearchIndexInfo`, `SearchClientConfig`).
|
|
82
|
-
|
|
83
|
-
Runtime search, index management, the Mastra tools, and the AppKit plugin live
|
|
84
|
-
in [`@dbx-tools/search`](../../node/search). The React search box lives in
|
|
85
|
-
[`@dbx-tools/ui/search`](../../ui/appkit).
|
package/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Hand edits are overwritten on the next watch; this file is read-only.
|
|
4
4
|
|
|
5
5
|
export const PACKAGE_IDENTIFIER = "@dbx-tools/shared-search";
|
|
6
|
-
export const PACKAGE_VERSION = "0.9.
|
|
6
|
+
export const PACKAGE_VERSION = "0.9.132";
|
|
7
7
|
export * as searchSchemas from "./src/search-schemas.ts";
|
|
8
8
|
export { searchModeSchema, aiSearchQueryTypeSchema, searchRequestSchema, searchHitSchema, searchResultSchema, universalSearchRequestSchema, searchDocumentSchema, upsertResultSchema, searchIndexInfoSchema, searchClientConfigSchema, createIndexRequestSchema, syncIndexRequestSchema, indexInfoSchema } from "./src/search-schemas.ts";
|
|
9
9
|
export type { SearchMode, AiSearchQueryType, SearchRequest, SearchHit, SearchResult, UniversalSearchRequest, SearchDocument, UpsertResult, SearchIndexInfo, SearchClientConfig, CreateIndexRequest, SyncIndexRequest, IndexInfo } from "./src/search-schemas.ts";
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const PACKAGE_IDENTIFIER = "@dbx-tools/shared-search";
|
|
2
|
-
export declare const PACKAGE_VERSION = "0.9.
|
|
2
|
+
export declare const PACKAGE_VERSION = "0.9.132";
|
|
3
3
|
export * as searchSchemas from "./src/search-schemas.ts";
|
|
4
4
|
export { searchModeSchema, aiSearchQueryTypeSchema, searchRequestSchema, searchHitSchema, searchResultSchema, universalSearchRequestSchema, searchDocumentSchema, upsertResultSchema, searchIndexInfoSchema, searchClientConfigSchema, createIndexRequestSchema, syncIndexRequestSchema, indexInfoSchema } from "./src/search-schemas.ts";
|
|
5
5
|
export type { SearchMode, AiSearchQueryType, SearchRequest, SearchHit, SearchResult, UniversalSearchRequest, SearchDocument, UpsertResult, SearchIndexInfo, SearchClientConfig, CreateIndexRequest, SyncIndexRequest, IndexInfo } from "./src/search-schemas.ts";
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Regenerated from the exporting modules in ./src.
|
|
3
3
|
// Hand edits are overwritten on the next watch; this file is read-only.
|
|
4
4
|
export const PACKAGE_IDENTIFIER = "@dbx-tools/shared-search";
|
|
5
|
-
export const PACKAGE_VERSION = "0.9.
|
|
5
|
+
export const PACKAGE_VERSION = "0.9.132";
|
|
6
6
|
export * as searchSchemas from "./src/search-schemas.js";
|
|
7
7
|
export { searchModeSchema, aiSearchQueryTypeSchema, searchRequestSchema, searchHitSchema, searchResultSchema, universalSearchRequestSchema, searchDocumentSchema, upsertResultSchema, searchIndexInfoSchema, searchClientConfigSchema, createIndexRequestSchema, syncIndexRequestSchema, indexInfoSchema } from "./src/search-schemas.js";
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQ0FBMkM7QUFDM0MsbURBQW1EO0FBQ25ELHdFQUF3RTtBQUV4RSxNQUFNLENBQUMsTUFBTSxrQkFBa0IsR0FBRywwQkFBMEIsQ0FBQztBQUM3RCxNQUFNLENBQUMsTUFBTSxlQUFlLEdBQUcsU0FBUyxDQUFDO0FBQ3pDLE9BQU8sS0FBSyxhQUFhLE1BQU0seUJBQXlCLENBQUM7QUFDekQsT0FBTyxFQUFFLGdCQUFnQixFQUFFLHVCQUF1QixFQUFFLG1CQUFtQixFQUFFLGVBQWUsRUFBRSxrQkFBa0IsRUFBRSw0QkFBNEIsRUFBRSxvQkFBb0IsRUFBRSxrQkFBa0IsRUFBRSxxQkFBcUIsRUFBRSx3QkFBd0IsRUFBRSx3QkFBd0IsRUFBRSxzQkFBc0IsRUFBRSxlQUFlLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8vIEdFTkVSQVRFRCBieSBwcm9qZW4gd2F0Y2ggLSBETyBOT1QgRURJVC5cbi8vIFJlZ2VuZXJhdGVkIGZyb20gdGhlIGV4cG9ydGluZyBtb2R1bGVzIGluIC4vc3JjLlxuLy8gSGFuZCBlZGl0cyBhcmUgb3ZlcndyaXR0ZW4gb24gdGhlIG5leHQgd2F0Y2g7IHRoaXMgZmlsZSBpcyByZWFkLW9ubHkuXG5cbmV4cG9ydCBjb25zdCBQQUNLQUdFX0lERU5USUZJRVIgPSBcIkBkYngtdG9vbHMvc2hhc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