rads-db 3.0.54 → 3.0.56
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 +24 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -52,24 +52,31 @@ type GetArgsInclude<EN extends keyof EntityMeta, R extends keyof EntityMeta[EN][
|
|
|
52
52
|
type GetAggResponse<EN extends keyof EntityMeta, A extends GetAggArgs<EN, any>> = {
|
|
53
53
|
[K in A['agg'][0]]: K extends '_count' ? number : number | undefined;
|
|
54
54
|
};
|
|
55
|
-
interface GetManyResponse<
|
|
56
|
-
nodes: GetResponse<
|
|
55
|
+
interface GetManyResponse<EN extends keyof EntityMeta, A extends GetArgs<EN, any>> {
|
|
56
|
+
nodes: GetResponse<EN, A>[];
|
|
57
57
|
cursor: string | null;
|
|
58
58
|
}
|
|
59
|
-
type GetResponse<
|
|
59
|
+
type GetResponse<EN extends keyof EntityMeta, A extends GetArgs<EN, any>> = A extends {
|
|
60
60
|
include: any;
|
|
61
|
-
} ? GetResponseInclude<
|
|
61
|
+
} ? GetResponseInclude<EN, A['include']> : GetResponseNoInclude<EN>;
|
|
62
|
+
type Get<EntityName extends keyof EntityMeta, Include extends keyof EntityMeta[EntityName]['relations'] | GetArgsInclude<EntityName> = {}> = Include extends GetArgsInclude<EntityName> ? GetResponse<EntityName, {
|
|
63
|
+
include: Include;
|
|
64
|
+
}> : GetResponse<EntityName, {
|
|
65
|
+
include: {
|
|
66
|
+
[K in Include]: {};
|
|
67
|
+
};
|
|
68
|
+
}>;
|
|
62
69
|
type RelationData<EN extends keyof EntityMeta, K extends keyof EntityMeta[EN]['relations']> = Pick<EntityMeta[EN]['relations'][K]['entity'], EntityMeta[EN]['relations'][K]['denormFields']>;
|
|
63
70
|
type KeepArray<TMaybeArray, TType> = NonNullable<TMaybeArray> extends any[] ? TType[] : TType;
|
|
64
|
-
type GetResponseInclude<
|
|
71
|
+
type GetResponseInclude<EN extends keyof EntityMeta, I extends GetArgsInclude<EN>> = I extends {
|
|
65
72
|
_pick: string[];
|
|
66
|
-
} ? GetResponseIncludeSelect<
|
|
67
|
-
[K in keyof
|
|
73
|
+
} ? GetResponseIncludeSelect<EN, I> : {
|
|
74
|
+
[K in keyof EntityMeta[EN]['type']]: K extends keyof EntityMeta[EN]['relations'] ? K extends keyof I ? KeepArray<EntityMeta[EN]['type'][K], GetResponseInclude<EntityMeta[EN]['relations'][K]['entityName'], I[K]>> : KeepArray<EntityMeta[EN]['type'][K], RelationData<EN, K>> : EntityMeta[EN]['type'][K];
|
|
68
75
|
};
|
|
69
|
-
interface GetResponseIncludeSelect<
|
|
76
|
+
interface GetResponseIncludeSelect<EN extends keyof EntityMeta, I> {
|
|
70
77
|
}
|
|
71
|
-
type GetResponseNoInclude<
|
|
72
|
-
[K in keyof
|
|
78
|
+
type GetResponseNoInclude<EN extends keyof EntityMeta> = {
|
|
79
|
+
[K in keyof EntityMeta[EN]['type']]: K extends keyof EntityMeta[EN]['relations'] ? KeepArray<EntityMeta[EN]['type'][K], RelationData<EN, K>> : EntityMeta[EN]['type'][K];
|
|
73
80
|
};
|
|
74
81
|
type DeepPartialWithNulls<T> = {
|
|
75
82
|
[K in keyof T]?: NonNullable<T[K]> extends any[] ? DeepPartialWithNullsItem<NonNullable<T[K]>[number]>[] : DeepPartialWithNullsItem<NonNullable<T[K]>>;
|
|
@@ -88,6 +95,7 @@ type Relation<T extends {
|
|
|
88
95
|
type PutArgs<T> = {
|
|
89
96
|
id: string;
|
|
90
97
|
} & DeepPartialWithNulls<T>;
|
|
98
|
+
type Put<EntityName extends keyof EntityMeta> = PutArgs<EntityMeta[EntityName]['type']>;
|
|
91
99
|
type DeepKeys<T> = T extends object ? {
|
|
92
100
|
[K in (string | number) & keyof T]: `${`.${K}` | (`${K}` extends `${number}` ? `[${K}]` : never)}${'' | DeepKeys<T[K]>}`;
|
|
93
101
|
}[(string | number) & keyof T] : never;
|
|
@@ -97,12 +105,12 @@ interface EntityMethods<E, EN extends keyof EntityMeta, W> {
|
|
|
97
105
|
/** Used to access underlying mechanism of storage directly.
|
|
98
106
|
* Warning: bypasses all rads features - schema won't be validated, default values won't be filled, etc. */
|
|
99
107
|
driver: Driver;
|
|
100
|
-
get<A extends GetArgs<EN, W>>(args: A, ctx?: RadsRequestContext): MaybePromise$1<GetResponse<
|
|
101
|
-
getMany<A extends GetManyArgs<EN, W>>(args?: A, ctx?: RadsRequestContext): MaybePromise$1<GetManyResponse<
|
|
108
|
+
get<A extends GetArgs<EN, W>>(args: A, ctx?: RadsRequestContext): MaybePromise$1<GetResponse<EN, A>>;
|
|
109
|
+
getMany<A extends GetManyArgs<EN, W>>(args?: A, ctx?: RadsRequestContext): MaybePromise$1<GetManyResponse<EN, A>>;
|
|
102
110
|
getAgg<A extends GetAggArgs<EN, W>>(args: A, ctx?: RadsRequestContext): MaybePromise$1<GetAggResponse<EN, A>>;
|
|
103
|
-
getAll<A extends GetManyArgs<EN, W>>(args?: A, ctx?: RadsRequestContext): MaybePromise$1<GetManyResponse<
|
|
104
|
-
put(data: PutArgs<E>, ctx?: RadsRequestContext): MaybePromise$1<GetResponseNoInclude<
|
|
105
|
-
putMany(data: PutArgs<E>[], ctx?: RadsRequestContext): MaybePromise$1<GetResponseNoInclude<
|
|
111
|
+
getAll<A extends GetManyArgs<EN, W>>(args?: A, ctx?: RadsRequestContext): MaybePromise$1<GetManyResponse<EN, A>['nodes']>;
|
|
112
|
+
put(data: PutArgs<E>, ctx?: RadsRequestContext): MaybePromise$1<GetResponseNoInclude<EN>>;
|
|
113
|
+
putMany(data: PutArgs<E>[], ctx?: RadsRequestContext): MaybePromise$1<GetResponseNoInclude<EN>[]>;
|
|
106
114
|
verifyMany<A extends VerifyManyArgs<EN, W>>(args?: A, ctx?: RadsRequestContext): MaybePromise$1<VerifyManyResponse>;
|
|
107
115
|
verifyAll<A extends VerifyManyArgs<EN, W>>(args?: A, ctx?: RadsRequestContext): MaybePromise$1<Pick<VerifyManyResponse, 'correctCount' | 'incorrectCount'>>;
|
|
108
116
|
}
|
|
@@ -440,4 +448,4 @@ declare function createRadsDb(args?: CreateRadsDbArgs): RadsDb;
|
|
|
440
448
|
*/
|
|
441
449
|
declare function createRadsDbClient(args?: CreateRadsDbClientArgs): RadsDb;
|
|
442
450
|
|
|
443
|
-
export { Change, ComputedContext, ComputedContextGlobal, ComputedDecoratorArgs, CreateRadsArgsDrivers, CreateRadsDbArgs, CreateRadsDbArgsNormalized, CreateRadsDbClientArgs, DeepKeys, DeepPartial, DeepPartialWithNulls, DeepPartialWithNullsItem, Driver, DriverConstructor, EntityDecoratorArgs, EntityMethods, EnumDefinition, FieldDecoratorArgs, FieldDefinition, FileSystemNode, FileUploadArgs, FileUploadDriver, FileUploadResult, GenerateClientNormalizedOptions, GenerateClientOptions, GetAggArgs, GetAggArgsAgg, GetAggArgsAny, GetAggResponse, GetArgs, GetArgsAny, GetArgsInclude, GetArgsWhere, GetManyArgs, GetManyArgsAny, GetManyResponse, GetResponse, GetResponseInclude, GetResponseIncludeSelect, GetResponseNoInclude, GetRestRoutesArgs, GetRestRoutesOptions, GetRestRoutesResponse, MinimalDriver, PutArgs, PutEffect, RadsFeature, RadsHookDoc, RadsRequestContext, RadsUiSlotDefinition, RadsUiSlotName, RadsVitePluginOptions, Relation, RequiredFields, RestDriverOptions, RestFileUploadDriverOptions, Schema, SchemaValidators, TypeDefinition, UiDecoratorArgs, UiFieldDecoratorArgs, ValidateEntityDecoratorArgs, ValidateFieldDecoratorArgs, ValidateStringDecoratorArgs, VerifyManyArgs, VerifyManyArgsAny, VerifyManyResponse, WhereJsonContains, cleanUndefinedAndNull, computed, createRadsDb, createRadsDbClient, diff, entity, field, getDriverInstance, handlePrecomputed, keepHistory, merge, precomputed, ui, validate };
|
|
451
|
+
export { Change, ComputedContext, ComputedContextGlobal, ComputedDecoratorArgs, CreateRadsArgsDrivers, CreateRadsDbArgs, CreateRadsDbArgsNormalized, CreateRadsDbClientArgs, DeepKeys, DeepPartial, DeepPartialWithNulls, DeepPartialWithNullsItem, Driver, DriverConstructor, EntityDecoratorArgs, EntityMethods, EnumDefinition, FieldDecoratorArgs, FieldDefinition, FileSystemNode, FileUploadArgs, FileUploadDriver, FileUploadResult, GenerateClientNormalizedOptions, GenerateClientOptions, Get, GetAggArgs, GetAggArgsAgg, GetAggArgsAny, GetAggResponse, GetArgs, GetArgsAny, GetArgsInclude, GetArgsWhere, GetManyArgs, GetManyArgsAny, GetManyResponse, GetResponse, GetResponseInclude, GetResponseIncludeSelect, GetResponseNoInclude, GetRestRoutesArgs, GetRestRoutesOptions, GetRestRoutesResponse, MinimalDriver, Put, PutArgs, PutEffect, RadsFeature, RadsHookDoc, RadsRequestContext, RadsUiSlotDefinition, RadsUiSlotName, RadsVitePluginOptions, Relation, RequiredFields, RestDriverOptions, RestFileUploadDriverOptions, Schema, SchemaValidators, TypeDefinition, UiDecoratorArgs, UiFieldDecoratorArgs, ValidateEntityDecoratorArgs, ValidateFieldDecoratorArgs, ValidateStringDecoratorArgs, VerifyManyArgs, VerifyManyArgsAny, VerifyManyResponse, WhereJsonContains, cleanUndefinedAndNull, computed, createRadsDb, createRadsDbClient, diff, entity, field, getDriverInstance, handlePrecomputed, keepHistory, merge, precomputed, ui, validate };
|