doxum 0.1.27 → 0.1.28
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 +66 -3
- package/dist/advanced.cjs +40 -14
- package/dist/advanced.cjs.map +1 -1
- package/dist/advanced.d.cts +27 -2
- package/dist/advanced.d.ts +27 -2
- package/dist/advanced.js +27 -1
- package/dist/advanced.js.map +1 -1
- package/dist/{definition-xgk3YNBp.d.ts → dependency-B3E65M1E.d.cts} +27 -3
- package/dist/{definition-CDOuvb5C.d.cts → dependency-BYbdDHNa.d.ts} +27 -3
- package/dist/driver-B5vdPohL.js.map +1 -1
- package/dist/driver-BL91gn7_.cjs.map +1 -1
- package/dist/index.cjs +663 -344
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -32
- package/dist/index.d.ts +23 -32
- package/dist/index.js +549 -230
- package/dist/index.js.map +1 -1
- package/dist/local-sync.cjs.map +1 -1
- package/dist/local-sync.js.map +1 -1
- package/dist/{scheduler-vzf3OcjT.js → transform-B4T3AcJr.js} +356 -11
- package/dist/transform-B4T3AcJr.js.map +1 -0
- package/dist/{scheduler-k1ZGR1PG.cjs → transform-DUleAsG0.cjs} +393 -12
- package/dist/transform-DUleAsG0.cjs.map +1 -0
- package/package.json +1 -1
- package/skills/doxum-runtime/SKILL.md +11 -5
- package/skills/doxum-runtime/references/api.en.md +40 -21
- package/skills/doxum-runtime/references/api.zh-CN.md +21 -2
- package/skills/doxum-runtime/references/guide.en.md +2 -1
- package/skills/doxum-runtime/references/guide.zh-CN.md +2 -1
- package/skills/doxum-runtime/references/invariants.en.md +2 -2
- package/skills/doxum-runtime/references/invariants.zh-CN.md +2 -2
- package/skills/doxum-runtime/references/patterns.en.md +1 -1
- package/skills/doxum-runtime/references/patterns.zh-CN.md +1 -1
- package/skills/doxum-runtime/references/projections.en.md +47 -3
- package/skills/doxum-runtime/references/projections.zh-CN.md +45 -3
- package/dist/scheduler-k1ZGR1PG.cjs.map +0 -1
- package/dist/scheduler-vzf3OcjT.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 {
|
|
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-B3E65M1E.cjs";
|
|
3
3
|
|
|
4
4
|
//#region core/src/runtime.d.ts
|
|
5
5
|
declare const createDocument: <S extends ObjectSchema<object>>(input: {
|
|
@@ -36,52 +36,42 @@ type Equality<T> = (previous: T, next: T) => boolean;
|
|
|
36
36
|
declare function createValueDerive<const D extends ProjectionDependencies, T>(dependencies: D, compute: (values: ProjectionValues<D>) => Synchronous<T>, equality?: Equality<T>): Projection<T>;
|
|
37
37
|
declare const derive: typeof createValueDerive & {
|
|
38
38
|
keyed: {
|
|
39
|
-
<K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: V
|
|
40
|
-
<K extends string, V, const D extends object
|
|
41
|
-
readonly source?: never;
|
|
42
|
-
readonly key?: never;
|
|
43
|
-
}) | {
|
|
44
|
-
readonly source: KeyedProjection<string, unknown>;
|
|
45
|
-
readonly key: (value: V, key: K) => Synchronous<string | undefined>;
|
|
46
|
-
} : never }, T>(source: KeyedProjection<K, V>, dependencies: D, select: (value: V, key: K, dependencies: { readonly [P_1 in keyof D]: D[P_1] extends {
|
|
47
|
-
readonly source: KeyedProjection<infer _K extends string, infer V_1>;
|
|
48
|
-
} ? V_1 | undefined : D[P_1] extends Projection<infer T_1> ? T_1 : never }) => Synchronous<T>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
|
|
39
|
+
<K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: NoInfer<V>, key: NoInfer<K>) => Synchronous<T>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
|
|
40
|
+
<K extends string, V, const D extends object, T>(source: KeyedProjection<K, V>, dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>, select: (value: NoInfer<V>, key: NoInfer<K>, dependencies: KeyedDependencyValues<D>) => Synchronous<T>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
|
|
49
41
|
} & {
|
|
50
42
|
keys: <K extends string, V>(source: KeyedProjection<K, V>) => Projection<readonly K[]>;
|
|
51
43
|
values: <K extends string, V>(source: KeyedProjection<K, V>) => Projection<readonly V[]>;
|
|
44
|
+
entries: <K extends string, V>(source: KeyedProjection<K, V>) => Projection<readonly (readonly [K, V])[]>;
|
|
45
|
+
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>;
|
|
46
|
+
groupBy: {
|
|
47
|
+
<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[]>;
|
|
48
|
+
<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[]>;
|
|
49
|
+
};
|
|
50
|
+
singleton: <K extends string, V>(source: Projection<V | undefined>, keyOf: (value: V) => Synchronous<K>, equality?: (previous: V, next: V) => boolean) => KeyedProjection<K, V>;
|
|
52
51
|
subset: <K extends string, V>(source: KeyedProjection<K, V>, orderedKeys: Projection<readonly K[]> | readonly K[]) => KeyedProjection<K, V>;
|
|
53
52
|
filter: {
|
|
54
|
-
<K extends string, V>(source: KeyedProjection<K, V>, predicate: (value: V
|
|
55
|
-
<K extends string, V, const D extends object
|
|
56
|
-
readonly source?: never;
|
|
57
|
-
readonly key?: never;
|
|
58
|
-
}) | {
|
|
59
|
-
readonly source: KeyedProjection<string, unknown>;
|
|
60
|
-
readonly key: (value: V, key: K) => Synchronous<string | undefined>;
|
|
61
|
-
} : never }>(source: KeyedProjection<K, V>, dependencies: D, predicate: (value: V, key: K, dependencies: { readonly [P_1 in keyof D]: D[P_1] extends {
|
|
62
|
-
readonly source: KeyedProjection<infer _K extends string, infer V_1>;
|
|
63
|
-
} ? V_1 | undefined : D[P_1] extends Projection<infer T> ? T : never }) => Synchronous<boolean>): KeyedProjection<K, V>;
|
|
53
|
+
<K extends string, V>(source: KeyedProjection<K, V>, predicate: (value: NoInfer<V>, key: NoInfer<K>) => Synchronous<boolean>): KeyedProjection<K, V>;
|
|
54
|
+
<K extends string, V, const D extends object>(source: KeyedProjection<K, V>, dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>, predicate: (value: NoInfer<V>, key: NoInfer<K>, dependencies: KeyedDependencyValues<D>) => Synchronous<boolean>): KeyedProjection<K, V>;
|
|
64
55
|
};
|
|
65
56
|
compact: {
|
|
66
|
-
<K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: V
|
|
67
|
-
<K extends string, V, const D extends object
|
|
68
|
-
readonly source?: never;
|
|
69
|
-
readonly key?: never;
|
|
70
|
-
}) | {
|
|
71
|
-
readonly source: KeyedProjection<string, unknown>;
|
|
72
|
-
readonly key: (value: V, key: K) => Synchronous<string | undefined>;
|
|
73
|
-
} : never }, T>(source: KeyedProjection<K, V>, dependencies: D, select: (value: V, key: K, dependencies: { readonly [P_1 in keyof D]: D[P_1] extends {
|
|
74
|
-
readonly source: KeyedProjection<infer _K extends string, infer V_1>;
|
|
75
|
-
} ? V_1 | undefined : D[P_1] extends Projection<infer T_1> ? T_1 : never }) => Synchronous<T | undefined>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
|
|
57
|
+
<K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: NoInfer<V>, key: NoInfer<K>) => Synchronous<T | undefined>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
|
|
58
|
+
<K extends string, V, const D extends object, T>(source: KeyedProjection<K, V>, dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>, select: (value: NoInfer<V>, key: NoInfer<K>, dependencies: KeyedDependencyValues<D>) => Synchronous<T | undefined>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
|
|
76
59
|
};
|
|
77
60
|
};
|
|
78
61
|
};
|
|
79
62
|
//#endregion
|
|
63
|
+
//#region core/src/projection/readable/keyed.d.ts
|
|
64
|
+
type ProjectionItems<K extends string, V> = {
|
|
65
|
+
readonly keys: Readable<readonly K[]>;
|
|
66
|
+
get(key: K): Readable<V | undefined>;
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
80
69
|
//#region core/src/projection/runtime.d.ts
|
|
81
70
|
type ProjectionRuntime = {
|
|
82
71
|
read<T>(projection: Projection<T>): T;
|
|
83
72
|
select<T>(projection: Projection<T>): Readable<T>;
|
|
84
73
|
select<T, R>(projection: Projection<T>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
|
|
74
|
+
items<K extends string, V>(projection: KeyedProjection<K, V>): ProjectionItems<K, V>;
|
|
85
75
|
update<T>(input: Input<T>, value: T): void;
|
|
86
76
|
update<K extends string, V>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => void): void;
|
|
87
77
|
batch<T>(run: () => T, options?: {
|
|
@@ -99,6 +89,7 @@ type ProjectionScope = {
|
|
|
99
89
|
read<T>(projection: Projection<T>): T;
|
|
100
90
|
select<T>(projection: Projection<T>): Readable<T>;
|
|
101
91
|
select<T, R>(projection: Projection<T>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
|
|
92
|
+
items<K extends string, V>(projection: KeyedProjection<K, V>): ProjectionItems<K, V>;
|
|
102
93
|
update<T>(input: Input<T>, value: T): void;
|
|
103
94
|
update<K extends string, V>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => void): void;
|
|
104
95
|
batch<T>(run: () => T, options?: {
|
|
@@ -110,5 +101,5 @@ declare const createProjectionRuntime: (options?: {
|
|
|
110
101
|
readonly onError?: (error: ProjectionError) => void;
|
|
111
102
|
}) => ProjectionRuntime;
|
|
112
103
|
//#endregion
|
|
113
|
-
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 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 };
|
|
104
|
+
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 };
|
|
114
105
|
//# sourceMappingURL=index.d.cts.map
|
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 {
|
|
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-BYbdDHNa.js";
|
|
3
3
|
|
|
4
4
|
//#region core/src/runtime.d.ts
|
|
5
5
|
declare const createDocument: <S extends ObjectSchema<object>>(input: {
|
|
@@ -36,52 +36,42 @@ type Equality<T> = (previous: T, next: T) => boolean;
|
|
|
36
36
|
declare function createValueDerive<const D extends ProjectionDependencies, T>(dependencies: D, compute: (values: ProjectionValues<D>) => Synchronous<T>, equality?: Equality<T>): Projection<T>;
|
|
37
37
|
declare const derive: typeof createValueDerive & {
|
|
38
38
|
keyed: {
|
|
39
|
-
<K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: V
|
|
40
|
-
<K extends string, V, const D extends object
|
|
41
|
-
readonly source?: never;
|
|
42
|
-
readonly key?: never;
|
|
43
|
-
}) | {
|
|
44
|
-
readonly source: KeyedProjection<string, unknown>;
|
|
45
|
-
readonly key: (value: V, key: K) => Synchronous<string | undefined>;
|
|
46
|
-
} : never }, T>(source: KeyedProjection<K, V>, dependencies: D, select: (value: V, key: K, dependencies: { readonly [P_1 in keyof D]: D[P_1] extends {
|
|
47
|
-
readonly source: KeyedProjection<infer _K extends string, infer V_1>;
|
|
48
|
-
} ? V_1 | undefined : D[P_1] extends Projection<infer T_1> ? T_1 : never }) => Synchronous<T>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
|
|
39
|
+
<K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: NoInfer<V>, key: NoInfer<K>) => Synchronous<T>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
|
|
40
|
+
<K extends string, V, const D extends object, T>(source: KeyedProjection<K, V>, dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>, select: (value: NoInfer<V>, key: NoInfer<K>, dependencies: KeyedDependencyValues<D>) => Synchronous<T>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
|
|
49
41
|
} & {
|
|
50
42
|
keys: <K extends string, V>(source: KeyedProjection<K, V>) => Projection<readonly K[]>;
|
|
51
43
|
values: <K extends string, V>(source: KeyedProjection<K, V>) => Projection<readonly V[]>;
|
|
44
|
+
entries: <K extends string, V>(source: KeyedProjection<K, V>) => Projection<readonly (readonly [K, V])[]>;
|
|
45
|
+
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>;
|
|
46
|
+
groupBy: {
|
|
47
|
+
<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[]>;
|
|
48
|
+
<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[]>;
|
|
49
|
+
};
|
|
50
|
+
singleton: <K extends string, V>(source: Projection<V | undefined>, keyOf: (value: V) => Synchronous<K>, equality?: (previous: V, next: V) => boolean) => KeyedProjection<K, V>;
|
|
52
51
|
subset: <K extends string, V>(source: KeyedProjection<K, V>, orderedKeys: Projection<readonly K[]> | readonly K[]) => KeyedProjection<K, V>;
|
|
53
52
|
filter: {
|
|
54
|
-
<K extends string, V>(source: KeyedProjection<K, V>, predicate: (value: V
|
|
55
|
-
<K extends string, V, const D extends object
|
|
56
|
-
readonly source?: never;
|
|
57
|
-
readonly key?: never;
|
|
58
|
-
}) | {
|
|
59
|
-
readonly source: KeyedProjection<string, unknown>;
|
|
60
|
-
readonly key: (value: V, key: K) => Synchronous<string | undefined>;
|
|
61
|
-
} : never }>(source: KeyedProjection<K, V>, dependencies: D, predicate: (value: V, key: K, dependencies: { readonly [P_1 in keyof D]: D[P_1] extends {
|
|
62
|
-
readonly source: KeyedProjection<infer _K extends string, infer V_1>;
|
|
63
|
-
} ? V_1 | undefined : D[P_1] extends Projection<infer T> ? T : never }) => Synchronous<boolean>): KeyedProjection<K, V>;
|
|
53
|
+
<K extends string, V>(source: KeyedProjection<K, V>, predicate: (value: NoInfer<V>, key: NoInfer<K>) => Synchronous<boolean>): KeyedProjection<K, V>;
|
|
54
|
+
<K extends string, V, const D extends object>(source: KeyedProjection<K, V>, dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>, predicate: (value: NoInfer<V>, key: NoInfer<K>, dependencies: KeyedDependencyValues<D>) => Synchronous<boolean>): KeyedProjection<K, V>;
|
|
64
55
|
};
|
|
65
56
|
compact: {
|
|
66
|
-
<K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: V
|
|
67
|
-
<K extends string, V, const D extends object
|
|
68
|
-
readonly source?: never;
|
|
69
|
-
readonly key?: never;
|
|
70
|
-
}) | {
|
|
71
|
-
readonly source: KeyedProjection<string, unknown>;
|
|
72
|
-
readonly key: (value: V, key: K) => Synchronous<string | undefined>;
|
|
73
|
-
} : never }, T>(source: KeyedProjection<K, V>, dependencies: D, select: (value: V, key: K, dependencies: { readonly [P_1 in keyof D]: D[P_1] extends {
|
|
74
|
-
readonly source: KeyedProjection<infer _K extends string, infer V_1>;
|
|
75
|
-
} ? V_1 | undefined : D[P_1] extends Projection<infer T_1> ? T_1 : never }) => Synchronous<T | undefined>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
|
|
57
|
+
<K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: NoInfer<V>, key: NoInfer<K>) => Synchronous<T | undefined>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
|
|
58
|
+
<K extends string, V, const D extends object, T>(source: KeyedProjection<K, V>, dependencies: D & KeyedDependencies<NoInfer<K>, NoInfer<V>, D>, select: (value: NoInfer<V>, key: NoInfer<K>, dependencies: KeyedDependencyValues<D>) => Synchronous<T | undefined>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
|
|
76
59
|
};
|
|
77
60
|
};
|
|
78
61
|
};
|
|
79
62
|
//#endregion
|
|
63
|
+
//#region core/src/projection/readable/keyed.d.ts
|
|
64
|
+
type ProjectionItems<K extends string, V> = {
|
|
65
|
+
readonly keys: Readable<readonly K[]>;
|
|
66
|
+
get(key: K): Readable<V | undefined>;
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
80
69
|
//#region core/src/projection/runtime.d.ts
|
|
81
70
|
type ProjectionRuntime = {
|
|
82
71
|
read<T>(projection: Projection<T>): T;
|
|
83
72
|
select<T>(projection: Projection<T>): Readable<T>;
|
|
84
73
|
select<T, R>(projection: Projection<T>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
|
|
74
|
+
items<K extends string, V>(projection: KeyedProjection<K, V>): ProjectionItems<K, V>;
|
|
85
75
|
update<T>(input: Input<T>, value: T): void;
|
|
86
76
|
update<K extends string, V>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => void): void;
|
|
87
77
|
batch<T>(run: () => T, options?: {
|
|
@@ -99,6 +89,7 @@ type ProjectionScope = {
|
|
|
99
89
|
read<T>(projection: Projection<T>): T;
|
|
100
90
|
select<T>(projection: Projection<T>): Readable<T>;
|
|
101
91
|
select<T, R>(projection: Projection<T>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
|
|
92
|
+
items<K extends string, V>(projection: KeyedProjection<K, V>): ProjectionItems<K, V>;
|
|
102
93
|
update<T>(input: Input<T>, value: T): void;
|
|
103
94
|
update<K extends string, V>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => void): void;
|
|
104
95
|
batch<T>(run: () => T, options?: {
|
|
@@ -110,5 +101,5 @@ declare const createProjectionRuntime: (options?: {
|
|
|
110
101
|
readonly onError?: (error: ProjectionError) => void;
|
|
111
102
|
}) => ProjectionRuntime;
|
|
112
103
|
//#endregion
|
|
113
|
-
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 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 };
|
|
104
|
+
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 };
|
|
114
105
|
//# sourceMappingURL=index.d.ts.map
|