@basecraft/types 1.0.0 → 3.0.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 (85) hide show
  1. package/dist/entity/omit-generated-fields.type.d.ts.map +1 -1
  2. package/dist/entity/resolve-generated-fields.type.d.ts.map +1 -1
  3. package/dist/index.d.ts +3 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/query/sort.type.d.ts +1 -1
  6. package/dist/query/sort.type.d.ts.map +1 -1
  7. package/dist/repository/create-repository.type.d.ts.map +1 -1
  8. package/dist/repository/page-result.type.d.ts.map +1 -1
  9. package/dist/repository/paginated-read-repository.type.d.ts +1 -1
  10. package/dist/repository/paginated-read-repository.type.d.ts.map +1 -1
  11. package/dist/repository/read-repository.type.d.ts.map +1 -1
  12. package/dist/repository/update-repository.type.d.ts.map +1 -1
  13. package/dist/schema/array-schema.type.d.ts +4 -2
  14. package/dist/schema/array-schema.type.d.ts.map +1 -1
  15. package/dist/schema/boolean-schema.type.d.ts +2 -0
  16. package/dist/schema/boolean-schema.type.d.ts.map +1 -1
  17. package/dist/schema/brand.type.d.ts.map +1 -1
  18. package/dist/schema/index.d.ts +2 -1
  19. package/dist/schema/index.d.ts.map +1 -1
  20. package/dist/schema/infer-schema.type.d.ts +2 -6
  21. package/dist/schema/infer-schema.type.d.ts.map +1 -1
  22. package/dist/schema/infer-shape.type.d.ts +10 -1
  23. package/dist/schema/infer-shape.type.d.ts.map +1 -1
  24. package/dist/schema/number-schema.type.d.ts +9 -4
  25. package/dist/schema/number-schema.type.d.ts.map +1 -1
  26. package/dist/schema/object-schema.type.d.ts +2 -0
  27. package/dist/schema/object-schema.type.d.ts.map +1 -1
  28. package/dist/schema/optional-schema.type.d.ts +5 -0
  29. package/dist/schema/optional-schema.type.d.ts.map +1 -0
  30. package/dist/schema/schema.type.d.ts.map +1 -1
  31. package/dist/schema/shape.type.d.ts +8 -1
  32. package/dist/schema/shape.type.d.ts.map +1 -1
  33. package/dist/schema/string-schema.type.d.ts +6 -2
  34. package/dist/schema/string-schema.type.d.ts.map +1 -1
  35. package/dist/service/crypto-service.type.d.ts +9 -0
  36. package/dist/service/crypto-service.type.d.ts.map +1 -0
  37. package/dist/service/date-service.type.d.ts +23 -0
  38. package/dist/service/date-service.type.d.ts.map +1 -0
  39. package/dist/service/date-time-service.type.d.ts +21 -0
  40. package/dist/service/date-time-service.type.d.ts.map +1 -0
  41. package/dist/service/index.d.ts +14 -0
  42. package/dist/service/index.d.ts.map +1 -0
  43. package/dist/service/instant-service.type.d.ts +19 -0
  44. package/dist/service/instant-service.type.d.ts.map +1 -0
  45. package/dist/service/locale.type.d.ts +2 -0
  46. package/dist/service/locale.type.d.ts.map +1 -0
  47. package/dist/service/time-service.type.d.ts +26 -0
  48. package/dist/service/time-service.type.d.ts.map +1 -0
  49. package/dist/service/time-zone.type.d.ts +2 -0
  50. package/dist/service/time-zone.type.d.ts.map +1 -0
  51. package/dist/service/token-decoding-service.type.d.ts +4 -0
  52. package/dist/service/token-decoding-service.type.d.ts.map +1 -0
  53. package/dist/service/token-decryption-service.type.d.ts +5 -0
  54. package/dist/service/token-decryption-service.type.d.ts.map +1 -0
  55. package/dist/service/token-encryption-service.type.d.ts +5 -0
  56. package/dist/service/token-encryption-service.type.d.ts.map +1 -0
  57. package/dist/service/token-generation-service.type.d.ts +7 -0
  58. package/dist/service/token-generation-service.type.d.ts.map +1 -0
  59. package/dist/service/token-signing-service.type.d.ts +9 -0
  60. package/dist/service/token-signing-service.type.d.ts.map +1 -0
  61. package/dist/service/token-validation-service.type.d.ts +4 -0
  62. package/dist/service/token-validation-service.type.d.ts.map +1 -0
  63. package/dist/service/token-verification-service.type.d.ts +8 -0
  64. package/dist/service/token-verification-service.type.d.ts.map +1 -0
  65. package/dist/service/zoned-date-time-service.type.d.ts +22 -0
  66. package/dist/service/zoned-date-time-service.type.d.ts.map +1 -0
  67. package/dist/use-case/result.type.d.ts +2 -2
  68. package/dist/use-case/result.type.d.ts.map +1 -1
  69. package/dist/use-case/use-case-dependencies.type.d.ts +1 -4
  70. package/dist/use-case/use-case-dependencies.type.d.ts.map +1 -1
  71. package/dist/use-case/use-case-error.type.d.ts +1 -1
  72. package/dist/use-case/use-case-error.type.d.ts.map +1 -1
  73. package/dist/use-case/use-case-options.type.d.ts +4 -3
  74. package/dist/use-case/use-case-options.type.d.ts.map +1 -1
  75. package/dist/use-case/use-case.type.d.ts +1 -1
  76. package/dist/use-case/use-case.type.d.ts.map +1 -1
  77. package/dist/util/infer-current-user.type.d.ts +3 -0
  78. package/dist/util/infer-current-user.type.d.ts.map +1 -0
  79. package/dist/util/infer-role.type.d.ts +6 -0
  80. package/dist/util/infer-role.type.d.ts.map +1 -0
  81. package/package.json +5 -2
  82. package/dist/require-at-least-one.type.d.ts +0 -4
  83. package/dist/require-at-least-one.type.d.ts.map +0 -1
  84. package/dist/schema/field-schemas.type.d.ts +0 -6
  85. package/dist/schema/field-schemas.type.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"omit-generated-fields.type.d.ts","sourceRoot":"","sources":["../../src/entity/omit-generated-fields.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,MAAM,mBAAmB,CAAC,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,IACxF;KACG,KAAK,IAAI,MAAM,YAAY,IAC1B,SAAS,SAAS,YAAY,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,KAAK,GACpD,YAAY,CAAC,KAAK,CAAC;CACvB,GAAG;KACD,KAAK,IAAI,MAAM,YAAY,IAC1B,SAAS,SAAS,YAAY,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,KAAK,CACtD,CAAC,EAAE,KAAK;CACV,CAAC"}
1
+ {"version":3,"file":"omit-generated-fields.type.d.ts","sourceRoot":"","sources":["../../src/entity/omit-generated-fields.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,MAAM,mBAAmB,CAC7B,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,IACxD;KAEA,KAAK,IAAI,MAAM,YAAY,IAAI,SAAS,SAAS,YAAY,CAAC,KAAK,CAAC,GAChE,KAAK,GACL,KAAK,GACR,YAAY,CAAC,KAAK,CAAC;CACvB,GAAG;KAEA,KAAK,IAAI,MAAM,YAAY,IAAI,SAAS,SAAS,YAAY,CAAC,KAAK,CAAC,GAChE,KAAK,GACL,KAAK,CACV,CAAC,EAAE,KAAK;CACV,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-generated-fields.type.d.ts","sourceRoot":"","sources":["../../src/entity/resolve-generated-fields.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,MAAM,sBAAsB,CAAC,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,IAAI;KAC9F,KAAK,IAAI,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CACzE,CAAC"}
1
+ {"version":3,"file":"resolve-generated-fields.type.d.ts","sourceRoot":"","sources":["../../src/entity/resolve-generated-fields.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,MAAM,sBAAsB,CAChC,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,IACxD;KACD,KAAK,IAAI,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CACzE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- export * from "./entity/index.js";
2
1
  export * from "./query/index.js";
2
+ export * from "./entity/index.js";
3
3
  export * from "./repository/index.js";
4
4
  export * from "./schema/index.js";
5
- export * from "./use-case/index.js";
6
5
  export * from "./util/index.js";
6
+ export * from "./use-case/index.js";
7
+ export * from "./service/index.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export type SortDirection = "asc" | "desc";
2
- export interface Sort<SortableField extends string> {
2
+ export interface Sort<SortableField extends string | number | symbol> {
3
3
  field: SortableField;
4
4
  direction: SortDirection;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sort.type.d.ts","sourceRoot":"","sources":["../../src/query/sort.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3C,MAAM,WAAW,IAAI,CAAC,aAAa,SAAS,MAAM;IAChD,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,aAAa,CAAC;CAC1B"}
1
+ {"version":3,"file":"sort.type.d.ts","sourceRoot":"","sources":["../../src/query/sort.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3C,MAAM,WAAW,IAAI,CAAC,aAAa,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM;IAClE,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,aAAa,CAAC;CAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-repository.type.d.ts","sourceRoot":"","sources":["../../src/repository/create-repository.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,WAAW,gBAAgB,CAAC,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,EAAE,KAAK;IACjG,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,oBAAoB,CAAC,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,EAAE,KAAK;IACrG,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CACtD"}
1
+ {"version":3,"file":"create-repository.type.d.ts","sourceRoot":"","sources":["../../src/repository/create-repository.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,WAAW,gBAAgB,CAC/B,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,EAC1D,KAAK;IAEL,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,oBAAoB,CACnC,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,EAC1D,KAAK;IAEL,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CACtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"page-result.type.d.ts","sourceRoot":"","sources":["../../src/repository/page-result.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,WAAW,UAAU,CAAC,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACpF,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB"}
1
+ {"version":3,"file":"page-result.type.d.ts","sourceRoot":"","sources":["../../src/repository/page-result.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,WAAW,UAAU,CACzB,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAE1D,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -2,7 +2,7 @@ import { Entity, IdentifierField } from "../entity/entity.type.js";
2
2
  import { Pagination } from "../query/pagination.type.js";
3
3
  import { Sort } from "../query/sort.type.js";
4
4
  import { PageResult } from "./page-result.type.js";
5
- export interface PaginatedReadRepository<CustomEntity extends Entity<CustomEntity[IdentifierField]>, FindQuery, SortableField extends string> {
5
+ export interface PaginatedReadRepository<CustomEntity extends Entity<CustomEntity[IdentifierField]>, FindQuery, SortableField extends keyof CustomEntity> {
6
6
  findById(id: CustomEntity[IdentifierField]): Promise<CustomEntity | null>;
7
7
  findMany(query: FindQuery & {
8
8
  pagination?: Pagination;
@@ -1 +1 @@
1
- {"version":3,"file":"paginated-read-repository.type.d.ts","sourceRoot":"","sources":["../../src/repository/paginated-read-repository.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,WAAW,uBAAuB,CACtC,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,EAC1D,SAAS,EACT,aAAa,SAAS,MAAM;IAE5B,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAE1E,QAAQ,CACN,KAAK,EAAE,SAAS,GAAG;QACjB,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,IAAI,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;KACpD,GACA,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;CACtC"}
1
+ {"version":3,"file":"paginated-read-repository.type.d.ts","sourceRoot":"","sources":["../../src/repository/paginated-read-repository.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,WAAW,uBAAuB,CACtC,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,EAC1D,SAAS,EACT,aAAa,SAAS,MAAM,YAAY;IAExC,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAE1E,QAAQ,CACN,KAAK,EAAE,SAAS,GAAG;QACjB,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,IAAI,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;KACpD,GACA,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;CACtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"read-repository.type.d.ts","sourceRoot":"","sources":["../../src/repository/read-repository.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,WAAW,cAAc,CAAC,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACxF,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAE1E,OAAO,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CACpC"}
1
+ {"version":3,"file":"read-repository.type.d.ts","sourceRoot":"","sources":["../../src/repository/read-repository.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,WAAW,cAAc,CAC7B,YAAY,SAAS,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAE1D,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAE1E,OAAO,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CACpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"update-repository.type.d.ts","sourceRoot":"","sources":["../../src/repository/update-repository.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB,CAAC,UAAU,EAAE,KAAK;IACjD,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,oBAAoB,CAAC,UAAU,EAAE,KAAK;IACrD,UAAU,CACR,KAAK,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,UAAU,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC,GAC7C,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB"}
1
+ {"version":3,"file":"update-repository.type.d.ts","sourceRoot":"","sources":["../../src/repository/update-repository.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB,CAAC,UAAU,EAAE,KAAK;IACjD,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,oBAAoB,CAAC,UAAU,EAAE,KAAK;IACrD,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,UAAU,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E"}
@@ -1,7 +1,9 @@
1
1
  import { BaseSchema } from "./base-schema.type.js";
2
+ import { OptionalSchema } from "./optional-schema.type.js";
2
3
  export interface ArraySchema<ItemType> extends BaseSchema<ItemType[]> {
3
4
  contains(item: ItemType): ArraySchema<ItemType>;
4
- minLength(length: number): ArraySchema<ItemType>;
5
- maxLength(length: number): ArraySchema<ItemType>;
5
+ min(length: number): ArraySchema<ItemType>;
6
+ max(length: number): ArraySchema<ItemType>;
7
+ optional(): OptionalSchema<ItemType[]>;
6
8
  }
7
9
  //# sourceMappingURL=array-schema.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"array-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/array-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,WAAW,WAAW,CAAC,QAAQ,CAAE,SAAQ,UAAU,CAAC,QAAQ,EAAE,CAAC;IACnE,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACjD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;CAClD"}
1
+ {"version":3,"file":"array-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/array-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,WAAW,WAAW,CAAC,QAAQ,CAAE,SAAQ,UAAU,CAAC,QAAQ,EAAE,CAAC;IACnE,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChD,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC3C,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC3C,QAAQ,IAAI,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;CACxC"}
@@ -1,5 +1,7 @@
1
1
  import { BaseSchema } from "./base-schema.type.js";
2
+ import { OptionalSchema } from "./optional-schema.type.js";
2
3
  export interface BooleanSchema extends BaseSchema<boolean> {
3
4
  equal(target: boolean): BooleanSchema;
5
+ optional(): OptionalSchema<boolean>;
4
6
  }
5
7
  //# sourceMappingURL=boolean-schema.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"boolean-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/boolean-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,WAAW,aAAc,SAAQ,UAAU,CAAC,OAAO,CAAC;IACxD,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,aAAa,CAAC;CACvC"}
1
+ {"version":3,"file":"boolean-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/boolean-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,WAAW,aAAc,SAAQ,UAAU,CAAC,OAAO,CAAC;IACxD,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,aAAa,CAAC;IACtC,QAAQ,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;CACrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"brand.type.d.ts","sourceRoot":"","sources":["../../src/schema/brand.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,CAAC,IAAI,IACpB,IAAI,SAAS,MAAM,GAAG,QAAQ,GAC9B,IAAI,SAAS,MAAM,GAAG,QAAQ,GAC9B,IAAI,SAAS,OAAO,GAAG,SAAS,GAChC,IAAI,SAAS,SAAS,OAAO,EAAE,GAAG,OAAO,GACzC,IAAI,SAAS,MAAM,GAAG,QAAQ,GAC9B,KAAK,CAAC"}
1
+ {"version":3,"file":"brand.type.d.ts","sourceRoot":"","sources":["../../src/schema/brand.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,CAAC,IAAI,IAAI,IAAI,SAAS,MAAM,GACzC,QAAQ,GACR,IAAI,SAAS,MAAM,GACjB,QAAQ,GACR,IAAI,SAAS,OAAO,GAClB,SAAS,GACT,IAAI,SAAS,SAAS,OAAO,EAAE,GAC7B,OAAO,GACP,IAAI,SAAS,MAAM,GACjB,QAAQ,GACR,KAAK,CAAC"}
@@ -5,8 +5,9 @@ export * from "./infer-shape.type.js";
5
5
  export * from "./infer-schema.type.js";
6
6
  export * from "./number-schema.type.js";
7
7
  export * from "./object-schema.type.js";
8
+ export * from "./optional-schema.type.js";
9
+ export * from "./string-schema.type.js";
8
10
  export * from "./base-schema.type.js";
9
11
  export * from "./schema.type.js";
10
12
  export * from "./shape.type.js";
11
- export * from "./string-schema.type.js";
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
@@ -1,7 +1,3 @@
1
- import { StringSchema } from "./string-schema.type.js";
2
- import { ArraySchema } from "./array-schema.type.js";
3
- import { BooleanSchema } from "./boolean-schema.type.js";
4
- import { NumberSchema } from "./number-schema.type.js";
5
- import { ObjectSchema } from "./object-schema.type.js";
6
- export type InferSchema<SchemaType> = SchemaType extends StringSchema ? string : SchemaType extends NumberSchema ? number : SchemaType extends BooleanSchema ? boolean : SchemaType extends ArraySchema<infer ItemType> ? ItemType[] : SchemaType extends ObjectSchema<infer ObjectType> ? ObjectType : never;
1
+ import { BaseSchema } from "./base-schema.type.js";
2
+ export type InferSchema<SchemaType> = SchemaType extends BaseSchema<infer Type> ? Type : never;
7
3
  //# sourceMappingURL=infer-schema.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"infer-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/infer-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,MAAM,WAAW,CAAC,UAAU,IAChC,UAAU,SAAS,YAAY,GAAG,MAAM,GACxC,UAAU,SAAS,YAAY,GAAG,MAAM,GACxC,UAAU,SAAS,aAAa,GAAG,OAAO,GAC1C,UAAU,SAAS,WAAW,CAAC,MAAM,QAAQ,CAAC,GAAG,QAAQ,EAAE,GAC3D,UAAU,SAAS,YAAY,CAAC,MAAM,UAAU,CAAC,GAAG,UAAU,GAC9D,KAAK,CAAC"}
1
+ {"version":3,"file":"infer-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/infer-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,MAAM,WAAW,CAAC,UAAU,IAChC,UAAU,SAAS,UAAU,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
@@ -1,5 +1,14 @@
1
1
  import { InferSchema } from "./infer-schema.type.js";
2
+ type OptionalSchemaMarker = {
3
+ readonly _optional: true;
4
+ };
5
+ type OptionalKeys<Shape> = {
6
+ [Key in keyof Shape]: Shape[Key] extends OptionalSchemaMarker ? Key : never;
7
+ }[keyof Shape];
2
8
  export type InferShape<Shape> = {
3
- [Key in keyof Shape]: InferSchema<Shape[Key]>;
9
+ [Key in Exclude<keyof Shape, OptionalKeys<Shape>>]: InferSchema<Shape[Key]>;
10
+ } & {
11
+ [Key in OptionalKeys<Shape>]?: InferSchema<Shape[Key]>;
4
12
  };
13
+ export {};
5
14
  //# sourceMappingURL=infer-shape.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"infer-shape.type.d.ts","sourceRoot":"","sources":["../../src/schema/infer-shape.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,MAAM,UAAU,CAAC,KAAK,IAAI;KAC7B,GAAG,IAAI,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;CAC9C,CAAC"}
1
+ {"version":3,"file":"infer-shape.type.d.ts","sourceRoot":"","sources":["../../src/schema/infer-shape.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B,CAAC;AAEF,KAAK,YAAY,CAAC,KAAK,IAAI;KACxB,GAAG,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,oBAAoB,GAAG,GAAG,GAAG,KAAK;CAC5E,CAAC,MAAM,KAAK,CAAC,CAAC;AAEf,MAAM,MAAM,UAAU,CAAC,KAAK,IAAI;KAC7B,GAAG,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;CAC5E,GAAG;KACD,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;CACvD,CAAC"}
@@ -1,11 +1,16 @@
1
1
  import { BaseSchema } from "./base-schema.type.js";
2
+ import { OptionalSchema } from "./optional-schema.type.js";
2
3
  export interface NumberSchema extends BaseSchema<number> {
3
- integer(): NumberSchema;
4
+ int(): NumberSchema;
4
5
  positive(): NumberSchema;
5
6
  negative(): NumberSchema;
6
- decimalPlaces(places: number): NumberSchema;
7
+ decimal(places: number): NumberSchema;
7
8
  equal(target: number): NumberSchema;
8
- greaterThan(target: number): NumberSchema;
9
- lessThan(target: number): NumberSchema;
9
+ in(values: readonly [number, ...number[]]): NumberSchema;
10
+ gt(target: number): NumberSchema;
11
+ gte(target: number): NumberSchema;
12
+ lt(target: number): NumberSchema;
13
+ lte(target: number): NumberSchema;
14
+ optional(): OptionalSchema<number>;
10
15
  }
11
16
  //# sourceMappingURL=number-schema.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"number-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/number-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,WAAW,YAAa,SAAQ,UAAU,CAAC,MAAM,CAAC;IACtD,OAAO,IAAI,YAAY,CAAC;IACxB,QAAQ,IAAI,YAAY,CAAC;IACzB,QAAQ,IAAI,YAAY,CAAC;IACzB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IAC5C,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IACpC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;CACxC"}
1
+ {"version":3,"file":"number-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/number-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,WAAW,YAAa,SAAQ,UAAU,CAAC,MAAM,CAAC;IACtD,GAAG,IAAI,YAAY,CAAC;IACpB,QAAQ,IAAI,YAAY,CAAC;IACzB,QAAQ,IAAI,YAAY,CAAC;IACzB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IACtC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IACpC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,GAAG,YAAY,CAAC;IACzD,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IACjC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IAClC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IACjC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IAClC,QAAQ,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;CACpC"}
@@ -1,6 +1,8 @@
1
1
  import type { BaseSchema } from "./base-schema.type.js";
2
+ import type { OptionalSchema } from "./optional-schema.type.js";
2
3
  import type { Shape } from "./shape.type.js";
3
4
  export type ObjectSchema<ObjectType extends object> = BaseSchema<ObjectType> & Shape<ObjectType> & {
4
5
  strict(): ObjectSchema<ObjectType>;
6
+ optional(): OptionalSchema<ObjectType>;
5
7
  };
6
8
  //# sourceMappingURL=object-schema.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"object-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/object-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,MAAM,YAAY,CAAC,UAAU,SAAS,MAAM,IAChD,UAAU,CAAC,UAAU,CAAC,GACtB,KAAK,CAAC,UAAU,CAAC,GAAG;IAClB,MAAM,IAAI,YAAY,CAAC,UAAU,CAAC,CAAC;CACpC,CAAC"}
1
+ {"version":3,"file":"object-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/object-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,MAAM,YAAY,CAAC,UAAU,SAAS,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,GAC1E,KAAK,CAAC,UAAU,CAAC,GAAG;IAClB,MAAM,IAAI,YAAY,CAAC,UAAU,CAAC,CAAC;IACnC,QAAQ,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC;CACxC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { BaseSchema } from "./base-schema.type.js";
2
+ export interface OptionalSchema<Type> extends BaseSchema<Type | undefined> {
3
+ readonly _optional: true;
4
+ }
5
+ //# sourceMappingURL=optional-schema.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optional-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/optional-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,WAAW,cAAc,CAAC,IAAI,CAAE,SAAQ,UAAU,CAAC,IAAI,GAAG,SAAS,CAAC;IACxE,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,MAAM,MAAM,CAAC,IAAI,IACrB,IAAI,SAAS,MAAM,GAAG,YAAY,GAClC,IAAI,SAAS,MAAM,GAAG,YAAY,GAClC,IAAI,SAAS,OAAO,GAAG,aAAa,GACpC,IAAI,SAAS,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,GAClD,IAAI,SAAS,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,GACxC,KAAK,CAAC"}
1
+ {"version":3,"file":"schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,MAAM,MAAM,CAAC,IAAI,IAAI,IAAI,SAAS,MAAM,GAC1C,YAAY,GACZ,IAAI,SAAS,MAAM,GACjB,YAAY,GACZ,IAAI,SAAS,OAAO,GAClB,aAAa,GACb,IAAI,SAAS,KAAK,CAAC,MAAM,IAAI,CAAC,GAC5B,WAAW,CAAC,IAAI,CAAC,GACjB,IAAI,SAAS,MAAM,GACjB,YAAY,CAAC,IAAI,CAAC,GAClB,KAAK,CAAC"}
@@ -1,5 +1,12 @@
1
+ import { OptionalSchema } from "./optional-schema.type.js";
1
2
  import { Schema } from "./schema.type.js";
3
+ type OptionalKeys<ObjectType> = {
4
+ [Key in keyof ObjectType]-?: undefined extends ObjectType[Key] ? Key : never;
5
+ }[keyof ObjectType];
2
6
  export type Shape<ObjectType extends object> = {
3
- [Key in keyof ObjectType]: Schema<ObjectType[Key]>;
7
+ [Key in Exclude<keyof ObjectType, OptionalKeys<ObjectType>>]-?: Schema<ObjectType[Key]>;
8
+ } & {
9
+ [Key in OptionalKeys<ObjectType>]-?: OptionalSchema<Exclude<ObjectType[Key], undefined>>;
4
10
  };
11
+ export {};
5
12
  //# sourceMappingURL=shape.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shape.type.d.ts","sourceRoot":"","sources":["../../src/schema/shape.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,MAAM,KAAK,CAAC,UAAU,SAAS,MAAM,IAAI;KAC5C,GAAG,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;CACnD,CAAC"}
1
+ {"version":3,"file":"shape.type.d.ts","sourceRoot":"","sources":["../../src/schema/shape.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,KAAK,YAAY,CAAC,UAAU,IAAI;KAC7B,GAAG,IAAI,MAAM,UAAU,CAAC,CAAC,GAAG,SAAS,SAAS,UAAU,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,KAAK;CAC7E,CAAC,MAAM,UAAU,CAAC,CAAC;AAEpB,MAAM,MAAM,KAAK,CAAC,UAAU,SAAS,MAAM,IAAI;KAC5C,GAAG,IAAI,OAAO,CAAC,MAAM,UAAU,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CACpE,UAAU,CAAC,GAAG,CAAC,CAChB;CACF,GAAG;KACD,GAAG,IAAI,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,cAAc,CACjD,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,CACpC;CACF,CAAC"}
@@ -1,7 +1,11 @@
1
1
  import { BaseSchema } from "./base-schema.type.js";
2
+ import { OptionalSchema } from "./optional-schema.type.js";
2
3
  export interface StringSchema extends BaseSchema<string> {
3
4
  contains(substring: string): StringSchema;
4
- minLength(length: number): StringSchema;
5
- maxLength(length: number): StringSchema;
5
+ email(): StringSchema;
6
+ in(values: readonly [string, ...string[]]): StringSchema;
7
+ min(length: number): StringSchema;
8
+ max(length: number): StringSchema;
9
+ optional(): OptionalSchema<string>;
6
10
  }
7
11
  //# sourceMappingURL=string-schema.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"string-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/string-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,WAAW,YAAa,SAAQ,UAAU,CAAC,MAAM,CAAC;IACtD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,CAAC;IAC1C,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IACxC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;CACzC"}
1
+ {"version":3,"file":"string-schema.type.d.ts","sourceRoot":"","sources":["../../src/schema/string-schema.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,WAAW,YAAa,SAAQ,UAAU,CAAC,MAAM,CAAC;IACtD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,CAAC;IAC1C,KAAK,IAAI,YAAY,CAAC;IACtB,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,GAAG,YAAY,CAAC;IACzD,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IAClC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IAClC,QAAQ,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;CACpC"}
@@ -0,0 +1,9 @@
1
+ export interface CryptoService {
2
+ hashSecret(secret: string): Promise<string>;
3
+ compareSecret(secret: string, hashedSecret: string): Promise<boolean>;
4
+ hash(value: string): Promise<string>;
5
+ encrypt(value: string): Promise<string>;
6
+ decrypt(encryptedValue: string): Promise<string>;
7
+ randomBytes(length: number): Promise<Uint8Array>;
8
+ }
9
+ //# sourceMappingURL=crypto-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-service.type.d.ts","sourceRoot":"","sources":["../../src/service/crypto-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5C,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtE,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAErC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExC,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAClD"}
@@ -0,0 +1,23 @@
1
+ import { Locale } from "./locale.type.js";
2
+ import { TimeZone } from "./time-zone.type.js";
3
+ export type DateUnit = "day" | "week" | "month" | "year";
4
+ export type DateFormatOptions = {
5
+ locale?: Locale;
6
+ year?: "numeric" | "2-digit";
7
+ month?: "numeric" | "2-digit" | "long" | "short" | "narrow";
8
+ day?: "numeric" | "2-digit";
9
+ weekday?: "long" | "short" | "narrow";
10
+ };
11
+ export interface DateService<Date> {
12
+ now(timeZone?: TimeZone): Date;
13
+ add(date: Date, amount: number, unit: DateUnit): Date;
14
+ subtract(date: Date, amount: number, unit: DateUnit): Date;
15
+ diff(firstDate: Date, secondDate: Date, unit: DateUnit): number;
16
+ equal(firstDate: Date, secondDate: Date): boolean;
17
+ gt(firstDate: Date, secondDate: Date): boolean;
18
+ lt(firstDate: Date, secondDate: Date): boolean;
19
+ gte(firstDate: Date, secondDate: Date): boolean;
20
+ lte(firstDate: Date, secondDate: Date): boolean;
21
+ format(date: Date, options: DateFormatOptions): string;
22
+ }
23
+ //# sourceMappingURL=date-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-service.type.d.ts","sourceRoot":"","sources":["../../src/service/date-service.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEzD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5D,GAAG,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;CACvC,CAAC;AAEF,MAAM,WAAW,WAAW,CAAC,IAAI;IAC/B,GAAG,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE/B,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IAEtD,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE3D,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IAEhE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAElD,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAE/C,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAE/C,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAEhD,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAEhD,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC;CACxD"}
@@ -0,0 +1,21 @@
1
+ import { DateFormatOptions, DateUnit } from "./date-service.type.js";
2
+ import { TimeFormatOptions, TimeUnit } from "./time-service.type.js";
3
+ import { TimeZone } from "./time-zone.type.js";
4
+ export type DateTimeUnit = DateUnit | TimeUnit;
5
+ export type DateTimeFormatOptions = DateFormatOptions & TimeFormatOptions & {
6
+ dateStyle?: "full" | "long" | "medium" | "short";
7
+ timeStyle?: "full" | "long" | "medium" | "short";
8
+ };
9
+ export interface DateTimeService<DateTime> {
10
+ now(timeZone?: TimeZone): DateTime;
11
+ add(dateTime: DateTime, amount: number, unit: DateTimeUnit): DateTime;
12
+ subtract(dateTime: DateTime, amount: number, unit: DateTimeUnit): DateTime;
13
+ diff(firstDateTime: DateTime, secondDateTime: DateTime, unit: DateTimeUnit): number;
14
+ equal(firstDateTime: DateTime, secondDateTime: DateTime): boolean;
15
+ gt(firstDateTime: DateTime, secondDateTime: DateTime): boolean;
16
+ lt(firstDateTime: DateTime, secondDateTime: DateTime): boolean;
17
+ gte(firstDateTime: DateTime, secondDateTime: DateTime): boolean;
18
+ lte(firstDateTime: DateTime, secondDateTime: DateTime): boolean;
19
+ format(dateTime: DateTime, options: DateTimeFormatOptions): string;
20
+ }
21
+ //# sourceMappingURL=date-time-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-time-service.type.d.ts","sourceRoot":"","sources":["../../src/service/date-time-service.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE/C,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GACnD,iBAAiB,GAAG;IAClB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CAClD,CAAC;AAEJ,MAAM,WAAW,eAAe,CAAC,QAAQ;IACvC,GAAG,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAEnC,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,QAAQ,CAAC;IAEtE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,QAAQ,CAAC;IAE3E,IAAI,CACF,aAAa,EAAE,QAAQ,EACvB,cAAc,EAAE,QAAQ,EACxB,IAAI,EAAE,YAAY,GACjB,MAAM,CAAC;IAEV,KAAK,CAAC,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,GAAG,OAAO,CAAC;IAElE,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,GAAG,OAAO,CAAC;IAE/D,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,GAAG,OAAO,CAAC;IAE/D,GAAG,CAAC,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,GAAG,OAAO,CAAC;IAEhE,GAAG,CAAC,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,GAAG,OAAO,CAAC;IAEhE,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAAC;CACpE"}
@@ -0,0 +1,14 @@
1
+ export * from "./instant-service.type.js";
2
+ export * from "./date-service.type.js";
3
+ export * from "./time-service.type.js";
4
+ export * from "./date-time-service.type.js";
5
+ export * from "./zoned-date-time-service.type.js";
6
+ export * from "./crypto-service.type.js";
7
+ export * from "./token-generation-service.type.js";
8
+ export * from "./token-signing-service.type.js";
9
+ export * from "./token-verification-service.type.js";
10
+ export * from "./token-decoding-service.type.js";
11
+ export * from "./token-encryption-service.type.js";
12
+ export * from "./token-decryption-service.type.js";
13
+ export * from "./token-validation-service.type.js";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { DateTimeFormatOptions } from "./date-time-service.type.js";
2
+ import { TimeZone } from "./time-zone.type.js";
3
+ export type InstantUnit = "millisecond" | "second" | "minute" | "hour";
4
+ export type InstantFormatOptions = DateTimeFormatOptions & {
5
+ timeZone?: TimeZone;
6
+ };
7
+ export interface InstantService<Instant> {
8
+ now(): Instant;
9
+ add(instant: Instant, amount: number, unit: InstantUnit): Instant;
10
+ subtract(instant: Instant, amount: number, unit: InstantUnit): Instant;
11
+ diff(firstInstant: Instant, secondInstant: Instant, unit: InstantUnit): number;
12
+ equal(firstInstant: Instant, secondInstant: Instant): boolean;
13
+ gt(firstInstant: Instant, secondInstant: Instant): boolean;
14
+ lt(firstInstant: Instant, secondInstant: Instant): boolean;
15
+ gte(firstInstant: Instant, secondInstant: Instant): boolean;
16
+ lte(firstInstant: Instant, secondInstant: Instant): boolean;
17
+ format(instant: Instant, options: InstantFormatOptions): string;
18
+ }
19
+ //# sourceMappingURL=instant-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instant-service.type.d.ts","sourceRoot":"","sources":["../../src/service/instant-service.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEvE,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,GAAG;IACzD,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,cAAc,CAAC,OAAO;IACrC,GAAG,IAAI,OAAO,CAAC;IAEf,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC;IAElE,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC;IAEvE,IAAI,CACF,YAAY,EAAE,OAAO,EACrB,aAAa,EAAE,OAAO,EACtB,IAAI,EAAE,WAAW,GAChB,MAAM,CAAC;IAEV,KAAK,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAE9D,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAE3D,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAE3D,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAE5D,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAE5D,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAAC;CACjE"}
@@ -0,0 +1,2 @@
1
+ export type Locale = string;
2
+ //# sourceMappingURL=locale.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.type.d.ts","sourceRoot":"","sources":["../../src/service/locale.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { InstantUnit } from "./instant-service.type.js";
2
+ import { Locale } from "./locale.type.js";
3
+ import { TimeZone } from "./time-zone.type.js";
4
+ export type TimeUnit = InstantUnit;
5
+ export type TimeFormatOptions = {
6
+ locale?: Locale;
7
+ hour?: "numeric" | "2-digit";
8
+ minute?: "numeric" | "2-digit";
9
+ second?: "numeric" | "2-digit";
10
+ fractionalSecondDigits?: 1 | 2 | 3;
11
+ hour12?: boolean;
12
+ hourCycle?: "h11" | "h12" | "h23" | "h24";
13
+ };
14
+ export interface TimeService<Time> {
15
+ now(timeZone?: TimeZone): Time;
16
+ add(time: Time, amount: number, unit: TimeUnit): Time;
17
+ subtract(time: Time, amount: number, unit: TimeUnit): Time;
18
+ diff(firstTime: Time, secondTime: Time, unit: TimeUnit): number;
19
+ equal(firstTime: Time, secondTime: Time): boolean;
20
+ gt(firstTime: Time, secondTime: Time): boolean;
21
+ lt(firstTime: Time, secondTime: Time): boolean;
22
+ gte(firstTime: Time, secondTime: Time): boolean;
23
+ lte(firstTime: Time, secondTime: Time): boolean;
24
+ format(time: Time, options: TimeFormatOptions): string;
25
+ }
26
+ //# sourceMappingURL=time-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-service.type.d.ts","sourceRoot":"","sources":["../../src/service/time-service.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC;AAEnC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,sBAAsB,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CAC3C,CAAC;AAEF,MAAM,WAAW,WAAW,CAAC,IAAI;IAC/B,GAAG,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE/B,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IAEtD,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE3D,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IAEhE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAElD,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAE/C,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAE/C,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAEhD,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAEhD,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC;CACxD"}
@@ -0,0 +1,2 @@
1
+ export type TimeZone = string;
2
+ //# sourceMappingURL=time-zone.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-zone.type.d.ts","sourceRoot":"","sources":["../../src/service/time-zone.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC"}
@@ -0,0 +1,4 @@
1
+ export interface TokenDecodingService<TokenPayload extends object, Token = string> {
2
+ decode(token: Token): Promise<TokenPayload | null>;
3
+ }
4
+ //# sourceMappingURL=token-decoding-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-decoding-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-decoding-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB,CACnC,YAAY,SAAS,MAAM,EAC3B,KAAK,GAAG,MAAM;IAEd,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CACpD"}
@@ -0,0 +1,5 @@
1
+ export type DecryptOptions = Record<string, unknown>;
2
+ export interface TokenDecryptionService<TokenPayload extends object, Token = string, CustomDecryptOptions extends DecryptOptions = DecryptOptions> {
3
+ decrypt(token: Token, options?: CustomDecryptOptions): Promise<TokenPayload>;
4
+ }
5
+ //# sourceMappingURL=token-decryption-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-decryption-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-decryption-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,WAAW,sBAAsB,CACrC,YAAY,SAAS,MAAM,EAC3B,KAAK,GAAG,MAAM,EACd,oBAAoB,SAAS,cAAc,GAAG,cAAc;IAE5D,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC9E"}
@@ -0,0 +1,5 @@
1
+ export type EncryptOptions = Record<string, unknown>;
2
+ export interface TokenEncryptionService<TokenPayload extends object, Token = string, CustomEncryptOptions extends EncryptOptions = EncryptOptions> {
3
+ encrypt(payload: TokenPayload, options?: CustomEncryptOptions): Promise<Token>;
4
+ }
5
+ //# sourceMappingURL=token-encryption-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-encryption-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-encryption-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,WAAW,sBAAsB,CACrC,YAAY,SAAS,MAAM,EAC3B,KAAK,GAAG,MAAM,EACd,oBAAoB,SAAS,cAAc,GAAG,cAAc;IAE5D,OAAO,CACL,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,KAAK,CAAC,CAAC;CACnB"}
@@ -0,0 +1,7 @@
1
+ export type GenerateOptions = {
2
+ length?: number;
3
+ };
4
+ export interface TokenGenerationService<Token = string, CustomGenerateOptions extends GenerateOptions = GenerateOptions> {
5
+ generate(options?: CustomGenerateOptions): Promise<Token>;
6
+ }
7
+ //# sourceMappingURL=token-generation-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-generation-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-generation-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,sBAAsB,CACrC,KAAK,GAAG,MAAM,EACd,qBAAqB,SAAS,eAAe,GAAG,eAAe;IAE/D,QAAQ,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CAC3D"}
@@ -0,0 +1,9 @@
1
+ export type SignOptions = {
2
+ expiresIn?: number | string;
3
+ issuer?: string;
4
+ audience?: string;
5
+ };
6
+ export interface TokenSigningService<TokenPayload extends object, Token = string, CustomSignOptions extends SignOptions = SignOptions> {
7
+ sign(payload: TokenPayload, options?: CustomSignOptions): Promise<Token>;
8
+ }
9
+ //# sourceMappingURL=token-signing-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-signing-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-signing-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,mBAAmB,CAClC,YAAY,SAAS,MAAM,EAC3B,KAAK,GAAG,MAAM,EACd,iBAAiB,SAAS,WAAW,GAAG,WAAW;IAEnD,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CAC1E"}
@@ -0,0 +1,4 @@
1
+ export interface TokenValidationService<Token = string> {
2
+ validate(token: Token): Promise<boolean>;
3
+ }
4
+ //# sourceMappingURL=token-validation-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-validation-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-validation-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB,CAAC,KAAK,GAAG,MAAM;IACpD,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C"}
@@ -0,0 +1,8 @@
1
+ export type VerifyOptions = {
2
+ issuer?: string;
3
+ audience?: string;
4
+ };
5
+ export interface TokenVerificationService<TokenPayload extends object, Token = string, CustomVerifyOptions extends VerifyOptions = VerifyOptions> {
6
+ verify(token: Token, options?: CustomVerifyOptions): Promise<TokenPayload>;
7
+ }
8
+ //# sourceMappingURL=token-verification-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-verification-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-verification-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,wBAAwB,CACvC,YAAY,SAAS,MAAM,EAC3B,KAAK,GAAG,MAAM,EACd,mBAAmB,SAAS,aAAa,GAAG,aAAa;IAEzD,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC5E"}
@@ -0,0 +1,22 @@
1
+ import { DateTimeFormatOptions } from "./date-time-service.type.js";
2
+ import { DateUnit } from "./date-service.type.js";
3
+ import { TimeUnit } from "./time-service.type.js";
4
+ import { TimeZone } from "./time-zone.type.js";
5
+ export type ZonedDateTimeUnit = DateUnit | TimeUnit;
6
+ export type ZonedDateTimeFormatOptions = DateTimeFormatOptions & {
7
+ timeZone?: TimeZone;
8
+ timeZoneName?: "long" | "short" | "longOffset" | "shortOffset";
9
+ };
10
+ export interface ZonedDateTimeService<ZonedDateTime> {
11
+ now(timeZone?: TimeZone): ZonedDateTime;
12
+ add(zonedDateTime: ZonedDateTime, amount: number, unit: ZonedDateTimeUnit): ZonedDateTime;
13
+ subtract(zonedDateTime: ZonedDateTime, amount: number, unit: ZonedDateTimeUnit): ZonedDateTime;
14
+ diff(firstZonedDateTime: ZonedDateTime, secondZonedDateTime: ZonedDateTime, unit: ZonedDateTimeUnit): number;
15
+ equal(firstZonedDateTime: ZonedDateTime, secondZonedDateTime: ZonedDateTime): boolean;
16
+ gt(firstZonedDateTime: ZonedDateTime, secondZonedDateTime: ZonedDateTime): boolean;
17
+ lt(firstZonedDateTime: ZonedDateTime, secondZonedDateTime: ZonedDateTime): boolean;
18
+ gte(firstZonedDateTime: ZonedDateTime, secondZonedDateTime: ZonedDateTime): boolean;
19
+ lte(firstZonedDateTime: ZonedDateTime, secondZonedDateTime: ZonedDateTime): boolean;
20
+ format(zonedDateTime: ZonedDateTime, options: ZonedDateTimeFormatOptions): string;
21
+ }
22
+ //# sourceMappingURL=zoned-date-time-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zoned-date-time-service.type.d.ts","sourceRoot":"","sources":["../../src/service/zoned-date-time-service.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEpD,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,GAAG;IAC/D,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,YAAY,GAAG,aAAa,CAAC;CAChE,CAAC;AAEF,MAAM,WAAW,oBAAoB,CAAC,aAAa;IACjD,GAAG,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC;IAExC,GAAG,CACD,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,iBAAiB,GACtB,aAAa,CAAC;IAEjB,QAAQ,CACN,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,iBAAiB,GACtB,aAAa,CAAC;IAEjB,IAAI,CACF,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,aAAa,EAClC,IAAI,EAAE,iBAAiB,GACtB,MAAM,CAAC;IAEV,KAAK,CACH,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,aAAa,GACjC,OAAO,CAAC;IAEX,EAAE,CACA,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,aAAa,GACjC,OAAO,CAAC;IAEX,EAAE,CACA,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,aAAa,GACjC,OAAO,CAAC;IAEX,GAAG,CACD,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,aAAa,GACjC,OAAO,CAAC;IAEX,GAAG,CACD,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,aAAa,GACjC,OAAO,CAAC;IAEX,MAAM,CACJ,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,0BAA0B,GAClC,MAAM,CAAC;CACX"}
@@ -1,4 +1,4 @@
1
1
  import { DomainError } from "@basecraft/errors";
2
- export type Result<Value, CustomError extends DomainError> = Value | CustomError;
3
- export type AsyncResult<Value, CustomError extends DomainError> = Promise<Result<Value, CustomError>>;
2
+ export type Result<Value, CustomError extends DomainError = never> = Value | CustomError;
3
+ export type AsyncResult<Value, CustomError extends DomainError = never> = Promise<Result<Value, CustomError>>;
4
4
  //# sourceMappingURL=result.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"result.type.d.ts","sourceRoot":"","sources":["../../src/use-case/result.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,MAAM,MAAM,CAAC,KAAK,EAAE,WAAW,SAAS,WAAW,IAAI,KAAK,GAAG,WAAW,CAAC;AAEjF,MAAM,MAAM,WAAW,CAAC,KAAK,EAAE,WAAW,SAAS,WAAW,IAAI,OAAO,CACvE,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAC3B,CAAC"}
1
+ {"version":3,"file":"result.type.d.ts","sourceRoot":"","sources":["../../src/use-case/result.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,MAAM,MAAM,CAAC,KAAK,EAAE,WAAW,SAAS,WAAW,GAAG,KAAK,IAC/D,KAAK,GAAG,WAAW,CAAC;AAEtB,MAAM,MAAM,WAAW,CACrB,KAAK,EACL,WAAW,SAAS,WAAW,GAAG,KAAK,IACrC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC"}
@@ -1,7 +1,4 @@
1
- export interface BaseUser {
2
- role: string;
3
- }
4
- export interface UseCaseDependencies<AuthenticatedUser extends BaseUser = BaseUser> {
1
+ export interface UseCaseDependencies<AuthenticatedUser extends object = object> {
5
2
  currentUser?: AuthenticatedUser | undefined;
6
3
  }
7
4
  //# sourceMappingURL=use-case-dependencies.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-case-dependencies.type.d.ts","sourceRoot":"","sources":["../../src/use-case/use-case-dependencies.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB,CAAC,iBAAiB,SAAS,QAAQ,GAAG,QAAQ;IAChF,WAAW,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAC7C"}
1
+ {"version":3,"file":"use-case-dependencies.type.d.ts","sourceRoot":"","sources":["../../src/use-case/use-case-dependencies.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB,CAClC,iBAAiB,SAAS,MAAM,GAAG,MAAM;IAEzC,WAAW,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAC7C"}
@@ -1,3 +1,3 @@
1
1
  import { AuthenticationRequiredError, AuthorizationError, DomainError, InvalidRequestError, UnexpectedError } from "@basecraft/errors";
2
- export type UseCaseError<CustomError extends DomainError> = CustomError | InvalidRequestError | AuthenticationRequiredError | AuthorizationError | UnexpectedError;
2
+ export type UseCaseError<CustomError extends DomainError = never> = CustomError | InvalidRequestError | AuthenticationRequiredError | AuthorizationError | UnexpectedError;
3
3
  //# sourceMappingURL=use-case-error.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-case-error.type.d.ts","sourceRoot":"","sources":["../../src/use-case/use-case-error.type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,YAAY,CAAC,WAAW,SAAS,WAAW,IACpD,WAAW,GACX,mBAAmB,GACnB,2BAA2B,GAC3B,kBAAkB,GAClB,eAAe,CAAC"}
1
+ {"version":3,"file":"use-case-error.type.d.ts","sourceRoot":"","sources":["../../src/use-case/use-case-error.type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,YAAY,CAAC,WAAW,SAAS,WAAW,GAAG,KAAK,IAC5D,WAAW,GACX,mBAAmB,GACnB,2BAA2B,GAC3B,kBAAkB,GAClB,eAAe,CAAC"}
@@ -1,10 +1,11 @@
1
1
  import { DomainError } from "@basecraft/errors";
2
2
  import { Shape } from "../schema/shape.type.js";
3
3
  import { Result } from "./result.type.js";
4
+ import { InferRole } from "../util/infer-role.type.js";
4
5
  import { UseCaseDependencies } from "./use-case-dependencies.type.js";
5
- export interface UseCaseOptions<Dependencies extends UseCaseDependencies, Request extends object, Response, CustomError extends DomainError> {
6
- authenticationRequired: boolean;
7
- allowedRoles?: readonly string[] | undefined;
6
+ export interface UseCaseOptions<Dependencies extends UseCaseDependencies, Request extends object, Response, CustomError extends DomainError = never> {
7
+ authRequired?: boolean | undefined;
8
+ allowedRoles?: readonly InferRole<Dependencies>[] | undefined;
8
9
  requestShape: Shape<Request>;
9
10
  handler: (dependencies: Dependencies, request: Request) => Promise<Result<Response, CustomError>>;
10
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-case-options.type.d.ts","sourceRoot":"","sources":["../../src/use-case/use-case-options.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,WAAW,cAAc,CAC7B,YAAY,SAAS,mBAAmB,EACxC,OAAO,SAAS,MAAM,EACtB,QAAQ,EACR,WAAW,SAAS,WAAW;IAE/B,sBAAsB,EAAE,OAAO,CAAC;IAEhC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAE7C,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAE7B,OAAO,EAAE,CACP,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;CAC7C"}
1
+ {"version":3,"file":"use-case-options.type.d.ts","sourceRoot":"","sources":["../../src/use-case/use-case-options.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,WAAW,cAAc,CAC7B,YAAY,SAAS,mBAAmB,EACxC,OAAO,SAAS,MAAM,EACtB,QAAQ,EACR,WAAW,SAAS,WAAW,GAAG,KAAK;IAEvC,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEnC,YAAY,CAAC,EAAE,SAAS,SAAS,CAAC,YAAY,CAAC,EAAE,GAAG,SAAS,CAAC;IAE9D,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAE7B,OAAO,EAAE,CACP,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;CAC7C"}
@@ -2,7 +2,7 @@ import { DomainError } from "@basecraft/errors";
2
2
  import { Result } from "./result.type.js";
3
3
  import { UseCaseDependencies } from "./use-case-dependencies.type.js";
4
4
  import { UseCaseError } from "./use-case-error.type.js";
5
- export interface UseCase<Dependencies extends UseCaseDependencies, Request extends object, Response, CustomError extends DomainError> {
5
+ export interface UseCase<Dependencies extends UseCaseDependencies, Request extends object, Response, CustomError extends DomainError = never> {
6
6
  execute(dependencies: Dependencies, request: Request): Promise<Result<Response, UseCaseError<CustomError>>>;
7
7
  }
8
8
  //# sourceMappingURL=use-case.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-case.type.d.ts","sourceRoot":"","sources":["../../src/use-case/use-case.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,WAAW,OAAO,CACtB,YAAY,SAAS,mBAAmB,EACxC,OAAO,SAAS,MAAM,EACtB,QAAQ,EACR,WAAW,SAAS,WAAW;IAE/B,OAAO,CACL,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CACzD"}
1
+ {"version":3,"file":"use-case.type.d.ts","sourceRoot":"","sources":["../../src/use-case/use-case.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,WAAW,OAAO,CACtB,YAAY,SAAS,mBAAmB,EACxC,OAAO,SAAS,MAAM,EACtB,QAAQ,EACR,WAAW,SAAS,WAAW,GAAG,KAAK;IAEvC,OAAO,CACL,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CACzD"}
@@ -0,0 +1,3 @@
1
+ import { UseCaseDependencies } from "../use-case/use-case-dependencies.type.js";
2
+ export type InferCurrentUser<Dependencies extends UseCaseDependencies> = NonNullable<Dependencies["currentUser"]>;
3
+ //# sourceMappingURL=infer-current-user.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infer-current-user.type.d.ts","sourceRoot":"","sources":["../../src/util/infer-current-user.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,MAAM,MAAM,gBAAgB,CAAC,YAAY,SAAS,mBAAmB,IACnE,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { UseCaseDependencies } from "../use-case/use-case-dependencies.type.js";
2
+ import { InferCurrentUser } from "./infer-current-user.type.js";
3
+ export type InferRole<Dependencies extends UseCaseDependencies> = InferCurrentUser<Dependencies> extends {
4
+ role?: infer Role;
5
+ } ? [Extract<Role, string | number>] extends [never] ? string | number : Extract<Role, string | number> : string | number;
6
+ //# sourceMappingURL=infer-role.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infer-role.type.d.ts","sourceRoot":"","sources":["../../src/util/infer-role.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,MAAM,MAAM,SAAS,CAAC,YAAY,SAAS,mBAAmB,IAC5D,gBAAgB,CAAC,YAAY,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,GACxD,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAC9C,MAAM,GAAG,MAAM,GACf,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,GAChC,MAAM,GAAG,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "@basecraft/types",
3
- "version": "1.0.0",
3
+ "version": "3.0.0",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
- "files": ["dist"],
6
+ "files": [
7
+ "dist"
8
+ ],
7
9
  "scripts": {
8
10
  "build": "tsc",
9
11
  "clean": "rm -rf dist",
10
12
  "check:types": "tsc --noEmit",
13
+ "check:format": "prettier . --check",
11
14
  "check:code": "eslint ."
12
15
  },
13
16
  "dependencies": {
@@ -1,4 +0,0 @@
1
- export type RequireAtLeastOne<ObjectType extends object> = {
2
- [Key in keyof ObjectType]-?: Required<Pick<ObjectType, Key>> & Partial<Omit<ObjectType, Key>>;
3
- }[keyof ObjectType];
4
- //# sourceMappingURL=require-at-least-one.type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"require-at-least-one.type.d.ts","sourceRoot":"","sources":["../src/require-at-least-one.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,CAAC,UAAU,SAAS,MAAM,IAAI;KACxD,GAAG,IAAI,MAAM,UAAU,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,GAC1D,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;CACjC,CAAC,MAAM,UAAU,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- export type FieldSchemas<Shape> = {
2
- readonly [Key in keyof Shape]: {
3
- readonly _brand: string;
4
- };
5
- };
6
- //# sourceMappingURL=field-schemas.type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-schemas.type.d.ts","sourceRoot":"","sources":["../../src/schema/field-schemas.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,CAAC,KAAK,IAAI;IAChC,QAAQ,EAAE,GAAG,IAAI,MAAM,KAAK,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CAC3D,CAAC"}