doxum 0.1.32 → 0.1.33

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/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-B1qIJJBL.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-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$1<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$1<V>): KeyedProjection<K, V>;
35
- declare function createKeyedFrom<K extends string, V>(source: readonly V[], keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$1<V>): KeyedProjection<K, V>;
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$1<V>;
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$1<V>;
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: {
@@ -86,14 +93,18 @@ type ProjectionItems<K extends string, V> = {
86
93
  };
87
94
  //#endregion
88
95
  //#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
+ };
89
100
  type ProjectionRuntime = {
90
101
  read<T>(projection: Projection<T>): T;
91
102
  select<T>(projection: Projection<T>): Readable<T>;
92
103
  select<T, R>(projection: Projection<T>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
93
104
  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>) => void): void;
96
- batch<T>(run: () => T, options?: {
105
+ update<T>(input: Input<T>, value: NoInfer<T>): void;
106
+ update<K extends string, V, R>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => Synchronous<R>): void;
107
+ batch<T>(run: (read: BatchRead) => Synchronous<T>, options?: {
97
108
  readonly cause?: unknown;
98
109
  }): T;
99
110
  scope(): ProjectionScope;
@@ -109,9 +120,9 @@ type ProjectionScope = {
109
120
  select<T>(projection: Projection<T>): Readable<T>;
110
121
  select<T, R>(projection: Projection<T>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
111
122
  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>) => void): void;
114
- batch<T>(run: () => T, options?: {
123
+ update<T>(input: Input<T>, value: NoInfer<T>): void;
124
+ update<K extends string, V, R>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => Synchronous<R>): void;
125
+ batch<T>(run: (read: BatchRead) => Synchronous<T>, options?: {
115
126
  readonly cause?: unknown;
116
127
  }): T;
117
128
  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-BRgPvyN6.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-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$1<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$1<V>): KeyedProjection<K, V>;
35
- declare function createKeyedFrom<K extends string, V>(source: readonly V[], keyOf: (value: NoInfer<V>) => Synchronous<K>, equality?: Equality$1<V>): KeyedProjection<K, V>;
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$1<V>;
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$1<V>;
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: {
@@ -86,14 +93,18 @@ type ProjectionItems<K extends string, V> = {
86
93
  };
87
94
  //#endregion
88
95
  //#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
+ };
89
100
  type ProjectionRuntime = {
90
101
  read<T>(projection: Projection<T>): T;
91
102
  select<T>(projection: Projection<T>): Readable<T>;
92
103
  select<T, R>(projection: Projection<T>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
93
104
  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>) => void): void;
96
- batch<T>(run: () => T, options?: {
105
+ update<T>(input: Input<T>, value: NoInfer<T>): void;
106
+ update<K extends string, V, R>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => Synchronous<R>): void;
107
+ batch<T>(run: (read: BatchRead) => Synchronous<T>, options?: {
97
108
  readonly cause?: unknown;
98
109
  }): T;
99
110
  scope(): ProjectionScope;
@@ -109,9 +120,9 @@ type ProjectionScope = {
109
120
  select<T>(projection: Projection<T>): Readable<T>;
110
121
  select<T, R>(projection: Projection<T>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
111
122
  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>) => void): void;
114
- batch<T>(run: () => T, options?: {
123
+ update<T>(input: Input<T>, value: NoInfer<T>): void;
124
+ update<K extends string, V, R>(input: CollectionInput<K, V>, run: (draft: CollectionInputDraft<K, V>) => Synchronous<R>): void;
125
+ batch<T>(run: (read: BatchRead) => Synchronous<T>, options?: {
115
126
  readonly cause?: unknown;
116
127
  }): T;
117
128
  dispose(): void;