doxum 0.1.35 → 0.1.37
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/README.md +7 -0
- package/dist/advanced.cjs +0 -2
- package/dist/advanced.d.cts +1 -2
- package/dist/advanced.d.ts +1 -2
- package/dist/advanced.js +0 -2
- package/dist/contract-CNR6BS75.d.cts +1 -2
- package/dist/contract-COgxO5sv.d.ts +1 -2
- package/dist/dependency-Cbf3C8eJ.d.cts +1 -2
- package/dist/dependency-DzxXGYe1.d.ts +1 -2
- package/dist/driver-B7RR-VfX.js +0 -2
- package/dist/driver-CN3dGxQI.cjs +0 -2
- package/dist/index.cjs +0 -2
- package/dist/index.d.cts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +0 -2
- package/dist/local-sync.cjs +0 -2
- package/dist/local-sync.d.cts +1 -2
- package/dist/local-sync.d.ts +1 -2
- package/dist/local-sync.js +0 -2
- package/dist/react.cjs +0 -2
- package/dist/react.d.cts +1 -2
- package/dist/react.d.ts +1 -2
- package/dist/react.js +0 -2
- package/dist/record-B2yRhYsc.js +0 -2
- package/dist/record-ChYUi8PP.cjs +0 -2
- package/dist/transform-3mj0eStL.js +0 -2
- package/dist/transform-D45KWMzj.cjs +0 -2
- package/package.json +8 -3
- package/skills/doxum-runtime/references/projections.md +2 -0
- package/skills/doxum-runtime/references/public-api.md +1 -0
- package/dist/advanced.cjs.map +0 -1
- package/dist/advanced.js.map +0 -1
- package/dist/driver-B7RR-VfX.js.map +0 -1
- package/dist/driver-CN3dGxQI.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/local-sync.cjs.map +0 -1
- package/dist/local-sync.js.map +0 -1
- package/dist/react.cjs.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/record-B2yRhYsc.js.map +0 -1
- package/dist/record-ChYUi8PP.cjs.map +0 -1
- package/dist/transform-3mj0eStL.js.map +0 -1
- package/dist/transform-D45KWMzj.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -666,6 +666,13 @@ round trips and repeated tree edits to expose costs hidden by commit-only benchm
|
|
|
666
666
|
Builds produce root `dist` ESM/CJS/declarations for `doxum`,
|
|
667
667
|
`doxum/local-sync`, `doxum/react` and `doxum/advanced`. Source ownership is described in
|
|
668
668
|
[architecture](docs/architecture.md) and [AGENTS.md](AGENTS.md).
|
|
669
|
+
Release builds keep JavaScript readable and omit source maps. Use `pnpm run build:debug`
|
|
670
|
+
to generate a separate `.debug/dist` build with embedded-source maps for source-level
|
|
671
|
+
debugging; it does not replace `dist` and is excluded from publication. Published
|
|
672
|
+
packages include both module formats, their declarations and the runtime skill.
|
|
673
|
+
`pnpm run check:package` inspects the actual npm file list, checks required artifacts
|
|
674
|
+
and reports packed/unpacked sizes. It runs as part of `build`, including releases,
|
|
675
|
+
and rejects accidental debug artifacts or dangling source-map references.
|
|
669
676
|
The runtime shares one transaction lifecycle; complete mutation operations are
|
|
670
677
|
organized by domain under `core/src/mutation/operations`, with access, first-touch
|
|
671
678
|
recording and publication retaining their own responsibilities.
|
package/dist/advanced.cjs
CHANGED
package/dist/advanced.d.cts
CHANGED
|
@@ -118,5 +118,4 @@ declare const incremental: typeof createIncrementalValue & {
|
|
|
118
118
|
group: typeof createIncrementalGroup;
|
|
119
119
|
};
|
|
120
120
|
//#endregion
|
|
121
|
-
export { type CollectionChange, IncrementalCollectionContext, IncrementalCollectionDefinition, IncrementalGroupContext, IncrementalGroupOutput, IncrementalGroupResult, IncrementalKeyedContext, IncrementalKeyedDefinition, IncrementalValueContext, IncrementalValueDefinition, collectionChange, incremental };
|
|
122
|
-
//# sourceMappingURL=advanced.d.cts.map
|
|
121
|
+
export { type CollectionChange, IncrementalCollectionContext, IncrementalCollectionDefinition, IncrementalGroupContext, IncrementalGroupOutput, IncrementalGroupResult, IncrementalKeyedContext, IncrementalKeyedDefinition, IncrementalValueContext, IncrementalValueDefinition, collectionChange, incremental };
|
package/dist/advanced.d.ts
CHANGED
|
@@ -118,5 +118,4 @@ declare const incremental: typeof createIncrementalValue & {
|
|
|
118
118
|
group: typeof createIncrementalGroup;
|
|
119
119
|
};
|
|
120
120
|
//#endregion
|
|
121
|
-
export { type CollectionChange, IncrementalCollectionContext, IncrementalCollectionDefinition, IncrementalGroupContext, IncrementalGroupOutput, IncrementalGroupResult, IncrementalKeyedContext, IncrementalKeyedDefinition, IncrementalValueContext, IncrementalValueDefinition, collectionChange, incremental };
|
|
122
|
-
//# sourceMappingURL=advanced.d.ts.map
|
|
121
|
+
export { type CollectionChange, IncrementalCollectionContext, IncrementalCollectionDefinition, IncrementalGroupContext, IncrementalGroupOutput, IncrementalGroupResult, IncrementalKeyedContext, IncrementalKeyedDefinition, IncrementalValueContext, IncrementalValueDefinition, collectionChange, incremental };
|
package/dist/advanced.js
CHANGED
|
@@ -617,5 +617,4 @@ type DocumentRuntime<S extends ObjectSchema<object>> = ReadonlyDocument<S> & {
|
|
|
617
617
|
dispose(): void;
|
|
618
618
|
};
|
|
619
619
|
//#endregion
|
|
620
|
-
export { table as $, ParseError as A, DocumentListConfig as B, Read as C, ChangeSet as D, Change as E, CollectionPath as F, ReadonlyValue as G, DocumentTreeValue as H, PathValueOf as I, field as J, Schema as K, SchemaPath as L, parse as M, CollectionEntry as N, MemberChange as O, CollectionId as P, optional as Q, DocumentAddress as R, Draft as S, snapshot as T, Infer as U, DocumentTreeNode as V, ObjectSchema as W, map as X, list as Y, object as Z, Unsubscribe as _, DocumentProblem as a, CollectionImpact as b, HistoryState as c, OperationResult as d, tree as et, ReadonlyDocument as f, Readable as g, TransactionResult as h, DocumentDisposedError as i, ParseIssue as j, ValueTransition as k, LocalHistory as l, TransactionRejected as m, DocumentCommit as n, DocumentReentrancyError as o, Synchronous as p, Validator as q, DocumentDiagnostic as r, DocumentRuntime as s, CommitSource as t, variant as tt, ObserverError as u, MutationIssue as v, replace as w, DocumentImpact as x, MutationIssueCode as y, DocumentAnchor as z };
|
|
621
|
-
//# sourceMappingURL=contract-CNR6BS75.d.cts.map
|
|
620
|
+
export { table as $, ParseError as A, DocumentListConfig as B, Read as C, ChangeSet as D, Change as E, CollectionPath as F, ReadonlyValue as G, DocumentTreeValue as H, PathValueOf as I, field as J, Schema as K, SchemaPath as L, parse as M, CollectionEntry as N, MemberChange as O, CollectionId as P, optional as Q, DocumentAddress as R, Draft as S, snapshot as T, Infer as U, DocumentTreeNode as V, ObjectSchema as W, map as X, list as Y, object as Z, Unsubscribe as _, DocumentProblem as a, CollectionImpact as b, HistoryState as c, OperationResult as d, tree as et, ReadonlyDocument as f, Readable as g, TransactionResult as h, DocumentDisposedError as i, ParseIssue as j, ValueTransition as k, LocalHistory as l, TransactionRejected as m, DocumentCommit as n, DocumentReentrancyError as o, Synchronous as p, Validator as q, DocumentDiagnostic as r, DocumentRuntime as s, CommitSource as t, variant as tt, ObserverError as u, MutationIssue as v, replace as w, DocumentImpact as x, MutationIssueCode as y, DocumentAnchor as z };
|
|
@@ -617,5 +617,4 @@ type DocumentRuntime<S extends ObjectSchema<object>> = ReadonlyDocument<S> & {
|
|
|
617
617
|
dispose(): void;
|
|
618
618
|
};
|
|
619
619
|
//#endregion
|
|
620
|
-
export { table as $, ParseError as A, DocumentListConfig as B, Read as C, ChangeSet as D, Change as E, CollectionPath as F, ReadonlyValue as G, DocumentTreeValue as H, PathValueOf as I, field as J, Schema as K, SchemaPath as L, parse as M, CollectionEntry as N, MemberChange as O, CollectionId as P, optional as Q, DocumentAddress as R, Draft as S, snapshot as T, Infer as U, DocumentTreeNode as V, ObjectSchema as W, map as X, list as Y, object as Z, Unsubscribe as _, DocumentProblem as a, CollectionImpact as b, HistoryState as c, OperationResult as d, tree as et, ReadonlyDocument as f, Readable as g, TransactionResult as h, DocumentDisposedError as i, ParseIssue as j, ValueTransition as k, LocalHistory as l, TransactionRejected as m, DocumentCommit as n, DocumentReentrancyError as o, Synchronous as p, Validator as q, DocumentDiagnostic as r, DocumentRuntime as s, CommitSource as t, variant as tt, ObserverError as u, MutationIssue as v, replace as w, DocumentImpact as x, MutationIssueCode as y, DocumentAnchor as z };
|
|
621
|
-
//# sourceMappingURL=contract-COgxO5sv.d.ts.map
|
|
620
|
+
export { table as $, ParseError as A, DocumentListConfig as B, Read as C, ChangeSet as D, Change as E, CollectionPath as F, ReadonlyValue as G, DocumentTreeValue as H, PathValueOf as I, field as J, Schema as K, SchemaPath as L, parse as M, CollectionEntry as N, MemberChange as O, CollectionId as P, optional as Q, DocumentAddress as R, Draft as S, snapshot as T, Infer as U, DocumentTreeNode as V, ObjectSchema as W, map as X, list as Y, object as Z, Unsubscribe as _, DocumentProblem as a, CollectionImpact as b, HistoryState as c, OperationResult as d, tree as et, ReadonlyDocument as f, Readable as g, TransactionResult as h, DocumentDisposedError as i, ParseIssue as j, ValueTransition as k, LocalHistory as l, TransactionRejected as m, DocumentCommit as n, DocumentReentrancyError as o, Synchronous as p, Validator as q, DocumentDiagnostic as r, DocumentRuntime as s, CommitSource as t, variant as tt, ObserverError as u, MutationIssue as v, replace as w, DocumentImpact as x, MutationIssueCode as y, DocumentAnchor as z };
|
|
@@ -143,5 +143,4 @@ type KeyedDependencyValues<D extends object> = { readonly [P in keyof D]: D[P] e
|
|
|
143
143
|
readonly source: KeyedProjection<infer _K extends string, infer V>;
|
|
144
144
|
} ? V | undefined : D[P] extends Projection<infer T> ? T : never };
|
|
145
145
|
//#endregion
|
|
146
|
-
export { ProjectionDisposedError as _, Input as a, ProjectionChange as c, CollectionRead as d, ExternalCollectionEvent as f, ExternalValueSource as g, ExternalValueEvent as h, CollectionInputDraft as i, CollectionChange as l, ExternalCollectionSource as m, KeyedDependencyValues as n, KeyedProjection as o, ExternalCollectionRead as p, CollectionInput as r, Projection as s, KeyedDependencies as t, CollectionDraft as u, ProjectionError as v };
|
|
147
|
-
//# sourceMappingURL=dependency-Cbf3C8eJ.d.cts.map
|
|
146
|
+
export { ProjectionDisposedError as _, Input as a, ProjectionChange as c, CollectionRead as d, ExternalCollectionEvent as f, ExternalValueSource as g, ExternalValueEvent as h, CollectionInputDraft as i, CollectionChange as l, ExternalCollectionSource as m, KeyedDependencyValues as n, KeyedProjection as o, ExternalCollectionRead as p, CollectionInput as r, Projection as s, KeyedDependencies as t, CollectionDraft as u, ProjectionError as v };
|
|
@@ -143,5 +143,4 @@ type KeyedDependencyValues<D extends object> = { readonly [P in keyof D]: D[P] e
|
|
|
143
143
|
readonly source: KeyedProjection<infer _K extends string, infer V>;
|
|
144
144
|
} ? V | undefined : D[P] extends Projection<infer T> ? T : never };
|
|
145
145
|
//#endregion
|
|
146
|
-
export { ProjectionDisposedError as _, Input as a, ProjectionChange as c, CollectionRead as d, ExternalCollectionEvent as f, ExternalValueSource as g, ExternalValueEvent as h, CollectionInputDraft as i, CollectionChange as l, ExternalCollectionSource as m, KeyedDependencyValues as n, KeyedProjection as o, ExternalCollectionRead as p, CollectionInput as r, Projection as s, KeyedDependencies as t, CollectionDraft as u, ProjectionError as v };
|
|
147
|
-
//# sourceMappingURL=dependency-DzxXGYe1.d.ts.map
|
|
146
|
+
export { ProjectionDisposedError as _, Input as a, ProjectionChange as c, CollectionRead as d, ExternalCollectionEvent as f, ExternalValueSource as g, ExternalValueEvent as h, CollectionInputDraft as i, CollectionChange as l, ExternalCollectionSource as m, KeyedDependencyValues as n, KeyedProjection as o, ExternalCollectionRead as p, CollectionInput as r, Projection as s, KeyedDependencies as t, CollectionDraft as u, ProjectionError as v };
|
package/dist/driver-B7RR-VfX.js
CHANGED
|
@@ -400,5 +400,3 @@ const installRuntimeWriteDriver = (runtime, driver) => {
|
|
|
400
400
|
};
|
|
401
401
|
//#endregion
|
|
402
402
|
export { changeCount as a, AddressIndex as c, invalidValue as d, children as f, validate as g, parent as h, contextOf as i, MutationRejected as l, is as m, installRuntimeWriteDriver as n, decodeChanges as o, contains as p, bindContext as r, sealChanges as s, assertRuntimeWritable as t, fail as u };
|
|
403
|
-
|
|
404
|
-
//# sourceMappingURL=driver-B7RR-VfX.js.map
|
package/dist/driver-CN3dGxQI.cjs
CHANGED
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -40,7 +40,7 @@ type KeyedEntries<K extends string, V> = readonly (readonly [K, V])[];
|
|
|
40
40
|
type Equality$2<T> = (previous: T, next: T) => boolean;
|
|
41
41
|
declare function createKeyedFrom<K extends string, V>(source: Projection<readonly V[]>, keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$2<V>): KeyedProjection<K, V>;
|
|
42
42
|
declare function createKeyedFrom<K extends string, V>(source: readonly V[], keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$2<V>): KeyedProjection<K, V>;
|
|
43
|
-
declare function createKeyedFromEntries<const D extends ProjectionDependencies, K extends string, V>(dependencies: D, compute: (values: ProjectionValues<D>) => Synchronous<KeyedEntries<K, V>>, equality?: Equality$2<
|
|
43
|
+
declare function createKeyedFromEntries<const D extends ProjectionDependencies, K extends string, V>(dependencies: D, compute: (values: ProjectionValues<D>) => Synchronous<KeyedEntries<K, V>>, equality?: Equality$2<V>): KeyedProjection<K, V>;
|
|
44
44
|
declare function createKeyedMerge<K extends string, V>(sources: readonly KeyedProjection<K, V>[], options: {
|
|
45
45
|
readonly conflict: 'error' | 'first' | 'last';
|
|
46
46
|
readonly equality?: Equality$2<V>;
|
|
@@ -133,5 +133,4 @@ declare const createProjectionRuntime: (options?: {
|
|
|
133
133
|
readonly onError?: (error: ProjectionError) => void;
|
|
134
134
|
}) => ProjectionRuntime;
|
|
135
135
|
//#endregion
|
|
136
|
-
export { type Change, type ChangeSet, type CollectionImpact, type CollectionInput, type CollectionInputDraft, type CommitSource, type DocumentAddress, type DocumentAnchor, type DocumentCommit, type DocumentDiagnostic, DocumentDisposedError, type DocumentImpact, type DocumentListConfig, type DocumentProblem, DocumentReentrancyError, type DocumentRuntime, type DocumentSelector, type DocumentTreeNode, type DocumentTreeValue, type Draft, type ExternalCollectionEvent, type ExternalCollectionRead, type ExternalCollectionSource, type ExternalValueEvent, type ExternalValueSource, type HistoryState, type Infer, type Input, type KeyedProjection, type LocalHistory, type MemberChange, type MutationIssue, type MutationIssueCode, type ObjectSchema, type ObserverError, type OperationResult, ParseError, type ParseIssue, type PathValueOf, type Projection, ProjectionDisposedError, ProjectionError, type ProjectionItems, type ProjectionRuntime, type ProjectionScope, type Read, type Readable, type ReadonlyDocument, type ReadonlyValue, type Schema, type SchemaPath, TransactionRejected, type TransactionResult, type Unsubscribe, type Validator, type ValueTransition, createDocument, createProjectionRuntime, derive, field, input, list, map, object, observe, optional, parse, read, replace, select, snapshot, table, tree, variant };
|
|
137
|
-
//# sourceMappingURL=index.d.cts.map
|
|
136
|
+
export { type Change, type ChangeSet, type CollectionImpact, type CollectionInput, type CollectionInputDraft, type CommitSource, type DocumentAddress, type DocumentAnchor, type DocumentCommit, type DocumentDiagnostic, DocumentDisposedError, type DocumentImpact, type DocumentListConfig, type DocumentProblem, DocumentReentrancyError, type DocumentRuntime, type DocumentSelector, type DocumentTreeNode, type DocumentTreeValue, type Draft, type ExternalCollectionEvent, type ExternalCollectionRead, type ExternalCollectionSource, type ExternalValueEvent, type ExternalValueSource, type HistoryState, type Infer, type Input, type KeyedProjection, type LocalHistory, type MemberChange, type MutationIssue, type MutationIssueCode, type ObjectSchema, type ObserverError, type OperationResult, ParseError, type ParseIssue, type PathValueOf, type Projection, ProjectionDisposedError, ProjectionError, type ProjectionItems, type ProjectionRuntime, type ProjectionScope, type Read, type Readable, type ReadonlyDocument, type ReadonlyValue, type Schema, type SchemaPath, TransactionRejected, type TransactionResult, type Unsubscribe, type Validator, type ValueTransition, createDocument, createProjectionRuntime, derive, field, input, list, map, object, observe, optional, parse, read, replace, select, snapshot, table, tree, variant };
|
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ type KeyedEntries<K extends string, V> = readonly (readonly [K, V])[];
|
|
|
40
40
|
type Equality$2<T> = (previous: T, next: T) => boolean;
|
|
41
41
|
declare function createKeyedFrom<K extends string, V>(source: Projection<readonly V[]>, keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$2<V>): KeyedProjection<K, V>;
|
|
42
42
|
declare function createKeyedFrom<K extends string, V>(source: readonly V[], keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$2<V>): KeyedProjection<K, V>;
|
|
43
|
-
declare function createKeyedFromEntries<const D extends ProjectionDependencies, K extends string, V>(dependencies: D, compute: (values: ProjectionValues<D>) => Synchronous<KeyedEntries<K, V>>, equality?: Equality$2<
|
|
43
|
+
declare function createKeyedFromEntries<const D extends ProjectionDependencies, K extends string, V>(dependencies: D, compute: (values: ProjectionValues<D>) => Synchronous<KeyedEntries<K, V>>, equality?: Equality$2<V>): KeyedProjection<K, V>;
|
|
44
44
|
declare function createKeyedMerge<K extends string, V>(sources: readonly KeyedProjection<K, V>[], options: {
|
|
45
45
|
readonly conflict: 'error' | 'first' | 'last';
|
|
46
46
|
readonly equality?: Equality$2<V>;
|
|
@@ -133,5 +133,4 @@ declare const createProjectionRuntime: (options?: {
|
|
|
133
133
|
readonly onError?: (error: ProjectionError) => void;
|
|
134
134
|
}) => ProjectionRuntime;
|
|
135
135
|
//#endregion
|
|
136
|
-
export { type Change, type ChangeSet, type CollectionImpact, type CollectionInput, type CollectionInputDraft, type CommitSource, type DocumentAddress, type DocumentAnchor, type DocumentCommit, type DocumentDiagnostic, DocumentDisposedError, type DocumentImpact, type DocumentListConfig, type DocumentProblem, DocumentReentrancyError, type DocumentRuntime, type DocumentSelector, type DocumentTreeNode, type DocumentTreeValue, type Draft, type ExternalCollectionEvent, type ExternalCollectionRead, type ExternalCollectionSource, type ExternalValueEvent, type ExternalValueSource, type HistoryState, type Infer, type Input, type KeyedProjection, type LocalHistory, type MemberChange, type MutationIssue, type MutationIssueCode, type ObjectSchema, type ObserverError, type OperationResult, ParseError, type ParseIssue, type PathValueOf, type Projection, ProjectionDisposedError, ProjectionError, type ProjectionItems, type ProjectionRuntime, type ProjectionScope, type Read, type Readable, type ReadonlyDocument, type ReadonlyValue, type Schema, type SchemaPath, TransactionRejected, type TransactionResult, type Unsubscribe, type Validator, type ValueTransition, createDocument, createProjectionRuntime, derive, field, input, list, map, object, observe, optional, parse, read, replace, select, snapshot, table, tree, variant };
|
|
137
|
-
//# sourceMappingURL=index.d.ts.map
|
|
136
|
+
export { type Change, type ChangeSet, type CollectionImpact, type CollectionInput, type CollectionInputDraft, type CommitSource, type DocumentAddress, type DocumentAnchor, type DocumentCommit, type DocumentDiagnostic, DocumentDisposedError, type DocumentImpact, type DocumentListConfig, type DocumentProblem, DocumentReentrancyError, type DocumentRuntime, type DocumentSelector, type DocumentTreeNode, type DocumentTreeValue, type Draft, type ExternalCollectionEvent, type ExternalCollectionRead, type ExternalCollectionSource, type ExternalValueEvent, type ExternalValueSource, type HistoryState, type Infer, type Input, type KeyedProjection, type LocalHistory, type MemberChange, type MutationIssue, type MutationIssueCode, type ObjectSchema, type ObserverError, type OperationResult, ParseError, type ParseIssue, type PathValueOf, type Projection, ProjectionDisposedError, ProjectionError, type ProjectionItems, type ProjectionRuntime, type ProjectionScope, type Read, type Readable, type ReadonlyDocument, type ReadonlyValue, type Schema, type SchemaPath, TransactionRejected, type TransactionResult, type Unsubscribe, type Validator, type ValueTransition, createDocument, createProjectionRuntime, derive, field, input, list, map, object, observe, optional, parse, read, replace, select, snapshot, table, tree, variant };
|
package/dist/index.js
CHANGED
|
@@ -6443,5 +6443,3 @@ const createProjectionRuntime = (options) => {
|
|
|
6443
6443
|
};
|
|
6444
6444
|
//#endregion
|
|
6445
6445
|
export { DocumentDisposedError, DocumentReentrancyError, ParseError, ProjectionDisposedError, ProjectionError, TransactionRejected, createDocument, createProjectionRuntime, derive, field, input, list, map, object, observe, optional, parse, read, replace, select, snapshot, table, tree, variant };
|
|
6446
|
-
|
|
6447
|
-
//# sourceMappingURL=index.js.map
|
package/dist/local-sync.cjs
CHANGED
package/dist/local-sync.d.cts
CHANGED
|
@@ -58,5 +58,4 @@ type AttachLocalSyncOptions<TSchema extends ObjectSchema<object>> = {
|
|
|
58
58
|
//#region core/src/local-sync/session.d.ts
|
|
59
59
|
declare const attachLocalSync: <TSchema extends ObjectSchema<object>>(input: AttachLocalSyncOptions<TSchema>) => Promise<LocalSync>;
|
|
60
60
|
//#endregion
|
|
61
|
-
export { type AttachLocalSyncOptions, type JsonChangeLimits, type JsonPrimitive, type JsonValue, type LocalSync, LocalSyncError, type LocalSyncErrorCode, type LocalSyncState, attachLocalSync, defaultJsonChangeLimits };
|
|
62
|
-
//# sourceMappingURL=local-sync.d.cts.map
|
|
61
|
+
export { type AttachLocalSyncOptions, type JsonChangeLimits, type JsonPrimitive, type JsonValue, type LocalSync, LocalSyncError, type LocalSyncErrorCode, type LocalSyncState, attachLocalSync, defaultJsonChangeLimits };
|
package/dist/local-sync.d.ts
CHANGED
|
@@ -58,5 +58,4 @@ type AttachLocalSyncOptions<TSchema extends ObjectSchema<object>> = {
|
|
|
58
58
|
//#region core/src/local-sync/session.d.ts
|
|
59
59
|
declare const attachLocalSync: <TSchema extends ObjectSchema<object>>(input: AttachLocalSyncOptions<TSchema>) => Promise<LocalSync>;
|
|
60
60
|
//#endregion
|
|
61
|
-
export { type AttachLocalSyncOptions, type JsonChangeLimits, type JsonPrimitive, type JsonValue, type LocalSync, LocalSyncError, type LocalSyncErrorCode, type LocalSyncState, attachLocalSync, defaultJsonChangeLimits };
|
|
62
|
-
//# sourceMappingURL=local-sync.d.ts.map
|
|
61
|
+
export { type AttachLocalSyncOptions, type JsonChangeLimits, type JsonPrimitive, type JsonValue, type LocalSync, LocalSyncError, type LocalSyncErrorCode, type LocalSyncState, attachLocalSync, defaultJsonChangeLimits };
|
package/dist/local-sync.js
CHANGED
package/dist/react.cjs
CHANGED
package/dist/react.d.cts
CHANGED
|
@@ -14,5 +14,4 @@ declare function useHistory<TCommit>(history: LocalHistory<TCommit>): HistorySta
|
|
|
14
14
|
redo(): OperationResult<TCommit>;
|
|
15
15
|
};
|
|
16
16
|
//#endregion
|
|
17
|
-
export { ProjectionProvider, useDocumentSelector, useHistory, useInput, useProjection, useReadable };
|
|
18
|
-
//# sourceMappingURL=react.d.cts.map
|
|
17
|
+
export { ProjectionProvider, useDocumentSelector, useHistory, useInput, useProjection, useReadable };
|
package/dist/react.d.ts
CHANGED
|
@@ -14,5 +14,4 @@ declare function useHistory<TCommit>(history: LocalHistory<TCommit>): HistorySta
|
|
|
14
14
|
redo(): OperationResult<TCommit>;
|
|
15
15
|
};
|
|
16
16
|
//#endregion
|
|
17
|
-
export { ProjectionProvider, useDocumentSelector, useHistory, useInput, useProjection, useReadable };
|
|
18
|
-
//# sourceMappingURL=react.d.ts.map
|
|
17
|
+
export { ProjectionProvider, useDocumentSelector, useHistory, useInput, useProjection, useReadable };
|
package/dist/react.js
CHANGED
package/dist/record-B2yRhYsc.js
CHANGED
package/dist/record-ChYUi8PP.cjs
CHANGED
|
@@ -1090,5 +1090,3 @@ const createKeyedTransform = (definition) => {
|
|
|
1090
1090
|
};
|
|
1091
1091
|
//#endregion
|
|
1092
1092
|
export { ownProjections as A, snapshotProjectionValues as C, defineProcessor as D, snapshotCollectionView as E, projectionRef as M, profile as N, defineSource as O, compileProjectionDependencies as S, mapRead as T, assertSynchronous as _, collectionChangeTouchesKey as a, ProjectionError as b, assertKeyedProjection as c, outputKind as d, createKeyRelation as f, assertScope as g, snapshotArray as h, collectionChangeIntersects as i, producerOf as j, isProjection as k, compileKeyedDependencies as l, sameArray as m, keyedAbsent as n, collectionHasStructuralChange as o, iterableMatchesArray as p, collectionChange as r, createCollectionChange as s, createKeyedTransform as t, createKeyedDependencyRuntime as u, createScheduler as v, collectionView as w, collectKeyedInvalidation as x, ProjectionDisposedError as y };
|
|
1093
|
-
|
|
1094
|
-
//# sourceMappingURL=transform-3mj0eStL.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doxum",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Doxum is a typed runtime for complex mutable documents.",
|
|
@@ -56,7 +56,10 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
59
|
-
"dist",
|
|
59
|
+
"dist/**/*.js",
|
|
60
|
+
"dist/**/*.cjs",
|
|
61
|
+
"dist/**/*.d.ts",
|
|
62
|
+
"dist/**/*.d.cts",
|
|
60
63
|
"skills"
|
|
61
64
|
],
|
|
62
65
|
"sideEffects": false,
|
|
@@ -79,13 +82,15 @@
|
|
|
79
82
|
"vitest": "^4.0.16"
|
|
80
83
|
},
|
|
81
84
|
"scripts": {
|
|
82
|
-
"build": "tsdown --config tsdown.config.ts && node scripts/check-build-exports.mjs && pnpm run check:declaration-portability",
|
|
85
|
+
"build": "tsdown --config tsdown.config.ts && node scripts/check-build-exports.mjs && pnpm run check:declaration-portability && pnpm run check:package",
|
|
86
|
+
"build:debug": "tsdown --config tsdown.config.ts --sourcemap --out-dir .debug/dist",
|
|
83
87
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
84
88
|
"test": "vitest run --config vitest.config.ts",
|
|
85
89
|
"check": "pnpm run format:check && pnpm run lint && pnpm run typecheck && pnpm run check:public-types && pnpm run test && pnpm run check:runtime-skill && pnpm run check:projection-surface && pnpm run check:runtime-imports",
|
|
86
90
|
"check:runtime-skill": "node scripts/check-runtime-skill.mjs",
|
|
87
91
|
"check:projection-surface": "node scripts/check-projection-surface.mjs",
|
|
88
92
|
"check:runtime-imports": "node scripts/check-runtime-imports.mjs",
|
|
93
|
+
"check:package": "node scripts/check-package.mjs",
|
|
89
94
|
"check:public-types": "tsc -p tsconfig.public-api.json --noEmit",
|
|
90
95
|
"check:declaration-portability": "tsc -p tsconfig.declaration-portability.json && node scripts/check-declaration-portability.mjs",
|
|
91
96
|
"bench": "vitest bench --config vitest.bench.config.ts",
|
|
@@ -200,6 +200,8 @@ const errors = derive.keyed.fromEntries(
|
|
|
200
200
|
|
|
201
201
|
Each synchronous computation returns the **complete** finite `readonly (readonly [K, V])[]` result. The tuple order is formal output order; `[]` removes all members. Keys must be unique strings. `[key, undefined]` is a present member. A key missing from the next result is removed. Reordering alone does not invent value updates.
|
|
202
202
|
|
|
203
|
+
Value inference uses both `compute` and a typed `equality` callback, including computations with empty-array branches and union values. These cases do not require an output `KeyedProjection<K, V>` annotation. Equality must accept every emitted value variant. Normal TypeScript literal widening still applies; preserve discriminants with a declared value type or `as const` when needed.
|
|
204
|
+
|
|
203
205
|
Equality defaults to `Object.is` and compares values under the same key, not the outer array or tuple objects. Equality-equivalent values retain their existing reference; new value objects require stable references or a suitable equality callback. Equality cannot suppress membership/order. Callback failures, thenables, malformed tuples, duplicate keys and equality failures install no partial output and follow normal initialization/processor recovery semantics. Output definitions are lazy, reusable across runtimes and compatible with scopes and `runtime.items()`.
|
|
204
206
|
|
|
205
207
|
This is **whole-result computation with incremental output publication**. Each necessary evaluation runs the callback for all inputs and scans the old/new result membership, costing O(old result size + new result size), plus callback work and keyed dependency snapshot costs. A keyed dependency is consumed as a whole: `records.get(activeId)` inside the callback does not establish an entry dependency. For precise dynamic lookup, compose the existing scalar lookup first:
|
|
@@ -350,6 +350,7 @@ derive.keyed.from(source: Projection<readonly V[]>, keyOf, equality?): KeyedProj
|
|
|
350
350
|
derive.keyed.from(source: readonly V[], keyOf, equality?): KeyedProjection<K,V>
|
|
351
351
|
derive.keyed.fromEntries(dependencies, compute, equality?): KeyedProjection<K,V>
|
|
352
352
|
// compute(readonlyNamedValues) returns Synchronous<readonly (readonly [K,V])[]>
|
|
353
|
+
// V is inferred from compute and typed equality; equality must accept every emitted variant.
|
|
353
354
|
derive.keyed.merge(sources, { conflict: 'error' | 'first' | 'last', equality? }): KeyedProjection<K,V>
|
|
354
355
|
derive.keyed.merge(sources, { conflict: 'resolve', resolve, equality? }): KeyedProjection<K,V>
|
|
355
356
|
derive.keyed.subset(source, orderedKeysOrProjection): KeyedProjection<K,V>
|
package/dist/advanced.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"advanced.cjs","names":["collectionView","isPlainObject","compileProjectionDependencies","defineProcessor","createKeyedTransform"],"sources":["../core/src/projection/advanced.ts"],"sourcesContent":["import { collectionView } from '@/projection/collection/view';\nimport type { CollectionChange, CollectionDraft, CollectionRead, SourceContext } from './contract';\nimport type {\n KeyedProjection,\n OutputDefinition,\n OutputEvaluation,\n Projection,\n ProjectionChange,\n} from './definition';\nimport { defineProcessor } from './definition';\nimport { compileProjectionDependencies } from './dependency';\nimport { assertSynchronous } from '@/projection/graph/scheduler';\nimport { isPlainObject } from '@/value/record';\nimport type {\n KeyedDependencies,\n KeyedDependencyRecord,\n KeyedDependencyValues,\n} from '@/projection/keyed/dependency';\nimport { createKeyedTransform } from '@/projection/keyed/transform';\n\ntype ProjectionDependencies = Readonly<Record<string, Projection<unknown>>>;\n\ntype ProjectionValues<D extends ProjectionDependencies> = {\n readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never;\n};\n\ntype ProjectionChanges<D extends ProjectionDependencies> = {\n readonly [K in keyof D]: ProjectionChange<D[K]> extends undefined\n ? undefined\n : ProjectionChange<D[K]> | undefined;\n};\n\ntype RetainedStateContext<State> = [State] extends [never] ? {} : { readonly state: State };\ntype RetainedStateDefinition<State> = [State] extends [never]\n ? { readonly state?: never }\n : { readonly state: () => State };\n\nexport type IncrementalValueContext<D extends ProjectionDependencies, T, State = never> = {\n readonly values: ProjectionValues<D>;\n readonly changes: ProjectionChanges<D>;\n readonly previous: T | undefined;\n readonly reset: boolean;\n readonly cause: unknown;\n} & RetainedStateContext<State>;\n\nexport type IncrementalValueDefinition<D extends ProjectionDependencies, T, State = never> = {\n readonly process: (context: IncrementalValueContext<D, T, State>) => T;\n} & RetainedStateDefinition<State>;\n\nexport type IncrementalCollectionContext<\n D extends ProjectionDependencies,\n K extends string,\n V,\n State = never,\n> = {\n readonly values: ProjectionValues<D>;\n readonly changes: ProjectionChanges<D>;\n readonly previous: CollectionRead<K, V>;\n readonly next: CollectionRead<K, V>;\n readonly reset: boolean;\n readonly cause: unknown;\n readonly output: CollectionDraft<K, V>;\n} & RetainedStateContext<State>;\n\nexport type IncrementalCollectionDefinition<\n D extends ProjectionDependencies,\n K extends string,\n V,\n State = never,\n> = {\n readonly process: (context: IncrementalCollectionContext<D, K, V, State>) => void;\n} & RetainedStateDefinition<State>;\n\nexport type IncrementalKeyedContext<K extends string, V, D extends object, State = never> = {\n readonly key: K;\n readonly value: V;\n readonly dependencies: KeyedDependencyValues<D>;\n readonly reset: boolean;\n readonly cause: unknown;\n} & RetainedStateContext<State>;\n\nexport type IncrementalKeyedDefinition<K extends string, V, D extends object, T, State = never> = {\n readonly equality?: (previous: T, next: T) => boolean;\n readonly process: (context: IncrementalKeyedContext<K, V, D, State>) => T;\n} & ([State] extends [never]\n ? { readonly state?: never }\n : { readonly state: (value: V, key: K) => State });\n\ndeclare const groupOutput: unique symbol;\n\n/** Type-only declaration token used by incremental.group output builders. */\nexport type IncrementalGroupOutput<P extends Projection<unknown>> = {\n readonly [groupOutput]: P;\n};\n\ntype GroupOutputShape = {\n readonly [name: string]: IncrementalGroupOutput<Projection<unknown>> | GroupOutputShape;\n};\n\ntype GroupOutputBuilder = {\n collection<K extends string, V>(\n equality?: (previous: V, next: V) => boolean\n ): IncrementalGroupOutput<KeyedProjection<K, V>>;\n value<T>(equality?: (previous: T, next: T) => boolean): IncrementalGroupOutput<Projection<T>>;\n};\n\n/** Portable projection tree returned from an incremental.group declaration. */\nexport type IncrementalGroupResult<O> =\n O extends IncrementalGroupOutput<infer P>\n ? P\n : O extends Readonly<Record<string, unknown>>\n ? { readonly [K in keyof O]: IncrementalGroupResult<O[K]> }\n : never;\n\ntype GroupReads<O> =\n O extends IncrementalGroupOutput<infer P>\n ? P extends KeyedProjection<infer K, infer V>\n ? CollectionRead<K, V>\n : P extends Projection<infer T>\n ? T | undefined\n : never\n : { readonly [K in keyof O]: GroupReads<O[K]> };\n\ntype GroupDrafts<O> =\n O extends IncrementalGroupOutput<infer P>\n ? P extends KeyedProjection<infer K, infer V>\n ? CollectionDraft<K, V>\n : P extends Projection<infer T>\n ? { set(value: T): void }\n : never\n : { readonly [K in keyof O]: GroupDrafts<O[K]> };\n\nexport type IncrementalGroupContext<\n D extends ProjectionDependencies,\n O extends GroupOutputShape,\n State = never,\n> = {\n readonly values: ProjectionValues<D>;\n readonly changes: ProjectionChanges<D>;\n readonly previous: GroupReads<O>;\n readonly next: GroupReads<O>;\n readonly output: GroupDrafts<O>;\n readonly reset: boolean;\n readonly cause: unknown;\n} & RetainedStateContext<State>;\n\ntype IncrementalGroupDefinition<\n D extends ProjectionDependencies,\n O extends GroupOutputShape,\n State = never,\n> = {\n readonly output: (define: GroupOutputBuilder) => O;\n readonly process: (context: IncrementalGroupContext<D, O, State>) => void;\n} & RetainedStateDefinition<State>;\n\nconst resetCollectionChange = Object.freeze({ kind: 'reset' as const });\n\nconst publicValue = (source: SourceContext): unknown =>\n source.kind === 'value' ? source.value : collectionView(source.read);\n\nconst publicInputs = (\n sources: readonly SourceContext[],\n names: readonly string[],\n reset: boolean\n): {\n readonly values: Readonly<Record<string, unknown>>;\n readonly changes: Readonly<Record<string, unknown>>;\n} => {\n const values: Record<string, unknown> = Object.create(null) as Record<string, unknown>;\n const changes: Record<string, unknown> = Object.create(null) as Record<string, unknown>;\n for (let index = 0; index < names.length; index++) {\n const source = sources[index];\n values[names[index]] = publicValue(source);\n changes[names[index]] =\n source.kind === 'collection' ? (reset ? resetCollectionChange : source.change) : undefined;\n }\n return Object.freeze({ values: Object.freeze(values), changes: Object.freeze(changes) });\n};\n\nfunction validateDefinition(\n definition: unknown,\n allowed: readonly string[],\n label: string\n): asserts definition is Record<string, unknown> {\n if (!isPlainObject(definition))\n throw new TypeError(`${label} definition must be a plain object.`);\n const allowedKeys = new Set(allowed);\n for (const key of Reflect.ownKeys(definition)) {\n if (typeof key !== 'string' || !allowedKeys.has(key))\n throw new TypeError(`${label} definition contains an unknown property.`);\n const descriptor = Object.getOwnPropertyDescriptor(definition, key);\n if (!descriptor?.enumerable || !('value' in descriptor))\n throw new TypeError(`${label} definition must contain enumerable data properties.`);\n }\n}\n\nconst validateRetainedState = (definition: Record<string, unknown>, label: string): void => {\n if (\n Object.prototype.hasOwnProperty.call(definition, 'state') &&\n typeof definition.state !== 'function'\n )\n throw new TypeError(`${label} state must be a function when provided.`);\n};\n\nconst initializeRetainedState = (definition: {\n readonly state?: () => unknown;\n}): Readonly<Record<string, unknown>> => {\n if (definition.state === undefined) return Object.freeze({});\n const state = definition.state();\n assertSynchronous(state);\n return Object.freeze({ state });\n};\n\ntype RuntimeIncrementalDefinition<Result> = {\n readonly state?: () => unknown;\n readonly process: (context: never) => Result;\n};\n\nfunction createIncrementalValue<const D extends ProjectionDependencies, T>(\n dependencies: D,\n definition: IncrementalValueDefinition<D, T>\n): Projection<T>;\nfunction createIncrementalValue<const D extends ProjectionDependencies, T, State>(\n dependencies: D,\n definition: {\n readonly state: () => State;\n readonly process: (context: IncrementalValueContext<D, T, State>) => T;\n }\n): Projection<T>;\nfunction createIncrementalValue<const D extends ProjectionDependencies, T>(\n dependencies: D,\n definition: RuntimeIncrementalDefinition<T>\n): Projection<T> {\n const compiled = compileProjectionDependencies(dependencies, 'Incremental');\n validateDefinition(definition, ['state', 'process'], 'Incremental value');\n validateRetainedState(definition, 'Incremental value');\n if (typeof definition.process !== 'function')\n throw new TypeError('Incremental value definition requires a process function.');\n const [projection] = defineProcessor({\n dependencies: compiled.projections,\n outputs: [{ kind: 'value', equality: Object.is }],\n create: () => {\n const state = initializeRetainedState(definition);\n return {\n evaluate: evaluation => {\n const output = evaluation.outputs[0];\n if (output.kind !== 'value') throw new Error('Incremental value output is invalid.');\n const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);\n const result = definition.process({\n values: publicInput.values as ProjectionValues<D>,\n changes: publicInput.changes as ProjectionChanges<D>,\n previous: output.previous as T | undefined,\n reset: evaluation.reset,\n cause: evaluation.cause,\n ...state,\n } as never);\n assertSynchronous(result);\n output.output.set(result);\n },\n };\n },\n });\n return projection as Projection<T>;\n}\n\nfunction createIncrementalCollection<const D extends ProjectionDependencies, K extends string, V>(\n dependencies: D,\n definition: IncrementalCollectionDefinition<D, K, V>\n): KeyedProjection<K, V>;\nfunction createIncrementalCollection<\n const D extends ProjectionDependencies,\n K extends string,\n V,\n State,\n>(\n dependencies: D,\n definition: {\n readonly state: () => State;\n readonly process: (context: IncrementalCollectionContext<D, K, V, State>) => void;\n }\n): KeyedProjection<K, V>;\nfunction createIncrementalCollection<const D extends ProjectionDependencies, K extends string, V>(\n dependencies: D,\n definition: RuntimeIncrementalDefinition<void>\n): KeyedProjection<K, V> {\n const compiled = compileProjectionDependencies(dependencies, 'Incremental');\n validateDefinition(definition, ['state', 'process'], 'Incremental collection');\n validateRetainedState(definition, 'Incremental collection');\n if (typeof definition.process !== 'function')\n throw new TypeError('Incremental collection definition requires a process function.');\n const [projection] = defineProcessor({\n dependencies: compiled.projections,\n outputs: [{ kind: 'collection', equality: Object.is }],\n create: () => {\n const state = initializeRetainedState(definition);\n return {\n evaluate: evaluation => {\n const output = evaluation.outputs[0];\n if (output.kind !== 'collection')\n throw new Error('Incremental collection output is invalid.');\n const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);\n const result = definition.process({\n values: publicInput.values as ProjectionValues<D>,\n changes: publicInput.changes as ProjectionChanges<D>,\n previous: output.previous as CollectionRead<K, V>,\n next: output.next as CollectionRead<K, V>,\n reset: evaluation.reset,\n cause: evaluation.cause,\n output: output.output as CollectionDraft<K, V>,\n ...state,\n } as never);\n assertSynchronous(result);\n },\n };\n },\n });\n return projection as KeyedProjection<K, V>;\n}\n\nfunction createIncrementalKeyed<K extends string, V, const D extends object, T, State>(\n driver: KeyedProjection<K, V>,\n dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>,\n definition: {\n readonly state: (value: NoInfer<V>, key: NoInfer<K>) => State;\n readonly equality?: (previous: T, next: T) => boolean;\n readonly process: (context: IncrementalKeyedContext<NoInfer<K>, NoInfer<V>, D, State>) => T;\n }\n): KeyedProjection<K, T>;\nfunction createIncrementalKeyed<K extends string, V, const D extends object, T>(\n driver: KeyedProjection<K, V>,\n dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>,\n definition: {\n readonly equality?: (previous: T, next: T) => boolean;\n readonly process: (context: IncrementalKeyedContext<NoInfer<K>, NoInfer<V>, D>) => T;\n }\n): KeyedProjection<K, T>;\nfunction createIncrementalKeyed<K extends string, V, T>(\n driver: KeyedProjection<K, V>,\n dependencies: KeyedDependencyRecord<K, V>,\n definition: {\n readonly state?: (value: V, key: K) => unknown;\n readonly equality?: (previous: T, next: T) => boolean;\n readonly process: (context: never) => T;\n }\n): KeyedProjection<K, T> {\n validateDefinition(definition, ['state', 'equality', 'process'], 'Incremental keyed');\n if (definition.state !== undefined && typeof definition.state !== 'function')\n throw new TypeError('Incremental keyed state must be a function when provided.');\n if (definition.equality !== undefined && typeof definition.equality !== 'function')\n throw new TypeError('Incremental keyed equality must be a function when provided.');\n if (typeof definition.process !== 'function')\n throw new TypeError('Incremental keyed definition requires a process function.');\n\n return createKeyedTransform<K, V, T, unknown>({\n source: driver,\n dependencies,\n equality: definition.equality,\n name: 'incremental.keyed',\n ...(definition.state ? { state: definition.state } : {}),\n evaluate: ({ key, value, dependencies: values, state, reset, cause }) =>\n definition.process({\n key,\n value,\n dependencies: values,\n reset,\n cause,\n ...(definition.state ? { state } : {}),\n } as never),\n });\n}\n\ntype GroupShape = number | { readonly [key: string]: GroupShape };\ntype GroupOutputMetadata = {\n readonly kind: OutputDefinition['kind'];\n readonly equality: (a: unknown, b: unknown) => boolean;\n};\n\nconst isPlainGroupNamespace = (\n value: unknown,\n metadata: ReadonlyMap<object, GroupOutputMetadata>\n): value is Record<string, unknown> => isPlainObject(value) && !metadata.has(value);\n\nconst compileGroupShape = (\n value: unknown,\n path: readonly string[],\n metadata: ReadonlyMap<object, GroupOutputMetadata>,\n used: Set<object>,\n outputs: OutputDefinition[]\n): GroupShape => {\n if (value !== null && typeof value === 'object') {\n const output = metadata.get(value);\n if (output) {\n if (used.has(value)) throw new TypeError('An incremental group output cannot be reused.');\n used.add(value);\n const index = outputs.length;\n outputs.push({\n kind: output.kind,\n equality: output.equality,\n path: Object.freeze([...path]),\n });\n return index;\n }\n }\n if (!isPlainGroupNamespace(value, metadata))\n throw new TypeError('Incremental group outputs must be a static object tree.');\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key !== 'string')\n throw new TypeError('Incremental group output names must be strings.');\n if (!Object.prototype.propertyIsEnumerable.call(value, key))\n throw new TypeError('Incremental group namespaces must contain enumerable properties.');\n }\n const keys = Object.keys(value);\n if (!keys.length) throw new TypeError('Incremental group namespaces cannot be empty.');\n const result: Record<string, GroupShape> = Object.create(null) as Record<string, GroupShape>;\n for (const key of keys) {\n if (key === '__proto__' || key === 'prototype' || key === 'constructor')\n throw new TypeError(`Invalid incremental group output name: ${key}`);\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (!descriptor || !('value' in descriptor))\n throw new TypeError('Incremental group namespaces cannot contain accessors.');\n result[key] = compileGroupShape(descriptor.value, [...path, key], metadata, used, outputs);\n }\n return Object.freeze(result);\n};\n\nconst hydrateGroupShape = <T>(shape: GroupShape, values: readonly T[]): unknown => {\n if (typeof shape === 'number') return values[shape];\n const result: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(shape)) result[key] = hydrateGroupShape(child, values);\n return Object.freeze(result);\n};\n\nconst hydrateGroupReads = (\n shape: GroupShape,\n outputs: readonly OutputEvaluation[],\n next: boolean\n): unknown => {\n if (typeof shape === 'number') {\n const output = outputs[shape];\n return next && output.kind === 'value' ? output.next() : next ? output.next : output.previous;\n }\n const result: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(shape)) {\n if (typeof child === 'number' && next && outputs[child].kind === 'value') {\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: false,\n get: () => (outputs[child] as Extract<OutputEvaluation, { kind: 'value' }>).next(),\n });\n } else result[key] = hydrateGroupReads(child, outputs, next);\n }\n return Object.freeze(result);\n};\n\nfunction createIncrementalGroup<\n const D extends ProjectionDependencies,\n const O extends GroupOutputShape,\n>(dependencies: D, definition: IncrementalGroupDefinition<D, O>): IncrementalGroupResult<O>;\nfunction createIncrementalGroup<\n const D extends ProjectionDependencies,\n const O extends GroupOutputShape,\n State,\n>(\n dependencies: D,\n definition: {\n readonly output: (define: GroupOutputBuilder) => O;\n readonly state: () => State;\n readonly process: (context: IncrementalGroupContext<D, O, State>) => void;\n }\n): IncrementalGroupResult<O>;\nfunction createIncrementalGroup<\n const D extends ProjectionDependencies,\n const O extends GroupOutputShape,\n>(\n dependencies: D,\n definition: RuntimeIncrementalDefinition<void> & {\n readonly output: (define: GroupOutputBuilder) => O;\n }\n): IncrementalGroupResult<O> {\n const compiled = compileProjectionDependencies(dependencies, 'Incremental');\n validateDefinition(definition, ['output', 'state', 'process'], 'Incremental group');\n validateRetainedState(definition, 'Incremental group');\n if (typeof definition.output !== 'function' || typeof definition.process !== 'function')\n throw new TypeError('Incremental group definition requires output and process functions.');\n\n let active = true;\n const metadata = new Map<object, GroupOutputMetadata>();\n const defineOutput: GroupOutputBuilder = {\n collection: <K extends string, V>(equality: (previous: V, next: V) => boolean = Object.is) => {\n if (!active) throw new TypeError('Incremental group output declarations are synchronous.');\n const descriptor = Object.freeze({});\n metadata.set(descriptor, {\n kind: 'collection',\n equality: equality as (a: unknown, b: unknown) => boolean,\n });\n return descriptor as IncrementalGroupOutput<KeyedProjection<K, V>>;\n },\n value: <T>(equality: (previous: T, next: T) => boolean = Object.is) => {\n if (!active) throw new TypeError('Incremental group output declarations are synchronous.');\n const descriptor = Object.freeze({});\n metadata.set(descriptor, {\n kind: 'value',\n equality: equality as (a: unknown, b: unknown) => boolean,\n });\n return descriptor as IncrementalGroupOutput<Projection<T>>;\n },\n };\n const declared = definition.output(defineOutput);\n assertSynchronous(declared);\n active = false;\n const outputs: OutputDefinition[] = [];\n const used = new Set<object>();\n const shape = compileGroupShape(declared, [], metadata, used, outputs);\n if (typeof shape === 'number')\n throw new TypeError('Incremental group declarations must return an output namespace.');\n if (used.size === 0 || used.size !== metadata.size)\n throw new TypeError('Every incremental group output must be returned by the declaration.');\n\n const projections = defineProcessor({\n dependencies: compiled.projections,\n outputs,\n create: () => {\n const state = initializeRetainedState(definition);\n return {\n evaluate: evaluation => {\n const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);\n const result = definition.process({\n values: publicInput.values as ProjectionValues<D>,\n changes: publicInput.changes as ProjectionChanges<D>,\n previous: hydrateGroupReads(shape, evaluation.outputs, false) as GroupReads<O>,\n next: hydrateGroupReads(shape, evaluation.outputs, true) as GroupReads<O>,\n output: hydrateGroupShape(\n shape,\n evaluation.outputs.map(output => output.output)\n ) as GroupDrafts<O>,\n reset: evaluation.reset,\n cause: evaluation.cause,\n ...state,\n } as never);\n assertSynchronous(result);\n },\n };\n },\n name: `processor-group:${outputs.map(output => output.path?.join('.') ?? '').join(',')}`,\n });\n return hydrateGroupShape(shape, projections) as IncrementalGroupResult<O>;\n}\n\nexport const incremental = Object.assign(createIncrementalValue, {\n collection: createIncrementalCollection,\n keyed: createIncrementalKeyed,\n group: createIncrementalGroup,\n});\n\nexport { collectionChange } from '@/projection/collection/change';\nexport type { CollectionChange } from './contract';\n"],"mappings":";;;;AA2JA,MAAM,wBAAwB,OAAO,OAAO,EAAE,MAAM,SAAkB,CAAC;AAEvE,MAAM,eAAe,WACnB,OAAO,SAAS,UAAU,OAAO,QAAQA,kBAAAA,eAAe,OAAO,KAAK;AAEtE,MAAM,gBACJ,SACA,OACA,UAIG;CACH,MAAM,SAAkC,OAAO,OAAO,KAAK;CAC3D,MAAM,UAAmC,OAAO,OAAO,KAAK;AAC5D,MAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;EACjD,MAA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,UAAU,kEAAkE;AACxF,KAAI,KAAK,SAAS,KAAK,KAAK,SAAS,SAAS,KAC5C,OAAM,IAAI,UAAU,sEAAsE;AA6B5F,QAAO,kBAAkB,OA3BLC,kBAAAA,gBAAgB;EAClC,cAAc,SAAS;EACvB;EACA,cAAc;GACZ,MAAM,QAAQ,wBAAwB,WAAW;AACjD,UAAO,EACL,WAAU,eAAc;IACtB,MAAM,cAAc,aAAa,WAAW,SAAS,SAAS,OAAO,WAAW,MAAM;AActF,sBAAA,kBAbe,WAAW,QAAQ;KAChC,QAAQ,YAAY;KACpB,SAAS,YAAY;KACrB,UAAU,kBAAkB,OAAO,WAAW,SAAS,MAAM;KAC7D,MAAM,kBAAkB,OAAO,WAAW,SAAS,KAAK;KACxD,QAAQ,kBACN,OACA,WAAW,QAAQ,KAAI,WAAU,OAAO,OAAO,CAChD;KACD,OAAO,WAAW;KAClB,OAAO,WAAW;KAClB,GAAG;KACJ,CACuB,CAAC;MAE5B;;EAEH,MAAM,mBAAmB,QAAQ,KAAI,WAAU,OAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC,KAAK,IAAI;EACvF,CAC0C,CAAC;;AAG9C,MAAa,cAAc,OAAO,OAAO,wBAAwB;CAC/D,YAAY;CACZ,OAAO;CACP,OAAO;CACR,CAAC"}
|
package/dist/advanced.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"advanced.js","names":[],"sources":["../core/src/projection/advanced.ts"],"sourcesContent":["import { collectionView } from '@/projection/collection/view';\nimport type { CollectionChange, CollectionDraft, CollectionRead, SourceContext } from './contract';\nimport type {\n KeyedProjection,\n OutputDefinition,\n OutputEvaluation,\n Projection,\n ProjectionChange,\n} from './definition';\nimport { defineProcessor } from './definition';\nimport { compileProjectionDependencies } from './dependency';\nimport { assertSynchronous } from '@/projection/graph/scheduler';\nimport { isPlainObject } from '@/value/record';\nimport type {\n KeyedDependencies,\n KeyedDependencyRecord,\n KeyedDependencyValues,\n} from '@/projection/keyed/dependency';\nimport { createKeyedTransform } from '@/projection/keyed/transform';\n\ntype ProjectionDependencies = Readonly<Record<string, Projection<unknown>>>;\n\ntype ProjectionValues<D extends ProjectionDependencies> = {\n readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never;\n};\n\ntype ProjectionChanges<D extends ProjectionDependencies> = {\n readonly [K in keyof D]: ProjectionChange<D[K]> extends undefined\n ? undefined\n : ProjectionChange<D[K]> | undefined;\n};\n\ntype RetainedStateContext<State> = [State] extends [never] ? {} : { readonly state: State };\ntype RetainedStateDefinition<State> = [State] extends [never]\n ? { readonly state?: never }\n : { readonly state: () => State };\n\nexport type IncrementalValueContext<D extends ProjectionDependencies, T, State = never> = {\n readonly values: ProjectionValues<D>;\n readonly changes: ProjectionChanges<D>;\n readonly previous: T | undefined;\n readonly reset: boolean;\n readonly cause: unknown;\n} & RetainedStateContext<State>;\n\nexport type IncrementalValueDefinition<D extends ProjectionDependencies, T, State = never> = {\n readonly process: (context: IncrementalValueContext<D, T, State>) => T;\n} & RetainedStateDefinition<State>;\n\nexport type IncrementalCollectionContext<\n D extends ProjectionDependencies,\n K extends string,\n V,\n State = never,\n> = {\n readonly values: ProjectionValues<D>;\n readonly changes: ProjectionChanges<D>;\n readonly previous: CollectionRead<K, V>;\n readonly next: CollectionRead<K, V>;\n readonly reset: boolean;\n readonly cause: unknown;\n readonly output: CollectionDraft<K, V>;\n} & RetainedStateContext<State>;\n\nexport type IncrementalCollectionDefinition<\n D extends ProjectionDependencies,\n K extends string,\n V,\n State = never,\n> = {\n readonly process: (context: IncrementalCollectionContext<D, K, V, State>) => void;\n} & RetainedStateDefinition<State>;\n\nexport type IncrementalKeyedContext<K extends string, V, D extends object, State = never> = {\n readonly key: K;\n readonly value: V;\n readonly dependencies: KeyedDependencyValues<D>;\n readonly reset: boolean;\n readonly cause: unknown;\n} & RetainedStateContext<State>;\n\nexport type IncrementalKeyedDefinition<K extends string, V, D extends object, T, State = never> = {\n readonly equality?: (previous: T, next: T) => boolean;\n readonly process: (context: IncrementalKeyedContext<K, V, D, State>) => T;\n} & ([State] extends [never]\n ? { readonly state?: never }\n : { readonly state: (value: V, key: K) => State });\n\ndeclare const groupOutput: unique symbol;\n\n/** Type-only declaration token used by incremental.group output builders. */\nexport type IncrementalGroupOutput<P extends Projection<unknown>> = {\n readonly [groupOutput]: P;\n};\n\ntype GroupOutputShape = {\n readonly [name: string]: IncrementalGroupOutput<Projection<unknown>> | GroupOutputShape;\n};\n\ntype GroupOutputBuilder = {\n collection<K extends string, V>(\n equality?: (previous: V, next: V) => boolean\n ): IncrementalGroupOutput<KeyedProjection<K, V>>;\n value<T>(equality?: (previous: T, next: T) => boolean): IncrementalGroupOutput<Projection<T>>;\n};\n\n/** Portable projection tree returned from an incremental.group declaration. */\nexport type IncrementalGroupResult<O> =\n O extends IncrementalGroupOutput<infer P>\n ? P\n : O extends Readonly<Record<string, unknown>>\n ? { readonly [K in keyof O]: IncrementalGroupResult<O[K]> }\n : never;\n\ntype GroupReads<O> =\n O extends IncrementalGroupOutput<infer P>\n ? P extends KeyedProjection<infer K, infer V>\n ? CollectionRead<K, V>\n : P extends Projection<infer T>\n ? T | undefined\n : never\n : { readonly [K in keyof O]: GroupReads<O[K]> };\n\ntype GroupDrafts<O> =\n O extends IncrementalGroupOutput<infer P>\n ? P extends KeyedProjection<infer K, infer V>\n ? CollectionDraft<K, V>\n : P extends Projection<infer T>\n ? { set(value: T): void }\n : never\n : { readonly [K in keyof O]: GroupDrafts<O[K]> };\n\nexport type IncrementalGroupContext<\n D extends ProjectionDependencies,\n O extends GroupOutputShape,\n State = never,\n> = {\n readonly values: ProjectionValues<D>;\n readonly changes: ProjectionChanges<D>;\n readonly previous: GroupReads<O>;\n readonly next: GroupReads<O>;\n readonly output: GroupDrafts<O>;\n readonly reset: boolean;\n readonly cause: unknown;\n} & RetainedStateContext<State>;\n\ntype IncrementalGroupDefinition<\n D extends ProjectionDependencies,\n O extends GroupOutputShape,\n State = never,\n> = {\n readonly output: (define: GroupOutputBuilder) => O;\n readonly process: (context: IncrementalGroupContext<D, O, State>) => void;\n} & RetainedStateDefinition<State>;\n\nconst resetCollectionChange = Object.freeze({ kind: 'reset' as const });\n\nconst publicValue = (source: SourceContext): unknown =>\n source.kind === 'value' ? source.value : collectionView(source.read);\n\nconst publicInputs = (\n sources: readonly SourceContext[],\n names: readonly string[],\n reset: boolean\n): {\n readonly values: Readonly<Record<string, unknown>>;\n readonly changes: Readonly<Record<string, unknown>>;\n} => {\n const values: Record<string, unknown> = Object.create(null) as Record<string, unknown>;\n const changes: Record<string, unknown> = Object.create(null) as Record<string, unknown>;\n for (let index = 0; index < names.length; index++) {\n const source = sources[index];\n values[names[index]] = publicValue(source);\n changes[names[index]] =\n source.kind === 'collection' ? (reset ? resetCollectionChange : source.change) : undefined;\n }\n return Object.freeze({ values: Object.freeze(values), changes: Object.freeze(changes) });\n};\n\nfunction validateDefinition(\n definition: unknown,\n allowed: readonly string[],\n label: string\n): asserts definition is Record<string, unknown> {\n if (!isPlainObject(definition))\n throw new TypeError(`${label} definition must be a plain object.`);\n const allowedKeys = new Set(allowed);\n for (const key of Reflect.ownKeys(definition)) {\n if (typeof key !== 'string' || !allowedKeys.has(key))\n throw new TypeError(`${label} definition contains an unknown property.`);\n const descriptor = Object.getOwnPropertyDescriptor(definition, key);\n if (!descriptor?.enumerable || !('value' in descriptor))\n throw new TypeError(`${label} definition must contain enumerable data properties.`);\n }\n}\n\nconst validateRetainedState = (definition: Record<string, unknown>, label: string): void => {\n if (\n Object.prototype.hasOwnProperty.call(definition, 'state') &&\n typeof definition.state !== 'function'\n )\n throw new TypeError(`${label} state must be a function when provided.`);\n};\n\nconst initializeRetainedState = (definition: {\n readonly state?: () => unknown;\n}): Readonly<Record<string, unknown>> => {\n if (definition.state === undefined) return Object.freeze({});\n const state = definition.state();\n assertSynchronous(state);\n return Object.freeze({ state });\n};\n\ntype RuntimeIncrementalDefinition<Result> = {\n readonly state?: () => unknown;\n readonly process: (context: never) => Result;\n};\n\nfunction createIncrementalValue<const D extends ProjectionDependencies, T>(\n dependencies: D,\n definition: IncrementalValueDefinition<D, T>\n): Projection<T>;\nfunction createIncrementalValue<const D extends ProjectionDependencies, T, State>(\n dependencies: D,\n definition: {\n readonly state: () => State;\n readonly process: (context: IncrementalValueContext<D, T, State>) => T;\n }\n): Projection<T>;\nfunction createIncrementalValue<const D extends ProjectionDependencies, T>(\n dependencies: D,\n definition: RuntimeIncrementalDefinition<T>\n): Projection<T> {\n const compiled = compileProjectionDependencies(dependencies, 'Incremental');\n validateDefinition(definition, ['state', 'process'], 'Incremental value');\n validateRetainedState(definition, 'Incremental value');\n if (typeof definition.process !== 'function')\n throw new TypeError('Incremental value definition requires a process function.');\n const [projection] = defineProcessor({\n dependencies: compiled.projections,\n outputs: [{ kind: 'value', equality: Object.is }],\n create: () => {\n const state = initializeRetainedState(definition);\n return {\n evaluate: evaluation => {\n const output = evaluation.outputs[0];\n if (output.kind !== 'value') throw new Error('Incremental value output is invalid.');\n const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);\n const result = definition.process({\n values: publicInput.values as ProjectionValues<D>,\n changes: publicInput.changes as ProjectionChanges<D>,\n previous: output.previous as T | undefined,\n reset: evaluation.reset,\n cause: evaluation.cause,\n ...state,\n } as never);\n assertSynchronous(result);\n output.output.set(result);\n },\n };\n },\n });\n return projection as Projection<T>;\n}\n\nfunction createIncrementalCollection<const D extends ProjectionDependencies, K extends string, V>(\n dependencies: D,\n definition: IncrementalCollectionDefinition<D, K, V>\n): KeyedProjection<K, V>;\nfunction createIncrementalCollection<\n const D extends ProjectionDependencies,\n K extends string,\n V,\n State,\n>(\n dependencies: D,\n definition: {\n readonly state: () => State;\n readonly process: (context: IncrementalCollectionContext<D, K, V, State>) => void;\n }\n): KeyedProjection<K, V>;\nfunction createIncrementalCollection<const D extends ProjectionDependencies, K extends string, V>(\n dependencies: D,\n definition: RuntimeIncrementalDefinition<void>\n): KeyedProjection<K, V> {\n const compiled = compileProjectionDependencies(dependencies, 'Incremental');\n validateDefinition(definition, ['state', 'process'], 'Incremental collection');\n validateRetainedState(definition, 'Incremental collection');\n if (typeof definition.process !== 'function')\n throw new TypeError('Incremental collection definition requires a process function.');\n const [projection] = defineProcessor({\n dependencies: compiled.projections,\n outputs: [{ kind: 'collection', equality: Object.is }],\n create: () => {\n const state = initializeRetainedState(definition);\n return {\n evaluate: evaluation => {\n const output = evaluation.outputs[0];\n if (output.kind !== 'collection')\n throw new Error('Incremental collection output is invalid.');\n const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);\n const result = definition.process({\n values: publicInput.values as ProjectionValues<D>,\n changes: publicInput.changes as ProjectionChanges<D>,\n previous: output.previous as CollectionRead<K, V>,\n next: output.next as CollectionRead<K, V>,\n reset: evaluation.reset,\n cause: evaluation.cause,\n output: output.output as CollectionDraft<K, V>,\n ...state,\n } as never);\n assertSynchronous(result);\n },\n };\n },\n });\n return projection as KeyedProjection<K, V>;\n}\n\nfunction createIncrementalKeyed<K extends string, V, const D extends object, T, State>(\n driver: KeyedProjection<K, V>,\n dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>,\n definition: {\n readonly state: (value: NoInfer<V>, key: NoInfer<K>) => State;\n readonly equality?: (previous: T, next: T) => boolean;\n readonly process: (context: IncrementalKeyedContext<NoInfer<K>, NoInfer<V>, D, State>) => T;\n }\n): KeyedProjection<K, T>;\nfunction createIncrementalKeyed<K extends string, V, const D extends object, T>(\n driver: KeyedProjection<K, V>,\n dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>,\n definition: {\n readonly equality?: (previous: T, next: T) => boolean;\n readonly process: (context: IncrementalKeyedContext<NoInfer<K>, NoInfer<V>, D>) => T;\n }\n): KeyedProjection<K, T>;\nfunction createIncrementalKeyed<K extends string, V, T>(\n driver: KeyedProjection<K, V>,\n dependencies: KeyedDependencyRecord<K, V>,\n definition: {\n readonly state?: (value: V, key: K) => unknown;\n readonly equality?: (previous: T, next: T) => boolean;\n readonly process: (context: never) => T;\n }\n): KeyedProjection<K, T> {\n validateDefinition(definition, ['state', 'equality', 'process'], 'Incremental keyed');\n if (definition.state !== undefined && typeof definition.state !== 'function')\n throw new TypeError('Incremental keyed state must be a function when provided.');\n if (definition.equality !== undefined && typeof definition.equality !== 'function')\n throw new TypeError('Incremental keyed equality must be a function when provided.');\n if (typeof definition.process !== 'function')\n throw new TypeError('Incremental keyed definition requires a process function.');\n\n return createKeyedTransform<K, V, T, unknown>({\n source: driver,\n dependencies,\n equality: definition.equality,\n name: 'incremental.keyed',\n ...(definition.state ? { state: definition.state } : {}),\n evaluate: ({ key, value, dependencies: values, state, reset, cause }) =>\n definition.process({\n key,\n value,\n dependencies: values,\n reset,\n cause,\n ...(definition.state ? { state } : {}),\n } as never),\n });\n}\n\ntype GroupShape = number | { readonly [key: string]: GroupShape };\ntype GroupOutputMetadata = {\n readonly kind: OutputDefinition['kind'];\n readonly equality: (a: unknown, b: unknown) => boolean;\n};\n\nconst isPlainGroupNamespace = (\n value: unknown,\n metadata: ReadonlyMap<object, GroupOutputMetadata>\n): value is Record<string, unknown> => isPlainObject(value) && !metadata.has(value);\n\nconst compileGroupShape = (\n value: unknown,\n path: readonly string[],\n metadata: ReadonlyMap<object, GroupOutputMetadata>,\n used: Set<object>,\n outputs: OutputDefinition[]\n): GroupShape => {\n if (value !== null && typeof value === 'object') {\n const output = metadata.get(value);\n if (output) {\n if (used.has(value)) throw new TypeError('An incremental group output cannot be reused.');\n used.add(value);\n const index = outputs.length;\n outputs.push({\n kind: output.kind,\n equality: output.equality,\n path: Object.freeze([...path]),\n });\n return index;\n }\n }\n if (!isPlainGroupNamespace(value, metadata))\n throw new TypeError('Incremental group outputs must be a static object tree.');\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key !== 'string')\n throw new TypeError('Incremental group output names must be strings.');\n if (!Object.prototype.propertyIsEnumerable.call(value, key))\n throw new TypeError('Incremental group namespaces must contain enumerable properties.');\n }\n const keys = Object.keys(value);\n if (!keys.length) throw new TypeError('Incremental group namespaces cannot be empty.');\n const result: Record<string, GroupShape> = Object.create(null) as Record<string, GroupShape>;\n for (const key of keys) {\n if (key === '__proto__' || key === 'prototype' || key === 'constructor')\n throw new TypeError(`Invalid incremental group output name: ${key}`);\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (!descriptor || !('value' in descriptor))\n throw new TypeError('Incremental group namespaces cannot contain accessors.');\n result[key] = compileGroupShape(descriptor.value, [...path, key], metadata, used, outputs);\n }\n return Object.freeze(result);\n};\n\nconst hydrateGroupShape = <T>(shape: GroupShape, values: readonly T[]): unknown => {\n if (typeof shape === 'number') return values[shape];\n const result: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(shape)) result[key] = hydrateGroupShape(child, values);\n return Object.freeze(result);\n};\n\nconst hydrateGroupReads = (\n shape: GroupShape,\n outputs: readonly OutputEvaluation[],\n next: boolean\n): unknown => {\n if (typeof shape === 'number') {\n const output = outputs[shape];\n return next && output.kind === 'value' ? output.next() : next ? output.next : output.previous;\n }\n const result: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(shape)) {\n if (typeof child === 'number' && next && outputs[child].kind === 'value') {\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: false,\n get: () => (outputs[child] as Extract<OutputEvaluation, { kind: 'value' }>).next(),\n });\n } else result[key] = hydrateGroupReads(child, outputs, next);\n }\n return Object.freeze(result);\n};\n\nfunction createIncrementalGroup<\n const D extends ProjectionDependencies,\n const O extends GroupOutputShape,\n>(dependencies: D, definition: IncrementalGroupDefinition<D, O>): IncrementalGroupResult<O>;\nfunction createIncrementalGroup<\n const D extends ProjectionDependencies,\n const O extends GroupOutputShape,\n State,\n>(\n dependencies: D,\n definition: {\n readonly output: (define: GroupOutputBuilder) => O;\n readonly state: () => State;\n readonly process: (context: IncrementalGroupContext<D, O, State>) => void;\n }\n): IncrementalGroupResult<O>;\nfunction createIncrementalGroup<\n const D extends ProjectionDependencies,\n const O extends GroupOutputShape,\n>(\n dependencies: D,\n definition: RuntimeIncrementalDefinition<void> & {\n readonly output: (define: GroupOutputBuilder) => O;\n }\n): IncrementalGroupResult<O> {\n const compiled = compileProjectionDependencies(dependencies, 'Incremental');\n validateDefinition(definition, ['output', 'state', 'process'], 'Incremental group');\n validateRetainedState(definition, 'Incremental group');\n if (typeof definition.output !== 'function' || typeof definition.process !== 'function')\n throw new TypeError('Incremental group definition requires output and process functions.');\n\n let active = true;\n const metadata = new Map<object, GroupOutputMetadata>();\n const defineOutput: GroupOutputBuilder = {\n collection: <K extends string, V>(equality: (previous: V, next: V) => boolean = Object.is) => {\n if (!active) throw new TypeError('Incremental group output declarations are synchronous.');\n const descriptor = Object.freeze({});\n metadata.set(descriptor, {\n kind: 'collection',\n equality: equality as (a: unknown, b: unknown) => boolean,\n });\n return descriptor as IncrementalGroupOutput<KeyedProjection<K, V>>;\n },\n value: <T>(equality: (previous: T, next: T) => boolean = Object.is) => {\n if (!active) throw new TypeError('Incremental group output declarations are synchronous.');\n const descriptor = Object.freeze({});\n metadata.set(descriptor, {\n kind: 'value',\n equality: equality as (a: unknown, b: unknown) => boolean,\n });\n return descriptor as IncrementalGroupOutput<Projection<T>>;\n },\n };\n const declared = definition.output(defineOutput);\n assertSynchronous(declared);\n active = false;\n const outputs: OutputDefinition[] = [];\n const used = new Set<object>();\n const shape = compileGroupShape(declared, [], metadata, used, outputs);\n if (typeof shape === 'number')\n throw new TypeError('Incremental group declarations must return an output namespace.');\n if (used.size === 0 || used.size !== metadata.size)\n throw new TypeError('Every incremental group output must be returned by the declaration.');\n\n const projections = defineProcessor({\n dependencies: compiled.projections,\n outputs,\n create: () => {\n const state = initializeRetainedState(definition);\n return {\n evaluate: evaluation => {\n const publicInput = publicInputs(evaluation.sources, compiled.names, evaluation.reset);\n const result = definition.process({\n values: publicInput.values as ProjectionValues<D>,\n changes: publicInput.changes as ProjectionChanges<D>,\n previous: hydrateGroupReads(shape, evaluation.outputs, false) as GroupReads<O>,\n next: hydrateGroupReads(shape, evaluation.outputs, true) as GroupReads<O>,\n output: hydrateGroupShape(\n shape,\n evaluation.outputs.map(output => output.output)\n ) as GroupDrafts<O>,\n reset: evaluation.reset,\n cause: evaluation.cause,\n ...state,\n } as never);\n assertSynchronous(result);\n },\n };\n },\n name: `processor-group:${outputs.map(output => output.path?.join('.') ?? '').join(',')}`,\n });\n return hydrateGroupShape(shape, projections) as IncrementalGroupResult<O>;\n}\n\nexport const incremental = Object.assign(createIncrementalValue, {\n collection: createIncrementalCollection,\n keyed: createIncrementalKeyed,\n group: createIncrementalGroup,\n});\n\nexport { collectionChange } from '@/projection/collection/change';\nexport type { CollectionChange } from './contract';\n"],"mappings":";;;AA2JA,MAAM,wBAAwB,OAAO,OAAO,EAAE,MAAM,SAAkB,CAAC;AAEvE,MAAM,eAAe,WACnB,OAAO,SAAS,UAAU,OAAO,QAAQ,eAAe,OAAO,KAAK;AAEtE,MAAM,gBACJ,SACA,OACA,UAIG;CACH,MAAM,SAAkC,OAAO,OAAO,KAAK;CAC3D,MAAM,UAAmC,OAAO,OAAO,KAAK;AAC5D,MAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;EACjD,MAAM,SAAS,QAAQ;AACvB,SAAO,MAAM,UAAU,YAAY,OAAO;AAC1C,UAAQ,MAAM,UACZ,OAAO,SAAS,eAAgB,QAAQ,wBAAwB,OAAO,SAAU,KAAA;;AAErF,QAAO,OAAO,OAAO;EAAE,QAAQ,OAAO,OAAO,OAAO;EAAE,SAAS,OAAO,OAAO,QAAQ;EAAE,CAAC;;AAG1F,SAAS,mBACP,YACA,SACA,OAC+C;AAC/C,KAAI,CAAC,cAAc,WAAW,CAC5B,OAAM,IAAI,UAAU,GAAG,MAAM,qCAAqC;CACpE,MAAM,cAAc,IAAI,IAAI,QAAQ;AACpC,MAAK,MAAM,OAAO,QAAQ,QAAQ,WAAW,EAAE;AAC7C,MAAI,OAAO,QAAQ,YAAY,CAAC,YAAY,IAAI,IAAI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H,MAAM,mBAAmB,QAAQ,KAAI,WAAU,OAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC,KAAK,IAAI;EACvF,CAC0C,CAAC;;AAG9C,MAAa,cAAc,OAAO,OAAO,wBAAwB;CAC/D,YAAY;CACZ,OAAO;CACP,OAAO;CACR,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"driver-B7RR-VfX.js","names":["issue.fail","tree.validNode"],"sources":["../core/src/tree/topology.ts","../core/src/mutation/issue.ts","../core/src/address/index.ts","../core/src/mutation/changes.ts","../core/src/runtime/context.ts","../core/src/runtime/driver.ts"],"sourcesContent":["import { isRecord } from '@/value/record';\nexport type MutableTreeNode = { parentId?: string; children: string[]; value?: unknown };\nexport type MutableTree = { rootId?: string; nodes: Record<string, MutableTreeNode> };\nconst node = (tree: MutableTree, id: string) =>\n Object.hasOwn(tree.nodes, id) ? tree.nodes[id] : undefined;\nexport const is = (value: unknown): value is MutableTree =>\n isRecord(value) && isRecord(value.nodes);\n\nexport const validNode = (value: unknown): value is MutableTreeNode => {\n if (!isRecord(value) || !Array.isArray(value.children)) return false;\n if (value.parentId !== undefined && typeof value.parentId !== 'string') return false;\n const children = new Set<string>();\n for (const id of value.children) {\n if (typeof id !== 'string' || children.has(id)) return false;\n children.add(id);\n }\n return true;\n};\n\nexport const contains = (tree: MutableTree, id: string): boolean => Object.hasOwn(tree.nodes, id);\n\nexport const parent = (tree: MutableTree, id: string): string | undefined =>\n node(tree, id)?.parentId;\n\nexport const children = (tree: MutableTree, id: string): readonly string[] | undefined =>\n node(tree, id)?.children;\n\nexport const validate = (value: unknown): value is MutableTree => {\n if (!is(value)) return false;\n const ids = Object.keys(value.nodes);\n if (ids.length === 0) return value.rootId === undefined;\n if (typeof value.rootId !== 'string' || !Object.hasOwn(value.nodes, value.rootId)) return false;\n\n for (const id of ids) {\n const entry = value.nodes[id];\n if (!validNode(entry)) return false;\n if (id === value.rootId) {\n if (entry.parentId !== undefined) return false;\n } else if (entry.parentId === undefined || !Object.hasOwn(value.nodes, entry.parentId))\n return false;\n for (const child of entry.children) {\n const childNode = value.nodes[child];\n if (!childNode || childNode.parentId !== id) return false;\n }\n }\n\n const seen = new Set<string>();\n const stack = [value.rootId];\n while (stack.length) {\n const id = stack.pop() as string;\n if (seen.has(id)) return false;\n seen.add(id);\n const entry = value.nodes[id];\n if (!entry) return false;\n for (const child of entry.children) stack.push(child);\n }\n return seen.size === ids.length;\n};\n\nexport type TreePosition = { readonly parentId?: string; readonly index?: number };\n","import type { DocumentAddress } from '@/schema/model';\nimport type { ParseIssue } from '@/schema/value';\n\nexport type MutationIssueCode =\n | 'invalid-address'\n | 'invalid-value'\n | 'invalid-key'\n | 'invalid-changes'\n | 'baseline-mismatch'\n | 'required-field'\n | 'invalid-anchor'\n | 'duplicate-entity'\n | 'missing-entity'\n | 'invalid-collection'\n | 'invalid-list-keys'\n | 'invalid-list-key'\n | 'duplicate-list-item'\n | 'missing-list-item'\n | 'invalid-tree'\n | 'duplicate-tree-node'\n | 'missing-tree-parent'\n | 'invalid-tree-index'\n | 'missing-tree-node'\n | 'tree-cycle';\nexport type MutationIssue = {\n readonly source: 'mutation';\n readonly code: MutationIssueCode;\n readonly address: DocumentAddress;\n readonly message: string;\n};\nexport const at = (\n address: DocumentAddress,\n code: MutationIssueCode,\n message: string\n): MutationIssue =>\n Object.freeze({ source: 'mutation', code, address: Object.freeze([...address]), message });\nexport class MutationRejected extends Error {\n constructor(readonly issue: MutationIssue) {\n super(issue.message);\n }\n}\nexport const fail = (address: DocumentAddress, code: MutationIssueCode, message: string): never => {\n throw new MutationRejected(at(address, code, message));\n};\n\nexport const invalidValue = (issue: ParseIssue, address = issue.address): never =>\n fail(address, issue.code === 'missing-validator' ? 'invalid-value' : issue.code, issue.message);\n","import type { DocumentAddress } from '@/schema/model';\n\ntype AddressIndexNode<T> = {\n readonly children: Map<string, AddressIndexNode<T>>;\n readonly values: Set<T>;\n};\n\nexport class AddressIndex<T> {\n private readonly root: AddressIndexNode<T> = { children: new Map(), values: new Set() };\n\n add(address: DocumentAddress, value: T, member?: string): void {\n let node = this.root;\n for (let index = 0; index < address.length + (member === undefined ? 0 : 1); index++) {\n const segment = index < address.length ? address[index] : member!;\n let child = node.children.get(segment);\n if (!child) {\n child = { children: new Map(), values: new Set() };\n node.children.set(segment, child);\n }\n node = child;\n }\n node.values.add(value);\n }\n\n delete(address: DocumentAddress, value: T, member?: string): void {\n const parents: AddressIndexNode<T>[] = [];\n let node = this.root;\n const length = address.length + (member === undefined ? 0 : 1);\n for (let index = 0; index < length; index++) {\n const segment = index < address.length ? address[index] : member!;\n const child = node.children.get(segment);\n if (!child) return;\n parents.push(node);\n node = child;\n }\n node.values.delete(value);\n for (let index = length - 1; index >= 0 && !node.values.size && !node.children.size; index--) {\n node = parents[index];\n node.children.delete(index < address.length ? address[index] : member!);\n }\n }\n\n exact(address: DocumentAddress): ReadonlySet<T> | undefined {\n let node = this.root;\n for (const segment of address) {\n const child = node.children.get(segment);\n if (!child) return undefined;\n node = child;\n }\n return node.values;\n }\n\n hasAncestor(address: DocumentAddress, strict = false): boolean {\n let node = this.root;\n for (let index = 0; index < address.length; index++) {\n if (node.values.size) return true;\n const child = node.children.get(address[index]);\n if (!child) return false;\n node = child;\n }\n return !strict && node.values.size > 0;\n }\n\n someAncestor(address: DocumentAddress, predicate: (value: T) => boolean): boolean {\n let node = this.root;\n for (let index = 0; ; index++) {\n for (const value of node.values) if (predicate(value)) return true;\n if (index === address.length) return false;\n const child = node.children.get(address[index]);\n if (!child) return false;\n node = child;\n }\n }\n\n overlaps(address: DocumentAddress, member?: string): boolean {\n let node = this.root;\n const length = address.length + (member === undefined ? 0 : 1);\n for (let index = 0; index < length; index++) {\n if (node.values.size) return true;\n const segment = index < address.length ? address[index] : member!;\n const child = node.children.get(segment);\n if (!child) return false;\n node = child;\n }\n return node.values.size > 0 || node.children.size > 0;\n }\n\n hasDescendant(address: DocumentAddress, member?: string): boolean {\n let node = this.root;\n const length = address.length + (member === undefined ? 0 : 1);\n for (let index = 0; index < length; index++) {\n const segment = index < address.length ? address[index] : member!;\n const child = node.children.get(segment);\n if (!child) return false;\n node = child;\n }\n return node.values.size > 0 || node.children.size > 0;\n }\n\n /** Visit one address' ancestors and descendants without batch de-duplication state. */\n forEachOverlap(address: DocumentAddress, visit: (value: T) => void): void {\n let node = this.root;\n for (const segment of address) {\n node.values.forEach(visit);\n const child = node.children.get(segment);\n if (!child) return;\n node = child;\n }\n const descend = (current: AddressIndexNode<T>): void => {\n current.values.forEach(visit);\n current.children.forEach(descend);\n };\n descend(node);\n }\n\n query(\n visit: (value: T) => void,\n relation: 'overlap' | 'ancestors' | 'descendants' = 'overlap'\n ): (address: DocumentAddress, members?: readonly { readonly key: string }[]) => void {\n const visited = new Set<AddressIndexNode<T>>();\n const subtrees = new Set<AddressIndexNode<T>>();\n const values = (node: AddressIndexNode<T>) => {\n if (visited.has(node)) return;\n visited.add(node);\n node.values.forEach(visit);\n };\n const descend = (current: AddressIndexNode<T>): void => {\n if (subtrees.has(current)) return;\n subtrees.add(current);\n values(current);\n current.children.forEach(descend);\n };\n const terminal = (node: AddressIndexNode<T>) =>\n relation === 'ancestors' ? values(node) : descend(node);\n return (address, members) => {\n let node = this.root;\n for (const segment of address) {\n if (subtrees.has(node)) return;\n if (relation !== 'descendants') values(node);\n const child = node.children.get(segment);\n if (!child) return;\n node = child;\n }\n if (!members) terminal(node);\n else {\n if (relation !== 'descendants') values(node);\n for (const member of members) {\n const child = node.children.get(member.key);\n if (child) terminal(child);\n }\n }\n };\n }\n\n clear(): void {\n this.root.values.clear();\n this.root.children.clear();\n }\n}\n","import type { Change, ChangeSet, MemberChange, ValueTransition } from '@/changes';\nimport { AddressIndex } from '@/address/index';\nimport { isPlainObject } from '@/value/record';\nimport * as issue from './issue';\nimport * as tree from '@/tree/topology';\n\nconst validated = new WeakSet<ChangeSet>();\n\nconst compareChanges = (a: Change, b: Change): number => {\n if (a.kind === 'reset' || b.kind === 'reset')\n return a.kind === b.kind ? 0 : a.kind === 'reset' ? -1 : 1;\n const length = Math.min(a.at.length, b.at.length);\n for (let i = 0; i < length; i++) if (a.at[i] !== b.at[i]) return lexical(a.at[i], b.at[i]);\n return a.at.length - b.at.length || lexical(a.kind, b.kind);\n};\n\nconst publication = (changes: Change[]): ChangeSet => {\n const result = { changes };\n validated.add(result);\n return result;\n};\n\n/** Register complete recorder groups; unknown input is validated separately. */\nexport const sealChanges = (changes: Change[]): ChangeSet => {\n changes.sort(compareChanges);\n return publication(changes);\n};\n\nconst keys = (value: Record<string, unknown>, expected: readonly string[]) =>\n Object.keys(value).every(key => expected.includes(key));\nconst strings = (value: unknown): value is readonly string[] => {\n if (!Array.isArray(value)) return false;\n for (const item of value) if (typeof item !== 'string') return false;\n return true;\n};\nconst order = (value: unknown): value is readonly string[] =>\n strings(value) && new Set(value).size === value.length;\nconst transition = (\n value: unknown,\n key: 'key' | 'id'\n): value is ValueTransition & Record<string, unknown> => {\n if (!isPlainObject(value) || typeof value[key] !== 'string') return false;\n if (value.kind === 'added')\n return keys(value, ['kind', key, 'after']) && Object.hasOwn(value, 'after');\n if (value.kind === 'removed')\n return keys(value, ['kind', key, 'before']) && Object.hasOwn(value, 'before');\n return (\n value.kind === 'updated' &&\n keys(value, ['kind', key, 'before', 'after']) &&\n Object.hasOwn(value, 'before') &&\n Object.hasOwn(value, 'after')\n );\n};\nconst lexical = (a: string, b: string) => (a < b ? -1 : a === b ? 0 : 1);\n\n/** The sole unknown ChangeSet boundary, including normalized logical-address conflicts. */\nexport const decodeChanges = (input: unknown): ChangeSet => {\n if (typeof input === 'object' && input !== null && validated.has(input as ChangeSet))\n return input as ChangeSet;\n if (!isPlainObject(input) || !keys(input, ['changes']) || !Array.isArray(input.changes))\n return issue.fail([], 'invalid-changes', 'Expected a ChangeSet.');\n const result: Change[] = [];\n for (const entry of input.changes) {\n if (!isPlainObject(entry)) return issue.fail([], 'invalid-changes', 'Expected a change.');\n if (entry.kind === 'reset') {\n if (\n input.changes.length !== 1 ||\n !keys(entry, ['kind', 'before', 'after']) ||\n !Object.hasOwn(entry, 'before') ||\n !Object.hasOwn(entry, 'after')\n )\n return issue.fail(\n [],\n 'invalid-changes',\n 'A reset must be the only change and contain both values.'\n );\n return sealChanges([{ kind: 'reset', before: entry.before, after: entry.after }]);\n }\n if (!strings(entry.at))\n return issue.fail([], 'invalid-changes', 'Change addresses must contain strings.');\n const at = entry.at;\n if (\n entry.kind === 'members' &&\n keys(entry, ['kind', 'at', 'members', 'order']) &&\n Array.isArray(entry.members) &&\n (entry.members.length || Object.hasOwn(entry, 'order'))\n ) {\n const seen = new Set<string>();\n const members: MemberChange[] = [];\n for (const member of entry.members) {\n if (!transition(member, 'key') || typeof member.key !== 'string' || seen.has(member.key))\n return issue.fail(at, 'invalid-changes', 'Malformed or duplicate member transition.');\n seen.add(member.key);\n members.push({ ...member, key: member.key });\n }\n const change: Extract<Change, { kind: 'members' }> = {\n kind: 'members',\n at,\n members: members.sort((a, b) => lexical(a.key, b.key)),\n };\n if (Object.hasOwn(entry, 'order')) {\n if (\n !isPlainObject(entry.order) ||\n !keys(entry.order, ['before', 'after']) ||\n !order(entry.order.before) ||\n !order(entry.order.after)\n )\n return issue.fail(at, 'invalid-changes', 'Malformed container order.');\n result.push({ ...change, order: { before: entry.order.before, after: entry.order.after } });\n } else result.push(change);\n } else if (\n entry.kind === 'tree' &&\n keys(entry, ['kind', 'at', 'before', 'after', 'nodes']) &&\n (entry.before === null || typeof entry.before === 'string') &&\n (entry.after === null || typeof entry.after === 'string') &&\n Array.isArray(entry.nodes)\n ) {\n const seen = new Set<string>();\n for (const node of entry.nodes) {\n if (\n !transition(node, 'id') ||\n typeof node.id !== 'string' ||\n seen.has(node.id) ||\n (node.kind !== 'added' && !tree.validNode(node.before)) ||\n (node.kind !== 'removed' && !tree.validNode(node.after))\n )\n return issue.fail(at, 'invalid-changes', 'Malformed or duplicate tree transition.');\n seen.add(node.id);\n }\n const nodes = entry.nodes as Extract<Change, { kind: 'tree' }>['nodes'];\n result.push({\n kind: 'tree',\n at,\n before: entry.before,\n after: entry.after,\n nodes: [...nodes].sort((a, b) => lexical(a.id, b.id)),\n });\n } else return issue.fail(at, 'invalid-changes', 'Unknown or malformed change.');\n }\n return publication(normalizeChanges(result));\n};\n\nconst normalizeChanges = (changes: Change[]): Change[] => {\n const sorted = changes.sort(compareChanges);\n const groups = new AddressIndex<true>();\n const replacements = new AddressIndex<true>();\n const orders = new AddressIndex<true>();\n for (const change of sorted) {\n if (change.kind === 'reset') continue;\n if (change.kind === 'members') {\n if (groups.exact(change.at)?.size)\n return issue.fail(change.at, 'invalid-changes', 'Duplicate member group.');\n groups.add(change.at, true);\n if (change.order) {\n if (replacements.hasAncestor(change.at))\n return issue.fail(change.at, 'invalid-changes', 'Overlapping container order.');\n orders.add(change.at, true);\n }\n for (const member of change.members) {\n if (\n replacements.overlaps(change.at, member.key) ||\n orders.hasDescendant(change.at, member.key)\n )\n return issue.fail(\n change.at.concat(member.key),\n 'invalid-changes',\n 'Overlapping member transitions.'\n );\n replacements.add(change.at, true, member.key);\n }\n } else if (change.kind === 'tree') {\n if (replacements.overlaps(change.at) || orders.hasDescendant(change.at))\n return issue.fail(change.at, 'invalid-changes', 'Overlapping tree transitions.');\n replacements.add(change.at, true);\n }\n }\n return sorted;\n};\n\nexport const changeCount = (changes: ChangeSet): number => {\n let count = 0;\n for (const change of changes.changes)\n count +=\n change.kind === 'members'\n ? change.members.length + (change.order ? 1 : 0)\n : change.kind === 'tree'\n ? 1 + change.nodes.length\n : 1;\n return count;\n};\n","import type { Infer, ObjectSchema, RootNodeOf } from '@/schema/model';\nimport type { DocumentRuntime } from './contract';\nimport type { RuntimeWriteDriver } from './driver';\nimport type { NotificationCenter } from './notification';\n\nexport type RuntimeState<TSchema extends ObjectSchema<object>> = {\n readonly schema: RootNodeOf<TSchema>;\n document: Infer<TSchema>;\n disposed: boolean;\n projectionLocks: number;\n};\n\nexport type RuntimeContext<TSchema extends ObjectSchema<object>> = {\n readonly state: RuntimeState<TSchema>;\n readonly owner: DocumentRuntime<TSchema>;\n readonly notifications: NotificationCenter<TSchema>;\n driver: RuntimeWriteDriver | undefined;\n bypassDepth: number;\n};\n\nconst contexts = new WeakMap<object, RuntimeContext<ObjectSchema<object>>>();\n\nexport const bindContext = <TSchema extends ObjectSchema<object>>(\n subject: object,\n context: RuntimeContext<TSchema>\n): void => {\n contexts.set(subject, context as unknown as RuntimeContext<ObjectSchema<object>>);\n};\n\nexport function contextOf<TSchema extends ObjectSchema<object>>(\n subject: object,\n required?: true\n): RuntimeContext<TSchema>;\nexport function contextOf<TSchema extends ObjectSchema<object>>(\n subject: object,\n required: false\n): RuntimeContext<TSchema> | undefined;\nexport function contextOf<TSchema extends ObjectSchema<object>>(\n subject: object,\n required = true\n): RuntimeContext<TSchema> | undefined {\n const context = contexts.get(subject);\n if (!context && required) throw new Error('Unknown Doxum runtime.');\n return context as unknown as RuntimeContext<TSchema> | undefined;\n}\n","import type { CommitSource, DocumentRuntime } from './contract';\nimport type { ObjectSchema } from '@/schema/model';\nimport { contextOf } from './context';\n\nexport type RuntimeWriteIntent =\n | { readonly kind: 'update'; readonly source: Extract<CommitSource, 'local' | 'system'> }\n | { readonly kind: 'apply'; readonly source: CommitSource }\n | { readonly kind: 'replace'; readonly source: Extract<CommitSource, 'system' | 'remote'> };\n\nexport type RuntimeWriteDriver = {\n readonly assertWritable: (intent: RuntimeWriteIntent) => void;\n};\n\nexport type RuntimeWriteDriverLease = {\n readonly run: <TResult>(run: () => TResult) => TResult;\n readonly dispose: () => void;\n};\n\nexport const assertRuntimeWritable = (runtime: object, intent: RuntimeWriteIntent): void => {\n const context = contextOf(runtime);\n if (context.bypassDepth === 0) context.driver?.assertWritable(intent);\n};\n\nexport const installRuntimeWriteDriver = <TSchema extends ObjectSchema<object>>(\n runtime: DocumentRuntime<TSchema>,\n driver: RuntimeWriteDriver\n): RuntimeWriteDriverLease => {\n const context = contextOf(runtime);\n if (context.driver) throw new Error('Doxum runtime already has a write driver.');\n context.driver = driver;\n let active = true;\n return Object.freeze({\n run: <TResult>(run: () => TResult): TResult => {\n if (!active) throw new Error('Doxum runtime write driver is no longer active.');\n context.bypassDepth += 1;\n try {\n return run();\n } finally {\n context.bypassDepth -= 1;\n }\n },\n dispose: (): void => {\n if (!active) return;\n active = false;\n if (context.driver === driver) context.driver = undefined;\n },\n });\n};\n"],"mappings":";;AAGA,MAAM,QAAQ,MAAmB,OAC/B,OAAO,OAAO,KAAK,OAAO,GAAG,GAAG,KAAK,MAAM,MAAM,KAAA;AACnD,MAAa,MAAM,UACjB,SAAS,MAAM,IAAI,SAAS,MAAM,MAAM;AAE1C,MAAa,aAAa,UAA6C;AACrE,KAAI,CAAC,SAAS,MAAM,IAAI,CAAC,MAAM,QAAQ,MAAM,SAAS,CAAE,QAAO;AAC/D,KAAI,MAAM,aAAa,KAAA,KAAa,OAAO,MAAM,aAAa,SAAU,QAAO;CAC/E,MAAM,2BAAW,IAAI,KAAa;AAClC,MAAK,MAAM,MAAM,MAAM,UAAU;AAC/B,MAAI,OAAO,OAAO,YAAY,SAAS,IAAI,GAAG,CAAE,QAAO;AACvD,WAAS,IAAI,GAAG;;AAElB,QAAO;;AAGT,MAAa,YAAY,MAAmB,OAAwB,OAAO,OAAO,KAAK,OAAO,GAAG;AAEjG,MAAa,UAAU,MAAmB,OACxC,KAAK,MAAM,GAAG,EAAE;AAElB,MAAa,YAAY,MAAmB,OAC1C,KAAK,MAAM,GAAG,EAAE;AAElB,MAAa,YAAY,UAAyC;AAChE,KAAI,CAAC,GAAG,MAAM,CAAE,QAAO;CACvB,MAAM,MAAM,OAAO,KAAK,MAAM,MAAM;AACpC,KAAI,IAAI,WAAW,EAAG,QAAO,MAAM,WAAW,KAAA;AAC9C,KAAI,OAAO,MAAM,WAAW,YAAY,CAAC,OAAO,OAAO,MAAM,OAAO,MAAM,OAAO,CAAE,QAAO;AAE1F,MAAK,MAAM,MAAM,KAAK;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