rads-db 3.0.26 → 3.0.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.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { RadsDb } from '_rads-db';
|
|
|
3
3
|
|
|
4
4
|
type MaybePromise$1<T> = Promise<T> | T;
|
|
5
5
|
type Change<T> = {
|
|
6
|
-
[K in keyof T]?: Change<T[K]
|
|
6
|
+
[K in keyof T]?: T[K] extends any[] ? T[K] : T[K] extends {} ? Change<T[K]> : T[K];
|
|
7
7
|
};
|
|
8
8
|
interface GetManyArgs<E, EN extends keyof EntityMeta, W> extends GetArgs<E, EN, W> {
|
|
9
9
|
cursor?: string | null;
|
|
@@ -52,15 +52,16 @@ interface GetManyResponse<E, EN extends keyof EntityMeta, A extends GetArgs<E, E
|
|
|
52
52
|
type GetResponse<E, EN extends keyof EntityMeta, A extends GetArgs<E, EN, any>> = A extends {
|
|
53
53
|
include: any;
|
|
54
54
|
} ? GetResponseInclude<E, EN, A['include']> : GetResponseNoInclude<E, EN>;
|
|
55
|
+
type RelationData<EN extends keyof EntityMeta, K extends keyof EntityMeta[EN]['relations']> = Pick<EntityMeta[EN]['relations'][K]['entity'], EntityMeta[EN]['relations'][K]['denormFields']>;
|
|
55
56
|
type GetResponseInclude<E, EN extends keyof EntityMeta, I extends GetArgsInclude<E, EN>> = I extends {
|
|
56
57
|
_pick: string[];
|
|
57
58
|
} ? GetResponseIncludeSelect<E, I> : {
|
|
58
|
-
[K in keyof E]: K extends keyof EntityMeta[EN]['relations'] ? K extends keyof I ? GetResponseInclude<EntityMeta[EN]['relations'][K]['entity'], EntityMeta[EN]['relations'][K]['entityName'], I[K]> :
|
|
59
|
+
[K in keyof E]: K extends keyof EntityMeta[EN]['relations'] ? K extends keyof I ? GetResponseInclude<EntityMeta[EN]['relations'][K]['entity'], EntityMeta[EN]['relations'][K]['entityName'], I[K]> : RelationData<EN, K> : E[K];
|
|
59
60
|
};
|
|
60
61
|
interface GetResponseIncludeSelect<E, I> {
|
|
61
62
|
}
|
|
62
63
|
type GetResponseNoInclude<E, EN extends keyof EntityMeta> = {
|
|
63
|
-
[K in keyof E]: K extends keyof EntityMeta[EN]['relations'] ?
|
|
64
|
+
[K in keyof E]: K extends keyof EntityMeta[EN]['relations'] ? E[K] extends any[] ? RelationData<EN, K>[] : RelationData<EN, K> : E[K];
|
|
64
65
|
};
|
|
65
66
|
type DeepPartial<T> = {
|
|
66
67
|
[K in keyof T]?: NonNullable<T[K]> extends Record<string, any> ? DeepPartial<T[K]> : T[K] | null;
|
|
@@ -77,7 +77,9 @@ function verifyEventSourcingSetup(schema, effects) {
|
|
|
77
77
|
events
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
await (0, _radsDb.handlePrecomputed)(
|
|
80
|
+
await (0, _radsDb.handlePrecomputed)(
|
|
81
|
+
// @ts-expect-error TODO wrong types
|
|
82
|
+
{
|
|
81
83
|
...context,
|
|
82
84
|
typeName: entityName
|
|
83
85
|
}, result.map(v => ({
|
|
@@ -70,6 +70,7 @@ function verifyEventSourcingSetup(schema, effects) {
|
|
|
70
70
|
result.push({ aggDoc, events });
|
|
71
71
|
}
|
|
72
72
|
await handlePrecomputed(
|
|
73
|
+
// @ts-expect-error TODO wrong types
|
|
73
74
|
{ ...context, typeName: entityName },
|
|
74
75
|
result.map((v) => ({ doc: v.aggDoc, events: v.events, oldDoc: existingAggregatesById[v.aggDoc.id] })),
|
|
75
76
|
ctx
|