rads-db 3.0.39 → 3.0.42
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.cjs +3 -2
- package/dist/index.d.ts +14 -17
- package/dist/index.mjs +3 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -109,8 +109,9 @@ function getFieldZodSchemaBase(zodSchemas, schema, field, shouldBeLazy) {
|
|
|
109
109
|
}
|
|
110
110
|
class ValidationError extends Error {
|
|
111
111
|
constructor(error) {
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
const firstError = error.errors[0];
|
|
113
|
+
const msg = `${firstError.message} (${firstError.path.join(".")})`;
|
|
114
|
+
super(msg);
|
|
114
115
|
this.issues = error.errors;
|
|
115
116
|
}
|
|
116
117
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ interface EntityMethods<E, EN extends keyof EntityMeta, W> {
|
|
|
84
84
|
put(data: PutArgs<E>, ctx?: RadsRequestContext): MaybePromise$1<GetResponseNoInclude<E, EN>>;
|
|
85
85
|
putMany(data: PutArgs<E>[], ctx?: RadsRequestContext): MaybePromise$1<GetResponseNoInclude<E, EN>[]>;
|
|
86
86
|
verifyMany<A extends VerifyManyArgs<E, EN, W>>(args?: A, ctx?: RadsRequestContext): MaybePromise$1<VerifyManyResponse>;
|
|
87
|
+
verifyAll<A extends VerifyManyArgs<E, EN, W>>(args?: A, ctx?: RadsRequestContext): MaybePromise$1<Pick<VerifyManyResponse, 'correctCount' | 'incorrectCount'>>;
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
type MaybePromise<T> = Promise<T> | T;
|
|
@@ -291,15 +292,17 @@ interface ComputedContext extends ComputedContextGlobal {
|
|
|
291
292
|
typeName: string;
|
|
292
293
|
handle: string;
|
|
293
294
|
}
|
|
295
|
+
interface RadsHookDoc {
|
|
296
|
+
/** Updated document that will be saved to the database */
|
|
297
|
+
doc: any;
|
|
298
|
+
/** Previous version of document - i.e. one that is currently in the database (before saving) */
|
|
299
|
+
oldDoc: any;
|
|
300
|
+
/** If current entity is event sourcing aggregate, you can access all events in the chronological order */
|
|
301
|
+
events?: any;
|
|
302
|
+
}
|
|
294
303
|
interface PutEffect {
|
|
295
|
-
beforePut?: (computedContext: ComputedContext, docs:
|
|
296
|
-
|
|
297
|
-
doc: any;
|
|
298
|
-
}[], ctx: RadsRequestContext) => MaybePromise<any>;
|
|
299
|
-
afterPut: (computedContext: ComputedContext, docs: {
|
|
300
|
-
oldDoc: any;
|
|
301
|
-
doc: any;
|
|
302
|
-
}[], beforePutResult: any, ctx: RadsRequestContext) => MaybePromise<any>;
|
|
304
|
+
beforePut?: (computedContext: ComputedContext, docs: RadsHookDoc[], ctx: RadsRequestContext) => MaybePromise<any>;
|
|
305
|
+
afterPut: (computedContext: ComputedContext, docs: RadsHookDoc[], beforePutResult: any, ctx: RadsRequestContext) => MaybePromise<any>;
|
|
303
306
|
}
|
|
304
307
|
interface RestFileUploadDriverOptions {
|
|
305
308
|
/** @default '/api' */
|
|
@@ -371,14 +374,8 @@ interface RadsFeature {
|
|
|
371
374
|
enhanceEntityMethods?: (context: ComputedContext, entityMethodsObj: EntityMethods<any, any, any>) => void;
|
|
372
375
|
beforeGet?: (args: GetArgsAny, ctx: RadsRequestContext, context: ComputedContext) => MaybePromise<any>;
|
|
373
376
|
afterGet?: (items: any[], args: GetArgsAny, ctx: RadsRequestContext, context: ComputedContext) => MaybePromise<void>;
|
|
374
|
-
beforePut?: (items:
|
|
375
|
-
|
|
376
|
-
doc: any;
|
|
377
|
-
}[], ctx: RadsRequestContext, computedContext: ComputedContext) => void;
|
|
378
|
-
afterPut?: (items: {
|
|
379
|
-
oldDoc: any;
|
|
380
|
-
doc: any;
|
|
381
|
-
}[], ctx: RadsRequestContext, computedContext: ComputedContext) => void;
|
|
377
|
+
beforePut?: (items: RadsHookDoc[], ctx: RadsRequestContext, computedContext: ComputedContext) => void;
|
|
378
|
+
afterPut?: (items: RadsHookDoc[], ctx: RadsRequestContext, computedContext: ComputedContext) => void;
|
|
382
379
|
beforeUploadFile?: (args: FileUploadArgs) => MaybePromise<any>;
|
|
383
380
|
afterUploadFile?: (result: FileUploadResult, args: FileUploadArgs) => MaybePromise<void>;
|
|
384
381
|
}
|
|
@@ -414,4 +411,4 @@ declare function createRadsDb(args?: CreateRadsDbArgs): RadsDb;
|
|
|
414
411
|
*/
|
|
415
412
|
declare function createRadsDbClient(args?: CreateRadsDbClientArgs): RadsDb;
|
|
416
413
|
|
|
417
|
-
export { Change, ComputedContext, ComputedContextGlobal, ComputedDecoratorArgs, CreateRadsArgsDrivers, CreateRadsDbArgs, CreateRadsDbArgsNormalized, CreateRadsDbClientArgs, DeepPartial, Driver, DriverConstructor, EntityDecoratorArgs, EntityMethods, EnumDefinition, FieldDecoratorArgs, FieldDefinition, FileSystemNode, FileUploadArgs, FileUploadDriver, FileUploadResult, GenerateClientNormalizedOptions, GenerateClientOptions, GetAggArgs, GetAggArgsAgg, GetAggArgsAny, GetAggResponse, GetArgs, GetArgsAny, GetArgsInclude, GetManyArgs, GetManyArgsAny, GetManyResponse, GetResponse, GetResponseInclude, GetResponseIncludeSelect, GetResponseNoInclude, GetRestRoutesArgs, GetRestRoutesOptions, GetRestRoutesResponse, MinimalDriver, PutArgs, PutEffect, RadsFeature, RadsRequestContext, RadsUiSlotDefinition, RadsUiSlotName, RadsVitePluginOptions, Relation, RequiredFields, RestDriverOptions, RestFileUploadDriverOptions, Schema, SchemaValidators, TypeDefinition, UiDecoratorArgs, UiFieldDecoratorArgs, ValidateEntityDecoratorArgs, ValidateFieldDecoratorArgs, ValidateStringDecoratorArgs, VerifyManyArgs, VerifyManyArgsAny, VerifyManyResponse, cleanUndefinedAndNull, computed, createRadsDb, createRadsDbClient, diff, entity, field, getDriverInstance, handlePrecomputed, keepHistory, merge, precomputed, ui, validate };
|
|
414
|
+
export { Change, ComputedContext, ComputedContextGlobal, ComputedDecoratorArgs, CreateRadsArgsDrivers, CreateRadsDbArgs, CreateRadsDbArgsNormalized, CreateRadsDbClientArgs, DeepPartial, Driver, DriverConstructor, EntityDecoratorArgs, EntityMethods, EnumDefinition, FieldDecoratorArgs, FieldDefinition, FileSystemNode, FileUploadArgs, FileUploadDriver, FileUploadResult, GenerateClientNormalizedOptions, GenerateClientOptions, GetAggArgs, GetAggArgsAgg, GetAggArgsAny, GetAggResponse, GetArgs, GetArgsAny, GetArgsInclude, 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, cleanUndefinedAndNull, computed, createRadsDb, createRadsDbClient, diff, entity, field, getDriverInstance, handlePrecomputed, keepHistory, merge, precomputed, ui, validate };
|
package/dist/index.mjs
CHANGED
|
@@ -101,8 +101,9 @@ function getFieldZodSchemaBase(zodSchemas, schema, field, shouldBeLazy) {
|
|
|
101
101
|
}
|
|
102
102
|
class ValidationError extends Error {
|
|
103
103
|
constructor(error) {
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
const firstError = error.errors[0];
|
|
105
|
+
const msg = `${firstError.message} (${firstError.path.join(".")})`;
|
|
106
|
+
super(msg);
|
|
106
107
|
this.issues = error.errors;
|
|
107
108
|
}
|
|
108
109
|
}
|