@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.
Files changed (101) hide show
  1. package/dist/clean-arch/application/queue/handler.d.ts +3 -0
  2. package/{lib/clean-arch/application/queue/messages-in-memory.ts → dist/clean-arch/application/queue/messages-in-memory.d.ts} +3 -4
  3. package/dist/clean-arch/application/queue/queue-connection.d.ts +6 -0
  4. package/dist/clean-arch/application/queue/queue.d.ts +6 -0
  5. package/dist/clean-arch/domain/entities/aggregate-root.d.ts +8 -0
  6. package/dist/clean-arch/domain/entities/common-dto.d.ts +14 -0
  7. package/dist/clean-arch/domain/entities/entity.d.ts +9 -0
  8. package/dist/clean-arch/domain/entities/unique-entity-id.d.ts +7 -0
  9. package/dist/clean-arch/domain/entities/value-object.d.ts +4 -0
  10. package/dist/clean-arch/domain/entities/watched-list.d.ts +25 -0
  11. package/dist/clean-arch/domain/entities/watched-list.spec.d.ts +1 -0
  12. package/dist/clean-arch/domain/errors/application-error.d.ts +4 -0
  13. package/dist/clean-arch/domain/errors/domain-error.d.ts +4 -0
  14. package/dist/clean-arch/domain/errors/validation-error.d.ts +10 -0
  15. package/{lib/clean-arch/domain/events/domain-event.ts → dist/clean-arch/domain/events/domain-event.d.ts} +2 -2
  16. package/dist/clean-arch/infra/adapters/express-adapter.d.ts +12 -0
  17. package/dist/clean-arch/infra/adapters/fastify-adapter.d.ts +11 -0
  18. package/dist/clean-arch/infra/authorizations/authorization.d.ts +18 -0
  19. package/dist/clean-arch/infra/authorizations/authorizer.d.ts +9 -0
  20. package/dist/clean-arch/infra/authorizations/authorizer.spec.d.ts +1 -0
  21. package/{lib/clean-arch/infra/authorizations/not-allowed.ts → dist/clean-arch/infra/authorizations/not-allowed.d.ts} +1 -4
  22. package/dist/clean-arch/infra/errors/infra-error.d.ts +4 -0
  23. package/dist/clean-arch/infra/http/controller.d.ts +19 -0
  24. package/dist/clean-arch/infra/http/handle-bool-filter.d.ts +1 -0
  25. package/dist/clean-arch/infra/http/handle-is-active-query.d.ts +1 -0
  26. package/dist/clean-arch/infra/http/handle-sort-param-query.d.ts +1 -0
  27. package/dist/clean-arch/infra/http/handle-user-headers.d.ts +11 -0
  28. package/dist/clean-arch/infra/http/health-connections.d.ts +15 -0
  29. package/dist/clean-arch/infra/http/http.d.ts +6 -0
  30. package/dist/clean-arch/shared/pagination/dto-response.d.ts +8 -0
  31. package/dist/clean-arch/shared/pagination/get-take-and-skip.d.ts +4 -0
  32. package/{lib/clean-arch/shared/pagination/pagination.ts → dist/clean-arch/shared/pagination/pagination.d.ts} +3 -4
  33. package/dist/frameworks/express/authorizations/authorization-express.d.ts +19 -0
  34. package/dist/frameworks/express/authorizations/authorization-express.spec.d.ts +1 -0
  35. package/dist/frameworks/express/authorizations/midleware-express.d.ts +3 -0
  36. package/dist/frameworks/nest/authorizations/guard-nest.d.ts +7 -0
  37. package/dist/infra/authorizations/auth-matcher.d.ts +10 -0
  38. package/dist/infra/authorizations/auth-matcher.spec.d.ts +1 -0
  39. package/dist/infra/authorizations/validator/api/api-validator.d.ts +15 -0
  40. package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.d.ts +7 -0
  41. package/dist/infra/authorizations/validator/api/factories/unauthorized-response-factory.spec.d.ts +1 -0
  42. package/dist/infra/authorizations/validator/auth-validator.d.ts +14 -0
  43. package/dist/infra/authorizations/validator/auth-validator.spec.d.ts +1 -0
  44. package/dist/infra/http/errors/api-common-error.d.ts +25 -0
  45. package/dist/infra/http/errors/api-error.d.ts +7 -0
  46. package/{lib/infra/http/errors/unauthorized-response.ts → dist/infra/http/errors/unauthorized-response.d.ts} +3 -4
  47. package/package.json +15 -7
  48. package/.editorconfig +0 -8
  49. package/.env.example +0 -4
  50. package/.eslintignore +0 -2
  51. package/.eslintrc.json +0 -41
  52. package/.husky/commit-msg +0 -4
  53. package/.husky/pre-commit +0 -4
  54. package/.husky/pre-push +0 -4
  55. package/.prettierrc +0 -5
  56. package/commitlint.config.js +0 -1
  57. package/lib/clean-arch/application/queue/handler.ts +0 -3
  58. package/lib/clean-arch/application/queue/queue-connection.ts +0 -7
  59. package/lib/clean-arch/application/queue/queue.ts +0 -12
  60. package/lib/clean-arch/domain/entities/aggregate-root.ts +0 -22
  61. package/lib/clean-arch/domain/entities/common-dto.ts +0 -16
  62. package/lib/clean-arch/domain/entities/entity.ts +0 -31
  63. package/lib/clean-arch/domain/entities/unique-entity-id.ts +0 -21
  64. package/lib/clean-arch/domain/entities/value-object.ts +0 -7
  65. package/lib/clean-arch/domain/entities/watched-list.spec.ts +0 -65
  66. package/lib/clean-arch/domain/entities/watched-list.ts +0 -130
  67. package/lib/clean-arch/domain/errors/application-error.ts +0 -8
  68. package/lib/clean-arch/domain/errors/domain-error.ts +0 -8
  69. package/lib/clean-arch/domain/errors/validation-error.ts +0 -17
  70. package/lib/clean-arch/infra/adapters/express-adapter.ts +0 -49
  71. package/lib/clean-arch/infra/adapters/fastify-adapter.ts +0 -65
  72. package/lib/clean-arch/infra/authorizations/authorization.ts +0 -48
  73. package/lib/clean-arch/infra/authorizations/authorizer.spec.ts +0 -155
  74. package/lib/clean-arch/infra/authorizations/authorizer.ts +0 -23
  75. package/lib/clean-arch/infra/errors/infra-error.ts +0 -8
  76. package/lib/clean-arch/infra/http/controller.ts +0 -95
  77. package/lib/clean-arch/infra/http/handle-bool-filter.ts +0 -7
  78. package/lib/clean-arch/infra/http/handle-is-active-query.ts +0 -7
  79. package/lib/clean-arch/infra/http/handle-sort-param-query.ts +0 -12
  80. package/lib/clean-arch/infra/http/handle-user-headers.ts +0 -13
  81. package/lib/clean-arch/infra/http/health-connections.ts +0 -21
  82. package/lib/clean-arch/infra/http/http.ts +0 -7
  83. package/lib/clean-arch/shared/pagination/dto-response.ts +0 -5
  84. package/lib/clean-arch/shared/pagination/get-take-and-skip.ts +0 -6
  85. package/lib/frameworks/express/authorizations/authorization-express.spec.ts +0 -108
  86. package/lib/frameworks/express/authorizations/authorization-express.ts +0 -54
  87. package/lib/frameworks/express/authorizations/midleware-express.ts +0 -17
  88. package/lib/frameworks/nest/authorizations/guard-nest.ts +0 -25
  89. package/lib/infra/authorizations/auth-matcher.spec.ts +0 -130
  90. package/lib/infra/authorizations/auth-matcher.ts +0 -76
  91. package/lib/infra/authorizations/validator/api/api-validator.ts +0 -40
  92. package/lib/infra/authorizations/validator/api/factories/unauthorized-response-factory.spec.ts +0 -126
  93. package/lib/infra/authorizations/validator/api/factories/unauthorized-response-factory.ts +0 -52
  94. package/lib/infra/authorizations/validator/auth-validator.spec.ts +0 -82
  95. package/lib/infra/authorizations/validator/auth-validator.ts +0 -35
  96. package/lib/infra/http/errors/api-common-error.ts +0 -25
  97. package/lib/infra/http/errors/api-error.ts +0 -13
  98. package/tsconfig.json +0 -113
  99. package/tsup.config.ts +0 -9
  100. package/vitest.config.ts +0 -17
  101. /package/{lib/clean-arch/domain/types/optional.ts → dist/clean-arch/domain/types/optional.d.ts} +0 -0
@@ -0,0 +1,3 @@
1
+ export default interface Handler {
2
+ handle(message: any): Promise<void>;
3
+ }
@@ -1,7 +1,6 @@
1
1
  import DomainEvent from '@/clean-arch/domain/events/domain-event';
2
-
3
2
  export type MessagesInMemory = {
4
- exchangeName: string;
5
- domainEvent: DomainEvent;
6
- configs?: Record<string, unknown>;
3
+ exchangeName: string;
4
+ domainEvent: DomainEvent;
5
+ configs?: Record<string, unknown>;
7
6
  };
@@ -0,0 +1,6 @@
1
+ import Queue from './queue';
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>;
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,7 @@
1
+ export declare class UniqueEntityId {
2
+ private value;
3
+ constructor(value?: string);
4
+ toString(): string;
5
+ toValue(): string;
6
+ equals(id: UniqueEntityId): boolean;
7
+ }
@@ -0,0 +1,4 @@
1
+ export declare abstract class ValueObject<Props> {
2
+ protected props: Props;
3
+ protected constructor(props: Props);
4
+ }
@@ -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,4 @@
1
+ export default class ApplicationError extends Error {
2
+ code: number;
3
+ constructor(message: string, code?: number);
4
+ }
@@ -0,0 +1,4 @@
1
+ export default class DomainError extends Error {
2
+ code: number;
3
+ constructor(message: string, code?: number);
4
+ }
@@ -0,0 +1,10 @@
1
+ type Errors = {
2
+ property: string;
3
+ message: string;
4
+ };
5
+ export default class ValidationError extends Error {
6
+ code: number;
7
+ errors: Errors[];
8
+ constructor(errors: Errors[]);
9
+ }
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
  }
@@ -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;
@@ -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
- constructor(input: UnauthorizedResponse) {
6
- super(input);
7
- }
4
+ constructor(input: UnauthorizedResponse);
8
5
  }
@@ -0,0 +1,4 @@
1
+ export default class InfraError extends Error {
2
+ code: number;
3
+ constructor(message: string, code?: number);
4
+ }
@@ -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,6 @@
1
+ export type MethodType = 'get' | 'post' | 'delete' | 'put' | 'patch';
2
+ export default interface Http {
3
+ on(method: MethodType, url: string, callback: any): void;
4
+ listen(port: number): Promise<void>;
5
+ close(): Promise<void>;
6
+ }
@@ -0,0 +1,8 @@
1
+ export type DtoResponsePagination = {
2
+ count: number;
3
+ query: {
4
+ page: string;
5
+ size: string;
6
+ };
7
+ withPagination: boolean;
8
+ };
@@ -0,0 +1,4 @@
1
+ export declare function getTakeAndSkip(size: string, page: string): {
2
+ take: number;
3
+ skip: number;
4
+ };
@@ -1,8 +1,7 @@
1
1
  export type Pagination<T> = {
2
- data: T[];
3
- count?: number;
2
+ data: T[];
3
+ count?: number;
4
4
  };
5
-
6
5
  export type NotPagination<T> = {
7
- data: T[];
6
+ data: T[];
8
7
  };
@@ -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,3 @@
1
+ import { NextFunction, Request, Response } from 'express';
2
+ import { AuthParams } from '@/infra/authorizations/auth-matcher';
3
+ export declare const validateAuthorizations: (query: AuthParams) => (request: Request, response: Response, next: NextFunction) => Promise<any>;
@@ -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
+ }
@@ -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,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
+ };
@@ -0,0 +1,7 @@
1
+ import { ApiCommonError } from './api-common-error';
2
+ import { UnauthorizedResponse } from './unauthorized-response';
3
+ export declare class ApiError extends Error {
4
+ code: number;
5
+ error: ApiCommonError;
6
+ constructor(input: UnauthorizedResponse);
7
+ }
@@ -1,7 +1,6 @@
1
1
  import { ApiCommonError } from './api-common-error';
2
-
3
2
  export type UnauthorizedResponse = {
4
- body: ApiCommonError;
5
- headers: Record<string, string>;
6
- status: number;
3
+ body: ApiCommonError;
4
+ headers: Record<string, string>;
5
+ status: number;
7
6
  };
package/package.json CHANGED
@@ -1,21 +1,29 @@
1
1
  {
2
2
  "name": "@seidor-cloud-produtos/orbit-backend-lib",
3
- "version": "0.0.6",
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
- "tsup": "8.0.2",
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
@@ -1,8 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 2
6
- charset = utf-8
7
- trim_trailing_whitespace = true
8
- insert_final_newline = true
package/.env.example DELETED
@@ -1,4 +0,0 @@
1
- # Common
2
- CURRENT_ENVIRONMENT="dev"
3
-
4
-
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- node_modules
2
- build
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
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npx --no -- commitlint --edit ${1}
package/.husky/pre-commit DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npm run lint-staged
package/.husky/pre-push DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npm run test
package/.prettierrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "trailingComma": "all",
4
- "arrowParens": "avoid"
5
- }
@@ -1 +0,0 @@
1
- module.exports = { extends: ['@commitlint/config-conventional'] };
@@ -1,3 +0,0 @@
1
- export default interface Handler {
2
- handle(message: any): Promise<void>;
3
- }
@@ -1,7 +0,0 @@
1
- import Queue from './queue';
2
-
3
- export default interface QueueConnection extends Queue {
4
- connect(props: unknown): Promise<any>;
5
- close(): Promise<void>;
6
- createConsumers?<T>(queueName: string, configs: T | any): Promise<void>;
7
- }