@bluemarble/bm-components 0.0.98 → 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 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 = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
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 }: {
@@ -364,6 +364,9 @@ declare type AlertContextProps = {
364
364
  createAlert(message: string, type: AlertColor): void;
365
365
  };
366
366
  declare const AlertContext: React.Context<AlertContextProps>;
367
- declare const AlertProvider: FC;
367
+ declare type AlertProviderProps = {
368
+ children: ReactNode;
369
+ };
370
+ declare const AlertProvider: ({ children }: AlertProviderProps) => JSX.Element;
368
371
 
369
372
  export { AlertContext, AlertProvider, ApiHelper, Autocomplete, BaseGrid, Checkbox, type ColumnTitleProps, type ColumnsProps, Dialog, EditableTableCell, type FilterCompareType, type FilterProps, GetInputLabel, Grid, HttpError, type IFilter, Input, InputMask, LargeButton, Modal, Radio, Select, Switch, TabPanel, type TabPanelProps, Td, Tr, createFilter, filterData, getTabProps, useAlert, useEvent, useFilter, useFormHelper, useGrid, useLoading };
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 = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
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 }: {
@@ -364,6 +364,9 @@ declare type AlertContextProps = {
364
364
  createAlert(message: string, type: AlertColor): void;
365
365
  };
366
366
  declare const AlertContext: React.Context<AlertContextProps>;
367
- declare const AlertProvider: FC;
367
+ declare type AlertProviderProps = {
368
+ children: ReactNode;
369
+ };
370
+ declare const AlertProvider: ({ children }: AlertProviderProps) => JSX.Element;
368
371
 
369
372
  export { AlertContext, AlertProvider, ApiHelper, Autocomplete, BaseGrid, Checkbox, type ColumnTitleProps, type ColumnsProps, Dialog, EditableTableCell, type FilterCompareType, type FilterProps, GetInputLabel, Grid, HttpError, type IFilter, Input, InputMask, LargeButton, Modal, Radio, Select, Switch, TabPanel, type TabPanelProps, Td, Tr, createFilter, filterData, getTabProps, useAlert, useEvent, useFilter, useFormHelper, useGrid, useLoading };
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");