@moss-js/moss-core 0.33.0 → 0.34.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 +9 -7
- package/index.d.ts +35 -174
- package/index.js +52 -56
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
# Moss JavaScript Binding
|
|
2
2
|
|
|
3
|
-
Rust-powered Node.js native addon that
|
|
3
|
+
Rust-powered Node.js native addon that runs the Moss core for [`@moss-js/moss`](https://www.npmjs.com/package/@moss-js/moss), the Moss JavaScript SDK.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Support
|
|
6
|
+
|
|
7
|
+
`@moss-js/moss-core` is the native runtime of `@moss-js/moss` and is not supported for direct use. Its exports are for the SDK and can change in any release. Install `@moss-js/moss` and import every Moss type from it.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
6
10
|
|
|
7
11
|
```bash
|
|
8
|
-
npm install @moss-js/moss
|
|
12
|
+
npm install @moss-js/moss
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
The prebuilt binary for each target ships in its own `@moss-js/moss-core-<platform>` package, which npm installs for your platform as an optional dependency, so keep optional dependencies on. A lockfile that npm older than 11.3 rebuilt while `node_modules` existed lists only that machine's platform package. Before running `npm ci` on another platform, regenerate it with `node_modules` removed, or with npm 11.3 or newer.
|
|
15
|
+
The SDK depends on this package. The prebuilt binary for each target ships in its own `@moss-js/moss-core-<platform>` package, which npm installs for your platform as an optional dependency, so keep optional dependencies on. A lockfile that npm older than 11.3 rebuilt while `node_modules` existed lists only that machine's platform package. Before running `npm ci` on another platform, regenerate it with `node_modules` removed, or with npm 11.3 or newer.
|
|
12
16
|
|
|
13
17
|
## Prerequisites For Local Builds
|
|
14
18
|
|
|
15
19
|
- Node.js 20+ (matches the engines field in `package.json`)
|
|
16
20
|
- Rust toolchain with `cargo`
|
|
17
|
-
- `npm` 8+
|
|
18
|
-
|
|
19
|
-
Refer to the `test/` directory for additional usage examples.
|
|
21
|
+
- `npm` 8+
|
package/index.d.ts
CHANGED
|
@@ -1,93 +1,5 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Low-level interface for working with a Moss search index from Node.js.
|
|
5
|
-
*
|
|
6
|
-
* Instances of this type keep an in-memory index that you can populate with
|
|
7
|
-
* precomputed embeddings, execute hybrid semantic queries, and serialize to
|
|
8
|
-
* the `.moss` file format. Most JavaScript developers should prefer the
|
|
9
|
-
* higher-level `MossClient`, but this type is available when you need direct
|
|
10
|
-
* control over embeddings and lifecycle.
|
|
11
|
-
*/
|
|
12
|
-
export declare class Index {
|
|
13
|
-
/**
|
|
14
|
-
* Create a new in-memory index instance.
|
|
15
|
-
*
|
|
16
|
-
* @param name Index name used for diagnostics and serialization.
|
|
17
|
-
* @param modelId Embedding model identifier (`"moss-minilm"`, `"moss-mediumlm"`, or `"custom"`).
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const index = new Index('knowledge-base', 'moss-minilm')
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
constructor(name: string, modelId: string)
|
|
25
|
-
/**
|
|
26
|
-
* Get metadata describing the current index state.
|
|
27
|
-
*
|
|
28
|
-
* @returns Index information including status, document counts, and model details.
|
|
29
|
-
*/
|
|
30
|
-
getInfo(): IndexInfo
|
|
31
|
-
/**
|
|
32
|
-
* Add new documents or update existing ones using precomputed embeddings.
|
|
33
|
-
*
|
|
34
|
-
* Embeddings **must** be generated separately and supplied alongside the
|
|
35
|
-
* documents in the same order.
|
|
36
|
-
*
|
|
37
|
-
* @param docs Documents to insert or update.
|
|
38
|
-
* @param embeddings One embedding vector per document.
|
|
39
|
-
* @param options Optional write behaviour (upsert by default).
|
|
40
|
-
* @returns Object containing the number of added and updated documents.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* await index.addDocuments(docs, embeddings, { upsert: true })
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
addDocuments(docs: Array<DocumentInfo>, embeddings: Array<Array<number>>, options?: AddDocumentsOptions | null): IndexUpdateResult
|
|
48
|
-
/**
|
|
49
|
-
* Delete one or more documents by their identifier.
|
|
50
|
-
*
|
|
51
|
-
* @param docIds Document identifiers to remove.
|
|
52
|
-
* @returns Number of documents deleted.
|
|
53
|
-
*/
|
|
54
|
-
deleteDocuments(docIds: Array<string>): number
|
|
55
|
-
/**
|
|
56
|
-
* Retrieve documents from the index.
|
|
57
|
-
*
|
|
58
|
-
* When `options.docIds` is omitted all documents are returned. Provide a
|
|
59
|
-
* list of IDs to fetch specific entries.
|
|
60
|
-
*/
|
|
61
|
-
getDocuments(options?: GetDocumentsOptions | null): Array<DocumentInfo>
|
|
62
|
-
/**
|
|
63
|
-
* Perform a semantic similarity search using a precomputed query embedding.
|
|
64
|
-
*
|
|
65
|
-
* @param query Original search text used for logging and metadata.
|
|
66
|
-
* @param topK Maximum number of results to return (defaults to 5).
|
|
67
|
-
* @param queryEmbedding Precomputed embedding vector representing the query.
|
|
68
|
-
* @param alpha Optional hybrid fusion weight between dense and sparse scores (default `0.8`).
|
|
69
|
-
* @returns Search result containing ranked documents with scores.
|
|
70
|
-
*/
|
|
71
|
-
query(query: string, topK: number, queryEmbedding: Array<number>, alpha?: number | null, filter?: object | null): SearchResult
|
|
72
|
-
/**
|
|
73
|
-
* Serialize the in-memory index into a plain JavaScript object.
|
|
74
|
-
*
|
|
75
|
-
* Useful for persisting the index or converting to the `.moss` binary format.
|
|
76
|
-
*/
|
|
77
|
-
serialize(): SerializedIndex
|
|
78
|
-
/**
|
|
79
|
-
* Load serialized metadata and embeddings into the index instance.
|
|
80
|
-
*
|
|
81
|
-
* @param data Serialized index object produced by `serialize` or deserialized from `.moss` files.
|
|
82
|
-
* @param documents Full document objects matching the doc_ids in the serialized data.
|
|
83
|
-
*/
|
|
84
|
-
deserialize(data: SerializedIndex, documents: Array<DocumentInfo>): void
|
|
85
|
-
/** Number of documents currently stored in the index. */
|
|
86
|
-
get docCount(): number
|
|
87
|
-
/** Remove all documents and embeddings from the index. */
|
|
88
|
-
clear(): void
|
|
89
|
-
}
|
|
90
|
-
|
|
91
3
|
/** Rust-backed local index manager with optional auto-refresh polling. */
|
|
92
4
|
export declare class IndexManager {
|
|
93
5
|
constructor(projectId: string, projectKey: string, baseUrl?: string | null)
|
|
@@ -350,10 +262,15 @@ export declare class SessionIndex {
|
|
|
350
262
|
* publication leaves the previously committed snapshot loadable; restore it
|
|
351
263
|
* without a cloud round-trip via `loadFromDisk`.
|
|
352
264
|
*
|
|
265
|
+
* Without `cachePath` the snapshot goes in `sessions/<project id>/` under
|
|
266
|
+
* the first of `clientCachePath`, the `MOSS_SESSION_CACHE_PATH` environment
|
|
267
|
+
* variable, which only session snapshots read, and `moss` in the default cache
|
|
268
|
+
* directory (`~/.cache` on macOS and Linux, `%LOCALAPPDATA%` on Windows).
|
|
269
|
+
*
|
|
353
270
|
* Returns a `Promise`: the write runs on a native worker thread rather
|
|
354
271
|
* than the Node main thread.
|
|
355
272
|
*/
|
|
356
|
-
saveToDisk(cachePath
|
|
273
|
+
saveToDisk(cachePath?: string | null, clientCachePath?: string | null): Promise<void>
|
|
357
274
|
/**
|
|
358
275
|
* Restore the committed snapshot previously written by `saveToDisk` from
|
|
359
276
|
* `<cachePath>/<name>/`. The snapshot is validated before the live session
|
|
@@ -362,16 +279,19 @@ export declare class SessionIndex {
|
|
|
362
279
|
* saved without artifact provenance (by a core before identity stamping)
|
|
363
280
|
* loads as a custom-model session; pass `{ rebuildLegacy: true }` to
|
|
364
281
|
* re-embed it with the current model instead (see `inspectSnapshot`).
|
|
365
|
-
* When that rebuild cannot load the model
|
|
282
|
+
* When that rebuild cannot load the model, for example offline, the
|
|
366
283
|
* call rejects with a message starting "Legacy snapshot rebuild needs
|
|
367
284
|
* the embedding model" and changes nothing: the snapshot is intact and
|
|
368
285
|
* the session is as it was, so retry later rather than discarding the
|
|
369
286
|
* snapshot.
|
|
370
287
|
*
|
|
288
|
+
* Without `cachePath` it reads the directory `saveToDisk` picks when
|
|
289
|
+
* called without one.
|
|
290
|
+
*
|
|
371
291
|
* Returns a `Promise`: the read and validation run on a native worker
|
|
372
292
|
* thread rather than the Node main thread.
|
|
373
293
|
*/
|
|
374
|
-
loadFromDisk(cachePath
|
|
294
|
+
loadFromDisk(cachePath?: string | null, options?: LoadFromDiskOptions | null, clientCachePath?: string | null): Promise<number>
|
|
375
295
|
/**
|
|
376
296
|
* Read what the snapshot under `<cachePath>/<name>/` records without
|
|
377
297
|
* changing the session: the model it was saved with, whether it carries
|
|
@@ -380,9 +300,9 @@ export declare class SessionIndex {
|
|
|
380
300
|
* install, without any of the load's repairs. A foundation snapshot with
|
|
381
301
|
* `hasModelArtifact: false` was written before identity stamping and
|
|
382
302
|
* needs `loadFromDisk(cachePath, { rebuildLegacy: true })` to keep its
|
|
383
|
-
* text search.
|
|
303
|
+
* text search. Without `cachePath` it reads the `saveToDisk` default.
|
|
384
304
|
*/
|
|
385
|
-
inspectSnapshot(cachePath
|
|
305
|
+
inspectSnapshot(cachePath?: string | null, clientCachePath?: string | null): Promise<SnapshotInfo>
|
|
386
306
|
/**
|
|
387
307
|
* Release the session's native resources now instead of waiting for
|
|
388
308
|
* GC: aborts the auto-refresh poller, sends the final telemetry flush,
|
|
@@ -416,17 +336,6 @@ export const CLOUD_API_IDENTITY_URL: string
|
|
|
416
336
|
/** Base URL for the Moss index management service. */
|
|
417
337
|
export const CLOUD_API_INDEX_URL: string
|
|
418
338
|
|
|
419
|
-
/** Query endpoint for the Moss query service. */
|
|
420
|
-
export const CLOUD_QUERY_URL: string
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* Deserialize Moss binary data into a JsSerializedIndex object.
|
|
424
|
-
*
|
|
425
|
-
* @param blob - A Uint8Array view containing the binary data.
|
|
426
|
-
* @returns The deserialized SerializedIndex object.
|
|
427
|
-
*/
|
|
428
|
-
export declare function deserializeFromBinary(blob: Uint8Array): SerializedIndex
|
|
429
|
-
|
|
430
339
|
export interface DeviceIdentity {
|
|
431
340
|
deviceId?: string
|
|
432
341
|
mossDeviceId?: string
|
|
@@ -476,37 +385,24 @@ export interface IndexInfo {
|
|
|
476
385
|
}
|
|
477
386
|
|
|
478
387
|
/** Lifecycle status for background index creation processes. */
|
|
479
|
-
export
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
Failed = 'Failed'
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* A simple struct to return the added/updated counts to JS,
|
|
488
|
-
* since JS doesn't support tuples.
|
|
489
|
-
*/
|
|
490
|
-
export interface IndexUpdateResult {
|
|
491
|
-
added: number
|
|
492
|
-
updated: number
|
|
493
|
-
}
|
|
388
|
+
export type IndexStatus = 'NotStarted'|
|
|
389
|
+
'Building'|
|
|
390
|
+
'Ready'|
|
|
391
|
+
'Failed';
|
|
494
392
|
|
|
495
393
|
/** Job phase for async cloud operations. */
|
|
496
|
-
export
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
ParsingDocuments = 'parsing_documents'
|
|
509
|
-
}
|
|
394
|
+
export type JobPhase = 'downloading'|
|
|
395
|
+
'deserializing'|
|
|
396
|
+
'generating_embeddings'|
|
|
397
|
+
'building_index'|
|
|
398
|
+
'uploading'|
|
|
399
|
+
'cleanup'|
|
|
400
|
+
'waiting_for_parser'|
|
|
401
|
+
'parsing'|
|
|
402
|
+
'parsing_complete'|
|
|
403
|
+
'queued'|
|
|
404
|
+
'crawling'|
|
|
405
|
+
'parsing_documents';
|
|
510
406
|
|
|
511
407
|
/** Progress update for async cloud operations. */
|
|
512
408
|
export interface JobProgress {
|
|
@@ -517,13 +413,11 @@ export interface JobProgress {
|
|
|
517
413
|
}
|
|
518
414
|
|
|
519
415
|
/** Job status for async cloud operations. */
|
|
520
|
-
export
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
Failed = 'failed'
|
|
526
|
-
}
|
|
416
|
+
export type JobStatus = 'pending_upload'|
|
|
417
|
+
'uploading'|
|
|
418
|
+
'building'|
|
|
419
|
+
'completed'|
|
|
420
|
+
'failed';
|
|
527
421
|
|
|
528
422
|
/** Status payload for a long-running async job. */
|
|
529
423
|
export interface JobStatusResponse {
|
|
@@ -753,40 +647,7 @@ export interface SearchResult {
|
|
|
753
647
|
timeTakenInMs?: number
|
|
754
648
|
}
|
|
755
649
|
|
|
756
|
-
/**
|
|
757
|
-
export interface SerializedIndex {
|
|
758
|
-
/** Name of the index. */
|
|
759
|
-
name: string
|
|
760
|
-
/** Index build or format version. */
|
|
761
|
-
version: string
|
|
762
|
-
/** Associated embedding model metadata. */
|
|
763
|
-
model: ModelRef
|
|
764
|
-
/** Dimensionality of each embedding vector. */
|
|
765
|
-
dimension: number
|
|
766
|
-
/** Embedding vectors stored row-wise. */
|
|
767
|
-
embeddings: Array<Array<number>>
|
|
768
|
-
/** Document identifiers parallel to the embeddings array. */
|
|
769
|
-
docIds: Array<string>
|
|
770
|
-
envelope?: SerializedIndexEnvelope
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
export interface SerializedIndexEnvelope {
|
|
774
|
-
/** Serialized envelope schema version. */
|
|
775
|
-
version: number
|
|
776
|
-
/** Exact immutable model artifact version, paired with `manifestSha256`. */
|
|
777
|
-
modelArtifactVersion?: string
|
|
778
|
-
/** Lowercase SHA-256 of the authoritative artifact manifest. */
|
|
779
|
-
manifestSha256?: string
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
/**
|
|
783
|
-
* Serialize a JsSerializedIndex object into a binary Buffer (.moss file format).
|
|
784
|
-
*
|
|
785
|
-
* @param index - The index object to serialize.
|
|
786
|
-
* @returns A Node.js Buffer containing the binary data.
|
|
787
|
-
*/
|
|
788
|
-
export declare function serializeToBinary(index: SerializedIndex): Buffer
|
|
789
|
-
|
|
650
|
+
/** Added and updated counts from `addDocuments` and `addDocumentsText`. */
|
|
790
651
|
export interface SessionUpdateResult {
|
|
791
652
|
added: number
|
|
792
653
|
updated: number
|
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@moss-js/moss-core-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@moss-js/moss-core-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
80
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@moss-js/moss-core-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@moss-js/moss-core-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
96
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@moss-js/moss-core-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@moss-js/moss-core-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
117
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@moss-js/moss-core-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@moss-js/moss-core-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
133
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@moss-js/moss-core-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@moss-js/moss-core-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
150
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@moss-js/moss-core-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@moss-js/moss-core-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
166
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@moss-js/moss-core-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@moss-js/moss-core-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
185
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@moss-js/moss-core-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@moss-js/moss-core-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
201
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@moss-js/moss-core-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@moss-js/moss-core-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
217
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@moss-js/moss-core-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@moss-js/moss-core-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
237
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@moss-js/moss-core-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@moss-js/moss-core-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
253
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@moss-js/moss-core-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@moss-js/moss-core-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
274
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@moss-js/moss-core-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@moss-js/moss-core-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
290
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@moss-js/moss-core-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@moss-js/moss-core-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
308
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@moss-js/moss-core-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@moss-js/moss-core-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
324
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@moss-js/moss-core-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@moss-js/moss-core-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
342
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@moss-js/moss-core-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@moss-js/moss-core-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
358
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@moss-js/moss-core-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@moss-js/moss-core-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
376
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@moss-js/moss-core-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@moss-js/moss-core-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
392
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@moss-js/moss-core-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@moss-js/moss-core-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
410
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@moss-js/moss-core-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@moss-js/moss-core-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
426
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@moss-js/moss-core-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@moss-js/moss-core-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
443
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@moss-js/moss-core-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@moss-js/moss-core-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
459
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@moss-js/moss-core-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@moss-js/moss-core-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
479
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@moss-js/moss-core-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@moss-js/moss-core-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
495
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@moss-js/moss-core-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@moss-js/moss-core-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
511
|
+
if (bindingPackageVersion !== '0.34.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.34.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -578,7 +578,6 @@ if (!nativeBinding) {
|
|
|
578
578
|
}
|
|
579
579
|
|
|
580
580
|
module.exports = nativeBinding
|
|
581
|
-
module.exports.Index = nativeBinding.Index
|
|
582
581
|
module.exports.IndexManager = nativeBinding.IndexManager
|
|
583
582
|
module.exports.JsIndexManager = nativeBinding.JsIndexManager
|
|
584
583
|
module.exports.ManageClient = nativeBinding.ManageClient
|
|
@@ -588,8 +587,6 @@ module.exports.JsSessionIndex = nativeBinding.JsSessionIndex
|
|
|
588
587
|
module.exports.CLOUD_API_AUTH_URL = nativeBinding.CLOUD_API_AUTH_URL
|
|
589
588
|
module.exports.CLOUD_API_IDENTITY_URL = nativeBinding.CLOUD_API_IDENTITY_URL
|
|
590
589
|
module.exports.CLOUD_API_INDEX_URL = nativeBinding.CLOUD_API_INDEX_URL
|
|
591
|
-
module.exports.CLOUD_QUERY_URL = nativeBinding.CLOUD_QUERY_URL
|
|
592
|
-
module.exports.deserializeFromBinary = nativeBinding.deserializeFromBinary
|
|
593
590
|
module.exports.IndexStatus = nativeBinding.IndexStatus
|
|
594
591
|
module.exports.JsIndexStatus = nativeBinding.JsIndexStatus
|
|
595
592
|
module.exports.JobPhase = nativeBinding.JobPhase
|
|
@@ -600,5 +597,4 @@ module.exports.MODEL_DOWNLOAD_URL = nativeBinding.MODEL_DOWNLOAD_URL
|
|
|
600
597
|
module.exports.rejectAuthRequest = nativeBinding.rejectAuthRequest
|
|
601
598
|
module.exports.resolveAuthRequest = nativeBinding.resolveAuthRequest
|
|
602
599
|
module.exports.SDK_VERSION_NUMBER = nativeBinding.SDK_VERSION_NUMBER
|
|
603
|
-
module.exports.serializeToBinary = nativeBinding.serializeToBinary
|
|
604
600
|
module.exports.validateIndexName = nativeBinding.validateIndexName
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moss-js/moss-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Connects JS SDK to Rust Moss-Core using N-API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
],
|
|
26
26
|
"files": [
|
|
27
27
|
"index.d.ts",
|
|
28
|
-
"index.js"
|
|
29
|
-
"LICENSE-onnxruntime"
|
|
28
|
+
"index.js"
|
|
30
29
|
],
|
|
31
30
|
"napi": {
|
|
32
31
|
"binaryName": "js-binding",
|
|
32
|
+
"constEnum": false,
|
|
33
33
|
"targets": [
|
|
34
34
|
"x86_64-pc-windows-msvc",
|
|
35
35
|
"x86_64-unknown-linux-gnu",
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"typescript": "^5.9.2"
|
|
64
64
|
},
|
|
65
65
|
"optionalDependencies": {
|
|
66
|
-
"@moss-js/moss-core-win32-x64-msvc": "0.
|
|
67
|
-
"@moss-js/moss-core-linux-x64-gnu": "0.
|
|
68
|
-
"@moss-js/moss-core-linux-arm64-gnu": "0.
|
|
69
|
-
"@moss-js/moss-core-darwin-arm64": "0.
|
|
70
|
-
"@moss-js/moss-core-darwin-x64": "0.
|
|
66
|
+
"@moss-js/moss-core-win32-x64-msvc": "0.34.0",
|
|
67
|
+
"@moss-js/moss-core-linux-x64-gnu": "0.34.0",
|
|
68
|
+
"@moss-js/moss-core-linux-arm64-gnu": "0.34.0",
|
|
69
|
+
"@moss-js/moss-core-darwin-arm64": "0.34.0",
|
|
70
|
+
"@moss-js/moss-core-darwin-x64": "0.34.0"
|
|
71
71
|
}
|
|
72
72
|
}
|