@korajs/store 1.0.0-beta.5 → 1.0.0-beta.7
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/adapters/better-sqlite3.d.cts +1 -1
- package/dist/adapters/better-sqlite3.d.ts +1 -1
- package/dist/adapters/indexeddb.cjs +347 -132
- package/dist/adapters/indexeddb.cjs.map +1 -1
- package/dist/adapters/indexeddb.d.cts +4 -2
- package/dist/adapters/indexeddb.d.ts +4 -2
- package/dist/adapters/indexeddb.js +42 -5
- package/dist/adapters/indexeddb.js.map +1 -1
- package/dist/adapters/sqlite-wasm-worker.cjs.map +1 -1
- package/dist/adapters/sqlite-wasm-worker.js +250 -3
- package/dist/adapters/sqlite-wasm-worker.js.map +1 -1
- package/dist/adapters/sqlite-wasm.cjs +308 -129
- package/dist/adapters/sqlite-wasm.cjs.map +1 -1
- package/dist/adapters/sqlite-wasm.d.cts +18 -7
- package/dist/adapters/sqlite-wasm.d.ts +18 -7
- package/dist/adapters/sqlite-wasm.js +2 -2
- package/dist/{chunk-Q57CHIIN.js → chunk-RJIEKEN4.js} +310 -130
- package/dist/chunk-RJIEKEN4.js.map +1 -0
- package/dist/{chunk-COJSQBXW.js → chunk-VDBJQ75K.js} +1 -1
- package/dist/chunk-VDBJQ75K.js.map +1 -0
- package/dist/{chunk-RL43UYQZ.js → chunk-YT7MRFCP.js} +5 -5
- package/dist/index.cjs +26 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -4
- package/dist/index.d.ts +18 -4
- package/dist/index.js +44 -18
- package/dist/index.js.map +1 -1
- package/dist/internal.d.cts +3 -3
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +2 -2
- package/dist/{sqlite-wasm-channel-NGSBJR44.js → sqlite-wasm-channel-GGHA2BXU.js} +2 -2
- package/dist/{sqlite-wasm-channel-Bx57s8Cq.d.cts → sqlite-wasm-channel-L6o3bWQK.d.cts} +2 -2
- package/dist/{sqlite-wasm-channel-Bx57s8Cq.d.ts → sqlite-wasm-channel-L6o3bWQK.d.ts} +2 -2
- package/dist/{types-C1kigrWz.d.ts → types-BOO9EPt1.d.ts} +1 -1
- package/dist/{types-D1MzKVmk.d.ts → types-BslDOTk0.d.cts} +16 -1
- package/dist/{types-D1MzKVmk.d.cts → types-BslDOTk0.d.ts} +16 -1
- package/dist/{types-DAo9oduO.d.cts → types-C_GDavG-.d.cts} +1 -1
- package/package.json +2 -12
- package/dist/adapters/sqlite-wasm-shared-host.cjs +0 -345
- package/dist/adapters/sqlite-wasm-shared-host.cjs.map +0 -1
- package/dist/adapters/sqlite-wasm-shared-host.d.cts +0 -82
- package/dist/adapters/sqlite-wasm-shared-host.d.ts +0 -82
- package/dist/adapters/sqlite-wasm-shared-host.js +0 -61
- package/dist/adapters/sqlite-wasm-shared-host.js.map +0 -1
- package/dist/chunk-3Y2IERBF.js +0 -255
- package/dist/chunk-3Y2IERBF.js.map +0 -1
- package/dist/chunk-COJSQBXW.js.map +0 -1
- package/dist/chunk-Q57CHIIN.js.map +0 -1
- /package/dist/{chunk-RL43UYQZ.js.map → chunk-YT7MRFCP.js.map} +0 -0
- /package/dist/{sqlite-wasm-channel-NGSBJR44.js.map → sqlite-wasm-channel-GGHA2BXU.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { C as CollectionRecord, S as StorageAdapter, Q as QueryDescriptor,
|
|
2
|
-
export { M as MigrationPlan,
|
|
1
|
+
import { C as CollectionRecord, S as StorageAdapter, Q as QueryDescriptor, d as SubscriptionCallback, W as WhereClause, e as OrderByDirection, L as LocalMutationHandler, f as StoreConfig, A as ApplyRemoteOptions, g as MaterializedRowSnapshot, h as RowVersionState } from './types-BslDOTk0.cjs';
|
|
2
|
+
export { M as MigrationPlan, i as OrderByClause, j as StorageFallbackReason, a as StorageOpenState, k as StoreIsolation, T as Transaction, l as TransactionBufferedEntry, m as TransactionCommitBatch, n as TransactionCommitResult, o as WhereOperators } from './types-BslDOTk0.cjs';
|
|
3
3
|
import { Operation, KoraError, VersionVector, SchemaDefinition, HLCTimestamp, MergeTrace, CollectionDefinition, SequenceConfig, HybridLogicalClock, CausalTracker, OperationLog, ApplyResult, StateMachineDefinition, KoraBytesValue, KoraEvent, BlobRefMetadata, BlobRef } from '@korajs/core';
|
|
4
4
|
export { ApplyResult } from '@korajs/core';
|
|
5
|
-
import { R as RelationEnforcer, L as LocalMutationContext } from './types-
|
|
6
|
-
export { C as Collection } from './types-
|
|
5
|
+
import { R as RelationEnforcer, L as LocalMutationContext } from './types-C_GDavG-.cjs';
|
|
6
|
+
export { C as Collection } from './types-C_GDavG-.cjs';
|
|
7
7
|
import * as yjs from 'yjs';
|
|
8
8
|
import { C as ContentAddressedBlobStore, M as MemoryBlobStore } from './content-addressed-blob-store-Dcj3SB9r.cjs';
|
|
9
9
|
export { B as BlobIntegrityError } from './content-addressed-blob-store-Dcj3SB9r.cjs';
|
|
@@ -820,6 +820,14 @@ declare class Store implements OperationLog {
|
|
|
820
820
|
* Route local CRUD through the unified apply pipeline (korajs ApplyPipeline).
|
|
821
821
|
*/
|
|
822
822
|
setLocalMutationHandler(handler: LocalMutationHandler | null): void;
|
|
823
|
+
/**
|
|
824
|
+
* Notify this store that another same-origin runtime committed an operation to
|
|
825
|
+
* the shared local database. The operation has already been persisted and
|
|
826
|
+
* materialized by the database owner; this method only advances in-memory causal
|
|
827
|
+
* watermarks and invalidates local reactive queries so already-open tabs stay
|
|
828
|
+
* live without reapplying or rewriting the operation.
|
|
829
|
+
*/
|
|
830
|
+
notifyExternalOperation(operation: Operation): void;
|
|
823
831
|
/**
|
|
824
832
|
* Build mutation context for a collection (used by ApplyPipeline side effects).
|
|
825
833
|
*/
|
|
@@ -1008,6 +1016,7 @@ declare class QueryStore<T = CollectionRecord> {
|
|
|
1008
1016
|
private listeners;
|
|
1009
1017
|
private unsubscribeQuery;
|
|
1010
1018
|
private active;
|
|
1019
|
+
private hasEmittedSnapshot;
|
|
1011
1020
|
private readonly queryBuilder;
|
|
1012
1021
|
constructor(queryBuilder: QueryBuilder<T>);
|
|
1013
1022
|
/**
|
|
@@ -1018,6 +1027,11 @@ declare class QueryStore<T = CollectionRecord> {
|
|
|
1018
1027
|
subscribe: (onStoreChange: () => void) => (() => void);
|
|
1019
1028
|
/** Synchronous read of the latest query results. */
|
|
1020
1029
|
getSnapshot: () => readonly T[];
|
|
1030
|
+
/**
|
|
1031
|
+
* Whether the underlying query subscription has delivered at least one
|
|
1032
|
+
* authoritative result for the current subscription lifecycle.
|
|
1033
|
+
*/
|
|
1034
|
+
hasSnapshot: () => boolean;
|
|
1021
1035
|
/** Tear down listeners and the underlying query subscription. */
|
|
1022
1036
|
destroy(): void;
|
|
1023
1037
|
private startSubscription;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { C as CollectionRecord, S as StorageAdapter, Q as QueryDescriptor,
|
|
2
|
-
export { M as MigrationPlan,
|
|
1
|
+
import { C as CollectionRecord, S as StorageAdapter, Q as QueryDescriptor, d as SubscriptionCallback, W as WhereClause, e as OrderByDirection, L as LocalMutationHandler, f as StoreConfig, A as ApplyRemoteOptions, g as MaterializedRowSnapshot, h as RowVersionState } from './types-BslDOTk0.js';
|
|
2
|
+
export { M as MigrationPlan, i as OrderByClause, j as StorageFallbackReason, a as StorageOpenState, k as StoreIsolation, T as Transaction, l as TransactionBufferedEntry, m as TransactionCommitBatch, n as TransactionCommitResult, o as WhereOperators } from './types-BslDOTk0.js';
|
|
3
3
|
import { Operation, KoraError, VersionVector, SchemaDefinition, HLCTimestamp, MergeTrace, CollectionDefinition, SequenceConfig, HybridLogicalClock, CausalTracker, OperationLog, ApplyResult, StateMachineDefinition, KoraBytesValue, KoraEvent, BlobRefMetadata, BlobRef } from '@korajs/core';
|
|
4
4
|
export { ApplyResult } from '@korajs/core';
|
|
5
|
-
import { R as RelationEnforcer, L as LocalMutationContext } from './types-
|
|
6
|
-
export { C as Collection } from './types-
|
|
5
|
+
import { R as RelationEnforcer, L as LocalMutationContext } from './types-BOO9EPt1.js';
|
|
6
|
+
export { C as Collection } from './types-BOO9EPt1.js';
|
|
7
7
|
import * as yjs from 'yjs';
|
|
8
8
|
import { C as ContentAddressedBlobStore, M as MemoryBlobStore } from './content-addressed-blob-store-Dcj3SB9r.js';
|
|
9
9
|
export { B as BlobIntegrityError } from './content-addressed-blob-store-Dcj3SB9r.js';
|
|
@@ -820,6 +820,14 @@ declare class Store implements OperationLog {
|
|
|
820
820
|
* Route local CRUD through the unified apply pipeline (korajs ApplyPipeline).
|
|
821
821
|
*/
|
|
822
822
|
setLocalMutationHandler(handler: LocalMutationHandler | null): void;
|
|
823
|
+
/**
|
|
824
|
+
* Notify this store that another same-origin runtime committed an operation to
|
|
825
|
+
* the shared local database. The operation has already been persisted and
|
|
826
|
+
* materialized by the database owner; this method only advances in-memory causal
|
|
827
|
+
* watermarks and invalidates local reactive queries so already-open tabs stay
|
|
828
|
+
* live without reapplying or rewriting the operation.
|
|
829
|
+
*/
|
|
830
|
+
notifyExternalOperation(operation: Operation): void;
|
|
823
831
|
/**
|
|
824
832
|
* Build mutation context for a collection (used by ApplyPipeline side effects).
|
|
825
833
|
*/
|
|
@@ -1008,6 +1016,7 @@ declare class QueryStore<T = CollectionRecord> {
|
|
|
1008
1016
|
private listeners;
|
|
1009
1017
|
private unsubscribeQuery;
|
|
1010
1018
|
private active;
|
|
1019
|
+
private hasEmittedSnapshot;
|
|
1011
1020
|
private readonly queryBuilder;
|
|
1012
1021
|
constructor(queryBuilder: QueryBuilder<T>);
|
|
1013
1022
|
/**
|
|
@@ -1018,6 +1027,11 @@ declare class QueryStore<T = CollectionRecord> {
|
|
|
1018
1027
|
subscribe: (onStoreChange: () => void) => (() => void);
|
|
1019
1028
|
/** Synchronous read of the latest query results. */
|
|
1020
1029
|
getSnapshot: () => readonly T[];
|
|
1030
|
+
/**
|
|
1031
|
+
* Whether the underlying query subscription has delivered at least one
|
|
1032
|
+
* authoritative result for the current subscription lifecycle.
|
|
1033
|
+
*/
|
|
1034
|
+
hasSnapshot: () => boolean;
|
|
1021
1035
|
/** Tear down listeners and the underlying query subscription. */
|
|
1022
1036
|
destroy(): void;
|
|
1023
1037
|
private startSubscription;
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
exportBackup,
|
|
3
|
-
readBackupManifest,
|
|
4
|
-
restoreBackup,
|
|
5
|
-
verifyBackupChecksum
|
|
6
|
-
} from "./chunk-HS6DBMST.js";
|
|
7
1
|
import {
|
|
8
2
|
decodeAuditExport,
|
|
9
3
|
readAuditExportManifest,
|
|
@@ -39,7 +33,24 @@ import {
|
|
|
39
33
|
serializeRowVersion,
|
|
40
34
|
validateStateTransition,
|
|
41
35
|
validateUpdateStateMachine
|
|
42
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-YT7MRFCP.js";
|
|
37
|
+
import {
|
|
38
|
+
AdapterError,
|
|
39
|
+
NoLeaderError,
|
|
40
|
+
OptimisticLockError,
|
|
41
|
+
PersistenceError,
|
|
42
|
+
QueryError,
|
|
43
|
+
RecordNotFoundError,
|
|
44
|
+
StoreNotOpenError,
|
|
45
|
+
WorkerInitError,
|
|
46
|
+
WorkerTimeoutError
|
|
47
|
+
} from "./chunk-TUR7RGEP.js";
|
|
48
|
+
import {
|
|
49
|
+
exportBackup,
|
|
50
|
+
readBackupManifest,
|
|
51
|
+
restoreBackup,
|
|
52
|
+
verifyBackupChecksum
|
|
53
|
+
} from "./chunk-HS6DBMST.js";
|
|
43
54
|
import {
|
|
44
55
|
decodeRichtext,
|
|
45
56
|
decodeRichtextFieldsFromOpData,
|
|
@@ -52,17 +63,6 @@ import {
|
|
|
52
63
|
serializeOperation,
|
|
53
64
|
serializeRecord
|
|
54
65
|
} from "./chunk-GSJ7EEUC.js";
|
|
55
|
-
import {
|
|
56
|
-
AdapterError,
|
|
57
|
-
NoLeaderError,
|
|
58
|
-
OptimisticLockError,
|
|
59
|
-
PersistenceError,
|
|
60
|
-
QueryError,
|
|
61
|
-
RecordNotFoundError,
|
|
62
|
-
StoreNotOpenError,
|
|
63
|
-
WorkerInitError,
|
|
64
|
-
WorkerTimeoutError
|
|
65
|
-
} from "./chunk-TUR7RGEP.js";
|
|
66
66
|
|
|
67
67
|
// src/compaction/types.ts
|
|
68
68
|
var COMPACTION_BASELINE_META_KEY = "compaction_baseline_at";
|
|
@@ -2596,6 +2596,22 @@ var Store = class {
|
|
|
2596
2596
|
col.setMutationHandler(handler);
|
|
2597
2597
|
}
|
|
2598
2598
|
}
|
|
2599
|
+
/**
|
|
2600
|
+
* Notify this store that another same-origin runtime committed an operation to
|
|
2601
|
+
* the shared local database. The operation has already been persisted and
|
|
2602
|
+
* materialized by the database owner; this method only advances in-memory causal
|
|
2603
|
+
* watermarks and invalidates local reactive queries so already-open tabs stay
|
|
2604
|
+
* live without reapplying or rewriting the operation.
|
|
2605
|
+
*/
|
|
2606
|
+
notifyExternalOperation(operation) {
|
|
2607
|
+
this.ensureOpen();
|
|
2608
|
+
const definition = this.schema.collections[operation.collection];
|
|
2609
|
+
if (!definition) {
|
|
2610
|
+
return;
|
|
2611
|
+
}
|
|
2612
|
+
this.recordOperationSequence(operation);
|
|
2613
|
+
this.subscriptionManager.notify(operation.collection, operation);
|
|
2614
|
+
}
|
|
2599
2615
|
/**
|
|
2600
2616
|
* Build mutation context for a collection (used by ApplyPipeline side effects).
|
|
2601
2617
|
*/
|
|
@@ -3091,6 +3107,7 @@ var QueryStore = class {
|
|
|
3091
3107
|
listeners = /* @__PURE__ */ new Set();
|
|
3092
3108
|
unsubscribeQuery = null;
|
|
3093
3109
|
active = false;
|
|
3110
|
+
hasEmittedSnapshot = false;
|
|
3094
3111
|
queryBuilder;
|
|
3095
3112
|
constructor(queryBuilder) {
|
|
3096
3113
|
this.queryBuilder = queryBuilder;
|
|
@@ -3116,16 +3133,25 @@ var QueryStore = class {
|
|
|
3116
3133
|
getSnapshot = () => {
|
|
3117
3134
|
return this.snapshot;
|
|
3118
3135
|
};
|
|
3136
|
+
/**
|
|
3137
|
+
* Whether the underlying query subscription has delivered at least one
|
|
3138
|
+
* authoritative result for the current subscription lifecycle.
|
|
3139
|
+
*/
|
|
3140
|
+
hasSnapshot = () => {
|
|
3141
|
+
return this.hasEmittedSnapshot;
|
|
3142
|
+
};
|
|
3119
3143
|
/** Tear down listeners and the underlying query subscription. */
|
|
3120
3144
|
destroy() {
|
|
3121
3145
|
this.stopSubscription();
|
|
3122
3146
|
this.listeners.clear();
|
|
3123
3147
|
this.snapshot = EMPTY_ARRAY;
|
|
3148
|
+
this.hasEmittedSnapshot = false;
|
|
3124
3149
|
}
|
|
3125
3150
|
startSubscription() {
|
|
3126
3151
|
this.active = true;
|
|
3127
3152
|
this.unsubscribeQuery = this.queryBuilder.subscribe((results) => {
|
|
3128
3153
|
if (!this.active) return;
|
|
3154
|
+
this.hasEmittedSnapshot = true;
|
|
3129
3155
|
this.snapshot = Object.freeze([...results]);
|
|
3130
3156
|
this.notifyListeners();
|
|
3131
3157
|
});
|