@bitcobblers/wod-wiki-storage 0.60.2258 → 0.62.2260
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/dist/{chunk-6WNKSMMW.mjs → chunk-62HQFP3B.mjs} +18 -11
- package/dist/chunk-62HQFP3B.mjs.map +1 -0
- package/dist/{chunk-WSFEAN7C.mjs → chunk-UZU3SJVC.mjs} +4 -4
- package/dist/{chunk-WSFEAN7C.mjs.map → chunk-UZU3SJVC.mjs.map} +1 -1
- package/dist/{chunk-W4J74CHN.mjs → chunk-WPWAMGAW.mjs} +37 -6
- package/dist/chunk-WPWAMGAW.mjs.map +1 -0
- package/dist/idb/index.cjs +98 -22
- package/dist/idb/index.cjs.map +1 -1
- package/dist/idb/index.d.cts +3 -3
- package/dist/idb/index.d.ts +3 -3
- package/dist/idb/index.mjs +67 -20
- package/dist/idb/index.mjs.map +1 -1
- package/dist/index.cjs +48 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +16 -12
- package/dist/index.mjs.map +1 -1
- package/dist/{policy-BrDCt3IU.d.cts → policy-BW92ljIY.d.cts} +1 -1
- package/dist/{policy-JQg92EFM.d.ts → policy-DI2euDls.d.ts} +1 -1
- package/dist/sql/index.cjs +66 -19
- package/dist/sql/index.cjs.map +1 -1
- package/dist/sql/index.d.cts +3 -3
- package/dist/sql/index.d.ts +3 -3
- package/dist/sql/index.mjs +19 -10
- package/dist/sql/index.mjs.map +1 -1
- package/dist/{sync-BeNNJq5-.d.ts → sync-Bl-3Hr1W.d.ts} +1 -1
- package/dist/{sync-Dnogcmm_.d.cts → sync-DJYfvXeH.d.cts} +1 -1
- package/dist/{wire-sRdblNjM.d.ts → wire-CerODSdR.d.cts} +5 -3
- package/dist/{wire-sRdblNjM.d.cts → wire-CerODSdR.d.ts} +5 -3
- package/package.json +6 -6
- package/dist/chunk-6WNKSMMW.mjs.map +0 -1
- package/dist/chunk-W4J74CHN.mjs.map +0 -1
package/dist/sql/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { S as SqlConnection, D as Database } from '../connection-DxuCLpRc.cjs';
|
|
2
2
|
export { L as LibsqlClient, a as SqlRow, b as SqlStatement, c as SqlValue, l as libsqlDatabase } from '../connection-DxuCLpRc.cjs';
|
|
3
|
-
import { e as StoreDef, R as RangeDTO, K as KeyDTO, f as DomainQueryResult, T as TxOp, I as IStorage, S as StoreName, a as IReadOnlyStore, b as StoreType, c as IReadWriteStore, D as DomainQuery, d as IStorageTransaction } from '../wire-
|
|
4
|
-
import { b as StoredSyncOp, S as SyncMutation } from '../sync-
|
|
5
|
-
export { A as ApplySyncBatchOptions, R as RawSyncOp, c as SYNC_OPS_TABLE, d as SYNC_STATE_TABLE, a as SyncEntry, e as SyncTargetKind, f as applySyncBatch, g as fetchSyncOps, i as initSyncTarget, p as probeSyncTarget, r as readLegacyRows, h as readRawSyncOps } from '../sync-
|
|
3
|
+
import { e as StoreDef, R as RangeDTO, K as KeyDTO, f as DomainQueryResult, T as TxOp, I as IStorage, S as StoreName, a as IReadOnlyStore, b as StoreType, c as IReadWriteStore, D as DomainQuery, d as IStorageTransaction } from '../wire-CerODSdR.cjs';
|
|
4
|
+
import { b as StoredSyncOp, S as SyncMutation } from '../sync-DJYfvXeH.cjs';
|
|
5
|
+
export { A as ApplySyncBatchOptions, R as RawSyncOp, c as SYNC_OPS_TABLE, d as SYNC_STATE_TABLE, a as SyncEntry, e as SyncTargetKind, f as applySyncBatch, g as fetchSyncOps, i as initSyncTarget, p as probeSyncTarget, r as readLegacyRows, h as readRawSyncOps } from '../sync-DJYfvXeH.cjs';
|
|
6
6
|
import '@libsql/client';
|
|
7
7
|
import '@bitcobblers/wod-wiki-core';
|
|
8
8
|
import '@bitcobblers/wod-wiki-lang';
|
package/dist/sql/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { S as SqlConnection, D as Database } from '../connection-DxuCLpRc.js';
|
|
2
2
|
export { L as LibsqlClient, a as SqlRow, b as SqlStatement, c as SqlValue, l as libsqlDatabase } from '../connection-DxuCLpRc.js';
|
|
3
|
-
import { e as StoreDef, R as RangeDTO, K as KeyDTO, f as DomainQueryResult, T as TxOp, I as IStorage, S as StoreName, a as IReadOnlyStore, b as StoreType, c as IReadWriteStore, D as DomainQuery, d as IStorageTransaction } from '../wire-
|
|
4
|
-
import { b as StoredSyncOp, S as SyncMutation } from '../sync-
|
|
5
|
-
export { A as ApplySyncBatchOptions, R as RawSyncOp, c as SYNC_OPS_TABLE, d as SYNC_STATE_TABLE, a as SyncEntry, e as SyncTargetKind, f as applySyncBatch, g as fetchSyncOps, i as initSyncTarget, p as probeSyncTarget, r as readLegacyRows, h as readRawSyncOps } from '../sync-
|
|
3
|
+
import { e as StoreDef, R as RangeDTO, K as KeyDTO, f as DomainQueryResult, T as TxOp, I as IStorage, S as StoreName, a as IReadOnlyStore, b as StoreType, c as IReadWriteStore, D as DomainQuery, d as IStorageTransaction } from '../wire-CerODSdR.js';
|
|
4
|
+
import { b as StoredSyncOp, S as SyncMutation } from '../sync-Bl-3Hr1W.js';
|
|
5
|
+
export { A as ApplySyncBatchOptions, R as RawSyncOp, c as SYNC_OPS_TABLE, d as SYNC_STATE_TABLE, a as SyncEntry, e as SyncTargetKind, f as applySyncBatch, g as fetchSyncOps, i as initSyncTarget, p as probeSyncTarget, r as readLegacyRows, h as readRawSyncOps } from '../sync-Bl-3Hr1W.js';
|
|
6
6
|
import '@libsql/client';
|
|
7
7
|
import '@bitcobblers/wod-wiki-core';
|
|
8
8
|
import '@bitcobblers/wod-wiki-lang';
|
package/dist/sql/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DOMAIN_PROJECTION_VERSION, bufferToOps, bufferedGet, overlayRows, isDirty, bufferSlot } from '../chunk-
|
|
2
|
-
import { getRows, storeDefinition, deleteRows, clearRows, SCHEMA_TABLE, decodeRowJson, encodeRowJson, initializeStore, putRow, wipeRows, getRow, listRowsFromIndexMany, listRows, countRows, putRows, deleteIn, batchInsert, SYNC_STATE_TABLE } from '../chunk-
|
|
3
|
-
export { SCHEMA_TABLE, SYNC_OPS_TABLE, SYNC_STATE_TABLE, applySyncBatch, clearRows, countRows, decodeRowJson, deleteRows, encodeRowJson, fetchSyncOps, getRow, getRows, initSyncTarget, initializeStore, listRows, listRowsFromIndexMany, probeSyncTarget, putRow, putRows, readLegacyRows, readRawSyncOps, storeDefinition, wipeRows } from '../chunk-
|
|
4
|
-
import { rowsEqual, validateStoredPins, DB_VERSION, STORE_DEFS, stampUserOwned, rangeFromIDB, keyFromValue, isRange } from '../chunk-
|
|
1
|
+
import { DOMAIN_PROJECTION_VERSION, bufferToOps, bufferedGet, overlayRows, isDirty, bufferSlot } from '../chunk-UZU3SJVC.mjs';
|
|
2
|
+
import { getRows, storeDefinition, deleteRows, clearRows, SCHEMA_TABLE, decodeRowJson, encodeRowJson, initializeStore, putRow, wipeRows, getRow, listRowsFromIndexMany, listRows, countRows, putRows, deleteIn, batchInsert, SYNC_STATE_TABLE } from '../chunk-62HQFP3B.mjs';
|
|
3
|
+
export { SCHEMA_TABLE, SYNC_OPS_TABLE, SYNC_STATE_TABLE, applySyncBatch, clearRows, countRows, decodeRowJson, deleteRows, encodeRowJson, fetchSyncOps, getRow, getRows, initSyncTarget, initializeStore, listRows, listRowsFromIndexMany, probeSyncTarget, putRow, putRows, readLegacyRows, readRawSyncOps, storeDefinition, wipeRows } from '../chunk-62HQFP3B.mjs';
|
|
4
|
+
import { rowsEqual, validateStoredPins, DB_VERSION, STORE_DEFS, stampUserOwned, rangeFromIDB, keyFromValue, isRange } from '../chunk-WPWAMGAW.mjs';
|
|
5
5
|
import { libsqlDatabase } from '../chunk-6ZTAWTAP.mjs';
|
|
6
6
|
export { libsqlDatabase } from '../chunk-6ZTAWTAP.mjs';
|
|
7
7
|
import { StorageError } from '../chunk-XRQKLSOT.mjs';
|
|
@@ -23,6 +23,11 @@ function sourceNote(row) {
|
|
|
23
23
|
if (!Array.isArray(tags) || !tags.every((t) => typeof t === "string")) throw new StorageError(400, "tags must be a string array");
|
|
24
24
|
item.tags = tags;
|
|
25
25
|
}
|
|
26
|
+
const notebookIds = row["notebookIds"];
|
|
27
|
+
if (notebookIds !== void 0 && notebookIds !== null) {
|
|
28
|
+
if (!Array.isArray(notebookIds) || !notebookIds.every((n) => typeof n === "string")) throw new StorageError(400, "notebookIds must be a string array");
|
|
29
|
+
item.notebookIds = notebookIds;
|
|
30
|
+
}
|
|
26
31
|
return item;
|
|
27
32
|
}
|
|
28
33
|
var num = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
@@ -922,9 +927,11 @@ var SqlStore = class {
|
|
|
922
927
|
this.assertMutable();
|
|
923
928
|
const stored = this.owner.stamp(this.store, value);
|
|
924
929
|
const key = keyFromValue(this.def, stored);
|
|
925
|
-
if (this.store === "block_revisions") {
|
|
930
|
+
if (this.store === "block_revisions" || this.store === "note_revisions") {
|
|
926
931
|
const previous = this.buffer?.get(bufferSlot(this.store, key));
|
|
927
|
-
if (previous?.kind === "put" && !rowsEqual(previous.value, stored))
|
|
932
|
+
if (previous?.kind === "put" && !rowsEqual(previous.value, stored)) {
|
|
933
|
+
throw new StorageError(409, this.store === "note_revisions" ? "immutable note revision collision" : "immutable block revision collision", "revision_conflict");
|
|
934
|
+
}
|
|
928
935
|
}
|
|
929
936
|
if (this.buffer) {
|
|
930
937
|
this.buffer.set(bufferSlot(this.store, key), { kind: "put", value: stored });
|
|
@@ -938,12 +945,14 @@ var SqlStore = class {
|
|
|
938
945
|
this.assertMutable();
|
|
939
946
|
const stored = values.map((value) => this.owner.stamp(this.store, value));
|
|
940
947
|
const keys = stored.map((value) => keyFromValue(this.def, value));
|
|
941
|
-
if (this.store === "block_revisions") {
|
|
948
|
+
if (this.store === "block_revisions" || this.store === "note_revisions") {
|
|
942
949
|
const seen = /* @__PURE__ */ new Map();
|
|
943
950
|
keys.forEach((key, i) => {
|
|
944
951
|
const slot = bufferSlot(this.store, key), previous = this.buffer?.get(slot);
|
|
945
952
|
const value = seen.has(slot) ? seen.get(slot) : previous?.kind === "put" ? previous.value : void 0;
|
|
946
|
-
if (value !== void 0 && !rowsEqual(value, stored[i]))
|
|
953
|
+
if (value !== void 0 && !rowsEqual(value, stored[i])) {
|
|
954
|
+
throw new StorageError(409, this.store === "note_revisions" ? "immutable note revision collision" : "immutable block revision collision", "revision_conflict");
|
|
955
|
+
}
|
|
947
956
|
seen.set(slot, stored[i]);
|
|
948
957
|
});
|
|
949
958
|
}
|
|
@@ -954,7 +963,7 @@ var SqlStore = class {
|
|
|
954
963
|
async delete(key) {
|
|
955
964
|
await this.owner.ensureReady();
|
|
956
965
|
this.assertMutable();
|
|
957
|
-
if (this.store === "block_revisions") throw new StorageError(409, "block history requires explicit wipe", "revision_conflict");
|
|
966
|
+
if (this.store === "block_revisions" || this.store === "note_revisions") throw new StorageError(409, "block history requires explicit wipe", "revision_conflict");
|
|
958
967
|
const range = isRange(key) ? key : void 0;
|
|
959
968
|
const target = range ?? key;
|
|
960
969
|
if (this.buffer) {
|
|
@@ -974,7 +983,7 @@ var SqlStore = class {
|
|
|
974
983
|
async clear() {
|
|
975
984
|
await this.owner.ensureReady();
|
|
976
985
|
this.assertMutable();
|
|
977
|
-
if (this.store === "block_revisions") throw new StorageError(409, "block history requires explicit wipe", "revision_conflict");
|
|
986
|
+
if (this.store === "block_revisions" || this.store === "note_revisions") throw new StorageError(409, "block history requires explicit wipe", "revision_conflict");
|
|
978
987
|
if (this.buffer) {
|
|
979
988
|
this.cleared?.add(this.store);
|
|
980
989
|
const prefix = `${this.store}\0`;
|