shift-swap 0.1.0

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 (44) hide show
  1. package/README.md +212 -0
  2. package/dist/core/entities/email.vo.d.ts +7 -0
  3. package/dist/core/entities/funcionario.entity.d.ts +7 -0
  4. package/dist/core/entities/name.vo.d.ts +7 -0
  5. package/dist/core/entities/pessoa.entity.d.ts +21 -0
  6. package/dist/core/entities/solicitacao-troca-turno.entity.d.ts +25 -0
  7. package/dist/core/entities/supervisor.entity.d.ts +7 -0
  8. package/dist/core/entities/turno.entity.d.ts +25 -0
  9. package/dist/core/ports/funcionario.repository.d.ts +5 -0
  10. package/dist/core/ports/solicitacao-troca-turno.repository.d.ts +7 -0
  11. package/dist/core/ports/supervisor.repository.d.ts +5 -0
  12. package/dist/core/ports/turno.repository.d.ts +6 -0
  13. package/dist/core/usecases/__mocks__/funcionario-in-memory.repository.d.ts +11 -0
  14. package/dist/core/usecases/__mocks__/solicitacao-troca-turno-in-memory.repository.d.ts +13 -0
  15. package/dist/core/usecases/__mocks__/supervisor-in-memory.repository.d.ts +11 -0
  16. package/dist/core/usecases/__mocks__/turno-in-memory.repository.d.ts +12 -0
  17. package/dist/core/usecases/aceitar-troca-turno.usecase.d.ts +18 -0
  18. package/dist/core/usecases/atualizar-funcionario.usecase.d.ts +15 -0
  19. package/dist/core/usecases/atualizar-turno.usecase.d.ts +16 -0
  20. package/dist/core/usecases/buscar-funcionario-por-id.usecase.d.ts +13 -0
  21. package/dist/core/usecases/buscar-solicitacao-troca-turno-por-id.usecase.d.ts +13 -0
  22. package/dist/core/usecases/buscar-turno-por-id.usecase.d.ts +13 -0
  23. package/dist/core/usecases/cancelar-troca-turno.usecase.d.ts +14 -0
  24. package/dist/core/usecases/criar-funcionario.usecase.d.ts +15 -0
  25. package/dist/core/usecases/criar-supervisor.usecase.d.ts +15 -0
  26. package/dist/core/usecases/criar-turno.usecase.d.ts +10 -0
  27. package/dist/core/usecases/listar-funcionarios.usecase.d.ts +10 -0
  28. package/dist/core/usecases/listar-solicitacoes-troca-turno.usecase.d.ts +10 -0
  29. package/dist/core/usecases/listar-turnos-disponiveis-para-troca.usecase.d.ts +13 -0
  30. package/dist/core/usecases/listar-turnos-por-funcionario-e-data.usecase.d.ts +14 -0
  31. package/dist/core/usecases/listar-turnos.usecase.d.ts +10 -0
  32. package/dist/core/usecases/remover-funcionario.usecase.d.ts +12 -0
  33. package/dist/core/usecases/remover-turno.usecase.d.ts +12 -0
  34. package/dist/core/usecases/solicitar-troca-turno.usecase.d.ts +16 -0
  35. package/dist/index.cjs +740 -0
  36. package/dist/index.d.ts +29 -0
  37. package/dist/index.js +698 -0
  38. package/dist/shared/either.d.ts +16 -0
  39. package/dist/shared/entity.d.ts +9 -0
  40. package/dist/shared/repository.d.ts +9 -0
  41. package/dist/shared/result.d.ts +13 -0
  42. package/dist/shared/use-case.d.ts +5 -0
  43. package/dist/shared/value-object.d.ts +9 -0
  44. package/package.json +25 -0
@@ -0,0 +1,9 @@
1
+ declare abstract class Entity<T> {
2
+ private readonly _id;
3
+ protected props: T;
4
+ protected constructor(props: T, id?: string);
5
+ get id(): string;
6
+ equals(other?: Entity<T> | null): boolean;
7
+ toString(): string;
8
+ }
9
+ export { Entity };
@@ -0,0 +1,9 @@
1
+ import { Entity } from "./entity";
2
+ declare abstract class Repository<T extends Entity<unknown>> {
3
+ abstract save(entity: T): Promise<void>;
4
+ abstract update(entity: T): Promise<void>;
5
+ abstract delete(id: string): Promise<void>;
6
+ abstract findById(id: string): Promise<T | null>;
7
+ abstract findAll(): Promise<T[]>;
8
+ }
9
+ export { Repository };
@@ -0,0 +1,13 @@
1
+ declare class Result<T> {
2
+ readonly isSuccess: boolean;
3
+ readonly isFailure: boolean;
4
+ readonly error?: string | Error;
5
+ private readonly _value?;
6
+ private constructor();
7
+ getValue(): T;
8
+ static ok<U>(value?: U): Result<U>;
9
+ static fail<U>(error: string | Error): Result<U>;
10
+ static combine(results: Result<any>[]): Result<any>;
11
+ private formatError;
12
+ }
13
+ export { Result };
@@ -0,0 +1,5 @@
1
+ import { Result } from "./result";
2
+ declare abstract class UseCase<Input, Output> {
3
+ abstract execute(input: Input): Promise<Result<Output>> | Result<Output>;
4
+ }
5
+ export { UseCase };
@@ -0,0 +1,9 @@
1
+ declare abstract class ValueObject<T> {
2
+ readonly value: T;
3
+ protected constructor(value: T);
4
+ equals(other?: ValueObject<T> | null): boolean;
5
+ isEmpty(): boolean;
6
+ toString(): string;
7
+ private static isEqual;
8
+ }
9
+ export { ValueObject };
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "shift-swap",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.cjs"
12
+ }
13
+ },
14
+ "files": ["dist"],
15
+ "scripts": {
16
+ "build": "bun run build:esm && bun run build:cjs && bun run build:types",
17
+ "build:esm": "bun build ./src/index.ts --outdir ./dist --target node --format esm",
18
+ "build:cjs": "bun build ./src/index.ts --outfile ./dist/index.cjs --target node --format cjs",
19
+ "build:types": "tsc -p tsconfig.build.json",
20
+ "test": "bun test"
21
+ },
22
+ "devDependencies": {
23
+ "typescript": "^5"
24
+ }
25
+ }