@tinacms/search 0.0.0-ecea7ac-20241011043815 → 0.0.0-ee8d9a3-20250429131017

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.
@@ -213,3 +213,4 @@
213
213
  exports2.queryToSearchIndexQuery = queryToSearchIndexQuery;
214
214
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
215
215
  });
216
+ //# sourceMappingURL=index-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-client.js","sources":["../src/indexer/utils.ts","../src/index-client.ts"],"sourcesContent":["import { Collection, ObjectField } from '@tinacms/schema-tools';\nimport * as sw from 'stopword';\n\nclass StringBuilder {\n private readonly buffer: string[];\n public length = 0;\n private readonly limit: number;\n constructor(limit: number) {\n this.buffer = [];\n this.limit = limit;\n }\n\n public append(str: string) {\n if (this.length + str.length > this.limit) {\n return true;\n } else {\n this.buffer.push(str);\n this.length += str.length;\n if (this.length > this.limit) {\n return true;\n }\n return false;\n }\n }\n\n public toString() {\n // NOTE this is going to add some length to the final string beyond the limit\n return this.buffer.join(' ');\n }\n}\n\nconst extractText = (\n data: any,\n acc: StringBuilder,\n indexableNodeTypes: string[]\n) => {\n if (data) {\n if (\n indexableNodeTypes.indexOf(data.type) !== -1 &&\n (data.text || data.value)\n ) {\n const tokens = tokenizeString(data.text || data.value);\n for (const token of tokens) {\n if (acc.append(token)) {\n return;\n }\n }\n }\n\n data.children?.forEach?.((child: any) =>\n extractText(child, acc, indexableNodeTypes)\n );\n }\n};\n\nconst relativePath = (path: string, collection: Collection) => {\n return path\n .replace(/\\\\/g, '/')\n .replace(collection.path, '')\n .replace(/^\\/|\\/$/g, '');\n};\n\nconst tokenizeString = (str: string) => {\n return str\n .split(/[\\s\\.,]+/)\n .map((s) => s.toLowerCase())\n .filter((s) => s);\n};\n\nconst processTextFieldValue = (value: string, maxLen: number) => {\n const tokens = tokenizeString(value);\n const builder = new StringBuilder(maxLen);\n for (const part of tokens) {\n if (builder.append(part)) {\n break;\n }\n }\n return builder.toString();\n};\n\nexport const processDocumentForIndexing = (\n data: any,\n path: string,\n collection: Collection,\n textIndexLength: number,\n field?: ObjectField\n) => {\n if (!field) {\n const relPath = relativePath(path, collection);\n data['_id'] = `${collection.name}:${relPath}`;\n data['_relativePath'] = relPath;\n }\n for (const f of field?.fields || collection.fields || []) {\n if (!f.searchable) {\n delete data[f.name];\n continue;\n }\n const isList = f.list;\n if (data[f.name]) {\n if (f.type === 'object') {\n if (isList) {\n data[f.name] = data[f.name].map((obj: any) =>\n processDocumentForIndexing(\n obj,\n path,\n collection,\n textIndexLength,\n f\n )\n );\n } else {\n data[f.name] = processDocumentForIndexing(\n data[f.name],\n path,\n collection,\n textIndexLength,\n f\n );\n }\n } else if (f.type === 'string') {\n const fieldTextIndexLength =\n f.maxSearchIndexFieldLength || textIndexLength;\n if (isList) {\n data[f.name] = data[f.name].map((value: string) =>\n processTextFieldValue(value, fieldTextIndexLength)\n );\n } else {\n data[f.name] = processTextFieldValue(\n data[f.name],\n fieldTextIndexLength\n );\n }\n } else if (f.type === 'rich-text') {\n const fieldTextIndexLength =\n f.maxSearchIndexFieldLength || textIndexLength;\n if (isList) {\n data[f.name] = data[f.name].map((value: any) => {\n const acc = new StringBuilder(fieldTextIndexLength);\n extractText(value, acc, ['text', 'code_block', 'html']);\n return acc.toString();\n });\n } else {\n const acc = new StringBuilder(fieldTextIndexLength);\n extractText(data[f.name], acc, ['text', 'code_block', 'html']);\n data[f.name] = acc.toString();\n }\n }\n }\n }\n return data;\n};\n\nconst memo: Record<string, string[]> = {};\nexport const lookupStopwords = (\n keys?: string[],\n defaultStopWords: string[] = sw.eng\n) => {\n let stopwords = defaultStopWords;\n if (keys) {\n if (memo[keys.join(',')]) {\n return memo[keys.join(',')];\n }\n stopwords = [];\n for (const key of keys) {\n stopwords.push(...sw[key]);\n }\n memo[keys.join(',')] = stopwords;\n }\n return stopwords;\n};\n","export type { SearchClient } from './types';\nexport { processDocumentForIndexing } from './indexer/utils';\nimport { lookupStopwords } from './indexer/utils';\n\nexport const queryToSearchIndexQuery = (\n query: string,\n stopwordLanguages?: string[]\n) => {\n let q;\n const parts = query.split(' ');\n const stopwords = lookupStopwords(stopwordLanguages);\n if (parts.length === 1) {\n q = { AND: [parts[0]] };\n } else {\n // TODO only allow AND for now - need parser\n q = {\n AND: parts.filter(\n (part) =>\n part.toLowerCase() !== 'and' &&\n stopwords.indexOf(part.toLowerCase()) === -1\n ),\n };\n }\n return q;\n};\n\nexport const optionsToSearchIndexOptions = (options?: {\n limit?: number;\n cursor?: string;\n}) => {\n const opt = {};\n if (options?.limit) {\n opt['PAGE'] = {\n SIZE: options.limit,\n NUMBER: options?.cursor ? parseInt(options.cursor) : 0,\n };\n }\n return opt;\n};\n\nexport const parseSearchIndexResponse = (\n data: any,\n options?: {\n limit?: number;\n cursor?: string;\n }\n) => {\n const results = data['RESULT'];\n const total = data['RESULT_LENGTH'];\n if (options?.cursor && options?.limit) {\n const prevCursor =\n options.cursor === '0' ? null : (parseInt(options.cursor) - 1).toString();\n const nextCursor =\n total <= (parseInt(options.cursor) + 1) * options.limit\n ? null\n : (parseInt(options.cursor) + 1).toString();\n return {\n results,\n total,\n prevCursor,\n nextCursor,\n };\n } else if (!options?.cursor && options?.limit) {\n const prevCursor = null;\n const nextCursor = total <= options.limit ? null : '1';\n return {\n results,\n total,\n prevCursor,\n nextCursor,\n };\n } else {\n return {\n results,\n total,\n prevCursor: null,\n nextCursor: null,\n };\n }\n};\n"],"names":["sw"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAGA,MAAM,cAAc;AAAA,IAIlB,YAAY,OAAe;AAF3B,WAAO,SAAS;AAGd,WAAK,SAAS;AACd,WAAK,QAAQ;AAAA,IACf;AAAA,IAEO,OAAO,KAAa;AACzB,UAAI,KAAK,SAAS,IAAI,SAAS,KAAK,OAAO;AAClC,eAAA;AAAA,MAAA,OACF;AACA,aAAA,OAAO,KAAK,GAAG;AACpB,aAAK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EzD;AACO,WAAA;AAAA,EACT;AAEa,QAAA,2BAA2B,CACtC,MACA,YAIG;AACG,UAAA,UAAU,KAAK,QAAQ;AACvB,UAAA,QAAQ,KAAK,eAAe;AAC9B,SAAA,mCAAS,YAAU,mCAAS,QAAO;AAC/B,YAAA,aACJ,QAAQ,WAAW,MAAM,QAAQ,SAAS,QAAQ,MAAM,IAAI,GAAG,SAAS;AAC1E,YAAM,aACJ,UAAU,SAAS,QAAQ,MAAM,IAAI,KAAK,QAAQ,QAC9C,QACC,SAAS,QAAQ,MAAM,IAAI,GAAG;AAC9B,aAAA;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IAEO,WAAA,EAAC,mCAAS,YAAU,mCAAS,QAAO;AAC7C,YAAM,aAAa;AACnB,YAAM,aAAa,SAAS,QAAQ,QAAQ,OAAO;AAC5C,aAAA;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF,OACK;AACE,aAAA;AAAA,QACL;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ,YAAY;AAAA,MAAA;AAAA,IAEhB;AAAA,EACF;;;;;;;"}
@@ -193,3 +193,4 @@ export {
193
193
  processDocumentForIndexing,
194
194
  queryToSearchIndexQuery
195
195
  };
196
+ //# sourceMappingURL=index-client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-client.mjs","sources":["../src/indexer/utils.ts","../src/index-client.ts"],"sourcesContent":["import { Collection, ObjectField } from '@tinacms/schema-tools';\nimport * as sw from 'stopword';\n\nclass StringBuilder {\n private readonly buffer: string[];\n public length = 0;\n private readonly limit: number;\n constructor(limit: number) {\n this.buffer = [];\n this.limit = limit;\n }\n\n public append(str: string) {\n if (this.length + str.length > this.limit) {\n return true;\n } else {\n this.buffer.push(str);\n this.length += str.length;\n if (this.length > this.limit) {\n return true;\n }\n return false;\n }\n }\n\n public toString() {\n // NOTE this is going to add some length to the final string beyond the limit\n return this.buffer.join(' ');\n }\n}\n\nconst extractText = (\n data: any,\n acc: StringBuilder,\n indexableNodeTypes: string[]\n) => {\n if (data) {\n if (\n indexableNodeTypes.indexOf(data.type) !== -1 &&\n (data.text || data.value)\n ) {\n const tokens = tokenizeString(data.text || data.value);\n for (const token of tokens) {\n if (acc.append(token)) {\n return;\n }\n }\n }\n\n data.children?.forEach?.((child: any) =>\n extractText(child, acc, indexableNodeTypes)\n );\n }\n};\n\nconst relativePath = (path: string, collection: Collection) => {\n return path\n .replace(/\\\\/g, '/')\n .replace(collection.path, '')\n .replace(/^\\/|\\/$/g, '');\n};\n\nconst tokenizeString = (str: string) => {\n return str\n .split(/[\\s\\.,]+/)\n .map((s) => s.toLowerCase())\n .filter((s) => s);\n};\n\nconst processTextFieldValue = (value: string, maxLen: number) => {\n const tokens = tokenizeString(value);\n const builder = new StringBuilder(maxLen);\n for (const part of tokens) {\n if (builder.append(part)) {\n break;\n }\n }\n return builder.toString();\n};\n\nexport const processDocumentForIndexing = (\n data: any,\n path: string,\n collection: Collection,\n textIndexLength: number,\n field?: ObjectField\n) => {\n if (!field) {\n const relPath = relativePath(path, collection);\n data['_id'] = `${collection.name}:${relPath}`;\n data['_relativePath'] = relPath;\n }\n for (const f of field?.fields || collection.fields || []) {\n if (!f.searchable) {\n delete data[f.name];\n continue;\n }\n const isList = f.list;\n if (data[f.name]) {\n if (f.type === 'object') {\n if (isList) {\n data[f.name] = data[f.name].map((obj: any) =>\n processDocumentForIndexing(\n obj,\n path,\n collection,\n textIndexLength,\n f\n )\n );\n } else {\n data[f.name] = processDocumentForIndexing(\n data[f.name],\n path,\n collection,\n textIndexLength,\n f\n );\n }\n } else if (f.type === 'string') {\n const fieldTextIndexLength =\n f.maxSearchIndexFieldLength || textIndexLength;\n if (isList) {\n data[f.name] = data[f.name].map((value: string) =>\n processTextFieldValue(value, fieldTextIndexLength)\n );\n } else {\n data[f.name] = processTextFieldValue(\n data[f.name],\n fieldTextIndexLength\n );\n }\n } else if (f.type === 'rich-text') {\n const fieldTextIndexLength =\n f.maxSearchIndexFieldLength || textIndexLength;\n if (isList) {\n data[f.name] = data[f.name].map((value: any) => {\n const acc = new StringBuilder(fieldTextIndexLength);\n extractText(value, acc, ['text', 'code_block', 'html']);\n return acc.toString();\n });\n } else {\n const acc = new StringBuilder(fieldTextIndexLength);\n extractText(data[f.name], acc, ['text', 'code_block', 'html']);\n data[f.name] = acc.toString();\n }\n }\n }\n }\n return data;\n};\n\nconst memo: Record<string, string[]> = {};\nexport const lookupStopwords = (\n keys?: string[],\n defaultStopWords: string[] = sw.eng\n) => {\n let stopwords = defaultStopWords;\n if (keys) {\n if (memo[keys.join(',')]) {\n return memo[keys.join(',')];\n }\n stopwords = [];\n for (const key of keys) {\n stopwords.push(...sw[key]);\n }\n memo[keys.join(',')] = stopwords;\n }\n return stopwords;\n};\n","export type { SearchClient } from './types';\nexport { processDocumentForIndexing } from './indexer/utils';\nimport { lookupStopwords } from './indexer/utils';\n\nexport const queryToSearchIndexQuery = (\n query: string,\n stopwordLanguages?: string[]\n) => {\n let q;\n const parts = query.split(' ');\n const stopwords = lookupStopwords(stopwordLanguages);\n if (parts.length === 1) {\n q = { AND: [parts[0]] };\n } else {\n // TODO only allow AND for now - need parser\n q = {\n AND: parts.filter(\n (part) =>\n part.toLowerCase() !== 'and' &&\n stopwords.indexOf(part.toLowerCase()) === -1\n ),\n };\n }\n return q;\n};\n\nexport const optionsToSearchIndexOptions = (options?: {\n limit?: number;\n cursor?: string;\n}) => {\n const opt = {};\n if (options?.limit) {\n opt['PAGE'] = {\n SIZE: options.limit,\n NUMBER: options?.cursor ? parseInt(options.cursor) : 0,\n };\n }\n return opt;\n};\n\nexport const parseSearchIndexResponse = (\n data: any,\n options?: {\n limit?: number;\n cursor?: string;\n }\n) => {\n const results = data['RESULT'];\n const total = data['RESULT_LENGTH'];\n if (options?.cursor && options?.limit) {\n const prevCursor =\n options.cursor === '0' ? null : (parseInt(options.cursor) - 1).toString();\n const nextCursor =\n total <= (parseInt(options.cursor) + 1) * options.limit\n ? null\n : (parseInt(options.cursor) + 1).toString();\n return {\n results,\n total,\n prevCursor,\n nextCursor,\n };\n } else if (!options?.cursor && options?.limit) {\n const prevCursor = null;\n const nextCursor = total <= options.limit ? null : '1';\n return {\n results,\n total,\n prevCursor,\n nextCursor,\n };\n } else {\n return {\n results,\n total,\n prevCursor: null,\n nextCursor: null,\n };\n }\n};\n"],"names":[],"mappings":";AAGA,MAAM,cAAc;AAAA,EAIlB,YAAY,OAAe;AAF3B,SAAO,SAAS;AAGd,SAAK,SAAS;AACd,SAAK,QAAQ;AAAA,EACf;AAAA,EAEO,OAAO,KAAa;AACzB,QAAI,KAAK,SAAS,IAAI,SAAS,KAAK,OAAO;AAClC,aAAA;AAAA,IAAA,OACF;AACA,WAAA,OAAO,KAAK,GAAG;AACpB,WAAK,UAAU,IAAI;AACf,UAAA,KAAK,SAAS,KAAK,OAAO;AACrB,eAAA;AAAA,MACT;AACO,aAAA;AAAA,IACT;AAAA,EACF;AAAA,EAEO,WAAW;AAET,WAAA,KAAK,OAAO,KAAK,GAAG;AAAA,EAC7B;AACF;AAEA,MAAM,cAAc,CAClB,MACA,KACA,uBACG;;AACH,MAAI,MAAM;AAEN,QAAA,mBAAmB,QAAQ,KAAK,IAAI,MAAM,OACzC,KAAK,QAAQ,KAAK,QACnB;AACA,YAAM,SAAS,eAAe,KAAK,QAAQ,KAAK,KAAK;AACrD,iBAAW,SAAS,QAAQ;AACtB,YAAA,IAAI,OAAO,KAAK,GAAG;AACrB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,qBAAK,aAAL,mBAAe,YAAf;AAAA;AAAA,MAAyB,CAAC,UACxB,YAAY,OAAO,KAAK,kBAAkB;AAAA;AAAA,EAE9C;AACF;AAEA,MAAM,eAAe,CAAC,MAAc,eAA2B;AAC7D,SAAO,KACJ,QAAQ,OAAO,GAAG,EAClB,QAAQ,WAAW,MAAM,EAAE,EAC3B,QAAQ,YAAY,EAA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, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
23
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
28
 
25
29
  // src/index.ts
26
- var src_exports = {};
27
- __export(src_exports, {
30
+ var index_exports = {};
31
+ __export(index_exports, {
28
32
  LocalSearchIndexClient: () => LocalSearchIndexClient,
29
33
  SearchIndexer: () => SearchIndexer,
30
34
  TinaCMSSearchIndexClient: () => TinaCMSSearchIndexClient,
31
35
  si: () => import_search_index2.default
32
36
  });
33
- module.exports = __toCommonJS(src_exports);
37
+ module.exports = __toCommonJS(index_exports);
34
38
  var import_search_index2 = __toESM(require("search-index"));
35
39
 
36
40
  // src/indexer/index.ts
@@ -275,6 +279,7 @@ var LocalSearchIndexClient = class {
275
279
  }
276
280
  async onStartIndexing() {
277
281
  this.searchIndex = await (0, import_search_index.default)({
282
+ // @ts-ignore
278
283
  db: this.memoryLevel,
279
284
  stopwords: this.stopwords,
280
285
  tokenSplitRegex: this.tokenSplitRegex
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/search",
3
- "version": "0.0.0-ecea7ac-20241011043815",
3
+ "version": "0.0.0-ee8d9a3-20250429131017",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index-client.mjs",
6
6
  "typings": "dist/index.d.ts",
@@ -31,10 +31,10 @@
31
31
  "dependencies": {
32
32
  "memory-level": "^1.0.0",
33
33
  "search-index": "4.0.0",
34
- "sqlite-level": "^1.2.0",
35
- "stopword": "^3.1.1",
36
- "@tinacms/graphql": "0.0.0-ecea7ac-20241011043815",
37
- "@tinacms/schema-tools": "0.0.0-ecea7ac-20241011043815"
34
+ "sqlite-level": "^1.2.1",
35
+ "stopword": "^3.1.4",
36
+ "@tinacms/graphql": "0.0.0-ee8d9a3-20250429131017",
37
+ "@tinacms/schema-tools": "1.7.3"
38
38
  },
39
39
  "publishConfig": {
40
40
  "registry": "https://registry.npmjs.org"
@@ -44,16 +44,16 @@
44
44
  "directory": "packages/@tinacms/search"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/jest": "^29.5.13",
47
+ "@types/jest": "^29.5.14",
48
48
  "@types/micromatch": "^4.0.9",
49
- "@types/node": "^22.7.4",
49
+ "@types/node": "^22.13.1",
50
50
  "@types/search-index": "^3.2.4",
51
51
  "jest": "^29.7.0",
52
52
  "jest-diff": "^29.7.0",
53
53
  "jest-file-snapshot": "^0.7.0",
54
54
  "jest-matcher-utils": "^29.7.0",
55
- "typescript": "^5.6.2",
56
- "@tinacms/scripts": "0.0.0-ecea7ac-20241011043815"
55
+ "typescript": "^5.7.3",
56
+ "@tinacms/scripts": "1.3.4"
57
57
  },
58
58
  "scripts": {
59
59
  "types": "pnpm tsc",