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/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: {
@@ -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>) => void): void;
96
- batch<T>(run: () => T, options?: {
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>) => void): void;
114
- batch<T>(run: () => T, options?: {
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-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: {
@@ -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>) => void): void;
96
- batch<T>(run: () => T, options?: {
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>) => void): void;
114
- batch<T>(run: () => T, options?: {
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;