@delali/narsil 0.3.1-next.144 → 0.3.1-next.145

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 (165) hide show
  1. package/dist/adapters/filesystem.d.ts +1 -1
  2. package/dist/adapters/filesystem.mjs +101 -13
  3. package/dist/adapters/gcs.d.ts +49 -0
  4. package/dist/adapters/gcs.mjs +213 -0
  5. package/dist/adapters/indexeddb.d.ts +1 -1
  6. package/dist/adapters/indexeddb.mjs +2 -7
  7. package/dist/adapters/memory.d.ts +1 -1
  8. package/dist/adapters/memory.mjs +5 -0
  9. package/dist/adapters/s3.d.ts +53 -0
  10. package/dist/adapters/s3.mjs +263 -0
  11. package/dist/{adapters-BQFQ4PRz.d.ts → adapters-pljAqmrC.d.ts} +33 -0
  12. package/dist/{analysis-change-HQUT2Z3I.mjs → analysis-change-D5APH4Z3.mjs} +24 -33
  13. package/dist/{browser/analysis-change-entry-7HR4LWL3.mjs → analysis-change-entry-V4SQQSXQ.mjs} +1 -1
  14. package/dist/browser/{analysis-change-JPV775LR.mjs → analysis-change-QTCQ5ETU.mjs} +5 -5
  15. package/dist/{analysis-change-entry-TZTG4AZB.mjs → browser/analysis-change-entry-KYEQSP3I.mjs} +1 -1
  16. package/dist/{chunk-46NZOPHS.mjs → browser/chunk-5WYWLTM5.mjs} +2 -2
  17. package/dist/browser/{chunk-ZEV26AQ6.mjs → chunk-6OFS7RUN.mjs} +1 -1
  18. package/dist/browser/{chunk-MZI3TEOW.mjs → chunk-75PMIFQA.mjs} +1 -1
  19. package/dist/browser/{chunk-R4WUDZQV.mjs → chunk-AOKLYVTT.mjs} +2 -2
  20. package/dist/browser/{chunk-LVY2LI35.mjs → chunk-BTMRV5MY.mjs} +2 -2
  21. package/dist/browser/{chunk-3ZBJYAS4.mjs → chunk-FHO5N7FD.mjs} +1 -1
  22. package/dist/browser/{chunk-KTOK275N.mjs → chunk-FXPMF65P.mjs} +12 -12
  23. package/dist/browser/{chunk-VFYMPCOV.mjs → chunk-GP4QLUQM.mjs} +5 -5
  24. package/dist/browser/{chunk-35B42UFM.mjs → chunk-IFGTRRPU.mjs} +9 -0
  25. package/dist/browser/{chunk-6RHTAVZX.mjs → chunk-K7UFXEJS.mjs} +31 -14
  26. package/dist/browser/{chunk-MVM33ZUL.mjs → chunk-LGJ6XMH5.mjs} +5 -5
  27. package/dist/{chunk-NN33CZRE.mjs → browser/chunk-PMBSBSCN.mjs} +2 -2
  28. package/dist/browser/{chunk-D33A5VMU.mjs → chunk-QNDWMPV2.mjs} +1 -1
  29. package/dist/browser/{chunk-HKX2G6WH.mjs → chunk-U77XQJOY.mjs} +3 -3
  30. package/dist/browser/{chunk-TCLEOZ4P.mjs → chunk-XIHLIMFX.mjs} +2 -2
  31. package/dist/browser/{chunk-WCFCHIBB.mjs → chunk-XWMEGKDC.mjs} +2 -2
  32. package/dist/browser/{chunk-5DB2VDGI.mjs → chunk-ZALEKEUH.mjs} +27 -27
  33. package/dist/browser/{chunk-MWUK3DA5.mjs → chunk-ZKVDQ5ZH.mjs} +8 -8
  34. package/dist/browser/{cold-module-MJMKNUYJ.mjs → cold-module-Y2IJAP7S.mjs} +14 -14
  35. package/dist/browser/{durability-wiring-SNOWIT6Z.mjs → durability-wiring-MLXZ5QQF.mjs} +78 -61
  36. package/dist/browser/import-FTMLTPGQ.mjs +9 -0
  37. package/dist/browser/{module-BUFNZMEU.mjs → module-5LMDGXQH.mjs} +10 -10
  38. package/dist/browser/{module-BVP4TKZU.mjs → module-Q6VFGLMG.mjs} +71 -11
  39. package/dist/browser/{phrase-module-HGVBO24W.mjs → phrase-module-KXNRTWCS.mjs} +1 -1
  40. package/dist/{restore-queue-FEYAC4SB.mjs → browser/restore-queue-SOAHKZSQ.mjs} +2 -2
  41. package/dist/browser/{runtime-VEUH674B.mjs → runtime-ZNEGK33G.mjs} +2 -2
  42. package/dist/browser/{snapshot-QXBKHJAG.mjs → snapshot-2EGS2FYU.mjs} +16 -15
  43. package/dist/browser/{write-WHFBDWQS.mjs → write-WMZA6NSF.mjs} +11 -11
  44. package/dist/{capabilities-BCdUwK_L.d.ts → capabilities-CNnzGtqP.d.ts} +3 -3
  45. package/dist/{chunk-ZMBFWQXN.mjs → chunk-2E2ZFOPT.mjs} +2 -2
  46. package/dist/{chunk-BOJZGUS6.mjs → chunk-5K2JHKM3.mjs} +1 -1
  47. package/dist/{chunk-YH5OIL7B.mjs → chunk-5QMHMELB.mjs} +6 -1
  48. package/dist/{browser/chunk-CCOAOO73.mjs → chunk-6FOJKNUR.mjs} +2 -2
  49. package/dist/{chunk-GLZHNSGB.mjs → chunk-6Z22L5RN.mjs} +1 -1
  50. package/dist/{chunk-AST3SHFA.mjs → chunk-7523VCM4.mjs} +2 -2
  51. package/dist/{chunk-KZL72VTC.mjs → chunk-7AJAW6NN.mjs} +11 -10
  52. package/dist/{chunk-DQNKVOJ2.mjs → chunk-BTARFTEN.mjs} +695 -8
  53. package/dist/{chunk-YLNSJQLX.mjs → chunk-DHEJAGVW.mjs} +5 -5
  54. package/dist/{chunk-Z4HFMYNX.mjs → chunk-DKMZ7JFW.mjs} +29 -12
  55. package/dist/{chunk-NRUXBYPH.mjs → chunk-F442VZUL.mjs} +5 -5
  56. package/dist/{chunk-O4LJQI4G.mjs → chunk-FRJ5RGX7.mjs} +126 -4
  57. package/dist/{chunk-L76W3IZJ.mjs → chunk-FTQLF5JI.mjs} +1 -1
  58. package/dist/{chunk-UIKN2OTQ.mjs → chunk-G6Q5DEF5.mjs} +37 -3
  59. package/dist/{chunk-DD2673TX.mjs → chunk-GRFXSEFF.mjs} +2 -2
  60. package/dist/{chunk-ZSWHPKGM.mjs → chunk-GVPYMSLO.mjs} +69 -2
  61. package/dist/{chunk-VEFN6X6Q.mjs → chunk-HOC5JP2H.mjs} +9 -10
  62. package/dist/{chunk-SRJBFG2T.mjs → chunk-HTMUGEFU.mjs} +6 -7
  63. package/dist/{chunk-J6YVB2XM.mjs → chunk-IJPK5PGM.mjs} +1 -1
  64. package/dist/{chunk-HNHCNTVG.mjs → chunk-IQHZMCLX.mjs} +9 -0
  65. package/dist/{chunk-C3YDYX6C.mjs → chunk-ISUOSACK.mjs} +1 -1
  66. package/dist/{chunk-YHUTF6EA.mjs → chunk-IV2XTSS2.mjs} +14 -14
  67. package/dist/chunk-K5HSUPYS.mjs +11 -0
  68. package/dist/{chunk-LA4WNDHL.mjs → chunk-KG5N7LE6.mjs} +12 -14
  69. package/dist/{chunk-NPNK57CA.mjs → chunk-LWFK3TC2.mjs} +1 -1
  70. package/dist/{chunk-RKAVHNRW.mjs → chunk-LYKUJNAV.mjs} +10 -5
  71. package/dist/{chunk-TNBIK2LQ.mjs → chunk-MJTEU2XK.mjs} +3 -4
  72. package/dist/chunk-NWTEJ2T7.mjs +100 -0
  73. package/dist/{chunk-WJGO5PGV.mjs → chunk-OH7SX5MY.mjs} +28 -16
  74. package/dist/{chunk-W2COJ5AH.mjs → chunk-ONDEEBTA.mjs} +2 -2
  75. package/dist/{chunk-PWIWSUCX.mjs → chunk-POUYICOU.mjs} +1 -1
  76. package/dist/chunk-PRID7CA6.mjs +104 -0
  77. package/dist/{chunk-ICW45TTU.mjs → chunk-QLDLQW36.mjs} +1 -1
  78. package/dist/{chunk-KEIYVZUX.mjs → chunk-QU2XF7VI.mjs} +3 -4
  79. package/dist/{chunk-74XB2SXI.mjs → chunk-QXH2CS4V.mjs} +35 -2
  80. package/dist/{chunk-ZPWS2SKJ.mjs → chunk-QYMAYU7M.mjs} +165 -11
  81. package/dist/{chunk-NJJCPFXN.mjs → chunk-RNUP6WZ6.mjs} +2 -2
  82. package/dist/{chunk-SBMAWTRG.mjs → chunk-RTVAWNUL.mjs} +80 -14
  83. package/dist/{chunk-7AUASRE7.mjs → chunk-RVBUQITB.mjs} +7 -7
  84. package/dist/{chunk-VJEGOELZ.mjs → chunk-SA52N7G3.mjs} +3 -3
  85. package/dist/{chunk-NOT5QOHU.mjs → chunk-SE7MKJVK.mjs} +1 -1
  86. package/dist/{chunk-BRUUBXCB.mjs → chunk-SNB4DYL3.mjs} +10 -38
  87. package/dist/chunk-SVO6NV4D.mjs +248 -0
  88. package/dist/{chunk-GWOS5DYC.mjs → chunk-UGQULMSU.mjs} +11 -13
  89. package/dist/{chunk-6SNBQESJ.mjs → chunk-UHVTEVF5.mjs} +5 -5
  90. package/dist/{chunk-HJJWY6PT.mjs → chunk-UQS5PAS5.mjs} +1 -1
  91. package/dist/{chunk-UUZCQQG2.mjs → chunk-W6M4RRAT.mjs} +3 -3
  92. package/dist/{browser/chunk-XNWPP5NS.mjs → chunk-WDEWU46C.mjs} +2 -2
  93. package/dist/{chunk-XZ3SRNDJ.mjs → chunk-WMIV7PJ7.mjs} +65 -5
  94. package/dist/{chunk-RHKRTYGO.mjs → chunk-X5SBWARI.mjs} +3 -3
  95. package/dist/{chunk-XS2VM7UE.mjs → chunk-XLAI4OIO.mjs} +2 -2
  96. package/dist/{chunk-IO5F7ZBE.mjs → chunk-YUCGFPMS.mjs} +454 -37
  97. package/dist/{client-B12YFALP.d.ts → client-DoYPHcUn.d.ts} +62 -5
  98. package/dist/client.d.ts +8 -8
  99. package/dist/client.mjs +44 -0
  100. package/dist/{cold-module-4X7WJCFM.mjs → cold-module-NUD332YD.mjs} +32 -41
  101. package/dist/{config-CIG5yDyg.d.ts → config-CuUfls_H.d.ts} +150 -3
  102. package/dist/{config-BhZxIeb1.d.ts → config-Dzs46im6.d.ts} +11 -2
  103. package/dist/direct-executor-FDQYQEJQ.mjs +22 -0
  104. package/dist/distribution/coordinator/etcd.d.ts +3 -3
  105. package/dist/distribution/coordinator/etcd.mjs +1 -1
  106. package/dist/distribution/coordinator/in-memory.d.ts +3 -3
  107. package/dist/distribution/transport/grpc.mjs +4 -4
  108. package/dist/distribution/transport/in-memory.mjs +2 -2
  109. package/dist/distribution/transport/tcp.mjs +3 -3
  110. package/dist/distribution.d.ts +8 -8
  111. package/dist/distribution.mjs +16219 -14535
  112. package/dist/{durability-wiring-324D2DDD.mjs → durability-wiring-K7RDXWL6.mjs} +103 -95
  113. package/dist/embeddings/openai.d.ts +1 -1
  114. package/dist/embeddings/openai.mjs +2 -2
  115. package/dist/{engine-CtzbHOmG.d.ts → engine-C0ifUEcm.d.ts} +3 -3
  116. package/dist/import-6KXFY6XI.mjs +35 -0
  117. package/dist/{index-DsEurhSl.d.ts → index-MsF7e5hL.d.ts} +2 -2
  118. package/dist/index.browser.mjs +4 -4
  119. package/dist/index.d.ts +7 -7
  120. package/dist/index.mjs +21 -30
  121. package/dist/invalidation/broadcast-channel.d.ts +1 -1
  122. package/dist/invalidation/filesystem.d.ts +1 -1
  123. package/dist/invalidation/filesystem.mjs +1 -1
  124. package/dist/invalidation/noop.d.ts +1 -1
  125. package/dist/{long-query-thread-4SW7RWDE.mjs → long-query-thread-FKVHRCHF.mjs} +18 -23
  126. package/dist/{module-DXSJ5LT2.mjs → module-GJUKW5VU.mjs} +14 -16
  127. package/dist/{module-IYPLWHGC.mjs → module-TMFIWOD2.mjs} +28 -37
  128. package/dist/{paged-partition-archive-HFP45PLU.mjs → paged-partition-archive-WNUEMYWM.mjs} +34 -39
  129. package/dist/partial-words.mjs +7 -9
  130. package/dist/pattern.mjs +4 -6
  131. package/dist/persistence/durability/checkpoint-worker.d.ts +2 -2
  132. package/dist/persistence/durability/checkpoint-worker.mjs +27 -36
  133. package/dist/{phrase-module-5QHBD2VJ.mjs → phrase-module-OMY3QQV7.mjs} +1 -1
  134. package/dist/react.d.ts +11 -11
  135. package/dist/react.mjs +9 -0
  136. package/dist/{rerank-KTLC3E6N.mjs → rerank-ZZ5CHKLW.mjs} +4 -4
  137. package/dist/rerankers/http.d.ts +1 -1
  138. package/dist/rerankers/http.mjs +2 -2
  139. package/dist/{browser/restore-queue-ONYNYUDE.mjs → restore-queue-UAVGBSJG.mjs} +2 -2
  140. package/dist/{runtime-DYV75DCB.mjs → runtime-RAOCKSYA.mjs} +5 -5
  141. package/dist/{schema-B-Runv0n.d.ts → schema-D33CyXCy.d.ts} +1 -1
  142. package/dist/server.d.ts +24 -12
  143. package/dist/server.mjs +153 -36
  144. package/dist/{snapshot-CGM65VCD.mjs → snapshot-DB5ZVCDN.mjs} +39 -48
  145. package/dist/synonyms.mjs +3 -4
  146. package/dist/{tasks-CjRJRGTb.d.ts → tasks-ChWp0wrF.d.ts} +59 -7
  147. package/dist/{thread-KGNAIKPD.mjs → thread-OV6T555H.mjs} +17 -22
  148. package/dist/vector/search-worker.d.ts +2 -2
  149. package/dist/vector/search-worker.mjs +5 -6
  150. package/dist/workers/entry.mjs +7 -7
  151. package/dist/{write-2DZPEQL2.mjs → write-KZVTLGCI.mjs} +28 -37
  152. package/openapi.json +349 -2
  153. package/package.json +27 -8
  154. package/dist/browser/import-TLB2A5LJ.mjs +0 -9
  155. package/dist/chunk-5WYVUPGD.mjs +0 -427
  156. package/dist/chunk-AV4IJKD2.mjs +0 -35
  157. package/dist/chunk-GES7U2PM.mjs +0 -68
  158. package/dist/chunk-KGOXHLLZ.mjs +0 -693
  159. package/dist/chunk-N37VMC62.mjs +0 -18
  160. package/dist/chunk-QSK35UC2.mjs +0 -35
  161. package/dist/chunk-WNBRW4Q2.mjs +0 -128
  162. package/dist/chunk-WQBCBKY3.mjs +0 -8
  163. package/dist/chunk-ZATRDAYU.mjs +0 -160
  164. package/dist/direct-executor-7XOQ7VQP.mjs +0 -28
  165. package/dist/import-OOBUW3RR.mjs +0 -44
@@ -1,18 +0,0 @@
1
- // src/core/id-generator.ts
2
- function generateId() {
3
- const bytes = new Uint8Array(16);
4
- crypto.getRandomValues(bytes);
5
- const now = Date.now();
6
- bytes[0] = Math.floor(now / 2 ** 40);
7
- bytes[1] = Math.floor(now / 2 ** 32) % 256;
8
- bytes[2] = Math.floor(now / 2 ** 24) % 256;
9
- bytes[3] = Math.floor(now / 2 ** 16) % 256;
10
- bytes[4] = Math.floor(now / 2 ** 8) % 256;
11
- bytes[5] = now % 256;
12
- bytes[6] = bytes[6] & 15 | 112;
13
- bytes[8] = bytes[8] & 63 | 128;
14
- const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
15
- return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
16
- }
17
-
18
- export { generateId };
@@ -1,35 +0,0 @@
1
- // src/vector/constants.ts
2
- var WASM_PAGE_BYTES = 65536;
3
- var MAX_WASM_PAGES = 65536;
4
- var VECTOR_STORE_INITIAL_CAPACITY = 16;
5
- var VECTOR_BLOCK_INITIAL_SLOTS = 256;
6
- var DISK_STORAGE_BLOCK_BYTES = 67108864;
7
- var MAX_VECTOR_ORDINALS = 16777216;
8
- var UNPLACED_FLAG_CHUNK_ORDINALS = 1024;
9
- var VECTOR_SCRATCH_SLOTS = 64;
10
- var SCRATCH_SLOTS_PER_THREAD_POOL = 31;
11
- var MAX_DOC_ID_TABLE_BYTES = 1073741824;
12
- var MAX_WORKER_COPIES = 64;
13
- var VECTOR_SEARCH_TIMEOUT_MS = 3e4;
14
- var VECTOR_SEARCH_LOAD_TIMEOUT_MS = 3e5;
15
- var VECTOR_INSERT_TIMEOUT_MS = 6e5;
16
- var NATIVE_ATTACH_RETRY_MS = 1e3;
17
- var MAX_RENUMBERED_SEARCH_ATTEMPTS = 3;
18
- var LOCK_SPIN_ITERATIONS = 128;
19
- var LOCK_WAIT_SLICE_MS = 20;
20
- var GRAPH_LOCK_WAIT_SLICE_MS = 1;
21
- var GRAPH_LOCK_WAIT_DEADLINE_MS = 1e4;
22
- var GRAPH_BUILD_DISPATCH_CHUNK = 64;
23
- var GRAPH_BUILD_CHUNKS_IN_FLIGHT_PER_WORKER = 2;
24
-
25
- // src/vector/osq/constants.ts
26
- var OSQ_GRID = { 1: 0.798, 2: 1.493, 4: 2.514, 8: 3.922 };
27
- var OSQ_STEPS = { 1: 1, 2: 3, 4: 15, 8: 255 };
28
- var OSQ_QUERY_BITS = { 1: 4, 2: 4, 4: 4, 8: 8 };
29
- var OSQ_PLACEMENT_QUERY_BITS = { 1: 4, 2: 4, 4: 8, 8: 8 };
30
- var OSQ_LAMBDA = 0.1;
31
- var OSQ_REFINE_ROUNDS = 5;
32
- var OSQ_REFINE_TOLERANCE = 1e-8;
33
- var MIN_OVERSAMPLE = 1;
34
-
35
- export { DISK_STORAGE_BLOCK_BYTES, GRAPH_BUILD_CHUNKS_IN_FLIGHT_PER_WORKER, GRAPH_BUILD_DISPATCH_CHUNK, GRAPH_LOCK_WAIT_DEADLINE_MS, GRAPH_LOCK_WAIT_SLICE_MS, LOCK_SPIN_ITERATIONS, LOCK_WAIT_SLICE_MS, MAX_DOC_ID_TABLE_BYTES, MAX_RENUMBERED_SEARCH_ATTEMPTS, MAX_VECTOR_ORDINALS, MAX_WASM_PAGES, MAX_WORKER_COPIES, MIN_OVERSAMPLE, NATIVE_ATTACH_RETRY_MS, OSQ_GRID, OSQ_LAMBDA, OSQ_PLACEMENT_QUERY_BITS, OSQ_QUERY_BITS, OSQ_REFINE_ROUNDS, OSQ_REFINE_TOLERANCE, OSQ_STEPS, SCRATCH_SLOTS_PER_THREAD_POOL, UNPLACED_FLAG_CHUNK_ORDINALS, VECTOR_BLOCK_INITIAL_SLOTS, VECTOR_INSERT_TIMEOUT_MS, VECTOR_SCRATCH_SLOTS, VECTOR_SEARCH_LOAD_TIMEOUT_MS, VECTOR_SEARCH_TIMEOUT_MS, VECTOR_STORE_INITIAL_CAPACITY, WASM_PAGE_BYTES };
@@ -1,128 +0,0 @@
1
- import { english } from './chunk-TGP5M5R7.mjs';
2
- import { NarsilError, ErrorCodes } from './chunk-HNHCNTVG.mjs';
3
- import { encode, decode } from '@msgpack/msgpack';
4
-
5
- // src/languages/registry.ts
6
- var languages = /* @__PURE__ */ new Map();
7
- languages.set("english", english);
8
- function registerLanguage(module) {
9
- languages.set(module.name, module);
10
- }
11
- function getLanguage(name) {
12
- const lang = languages.get(name);
13
- if (!lang) {
14
- throw new NarsilError(ErrorCodes.LANGUAGE_NOT_SUPPORTED, `Language "${name}" is not registered`, { language: name });
15
- }
16
- return lang;
17
- }
18
-
19
- // src/core/synonyms/constants.ts
20
- var MAX_SYNONYM_RULES = 1e5;
21
- var MAX_SYNONYM_WORDS = 5e5;
22
- var MAX_SYNONYM_WORD_BYTES = 4194304;
23
- var MAX_SYNONYM_RULE_WORDS = 100;
24
- var MIN_TWO_WAY_SYNONYM_WORDS = 2;
25
- var MIN_ONE_WAY_SYNONYMS = 1;
26
- var SYNONYMS_ADDED_PER_QUERY = 50;
27
- var SYNONYM_EXPANSION_CACHE_ENTRIES = 1024;
28
-
29
- // src/core/synonyms/rules.ts
30
- var FIRST_PRINTABLE_CODE = 32;
31
- function holdsControlCharacter(word) {
32
- for (let i = 0; i < word.length; i++) if (word.charCodeAt(i) < FIRST_PRINTABLE_CODE) return true;
33
- return false;
34
- }
35
- function utf8Length(word) {
36
- let bytes = 0;
37
- for (let i = 0; i < word.length; i++) {
38
- const unit = word.charCodeAt(i);
39
- if (unit < 128) bytes += 1;
40
- else if (unit < 2048) bytes += 2;
41
- else if (unit >= 55296 && unit < 56320 && i + 1 < word.length) {
42
- const low = word.charCodeAt(i + 1);
43
- if (low >= 56320 && low < 57344) {
44
- bytes += 4;
45
- i++;
46
- } else bytes += 3;
47
- } else bytes += 3;
48
- }
49
- return bytes;
50
- }
51
- function hasOnlyKeys(value, keys) {
52
- const own = Object.keys(value);
53
- return own.length === keys.length && keys.every((key) => Object.hasOwn(value, key));
54
- }
55
- function readWord(value, rule, tally, raise) {
56
- if (typeof value !== "string") {
57
- raise(`Synonym rule ${rule} holds a word that is not a string`, { rule });
58
- }
59
- if (holdsControlCharacter(value)) {
60
- raise(`Synonym rule ${rule} holds a word with a control character`, { rule });
61
- }
62
- tally.words++;
63
- tally.bytes += utf8Length(value);
64
- if (tally.words > MAX_SYNONYM_WORDS) {
65
- raise(`A synonym set holds at most ${MAX_SYNONYM_WORDS} words`, { maxWords: MAX_SYNONYM_WORDS });
66
- }
67
- if (tally.bytes > MAX_SYNONYM_WORD_BYTES) {
68
- raise(`The words of a synonym set hold at most ${MAX_SYNONYM_WORD_BYTES} bytes in UTF-8`, {
69
- maxWordBytes: MAX_SYNONYM_WORD_BYTES
70
- });
71
- }
72
- return value;
73
- }
74
- function readWords(value, rule, key, minimum, maximum, tally, raise) {
75
- if (!Array.isArray(value) || value.length < minimum || value.length > maximum) {
76
- raise(`Synonym rule ${rule} needs "${key}" as a list of ${minimum} to ${maximum} words`, { rule });
77
- }
78
- const words = new Array(value.length);
79
- for (let i = 0; i < value.length; i++) words[i] = readWord(value[i], rule, tally, raise);
80
- return words;
81
- }
82
- function readRule(value, rule, tally, raise) {
83
- if (value === null || typeof value !== "object" || Array.isArray(value)) {
84
- raise(`Synonym rule ${rule} must be an object`, { rule });
85
- }
86
- if (hasOnlyKeys(value, ["words"])) {
87
- const words = Reflect.get(value, "words");
88
- return { words: readWords(words, rule, "words", MIN_TWO_WAY_SYNONYM_WORDS, MAX_SYNONYM_RULE_WORDS, tally, raise) };
89
- }
90
- if (hasOnlyKeys(value, ["word", "synonyms"])) {
91
- const word = readWord(Reflect.get(value, "word"), rule, tally, raise);
92
- const synonyms = readWords(
93
- Reflect.get(value, "synonyms"),
94
- rule,
95
- "synonyms",
96
- MIN_ONE_WAY_SYNONYMS,
97
- MAX_SYNONYM_RULE_WORDS - 1,
98
- tally,
99
- raise
100
- );
101
- return { word, synonyms };
102
- }
103
- raise(`Synonym rule ${rule} must hold either "words" alone, or "word" and "synonyms"`, { rule });
104
- }
105
- function parseSynonymRules(value, raise) {
106
- if (!Array.isArray(value)) raise("A synonym set must be a list of rules", {});
107
- if (value.length > MAX_SYNONYM_RULES) {
108
- raise(`A synonym set holds at most ${MAX_SYNONYM_RULES} rules`, { maxRules: MAX_SYNONYM_RULES });
109
- }
110
- const tally = { words: 0, bytes: 0 };
111
- const rules = new Array(value.length);
112
- for (let rule = 0; rule < value.length; rule++) rules[rule] = readRule(value[rule], rule, tally, raise);
113
- return rules;
114
- }
115
- function encodeSynonymRules(rules) {
116
- return encode(rules);
117
- }
118
- function decodeSynonymRules(bytes, raise) {
119
- let decoded;
120
- try {
121
- decoded = decode(bytes);
122
- } catch {
123
- raise("A stored synonym set is not valid MessagePack", {});
124
- }
125
- return parseSynonymRules(decoded, raise);
126
- }
127
-
128
- export { SYNONYMS_ADDED_PER_QUERY, SYNONYM_EXPANSION_CACHE_ENTRIES, decodeSynonymRules, encodeSynonymRules, getLanguage, parseSynonymRules, registerLanguage };
@@ -1,8 +0,0 @@
1
- // src/filters/constants.ts
2
- var MAX_FILTER_DEPTH = 30;
3
- var MAX_FILTER_TESTS = 1024;
4
- var FILTER_OPERAND_COPY_DEPTH = 3;
5
- var MAX_FILTER_ARRAY_SIZE = 65536;
6
- var GEO_UNIT_METRES = { km: 1e3, mi: 1609.344, m: 1 };
7
-
8
- export { FILTER_OPERAND_COPY_DEPTH, GEO_UNIT_METRES, MAX_FILTER_ARRAY_SIZE, MAX_FILTER_DEPTH, MAX_FILTER_TESTS };
@@ -1,160 +0,0 @@
1
- import { youngGenerationBytesOfThisV8 } from './chunk-EBIHRL7B.mjs';
2
- import { PROCESS_LIMIT_REFRESH_INTERVAL_MS } from './chunk-22YPZVMG.mjs';
3
- import { totalmem, freemem } from 'os';
4
- import { getHeapSpaceStatistics, getHeapStatistics } from 'v8';
5
-
6
- var MEGABYTE_BYTES = 1048576;
7
- var IN_MEGABYTES = /^--max-old-space-size=(\d+)$/;
8
- var AS_PERCENTAGE = /^--max-old-space-size-percentage=(\d+(?:\.\d+)?)$/;
9
- var SEMI_SPACE_IN_MEGABYTES = /^--max-semi-space-size=(\d+)$/;
10
- var YOUNG_GENERATION_SPACES = /* @__PURE__ */ new Set(["new_space", "new_large_object_space"]);
11
- var V8_YOUNG_GENERATION_BYTES_PER_SEMI_SPACE_BYTE = 3;
12
- function flagEntries() {
13
- const fromNodeOptions = (process.env.NODE_OPTIONS ?? "").split(/\s+/).filter((entry) => entry.length > 0);
14
- return [...process.execArgv, ...fromNodeOptions];
15
- }
16
- function memoryTheHostAllows() {
17
- const constrained = process.constrainedMemory?.() ?? 0;
18
- return constrained > 0 ? constrained : totalmem();
19
- }
20
- function readConfiguredOldSpaceMegabytes() {
21
- let megabytes = null;
22
- for (const entry of flagEntries()) {
23
- const inMegabytes = IN_MEGABYTES.exec(entry);
24
- if (inMegabytes !== null) megabytes = Number(inMegabytes[1]);
25
- if (AS_PERCENTAGE.test(entry)) megabytes = null;
26
- }
27
- return megabytes !== null && Number.isFinite(megabytes) && megabytes > 0 ? megabytes : null;
28
- }
29
- function readConfiguredLimit() {
30
- let megabytes = null;
31
- let percentage = null;
32
- for (const entry of flagEntries()) {
33
- const inMegabytes = IN_MEGABYTES.exec(entry);
34
- if (inMegabytes !== null) {
35
- megabytes = Number(inMegabytes[1]);
36
- percentage = null;
37
- }
38
- const asPercentage = AS_PERCENTAGE.exec(entry);
39
- if (asPercentage !== null) {
40
- percentage = Number(asPercentage[1]);
41
- megabytes = null;
42
- }
43
- }
44
- const bytes = megabytes !== null && megabytes > 0 ? megabytes * MEGABYTE_BYTES : percentage !== null && percentage > 0 && percentage <= 100 ? Math.floor(memoryTheHostAllows() * percentage / 100) : null;
45
- return bytes !== null && Number.isFinite(bytes) && bytes > 0 ? bytes : null;
46
- }
47
- var configuredLimit;
48
- function configuredLimitBytes() {
49
- if (configuredLimit === void 0) configuredLimit = readConfiguredLimit();
50
- return configuredLimit;
51
- }
52
- function readConfiguredYoungGeneration() {
53
- let megabytes = 0;
54
- for (const entry of flagEntries()) {
55
- const semiSpace = SEMI_SPACE_IN_MEGABYTES.exec(entry);
56
- if (semiSpace !== null) megabytes = Number(semiSpace[1]);
57
- }
58
- if (!Number.isFinite(megabytes) || megabytes <= 0) return null;
59
- const semiSpaceBytes = 2 ** Math.ceil(Math.log2(megabytes)) * MEGABYTE_BYTES;
60
- return semiSpaceBytes * V8_YOUNG_GENERATION_BYTES_PER_SEMI_SPACE_BYTE;
61
- }
62
- var configuredYoungGeneration;
63
- function configuredYoungGenerationBytes() {
64
- if (configuredYoungGeneration === void 0) configuredYoungGeneration = readConfiguredYoungGeneration();
65
- return configuredYoungGeneration;
66
- }
67
- var heapSizeLimit;
68
- function heapSizeLimitBytes() {
69
- if (heapSizeLimit === void 0) heapSizeLimit = getHeapStatistics().heap_size_limit;
70
- return heapSizeLimit;
71
- }
72
- function readYoungGenerationCeiling() {
73
- const fromSemiSpace = configuredYoungGenerationBytes();
74
- if (fromSemiSpace !== null) return fromSemiSpace;
75
- const oldSpaceMegabytes = readConfiguredOldSpaceMegabytes();
76
- if (oldSpaceMegabytes !== null) {
77
- const beyondOldSpace = heapSizeLimitBytes() - oldSpaceMegabytes * MEGABYTE_BYTES;
78
- if (beyondOldSpace > 0) return beyondOldSpace;
79
- }
80
- return youngGenerationBytesOfThisV8();
81
- }
82
- var youngGenerationCeiling;
83
- function youngGenerationCeilingBytes() {
84
- if (youngGenerationCeiling === void 0) youngGenerationCeiling = readYoungGenerationCeiling();
85
- return youngGenerationCeiling;
86
- }
87
- function readOldGenerationStatistics() {
88
- try {
89
- let usedBytes = 0;
90
- let committedBytes = 0;
91
- let youngCapacityBytes = 0;
92
- let youngUsedBytes = 0;
93
- for (const space of getHeapSpaceStatistics()) {
94
- if (YOUNG_GENERATION_SPACES.has(space.space_name)) {
95
- youngCapacityBytes += space.space_size;
96
- youngUsedBytes += space.space_used_size;
97
- } else {
98
- usedBytes += space.space_used_size;
99
- committedBytes += space.space_size;
100
- }
101
- }
102
- const youngCeilingBytes = youngGenerationCeilingBytes();
103
- const limitBytes2 = configuredLimitBytes() ?? heapSizeLimitBytes() - youngCeilingBytes;
104
- if (!Number.isFinite(usedBytes) || !Number.isFinite(limitBytes2) || limitBytes2 <= 0) return null;
105
- return {
106
- usedBytes,
107
- limitBytes: limitBytes2,
108
- youngUsedBytes: Number.isFinite(youngUsedBytes) ? youngUsedBytes : 0,
109
- committedBytes: Number.isFinite(committedBytes) ? committedBytes : usedBytes,
110
- youngReserveBytes: Number.isFinite(youngCapacityBytes) ? Math.max(0, youngCeilingBytes - youngCapacityBytes) : 0,
111
- youngCeilingBytes
112
- };
113
- } catch {
114
- return null;
115
- }
116
- }
117
- function readHeapStatistics() {
118
- try {
119
- const stats = getHeapStatistics();
120
- const usedBytes = stats.used_heap_size;
121
- const limitBytes2 = stats.heap_size_limit;
122
- if (!Number.isFinite(usedBytes) || !Number.isFinite(limitBytes2) || limitBytes2 <= 0) return null;
123
- const available = stats.total_available_size;
124
- const availableBytes = Number.isFinite(available) && available >= 0 ? available : null;
125
- return { usedBytes, limitBytes: limitBytes2, availableBytes, configuredLimitBytes: configuredLimitBytes() };
126
- } catch {
127
- return null;
128
- }
129
- }
130
- var limitBytes = 0;
131
- var limitReadAt = Number.NEGATIVE_INFINITY;
132
- function readProcessLimit(residentBytes) {
133
- const hostBytes = totalmem();
134
- const constrained = typeof process.constrainedMemory === "function" ? process.constrainedMemory() : 0;
135
- if (Number.isFinite(constrained) && constrained > 0 && constrained < hostBytes) return constrained;
136
- if (process.platform !== "linux") return hostBytes;
137
- const availableBytes = freemem();
138
- if (!Number.isFinite(availableBytes) || availableBytes < 0) return hostBytes;
139
- return Math.min(hostBytes, residentBytes + availableBytes);
140
- }
141
- function processLimitBytes(residentBytes) {
142
- const now = performance.now();
143
- if (now - limitReadAt >= PROCESS_LIMIT_REFRESH_INTERVAL_MS) {
144
- limitBytes = readProcessLimit(residentBytes);
145
- limitReadAt = now;
146
- }
147
- return limitBytes;
148
- }
149
- function readResidentMemory() {
150
- try {
151
- const residentBytes = process.memoryUsage.rss();
152
- const limitBytes2 = processLimitBytes(residentBytes);
153
- if (!Number.isFinite(residentBytes) || !Number.isFinite(limitBytes2) || limitBytes2 <= 0) return null;
154
- return { residentBytes, limitBytes: limitBytes2 };
155
- } catch {
156
- return null;
157
- }
158
- }
159
-
160
- export { processLimitBytes, readHeapStatistics, readOldGenerationStatistics, readResidentMemory };
@@ -1,28 +0,0 @@
1
- export { createDirectExecutor } from './chunk-WJGO5PGV.mjs';
2
- import './chunk-ZPWS2SKJ.mjs';
3
- import './chunk-N37VMC62.mjs';
4
- import './chunk-ZATRDAYU.mjs';
5
- import './chunk-EBIHRL7B.mjs';
6
- import './chunk-RKAVHNRW.mjs';
7
- import './chunk-WQBCBKY3.mjs';
8
- import './chunk-JUKYYXSP.mjs';
9
- import './chunk-DQNKVOJ2.mjs';
10
- import './chunk-KGOXHLLZ.mjs';
11
- import './chunk-U476IXKQ.mjs';
12
- import './chunk-FQBFZAWG.mjs';
13
- import './chunk-VJS4JFBQ.mjs';
14
- import './chunk-GES7U2PM.mjs';
15
- import './chunk-ZSWHPKGM.mjs';
16
- import './chunk-O4LJQI4G.mjs';
17
- import './chunk-X5CV2E2B.mjs';
18
- import './chunk-WNBRW4Q2.mjs';
19
- import './chunk-TGP5M5R7.mjs';
20
- import './chunk-U2BKYEC7.mjs';
21
- import './chunk-NPNK57CA.mjs';
22
- import './chunk-4UMZ7KQL.mjs';
23
- import './chunk-R6A773WK.mjs';
24
- import './chunk-YTJCGKM4.mjs';
25
- import './chunk-GLZHNSGB.mjs';
26
- import './chunk-22YPZVMG.mjs';
27
- import './chunk-L5ORED7V.mjs';
28
- import './chunk-HNHCNTVG.mjs';
@@ -1,44 +0,0 @@
1
- export { DOCUMENT_EXPORT_FORMAT, DOCUMENT_EXPORT_VERSION, readDocumentExport } from './chunk-6SNBQESJ.mjs';
2
- import './chunk-BOJZGUS6.mjs';
3
- import './chunk-CZQ33DLW.mjs';
4
- import './chunk-L76W3IZJ.mjs';
5
- import './chunk-IO5F7ZBE.mjs';
6
- import './chunk-VEFN6X6Q.mjs';
7
- import './chunk-5WYVUPGD.mjs';
8
- import './chunk-HJSN7UYG.mjs';
9
- import './chunk-UIKN2OTQ.mjs';
10
- import './chunk-AV4IJKD2.mjs';
11
- import './chunk-EEBCDP36.mjs';
12
- import './chunk-WJGO5PGV.mjs';
13
- import './chunk-ZPWS2SKJ.mjs';
14
- import './chunk-N37VMC62.mjs';
15
- import './chunk-ZATRDAYU.mjs';
16
- import './chunk-EBIHRL7B.mjs';
17
- import './chunk-KOKM4PQN.mjs';
18
- import './chunk-QSK35UC2.mjs';
19
- import './chunk-74XB2SXI.mjs';
20
- import './chunk-RKAVHNRW.mjs';
21
- import './chunk-WQBCBKY3.mjs';
22
- import './chunk-JUKYYXSP.mjs';
23
- import './chunk-DQNKVOJ2.mjs';
24
- import './chunk-KGOXHLLZ.mjs';
25
- import './chunk-U476IXKQ.mjs';
26
- import './chunk-FQBFZAWG.mjs';
27
- import './chunk-VJS4JFBQ.mjs';
28
- import './chunk-GES7U2PM.mjs';
29
- import './chunk-ZSWHPKGM.mjs';
30
- import './chunk-O4LJQI4G.mjs';
31
- import './chunk-X5CV2E2B.mjs';
32
- import './chunk-WNBRW4Q2.mjs';
33
- import './chunk-TGP5M5R7.mjs';
34
- import './chunk-U2BKYEC7.mjs';
35
- import './chunk-NPNK57CA.mjs';
36
- import './chunk-4UMZ7KQL.mjs';
37
- import './chunk-R6A773WK.mjs';
38
- import './chunk-YTJCGKM4.mjs';
39
- import './chunk-QHPYS427.mjs';
40
- import './chunk-GLZHNSGB.mjs';
41
- import './chunk-22YPZVMG.mjs';
42
- import './chunk-RFBLQLLZ.mjs';
43
- import './chunk-L5ORED7V.mjs';
44
- import './chunk-HNHCNTVG.mjs';