vsrepo 1.2.6 → 1.2.8

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 (55) hide show
  1. package/README.md +296 -437
  2. package/{VSRepository → dist}/VSRepoError.d.ts +12 -12
  3. package/dist/VSRepoError.js +17 -0
  4. package/{VSRepository → dist}/VSRepository.d.ts +973 -907
  5. package/dist/VSRepository.js +204 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.js +17 -0
  8. package/dist/internal/errors/types/vs-repo-error-type.type.js +2 -0
  9. package/dist/internal/errors/vs-repo.error.js +27 -0
  10. package/dist/internal/resolvers/base-methods.resolve.js +535 -0
  11. package/dist/internal/resolvers/create-update-payloads-with-relations.resolve.js +143 -0
  12. package/dist/internal/resolvers/data-payload-with-relations.resolve.js +60 -0
  13. package/dist/internal/resolvers/dbAndPrismaArgs.resolve.js +46 -0
  14. package/dist/internal/resolvers/dinamic-method-customization.resolve.js +45 -0
  15. package/dist/internal/resolvers/dinamic-method-info.resolve.js +265 -0
  16. package/dist/internal/resolvers/merge-wheres.resolve.js +22 -0
  17. package/dist/internal/resolvers/pretty-wheres.resolve.js +87 -0
  18. package/dist/internal/resolvers/select.resolve.js +7 -0
  19. package/dist/internal/resolvers/specific-where.resolve.js +77 -0
  20. package/dist/internal/resolvers/types/base-method-function.type.js +2 -0
  21. package/dist/internal/resolvers/types/dinamic-method-customization.type.js +2 -0
  22. package/dist/internal/resolvers/types/dinamic-method-info.type.js +2 -0
  23. package/dist/internal/resolvers/types/dinamic-method-where-ops.type.js +2 -0
  24. package/dist/internal/resolvers/types/pretty-where.type.js +2 -0
  25. package/dist/internal/resolvers/types/prisma-args.type.js +2 -0
  26. package/dist/internal/resolvers/types/repository-build-instance.type.js +2 -0
  27. package/dist/internal/resolvers/types/resolve-db-and-prisma-args-data.type.js +2 -0
  28. package/dist/internal/resolvers/types/ugly-where.type.js +2 -0
  29. package/dist/internal/resolvers/ugly-where.resolve.js +178 -0
  30. package/dist/internal/utils/logger.util.js +21 -0
  31. package/dist/internal/utils/schemas.util.js +10 -0
  32. package/dist/internal/utils/uncapitalize.util.js +6 -0
  33. package/dist/internal/validation/build-config.validate.js +84 -0
  34. package/dist/internal/validation/constructor-config.validate.js +68 -0
  35. package/dist/internal/validation/extension.validate.js +15 -0
  36. package/dist/internal/validation/is-object.validate.js +6 -0
  37. package/dist/internal/validation/method-options.validate.js +26 -0
  38. package/dist/internal/validation/obj-with-relations.validate.js +37 -0
  39. package/dist/internal/validation/prisma-client.validate.js +10 -0
  40. package/dist/internal/validation/types/base-methods.type.js +2 -0
  41. package/dist/internal/validation/types/build-config.type.js +2 -0
  42. package/dist/internal/validation/types/constructor-config.type.js +2 -0
  43. package/dist/internal/validation/types/method-options.type.js +2 -0
  44. package/dist/internal/validation/types/method.type.js +2 -0
  45. package/dist/internal/validation/types/pagination.type.js +2 -0
  46. package/dist/internal/validation/types/relation.type.js +2 -0
  47. package/dist/internal/validation/types/see-mode.type.js +2 -0
  48. package/package.json +72 -70
  49. package/scripts/configure-prisma-import.mjs +3 -3
  50. package/scripts/copy-types.mjs +24 -0
  51. package/VSRepository/VSRepoError.js +0 -33
  52. package/VSRepository/VSRepoUtils.js +0 -155
  53. package/VSRepository/VSRepository.js +0 -1445
  54. package/VSRepository/index.d.ts +0 -2
  55. package/VSRepository/index.js +0 -2
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tipos literais que representam os códigos de erro internos da biblioteca.
2
+ * Literal types representing the internal error codes of the library.
3
3
  */
4
4
  export type VSRepoErrorType =
5
5
  | 'VSREPO_CONFIG'
@@ -8,18 +8,18 @@ export type VSRepoErrorType =
8
8
  | 'VSREPO_RUNTIME';
9
9
 
10
10
  /**
11
- * Classe base para todos os erros lançados pelo Virtual Schema Repository.
11
+ * Base class for all errors thrown by the VSRepository.
12
12
  */
13
13
  export declare abstract class VSRepoError extends Error {
14
- /** Código interno usado para identificar a categoria do erro. */
14
+ /** Internal code used to identify the error category. */
15
15
  abstract readonly type: VSRepoErrorType;
16
16
 
17
17
  constructor(message: string, type: VSRepoErrorType);
18
18
  }
19
19
 
20
20
  /**
21
- * Lançado quando uma configuração inválida ou uma inconsistência de
22
- * configuração é detectada antes ou durante a inicialização do repositório.
21
+ * Thrown when an invalid configuration or a configuration inconsistency
22
+ * is detected before or during repository initialization.
23
23
  */
24
24
  export declare class VSRepoConfigError extends VSRepoError {
25
25
  readonly type: 'VSREPO_CONFIG';
@@ -27,8 +27,8 @@ export declare class VSRepoConfigError extends VSRepoError {
27
27
  }
28
28
 
29
29
  /**
30
- * Lançado quando a injeção da instância do Prisma falha ou quando o
31
- * repositório não pode ser finalizado por meio de `.build()`.
30
+ * Thrown when the Prisma instance injection fails or when the
31
+ * build configuration is incorrect in the `.build()`.
32
32
  */
33
33
  export declare class VSRepoBuildError extends VSRepoError {
34
34
  readonly type: 'VSREPO_BUILD';
@@ -36,8 +36,8 @@ export declare class VSRepoBuildError extends VSRepoError {
36
36
  }
37
37
 
38
38
  /**
39
- * Lançado quando ocorre um erro ao injetar novos métodos no repositório
40
- * por meio de `.extend()`.
39
+ * Thrown when an error occurs while injecting new methods into the repository
40
+ * via `.extend()`.
41
41
  */
42
42
  export declare class VSRepoExtendError extends VSRepoError {
43
43
  readonly type: 'VSREPO_EXTEND';
@@ -45,10 +45,10 @@ export declare class VSRepoExtendError extends VSRepoError {
45
45
  }
46
46
 
47
47
  /**
48
- * Lançado quando operações dinâmicas falham em tempo de execução, como
49
- * quando argumentos inválidos são passados para métodos.
48
+ * Thrown when dynamic operations fail at runtime, such as
49
+ * when invalid arguments are passed to methods.
50
50
  */
51
51
  export declare class VSRepoRuntimeError extends VSRepoError {
52
52
  readonly type: 'VSREPO_RUNTIME';
53
- constructor(message: string);
53
+ constructor(message: string, code?: string);
54
54
  }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./internal/errors/vs-repo.error"), exports);