doxum 0.1.14 → 0.1.16
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 +12 -2
- package/dist/advanced.cjs +71 -21
- package/dist/advanced.cjs.map +1 -1
- package/dist/advanced.d.cts +14 -14
- package/dist/advanced.d.ts +14 -14
- package/dist/advanced.js +70 -20
- package/dist/advanced.js.map +1 -1
- package/dist/{contract-BT53Gg94.d.ts → contract-CATCCVu5.d.ts} +1 -1
- package/dist/{definition-DN6yW2vi.d.cts → definition-C__VJqA4.d.cts} +45 -8
- package/dist/{definition-Dr8tHwTD.d.ts → definition-Dc1Udkop.d.ts} +46 -9
- package/dist/definition-Z6TagMup.cjs +107 -0
- package/dist/definition-Z6TagMup.cjs.map +1 -0
- package/dist/definition-c6XQXzvK.js +72 -0
- package/dist/definition-c6XQXzvK.js.map +1 -0
- package/dist/index.cjs +2080 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -3
- package/dist/index.d.ts +17 -4
- package/dist/index.js +2027 -2
- package/dist/index.js.map +1 -1
- package/dist/{integration-WniqaEPW.cjs → integration-B7VDgAOJ.cjs} +4 -4
- package/dist/integration-B7VDgAOJ.cjs.map +1 -0
- package/dist/{integration-zB8e-uNP.js → integration-CxVhq-KD.js} +2 -2
- package/dist/integration-CxVhq-KD.js.map +1 -0
- package/dist/integration.cjs +4 -6
- package/dist/integration.d.cts +1 -2
- package/dist/integration.d.ts +2 -3
- package/dist/integration.js +3 -3
- package/dist/local-sync.d.ts +1 -1
- package/dist/notification-CDSUfiip.cjs +398 -0
- package/dist/notification-CDSUfiip.cjs.map +1 -0
- package/dist/notification-IQIJyH3Q.js +285 -0
- package/dist/notification-IQIJyH3Q.js.map +1 -0
- package/dist/react.cjs +6 -52
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +4 -50
- package/dist/react.js.map +1 -1
- package/dist/{definition-BDW6i7fp.cjs → scope-Ezs-Y3TY.cjs} +1 -106
- package/dist/scope-Ezs-Y3TY.cjs.map +1 -0
- package/dist/{definition-wOvuklwp.js → scope-d-L87NeC.js} +2 -71
- package/dist/scope-d-L87NeC.js.map +1 -0
- package/package.json +1 -1
- package/skills/doxum-runtime/references/projections.en.md +16 -8
- package/skills/doxum-runtime/references/projections.zh-CN.md +14 -7
- package/dist/definition-BDW6i7fp.cjs.map +0 -1
- package/dist/definition-wOvuklwp.js.map +0 -1
- package/dist/integration-WniqaEPW.cjs.map +0 -1
- package/dist/integration-zB8e-uNP.js.map +0 -1
- package/dist/store-6wMvZthf.cjs +0 -2399
- package/dist/store-6wMvZthf.cjs.map +0 -1
- package/dist/store-BCR20XSb.d.ts +0 -28
- package/dist/store-PLKs1KnS.js +0 -2220
- package/dist/store-PLKs1KnS.js.map +0 -1
- package/dist/store-jJ3SNYKH.d.cts +0 -28
|
@@ -6,6 +6,40 @@ type Cause = unknown;
|
|
|
6
6
|
type BatchOptions = {
|
|
7
7
|
readonly cause?: Cause;
|
|
8
8
|
};
|
|
9
|
+
type CollectionEntryTransition<K extends string, V> = {
|
|
10
|
+
readonly key: K;
|
|
11
|
+
readonly kind: 'added';
|
|
12
|
+
readonly before: undefined;
|
|
13
|
+
readonly after: V;
|
|
14
|
+
} | {
|
|
15
|
+
readonly key: K;
|
|
16
|
+
readonly kind: 'updated';
|
|
17
|
+
readonly before: V;
|
|
18
|
+
readonly after: V;
|
|
19
|
+
} | {
|
|
20
|
+
readonly key: K;
|
|
21
|
+
readonly kind: 'removed';
|
|
22
|
+
readonly before: V;
|
|
23
|
+
readonly after: undefined;
|
|
24
|
+
};
|
|
25
|
+
type CollectionChange<K extends string, V> = {
|
|
26
|
+
readonly kind: 'reset';
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: 'incremental';
|
|
29
|
+
readonly added: readonly Omit<Extract<CollectionEntryTransition<K, V>, {
|
|
30
|
+
readonly kind: 'added';
|
|
31
|
+
}>, 'before'>[];
|
|
32
|
+
readonly updated: readonly Extract<CollectionEntryTransition<K, V>, {
|
|
33
|
+
readonly kind: 'updated';
|
|
34
|
+
}>[];
|
|
35
|
+
readonly removed: readonly Omit<Extract<CollectionEntryTransition<K, V>, {
|
|
36
|
+
readonly kind: 'removed';
|
|
37
|
+
}>, 'after'>[];
|
|
38
|
+
readonly order?: {
|
|
39
|
+
readonly before: readonly K[];
|
|
40
|
+
readonly after: readonly K[];
|
|
41
|
+
};
|
|
42
|
+
};
|
|
9
43
|
type CollectionRead<K extends string, V> = {
|
|
10
44
|
get(key: K): V | undefined;
|
|
11
45
|
has(key: K): boolean;
|
|
@@ -69,18 +103,21 @@ declare class ProjectionDisposedError extends Error {
|
|
|
69
103
|
//#endregion
|
|
70
104
|
//#region core/src/projection/definition.d.ts
|
|
71
105
|
declare const projectionDefinition: unique symbol;
|
|
106
|
+
declare const projectionChanges: unique symbol;
|
|
72
107
|
declare const writableInput: unique symbol;
|
|
73
108
|
/** A lazy, reusable projection definition. Its value is materialized per runtime. */
|
|
74
|
-
type Projection<T> = {
|
|
109
|
+
type Projection<T, C = undefined> = {
|
|
75
110
|
readonly [projectionDefinition]: T;
|
|
111
|
+
readonly [projectionChanges]: C;
|
|
76
112
|
};
|
|
77
113
|
/** A runtime-local writable projection definition. */
|
|
78
114
|
type Input<T> = Projection<T> & {
|
|
79
115
|
readonly [writableInput]: true;
|
|
80
116
|
};
|
|
81
|
-
type ProjectionValues<D extends readonly Projection<unknown>[]> = { readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never };
|
|
117
|
+
type ProjectionValues<D extends readonly Projection<unknown, unknown>[]> = { readonly [K in keyof D]: D[K] extends Projection<infer T, unknown> ? T : never };
|
|
118
|
+
type ProjectionChanges<D extends readonly Projection<unknown, unknown>[]> = { readonly [K in keyof D]: D[K] extends Projection<unknown, infer C> ? [C] extends [undefined] ? undefined : C | undefined : undefined };
|
|
82
119
|
type PublicCollection<K extends string, V> = ReadonlyMap<K, V>;
|
|
83
|
-
type
|
|
120
|
+
type CollectionProjection<K extends string, V> = Projection<PublicCollection<K, V>, CollectionChange<K, V>>;
|
|
84
121
|
declare const input: <T>(initial: T, equality?: (previous: T, next: T) => boolean) => Input<T>;
|
|
85
122
|
/**
|
|
86
123
|
* Establishes a reactive boundary from a document, readable, or external
|
|
@@ -89,11 +126,11 @@ declare const input: <T>(initial: T, equality?: (previous: T, next: T) => boolea
|
|
|
89
126
|
*/
|
|
90
127
|
declare function observe<S extends ObjectNode>(document: DocumentReadable<S>): Projection<Infer<S>>;
|
|
91
128
|
declare function observe<T, D>(source: ExternalValueSource<T, D>): Projection<T>;
|
|
92
|
-
declare function observe<K extends string, V, D>(source: ExternalCollectionSource<K, V, D>):
|
|
129
|
+
declare function observe<K extends string, V, D>(source: ExternalCollectionSource<K, V, D>): CollectionProjection<K, V>;
|
|
93
130
|
declare function observe<T>(readable: Readable<T>): Projection<T>;
|
|
94
|
-
declare function observe<S extends ObjectNode, P extends CollectionPath>(document: DocumentReadable<S>, selector: (path: SchemaPath<S['shape']>) => P):
|
|
131
|
+
declare function observe<S extends ObjectNode, P extends CollectionPath>(document: DocumentReadable<S>, selector: (path: SchemaPath<S['shape']>) => P): CollectionProjection<CollectionId<P>, ReadonlyValue<Infer<CollectionNode<P>>>>;
|
|
95
132
|
declare function observe<S extends ObjectNode, P>(document: DocumentReadable<S>, selector: (path: SchemaPath<S['shape']>) => P): Projection<PathValueOf<P>>;
|
|
96
|
-
declare function derive<const D extends readonly Projection<unknown>[], T>(dependencies: D, compute: (...values: ProjectionValues<D>) => Synchronous<T>, equality?: (previous: T, next: T) => boolean): Projection<T>;
|
|
133
|
+
declare function derive<const D extends readonly Projection<unknown, unknown>[], T>(dependencies: D, compute: (...values: ProjectionValues<D>) => Synchronous<T>, equality?: (previous: T, next: T) => boolean): Projection<T>;
|
|
97
134
|
//#endregion
|
|
98
|
-
export {
|
|
99
|
-
//# sourceMappingURL=definition-
|
|
135
|
+
export { ExternalValueEvent as _, ProjectionValues as a, ProjectionError as b, input as c, CollectionChange as d, CollectionDraft as f, ExternalCollectionSource as g, ExternalCollectionRead as h, ProjectionChanges as i, observe as l, ExternalCollectionEvent as m, Input as n, PublicCollection as o, CollectionRead as p, Projection as r, derive as s, CollectionProjection as t, BatchOptions as u, ExternalValueSource as v, ProjectionDisposedError as y };
|
|
136
|
+
//# sourceMappingURL=definition-C__VJqA4.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as Infer, L as CollectionId, R as CollectionNode, Z as ObjectNode, _ as Unsubscribe, et as PathValueOf, m as Synchronous, nt as SchemaPath, s as DocumentReadable, tt as ReadonlyValue, v as Readable, x as CollectionImpact, z as CollectionPath } from "./contract-
|
|
1
|
+
import { J as Infer, L as CollectionId, R as CollectionNode, Z as ObjectNode, _ as Unsubscribe, et as PathValueOf, m as Synchronous, nt as SchemaPath, s as DocumentReadable, tt as ReadonlyValue, v as Readable, x as CollectionImpact, z as CollectionPath } from "./contract-CATCCVu5.js";
|
|
2
2
|
|
|
3
3
|
//#region core/src/projection/contract.d.ts
|
|
4
4
|
/** Opaque application metadata identifying the action that produced a source event. */
|
|
@@ -6,6 +6,40 @@ type Cause = unknown;
|
|
|
6
6
|
type BatchOptions = {
|
|
7
7
|
readonly cause?: Cause;
|
|
8
8
|
};
|
|
9
|
+
type CollectionEntryTransition<K extends string, V> = {
|
|
10
|
+
readonly key: K;
|
|
11
|
+
readonly kind: 'added';
|
|
12
|
+
readonly before: undefined;
|
|
13
|
+
readonly after: V;
|
|
14
|
+
} | {
|
|
15
|
+
readonly key: K;
|
|
16
|
+
readonly kind: 'updated';
|
|
17
|
+
readonly before: V;
|
|
18
|
+
readonly after: V;
|
|
19
|
+
} | {
|
|
20
|
+
readonly key: K;
|
|
21
|
+
readonly kind: 'removed';
|
|
22
|
+
readonly before: V;
|
|
23
|
+
readonly after: undefined;
|
|
24
|
+
};
|
|
25
|
+
type CollectionChange<K extends string, V> = {
|
|
26
|
+
readonly kind: 'reset';
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: 'incremental';
|
|
29
|
+
readonly added: readonly Omit<Extract<CollectionEntryTransition<K, V>, {
|
|
30
|
+
readonly kind: 'added';
|
|
31
|
+
}>, 'before'>[];
|
|
32
|
+
readonly updated: readonly Extract<CollectionEntryTransition<K, V>, {
|
|
33
|
+
readonly kind: 'updated';
|
|
34
|
+
}>[];
|
|
35
|
+
readonly removed: readonly Omit<Extract<CollectionEntryTransition<K, V>, {
|
|
36
|
+
readonly kind: 'removed';
|
|
37
|
+
}>, 'after'>[];
|
|
38
|
+
readonly order?: {
|
|
39
|
+
readonly before: readonly K[];
|
|
40
|
+
readonly after: readonly K[];
|
|
41
|
+
};
|
|
42
|
+
};
|
|
9
43
|
type CollectionRead<K extends string, V> = {
|
|
10
44
|
get(key: K): V | undefined;
|
|
11
45
|
has(key: K): boolean;
|
|
@@ -69,18 +103,21 @@ declare class ProjectionDisposedError extends Error {
|
|
|
69
103
|
//#endregion
|
|
70
104
|
//#region core/src/projection/definition.d.ts
|
|
71
105
|
declare const projectionDefinition: unique symbol;
|
|
106
|
+
declare const projectionChanges: unique symbol;
|
|
72
107
|
declare const writableInput: unique symbol;
|
|
73
108
|
/** A lazy, reusable projection definition. Its value is materialized per runtime. */
|
|
74
|
-
type Projection<T> = {
|
|
109
|
+
type Projection<T, C = undefined> = {
|
|
75
110
|
readonly [projectionDefinition]: T;
|
|
111
|
+
readonly [projectionChanges]: C;
|
|
76
112
|
};
|
|
77
113
|
/** A runtime-local writable projection definition. */
|
|
78
114
|
type Input<T> = Projection<T> & {
|
|
79
115
|
readonly [writableInput]: true;
|
|
80
116
|
};
|
|
81
|
-
type ProjectionValues<D extends readonly Projection<unknown>[]> = { readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never };
|
|
117
|
+
type ProjectionValues<D extends readonly Projection<unknown, unknown>[]> = { readonly [K in keyof D]: D[K] extends Projection<infer T, unknown> ? T : never };
|
|
118
|
+
type ProjectionChanges<D extends readonly Projection<unknown, unknown>[]> = { readonly [K in keyof D]: D[K] extends Projection<unknown, infer C> ? [C] extends [undefined] ? undefined : C | undefined : undefined };
|
|
82
119
|
type PublicCollection<K extends string, V> = ReadonlyMap<K, V>;
|
|
83
|
-
type
|
|
120
|
+
type CollectionProjection<K extends string, V> = Projection<PublicCollection<K, V>, CollectionChange<K, V>>;
|
|
84
121
|
declare const input: <T>(initial: T, equality?: (previous: T, next: T) => boolean) => Input<T>;
|
|
85
122
|
/**
|
|
86
123
|
* Establishes a reactive boundary from a document, readable, or external
|
|
@@ -89,11 +126,11 @@ declare const input: <T>(initial: T, equality?: (previous: T, next: T) => boolea
|
|
|
89
126
|
*/
|
|
90
127
|
declare function observe<S extends ObjectNode>(document: DocumentReadable<S>): Projection<Infer<S>>;
|
|
91
128
|
declare function observe<T, D>(source: ExternalValueSource<T, D>): Projection<T>;
|
|
92
|
-
declare function observe<K extends string, V, D>(source: ExternalCollectionSource<K, V, D>):
|
|
129
|
+
declare function observe<K extends string, V, D>(source: ExternalCollectionSource<K, V, D>): CollectionProjection<K, V>;
|
|
93
130
|
declare function observe<T>(readable: Readable<T>): Projection<T>;
|
|
94
|
-
declare function observe<S extends ObjectNode, P extends CollectionPath>(document: DocumentReadable<S>, selector: (path: SchemaPath<S['shape']>) => P):
|
|
131
|
+
declare function observe<S extends ObjectNode, P extends CollectionPath>(document: DocumentReadable<S>, selector: (path: SchemaPath<S['shape']>) => P): CollectionProjection<CollectionId<P>, ReadonlyValue<Infer<CollectionNode<P>>>>;
|
|
95
132
|
declare function observe<S extends ObjectNode, P>(document: DocumentReadable<S>, selector: (path: SchemaPath<S['shape']>) => P): Projection<PathValueOf<P>>;
|
|
96
|
-
declare function derive<const D extends readonly Projection<unknown>[], T>(dependencies: D, compute: (...values: ProjectionValues<D>) => Synchronous<T>, equality?: (previous: T, next: T) => boolean): Projection<T>;
|
|
133
|
+
declare function derive<const D extends readonly Projection<unknown, unknown>[], T>(dependencies: D, compute: (...values: ProjectionValues<D>) => Synchronous<T>, equality?: (previous: T, next: T) => boolean): Projection<T>;
|
|
97
134
|
//#endregion
|
|
98
|
-
export {
|
|
99
|
-
//# sourceMappingURL=definition-
|
|
135
|
+
export { ExternalValueEvent as _, ProjectionValues as a, ProjectionError as b, input as c, CollectionChange as d, CollectionDraft as f, ExternalCollectionSource as g, ExternalCollectionRead as h, ProjectionChanges as i, observe as l, ExternalCollectionEvent as m, Input as n, PublicCollection as o, CollectionRead as p, Projection as r, derive as s, CollectionProjection as t, BatchOptions as u, ExternalValueSource as v, ProjectionDisposedError as y };
|
|
136
|
+
//# sourceMappingURL=definition-Dc1Udkop.d.ts.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
//#region core/src/projection/definition.ts
|
|
2
|
+
const definitions = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
const define = (definition) => {
|
|
4
|
+
const handle = Object.freeze({});
|
|
5
|
+
definitions.set(handle, definition);
|
|
6
|
+
return handle;
|
|
7
|
+
};
|
|
8
|
+
const definitionOf = (projection) => {
|
|
9
|
+
const definition = definitions.get(projection);
|
|
10
|
+
if (!definition) throw new TypeError("Unknown projection definition.");
|
|
11
|
+
return definition;
|
|
12
|
+
};
|
|
13
|
+
const input = (initial, equality = Object.is) => define({
|
|
14
|
+
kind: "input",
|
|
15
|
+
initial,
|
|
16
|
+
isEqual: equality
|
|
17
|
+
});
|
|
18
|
+
function observe(document, selector) {
|
|
19
|
+
if (isExternalSource(document)) return document.kind === "collection" ? defineExternalCollection(document) : defineExternalValue(document);
|
|
20
|
+
if ("current" in document && typeof document.current === "function") return defineReadable(document);
|
|
21
|
+
return define({
|
|
22
|
+
kind: "document",
|
|
23
|
+
document,
|
|
24
|
+
selector
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const isExternalSource = (source) => {
|
|
28
|
+
if (!source || typeof source !== "object") return false;
|
|
29
|
+
const candidate = source;
|
|
30
|
+
return (candidate.kind === "value" || candidate.kind === "collection") && typeof candidate.current === "function" && typeof candidate.revision === "function" && typeof candidate.subscribe === "function";
|
|
31
|
+
};
|
|
32
|
+
function derive(dependencies, compute, equality = Object.is) {
|
|
33
|
+
if (!Array.isArray(dependencies) || dependencies.some((value) => !definitions.has(value))) throw new TypeError("derive dependencies must be projections.");
|
|
34
|
+
return define({
|
|
35
|
+
kind: "derive",
|
|
36
|
+
dependencies: Object.freeze([...dependencies]),
|
|
37
|
+
compute,
|
|
38
|
+
isEqual: equality
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/** Internal source adapters used by observe, not exported publicly. */
|
|
42
|
+
const defineReadable = (readable, equality = Object.is) => define({
|
|
43
|
+
kind: "readable",
|
|
44
|
+
readable,
|
|
45
|
+
isEqual: equality
|
|
46
|
+
});
|
|
47
|
+
const defineExternalValue = (source) => define({
|
|
48
|
+
kind: "source-value",
|
|
49
|
+
source
|
|
50
|
+
});
|
|
51
|
+
const defineExternalCollection = (source) => define({
|
|
52
|
+
kind: "source-collection",
|
|
53
|
+
source
|
|
54
|
+
});
|
|
55
|
+
const defineIncrementalValue = (definition) => define({
|
|
56
|
+
kind: "incremental-value",
|
|
57
|
+
dependencies: definition.dependencies,
|
|
58
|
+
build: definition.build,
|
|
59
|
+
isEqual: definition.isEqual,
|
|
60
|
+
name: definition.name
|
|
61
|
+
});
|
|
62
|
+
const defineIncrementalCollection = (definition) => define({
|
|
63
|
+
kind: "incremental-collection",
|
|
64
|
+
dependencies: definition.dependencies,
|
|
65
|
+
build: definition.build,
|
|
66
|
+
isEqual: definition.isEqual,
|
|
67
|
+
name: definition.name
|
|
68
|
+
});
|
|
69
|
+
//#endregion
|
|
70
|
+
Object.defineProperty(exports, "defineIncrementalCollection", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function() {
|
|
73
|
+
return defineIncrementalCollection;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "defineIncrementalValue", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function() {
|
|
79
|
+
return defineIncrementalValue;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(exports, "definitionOf", {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function() {
|
|
85
|
+
return definitionOf;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(exports, "derive", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function() {
|
|
91
|
+
return derive;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
Object.defineProperty(exports, "input", {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function() {
|
|
97
|
+
return input;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(exports, "observe", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function() {
|
|
103
|
+
return observe;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=definition-Z6TagMup.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition-Z6TagMup.cjs","names":[],"sources":["../core/src/projection/definition.ts"],"sourcesContent":["import type { DocumentReadable, Synchronous } from '../runtime/contract';\nimport type {\n CollectionId,\n CollectionPath,\n CollectionNode as SchemaCollectionNode,\n Infer,\n ObjectNode,\n ReadonlyValue,\n SchemaPath,\n PathValueOf,\n} from '../schema';\nimport type { Readable } from './readable';\nimport type {\n BatchContext,\n Cause,\n CollectionContext,\n CollectionChange,\n CollectionDraft,\n CollectionRead,\n CollectionEntryTransition,\n DocumentContext,\n ExternalCollectionSource,\n ExternalValueSource,\n GraphSources,\n InputHandles,\n NodeUpdate,\n ValueContext,\n} from './contract';\n\ndeclare const projectionDefinition: unique symbol;\ndeclare const projectionChanges: unique symbol;\ndeclare const writableInput: unique symbol;\n\n/** A lazy, reusable projection definition. Its value is materialized per runtime. */\nexport type Projection<T, C = undefined> = {\n readonly [projectionDefinition]: T;\n readonly [projectionChanges]: C;\n};\n\n/** A runtime-local writable projection definition. */\nexport type Input<T> = Projection<T> & { readonly [writableInput]: true };\n\nexport type ProjectionValues<D extends readonly Projection<unknown, unknown>[]> = {\n readonly [K in keyof D]: D[K] extends Projection<infer T, unknown> ? T : never;\n};\n\nexport type ProjectionChanges<D extends readonly Projection<unknown, unknown>[]> = {\n readonly [K in keyof D]: D[K] extends Projection<unknown, infer C>\n ? [C] extends [undefined]\n ? undefined\n : C | undefined\n : undefined;\n};\n\nexport type PublicCollection<K extends string, V> = ReadonlyMap<K, V>;\nexport type CollectionProjection<K extends string, V> = Projection<\n PublicCollection<K, V>,\n CollectionChange<K, V>\n>;\n\ntype Equality = (a: unknown, b: unknown) => boolean;\ntype PathSelector<S extends ObjectNode> = (path: SchemaPath<S['shape']>) => unknown;\n\ntype Definition =\n | { readonly kind: 'input'; readonly initial: unknown; readonly isEqual?: Equality }\n | { readonly kind: 'readable'; readonly readable: Readable<unknown>; readonly isEqual?: Equality }\n | { readonly kind: 'source-value'; readonly source: ExternalValueSource<unknown, unknown> }\n | {\n readonly kind: 'source-collection';\n readonly source: ExternalCollectionSource<string, unknown, unknown>;\n }\n | {\n readonly kind: 'document';\n readonly document: DocumentReadable<ObjectNode>;\n readonly selector?: PathSelector<ObjectNode>;\n }\n | {\n readonly kind: 'derive';\n readonly dependencies: readonly Projection<unknown, unknown>[];\n readonly compute: (...values: readonly unknown[]) => unknown;\n readonly isEqual?: Equality;\n }\n | {\n readonly kind: 'incremental-value';\n readonly dependencies: GraphSources;\n readonly build: (...args: never[]) => unknown;\n readonly isEqual?: Equality;\n readonly name?: string;\n }\n | {\n readonly kind: 'incremental-collection';\n readonly dependencies: GraphSources;\n readonly build: (...args: never[]) => unknown;\n readonly isEqual?: Equality;\n readonly name?: string;\n };\n\ntype DefinitionProjection = Projection<unknown, unknown>;\nconst definitions = new WeakMap<object, Definition>();\n\nconst define = <T, C = undefined>(definition: Definition): Projection<T, C> => {\n const handle = Object.freeze({}) as Projection<T, C>;\n definitions.set(handle, definition);\n return handle;\n};\n\nexport const definitionOf = (projection: DefinitionProjection): Definition => {\n const definition = definitions.get(projection);\n if (!definition) throw new TypeError('Unknown projection definition.');\n return definition;\n};\n\nexport const input = <T>(\n initial: T,\n equality: (previous: T, next: T) => boolean = Object.is\n): Input<T> => define<T>({ kind: 'input', initial, isEqual: equality as Equality }) as Input<T>;\n\n/**\n * Establishes a reactive boundary from a document, readable, or external\n * source. The selector is compiled when the definition is materialized, so\n * declarations stay lazy and reusable.\n */\nexport function observe<S extends ObjectNode>(document: DocumentReadable<S>): Projection<Infer<S>>;\nexport function observe<T, D>(source: ExternalValueSource<T, D>): Projection<T>;\nexport function observe<K extends string, V, D>(\n source: ExternalCollectionSource<K, V, D>\n): CollectionProjection<K, V>;\nexport function observe<T>(readable: Readable<T>): Projection<T>;\nexport function observe<S extends ObjectNode, P extends CollectionPath>(\n document: DocumentReadable<S>,\n selector: (path: SchemaPath<S['shape']>) => P\n): CollectionProjection<CollectionId<P>, ReadonlyValue<Infer<SchemaCollectionNode<P>>>>;\nexport function observe<S extends ObjectNode, P>(\n document: DocumentReadable<S>,\n selector: (path: SchemaPath<S['shape']>) => P\n): Projection<PathValueOf<P>>;\nexport function observe<S extends ObjectNode>(\n document:\n | DocumentReadable<S>\n | Readable<unknown>\n | ExternalValueSource<unknown, unknown>\n | ExternalCollectionSource<string, unknown, unknown>,\n selector?: PathSelector<S>\n): Projection<unknown, unknown> {\n if (isExternalSource(document))\n return document.kind === 'collection'\n ? defineExternalCollection(document)\n : defineExternalValue(document);\n if ('current' in document && typeof document.current === 'function')\n return defineReadable(document as Readable<unknown>);\n return define({\n kind: 'document',\n document: document as DocumentReadable<ObjectNode>,\n selector: selector as PathSelector<ObjectNode> | undefined,\n });\n}\n\nconst isExternalSource = (\n source: unknown\n): source is\n ExternalValueSource<unknown, unknown> | ExternalCollectionSource<string, unknown, unknown> => {\n if (!source || typeof source !== 'object') return false;\n const candidate = source as {\n readonly kind?: unknown;\n readonly current?: unknown;\n readonly revision?: unknown;\n readonly subscribe?: unknown;\n };\n return (\n (candidate.kind === 'value' || candidate.kind === 'collection') &&\n typeof candidate.current === 'function' &&\n typeof candidate.revision === 'function' &&\n typeof candidate.subscribe === 'function'\n );\n};\n\nexport function derive<const D extends readonly Projection<unknown, unknown>[], T>(\n dependencies: D,\n compute: (...values: ProjectionValues<D>) => Synchronous<T>,\n equality: (previous: T, next: T) => boolean = Object.is\n): Projection<T> {\n if (!Array.isArray(dependencies) || dependencies.some(value => !definitions.has(value)))\n throw new TypeError('derive dependencies must be projections.');\n const frozen = Object.freeze([...dependencies]) as readonly Projection<unknown, unknown>[];\n return define<T>({\n kind: 'derive',\n dependencies: frozen,\n compute: compute as (...values: readonly unknown[]) => unknown,\n isEqual: equality as Equality,\n });\n}\n\n/** Internal source adapters used by observe, not exported publicly. */\nexport const defineReadable = <T>(\n readable: Readable<T>,\n equality: (a: T, b: T) => boolean = Object.is\n): Projection<T> => define<T>({ kind: 'readable', readable, isEqual: equality as Equality });\n\nexport const defineExternalValue = <T, D>(source: ExternalValueSource<T, D>): Projection<T> =>\n define<T>({ kind: 'source-value', source: source as never });\n\nexport const defineExternalCollection = <K extends string, V, D>(\n source: ExternalCollectionSource<K, V, D>\n): CollectionProjection<K, V> =>\n define<PublicCollection<K, V>, CollectionChange<K, V>>({\n kind: 'source-collection',\n source: source as never,\n });\n\nexport type IncrementalValueDefinition = Extract<Definition, { kind: 'incremental-value' }>;\nexport type IncrementalCollectionDefinition = Extract<\n Definition,\n { kind: 'incremental-collection' }\n>;\n\nexport const defineIncrementalValue = <T>(definition: {\n readonly dependencies: GraphSources;\n readonly build: (...args: never[]) => unknown;\n readonly isEqual?: (a: T, b: T) => boolean;\n readonly name?: string;\n}): Projection<T> =>\n define<T>({\n kind: 'incremental-value',\n dependencies: definition.dependencies,\n build: definition.build,\n isEqual: definition.isEqual as Equality | undefined,\n name: definition.name,\n });\n\nexport const defineIncrementalCollection = <K extends string, V>(definition: {\n readonly dependencies: GraphSources;\n readonly build: (...args: never[]) => unknown;\n readonly isEqual?: (a: V, b: V) => boolean;\n readonly name?: string;\n}): CollectionProjection<K, V> =>\n define<PublicCollection<K, V>, CollectionChange<K, V>>({\n kind: 'incremental-collection',\n dependencies: definition.dependencies,\n build: definition.build,\n isEqual: definition.isEqual as Equality | undefined,\n name: definition.name,\n });\n\n// Internal event names remain private implementation detail and are not root exports.\nexport type InternalDocumentEvent<S extends ObjectNode> = DocumentContext<S>;\nexport type InternalValueEvent<T, D = unknown> = ValueContext<T, D>;\nexport type InternalCollectionEvent<K extends string, V, D = unknown> = CollectionContext<K, V, D>;\nexport type InternalCollectionTransition<K extends string, V> = CollectionEntryTransition<K, V>;\nexport type InternalCollectionDraft<K extends string, V> = CollectionDraft<K, V>;\nexport type InternalBatchContext = BatchContext;\nexport type InternalCause = Cause;\nexport type InternalInputHandles<S extends GraphSources> = InputHandles<S>;\nexport type InternalNodeUpdate<T> = NodeUpdate<T>;\nexport type InternalCollectionRead<K extends string, V> = CollectionRead<K, V>;\n"],"mappings":";AAkGA,MAAM,8BAAc,IAAI,SAA6B;AAErD,MAAM,UAA4B,eAA6C;CAC7E,MAAM,SAAS,OAAO,OAAO,EAAE,CAAC;AAChC,aAAY,IAAI,QAAQ,WAAW;AACnC,QAAO;;AAGT,MAAa,gBAAgB,eAAiD;CAC5E,MAAM,aAAa,YAAY,IAAI,WAAW;AAC9C,KAAI,CAAC,WAAY,OAAM,IAAI,UAAU,iCAAiC;AACtE,QAAO;;AAGT,MAAa,SACX,SACA,WAA8C,OAAO,OACxC,OAAU;CAAE,MAAM;CAAS;CAAS,SAAS;CAAsB,CAAC;AAqBnF,SAAgB,QACd,UAKA,UAC8B;AAC9B,KAAI,iBAAiB,SAAS,CAC5B,QAAO,SAAS,SAAS,eACrB,yBAAyB,SAAS,GAClC,oBAAoB,SAAS;AACnC,KAAI,aAAa,YAAY,OAAO,SAAS,YAAY,WACvD,QAAO,eAAe,SAA8B;AACtD,QAAO,OAAO;EACZ,MAAM;EACI;EACA;EACX,CAAC;;AAGJ,MAAM,oBACJ,WAE8F;AAC9F,KAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO;CAClD,MAAM,YAAY;AAMlB,SACG,UAAU,SAAS,WAAW,UAAU,SAAS,iBAClD,OAAO,UAAU,YAAY,cAC7B,OAAO,UAAU,aAAa,cAC9B,OAAO,UAAU,cAAc;;AAInC,SAAgB,OACd,cACA,SACA,WAA8C,OAAO,IACtC;AACf,KAAI,CAAC,MAAM,QAAQ,aAAa,IAAI,aAAa,MAAK,UAAS,CAAC,YAAY,IAAI,MAAM,CAAC,CACrF,OAAM,IAAI,UAAU,2CAA2C;AAEjE,QAAO,OAAU;EACf,MAAM;EACN,cAHa,OAAO,OAAO,CAAC,GAAG,aAAa,CAGxB;EACX;EACT,SAAS;EACV,CAAC;;;AAIJ,MAAa,kBACX,UACA,WAAoC,OAAO,OACzB,OAAU;CAAE,MAAM;CAAY;CAAU,SAAS;CAAsB,CAAC;AAE5F,MAAa,uBAA6B,WACxC,OAAU;CAAE,MAAM;CAAwB;CAAiB,CAAC;AAE9D,MAAa,4BACX,WAEA,OAAuD;CACrD,MAAM;CACE;CACT,CAAC;AAQJ,MAAa,0BAA6B,eAMxC,OAAU;CACR,MAAM;CACN,cAAc,WAAW;CACzB,OAAO,WAAW;CAClB,SAAS,WAAW;CACpB,MAAM,WAAW;CAClB,CAAC;AAEJ,MAAa,+BAAoD,eAM/D,OAAuD;CACrD,MAAM;CACN,cAAc,WAAW;CACzB,OAAO,WAAW;CAClB,SAAS,WAAW;CACpB,MAAM,WAAW;CAClB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//#region core/src/projection/definition.ts
|
|
2
|
+
const definitions = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
const define = (definition) => {
|
|
4
|
+
const handle = Object.freeze({});
|
|
5
|
+
definitions.set(handle, definition);
|
|
6
|
+
return handle;
|
|
7
|
+
};
|
|
8
|
+
const definitionOf = (projection) => {
|
|
9
|
+
const definition = definitions.get(projection);
|
|
10
|
+
if (!definition) throw new TypeError("Unknown projection definition.");
|
|
11
|
+
return definition;
|
|
12
|
+
};
|
|
13
|
+
const input = (initial, equality = Object.is) => define({
|
|
14
|
+
kind: "input",
|
|
15
|
+
initial,
|
|
16
|
+
isEqual: equality
|
|
17
|
+
});
|
|
18
|
+
function observe(document, selector) {
|
|
19
|
+
if (isExternalSource(document)) return document.kind === "collection" ? defineExternalCollection(document) : defineExternalValue(document);
|
|
20
|
+
if ("current" in document && typeof document.current === "function") return defineReadable(document);
|
|
21
|
+
return define({
|
|
22
|
+
kind: "document",
|
|
23
|
+
document,
|
|
24
|
+
selector
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const isExternalSource = (source) => {
|
|
28
|
+
if (!source || typeof source !== "object") return false;
|
|
29
|
+
const candidate = source;
|
|
30
|
+
return (candidate.kind === "value" || candidate.kind === "collection") && typeof candidate.current === "function" && typeof candidate.revision === "function" && typeof candidate.subscribe === "function";
|
|
31
|
+
};
|
|
32
|
+
function derive(dependencies, compute, equality = Object.is) {
|
|
33
|
+
if (!Array.isArray(dependencies) || dependencies.some((value) => !definitions.has(value))) throw new TypeError("derive dependencies must be projections.");
|
|
34
|
+
return define({
|
|
35
|
+
kind: "derive",
|
|
36
|
+
dependencies: Object.freeze([...dependencies]),
|
|
37
|
+
compute,
|
|
38
|
+
isEqual: equality
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/** Internal source adapters used by observe, not exported publicly. */
|
|
42
|
+
const defineReadable = (readable, equality = Object.is) => define({
|
|
43
|
+
kind: "readable",
|
|
44
|
+
readable,
|
|
45
|
+
isEqual: equality
|
|
46
|
+
});
|
|
47
|
+
const defineExternalValue = (source) => define({
|
|
48
|
+
kind: "source-value",
|
|
49
|
+
source
|
|
50
|
+
});
|
|
51
|
+
const defineExternalCollection = (source) => define({
|
|
52
|
+
kind: "source-collection",
|
|
53
|
+
source
|
|
54
|
+
});
|
|
55
|
+
const defineIncrementalValue = (definition) => define({
|
|
56
|
+
kind: "incremental-value",
|
|
57
|
+
dependencies: definition.dependencies,
|
|
58
|
+
build: definition.build,
|
|
59
|
+
isEqual: definition.isEqual,
|
|
60
|
+
name: definition.name
|
|
61
|
+
});
|
|
62
|
+
const defineIncrementalCollection = (definition) => define({
|
|
63
|
+
kind: "incremental-collection",
|
|
64
|
+
dependencies: definition.dependencies,
|
|
65
|
+
build: definition.build,
|
|
66
|
+
isEqual: definition.isEqual,
|
|
67
|
+
name: definition.name
|
|
68
|
+
});
|
|
69
|
+
//#endregion
|
|
70
|
+
export { input as a, derive as i, defineIncrementalValue as n, observe as o, definitionOf as r, defineIncrementalCollection as t };
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=definition-c6XQXzvK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition-c6XQXzvK.js","names":[],"sources":["../core/src/projection/definition.ts"],"sourcesContent":["import type { DocumentReadable, Synchronous } from '../runtime/contract';\nimport type {\n CollectionId,\n CollectionPath,\n CollectionNode as SchemaCollectionNode,\n Infer,\n ObjectNode,\n ReadonlyValue,\n SchemaPath,\n PathValueOf,\n} from '../schema';\nimport type { Readable } from './readable';\nimport type {\n BatchContext,\n Cause,\n CollectionContext,\n CollectionChange,\n CollectionDraft,\n CollectionRead,\n CollectionEntryTransition,\n DocumentContext,\n ExternalCollectionSource,\n ExternalValueSource,\n GraphSources,\n InputHandles,\n NodeUpdate,\n ValueContext,\n} from './contract';\n\ndeclare const projectionDefinition: unique symbol;\ndeclare const projectionChanges: unique symbol;\ndeclare const writableInput: unique symbol;\n\n/** A lazy, reusable projection definition. Its value is materialized per runtime. */\nexport type Projection<T, C = undefined> = {\n readonly [projectionDefinition]: T;\n readonly [projectionChanges]: C;\n};\n\n/** A runtime-local writable projection definition. */\nexport type Input<T> = Projection<T> & { readonly [writableInput]: true };\n\nexport type ProjectionValues<D extends readonly Projection<unknown, unknown>[]> = {\n readonly [K in keyof D]: D[K] extends Projection<infer T, unknown> ? T : never;\n};\n\nexport type ProjectionChanges<D extends readonly Projection<unknown, unknown>[]> = {\n readonly [K in keyof D]: D[K] extends Projection<unknown, infer C>\n ? [C] extends [undefined]\n ? undefined\n : C | undefined\n : undefined;\n};\n\nexport type PublicCollection<K extends string, V> = ReadonlyMap<K, V>;\nexport type CollectionProjection<K extends string, V> = Projection<\n PublicCollection<K, V>,\n CollectionChange<K, V>\n>;\n\ntype Equality = (a: unknown, b: unknown) => boolean;\ntype PathSelector<S extends ObjectNode> = (path: SchemaPath<S['shape']>) => unknown;\n\ntype Definition =\n | { readonly kind: 'input'; readonly initial: unknown; readonly isEqual?: Equality }\n | { readonly kind: 'readable'; readonly readable: Readable<unknown>; readonly isEqual?: Equality }\n | { readonly kind: 'source-value'; readonly source: ExternalValueSource<unknown, unknown> }\n | {\n readonly kind: 'source-collection';\n readonly source: ExternalCollectionSource<string, unknown, unknown>;\n }\n | {\n readonly kind: 'document';\n readonly document: DocumentReadable<ObjectNode>;\n readonly selector?: PathSelector<ObjectNode>;\n }\n | {\n readonly kind: 'derive';\n readonly dependencies: readonly Projection<unknown, unknown>[];\n readonly compute: (...values: readonly unknown[]) => unknown;\n readonly isEqual?: Equality;\n }\n | {\n readonly kind: 'incremental-value';\n readonly dependencies: GraphSources;\n readonly build: (...args: never[]) => unknown;\n readonly isEqual?: Equality;\n readonly name?: string;\n }\n | {\n readonly kind: 'incremental-collection';\n readonly dependencies: GraphSources;\n readonly build: (...args: never[]) => unknown;\n readonly isEqual?: Equality;\n readonly name?: string;\n };\n\ntype DefinitionProjection = Projection<unknown, unknown>;\nconst definitions = new WeakMap<object, Definition>();\n\nconst define = <T, C = undefined>(definition: Definition): Projection<T, C> => {\n const handle = Object.freeze({}) as Projection<T, C>;\n definitions.set(handle, definition);\n return handle;\n};\n\nexport const definitionOf = (projection: DefinitionProjection): Definition => {\n const definition = definitions.get(projection);\n if (!definition) throw new TypeError('Unknown projection definition.');\n return definition;\n};\n\nexport const input = <T>(\n initial: T,\n equality: (previous: T, next: T) => boolean = Object.is\n): Input<T> => define<T>({ kind: 'input', initial, isEqual: equality as Equality }) as Input<T>;\n\n/**\n * Establishes a reactive boundary from a document, readable, or external\n * source. The selector is compiled when the definition is materialized, so\n * declarations stay lazy and reusable.\n */\nexport function observe<S extends ObjectNode>(document: DocumentReadable<S>): Projection<Infer<S>>;\nexport function observe<T, D>(source: ExternalValueSource<T, D>): Projection<T>;\nexport function observe<K extends string, V, D>(\n source: ExternalCollectionSource<K, V, D>\n): CollectionProjection<K, V>;\nexport function observe<T>(readable: Readable<T>): Projection<T>;\nexport function observe<S extends ObjectNode, P extends CollectionPath>(\n document: DocumentReadable<S>,\n selector: (path: SchemaPath<S['shape']>) => P\n): CollectionProjection<CollectionId<P>, ReadonlyValue<Infer<SchemaCollectionNode<P>>>>;\nexport function observe<S extends ObjectNode, P>(\n document: DocumentReadable<S>,\n selector: (path: SchemaPath<S['shape']>) => P\n): Projection<PathValueOf<P>>;\nexport function observe<S extends ObjectNode>(\n document:\n | DocumentReadable<S>\n | Readable<unknown>\n | ExternalValueSource<unknown, unknown>\n | ExternalCollectionSource<string, unknown, unknown>,\n selector?: PathSelector<S>\n): Projection<unknown, unknown> {\n if (isExternalSource(document))\n return document.kind === 'collection'\n ? defineExternalCollection(document)\n : defineExternalValue(document);\n if ('current' in document && typeof document.current === 'function')\n return defineReadable(document as Readable<unknown>);\n return define({\n kind: 'document',\n document: document as DocumentReadable<ObjectNode>,\n selector: selector as PathSelector<ObjectNode> | undefined,\n });\n}\n\nconst isExternalSource = (\n source: unknown\n): source is\n ExternalValueSource<unknown, unknown> | ExternalCollectionSource<string, unknown, unknown> => {\n if (!source || typeof source !== 'object') return false;\n const candidate = source as {\n readonly kind?: unknown;\n readonly current?: unknown;\n readonly revision?: unknown;\n readonly subscribe?: unknown;\n };\n return (\n (candidate.kind === 'value' || candidate.kind === 'collection') &&\n typeof candidate.current === 'function' &&\n typeof candidate.revision === 'function' &&\n typeof candidate.subscribe === 'function'\n );\n};\n\nexport function derive<const D extends readonly Projection<unknown, unknown>[], T>(\n dependencies: D,\n compute: (...values: ProjectionValues<D>) => Synchronous<T>,\n equality: (previous: T, next: T) => boolean = Object.is\n): Projection<T> {\n if (!Array.isArray(dependencies) || dependencies.some(value => !definitions.has(value)))\n throw new TypeError('derive dependencies must be projections.');\n const frozen = Object.freeze([...dependencies]) as readonly Projection<unknown, unknown>[];\n return define<T>({\n kind: 'derive',\n dependencies: frozen,\n compute: compute as (...values: readonly unknown[]) => unknown,\n isEqual: equality as Equality,\n });\n}\n\n/** Internal source adapters used by observe, not exported publicly. */\nexport const defineReadable = <T>(\n readable: Readable<T>,\n equality: (a: T, b: T) => boolean = Object.is\n): Projection<T> => define<T>({ kind: 'readable', readable, isEqual: equality as Equality });\n\nexport const defineExternalValue = <T, D>(source: ExternalValueSource<T, D>): Projection<T> =>\n define<T>({ kind: 'source-value', source: source as never });\n\nexport const defineExternalCollection = <K extends string, V, D>(\n source: ExternalCollectionSource<K, V, D>\n): CollectionProjection<K, V> =>\n define<PublicCollection<K, V>, CollectionChange<K, V>>({\n kind: 'source-collection',\n source: source as never,\n });\n\nexport type IncrementalValueDefinition = Extract<Definition, { kind: 'incremental-value' }>;\nexport type IncrementalCollectionDefinition = Extract<\n Definition,\n { kind: 'incremental-collection' }\n>;\n\nexport const defineIncrementalValue = <T>(definition: {\n readonly dependencies: GraphSources;\n readonly build: (...args: never[]) => unknown;\n readonly isEqual?: (a: T, b: T) => boolean;\n readonly name?: string;\n}): Projection<T> =>\n define<T>({\n kind: 'incremental-value',\n dependencies: definition.dependencies,\n build: definition.build,\n isEqual: definition.isEqual as Equality | undefined,\n name: definition.name,\n });\n\nexport const defineIncrementalCollection = <K extends string, V>(definition: {\n readonly dependencies: GraphSources;\n readonly build: (...args: never[]) => unknown;\n readonly isEqual?: (a: V, b: V) => boolean;\n readonly name?: string;\n}): CollectionProjection<K, V> =>\n define<PublicCollection<K, V>, CollectionChange<K, V>>({\n kind: 'incremental-collection',\n dependencies: definition.dependencies,\n build: definition.build,\n isEqual: definition.isEqual as Equality | undefined,\n name: definition.name,\n });\n\n// Internal event names remain private implementation detail and are not root exports.\nexport type InternalDocumentEvent<S extends ObjectNode> = DocumentContext<S>;\nexport type InternalValueEvent<T, D = unknown> = ValueContext<T, D>;\nexport type InternalCollectionEvent<K extends string, V, D = unknown> = CollectionContext<K, V, D>;\nexport type InternalCollectionTransition<K extends string, V> = CollectionEntryTransition<K, V>;\nexport type InternalCollectionDraft<K extends string, V> = CollectionDraft<K, V>;\nexport type InternalBatchContext = BatchContext;\nexport type InternalCause = Cause;\nexport type InternalInputHandles<S extends GraphSources> = InputHandles<S>;\nexport type InternalNodeUpdate<T> = NodeUpdate<T>;\nexport type InternalCollectionRead<K extends string, V> = CollectionRead<K, V>;\n"],"mappings":";AAkGA,MAAM,8BAAc,IAAI,SAA6B;AAErD,MAAM,UAA4B,eAA6C;CAC7E,MAAM,SAAS,OAAO,OAAO,EAAE,CAAC;AAChC,aAAY,IAAI,QAAQ,WAAW;AACnC,QAAO;;AAGT,MAAa,gBAAgB,eAAiD;CAC5E,MAAM,aAAa,YAAY,IAAI,WAAW;AAC9C,KAAI,CAAC,WAAY,OAAM,IAAI,UAAU,iCAAiC;AACtE,QAAO;;AAGT,MAAa,SACX,SACA,WAA8C,OAAO,OACxC,OAAU;CAAE,MAAM;CAAS;CAAS,SAAS;CAAsB,CAAC;AAqBnF,SAAgB,QACd,UAKA,UAC8B;AAC9B,KAAI,iBAAiB,SAAS,CAC5B,QAAO,SAAS,SAAS,eACrB,yBAAyB,SAAS,GAClC,oBAAoB,SAAS;AACnC,KAAI,aAAa,YAAY,OAAO,SAAS,YAAY,WACvD,QAAO,eAAe,SAA8B;AACtD,QAAO,OAAO;EACZ,MAAM;EACI;EACA;EACX,CAAC;;AAGJ,MAAM,oBACJ,WAE8F;AAC9F,KAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO;CAClD,MAAM,YAAY;AAMlB,SACG,UAAU,SAAS,WAAW,UAAU,SAAS,iBAClD,OAAO,UAAU,YAAY,cAC7B,OAAO,UAAU,aAAa,cAC9B,OAAO,UAAU,cAAc;;AAInC,SAAgB,OACd,cACA,SACA,WAA8C,OAAO,IACtC;AACf,KAAI,CAAC,MAAM,QAAQ,aAAa,IAAI,aAAa,MAAK,UAAS,CAAC,YAAY,IAAI,MAAM,CAAC,CACrF,OAAM,IAAI,UAAU,2CAA2C;AAEjE,QAAO,OAAU;EACf,MAAM;EACN,cAHa,OAAO,OAAO,CAAC,GAAG,aAAa,CAGxB;EACX;EACT,SAAS;EACV,CAAC;;;AAIJ,MAAa,kBACX,UACA,WAAoC,OAAO,OACzB,OAAU;CAAE,MAAM;CAAY;CAAU,SAAS;CAAsB,CAAC;AAE5F,MAAa,uBAA6B,WACxC,OAAU;CAAE,MAAM;CAAwB;CAAiB,CAAC;AAE9D,MAAa,4BACX,WAEA,OAAuD;CACrD,MAAM;CACE;CACT,CAAC;AAQJ,MAAa,0BAA6B,eAMxC,OAAU;CACR,MAAM;CACN,cAAc,WAAW;CACzB,OAAO,WAAW;CAClB,SAAS,WAAW;CACpB,MAAM,WAAW;CAClB,CAAC;AAEJ,MAAa,+BAAoD,eAM/D,OAAuD;CACrD,MAAM;CACN,cAAc,WAAW;CACzB,OAAO,WAAW;CAClB,SAAS,WAAW;CACpB,MAAM,WAAW;CAClB,CAAC"}
|