@bluemarble/bm-components 0.0.99 → 0.0.100
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -264,7 +264,7 @@ declare class HttpError extends Error {
|
|
|
264
264
|
constructor(status: number, message: any);
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
declare type PossibleMethods =
|
|
267
|
+
declare type PossibleMethods = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
268
268
|
declare type HandlerProps = (req: NextApiRequest & {
|
|
269
269
|
user?: number;
|
|
270
270
|
}, res: NextApiResponse) => Promise<any>;
|
|
@@ -279,7 +279,7 @@ declare class ApiHelper {
|
|
|
279
279
|
private onFinally;
|
|
280
280
|
constructor(props?: ConstructorProps);
|
|
281
281
|
setMiddlewares(middlewares: any[]): this;
|
|
282
|
-
createMethods(methods: MethodProps): (req: NextApiRequest, res: NextApiResponse) => Promise<void
|
|
282
|
+
createMethods(methods: MethodProps): (req: NextApiRequest, res: NextApiResponse) => Promise<void | NextApiResponse<any>>;
|
|
283
283
|
static parserErrorWrapper<Output, Def extends ZodTypeDef, Input>(body: Record<string, any>, parser: ZodSchema<Output, Def, Input>): Output;
|
|
284
284
|
static parseQueyFilters<T extends Record<string, any>>(filters: T): T;
|
|
285
285
|
static create({ onFinally }: {
|
package/dist/index.d.ts
CHANGED
|
@@ -264,7 +264,7 @@ declare class HttpError extends Error {
|
|
|
264
264
|
constructor(status: number, message: any);
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
declare type PossibleMethods =
|
|
267
|
+
declare type PossibleMethods = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
268
268
|
declare type HandlerProps = (req: NextApiRequest & {
|
|
269
269
|
user?: number;
|
|
270
270
|
}, res: NextApiResponse) => Promise<any>;
|
|
@@ -279,7 +279,7 @@ declare class ApiHelper {
|
|
|
279
279
|
private onFinally;
|
|
280
280
|
constructor(props?: ConstructorProps);
|
|
281
281
|
setMiddlewares(middlewares: any[]): this;
|
|
282
|
-
createMethods(methods: MethodProps): (req: NextApiRequest, res: NextApiResponse) => Promise<void
|
|
282
|
+
createMethods(methods: MethodProps): (req: NextApiRequest, res: NextApiResponse) => Promise<void | NextApiResponse<any>>;
|
|
283
283
|
static parserErrorWrapper<Output, Def extends ZodTypeDef, Input>(body: Record<string, any>, parser: ZodSchema<Output, Def, Input>): Output;
|
|
284
284
|
static parseQueyFilters<T extends Record<string, any>>(filters: T): T;
|
|
285
285
|
static create({ onFinally }: {
|
package/dist/index.js
CHANGED
|
@@ -3937,6 +3937,8 @@ var ApiHelper = class _ApiHelper {
|
|
|
3937
3937
|
createMethods(methods) {
|
|
3938
3938
|
return (req, res) => __async(this, null, function* () {
|
|
3939
3939
|
const currentMethod = methods[req.method];
|
|
3940
|
+
if (req.method === "OPTIONS")
|
|
3941
|
+
return res.status(200).end();
|
|
3940
3942
|
try {
|
|
3941
3943
|
if (!currentMethod)
|
|
3942
3944
|
throw new HttpError(405, "M\xE9todo inv\xE1lido");
|