@korajs/store 1.0.0-beta.13 → 1.0.0-beta.14

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.
Files changed (53) hide show
  1. package/dist/adapters/better-sqlite3.cjs.map +1 -1
  2. package/dist/adapters/better-sqlite3.js +1 -1
  3. package/dist/adapters/indexeddb.cjs.map +1 -1
  4. package/dist/adapters/indexeddb.js +4 -4
  5. package/dist/adapters/sqlite-wasm-worker.cjs +67 -15
  6. package/dist/adapters/sqlite-wasm-worker.cjs.map +1 -1
  7. package/dist/adapters/sqlite-wasm-worker.js +65 -17
  8. package/dist/adapters/sqlite-wasm-worker.js.map +1 -1
  9. package/dist/adapters/sqlite-wasm.cjs.map +1 -1
  10. package/dist/adapters/sqlite-wasm.js +5 -5
  11. package/dist/{backup-4NUPDEMB.js → backup-IHKVMUAM.js} +5 -5
  12. package/dist/{chunk-Y5LRH7KI.js → chunk-5AQSGMJV.js} +151 -21
  13. package/dist/chunk-5AQSGMJV.js.map +1 -0
  14. package/dist/{chunk-W5F2LWG6.js → chunk-5JMGMPUE.js} +2 -2
  15. package/dist/{chunk-HZTDBLDB.js → chunk-BILSA6XZ.js} +4 -3
  16. package/dist/{chunk-HZTDBLDB.js.map → chunk-BILSA6XZ.js.map} +1 -1
  17. package/dist/{chunk-QDUSJMFV.js → chunk-BQSIL6TT.js} +5 -5
  18. package/dist/{chunk-MCQKEHOD.js → chunk-KK3GBONL.js} +2 -2
  19. package/dist/{chunk-32EDKWMI.js → chunk-KTVNANUH.js} +2 -2
  20. package/dist/{chunk-SJP2HTYZ.js → chunk-QW4UU7NG.js} +2 -2
  21. package/dist/{chunk-DUKTWVZW.js → chunk-SRHDJF5B.js} +13 -2
  22. package/dist/{chunk-DUKTWVZW.js.map → chunk-SRHDJF5B.js.map} +1 -1
  23. package/dist/{chunk-P4V375FY.js → chunk-UC2LGFPV.js} +4 -4
  24. package/dist/index.cjs +203 -47
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +96 -6
  27. package/dist/index.d.ts +96 -6
  28. package/dist/index.js +55 -39
  29. package/dist/index.js.map +1 -1
  30. package/dist/internal.cjs +1 -0
  31. package/dist/internal.cjs.map +1 -1
  32. package/dist/internal.d.cts +2 -2
  33. package/dist/internal.d.ts +2 -2
  34. package/dist/internal.js +3 -3
  35. package/dist/{restore-FR7XIKT2.js → restore-MNDPR557.js} +4 -4
  36. package/dist/{sql-builder-C4u55jKW.d.cts → sql-builder-D0tC3sv9.d.cts} +8 -1
  37. package/dist/{sql-builder-CGckdBDL.d.ts → sql-builder-D5UMzHEo.d.ts} +8 -1
  38. package/dist/sqlite-wasm-channel-QCCNBYCU.js +12 -0
  39. package/dist/store-HNGX4KTT.js +16 -0
  40. package/package.json +2 -2
  41. package/dist/chunk-Y5LRH7KI.js.map +0 -1
  42. package/dist/sqlite-wasm-channel-MLHLKEED.js +0 -12
  43. package/dist/store-IMWKZLWB.js +0 -16
  44. /package/dist/{backup-4NUPDEMB.js.map → backup-IHKVMUAM.js.map} +0 -0
  45. /package/dist/{chunk-W5F2LWG6.js.map → chunk-5JMGMPUE.js.map} +0 -0
  46. /package/dist/{chunk-QDUSJMFV.js.map → chunk-BQSIL6TT.js.map} +0 -0
  47. /package/dist/{chunk-MCQKEHOD.js.map → chunk-KK3GBONL.js.map} +0 -0
  48. /package/dist/{chunk-32EDKWMI.js.map → chunk-KTVNANUH.js.map} +0 -0
  49. /package/dist/{chunk-SJP2HTYZ.js.map → chunk-QW4UU7NG.js.map} +0 -0
  50. /package/dist/{chunk-P4V375FY.js.map → chunk-UC2LGFPV.js.map} +0 -0
  51. /package/dist/{restore-FR7XIKT2.js.map → restore-MNDPR557.js.map} +0 -0
  52. /package/dist/{sqlite-wasm-channel-MLHLKEED.js.map → sqlite-wasm-channel-QCCNBYCU.js.map} +0 -0
  53. /package/dist/{store-IMWKZLWB.js.map → store-HNGX4KTT.js.map} +0 -0
@@ -1,8 +1,8 @@
1
1
  import { Operation, FieldDescriptor, HLCTimestamp } from '@korajs/core';
2
2
  import { O as OperationRow, R as RawCollectionRow, C as CollectionRecord } from './types-Dh-xyUjP.cjs';
3
3
  export { b as MetaRow, c as Subscription, V as VersionVectorRow } from './types-Dh-xyUjP.cjs';
4
- import { L as LocalMutationContext } from './sql-builder-C4u55jKW.cjs';
5
- export { D as DatabaseQuery, S as SqlQuery, b as buildCountQuery, a as buildInsertQuery, c as buildLwwSoftDeleteQuery, d as buildLwwUpdateQuery, e as buildSelectQuery, f as buildSoftDeleteQuery, g as buildUpdateQuery, h as buildWhereClause, i as hasUnsyncedOwnOperations } from './sql-builder-C4u55jKW.cjs';
4
+ import { L as LocalMutationContext } from './sql-builder-D0tC3sv9.cjs';
5
+ export { D as DatabaseQuery, S as SqlQuery, b as buildCountQuery, a as buildInsertQuery, c as buildLwwSoftDeleteQuery, d as buildLwwUpdateQuery, e as buildSelectQuery, f as buildSoftDeleteQuery, g as buildUpdateQuery, h as buildWhereClause, i as hasUnsyncedOwnOperations } from './sql-builder-D0tC3sv9.cjs';
6
6
 
7
7
  /**
8
8
  * Serialize a JS record to SQL-compatible values for INSERT/UPDATE.
@@ -1,8 +1,8 @@
1
1
  import { Operation, FieldDescriptor, HLCTimestamp } from '@korajs/core';
2
2
  import { O as OperationRow, R as RawCollectionRow, C as CollectionRecord } from './types-Dh-xyUjP.js';
3
3
  export { b as MetaRow, c as Subscription, V as VersionVectorRow } from './types-Dh-xyUjP.js';
4
- import { L as LocalMutationContext } from './sql-builder-CGckdBDL.js';
5
- export { D as DatabaseQuery, S as SqlQuery, b as buildCountQuery, a as buildInsertQuery, c as buildLwwSoftDeleteQuery, d as buildLwwUpdateQuery, e as buildSelectQuery, f as buildSoftDeleteQuery, g as buildUpdateQuery, h as buildWhereClause, i as hasUnsyncedOwnOperations } from './sql-builder-CGckdBDL.js';
4
+ import { L as LocalMutationContext } from './sql-builder-D5UMzHEo.js';
5
+ export { D as DatabaseQuery, S as SqlQuery, b as buildCountQuery, a as buildInsertQuery, c as buildLwwSoftDeleteQuery, d as buildLwwUpdateQuery, e as buildSelectQuery, f as buildSoftDeleteQuery, g as buildUpdateQuery, h as buildWhereClause, i as hasUnsyncedOwnOperations } from './sql-builder-D5UMzHEo.js';
6
6
 
7
7
  /**
8
8
  * Serialize a JS record to SQL-compatible values for INSERT/UPDATE.
package/dist/internal.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  executeDelete,
3
3
  executeInsert,
4
4
  executeUpdate
5
- } from "./chunk-HZTDBLDB.js";
5
+ } from "./chunk-BILSA6XZ.js";
6
6
  import {
7
7
  buildCountQuery,
8
8
  buildInsertQuery,
@@ -16,7 +16,7 @@ import {
16
16
  isIncomingNewerThanRow,
17
17
  rowVersionFromRecord,
18
18
  serializeRowVersion
19
- } from "./chunk-SJP2HTYZ.js";
19
+ } from "./chunk-QW4UU7NG.js";
20
20
  import {
21
21
  deserializeOperation,
22
22
  deserializeOperationWithCollection,
@@ -24,7 +24,7 @@ import {
24
24
  serializeOperation,
25
25
  serializeRecord
26
26
  } from "./chunk-J5AGXF3D.js";
27
- import "./chunk-DUKTWVZW.js";
27
+ import "./chunk-SRHDJF5B.js";
28
28
  export {
29
29
  buildCountQuery,
30
30
  buildInsertQuery,
@@ -6,7 +6,7 @@ import {
6
6
  PROVISIONAL_OPS_TABLE,
7
7
  SEQ_CONFLICTS_TABLE,
8
8
  insertConflictRow
9
- } from "./chunk-32EDKWMI.js";
9
+ } from "./chunk-KTVNANUH.js";
10
10
  import {
11
11
  DELIVERY_WATERMARK_META_KEY,
12
12
  DELTA_CURSOR_META_KEY,
@@ -14,12 +14,12 @@ import {
14
14
  ensureLocalSyncRecordTables,
15
15
  loadLastAckedServerVector,
16
16
  loadOwnAckedThrough
17
- } from "./chunk-SJP2HTYZ.js";
17
+ } from "./chunk-QW4UU7NG.js";
18
18
  import {
19
19
  deserializeOperationWithCollection,
20
20
  serializeOperation
21
21
  } from "./chunk-J5AGXF3D.js";
22
- import "./chunk-DUKTWVZW.js";
22
+ import "./chunk-SRHDJF5B.js";
23
23
 
24
24
  // src/backup/restore.ts
25
25
  import { HybridLogicalClock, quoteIdent } from "@korajs/core";
@@ -296,4 +296,4 @@ export {
296
296
  restoreMerge,
297
297
  restoreReplace
298
298
  };
299
- //# sourceMappingURL=restore-FR7XIKT2.js.map
299
+ //# sourceMappingURL=restore-MNDPR557.js.map
@@ -290,6 +290,12 @@ interface WriteEnv {
290
290
  * `maxOperationBytes`. Default `DEFAULT_MAX_OPERATION_BYTES` (256 KiB).
291
291
  */
292
292
  readonly maxOperationBytes?: number;
293
+ /**
294
+ * Throws when local writes are not allowed right now: the store's pinned node
295
+ * belongs to another user than the one signed in (F9). Called before every local
296
+ * operation is built.
297
+ */
298
+ readonly assertLocalWriteAllowed?: () => void;
293
299
  }
294
300
  /**
295
301
  * Causal bookkeeping for the operations built inside ONE storage transaction.
@@ -479,7 +485,8 @@ declare class Collection {
479
485
  private readonly onStorageError?;
480
486
  private readonly fold?;
481
487
  private readonly maxOperationBytes?;
482
- constructor(name: string, definition: CollectionDefinition, schema: SchemaDefinition, adapter: StorageAdapter, clock: HybridLogicalClock, nodeId: string, onMutation: MutationCallback, relationEnforcer: RelationEnforcer | null, mutationHandler: LocalMutationHandler | null, causalTracker: CausalTracker | null, secretKeyProvider?: SecretKeyProvider | undefined, onStorageError?: ((error: unknown) => void) | undefined, fold?: (() => RecordFolder | undefined) | undefined, maxOperationBytes?: number | undefined);
488
+ private readonly assertLocalWriteAllowed?;
489
+ constructor(name: string, definition: CollectionDefinition, schema: SchemaDefinition, adapter: StorageAdapter, clock: HybridLogicalClock, nodeId: string, onMutation: MutationCallback, relationEnforcer: RelationEnforcer | null, mutationHandler: LocalMutationHandler | null, causalTracker: CausalTracker | null, secretKeyProvider?: SecretKeyProvider | undefined, onStorageError?: ((error: unknown) => void) | undefined, fold?: (() => RecordFolder | undefined) | undefined, maxOperationBytes?: number | undefined, assertLocalWriteAllowed?: (() => void) | undefined);
483
490
  /**
484
491
  * Point this collection at the store's new device identity after a node-id
485
492
  * rotation (RT-21). Internal: called by the owning Store only.
@@ -290,6 +290,12 @@ interface WriteEnv {
290
290
  * `maxOperationBytes`. Default `DEFAULT_MAX_OPERATION_BYTES` (256 KiB).
291
291
  */
292
292
  readonly maxOperationBytes?: number;
293
+ /**
294
+ * Throws when local writes are not allowed right now: the store's pinned node
295
+ * belongs to another user than the one signed in (F9). Called before every local
296
+ * operation is built.
297
+ */
298
+ readonly assertLocalWriteAllowed?: () => void;
293
299
  }
294
300
  /**
295
301
  * Causal bookkeeping for the operations built inside ONE storage transaction.
@@ -479,7 +485,8 @@ declare class Collection {
479
485
  private readonly onStorageError?;
480
486
  private readonly fold?;
481
487
  private readonly maxOperationBytes?;
482
- constructor(name: string, definition: CollectionDefinition, schema: SchemaDefinition, adapter: StorageAdapter, clock: HybridLogicalClock, nodeId: string, onMutation: MutationCallback, relationEnforcer: RelationEnforcer | null, mutationHandler: LocalMutationHandler | null, causalTracker: CausalTracker | null, secretKeyProvider?: SecretKeyProvider | undefined, onStorageError?: ((error: unknown) => void) | undefined, fold?: (() => RecordFolder | undefined) | undefined, maxOperationBytes?: number | undefined);
488
+ private readonly assertLocalWriteAllowed?;
489
+ constructor(name: string, definition: CollectionDefinition, schema: SchemaDefinition, adapter: StorageAdapter, clock: HybridLogicalClock, nodeId: string, onMutation: MutationCallback, relationEnforcer: RelationEnforcer | null, mutationHandler: LocalMutationHandler | null, causalTracker: CausalTracker | null, secretKeyProvider?: SecretKeyProvider | undefined, onStorageError?: ((error: unknown) => void) | undefined, fold?: (() => RecordFolder | undefined) | undefined, maxOperationBytes?: number | undefined, assertLocalWriteAllowed?: (() => void) | undefined);
483
490
  /**
484
491
  * Point this collection at the store's new device identity after a node-id
485
492
  * rotation (RT-21). Internal: called by the owning Store only.
@@ -0,0 +1,12 @@
1
+ import {
2
+ WebWorkerBridge
3
+ } from "./chunk-KK3GBONL.js";
4
+ import {
5
+ Mutex
6
+ } from "./chunk-TVJEC5S2.js";
7
+ import "./chunk-SRHDJF5B.js";
8
+ export {
9
+ Mutex,
10
+ WebWorkerBridge
11
+ };
12
+ //# sourceMappingURL=sqlite-wasm-channel-QCCNBYCU.js.map
@@ -0,0 +1,16 @@
1
+ import {
2
+ ReservedNodeIdError,
3
+ Store
4
+ } from "./chunk-5AQSGMJV.js";
5
+ import "./chunk-BILSA6XZ.js";
6
+ import "./chunk-A6GFH5IG.js";
7
+ import "./chunk-UC2LGFPV.js";
8
+ import "./chunk-KTVNANUH.js";
9
+ import "./chunk-QW4UU7NG.js";
10
+ import "./chunk-J5AGXF3D.js";
11
+ import "./chunk-SRHDJF5B.js";
12
+ export {
13
+ ReservedNodeIdError,
14
+ Store
15
+ };
16
+ //# sourceMappingURL=store-HNGX4KTT.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@korajs/store",
3
- "version": "1.0.0-beta.13",
3
+ "version": "1.0.0-beta.14",
4
4
  "description": "Local storage engine for Kora.js with SQLite WASM, IndexedDB, and reactive queries",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -84,7 +84,7 @@
84
84
  ],
85
85
  "dependencies": {
86
86
  "yjs": "^13.6.30",
87
- "@korajs/core": "1.0.0-beta.13"
87
+ "@korajs/core": "1.0.0-beta.14"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "@sqlite.org/sqlite-wasm": ">=3.51.0-build1"