@seidor-cloud-produtos/orbit-backend-lib 0.0.6 → 0.0.9
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 +3 -0
- package/{lib/clean-arch/application/queue/messages-in-memory.ts → dist/clean-arch/application/queue/messages-in-memory.d.ts} +3 -4
- package/dist/clean-arch/application/queue/queue-connection.d.ts +6 -0
- package/dist/clean-arch/application/queue/queue.d.ts +6 -0
- package/dist/clean-arch/domain/entities/aggregate-root.d.ts +8 -0
- package/dist/clean-arch/domain/entities/common-dto.d.ts +14 -0
- package/dist/clean-arch/domain/entities/entity.d.ts +9 -0
- package/dist/clean-arch/domain/entities/unique-entity-id.d.ts +7 -0
- package/dist/clean-arch/domain/entities/value-object.d.ts +4 -0
- package/dist/clean-arch/domain/entities/watched-list.d.ts +25 -0
- package/dist/clean-arch/domain/entities/watched-list.spec.d.ts +1 -0
- package/dist/clean-arch/domain/errors/application-error.d.ts +4 -0
- package/dist/clean-arch/domain/errors/domain-error.d.ts +4 -0
- package/dist/clean-arch/domain/errors/validation-error.d.ts +10 -0
- package/{lib/clean-arch/domain/events/domain-event.ts → dist/clean-arch/domain/events/domain-event.d.ts} +2 -2
- package/dist/clean-arch/infra/adapters/express-adapter.d.ts +12 -0
- package/dist/clean-arch/infra/adapters/fastify-adapter.d.ts +11 -0
- package/dist/clean-arch/infra/authorizations/authorization.d.ts +18 -0
- package/dist/clean-arch/infra/authorizations/authorizer.d.ts +9 -0
- package/dist/clean-arch/infra/authorizations/authorizer.spec.d.ts +1 -0
- package/{lib/clean-arch/infra/authorizations/not-allowed.ts → dist/clean-arch/infra/authorizations/not-allowed.d.ts} +1 -4
- package/dist/clean-arch/infra/errors/infra-error.d.ts +4 -0
- package/dist/clean-arch/infra/http/controller.d.ts +19 -0
- package/dist/clean-arch/infra/http/handle-bool-filter.d.ts +1 -0
- package/dist/clean-arch/infra/http/handle-is-active-query.d.ts +1 -0
- package/dist/clean-arch/infra/http/handle-sort-param-query.d.ts +1 -0
- package/dist/clean-arch/infra/http/handle-user-headers.d.ts +11 -0
- package/dist/clean-arch/infra/http/health-connections.d.ts +15 -0
- package/dist/clean-arch/infra/http/http.d.ts +6 -0
- package/dist/clean-arch/shared/pagination/dto-response.d.ts +8 -0
- package/dist/clean-arch/shared/pagination/get-take-and-skip.d.ts +4 -0
- package/{lib/clean-arch/shared/pagination/pagination.ts → dist/clean-arch/shared/pagination/pagination.d.ts} +3 -4
- package/dist/frameworks/express/authorizations/authorization-express.d.ts +19 -0
- package/dist/frameworks/express/authorizations/authorization-express.spec.d.ts +1 -0
- package/dist/frameworks/express/authorizations/midleware-express.d.ts +3 -0
- package/dist/frameworks/nest/authorizations/guard-nest.d.ts +7 -0
- package/dist/infra/authorizations/auth-matcher.d.ts +10 -0
- package/dist/infra/authorizations/auth-matcher.spec.d.ts +1 -0
- package/dist/infra/authorizations/validator/api/api-validator.d.ts +15 -0
- package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.d.ts +7 -0
- package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.spec.d.ts +1 -0
- package/dist/infra/authorizations/validator/auth-validator.d.ts +14 -0
- package/dist/infra/authorizations/validator/auth-validator.spec.d.ts +1 -0
- package/dist/infra/http/errors/api-common-error.d.ts +25 -0
- package/dist/infra/http/errors/api-error.d.ts +7 -0
- package/{lib/infra/http/errors/unauthorized-response.ts → dist/infra/http/errors/unauthorized-response.d.ts} +3 -4
- package/package.json +15 -7
- package/.editorconfig +0 -8
- package/.env.example +0 -4
- package/.eslintignore +0 -2
- package/.eslintrc.json +0 -41
- package/.husky/commit-msg +0 -4
- package/.husky/pre-commit +0 -4
- package/.husky/pre-push +0 -4
- package/.prettierrc +0 -5
- package/commitlint.config.js +0 -1
- package/lib/clean-arch/application/queue/handler.ts +0 -3
- package/lib/clean-arch/application/queue/queue-connection.ts +0 -7
- package/lib/clean-arch/application/queue/queue.ts +0 -12
- package/lib/clean-arch/domain/entities/aggregate-root.ts +0 -22
- package/lib/clean-arch/domain/entities/common-dto.ts +0 -16
- package/lib/clean-arch/domain/entities/entity.ts +0 -31
- package/lib/clean-arch/domain/entities/unique-entity-id.ts +0 -21
- package/lib/clean-arch/domain/entities/value-object.ts +0 -7
- package/lib/clean-arch/domain/entities/watched-list.spec.ts +0 -65
- package/lib/clean-arch/domain/entities/watched-list.ts +0 -130
- package/lib/clean-arch/domain/errors/application-error.ts +0 -8
- package/lib/clean-arch/domain/errors/domain-error.ts +0 -8
- package/lib/clean-arch/domain/errors/validation-error.ts +0 -17
- package/lib/clean-arch/infra/adapters/express-adapter.ts +0 -49
- package/lib/clean-arch/infra/adapters/fastify-adapter.ts +0 -65
- package/lib/clean-arch/infra/authorizations/authorization.ts +0 -48
- package/lib/clean-arch/infra/authorizations/authorizer.spec.ts +0 -155
- package/lib/clean-arch/infra/authorizations/authorizer.ts +0 -23
- package/lib/clean-arch/infra/errors/infra-error.ts +0 -8
- package/lib/clean-arch/infra/http/controller.ts +0 -95
- package/lib/clean-arch/infra/http/handle-bool-filter.ts +0 -7
- package/lib/clean-arch/infra/http/handle-is-active-query.ts +0 -7
- package/lib/clean-arch/infra/http/handle-sort-param-query.ts +0 -12
- package/lib/clean-arch/infra/http/handle-user-headers.ts +0 -13
- package/lib/clean-arch/infra/http/health-connections.ts +0 -21
- package/lib/clean-arch/infra/http/http.ts +0 -7
- package/lib/clean-arch/shared/pagination/dto-response.ts +0 -5
- package/lib/clean-arch/shared/pagination/get-take-and-skip.ts +0 -6
- package/lib/frameworks/express/authorizations/authorization-express.spec.ts +0 -108
- package/lib/frameworks/express/authorizations/authorization-express.ts +0 -54
- package/lib/frameworks/express/authorizations/midleware-express.ts +0 -17
- package/lib/frameworks/nest/authorizations/guard-nest.ts +0 -25
- package/lib/infra/authorizations/auth-matcher.spec.ts +0 -130
- package/lib/infra/authorizations/auth-matcher.ts +0 -76
- package/lib/infra/authorizations/validator/api/api-validator.ts +0 -40
- package/lib/infra/authorizations/validator/api/factories/unauthorized-response-factory.spec.ts +0 -126
- package/lib/infra/authorizations/validator/api/factories/unauthorized-response-factory.ts +0 -52
- package/lib/infra/authorizations/validator/auth-validator.spec.ts +0 -82
- package/lib/infra/authorizations/validator/auth-validator.ts +0 -35
- package/lib/infra/http/errors/api-common-error.ts +0 -25
- package/lib/infra/http/errors/api-error.ts +0 -13
- package/tsconfig.json +0 -113
- package/tsup.config.ts +0 -9
- package/vitest.config.ts +0 -17
- /package/{lib/clean-arch/domain/types/optional.ts → dist/clean-arch/domain/types/optional.d.ts} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import DomainEvent from '@/clean-arch/domain/events/domain-event';
|
|
2
|
-
|
|
3
2
|
export type MessagesInMemory = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
exchangeName: string;
|
|
4
|
+
domainEvent: DomainEvent;
|
|
5
|
+
configs?: Record<string, unknown>;
|
|
7
6
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import DomainEvent from '@/clean-arch/domain/events/domain-event';
|
|
2
|
+
import Handler from './handler';
|
|
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>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CommonDTO } from './common-dto';
|
|
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;
|
|
8
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type CommonDTO = {
|
|
2
|
+
createdAt: Date;
|
|
3
|
+
updatedAt?: Date;
|
|
4
|
+
};
|
|
5
|
+
export type CreateCommonDTO = {
|
|
6
|
+
createdAt?: Date;
|
|
7
|
+
updatedAt?: Date;
|
|
8
|
+
};
|
|
9
|
+
export type UserRequestDTO = {
|
|
10
|
+
createdByName: string;
|
|
11
|
+
createdByEmail: string;
|
|
12
|
+
updatedByName: string;
|
|
13
|
+
updatedByEmail: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UniqueEntityId } from './unique-entity-id';
|
|
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;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Express } from 'express';
|
|
2
|
+
import Controller from '../http/controller';
|
|
3
|
+
import Http, { MethodType } from '../http/http';
|
|
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>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FastifyInstance } from 'fastify';
|
|
2
|
+
import Controller from '../http/controller';
|
|
3
|
+
import Http, { MethodType } from '../http/http';
|
|
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>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AuthParams } from '@/infra/authorizations/auth-matcher';
|
|
2
|
+
import { APIAuthValidator } from '@/infra/authorizations/validator/api/api-validator';
|
|
3
|
+
import AuthValidator from '@/infra/authorizations/validator/auth-validator';
|
|
4
|
+
import { UnauthorizedResponse } from '@/infra/http/errors/unauthorized-response';
|
|
5
|
+
import { Request, Response } from '../http/controller';
|
|
6
|
+
type AuthorizationMetaData = {
|
|
7
|
+
handle(input: Request): Promise<Response>;
|
|
8
|
+
request: Request;
|
|
9
|
+
};
|
|
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>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AuthParams } from '@/infra/authorizations/auth-matcher';
|
|
2
|
+
import { Request, Response } from '../http/controller';
|
|
3
|
+
export default function Authorizer(props: AuthParams): <T extends new (..._: any[]) => {
|
|
4
|
+
handle(request: Request): Promise<Response>;
|
|
5
|
+
}>(constructor: T) => {
|
|
6
|
+
new (..._: any[]): {
|
|
7
|
+
handle(request: Request): Promise<Response>;
|
|
8
|
+
};
|
|
9
|
+
} & T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { ApiError } from '@/infra/http/errors/api-error';
|
|
2
2
|
import { UnauthorizedResponse } from '@/infra/http/errors/unauthorized-response';
|
|
3
|
-
|
|
4
3
|
export default class NotAllowedError extends ApiError {
|
|
5
|
-
|
|
6
|
-
super(input);
|
|
7
|
-
}
|
|
4
|
+
constructor(input: UnauthorizedResponse);
|
|
8
5
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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;
|
|
8
|
+
}
|
|
9
|
+
export type AnyObject = Record<string, any>;
|
|
10
|
+
export type Request = {
|
|
11
|
+
body: AnyObject;
|
|
12
|
+
params: AnyObject;
|
|
13
|
+
headers: AnyObject;
|
|
14
|
+
query: AnyObject;
|
|
15
|
+
};
|
|
16
|
+
export type Response = {
|
|
17
|
+
code: number;
|
|
18
|
+
data: any;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function handleBoolFilter(active?: string): boolean | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function handleIsActive(isActive?: string): boolean | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleSortParamQuery(query: string): "createdAt" | "updatedAt" | "isMain";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type HeadersProps = {
|
|
2
|
+
username: string;
|
|
3
|
+
useremail: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function handleUserHeaders(headers: HeadersProps): {
|
|
6
|
+
createdByName: string;
|
|
7
|
+
createdByEmail: string;
|
|
8
|
+
updatedByEmail: string;
|
|
9
|
+
updatedByName: string;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type HealthCheckOutput = {
|
|
2
|
+
dbIsOnline: boolean;
|
|
3
|
+
};
|
|
4
|
+
export interface HealthCheck {
|
|
5
|
+
check(): Promise<HealthCheckOutput>;
|
|
6
|
+
}
|
|
7
|
+
export default class Health implements HealthCheck {
|
|
8
|
+
private checkDB;
|
|
9
|
+
constructor(checkDB: CheckDB);
|
|
10
|
+
check(): Promise<HealthCheckOutput>;
|
|
11
|
+
}
|
|
12
|
+
export interface CheckDB {
|
|
13
|
+
dbIsOnline(): Promise<boolean>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
|
2
|
+
import { AuthParams } from '@/infra/authorizations/auth-matcher';
|
|
3
|
+
import { APIAuthValidator } from '@/infra/authorizations/validator/api/api-validator';
|
|
4
|
+
import AuthValidator from '@/infra/authorizations/validator/auth-validator';
|
|
5
|
+
import { UnauthorizedResponse } from '@/infra/http/errors/unauthorized-response';
|
|
6
|
+
export type AuthorizationExpressMetaData = {
|
|
7
|
+
request: Request;
|
|
8
|
+
response: Response;
|
|
9
|
+
next: NextFunction;
|
|
10
|
+
};
|
|
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;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
+
import { AuthParams } from '@/infra/authorizations/auth-matcher';
|
|
3
|
+
export default class AuthGuardNest implements CanActivate {
|
|
4
|
+
private readonly authParams;
|
|
5
|
+
constructor(authParams: AuthParams);
|
|
6
|
+
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type AuthParams = {
|
|
2
|
+
$and?: string[];
|
|
3
|
+
$or?: string[];
|
|
4
|
+
};
|
|
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;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AuthParams } from '@/infra/authorizations/auth-matcher';
|
|
2
|
+
import AuthValidator, { RequestData } from '@/infra/authorizations/validator/auth-validator';
|
|
3
|
+
import { UnauthorizedResponse } from '@/infra/http/errors/unauthorized-response';
|
|
4
|
+
export type APIRequestData = RequestData & {
|
|
5
|
+
request_id: string;
|
|
6
|
+
};
|
|
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;
|
|
15
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AuthParams } from '@/infra/authorizations/auth-matcher';
|
|
2
|
+
import { RequestData } from '@/infra/authorizations/validator/auth-validator';
|
|
3
|
+
import { UnauthorizedResponse } from '@/infra/http/errors/unauthorized-response';
|
|
4
|
+
import { APIRequestData } from '../api-validator';
|
|
5
|
+
export default class UnauthorizedResponseFactory {
|
|
6
|
+
static create(query: AuthParams, requestData: RequestData & APIRequestData): UnauthorizedResponse;
|
|
7
|
+
}
|
package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.spec.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AuthParams } from '../auth-matcher';
|
|
2
|
+
export type RequestData = {
|
|
3
|
+
authorizations?: string[];
|
|
4
|
+
};
|
|
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;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type ApiCommonError = {
|
|
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?: [
|
|
14
|
+
{
|
|
15
|
+
value?: any;
|
|
16
|
+
type: string;
|
|
17
|
+
code_error: string;
|
|
18
|
+
msg: string;
|
|
19
|
+
property: string;
|
|
20
|
+
path?: string;
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seidor-cloud-produtos/orbit-backend-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Internal lib for backend components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "rm -rf dist && tsc --declaration",
|
|
9
|
-
"eslint:fix": "npx eslint --fix
|
|
9
|
+
"eslint:fix": "npx eslint --fix lib/**/*.ts",
|
|
10
|
+
"prettier:format": "prettier --write lib/**/*.ts",
|
|
10
11
|
"prepare:husky": "husky install",
|
|
11
12
|
"lint-staged": "lint-staged",
|
|
12
|
-
"test": "vitest run --reporter=verbose"
|
|
13
|
+
"test": "vitest run --reporter=verbose",
|
|
14
|
+
"prepare": "npm run build",
|
|
15
|
+
"version": "npm run prepare && git add --all",
|
|
16
|
+
"postversion": "git push && git push --tags"
|
|
13
17
|
},
|
|
14
18
|
"lint-staged": {
|
|
15
19
|
"*.ts": [
|
|
16
|
-
"npm run eslint:fix"
|
|
20
|
+
"npm run eslint:fix",
|
|
21
|
+
"npm run prettier:format"
|
|
17
22
|
]
|
|
18
23
|
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
19
27
|
"repository": {
|
|
20
28
|
"type": "git",
|
|
21
29
|
"url": "git+https://github.com/orbitspot/orbit-backend-lib.git"
|
|
@@ -60,7 +68,7 @@
|
|
|
60
68
|
"lint-staged": "13.2.2",
|
|
61
69
|
"prettier": "2.8.8",
|
|
62
70
|
"supertest": "6.3.4",
|
|
63
|
-
"
|
|
71
|
+
"tslib": "2.6.2",
|
|
64
72
|
"tsx": "4.7.1",
|
|
65
73
|
"typescript": "5.3.3",
|
|
66
74
|
"unplugin-swc": "1.4.4",
|
|
@@ -68,9 +76,9 @@
|
|
|
68
76
|
"vitest": "^0.32.0"
|
|
69
77
|
},
|
|
70
78
|
"dependencies": {
|
|
79
|
+
"@fastify/cors": "8.3.0",
|
|
71
80
|
"@nestjs/common": "10.3.8",
|
|
72
81
|
"express": "4.19.2",
|
|
73
|
-
"fastify": "4.18.0"
|
|
74
|
-
"@fastify/cors": "8.3.0"
|
|
82
|
+
"fastify": "4.18.0"
|
|
75
83
|
}
|
|
76
84
|
}
|
package/.editorconfig
DELETED
package/.env.example
DELETED
package/.eslintignore
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"es2021": true,
|
|
4
|
-
"node": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"plugin:@typescript-eslint/recommended",
|
|
9
|
-
"plugin:prettier/recommended",
|
|
10
|
-
"plugin:vitest-globals/recommended"
|
|
11
|
-
],
|
|
12
|
-
"parser": "@typescript-eslint/parser",
|
|
13
|
-
"parserOptions": {
|
|
14
|
-
"ecmaVersion": "latest",
|
|
15
|
-
"sourceType": "module",
|
|
16
|
-
"warnOnUnsupportedTypeScriptVersion": false
|
|
17
|
-
},
|
|
18
|
-
"plugins": ["@typescript-eslint", "prettier", "eslint-plugin-import-helpers"],
|
|
19
|
-
"rules": {
|
|
20
|
-
"prettier/prettier": "error",
|
|
21
|
-
"no-useless-constructor": "off",
|
|
22
|
-
"no-console": "off",
|
|
23
|
-
"@typescript-eslint/ban-types": "off",
|
|
24
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
25
|
-
"import-helpers/order-imports": [
|
|
26
|
-
"warn",
|
|
27
|
-
{
|
|
28
|
-
"newlinesBetween": "always",
|
|
29
|
-
"groups": [
|
|
30
|
-
"/^node/",
|
|
31
|
-
"module",
|
|
32
|
-
"/^@/infra/",
|
|
33
|
-
"/^@/frameworks/",
|
|
34
|
-
"/^@/clean-arch/",
|
|
35
|
-
["parent", "sibling", "index"]
|
|
36
|
-
],
|
|
37
|
-
"alphabetize": { "order": "asc", "ignoreCase": true }
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
}
|
package/.husky/commit-msg
DELETED
package/.husky/pre-commit
DELETED
package/.husky/pre-push
DELETED
package/.prettierrc
DELETED
package/commitlint.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = { extends: ['@commitlint/config-conventional'] };
|