@tinacms/search 1.2.22 → 1.2.24

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.
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  import * as sw from "stopword";
8
5
  const INDEXABLE_NODE_TYPES = ["text", "code_block", "html"];
9
6
  class StringBuilder {
@@ -14,8 +11,7 @@ class StringBuilder {
14
11
  this.limit = limit;
15
12
  }
16
13
  append(str) {
17
- if (this.length + str.length > this.limit)
18
- return true;
14
+ if (this.length + str.length > this.limit) return true;
19
15
  this.buffer.push(str);
20
16
  this.length += str.length;
21
17
  return this.length > this.limit;
@@ -29,13 +25,11 @@ const tokenizeString = (str) => {
29
25
  };
30
26
  const extractText = (data, builder, nodeTypes) => {
31
27
  var _a;
32
- if (!data)
33
- return;
28
+ if (!data) return;
34
29
  if (nodeTypes.includes(data.type ?? "") && (data.text || data.value)) {
35
30
  const tokens = tokenizeString(data.text || data.value || "");
36
31
  for (const token of tokens) {
37
- if (builder.append(token))
38
- return;
32
+ if (builder.append(token)) return;
39
33
  }
40
34
  }
41
35
  (_a = data.children) == null ? void 0 : _a.forEach((child) => extractText(child, builder, nodeTypes));
@@ -47,8 +41,7 @@ const processTextField = (value, maxLength) => {
47
41
  const tokens = tokenizeString(value);
48
42
  const builder = new StringBuilder(maxLength);
49
43
  for (const part of tokens) {
50
- if (builder.append(part))
51
- break;
44
+ if (builder.append(part)) break;
52
45
  }
53
46
  return builder.toString();
54
47
  };
@@ -99,8 +92,7 @@ const processDocumentForIndexing = (data, path, collection, textIndexLength, fie
99
92
  delete data[f.name];
100
93
  continue;
101
94
  }
102
- if (!data[f.name])
103
- continue;
95
+ if (!data[f.name]) continue;
104
96
  const fieldMaxLength = f.maxSearchIndexFieldLength || textIndexLength;
105
97
  const isList = Boolean(f.list);
106
98
  switch (f.type) {
@@ -156,8 +148,7 @@ const queryToSearchIndexQuery = (query, stopwordLanguages) => {
156
148
  return { AND: filteredParts };
157
149
  };
158
150
  const optionsToSearchIndexOptions = (options) => {
159
- if (!(options == null ? void 0 : options.limit))
160
- return {};
151
+ if (!(options == null ? void 0 : options.limit)) return {};
161
152
  return {
162
153
  PAGE: {
163
154
  SIZE: options.limit,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tinacms/search",
3
3
  "type": "module",
4
- "version": "1.2.22",
4
+ "version": "1.2.24",
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": "^2.1.0",
34
34
  "stopword": "^3.1.4",
35
- "@tinacms/graphql": "2.4.8",
36
- "@tinacms/schema-tools": "2.8.3"
35
+ "@tinacms/schema-tools": "^2.9.0",
36
+ "@tinacms/graphql": "^2.4.10"
37
37
  },
38
38
  "publishConfig": {
39
39
  "registry": "https://registry.npmjs.org"
@@ -49,12 +49,11 @@
49
49
  "@types/search-index": "^3.2.4",
50
50
  "jest": "^29.7.0",
51
51
  "typescript": "^5.7.3",
52
- "@tinacms/scripts": "1.6.2"
52
+ "@tinacms/scripts": "1.6.4"
53
53
  },
54
54
  "scripts": {
55
55
  "types": "pnpm tsc",
56
56
  "build": "tinacms-scripts build",
57
- "docs": "pnpm typedoc",
58
57
  "serve": "pnpm nodemon dist/server.js",
59
58
  "test": "NODE_OPTIONS='--experimental-vm-modules' jest",
60
59
  "test-watch": "NODE_OPTIONS='--experimental-vm-modules' jest --watch"