@seidor-cloud-produtos/orbit-backend-lib 0.0.18 → 0.0.19

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.
Files changed (40) hide show
  1. package/dist/clean-arch/application/queue/handler.d.ts +1 -1
  2. package/dist/clean-arch/application/queue/messages-in-memory.d.ts +3 -3
  3. package/dist/clean-arch/application/queue/queue-connection.d.ts +3 -3
  4. package/dist/clean-arch/application/queue/queue.d.ts +6 -2
  5. package/dist/clean-arch/domain/entities/aggregate-root.d.ts +7 -5
  6. package/dist/clean-arch/domain/entities/common-dto.d.ts +8 -8
  7. package/dist/clean-arch/domain/entities/entity.d.ts +6 -6
  8. package/dist/clean-arch/domain/entities/unique-entity-id.d.ts +5 -5
  9. package/dist/clean-arch/domain/entities/value-object.d.ts +2 -2
  10. package/dist/clean-arch/domain/entities/watched-list.d.ts +23 -23
  11. package/dist/clean-arch/domain/errors/application-error.d.ts +2 -2
  12. package/dist/clean-arch/domain/errors/domain-error.d.ts +2 -2
  13. package/dist/clean-arch/domain/errors/validation-error.d.ts +5 -5
  14. package/dist/clean-arch/domain/events/domain-event.d.ts +2 -2
  15. package/dist/clean-arch/infra/adapters/express-adapter.d.ts +7 -7
  16. package/dist/clean-arch/infra/adapters/fastify-adapter.d.ts +6 -6
  17. package/dist/clean-arch/infra/authorizations/authorization.d.ts +11 -8
  18. package/dist/clean-arch/infra/authorizations/authorizer.d.ts +9 -5
  19. package/dist/clean-arch/infra/authorizations/not-allowed.d.ts +1 -1
  20. package/dist/clean-arch/infra/errors/infra-error.d.ts +2 -2
  21. package/dist/clean-arch/infra/http/controller.d.ts +12 -12
  22. package/dist/clean-arch/infra/http/handle-sort-param-query.d.ts +3 -1
  23. package/dist/clean-arch/infra/http/handle-user-headers.d.ts +6 -6
  24. package/dist/clean-arch/infra/http/health-connections.d.ts +6 -6
  25. package/dist/clean-arch/infra/http/http.d.ts +3 -3
  26. package/dist/clean-arch/shared/pagination/dto-response.d.ts +6 -6
  27. package/dist/clean-arch/shared/pagination/get-take-and-skip.d.ts +6 -3
  28. package/dist/clean-arch/shared/pagination/pagination.d.ts +3 -3
  29. package/dist/frameworks/express/authorizations/authorization-express.d.ts +15 -10
  30. package/dist/frameworks/express/authorizations/midleware-express.d.ts +3 -1
  31. package/dist/frameworks/nest/authorizations/guard-nest.d.ts +3 -3
  32. package/dist/infra/authorizations/auth-matcher.d.ts +9 -6
  33. package/dist/infra/authorizations/auth-matcher.js +3 -2
  34. package/dist/infra/authorizations/validator/api/api-validator.d.ts +8 -8
  35. package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.d.ts +4 -1
  36. package/dist/infra/authorizations/validator/auth-validator.d.ts +9 -9
  37. package/dist/infra/http/errors/api-common-error.d.ts +22 -22
  38. package/dist/infra/http/errors/api-error.d.ts +3 -3
  39. package/dist/infra/http/errors/unauthorized-response.d.ts +3 -3
  40. package/package.json +2 -2
@@ -1,3 +1,3 @@
1
1
  export default interface Handler {
2
- handle(message: any): Promise<void>;
2
+ handle(message: any): Promise<void>;
3
3
  }
@@ -1,6 +1,6 @@
1
1
  import DomainEvent from '../../domain/events/domain-event';
2
2
  export type MessagesInMemory = {
3
- exchangeName: string;
4
- domainEvent: DomainEvent;
5
- configs?: Record<string, unknown>;
3
+ exchangeName: string;
4
+ domainEvent: DomainEvent;
5
+ configs?: Record<string, unknown>;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import Queue from './queue';
2
2
  export default interface QueueConnection extends Queue {
3
- connect(props: unknown): Promise<any>;
4
- close(): Promise<void>;
5
- createConsumers?<T>(queueName: string, configs: T | any): Promise<void>;
3
+ connect(props: unknown): Promise<any>;
4
+ close(): Promise<void>;
5
+ createConsumers?<T>(queueName: string, configs: T | any): Promise<void>;
6
6
  }
@@ -1,6 +1,10 @@
1
1
  import DomainEvent from '../../domain/events/domain-event';
2
2
  import Handler from './handler';
3
3
  export default interface Queue {
4
- on(queueName: string, callback: Handler): Promise<void>;
5
- publish(exchangeName: string, domainEvent: DomainEvent, configs?: Record<string, any>): Promise<void>;
4
+ on(queueName: string, callback: Handler): Promise<void>;
5
+ publish(
6
+ exchangeName: string,
7
+ domainEvent: DomainEvent,
8
+ configs?: Record<string, any>,
9
+ ): Promise<void>;
6
10
  }
@@ -1,8 +1,10 @@
1
1
  import { CommonDTO } from './common-dto';
2
2
  import { Entity } from './entity';
3
- export declare abstract class AggregateRoot<Props extends CommonDTO> extends Entity<Props> {
4
- get createdAt(): Date;
5
- set createdAt(date: Date);
6
- get updatedAt(): Date | undefined;
7
- touch(): void;
3
+ export declare abstract class AggregateRoot<
4
+ Props extends CommonDTO,
5
+ > extends Entity<Props> {
6
+ get createdAt(): Date;
7
+ set createdAt(date: Date);
8
+ get updatedAt(): Date | undefined;
9
+ touch(): void;
8
10
  }
@@ -1,14 +1,14 @@
1
1
  export type CommonDTO = {
2
- createdAt: Date;
3
- updatedAt?: Date;
2
+ createdAt: Date;
3
+ updatedAt?: Date;
4
4
  };
5
5
  export type CreateCommonDTO = {
6
- createdAt?: Date;
7
- updatedAt?: Date;
6
+ createdAt?: Date;
7
+ updatedAt?: Date;
8
8
  };
9
9
  export type UserRequestDTO = {
10
- createdByName: string;
11
- createdByEmail: string;
12
- updatedByName: string;
13
- updatedByEmail: string;
10
+ createdByName: string;
11
+ createdByEmail: string;
12
+ updatedByName: string;
13
+ updatedByEmail: string;
14
14
  };
@@ -1,9 +1,9 @@
1
1
  import { UniqueEntityId } from './unique-entity-id';
2
2
  export declare abstract class Entity<Props> {
3
- private _id;
4
- protected props: Props;
5
- get id(): UniqueEntityId;
6
- set id(id: UniqueEntityId);
7
- protected constructor(props: Props, id?: UniqueEntityId);
8
- equals(entity: Entity<any>): boolean;
3
+ private _id;
4
+ protected props: Props;
5
+ get id(): UniqueEntityId;
6
+ set id(id: UniqueEntityId);
7
+ protected constructor(props: Props, id?: UniqueEntityId);
8
+ equals(entity: Entity<any>): boolean;
9
9
  }
@@ -1,7 +1,7 @@
1
1
  export declare class UniqueEntityId {
2
- private value;
3
- constructor(value?: string);
4
- toString(): string;
5
- toValue(): string;
6
- equals(id: UniqueEntityId): boolean;
2
+ private value;
3
+ constructor(value?: string);
4
+ toString(): string;
5
+ toValue(): string;
6
+ equals(id: UniqueEntityId): boolean;
7
7
  }
@@ -1,4 +1,4 @@
1
1
  export declare abstract class ValueObject<Props> {
2
- protected props: Props;
3
- protected constructor(props: Props);
2
+ protected props: Props;
3
+ protected constructor(props: Props);
4
4
  }
@@ -1,25 +1,25 @@
1
1
  export declare abstract class WatchedList<T> {
2
- currentItems: T[];
3
- private initial;
4
- private new;
5
- private removed;
6
- private updated;
7
- constructor(initialItems?: T[]);
8
- abstract compareItems(a: T, b: T): boolean;
9
- getItems(): T[];
10
- getNewItems(): T[];
11
- getRemovedItems(): T[];
12
- getUpdatedItems(): T[];
13
- addUpdatedItem(item: T): number;
14
- private isCurrentItem;
15
- private isNewItem;
16
- private isRemovedItem;
17
- private removeFromNew;
18
- private removeFromCurrent;
19
- private removeFromRemoved;
20
- private wasAddedInitially;
21
- exists(item: T): boolean;
22
- add(item: T): void;
23
- remove(item: T): void;
24
- update(items: T[]): void;
2
+ currentItems: T[];
3
+ private initial;
4
+ private new;
5
+ private removed;
6
+ private updated;
7
+ constructor(initialItems?: T[]);
8
+ abstract compareItems(a: T, b: T): boolean;
9
+ getItems(): T[];
10
+ getNewItems(): T[];
11
+ getRemovedItems(): T[];
12
+ getUpdatedItems(): T[];
13
+ addUpdatedItem(item: T): number;
14
+ private isCurrentItem;
15
+ private isNewItem;
16
+ private isRemovedItem;
17
+ private removeFromNew;
18
+ private removeFromCurrent;
19
+ private removeFromRemoved;
20
+ private wasAddedInitially;
21
+ exists(item: T): boolean;
22
+ add(item: T): void;
23
+ remove(item: T): void;
24
+ update(items: T[]): void;
25
25
  }
@@ -1,4 +1,4 @@
1
1
  export default class ApplicationError extends Error {
2
- code: number;
3
- constructor(message: string, code?: number);
2
+ code: number;
3
+ constructor(message: string, code?: number);
4
4
  }
@@ -1,4 +1,4 @@
1
1
  export default class DomainError extends Error {
2
- code: number;
3
- constructor(message: string, code?: number);
2
+ code: number;
3
+ constructor(message: string, code?: number);
4
4
  }
@@ -1,10 +1,10 @@
1
1
  type Errors = {
2
- property: string;
3
- message: string;
2
+ property: string;
3
+ message: string;
4
4
  };
5
5
  export default class ValidationError extends Error {
6
- code: number;
7
- errors: Errors[];
8
- constructor(errors: Errors[]);
6
+ code: number;
7
+ errors: Errors[];
8
+ constructor(errors: Errors[]);
9
9
  }
10
10
  export {};
@@ -1,4 +1,4 @@
1
1
  export default interface DomainEvent {
2
- name: string;
3
- eventDate: Date;
2
+ name: string;
3
+ eventDate: Date;
4
4
  }
@@ -2,11 +2,11 @@ import { Express } from 'express';
2
2
  import Controller from '../http/controller';
3
3
  import Http, { MethodType } from '../http/http';
4
4
  export default class ExpressAdapter implements Http {
5
- readonly envs: Record<string, unknown>;
6
- readonly instance: Express;
7
- private server;
8
- constructor(envs: Record<string, unknown>);
9
- on(method: MethodType, url: string, callback: Controller): void;
10
- listen(port: number): Promise<void>;
11
- close(): Promise<void>;
5
+ readonly envs: Record<string, unknown>;
6
+ readonly instance: Express;
7
+ private server;
8
+ constructor(envs: Record<string, unknown>);
9
+ on(method: MethodType, url: string, callback: Controller): void;
10
+ listen(port: number): Promise<void>;
11
+ close(): Promise<void>;
12
12
  }
@@ -2,10 +2,10 @@ import { FastifyInstance } from 'fastify';
2
2
  import Controller from '../http/controller';
3
3
  import Http, { MethodType } from '../http/http';
4
4
  export default class FastifyAdapter implements Http {
5
- readonly envs: Record<string, unknown>;
6
- readonly instance: FastifyInstance;
7
- constructor(envs: Record<string, unknown>);
8
- on(method: MethodType, url: string, callback: Controller): void;
9
- listen(port: number): Promise<void>;
10
- close(): Promise<void>;
5
+ readonly envs: Record<string, unknown>;
6
+ readonly instance: FastifyInstance;
7
+ constructor(envs: Record<string, unknown>);
8
+ on(method: MethodType, url: string, callback: Controller): void;
9
+ listen(port: number): Promise<void>;
10
+ close(): Promise<void>;
11
11
  }
@@ -4,15 +4,18 @@ import AuthValidator from '../../../infra/authorizations/validator/auth-validato
4
4
  import { UnauthorizedResponse } from '../../../infra/http/errors/unauthorized-response';
5
5
  import { Request, Response } from '../http/controller';
6
6
  type AuthorizationMetaData = {
7
- handle(input: Request): Promise<Response>;
8
- request: Request;
7
+ handle(input: Request): Promise<Response>;
8
+ request: Request;
9
9
  };
10
10
  export default class Authorization extends APIAuthValidator {
11
- controller: AuthorizationMetaData;
12
- static create(query: AuthParams, controllerMetaData: AuthorizationMetaData): Promise<AuthValidator>;
13
- protected unauthorize(response: UnauthorizedResponse): void;
14
- protected getRequestId(): string;
15
- protected getAuthorizations(): Promise<string[]>;
16
- protected handleAuthorized(): Promise<Response>;
11
+ controller: AuthorizationMetaData;
12
+ static create(
13
+ query: AuthParams,
14
+ controllerMetaData: AuthorizationMetaData,
15
+ ): Promise<AuthValidator>;
16
+ protected unauthorize(response: UnauthorizedResponse): void;
17
+ protected getRequestId(): string;
18
+ protected getAuthorizations(): Promise<string[]>;
19
+ protected handleAuthorized(): Promise<Response>;
17
20
  }
18
21
  export {};
@@ -1,9 +1,13 @@
1
1
  import { AuthParams } from '../../../infra/authorizations/auth-matcher';
2
2
  import { Request, Response } from '../http/controller';
3
- export default function Authorizer(props: AuthParams): <T extends new (...args: any[]) => {
3
+ export default function Authorizer(props: AuthParams): <
4
+ T extends new (...args: any[]) => {
4
5
  handle(request: Request): Promise<Response>;
5
- }>(constructor: T) => {
6
- new (...args: any): {
7
- handle(request: Request): Promise<Response>;
8
- };
6
+ },
7
+ >(
8
+ constructor: T,
9
+ ) => {
10
+ new (...args: any): {
11
+ handle(request: Request): Promise<Response>;
12
+ };
9
13
  } & T;
@@ -1,5 +1,5 @@
1
1
  import { ApiError } from '../../../infra/http/errors/api-error';
2
2
  import { UnauthorizedResponse } from '../../../infra/http/errors/unauthorized-response';
3
3
  export default class NotAllowedError extends ApiError {
4
- constructor(input: UnauthorizedResponse);
4
+ constructor(input: UnauthorizedResponse);
5
5
  }
@@ -1,4 +1,4 @@
1
1
  export default class InfraError extends Error {
2
- code: number;
3
- constructor(message: string, code?: number);
2
+ code: number;
3
+ constructor(message: string, code?: number);
4
4
  }
@@ -1,19 +1,19 @@
1
1
  export default abstract class Controller {
2
- abstract handle(request: Request): Promise<Response>;
3
- protected success<T>(dto?: T): Response;
4
- protected noContent(): Response;
5
- protected created<T>(dto?: T): Response;
6
- protected paginated<T>(dto?: T): Response;
7
- throw(error: Error): Response;
2
+ abstract handle(request: Request): Promise<Response>;
3
+ protected success<T>(dto?: T): Response;
4
+ protected noContent(): Response;
5
+ protected created<T>(dto?: T): Response;
6
+ protected paginated<T>(dto?: T): Response;
7
+ throw(error: Error): Response;
8
8
  }
9
9
  export type AnyObject = Record<string, any>;
10
10
  export type Request = {
11
- body: AnyObject;
12
- params: AnyObject;
13
- headers: AnyObject;
14
- query: AnyObject;
11
+ body: AnyObject;
12
+ params: AnyObject;
13
+ headers: AnyObject;
14
+ query: AnyObject;
15
15
  };
16
16
  export type Response = {
17
- code: number;
18
- data: any;
17
+ code: number;
18
+ data: any;
19
19
  };
@@ -1 +1,3 @@
1
- export declare function handleSortParamQuery(query: string): "createdAt" | "updatedAt" | "isMain";
1
+ export declare function handleSortParamQuery(
2
+ query: string,
3
+ ): 'createdAt' | 'updatedAt' | 'isMain';
@@ -1,11 +1,11 @@
1
1
  type HeadersProps = {
2
- username: string;
3
- useremail: string;
2
+ username: string;
3
+ useremail: string;
4
4
  };
5
5
  export declare function handleUserHeaders(headers: HeadersProps): {
6
- createdByName: string;
7
- createdByEmail: string;
8
- updatedByEmail: string;
9
- updatedByName: string;
6
+ createdByName: string;
7
+ createdByEmail: string;
8
+ updatedByEmail: string;
9
+ updatedByName: string;
10
10
  };
11
11
  export {};
@@ -1,15 +1,15 @@
1
1
  type HealthCheckOutput = {
2
- dbIsOnline: boolean;
2
+ dbIsOnline: boolean;
3
3
  };
4
4
  export interface HealthCheck {
5
- check(): Promise<HealthCheckOutput>;
5
+ check(): Promise<HealthCheckOutput>;
6
6
  }
7
7
  export default class Health implements HealthCheck {
8
- private checkDB;
9
- constructor(checkDB: CheckDB);
10
- check(): Promise<HealthCheckOutput>;
8
+ private checkDB;
9
+ constructor(checkDB: CheckDB);
10
+ check(): Promise<HealthCheckOutput>;
11
11
  }
12
12
  export interface CheckDB {
13
- dbIsOnline(): Promise<boolean>;
13
+ dbIsOnline(): Promise<boolean>;
14
14
  }
15
15
  export {};
@@ -1,6 +1,6 @@
1
1
  export type MethodType = 'get' | 'post' | 'delete' | 'put' | 'patch';
2
2
  export default interface Http {
3
- on(method: MethodType, url: string, callback: any): void;
4
- listen(port: number): Promise<void>;
5
- close(): Promise<void>;
3
+ on(method: MethodType, url: string, callback: any): void;
4
+ listen(port: number): Promise<void>;
5
+ close(): Promise<void>;
6
6
  }
@@ -1,8 +1,8 @@
1
1
  export type DtoResponsePagination = {
2
- count: number;
3
- query: {
4
- page: string;
5
- size: string;
6
- };
7
- withPagination: boolean;
2
+ count: number;
3
+ query: {
4
+ page: string;
5
+ size: string;
6
+ };
7
+ withPagination: boolean;
8
8
  };
@@ -1,4 +1,7 @@
1
- export declare function getTakeAndSkip(size: string, page: string): {
2
- take: number;
3
- skip: number;
1
+ export declare function getTakeAndSkip(
2
+ size: string,
3
+ page: string,
4
+ ): {
5
+ take: number;
6
+ skip: number;
4
7
  };
@@ -1,7 +1,7 @@
1
1
  export type Pagination<T> = {
2
- data: T[];
3
- count?: number;
2
+ data: T[];
3
+ count?: number;
4
4
  };
5
5
  export type NotPagination<T> = {
6
- data: T[];
6
+ data: T[];
7
7
  };
@@ -4,16 +4,21 @@ import { APIAuthValidator } from '../../../infra/authorizations/validator/api/ap
4
4
  import AuthValidator from '../../../infra/authorizations/validator/auth-validator';
5
5
  import { UnauthorizedResponse } from '../../../infra/http/errors/unauthorized-response';
6
6
  export type AuthorizationExpressMetaData = {
7
- request: Request;
8
- response: Response;
9
- next: NextFunction;
7
+ request: Request;
8
+ response: Response;
9
+ next: NextFunction;
10
10
  };
11
11
  export default class AuthorizationExpress extends APIAuthValidator {
12
- controller: AuthorizationExpressMetaData;
13
- static create(query: AuthParams, controllerMetaData: AuthorizationExpressMetaData): Promise<AuthValidator>;
14
- getAuthorizations(): Promise<string[]>;
15
- getRequestId(): string;
16
- handleAuthorized(): Promise<boolean | void>;
17
- unauthorize(response: UnauthorizedResponse): Promise<Response<any, Record<string, any>>>;
18
- private setResponseHeaders;
12
+ controller: AuthorizationExpressMetaData;
13
+ static create(
14
+ query: AuthParams,
15
+ controllerMetaData: AuthorizationExpressMetaData,
16
+ ): Promise<AuthValidator>;
17
+ getAuthorizations(): Promise<string[]>;
18
+ getRequestId(): string;
19
+ handleAuthorized(): Promise<boolean | void>;
20
+ unauthorize(
21
+ response: UnauthorizedResponse,
22
+ ): Promise<Response<any, Record<string, any>>>;
23
+ private setResponseHeaders;
19
24
  }
@@ -1,3 +1,5 @@
1
1
  import { NextFunction, Request, Response } from 'express';
2
2
  import { AuthParams } from '../../../infra/authorizations/auth-matcher';
3
- export declare const validateAuthorizations: (query: AuthParams) => (request: Request, response: Response, next: NextFunction) => Promise<any>;
3
+ export declare const validateAuthorizations: (
4
+ query: AuthParams,
5
+ ) => (request: Request, response: Response, next: NextFunction) => Promise<any>;
@@ -1,7 +1,7 @@
1
1
  import { CanActivate, ExecutionContext } from '@nestjs/common';
2
2
  import { AuthParams } from '../../../infra/authorizations/auth-matcher';
3
3
  export default class AuthGuardNest implements CanActivate {
4
- private readonly authParams;
5
- constructor(authParams: AuthParams);
6
- canActivate(context: ExecutionContext): Promise<boolean>;
4
+ private readonly authParams;
5
+ constructor(authParams: AuthParams);
6
+ canActivate(context: ExecutionContext): Promise<boolean>;
7
7
  }
@@ -1,10 +1,13 @@
1
1
  export type AuthParams = {
2
- $and?: string[];
3
- $or?: string[];
2
+ $and?: string[];
3
+ $or?: string[];
4
4
  };
5
5
  export default class AuthMatcher {
6
- static isMatch(params: AuthParams, authorizationsFromRequest?: string[]): boolean;
7
- private static handleOr;
8
- private static handleAnd;
9
- private static binarySearch;
6
+ static isMatch(
7
+ params: AuthParams,
8
+ authorizationsFromRequest?: string[],
9
+ ): boolean;
10
+ private static handleOr;
11
+ private static handleAnd;
12
+ private static binarySearch;
10
13
  }
@@ -5,8 +5,9 @@ class AuthMatcher {
5
5
  if (!authorizationsFromRequest) {
6
6
  return false;
7
7
  }
8
- const $andResult = this.handleAnd(authorizationsFromRequest, params.$and);
9
- const $orResult = this.handleOr(authorizationsFromRequest, params.$or);
8
+ const orderAuthorizations = authorizationsFromRequest.sort((a, b) => a.localeCompare(b));
9
+ const $andResult = this.handleAnd(orderAuthorizations, params.$and);
10
+ const $orResult = this.handleOr(orderAuthorizations, params.$or);
10
11
  return $andResult && $orResult;
11
12
  }
12
13
  static handleOr(authorizationsFromRequest, requiredUserAuthorizations) {
@@ -2,14 +2,14 @@ import { UnauthorizedResponse } from '../../../http/errors/unauthorized-response
2
2
  import { AuthParams } from '../../auth-matcher';
3
3
  import AuthValidator, { RequestData } from '../auth-validator';
4
4
  export type APIRequestData = RequestData & {
5
- request_id: string;
5
+ request_id: string;
6
6
  };
7
7
  export declare abstract class APIAuthValidator extends AuthValidator {
8
- protected controller: any;
9
- requestData: APIRequestData;
10
- protected constructor(query: AuthParams, controller: any);
11
- protected handleUnauthorized(): any;
12
- setup(): Promise<AuthValidator>;
13
- protected abstract unauthorize(response: UnauthorizedResponse): any;
14
- protected abstract getRequestId(): string;
8
+ protected controller: any;
9
+ requestData: APIRequestData;
10
+ protected constructor(query: AuthParams, controller: any);
11
+ protected handleUnauthorized(): any;
12
+ setup(): Promise<AuthValidator>;
13
+ protected abstract unauthorize(response: UnauthorizedResponse): any;
14
+ protected abstract getRequestId(): string;
15
15
  }
@@ -3,5 +3,8 @@ import { AuthParams } from '../../../auth-matcher';
3
3
  import { RequestData } from '../../auth-validator';
4
4
  import { APIRequestData } from '../api-validator';
5
5
  export default class UnauthorizedResponseFactory {
6
- static create(query: AuthParams, requestData: RequestData & APIRequestData): UnauthorizedResponse;
6
+ static create(
7
+ query: AuthParams,
8
+ requestData: RequestData & APIRequestData,
9
+ ): UnauthorizedResponse;
7
10
  }
@@ -1,14 +1,14 @@
1
1
  import { AuthParams } from '../auth-matcher';
2
2
  export type RequestData = {
3
- authorizations?: string[];
3
+ authorizations?: string[];
4
4
  };
5
5
  export default abstract class AuthValidator {
6
- protected query: AuthParams;
7
- protected requestData: RequestData;
8
- protected constructor(query: AuthParams);
9
- validate(): Promise<any>;
10
- setup(): Promise<AuthValidator>;
11
- protected abstract getAuthorizations(): Promise<string[]>;
12
- protected abstract handleAuthorized(): any;
13
- protected abstract handleUnauthorized(): any;
6
+ protected query: AuthParams;
7
+ protected requestData: RequestData;
8
+ protected constructor(query: AuthParams);
9
+ validate(): Promise<any>;
10
+ setup(): Promise<AuthValidator>;
11
+ protected abstract getAuthorizations(): Promise<string[]>;
12
+ protected abstract handleAuthorized(): any;
13
+ protected abstract handleUnauthorized(): any;
14
14
  }
@@ -1,25 +1,25 @@
1
1
  export type ApiCommonError = {
2
- code: number;
3
- message: string;
4
- timestamp: Date;
5
- request_id?: string;
6
- errors: [
2
+ code: number;
3
+ message: string;
4
+ timestamp: Date;
5
+ request_id?: string;
6
+ errors: [
7
+ {
8
+ context_id?: string | number;
9
+ type?: string;
10
+ code_error: string;
11
+ msg: string;
12
+ location: string;
13
+ property_errors?: [
7
14
  {
8
- context_id?: string | number;
9
- type?: string;
10
- code_error: string;
11
- msg: string;
12
- location: string;
13
- property_errors?: [
14
- {
15
- value?: any;
16
- type: string;
17
- code_error: string;
18
- msg: string;
19
- property: string;
20
- path?: string;
21
- }
22
- ];
23
- }
24
- ];
15
+ value?: any;
16
+ type: string;
17
+ code_error: string;
18
+ msg: string;
19
+ property: string;
20
+ path?: string;
21
+ },
22
+ ];
23
+ },
24
+ ];
25
25
  };
@@ -1,7 +1,7 @@
1
1
  import { ApiCommonError } from './api-common-error';
2
2
  import { UnauthorizedResponse } from './unauthorized-response';
3
3
  export declare class ApiError extends Error {
4
- code: number;
5
- error: ApiCommonError;
6
- constructor(input: UnauthorizedResponse);
4
+ code: number;
5
+ error: ApiCommonError;
6
+ constructor(input: UnauthorizedResponse);
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import { ApiCommonError } from './api-common-error';
2
2
  export type UnauthorizedResponse = {
3
- body: ApiCommonError;
4
- headers: Record<string, string>;
5
- status: number;
3
+ body: ApiCommonError;
4
+ headers: Record<string, string>;
5
+ status: number;
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seidor-cloud-produtos/orbit-backend-lib",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Internal lib for backend components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "prepare:husky": "husky install",
12
12
  "lint-staged": "lint-staged",
13
13
  "test": "vitest run --reporter=verbose",
14
- "prepare": "npm run build",
14
+ "prepare": "npm run build && prettier --write dist/**/*.ts",
15
15
  "version": "npm run prepare && git add --all",
16
16
  "postversion": "git push && git push --tags"
17
17
  },