@moss-js/moss 1.9.0 → 1.11.0
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/README.md +29 -2
- package/dist/index.esm.js +1 -1
- package/dist/moss.d.ts +128 -18
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -226,6 +226,33 @@ each index, and `filter` applies to every index. `loadIndexes` is best-effort:
|
|
|
226
226
|
names that fail are reported in `failed` without rolling back the ones that
|
|
227
227
|
loaded.
|
|
228
228
|
|
|
229
|
+
## Web sources
|
|
230
|
+
|
|
231
|
+
POST the existing `/v1/manage` web-source actions and return typed results.
|
|
232
|
+
Poll `jobId` with `getJobStatus`. Depends on the index-manager release with
|
|
233
|
+
several sources per index and source-preserving crawls, and the moss-control
|
|
234
|
+
release with the deleteIndex proxy. Set `MOSS_CLOUD_API_BASE_URL` to send
|
|
235
|
+
manage calls to a non-default host (defaults to `https://service.usemoss.dev`).
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
const created = await mossClient.createWebSource(
|
|
239
|
+
"https://docs.example.com",
|
|
240
|
+
"knowledge-base",
|
|
241
|
+
{ maxPages: 200, refreshCadence: "weekly" },
|
|
242
|
+
);
|
|
243
|
+
await mossClient.getJobStatus(created.jobId);
|
|
244
|
+
|
|
245
|
+
const sources = await mossClient.listWebSources("knowledge-base");
|
|
246
|
+
const source = await mossClient.getWebSource(created.id);
|
|
247
|
+
const updated = await mossClient.updateWebSource(created.id, {
|
|
248
|
+
refreshCadence: "daily",
|
|
249
|
+
});
|
|
250
|
+
// updated.jobId is set when resync: true enqueued a crawl.
|
|
251
|
+
const resync = await mossClient.resyncWebSource(created.id);
|
|
252
|
+
const deleted = await mossClient.deleteWebSource(created.id);
|
|
253
|
+
// deleted.purgeJobId is set when a purge was enqueued.
|
|
254
|
+
```
|
|
255
|
+
|
|
229
256
|
## Metadata filtering
|
|
230
257
|
|
|
231
258
|
You can pass a metadata filter in `query` options after loading an index locally:
|
|
@@ -249,8 +276,8 @@ For a complete runnable example, see `javascript/user-facing-sdk/samples/metadat
|
|
|
249
276
|
|
|
250
277
|
This package is licensed under the [PolyForm Shield License 1.0.0](./LICENSE.txt).
|
|
251
278
|
|
|
252
|
-
- ✅ Free for
|
|
253
|
-
- ❌ Not permitted
|
|
279
|
+
- ✅ Free for any use, including production and commercial use.
|
|
280
|
+
- ❌ Not permitted: providing a product that competes with Moss.
|
|
254
281
|
- 📩 For commercial licenses, contact: <contact@inferedge.dev>
|
|
255
282
|
|
|
256
283
|
## 📬 Contact
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x3db910=_0x232b;(function(_0x7b7f0c,_0x32f0e3){const _0x34fc2d=_0x232b,_0x5af2cd=_0x7b7f0c();while(!![]){try{const _0x3aaafb=parseInt(_0x34fc2d(0x18e))/0x1*(-parseInt(_0x34fc2d(0x166))/0x2)+parseInt(_0x34fc2d(0x16d))/0x3+-parseInt(_0x34fc2d(0x126))/0x4*(parseInt(_0x34fc2d(0x148))/0x5)+-parseInt(_0x34fc2d(0x15a))/0x6*(-parseInt(_0x34fc2d(0x104))/0x7)+-parseInt(_0x34fc2d(0xfe))/0x8*(parseInt(_0x34fc2d(0x16a))/0x9)+-parseInt(_0x34fc2d(0x133))/0xa+-parseInt(_0x34fc2d(0x109))/0xb*(-parseInt(_0x34fc2d(0x13a))/0xc);if(_0x3aaafb===_0x32f0e3)break;else _0x5af2cd['push'](_0x5af2cd['shift']());}catch(_0x2e1912){_0x5af2cd['push'](_0x5af2cd['shift']());}}}(_0x489a,0x82da9));function _0x489a(){const _0x2a853e=['getAuthHeader','startsWith','uploading','\x20UTF-8\x20bytes','toByteArray','stringify','onProgress','projectKey','deleteDocs','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','2714412SxdIGb','queryMultiIndex','utf8','MOSS_AUTH_URL','MossClient\x20options.identity.','[moss]\x20Auth\x20request\x20','alpha','indexManager','SDK_VERSION_NUMBER','projectId','unloadIndexes','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','86qibVNq','cache','received\x20','bind','585cSMrud','deleteIndex','freeze','2049690ZTyrjx','POST','inflight','number','setIdentity','deviceIdCachePath','applyIdentityToManager','model','object','application/json','getAuthToken','getIndex','_fromInner','progress','pushIndex','.moss-device-id','filter','moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports','slice','Bearer\x20','no\x20exact\x20artifact\x20identity','IndexManager','deref','authUrl','resolveAuthRequest','configuredIdentity','_warmModel','getDocuments','byteLength','addDocuments','call','hasCustomAuthenticator','moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','2612jKJdAF','docCount','Authentication\x20failed\x20(HTTP\x20401):\x20','arrayBuffer','\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','parseOptions','rejectAuthRequest','embedding','version','SessionIndex','saveToDisk','data','test','toLowerCase','cachePath','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20(','inner','currentPhase','\x20could\x20not\x20be\x20settled:\x20','isArray','loadIndexes','moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20','withAuthenticator','function','modelId','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','unloadIndex','applied','moss-minilm','clear','One\x20or\x20more\x20indexes\x20use\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','trim','MODEL_DOWNLOAD_URL','some','Uploading','queryText','isSafeInteger','encode','timeout','hasIndex','error','.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.','PendingUpload','requireMultiIndexCore','includes','updated','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','addDocs','This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.','resolveIdentityForSession','userId','56528bIqrSx','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','ManageClient','setDeviceId','createIndex','message','14iRWWoq','Index\x20\x22','then','deviceIdState','asyncDispose','414601xaHmOB','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20MossClient\x20identity.\x20Install\x20the\x20exact\x20@moss-js/moss-core\x20version\x20required\x20by\x20@moss-js/moss.','received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected','\x20must\x20be\x20at\x20most\x20','MossClient\x20options.identity\x20must\x20be\x20an\x20object','string','authenticator','manageClient','added','env','_create','status','close','\x20contains\x20an\x20unsupported\x20character','jobId','path','wrapProgress','default','identity','\x27\x20is\x20closed','Building','loadIndex','queryMultiIndexText','name','map','createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client','addDocumentsText','replace','isFinite','204FKhGmM','getDocs','from','\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace','length','deleteDocuments','normalizeJobStatus','authNotifyFn','expiresIn','warn','MOSS_INDEX_URL','requires\x20explicit\x20query\x20embeddings','delete','9322830Wlrchp','getJobStatus','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()','[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20','HTTP\x20','loadModel','callerSupplied','444CrnCfs','create','Completed','modelArtifactContractVersion','pendingupload','query','all','received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20(','fetchAndCache','custom','createAuthenticatedSessionInner','createIndexFromFiles','USERPROFILE','\x27\x20returned\x20by\x20moss-core','92425mHqoiz','building','.moss','now','Unsupported\x20job\x20status\x20\x27','deviceId','hostDeviceId','loadFromDisk'];_0x489a=function(){return _0x2a853e;};return _0x489a();}import{JobStatus as _0x5d0490}from'@moss-js/moss-core';import*as _0x20f1c6 from'@moss-js/moss-core';import*as _0x40ffdc from'@moss-js/moss-core';var p=_0x40ffdc,le=p[_0x3db910(0x1af)],ce=p[_0x3db910(0x162)],me=p['CLOUD_API_IDENTITY_URL'],O=p['CLOUD_API_AUTH_URL'],he=typeof process<'u'&&process[_0x3db910(0x112)][_0x3db910(0x130)]||p['CLOUD_API_INDEX_URL'],E=typeof process<'u'?process[_0x3db910(0x112)]:{},I=class{constructor(_0x56cd88,_0x1cb46b){const _0x299859=_0x3db910;this['projectId']=_0x56cd88,this[_0x299859(0x157)]=_0x1cb46b,this[_0x299859(0x184)]=E[_0x299859(0x15d)]??O;}[_0x3db910(0x163)];[_0x3db910(0x157)];[_0x3db910(0x184)];async[_0x3db910(0x177)](){const _0x162da2=_0x3db910;let _0xabfa3b=await fetch(this[_0x162da2(0x184)],{'method':_0x162da2(0x16e),'headers':{'Content-Type':_0x162da2(0x176)},'body':JSON[_0x162da2(0x155)]({'projectId':this[_0x162da2(0x163)],'projectKey':this[_0x162da2(0x157)]}),'signal':AbortSignal[_0x162da2(0x1b5)](0x7530)});if(_0xabfa3b['status']===0x191){let _0xf61a72=await _0xabfa3b['text']();throw new Error(_0x162da2(0x190)+_0xf61a72);}if(!_0xabfa3b['ok']){let _0x21872f=await _0xabfa3b['text']();throw new Error(_0x162da2(0x137)+_0xabfa3b[_0x162da2(0x114)]+':\x20'+_0x21872f);}let _0x37ffe8=await _0xabfa3b['json']();return{'token':_0x37ffe8['token'],'expiresIn':_0x37ffe8[_0x162da2(0x12e)]};}async[_0x3db910(0x150)](){const _0x9d322f=_0x3db910;let {token:_0x2f7ce3}=await this[_0x9d322f(0x177)]();return'Bearer\x20'+_0x2f7ce3;}},f=class{constructor(_0x24d55d){const _0x5ebb8a=_0x3db910;this[_0x5ebb8a(0x19e)]=_0x24d55d;}['inner'];[_0x3db910(0x167)]=null;[_0x3db910(0x16f)]=null;async['getAuthToken'](){const _0x4a9529=_0x3db910;if(this[_0x4a9529(0x167)]&&this[_0x4a9529(0x167)]['expiresAt']>Date[_0x4a9529(0x14b)]())return{'token':this[_0x4a9529(0x167)]['token'],'expiresIn':this['cache'][_0x4a9529(0x12e)]};if(this[_0x4a9529(0x16f)])return this[_0x4a9529(0x16f)];this[_0x4a9529(0x16f)]=this[_0x4a9529(0x142)]();try{return await this['inflight'];}finally{this[_0x4a9529(0x16f)]=null;}}async[_0x3db910(0x150)](){const _0x15107f=_0x3db910;let {token:_0x33e25e}=await this[_0x15107f(0x177)]();return _0x15107f(0x180)+_0x33e25e;}async[_0x3db910(0x142)](){const _0x53c62d=_0x3db910;let {token:_0x411290,expiresIn:_0x6a12da}=await this['inner'][_0x53c62d(0x177)](),_0x2dbc59=Date[_0x53c62d(0x14b)]()+(_0x6a12da-0x3c)*0x3e8;return this[_0x53c62d(0x167)]={'token':_0x411290,'expiresIn':_0x6a12da,'expiresAt':_0x2dbc59},{'token':_0x411290,'expiresIn':_0x6a12da};}};import{randomUUID as _0x556a72}from'node:crypto';import{existsSync as _0x3642fb,mkdirSync as _0x393f24,readFileSync as _0x32687c,writeFileSync as _0x4134c1}from'node:fs';import{homedir as _0x3b8bee}from'node:os';import{join as _0x33e16d,resolve as _0x237be3}from'node:path';var ee=_0x3db910(0x17c),te=_0x3db910(0x14a),b=0x100,q=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u,L=_0x3db910(0x10a);function ne(_0x119950){const _0x1f3ccb=_0x3db910;return _0x119950[_0x1f3ccb(0x12a)]>0x0&&_0x119950['trim']()===_0x119950&&!q[_0x1f3ccb(0x19a)](_0x119950)&&new TextEncoder()[_0x1f3ccb(0x1b4)](_0x119950)[_0x1f3ccb(0x189)]<=b;}function re(_0x250e8c){const _0x40d445=_0x3db910;try{let _0x372bab=_0x237be3(_0x250e8c),_0x469fba=_0x33e16d(_0x372bab,ee);if(_0x3642fb(_0x469fba)){let _0x221cc6=_0x32687c(_0x469fba,_0x40d445(0x15c))[_0x40d445(0x1ae)]();if(ne(_0x221cc6))return _0x221cc6;}_0x393f24(_0x372bab,{'recursive':!0x0});let _0x54213f=_0x556a72();return _0x4134c1(_0x469fba,_0x54213f,_0x40d445(0x15c)),_0x54213f;}catch{return _0x556a72();}}function se(_0x3bead6=process[_0x3db910(0x112)]){const _0x23b482=_0x3db910;let _0x3b2f9b=_0x3bead6['HOME']?.[_0x23b482(0x1ae)]()||_0x3bead6[_0x23b482(0x146)]?.[_0x23b482(0x1ae)]()||_0x3b8bee();return _0x33e16d(_0x3b2f9b,te);}function k(_0x1aefa2,_0x337bab){const _0x16fcc9=_0x3db910;if(_0x1aefa2!==void 0x0){if(typeof _0x1aefa2!=_0x16fcc9(0x10e)||_0x1aefa2[_0x16fcc9(0x12a)]===0x0)throw new TypeError(_0x16fcc9(0x15e)+_0x337bab+'\x20must\x20be\x20a\x20non-empty\x20string');if(_0x1aefa2[_0x16fcc9(0x1ae)]()!==_0x1aefa2)throw new TypeError(_0x16fcc9(0x15e)+_0x337bab+_0x16fcc9(0x129));if(q['test'](_0x1aefa2))throw new TypeError(_0x16fcc9(0x15e)+_0x337bab+_0x16fcc9(0x116));if(new TextEncoder()[_0x16fcc9(0x1b4)](_0x1aefa2)[_0x16fcc9(0x189)]>b)throw new TypeError(_0x16fcc9(0x15e)+_0x337bab+_0x16fcc9(0x10c)+b+_0x16fcc9(0x153));return _0x1aefa2;}}function F(_0x40de17){const _0xf4293e=_0x3db910;if(_0x40de17!==void 0x0){if(_0x40de17===null||typeof _0x40de17!=_0xf4293e(0x175)||Array['isArray'](_0x40de17))throw new TypeError(_0xf4293e(0x10d));return Object[_0xf4293e(0x16c)]({'deviceId':k(_0x40de17[_0xf4293e(0x14d)],'deviceId'),'userId':k(_0x40de17[_0xf4293e(0xfd)],_0xf4293e(0xfd))});}}function M(_0x2ab7d4){const _0x5454e3=_0x3db910;return _0x2ab7d4?.['deviceId']!==void 0x0||_0x2ab7d4?.[_0x5454e3(0xfd)]!==void 0x0;}function j(_0x5995c8){const _0x4cfff7=_0x3db910;if(typeof _0x5995c8['setIdentity']!=_0x4cfff7(0x1a6))throw new Error(L);}function oe(_0x3ca352,_0x466704,_0x3f0bfa=process[_0x3db910(0x112)]){const _0x158231=_0x3db910;if(_0x3ca352['id'])return _0x3ca352['id'];let _0x37dbad=_0x466704?.[_0x158231(0x1ae)]()?_0x466704:se(_0x3f0bfa);return _0x3ca352['id']=re(_0x37dbad),_0x3ca352['id'];}function ie(_0x5577af,_0x112c48){const _0x387606=_0x3db910;if(typeof _0x5577af[_0x387606(0x101)]!=_0x387606(0x1a6))return!0x0;try{return _0x5577af['setDeviceId'](_0x112c48),!0x0;}catch{return!0x1;}}function v(_0x2374f1,_0x2ce7f8,_0x3aed9a,_0x513c3e=process[_0x3db910(0x112)]){const _0x51439b=_0x3db910;let _0x5799c6=oe(_0x2374f1,_0x3aed9a,_0x513c3e);return{'deviceId':_0x2ce7f8?.[_0x51439b(0x14d)]??_0x5799c6,'hostDeviceId':_0x2ce7f8?.[_0x51439b(0x14d)],'mossDeviceId':_0x5799c6,'userId':_0x2ce7f8?.[_0x51439b(0xfd)],'callerSupplied':M(_0x2ce7f8)};}function P(_0x29116c,_0x4c0242){const _0x4aefc7=_0x3db910;if(typeof _0x29116c[_0x4aefc7(0x171)]!=_0x4aefc7(0x1a6)){if(_0x4c0242[_0x4aefc7(0x139)])throw new Error(L);return ie(_0x29116c,_0x4c0242[_0x4aefc7(0x14d)]);}if(!_0x4c0242[_0x4aefc7(0x139)])try{return _0x29116c[_0x4aefc7(0x171)](null,null,_0x4c0242['mossDeviceId']),!0x0;}catch{return!0x1;}return _0x29116c['setIdentity'](_0x4c0242[_0x4aefc7(0x14e)]??null,_0x4c0242[_0x4aefc7(0xfd)]??null,_0x4c0242['mossDeviceId']),!0x0;}function N(_0x5087bb,_0xad430c,_0x23aa33,_0x33d307,_0x130ecd=process[_0x3db910(0x112)]){const _0x290482=_0x3db910;_0xad430c['applied']||(_0xad430c[_0x290482(0x1aa)]=P(_0x5087bb,v(_0xad430c,_0x23aa33,_0x33d307,_0x130ecd)));}function _0x232b(_0x4b562b,_0x24f884){_0x4b562b=_0x4b562b-0xfa;const _0x489a72=_0x489a();let _0x232b98=_0x489a72[_0x4b562b];return _0x232b98;}var ae=0x1;function y(_0x3e5b9f){const _0x249d50=_0x3db910;let _0x1095ed=_0x3e5b9f[_0x249d50(0x13d)];if(typeof _0x1095ed!=_0x249d50(0x1a6))throw J();let _0x47f742=_0x1095ed[_0x249d50(0x18b)](_0x3e5b9f);if(!Number[_0x249d50(0x1b3)](_0x47f742)||_0x47f742<ae)throw J();}function J(){return new Error('The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.');}var ve=0x708*0x3e8;function A(_0x4dbb2e){const _0x1c67ae=_0x3db910;return _0x4dbb2e instanceof Error?_0x4dbb2e[_0x1c67ae(0x103)]:String(_0x4dbb2e);}function de(_0x321be6){const _0x349400=_0x3db910;if(_0x321be6===null||typeof _0x321be6!=_0x349400(0x175))return'received\x20'+String(_0x321be6);if(Array['isArray'](_0x321be6))return _0x349400(0x10b);let _0x1c9b4c=_0x321be6;return typeof _0x1c9b4c[_0x349400(0x117)]!='string'||_0x1c9b4c[_0x349400(0x117)][_0x349400(0x12a)]===0x0?'received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20('+String(_0x1c9b4c[_0x349400(0x117)])+')':typeof _0x1c9b4c[_0x349400(0x114)]!=_0x349400(0x10e)||_0x1c9b4c[_0x349400(0x114)][_0x349400(0x12a)]===0x0?_0x349400(0x19d)+String(_0x1c9b4c[_0x349400(0x114)])+')':typeof _0x1c9b4c[_0x349400(0x17a)]!=_0x349400(0x170)||!Number[_0x349400(0x125)](_0x1c9b4c['progress'])?'received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20('+String(_0x1c9b4c[_0x349400(0x17a)])+')':_0x1c9b4c[_0x349400(0x19f)]!==void 0x0&&_0x1c9b4c[_0x349400(0x19f)]!==null&&typeof _0x1c9b4c[_0x349400(0x19f)]!='string'?_0x349400(0x141)+String(_0x1c9b4c[_0x349400(0x19f)])+')':null;}var x=class{['authenticator'];[_0x3db910(0x110)];[_0x3db910(0x161)];[_0x3db910(0x107)]={'applied':!0x1};['deviceIdCachePath'];[_0x3db910(0x186)];[_0x3db910(0x163)];[_0x3db910(0x12d)];constructor(_0x443037,_0x3e8d92,_0x57c4f0){const _0x2c0f4b=_0x3db910;this[_0x2c0f4b(0x186)]=F(_0x57c4f0?.[_0x2c0f4b(0x11b)]),this[_0x2c0f4b(0x172)]=_0x57c4f0?.[_0x2c0f4b(0x19c)],this['projectId']=_0x443037;let _0x134897=typeof _0x3e8d92==_0x2c0f4b(0x10e)?new I(_0x443037,_0x3e8d92):_0x3e8d92;this[_0x2c0f4b(0x10f)]=new f(_0x134897);let _0xc3342a=_0x20f1c6,_0x2133c0=_0xc3342a[_0x2c0f4b(0x100)]??_0xc3342a[_0x2c0f4b(0x11a)]?.[_0x2c0f4b(0x100)],_0xbf8b84=_0xc3342a['IndexManager']??_0xc3342a['default']?.[_0x2c0f4b(0x182)];if(!_0x2133c0||!_0xbf8b84)throw new Error(_0x2c0f4b(0x17e));if(typeof _0x3e8d92=='string')this[_0x2c0f4b(0x110)]=new _0x2133c0(_0x443037,_0x3e8d92),this[_0x2c0f4b(0x161)]=new _0xbf8b84(_0x443037,_0x3e8d92);else{let _0x28d3c3=_0xc3342a[_0x2c0f4b(0x185)]??_0xc3342a[_0x2c0f4b(0x11a)]?.[_0x2c0f4b(0x185)],_0x3f1ec4=_0xc3342a[_0x2c0f4b(0x194)]??_0xc3342a[_0x2c0f4b(0x11a)]?.[_0x2c0f4b(0x194)];if(!_0x28d3c3||!_0x3f1ec4)throw new Error(_0x2c0f4b(0x1bd));let _0x54bb4b=this['authenticator'],_0x59ebd3=(_0x536ed5,_0x14269e)=>{const _0x5ea131=_0x2c0f4b;try{_0x3f1ec4(_0x536ed5,_0x14269e);}catch(_0x34a424){console[_0x5ea131(0x12f)](_0x5ea131(0x15f)+_0x536ed5+_0x5ea131(0x1a0)+A(_0x34a424));}},_0x15b97c=(_0x3e1c68,_0x4fd357)=>{try{_0x28d3c3(_0x3e1c68,_0x4fd357);}catch(_0x3fde70){_0x59ebd3(_0x3e1c68,'moss-core\x20rejected\x20the\x20auth\x20token:\x20'+A(_0x3fde70));}},_0x273008=!0x1,_0x1795a6=(_0x1f83e4,_0x114e42)=>{const _0x3dd5b6=_0x2c0f4b;if(_0x1f83e4||!Number[_0x3dd5b6(0x1b3)](_0x114e42)||_0x114e42<0x0){_0x273008||(_0x273008=!0x0,console['warn'](_0x3dd5b6(0x136)+(_0x1f83e4?_0x1f83e4[_0x3dd5b6(0x103)]:_0x3dd5b6(0x168)+String(_0x114e42))));return;}_0x54bb4b[_0x3dd5b6(0x150)]()[_0x3dd5b6(0x106)](_0x445b86=>{const _0x425d09=_0x3dd5b6;let _0x448985=_0x445b86[_0x425d09(0x151)]('Bearer\x20')?_0x445b86[_0x425d09(0x17f)](0x7):_0x445b86;_0x15b97c(_0x114e42,_0x448985);},_0x396d56=>_0x59ebd3(_0x114e42,A(_0x396d56)));};this[_0x2c0f4b(0x12d)]=_0x1795a6;let _0x414381=_0x2133c0,_0x1ff196=_0xbf8b84;if(!_0x414381[_0x2c0f4b(0x1a5)]||!_0x1ff196[_0x2c0f4b(0x1a5)])throw new Error(_0x2c0f4b(0x1a3));this['manageClient']=_0x414381[_0x2c0f4b(0x1a5)](_0x443037,_0x1795a6),this[_0x2c0f4b(0x161)]=_0x1ff196[_0x2c0f4b(0x1a5)](_0x443037,_0x1795a6);}M(this[_0x2c0f4b(0x186)])&&j(this['indexManager']);}async['close'](){const _0x584330=_0x3db910;let _0x182a73=this[_0x584330(0x161)]['close'];if(typeof _0x182a73!=_0x584330(0x1a6))throw new Error(_0x584330(0x1a8));await _0x182a73[_0x584330(0x18b)](this[_0x584330(0x161)]);}async[_0x3db910(0x177)](){const _0x58841e=_0x3db910;return this[_0x58841e(0x10f)]['getAuthToken']();}[_0x3db910(0x119)](_0x5acfd4){if(!_0x5acfd4)return;let _0x21bfdf=!0x1;return(_0x1a702b,_0x2275a5)=>{const _0x416c38=_0x232b;let _0x4d0f9d=_0x1a702b?_0x1a702b[_0x416c38(0x103)]:de(_0x2275a5);if(_0x4d0f9d!==null){_0x21bfdf||(_0x21bfdf=!0x0,console[_0x416c38(0x12f)](_0x416c38(0xff)+_0x4d0f9d));return;}_0x5acfd4(_0x2275a5);};}[_0x3db910(0x12c)](_0x273e65){const _0x2d66a7=_0x3db910;let _0x1effcb=_0x273e65[_0x2d66a7(0x1ae)]()[_0x2d66a7(0x19b)]()[_0x2d66a7(0x124)](/\s+/g,'_'),_0x254729=_0x1effcb[_0x2d66a7(0x124)](/_/g,'');if(_0x1effcb==='pending_upload'||_0x254729===_0x2d66a7(0x13e))return _0x5d0490[_0x2d66a7(0x1b9)];if(_0x1effcb===_0x2d66a7(0x152))return _0x5d0490[_0x2d66a7(0x1b1)];if(_0x1effcb===_0x2d66a7(0x149))return _0x5d0490[_0x2d66a7(0x11d)];if(_0x1effcb==='completed')return _0x5d0490[_0x2d66a7(0x13c)];if(_0x1effcb==='failed')return _0x5d0490['Failed'];throw new Error(_0x2d66a7(0x14c)+_0x273e65+_0x2d66a7(0x147));}async['createIndex'](_0x24bd6c,_0x211cb3,_0x595335,_0x5a8a43){const _0x24ac82=_0x3db910;if(!_0x211cb3[_0x24ac82(0x12a)])throw new Error('createIndex\x20requires\x20at\x20least\x20one\x20document');return await this[_0x24ac82(0x110)][_0x24ac82(0x102)](_0x24bd6c,_0x211cb3,_0x595335,this[_0x24ac82(0x119)](_0x5a8a43?.[_0x24ac82(0x156)]));}async[_0x3db910(0x154)](_0x37c944){const _0x4641f3=_0x3db910;if(_0x37c944 instanceof Uint8Array)return Array[_0x4641f3(0x128)](_0x37c944);if(_0x37c944 instanceof ArrayBuffer)return Array[_0x4641f3(0x128)](new Uint8Array(_0x37c944));if(typeof _0x37c944[_0x4641f3(0x191)]==_0x4641f3(0x1a6)){let _0x14fb27=await _0x37c944[_0x4641f3(0x191)]();return Array[_0x4641f3(0x128)](new Uint8Array(_0x14fb27));}throw new Error('Unsupported\x20data\x20type\x20for\x20file\x20upload');}async[_0x3db910(0x145)](_0x26c9c7,_0xa427b3,_0x53251d){const _0x4e3a65=_0x3db910;if(_0xa427b3[_0x4e3a65(0x12a)]===0x0)throw new Error(_0x4e3a65(0x159));let _0x2d5ca6=_0x53251d?.[_0x4e3a65(0x1a7)]??_0x4e3a65(0x1ab),_0x48db0f=await Promise[_0x4e3a65(0x140)](_0xa427b3['map'](async _0xe27f2f=>({'name':_0xe27f2f[_0x4e3a65(0x120)],'contentType':_0xe27f2f['contentType'],'path':_0xe27f2f[_0x4e3a65(0x118)]??void 0x0,'data':_0xe27f2f['data']!=null?await this['toByteArray'](_0xe27f2f[_0x4e3a65(0x199)]):void 0x0})));return await this[_0x4e3a65(0x110)]['createIndexFromFiles'](_0x26c9c7,_0x48db0f,_0x2d5ca6,this['wrapProgress'](_0x53251d?.['onProgress']),_0x53251d?.[_0x4e3a65(0x193)]??null);}async[_0x3db910(0xfa)](_0x59bb11,_0x3269e,_0x234579){const _0x5a5c60=_0x3db910;if(Array[_0x5a5c60(0x1a1)](_0x3269e)&&_0x3269e[_0x5a5c60(0x12a)]===0x0)throw new Error('addDocs\x20requires\x20at\x20least\x20one\x20document');return await this[_0x5a5c60(0x110)][_0x5a5c60(0xfa)](_0x59bb11,_0x3269e,_0x234579??null,this[_0x5a5c60(0x119)](_0x234579?.['onProgress']));}async['deleteDocs'](_0x9efbaf,_0x13236e,_0x29a3bf){const _0x295b7e=_0x3db910;if(Array['isArray'](_0x13236e)&&_0x13236e[_0x295b7e(0x12a)]===0x0)throw new Error('deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID');return await this[_0x295b7e(0x110)]['deleteDocs'](_0x9efbaf,_0x13236e,this['wrapProgress'](_0x29a3bf?.[_0x295b7e(0x156)]));}async[_0x3db910(0x134)](_0x5626bb){const _0xc0d870=_0x3db910;let _0x1fe817=await this[_0xc0d870(0x110)][_0xc0d870(0x134)](_0x5626bb);return{..._0x1fe817,'status':this[_0xc0d870(0x12c)](_0x1fe817[_0xc0d870(0x114)]),'currentPhase':_0x1fe817['currentPhase']??null,'error':_0x1fe817[_0xc0d870(0x1b7)]??null};}async[_0x3db910(0x178)](_0x35134f){const _0xd4bc1a=_0x3db910;return this[_0xd4bc1a(0x110)][_0xd4bc1a(0x178)](_0x35134f);}async['listIndexes'](){const _0x5a6a67=_0x3db910;return this[_0x5a6a67(0x110)]['listIndexes']();}async[_0x3db910(0x16b)](_0x3e4362){const _0x49aa32=_0x3db910;return this['manageClient'][_0x49aa32(0x16b)](_0x3e4362);}async[_0x3db910(0x127)](_0x4d0ef2,_0x2916a2){const _0x2e52ee=_0x3db910;return this[_0x2e52ee(0x110)]['getDocs'](_0x4d0ef2,_0x2916a2??null);}async['loadIndex'](_0x3ffdce,_0x43cbb3){const _0x432a24=_0x3db910;this[_0x432a24(0x173)](_0x43cbb3?.[_0x432a24(0x19c)]);let _0x117777=await this[_0x432a24(0x161)][_0x432a24(0x11e)](_0x3ffdce,_0x43cbb3??null);return _0x117777[_0x432a24(0x174)]['id']!=='custom'&&await this[_0x432a24(0x161)]['loadQueryModel'](_0x3ffdce),_0x117777['name'];}async[_0x3db910(0x1a2)](_0x10cc61,_0x23061b){const _0x53dfd7=_0x3db910;let _0x210b81=this[_0x53dfd7(0x1ba)]();return this['applyIdentityToManager'](_0x23061b?.[_0x53dfd7(0x19c)]),_0x210b81['loadIndexes'](_0x10cc61,_0x23061b??null);}async[_0x3db910(0x1a9)](_0x3f6f06){const _0xdbfecc=_0x3db910;return this[_0xdbfecc(0x161)][_0xdbfecc(0x1a9)](_0x3f6f06);}async[_0x3db910(0x164)](_0x290fee){const _0x2a858d=_0x3db910;return this[_0x2a858d(0x1ba)]()[_0x2a858d(0x164)](_0x290fee);}['requireMultiIndexCore'](){const _0x56dc07=_0x3db910;let _0x1b3631=this[_0x56dc07(0x161)];if(typeof _0x1b3631[_0x56dc07(0x15b)]!=_0x56dc07(0x1a6)||typeof _0x1b3631['queryMultiIndexText']!='function'||typeof _0x1b3631[_0x56dc07(0x1a2)]!=_0x56dc07(0x1a6)||typeof _0x1b3631['unloadIndexes']!=_0x56dc07(0x1a6))throw new Error(_0x56dc07(0x165));return{'queryMultiIndex':_0x1b3631['queryMultiIndex'][_0x56dc07(0x169)](_0x1b3631),'queryMultiIndexText':_0x1b3631[_0x56dc07(0x11f)]['bind'](_0x1b3631),'loadIndexes':_0x1b3631[_0x56dc07(0x1a2)][_0x56dc07(0x169)](_0x1b3631),'unloadIndexes':_0x1b3631[_0x56dc07(0x164)][_0x56dc07(0x169)](_0x1b3631)};}[_0x3db910(0x173)](_0x2b466f){const _0x3fb90d=_0x3db910;N(this[_0x3fb90d(0x161)],this[_0x3fb90d(0x107)],this['configuredIdentity'],this[_0x3fb90d(0x172)]??_0x2b466f);}[_0x3db910(0xfc)](){const _0x2cd18b=_0x3db910;return v(this[_0x2cd18b(0x107)],this[_0x2cd18b(0x186)],this[_0x2cd18b(0x172)]);}[_0x3db910(0x18c)](){const _0x19e7df=_0x3db910;return this[_0x19e7df(0x12d)]!==void 0x0;}async['createAuthenticatedSessionInner'](_0x6b9021,_0x3ad55a,_0x22c36b){const _0x4f9a17=_0x3db910;if(!this[_0x4f9a17(0x12d)])throw new Error(_0x4f9a17(0x122));let _0x4a966f=_0x20f1c6,_0x179fe4=_0x4a966f[_0x4f9a17(0x197)]??_0x4a966f[_0x4f9a17(0x11a)]?.[_0x4f9a17(0x197)];if(!_0x179fe4||typeof _0x179fe4[_0x4f9a17(0x1a5)]!='function')throw new Error(_0x4f9a17(0x18d));return _0x22c36b&&y(_0x179fe4),_0x179fe4[_0x4f9a17(0x1a5)](_0x6b9021,_0x3ad55a,this[_0x4f9a17(0x163)],this[_0x4f9a17(0x12d)],null,null,_0x22c36b?.[_0x4f9a17(0x196)]??null,_0x22c36b?.['manifestSha256']??null);}async[_0x3db910(0x13f)](_0x23174d,_0x523374,_0x5d036e){const _0x206ad0=_0x3db910;if(!await this[_0x206ad0(0x161)][_0x206ad0(0x1b6)](_0x23174d))throw new Error(_0x206ad0(0x105)+_0x23174d+'\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22'+_0x23174d+'\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.');let _0x447535=_0x5d036e?.['topK']??0x5,_0x2685ba=_0x5d036e?.[_0x206ad0(0x160)]??0.8;return _0x5d036e?.['embedding']?this[_0x206ad0(0x161)][_0x206ad0(0x13f)](_0x23174d,_0x523374,_0x5d036e[_0x206ad0(0x195)],_0x447535,_0x2685ba,_0x5d036e?.[_0x206ad0(0x17d)]):this[_0x206ad0(0x161)][_0x206ad0(0x1b2)](_0x23174d,_0x523374,_0x447535,_0x2685ba,_0x5d036e?.['filter']);}async[_0x3db910(0x15b)](_0x5a658a,_0x90a6cb,_0x354b18){const _0x123ded=_0x3db910;if(_0x5a658a[_0x123ded(0x12a)]===0x0)throw new Error('queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name');let _0x3a5866=this[_0x123ded(0x1ba)](),_0x3380e7=_0x354b18?.['topK']??0xa,_0x4f309b=_0x354b18?.[_0x123ded(0x160)]??0.8;if(_0x354b18?.[_0x123ded(0x195)])return _0x3a5866['queryMultiIndex'](_0x5a658a,_0x90a6cb,_0x354b18[_0x123ded(0x195)],_0x3380e7,_0x4f309b,_0x354b18?.[_0x123ded(0x17d)]);try{return await _0x3a5866[_0x123ded(0x11f)](_0x5a658a,_0x90a6cb,_0x3380e7,_0x4f309b,_0x354b18?.[_0x123ded(0x17d)]);}catch(_0x541ea9){throw _0x541ea9 instanceof Error&&_0x541ea9[_0x123ded(0x103)][_0x123ded(0x1bb)](_0x123ded(0x181))?new Error(_0x541ea9[_0x123ded(0x103)]+_0x123ded(0x192),{'cause':_0x541ea9}):_0x541ea9 instanceof Error&&_0x541ea9['message'][_0x123ded(0x1bb)](_0x123ded(0x131))?new Error(_0x123ded(0x1ad),{'cause':_0x541ea9}):_0x541ea9;}}};import{SessionIndex as _0x1504d4}from'@moss-js/moss-core';var h=class r{#e;#r;#s;#o=!0x1;#i;constructor(_0x138e46,_0x569b97,_0x5d44bc){this.#s=_0x138e46,this.#r=_0x569b97,this.#e=_0x5d44bc;}static async[_0x3db910(0x113)](_0x370121,_0x20f475,_0x314728,_0xb572cd,_0x4ab90f,_0x13c537,_0x50f5ec){const _0x3400be=_0x3db910;let _0x46d8a5=_0x1504d4;_0x50f5ec&&y(_0x46d8a5);let _0x43d82b=await _0x46d8a5[_0x3400be(0x13b)](_0x370121,_0x20f475,_0x314728,_0xb572cd,_0x4ab90f??null,_0x50f5ec?.[_0x3400be(0x196)]??null,_0x50f5ec?.['manifestSha256']??null);return r[_0x3400be(0x179)](_0x370121,_0x20f475,_0x43d82b,_0x13c537);}static[_0x3db910(0x179)](_0x244965,_0x562161,_0x215358,_0x1348bf){return _0x1348bf&&P(_0x215358,_0x1348bf),new r(_0x244965,_0x562161,_0x215358);}get[_0x3db910(0x120)](){return this.#s;}get[_0x3db910(0x18f)](){const _0x2385db=_0x3db910;return this.#n(),this.#e[_0x2385db(0x18f)];}get[_0x3db910(0x1a7)](){return this.#r;}async['addDocs'](_0x4b6b77,_0x42e5bd){const _0x10a75c=_0x3db910;this.#n();let _0x321ece=_0x42e5bd?{'upsert':_0x42e5bd['upsert']??!0x0}:void 0x0;if(this.#r==='custom'){let _0x4630be=r.#a(_0x4b6b77),_0x5760e5=_0x4b6b77[_0x10a75c(0x121)](_0x5a0295=>{const _0x229a41=_0x10a75c;let _0x156308={..._0x5a0295};return delete _0x156308[_0x229a41(0x195)],_0x156308;}),_0x584dc6=this.#e[_0x10a75c(0x18a)](_0x5760e5,_0x4630be,_0x321ece);return{'added':_0x584dc6[_0x10a75c(0x111)],'updated':_0x584dc6[_0x10a75c(0x1bc)]};}let _0x1591d9=this.#e[_0x10a75c(0x123)](_0x4b6b77,_0x321ece);return{'added':_0x1591d9[_0x10a75c(0x111)],'updated':_0x1591d9['updated']};}async['deleteDocs'](_0x4787b1){const _0x2752d5=_0x3db910;return this.#n(),this.#e[_0x2752d5(0x12b)](_0x4787b1);}async[_0x3db910(0x127)](_0x5e0f49){const _0x47dcd5=_0x3db910;return this.#n(),this.#e[_0x47dcd5(0x188)](_0x5e0f49??null);}async['query'](_0x3b6c77,_0x121232){const _0x3d4b1a=_0x3db910;this.#n();let _0x50cc54=_0x121232?.['topK']??0x5,_0x327f11=_0x121232?.[_0x3d4b1a(0x160)]??0.8,_0x50c3d5=_0x121232?.[_0x3d4b1a(0x17d)]??null,_0x3b996d=_0x121232?.['embedding'];if(_0x3b996d==null){if(this.#r==='custom')throw new Error(_0x3d4b1a(0xfb));return this.#e['queryText'](_0x3b6c77,_0x50cc54,_0x327f11,_0x50c3d5);}return this.#e['query'](_0x3b6c77,_0x50cc54,Array[_0x3d4b1a(0x128)](_0x3b996d),_0x327f11,_0x50c3d5);}async[_0x3db910(0x11e)](_0x22d4f3,_0x182851){return this.#n(),this.#e['loadIndex'](_0x22d4f3,_0x182851??null);}async['pushIndex'](){const _0x5aca55=_0x3db910;return this.#n(),this.#e[_0x5aca55(0x17b)]();}async[_0x3db910(0x198)](_0x3891dd){const _0x388bc7=_0x3db910;this.#n(),this.#e[_0x388bc7(0x198)](_0x3891dd);}async[_0x3db910(0x14f)](_0x30938e){return this.#n(),this.#e['loadFromDisk'](_0x30938e);}#n(){const _0x73c020=_0x3db910;if(this.#o)throw new Error('SessionIndex\x20\x27'+this.#s+_0x73c020(0x11c));}[_0x3db910(0x115)](){return this.#i??=this.#t(),this.#i;}async #t(){const _0xdc15c6=_0x3db910;this.#o=!0x0;let _0x4a3ef2=this.#e[_0xdc15c6(0x115)];if(typeof _0x4a3ef2!=_0xdc15c6(0x1a6))throw new Error(_0xdc15c6(0x135));await _0x4a3ef2[_0xdc15c6(0x18b)](this.#e);}async[Symbol[_0x3db910(0x108)]](){const _0x1fcd21=_0x3db910;return this[_0x1fcd21(0x115)]();}async[_0x3db910(0x187)](){const _0x5ae6e6=_0x3db910;this.#n(),this.#r!=='custom'&&this.#e[_0x5ae6e6(0x138)]();}static#a(_0x23b960){const _0x34971a=_0x3db910;let _0x4df5e4=_0x23b960[_0x34971a(0x17d)](_0x161b3f=>!_0x161b3f[_0x34971a(0x195)]||_0x161b3f[_0x34971a(0x195)][_0x34971a(0x12a)]===0x0)[_0x34971a(0x121)](_0x2fa692=>_0x2fa692['id']);if(_0x4df5e4['length']>0x0)throw new Error(_0x34971a(0x1a4)+_0x4df5e4['join'](',\x20')+_0x34971a(0x1b8));return _0x23b960[_0x34971a(0x121)](_0x2c2e9f=>Array['from'](_0x2c2e9f[_0x34971a(0x195)]??[]));}},B=_0x3db910(0x1ab),S=class{#e;#r;#s;#o=!0x1;#i;#n=new Set();constructor(_0x4d46eb,_0x27fead,_0x2d261d){const _0x35ba3c=_0x3db910;this.#e=new x(_0x4d46eb,_0x27fead,_0x2d261d),this.#r=_0x4d46eb,this.#s=typeof _0x27fead==_0x35ba3c(0x10e)?_0x27fead:null;}async[_0x3db910(0x177)](){const _0x1cb100=_0x3db910;return this.#t(),this.#e[_0x1cb100(0x177)]();}async['createIndex'](_0x67bac4,_0x109d9e,_0x3a2745){const _0x202323=_0x3db910;this.#t();let _0x22dbd1;return _0x3a2745?.[_0x202323(0x1a7)]!==void 0x0?_0x22dbd1=_0x3a2745[_0x202323(0x1a7)]:_0x22dbd1=_0x109d9e[_0x202323(0x1b0)](_0x4e3047=>Array[_0x202323(0x1a1)](_0x4e3047[_0x202323(0x195)])&&_0x4e3047[_0x202323(0x195)]['length']>0x0)?_0x202323(0x143):B,this.#e[_0x202323(0x102)](_0x67bac4,_0x109d9e,_0x22dbd1,_0x3a2745);}async[_0x3db910(0x145)](_0x567dab,_0x443038,_0x24289c){const _0x2b6c75=_0x3db910;return this.#t(),this.#e[_0x2b6c75(0x145)](_0x567dab,_0x443038,_0x24289c);}async['getIndex'](_0x3be7df){const _0x5fc3b7=_0x3db910;return this.#t(),this.#e[_0x5fc3b7(0x178)](_0x3be7df);}async['listIndexes'](){return this.#t(),this.#e['listIndexes']();}async[_0x3db910(0x16b)](_0x4d0e2c){const _0x4cd9b8=_0x3db910;return this.#t(),this.#e[_0x4cd9b8(0x16b)](_0x4d0e2c);}async['addDocs'](_0x4e929d,_0x3ec44e,_0x391951){const _0x41eb58=_0x3db910;return this.#t(),this.#e[_0x41eb58(0xfa)](_0x4e929d,_0x3ec44e,_0x391951);}async[_0x3db910(0x158)](_0x2c4812,_0x4e8be0,_0x41b1c2){const _0x302568=_0x3db910;return this.#t(),this.#e[_0x302568(0x158)](_0x2c4812,_0x4e8be0,_0x41b1c2);}async[_0x3db910(0x134)](_0x578de0){const _0x56489a=_0x3db910;return this.#t(),this.#e[_0x56489a(0x134)](_0x578de0);}async[_0x3db910(0x127)](_0x1feb55,_0x39ea9b){const _0x14b533=_0x3db910;return this.#t(),this.#e[_0x14b533(0x127)](_0x1feb55,_0x39ea9b);}async['loadIndex'](_0x3bec77,_0x24df53){const _0x3a0cd5=_0x3db910;return this.#t(),this.#e[_0x3a0cd5(0x11e)](_0x3bec77,_0x24df53);}async[_0x3db910(0x1a2)](_0x4cfeaa,_0x2a022){const _0x599dcb=_0x3db910;return this.#t(),this.#e[_0x599dcb(0x1a2)](_0x4cfeaa,_0x2a022);}async['unloadIndex'](_0x588b49){const _0x54ca56=_0x3db910;return this.#t(),this.#e[_0x54ca56(0x1a9)](_0x588b49);}async[_0x3db910(0x164)](_0x137a50){return this.#t(),this.#e['unloadIndexes'](_0x137a50);}async[_0x3db910(0x13f)](_0x4f44b6,_0x2e71e1,_0x46bbbb){return this.#t(),this.#e['query'](_0x4f44b6,_0x2e71e1,_0x46bbbb);}async['queryMultiIndex'](_0x211446,_0x152b89,_0x43d1f){const _0x26856f=_0x3db910;return this.#t(),this.#e[_0x26856f(0x15b)](_0x211446,_0x152b89,_0x43d1f);}async['session'](_0x8c33e9,_0x3b9cba=B,_0x2a9342){const _0x4d4214=_0x3db910;this.#t();let _0x537fbf=this.#e[_0x4d4214(0xfc)](),_0x1f4445;if(this.#s!==null)_0x1f4445=await h[_0x4d4214(0x113)](_0x8c33e9,_0x3b9cba,this.#r,this.#s,void 0x0,_0x537fbf,_0x2a9342);else{let _0x51582e=await this.#e[_0x4d4214(0x144)](_0x8c33e9,_0x3b9cba,_0x2a9342);_0x1f4445=h[_0x4d4214(0x179)](_0x8c33e9,_0x3b9cba,_0x51582e,_0x537fbf);}await _0x1f4445['_warmModel']();for(let _0x530370 of this.#n)_0x530370[_0x4d4214(0x183)]()||this.#n[_0x4d4214(0x132)](_0x530370);return this.#n['add'](new WeakRef(_0x1f4445)),_0x1f4445;}#t(){if(this.#o)throw new Error('MossClient\x20is\x20closed');}['close'](){return this.#i??=this.#a(),this.#i;}async #a(){const _0x127a92=_0x3db910;this.#o=!0x0;let _0xbe1f5e=[...this.#n][_0x127a92(0x121)](_0x17c068=>_0x17c068[_0x127a92(0x183)]())[_0x127a92(0x17d)](_0x589b96=>_0x589b96!==void 0x0);this.#n[_0x127a92(0x1ac)](),await Promise['all'](_0xbe1f5e[_0x127a92(0x121)](_0x37aba0=>_0x37aba0[_0x127a92(0x115)]())),await this.#e[_0x127a92(0x115)]();}async[Symbol['asyncDispose']](){return this['close']();}};export{S as MossClient,h as SessionIndex};
|
|
1
|
+
const _0x383a96=_0x7cc7;(function(_0x2868ab,_0x463f85){const _0x13163a=_0x7cc7,_0x3dadad=_0x2868ab();while(!![]){try{const _0x1b55a6=parseInt(_0x13163a(0x1ea))/0x1+-parseInt(_0x13163a(0x219))/0x2*(-parseInt(_0x13163a(0x21a))/0x3)+-parseInt(_0x13163a(0x1bd))/0x4+-parseInt(_0x13163a(0x22a))/0x5*(parseInt(_0x13163a(0x261))/0x6)+-parseInt(_0x13163a(0x1a9))/0x7*(-parseInt(_0x13163a(0x244))/0x8)+parseInt(_0x13163a(0x1be))/0x9+parseInt(_0x13163a(0x201))/0xa*(-parseInt(_0x13163a(0x212))/0xb);if(_0x1b55a6===_0x463f85)break;else _0x3dadad['push'](_0x3dadad['shift']());}catch(_0x4526db){_0x3dadad['push'](_0x3dadad['shift']());}}}(_0x7380,0x7dfb5));import{JobStatus as _0x4813ef}from'@moss-js/moss-core';function _0x7cc7(_0x803d5e,_0x3653e7){_0x803d5e=_0x803d5e-0x1a8;const _0x7380f5=_0x7380();let _0x7cc760=_0x7380f5[_0x803d5e];return _0x7cc760;}import*as _0x31db36 from'@moss-js/moss-core';import*as _0x3ddaff from'@moss-js/moss-core';var g=_0x3ddaff,oe=g[_0x383a96(0x232)],ie=g[_0x383a96(0x1d7)],ae=g[_0x383a96(0x20c)],O=g[_0x383a96(0x242)],ue=typeof process<'u'&&process[_0x383a96(0x235)][_0x383a96(0x213)]||g[_0x383a96(0x20e)],T=typeof process<'u'?process[_0x383a96(0x235)]:{},f=class{constructor(_0x135efe,_0x1e8e57){const _0x2e2cca=_0x383a96;this[_0x2e2cca(0x1da)]=_0x135efe,this[_0x2e2cca(0x269)]=_0x1e8e57,this[_0x2e2cca(0x1cd)]=T[_0x2e2cca(0x27b)]??O;}[_0x383a96(0x1da)];[_0x383a96(0x269)];[_0x383a96(0x1cd)];async['getAuthToken'](){const _0x2d8b5=_0x383a96;let _0x91195f=await fetch(this[_0x2d8b5(0x1cd)],{'method':_0x2d8b5(0x1b2),'headers':{'Content-Type':_0x2d8b5(0x27e)},'body':JSON[_0x2d8b5(0x1dd)]({'projectId':this['projectId'],'projectKey':this[_0x2d8b5(0x269)]}),'signal':AbortSignal['timeout'](0x7530)});if(_0x91195f[_0x2d8b5(0x1c4)]===0x191){let _0x3ff1f1=await _0x91195f[_0x2d8b5(0x23b)]();throw new Error(_0x2d8b5(0x227)+_0x3ff1f1);}if(!_0x91195f['ok']){let _0x180502=await _0x91195f['text']();throw new Error(_0x2d8b5(0x268)+_0x91195f[_0x2d8b5(0x1c4)]+':\x20'+_0x180502);}let _0x396a6c=await _0x91195f[_0x2d8b5(0x249)]();return{'token':_0x396a6c[_0x2d8b5(0x27a)],'expiresIn':_0x396a6c[_0x2d8b5(0x21b)]};}async[_0x383a96(0x26b)](){const _0x563958=_0x383a96;let {token:_0x37623e}=await this[_0x563958(0x265)]();return _0x563958(0x241)+_0x37623e;}},I=class{constructor(_0x2ec7c7){this['inner']=_0x2ec7c7;}['inner'];[_0x383a96(0x20f)]=null;[_0x383a96(0x1e1)]=null;async[_0x383a96(0x265)](){const _0x4abb25=_0x383a96;if(this[_0x4abb25(0x20f)]&&this[_0x4abb25(0x20f)][_0x4abb25(0x27d)]>Date['now']())return{'token':this[_0x4abb25(0x20f)][_0x4abb25(0x27a)],'expiresIn':this['cache'][_0x4abb25(0x21b)]};if(this[_0x4abb25(0x1e1)])return this[_0x4abb25(0x1e1)];this[_0x4abb25(0x1e1)]=this[_0x4abb25(0x1ba)]();try{return await this[_0x4abb25(0x1e1)];}finally{this['inflight']=null;}}async[_0x383a96(0x26b)](){const _0x2df21a=_0x383a96;let {token:_0x1bf587}=await this[_0x2df21a(0x265)]();return _0x2df21a(0x241)+_0x1bf587;}async[_0x383a96(0x1ba)](){const _0x3b2966=_0x383a96;let {token:_0x3df15f,expiresIn:_0x342979}=await this['inner'][_0x3b2966(0x265)](),_0x53004e=Date[_0x3b2966(0x1ff)]()+(_0x342979-0x3c)*0x3e8;return this[_0x3b2966(0x20f)]={'token':_0x3df15f,'expiresIn':_0x342979,'expiresAt':_0x53004e},{'token':_0x3df15f,'expiresIn':_0x342979};}};import{randomUUID as _0x4ee26c}from'node:crypto';import{existsSync as _0x218176,mkdirSync as _0x3e5e92,readFileSync as _0x2c52d0,writeFileSync as _0x4fb13a}from'node:fs';import{join as _0x2d4aab}from'node:path';var X='.moss-device-id',P=0x100,_=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u;function z(_0x58fd11){const _0x237066=_0x383a96;return _0x58fd11['length']>0x0&&_0x58fd11['trim']()===_0x58fd11&&!_['test'](_0x58fd11)&&new TextEncoder()[_0x237066(0x240)](_0x58fd11)[_0x237066(0x1ca)]<=P;}function E(_0x4ce1ff,_0x5a5c20){const _0x436ca1=_0x383a96;if(_0x4ce1ff!==void 0x0){if(typeof _0x4ce1ff!=_0x436ca1(0x218)||_0x4ce1ff[_0x436ca1(0x21f)]===0x0)throw new TypeError(_0x436ca1(0x22b)+_0x5a5c20+_0x436ca1(0x1ed));if(_0x4ce1ff[_0x436ca1(0x1b1)]()!==_0x4ce1ff)throw new TypeError(_0x436ca1(0x22b)+_0x5a5c20+'\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace');if(_[_0x436ca1(0x1bf)](_0x4ce1ff))throw new TypeError('MossClient\x20options.identity.'+_0x5a5c20+_0x436ca1(0x1f3));if(new TextEncoder()[_0x436ca1(0x240)](_0x4ce1ff)[_0x436ca1(0x1ca)]>P)throw new TypeError(_0x436ca1(0x22b)+_0x5a5c20+'\x20must\x20be\x20at\x20most\x20'+P+'\x20UTF-8\x20bytes');return _0x4ce1ff;}}function k(_0x579dad){const _0x85139c=_0x383a96;if(_0x579dad!==void 0x0){if(_0x579dad===null||typeof _0x579dad!=_0x85139c(0x1c8)||Array['isArray'](_0x579dad))throw new TypeError('MossClient\x20options.identity\x20must\x20be\x20an\x20object');return Object[_0x85139c(0x1cf)]({'deviceId':E(_0x579dad[_0x85139c(0x1c9)],'deviceId'),'userId':E(_0x579dad[_0x85139c(0x24b)],_0x85139c(0x24b))});}}function U(_0x40e6b8){const _0x4357e4=_0x383a96;return _0x40e6b8?.[_0x4357e4(0x1c9)]!==void 0x0||_0x40e6b8?.[_0x4357e4(0x24b)]!==void 0x0;}function M(_0x2cc903){const _0x2caddf=_0x383a96;if(!_0x2cc903?.['trim']())return;let _0x203831=_0x2d4aab(_0x2cc903,X);try{if(_0x218176(_0x203831)){let _0xfb0f1b=_0x2c52d0(_0x203831,'utf8')[_0x2caddf(0x1b1)]();return z(_0xfb0f1b)?_0xfb0f1b:void 0x0;}_0x3e5e92(_0x2cc903,{'recursive':!0x0});let _0x1cac80=_0x4ee26c();return _0x4fb13a(_0x203831,_0x1cac80,_0x2caddf(0x24f)),_0x1cac80;}catch{return;}}var Y=0x1;function y(_0xd975fd){const _0x5ded73=_0x383a96;let _0x45b689=_0xd975fd[_0x5ded73(0x207)];if(typeof _0x45b689!=_0x5ded73(0x1d2))throw q();let _0x4d8aa7=_0x45b689[_0x5ded73(0x274)](_0xd975fd);if(!Number['isSafeInteger'](_0x4d8aa7)||_0x4d8aa7<Y)throw q();}function q(){return new Error('The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.');}var Ie=0x708*0x3e8;function S(_0x4af0c8){const _0x31534d=_0x383a96;return _0x4af0c8 instanceof Error?_0x4af0c8[_0x31534d(0x259)]:String(_0x4af0c8);}function Z(_0x52b1ff){const _0x425524=_0x383a96;if(_0x52b1ff===null||typeof _0x52b1ff!=_0x425524(0x1c8))return'received\x20'+String(_0x52b1ff);if(Array[_0x425524(0x1aa)](_0x52b1ff))return _0x425524(0x24e);let _0x439cc8=_0x52b1ff;return typeof _0x439cc8[_0x425524(0x231)]!='string'||_0x439cc8[_0x425524(0x231)][_0x425524(0x21f)]===0x0?'received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20('+String(_0x439cc8[_0x425524(0x231)])+')':typeof _0x439cc8[_0x425524(0x1c4)]!=_0x425524(0x218)||_0x439cc8[_0x425524(0x1c4)][_0x425524(0x21f)]===0x0?_0x425524(0x20b)+String(_0x439cc8['status'])+')':typeof _0x439cc8[_0x425524(0x23a)]!='number'||!Number[_0x425524(0x26e)](_0x439cc8[_0x425524(0x23a)])?_0x425524(0x1b0)+String(_0x439cc8[_0x425524(0x23a)])+')':_0x439cc8[_0x425524(0x250)]!==void 0x0&&_0x439cc8['currentPhase']!==null&&typeof _0x439cc8['currentPhase']!=_0x425524(0x218)?_0x425524(0x21d)+String(_0x439cc8[_0x425524(0x250)])+')':null;}var x=class{[_0x383a96(0x1c7)];[_0x383a96(0x225)];[_0x383a96(0x21e)];[_0x383a96(0x263)];[_0x383a96(0x1b9)];[_0x383a96(0x1da)];[_0x383a96(0x1df)];constructor(_0x68fa9b,_0x1e525b,_0x5f103b){const _0x56c035=_0x383a96;this[_0x56c035(0x1b9)]=k(_0x5f103b?.[_0x56c035(0x1ef)]),this['cachePathDeviceId']=M(_0x5f103b?.['cachePath']),this[_0x56c035(0x1da)]=_0x68fa9b;let _0x2d61c7=typeof _0x1e525b==_0x56c035(0x218)?new f(_0x68fa9b,_0x1e525b):_0x1e525b;this['authenticator']=new I(_0x2d61c7);let _0x3a9845=_0x31db36,_0x4b12b0=_0x3a9845[_0x56c035(0x1a8)]??_0x3a9845['default']?.[_0x56c035(0x1a8)],_0x27e44e=_0x3a9845[_0x56c035(0x1ae)]??_0x3a9845['default']?.[_0x56c035(0x1ae)];if(!_0x4b12b0||!_0x27e44e)throw new Error(_0x56c035(0x238));if(typeof _0x1e525b==_0x56c035(0x218))this[_0x56c035(0x225)]=new _0x4b12b0(_0x68fa9b,_0x1e525b),this[_0x56c035(0x21e)]=new _0x27e44e(_0x68fa9b,_0x1e525b);else{let _0x2baa16=_0x3a9845[_0x56c035(0x202)]??_0x3a9845[_0x56c035(0x246)]?.[_0x56c035(0x202)],_0x5f5d4e=_0x3a9845[_0x56c035(0x1ec)]??_0x3a9845[_0x56c035(0x246)]?.[_0x56c035(0x1ec)];if(!_0x2baa16||!_0x5f5d4e)throw new Error(_0x56c035(0x215));let _0x382a04=this['authenticator'],_0x1d4d59=(_0x2c28d2,_0x5e8999)=>{const _0x10f29e=_0x56c035;try{_0x5f5d4e(_0x2c28d2,_0x5e8999);}catch(_0x21db68){console[_0x10f29e(0x1d4)](_0x10f29e(0x233)+_0x2c28d2+_0x10f29e(0x22f)+S(_0x21db68));}},_0x2cfede=(_0x422f69,_0x54ce1d)=>{const _0x3727b6=_0x56c035;try{_0x2baa16(_0x422f69,_0x54ce1d);}catch(_0x328862){_0x1d4d59(_0x422f69,_0x3727b6(0x203)+S(_0x328862));}},_0x28a5a4=!0x1,_0xb8075c=(_0x145c4e,_0x416cfc)=>{const _0x347d60=_0x56c035;if(_0x145c4e||!Number['isSafeInteger'](_0x416cfc)||_0x416cfc<0x0){_0x28a5a4||(_0x28a5a4=!0x0,console[_0x347d60(0x1d4)]('[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20'+(_0x145c4e?_0x145c4e[_0x347d60(0x259)]:'received\x20'+String(_0x416cfc))));return;}_0x382a04['getAuthHeader']()[_0x347d60(0x1b4)](_0x297a9e=>{const _0x34941a=_0x347d60;let _0x1d0ab2=_0x297a9e[_0x34941a(0x23f)](_0x34941a(0x241))?_0x297a9e[_0x34941a(0x25a)](0x7):_0x297a9e;_0x2cfede(_0x416cfc,_0x1d0ab2);},_0x12798c=>_0x1d4d59(_0x416cfc,S(_0x12798c)));};this['authNotifyFn']=_0xb8075c;let _0x32bfcf=_0x4b12b0,_0x125b02=_0x27e44e;if(!_0x32bfcf[_0x56c035(0x271)]||!_0x125b02[_0x56c035(0x271)])throw new Error(_0x56c035(0x1ab));this[_0x56c035(0x225)]=_0x32bfcf[_0x56c035(0x271)](_0x68fa9b,_0xb8075c),this['indexManager']=_0x125b02[_0x56c035(0x271)](_0x68fa9b,_0xb8075c);}this['applyIdentity'](this[_0x56c035(0x21e)]);}async[_0x383a96(0x24c)](){const _0x1b2d4a=_0x383a96;let _0x1ac1ea=this['indexManager'][_0x1b2d4a(0x24c)];if(typeof _0x1ac1ea!='function')throw new Error(_0x1b2d4a(0x1db));await _0x1ac1ea[_0x1b2d4a(0x274)](this[_0x1b2d4a(0x21e)]);}async[_0x383a96(0x265)](){const _0x3dc99b=_0x383a96;return this['authenticator'][_0x3dc99b(0x265)]();}[_0x383a96(0x266)](_0x2b7e59){if(!_0x2b7e59)return;let _0x5654f2=!0x1;return(_0x24201d,_0x196829)=>{const _0x145469=_0x7cc7;let _0x2e8f0a=_0x24201d?_0x24201d[_0x145469(0x259)]:Z(_0x196829);if(_0x2e8f0a!==null){_0x5654f2||(_0x5654f2=!0x0,console[_0x145469(0x1d4)](_0x145469(0x267)+_0x2e8f0a));return;}_0x2b7e59(_0x196829);};}[_0x383a96(0x1f9)](_0x6b6025){const _0x400f09=_0x383a96;let _0x4e8fb7=_0x6b6025[_0x400f09(0x1b1)]()[_0x400f09(0x1f2)]()[_0x400f09(0x1d1)](/\s+/g,'_'),_0x2c3529=_0x4e8fb7[_0x400f09(0x1d1)](/_/g,'');if(_0x4e8fb7===_0x400f09(0x1f4)||_0x2c3529===_0x400f09(0x256))return _0x4813ef[_0x400f09(0x22c)];if(_0x4e8fb7===_0x400f09(0x1b8))return _0x4813ef[_0x400f09(0x276)];if(_0x4e8fb7===_0x400f09(0x223))return _0x4813ef[_0x400f09(0x1d6)];if(_0x4e8fb7==='completed')return _0x4813ef['Completed'];if(_0x4e8fb7==='failed')return _0x4813ef['Failed'];throw new Error(_0x400f09(0x1dc)+_0x6b6025+_0x400f09(0x253));}async[_0x383a96(0x25d)](_0x4ba87e,_0x5ac3ec,_0x1cc202,_0x524db8){const _0x4c1816=_0x383a96;if(!_0x5ac3ec[_0x4c1816(0x21f)])throw new Error(_0x4c1816(0x1e0));return await this['manageClient'][_0x4c1816(0x25d)](_0x4ba87e,_0x5ac3ec,_0x1cc202,this[_0x4c1816(0x266)](_0x524db8?.[_0x4c1816(0x1f5)]));}async[_0x383a96(0x1c1)](_0x4a4b4c){const _0x49e3f2=_0x383a96;if(_0x4a4b4c instanceof Uint8Array)return Array[_0x49e3f2(0x229)](_0x4a4b4c);if(_0x4a4b4c instanceof ArrayBuffer)return Array[_0x49e3f2(0x229)](new Uint8Array(_0x4a4b4c));if(typeof _0x4a4b4c[_0x49e3f2(0x1e2)]==_0x49e3f2(0x1d2)){let _0x37f925=await _0x4a4b4c[_0x49e3f2(0x1e2)]();return Array[_0x49e3f2(0x229)](new Uint8Array(_0x37f925));}throw new Error('Unsupported\x20data\x20type\x20for\x20file\x20upload');}async[_0x383a96(0x1f1)](_0x456103,_0x95ba10,_0x3aa294){const _0x1fc903=_0x383a96;if(_0x95ba10['length']===0x0)throw new Error(_0x1fc903(0x257));let _0x21212f=_0x3aa294?.['modelId']??_0x1fc903(0x1f0),_0x30ad2d=await Promise[_0x1fc903(0x270)](_0x95ba10[_0x1fc903(0x252)](async _0x189b16=>({'name':_0x189b16['name'],'contentType':_0x189b16[_0x1fc903(0x26f)],'path':_0x189b16[_0x1fc903(0x1de)]??void 0x0,'data':_0x189b16['data']!=null?await this[_0x1fc903(0x1c1)](_0x189b16['data']):void 0x0})));return await this[_0x1fc903(0x225)][_0x1fc903(0x1f1)](_0x456103,_0x30ad2d,_0x21212f,this[_0x1fc903(0x266)](_0x3aa294?.['onProgress']),_0x3aa294?.[_0x1fc903(0x1e6)]??null);}async[_0x383a96(0x24a)](_0x213b9c,_0x1ce9a9,_0x177ce7){const _0x50bc8b=_0x383a96;if(Array[_0x50bc8b(0x1aa)](_0x1ce9a9)&&_0x1ce9a9[_0x50bc8b(0x21f)]===0x0)throw new Error(_0x50bc8b(0x1cb));return await this['manageClient']['addDocs'](_0x213b9c,_0x1ce9a9,_0x177ce7??null,this['wrapProgress'](_0x177ce7?.[_0x50bc8b(0x1f5)]));}async[_0x383a96(0x277)](_0x3aa4ac,_0x3532b2,_0x275e1a){const _0x207949=_0x383a96;if(Array[_0x207949(0x1aa)](_0x3532b2)&&_0x3532b2[_0x207949(0x21f)]===0x0)throw new Error(_0x207949(0x1d5));return await this['manageClient']['deleteDocs'](_0x3aa4ac,_0x3532b2,this[_0x207949(0x266)](_0x275e1a?.[_0x207949(0x1f5)]));}async[_0x383a96(0x1e3)](_0x27f53d){const _0x38db62=_0x383a96;let _0x259365=await this[_0x38db62(0x225)][_0x38db62(0x1e3)](_0x27f53d);return{..._0x259365,'status':this[_0x38db62(0x1f9)](_0x259365[_0x38db62(0x1c4)]),'currentPhase':_0x259365['currentPhase']??null,'error':_0x259365[_0x38db62(0x200)]??null};}async['getIndex'](_0x5195fe){return this['manageClient']['getIndex'](_0x5195fe);}async[_0x383a96(0x205)](){const _0x4f3173=_0x383a96;return this['manageClient'][_0x4f3173(0x205)]();}async['deleteIndex'](_0x250c94){const _0x98b426=_0x383a96;return this[_0x98b426(0x225)][_0x98b426(0x239)](_0x250c94);}async[_0x383a96(0x25f)](_0x5e8675,_0x5cc263){const _0x1dd429=_0x383a96;return this[_0x1dd429(0x225)][_0x1dd429(0x25f)](_0x5e8675,_0x5cc263??null);}async[_0x383a96(0x204)](_0x2df8c0,_0x1b707e){const _0x26e1c3=_0x383a96;this[_0x26e1c3(0x1e8)](_0x1b707e?.[_0x26e1c3(0x1c6)]);let _0x546cd8=await this['indexManager'][_0x26e1c3(0x204)](_0x2df8c0,_0x1b707e??null);return _0x546cd8[_0x26e1c3(0x273)]['id']!==_0x26e1c3(0x1bb)&&await this[_0x26e1c3(0x21e)]['loadQueryModel'](_0x2df8c0),_0x546cd8[_0x26e1c3(0x1e4)];}async[_0x383a96(0x262)](_0x5ee11c,_0x1d8524){const _0x436bc0=_0x383a96;let _0x4fd944=this[_0x436bc0(0x1d9)]();return this[_0x436bc0(0x1e8)](_0x1d8524?.[_0x436bc0(0x1c6)]),_0x4fd944[_0x436bc0(0x262)](_0x5ee11c,_0x1d8524??null);}async[_0x383a96(0x26d)](_0x3c4033){const _0x221591=_0x383a96;return this[_0x221591(0x21e)][_0x221591(0x26d)](_0x3c4033);}async[_0x383a96(0x221)](_0x489aa5){const _0x3b90d6=_0x383a96;return this['requireMultiIndexCore']()[_0x3b90d6(0x221)](_0x489aa5);}[_0x383a96(0x1d9)](){const _0x3ead3e=_0x383a96;let _0x29e4d1=this[_0x3ead3e(0x21e)];if(typeof _0x29e4d1[_0x3ead3e(0x217)]!='function'||typeof _0x29e4d1[_0x3ead3e(0x23c)]!=_0x3ead3e(0x1d2)||typeof _0x29e4d1[_0x3ead3e(0x262)]!=_0x3ead3e(0x1d2)||typeof _0x29e4d1[_0x3ead3e(0x221)]!='function')throw new Error(_0x3ead3e(0x264));return{'queryMultiIndex':_0x29e4d1['queryMultiIndex'][_0x3ead3e(0x1d0)](_0x29e4d1),'queryMultiIndexText':_0x29e4d1[_0x3ead3e(0x23c)][_0x3ead3e(0x1d0)](_0x29e4d1),'loadIndexes':_0x29e4d1[_0x3ead3e(0x262)][_0x3ead3e(0x1d0)](_0x29e4d1),'unloadIndexes':_0x29e4d1[_0x3ead3e(0x221)][_0x3ead3e(0x1d0)](_0x29e4d1)};}['ensureCachePathDeviceId'](_0x23d43a){_0x23d43a&&this['cachePathDeviceId']===void 0x0&&M(_0x23d43a);}[_0x383a96(0x1b3)]=_0x31ad1a=>{const _0x2ed187=_0x383a96;!U(this['configuredIdentity'])&&this[_0x2ed187(0x263)]===void 0x0||_0x31ad1a['setIdentity'](this[_0x2ed187(0x1b9)]?.[_0x2ed187(0x1c9)]??null,this['configuredIdentity']?.['userId']??null,this[_0x2ed187(0x263)]??null);};[_0x383a96(0x20d)]=_0x5dab3b=>{const _0x4d6b3f=_0x383a96;let _0x5dd0ff=this[_0x4d6b3f(0x21e)]['deviceIdentity']?.();if(!_0x5dd0ff){this['applyIdentity'](_0x5dab3b);return;}_0x5dab3b[_0x4d6b3f(0x216)](_0x5dd0ff[_0x4d6b3f(0x1c9)]??null,this[_0x4d6b3f(0x1b9)]?.[_0x4d6b3f(0x24b)]??null,_0x5dd0ff['mossDeviceId']??null);};['hasCustomAuthenticator'](){const _0x30daa6=_0x383a96;return this[_0x30daa6(0x1df)]!==void 0x0;}async[_0x383a96(0x220)](_0xea997e,_0x435985,_0x24f19d){const _0x4fe826=_0x383a96;if(!this[_0x4fe826(0x1df)])throw new Error(_0x4fe826(0x209));let _0x3fd46d=_0x31db36,_0x5a4941=_0x3fd46d[_0x4fe826(0x222)]??_0x3fd46d[_0x4fe826(0x246)]?.[_0x4fe826(0x222)];if(!_0x5a4941||typeof _0x5a4941[_0x4fe826(0x271)]!='function')throw new Error(_0x4fe826(0x279));return _0x24f19d&&y(_0x5a4941),_0x5a4941[_0x4fe826(0x271)](_0xea997e,_0x435985,this[_0x4fe826(0x1da)],this[_0x4fe826(0x1df)],null,null,_0x24f19d?.[_0x4fe826(0x254)]??null,_0x24f19d?.[_0x4fe826(0x258)]??null);}async[_0x383a96(0x248)](_0x4da6fc,_0x34124f,_0x392d0a){const _0x10b0a3=_0x383a96;if(!await this[_0x10b0a3(0x21e)][_0x10b0a3(0x247)](_0x4da6fc))throw new Error('Index\x20\x22'+_0x4da6fc+_0x10b0a3(0x1bc)+_0x4da6fc+_0x10b0a3(0x224));let _0x251f26=_0x392d0a?.[_0x10b0a3(0x226)]??0x5,_0x2a1a91=_0x392d0a?.[_0x10b0a3(0x1c2)]??0.8;return _0x392d0a?.[_0x10b0a3(0x206)]?this[_0x10b0a3(0x21e)][_0x10b0a3(0x248)](_0x4da6fc,_0x34124f,_0x392d0a['embedding'],_0x251f26,_0x2a1a91,_0x392d0a?.[_0x10b0a3(0x214)]):this[_0x10b0a3(0x21e)][_0x10b0a3(0x25b)](_0x4da6fc,_0x34124f,_0x251f26,_0x2a1a91,_0x392d0a?.[_0x10b0a3(0x214)]);}async[_0x383a96(0x217)](_0x43acda,_0x279b79,_0x5aecb7){const _0x642517=_0x383a96;if(_0x43acda['length']===0x0)throw new Error(_0x642517(0x1fc));let _0x4b93c5=this[_0x642517(0x1d9)](),_0x5fcb66=_0x5aecb7?.['topK']??0xa,_0x11dc65=_0x5aecb7?.[_0x642517(0x1c2)]??0.8;if(_0x5aecb7?.[_0x642517(0x206)])return _0x4b93c5[_0x642517(0x217)](_0x43acda,_0x279b79,_0x5aecb7[_0x642517(0x206)],_0x5fcb66,_0x11dc65,_0x5aecb7?.['filter']);try{return await _0x4b93c5[_0x642517(0x23c)](_0x43acda,_0x279b79,_0x5fcb66,_0x11dc65,_0x5aecb7?.[_0x642517(0x214)]);}catch(_0x399463){throw _0x399463 instanceof Error&&_0x399463['message'][_0x642517(0x272)](_0x642517(0x275))?new Error(_0x399463['message']+_0x642517(0x1f6),{'cause':_0x399463}):_0x399463 instanceof Error&&_0x399463[_0x642517(0x259)][_0x642517(0x272)](_0x642517(0x1fe))?new Error('One\x20or\x20more\x20indexes\x20use\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.',{'cause':_0x399463}):_0x399463;}}};import{SessionIndex as _0x2f1d96}from'@moss-js/moss-core';var h=class r{#e;#r;#s;#i=!0x1;#a;constructor(_0x52adb2,_0x5400c0,_0x24e9e5){this.#s=_0x52adb2,this.#r=_0x5400c0,this.#e=_0x24e9e5;}static async[_0x383a96(0x255)](_0x58ff4c,_0x390be5,_0x270dd7,_0x1ac6e8,_0xe3a6ce,_0x1bb62f,_0x166900){const _0x247be6=_0x383a96;let _0x25867c=_0x2f1d96;_0x166900&&y(_0x25867c);let _0x4e87e3=await _0x25867c[_0x247be6(0x22d)](_0x58ff4c,_0x390be5,_0x270dd7,_0x1ac6e8,_0xe3a6ce??null,_0x166900?.[_0x247be6(0x254)]??null,_0x166900?.['manifestSha256']??null);return r['_fromInner'](_0x58ff4c,_0x390be5,_0x4e87e3,_0x1bb62f);}static[_0x383a96(0x1d3)](_0x51a17a,_0x293e4c,_0x3b8028,_0x3c6534){return _0x3c6534?.(_0x3b8028),new r(_0x51a17a,_0x293e4c,_0x3b8028);}get[_0x383a96(0x1e4)](){return this.#s;}get[_0x383a96(0x237)](){const _0x5a16d8=_0x383a96;return this.#n(),this.#e[_0x5a16d8(0x237)];}get[_0x383a96(0x210)](){return this.#r;}async[_0x383a96(0x24a)](_0x44be6c,_0x1b4c9a){const _0x21a2ce=_0x383a96;this.#n();let _0x5b2250=_0x1b4c9a?{'upsert':_0x1b4c9a[_0x21a2ce(0x243)]??!0x0}:void 0x0;if(this.#r===_0x21a2ce(0x1bb)){let _0x2c03b6=r.#t(_0x44be6c),_0x14204a=_0x44be6c[_0x21a2ce(0x252)](_0x8191da=>{const _0x1ab6d3=_0x21a2ce;let _0x1c5f44={..._0x8191da};return delete _0x1c5f44[_0x1ab6d3(0x206)],_0x1c5f44;}),_0x3b9475=this.#e[_0x21a2ce(0x230)](_0x14204a,_0x2c03b6,_0x5b2250);return{'added':_0x3b9475[_0x21a2ce(0x1b7)],'updated':_0x3b9475['updated']};}let _0x5ec9e1=this.#e['addDocumentsText'](_0x44be6c,_0x5b2250);return{'added':_0x5ec9e1['added'],'updated':_0x5ec9e1[_0x21a2ce(0x278)]};}async['deleteDocs'](_0x2c6289){const _0x547685=_0x383a96;return this.#n(),this.#e[_0x547685(0x260)](_0x2c6289);}async[_0x383a96(0x25f)](_0x21d0b3){return this.#n(),this.#e['getDocuments'](_0x21d0b3??null);}async[_0x383a96(0x248)](_0x3c5abb,_0x14106d){const _0x534c79=_0x383a96;this.#n();let _0x49ec9a=_0x14106d?.['topK']??0x5,_0xa22d1f=_0x14106d?.[_0x534c79(0x1c2)]??0.8,_0x5ba81d=_0x14106d?.[_0x534c79(0x214)]??null,_0x384ac6=_0x14106d?.[_0x534c79(0x206)];if(_0x384ac6==null){if(this.#r===_0x534c79(0x1bb))throw new Error('This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.');return this.#e[_0x534c79(0x25b)](_0x3c5abb,_0x49ec9a,_0xa22d1f,_0x5ba81d);}return this.#e[_0x534c79(0x248)](_0x3c5abb,_0x49ec9a,Array[_0x534c79(0x229)](_0x384ac6),_0xa22d1f,_0x5ba81d);}async['loadIndex'](_0x909bb5,_0x53462f){const _0x54116b=_0x383a96;return this.#n(),this.#e[_0x54116b(0x204)](_0x909bb5,_0x53462f??null);}async['pushIndex'](){return this.#n(),this.#e['pushIndex']();}async['saveToDisk'](_0x5d101a){const _0x2b0f3f=_0x383a96;this.#n(),this.#e[_0x2b0f3f(0x236)](_0x5d101a);}async['loadFromDisk'](_0x5b7ec2){const _0x5208b2=_0x383a96;return this.#n(),this.#e[_0x5208b2(0x27c)](_0x5b7ec2);}#n(){const _0x1b356d=_0x383a96;if(this.#i)throw new Error('SessionIndex\x20\x27'+this.#s+_0x1b356d(0x25e));}[_0x383a96(0x24c)](){return this.#a??=this.#o(),this.#a;}async #o(){const _0x4b5aa6=_0x383a96;this.#i=!0x0;let _0x1d623a=this.#e[_0x4b5aa6(0x24c)];if(typeof _0x1d623a!=_0x4b5aa6(0x1d2))throw new Error(_0x4b5aa6(0x25c));await _0x1d623a[_0x4b5aa6(0x274)](this.#e);}async[Symbol[_0x383a96(0x1eb)]](){const _0x305243=_0x383a96;return this[_0x305243(0x24c)]();}async['_warmModel'](){const _0x1fe79d=_0x383a96;this.#n(),this.#r!==_0x1fe79d(0x1bb)&&this.#e['loadModel']();}static#t(_0x2eb830){const _0x3f9c9f=_0x383a96;let _0x332041=_0x2eb830[_0x3f9c9f(0x214)](_0xabeec8=>!_0xabeec8['embedding']||_0xabeec8[_0x3f9c9f(0x206)]['length']===0x0)[_0x3f9c9f(0x252)](_0x4489ea=>_0x4489ea['id']);if(_0x332041['length']>0x0)throw new Error('Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20'+_0x332041[_0x3f9c9f(0x1fd)](',\x20')+_0x3f9c9f(0x251));return _0x2eb830[_0x3f9c9f(0x252)](_0xf55cd4=>Array['from'](_0xf55cd4[_0x3f9c9f(0x206)]??[]));}},te='https://service.usemoss.dev',ne='/v1/manage',b=class extends Error{[_0x383a96(0x1c4)];['body'];constructor(_0x4515cf,_0x40c0b4){const _0x19f9e3=_0x383a96;let _0x1b0ba1=_0x40c0b4?':\x20'+_0x40c0b4:'';super(_0x19f9e3(0x1fa)+_0x4515cf+_0x1b0ba1),this[_0x19f9e3(0x1e4)]=_0x19f9e3(0x1af),this[_0x19f9e3(0x1c4)]=_0x4515cf,this['body']=_0x40c0b4;}};function re(){const _0x198d86=_0x383a96;return''+(typeof process<'u'&&process[_0x198d86(0x235)][_0x198d86(0x1ac)]||te)[_0x198d86(0x1d1)](/\/+$/,'')+ne;}function _0x7380(){const _0x37adbb=['maxDepth','IndexManager','ManageApiError','received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20(','trim','POST','applyIdentity','then','includePaths','respectRobots','added','uploading','configuredIdentity','fetchAndCache','custom','\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22','1981804idGiwb','8777970mXFnUA','test','sources','toByteArray','alpha','resyncWebSource','status','delete','cachePath','authenticator','object','deviceId','byteLength','addDocs\x20requires\x20at\x20least\x20one\x20document','session','authUrl','entries','freeze','bind','replace','function','_fromInner','warn','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','Building','SDK_VERSION_NUMBER','refreshCadence','requireMultiIndexCore','projectId','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','Unsupported\x20job\x20status\x20\x27','stringify','path','authNotifyFn','createIndex\x20requires\x20at\x20least\x20one\x20document','inflight','arrayBuffer','getJobStatus','name','fromEntries','parseOptions','deleteWebSource','ensureCachePathDeviceId','createWebSource','298889KhLapv','asyncDispose','rejectAuthRequest','\x20must\x20be\x20a\x20non-empty\x20string','indexName','identity','moss-minilm','createIndexFromFiles','toLowerCase','\x20contains\x20an\x20unsupported\x20character','pending_upload','onProgress','\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','updateWebSource','getIndex','normalizeJobStatus','HTTP\x20error!\x20status:\x20','_warmModel','queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name','join','requires\x20explicit\x20query\x20embeddings','now','error','40iUNvvG','resolveAuthRequest','moss-core\x20rejected\x20the\x20auth\x20token:\x20','loadIndex','listIndexes','embedding','modelArtifactContractVersion','parseDocuments','createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client','maxDocuments','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20(','CLOUD_API_IDENTITY_URL','applySessionIdentity','CLOUD_API_INDEX_URL','cache','modelId','getWebSource','2046022YfPgbN','MOSS_INDEX_URL','filter','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','setIdentity','queryMultiIndex','string','8aAURMf','372939lobvNf','expiresIn','clear','received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20(','indexManager','length','createAuthenticatedSessionInner','unloadIndexes','SessionIndex','building','\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.','manageClient','topK','Authentication\x20failed\x20(HTTP\x20401):\x20','resync','from','153210ycWJdK','MossClient\x20options.identity.','PendingUpload','create','maxPages','\x20could\x20not\x20be\x20settled:\x20','addDocuments','jobId','MODEL_DOWNLOAD_URL','[moss]\x20Auth\x20request\x20','timeout','env','saveToDisk','docCount','moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports','deleteIndex','progress','text','queryMultiIndexText','deref','excludePaths','startsWith','encode','Bearer\x20','CLOUD_API_AUTH_URL','upsert','250232lUhgEy','Web\x20source\x20methods\x20require\x20a\x20project\x20key.\x20Construct\x20MossClient\x20with\x20(projectId,\x20projectKey).','default','hasIndex','query','json','addDocs','userId','close','MossClient\x20is\x20closed','received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected','utf8','currentPhase','.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.','map','\x27\x20returned\x20by\x20moss-core','version','_create','pendingupload','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','manifestSha256','message','slice','queryText','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()','createIndex','\x27\x20is\x20closed','getDocs','deleteDocuments','144iZuYPj','loadIndexes','cachePathDeviceId','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','getAuthToken','wrapProgress','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','HTTP\x20','projectKey','rootUrl','getAuthHeader','add','unloadIndex','isFinite','contentType','all','withAuthenticator','includes','model','call','no\x20exact\x20artifact\x20identity','Uploading','deleteDocs','updated','moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','token','MOSS_AUTH_URL','loadFromDisk','expiresAt','application/json','listWebSources','ManageClient','161kNMiNC','isArray','moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','MOSS_CLOUD_API_BASE_URL'];_0x7380=function(){return _0x37adbb;};return _0x7380();}function se(_0x200fef){const _0xf516e1=_0x383a96;return _0x200fef?Object[_0xf516e1(0x1e5)](Object[_0xf516e1(0x1ce)](_0x200fef)[_0xf516e1(0x214)](([,_0x3037ac])=>_0x3037ac!==void 0x0)):{};}async function j(_0x39380b,_0xf03e60,_0x10d5ed,_0x25f9dc){const _0x195d07=_0x383a96;let _0xcaa053={...se(_0x25f9dc),'action':_0x10d5ed,'projectId':_0x39380b},_0x1924f8=await fetch(re(),{'method':_0x195d07(0x1b2),'headers':{'Content-Type':'application/json','X-Project-Key':_0xf03e60},'body':JSON[_0x195d07(0x1dd)](_0xcaa053),'signal':AbortSignal[_0x195d07(0x234)](0x927c0)}),_0xbb0251=await _0x1924f8['text']();if(!_0x1924f8['ok'])throw new b(_0x1924f8[_0x195d07(0x1c4)],_0xbb0251);return _0xbb0251?JSON['parse'](_0xbb0251):{};}var F=_0x383a96(0x1f0),A=class{#e;#r;#s;#i=!0x1;#a;#n=new Set();constructor(_0x3ef9f4,_0x24ba72,_0x214319){const _0x344afd=_0x383a96;this.#e=new x(_0x3ef9f4,_0x24ba72,_0x214319),this.#r=_0x3ef9f4,this.#s=typeof _0x24ba72==_0x344afd(0x218)?_0x24ba72:null;}async[_0x383a96(0x265)](){const _0x37e0ec=_0x383a96;return this.#t(),this.#e[_0x37e0ec(0x265)]();}async['createIndex'](_0x3d1503,_0x2c6739,_0x40dadb){const _0x443c2a=_0x383a96;this.#t();let _0x35533b;return _0x40dadb?.['modelId']!==void 0x0?_0x35533b=_0x40dadb[_0x443c2a(0x210)]:_0x35533b=_0x2c6739['some'](_0x4346ca=>Array[_0x443c2a(0x1aa)](_0x4346ca[_0x443c2a(0x206)])&&_0x4346ca[_0x443c2a(0x206)][_0x443c2a(0x21f)]>0x0)?'custom':F,this.#e['createIndex'](_0x3d1503,_0x2c6739,_0x35533b,_0x40dadb);}async[_0x383a96(0x1f1)](_0x2d0462,_0x52c6b5,_0x1d33fe){const _0x44bc9d=_0x383a96;return this.#t(),this.#e[_0x44bc9d(0x1f1)](_0x2d0462,_0x52c6b5,_0x1d33fe);}async[_0x383a96(0x1f8)](_0x14d875){const _0x3e22e1=_0x383a96;return this.#t(),this.#e[_0x3e22e1(0x1f8)](_0x14d875);}async[_0x383a96(0x205)](){const _0x115a38=_0x383a96;return this.#t(),this.#e[_0x115a38(0x205)]();}async[_0x383a96(0x239)](_0x32f686){const _0x3c8821=_0x383a96;return this.#t(),this.#e[_0x3c8821(0x239)](_0x32f686);}async[_0x383a96(0x24a)](_0x5f27fb,_0x4f5b7c,_0x995df5){const _0x548384=_0x383a96;return this.#t(),this.#e[_0x548384(0x24a)](_0x5f27fb,_0x4f5b7c,_0x995df5);}async[_0x383a96(0x277)](_0x59c62b,_0x563f15,_0x2b4dce){const _0x1de20e=_0x383a96;return this.#t(),this.#e[_0x1de20e(0x277)](_0x59c62b,_0x563f15,_0x2b4dce);}async[_0x383a96(0x1e3)](_0x13a267){const _0x2c7a53=_0x383a96;return this.#t(),this.#e[_0x2c7a53(0x1e3)](_0x13a267);}async[_0x383a96(0x1e9)](_0x5610a8,_0x374dec,_0x40ff8e){const _0x1b2108=_0x383a96;return this.#t(),this.#o('createWebSource',{'rootUrl':_0x5610a8,'indexName':_0x374dec,'maxPages':_0x40ff8e?.[_0x1b2108(0x22e)],'maxDocuments':_0x40ff8e?.[_0x1b2108(0x20a)],'maxDepth':_0x40ff8e?.[_0x1b2108(0x1ad)],'includePaths':_0x40ff8e?.[_0x1b2108(0x1b5)],'excludePaths':_0x40ff8e?.[_0x1b2108(0x23e)],'respectRobots':_0x40ff8e?.[_0x1b2108(0x1b6)],'parseDocuments':_0x40ff8e?.[_0x1b2108(0x208)],'refreshCadence':_0x40ff8e?.[_0x1b2108(0x1d8)],'modelId':_0x40ff8e?.[_0x1b2108(0x210)]});}async[_0x383a96(0x27f)](_0x452460){const _0x4cde1d=_0x383a96;this.#t();let _0x41c971=(await this.#o(_0x4cde1d(0x27f),_0x452460!==void 0x0?{'indexName':_0x452460}:void 0x0))[_0x4cde1d(0x1c0)]??[];return _0x452460===void 0x0?_0x41c971:_0x41c971[_0x4cde1d(0x214)](_0x43836e=>_0x43836e[_0x4cde1d(0x1ee)]===_0x452460);}async[_0x383a96(0x211)](_0x559703){return this.#t(),this.#o('getWebSource',{'sourceId':_0x559703});}async['updateWebSource'](_0x309e27,_0x2ade64){const _0x549b97=_0x383a96;return this.#t(),this.#o(_0x549b97(0x1f7),{'sourceId':_0x309e27,'refreshCadence':_0x2ade64[_0x549b97(0x1d8)],'rootUrl':_0x2ade64[_0x549b97(0x26a)],'includePaths':_0x2ade64[_0x549b97(0x1b5)],'excludePaths':_0x2ade64['excludePaths'],'maxDepth':_0x2ade64[_0x549b97(0x1ad)],'maxPages':_0x2ade64[_0x549b97(0x22e)],'resync':_0x2ade64[_0x549b97(0x228)]});}async[_0x383a96(0x1c3)](_0x7f56ad){return this.#t(),this.#o('resyncWebSource',{'sourceId':_0x7f56ad});}async[_0x383a96(0x1e7)](_0x1c1c3e){const _0x1bbbf2=_0x383a96;return this.#t(),this.#o(_0x1bbbf2(0x1e7),{'sourceId':_0x1c1c3e});}async #o(_0x5e1113,_0x5adfeb){const _0x2f14a0=_0x383a96;if(this.#s===null)throw new Error(_0x2f14a0(0x245));return j(this.#r,this.#s,_0x5e1113,_0x5adfeb);}async[_0x383a96(0x25f)](_0x53f7af,_0x4b46f4){const _0x5a1db6=_0x383a96;return this.#t(),this.#e[_0x5a1db6(0x25f)](_0x53f7af,_0x4b46f4);}async[_0x383a96(0x204)](_0x40e195,_0xbaa518){const _0x2c5e4b=_0x383a96;return this.#t(),this.#e[_0x2c5e4b(0x204)](_0x40e195,_0xbaa518);}async['loadIndexes'](_0x33d1ed,_0x4cde7d){return this.#t(),this.#e['loadIndexes'](_0x33d1ed,_0x4cde7d);}async['unloadIndex'](_0x2fe8d2){const _0xb3099f=_0x383a96;return this.#t(),this.#e[_0xb3099f(0x26d)](_0x2fe8d2);}async[_0x383a96(0x221)](_0x4f6d7e){const _0x47aff5=_0x383a96;return this.#t(),this.#e[_0x47aff5(0x221)](_0x4f6d7e);}async[_0x383a96(0x248)](_0x49b852,_0x19a8e7,_0x4f2c2f){const _0x16f66c=_0x383a96;return this.#t(),this.#e[_0x16f66c(0x248)](_0x49b852,_0x19a8e7,_0x4f2c2f);}async[_0x383a96(0x217)](_0x5d0fce,_0x453e96,_0x48eb7f){const _0x4627aa=_0x383a96;return this.#t(),this.#e[_0x4627aa(0x217)](_0x5d0fce,_0x453e96,_0x48eb7f);}async[_0x383a96(0x1cc)](_0x4aaed8,_0xbfb980=F,_0x5a629b){const _0x336087=_0x383a96;this.#t();let _0x96570b=this.#e['applySessionIdentity'],_0x425b13;if(this.#s!==null)_0x425b13=await h[_0x336087(0x255)](_0x4aaed8,_0xbfb980,this.#r,this.#s,void 0x0,_0x96570b,_0x5a629b);else{let _0x2567e0=await this.#e[_0x336087(0x220)](_0x4aaed8,_0xbfb980,_0x5a629b);_0x425b13=h[_0x336087(0x1d3)](_0x4aaed8,_0xbfb980,_0x2567e0,_0x96570b);}await _0x425b13[_0x336087(0x1fb)]();for(let _0x246727 of this.#n)_0x246727[_0x336087(0x23d)]()||this.#n[_0x336087(0x1c5)](_0x246727);return this.#n[_0x336087(0x26c)](new WeakRef(_0x425b13)),_0x425b13;}#t(){const _0x3d4ce7=_0x383a96;if(this.#i)throw new Error(_0x3d4ce7(0x24d));}[_0x383a96(0x24c)](){return this.#a??=this.#u(),this.#a;}async #u(){const _0x27f19d=_0x383a96;this.#i=!0x0;let _0x53339d=[...this.#n][_0x27f19d(0x252)](_0x4232b2=>_0x4232b2[_0x27f19d(0x23d)]())[_0x27f19d(0x214)](_0x5e30e2=>_0x5e30e2!==void 0x0);this.#n[_0x27f19d(0x21c)](),await Promise[_0x27f19d(0x270)](_0x53339d[_0x27f19d(0x252)](_0x340feb=>_0x340feb[_0x27f19d(0x24c)]())),await this.#e['close']();}async[Symbol[_0x383a96(0x1eb)]](){const _0x1daf49=_0x383a96;return this[_0x1daf49(0x24c)]();}};export{b as ManageApiError,A as MossClient,h as SessionIndex};
|
package/dist/moss.d.ts
CHANGED
|
@@ -54,6 +54,32 @@ export declare interface CreateIndexOptions {
|
|
|
54
54
|
onProgress?: (progress: JobProgress) => void;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
export declare interface CreateWebSourceOptions {
|
|
58
|
+
maxPages?: number;
|
|
59
|
+
maxDocuments?: number;
|
|
60
|
+
maxDepth?: number;
|
|
61
|
+
includePaths?: string[];
|
|
62
|
+
excludePaths?: string[];
|
|
63
|
+
respectRobots?: boolean;
|
|
64
|
+
parseDocuments?: boolean;
|
|
65
|
+
refreshCadence?: "daily" | "weekly";
|
|
66
|
+
modelId?: "moss-minilm" | "moss-mediumlm";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare interface CreateWebSourceResult extends WebSource {
|
|
70
|
+
/** Crawl job to poll with `getJobStatus`. */
|
|
71
|
+
jobId: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export declare interface DeleteWebSourceResult {
|
|
75
|
+
deleted: boolean;
|
|
76
|
+
id: string;
|
|
77
|
+
/**
|
|
78
|
+
* Present when a purge was enqueued. Poll with `getJobStatus`.
|
|
79
|
+
*/
|
|
80
|
+
purgeJobId?: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
57
83
|
export { DocumentInfo }
|
|
58
84
|
|
|
59
85
|
export { GetDocumentsOptions }
|
|
@@ -63,6 +89,10 @@ export declare interface IAuthenticator {
|
|
|
63
89
|
getAuthHeader(): Promise<string>;
|
|
64
90
|
}
|
|
65
91
|
|
|
92
|
+
declare interface IdentityTarget {
|
|
93
|
+
setIdentity(deviceId?: string | null, userId?: string | null, mossDeviceId?: string | null): void;
|
|
94
|
+
}
|
|
95
|
+
|
|
66
96
|
/**
|
|
67
97
|
* ISO 8601 date string format.
|
|
68
98
|
* @example "2025-09-26T15:04:05Z"
|
|
@@ -125,6 +155,12 @@ export declare interface LoadIndexOptions {
|
|
|
125
155
|
|
|
126
156
|
export { LoadSessionOptions }
|
|
127
157
|
|
|
158
|
+
export declare class ManageApiError extends Error {
|
|
159
|
+
readonly status: number;
|
|
160
|
+
readonly body: string;
|
|
161
|
+
constructor(status: number, body: string);
|
|
162
|
+
}
|
|
163
|
+
|
|
128
164
|
/** Exact immutable publisher identity required for local foundation models. */
|
|
129
165
|
export declare interface ModelArtifactIdentity {
|
|
130
166
|
/** Version embedded in the publisher manifest and immutable artifact URL. */
|
|
@@ -340,6 +376,40 @@ export declare class MossClient {
|
|
|
340
376
|
* ```
|
|
341
377
|
*/
|
|
342
378
|
getJobStatus(jobId: string): Promise<JobStatusResponse>;
|
|
379
|
+
/**
|
|
380
|
+
* POST `createWebSource` and return the typed source plus `jobId` for
|
|
381
|
+
* `getJobStatus`. Server-release notes: see the package README Web sources
|
|
382
|
+
* section.
|
|
383
|
+
*/
|
|
384
|
+
createWebSource(rootUrl: string, indexName: string, options?: CreateWebSourceOptions): Promise<CreateWebSourceResult>;
|
|
385
|
+
/**
|
|
386
|
+
* POST `listWebSources` and return the typed sources. When `indexName` is
|
|
387
|
+
* given, only sources for that index are returned.
|
|
388
|
+
*/
|
|
389
|
+
listWebSources(indexName?: string): Promise<WebSource[]>;
|
|
390
|
+
/**
|
|
391
|
+
* POST `getWebSource` and return the typed source: crawl status, last run,
|
|
392
|
+
* and page/document counts.
|
|
393
|
+
*/
|
|
394
|
+
getWebSource(sourceId: string): Promise<WebSource>;
|
|
395
|
+
/**
|
|
396
|
+
* POST `updateWebSource` and return the typed source. `jobId` is present
|
|
397
|
+
* when `resync` is true and the server enqueued a crawl; poll with
|
|
398
|
+
* `getJobStatus`. `refreshCadence` is live today. Other fields: see the
|
|
399
|
+
* package README Web sources section.
|
|
400
|
+
*/
|
|
401
|
+
updateWebSource(sourceId: string, options: UpdateWebSourceOptions): Promise<UpdateWebSourceResult>;
|
|
402
|
+
/**
|
|
403
|
+
* POST `resyncWebSource` and return a `jobId` to poll with `getJobStatus`.
|
|
404
|
+
* See the package README Web sources section.
|
|
405
|
+
*/
|
|
406
|
+
resyncWebSource(sourceId: string): Promise<ResyncWebSourceResult>;
|
|
407
|
+
/**
|
|
408
|
+
* POST `deleteWebSource` and return `{ deleted, id }`. `purgeJobId` is
|
|
409
|
+
* present when a purge was enqueued; poll with `getJobStatus`. Does not
|
|
410
|
+
* delete the index.
|
|
411
|
+
*/
|
|
412
|
+
deleteWebSource(sourceId: string): Promise<DeleteWebSourceResult>;
|
|
343
413
|
/**
|
|
344
414
|
* Retrieves documents from an index.
|
|
345
415
|
*
|
|
@@ -535,13 +605,11 @@ export declare class MossClient {
|
|
|
535
605
|
|
|
536
606
|
export declare interface MossClientOptions {
|
|
537
607
|
/**
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
* as the billable `deviceId` when no host device id is configured.
|
|
541
|
-
*
|
|
542
|
-
* device
|
|
543
|
-
* this option to use one path consistently across client and session
|
|
544
|
-
* telemetry.
|
|
608
|
+
* Directory whose `.moss-device-id` file is adopted as Moss's stable device
|
|
609
|
+
* UUID for this client and its sessions. It is emitted as `mossDeviceId`,
|
|
610
|
+
* and also as the billable `deviceId` when no host device id is configured.
|
|
611
|
+
* The file is created on first use. When omitted, the native core uses
|
|
612
|
+
* `~/.moss/.moss-device-id`.
|
|
545
613
|
*/
|
|
546
614
|
cachePath?: string;
|
|
547
615
|
/**
|
|
@@ -664,15 +732,11 @@ export { QueryResultDocumentInfo }
|
|
|
664
732
|
|
|
665
733
|
export { RefreshResult }
|
|
666
734
|
|
|
667
|
-
declare interface
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
/** Moss's file-backed stable UUID, always retained for correlation. */
|
|
673
|
-
mossDeviceId: string;
|
|
674
|
-
userId?: string;
|
|
675
|
-
callerSupplied: boolean;
|
|
735
|
+
export declare interface ResyncWebSourceResult {
|
|
736
|
+
id: string;
|
|
737
|
+
jobId: string;
|
|
738
|
+
status?: string;
|
|
739
|
+
indexName?: string;
|
|
676
740
|
}
|
|
677
741
|
|
|
678
742
|
export { SearchResult }
|
|
@@ -708,13 +772,13 @@ export declare class SessionIndex {
|
|
|
708
772
|
* worker thread — `await`ing here keeps the Node main thread
|
|
709
773
|
* responsive while auth is in flight.
|
|
710
774
|
*/
|
|
711
|
-
static _create(name: string, modelId: MossModel, projectId: string, projectKey: string, clientId?: string,
|
|
775
|
+
static _create(name: string, modelId: MossModel, projectId: string, projectKey: string, clientId?: string, applyIdentity?: (target: IdentityTarget) => void, modelArtifact?: ModelArtifactIdentity): Promise<SessionIndex>;
|
|
712
776
|
/**
|
|
713
777
|
* @internal Wrap an already-constructed core `SessionIndex` — used for the
|
|
714
778
|
* custom-authenticator path, where `InternalMossClient` builds the core
|
|
715
779
|
* handle via the auth bridge (`SessionIndex.withAuthenticator`).
|
|
716
780
|
*/
|
|
717
|
-
static _fromInner(name: string, modelId: MossModel, inner: SessionIndex_2,
|
|
781
|
+
static _fromInner(name: string, modelId: MossModel, inner: SessionIndex_2, applyIdentity?: (target: IdentityTarget) => void): SessionIndex;
|
|
718
782
|
/** The session index name. Identifies the cloud index on `pushIndex` / `loadIndex`. */
|
|
719
783
|
get name(): string;
|
|
720
784
|
/** Number of documents currently in the local session. */
|
|
@@ -791,4 +855,50 @@ export declare class SessionIndex {
|
|
|
791
855
|
_warmModel(): Promise<void>;
|
|
792
856
|
}
|
|
793
857
|
|
|
858
|
+
export declare interface UpdateWebSourceOptions {
|
|
859
|
+
refreshCadence?: WebSourceRefreshCadence;
|
|
860
|
+
rootUrl?: string;
|
|
861
|
+
includePaths?: string[];
|
|
862
|
+
excludePaths?: string[];
|
|
863
|
+
maxDepth?: number;
|
|
864
|
+
maxPages?: number;
|
|
865
|
+
resync?: boolean;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
export declare interface UpdateWebSourceResult extends WebSource {
|
|
869
|
+
/**
|
|
870
|
+
* Present when `resync` is true and the server enqueued a crawl.
|
|
871
|
+
* Poll with `getJobStatus`.
|
|
872
|
+
*/
|
|
873
|
+
jobId?: string;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Public web-source record from the manage API (`toPublic` shape).
|
|
878
|
+
*/
|
|
879
|
+
export declare interface WebSource {
|
|
880
|
+
id: string;
|
|
881
|
+
indexName: string;
|
|
882
|
+
rootUrl: string;
|
|
883
|
+
maxPages: number;
|
|
884
|
+
maxDocuments: number;
|
|
885
|
+
maxDepth: number;
|
|
886
|
+
includePaths?: string[];
|
|
887
|
+
excludePaths?: string[];
|
|
888
|
+
respectRobots: boolean;
|
|
889
|
+
parseDocuments: boolean;
|
|
890
|
+
refreshCadence: WebSourceRefreshCadence;
|
|
891
|
+
nextRefreshAt: string | null;
|
|
892
|
+
lastCrawledAt: string | null;
|
|
893
|
+
lastPageCount: number | null;
|
|
894
|
+
lastDocCount: number | null;
|
|
895
|
+
status: WebSourceStatus;
|
|
896
|
+
lastErrorCode: string | null;
|
|
897
|
+
createdAt?: string;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
export declare type WebSourceRefreshCadence = "daily" | "weekly" | "manual";
|
|
901
|
+
|
|
902
|
+
export declare type WebSourceStatus = "idle" | "crawling" | "failed" | "removing";
|
|
903
|
+
|
|
794
904
|
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moss-js/moss",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"main": "dist/index.esm.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/moss.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"author": "InferEdge Inc.",
|
|
46
46
|
"license": "SEE LICENSE IN LICENSE",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@moss-js/moss-core": "0.
|
|
48
|
+
"@moss-js/moss-core": "0.26.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eslint/js": "^9.39.4",
|