@moyodb/sdk 1.3.0 → 1.5.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-p7uX85l-.js +4 -0
- package/dist/assets/browser-worker-p7uX85l-.js.map +1 -0
- package/dist/assets/shared-worker-BALTqEUe.js +2 -0
- package/dist/assets/shared-worker-BALTqEUe.js.map +1 -0
- package/dist/chunks/{indexing-CKtbpaZn.js → indexing-DdpU69Fd.js} +344 -185
- package/dist/chunks/indexing-DdpU69Fd.js.map +1 -0
- package/dist/codec.d.ts.map +1 -1
- package/dist/compression.d.ts.map +1 -1
- 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/engine/snippets/{moyodb-engine-54a406e33b0fb849 → moyodb-engine-1f8134232168280b}/js/opfs_shim.js +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/indexing.d.ts +7 -0
- package/dist/indexing.d.ts.map +1 -1
- package/dist/moyodb-sdk.js +1265 -872
- package/dist/moyodb-sdk.js.map +1 -1
- package/dist/node-engine.js +411 -81
- package/dist/node-engine.js.map +1 -1
- package/dist/node.js +354 -74
- package/dist/node.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/subscriptions.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-client.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-server.d.ts.map +1 -1
- package/dist/worker.d.ts +12 -5
- package/dist/worker.d.ts.map +1 -1
- package/package.json +5 -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
|
@@ -107,10 +107,13 @@ export function writeAll(handle, bytes, at) {
|
|
|
107
107
|
return writtenTotal;
|
|
108
108
|
}
|
|
109
109
|
// Reads until the buffer is full or a read returns zero. The unread suffix is unchanged.
|
|
110
|
+
// The first attempt borrows the caller view. A short read retries through a suffix
|
|
111
|
+
// view so bytes already stored stay put without copying them.
|
|
110
112
|
export function readAll(handle, buffer, at) {
|
|
111
113
|
let readTotal = 0;
|
|
112
114
|
while (readTotal < buffer.length) {
|
|
113
|
-
const
|
|
115
|
+
const chunk = readTotal === 0 ? buffer : buffer.subarray(readTotal);
|
|
116
|
+
const rawRead = handle.read(chunk, { at: at + readTotal });
|
|
114
117
|
const read = Number(rawRead);
|
|
115
118
|
if (!Number.isSafeInteger(read) || read < 0 || read > buffer.length - readTotal) {
|
|
116
119
|
throw namedError('StorageError', `opfs read failed: invalid byte count ${String(rawRead)}`);
|
|
@@ -192,7 +195,10 @@ export function readControlStateFromAccessHandle(accessHandle) {
|
|
|
192
195
|
return { status: 'absent', control: null };
|
|
193
196
|
}
|
|
194
197
|
const buffer = new Uint8Array(CONTROL_SLOT_SIZE * 2);
|
|
195
|
-
|
|
198
|
+
// A short file must not be presented as a full two-slot buffer. A file that
|
|
199
|
+
// already covers both slots can be read through the allocated buffer itself.
|
|
200
|
+
const readable = size < buffer.length ? buffer.subarray(0, size) : buffer;
|
|
201
|
+
readAll(accessHandle, readable, 0);
|
|
196
202
|
const slot0 = decodeControlSlot(0, buffer.subarray(0, CONTROL_SLOT_SIZE));
|
|
197
203
|
const slot1 = decodeControlSlot(1, buffer.subarray(CONTROL_SLOT_SIZE, CONTROL_SLOT_SIZE * 2));
|
|
198
204
|
if (slot0 && slot1) {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAMR,EAAE,EAOF,WAAW,EAYd,MAAM,SAAS,CAAC;AACjB,OAAO,EASH,KAAK,aAAa,EACrB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAMR,EAAE,EAOF,WAAW,EAYd,MAAM,SAAS,CAAC;AACjB,OAAO,EASH,KAAK,aAAa,EACrB,MAAM,YAAY,CAAC;AAigCpB,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,EAAE,CAAC,CAMjF;AACD,wBAAsB,gBAAgB,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,GACxE,OAAO,CAAC,EAAE,CAAC,CAkEb;AACD,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI1D;AACD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG5D;AACD,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,SAAS,CAAC"}
|
package/dist/indexing.d.ts
CHANGED
|
@@ -25,6 +25,13 @@ export declare function decodeIndexMetadataValue(bytes: Uint8Array): NormalizedI
|
|
|
25
25
|
export declare function encodeIndexEntryKey(logicalIndexKey: Uint8Array, primaryKey: Uint8Array): Uint8Array;
|
|
26
26
|
export declare function decodeIndexEntryKey(bytes: Uint8Array): DecodedIndexEntryKey;
|
|
27
27
|
export declare function indexKeyExactRange(logicalIndexKey: Uint8Array): Range;
|
|
28
|
+
/** WASM `usize` is 32-bit, so this is the largest limit the engine can accept. */
|
|
29
|
+
export declare const MAX_ENGINE_SCAN_LIMIT = 4294967295;
|
|
30
|
+
/**
|
|
31
|
+
* Bounds and limits follow the engine `RangeSpec` contract.
|
|
32
|
+
* Conflicting bounds and a limit the engine cannot store are `InvalidRangeError`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function assertValidScanRange(range?: Range): void;
|
|
28
35
|
export declare function indexRangeToPhysicalRange(range?: Range): Range;
|
|
29
36
|
export declare function extractLogicalIndexKey(def: NormalizedIndexDef, valueBytes: Uint8Array): Uint8Array | null;
|
|
30
37
|
/**
|
package/dist/indexing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexing.d.ts","sourceRoot":"","sources":["../src/indexing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"indexing.d.ts","sourceRoot":"","sources":["../src/indexing.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAS/C,eAAO,MAAM,oBAAoB,wBAAwB,CAAC;AAC1D,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;CACzB;AACD,MAAM,WAAW,oBAAoB;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;CAC1B;AACD,wBAAgB,mBAAmB,CAAC,IAAI,E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