@delali/narsil 0.3.1-next.155 → 0.3.1-next.157
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/NOTICE +45 -0
- package/dist/{analysis-change-3TFIHT5E.mjs → analysis-change-CKEMM2MC.mjs} +25 -18
- package/dist/{react-native/chunks/analysis-change-entry-JLL42PH6.mjs → analysis-change-entry-SEDMJ6MW.mjs} +1 -1
- package/dist/browser/{analysis-change-TC36BU47.mjs → analysis-change-ZKGJFENM.mjs} +42 -32
- package/dist/{analysis-change-entry-KA6JAO4X.mjs → browser/analysis-change-entry-5BFUVMHJ.mjs} +1 -1
- package/dist/browser/{chunk-KKAMCABR.mjs → chunk-25MTVDYD.mjs} +1 -1
- package/dist/browser/{chunk-K5AXJBLL.mjs → chunk-3NLMB5CC.mjs} +3 -3
- package/dist/browser/{chunk-23XRXIBW.mjs → chunk-5YWB3E2W.mjs} +8 -1
- package/dist/browser/chunk-AI5UI46D.mjs +12 -0
- package/dist/browser/{chunk-A5KUEGDY.mjs → chunk-BLT4RHCJ.mjs} +3 -3
- package/dist/browser/{chunk-RRO3EV4C.mjs → chunk-C26SPCGQ.mjs} +8 -7
- package/dist/browser/{chunk-ABCXENU5.mjs → chunk-C4FJ3WDY.mjs} +1 -1
- package/dist/browser/{chunk-3UIEB4QF.mjs → chunk-CXNTHHA7.mjs} +2 -2
- package/dist/browser/{chunk-JIJXMI42.mjs → chunk-DUH6QUVU.mjs} +547 -2
- package/dist/browser/chunk-EKMGCRSR.mjs +61 -0
- package/dist/browser/{chunk-JVBP5EYO.mjs → chunk-GFAZPSWK.mjs} +7 -7
- package/dist/browser/{chunk-CJSYBQ4J.mjs → chunk-HUCSHDTB.mjs} +1 -1
- package/dist/browser/{chunk-RND5CLX3.mjs → chunk-K3IPRX6D.mjs} +52 -21
- package/dist/browser/chunk-MY2XKH22.mjs +40 -0
- package/dist/browser/{chunk-SMEQ36NT.mjs → chunk-N23GL72Q.mjs} +629 -1416
- package/dist/browser/{chunk-LFIWRCEA.mjs → chunk-NXQG7DRA.mjs} +29 -6
- package/dist/browser/{chunk-26A5JFT2.mjs → chunk-TK63WFXK.mjs} +2 -1
- package/dist/browser/{chunk-4EWUGZYZ.mjs → chunk-U4YDIBUT.mjs} +2 -2
- package/dist/browser/{chunk-RQBUNZQW.mjs → chunk-UATIJ4KU.mjs} +2 -2
- package/dist/browser/{chunk-BXM5XOCA.mjs → chunk-UKOWD2K5.mjs} +3 -3
- package/dist/browser/{chunk-FNIFPFB7.mjs → chunk-UTMHUHUV.mjs} +2 -2
- package/dist/browser/{chunk-56W3HQVJ.mjs → chunk-V43N6TZO.mjs} +5 -5
- package/dist/browser/{chunk-K4GCSZLI.mjs → chunk-VLJQW4J6.mjs} +2985 -2985
- package/dist/browser/{chunk-IKDKX5VQ.mjs → chunk-VY5KW3HN.mjs} +3 -3
- package/dist/browser/{chunk-5TCXK5SB.mjs → chunk-WN464PTL.mjs} +1 -1
- package/dist/browser/{chunk-SUDNZKPL.mjs → chunk-X7TXYUKO.mjs} +1 -1
- package/dist/browser/{chunk-XY4VVBBO.mjs → chunk-Y6IBAUNO.mjs} +2 -86
- package/dist/browser/{cold-module-NEUGHUPA.mjs → cold-module-YNUUDNOM.mjs} +18 -15
- package/dist/browser/{durability-wiring-CVGPRO6D.mjs → durability-wiring-GVZEE46O.mjs} +71 -27
- package/dist/browser/{engine-hooks-YXMPHZKZ.mjs → engine-hooks-HBVS6YM4.mjs} +8 -6
- package/dist/browser/geo-index-OTV7VPIR.mjs +1387 -0
- package/dist/browser/{import-OM6QAW45.mjs → import-5ESVMFDJ.mjs} +9 -7
- package/dist/browser/{module-E33X4AOK.mjs → module-NDSQLPMQ.mjs} +14 -11
- package/dist/browser/{module-3HNFCBJ5.mjs → module-TCT66FWA.mjs} +6 -6
- package/dist/browser/{phrase-module-ZXXU7S3B.mjs → phrase-module-HAT3TLZN.mjs} +1 -1
- package/dist/{release-BH3DKW3T.mjs → browser/release-HYXPVJVS.mjs} +0 -1
- package/dist/browser/{restore-hooks-IF2ZROUP.mjs → restore-hooks-IE3GGYHG.mjs} +11 -9
- package/dist/browser/{restore-queue-ZBS7CJA6.mjs → restore-queue-LQBBTODR.mjs} +3 -3
- package/dist/browser/{retention-ASWUHAYI.mjs → retention-TY3L3BFN.mjs} +11 -9
- package/dist/browser/{snapshot-PN7ZW6Q4.mjs → snapshot-5FHPPCNZ.mjs} +27 -24
- package/dist/browser/{start-ZIRB7MQ2.mjs → start-2UZTOBG5.mjs} +12 -10
- package/dist/browser/{write-HMDYCTV2.mjs → write-ULXAN5B4.mjs} +14 -11
- package/dist/{capabilities-Da4ywVVl.d.ts → capabilities-D3AoBJoF.d.ts} +2 -2
- package/dist/{chunk-KBKEXQZA.mjs → chunk-24FNVRKB.mjs} +1 -1
- package/dist/{chunk-VHBNF4MA.mjs → chunk-2ROUFMQX.mjs} +2 -2
- package/dist/{chunk-AILVAOLX.mjs → chunk-4B7JIGQD.mjs} +2 -2
- package/dist/{chunk-DCNKVEDB.mjs → chunk-4LMSZAK6.mjs} +16 -6
- package/dist/{chunk-RSVULW4Q.mjs → chunk-4ZTHGTVX.mjs} +4 -4
- package/dist/{chunk-VQEUR6T6.mjs → chunk-5VV4R6P7.mjs} +3040 -3040
- package/dist/chunk-6HTGOXIK.mjs +875 -0
- package/dist/chunk-7GFE3PEY.mjs +40 -0
- package/dist/{chunk-JUKYYXSP.mjs → chunk-7V5IUP2T.mjs} +1 -31
- package/dist/{chunk-4BYWRYPM.mjs → chunk-A4L7YTKX.mjs} +52 -89
- package/dist/{chunk-J4IWBIVY.mjs → chunk-BNL5OPRV.mjs} +6 -6
- package/dist/{chunk-BY6ZDGYS.mjs → chunk-C7XQYG6U.mjs} +2 -2
- package/dist/{chunk-LC3FDWTX.mjs → chunk-CITFCZKF.mjs} +3 -2
- package/dist/{chunk-KXCVQWOR.mjs → chunk-CQZXZ75V.mjs} +3 -97
- package/dist/{chunk-SY3EWKQY.mjs → chunk-CWS55TEX.mjs} +2 -2
- package/dist/{chunk-3HHQLEEQ.mjs → chunk-EYD7K3H6.mjs} +7 -7
- package/dist/chunk-FB6463IN.mjs +1499 -0
- package/dist/{chunk-KFLK5NA2.mjs → chunk-FCJ553HS.mjs} +1 -1
- package/dist/{chunk-KMUNHGBQ.mjs → chunk-FEZVDOWX.mjs} +169 -253
- package/dist/{chunk-SG3JBNHY.mjs → chunk-FJKKCV4D.mjs} +1 -1
- package/dist/{chunk-BDRIVYOK.mjs → chunk-FUD5XSZ5.mjs} +1 -1
- package/dist/chunk-G6HRSGOU.mjs +74 -0
- package/dist/{chunk-S2EQU2GE.mjs → chunk-GPWMUPCA.mjs} +10 -10
- package/dist/{chunk-ZHCUZZE5.mjs → chunk-HHBUCIUY.mjs} +1 -1
- package/dist/{chunk-YEDIDCR7.mjs → chunk-I5B7RXU7.mjs} +91 -22
- package/dist/{chunk-2MANFZJ3.mjs → chunk-IIRIG7H5.mjs} +1 -1
- package/dist/{react-native/chunks/chunk-KWRW5U65.mjs → chunk-J4IJTTEX.mjs} +1 -1
- package/dist/{chunk-Q622CTMC.mjs → chunk-JSV6OQ4C.mjs} +1 -1
- package/dist/{chunk-NF4DT3IH.mjs → chunk-JTYPJF3T.mjs} +8 -1
- package/dist/chunk-KCQYFO4K.mjs +62 -0
- package/dist/{chunk-Q7G3BV3Y.mjs → chunk-KKQC526K.mjs} +19 -11
- package/dist/{chunk-PCRA7HTI.mjs → chunk-LDNCLRZU.mjs} +1 -1
- package/dist/{chunk-U4BS74YN.mjs → chunk-MW6BR4QP.mjs} +2 -2
- package/dist/{chunk-DIBHI6W5.mjs → chunk-MWD5VPN7.mjs} +2 -2
- package/dist/{chunk-UZRZKNNZ.mjs → chunk-ODYKO5TO.mjs} +1 -1
- package/dist/{chunk-PHQNACDT.mjs → chunk-OG7UGJ6F.mjs} +2 -2
- package/dist/{chunk-QH3YIQP4.mjs → chunk-OQLD2BSW.mjs} +2 -2
- package/dist/chunk-ORN5BLL7.mjs +11 -0
- package/dist/{chunk-L7ZD4L3K.mjs → chunk-OYABFKTW.mjs} +7 -6
- package/dist/{chunk-KBDBPVLN.mjs → chunk-P5LANSH6.mjs} +1 -1
- package/dist/{chunk-ZAUJFLEN.mjs → chunk-PIH5SJ4N.mjs} +122 -1697
- package/dist/{chunk-DUOLGBTE.mjs → chunk-PSZI4O24.mjs} +51 -4
- package/dist/{chunk-4KRC2APY.mjs → chunk-PV2CG7EJ.mjs} +5 -567
- package/dist/{chunk-6L3XJXGU.mjs → chunk-PWGYQXML.mjs} +1 -1
- package/dist/{chunk-5FVU47TB.mjs → chunk-QLDABJZM.mjs} +3 -3
- package/dist/{chunk-KPIV4RUC.mjs → chunk-RCX4WNLC.mjs} +2 -2
- package/dist/{chunk-3HB3PEC6.mjs → chunk-RIHIVFIQ.mjs} +6 -6
- package/dist/chunk-RLOES5SX.mjs +31 -0
- package/dist/{chunk-H6VIGE62.mjs → chunk-RWURUDSP.mjs} +10 -9
- package/dist/{chunk-ZTW5WTGG.mjs → chunk-SMOOSIAW.mjs} +4 -4
- package/dist/{chunk-MT2NRTA6.mjs → chunk-SOI6LTHM.mjs} +3 -3
- package/dist/chunk-SQJWAIF4.mjs +12 -0
- package/dist/{react-native/chunks/chunk-PPEPTUVV.mjs → chunk-TBC3XUL2.mjs} +29 -6
- package/dist/chunk-TDIK6NTV.mjs +10 -0
- package/dist/{react-native/chunks/chunk-JV6VQY2S.mjs → chunk-U55XJEIG.mjs} +2 -1
- package/dist/{chunk-H4KHPLHJ.mjs → chunk-UD5HIS4U.mjs} +1 -1
- package/dist/{chunk-HW5TNXBO.mjs → chunk-UJDJB3NE.mjs} +40 -31
- package/dist/{chunk-QUJHMPTP.mjs → chunk-VSLSGASN.mjs} +2 -2
- package/dist/{chunk-Z2BE2MAM.mjs → chunk-VZ2ONHEE.mjs} +32 -15
- package/dist/chunk-W5EB5XKI.mjs +741 -0
- package/dist/{chunk-3R4UZWQG.mjs → chunk-W7OSSKH5.mjs} +50 -20
- package/dist/{chunk-SMVH6JBE.mjs → chunk-XXJZMTZT.mjs} +1 -1
- package/dist/{chunk-VGF7CFRP.mjs → chunk-ZPZ3YGXV.mjs} +5 -4
- package/dist/{client-DRv7UVeY.d.ts → client-kqSMevVi.d.ts} +15 -3
- package/dist/client.d.ts +6 -6
- package/dist/client.mjs +4 -0
- package/dist/{cold-module-7XXCEGTZ.mjs → cold-module-VOJXMNZB.mjs} +31 -24
- package/dist/{config-DMwffLKn.d.ts → config-B4v_Htpu.d.ts} +1 -1
- package/dist/{config-CoSig5Ox.d.ts → config-CTP01fns.d.ts} +1 -1
- package/dist/direct-executor-V5DRIECI.mjs +34 -0
- package/dist/distribution/coordinator/etcd.mjs +2 -2
- package/dist/distribution/coordinator/in-memory.mjs +2 -2
- package/dist/distribution.d.ts +4 -4
- package/dist/distribution.mjs +94 -80
- package/dist/{durability-wiring-NCKUC5EO.mjs → durability-wiring-3TD62MBI.mjs} +57 -42
- package/dist/{engine-CFxPYqEk.d.ts → engine-CkPn2PWE.d.ts} +1 -1
- package/dist/{engine-hooks-DHCMOADY.mjs → engine-hooks-HA3SBOBR.mjs} +24 -17
- package/dist/geo-index-MRH5JMIR.mjs +1387 -0
- package/dist/{import-NBFXFCSG.mjs → import-GPKLTSKA.mjs} +24 -17
- package/dist/index.browser.mjs +7 -5
- package/dist/index.d.ts +131 -6
- package/dist/index.mjs +23 -16
- package/dist/index.react-native.mjs +12 -10
- package/dist/invalidation/filesystem.mjs +2 -2
- package/dist/{long-query-thread-J4DVRM4A.mjs → long-query-thread-QDFQSJD6.mjs} +26 -21
- package/dist/{module-DWKPBSMN.mjs → module-JYHFTVPS.mjs} +28 -20
- package/dist/{module-UN76TF7I.mjs → module-N55W4Q5C.mjs} +9 -9
- package/dist/{paged-partition-archive-DPNWVSK2.mjs → paged-partition-archive-RLRGOXDX.mjs} +33 -27
- package/dist/partial-words.mjs +8 -6
- package/dist/pattern.mjs +4 -3
- package/dist/persistence/durability/checkpoint-worker.mjs +32 -22
- package/dist/{phrase-module-ZI4WSQVH.mjs → phrase-module-XW5MKWP5.mjs} +3 -2
- package/dist/query-suggestions/merge-worker.mjs +25 -18
- package/dist/query-suggestions.browser.mjs +13 -11
- package/dist/query-suggestions.d.ts +1 -1
- package/dist/query-suggestions.mjs +34 -27
- package/dist/react-native/chunks/{analysis-change-6BPDPH6K.mjs → analysis-change-QUVDNABS.mjs} +46 -36
- package/dist/{browser/analysis-change-entry-4MH3CZXH.mjs → react-native/chunks/analysis-change-entry-OC4XASBF.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-7PXRWYUU.mjs → chunk-2PRHILX3.mjs} +53 -19
- package/dist/{chunk-R6A773WK.mjs → react-native/chunks/chunk-3WI35N75.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-GIZTJXYW.mjs → chunk-4AV5PPH6.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-4Y53T4YE.mjs → chunk-4COWCEY7.mjs} +189 -178
- package/dist/react-native/chunks/{chunk-OL3WDV53.mjs → chunk-4NWR3NGS.mjs} +3 -3
- package/dist/react-native/chunks/{chunk-C3PTWYKT.mjs → chunk-5MSX5FRT.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-6WA3C3DV.mjs → chunk-6OFDUYVX.mjs} +8 -1
- package/dist/react-native/chunks/{chunk-4LCEN2IU.mjs → chunk-6ZELFCK5.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-CUH5F57W.mjs → chunk-BITYFZSZ.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-TYIRMPD3.mjs → chunk-DMIFXZ3Q.mjs} +1 -1
- package/dist/react-native/chunks/chunk-DXRSEWA2.mjs +12 -0
- package/dist/{chunk-YTJCGKM4.mjs → react-native/chunks/chunk-EJ33LCHV.mjs} +29 -6
- package/dist/react-native/chunks/{chunk-EIOYM5TO.mjs → chunk-ENLMYKSX.mjs} +3024 -3054
- package/dist/react-native/chunks/chunk-FHPW7P2O.mjs +40 -0
- package/dist/{chunk-4UMZ7KQL.mjs → react-native/chunks/chunk-FTZHMRD2.mjs} +2 -1
- package/dist/react-native/chunks/{chunk-ALOIBXWN.mjs → chunk-IAENKE2D.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-QJXTNPLQ.mjs → chunk-KSBYEMCB.mjs} +1 -1
- package/dist/react-native/chunks/chunk-KU646XXT.mjs +164 -0
- package/dist/react-native/chunks/{chunk-HUOYZJ3Q.mjs → chunk-OCSLSH27.mjs} +1561 -933
- package/dist/react-native/chunks/chunk-OXM66LO6.mjs +62 -0
- package/dist/react-native/chunks/{chunk-KTTAU63H.mjs → chunk-SK2PWYDH.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-PEHS2UO3.mjs → chunk-TORU2OHQ.mjs} +3 -3
- package/dist/react-native/chunks/{chunk-VXGE4ZXL.mjs → chunk-WVWJNUMN.mjs} +51 -21
- package/dist/react-native/chunks/{chunk-KJIG57UD.mjs → chunk-WW2X2AEI.mjs} +7 -7
- package/dist/react-native/chunks/{chunk-JLIIWJUV.mjs → chunk-YZW4CHM6.mjs} +50 -11
- package/dist/react-native/chunks/{chunk-GJFXPHXI.mjs → chunk-ZNZ6CPAZ.mjs} +2 -87
- package/dist/react-native/chunks/{chunk-7GRCBBME.mjs → chunk-ZVQMBF2H.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-N2WUOWLL.mjs → chunk-ZWAIN4GG.mjs} +7 -7
- package/dist/react-native/chunks/{cold-module-5PHF6DZR.mjs → cold-module-N6KFNNZA.mjs} +20 -17
- package/dist/react-native/chunks/{durability-wiring-KO565FZC.mjs → durability-wiring-RN64S2TL.mjs} +76 -32
- package/dist/react-native/chunks/{engine-hooks-MVRRHH6B.mjs → engine-hooks-CWA5CKCA.mjs} +13 -11
- package/dist/react-native/chunks/geo-index-PX3BIHAH.mjs +1387 -0
- package/dist/react-native/chunks/{import-YVZA4V4V.mjs → import-5UAWBRJP.mjs} +14 -12
- package/dist/react-native/chunks/{module-ZL5ZG6YB.mjs → module-6RP4ZCBW.mjs} +17 -14
- package/dist/react-native/chunks/{module-H5MVPSP2.mjs → module-TTEVPRCW.mjs} +8 -8
- package/dist/react-native/chunks/{phrase-module-RTVKEWJT.mjs → phrase-module-QK22HSQ2.mjs} +1 -1
- package/dist/react-native/chunks/{release-D7ZTIANM.mjs → release-2SIHZWDO.mjs} +0 -1
- package/dist/react-native/chunks/{restore-hooks-SILFPU6B.mjs → restore-hooks-ENFMDTWC.mjs} +17 -15
- package/dist/react-native/chunks/{restore-queue-HSYP2AEC.mjs → restore-queue-4R6AASE5.mjs} +3 -3
- package/dist/react-native/chunks/{retention-7I7UAWYK.mjs → retention-5GTFT3GR.mjs} +18 -16
- package/dist/react-native/chunks/{snapshot-EZYB6SLF.mjs → snapshot-5LGPQXFS.mjs} +32 -29
- package/dist/react-native/chunks/{start-SHVZ72I5.mjs → start-ZQJVZ5DN.mjs} +18 -16
- package/dist/react-native/chunks/{write-JUESXHDL.mjs → write-6BRYIIZ7.mjs} +17 -14
- package/dist/react-native/partial-words.mjs +7 -6
- package/dist/react-native/pattern.mjs +1 -1
- package/dist/react-native/query-suggestions.mjs +19 -17
- package/dist/react-native/sync.mjs +47 -13
- package/dist/react-native/synonyms.mjs +92 -24
- package/dist/react.d.ts +7 -7
- package/dist/{browser/release-76MXRPGV.mjs → release-SMR4WJD4.mjs} +0 -1
- package/dist/{restore-hooks-HZ3ILAMO.mjs → restore-hooks-HXLIEB4A.mjs} +28 -21
- package/dist/{restore-queue-JVGENGGE.mjs → restore-queue-LZH7LMLR.mjs} +3 -3
- package/dist/{retention-HROPV2QU.mjs → retention-3K7ARGAG.mjs} +29 -22
- package/dist/server.d.ts +10 -8
- package/dist/server.mjs +55 -41
- package/dist/{snapshot-4HS2G2UM.mjs → snapshot-O7ICP7NJ.mjs} +46 -39
- package/dist/{start-UTWHGH42.mjs → start-S4PFP6RS.mjs} +31 -24
- package/dist/sync/filesystem.d.ts +2 -2
- package/dist/sync/filesystem.mjs +3 -3
- package/dist/sync/indexeddb.d.ts +2 -2
- package/dist/sync.browser.mjs +46 -12
- package/dist/sync.d.ts +3 -3
- package/dist/sync.mjs +46 -12
- package/dist/synonyms.mjs +7 -6
- package/dist/{tasks-qrJojgST.d.ts → tasks-CoNjxbop.d.ts} +2 -2
- package/dist/{thread-6MOXY2KD.mjs → thread-YLJ3ZPQ3.mjs} +25 -20
- package/dist/{types-BZCGjfLn.d.ts → types-DPMjfOr_.d.ts} +1 -1
- package/dist/vector/search-worker.mjs +6 -6
- package/dist/workers/entry.mjs +17 -6
- package/dist/{write-GTTWWRRG.mjs → write-2OBJGLFS.mjs} +27 -19
- package/openapi.json +71 -0
- package/package.json +15 -8
- package/dist/chunk-DJHHF2L5.mjs +0 -17
- package/dist/chunk-HNVVEQP7.mjs +0 -44
- package/dist/chunk-WQRN64Q6.mjs +0 -196
- package/dist/direct-executor-G5TK7NLA.mjs +0 -29
- package/dist/react-native/chunks/chunk-3JIBF3XT.mjs +0 -191
- package/dist/browser/{chunk-4WCVMOU3.mjs → chunk-XAWNZ4G2.mjs} +10 -10
package/dist/chunk-WQRN64Q6.mjs
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { isWordIndexedBase, parseFieldType } from './chunk-I54T6CQP.mjs';
|
|
2
|
-
import { isPlainObject, MAX_TEXT_FIELDS, MAX_VECTOR_DIMENSION, MAX_NESTING_DEPTH, PROTOTYPE_POLLUTION_KEYS, FIELD_NAME_PATTERN, RESERVED_ROOT_FIELDS } from './chunk-L5ORED7V.mjs';
|
|
3
|
-
import { MAX_DOCUMENT_ENCODING_DEPTH, DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES, DOCUMENT_REPLY_ENVELOPE_DEPTH } from './chunk-U476IXKQ.mjs';
|
|
4
|
-
import { NarsilError, ErrorCodes } from './chunk-MP7ABPTD.mjs';
|
|
5
|
-
import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
6
|
-
import { Encoder, encode } from '@msgpack/msgpack';
|
|
7
|
-
|
|
8
|
-
var INTEGER_ENCODING = { maxDepth: MAX_DOCUMENT_ENCODING_DEPTH };
|
|
9
|
-
var FLOAT_ENCODING = { maxDepth: MAX_DOCUMENT_ENCODING_DEPTH, forceIntegerToFloat: true };
|
|
10
|
-
var integerEncoder = new Encoder(INTEGER_ENCODING);
|
|
11
|
-
var floatEncoder = new Encoder(FLOAT_ENCODING);
|
|
12
|
-
function encodeExactly(document, forceIntegerToFloat) {
|
|
13
|
-
const bytes = (forceIntegerToFloat ? floatEncoder : integerEncoder).encode(document);
|
|
14
|
-
if (bytes.byteLength > DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES) {
|
|
15
|
-
if (forceIntegerToFloat) floatEncoder = new Encoder(FLOAT_ENCODING);
|
|
16
|
-
else integerEncoder = new Encoder(INTEGER_ENCODING);
|
|
17
|
-
}
|
|
18
|
-
return bytes;
|
|
19
|
-
}
|
|
20
|
-
function holdsNegativeZero(value, depth) {
|
|
21
|
-
if (typeof value === "number") return Object.is(value, -0);
|
|
22
|
-
if (value === null || typeof value !== "object" || ArrayBuffer.isView(value) || depth > MAX_DOCUMENT_ENCODING_DEPTH) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
for (const child of Array.isArray(value) ? value : Object.values(value)) {
|
|
26
|
-
if (holdsNegativeZero(child, depth + 1)) return true;
|
|
27
|
-
}
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
function encodeDocumentReply(payload) {
|
|
31
|
-
return encode(payload, { forceIntegerToFloat: holdsNegativeZero(payload, 1 - DOCUMENT_REPLY_ENVELOPE_DEPTH) });
|
|
32
|
-
}
|
|
33
|
-
function encodeDocument(document) {
|
|
34
|
-
try {
|
|
35
|
-
return encodeExactly(document, holdsNegativeZero(document, 1));
|
|
36
|
-
} catch (error) {
|
|
37
|
-
throw new NarsilError(
|
|
38
|
-
ErrorCodes.DOC_VALIDATION_FAILED,
|
|
39
|
-
`The document cannot be encoded as MessagePack: ${error instanceof Error ? error.message : String(error)}`
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/schema/validator/schema.ts
|
|
45
|
-
function validateSchemaFields(schema, depth, prefix) {
|
|
46
|
-
if (depth > MAX_NESTING_DEPTH) {
|
|
47
|
-
throw new NarsilError(
|
|
48
|
-
ErrorCodes.SCHEMA_DEPTH_EXCEEDED,
|
|
49
|
-
`Schema nesting exceeds the maximum depth of ${MAX_NESTING_DEPTH} at "${prefix}"`,
|
|
50
|
-
{ path: prefix, maxDepth: MAX_NESTING_DEPTH }
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
let canonical = null;
|
|
54
|
-
const replace = (field, value) => {
|
|
55
|
-
if (canonical === null) canonical = { ...schema };
|
|
56
|
-
canonical[field] = value;
|
|
57
|
-
};
|
|
58
|
-
for (const [field, type] of Object.entries(schema)) {
|
|
59
|
-
const path = prefix ? `${prefix}.${field}` : field;
|
|
60
|
-
if (PROTOTYPE_POLLUTION_KEYS.has(field)) {
|
|
61
|
-
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, `Field name "${field}" is not allowed in a schema`, {
|
|
62
|
-
field,
|
|
63
|
-
path
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (!FIELD_NAME_PATTERN.test(field)) {
|
|
67
|
-
throw new NarsilError(
|
|
68
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
69
|
-
`Field name "${field}" contains characters that are not allowed; use letters, digits, and underscores only`,
|
|
70
|
-
{ field, path }
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
if (depth === 1 && RESERVED_ROOT_FIELDS.has(field)) {
|
|
74
|
-
throw new NarsilError(
|
|
75
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
76
|
-
`Field "${field}" is reserved and cannot be defined in a schema`,
|
|
77
|
-
{ field, path }
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
if (isPlainObject(type)) {
|
|
81
|
-
const nested = validateSchemaFields(type, depth + 1, path);
|
|
82
|
-
if (nested !== type) replace(field, nested);
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
if (typeof type !== "string") {
|
|
86
|
-
throw new NarsilError(
|
|
87
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
88
|
-
`Field "${path}" has an invalid type definition: ${String(type)}`,
|
|
89
|
-
{
|
|
90
|
-
field: path,
|
|
91
|
-
type: String(type)
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
const parsed = parseFieldType(type, path);
|
|
96
|
-
if (parsed.type !== type) replace(field, parsed.type);
|
|
97
|
-
}
|
|
98
|
-
return canonical ?? schema;
|
|
99
|
-
}
|
|
100
|
-
function validateSchema(schema) {
|
|
101
|
-
if (!isPlainObject(schema)) {
|
|
102
|
-
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, "Schema must be a plain object", {
|
|
103
|
-
received: typeof schema
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
if (Object.keys(schema).length === 0) {
|
|
107
|
-
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, "Schema must define at least one field");
|
|
108
|
-
}
|
|
109
|
-
const validated = validateSchemaFields(schema, 1, "");
|
|
110
|
-
requireTextFieldCount(schemaFieldsOf(validated).filter((field) => isWordIndexedBase(field.base)).length);
|
|
111
|
-
return validated;
|
|
112
|
-
}
|
|
113
|
-
function requireTextFieldCount(count) {
|
|
114
|
-
if (count <= MAX_TEXT_FIELDS) return;
|
|
115
|
-
throw new NarsilError(
|
|
116
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
117
|
-
`The schema declares ${count} string and string[] fields, but a schema holds at most ${MAX_TEXT_FIELDS}`,
|
|
118
|
-
{ textFields: count, maximum: MAX_TEXT_FIELDS }
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
function requireCreatableSchema(schema) {
|
|
122
|
-
for (const field of schemaFieldsOf(schema)) {
|
|
123
|
-
if (field.base !== "vector" || field.dimension <= MAX_VECTOR_DIMENSION) continue;
|
|
124
|
-
throw new NarsilError(
|
|
125
|
-
ErrorCodes.SCHEMA_INVALID_VECTOR_DIMENSION,
|
|
126
|
-
`Vector field "${field.path}" has ${field.dimension} dimensions, but a new index takes at most ${MAX_VECTOR_DIMENSION}`,
|
|
127
|
-
{ field: field.path, dimension: field.dimension, maximum: MAX_VECTOR_DIMENSION }
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function requireValidFieldTypes(flatSchema) {
|
|
132
|
-
let textFields = 0;
|
|
133
|
-
for (const [path, type] of Object.entries(flatSchema)) {
|
|
134
|
-
if (typeof type !== "string") {
|
|
135
|
-
throw new NarsilError(
|
|
136
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
137
|
-
`Field "${path}" has an invalid type definition: ${String(type)}`,
|
|
138
|
-
{ field: path, type: String(type) }
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
if (isWordIndexedBase(parseFieldType(type, path).base)) textFields += 1;
|
|
142
|
-
}
|
|
143
|
-
requireTextFieldCount(textFields);
|
|
144
|
-
}
|
|
145
|
-
function flattenRecursive(schema, prefix, result) {
|
|
146
|
-
for (const [field, type] of Object.entries(schema)) {
|
|
147
|
-
const path = prefix ? `${prefix}.${field}` : field;
|
|
148
|
-
if (isPlainObject(type)) {
|
|
149
|
-
flattenRecursive(type, path, result);
|
|
150
|
-
} else {
|
|
151
|
-
result[path] = type;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
var flattenedSchemas = /* @__PURE__ */ new WeakMap();
|
|
156
|
-
function flattenSchema(schema) {
|
|
157
|
-
const cached = flattenedSchemas.get(schema);
|
|
158
|
-
if (cached !== void 0) return cached;
|
|
159
|
-
const result = /* @__PURE__ */ Object.create(null);
|
|
160
|
-
flattenRecursive(schema, "", result);
|
|
161
|
-
flattenedSchemas.set(schema, Object.freeze(result));
|
|
162
|
-
return result;
|
|
163
|
-
}
|
|
164
|
-
var parsedSchemas = /* @__PURE__ */ new WeakMap();
|
|
165
|
-
function schemaFieldsOf(schema) {
|
|
166
|
-
const cached = parsedSchemas.get(schema);
|
|
167
|
-
if (cached !== void 0) return cached;
|
|
168
|
-
const fields = [];
|
|
169
|
-
for (const [path, type] of Object.entries(flattenSchema(schema))) {
|
|
170
|
-
fields.push({ ...parseFieldType(type, path), path });
|
|
171
|
-
}
|
|
172
|
-
const frozen = Object.freeze(fields);
|
|
173
|
-
parsedSchemas.set(schema, frozen);
|
|
174
|
-
return frozen;
|
|
175
|
-
}
|
|
176
|
-
var partialFieldsBySchema = /* @__PURE__ */ new WeakMap();
|
|
177
|
-
function partialFieldsOf(schema) {
|
|
178
|
-
const cached = partialFieldsBySchema.get(schema);
|
|
179
|
-
if (cached !== void 0) return cached;
|
|
180
|
-
const paths = [];
|
|
181
|
-
for (const field of schemaFieldsOf(schema)) {
|
|
182
|
-
if (field.partial) paths.push(field.path);
|
|
183
|
-
}
|
|
184
|
-
const frozen = Object.freeze(paths.sort(compareCodePoints));
|
|
185
|
-
partialFieldsBySchema.set(schema, frozen);
|
|
186
|
-
return frozen;
|
|
187
|
-
}
|
|
188
|
-
function extractVectorFieldsFromSchema(schema) {
|
|
189
|
-
const result = /* @__PURE__ */ new Map();
|
|
190
|
-
for (const field of schemaFieldsOf(schema)) {
|
|
191
|
-
if (field.base === "vector") result.set(field.path, field.dimension);
|
|
192
|
-
}
|
|
193
|
-
return result;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export { encodeDocument, encodeDocumentReply, extractVectorFieldsFromSchema, flattenSchema, partialFieldsOf, requireCreatableSchema, requireValidFieldTypes, schemaFieldsOf, validateSchema };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export { createDirectExecutor } from './chunk-Z2BE2MAM.mjs';
|
|
2
|
-
import './chunk-ZAUJFLEN.mjs';
|
|
3
|
-
import './chunk-IPN7S4KX.mjs';
|
|
4
|
-
import './chunk-KAKQ74LS.mjs';
|
|
5
|
-
import './chunk-Q2UL2TPC.mjs';
|
|
6
|
-
import './chunk-LC3FDWTX.mjs';
|
|
7
|
-
import './chunk-JUKYYXSP.mjs';
|
|
8
|
-
import './chunk-4KRC2APY.mjs';
|
|
9
|
-
import './chunk-FQBFZAWG.mjs';
|
|
10
|
-
import './chunk-WQRN64Q6.mjs';
|
|
11
|
-
import './chunk-GES7U2PM.mjs';
|
|
12
|
-
import './chunk-I54T6CQP.mjs';
|
|
13
|
-
import './chunk-YEDIDCR7.mjs';
|
|
14
|
-
import './chunk-X5CV2E2B.mjs';
|
|
15
|
-
import './chunk-Y4WPNHMC.mjs';
|
|
16
|
-
import './chunk-RZWWB2XR.mjs';
|
|
17
|
-
import './chunk-TGP5M5R7.mjs';
|
|
18
|
-
import './chunk-4BYWRYPM.mjs';
|
|
19
|
-
import './chunk-4UMZ7KQL.mjs';
|
|
20
|
-
import './chunk-U2BKYEC7.mjs';
|
|
21
|
-
import './chunk-HNVVEQP7.mjs';
|
|
22
|
-
import './chunk-ZXNQEW43.mjs';
|
|
23
|
-
import './chunk-L5ORED7V.mjs';
|
|
24
|
-
import './chunk-LQG5G2LY.mjs';
|
|
25
|
-
import './chunk-ZXX5GZEX.mjs';
|
|
26
|
-
import './chunk-U476IXKQ.mjs';
|
|
27
|
-
import './chunk-MP7ABPTD.mjs';
|
|
28
|
-
import './chunk-R6A773WK.mjs';
|
|
29
|
-
import './chunk-YTJCGKM4.mjs';
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { MAX_DOCUMENT_ENCODING_DEPTH, DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES } from './chunk-6VBXNFLE.mjs';
|
|
2
|
-
import { isPlainObject, isWordIndexedBase, MAX_TEXT_FIELDS, MAX_VECTOR_DIMENSION, parseFieldType, MAX_NESTING_DEPTH, PROTOTYPE_POLLUTION_KEYS, FIELD_NAME_PATTERN, RESERVED_ROOT_FIELDS } from './chunk-C5G6TJ7A.mjs';
|
|
3
|
-
import { compareCodePoints } from './chunk-PPEPTUVV.mjs';
|
|
4
|
-
import { NarsilError, ErrorCodes } from './chunk-DZ7H7D2C.mjs';
|
|
5
|
-
import { Encoder } from '@msgpack/msgpack';
|
|
6
|
-
|
|
7
|
-
// src/schema/validator/schema.ts
|
|
8
|
-
function validateSchemaFields(schema, depth, prefix) {
|
|
9
|
-
if (depth > MAX_NESTING_DEPTH) {
|
|
10
|
-
throw new NarsilError(
|
|
11
|
-
ErrorCodes.SCHEMA_DEPTH_EXCEEDED,
|
|
12
|
-
`Schema nesting exceeds the maximum depth of ${MAX_NESTING_DEPTH} at "${prefix}"`,
|
|
13
|
-
{ path: prefix, maxDepth: MAX_NESTING_DEPTH }
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
let canonical = null;
|
|
17
|
-
const replace = (field, value) => {
|
|
18
|
-
if (canonical === null) canonical = { ...schema };
|
|
19
|
-
canonical[field] = value;
|
|
20
|
-
};
|
|
21
|
-
for (const [field, type] of Object.entries(schema)) {
|
|
22
|
-
const path = prefix ? `${prefix}.${field}` : field;
|
|
23
|
-
if (PROTOTYPE_POLLUTION_KEYS.has(field)) {
|
|
24
|
-
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, `Field name "${field}" is not allowed in a schema`, {
|
|
25
|
-
field,
|
|
26
|
-
path
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
if (!FIELD_NAME_PATTERN.test(field)) {
|
|
30
|
-
throw new NarsilError(
|
|
31
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
32
|
-
`Field name "${field}" contains characters that are not allowed; use letters, digits, and underscores only`,
|
|
33
|
-
{ field, path }
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
if (depth === 1 && RESERVED_ROOT_FIELDS.has(field)) {
|
|
37
|
-
throw new NarsilError(
|
|
38
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
39
|
-
`Field "${field}" is reserved and cannot be defined in a schema`,
|
|
40
|
-
{ field, path }
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
if (isPlainObject(type)) {
|
|
44
|
-
const nested = validateSchemaFields(type, depth + 1, path);
|
|
45
|
-
if (nested !== type) replace(field, nested);
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (typeof type !== "string") {
|
|
49
|
-
throw new NarsilError(
|
|
50
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
51
|
-
`Field "${path}" has an invalid type definition: ${String(type)}`,
|
|
52
|
-
{
|
|
53
|
-
field: path,
|
|
54
|
-
type: String(type)
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
const parsed = parseFieldType(type, path);
|
|
59
|
-
if (parsed.type !== type) replace(field, parsed.type);
|
|
60
|
-
}
|
|
61
|
-
return canonical ?? schema;
|
|
62
|
-
}
|
|
63
|
-
function validateSchema(schema) {
|
|
64
|
-
if (!isPlainObject(schema)) {
|
|
65
|
-
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, "Schema must be a plain object", {
|
|
66
|
-
received: typeof schema
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
if (Object.keys(schema).length === 0) {
|
|
70
|
-
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, "Schema must define at least one field");
|
|
71
|
-
}
|
|
72
|
-
const validated = validateSchemaFields(schema, 1, "");
|
|
73
|
-
requireTextFieldCount(schemaFieldsOf(validated).filter((field) => isWordIndexedBase(field.base)).length);
|
|
74
|
-
return validated;
|
|
75
|
-
}
|
|
76
|
-
function requireTextFieldCount(count) {
|
|
77
|
-
if (count <= MAX_TEXT_FIELDS) return;
|
|
78
|
-
throw new NarsilError(
|
|
79
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
80
|
-
`The schema declares ${count} string and string[] fields, but a schema holds at most ${MAX_TEXT_FIELDS}`,
|
|
81
|
-
{ textFields: count, maximum: MAX_TEXT_FIELDS }
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
function requireCreatableSchema(schema) {
|
|
85
|
-
for (const field of schemaFieldsOf(schema)) {
|
|
86
|
-
if (field.base !== "vector" || field.dimension <= MAX_VECTOR_DIMENSION) continue;
|
|
87
|
-
throw new NarsilError(
|
|
88
|
-
ErrorCodes.SCHEMA_INVALID_VECTOR_DIMENSION,
|
|
89
|
-
`Vector field "${field.path}" has ${field.dimension} dimensions, but a new index takes at most ${MAX_VECTOR_DIMENSION}`,
|
|
90
|
-
{ field: field.path, dimension: field.dimension, maximum: MAX_VECTOR_DIMENSION }
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function requireValidFieldTypes(flatSchema) {
|
|
95
|
-
let textFields = 0;
|
|
96
|
-
for (const [path, type] of Object.entries(flatSchema)) {
|
|
97
|
-
if (typeof type !== "string") {
|
|
98
|
-
throw new NarsilError(
|
|
99
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
100
|
-
`Field "${path}" has an invalid type definition: ${String(type)}`,
|
|
101
|
-
{ field: path, type: String(type) }
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
if (isWordIndexedBase(parseFieldType(type, path).base)) textFields += 1;
|
|
105
|
-
}
|
|
106
|
-
requireTextFieldCount(textFields);
|
|
107
|
-
}
|
|
108
|
-
function flattenRecursive(schema, prefix, result) {
|
|
109
|
-
for (const [field, type] of Object.entries(schema)) {
|
|
110
|
-
const path = prefix ? `${prefix}.${field}` : field;
|
|
111
|
-
if (isPlainObject(type)) {
|
|
112
|
-
flattenRecursive(type, path, result);
|
|
113
|
-
} else {
|
|
114
|
-
result[path] = type;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
var flattenedSchemas = /* @__PURE__ */ new WeakMap();
|
|
119
|
-
function flattenSchema(schema) {
|
|
120
|
-
const cached = flattenedSchemas.get(schema);
|
|
121
|
-
if (cached !== void 0) return cached;
|
|
122
|
-
const result = /* @__PURE__ */ Object.create(null);
|
|
123
|
-
flattenRecursive(schema, "", result);
|
|
124
|
-
flattenedSchemas.set(schema, Object.freeze(result));
|
|
125
|
-
return result;
|
|
126
|
-
}
|
|
127
|
-
var parsedSchemas = /* @__PURE__ */ new WeakMap();
|
|
128
|
-
function schemaFieldsOf(schema) {
|
|
129
|
-
const cached = parsedSchemas.get(schema);
|
|
130
|
-
if (cached !== void 0) return cached;
|
|
131
|
-
const fields = [];
|
|
132
|
-
for (const [path, type] of Object.entries(flattenSchema(schema))) {
|
|
133
|
-
fields.push({ ...parseFieldType(type, path), path });
|
|
134
|
-
}
|
|
135
|
-
const frozen = Object.freeze(fields);
|
|
136
|
-
parsedSchemas.set(schema, frozen);
|
|
137
|
-
return frozen;
|
|
138
|
-
}
|
|
139
|
-
var partialFieldsBySchema = /* @__PURE__ */ new WeakMap();
|
|
140
|
-
function partialFieldsOf(schema) {
|
|
141
|
-
const cached = partialFieldsBySchema.get(schema);
|
|
142
|
-
if (cached !== void 0) return cached;
|
|
143
|
-
const paths = [];
|
|
144
|
-
for (const field of schemaFieldsOf(schema)) {
|
|
145
|
-
if (field.partial) paths.push(field.path);
|
|
146
|
-
}
|
|
147
|
-
const frozen = Object.freeze(paths.sort(compareCodePoints));
|
|
148
|
-
partialFieldsBySchema.set(schema, frozen);
|
|
149
|
-
return frozen;
|
|
150
|
-
}
|
|
151
|
-
function extractVectorFieldsFromSchema(schema) {
|
|
152
|
-
const result = /* @__PURE__ */ new Map();
|
|
153
|
-
for (const field of schemaFieldsOf(schema)) {
|
|
154
|
-
if (field.base === "vector") result.set(field.path, field.dimension);
|
|
155
|
-
}
|
|
156
|
-
return result;
|
|
157
|
-
}
|
|
158
|
-
var INTEGER_ENCODING = { maxDepth: MAX_DOCUMENT_ENCODING_DEPTH };
|
|
159
|
-
var FLOAT_ENCODING = { maxDepth: MAX_DOCUMENT_ENCODING_DEPTH, forceIntegerToFloat: true };
|
|
160
|
-
var integerEncoder = new Encoder(INTEGER_ENCODING);
|
|
161
|
-
var floatEncoder = new Encoder(FLOAT_ENCODING);
|
|
162
|
-
function encodeExactly(document, forceIntegerToFloat) {
|
|
163
|
-
const bytes = (forceIntegerToFloat ? floatEncoder : integerEncoder).encode(document);
|
|
164
|
-
if (bytes.byteLength > DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES) {
|
|
165
|
-
if (forceIntegerToFloat) floatEncoder = new Encoder(FLOAT_ENCODING);
|
|
166
|
-
else integerEncoder = new Encoder(INTEGER_ENCODING);
|
|
167
|
-
}
|
|
168
|
-
return bytes;
|
|
169
|
-
}
|
|
170
|
-
function holdsNegativeZero(value, depth) {
|
|
171
|
-
if (typeof value === "number") return Object.is(value, -0);
|
|
172
|
-
if (value === null || typeof value !== "object" || ArrayBuffer.isView(value) || depth > MAX_DOCUMENT_ENCODING_DEPTH) {
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
for (const child of Array.isArray(value) ? value : Object.values(value)) {
|
|
176
|
-
if (holdsNegativeZero(child, depth + 1)) return true;
|
|
177
|
-
}
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
function encodeDocument(document) {
|
|
181
|
-
try {
|
|
182
|
-
return encodeExactly(document, holdsNegativeZero(document, 1));
|
|
183
|
-
} catch (error) {
|
|
184
|
-
throw new NarsilError(
|
|
185
|
-
ErrorCodes.DOC_VALIDATION_FAILED,
|
|
186
|
-
`The document cannot be encoded as MessagePack: ${error instanceof Error ? error.message : String(error)}`
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export { encodeDocument, extractVectorFieldsFromSchema, flattenSchema, partialFieldsOf, requireCreatableSchema, requireValidFieldTypes, schemaFieldsOf, validateSchema };
|
|
@@ -69,16 +69,6 @@ function markSimdUnavailable() {
|
|
|
69
69
|
simdAvailable = false;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
// src/vector/osq/constants.ts
|
|
73
|
-
var OSQ_GRID = { 1: 0.798, 2: 1.493, 4: 2.514, 8: 3.922 };
|
|
74
|
-
var OSQ_STEPS = { 1: 1, 2: 3, 4: 15, 8: 255 };
|
|
75
|
-
var OSQ_QUERY_BITS = { 1: 4, 2: 4, 4: 4, 8: 8 };
|
|
76
|
-
var OSQ_PLACEMENT_QUERY_BITS = { 1: 4, 2: 4, 4: 8, 8: 8 };
|
|
77
|
-
var OSQ_LAMBDA = 0.1;
|
|
78
|
-
var OSQ_REFINE_ROUNDS = 5;
|
|
79
|
-
var OSQ_REFINE_TOLERANCE = 1e-8;
|
|
80
|
-
var MIN_OVERSAMPLE = 1;
|
|
81
|
-
|
|
82
72
|
// src/workers/thread-slot.ts
|
|
83
73
|
var goneThreadSlots = /* @__PURE__ */ new Set();
|
|
84
74
|
function threadSlotOfWorker(workerId) {
|
|
@@ -94,6 +84,16 @@ function threadSlotGone(threadSlot) {
|
|
|
94
84
|
return goneThreadSlots.has(threadSlot);
|
|
95
85
|
}
|
|
96
86
|
|
|
87
|
+
// src/vector/osq/constants.ts
|
|
88
|
+
var OSQ_GRID = { 1: 0.798, 2: 1.493, 4: 2.514, 8: 3.922 };
|
|
89
|
+
var OSQ_STEPS = { 1: 1, 2: 3, 4: 15, 8: 255 };
|
|
90
|
+
var OSQ_QUERY_BITS = { 1: 4, 2: 4, 4: 4, 8: 8 };
|
|
91
|
+
var OSQ_PLACEMENT_QUERY_BITS = { 1: 4, 2: 4, 4: 8, 8: 8 };
|
|
92
|
+
var OSQ_LAMBDA = 0.1;
|
|
93
|
+
var OSQ_REFINE_ROUNDS = 5;
|
|
94
|
+
var OSQ_REFINE_TOLERANCE = 1e-8;
|
|
95
|
+
var MIN_OVERSAMPLE = 1;
|
|
96
|
+
|
|
97
97
|
// src/core/doc-id-tables/plain.ts
|
|
98
98
|
function createDocIdMap() {
|
|
99
99
|
return /* @__PURE__ */ new Map();
|