@seidor-cloud-produtos/orbit-backend-lib 0.0.17 → 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.
- package/dist/clean-arch/application/queue/handler.d.ts +1 -1
- package/dist/clean-arch/application/queue/messages-in-memory.d.ts +3 -3
- package/dist/clean-arch/application/queue/queue-connection.d.ts +3 -3
- package/dist/clean-arch/application/queue/queue.d.ts +6 -2
- package/dist/clean-arch/domain/entities/aggregate-root.d.ts +7 -5
- package/dist/clean-arch/domain/entities/common-dto.d.ts +8 -8
- package/dist/clean-arch/domain/entities/entity.d.ts +6 -6
- package/dist/clean-arch/domain/entities/unique-entity-id.d.ts +5 -5
- package/dist/clean-arch/domain/entities/value-object.d.ts +2 -2
- package/dist/clean-arch/domain/entities/watched-list.d.ts +23 -23
- package/dist/clean-arch/domain/errors/application-error.d.ts +2 -2
- package/dist/clean-arch/domain/errors/domain-error.d.ts +2 -2
- package/dist/clean-arch/domain/errors/validation-error.d.ts +5 -5
- package/dist/clean-arch/domain/events/domain-event.d.ts +2 -2
- package/dist/clean-arch/infra/adapters/express-adapter.d.ts +7 -7
- package/dist/clean-arch/infra/adapters/fastify-adapter.d.ts +6 -6
- package/dist/clean-arch/infra/authorizations/authorization.d.ts +11 -8
- package/dist/clean-arch/infra/authorizations/authorizer.d.ts +9 -5
- package/dist/clean-arch/infra/authorizations/not-allowed.d.ts +1 -1
- package/dist/clean-arch/infra/errors/infra-error.d.ts +2 -2
- package/dist/clean-arch/infra/http/controller.d.ts +12 -12
- package/dist/clean-arch/infra/http/handle-sort-param-query.d.ts +3 -1
- package/dist/clean-arch/infra/http/handle-user-headers.d.ts +6 -6
- package/dist/clean-arch/infra/http/health-connections.d.ts +6 -6
- package/dist/clean-arch/infra/http/http.d.ts +3 -3
- package/dist/clean-arch/shared/pagination/dto-response.d.ts +6 -6
- package/dist/clean-arch/shared/pagination/get-take-and-skip.d.ts +6 -3
- package/dist/clean-arch/shared/pagination/pagination.d.ts +3 -3
- package/dist/frameworks/express/authorizations/authorization-express.d.ts +15 -10
- package/dist/frameworks/express/authorizations/midleware-express.d.ts +3 -1
- package/dist/frameworks/nest/authorizations/guard-nest.d.ts +3 -3
- package/dist/infra/authorizations/auth-matcher.d.ts +9 -6
- package/dist/infra/authorizations/auth-matcher.js +3 -2
- package/dist/infra/authorizations/validator/api/api-validator.d.ts +8 -8
- package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.d.ts +4 -1
- package/dist/infra/authorizations/validator/auth-validator.d.ts +9 -9
- package/dist/infra/http/errors/api-common-error.d.ts +22 -22
- package/dist/infra/http/errors/api-error.d.ts +3 -3
- package/dist/infra/http/errors/unauthorized-response.d.ts +3 -3
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DomainEvent from '../../domain/events/domain-event';
|
|
2
2
|
export type MessagesInMemory = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
5
|
-
|
|
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<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
3
|
-
|
|
2
|
+
createdAt: Date;
|
|
3
|
+
updatedAt?: Date;
|
|
4
4
|
};
|
|
5
5
|
export type CreateCommonDTO = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
createdAt?: Date;
|
|
7
|
+
updatedAt?: Date;
|
|
8
8
|
};
|
|
9
9
|
export type UserRequestDTO = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
private value;
|
|
3
|
+
constructor(value?: string);
|
|
4
|
+
toString(): string;
|
|
5
|
+
toValue(): string;
|
|
6
|
+
equals(id: UniqueEntityId): boolean;
|
|
7
7
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
export declare abstract class WatchedList<T> {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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,10 +1,10 @@
|
|
|
1
1
|
type Errors = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
property: string;
|
|
3
|
+
message: string;
|
|
4
4
|
};
|
|
5
5
|
export default class ValidationError extends Error {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
code: number;
|
|
7
|
+
errors: Errors[];
|
|
8
|
+
constructor(errors: Errors[]);
|
|
9
9
|
}
|
|
10
10
|
export {};
|
|
@@ -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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
8
|
-
|
|
7
|
+
handle(input: Request): Promise<Response>;
|
|
8
|
+
request: Request;
|
|
9
9
|
};
|
|
10
10
|
export default class Authorization extends APIAuthValidator {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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): <
|
|
3
|
+
export default function Authorizer(props: AuthParams): <
|
|
4
|
+
T extends new (...args: any[]) => {
|
|
4
5
|
handle(request: Request): Promise<Response>;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
4
|
+
constructor(input: UnauthorizedResponse);
|
|
5
5
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export default abstract class Controller {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
body: AnyObject;
|
|
12
|
+
params: AnyObject;
|
|
13
|
+
headers: AnyObject;
|
|
14
|
+
query: AnyObject;
|
|
15
15
|
};
|
|
16
16
|
export type Response = {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
code: number;
|
|
18
|
+
data: any;
|
|
19
19
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
type HeadersProps = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
username: string;
|
|
3
|
+
useremail: string;
|
|
4
4
|
};
|
|
5
5
|
export declare function handleUserHeaders(headers: HeadersProps): {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
2
|
+
dbIsOnline: boolean;
|
|
3
3
|
};
|
|
4
4
|
export interface HealthCheck {
|
|
5
|
-
|
|
5
|
+
check(): Promise<HealthCheckOutput>;
|
|
6
6
|
}
|
|
7
7
|
export default class Health implements HealthCheck {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
private checkDB;
|
|
9
|
+
constructor(checkDB: CheckDB);
|
|
10
|
+
check(): Promise<HealthCheckOutput>;
|
|
11
11
|
}
|
|
12
12
|
export interface CheckDB {
|
|
13
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
on(method: MethodType, url: string, callback: any): void;
|
|
4
|
+
listen(port: number): Promise<void>;
|
|
5
|
+
close(): Promise<void>;
|
|
6
6
|
}
|
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
request: Request;
|
|
8
|
+
response: Response;
|
|
9
|
+
next: NextFunction;
|
|
10
10
|
};
|
|
11
11
|
export default class AuthorizationExpress extends APIAuthValidator {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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: (
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
3
|
-
|
|
2
|
+
$and?: string[];
|
|
3
|
+
$or?: string[];
|
|
4
4
|
};
|
|
5
5
|
export default class AuthMatcher {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
9
|
-
const $
|
|
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
|
-
|
|
5
|
+
request_id: string;
|
|
6
6
|
};
|
|
7
7
|
export declare abstract class APIAuthValidator extends AuthValidator {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
}
|
package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
3
|
+
authorizations?: string[];
|
|
4
4
|
};
|
|
5
5
|
export default abstract class AuthValidator {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
code: number;
|
|
5
|
+
error: ApiCommonError;
|
|
6
|
+
constructor(input: UnauthorizedResponse);
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seidor-cloud-produtos/orbit-backend-lib",
|
|
3
|
-
"version": "0.0.
|
|
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,8 +11,8 @@
|
|
|
11
11
|
"prepare:husky": "husky install",
|
|
12
12
|
"lint-staged": "lint-staged",
|
|
13
13
|
"test": "vitest run --reporter=verbose",
|
|
14
|
-
"prepare": "npm run build",
|
|
15
|
-
"version": "npm run prepare &&
|
|
14
|
+
"prepare": "npm run build && prettier --write dist/**/*.ts",
|
|
15
|
+
"version": "npm run prepare && git add --all",
|
|
16
16
|
"postversion": "git push && git push --tags"
|
|
17
17
|
},
|
|
18
18
|
"lint-staged": {
|