@tinacms/search 0.0.0-00d7b85-20251222014449
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/LICENSE +184 -0
- package/README.md +55 -0
- package/dist/client/index.d.ts +36 -0
- 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 +28 -0
- package/dist/index-client.js +210 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +683 -0
- package/dist/indexer/index.d.ts +26 -0
- package/dist/indexer/utils.d.ts +3 -0
- package/dist/pagination.d.ts +16 -0
- package/dist/types.d.ts +56 -0
- package/package.json +65 -0
|
@@ -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
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
}
|
|
49
|
+
export type SearchClient = {
|
|
50
|
+
query: (query: string, options?: SearchOptions) => Promise<SearchQueryResponse>;
|
|
51
|
+
put: (docs: IndexableDocument[] | Record<string, unknown>[]) => Promise<void>;
|
|
52
|
+
del: (ids: string[]) => Promise<void>;
|
|
53
|
+
onStartIndexing?: () => Promise<void>;
|
|
54
|
+
onFinishIndexing?: () => Promise<void>;
|
|
55
|
+
supportsClientSideIndexing?: () => boolean;
|
|
56
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tinacms/search",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.0-00d7b85-20251222014449",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./index-client": {
|
|
16
|
+
"types": "./dist/index-client.d.ts",
|
|
17
|
+
"default": "./dist/index-client.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
21
|
+
"buildConfig": {
|
|
22
|
+
"entryPoints": [
|
|
23
|
+
{
|
|
24
|
+
"name": "src/index.ts",
|
|
25
|
+
"target": "node"
|
|
26
|
+
},
|
|
27
|
+
"src/index-client.ts"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"memory-level": "^1.0.0",
|
|
32
|
+
"search-index": "4.0.0",
|
|
33
|
+
"sqlite-level": "^1.2.1",
|
|
34
|
+
"stopword": "^3.1.4",
|
|
35
|
+
"@tinacms/graphql": "0.0.0-00d7b85-20251222014449",
|
|
36
|
+
"@tinacms/schema-tools": "0.0.0-00d7b85-20251222014449"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"registry": "https://registry.npmjs.org"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"url": "https://github.com/tinacms/tinacms.git",
|
|
43
|
+
"directory": "packages/@tinacms/search"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/jest": "^29.5.14",
|
|
47
|
+
"@types/micromatch": "^4.0.9",
|
|
48
|
+
"@types/node": "^22.13.1",
|
|
49
|
+
"@types/search-index": "^3.2.4",
|
|
50
|
+
"jest": "^29.7.0",
|
|
51
|
+
"jest-diff": "^29.7.0",
|
|
52
|
+
"jest-file-snapshot": "^0.7.0",
|
|
53
|
+
"jest-matcher-utils": "^29.7.0",
|
|
54
|
+
"typescript": "^5.7.3",
|
|
55
|
+
"@tinacms/scripts": "1.4.2"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"types": "pnpm tsc",
|
|
59
|
+
"build": "tinacms-scripts build",
|
|
60
|
+
"docs": "pnpm typedoc",
|
|
61
|
+
"serve": "pnpm nodemon dist/server.js",
|
|
62
|
+
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
|
|
63
|
+
"test-watch": "NODE_OPTIONS='--experimental-vm-modules' jest --watch"
|
|
64
|
+
}
|
|
65
|
+
}
|