@moyodb/sdk 1.3.0 → 1.4.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/CONTRIBUTING.md +46 -0
- package/README.md +4 -2
- package/dist/assets/browser-worker-Bj2ErRvC.js +4 -0
- package/dist/assets/browser-worker-Bj2ErRvC.js.map +1 -0
- package/dist/assets/shared-worker-CMeTcusa.js +2 -0
- package/dist/assets/shared-worker-CMeTcusa.js.map +1 -0
- package/dist/chunks/{indexing-CKtbpaZn.js → indexing-B0duqlUs.js} +43 -117
- package/dist/chunks/indexing-B0duqlUs.js.map +1 -0
- package/dist/demo.d.ts.map +1 -1
- package/dist/engine/README.md +4 -2
- package/dist/engine/moyodb_engine.d.ts +4 -2
- package/dist/engine/moyodb_engine.js +45 -22
- package/dist/engine/moyodb_engine_bg.wasm +0 -0
- package/dist/engine/moyodb_engine_bg.wasm.d.ts +3 -2
- package/dist/engine/package.json +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/indexing.d.ts.map +1 -1
- package/dist/moyodb-sdk.js +648 -653
- package/dist/moyodb-sdk.js.map +1 -1
- package/dist/node-engine.js +30 -35
- package/dist/node-engine.js.map +1 -1
- package/dist/node.js +23 -31
- package/dist/node.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/worker-api.d.ts +2 -5
- package/dist/worker-api.d.ts.map +1 -1
- package/dist/worker-protocol.d.ts +7 -2
- package/dist/worker-protocol.d.ts.map +1 -1
- package/dist/worker.d.ts +2 -2
- package/dist/worker.d.ts.map +1 -1
- package/package.json +4 -3
- package/dist/assets/browser-worker-DBt51gsS.js +0 -4
- package/dist/assets/browser-worker-DBt51gsS.js.map +0 -1
- package/dist/assets/shared-worker-NdniRuEL.js +0 -2
- package/dist/assets/shared-worker-NdniRuEL.js.map +0 -1
- package/dist/chunks/indexing-CKtbpaZn.js.map +0 -1
- /package/dist/engine/snippets/{moyodb-engine-54a406e33b0fb849 → moyodb-engine-1d53039816cbc2f7}/js/opfs_shim.js +0 -0
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as StoreExistsError, A as prefixRange, B as DatabaseClosedError, C as compoundKey, Ct as isWorkerProtocolReadyEnvelope, D as indexKey, Dt as isWorkerProtocolResponseBatchMessage, E as encodeIndexScalar, F as utf8Encode, G as InvalidRangeError, Gt as isRecord$1, H as InjectedFailureError, Ht as workerProtocolError, I as ChangeFeedCompactedError, J as ReadonlyTransactionError, K as KeyTooLargeError, L as ConstraintError, M as splitCompoundKey, N as u64Key, Nt as prepareWorkerCommandPayload, O as jsonDecode, Ot as isWorkerProtocolResponseMessage, P as utf8Decode, Q as StorageError, R as CorruptionError, S as toPublicIndexDefinitions, T as encodeCompoundKeyParts, U as InternalError, Ut as clampTimerDelayMs, V as IndexNotFoundError, W as InvalidOpenOptionsError, Wt as compareStringsByCodeUnit, X as ReservedStoreNameError, Y as RecoveryRequiredError, Z as SerializationError, _ as indexRangeToPhysicalRange, a as createIndexKeyExtractor, at as UnsupportedPlatformError, b as normalizeIndexDefinitions, c as decodeIndexedDocument, ct as WriteTransactionAlreadyOpenError, d as encodeIndexMetadataValue, et as StoreNameTooLongError, f as extractLogicalIndexKey, ft as WORKER_PROTOCOL_REQUEST, g as indexKeyExactRange, gt as captureWorkerPayload, h as indexDefinitionIdentity, i as compareNormalizedIndexDefinitions, it as UniqueIndexConstraintError, j as prefixSuccessor, k as jsonEncode, l as encodeIndexEntryKey, lt as normalizeError, m as findIndexDefinition, n as assertPublicStoreName, nt as TransactionClosedError, o as decodeIndexEntryKey, ot as ValueTooLargeError, p as extractLogicalIndexKeyFromDocument, pt as WORKER_PROTOCOL_REQUEST_BATCH, q as MoyoDbError, r as cloneNormalizedIndexDefinitions, rt as TransactionConflictError, s as decodeIndexMetadataValue, st as VersionError, t as INDEX_METADATA_STORE, tt as StoreNotFoundError, u as encodeIndexMetadataKey, v as indexesForStore, vt as decodeWorkerResponsePayload, w as compoundKeyRange, wt as isWorkerProtocolReadyMessage, x as serializeNormalizedIndexDefinitions, y as isInternalStoreName, yt as deserializeWorkerError, z as DatabaseBusyError } from "./chunks/indexing-
|
|
1
|
+
import { $ as StoreExistsError, A as prefixRange, B as DatabaseClosedError, C as compoundKey, Ct as isWorkerProtocolReadyEnvelope, D as indexKey, Dt as isWorkerProtocolResponseBatchMessage, E as encodeIndexScalar, F as utf8Encode, G as InvalidRangeError, Gt as isRecord$1, H as InjectedFailureError, Ht as workerProtocolError, I as ChangeFeedCompactedError, J as ReadonlyTransactionError, K as KeyTooLargeError, L as ConstraintError, M as splitCompoundKey, N as u64Key, Nt as prepareWorkerCommandPayload, O as jsonDecode, Ot as isWorkerProtocolResponseMessage, P as utf8Decode, Q as StorageError, R as CorruptionError, S as toPublicIndexDefinitions, T as encodeCompoundKeyParts, U as InternalError, Ut as clampTimerDelayMs, V as IndexNotFoundError, W as InvalidOpenOptionsError, Wt as compareStringsByCodeUnit, X as ReservedStoreNameError, Y as RecoveryRequiredError, Z as SerializationError, _ as indexRangeToPhysicalRange, a as createIndexKeyExtractor, at as UnsupportedPlatformError, b as normalizeIndexDefinitions, c as decodeIndexedDocument, ct as WriteTransactionAlreadyOpenError, d as encodeIndexMetadataValue, et as StoreNameTooLongError, f as extractLogicalIndexKey, ft as WORKER_PROTOCOL_REQUEST, g as indexKeyExactRange, gt as captureWorkerPayload, h as indexDefinitionIdentity, i as compareNormalizedIndexDefinitions, it as UniqueIndexConstraintError, j as prefixSuccessor, k as jsonEncode, l as encodeIndexEntryKey, lt as normalizeError, m as findIndexDefinition, n as assertPublicStoreName, nt as TransactionClosedError, o as decodeIndexEntryKey, ot as ValueTooLargeError, p as extractLogicalIndexKeyFromDocument, pt as WORKER_PROTOCOL_REQUEST_BATCH, q as MoyoDbError, r as cloneNormalizedIndexDefinitions, rt as TransactionConflictError, s as decodeIndexMetadataValue, st as VersionError, t as INDEX_METADATA_STORE, tt as StoreNotFoundError, u as encodeIndexMetadataKey, v as indexesForStore, vt as decodeWorkerResponsePayload, w as compoundKeyRange, wt as isWorkerProtocolReadyMessage, x as serializeNormalizedIndexDefinitions, y as isInternalStoreName, yt as deserializeWorkerError, z as DatabaseBusyError } from "./chunks/indexing-B0duqlUs.js";
|
|
2
2
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
3
|
import { realpath } from "node:fs/promises";
|
|
4
4
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -2428,20 +2428,17 @@ var DBImpl = class {
|
|
|
2428
2428
|
}
|
|
2429
2429
|
}
|
|
2430
2430
|
async listStores() {
|
|
2431
|
-
this.#
|
|
2432
|
-
return callProxy(() => this.#entry.proxy.listStores());
|
|
2431
|
+
return this.#call(() => this.#entry.proxy.listStores());
|
|
2433
2432
|
}
|
|
2434
2433
|
async listIndexes() {
|
|
2435
2434
|
this.#ensureOpen();
|
|
2436
2435
|
return callProxy(() => this.#entry.proxy.getIndexes());
|
|
2437
2436
|
}
|
|
2438
2437
|
async getVersion() {
|
|
2439
|
-
this.#
|
|
2440
|
-
return callProxy(() => this.#entry.proxy.getVersion());
|
|
2438
|
+
return this.#call(() => this.#entry.proxy.getVersion());
|
|
2441
2439
|
}
|
|
2442
2440
|
async changesSince(txid, options = {}) {
|
|
2443
|
-
this.#
|
|
2444
|
-
return callProxy(() => this.#entry.proxy.changesSince(normalizeTxId(txid), normalizeChangeFeedOptions(options)));
|
|
2441
|
+
return this.#call(() => this.#entry.proxy.changesSince(normalizeTxId(txid), normalizeChangeFeedOptions(options)));
|
|
2445
2442
|
}
|
|
2446
2443
|
async #beginImpl(mode) {
|
|
2447
2444
|
this.#ensureOpen();
|
|
@@ -2552,54 +2549,40 @@ var DBImpl = class {
|
|
|
2552
2549
|
return callProxy(() => this.#entry.proxy.autocommit(mode, command, args));
|
|
2553
2550
|
}
|
|
2554
2551
|
async exportSnapshot(options = {}) {
|
|
2555
|
-
this.#
|
|
2556
|
-
return callProxy(async () => {
|
|
2552
|
+
return this.#call(async () => {
|
|
2557
2553
|
const bytes = await this.#entry.proxy.exportSnapshot(normalizeExportSnapshotOptions(options));
|
|
2558
2554
|
return bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|
|
2559
2555
|
});
|
|
2560
2556
|
}
|
|
2561
2557
|
async importSnapshot(data) {
|
|
2562
|
-
this.#
|
|
2563
|
-
invalidateTransactions(this.#entry);
|
|
2564
|
-
return callProxy(() => {
|
|
2558
|
+
return this.#callAfterTxInvalidation(() => {
|
|
2565
2559
|
const bytes = data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
2566
2560
|
return this.#entry.proxy.importSnapshot(bytes);
|
|
2567
2561
|
});
|
|
2568
2562
|
}
|
|
2569
2563
|
async reset() {
|
|
2570
|
-
this.#
|
|
2571
|
-
invalidateTransactions(this.#entry);
|
|
2572
|
-
return callProxy(() => this.#entry.proxy.reset());
|
|
2564
|
+
return this.#callAfterTxInvalidation(() => this.#entry.proxy.reset());
|
|
2573
2565
|
}
|
|
2574
2566
|
async compact() {
|
|
2575
|
-
this.#
|
|
2576
|
-
invalidateTransactions(this.#entry);
|
|
2577
|
-
return callProxy(() => this.#entry.proxy.compact());
|
|
2567
|
+
return this.#callAfterTxInvalidation(() => this.#entry.proxy.compact());
|
|
2578
2568
|
}
|
|
2579
2569
|
async rebuild() {
|
|
2580
|
-
this.#
|
|
2581
|
-
invalidateTransactions(this.#entry);
|
|
2582
|
-
return callProxy(() => this.#entry.proxy.rebuild());
|
|
2570
|
+
return this.#callAfterTxInvalidation(() => this.#entry.proxy.rebuild());
|
|
2583
2571
|
}
|
|
2584
2572
|
async stats() {
|
|
2585
|
-
this.#
|
|
2586
|
-
return callProxy(() => this.#entry.proxy.stats());
|
|
2573
|
+
return this.#call(() => this.#entry.proxy.stats());
|
|
2587
2574
|
}
|
|
2588
2575
|
async storageInfo() {
|
|
2589
|
-
this.#
|
|
2590
|
-
return callProxy(() => this.#entry.proxy.storageInfo());
|
|
2576
|
+
return this.#call(() => this.#entry.proxy.storageInfo());
|
|
2591
2577
|
}
|
|
2592
2578
|
async requestPersistence() {
|
|
2593
|
-
this.#
|
|
2594
|
-
return callProxy(() => this.#entry.proxy.requestPersistence());
|
|
2579
|
+
return this.#call(() => this.#entry.proxy.requestPersistence());
|
|
2595
2580
|
}
|
|
2596
2581
|
async destroy() {
|
|
2597
|
-
this.#
|
|
2598
|
-
return callProxy(() => this.#entry.destroy?.() ?? destroyDbWorker(this.#entry));
|
|
2582
|
+
return this.#call(() => this.#entry.destroy?.() ?? destroyDbWorker(this.#entry));
|
|
2599
2583
|
}
|
|
2600
2584
|
async setFailpoint(failpoint) {
|
|
2601
|
-
this.#
|
|
2602
|
-
return callProxy(() => this.#entry.proxy.setFailpoint(failpoint));
|
|
2585
|
+
return this.#call(() => this.#entry.proxy.setFailpoint(failpoint));
|
|
2603
2586
|
}
|
|
2604
2587
|
subscribe(arg1, arg2, arg3) {
|
|
2605
2588
|
this.#ensureOpen();
|
|
@@ -2659,6 +2642,15 @@ var DBImpl = class {
|
|
|
2659
2642
|
this.#forceCloseTransactions();
|
|
2660
2643
|
this.#subscriptions.close();
|
|
2661
2644
|
}
|
|
2645
|
+
#call(run) {
|
|
2646
|
+
this.#ensureOpen();
|
|
2647
|
+
return callProxy(run);
|
|
2648
|
+
}
|
|
2649
|
+
#callAfterTxInvalidation(run) {
|
|
2650
|
+
this.#ensureOpen();
|
|
2651
|
+
invalidateTransactions(this.#entry);
|
|
2652
|
+
return callProxy(run);
|
|
2653
|
+
}
|
|
2662
2654
|
#ensureOpen() {
|
|
2663
2655
|
if (this.#closed || this.#entry.invalidated) throw new DatabaseClosedError();
|
|
2664
2656
|
}
|