@tinacms/search 1.0.44 → 1.0.46

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -15
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -65,7 +65,6 @@ var StringBuilder = class {
65
65
  }
66
66
  };
67
67
  var extractText = (data, acc, indexableNodeTypes) => {
68
- var _a, _b;
69
68
  if (data) {
70
69
  if (indexableNodeTypes.indexOf(data.type) !== -1 && (data.text || data.value)) {
71
70
  const tokens = tokenizeString(data.text || data.value);
@@ -75,8 +74,7 @@ var extractText = (data, acc, indexableNodeTypes) => {
75
74
  }
76
75
  }
77
76
  }
78
- (_b = (_a = data.children) == null ? void 0 : _a.forEach) == null ? void 0 : _b.call(
79
- _a,
77
+ data.children?.forEach?.(
80
78
  (child) => extractText(child, acc, indexableNodeTypes)
81
79
  );
82
80
  }
@@ -103,7 +101,7 @@ var processDocumentForIndexing = (data, path, collection, textIndexLength, field
103
101
  data["_id"] = `${collection.name}:${relPath}`;
104
102
  data["_relativePath"] = relPath;
105
103
  }
106
- for (const f of (field == null ? void 0 : field.fields) || collection.fields || []) {
104
+ for (const f of field?.fields || collection.fields || []) {
107
105
  if (!f.searchable) {
108
106
  delete data[f.name];
109
107
  continue;
@@ -215,7 +213,6 @@ var SearchIndexer = class {
215
213
  };
216
214
  }
217
215
  async indexContentByPaths(documentPaths) {
218
- var _a, _b, _c, _d;
219
216
  let batch = [];
220
217
  const itemCallback = async (item) => {
221
218
  batch.push(item);
@@ -224,7 +221,7 @@ var SearchIndexer = class {
224
221
  batch = [];
225
222
  }
226
223
  };
227
- await ((_b = (_a = this.client).onStartIndexing) == null ? void 0 : _b.call(_a));
224
+ await this.client.onStartIndexing?.();
228
225
  await (0, import_graphql.scanContentByPaths)(
229
226
  this.schema,
230
227
  documentPaths,
@@ -233,11 +230,10 @@ var SearchIndexer = class {
233
230
  if (batch.length > 0) {
234
231
  await this.client.put(batch);
235
232
  }
236
- await ((_d = (_c = this.client).onFinishIndexing) == null ? void 0 : _d.call(_c));
233
+ await this.client.onFinishIndexing?.();
237
234
  }
238
235
  async indexAllContent() {
239
- var _a, _b, _c, _d;
240
- await ((_b = (_a = this.client).onStartIndexing) == null ? void 0 : _b.call(_a));
236
+ await this.client.onStartIndexing?.();
241
237
  let batch = [];
242
238
  const itemCallback = async (item) => {
243
239
  batch.push(item);
@@ -254,14 +250,13 @@ var SearchIndexer = class {
254
250
  if (batch.length > 0) {
255
251
  await this.client.put(batch);
256
252
  }
257
- await ((_d = (_c = this.client).onFinishIndexing) == null ? void 0 : _d.call(_c));
253
+ await this.client.onFinishIndexing?.();
258
254
  return { warnings };
259
255
  }
260
256
  async deleteIndexContent(documentPaths) {
261
- var _a, _b, _c, _d;
262
- await ((_b = (_a = this.client).onStartIndexing) == null ? void 0 : _b.call(_a));
257
+ await this.client.onStartIndexing?.();
263
258
  await this.client.del(documentPaths);
264
- await ((_d = (_c = this.client).onFinishIndexing) == null ? void 0 : _d.call(_c));
259
+ await this.client.onFinishIndexing?.();
265
260
  }
266
261
  };
267
262
 
@@ -269,7 +264,7 @@ var SearchIndexer = class {
269
264
  var import_sqlite_level = require("sqlite-level");
270
265
  var import_search_index = __toESM(require("search-index"));
271
266
  var import_memory_level = require("memory-level");
272
- var zlib = __toESM(require("zlib"));
267
+ var zlib = __toESM(require("node:zlib"));
273
268
  var DEFAULT_TOKEN_SPLIT_REGEX = /[\p{L}\d_]+/gu;
274
269
  var LocalSearchIndexClient = class {
275
270
  constructor(options) {
@@ -337,7 +332,7 @@ var TinaCMSSearchIndexClient = class extends LocalSearchIndexClient {
337
332
  console.error("Failed to parse error response", e);
338
333
  }
339
334
  throw new Error(
340
- `Failed to get upload url. Status: ${res.status}${(json == null ? void 0 : json.message) ? ` - ${json.message}` : ``}`
335
+ `Failed to get upload url. Status: ${res.status}${json?.message ? ` - ${json.message}` : ``}`
341
336
  );
342
337
  }
343
338
  const { signedUrl } = await res.json();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/search",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index-client.mjs",
6
6
  "typings": "dist/index.d.ts",
@@ -33,8 +33,8 @@
33
33
  "search-index": "4.0.0",
34
34
  "sqlite-level": "^1.2.1",
35
35
  "stopword": "^3.1.4",
36
- "@tinacms/graphql": "1.5.17",
37
- "@tinacms/schema-tools": "1.7.3"
36
+ "@tinacms/graphql": "1.5.19",
37
+ "@tinacms/schema-tools": "1.8.0"
38
38
  },
39
39
  "publishConfig": {
40
40
  "registry": "https://registry.npmjs.org"
@@ -53,7 +53,7 @@
53
53
  "jest-file-snapshot": "^0.7.0",
54
54
  "jest-matcher-utils": "^29.7.0",
55
55
  "typescript": "^5.7.3",
56
- "@tinacms/scripts": "1.3.4"
56
+ "@tinacms/scripts": "1.3.5"
57
57
  },
58
58
  "scripts": {
59
59
  "types": "pnpm tsc",