doxum 0.1.33 → 0.1.35
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 +18 -7
- package/dist/advanced.cjs +1 -1
- package/dist/advanced.js +1 -1
- package/dist/index.cjs +395 -142
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -11
- package/dist/index.d.ts +13 -11
- package/dist/index.js +395 -142
- package/dist/index.js.map +1 -1
- package/dist/{transform-A9Lx5R2l.js → transform-3mj0eStL.js} +147 -152
- package/dist/transform-3mj0eStL.js.map +1 -0
- package/dist/{transform-CSPGdBe5.cjs → transform-D45KWMzj.cjs} +148 -159
- package/dist/transform-D45KWMzj.cjs.map +1 -0
- package/package.json +1 -1
- package/skills/doxum-runtime/SKILL.md +3 -3
- 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 +48 -20
- package/skills/doxum-runtime/references/public-api.md +22 -21
- package/skills/doxum-runtime/references/recipes.md +25 -2
- package/dist/transform-A9Lx5R2l.js.map +0 -1
- package/dist/transform-CSPGdBe5.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -29,10 +29,18 @@ declare function observe<T>(readable: Readable<T>): Projection<T>;
|
|
|
29
29
|
declare function observe<S extends ObjectSchema<object>, P extends CollectionPath>(document: ReadonlyDocument<S>, selector: (path: SchemaPath<S>) => P): KeyedProjection<CollectionId<P>, ReadonlyValue<CollectionEntry<P>>>;
|
|
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
|
+
//#region core/src/projection/dependency.d.ts
|
|
33
|
+
type ProjectionDependencies = Readonly<Record<string, Projection<unknown>>> & Partial<Record<keyof Projection<unknown>, never>>;
|
|
34
|
+
type ProjectionValues<D extends ProjectionDependencies> = { readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never };
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region core/src/projection/keyed/entries.d.ts
|
|
37
|
+
type KeyedEntries<K extends string, V> = readonly (readonly [K, V])[];
|
|
38
|
+
//#endregion
|
|
32
39
|
//#region core/src/projection/keyed/composition.d.ts
|
|
33
40
|
type Equality$2<T> = (previous: T, next: T) => boolean;
|
|
34
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>;
|
|
35
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<NoInfer<V>>): KeyedProjection<K, V>;
|
|
36
44
|
declare function createKeyedMerge<K extends string, V>(sources: readonly KeyedProjection<K, V>[], options: {
|
|
37
45
|
readonly conflict: 'error' | 'first' | 'last';
|
|
38
46
|
readonly equality?: Equality$2<V>;
|
|
@@ -47,14 +55,11 @@ declare function createKeyedMerge<K extends string, V>(sources: readonly KeyedPr
|
|
|
47
55
|
}): KeyedProjection<K, V>;
|
|
48
56
|
//#endregion
|
|
49
57
|
//#region core/src/projection/keyed/flat-map.d.ts
|
|
50
|
-
type Entries<K extends string, V> = readonly (readonly [K, V])[];
|
|
51
58
|
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<
|
|
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<
|
|
59
|
+
declare function createKeyedFlatMap<K extends string, V, O extends string, T>(source: KeyedProjection<K, V>, select: (value: NoInfer<V>, key: NoInfer<K>) => Synchronous<KeyedEntries<O, T>>, equality?: Equality$1<T>): KeyedProjection<O, T>;
|
|
60
|
+
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<KeyedEntries<O, T>>, equality?: Equality$1<T>): KeyedProjection<O, T>;
|
|
54
61
|
//#endregion
|
|
55
62
|
//#region core/src/projection/derive.d.ts
|
|
56
|
-
type ProjectionDependencies = Readonly<Record<string, Projection<unknown>>>;
|
|
57
|
-
type ProjectionValues<D extends ProjectionDependencies> = { readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never };
|
|
58
63
|
type Equality<T> = (previous: T, next: T) => boolean;
|
|
59
64
|
declare function createValueDerive<const D extends ProjectionDependencies, T>(dependencies: D, compute: (values: ProjectionValues<D>) => Synchronous<T>, equality?: Equality<T>): Projection<T>;
|
|
60
65
|
declare const derive: typeof createValueDerive & {
|
|
@@ -67,6 +72,7 @@ declare const derive: typeof createValueDerive & {
|
|
|
67
72
|
entries: <K extends string, V>(source: KeyedProjection<K, V>) => Projection<readonly (readonly [K, V])[]>;
|
|
68
73
|
get: <K extends string, V>(source: KeyedProjection<K, V>, key: Projection<NoInfer<K> | undefined>, equality?: (previous: V | undefined, next: V | undefined) => boolean) => Projection<V | undefined>;
|
|
69
74
|
from: typeof createKeyedFrom;
|
|
75
|
+
fromEntries: typeof createKeyedFromEntries;
|
|
70
76
|
merge: typeof createKeyedMerge;
|
|
71
77
|
groupBy: {
|
|
72
78
|
<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[]>;
|
|
@@ -93,10 +99,6 @@ type ProjectionItems<K extends string, V> = {
|
|
|
93
99
|
};
|
|
94
100
|
//#endregion
|
|
95
101
|
//#region core/src/projection/runtime.d.ts
|
|
96
|
-
type BatchRead = {
|
|
97
|
-
<T>(input: Input<T>): T;
|
|
98
|
-
<K extends string, V>(input: CollectionInput<K, V>): ReadonlyMap<K, V>;
|
|
99
|
-
};
|
|
100
102
|
type ProjectionRuntime = {
|
|
101
103
|
read<T>(projection: Projection<T>): T;
|
|
102
104
|
select<T>(projection: Projection<T>): Readable<T>;
|
|
@@ -104,7 +106,7 @@ type ProjectionRuntime = {
|
|
|
104
106
|
items<K extends string, V>(projection: KeyedProjection<K, V>): ProjectionItems<K, V>;
|
|
105
107
|
update<T>(input: Input<T>, value: NoInfer<T>): void;
|
|
106
108
|
update<K extends string, V, R>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => Synchronous<R>): void;
|
|
107
|
-
batch<T>(run: (
|
|
109
|
+
batch<T>(run: () => Synchronous<T>, options?: {
|
|
108
110
|
readonly cause?: unknown;
|
|
109
111
|
}): T;
|
|
110
112
|
scope(): ProjectionScope;
|
|
@@ -122,7 +124,7 @@ type ProjectionScope = {
|
|
|
122
124
|
items<K extends string, V>(projection: KeyedProjection<K, V>): ProjectionItems<K, V>;
|
|
123
125
|
update<T>(input: Input<T>, value: NoInfer<T>): void;
|
|
124
126
|
update<K extends string, V, R>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => Synchronous<R>): void;
|
|
125
|
-
batch<T>(run: (
|
|
127
|
+
batch<T>(run: () => Synchronous<T>, options?: {
|
|
126
128
|
readonly cause?: unknown;
|
|
127
129
|
}): T;
|
|
128
130
|
dispose(): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -29,10 +29,18 @@ declare function observe<T>(readable: Readable<T>): Projection<T>;
|
|
|
29
29
|
declare function observe<S extends ObjectSchema<object>, P extends CollectionPath>(document: ReadonlyDocument<S>, selector: (path: SchemaPath<S>) => P): KeyedProjection<CollectionId<P>, ReadonlyValue<CollectionEntry<P>>>;
|
|
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
|
+
//#region core/src/projection/dependency.d.ts
|
|
33
|
+
type ProjectionDependencies = Readonly<Record<string, Projection<unknown>>> & Partial<Record<keyof Projection<unknown>, never>>;
|
|
34
|
+
type ProjectionValues<D extends ProjectionDependencies> = { readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never };
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region core/src/projection/keyed/entries.d.ts
|
|
37
|
+
type KeyedEntries<K extends string, V> = readonly (readonly [K, V])[];
|
|
38
|
+
//#endregion
|
|
32
39
|
//#region core/src/projection/keyed/composition.d.ts
|
|
33
40
|
type Equality$2<T> = (previous: T, next: T) => boolean;
|
|
34
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>;
|
|
35
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<NoInfer<V>>): KeyedProjection<K, V>;
|
|
36
44
|
declare function createKeyedMerge<K extends string, V>(sources: readonly KeyedProjection<K, V>[], options: {
|
|
37
45
|
readonly conflict: 'error' | 'first' | 'last';
|
|
38
46
|
readonly equality?: Equality$2<V>;
|
|
@@ -47,14 +55,11 @@ declare function createKeyedMerge<K extends string, V>(sources: readonly KeyedPr
|
|
|
47
55
|
}): KeyedProjection<K, V>;
|
|
48
56
|
//#endregion
|
|
49
57
|
//#region core/src/projection/keyed/flat-map.d.ts
|
|
50
|
-
type Entries<K extends string, V> = readonly (readonly [K, V])[];
|
|
51
58
|
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<
|
|
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<
|
|
59
|
+
declare function createKeyedFlatMap<K extends string, V, O extends string, T>(source: KeyedProjection<K, V>, select: (value: NoInfer<V>, key: NoInfer<K>) => Synchronous<KeyedEntries<O, T>>, equality?: Equality$1<T>): KeyedProjection<O, T>;
|
|
60
|
+
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<KeyedEntries<O, T>>, equality?: Equality$1<T>): KeyedProjection<O, T>;
|
|
54
61
|
//#endregion
|
|
55
62
|
//#region core/src/projection/derive.d.ts
|
|
56
|
-
type ProjectionDependencies = Readonly<Record<string, Projection<unknown>>>;
|
|
57
|
-
type ProjectionValues<D extends ProjectionDependencies> = { readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never };
|
|
58
63
|
type Equality<T> = (previous: T, next: T) => boolean;
|
|
59
64
|
declare function createValueDerive<const D extends ProjectionDependencies, T>(dependencies: D, compute: (values: ProjectionValues<D>) => Synchronous<T>, equality?: Equality<T>): Projection<T>;
|
|
60
65
|
declare const derive: typeof createValueDerive & {
|
|
@@ -67,6 +72,7 @@ declare const derive: typeof createValueDerive & {
|
|
|
67
72
|
entries: <K extends string, V>(source: KeyedProjection<K, V>) => Projection<readonly (readonly [K, V])[]>;
|
|
68
73
|
get: <K extends string, V>(source: KeyedProjection<K, V>, key: Projection<NoInfer<K> | undefined>, equality?: (previous: V | undefined, next: V | undefined) => boolean) => Projection<V | undefined>;
|
|
69
74
|
from: typeof createKeyedFrom;
|
|
75
|
+
fromEntries: typeof createKeyedFromEntries;
|
|
70
76
|
merge: typeof createKeyedMerge;
|
|
71
77
|
groupBy: {
|
|
72
78
|
<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[]>;
|
|
@@ -93,10 +99,6 @@ type ProjectionItems<K extends string, V> = {
|
|
|
93
99
|
};
|
|
94
100
|
//#endregion
|
|
95
101
|
//#region core/src/projection/runtime.d.ts
|
|
96
|
-
type BatchRead = {
|
|
97
|
-
<T>(input: Input<T>): T;
|
|
98
|
-
<K extends string, V>(input: CollectionInput<K, V>): ReadonlyMap<K, V>;
|
|
99
|
-
};
|
|
100
102
|
type ProjectionRuntime = {
|
|
101
103
|
read<T>(projection: Projection<T>): T;
|
|
102
104
|
select<T>(projection: Projection<T>): Readable<T>;
|
|
@@ -104,7 +106,7 @@ type ProjectionRuntime = {
|
|
|
104
106
|
items<K extends string, V>(projection: KeyedProjection<K, V>): ProjectionItems<K, V>;
|
|
105
107
|
update<T>(input: Input<T>, value: NoInfer<T>): void;
|
|
106
108
|
update<K extends string, V, R>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => Synchronous<R>): void;
|
|
107
|
-
batch<T>(run: (
|
|
109
|
+
batch<T>(run: () => Synchronous<T>, options?: {
|
|
108
110
|
readonly cause?: unknown;
|
|
109
111
|
}): T;
|
|
110
112
|
scope(): ProjectionScope;
|
|
@@ -122,7 +124,7 @@ type ProjectionScope = {
|
|
|
122
124
|
items<K extends string, V>(projection: KeyedProjection<K, V>): ProjectionItems<K, V>;
|
|
123
125
|
update<T>(input: Input<T>, value: NoInfer<T>): void;
|
|
124
126
|
update<K extends string, V, R>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => Synchronous<R>): void;
|
|
125
|
-
batch<T>(run: (
|
|
127
|
+
batch<T>(run: () => Synchronous<T>, options?: {
|
|
126
128
|
readonly cause?: unknown;
|
|
127
129
|
}): T;
|
|
128
130
|
dispose(): void;
|