@tinacms/search 0.0.0-bf8b9b7-20251204000148 → 0.0.0-c19d29e-20251224001156
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 +55 -0
- package/dist/client/index.d.ts +10 -13
- package/dist/fuzzy/cache.d.ts +11 -0
- package/dist/fuzzy/distance.d.ts +8 -0
- package/dist/fuzzy/index.d.ts +4 -0
- package/dist/fuzzy/types.d.ts +19 -0
- package/dist/fuzzy-search-wrapper.d.ts +23 -0
- package/dist/index-client.d.ts +25 -15
- package/dist/index-client.js +141 -134
- package/dist/index.d.ts +8 -3
- package/dist/index.js +496 -163
- package/dist/indexer/index.d.ts +1 -0
- package/dist/indexer/utils.d.ts +1 -1
- package/dist/pagination.d.ts +16 -0
- package/dist/types.d.ts +51 -11
- package/package.json +6 -6
package/dist/indexer/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare class SearchIndexer {
|
|
|
15
15
|
private readonly schema;
|
|
16
16
|
private readonly textIndexLength;
|
|
17
17
|
constructor(options: SearchIndexOptions);
|
|
18
|
+
private createBatchProcessor;
|
|
18
19
|
private makeIndexerCallback;
|
|
19
20
|
indexContentByPaths(documentPaths: string[]): Promise<void>;
|
|
20
21
|
indexAllContent(): Promise<{
|
package/dist/indexer/utils.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Collection, ObjectField } from '@tinacms/schema-tools';
|
|
2
|
-
export declare const processDocumentForIndexing: (data:
|
|
2
|
+
export declare const processDocumentForIndexing: (data: Record<string, unknown>, path: string, collection: Collection, textIndexLength: number, field?: ObjectField) => Record<string, unknown>;
|
|
3
3
|
export declare const lookupStopwords: (keys?: string[], defaultStopWords?: string[]) => string[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface PaginationOptions {
|
|
2
|
+
limit?: number;
|
|
3
|
+
cursor?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface PageOptions {
|
|
6
|
+
PAGE?: {
|
|
7
|
+
SIZE: number;
|
|
8
|
+
NUMBER: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface PaginationCursors {
|
|
12
|
+
nextCursor: string | null;
|
|
13
|
+
prevCursor: string | null;
|
|
14
|
+
}
|
|
15
|
+
export declare function buildPageOptions(options: PaginationOptions): PageOptions;
|
|
16
|
+
export declare function buildPaginationCursors(total: number, options: PaginationOptions): PaginationCursors;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,15 +1,55 @@
|
|
|
1
|
+
import type { FuzzySearchOptions, FuzzyMatch } from './fuzzy';
|
|
2
|
+
export interface SearchOptions {
|
|
3
|
+
cursor?: string;
|
|
4
|
+
limit?: number;
|
|
5
|
+
fuzzy?: boolean;
|
|
6
|
+
fuzzyOptions?: FuzzySearchOptions;
|
|
7
|
+
}
|
|
8
|
+
export interface SearchResult {
|
|
9
|
+
_id: string;
|
|
10
|
+
_match: Record<string, string[]>;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface SearchQueryResponse {
|
|
14
|
+
results: SearchResult[];
|
|
15
|
+
total: number;
|
|
16
|
+
nextCursor: string | null;
|
|
17
|
+
prevCursor: string | null;
|
|
18
|
+
fuzzyMatches?: Record<string, FuzzyMatch[]>;
|
|
19
|
+
}
|
|
20
|
+
export interface IndexableDocument {
|
|
21
|
+
_id: string;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface SearchIndexResult {
|
|
25
|
+
RESULT: SearchResult[];
|
|
26
|
+
RESULT_LENGTH: number;
|
|
27
|
+
}
|
|
28
|
+
export interface SearchIndex {
|
|
29
|
+
PUT: (docs: IndexableDocument[]) => Promise<void>;
|
|
30
|
+
DELETE: (ids: string[]) => Promise<void>;
|
|
31
|
+
QUERY: (query: {
|
|
32
|
+
AND: string[];
|
|
33
|
+
} | {
|
|
34
|
+
OR: string[];
|
|
35
|
+
} | {
|
|
36
|
+
AND: (string | {
|
|
37
|
+
OR: string[];
|
|
38
|
+
})[];
|
|
39
|
+
}, options?: {
|
|
40
|
+
PAGE?: {
|
|
41
|
+
NUMBER: number;
|
|
42
|
+
SIZE: number;
|
|
43
|
+
};
|
|
44
|
+
}) => Promise<SearchIndexResult>;
|
|
45
|
+
DICTIONARY: (token?: {
|
|
46
|
+
FIELD: string;
|
|
47
|
+
}) => Promise<unknown[]>;
|
|
48
|
+
}
|
|
1
49
|
export type SearchClient = {
|
|
2
|
-
query: (query: string, options?:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) => Promise<{
|
|
6
|
-
results: any[];
|
|
7
|
-
total: number;
|
|
8
|
-
nextCursor: string | null;
|
|
9
|
-
prevCursor: string | null;
|
|
10
|
-
}>;
|
|
11
|
-
put: (docs: any[]) => Promise<any>;
|
|
12
|
-
del: (ids: string[]) => Promise<any>;
|
|
50
|
+
query: (query: string, options?: SearchOptions) => Promise<SearchQueryResponse>;
|
|
51
|
+
put: (docs: IndexableDocument[] | Record<string, unknown>[]) => Promise<void>;
|
|
52
|
+
del: (ids: string[]) => Promise<void>;
|
|
13
53
|
onStartIndexing?: () => Promise<void>;
|
|
14
54
|
onFinishIndexing?: () => Promise<void>;
|
|
15
55
|
supportsClientSideIndexing?: () => boolean;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/search",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-c19d29e-20251224001156",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"search-index": "4.0.0",
|
|
33
33
|
"sqlite-level": "^1.2.1",
|
|
34
34
|
"stopword": "^3.1.4",
|
|
35
|
-
"@tinacms/
|
|
36
|
-
"@tinacms/
|
|
35
|
+
"@tinacms/graphql": "0.0.0-c19d29e-20251224001156",
|
|
36
|
+
"@tinacms/schema-tools": "0.0.0-c19d29e-20251224001156"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"registry": "https://registry.npmjs.org"
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"jest-file-snapshot": "^0.7.0",
|
|
53
53
|
"jest-matcher-utils": "^29.7.0",
|
|
54
54
|
"typescript": "^5.7.3",
|
|
55
|
-
"@tinacms/scripts": "1.4.
|
|
55
|
+
"@tinacms/scripts": "1.4.2"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"types": "pnpm tsc",
|
|
59
59
|
"build": "tinacms-scripts build",
|
|
60
60
|
"docs": "pnpm typedoc",
|
|
61
61
|
"serve": "pnpm nodemon dist/server.js",
|
|
62
|
-
"test": "jest",
|
|
63
|
-
"test-watch": "jest --watch"
|
|
62
|
+
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
|
|
63
|
+
"test-watch": "NODE_OPTIONS='--experimental-vm-modules' jest --watch"
|
|
64
64
|
}
|
|
65
65
|
}
|