@sunfall/arc-db 0.1.0-alpha.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/LICENSE +21 -0
- package/dist/change-feed-dispatcher.d.ts +21 -0
- package/dist/change-feed-dispatcher.d.ts.map +1 -0
- package/dist/change-feed-dispatcher.js +53 -0
- package/dist/change-feed-dispatcher.js.map +1 -0
- package/dist/collection-change-feed-runtime.d.ts +32 -0
- package/dist/collection-change-feed-runtime.d.ts.map +1 -0
- package/dist/collection-change-feed-runtime.js +50 -0
- package/dist/collection-change-feed-runtime.js.map +1 -0
- package/dist/collection-contract.d.ts +525 -0
- package/dist/collection-contract.d.ts.map +1 -0
- package/dist/collection-contract.js +4 -0
- package/dist/collection-contract.js.map +1 -0
- package/dist/collection-definition-snapshot.d.ts +64 -0
- package/dist/collection-definition-snapshot.d.ts.map +1 -0
- package/dist/collection-definition-snapshot.js +122 -0
- package/dist/collection-definition-snapshot.js.map +1 -0
- package/dist/collection-errors.d.ts +38 -0
- package/dist/collection-errors.d.ts.map +1 -0
- package/dist/collection-errors.js +17 -0
- package/dist/collection-errors.js.map +1 -0
- package/dist/collection-ids.d.ts +6 -0
- package/dist/collection-ids.d.ts.map +1 -0
- package/dist/collection-ids.js +6 -0
- package/dist/collection-ids.js.map +1 -0
- package/dist/collection-index-materialization.d.ts +29 -0
- package/dist/collection-index-materialization.d.ts.map +1 -0
- package/dist/collection-index-materialization.js +118 -0
- package/dist/collection-index-materialization.js.map +1 -0
- package/dist/collection-mutation-queue.d.ts +10 -0
- package/dist/collection-mutation-queue.d.ts.map +1 -0
- package/dist/collection-mutation-queue.js +46 -0
- package/dist/collection-mutation-queue.js.map +1 -0
- package/dist/collection-mutation-workflow.d.ts +18 -0
- package/dist/collection-mutation-workflow.d.ts.map +1 -0
- package/dist/collection-mutation-workflow.js +252 -0
- package/dist/collection-mutation-workflow.js.map +1 -0
- package/dist/collection-persistence.d.ts +48 -0
- package/dist/collection-persistence.d.ts.map +1 -0
- package/dist/collection-persistence.js +323 -0
- package/dist/collection-persistence.js.map +1 -0
- package/dist/collection-policy.d.ts +5 -0
- package/dist/collection-policy.d.ts.map +1 -0
- package/dist/collection-policy.js +7 -0
- package/dist/collection-policy.js.map +1 -0
- package/dist/collection-preload.d.ts +21 -0
- package/dist/collection-preload.d.ts.map +1 -0
- package/dist/collection-preload.js +4 -0
- package/dist/collection-preload.js.map +1 -0
- package/dist/collection-projection-callback-policy.d.ts +14 -0
- package/dist/collection-projection-callback-policy.d.ts.map +1 -0
- package/dist/collection-projection-callback-policy.js +25 -0
- package/dist/collection-projection-callback-policy.js.map +1 -0
- package/dist/collection-reactive-binding.d.ts +72 -0
- package/dist/collection-reactive-binding.d.ts.map +1 -0
- package/dist/collection-reactive-binding.js +95 -0
- package/dist/collection-reactive-binding.js.map +1 -0
- package/dist/collection-registry.d.ts +56 -0
- package/dist/collection-registry.d.ts.map +1 -0
- package/dist/collection-registry.js +123 -0
- package/dist/collection-registry.js.map +1 -0
- package/dist/collection-row-ingress.d.ts +16 -0
- package/dist/collection-row-ingress.d.ts.map +1 -0
- package/dist/collection-row-ingress.js +110 -0
- package/dist/collection-row-ingress.js.map +1 -0
- package/dist/collection-runtime.d.ts +20 -0
- package/dist/collection-runtime.d.ts.map +1 -0
- package/dist/collection-runtime.js +256 -0
- package/dist/collection-runtime.js.map +1 -0
- package/dist/collection-snapshot-codec.d.ts +62 -0
- package/dist/collection-snapshot-codec.d.ts.map +1 -0
- package/dist/collection-snapshot-codec.js +563 -0
- package/dist/collection-snapshot-codec.js.map +1 -0
- package/dist/collection-state.d.ts +72 -0
- package/dist/collection-state.d.ts.map +1 -0
- package/dist/collection-state.js +276 -0
- package/dist/collection-state.js.map +1 -0
- package/dist/collection-sync-load-policy.d.ts +17 -0
- package/dist/collection-sync-load-policy.d.ts.map +1 -0
- package/dist/collection-sync-load-policy.js +245 -0
- package/dist/collection-sync-load-policy.js.map +1 -0
- package/dist/collection-value-detachment.d.ts +34 -0
- package/dist/collection-value-detachment.d.ts.map +1 -0
- package/dist/collection-value-detachment.js +248 -0
- package/dist/collection-value-detachment.js.map +1 -0
- package/dist/collection-write-commit.d.ts +32 -0
- package/dist/collection-write-commit.d.ts.map +1 -0
- package/dist/collection-write-commit.js +51 -0
- package/dist/collection-write-commit.js.map +1 -0
- package/dist/flush-policy.d.ts +130 -0
- package/dist/flush-policy.d.ts.map +1 -0
- package/dist/flush-policy.js +96 -0
- package/dist/flush-policy.js.map +1 -0
- package/dist/index.d.ts +481 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +251 -0
- package/dist/index.js.map +1 -0
- package/dist/live-query-collection-materialization.d.ts +47 -0
- package/dist/live-query-collection-materialization.d.ts.map +1 -0
- package/dist/live-query-collection-materialization.js +231 -0
- package/dist/live-query-collection-materialization.js.map +1 -0
- package/dist/live-query-collection.d.ts +23 -0
- package/dist/live-query-collection.d.ts.map +1 -0
- package/dist/live-query-collection.js +94 -0
- package/dist/live-query-collection.js.map +1 -0
- package/dist/live-query-runtime.d.ts +8 -0
- package/dist/live-query-runtime.d.ts.map +1 -0
- package/dist/live-query-runtime.js +228 -0
- package/dist/live-query-runtime.js.map +1 -0
- package/dist/live-query-state.d.ts +11 -0
- package/dist/live-query-state.d.ts.map +1 -0
- package/dist/live-query-state.js +130 -0
- package/dist/live-query-state.js.map +1 -0
- package/dist/query-builder.d.ts +294 -0
- package/dist/query-builder.d.ts.map +1 -0
- package/dist/query-builder.js +373 -0
- package/dist/query-builder.js.map +1 -0
- package/dist/query-context-identity.d.ts +19 -0
- package/dist/query-context-identity.d.ts.map +1 -0
- package/dist/query-context-identity.js +41 -0
- package/dist/query-context-identity.js.map +1 -0
- package/dist/query-execution-plan.d.ts +27 -0
- package/dist/query-execution-plan.d.ts.map +1 -0
- package/dist/query-execution-plan.js +69 -0
- package/dist/query-execution-plan.js.map +1 -0
- package/dist/query-plan.d.ts +200 -0
- package/dist/query-plan.d.ts.map +1 -0
- package/dist/query-plan.js +524 -0
- package/dist/query-plan.js.map +1 -0
- package/dist/query-source-adapter.d.ts +25 -0
- package/dist/query-source-adapter.d.ts.map +1 -0
- package/dist/query-source-adapter.js +14 -0
- package/dist/query-source-adapter.js.map +1 -0
- package/dist/runtime-collection-store.d.ts +38 -0
- package/dist/runtime-collection-store.d.ts.map +1 -0
- package/dist/runtime-collection-store.js +149 -0
- package/dist/runtime-collection-store.js.map +1 -0
- package/dist/server-collection.d.ts +84 -0
- package/dist/server-collection.d.ts.map +1 -0
- package/dist/server-collection.js +84 -0
- package/dist/server-collection.js.map +1 -0
- package/dist/sqlite-persistence.d.ts +239 -0
- package/dist/sqlite-persistence.d.ts.map +1 -0
- package/dist/sqlite-persistence.js +345 -0
- package/dist/sqlite-persistence.js.map +1 -0
- package/dist/sync-adapter.d.ts +233 -0
- package/dist/sync-adapter.d.ts.map +1 -0
- package/dist/sync-adapter.js +226 -0
- package/dist/sync-adapter.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { invokeEffectInput, } from "@sunfall/arc-core";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
const shouldSkipCollection = (skip, context) => {
|
|
4
|
+
if (!skip) {
|
|
5
|
+
return Effect.succeed(false);
|
|
6
|
+
}
|
|
7
|
+
return typeof skip === "function"
|
|
8
|
+
? invokeEffectInput("Collection.flush.skip", skip, context)
|
|
9
|
+
: invokeEffectInput("Collection.flush.skip", () => skip);
|
|
10
|
+
};
|
|
11
|
+
const backgroundSyncPending = (collections) => Effect.forEach(collections, (collection) => Effect.map(collection.pendingMutationsEffect(), (pending) => ({
|
|
12
|
+
collection: collection.name,
|
|
13
|
+
transactions: pending.map((entry) => entry.transaction),
|
|
14
|
+
})));
|
|
15
|
+
/**
|
|
16
|
+
* Flush queued optimistic mutations for each collection in order.
|
|
17
|
+
*
|
|
18
|
+
* Collection handler errors, requirements, and optional skip predicate channels
|
|
19
|
+
* are reflected in the returned Effect.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* yield* flushCollectionsPendingMutationsEffect([todos, projects])
|
|
23
|
+
*/
|
|
24
|
+
export const flushCollectionsPendingMutationsEffect = (collections, options = {}) => Effect.gen(function* () {
|
|
25
|
+
const results = [];
|
|
26
|
+
let index = 0;
|
|
27
|
+
for (const collection of collections) {
|
|
28
|
+
const context = {
|
|
29
|
+
collection,
|
|
30
|
+
index,
|
|
31
|
+
};
|
|
32
|
+
const skipped = yield* shouldSkipCollection(options.skip, context);
|
|
33
|
+
if (skipped) {
|
|
34
|
+
results.push({
|
|
35
|
+
_tag: "Skipped",
|
|
36
|
+
collection: collection.name,
|
|
37
|
+
transactions: [],
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const transactions = yield* collection.flushPendingMutationsEffect();
|
|
42
|
+
results.push({
|
|
43
|
+
_tag: "Flushed",
|
|
44
|
+
collection: collection.name,
|
|
45
|
+
transactions,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
index++;
|
|
49
|
+
}
|
|
50
|
+
return results;
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Decide whether to flush pending mutations for a background sync trigger.
|
|
54
|
+
*
|
|
55
|
+
* Returns `Idle` when nothing is pending, `Deferred` when the adapter declines
|
|
56
|
+
* the flush, or `Flushed` with per-collection results.
|
|
57
|
+
*/
|
|
58
|
+
export const backgroundSyncCollectionsPendingMutationsEffect = (collections, options = {}) => Effect.gen(function* () {
|
|
59
|
+
const collectionArray = Array.from(collections);
|
|
60
|
+
const pending = yield* backgroundSyncPending(collectionArray);
|
|
61
|
+
const trigger = options.trigger ?? "manual";
|
|
62
|
+
const hasPending = pending.some((entry) => entry.transactions.length > 0);
|
|
63
|
+
if (!hasPending && options.flushEmpty !== true) {
|
|
64
|
+
return {
|
|
65
|
+
_tag: "Idle",
|
|
66
|
+
trigger,
|
|
67
|
+
pending,
|
|
68
|
+
results: [],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (options.adapter) {
|
|
72
|
+
const shouldFlush = yield* invokeEffectInput("Collection.backgroundSync.shouldFlush", options.adapter.shouldFlush, {
|
|
73
|
+
trigger,
|
|
74
|
+
collections: collectionArray.map((collection) => collection.name),
|
|
75
|
+
pending,
|
|
76
|
+
});
|
|
77
|
+
if (!shouldFlush) {
|
|
78
|
+
return {
|
|
79
|
+
_tag: "Deferred",
|
|
80
|
+
trigger,
|
|
81
|
+
adapter: options.adapter.name,
|
|
82
|
+
pending,
|
|
83
|
+
results: [],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const results = yield* flushCollectionsPendingMutationsEffect(collectionArray, options);
|
|
88
|
+
return {
|
|
89
|
+
_tag: "Flushed",
|
|
90
|
+
trigger,
|
|
91
|
+
...(options.adapter === undefined ? {} : { adapter: options.adapter.name }),
|
|
92
|
+
pending,
|
|
93
|
+
results,
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
//# sourceMappingURL=flush-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flush-policy.js","sourceRoot":"","sources":["../src/flush-policy.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { type EffectInputError, type EffectInputRequirements, type EffectInputCallbackError, type EffectInput, type EnsureEffectInput, type ReadableSignal } from "@sunfall/arc-core";
|
|
2
|
+
import { Effect, PubSub, Schema, Scope } from "effect";
|
|
3
|
+
import { type CollectionBackgroundSyncAdapter, type CollectionBackgroundSyncAdapterContext, type CollectionBackgroundSyncOptions, type CollectionBackgroundSyncPending, type CollectionBackgroundSyncError, type CollectionBackgroundSyncRequirements, type CollectionBackgroundSyncResult, type CollectionBackgroundSyncTrigger, type FlushCollectionPendingMutationsContext, type FlushCollectionPendingMutationsResult, type FlushCollectionPendingMutationsSkip, type FlushCollectionsPendingMutationsError, type FlushCollectionsPendingMutationsOptions, type FlushCollectionsPendingMutationsRequirements } from "./flush-policy.js";
|
|
4
|
+
import { type SQLiteMemoryStatement as SQLitePersistenceMemoryStatement, type SQLiteMemoryStatementDatabase as SQLitePersistenceMemoryStatementDatabase, type SQLitePreparedStatement as SQLitePersistencePreparedStatement, type SQLitePreparedStatementDatabase as SQLitePersistencePreparedStatementDatabase, type SQLitePreparedStatementDatabaseOptions as SQLitePersistencePreparedStatementDatabaseOptions, type SQLitePersistenceDriver, type SQLitePersistenceKey, type SQLitePersistenceOptions, type SQLitePersistenceRow, type SQLitePersistenceTable, type SQLiteStatementDatabase as SQLitePersistenceStatementDatabase, type SQLiteStatementParams as SQLitePersistenceStatementParams, type SQLiteStatementRow as SQLitePersistenceStatementRow, type SQLiteStatementValue as SQLitePersistenceStatementValue } from "./sqlite-persistence.js";
|
|
5
|
+
import { type ServerCollectionDeletePayload, type ServerCollectionInsertPayload, type ServerCollectionOperation, type ServerCollectionOptions, type ServerCollectionResult, type ServerCollectionUpdatePayload } from "./server-collection.js";
|
|
6
|
+
import { type CollectionQuerySyncAdapterOptions, type CollectionQuerySyncClient, type CollectionQuerySyncFetchOptions, type CollectionQuerySyncInvalidateOptions, type CollectionQuerySyncKey, type CollectionQuerySyncKeyPart, type CollectionQuerySyncMutationInvalidationPolicy, type CollectionChangeFeedAdapter, type CollectionChangeFeedContext, type CollectionChangeFeedSubscribeOptions, type CollectionChangeFeedSubscription, type CollectionChangeFeedUnsubscribe, type CollectionSyncAdapter, type CollectionSyncDeletePayload, type CollectionSyncInsertPayload, type CollectionSyncOptions, type CollectionResourceSyncAdapterOptions, type CollectionSyncUpdatePayload } from "./sync-adapter.js";
|
|
7
|
+
import { UnknownCollectionIndex } from "./collection-index-materialization.js";
|
|
8
|
+
import { CollectionStorageError } from "./collection-persistence.js";
|
|
9
|
+
import type { QueryEvaluationError } from "./query-plan.js";
|
|
10
|
+
import { type CollectionLiveQueryOptions } from "./live-query-collection.js";
|
|
11
|
+
import { CollectionRowKeyChanged, CollectionRowNotFound, ReadonlyCollectionMutation } from "./collection-errors.js";
|
|
12
|
+
import { type CollectionPreloadCollected, type CollectionPreloadCollector as CollectionPreloadCollectorState } from "./collection-preload.js";
|
|
13
|
+
import { CollectionSnapshotCodecError } from "./collection-snapshot-codec.js";
|
|
14
|
+
import type { CollectionChangeFeedDispatchPolicy, CollectionChangeFeedLateEmitPolicy } from "./change-feed-dispatcher.js";
|
|
15
|
+
import type { AnyCollection, CollectionChange, CollectionDefinition, CollectionDefinitionDiagnostics, CollectionDiagnostics, CollectionHydrateOptions, CollectionHydrationPayload, CollectionIndexDefinition, CollectionIndexInput, CollectionIndexRecord, CollectionIndexResult, CollectionIndexValue, CollectionKey, CollectionLoadState, CollectionMemoryStorage, CollectionMutation, CollectionMutationContext, CollectionOrigin, CollectionOptions, CollectionPendingMutation, CollectionPersistedOptions, CollectionPersistenceConfig, CollectionPersistenceStorage, CollectionPersistOptions, CollectionPolicy, CollectionRollbackRow, CollectionRow, CollectionRowSnapshot, CollectionRuntimeError, CollectionSnapshot, CollectionStorageLike, CollectionStore, CollectionStoreDiagnostics, CollectionStoreDiagnosticsSnapshot, CollectionStoreEvent, CollectionSyncDiagnostics, CollectionTransaction, CollectionUpdate, CollectionWriteOptions } from "./collection-contract.js";
|
|
16
|
+
import type { CollectionDefinitionDuplicatePolicy, CollectionDefinitionDuplicateDiagnostics, CollectionDefinitionRegistration, CollectionDefinitionRegistryAdapter, CollectionDefinitionRegistryDiagnostics, CollectionDefinitionRegistryOptions } from "./collection-registry.js";
|
|
17
|
+
type CollectionRowFromOutput<Output extends Schema.Top> = Schema.Schema.Type<Output> extends ReadonlyArray<infer A extends object> ? A : Schema.Schema.Type<Output> extends object ? Schema.Schema.Type<Output> : never;
|
|
18
|
+
type CollectionKeyFromDefinition<Definition> = Definition extends {
|
|
19
|
+
readonly getKey: (value: any) => infer K extends CollectionKey;
|
|
20
|
+
} ? K : CollectionKey;
|
|
21
|
+
type CollectionOptionalReturn<Definition, Key extends PropertyKey> = Definition extends {
|
|
22
|
+
readonly [K in Key]?: (...args: any) => infer Out;
|
|
23
|
+
} ? Out : never;
|
|
24
|
+
type CollectionPersistenceError<Definition> = Definition extends {
|
|
25
|
+
readonly persistence: {
|
|
26
|
+
readonly storage: CollectionPersistenceStorage<infer E, any>;
|
|
27
|
+
};
|
|
28
|
+
} ? E : never;
|
|
29
|
+
type CollectionPersistenceRequirements<Definition> = Definition extends {
|
|
30
|
+
readonly persistence: {
|
|
31
|
+
readonly storage: CollectionPersistenceStorage<any, infer R>;
|
|
32
|
+
};
|
|
33
|
+
} ? R : never;
|
|
34
|
+
type CollectionEffectOutputs<Definition> = CollectionOptionalReturn<Definition, "load"> | CollectionOptionalReturn<Definition, "refetch"> | CollectionOptionalReturn<Definition, "onInsert"> | CollectionOptionalReturn<Definition, "onUpdate"> | CollectionOptionalReturn<Definition, "onDelete">;
|
|
35
|
+
type CollectionErrorFromDefinition<Definition> = EffectInputError<CollectionEffectOutputs<Definition>> | CollectionPersistenceError<Definition>;
|
|
36
|
+
type CollectionRequirementsFromDefinition<Definition> = EffectInputRequirements<CollectionEffectOutputs<Definition>> | CollectionPersistenceRequirements<Definition>;
|
|
37
|
+
type RejectCollectionPromiseOutput<Out> = [Out] extends [never] ? unknown : EnsureEffectInput<Out> extends never ? never : unknown;
|
|
38
|
+
type RejectCollectionPromiseOutputs<Definition> = RejectCollectionPromiseOutput<CollectionOptionalReturn<Definition, "load">> & RejectCollectionPromiseOutput<CollectionOptionalReturn<Definition, "refetch">> & RejectCollectionPromiseOutput<CollectionOptionalReturn<Definition, "onInsert">> & RejectCollectionPromiseOutput<CollectionOptionalReturn<Definition, "onUpdate">> & RejectCollectionPromiseOutput<CollectionOptionalReturn<Definition, "onDelete">>;
|
|
39
|
+
export { UnknownCollectionIndex } from "./collection-index-materialization.js";
|
|
40
|
+
export { CollectionStoreTypeId, CollectionTypeId } from "./collection-ids.js";
|
|
41
|
+
export { CollectionRowKeyChanged, CollectionRowNotFound, ReadonlyCollectionMutation, } from "./collection-errors.js";
|
|
42
|
+
export { CollectionSnapshotCodecError } from "./collection-snapshot-codec.js";
|
|
43
|
+
export { CollectionPreloadCollector } from "./collection-preload.js";
|
|
44
|
+
export type { CollectionChangeFeedDispatchPolicy, CollectionChangeFeedLateEmitPolicy, } from "./change-feed-dispatcher.js";
|
|
45
|
+
export { defaultCollectionDefinitionRegistry, makeCollectionDefinitionRegistry, } from "./collection-registry.js";
|
|
46
|
+
export type { AnyCollection, CollectionChange, CollectionDefinition, CollectionDefinitionDiagnostics, CollectionDiagnostics, CollectionError, CollectionHydrateOptions, CollectionHydrationPayload, CollectionIndexDefinition, CollectionIndexInput, CollectionIndexRecord, CollectionIndexResult, CollectionIndexValue, CollectionKey, CollectionLoadState, CollectionMemoryStorage, CollectionMutation, CollectionMutationContext, CollectionOrigin, CollectionOptions, CollectionPendingMutation, CollectionPersistedOptions, CollectionPersistenceConfig, CollectionPersistenceStorage, CollectionPersistOptions, CollectionPolicy, CollectionRequirements, CollectionRollbackRow, CollectionRow, CollectionRowSnapshot, CollectionRowValue, CollectionRuntimeError, CollectionSnapshot, CollectionStorageLike, CollectionStore, CollectionStoreEvent, CollectionSyncDiagnostics, CollectionTransaction, CollectionUpdate, CollectionValue, CollectionWriteOptions, } from "./collection-contract.js";
|
|
47
|
+
export type { CollectionDefinitionDuplicatePolicy, CollectionDefinitionDuplicateDiagnostics, CollectionDefinitionRegistration, CollectionDefinitionRegistryAdapter, CollectionDefinitionRegistryDiagnostics, CollectionDefinitionRegistryOptions, } from "./collection-registry.js";
|
|
48
|
+
export { Query, and, eq, gt, gte, includes, lt, lte, neq, not, or } from "./query-builder.js";
|
|
49
|
+
export type { LiveQuery, LiveQueryState, QueryFactory, QueryRoot } from "./query-builder.js";
|
|
50
|
+
export type { CollectionLiveQueryOptions } from "./live-query-collection.js";
|
|
51
|
+
export type { CollectionPreloadCollected, CollectionPreloadCollector as CollectionPreloadCollectorState, } from "./collection-preload.js";
|
|
52
|
+
export { QueryEvaluationError, UnsupportedLiveQuery } from "./query-plan.js";
|
|
53
|
+
export type { QueryAggregate, QueryAggregateRecord, QueryAggregateResult, QueryEvaluationOperation, QueryGroupKey, QueryJoinKey, QueryJoinStrategy, QueryPlanDiagnostics, QueryPlanJoinDiagnostics, QueryPlanSourceDiagnostics, QuerySortDirection, QuerySortValue, } from "./query-plan.js";
|
|
54
|
+
export { persistedCollectionOptions } from "./collection-persistence.js";
|
|
55
|
+
/**
|
|
56
|
+
* Create a read-only collection from a live query.
|
|
57
|
+
*
|
|
58
|
+
* The collection materializes query results for reads, indexes, and joins.
|
|
59
|
+
* Mutation effects fail with `ReadonlyCollectionMutation`; use the source
|
|
60
|
+
* collections for writes.
|
|
61
|
+
*/
|
|
62
|
+
export declare const makeLiveQueryCollection: <A extends object, K extends CollectionKey = string, E = never, R = never>(options: CollectionLiveQueryOptions<A, K, E, R>, registry?: CollectionDefinitionRegistryAdapter) => CollectionDefinition<A, K, E | QueryEvaluationError | ReadonlyCollectionMutation, R>;
|
|
63
|
+
/** Type guard for runtime collection definitions. */
|
|
64
|
+
export declare const isCollection: (value: unknown) => value is AnyCollection;
|
|
65
|
+
/**
|
|
66
|
+
* Main collection API namespace.
|
|
67
|
+
*
|
|
68
|
+
* Prefer the `*Effect` entrypoints in application code so errors and service
|
|
69
|
+
* requirements stay typed in Effect. Non-Effect helpers either read synchronously
|
|
70
|
+
* from the current runtime store or fork work onto the current runtime.
|
|
71
|
+
*/
|
|
72
|
+
export declare namespace Collection {
|
|
73
|
+
/** Runtime definition returned by `Collection.define(...)`. */
|
|
74
|
+
type Definition<A extends object, K extends CollectionKey = string, E = never, R = never> = CollectionDefinition<A, K, E, R>;
|
|
75
|
+
/** Stored row shape with collection key metadata attached. */
|
|
76
|
+
type Row<A extends object, K extends CollectionKey = CollectionKey> = CollectionRow<A, K>;
|
|
77
|
+
/** Key values accepted by collections and row references. */
|
|
78
|
+
type Key = CollectionKey;
|
|
79
|
+
/** Origin marker for local, remote, or hydrated collection rows. */
|
|
80
|
+
type Origin = CollectionOrigin;
|
|
81
|
+
/** Reactive load state for one collection. */
|
|
82
|
+
type State<E = never> = CollectionLoadState<E>;
|
|
83
|
+
/** Runtime collection error channel including callback and storage failures. */
|
|
84
|
+
type RuntimeError<E = never> = CollectionRuntimeError<E>;
|
|
85
|
+
/** Optimistic mutation record queued for a collection. */
|
|
86
|
+
type Mutation<A extends object, K extends CollectionKey> = CollectionMutation<A, K>;
|
|
87
|
+
/** Committed mutation transaction record for diagnostics and rollback. */
|
|
88
|
+
type Transaction<A extends object, K extends CollectionKey> = CollectionTransaction<A, K>;
|
|
89
|
+
/** Context passed to collection mutation handlers. */
|
|
90
|
+
type MutationContext<A extends object, K extends CollectionKey> = CollectionMutationContext<A, K>;
|
|
91
|
+
/** Previous row snapshot retained for rollback. */
|
|
92
|
+
type RollbackRow<A extends object, K extends CollectionKey> = CollectionRollbackRow<A, K>;
|
|
93
|
+
/** Mutation waiting for its handler to flush. */
|
|
94
|
+
type PendingMutation<A extends object, K extends CollectionKey> = CollectionPendingMutation<A, K>;
|
|
95
|
+
/** Collection reload, garbage collection, and retry policy. */
|
|
96
|
+
type Policy<E = never> = CollectionPolicy<E>;
|
|
97
|
+
/** Sync adapter diagnostic facts for a collection. */
|
|
98
|
+
type SyncDiagnostics = CollectionSyncDiagnostics;
|
|
99
|
+
/** Scalar value accepted by collection secondary indexes; Dates must be valid. */
|
|
100
|
+
type IndexValue = CollectionIndexValue;
|
|
101
|
+
/** Result row stored under one secondary index key. */
|
|
102
|
+
type IndexResult = CollectionIndexResult;
|
|
103
|
+
/** Secondary index definition for collection rows. */
|
|
104
|
+
type IndexDefinition<A extends object> = CollectionIndexDefinition<A>;
|
|
105
|
+
/** User-facing secondary index configuration. */
|
|
106
|
+
type IndexInput<A extends object> = CollectionIndexInput<A>;
|
|
107
|
+
/** Map of named secondary indexes for a collection. */
|
|
108
|
+
type IndexRecord<A extends object> = CollectionIndexRecord<A>;
|
|
109
|
+
/** Runtime in-memory store shared by collection definitions. */
|
|
110
|
+
type Store = CollectionStore;
|
|
111
|
+
/** Diagnostics facade for the current collection store. */
|
|
112
|
+
type StoreDiagnostics = CollectionStoreDiagnostics;
|
|
113
|
+
/** Serializable snapshot of collection store diagnostics. */
|
|
114
|
+
type StoreDiagnosticsSnapshot = CollectionStoreDiagnosticsSnapshot;
|
|
115
|
+
/** Lifecycle event emitted by the collection store. */
|
|
116
|
+
type StoreEvent = CollectionStoreEvent;
|
|
117
|
+
/** Partial row update payload. */
|
|
118
|
+
type Update<A extends object> = CollectionUpdate<A>;
|
|
119
|
+
/** Remote or local row change event. */
|
|
120
|
+
type Change<A extends object, K extends CollectionKey = CollectionKey> = CollectionChange<A, K>;
|
|
121
|
+
/** Durable snapshot for one collection row. */
|
|
122
|
+
type RowSnapshot<A extends object, K extends CollectionKey> = CollectionRowSnapshot<A, K>;
|
|
123
|
+
/** Durable snapshot for one collection. */
|
|
124
|
+
type Snapshot<A extends object = object, K extends CollectionKey = CollectionKey> = CollectionSnapshot<A, K>;
|
|
125
|
+
/** Multi-collection hydration payload used by Start and persistence. */
|
|
126
|
+
type HydrationPayload = CollectionHydrationPayload;
|
|
127
|
+
/** Options for applying collection hydration payloads. */
|
|
128
|
+
type HydrateOptions = CollectionHydrateOptions;
|
|
129
|
+
/** Error raised when an update or delete targets a missing collection row. */
|
|
130
|
+
type RowNotFound = CollectionRowNotFound;
|
|
131
|
+
/** Error raised when an update would change the collection key for a row. */
|
|
132
|
+
type RowKeyChanged = CollectionRowKeyChanged;
|
|
133
|
+
/** Error raised when mutating a read-only live-query collection. */
|
|
134
|
+
type ReadonlyMutation = ReadonlyCollectionMutation;
|
|
135
|
+
/** Error raised when a requested secondary index does not exist. */
|
|
136
|
+
type UnknownIndex = UnknownCollectionIndex;
|
|
137
|
+
/** Error raised by built-in collection persistence storage operations. */
|
|
138
|
+
type StorageError = CollectionStorageError;
|
|
139
|
+
/** Error raised when collection snapshots fail validation or serialization. */
|
|
140
|
+
type SnapshotCodecError = CollectionSnapshotCodecError;
|
|
141
|
+
/** Error raised when an update or delete targets a missing collection row. */
|
|
142
|
+
const RowNotFound: typeof CollectionRowNotFound;
|
|
143
|
+
/** Error raised when an update would change the collection key for a row. */
|
|
144
|
+
const RowKeyChanged: typeof CollectionRowKeyChanged;
|
|
145
|
+
/** Error raised when mutating a read-only live-query collection. */
|
|
146
|
+
const ReadonlyMutation: typeof ReadonlyCollectionMutation;
|
|
147
|
+
/** Error raised when a requested secondary index does not exist. */
|
|
148
|
+
const UnknownIndex: typeof UnknownCollectionIndex;
|
|
149
|
+
/** Error raised by built-in collection persistence storage operations. */
|
|
150
|
+
const StorageError: typeof CollectionStorageError;
|
|
151
|
+
/** Error raised when collection snapshots fail validation or serialization. */
|
|
152
|
+
const SnapshotCodecError: typeof CollectionSnapshotCodecError;
|
|
153
|
+
/** Effect-aware key/value storage contract for collection persistence. */
|
|
154
|
+
type PersistenceStorage<E = never, R = never> = CollectionPersistenceStorage<E, R>;
|
|
155
|
+
/** Options for writing a collection snapshot to persistence. */
|
|
156
|
+
type PersistOptions = CollectionPersistOptions;
|
|
157
|
+
/** Persistence policy attached to a collection definition. */
|
|
158
|
+
type PersistenceConfig<E = never, R = never> = CollectionPersistenceConfig<E, R>;
|
|
159
|
+
/** Collection options with persistence error and requirement channels preserved. */
|
|
160
|
+
type PersistedOptions<A extends object, K extends CollectionKey = string, E = never, R = never, PE = never, PR = never> = CollectionPersistedOptions<A, K, E, R, PE, PR>;
|
|
161
|
+
/** Options for materializing a read-only collection from a live query. */
|
|
162
|
+
type LiveQueryOptions<A extends object, K extends CollectionKey, E = never, R = never> = CollectionLiveQueryOptions<A, K, E, R>;
|
|
163
|
+
/** Synchronous Web Storage-like shape accepted by `Collection.storage(...)`. */
|
|
164
|
+
type StorageLike = CollectionStorageLike;
|
|
165
|
+
/** In-memory persistence storage for tests, demos, and ephemeral state. */
|
|
166
|
+
type MemoryStorage = CollectionMemoryStorage;
|
|
167
|
+
/** Diagnostics for one registered collection definition. */
|
|
168
|
+
type DefinitionDiagnostics = CollectionDefinitionDiagnostics;
|
|
169
|
+
/** Registry-level diagnostics for collection definitions. */
|
|
170
|
+
type Diagnostics = CollectionDiagnostics;
|
|
171
|
+
/** Adapter that owns collection definition registration policy. */
|
|
172
|
+
type DefinitionRegistryAdapter = CollectionDefinitionRegistryAdapter;
|
|
173
|
+
/** Options for an isolated collection definition registry. */
|
|
174
|
+
type DefinitionRegistryOptions = CollectionDefinitionRegistryOptions;
|
|
175
|
+
/** Registration result for one collection definition. */
|
|
176
|
+
type DefinitionRegistration = CollectionDefinitionRegistration;
|
|
177
|
+
/** Duplicate-name policy for collection definition registration. */
|
|
178
|
+
type DefinitionDuplicatePolicy = CollectionDefinitionDuplicatePolicy;
|
|
179
|
+
/** Diagnostics for duplicate collection definition registrations. */
|
|
180
|
+
type DefinitionDuplicateDiagnostics = CollectionDefinitionDuplicateDiagnostics;
|
|
181
|
+
/** Snapshot of collection definition registry diagnostics. */
|
|
182
|
+
type DefinitionRegistryDiagnostics = CollectionDefinitionRegistryDiagnostics;
|
|
183
|
+
/** Scoped collector state used during SSR/data preload. */
|
|
184
|
+
type PreloadCollector = CollectionPreloadCollectorState;
|
|
185
|
+
/** Value plus ordered collection definitions collected during preload. */
|
|
186
|
+
type Collected<A> = CollectionPreloadCollected<A>;
|
|
187
|
+
/** Options for creating collection definitions from server operations. */
|
|
188
|
+
type ServerOptions<A extends object, K extends CollectionKey = string, E = never, R = never> = ServerCollectionOptions<A, K, E, R>;
|
|
189
|
+
/** Server operation callback accepted by server-backed collections. */
|
|
190
|
+
type ServerOperation<I, A, E = never, R = never> = ServerCollectionOperation<I, A, E, R>;
|
|
191
|
+
/** Result returned by server-backed collection operations. */
|
|
192
|
+
type ServerResult<A, E = never, R = never> = ServerCollectionResult<A, E, R>;
|
|
193
|
+
/** Insert payload sent through collection server operations. */
|
|
194
|
+
type ServerInsertPayload<A extends object, K extends CollectionKey> = ServerCollectionInsertPayload<A, K>;
|
|
195
|
+
/** Update payload sent through collection server operations. */
|
|
196
|
+
type ServerUpdatePayload<A extends object, K extends CollectionKey> = ServerCollectionUpdatePayload<A, K>;
|
|
197
|
+
/** Delete payload sent through collection server operations. */
|
|
198
|
+
type ServerDeletePayload<A extends object, K extends CollectionKey> = ServerCollectionDeletePayload<A, K>;
|
|
199
|
+
/** Sync adapter contract for loading and mutating remote collection data. */
|
|
200
|
+
type SyncAdapter<A extends object, K extends CollectionKey = string, E = never, R = never> = CollectionSyncAdapter<A, K, E, R>;
|
|
201
|
+
/** Collection options produced from a sync adapter. */
|
|
202
|
+
type SyncOptions<A extends object, K extends CollectionKey = string, E = never, R = never> = CollectionSyncOptions<A, K, E, R>;
|
|
203
|
+
/** Options for adapting a Core Resource into a collection sync adapter. */
|
|
204
|
+
type ResourceSyncAdapterOptions<I, A extends object, K extends CollectionKey = string, E = never, R = never> = CollectionResourceSyncAdapterOptions<I, A, K, E, R>;
|
|
205
|
+
/** Stable cache key used by query-sync adapters. */
|
|
206
|
+
type QuerySyncKey = CollectionQuerySyncKey;
|
|
207
|
+
/** One structured segment inside a query-sync cache key. */
|
|
208
|
+
type QuerySyncKeyPart = CollectionQuerySyncKeyPart;
|
|
209
|
+
/** Options passed when a query-sync adapter fetches rows. */
|
|
210
|
+
type QuerySyncFetchOptions<A extends object, E = never, R = never> = CollectionQuerySyncFetchOptions<A, E, R>;
|
|
211
|
+
/** Options for invalidating query-sync client cache entries. */
|
|
212
|
+
type QuerySyncInvalidateOptions = CollectionQuerySyncInvalidateOptions;
|
|
213
|
+
/** Query-client bridge used by query-sync adapters. */
|
|
214
|
+
type QuerySyncClient<A extends object, E = never, R = never> = CollectionQuerySyncClient<A, E, R>;
|
|
215
|
+
/** Options for adapting a query client into a collection sync adapter. */
|
|
216
|
+
type QuerySyncAdapterOptions<A extends object, K extends CollectionKey = string, E = never, R = never> = CollectionQuerySyncAdapterOptions<A, K, E, R>;
|
|
217
|
+
/** Policy for invalidating query-sync caches after mutations. */
|
|
218
|
+
type QuerySyncMutationInvalidationPolicy = CollectionQuerySyncMutationInvalidationPolicy;
|
|
219
|
+
/** Cleanup callback returned by collection change feeds. */
|
|
220
|
+
type ChangeFeedUnsubscribe<E = never, R = never> = CollectionChangeFeedUnsubscribe<E, R>;
|
|
221
|
+
/** Active remote change-feed subscription. */
|
|
222
|
+
type ChangeFeedSubscription<E = never, R = never> = CollectionChangeFeedSubscription<E, R>;
|
|
223
|
+
/** Context passed to change-feed adapters. */
|
|
224
|
+
type ChangeFeedContext<A extends object, K extends CollectionKey = string, E = never, R = never> = CollectionChangeFeedContext<A, K, E, R>;
|
|
225
|
+
/** Remote change-feed adapter that emits collection changes. */
|
|
226
|
+
type ChangeFeedAdapter<A extends object, K extends CollectionKey = string, E = never, R = never, CollectionError = never, CollectionRequirements = never> = CollectionChangeFeedAdapter<A, K, E, R, CollectionError, CollectionRequirements>;
|
|
227
|
+
/** Options for subscribing a collection to a change feed. */
|
|
228
|
+
type ChangeFeedSubscribeOptions = CollectionChangeFeedSubscribeOptions;
|
|
229
|
+
/** Dispatch behavior for incoming change-feed events. */
|
|
230
|
+
type ChangeFeedDispatchPolicy = CollectionChangeFeedDispatchPolicy;
|
|
231
|
+
/** Policy for handling change-feed emissions after unsubscribe. */
|
|
232
|
+
type ChangeFeedLateEmitPolicy = CollectionChangeFeedLateEmitPolicy;
|
|
233
|
+
/** Insert change emitted by sync/change-feed protocols. */
|
|
234
|
+
type SyncInsertPayload<A extends object, K extends CollectionKey> = CollectionSyncInsertPayload<A, K>;
|
|
235
|
+
/** Update change emitted by sync/change-feed protocols. */
|
|
236
|
+
type SyncUpdatePayload<A extends object, K extends CollectionKey> = CollectionSyncUpdatePayload<A, K>;
|
|
237
|
+
/** Delete change emitted by sync/change-feed protocols. */
|
|
238
|
+
type SyncDeletePayload<A extends object, K extends CollectionKey> = CollectionSyncDeletePayload<A, K>;
|
|
239
|
+
/** Context passed when flushing pending mutations across collections. */
|
|
240
|
+
type FlushAllPendingMutationsContext = FlushCollectionPendingMutationsContext;
|
|
241
|
+
/** Predicate for skipping a background flush attempt. */
|
|
242
|
+
type FlushAllPendingMutationsSkip<SkipError = never, SkipRequirements = never> = FlushCollectionPendingMutationsSkip<SkipError, SkipRequirements>;
|
|
243
|
+
/** Options for flushing pending mutations across collections. */
|
|
244
|
+
type FlushAllPendingMutationsOptions<SkipError = never, SkipRequirements = never> = FlushCollectionsPendingMutationsOptions<SkipError, SkipRequirements>;
|
|
245
|
+
/** Error channel for flushing pending mutations across collections. */
|
|
246
|
+
type FlushAllPendingMutationsError<Collections extends Iterable<AnyCollection>, SkipError = never> = FlushCollectionsPendingMutationsError<Collections, SkipError>;
|
|
247
|
+
/** Requirement channel for flushing pending mutations across collections. */
|
|
248
|
+
type FlushAllPendingMutationsRequirements<Collections extends Iterable<AnyCollection>, SkipRequirements = never> = FlushCollectionsPendingMutationsRequirements<Collections, SkipRequirements>;
|
|
249
|
+
/** Result of flushing pending mutations across collections. */
|
|
250
|
+
type FlushAllPendingMutationsResult = FlushCollectionPendingMutationsResult;
|
|
251
|
+
/** Event that triggered a collection background sync attempt. */
|
|
252
|
+
type BackgroundSyncTrigger = CollectionBackgroundSyncTrigger;
|
|
253
|
+
/** Pending-mutation facts passed to background sync logic. */
|
|
254
|
+
type BackgroundSyncPending = CollectionBackgroundSyncPending;
|
|
255
|
+
/** Context passed to background sync adapters. */
|
|
256
|
+
type BackgroundSyncAdapterContext = CollectionBackgroundSyncAdapterContext;
|
|
257
|
+
/** Adapter that performs background sync for pending mutations. */
|
|
258
|
+
type BackgroundSyncAdapter<AdapterError = never, AdapterRequirements = never> = CollectionBackgroundSyncAdapter<AdapterError, AdapterRequirements>;
|
|
259
|
+
/** Background sync policy and adapter options. */
|
|
260
|
+
type BackgroundSyncOptions<AdapterError = never, AdapterRequirements = never, SkipError = never, SkipRequirements = never> = CollectionBackgroundSyncOptions<AdapterError, AdapterRequirements, SkipError, SkipRequirements>;
|
|
261
|
+
/** Error channel for background sync pending-mutation evaluation. */
|
|
262
|
+
type BackgroundSyncError<Collections extends Iterable<AnyCollection>, AdapterError = never, SkipError = never> = CollectionBackgroundSyncError<Collections, AdapterError, SkipError>;
|
|
263
|
+
/** Requirement channel for background sync pending-mutation evaluation. */
|
|
264
|
+
type BackgroundSyncRequirements<Collections extends Iterable<AnyCollection>, AdapterRequirements = never, SkipRequirements = never> = CollectionBackgroundSyncRequirements<Collections, AdapterRequirements, SkipRequirements>;
|
|
265
|
+
/** Result returned by background sync attempts. */
|
|
266
|
+
type BackgroundSyncResult = CollectionBackgroundSyncResult;
|
|
267
|
+
/** SQLite persistence storage key shape. */
|
|
268
|
+
type SQLiteStorageKey = SQLitePersistenceKey;
|
|
269
|
+
/** SQLite persistence storage row shape. */
|
|
270
|
+
type SQLiteStorageRow = SQLitePersistenceRow;
|
|
271
|
+
/** SQL table adapter used by SQLite persistence. */
|
|
272
|
+
type SQLiteStorageTable<E = never, R = never> = SQLitePersistenceTable<E, R>;
|
|
273
|
+
/** Driver abstraction used by SQLite persistence storage. */
|
|
274
|
+
type SQLiteStorageDriver<E = never, R = never> = SQLitePersistenceDriver<E, R>;
|
|
275
|
+
/** Options for SQLite persistence storage. */
|
|
276
|
+
type SQLiteStorageOptions = SQLitePersistenceOptions;
|
|
277
|
+
/** In-memory SQL statement handle. */
|
|
278
|
+
type SQLiteMemoryStatement = SQLitePersistenceMemoryStatement;
|
|
279
|
+
/** In-memory SQL statement database. */
|
|
280
|
+
type SQLiteMemoryStatementDatabase = SQLitePersistenceMemoryStatementDatabase;
|
|
281
|
+
/** Scalar value accepted by SQLite statement parameters and rows. */
|
|
282
|
+
type SQLiteStatementValue = SQLitePersistenceStatementValue;
|
|
283
|
+
/** Positional SQLite statement parameters. */
|
|
284
|
+
type SQLiteStatementParams = SQLitePersistenceStatementParams;
|
|
285
|
+
/** Row returned by a SQLite statement. */
|
|
286
|
+
type SQLiteStatementRow = SQLitePersistenceStatementRow;
|
|
287
|
+
/** Minimal SQL statement database accepted by the persistence adapter. */
|
|
288
|
+
type SQLiteStatementDatabase<E = never, R = never> = SQLitePersistenceStatementDatabase<E, R>;
|
|
289
|
+
/** Prepared SQLite statement returned by adapted databases. */
|
|
290
|
+
type SQLitePreparedStatement<Row extends SQLiteStatementRow = SQLiteStatementRow, E = never, R = never> = SQLitePersistencePreparedStatement<Row, E, R>;
|
|
291
|
+
/** Prepared-statement database adapter for SQLite persistence. */
|
|
292
|
+
type SQLitePreparedStatementDatabase<Row extends SQLiteStatementRow = SQLiteStatementRow, E = never, R = never> = SQLitePersistencePreparedStatementDatabase<Row, E, R>;
|
|
293
|
+
/** Options for adapting prepare/run/all style SQLite clients. */
|
|
294
|
+
type SQLitePreparedStatementDatabaseOptions = SQLitePersistencePreparedStatementDatabaseOptions;
|
|
295
|
+
/** Build `Collection.define` options from server functions or Effect callbacks. */
|
|
296
|
+
const serverOptions: <A extends object, K extends CollectionKey = string, E = never, R = never>(options: ServerCollectionOptions<A, K, E, R>) => CollectionOptions<A, K, E | EffectInputCallbackError | import("@sunfall/arc-core").ServerClientError, R>;
|
|
297
|
+
/** Build a sync adapter from server functions or Effect callbacks. */
|
|
298
|
+
const serverSyncAdapter: <A extends object, K extends CollectionKey = string, E = never, R = never>(options: ServerCollectionOptions<A, K, E, R>) => CollectionSyncAdapter<A, K, E | EffectInputCallbackError | import("@sunfall/arc-core").ServerClientError, R>;
|
|
299
|
+
/** Adapt an `@sunfall/arc-core` Resource ref into a collection sync adapter. */
|
|
300
|
+
const resourceSyncAdapter: <I, A extends object, K extends CollectionKey = string, E = never, R = never>(options: CollectionResourceSyncAdapterOptions<I, A, K, E, R>) => CollectionSyncAdapter<A, K, import("@sunfall/arc-core").Resource.LoadError<E>, R>;
|
|
301
|
+
/** Adapt a query client style cache into a collection sync adapter. */
|
|
302
|
+
const querySyncAdapter: <A extends object, K extends CollectionKey = string, E = never, R = never>(options: CollectionQuerySyncAdapterOptions<A, K, E, R>) => CollectionSyncAdapter<A, K, E | EffectInputCallbackError, R>;
|
|
303
|
+
/** Convert a sync adapter into `Collection.define` options. */
|
|
304
|
+
const syncOptions: <A extends object, K extends CollectionKey = string, E = never, R = never>(options: CollectionSyncOptions<A, K, E, R>) => CollectionOptions<A, K, E | EffectInputCallbackError, R>;
|
|
305
|
+
/** Attach persistence while preserving storage error and requirement types. */
|
|
306
|
+
const persistedOptions: <A extends object, K extends CollectionKey = string, E = never, R = never, PE = never, PR = never>(options: CollectionPersistedOptions<A, K, E, R, PE, PR>) => CollectionOptions<A, K, E | PE, R | PR>;
|
|
307
|
+
/** Create a read-only collection from a live query result. */
|
|
308
|
+
const liveQuery: <A extends object, K extends CollectionKey = string, E = never, R = never>(options: CollectionLiveQueryOptions<A, K, E, R>, registry?: CollectionDefinitionRegistryAdapter) => CollectionDefinition<A, K, E | QueryEvaluationError | ReadonlyCollectionMutation, R>;
|
|
309
|
+
/** Build an isolated collection definition registry adapter. */
|
|
310
|
+
const makeRegistry: (options?: CollectionDefinitionRegistryOptions) => CollectionDefinitionRegistryAdapter;
|
|
311
|
+
/** Process-wide collection definition registry adapter used by default. */
|
|
312
|
+
const defaultRegistry: CollectionDefinitionRegistryAdapter;
|
|
313
|
+
/** Flush queued optimistic mutations across many collections. */
|
|
314
|
+
const flushAllPendingMutationsEffect: <const Collections extends Iterable<AnyCollection>, SkipError = never, SkipRequirements = never>(collections: Collections, options?: FlushCollectionsPendingMutationsOptions<SkipError, SkipRequirements>) => Effect.Effect<ReadonlyArray<FlushCollectionPendingMutationsResult>, FlushCollectionsPendingMutationsError<Collections, SkipError>, FlushCollectionsPendingMutationsRequirements<Collections, SkipRequirements>>;
|
|
315
|
+
/** Decide whether to flush pending mutations for background sync triggers. */
|
|
316
|
+
const backgroundSyncPendingMutationsEffect: <const Collections extends Iterable<AnyCollection>, AdapterError = never, AdapterRequirements = never, SkipError = never, SkipRequirements = never>(collections: Collections, options?: CollectionBackgroundSyncOptions<AdapterError, AdapterRequirements, SkipError, SkipRequirements>) => Effect.Effect<CollectionBackgroundSyncResult, CollectionBackgroundSyncError<Collections, AdapterError, SkipError>, CollectionBackgroundSyncRequirements<Collections, AdapterRequirements, SkipRequirements>>;
|
|
317
|
+
/** Build collection persistence storage from a SQLite persistence driver. */
|
|
318
|
+
const sqliteStorage: <E = never, R = never>(driver: SQLitePersistenceDriver<E, R>, options?: SQLitePersistenceOptions) => CollectionPersistenceStorage<E | EffectInputCallbackError | import("./sqlite-persistence.js").SQLitePersistenceInvalidRow | import("./sqlite-persistence.js").SQLitePersistenceInvalidTableName, R>;
|
|
319
|
+
/** Adapt prepare/run/all style SQLite clients to statement database storage. */
|
|
320
|
+
const sqlitePreparedStatementDatabase: <Row extends SQLitePersistenceStatementRow = SQLitePersistenceStatementRow, E = never, R = never>(database: SQLitePersistencePreparedStatementDatabase<Row, E, R>, options?: SQLitePersistencePreparedStatementDatabaseOptions) => SQLitePersistenceStatementDatabase<E | EffectInputCallbackError, R>;
|
|
321
|
+
/** Build a persistence driver from a simple SQL statement database. */
|
|
322
|
+
const sqliteStatementDriver: <E = never, R = never>(database: SQLitePersistenceStatementDatabase<E, R>) => SQLitePersistenceDriver<E | EffectInputCallbackError | import("./sqlite-persistence.js").SQLitePersistenceInvalidRow, R>;
|
|
323
|
+
/** In-memory SQL statement database for tests and demos. */
|
|
324
|
+
const sqliteMemoryStatementDatabase: () => SQLitePersistenceMemoryStatementDatabase;
|
|
325
|
+
/**
|
|
326
|
+
* Define a local-first collection.
|
|
327
|
+
*
|
|
328
|
+
* Reads are synchronous from an in-memory store. Loads, mutation handlers, and
|
|
329
|
+
* persistence run through Effect so failures stay in `E` and services stay in
|
|
330
|
+
* `R`.
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* const todos = Collection.define({
|
|
334
|
+
* name: "todos",
|
|
335
|
+
* getKey: (todo) => todo.id,
|
|
336
|
+
* load: () => Effect.tryPromise(() => TodoApi.list()),
|
|
337
|
+
* onInsert: (values) => Effect.tryPromise(() => TodoApi.createMany(values))
|
|
338
|
+
* })
|
|
339
|
+
*/
|
|
340
|
+
function define<const Output extends Schema.Top, const Definition extends Omit<CollectionOptions<CollectionRowFromOutput<Output>, CollectionKey, any, any>, "output"> & {
|
|
341
|
+
readonly output: Output;
|
|
342
|
+
}>(options: Definition & RejectCollectionPromiseOutputs<Definition>, registry?: CollectionDefinitionRegistryAdapter): CollectionDefinition<CollectionRowFromOutput<Output>, CollectionKeyFromDefinition<Definition>, CollectionErrorFromDefinition<Definition>, CollectionRequirementsFromDefinition<Definition>>;
|
|
343
|
+
function define<A extends object, K extends CollectionKey = string, E = never, R = never>(options: Omit<CollectionOptions<A, K, E, R>, "load"> & {
|
|
344
|
+
readonly load?: () => EffectInput<ReadonlyArray<A>, E, R>;
|
|
345
|
+
}, registry?: CollectionDefinitionRegistryAdapter): CollectionDefinition<A, K, E, R>;
|
|
346
|
+
/** Return the process-wide registry of named collection definitions. */
|
|
347
|
+
const definitions: () => ReadonlyMap<string, AnyCollection>;
|
|
348
|
+
/** Type guard for values that are full Collection definitions. */
|
|
349
|
+
const isCollection: (value: unknown) => value is AnyCollection;
|
|
350
|
+
/** Describe registered collections, indexes, handlers, sync, and persistence. */
|
|
351
|
+
const diagnostics: () => CollectionDiagnostics;
|
|
352
|
+
/** Describe the process-wide registry, including duplicate registrations. */
|
|
353
|
+
const registryDiagnostics: () => CollectionDefinitionRegistryDiagnostics;
|
|
354
|
+
/** Reactive load state signal for a collection. */
|
|
355
|
+
const state: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>) => ReadableSignal<CollectionLoadState<CollectionRuntimeError<E>>>;
|
|
356
|
+
/** Reactive version signal that changes when rows or pending mutations change. */
|
|
357
|
+
const version: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>) => ReadableSignal<number>;
|
|
358
|
+
/** Read one row by key from current in-memory state. */
|
|
359
|
+
const get: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>, key: K) => CollectionRow<A, K> | undefined;
|
|
360
|
+
/** Read all current rows, including local optimistic rows. */
|
|
361
|
+
const rows: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>) => ReadonlyArray<CollectionRow<A, K>>;
|
|
362
|
+
/** Read rows from a named secondary index bucket. */
|
|
363
|
+
const index: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>, index: string, value: CollectionIndexValue) => ReadonlyArray<CollectionRow<A, K>>;
|
|
364
|
+
/** Read the first row from a named secondary index bucket. */
|
|
365
|
+
const firstByIndex: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>, index: string, value: CollectionIndexValue) => CollectionRow<A, K> | undefined;
|
|
366
|
+
/**
|
|
367
|
+
* Ensure a collection has loaded once.
|
|
368
|
+
*
|
|
369
|
+
* Restores configured persistence first, then skips `load` when data is
|
|
370
|
+
* already ready. Errors and requirements come from the collection definition.
|
|
371
|
+
*/
|
|
372
|
+
const preloadEffect: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>) => Effect.Effect<void, CollectionRuntimeError<E>, R>;
|
|
373
|
+
/**
|
|
374
|
+
* Force a fresh load for a collection.
|
|
375
|
+
*/
|
|
376
|
+
const refetchEffect: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>) => Effect.Effect<void, CollectionRuntimeError<E>, R>;
|
|
377
|
+
/**
|
|
378
|
+
* Run an Effect and collect any collections it preloads.
|
|
379
|
+
*
|
|
380
|
+
* Useful for SSR or route loaders that need data plus a hydration payload.
|
|
381
|
+
* The returned definitions are ordered preload facts. Nested collection
|
|
382
|
+
* collectors propagate their facts to the parent collector; dehydration
|
|
383
|
+
* dedupes identical definitions and rejects distinct same-name definitions.
|
|
384
|
+
*/
|
|
385
|
+
const collectEffect: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<CollectionPreloadCollected<A>, E, R>;
|
|
386
|
+
/** Return queued optimistic mutations waiting for handlers to commit. */
|
|
387
|
+
const pendingMutationsEffect: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>) => Effect.Effect<ReadonlyArray<CollectionPendingMutation<A, K>>>;
|
|
388
|
+
/** Synchronously read queued optimistic mutations from the current runtime store. */
|
|
389
|
+
const pendingMutations: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>) => ReadonlyArray<CollectionPendingMutation<A, K>>;
|
|
390
|
+
/** Retry all queued mutation handlers for one collection. */
|
|
391
|
+
const flushPendingMutationsEffect: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>) => Effect.Effect<ReadonlyArray<CollectionTransaction<A, K>>, CollectionRuntimeError<E>, R>;
|
|
392
|
+
/** Capture a durable serializable snapshot with an Effect-provided timestamp. */
|
|
393
|
+
const snapshotEffect: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>) => Effect.Effect<CollectionSnapshot<A, K>, CollectionSnapshotCodecError | EffectInputCallbackError>;
|
|
394
|
+
/** Synchronous inspection snapshot; durable workflows should use `snapshotEffect`. */
|
|
395
|
+
const snapshot: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>) => CollectionSnapshot<A, K>;
|
|
396
|
+
/**
|
|
397
|
+
* Restore one collection from a snapshot.
|
|
398
|
+
*
|
|
399
|
+
* By default hydration replaces existing rows and pending mutations. Pass
|
|
400
|
+
* `{ replace: false }` to merge into current state.
|
|
401
|
+
*/
|
|
402
|
+
const hydrateEffect: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>, value: CollectionSnapshot<A, K>, options?: CollectionHydrateOptions) => Effect.Effect<void, CollectionSnapshotCodecError | EffectInputCallbackError>;
|
|
403
|
+
/** Fork `hydrateEffect` on the current runtime. */
|
|
404
|
+
const hydrate: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>, value: CollectionSnapshot<A, K>, options?: CollectionHydrateOptions) => void;
|
|
405
|
+
/** Snapshot several collections synchronously for UI inspection. */
|
|
406
|
+
const dehydrate: (collections: Iterable<AnyCollection>) => CollectionHydrationPayload;
|
|
407
|
+
/** Snapshot several collections durably with an Effect-provided timestamp. */
|
|
408
|
+
const dehydrateEffect: (collections: Iterable<AnyCollection>) => Effect.Effect<CollectionHydrationPayload, CollectionSnapshotCodecError | EffectInputCallbackError>;
|
|
409
|
+
/** Hydrate matching collections from a multi-collection payload. */
|
|
410
|
+
const hydratePayloadEffect: (collections: Iterable<AnyCollection>, payload: CollectionHydrationPayload, options?: CollectionHydrateOptions) => Effect.Effect<void, CollectionSnapshotCodecError | EffectInputCallbackError>;
|
|
411
|
+
/** Validate a multi-collection hydration payload without applying it. */
|
|
412
|
+
const validateHydrationPayloadEffect: (collections: Iterable<AnyCollection>, payload: CollectionHydrationPayload, options?: CollectionHydrateOptions) => Effect.Effect<void, CollectionSnapshotCodecError | EffectInputCallbackError>;
|
|
413
|
+
/** Fork `hydratePayloadEffect` on the current runtime. */
|
|
414
|
+
const hydratePayload: (collections: Iterable<AnyCollection>, payload: CollectionHydrationPayload, options?: CollectionHydrateOptions) => void;
|
|
415
|
+
/**
|
|
416
|
+
* Apply remote change-feed events without queuing local mutation handlers.
|
|
417
|
+
*/
|
|
418
|
+
const applyChangesEffect: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>, changes: ReadonlyArray<CollectionChange<A, K>>, options?: CollectionWriteOptions) => Effect.Effect<void, CollectionRuntimeError<E>, R>;
|
|
419
|
+
/** Fork `applyChangesEffect` on the current runtime. */
|
|
420
|
+
const applyChanges: <A extends object, K extends CollectionKey, E, R>(definition: CollectionDefinition<A, K, E, R>, changes: ReadonlyArray<CollectionChange<A, K>>, options?: CollectionWriteOptions) => void;
|
|
421
|
+
/**
|
|
422
|
+
* Subscribe a collection to a scoped remote change feed.
|
|
423
|
+
*
|
|
424
|
+
* Requires `Scope.Scope`; feed errors/requirements are unioned with the
|
|
425
|
+
* collection channels.
|
|
426
|
+
*/
|
|
427
|
+
const subscribeChangesEffect: <A extends object, K extends CollectionKey, E, R, FeedError = never, FeedRequirements = never>(definition: CollectionDefinition<A, K, E, R>, adapter: CollectionChangeFeedAdapter<A, K, FeedError, FeedRequirements, E, R>, options?: CollectionChangeFeedSubscribeOptions) => Effect.Effect<void, CollectionRuntimeError<E> | FeedError, R | FeedRequirements | Scope.Scope>;
|
|
428
|
+
/**
|
|
429
|
+
* Persist one collection snapshot to storage.
|
|
430
|
+
*
|
|
431
|
+
* The storage backend controls the Effect error and requirement channels.
|
|
432
|
+
*/
|
|
433
|
+
const persistEffect: <A extends object, K extends CollectionKey, E, R, PE = never, PR = never>(definition: CollectionDefinition<A, K, E, R>, storage: CollectionPersistenceStorage<PE, PR>, options?: CollectionPersistOptions) => Effect.Effect<void, PE | CollectionSnapshotCodecError | EffectInputCallbackError, PR>;
|
|
434
|
+
/**
|
|
435
|
+
* Restore one collection snapshot from storage if present.
|
|
436
|
+
*/
|
|
437
|
+
const restoreEffect: <A extends object, K extends CollectionKey, E, R, PE = never, PR = never>(definition: CollectionDefinition<A, K, E, R>, storage: CollectionPersistenceStorage<PE, PR>, options?: CollectionPersistOptions & CollectionHydrateOptions) => Effect.Effect<void, PE | CollectionSnapshotCodecError | EffectInputCallbackError, PR>;
|
|
438
|
+
/** Create in-memory persistence storage for tests, demos, or ephemeral data. */
|
|
439
|
+
const memoryStorage: (initial?: Iterable<readonly [string, string]>) => CollectionMemoryStorage;
|
|
440
|
+
/** Adapt synchronous Web Storage style APIs to Effect-aware persistence storage. */
|
|
441
|
+
const storage: (storage: CollectionStorageLike) => CollectionPersistenceStorage<CollectionStorageError, never>;
|
|
442
|
+
/** Access the current runtime collection store as an Effect. */
|
|
443
|
+
const storeEffect: () => Effect.Effect<CollectionStore>;
|
|
444
|
+
/** Access the current runtime collection store synchronously. */
|
|
445
|
+
const currentStore: () => CollectionStore;
|
|
446
|
+
/** Subscribe to collection lifecycle events inside a Scope. */
|
|
447
|
+
const subscribeEventsEffect: () => Effect.Effect<PubSub.Subscription<CollectionStoreEvent>, never, Scope.Scope>;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Compatibility alias for `Collection.define(...)`.
|
|
451
|
+
*
|
|
452
|
+
* Prefer `Collection.define(...)` in new code so DB APIs stay grouped under
|
|
453
|
+
* their owning namespace in LSP hovers and generated docs.
|
|
454
|
+
*
|
|
455
|
+
* @deprecated Use `Collection.define(...)`.
|
|
456
|
+
*/
|
|
457
|
+
export declare const createCollection: typeof Collection.define;
|
|
458
|
+
/**
|
|
459
|
+
* Compatibility alias for `Query.live(...)`.
|
|
460
|
+
*
|
|
461
|
+
* Prefer `Query.live(...)` in new code so query APIs stay grouped under their
|
|
462
|
+
* owning namespace in LSP hovers and generated docs.
|
|
463
|
+
*
|
|
464
|
+
* @deprecated Use `Query.live(...)`.
|
|
465
|
+
*/
|
|
466
|
+
export declare const createLiveQuery: <T, E = never, R = never>(factory: import("./query-builder.js").QueryFactory<T, E, R>) => import("./query-builder.js").LiveQuery<T, E, R>;
|
|
467
|
+
/**
|
|
468
|
+
* Compatibility alias for `Collection.liveQuery(...)`.
|
|
469
|
+
*
|
|
470
|
+
* Prefer `Collection.liveQuery(...)` in new code so live-query collection APIs
|
|
471
|
+
* stay grouped under their owning namespace in LSP hovers and generated docs.
|
|
472
|
+
*
|
|
473
|
+
* @deprecated Use `Collection.liveQuery(...)`.
|
|
474
|
+
*/
|
|
475
|
+
export declare const createLiveQueryCollection: <A extends object, K extends CollectionKey = string, E = never, R = never>(options: CollectionLiveQueryOptions<A, K, E, R>, registry?: CollectionDefinitionRegistryAdapter) => CollectionDefinition<A, K, E | QueryEvaluationError | ReadonlyCollectionMutation, R>;
|
|
476
|
+
export * from "./flush-policy.js";
|
|
477
|
+
export * from "./server-collection.js";
|
|
478
|
+
export * from "./collection-reactive-binding.js";
|
|
479
|
+
export { CollectionStorageError } from "./collection-persistence.js";
|
|
480
|
+
export * from "./sqlite-persistence.js";
|
|
481
|
+
//# sourceMappingURL=index.d.ts.map
|