doxum 0.1.32 → 0.1.34
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 +33 -1
- package/dist/advanced.cjs +1 -1
- package/dist/advanced.d.cts +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +1 -1
- package/dist/{dependency-B1qIJJBL.d.cts → dependency-Cbf3C8eJ.d.cts} +2 -2
- package/dist/{dependency-BRgPvyN6.d.ts → dependency-DzxXGYe1.d.ts} +2 -2
- package/dist/index.cjs +580 -212
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -12
- package/dist/index.d.ts +19 -12
- package/dist/index.js +580 -212
- package/dist/index.js.map +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js.map +1 -1
- package/dist/{transform-CENhTaVN.cjs → transform-Bt1Mwgrj.cjs} +310 -280
- package/dist/transform-Bt1Mwgrj.cjs.map +1 -0
- package/dist/{transform-gOtqcdHe.js → transform-RghG_Qxs.js} +305 -275
- package/dist/transform-RghG_Qxs.js.map +1 -0
- package/package.json +1 -1
- package/skills/doxum-runtime/SKILL.md +4 -2
- package/skills/doxum-runtime/references/integrations.md +2 -2
- package/skills/doxum-runtime/references/invariants.md +6 -3
- package/skills/doxum-runtime/references/projections.md +62 -3
- package/skills/doxum-runtime/references/public-api.md +14 -4
- package/skills/doxum-runtime/references/recipes.md +32 -0
- package/dist/transform-CENhTaVN.cjs.map +0 -1
- package/dist/transform-gOtqcdHe.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $ as table, A as ParseError, B as DocumentListConfig, C as Read, D as ChangeSet, E as Change, F as CollectionPath, G as ReadonlyValue, H as DocumentTreeValue, I as PathValueOf, J as field, K as Schema, L as SchemaPath, M as parse, N as CollectionEntry, O as MemberChange, P as CollectionId, Q as optional, R as DocumentAddress, S as Draft, T as snapshot, U as Infer, V as DocumentTreeNode, W as ObjectSchema, X as map, Y as list, Z as object, _ as Unsubscribe, a as DocumentProblem, b as CollectionImpact, c as HistoryState, d as OperationResult, et as tree, f as ReadonlyDocument, g as Readable, h as TransactionResult, i as DocumentDisposedError, j as ParseIssue, k as ValueTransition, l as LocalHistory, m as TransactionRejected, n as DocumentCommit, o as DocumentReentrancyError, p as Synchronous, q as Validator, r as DocumentDiagnostic, s as DocumentRuntime, t as CommitSource, tt as variant, u as ObserverError, v as MutationIssue, w as replace, x as DocumentImpact, y as MutationIssueCode, z as DocumentAnchor } from "./contract-CNR6BS75.cjs";
|
|
2
|
-
import { _ as ProjectionDisposedError, a as Input, f as ExternalCollectionEvent, g as ExternalValueSource, h as ExternalValueEvent, i as CollectionInputDraft, m as ExternalCollectionSource, n as KeyedDependencyValues, o as KeyedProjection, p as ExternalCollectionRead, r as CollectionInput, s as Projection, t as KeyedDependencies, v as ProjectionError } from "./dependency-
|
|
2
|
+
import { _ as ProjectionDisposedError, a as Input, f as ExternalCollectionEvent, g as ExternalValueSource, h as ExternalValueEvent, i as CollectionInputDraft, m as ExternalCollectionSource, n as KeyedDependencyValues, o as KeyedProjection, p as ExternalCollectionRead, r as CollectionInput, s as Projection, t as KeyedDependencies, v as ProjectionError } from "./dependency-Cbf3C8eJ.cjs";
|
|
3
3
|
|
|
4
4
|
//#region core/src/runtime.d.ts
|
|
5
5
|
declare const createDocument: <S extends ObjectSchema<object>>(input: {
|
|
@@ -30,12 +30,12 @@ declare function observe<S extends ObjectSchema<object>, P extends CollectionPat
|
|
|
30
30
|
declare function observe<S extends ObjectSchema<object>, P>(document: ReadonlyDocument<S>, selector: (path: SchemaPath<S>) => P): Projection<PathValueOf<P>>;
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region core/src/projection/keyed/composition.d.ts
|
|
33
|
-
type Equality$
|
|
34
|
-
declare function createKeyedFrom<K extends string, V>(source: Projection<readonly V[]>, keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$
|
|
35
|
-
declare function createKeyedFrom<K extends string, V>(source: readonly V[], keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$
|
|
33
|
+
type Equality$2<T> = (previous: T, next: T) => boolean;
|
|
34
|
+
declare function createKeyedFrom<K extends string, V>(source: Projection<readonly V[]>, keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$2<V>): KeyedProjection<K, V>;
|
|
35
|
+
declare function createKeyedFrom<K extends string, V>(source: readonly V[], keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$2<V>): KeyedProjection<K, V>;
|
|
36
36
|
declare function createKeyedMerge<K extends string, V>(sources: readonly KeyedProjection<K, V>[], options: {
|
|
37
37
|
readonly conflict: 'error' | 'first' | 'last';
|
|
38
|
-
readonly equality?: Equality$
|
|
38
|
+
readonly equality?: Equality$2<V>;
|
|
39
39
|
readonly resolve?: never;
|
|
40
40
|
} | {
|
|
41
41
|
readonly conflict: 'resolve';
|
|
@@ -43,9 +43,15 @@ declare function createKeyedMerge<K extends string, V>(sources: readonly KeyedPr
|
|
|
43
43
|
readonly sourceIndex: number;
|
|
44
44
|
readonly value: V;
|
|
45
45
|
}[], key: NoInfer<K>) => Synchronous<V>;
|
|
46
|
-
readonly equality?: Equality$
|
|
46
|
+
readonly equality?: Equality$2<V>;
|
|
47
47
|
}): KeyedProjection<K, V>;
|
|
48
48
|
//#endregion
|
|
49
|
+
//#region core/src/projection/keyed/flat-map.d.ts
|
|
50
|
+
type Entries<K extends string, V> = readonly (readonly [K, V])[];
|
|
51
|
+
type Equality$1<V> = (previous: V, next: V) => boolean;
|
|
52
|
+
declare function createKeyedFlatMap<K extends string, V, O extends string, T>(source: KeyedProjection<K, V>, select: (value: NoInfer<V>, key: NoInfer<K>) => Synchronous<Entries<O, T>>, equality?: Equality$1<T>): KeyedProjection<O, T>;
|
|
53
|
+
declare function createKeyedFlatMap<K extends string, V, const D extends object, O extends string, T>(source: KeyedProjection<K, V>, dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>, select: (value: NoInfer<V>, key: NoInfer<K>, dependencies: KeyedDependencyValues<D>) => Synchronous<Entries<O, T>>, equality?: Equality$1<T>): KeyedProjection<O, T>;
|
|
54
|
+
//#endregion
|
|
49
55
|
//#region core/src/projection/derive.d.ts
|
|
50
56
|
type ProjectionDependencies = Readonly<Record<string, Projection<unknown>>>;
|
|
51
57
|
type ProjectionValues<D extends ProjectionDependencies> = { readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never };
|
|
@@ -66,6 +72,7 @@ declare const derive: typeof createValueDerive & {
|
|
|
66
72
|
<K extends string, V, G extends string>(source: KeyedProjection<K, V>, selector: (value: NoInfer<V>, key: NoInfer<K>) => Synchronous<G | readonly G[]>): KeyedProjection<G, readonly K[]>;
|
|
67
73
|
<K extends string, V, const D extends object, G extends string>(source: KeyedProjection<K, V>, dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>, selector: (value: NoInfer<V>, key: NoInfer<K>, dependencies: KeyedDependencyValues<D>) => Synchronous<G | readonly G[]>): KeyedProjection<G, readonly K[]>;
|
|
68
74
|
};
|
|
75
|
+
flatMap: typeof createKeyedFlatMap;
|
|
69
76
|
singleton: <K extends string, V>(source: Projection<V | undefined>, keyOf: (value: V) => Synchronous<K>, equality?: (previous: V, next: V) => boolean) => KeyedProjection<K, V>;
|
|
70
77
|
subset: <K extends string, V>(source: KeyedProjection<K, V>, orderedKeys: Projection<readonly K[]> | readonly K[]) => KeyedProjection<K, V>;
|
|
71
78
|
filter: {
|
|
@@ -91,9 +98,9 @@ type ProjectionRuntime = {
|
|
|
91
98
|
select<T>(projection: Projection<T>): Readable<T>;
|
|
92
99
|
select<T, R>(projection: Projection<T>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
|
|
93
100
|
items<K extends string, V>(projection: KeyedProjection<K, V>): ProjectionItems<K, V>;
|
|
94
|
-
update<T>(input: Input<T>, value: T): void;
|
|
95
|
-
update<K extends string, V>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) =>
|
|
96
|
-
batch<T>(run: () => T
|
|
101
|
+
update<T>(input: Input<T>, value: NoInfer<T>): void;
|
|
102
|
+
update<K extends string, V, R>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => Synchronous<R>): void;
|
|
103
|
+
batch<T>(run: () => Synchronous<T>, options?: {
|
|
97
104
|
readonly cause?: unknown;
|
|
98
105
|
}): T;
|
|
99
106
|
scope(): ProjectionScope;
|
|
@@ -109,9 +116,9 @@ type ProjectionScope = {
|
|
|
109
116
|
select<T>(projection: Projection<T>): Readable<T>;
|
|
110
117
|
select<T, R>(projection: Projection<T>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
|
|
111
118
|
items<K extends string, V>(projection: KeyedProjection<K, V>): ProjectionItems<K, V>;
|
|
112
|
-
update<T>(input: Input<T>, value: T): void;
|
|
113
|
-
update<K extends string, V>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) =>
|
|
114
|
-
batch<T>(run: () => T
|
|
119
|
+
update<T>(input: Input<T>, value: NoInfer<T>): void;
|
|
120
|
+
update<K extends string, V, R>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => Synchronous<R>): void;
|
|
121
|
+
batch<T>(run: () => Synchronous<T>, options?: {
|
|
115
122
|
readonly cause?: unknown;
|
|
116
123
|
}): T;
|
|
117
124
|
dispose(): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $ as table, A as ParseError, B as DocumentListConfig, C as Read, D as ChangeSet, E as Change, F as CollectionPath, G as ReadonlyValue, H as DocumentTreeValue, I as PathValueOf, J as field, K as Schema, L as SchemaPath, M as parse, N as CollectionEntry, O as MemberChange, P as CollectionId, Q as optional, R as DocumentAddress, S as Draft, T as snapshot, U as Infer, V as DocumentTreeNode, W as ObjectSchema, X as map, Y as list, Z as object, _ as Unsubscribe, a as DocumentProblem, b as CollectionImpact, c as HistoryState, d as OperationResult, et as tree, f as ReadonlyDocument, g as Readable, h as TransactionResult, i as DocumentDisposedError, j as ParseIssue, k as ValueTransition, l as LocalHistory, m as TransactionRejected, n as DocumentCommit, o as DocumentReentrancyError, p as Synchronous, q as Validator, r as DocumentDiagnostic, s as DocumentRuntime, t as CommitSource, tt as variant, u as ObserverError, v as MutationIssue, w as replace, x as DocumentImpact, y as MutationIssueCode, z as DocumentAnchor } from "./contract-COgxO5sv.js";
|
|
2
|
-
import { _ as ProjectionDisposedError, a as Input, f as ExternalCollectionEvent, g as ExternalValueSource, h as ExternalValueEvent, i as CollectionInputDraft, m as ExternalCollectionSource, n as KeyedDependencyValues, o as KeyedProjection, p as ExternalCollectionRead, r as CollectionInput, s as Projection, t as KeyedDependencies, v as ProjectionError } from "./dependency-
|
|
2
|
+
import { _ as ProjectionDisposedError, a as Input, f as ExternalCollectionEvent, g as ExternalValueSource, h as ExternalValueEvent, i as CollectionInputDraft, m as ExternalCollectionSource, n as KeyedDependencyValues, o as KeyedProjection, p as ExternalCollectionRead, r as CollectionInput, s as Projection, t as KeyedDependencies, v as ProjectionError } from "./dependency-DzxXGYe1.js";
|
|
3
3
|
|
|
4
4
|
//#region core/src/runtime.d.ts
|
|
5
5
|
declare const createDocument: <S extends ObjectSchema<object>>(input: {
|
|
@@ -30,12 +30,12 @@ declare function observe<S extends ObjectSchema<object>, P extends CollectionPat
|
|
|
30
30
|
declare function observe<S extends ObjectSchema<object>, P>(document: ReadonlyDocument<S>, selector: (path: SchemaPath<S>) => P): Projection<PathValueOf<P>>;
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region core/src/projection/keyed/composition.d.ts
|
|
33
|
-
type Equality$
|
|
34
|
-
declare function createKeyedFrom<K extends string, V>(source: Projection<readonly V[]>, keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$
|
|
35
|
-
declare function createKeyedFrom<K extends string, V>(source: readonly V[], keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$
|
|
33
|
+
type Equality$2<T> = (previous: T, next: T) => boolean;
|
|
34
|
+
declare function createKeyedFrom<K extends string, V>(source: Projection<readonly V[]>, keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$2<V>): KeyedProjection<K, V>;
|
|
35
|
+
declare function createKeyedFrom<K extends string, V>(source: readonly V[], keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$2<V>): KeyedProjection<K, V>;
|
|
36
36
|
declare function createKeyedMerge<K extends string, V>(sources: readonly KeyedProjection<K, V>[], options: {
|
|
37
37
|
readonly conflict: 'error' | 'first' | 'last';
|
|
38
|
-
readonly equality?: Equality$
|
|
38
|
+
readonly equality?: Equality$2<V>;
|
|
39
39
|
readonly resolve?: never;
|
|
40
40
|
} | {
|
|
41
41
|
readonly conflict: 'resolve';
|
|
@@ -43,9 +43,15 @@ declare function createKeyedMerge<K extends string, V>(sources: readonly KeyedPr
|
|
|
43
43
|
readonly sourceIndex: number;
|
|
44
44
|
readonly value: V;
|
|
45
45
|
}[], key: NoInfer<K>) => Synchronous<V>;
|
|
46
|
-
readonly equality?: Equality$
|
|
46
|
+
readonly equality?: Equality$2<V>;
|
|
47
47
|
}): KeyedProjection<K, V>;
|
|
48
48
|
//#endregion
|
|
49
|
+
//#region core/src/projection/keyed/flat-map.d.ts
|
|
50
|
+
type Entries<K extends string, V> = readonly (readonly [K, V])[];
|
|
51
|
+
type Equality$1<V> = (previous: V, next: V) => boolean;
|
|
52
|
+
declare function createKeyedFlatMap<K extends string, V, O extends string, T>(source: KeyedProjection<K, V>, select: (value: NoInfer<V>, key: NoInfer<K>) => Synchronous<Entries<O, T>>, equality?: Equality$1<T>): KeyedProjection<O, T>;
|
|
53
|
+
declare function createKeyedFlatMap<K extends string, V, const D extends object, O extends string, T>(source: KeyedProjection<K, V>, dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>, select: (value: NoInfer<V>, key: NoInfer<K>, dependencies: KeyedDependencyValues<D>) => Synchronous<Entries<O, T>>, equality?: Equality$1<T>): KeyedProjection<O, T>;
|
|
54
|
+
//#endregion
|
|
49
55
|
//#region core/src/projection/derive.d.ts
|
|
50
56
|
type ProjectionDependencies = Readonly<Record<string, Projection<unknown>>>;
|
|
51
57
|
type ProjectionValues<D extends ProjectionDependencies> = { readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never };
|
|
@@ -66,6 +72,7 @@ declare const derive: typeof createValueDerive & {
|
|
|
66
72
|
<K extends string, V, G extends string>(source: KeyedProjection<K, V>, selector: (value: NoInfer<V>, key: NoInfer<K>) => Synchronous<G | readonly G[]>): KeyedProjection<G, readonly K[]>;
|
|
67
73
|
<K extends string, V, const D extends object, G extends string>(source: KeyedProjection<K, V>, dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>, selector: (value: NoInfer<V>, key: NoInfer<K>, dependencies: KeyedDependencyValues<D>) => Synchronous<G | readonly G[]>): KeyedProjection<G, readonly K[]>;
|
|
68
74
|
};
|
|
75
|
+
flatMap: typeof createKeyedFlatMap;
|
|
69
76
|
singleton: <K extends string, V>(source: Projection<V | undefined>, keyOf: (value: V) => Synchronous<K>, equality?: (previous: V, next: V) => boolean) => KeyedProjection<K, V>;
|
|
70
77
|
subset: <K extends string, V>(source: KeyedProjection<K, V>, orderedKeys: Projection<readonly K[]> | readonly K[]) => KeyedProjection<K, V>;
|
|
71
78
|
filter: {
|
|
@@ -91,9 +98,9 @@ type ProjectionRuntime = {
|
|
|
91
98
|
select<T>(projection: Projection<T>): Readable<T>;
|
|
92
99
|
select<T, R>(projection: Projection<T>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
|
|
93
100
|
items<K extends string, V>(projection: KeyedProjection<K, V>): ProjectionItems<K, V>;
|
|
94
|
-
update<T>(input: Input<T>, value: T): void;
|
|
95
|
-
update<K extends string, V>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) =>
|
|
96
|
-
batch<T>(run: () => T
|
|
101
|
+
update<T>(input: Input<T>, value: NoInfer<T>): void;
|
|
102
|
+
update<K extends string, V, R>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => Synchronous<R>): void;
|
|
103
|
+
batch<T>(run: () => Synchronous<T>, options?: {
|
|
97
104
|
readonly cause?: unknown;
|
|
98
105
|
}): T;
|
|
99
106
|
scope(): ProjectionScope;
|
|
@@ -109,9 +116,9 @@ type ProjectionScope = {
|
|
|
109
116
|
select<T>(projection: Projection<T>): Readable<T>;
|
|
110
117
|
select<T, R>(projection: Projection<T>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
|
|
111
118
|
items<K extends string, V>(projection: KeyedProjection<K, V>): ProjectionItems<K, V>;
|
|
112
|
-
update<T>(input: Input<T>, value: T): void;
|
|
113
|
-
update<K extends string, V>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) =>
|
|
114
|
-
batch<T>(run: () => T
|
|
119
|
+
update<T>(input: Input<T>, value: NoInfer<T>): void;
|
|
120
|
+
update<K extends string, V, R>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => Synchronous<R>): void;
|
|
121
|
+
batch<T>(run: () => Synchronous<T>, options?: {
|
|
115
122
|
readonly cause?: unknown;
|
|
116
123
|
}): T;
|
|
117
124
|
dispose(): void;
|