doxum 0.1.26 → 0.1.27

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
@@ -33,24 +33,48 @@ declare function observe<S extends ObjectSchema<object>, P>(document: ReadonlyDo
33
33
  type ProjectionDependencies = Readonly<Record<string, Projection<unknown>>>;
34
34
  type ProjectionValues<D extends ProjectionDependencies> = { readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never };
35
35
  type Equality<T> = (previous: T, next: T) => boolean;
36
- /** A declared dynamic lookup from one driver entry to one key in another keyed projection. */
37
- type KeyedDependency<DriverKey extends string, DriverValue, SourceKey extends string = string, SourceValue = unknown> = {
38
- readonly source: KeyedProjection<SourceKey, SourceValue>;
39
- readonly key: (value: DriverValue, key: DriverKey) => Synchronous<SourceKey | undefined>;
40
- };
41
- type KeyedDeriveDependency<K extends string, V> = (Projection<unknown> & {
42
- readonly source?: never;
43
- readonly key?: never;
44
- }) | KeyedDependency<K, V, string, unknown>;
45
- type KeyedDeriveDependencies<K extends string, V, D extends object> = { readonly [P in keyof D]: P extends string ? KeyedDeriveDependency<K, V> : never };
46
- type KeyedDependencyValues<D extends Readonly<Record<string, unknown>>> = { readonly [P in keyof D]: D[P] extends {
47
- readonly source: KeyedProjection<infer _K extends string, infer V>;
48
- } ? V | undefined : D[P] extends Projection<infer T> ? T : never };
49
36
  declare function createValueDerive<const D extends ProjectionDependencies, T>(dependencies: D, compute: (values: ProjectionValues<D>) => Synchronous<T>, equality?: Equality<T>): Projection<T>;
50
- declare function createKeyedDerive<K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: V, key: K) => Synchronous<T>, equality?: Equality<T>): KeyedProjection<K, T>;
51
- declare function createKeyedDerive<K extends string, V, const D extends object & KeyedDeriveDependencies<K, V, D>, T>(source: KeyedProjection<K, V>, dependencies: D, select: (value: V, key: K, dependencies: KeyedDependencyValues<D>) => Synchronous<T>, equality?: Equality<T>): KeyedProjection<K, T>;
52
37
  declare const derive: typeof createValueDerive & {
53
- keyed: typeof createKeyedDerive;
38
+ keyed: {
39
+ <K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: V, key: K) => Synchronous<T>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
40
+ <K extends string, V, const D extends object & { readonly [P in keyof D]: P extends string ? (Projection<unknown> & {
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>;
49
+ } & {
50
+ keys: <K extends string, V>(source: KeyedProjection<K, V>) => Projection<readonly K[]>;
51
+ values: <K extends string, V>(source: KeyedProjection<K, V>) => Projection<readonly V[]>;
52
+ subset: <K extends string, V>(source: KeyedProjection<K, V>, orderedKeys: Projection<readonly K[]> | readonly K[]) => KeyedProjection<K, V>;
53
+ filter: {
54
+ <K extends string, V>(source: KeyedProjection<K, V>, predicate: (value: V, key: K) => Synchronous<boolean>): KeyedProjection<K, V>;
55
+ <K extends string, V, const D extends object & { readonly [P in keyof D]: P extends string ? (Projection<unknown> & {
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>;
64
+ };
65
+ compact: {
66
+ <K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: V, key: K) => Synchronous<T | undefined>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
67
+ <K extends string, V, const D extends object & { readonly [P in keyof D]: P extends string ? (Projection<unknown> & {
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>;
76
+ };
77
+ };
54
78
  };
55
79
  //#endregion
56
80
  //#region core/src/projection/runtime.d.ts
package/dist/index.d.ts CHANGED
@@ -33,24 +33,48 @@ declare function observe<S extends ObjectSchema<object>, P>(document: ReadonlyDo
33
33
  type ProjectionDependencies = Readonly<Record<string, Projection<unknown>>>;
34
34
  type ProjectionValues<D extends ProjectionDependencies> = { readonly [K in keyof D]: D[K] extends Projection<infer T> ? T : never };
35
35
  type Equality<T> = (previous: T, next: T) => boolean;
36
- /** A declared dynamic lookup from one driver entry to one key in another keyed projection. */
37
- type KeyedDependency<DriverKey extends string, DriverValue, SourceKey extends string = string, SourceValue = unknown> = {
38
- readonly source: KeyedProjection<SourceKey, SourceValue>;
39
- readonly key: (value: DriverValue, key: DriverKey) => Synchronous<SourceKey | undefined>;
40
- };
41
- type KeyedDeriveDependency<K extends string, V> = (Projection<unknown> & {
42
- readonly source?: never;
43
- readonly key?: never;
44
- }) | KeyedDependency<K, V, string, unknown>;
45
- type KeyedDeriveDependencies<K extends string, V, D extends object> = { readonly [P in keyof D]: P extends string ? KeyedDeriveDependency<K, V> : never };
46
- type KeyedDependencyValues<D extends Readonly<Record<string, unknown>>> = { readonly [P in keyof D]: D[P] extends {
47
- readonly source: KeyedProjection<infer _K extends string, infer V>;
48
- } ? V | undefined : D[P] extends Projection<infer T> ? T : never };
49
36
  declare function createValueDerive<const D extends ProjectionDependencies, T>(dependencies: D, compute: (values: ProjectionValues<D>) => Synchronous<T>, equality?: Equality<T>): Projection<T>;
50
- declare function createKeyedDerive<K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: V, key: K) => Synchronous<T>, equality?: Equality<T>): KeyedProjection<K, T>;
51
- declare function createKeyedDerive<K extends string, V, const D extends object & KeyedDeriveDependencies<K, V, D>, T>(source: KeyedProjection<K, V>, dependencies: D, select: (value: V, key: K, dependencies: KeyedDependencyValues<D>) => Synchronous<T>, equality?: Equality<T>): KeyedProjection<K, T>;
52
37
  declare const derive: typeof createValueDerive & {
53
- keyed: typeof createKeyedDerive;
38
+ keyed: {
39
+ <K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: V, key: K) => Synchronous<T>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
40
+ <K extends string, V, const D extends object & { readonly [P in keyof D]: P extends string ? (Projection<unknown> & {
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>;
49
+ } & {
50
+ keys: <K extends string, V>(source: KeyedProjection<K, V>) => Projection<readonly K[]>;
51
+ values: <K extends string, V>(source: KeyedProjection<K, V>) => Projection<readonly V[]>;
52
+ subset: <K extends string, V>(source: KeyedProjection<K, V>, orderedKeys: Projection<readonly K[]> | readonly K[]) => KeyedProjection<K, V>;
53
+ filter: {
54
+ <K extends string, V>(source: KeyedProjection<K, V>, predicate: (value: V, key: K) => Synchronous<boolean>): KeyedProjection<K, V>;
55
+ <K extends string, V, const D extends object & { readonly [P in keyof D]: P extends string ? (Projection<unknown> & {
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>;
64
+ };
65
+ compact: {
66
+ <K extends string, V, T>(source: KeyedProjection<K, V>, select: (value: V, key: K) => Synchronous<T | undefined>, equality?: (previous: T, next: T) => boolean): KeyedProjection<K, T>;
67
+ <K extends string, V, const D extends object & { readonly [P in keyof D]: P extends string ? (Projection<unknown> & {
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>;
76
+ };
77
+ };
54
78
  };
55
79
  //#endregion
56
80
  //#region core/src/projection/runtime.d.ts