@bluemarble/bm-components 0.2.2 → 0.2.3
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.mts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -260,26 +260,26 @@ declare class HttpError extends Error {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
type PossibleMethods = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
263
|
-
type HandlerProps<UserKeyType
|
|
263
|
+
type HandlerProps<UserKeyType> = (req: NextApiRequest & {
|
|
264
264
|
user?: UserKeyType;
|
|
265
265
|
}, res: NextApiResponse) => Promise<any>;
|
|
266
|
-
type MethodProps = Partial<Record<PossibleMethods, HandlerProps
|
|
267
|
-
type MiddlewaresProps = ((handler: HandlerProps) => HandlerProps)[];
|
|
268
|
-
type ConstructorProps = {
|
|
269
|
-
middlewares?: MiddlewaresProps
|
|
266
|
+
type MethodProps<T> = Partial<Record<PossibleMethods, HandlerProps<T>>>;
|
|
267
|
+
type MiddlewaresProps<T> = ((handler: HandlerProps<T>) => HandlerProps<T>)[];
|
|
268
|
+
type ConstructorProps<T> = {
|
|
269
|
+
middlewares?: MiddlewaresProps<T>;
|
|
270
270
|
onFinally: (req: NextApiRequest) => Promise<void>;
|
|
271
271
|
};
|
|
272
|
-
declare class ApiHelper {
|
|
273
|
-
middlewares: MiddlewaresProps
|
|
272
|
+
declare class ApiHelper<T> {
|
|
273
|
+
middlewares: MiddlewaresProps<T>;
|
|
274
274
|
private onFinally;
|
|
275
|
-
constructor(props?: ConstructorProps);
|
|
275
|
+
constructor(props?: ConstructorProps<T>);
|
|
276
276
|
setMiddlewares(middlewares: any[]): this;
|
|
277
|
-
createMethods(methods: MethodProps): (req: NextApiRequest, res: NextApiResponse) => Promise<void | NextApiResponse<any>>;
|
|
277
|
+
createMethods(methods: MethodProps<T>): (req: NextApiRequest, res: NextApiResponse) => Promise<void | NextApiResponse<any>>;
|
|
278
278
|
static parserErrorWrapper<Output, Def extends ZodTypeDef, Input>(body: Record<string, any>, parser: ZodSchema<Output, Def, Input>): Output;
|
|
279
279
|
static parseQueyFilters<T extends Record<string, any>>(filters: T): T;
|
|
280
280
|
static create({ onFinally }: {
|
|
281
281
|
onFinally: any;
|
|
282
|
-
}): ApiHelper
|
|
282
|
+
}): ApiHelper<unknown>;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
type Methods = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options';
|
package/dist/index.d.ts
CHANGED
|
@@ -260,26 +260,26 @@ declare class HttpError extends Error {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
type PossibleMethods = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
263
|
-
type HandlerProps<UserKeyType
|
|
263
|
+
type HandlerProps<UserKeyType> = (req: NextApiRequest & {
|
|
264
264
|
user?: UserKeyType;
|
|
265
265
|
}, res: NextApiResponse) => Promise<any>;
|
|
266
|
-
type MethodProps = Partial<Record<PossibleMethods, HandlerProps
|
|
267
|
-
type MiddlewaresProps = ((handler: HandlerProps) => HandlerProps)[];
|
|
268
|
-
type ConstructorProps = {
|
|
269
|
-
middlewares?: MiddlewaresProps
|
|
266
|
+
type MethodProps<T> = Partial<Record<PossibleMethods, HandlerProps<T>>>;
|
|
267
|
+
type MiddlewaresProps<T> = ((handler: HandlerProps<T>) => HandlerProps<T>)[];
|
|
268
|
+
type ConstructorProps<T> = {
|
|
269
|
+
middlewares?: MiddlewaresProps<T>;
|
|
270
270
|
onFinally: (req: NextApiRequest) => Promise<void>;
|
|
271
271
|
};
|
|
272
|
-
declare class ApiHelper {
|
|
273
|
-
middlewares: MiddlewaresProps
|
|
272
|
+
declare class ApiHelper<T> {
|
|
273
|
+
middlewares: MiddlewaresProps<T>;
|
|
274
274
|
private onFinally;
|
|
275
|
-
constructor(props?: ConstructorProps);
|
|
275
|
+
constructor(props?: ConstructorProps<T>);
|
|
276
276
|
setMiddlewares(middlewares: any[]): this;
|
|
277
|
-
createMethods(methods: MethodProps): (req: NextApiRequest, res: NextApiResponse) => Promise<void | NextApiResponse<any>>;
|
|
277
|
+
createMethods(methods: MethodProps<T>): (req: NextApiRequest, res: NextApiResponse) => Promise<void | NextApiResponse<any>>;
|
|
278
278
|
static parserErrorWrapper<Output, Def extends ZodTypeDef, Input>(body: Record<string, any>, parser: ZodSchema<Output, Def, Input>): Output;
|
|
279
279
|
static parseQueyFilters<T extends Record<string, any>>(filters: T): T;
|
|
280
280
|
static create({ onFinally }: {
|
|
281
281
|
onFinally: any;
|
|
282
|
-
}): ApiHelper
|
|
282
|
+
}): ApiHelper<unknown>;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
type Methods = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options';
|