@venizia/ignis-kernel 0.4.1 → 0.4.3

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 (183) hide show
  1. package/dist/cjs/base/applications/common/constants.d.ts +9 -0
  2. package/dist/cjs/base/applications/common/constants.d.ts.map +1 -1
  3. package/dist/cjs/base/applications/common/constants.js +11 -1
  4. package/dist/cjs/base/applications/common/constants.js.map +1 -1
  5. package/dist/cjs/base/applications/common/types/middlewares.d.ts +2 -2
  6. package/dist/cjs/base/applications/common/types/middlewares.d.ts.map +1 -1
  7. package/dist/cjs/base/applications/common/types/middlewares.js.map +1 -1
  8. package/dist/cjs/base/applications/cors.d.ts +13 -0
  9. package/dist/cjs/base/applications/cors.d.ts.map +1 -0
  10. package/dist/cjs/base/applications/cors.js +43 -0
  11. package/dist/cjs/base/applications/cors.js.map +1 -0
  12. package/dist/cjs/base/applications/deprecations.d.ts +10 -0
  13. package/dist/cjs/base/applications/deprecations.d.ts.map +1 -0
  14. package/dist/cjs/base/applications/deprecations.js +23 -0
  15. package/dist/cjs/base/applications/deprecations.js.map +1 -0
  16. package/dist/cjs/base/applications/rest.d.ts.map +1 -1
  17. package/dist/cjs/base/applications/rest.js +6 -0
  18. package/dist/cjs/base/applications/rest.js.map +1 -1
  19. package/dist/cjs/base/auth/authenticate/common/constants/jose.d.ts +10 -0
  20. package/dist/cjs/base/auth/authenticate/common/constants/jose.d.ts.map +1 -1
  21. package/dist/cjs/base/auth/authenticate/common/constants/jose.js +12 -1
  22. package/dist/cjs/base/auth/authenticate/common/constants/jose.js.map +1 -1
  23. package/dist/cjs/base/auth/authenticate/common/types/jwt.d.ts +1 -2
  24. package/dist/cjs/base/auth/authenticate/common/types/jwt.d.ts.map +1 -1
  25. package/dist/cjs/base/auth/authenticate/common/types/jwt.js.map +1 -1
  26. package/dist/cjs/base/auth/authorize/common/constants/authorization.d.ts +11 -0
  27. package/dist/cjs/base/auth/authorize/common/constants/authorization.d.ts.map +1 -1
  28. package/dist/cjs/base/auth/authorize/common/constants/authorization.js +13 -1
  29. package/dist/cjs/base/auth/authorize/common/constants/authorization.js.map +1 -1
  30. package/dist/cjs/base/auth/authorize/common/types/request.d.ts +2 -1
  31. package/dist/cjs/base/auth/authorize/common/types/request.d.ts.map +1 -1
  32. package/dist/cjs/base/auth/authorize/common/types/request.js.map +1 -1
  33. package/dist/cjs/base/auth/authorize/providers/request-domain.js +4 -4
  34. package/dist/cjs/base/auth/authorize/providers/request-domain.js.map +1 -1
  35. package/dist/cjs/base/controllers/common/constants.d.ts +10 -0
  36. package/dist/cjs/base/controllers/common/constants.d.ts.map +1 -1
  37. package/dist/cjs/base/controllers/common/constants.js +12 -1
  38. package/dist/cjs/base/controllers/common/constants.js.map +1 -1
  39. package/dist/cjs/base/controllers/factory/authorize-guard.d.ts +19 -0
  40. package/dist/cjs/base/controllers/factory/authorize-guard.d.ts.map +1 -0
  41. package/dist/cjs/base/controllers/factory/authorize-guard.js +60 -0
  42. package/dist/cjs/base/controllers/factory/authorize-guard.js.map +1 -0
  43. package/dist/cjs/base/controllers/factory/controller.d.ts +1 -1
  44. package/dist/cjs/base/controllers/factory/controller.d.ts.map +1 -1
  45. package/dist/cjs/base/controllers/factory/controller.js +8 -0
  46. package/dist/cjs/base/controllers/factory/controller.js.map +1 -1
  47. package/dist/cjs/base/controllers/rest/abstract.d.ts +2 -1
  48. package/dist/cjs/base/controllers/rest/abstract.d.ts.map +1 -1
  49. package/dist/cjs/base/controllers/rest/abstract.js +6 -4
  50. package/dist/cjs/base/controllers/rest/abstract.js.map +1 -1
  51. package/dist/cjs/base/metadata/model-metadata.d.ts +17 -0
  52. package/dist/cjs/base/metadata/model-metadata.d.ts.map +1 -0
  53. package/dist/cjs/base/metadata/model-metadata.js +50 -0
  54. package/dist/cjs/base/metadata/model-metadata.js.map +1 -0
  55. package/dist/cjs/base/metadata/model-settings.d.ts +11 -0
  56. package/dist/cjs/base/metadata/model-settings.d.ts.map +1 -0
  57. package/dist/cjs/base/metadata/model-settings.js +34 -0
  58. package/dist/cjs/base/metadata/model-settings.js.map +1 -0
  59. package/dist/cjs/base/metadata/persistents.d.ts +1 -1
  60. package/dist/cjs/base/metadata/persistents.d.ts.map +1 -1
  61. package/dist/cjs/base/metadata/persistents.js +13 -8
  62. package/dist/cjs/base/metadata/persistents.js.map +1 -1
  63. package/dist/cjs/base/models/common/constants.d.ts +17 -0
  64. package/dist/cjs/base/models/common/constants.d.ts.map +1 -1
  65. package/dist/cjs/base/models/common/constants.js +20 -1
  66. package/dist/cjs/base/models/common/constants.js.map +1 -1
  67. package/dist/cjs/base/models/common/schemas.d.ts +1 -1
  68. package/dist/cjs/base/models/common/schemas.d.ts.map +1 -1
  69. package/dist/cjs/base/models/common/schemas.js.map +1 -1
  70. package/dist/cjs/base/models/common/types/id.d.ts +0 -2
  71. package/dist/cjs/base/models/common/types/id.d.ts.map +1 -1
  72. package/dist/cjs/base/models/common/types/id.js.map +1 -1
  73. package/dist/cjs/base/repositories/common/constants.d.ts +18 -1
  74. package/dist/cjs/base/repositories/common/constants.d.ts.map +1 -1
  75. package/dist/cjs/base/repositories/common/constants.js +22 -2
  76. package/dist/cjs/base/repositories/common/constants.js.map +1 -1
  77. package/dist/cjs/base/repositories/core/abstract.d.ts +1 -1
  78. package/dist/cjs/base/repositories/core/abstract.d.ts.map +1 -1
  79. package/dist/cjs/base/repositories/core/abstract.js +4 -4
  80. package/dist/cjs/base/repositories/core/abstract.js.map +1 -1
  81. package/dist/cjs/helpers/inversion/common/constants.d.ts +10 -0
  82. package/dist/cjs/helpers/inversion/common/constants.d.ts.map +1 -1
  83. package/dist/cjs/helpers/inversion/common/constants.js +11 -1
  84. package/dist/cjs/helpers/inversion/common/constants.js.map +1 -1
  85. package/dist/cjs/helpers/inversion/common/types/model.d.ts +85 -25
  86. package/dist/cjs/helpers/inversion/common/types/model.d.ts.map +1 -1
  87. package/dist/cjs/helpers/inversion/common/types/model.js.map +1 -1
  88. package/dist/cjs/helpers/inversion/mixins/model.mixin.d.ts +5 -4
  89. package/dist/cjs/helpers/inversion/mixins/model.mixin.d.ts.map +1 -1
  90. package/dist/cjs/helpers/inversion/mixins/model.mixin.js +5 -4
  91. package/dist/cjs/helpers/inversion/mixins/model.mixin.js.map +1 -1
  92. package/dist/esm/base/applications/common/constants.d.ts +9 -0
  93. package/dist/esm/base/applications/common/constants.d.ts.map +1 -1
  94. package/dist/esm/base/applications/common/constants.js +9 -0
  95. package/dist/esm/base/applications/common/constants.js.map +1 -1
  96. package/dist/esm/base/applications/common/types/middlewares.d.ts +2 -2
  97. package/dist/esm/base/applications/common/types/middlewares.d.ts.map +1 -1
  98. package/dist/esm/base/applications/common/types/middlewares.js.map +1 -1
  99. package/dist/esm/base/applications/cors.d.ts +13 -0
  100. package/dist/esm/base/applications/cors.d.ts.map +1 -0
  101. package/dist/esm/base/applications/cors.js +39 -0
  102. package/dist/esm/base/applications/cors.js.map +1 -0
  103. package/dist/esm/base/applications/deprecations.d.ts +10 -0
  104. package/dist/esm/base/applications/deprecations.d.ts.map +1 -0
  105. package/dist/esm/base/applications/deprecations.js +19 -0
  106. package/dist/esm/base/applications/deprecations.js.map +1 -0
  107. package/dist/esm/base/applications/rest.d.ts.map +1 -1
  108. package/dist/esm/base/applications/rest.js +6 -0
  109. package/dist/esm/base/applications/rest.js.map +1 -1
  110. package/dist/esm/base/auth/authenticate/common/constants/jose.d.ts +10 -0
  111. package/dist/esm/base/auth/authenticate/common/constants/jose.d.ts.map +1 -1
  112. package/dist/esm/base/auth/authenticate/common/constants/jose.js +10 -0
  113. package/dist/esm/base/auth/authenticate/common/constants/jose.js.map +1 -1
  114. package/dist/esm/base/auth/authenticate/common/types/jwt.d.ts +1 -2
  115. package/dist/esm/base/auth/authenticate/common/types/jwt.d.ts.map +1 -1
  116. package/dist/esm/base/auth/authenticate/common/types/jwt.js.map +1 -1
  117. package/dist/esm/base/auth/authorize/common/constants/authorization.d.ts +11 -0
  118. package/dist/esm/base/auth/authorize/common/constants/authorization.d.ts.map +1 -1
  119. package/dist/esm/base/auth/authorize/common/constants/authorization.js +11 -0
  120. package/dist/esm/base/auth/authorize/common/constants/authorization.js.map +1 -1
  121. package/dist/esm/base/auth/authorize/common/types/request.d.ts +2 -1
  122. package/dist/esm/base/auth/authorize/common/types/request.d.ts.map +1 -1
  123. package/dist/esm/base/auth/authorize/common/types/request.js.map +1 -1
  124. package/dist/esm/base/auth/authorize/providers/request-domain.js +5 -5
  125. package/dist/esm/base/auth/authorize/providers/request-domain.js.map +1 -1
  126. package/dist/esm/base/controllers/common/constants.d.ts +10 -0
  127. package/dist/esm/base/controllers/common/constants.d.ts.map +1 -1
  128. package/dist/esm/base/controllers/common/constants.js +10 -0
  129. package/dist/esm/base/controllers/common/constants.js.map +1 -1
  130. package/dist/esm/base/controllers/factory/authorize-guard.d.ts +19 -0
  131. package/dist/esm/base/controllers/factory/authorize-guard.d.ts.map +1 -0
  132. package/dist/esm/base/controllers/factory/authorize-guard.js +56 -0
  133. package/dist/esm/base/controllers/factory/authorize-guard.js.map +1 -0
  134. package/dist/esm/base/controllers/factory/controller.d.ts +1 -1
  135. package/dist/esm/base/controllers/factory/controller.d.ts.map +1 -1
  136. package/dist/esm/base/controllers/factory/controller.js +8 -0
  137. package/dist/esm/base/controllers/factory/controller.js.map +1 -1
  138. package/dist/esm/base/controllers/rest/abstract.d.ts +2 -1
  139. package/dist/esm/base/controllers/rest/abstract.d.ts.map +1 -1
  140. package/dist/esm/base/controllers/rest/abstract.js +6 -4
  141. package/dist/esm/base/controllers/rest/abstract.js.map +1 -1
  142. package/dist/esm/base/metadata/model-metadata.d.ts +17 -0
  143. package/dist/esm/base/metadata/model-metadata.d.ts.map +1 -0
  144. package/dist/esm/base/metadata/model-metadata.js +46 -0
  145. package/dist/esm/base/metadata/model-metadata.js.map +1 -0
  146. package/dist/esm/base/metadata/model-settings.d.ts +11 -0
  147. package/dist/esm/base/metadata/model-settings.d.ts.map +1 -0
  148. package/dist/esm/base/metadata/model-settings.js +30 -0
  149. package/dist/esm/base/metadata/model-settings.js.map +1 -0
  150. package/dist/esm/base/metadata/persistents.d.ts +1 -1
  151. package/dist/esm/base/metadata/persistents.d.ts.map +1 -1
  152. package/dist/esm/base/metadata/persistents.js +13 -8
  153. package/dist/esm/base/metadata/persistents.js.map +1 -1
  154. package/dist/esm/base/models/common/constants.d.ts +17 -0
  155. package/dist/esm/base/models/common/constants.d.ts.map +1 -1
  156. package/dist/esm/base/models/common/constants.js +17 -0
  157. package/dist/esm/base/models/common/constants.js.map +1 -1
  158. package/dist/esm/base/models/common/schemas.d.ts +1 -1
  159. package/dist/esm/base/models/common/schemas.d.ts.map +1 -1
  160. package/dist/esm/base/models/common/schemas.js.map +1 -1
  161. package/dist/esm/base/models/common/types/id.d.ts +0 -2
  162. package/dist/esm/base/models/common/types/id.d.ts.map +1 -1
  163. package/dist/esm/base/models/common/types/id.js.map +1 -1
  164. package/dist/esm/base/repositories/common/constants.d.ts +18 -1
  165. package/dist/esm/base/repositories/common/constants.d.ts.map +1 -1
  166. package/dist/esm/base/repositories/common/constants.js +20 -1
  167. package/dist/esm/base/repositories/common/constants.js.map +1 -1
  168. package/dist/esm/base/repositories/core/abstract.d.ts +1 -1
  169. package/dist/esm/base/repositories/core/abstract.d.ts.map +1 -1
  170. package/dist/esm/base/repositories/core/abstract.js +4 -4
  171. package/dist/esm/base/repositories/core/abstract.js.map +1 -1
  172. package/dist/esm/helpers/inversion/common/constants.d.ts +10 -0
  173. package/dist/esm/helpers/inversion/common/constants.d.ts.map +1 -1
  174. package/dist/esm/helpers/inversion/common/constants.js +9 -0
  175. package/dist/esm/helpers/inversion/common/constants.js.map +1 -1
  176. package/dist/esm/helpers/inversion/common/types/model.d.ts +85 -25
  177. package/dist/esm/helpers/inversion/common/types/model.d.ts.map +1 -1
  178. package/dist/esm/helpers/inversion/common/types/model.js.map +1 -1
  179. package/dist/esm/helpers/inversion/mixins/model.mixin.d.ts +5 -4
  180. package/dist/esm/helpers/inversion/mixins/model.mixin.d.ts.map +1 -1
  181. package/dist/esm/helpers/inversion/mixins/model.mixin.js +5 -4
  182. package/dist/esm/helpers/inversion/mixins/model.mixin.js.map +1 -1
  183. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"abstract.d.ts","sourceRoot":"","sources":["../../../../../src/base/controllers/rest/abstract.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAY,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACd,MAAM,iBAAiB,CAAC;AAOzB,kHAAkH;AAClH,8BAAsB,sBAAsB,CAC1C,QAAQ,SAAS,GAAG,GAAG,GAAG,EAC1B,WAAW,SAAS,MAAM,GAAG,EAAE,EAC/B,QAAQ,SAAS,MAAM,GAAG,GAAG,EAC7B,mBAAmB,SAAS,MAAM,GAAG,EAAE,EACvC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAEvF,SAAQ,UACR,YAAW,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,mBAAmB,CAAC;IAE5E,YAAY,UAAS;IACrB,MAAM,EAAE,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,WAAW,CAAC;gBAEb,IAAI,EAAE,kBAAkB;IA2BpC,mEAAmE;IACn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const form_body_middleware_1 = require("../../middlewares/form-body/form-body.mi
8
8
  const strategy_registry_1 = require("../../auth/authenticate/strategies/strategy-registry");
9
9
  const common_1 = require("../../metadata/routes/common");
10
10
  const registry_1 = require("../../../helpers/inversion/registry");
11
+ const constants_2 = require("../common/constants");
11
12
  const html_response_1 = require("../common/html-response");
12
13
  const zod_openapi_1 = require("@hono/zod-openapi");
13
14
  const core_1 = require("@venizia/ignis-helpers/core");
@@ -46,7 +47,7 @@ class AbstractRestController extends core_1.BaseHelper {
46
47
  }
47
48
  /** Registers decorator-defined routes from the metadata registry; `paths` selects them by shape - see the two-phase call in {@link configure}. */
48
49
  registerRoutesFromRegistry(opts) {
49
- const { paths = 'all' } = opts ?? {};
50
+ const { paths = constants_2.RoutePathScopes.ALL } = opts ?? {};
50
51
  const logger = this.logger.for(this.registerRoutesFromRegistry.name);
51
52
  common_1.DroppedRouteDecorators.report({ logger });
52
53
  const routes = registry_1.MetadataRegistry.getInstance().getRoutes({
@@ -57,7 +58,8 @@ class AbstractRestController extends core_1.BaseHelper {
57
58
  }
58
59
  const routeDefs = routes.entries();
59
60
  for (const [methodName, routeConfigs] of routeDefs) {
60
- if (paths !== 'all' && hasPathParam({ path: routeConfigs.path }) !== (paths === 'param')) {
61
+ if (paths !== constants_2.RoutePathScopes.ALL &&
62
+ hasPathParam({ path: routeConfigs.path }) !== (paths === constants_2.RoutePathScopes.PARAM)) {
61
63
  continue;
62
64
  }
63
65
  // Dynamic dispatch by decorator-recorded method name - the controller class has no static index signature, so this read cannot be typed narrower than `unknown`.
@@ -81,9 +83,9 @@ class AbstractRestController extends core_1.BaseHelper {
81
83
  const configureOptions = opts ?? {};
82
84
  logger.info('START | Binding controller | Options: %j', configureOptions);
83
85
  // Hono matches in registration order, so registration runs by SHAPE not source: every static path first, then binding()'s routes, then decorator param routes last (`/{id}` early would eat `/count`).
84
- this.registerRoutesFromRegistry({ paths: 'static' });
86
+ this.registerRoutesFromRegistry({ paths: constants_2.RoutePathScopes.STATIC });
85
87
  await this.binding();
86
- this.registerRoutesFromRegistry({ paths: 'param' });
88
+ this.registerRoutesFromRegistry({ paths: constants_2.RoutePathScopes.PARAM });
87
89
  this.isConfigured = true;
88
90
  logger.info('DONE | Binding controller | Took: %s (ms)', performance.now() - t);
89
91
  return this.router;
@@ -1 +1 @@
1
- {"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../../../src/base/controllers/rest/abstract.ts"],"names":[],"mappings":";;;AAAA,yEAAgF;AAChF,0GAA8G;AAE9G,iGAAkG;AAClG,4FAAgG;AAChG,6FAAuG;AACvG,0DAAuE;AACvE,2DAAgE;AAChE,2EAAuE;AAEvE,mDAA6D;AAE7D,sDAAmE;AAWnE,sGAAsG;AACtG,MAAM,YAAY,GAAG,CAAC,IAAsB,EAAW,EAAE;IACvD,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,kHAAkH;AAClH,MAAsB,sBAOpB,SAAQ,iBAAU;IAQlB,YAAY,IAAwB;QAClC,KAAK,CAAC,IAAI,CAAC,CAAC;QANd,iBAAY,GAAG,KAAK,CAAC;QAOnB,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QAEjC,MAAM,iBAAiB,GAAG,2BAAgB,CAAC,WAAW,EAAE,CAAC,qBAAqB,CAAC;YAC7E,MAAM,EAAE,GAAG,CAAC,MAAM;SACnB,CAAC,CAAC;QACH,MAAM,YAAY,GAAG,iBAAiB,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;QAE1D,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAA,eAAQ,EAAC;gBACb,OAAO,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,+FAA+F;aAC5H,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QAEzB,IAAI,CAAC,MAAM,GAAG,IAAI,yBAAW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,EAAE,WAAW,EAAE,CAAC,EAAE,SAAS,CAAC;YACnF,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;YAC3B,QAAQ;SACT,CAAQ,CACV,CAAC;IACJ,CAAC;CAeF;AAxMD,wDAwMC","sourcesContent":["import { AuthenticationModes } from '@/base/auth/authenticate/common/constants';\nimport { authenticate as authenticateFn } from '@/base/auth/authenticate/middlewares/authenticate.middleware';\nimport type { IAuthorizationSpec } from '@/base/auth/authorize/common/types';\nimport { authorize as authorizeFn } from '@/base/auth/authorize/middlewares/authorize.middleware';\nimport { formBodyReader, hasFormBody } from '@/base/middlewares/form-body/form-body.middleware';\nimport { AuthenticationStrategyRegistry } from '@/base/auth/authenticate/strategies/strategy-registry';\nimport { DroppedRouteDecorators } from '@/base/metadata/routes/common';\nimport { MetadataRegistry } from '@/helpers/inversion/registry';\nimport { htmlResponse } from '@/base/controllers/common/html-response';\nimport type { Hook } from '@hono/zod-openapi';\nimport { createRoute, OpenAPIHono } from '@hono/zod-openapi';\nimport type { ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport { BaseHelper, getError } from '@venizia/ignis-helpers/core';\nimport type { Env, Schema } from 'hono';\nimport type {\n IAuthRouteConfig,\n IBindRouteOptions,\n IController,\n IControllerOptions,\n IDefineRouteOptions,\n TRouteHandler,\n} from '../common/types';\n\n/** True for a route path carrying a path parameter, in either supported syntax: `/{id}` or `/:id`. */\nconst hasPathParam = (opts: { path: string }): boolean => {\n return /\\{[^}]+\\}|:[^/]+/.test(opts.path);\n};\n\n/** Abstract base class for all REST controllers, providing route registration and auth middleware integration. */\nexport abstract class AbstractRestController<\n RouteEnv extends Env = Env,\n RouteSchema extends Schema = {},\n BasePath extends string = '/',\n ConfigurableOptions extends object = {},\n Definitions extends Record<string, IAuthRouteConfig> = Record<string, IAuthRouteConfig>,\n>\n extends BaseHelper\n implements IController<RouteEnv, RouteSchema, BasePath, ConfigurableOptions>\n{\n isConfigured = false;\n router: OpenAPIHono<RouteEnv, RouteSchema, BasePath>;\n path: string;\n definitions: Definitions;\n\n constructor(opts: IControllerOptions) {\n super(opts);\n const { isStrict = true } = opts;\n\n const decoratorMetadata = MetadataRegistry.getInstance().getControllerMetadata({\n target: new.target,\n });\n const resolvedPath = decoratorMetadata?.path ?? opts.path;\n\n if (!resolvedPath) {\n throw getError({\n message: `[${new.target.name}] Controller path is required. Provide path via @controller decorator or constructor options.`,\n });\n }\n\n this.path = resolvedPath;\n\n this.router = new OpenAPIHono<RouteEnv, RouteSchema, BasePath>({\n strict: isStrict,\n defaultHook: (result, _context) => {\n if (!result.success) {\n throw result.error;\n }\n },\n });\n }\n\n /** Returns the OpenAPIHono router instance for this controller. */\n getRouter() {\n return this.router;\n }\n\n /** Registers decorator-defined routes from the metadata registry; `paths` selects them by shape - see the two-phase call in {@link configure}. */\n registerRoutesFromRegistry(opts?: { paths?: 'static' | 'param' | 'all' }): void {\n const { paths = 'all' } = opts ?? {};\n\n const logger = this.logger.for(this.registerRoutesFromRegistry.name);\n DroppedRouteDecorators.report({ logger });\n\n const routes = MetadataRegistry.getInstance().getRoutes({\n target: Object.getPrototypeOf(this),\n });\n\n if (!routes?.size) {\n return;\n }\n\n const routeDefs = routes.entries();\n for (const [methodName, routeConfigs] of routeDefs) {\n if (paths !== 'all' && hasPathParam({ path: routeConfigs.path }) !== (paths === 'param')) {\n continue;\n }\n\n // Dynamic dispatch by decorator-recorded method name - the controller class has no static index signature, so this read cannot be typed narrower than `unknown`.\n const handler = (this as Record<string | symbol, unknown>)[methodName];\n if (typeof handler !== 'function') {\n logger.warn('Route method \"%s\" not found on controller', String(methodName));\n continue;\n }\n\n this.bindRoute({ configs: routeConfigs }).to({\n handler: (handler as TRouteHandler<unknown, RouteEnv>).bind(this),\n });\n }\n }\n\n /** Configures the controller by binding all routes and registering decorator-based routes. Idempotent. */\n async configure(\n opts?: ConfigurableOptions,\n ): Promise<OpenAPIHono<RouteEnv, RouteSchema, BasePath>> {\n if (this.isConfigured) {\n return this.router;\n }\n\n const t = performance.now();\n const logger = this.logger.for(this.configure.name);\n\n const configureOptions = opts ?? {};\n logger.info('START | Binding controller | Options: %j', configureOptions);\n\n // Hono matches in registration order, so registration runs by SHAPE not source: every static path first, then binding()'s routes, then decorator param routes last (`/{id}` early would eat `/count`).\n this.registerRoutesFromRegistry({ paths: 'static' });\n await this.binding();\n this.registerRoutesFromRegistry({ paths: 'param' });\n\n this.isConfigured = true;\n logger.info('DONE | Binding controller | Took: %s (ms)', performance.now() - t);\n return this.router;\n }\n\n /** @internal Builds auth + custom middlewares and security specs from route config. */\n buildRouteMiddlewares<RouteConfig extends IAuthRouteConfig>(opts: { configs: RouteConfig }) {\n const { authenticate = {}, authorize, ...restConfig } = opts.configs;\n const { strategies = [], mode = AuthenticationModes.ANY } = authenticate;\n\n // Boot-time and NON-fatal: names a misspelled strategy at error level instead of leaving it as\n // a 401 nobody can explain. Deliberately not a throw - `defineAuthController` hard-codes `jwt`\n // on four routes, and ANY mode tolerates a strategy that does not resolve, so failing here would\n // stop applications booting that work today. `assertRegistered` is there for an application that\n // does want the hard failure.\n AuthenticationStrategyRegistry.getInstance().reportUnregistered({\n names: strategies,\n scope: this.constructor.name,\n });\n\n const security = strategies.map((strategy: string) => ({ [strategy]: [] }));\n const mws: ReturnType<typeof authenticateFn>[] = [];\n\n if (strategies.length > 0) {\n mws.push(authenticateFn({ strategies, mode }));\n }\n\n // Inject authorize middleware AFTER authenticate\n if (authorize) {\n const specs: IAuthorizationSpec[] = Array.isArray(authorize) ? authorize : [authorize];\n for (const spec of specs) {\n mws.push(authorizeFn({ spec }));\n }\n }\n\n const configuredMiddleware = restConfig.middleware;\n const extraMws = Array.isArray(configuredMiddleware)\n ? configuredMiddleware\n : [configuredMiddleware];\n\n for (const mw of extraMws) {\n if (!mw) {\n continue;\n }\n\n mws.push(mw);\n }\n\n // Last: an application middleware and any size check run before the body is read.\n if (hasFormBody({ content: restConfig.request?.body?.content })) {\n mws.push(formBodyReader);\n }\n\n return { restConfig, security, mws };\n }\n\n /** Processes route config, injecting auth middleware and OpenAPI security specs. */\n getRouteConfigs<RouteConfig extends IAuthRouteConfig>(opts: { configs: RouteConfig }) {\n const { restConfig, security, mws } = this.buildRouteMiddlewares(opts);\n const { tags = [] } = restConfig;\n\n // `restConfig` already omitted `authenticate`/`authorize` (this library's fields, not Hono's `createRoute` ones); reassembled with the injected middleware/tags/security it no longer structurally overlaps RouteConfig enough to assert directly.\n return createRoute<string, RouteConfig>(\n Object.assign({}, restConfig, {\n middleware: mws,\n tags: [...tags, this.scope],\n security,\n }) as any,\n );\n }\n\n /** Like getRouteConfigs but adds HTML response schema for JSX rendering. */\n getJSXRouteConfigs<RouteConfig extends IAuthRouteConfig>(opts: { configs: RouteConfig }) {\n const { restConfig, security, mws } = this.buildRouteMiddlewares(opts);\n const { responses, tags = [] } = restConfig;\n\n // Same reassembled-vs-RouteConfig boundary as getRouteConfigs above.\n return createRoute<string, RouteConfig>(\n Object.assign({}, restConfig, {\n middleware: mws,\n responses: Object.assign({}, htmlResponse({ description: 'HTML page' }), responses),\n tags: [...tags, this.scope],\n security,\n }) as any,\n );\n }\n /** Override to register routes using bindRoute or defineRoute. */\n abstract binding(): ValueOrPromise<void>;\n\n /** Creates a fluent binding for registering a route (call .to() to attach handler). */\n abstract bindRoute<RouteConfig extends IAuthRouteConfig>(opts: {\n configs: RouteConfig;\n }): IBindRouteOptions<RouteConfig, RouteEnv, RouteSchema, BasePath>;\n\n /** Defines and registers a route with its handler in a single call. */\n abstract defineRoute<RouteConfig extends IAuthRouteConfig, ResponseType = unknown>(opts: {\n configs: RouteConfig;\n handler: TRouteHandler<ResponseType, RouteEnv>;\n hook?: Hook<any, RouteEnv, string, ValueOrPromise<any>>;\n }): IDefineRouteOptions<RouteConfig, RouteEnv, RouteSchema, BasePath>;\n}\n"]}
1
+ {"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../../../src/base/controllers/rest/abstract.ts"],"names":[],"mappings":";;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ationModes } from '@/base/auth/authenticate/common/constants';\nimport { authenticate as authenticateFn } from '@/base/auth/authenticate/middlewares/authenticate.middleware';\nimport type { IAuthorizationSpec } from '@/base/auth/authorize/common/types';\nimport { authorize as authorizeFn } from '@/base/auth/authorize/middlewares/authorize.middleware';\nimport { formBodyReader, hasFormBody } from '@/base/middlewares/form-body/form-body.middleware';\nimport { AuthenticationStrategyRegistry } from '@/base/auth/authenticate/strategies/strategy-registry';\nimport { DroppedRouteDecorators } from '@/base/metadata/routes/common';\nimport { MetadataRegistry } from '@/helpers/inversion/registry';\nimport { RoutePathScopes, type TRoutePathScope } from '@/base/controllers/common/constants';\nimport { htmlResponse } from '@/base/controllers/common/html-response';\nimport type { Hook } from '@hono/zod-openapi';\nimport { createRoute, OpenAPIHono } from '@hono/zod-openapi';\nimport type { ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport { BaseHelper, getError } from '@venizia/ignis-helpers/core';\nimport type { Env, Schema } from 'hono';\nimport type {\n IAuthRouteConfig,\n IBindRouteOptions,\n IController,\n IControllerOptions,\n IDefineRouteOptions,\n TRouteHandler,\n} from '../common/types';\n\n/** True for a route path carrying a path parameter, in either supported syntax: `/{id}` or `/:id`. */\nconst hasPathParam = (opts: { path: string }): boolean => {\n return /\\{[^}]+\\}|:[^/]+/.test(opts.path);\n};\n\n/** Abstract base class for all REST controllers, providing route registration and auth middleware integration. */\nexport abstract class AbstractRestController<\n RouteEnv extends Env = Env,\n RouteSchema extends Schema = {},\n BasePath extends string = '/',\n ConfigurableOptions extends object = {},\n Definitions extends Record<string, IAuthRouteConfig> = Record<string, IAuthRouteConfig>,\n>\n extends BaseHelper\n implements IController<RouteEnv, RouteSchema, BasePath, ConfigurableOptions>\n{\n isConfigured = false;\n router: OpenAPIHono<RouteEnv, RouteSchema, BasePath>;\n path: string;\n definitions: Definitions;\n\n constructor(opts: IControllerOptions) {\n super(opts);\n const { isStrict = true } = opts;\n\n const decoratorMetadata = MetadataRegistry.getInstance().getControllerMetadata({\n target: new.target,\n });\n const resolvedPath = decoratorMetadata?.path ?? opts.path;\n\n if (!resolvedPath) {\n throw getError({\n message: `[${new.target.name}] Controller path is required. Provide path via @controller decorator or constructor options.`,\n });\n }\n\n this.path = resolvedPath;\n\n this.router = new OpenAPIHono<RouteEnv, RouteSchema, BasePath>({\n strict: isStrict,\n defaultHook: (result, _context) => {\n if (!result.success) {\n throw result.error;\n }\n },\n });\n }\n\n /** Returns the OpenAPIHono router instance for this controller. */\n getRouter() {\n return this.router;\n }\n\n /** Registers decorator-defined routes from the metadata registry; `paths` selects them by shape - see the two-phase call in {@link configure}. */\n registerRoutesFromRegistry(opts?: { paths?: TRoutePathScope }): void {\n const { paths = RoutePathScopes.ALL } = opts ?? {};\n\n const logger = this.logger.for(this.registerRoutesFromRegistry.name);\n DroppedRouteDecorators.report({ logger });\n\n const routes = MetadataRegistry.getInstance().getRoutes({\n target: Object.getPrototypeOf(this),\n });\n\n if (!routes?.size) {\n return;\n }\n\n const routeDefs = routes.entries();\n for (const [methodName, routeConfigs] of routeDefs) {\n if (\n paths !== RoutePathScopes.ALL &&\n hasPathParam({ path: routeConfigs.path }) !== (paths === RoutePathScopes.PARAM)\n ) {\n continue;\n }\n\n // Dynamic dispatch by decorator-recorded method name - the controller class has no static index signature, so this read cannot be typed narrower than `unknown`.\n const handler = (this as Record<string | symbol, unknown>)[methodName];\n if (typeof handler !== 'function') {\n logger.warn('Route method \"%s\" not found on controller', String(methodName));\n continue;\n }\n\n this.bindRoute({ configs: routeConfigs }).to({\n handler: (handler as TRouteHandler<unknown, RouteEnv>).bind(this),\n });\n }\n }\n\n /** Configures the controller by binding all routes and registering decorator-based routes. Idempotent. */\n async configure(\n opts?: ConfigurableOptions,\n ): Promise<OpenAPIHono<RouteEnv, RouteSchema, BasePath>> {\n if (this.isConfigured) {\n return this.router;\n }\n\n const t = performance.now();\n const logger = this.logger.for(this.configure.name);\n\n const configureOptions = opts ?? {};\n logger.info('START | Binding controller | Options: %j', configureOptions);\n\n // Hono matches in registration order, so registration runs by SHAPE not source: every static path first, then binding()'s routes, then decorator param routes last (`/{id}` early would eat `/count`).\n this.registerRoutesFromRegistry({ paths: RoutePathScopes.STATIC });\n await this.binding();\n this.registerRoutesFromRegistry({ paths: RoutePathScopes.PARAM });\n\n this.isConfigured = true;\n logger.info('DONE | Binding controller | Took: %s (ms)', performance.now() - t);\n return this.router;\n }\n\n /** @internal Builds auth + custom middlewares and security specs from route config. */\n buildRouteMiddlewares<RouteConfig extends IAuthRouteConfig>(opts: { configs: RouteConfig }) {\n const { authenticate = {}, authorize, ...restConfig } = opts.configs;\n const { strategies = [], mode = AuthenticationModes.ANY } = authenticate;\n\n // Boot-time and NON-fatal: names a misspelled strategy at error level instead of leaving it as\n // a 401 nobody can explain. Deliberately not a throw - `defineAuthController` hard-codes `jwt`\n // on four routes, and ANY mode tolerates a strategy that does not resolve, so failing here would\n // stop applications booting that work today. `assertRegistered` is there for an application that\n // does want the hard failure.\n AuthenticationStrategyRegistry.getInstance().reportUnregistered({\n names: strategies,\n scope: this.constructor.name,\n });\n\n const security = strategies.map((strategy: string) => ({ [strategy]: [] }));\n const mws: ReturnType<typeof authenticateFn>[] = [];\n\n if (strategies.length > 0) {\n mws.push(authenticateFn({ strategies, mode }));\n }\n\n // Inject authorize middleware AFTER authenticate\n if (authorize) {\n const specs: IAuthorizationSpec[] = Array.isArray(authorize) ? authorize : [authorize];\n for (const spec of specs) {\n mws.push(authorizeFn({ spec }));\n }\n }\n\n const configuredMiddleware = restConfig.middleware;\n const extraMws = Array.isArray(configuredMiddleware)\n ? configuredMiddleware\n : [configuredMiddleware];\n\n for (const mw of extraMws) {\n if (!mw) {\n continue;\n }\n\n mws.push(mw);\n }\n\n // Last: an application middleware and any size check run before the body is read.\n if (hasFormBody({ content: restConfig.request?.body?.content })) {\n mws.push(formBodyReader);\n }\n\n return { restConfig, security, mws };\n }\n\n /** Processes route config, injecting auth middleware and OpenAPI security specs. */\n getRouteConfigs<RouteConfig extends IAuthRouteConfig>(opts: { configs: RouteConfig }) {\n const { restConfig, security, mws } = this.buildRouteMiddlewares(opts);\n const { tags = [] } = restConfig;\n\n // `restConfig` already omitted `authenticate`/`authorize` (this library's fields, not Hono's `createRoute` ones); reassembled with the injected middleware/tags/security it no longer structurally overlaps RouteConfig enough to assert directly.\n return createRoute<string, RouteConfig>(\n Object.assign({}, restConfig, {\n middleware: mws,\n tags: [...tags, this.scope],\n security,\n }) as any,\n );\n }\n\n /** Like getRouteConfigs but adds HTML response schema for JSX rendering. */\n getJSXRouteConfigs<RouteConfig extends IAuthRouteConfig>(opts: { configs: RouteConfig }) {\n const { restConfig, security, mws } = this.buildRouteMiddlewares(opts);\n const { responses, tags = [] } = restConfig;\n\n // Same reassembled-vs-RouteConfig boundary as getRouteConfigs above.\n return createRoute<string, RouteConfig>(\n Object.assign({}, restConfig, {\n middleware: mws,\n responses: Object.assign({}, htmlResponse({ description: 'HTML page' }), responses),\n tags: [...tags, this.scope],\n security,\n }) as any,\n );\n }\n /** Override to register routes using bindRoute or defineRoute. */\n abstract binding(): ValueOrPromise<void>;\n\n /** Creates a fluent binding for registering a route (call .to() to attach handler). */\n abstract bindRoute<RouteConfig extends IAuthRouteConfig>(opts: {\n configs: RouteConfig;\n }): IBindRouteOptions<RouteConfig, RouteEnv, RouteSchema, BasePath>;\n\n /** Defines and registers a route with its handler in a single call. */\n abstract defineRoute<RouteConfig extends IAuthRouteConfig, ResponseType = unknown>(opts: {\n configs: RouteConfig;\n handler: TRouteHandler<ResponseType, RouteEnv>;\n hook?: Hook<any, RouteEnv, string, ValueOrPromise<any>>;\n }): IDefineRouteOptions<RouteConfig, RouteEnv, RouteSchema, BasePath>;\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import type { IModelMetadata } from '../../helpers/inversion';
2
+ /** The release that drops the deprecated `skipMigrate` key. */
3
+ export declare const DEPRECATED_MODEL_METADATA_REMOVED_IN = "0.4.4";
4
+ /**
5
+ * The one place the `@model` metadata outside `settings` is checked and normalised.
6
+ *
7
+ * - `type` is optional; a value must be one of {@link ModelTypes}.
8
+ * - `skipMigrate` (deprecated) becomes `migration: { use: !skipMigrate }`, and is reported so the
9
+ * application warns once at boot. Setting both `skipMigrate` and `migration` throws.
10
+ * - When the model declares either, the registry entry carries BOTH `migration` and a derived
11
+ * `skipMigrate`, so consumer tooling that reads `metadata.skipMigrate` keeps working this release.
12
+ */
13
+ export declare const normalizeModelMetadata: (opts: {
14
+ model: string;
15
+ metadata: IModelMetadata;
16
+ }) => IModelMetadata;
17
+ //# sourceMappingURL=model-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-metadata.d.ts","sourceRoot":"","sources":["../../../../src/base/metadata/model-metadata.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA4B,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGpF,+DAA+D;AAC/D,eAAO,MAAM,oCAAoC,UAAU,CAAC;AAE5D;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,cAAc,CAAC;CAC1B,KAAG,cAoCH,CAAC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeModelMetadata = exports.DEPRECATED_MODEL_METADATA_REMOVED_IN = void 0;
4
+ const core_1 = require("@venizia/ignis-helpers/core");
5
+ const constants_1 = require("../models/common/constants");
6
+ /** The release that drops the deprecated `skipMigrate` key. */
7
+ exports.DEPRECATED_MODEL_METADATA_REMOVED_IN = '0.4.4';
8
+ /**
9
+ * The one place the `@model` metadata outside `settings` is checked and normalised.
10
+ *
11
+ * - `type` is optional; a value must be one of {@link ModelTypes}.
12
+ * - `skipMigrate` (deprecated) becomes `migration: { use: !skipMigrate }`, and is reported so the
13
+ * application warns once at boot. Setting both `skipMigrate` and `migration` throws.
14
+ * - When the model declares either, the registry entry carries BOTH `migration` and a derived
15
+ * `skipMigrate`, so consumer tooling that reads `metadata.skipMigrate` keeps working this release.
16
+ */
17
+ const normalizeModelMetadata = (opts) => {
18
+ const { model, metadata } = opts;
19
+ const { type, skipMigrate, migration } = metadata;
20
+ if (type !== undefined && !constants_1.ModelTypes.isValid(type)) {
21
+ throw (0, core_1.getError)({
22
+ message: `[model][${model}] Invalid 'type' | Expected one of: ${[...constants_1.ModelTypes.SCHEME_SET].join(', ')} (or leave it out) | Got: ${String(type)}`,
23
+ });
24
+ }
25
+ if (skipMigrate !== undefined && migration !== undefined) {
26
+ throw (0, core_1.getError)({
27
+ message: `[model][${model}] skipMigrate and migration are both set | skipMigrate is the deprecated name of migration.use (inverted) | keep migration and remove skipMigrate`,
28
+ });
29
+ }
30
+ if (skipMigrate === undefined && migration === undefined) {
31
+ return metadata;
32
+ }
33
+ const deprecatedMetadata = [];
34
+ let use;
35
+ if (skipMigrate !== undefined) {
36
+ use = !skipMigrate;
37
+ deprecatedMetadata.push({ key: 'skipMigrate', use: 'migration: { use: false }' });
38
+ }
39
+ else {
40
+ use = migration?.use !== false;
41
+ }
42
+ return {
43
+ ...metadata,
44
+ migration: { ...migration, use },
45
+ skipMigrate: !use,
46
+ ...(deprecatedMetadata.length > 0 ? { deprecatedMetadata } : {}),
47
+ };
48
+ };
49
+ exports.normalizeModelMetadata = normalizeModelMetadata;
50
+ //# sourceMappingURL=model-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-metadata.js","sourceRoot":"","sources":["../../../../src/base/metadata/model-metadata.ts"],"names":[],"mappings":";;;AAAA,sDAAuD;AAEvD,0DAAwD;AAExD,+DAA+D;AAClD,QAAA,oCAAoC,GAAG,OAAO,CAAC;AAE5D;;;;;;;;GAQG;AACI,MAAM,sBAAsB,GAAG,CAAC,IAGtC,EAAkB,EAAE;IACnB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAA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izia/ignis-helpers/core';\nimport type { IDeprecatedModelMetadata, IModelMetadata } from '@/helpers/inversion';\nimport { ModelTypes } from '../models/common/constants';\n\n/** The release that drops the deprecated `skipMigrate` key. */\nexport const DEPRECATED_MODEL_METADATA_REMOVED_IN = '0.4.4';\n\n/**\n * The one place the `@model` metadata outside `settings` is checked and normalised.\n *\n * - `type` is optional; a value must be one of {@link ModelTypes}.\n * - `skipMigrate` (deprecated) becomes `migration: { use: !skipMigrate }`, and is reported so the\n * application warns once at boot. Setting both `skipMigrate` and `migration` throws.\n * - When the model declares either, the registry entry carries BOTH `migration` and a derived\n * `skipMigrate`, so consumer tooling that reads `metadata.skipMigrate` keeps working this release.\n */\nexport const normalizeModelMetadata = (opts: {\n model: string;\n metadata: IModelMetadata;\n}): IModelMetadata => {\n const { model, metadata } = opts;\n const { type, skipMigrate, migration } = metadata;\n\n if (type !== undefined && !ModelTypes.isValid(type)) {\n throw getError({\n message: `[model][${model}] Invalid 'type' | Expected one of: ${[...ModelTypes.SCHEME_SET].join(', ')} (or leave it out) | Got: ${String(type)}`,\n });\n }\n\n if (skipMigrate !== undefined && migration !== undefined) {\n throw getError({\n message: `[model][${model}] skipMigrate and migration are both set | skipMigrate is the deprecated name of migration.use (inverted) | keep migration and remove skipMigrate`,\n });\n }\n\n if (skipMigrate === undefined && migration === undefined) {\n return metadata;\n }\n\n const deprecatedMetadata: IDeprecatedModelMetadata[] = [];\n let use: boolean;\n\n if (skipMigrate !== undefined) {\n use = !skipMigrate;\n deprecatedMetadata.push({ key: 'skipMigrate', use: 'migration: { use: false }' });\n } else {\n use = migration?.use !== false;\n }\n\n return {\n ...metadata,\n migration: { ...migration, use },\n skipMigrate: !use,\n ...(deprecatedMetadata.length > 0 ? { deprecatedMetadata } : {}),\n };\n};\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Refuses a removed `@model` settings key. A model that still says `scopeFilter` would otherwise
3
+ * lose its row scope without a sound (a plain-JavaScript or `any`-typed model gets no type error),
4
+ * so the decorator throws instead, naming the key to use. `devz codemod model-settings --write` rewrites
5
+ * the keys.
6
+ */
7
+ export declare const assertNoRemovedModelSettings: (opts: {
8
+ model: string;
9
+ settings: object | undefined;
10
+ }) => void;
11
+ //# sourceMappingURL=model-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-settings.d.ts","sourceRoot":"","sources":["../../../../src/base/metadata/model-settings.ts"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GAAI,MAAM;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,KAAG,IAiBH,CAAC"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertNoRemovedModelSettings = void 0;
4
+ const core_1 = require("@venizia/ignis-helpers/core");
5
+ /** The keys 0.4.2 deprecated and 0.4.3 removed, and the key that replaces each. */
6
+ const REMOVED_MODEL_SETTINGS = {
7
+ defaultFilter: 'query.filter',
8
+ defaultLimit: 'query.limit.default',
9
+ maxLimit: 'query.limit.max',
10
+ scopeFilter: 'access',
11
+ };
12
+ /**
13
+ * Refuses a removed `@model` settings key. A model that still says `scopeFilter` would otherwise
14
+ * lose its row scope without a sound (a plain-JavaScript or `any`-typed model gets no type error),
15
+ * so the decorator throws instead, naming the key to use. `devz codemod model-settings --write` rewrites
16
+ * the keys.
17
+ */
18
+ const assertNoRemovedModelSettings = (opts) => {
19
+ const { model, settings } = opts;
20
+ if (!settings) {
21
+ return;
22
+ }
23
+ const removed = Object.keys(REMOVED_MODEL_SETTINGS).filter((key) => Object.hasOwn(settings, key));
24
+ if (removed.length === 0) {
25
+ return;
26
+ }
27
+ throw (0, core_1.getError)({
28
+ message: `[model][${model}] Removed settings key(s): ${removed
29
+ .map((key) => `settings.${key} (use settings.${REMOVED_MODEL_SETTINGS[key]})`)
30
+ .join(', ')} | removed in 0.4.3 | run 'devz codemod model-settings --write' to rewrite them`,
31
+ });
32
+ };
33
+ exports.assertNoRemovedModelSettings = assertNoRemovedModelSettings;
34
+ //# sourceMappingURL=model-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-settings.js","sourceRoot":"","sources":["../../../../src/base/metadata/model-settings.ts"],"names":[],"mappings":";;;AAAA,sDAAuD;AAEvD,mFAAmF;AACnF,MAAM,sBAAsB,GAA2B;IACrD,aAAa,EAAE,cAAc;IAC7B,YAAY,EAAE,qBAAqB;IACnC,QAAQ,EAAE,iBAAiB;IAC3B,WAAW,EAAE,QAAQ;CACtB,CAAC;AAEF;;;;;GAKG;AACI,MAAM,4BAA4B,GAAG,CAAC,IAG5C,EAAQ,EAAE;IACT,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAEjC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IAClG,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO;IACT,CAAC;IAED,MAAM,IAAA,eAAQ,EAAC;QACb,OAAO,EAAE,WAAW,KAAK,8BAA8B,OAAO;aAC3D,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,GAAG,kBAAkB,sBAAsB,CAAC,GAAG,CAAC,GAAG,CAAC;aAC7E,IAAI,CAAC,IAAI,CAAC,iFAAiF;KAC/F,CAAC,CAAC;AACL,CAAC,CAAC;AApBW,QAAA,4BAA4B,gCAoBvC","sourcesContent":["import { getError } from '@venizia/ignis-helpers/core';\n\n/** The keys 0.4.2 deprecated and 0.4.3 removed, and the key that replaces each. */\nconst REMOVED_MODEL_SETTINGS: Record<string, string> = {\n defaultFilter: 'query.filter',\n defaultLimit: 'query.limit.default',\n maxLimit: 'query.limit.max',\n scopeFilter: 'access',\n};\n\n/**\n * Refuses a removed `@model` settings key. A model that still says `scopeFilter` would otherwise\n * lose its row scope without a sound (a plain-JavaScript or `any`-typed model gets no type error),\n * so the decorator throws instead, naming the key to use. `devz codemod model-settings --write` rewrites\n * the keys.\n */\nexport const assertNoRemovedModelSettings = (opts: {\n model: string;\n settings: object | undefined;\n}): void => {\n const { model, settings } = opts;\n\n if (!settings) {\n return;\n }\n\n const removed = Object.keys(REMOVED_MODEL_SETTINGS).filter((key) => Object.hasOwn(settings, key));\n if (removed.length === 0) {\n return;\n }\n\n throw getError({\n message: `[model][${model}] Removed settings key(s): ${removed\n .map((key) => `settings.${key} (use settings.${REMOVED_MODEL_SETTINGS[key]})`)\n .join(', ')} | removed in 0.4.3 | run 'devz codemod model-settings --write' to rewrite them`,\n });\n};\n"]}
@@ -2,7 +2,7 @@ import type { IDataSourceMetadata, IModelMetadata, TRepositoryMetadata } from '.
2
2
  import type { IDataSource } from '../datasources';
3
3
  import type { AbstractEntity } from '../models';
4
4
  /** Registers a model class with its static schema and relations. */
5
- export declare const model: (metadata: IModelMetadata) => ClassDecorator;
5
+ export declare const model: (input?: IModelMetadata) => ClassDecorator;
6
6
  /** Registers a datasource with driver and auto-discovery settings. */
7
7
  export declare const datasource: (metadata?: IDataSourceMetadata) => ClassDecorator;
8
8
  export declare const repository: <Model extends AbstractEntity = AbstractEntity, DataSource extends IDataSource = IDataSource>(metadata?: TRepositoryMetadata<Model, DataSource>) => ClassDecorator;
@@ -1 +1 @@
1
- {"version":3,"file":"persistents.d.ts","sourceRoot":"","sources":["../../../../src/base/metadata/persistents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,mBAAmB,EAEnB,cAAc,EAEd,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAU7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIhD,oEAAoE;AACpE,eAAO,MAAM,KAAK,GAAI,UAAU,cAAc,KAAG,cA4BhD,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,UAAU,GAAI,WAAW,mBAAmB,KAAG,cAQ3D,CAAC;AA0PF,eAAO,MAAM,UAAU,GACrB,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,UAAU,SAAS,WAAW,GAAG,WAAW,EAE5C,WAAW,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,KAChD,cAeF,CAAC"}
1
+ {"version":3,"file":"persistents.d.ts","sourceRoot":"","sources":["../../../../src/base/metadata/persistents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,mBAAmB,EAEnB,cAAc,EAEd,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAU7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAMhD,oEAAoE;AACpE,eAAO,MAAM,KAAK,GAAI,QAAO,cAAmB,KAAG,cAmClD,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,UAAU,GAAI,WAAW,mBAAmB,KAAG,cAQ3D,CAAC;AA0PF,eAAO,MAAM,UAAU,GACrB,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,UAAU,SAAS,WAAW,GAAG,WAAW,EAE5C,WAAW,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,KAChD,cAeF,CAAC"}
@@ -8,26 +8,31 @@ const core_1 = require("@venizia/ignis-helpers/core");
8
8
  const datasources_1 = require("../datasources");
9
9
  const constants_1 = require("../repositories/common/constants");
10
10
  const injectable_1 = require("./injectable");
11
+ const model_metadata_1 = require("./model-metadata");
12
+ const model_settings_1 = require("./model-settings");
11
13
  /** Registers a model class with its static schema and relations. */
12
- const model = (metadata) => {
14
+ const model = (input = {}) => {
13
15
  return (target) => {
14
- (0, injectable_1.injectable)({ type: inversion_1.ArtifactTypes.MODEL, ...(0, injectable_1.pickRegistrationOptions)({ metadata }) })(target);
15
- const defaultLimit = metadata.settings?.defaultLimit;
16
+ (0, injectable_1.injectable)({ type: inversion_1.ArtifactTypes.MODEL, ...(0, injectable_1.pickRegistrationOptions)({ metadata: input }) })(target);
17
+ const metadata = (0, model_metadata_1.normalizeModelMetadata)({ model: target.name, metadata: input });
18
+ (0, model_settings_1.assertNoRemovedModelSettings)({ model: target.name, settings: metadata.settings });
19
+ const { settings } = metadata;
20
+ const defaultLimit = settings?.query?.limit?.default;
16
21
  if (defaultLimit !== undefined && (!Number.isInteger(defaultLimit) || defaultLimit <= 0)) {
17
22
  throw (0, core_1.getError)({
18
- message: `[model][${target.name}] Invalid 'defaultLimit' | Expected a positive integer | Got: ${defaultLimit}`,
23
+ message: `[model][${target.name}] Invalid 'query.limit.default' | Expected a positive integer | Got: ${defaultLimit}`,
19
24
  });
20
25
  }
21
- // Validated at DECORATION time, like defaultLimit: a bad ceiling is a wiring mistake, and
26
+ // Validated at DECORATION time, like the default limit: a bad ceiling is a wiring mistake, and
22
27
  // catching it at boot beats catching it on the one request that happens to reach the limit.
23
- const maxLimit = metadata.settings?.maxLimit;
28
+ const maxLimit = settings?.query?.limit?.max;
24
29
  if (maxLimit !== undefined && (!Number.isInteger(maxLimit) || maxLimit <= 0)) {
25
30
  throw (0, core_1.getError)({
26
- message: `[model][${target.name}] Invalid 'maxLimit' | Expected a positive integer | Got: ${maxLimit}`,
31
+ message: `[model][${target.name}] Invalid 'query.limit.max' | Expected a positive integer | Got: ${maxLimit}`,
27
32
  });
28
33
  }
29
34
  // Auto-populate AUTHORIZATION_SUBJECT from authorize.principal if not already set
30
- const principal = metadata.settings?.authorize?.principal;
35
+ const principal = settings?.authorize?.principal;
31
36
  if (principal && !Object.hasOwn(target, 'AUTHORIZATION_SUBJECT')) {
32
37
  target.AUTHORIZATION_SUBJECT = principal;
33
38
  }
@@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;IAEX,MAAM,QAAQ,GAAG,yBAAyB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE3E,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,GAAG,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC7F,CAAC,CAAC;AAEK,MAAM,UAAU,GAAG,CAIxB,QAAiD,EACjC,EAAE;IAClB,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,MAAM,QAAQ,GAAG,4BAAgB,CAAC,WAAW,EAAE,CAAC;QAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,uBAAuB,CAAC;gBACtB,QAAQ,EAAE,yBAAyB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;gBACzD,YAAY,EAAE,EAAE;gBAChB,MAAM;gBACN,QAAQ;aACT,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,uBAAuB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClF,CAAC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,UAAU,cAoBrB","sourcesContent":["import { BindingNamespaces } from '@/common/bindings';\nimport type {\n IArtifactRegistrationOptions,\n IDataSourceMetadata,\n IInjectMetadata,\n IModelMetadata,\n IResolvedRepositoryMetadata,\n TRepositoryMetadata,\n} from '@/helpers/inversion';\nimport {\n ArtifactTypes,\n BindingKeys,\n MetadataKeys,\n MetadataRegistry,\n resolveInjectTarget,\n} from '@/helpers/inversion';\nimport { resolveClass, resolveValue } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { IDataSource } from '../datasources';\nimport { isDataSourceClass } from '../datasources';\nimport type { AbstractEntity } from '../models';\nimport { RepositoryTypes } from '../repositories/common/constants';\nimport { injectable, pickRegistrationOptions } from './injectable';\n\n/** Registers a model class with its static schema and relations. */\nexport const model = (metadata: IModelMetadata): ClassDecorator => {\n return (target) => {\n injectable({ type: ArtifactTypes.MODEL, ...pickRegistrationOptions({ metadata }) })(target);\n\n const defaultLimit = metadata.settings?.defaultLimit;\n if (defaultLimit !== undefined && (!Number.isInteger(defaultLimit) || defaultLimit <= 0)) {\n throw getError({\n message: `[model][${target.name}] Invalid 'defaultLimit' | Expected a positive integer | Got: ${defaultLimit}`,\n });\n }\n\n // Validated at DECORATION time, like defaultLimit: a bad ceiling is a wiring mistake, and\n // catching it at boot beats catching it on the one request that happens to reach the limit.\n const maxLimit = metadata.settings?.maxLimit;\n if (maxLimit !== undefined && (!Number.isInteger(maxLimit) || maxLimit <= 0)) {\n throw getError({\n message: `[model][${target.name}] Invalid 'maxLimit' | Expected a positive integer | Got: ${maxLimit}`,\n });\n }\n\n // Auto-populate AUTHORIZATION_SUBJECT from authorize.principal if not already set\n const principal = metadata.settings?.authorize?.principal;\n if (principal && !Object.hasOwn(target, 'AUTHORIZATION_SUBJECT')) {\n (target as Record<string, unknown>).AUTHORIZATION_SUBJECT = principal;\n }\n\n MetadataRegistry.getInstance().registerModel({ target, metadata });\n };\n};\n\n/** Registers a datasource with driver and auto-discovery settings. */\nexport const datasource = (metadata?: IDataSourceMetadata): ClassDecorator => {\n return (target) => {\n injectable({\n type: ArtifactTypes.DATASOURCE,\n ...pickRegistrationOptions({ metadata: metadata ?? {} }),\n })(target);\n MetadataRegistry.getInstance().setDataSourceMetadata({ target, metadata });\n };\n};\n\n/** Mirrors the `TRepositoryMetadata` union for JavaScript callers: a known type, a dataSource always, a model exactly when the type is RepositoryTypes.MODEL. */\nconst validateRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n target: Function;\n}): void => {\n const { metadata, target } = opts;\n const type = metadata.type ?? RepositoryTypes.MODEL;\n\n if (!RepositoryTypes.isValid(type)) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Unknown 'type': ${type} | Expected one of: ${[...RepositoryTypes.SCHEME_SET].join(', ')}`,\n });\n }\n\n if (type === RepositoryTypes.MODEL && !metadata.model) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Missing 'model'`,\n });\n }\n\n if (type === RepositoryTypes.REMOTE && metadata.model) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | A '${RepositoryTypes.REMOTE}' repository takes no 'model'`,\n });\n }\n\n if (!metadata.dataSource) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Missing 'dataSource'`,\n });\n }\n};\n\n/** Asserts the constructor's first parameter is an AbstractDataSource compatible with what @repository declared. */\nconst validateFirstConstructorParameter = (opts: {\n target: Function;\n firstParamType: Function;\n resolvedDataSource: string | Function;\n}): void => {\n const { target, firstParamType, resolvedDataSource } = opts;\n\n // NOT `instanceof`: two copies of this package give two `AbstractDataSource` classes and the\n // check would be false across them, rejecting a perfectly valid repository at import time.\n const isDataSourceType = isDataSourceClass(firstParamType);\n\n if (!isDataSourceType) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must extend AbstractDataSource | Received: '${firstParamType.name}'`,\n });\n }\n\n if (typeof resolvedDataSource !== 'function') {\n return;\n }\n\n const isCompatible =\n firstParamType === resolvedDataSource || resolvedDataSource.prototype instanceof firstParamType;\n\n if (!isCompatible) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | Type mismatch | Constructor expects '${firstParamType.name}' but @repository specifies '${resolvedDataSource.name}'`,\n });\n }\n};\n\n/**\n * Auto-injects dataSource at constructor param[0] unless explicit @inject exists. A class is injected\n * by the class itself, so the container reads the key its registration recorded: a pinned\n * `binding` and a minified class name both resolve. Only a string reference is a key.\n */\nconst registerDataSourceInjection = (opts: {\n target: Function;\n registry: MetadataRegistry;\n dataSourceRef: TRepositoryMetadata['dataSource'];\n resolvedDataSource: string | Function;\n}): void => {\n const { target, registry, dataSourceRef, resolvedDataSource } = opts;\n\n // Own metadata only: `getInjectMetadata` walks the prototype chain, so a repository extending another @repository class would see the BASE's injection at param[0] and silently resolve the base's dataSource.\n const ownInjects: IInjectMetadata[] | undefined = Reflect.getOwnMetadata(\n MetadataKeys.INJECT,\n target,\n );\n const injectAtIndex0 = ownInjects?.find((entry) => entry?.index === 0);\n\n if (injectAtIndex0) {\n // `@inject({ target })` carries no key; read the one recorded on the class. The function form\n // resolves through the same helper the container uses, so both paths read one class.\n const injectedTarget = injectAtIndex0.target\n ? resolveInjectTarget({ target: injectAtIndex0.target })\n : undefined;\n const injectKey =\n injectAtIndex0.key ??\n (injectedTarget ? registry.getBindingKey({ target: injectedTarget }) : undefined);\n\n // A class is judged by its brand: its key may sit under any namespace a `binding` pinned, and\n // a provisional key may still change at registration. Only a bare key is judged by its prefix.\n const isDataSourceTarget = injectedTarget\n ? isDataSourceClass(injectedTarget)\n : typeof injectKey === 'string' && injectKey.startsWith(`${BindingNamespaces.DATASOURCE}.`);\n\n if (!isDataSourceTarget) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must be a DataSource | Found @inject with key: '${String(injectKey)}' | Expected a key starting with '${BindingNamespaces.DATASOURCE}.' or a DataSource class`,\n });\n }\n\n return;\n }\n\n // Checked only when this decorator writes the injection: an explicit @inject decides for itself.\n // An interface emits `Object` and a type-only class import emits `Function` under tsc (`Object`\n // under bun); neither names the class, so neither is judged.\n const firstParamType = Reflect.getMetadata('design:paramtypes', target)?.[0];\n if (firstParamType && firstParamType !== Object && firstParamType !== Function) {\n validateFirstConstructorParameter({ target, firstParamType, resolvedDataSource });\n }\n\n // The inherited list is the base repository's own, and setInjectMetadata may write straight into it.\n if (!ownInjects) {\n Reflect.defineMetadata(\n MetadataKeys.INJECT,\n [...(registry.getInjectMetadata({ target }) ?? [])],\n target,\n );\n }\n\n const derivedKey = BindingKeys.build({\n namespace: BindingNamespaces.DATASOURCE,\n key: typeof resolvedDataSource === 'string' ? resolvedDataSource : resolvedDataSource.name,\n });\n\n // The class first, decided when the repository is resolved: by then any registration - decorated,\n // `bindingList()`, or `dataSource(X, { binding })` - has recorded its key on the class. The derived\n // key is the fallback for a class nothing recorded, bound by hand under exactly that key.\n registry.setInjectMetadata({\n target,\n index: 0,\n metadata:\n typeof dataSourceRef === 'string'\n ? { key: derivedKey, index: 0, isOptional: false }\n : { target: dataSourceRef, key: derivedKey, index: 0, isOptional: false },\n });\n};\n\n/** Resolves repository metadata and registers bindings for schema auto-discovery. */\nconst resolveRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n target: Function;\n registry: MetadataRegistry;\n}): IResolvedRepositoryMetadata<Model, DataSource> => {\n const { metadata, target, registry } = opts;\n\n validateRepositoryMetadata({ metadata, target });\n\n const resolvedDataSource = resolveClass({ ref: metadata.dataSource });\n if (!resolvedDataSource) {\n throw getError({\n message: `[@repository][${target.name}] The dataSource resolver returned nothing at decoration time | An import cycle leaves the datasource class undefined here; import it without the cycle, or name it as a string`,\n });\n }\n\n // No model, so no binding: the datasource owns no schema through this repository.\n if (metadata.type === RepositoryTypes.REMOTE) {\n registerDataSourceInjection({\n target,\n registry,\n dataSourceRef: metadata.dataSource,\n resolvedDataSource,\n });\n return {\n type: RepositoryTypes.REMOTE,\n dataSource: resolvedDataSource,\n operationScope: metadata.operationScope,\n };\n }\n\n const resolvedModel = resolveValue({ value: metadata.model });\n\n registry.registerRepositoryBinding({\n repository: target,\n model: resolvedModel,\n dataSource: resolvedDataSource,\n });\n\n registerDataSourceInjection({\n target,\n registry,\n dataSourceRef: metadata.dataSource,\n resolvedDataSource,\n });\n\n return {\n type: RepositoryTypes.MODEL,\n model: resolvedModel,\n dataSource: resolvedDataSource,\n operationScope: metadata.operationScope,\n };\n};\n\n/** A bare `@repository()` on a subclass reuses the type, model and datasource its nearest decorated parent declared; the registration options (`binding`, `when`, ...) are never inherited, so the subclass registers under its own name. */\nconst inheritRepositoryMetadata = (opts: {\n target: Function;\n registry: MetadataRegistry;\n}): TRepositoryMetadata => {\n // Own metadata does not exist yet at decoration time, so this read walks the prototype chain.\n const inherited = opts.registry.getRepositoryMetadata({ target: opts.target });\n if (!inherited) {\n throw getError({\n message: `[@repository][${opts.target.name}] No metadata given and no decorated repository above it in the prototype chain | pass { model, dataSource } or decorate the parent`,\n });\n }\n\n if (inherited.type === RepositoryTypes.REMOTE) {\n const { type, dataSource, operationScope } = inherited;\n return { type, dataSource, operationScope };\n }\n\n const { type, model: parentModel, dataSource, operationScope } = inherited;\n return { type, model: parentModel, dataSource, operationScope };\n};\n\nconst applyRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n registration: IArtifactRegistrationOptions;\n target: Function;\n registry: MetadataRegistry;\n}): void => {\n const { metadata, registration, target, registry } = opts;\n injectable({\n type: ArtifactTypes.REPOSITORY,\n ...pickRegistrationOptions({ metadata: registration }),\n })(target);\n\n const resolved = resolveRepositoryMetadata({ metadata, target, registry });\n\n registry.setRepositoryMetadata({ target, metadata: { ...metadata, _resolved: resolved } });\n};\n\nexport const repository = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(\n metadata?: TRepositoryMetadata<Model, DataSource>,\n): ClassDecorator => {\n return (target) => {\n const registry = MetadataRegistry.getInstance();\n if (!metadata) {\n applyRepositoryMetadata({\n metadata: inheritRepositoryMetadata({ target, registry }),\n registration: {},\n target,\n registry,\n });\n return;\n }\n\n applyRepositoryMetadata({ metadata, registration: metadata, target, registry });\n };\n};\n"]}
1
+ {"version":3,"file":"persistents.js","sourceRoot":"","sources":["../../../../src/base/metadata/persistents.ts"],"names":[],"mappings":";;;AAAA,gDAAsD;AAStD,mDAM6B;AAC7B,0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AY,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAC1D,IAAA,uBAAU,EAAC;QACT,IAAI,EAAE,yBAAa,CAAC,UAAU;QAC9B,GAAG,IAAA,oCAAuB,EAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;KACvD,CAAC,CAAC,MAAM,CAAC,CAAC;IAEX,MAAM,QAAQ,GAAG,yBAAyB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE3E,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,GAAG,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC7F,CAAC,CAAC;AAEK,MAAM,UAAU,GAAG,CAIxB,QAAiD,EACjC,EAAE;IAClB,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,MAAM,QAAQ,GAAG,4BAAgB,CAAC,WAAW,EAAE,CAAC;QAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,uBAAuB,CAAC;gBACtB,QAAQ,EAAE,yBAAyB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;gBACzD,YAAY,EAAE,EAAE;gBAChB,MAAM;gBACN,QAAQ;aACT,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,uBAAuB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClF,CAAC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,UAAU,cAoBrB","sourcesContent":["import { BindingNamespaces } from '@/common/bindings';\nimport type {\n IArtifactRegistrationOptions,\n IDataSourceMetadata,\n IInjectMetadata,\n IModelMetadata,\n IResolvedRepositoryMetadata,\n TRepositoryMetadata,\n} from '@/helpers/inversion';\nimport {\n ArtifactTypes,\n BindingKeys,\n MetadataKeys,\n MetadataRegistry,\n resolveInjectTarget,\n} from '@/helpers/inversion';\nimport { resolveClass, resolveValue } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { IDataSource } from '../datasources';\nimport { isDataSourceClass } from '../datasources';\nimport type { AbstractEntity } from '../models';\nimport { RepositoryTypes } from '../repositories/common/constants';\nimport { injectable, pickRegistrationOptions } from './injectable';\nimport { normalizeModelMetadata } from './model-metadata';\nimport { assertNoRemovedModelSettings } from './model-settings';\n\n/** Registers a model class with its static schema and relations. */\nexport const model = (input: IModelMetadata = {}): ClassDecorator => {\n return (target) => {\n injectable({ type: ArtifactTypes.MODEL, ...pickRegistrationOptions({ metadata: input }) })(\n target,\n );\n\n const metadata = normalizeModelMetadata({ model: target.name, metadata: input });\n\n assertNoRemovedModelSettings({ model: target.name, settings: metadata.settings });\n const { settings } = metadata;\n\n const defaultLimit = settings?.query?.limit?.default;\n if (defaultLimit !== undefined && (!Number.isInteger(defaultLimit) || defaultLimit <= 0)) {\n throw getError({\n message: `[model][${target.name}] Invalid 'query.limit.default' | Expected a positive integer | Got: ${defaultLimit}`,\n });\n }\n\n // Validated at DECORATION time, like the default limit: a bad ceiling is a wiring mistake, and\n // catching it at boot beats catching it on the one request that happens to reach the limit.\n const maxLimit = settings?.query?.limit?.max;\n if (maxLimit !== undefined && (!Number.isInteger(maxLimit) || maxLimit <= 0)) {\n throw getError({\n message: `[model][${target.name}] Invalid 'query.limit.max' | Expected a positive integer | Got: ${maxLimit}`,\n });\n }\n\n // Auto-populate AUTHORIZATION_SUBJECT from authorize.principal if not already set\n const principal = settings?.authorize?.principal;\n if (principal && !Object.hasOwn(target, 'AUTHORIZATION_SUBJECT')) {\n (target as Record<string, unknown>).AUTHORIZATION_SUBJECT = principal;\n }\n\n MetadataRegistry.getInstance().registerModel({ target, metadata });\n };\n};\n\n/** Registers a datasource with driver and auto-discovery settings. */\nexport const datasource = (metadata?: IDataSourceMetadata): ClassDecorator => {\n return (target) => {\n injectable({\n type: ArtifactTypes.DATASOURCE,\n ...pickRegistrationOptions({ metadata: metadata ?? {} }),\n })(target);\n MetadataRegistry.getInstance().setDataSourceMetadata({ target, metadata });\n };\n};\n\n/** Mirrors the `TRepositoryMetadata` union for JavaScript callers: a known type, a dataSource always, a model exactly when the type is RepositoryTypes.MODEL. */\nconst validateRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n target: Function;\n}): void => {\n const { metadata, target } = opts;\n const type = metadata.type ?? RepositoryTypes.MODEL;\n\n if (!RepositoryTypes.isValid(type)) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Unknown 'type': ${type} | Expected one of: ${[...RepositoryTypes.SCHEME_SET].join(', ')}`,\n });\n }\n\n if (type === RepositoryTypes.MODEL && !metadata.model) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Missing 'model'`,\n });\n }\n\n if (type === RepositoryTypes.REMOTE && metadata.model) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | A '${RepositoryTypes.REMOTE}' repository takes no 'model'`,\n });\n }\n\n if (!metadata.dataSource) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Missing 'dataSource'`,\n });\n }\n};\n\n/** Asserts the constructor's first parameter is an AbstractDataSource compatible with what @repository declared. */\nconst validateFirstConstructorParameter = (opts: {\n target: Function;\n firstParamType: Function;\n resolvedDataSource: string | Function;\n}): void => {\n const { target, firstParamType, resolvedDataSource } = opts;\n\n // NOT `instanceof`: two copies of this package give two `AbstractDataSource` classes and the\n // check would be false across them, rejecting a perfectly valid repository at import time.\n const isDataSourceType = isDataSourceClass(firstParamType);\n\n if (!isDataSourceType) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must extend AbstractDataSource | Received: '${firstParamType.name}'`,\n });\n }\n\n if (typeof resolvedDataSource !== 'function') {\n return;\n }\n\n const isCompatible =\n firstParamType === resolvedDataSource || resolvedDataSource.prototype instanceof firstParamType;\n\n if (!isCompatible) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | Type mismatch | Constructor expects '${firstParamType.name}' but @repository specifies '${resolvedDataSource.name}'`,\n });\n }\n};\n\n/**\n * Auto-injects dataSource at constructor param[0] unless explicit @inject exists. A class is injected\n * by the class itself, so the container reads the key its registration recorded: a pinned\n * `binding` and a minified class name both resolve. Only a string reference is a key.\n */\nconst registerDataSourceInjection = (opts: {\n target: Function;\n registry: MetadataRegistry;\n dataSourceRef: TRepositoryMetadata['dataSource'];\n resolvedDataSource: string | Function;\n}): void => {\n const { target, registry, dataSourceRef, resolvedDataSource } = opts;\n\n // Own metadata only: `getInjectMetadata` walks the prototype chain, so a repository extending another @repository class would see the BASE's injection at param[0] and silently resolve the base's dataSource.\n const ownInjects: IInjectMetadata[] | undefined = Reflect.getOwnMetadata(\n MetadataKeys.INJECT,\n target,\n );\n const injectAtIndex0 = ownInjects?.find((entry) => entry?.index === 0);\n\n if (injectAtIndex0) {\n // `@inject({ target })` carries no key; read the one recorded on the class. The function form\n // resolves through the same helper the container uses, so both paths read one class.\n const injectedTarget = injectAtIndex0.target\n ? resolveInjectTarget({ target: injectAtIndex0.target })\n : undefined;\n const injectKey =\n injectAtIndex0.key ??\n (injectedTarget ? registry.getBindingKey({ target: injectedTarget }) : undefined);\n\n // A class is judged by its brand: its key may sit under any namespace a `binding` pinned, and\n // a provisional key may still change at registration. Only a bare key is judged by its prefix.\n const isDataSourceTarget = injectedTarget\n ? isDataSourceClass(injectedTarget)\n : typeof injectKey === 'string' && injectKey.startsWith(`${BindingNamespaces.DATASOURCE}.`);\n\n if (!isDataSourceTarget) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must be a DataSource | Found @inject with key: '${String(injectKey)}' | Expected a key starting with '${BindingNamespaces.DATASOURCE}.' or a DataSource class`,\n });\n }\n\n return;\n }\n\n // Checked only when this decorator writes the injection: an explicit @inject decides for itself.\n // An interface emits `Object` and a type-only class import emits `Function` under tsc (`Object`\n // under bun); neither names the class, so neither is judged.\n const firstParamType = Reflect.getMetadata('design:paramtypes', target)?.[0];\n if (firstParamType && firstParamType !== Object && firstParamType !== Function) {\n validateFirstConstructorParameter({ target, firstParamType, resolvedDataSource });\n }\n\n // The inherited list is the base repository's own, and setInjectMetadata may write straight into it.\n if (!ownInjects) {\n Reflect.defineMetadata(\n MetadataKeys.INJECT,\n [...(registry.getInjectMetadata({ target }) ?? [])],\n target,\n );\n }\n\n const derivedKey = BindingKeys.build({\n namespace: BindingNamespaces.DATASOURCE,\n key: typeof resolvedDataSource === 'string' ? resolvedDataSource : resolvedDataSource.name,\n });\n\n // The class first, decided when the repository is resolved: by then any registration - decorated,\n // `bindingList()`, or `dataSource(X, { binding })` - has recorded its key on the class. The derived\n // key is the fallback for a class nothing recorded, bound by hand under exactly that key.\n registry.setInjectMetadata({\n target,\n index: 0,\n metadata:\n typeof dataSourceRef === 'string'\n ? { key: derivedKey, index: 0, isOptional: false }\n : { target: dataSourceRef, key: derivedKey, index: 0, isOptional: false },\n });\n};\n\n/** Resolves repository metadata and registers bindings for schema auto-discovery. */\nconst resolveRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n target: Function;\n registry: MetadataRegistry;\n}): IResolvedRepositoryMetadata<Model, DataSource> => {\n const { metadata, target, registry } = opts;\n\n validateRepositoryMetadata({ metadata, target });\n\n const resolvedDataSource = resolveClass({ ref: metadata.dataSource });\n if (!resolvedDataSource) {\n throw getError({\n message: `[@repository][${target.name}] The dataSource resolver returned nothing at decoration time | An import cycle leaves the datasource class undefined here; import it without the cycle, or name it as a string`,\n });\n }\n\n // No model, so no binding: the datasource owns no schema through this repository.\n if (metadata.type === RepositoryTypes.REMOTE) {\n registerDataSourceInjection({\n target,\n registry,\n dataSourceRef: metadata.dataSource,\n resolvedDataSource,\n });\n return {\n type: RepositoryTypes.REMOTE,\n dataSource: resolvedDataSource,\n operationScope: metadata.operationScope,\n };\n }\n\n const resolvedModel = resolveValue({ value: metadata.model });\n\n registry.registerRepositoryBinding({\n repository: target,\n model: resolvedModel,\n dataSource: resolvedDataSource,\n });\n\n registerDataSourceInjection({\n target,\n registry,\n dataSourceRef: metadata.dataSource,\n resolvedDataSource,\n });\n\n return {\n type: RepositoryTypes.MODEL,\n model: resolvedModel,\n dataSource: resolvedDataSource,\n operationScope: metadata.operationScope,\n };\n};\n\n/** A bare `@repository()` on a subclass reuses the type, model and datasource its nearest decorated parent declared; the registration options (`binding`, `when`, ...) are never inherited, so the subclass registers under its own name. */\nconst inheritRepositoryMetadata = (opts: {\n target: Function;\n registry: MetadataRegistry;\n}): TRepositoryMetadata => {\n // Own metadata does not exist yet at decoration time, so this read walks the prototype chain.\n const inherited = opts.registry.getRepositoryMetadata({ target: opts.target });\n if (!inherited) {\n throw getError({\n message: `[@repository][${opts.target.name}] No metadata given and no decorated repository above it in the prototype chain | pass { model, dataSource } or decorate the parent`,\n });\n }\n\n if (inherited.type === RepositoryTypes.REMOTE) {\n const { type, dataSource, operationScope } = inherited;\n return { type, dataSource, operationScope };\n }\n\n const { type, model: parentModel, dataSource, operationScope } = inherited;\n return { type, model: parentModel, dataSource, operationScope };\n};\n\nconst applyRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n registration: IArtifactRegistrationOptions;\n target: Function;\n registry: MetadataRegistry;\n}): void => {\n const { metadata, registration, target, registry } = opts;\n injectable({\n type: ArtifactTypes.REPOSITORY,\n ...pickRegistrationOptions({ metadata: registration }),\n })(target);\n\n const resolved = resolveRepositoryMetadata({ metadata, target, registry });\n\n registry.setRepositoryMetadata({ target, metadata: { ...metadata, _resolved: resolved } });\n};\n\nexport const repository = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(\n metadata?: TRepositoryMetadata<Model, DataSource>,\n): ClassDecorator => {\n return (target) => {\n const registry = MetadataRegistry.getInstance();\n if (!metadata) {\n applyRepositoryMetadata({\n metadata: inheritRepositoryMetadata({ target, registry }),\n registration: {},\n target,\n registry,\n });\n return;\n }\n\n applyRepositoryMetadata({ metadata, registration: metadata, target, registry });\n };\n};\n"]}
@@ -8,4 +8,21 @@ export declare class SchemaTypes {
8
8
  static isValid(input: string): input is TSchemaType;
9
9
  }
10
10
  export type TSchemaType = TConstValue<typeof SchemaTypes>;
11
+ /** What `@model` declares. Only ENTITY (a table-backed model) exists; `type` may be left out. */
12
+ export declare class ModelTypes {
13
+ static readonly ENTITY = "entity";
14
+ static readonly SCHEME_SET: Set<string>;
15
+ static isValid(value: string): boolean;
16
+ }
17
+ /** Valid model type values. */
18
+ export type TModelType = TConstValue<typeof ModelTypes>;
19
+ /** The path-param id shape an entity family resolves to (`AbstractEntity.getIdType()`). */
20
+ export declare class IdSchemaTypes {
21
+ static readonly NUMBER = "number";
22
+ static readonly STRING = "string";
23
+ static readonly SCHEME_SET: Set<string>;
24
+ static isValid(value: string): boolean;
25
+ }
26
+ /** Valid id schema type values. */
27
+ export type TIdSchemaType = TConstValue<typeof IdSchemaTypes>;
11
28
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/base/models/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,qBAAa,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IAEpC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAkE;IA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O,aAAa,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SchemaTypes = void 0;
3
+ exports.IdSchemaTypes = exports.ModelTypes = exports.SchemaTypes = void 0;
4
4
  class SchemaTypes {
5
5
  static { this.SELECT = 'select'; }
6
6
  static { this.UPDATE = 'update'; }
@@ -12,4 +12,23 @@ class SchemaTypes {
12
12
  }
13
13
  }
14
14
  exports.SchemaTypes = SchemaTypes;
15
+ /** What `@model` declares. Only ENTITY (a table-backed model) exists; `type` may be left out. */
16
+ class ModelTypes {
17
+ static { this.ENTITY = 'entity'; }
18
+ static { this.SCHEME_SET = new Set([this.ENTITY]); }
19
+ static isValid(value) {
20
+ return this.SCHEME_SET.has(value);
21
+ }
22
+ }
23
+ exports.ModelTypes = ModelTypes;
24
+ /** The path-param id shape an entity family resolves to (`AbstractEntity.getIdType()`). */
25
+ class IdSchemaTypes {
26
+ static { this.NUMBER = 'number'; }
27
+ static { this.STRING = 'string'; }
28
+ static { this.SCHEME_SET = new Set([this.NUMBER, this.STRING]); }
29
+ static isValid(value) {
30
+ return this.SCHEME_SET.has(value);
31
+ }
32
+ }
33
+ exports.IdSchemaTypes = IdSchemaTypes;
15
34
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/models/common/constants.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;aACN,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,YAAO,GAAG,SAAS,CAAC;aAEpB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5F,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAVH,kCAWC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\n\nexport class SchemaTypes {\n static readonly SELECT = 'select';\n static readonly UPDATE = 'update';\n static readonly CREATE = 'create';\n static readonly EXECUTE = 'execute';\n\n static readonly SCHEME_SET = new Set([this.SELECT, this.UPDATE, this.CREATE, this.EXECUTE]);\n\n static isValid(input: string): input is TSchemaType {\n return this.SCHEME_SET.has(input);\n }\n}\n\nexport type TSchemaType = TConstValue<typeof SchemaTypes>;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/models/common/constants.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;aACN,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,YAAO,GAAG,SAAS,CAAC;aAEpB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5F,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAVH,kCAWC;AAID,iGAAiG;AACjG,MAAa,UAAU;aACL,WAAM,GAAG,QAAQ,CAAC;aAClB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEpD,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AANH,gCAOC;AAKD,2FAA2F;AAC3F,MAAa,aAAa;aACR,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AARH,sCASC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\n\nexport class SchemaTypes {\n static readonly SELECT = 'select';\n static readonly UPDATE = 'update';\n static readonly CREATE = 'create';\n static readonly EXECUTE = 'execute';\n\n static readonly SCHEME_SET = new Set([this.SELECT, this.UPDATE, this.CREATE, this.EXECUTE]);\n\n static isValid(input: string): input is TSchemaType {\n return this.SCHEME_SET.has(input);\n }\n}\n\nexport type TSchemaType = TConstValue<typeof SchemaTypes>;\n\n/** What `@model` declares. Only ENTITY (a table-backed model) exists; `type` may be left out. */\nexport class ModelTypes {\n static readonly ENTITY = 'entity';\n static readonly SCHEME_SET = new Set([this.ENTITY]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid model type values. */\nexport type TModelType = TConstValue<typeof ModelTypes>;\n\n/** The path-param id shape an entity family resolves to (`AbstractEntity.getIdType()`). */\nexport class IdSchemaTypes {\n static readonly NUMBER = 'number';\n static readonly STRING = 'string';\n\n static readonly SCHEME_SET = new Set<string>([this.NUMBER, this.STRING]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid id schema type values. */\nexport type TIdSchemaType = TConstValue<typeof IdSchemaTypes>;\n"]}
@@ -1,5 +1,5 @@
1
1
  import { z } from '@hono/zod-openapi';
2
- import type { TIdSchemaType } from './types';
2
+ import type { TIdSchemaType } from './constants';
3
3
  /**
4
4
  * The error RESPONSE for OpenAPI docs - here, beside the REST layer that already needs `@hono/zod-openapi`.
5
5
  * Named, so every route's `4XX` and `5XX` reference one `Er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C,CAAC;IAEH,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;IAEjG,OAAO;QACL,CAAC,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,eAAe;QAC3C,GAAG,IAAA,sBAAc,GAAE;KACpB,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,YAAY,gBAkBvB","sourcesContent":["import { z } from '@hono/zod-openapi';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { TIdSchemaType } from './types';\n\n/**\n * The error RESPONSE for OpenAPI docs - here, beside the REST layer that already needs `@hono/zod-openapi`.\n * Named, so every route's `4XX` and `5XX` reference one `ErrorResponse` component.\n */\nexport const ErrorSchema = z\n .object({\n statusCode: z.number().optional(),\n message: z.string(),\n normalized: z\n .object({\n text: z.string(),\n code: z.string(),\n args: z.record(z.string(), z.any()),\n })\n .optional(),\n extra: z.record(z.string(), z.any()).optional(),\n requestId: z.string().optional(),\n details: z.record(z.string(), z.any()).optional(),\n })\n .openapi('ErrorResponse', {\n description: 'Error Schema',\n example: {\n statusCode: HTTP.ResultCodes.RS_4.Conflict,\n message: 'A category named %{name} already exists.',\n normalized: {\n text: 'A category named %{name} already exists.',\n code: 'server.commerce.category.create.duplicate_name',\n args: { name: 'Ticket' },\n },\n extra: { categoryId: 42 },\n requestId: 'abc-123-def',\n details: { url: 'http://localhost:3000/categories', path: '/categories' },\n },\n });\n\nexport type TErrorResponse = z.infer<typeof ErrorSchema>;\n\nexport const idParamsSchema = (opts?: { idType: TIdSchemaType }) => {\n const { idType = 'number' } = opts ?? {};\n\n switch (idType) {\n case 'number': {\n return z.object({\n id: z.number().openapi({\n param: {\n name: 'id',\n in: 'path',\n description: 'The unique id of the resource',\n },\n examples: [1, 2, 3],\n }),\n });\n }\n case 'string': {\n return z.object({\n id: z.string().openapi({\n param: {\n name: 'id',\n in: 'path',\n description: 'The unique id of the resource',\n },\n examples: ['4651e634-a530-4484-9b09-9616a28f35e3', 'some_unique_id'],\n }),\n });\n }\n default: {\n throw getError({\n message: `[idParamsSchema] Invalid input idType | valid: [string | number] | idType: ${idType}`,\n });\n }\n }\n};\n\nexport const jsonContent = <T extends z.ZodType>(opts: {\n schema: T;\n description: string;\n required?: boolean;\n}) => {\n return {\n description: opts.description,\n content: { 'application/json': { schema: opts.schema } },\n required: opts.required,\n };\n};\n\n/** The JSON error body of a route, under `4XX` and `5XX` - the range keys OpenAPI accepts. */\nexport const errorResponses = () => {\n const errorResponse = jsonContent({ description: 'Error Response', schema: ErrorSchema });\n\n return { '4XX': errorResponse, '5XX': errorResponse };\n};\n\n/** OpenAPI Header Object format */\ntype THeaderObject = {\n description?: string;\n schema: { type: string; examples?: Array<string> };\n};\n\n/** Map of header names to Header Objects */\ntype TResponseHeaders = Record<string, THeaderObject>;\n\ntype TJsonResponseOpts<T extends z.ZodType, H extends TResponseHeaders | undefined> = {\n schema: T;\n description?: string;\n required?: boolean;\n headers?: H;\n};\n\nexport const jsonResponse = <\n ContentSchema extends z.ZodType,\n HeaderSchema extends TResponseHeaders | undefined = undefined,\n>(\n opts: TJsonResponseOpts<ContentSchema, HeaderSchema>,\n) => {\n const baseResponse = jsonContent({\n required: opts.required,\n description: opts.description ?? 'Success Response',\n schema: opts.schema,\n });\n\n const successResponse = opts.headers ? { ...baseResponse, headers: opts.headers } : baseResponse;\n\n return {\n [HTTP.ResultCodes.RS_2.Ok]: successResponse,\n ...errorResponses(),\n };\n};\n"]}
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../../../src/base/models/common/schemas.ts"],"names":[],"mappings":";;;AAAA,mDAAsC;AACtC,0DAAqD;AACrD,sDAAuD;AAGvD;;;GAGG;AACU,QAAA,WAAW,GAAG,eAAC;KACzB,MAAM,CAAC;IACN,UAAU,E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a,GAAG,IAAA,mBAAW,EAAC,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,EAAE,mBAAW,EAAE,CAAC,CAAC;IAE1F,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AACxD,CAAC,CAAC;AAJW,QAAA,cAAc,kBAIzB;AAkBK,MAAM,YAAY,GAAG,CAI1B,IAAoD,EACpD,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,mBAAW,EAAC;QAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,kBAAkB;QACnD,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;IAEjG,OAAO;QACL,CAAC,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,eAAe;QAC3C,GAAG,IAAA,sBAAc,GAAE;KACpB,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,YAAY,gBAkBvB","sourcesContent":["import { z } from '@hono/zod-openapi';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { TIdSchemaType } from './constants';\n\n/**\n * The error RESPONSE for OpenAPI docs - here, beside the REST layer that already needs `@hono/zod-openapi`.\n * Named, so every route's `4XX` and `5XX` reference one `ErrorResponse` component.\n */\nexport const ErrorSchema = z\n .object({\n statusCode: z.number().optional(),\n message: z.string(),\n normalized: z\n .object({\n text: z.string(),\n code: z.string(),\n args: z.record(z.string(), z.any()),\n })\n .optional(),\n extra: z.record(z.string(), z.any()).optional(),\n requestId: z.string().optional(),\n details: z.record(z.string(), z.any()).optional(),\n })\n .openapi('ErrorResponse', {\n description: 'Error Schema',\n example: {\n statusCode: HTTP.ResultCodes.RS_4.Conflict,\n message: 'A category named %{name} already exists.',\n normalized: {\n text: 'A category named %{name} already exists.',\n code: 'server.commerce.category.create.duplicate_name',\n args: { name: 'Ticket' },\n },\n extra: { categoryId: 42 },\n requestId: 'abc-123-def',\n details: { url: 'http://localhost:3000/categories', path: '/categories' },\n },\n });\n\nexport type TErrorResponse = z.infer<typeof ErrorSchema>;\n\nexport const idParamsSchema = (opts?: { idType: TIdSchemaType }) => {\n const { idType = 'number' } = opts ?? {};\n\n switch (idType) {\n case 'number': {\n return z.object({\n id: z.number().openapi({\n param: {\n name: 'id',\n in: 'path',\n description: 'The unique id of the resource',\n },\n examples: [1, 2, 3],\n }),\n });\n }\n case 'string': {\n return z.object({\n id: z.string().openapi({\n param: {\n name: 'id',\n in: 'path',\n description: 'The unique id of the resource',\n },\n examples: ['4651e634-a530-4484-9b09-9616a28f35e3', 'some_unique_id'],\n }),\n });\n }\n default: {\n throw getError({\n message: `[idParamsSchema] Invalid input idType | valid: [string | number] | idType: ${idType}`,\n });\n }\n }\n};\n\nexport const jsonContent = <T extends z.ZodType>(opts: {\n schema: T;\n description: string;\n required?: boolean;\n}) => {\n return {\n description: opts.description,\n content: { 'application/json': { schema: opts.schema } },\n required: opts.required,\n };\n};\n\n/** The JSON error body of a route, under `4XX` and `5XX` - the range keys OpenAPI accepts. */\nexport const errorResponses = () => {\n const errorResponse = jsonContent({ description: 'Error Response', schema: ErrorSchema });\n\n return { '4XX': errorResponse, '5XX': errorResponse };\n};\n\n/** OpenAPI Header Object format */\ntype THeaderObject = {\n description?: string;\n schema: { type: string; examples?: Array<string> };\n};\n\n/** Map of header names to Header Objects */\ntype TResponseHeaders = Record<string, THeaderObject>;\n\ntype TJsonResponseOpts<T extends z.ZodType, H extends TResponseHeaders | undefined> = {\n schema: T;\n description?: string;\n required?: boolean;\n headers?: H;\n};\n\nexport const jsonResponse = <\n ContentSchema extends z.ZodType,\n HeaderSchema extends TResponseHeaders | undefined = undefined,\n>(\n opts: TJsonResponseOpts<ContentSchema, HeaderSchema>,\n) => {\n const baseResponse = jsonContent({\n required: opts.required,\n description: opts.description ?? 'Success Response',\n schema: opts.schema,\n });\n\n const successResponse = opts.headers ? { ...baseResponse, headers: opts.headers } : baseResponse;\n\n return {\n [HTTP.ResultCodes.RS_2.Ok]: successResponse,\n ...errorResponses(),\n };\n};\n"]}
@@ -18,7 +18,5 @@ declare const entityIdBrand: unique symbol;
18
18
  export type TEntityId = string & {
19
19
  readonly [entityIdBrand]: never;
20
20
  };
21
- /** Path-param id shape every entity family resolves to (`AbstractEntity.getIdType()`). */
22
- export type TIdSchemaType = 'number' | 'string';
23
21
  export {};
24
22
  //# sourceMappingURL=id.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../../../../../src/base/models/common/types/id.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,MAAM,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;AAEhE,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,MAAM,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,aAAa,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAErE,0FAA0F;AAC1F,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../../../../../src/base/models/common/types/id.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,MAAM,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;AAEhE,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,MAAM,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,aAAa,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"id.js","sourceRoot":"","sources":["../../../../../../src/base/models/common/types/id.ts"],"names":[],"mappings":"","sourcesContent":["export type NumberIdType = number;\nexport type StringIdType = string;\nexport type BigIntIdType = bigint;\nexport type IdType = NumberIdType | StringIdType | BigIntIdType;\n\ndeclare const entityIdBrand: unique symbol;\n\n/**\n * A string id a plain `string` cannot be assigned to, so passing a name, code or email where an id\n * belongs is a compile error. Opt a column in with `.$type<TEntityId>()`.\n *\n * IT VALIDATES NOTHING. `toEntityId` is a cast with a non-empty check; the value is making the\n * laundering VISIBLE at each boundary, not proving the string is a real id.\n *\n * The cost is not optional: Drizzle derives `$inferInsert` and `$inferSelect` from the same field,\n * so a branded column rejects every literal - `create({ data: { merchantId: 'M1' } })`, seeds,\n * fixtures, path params - until each converts. A union with `string` would restore those but makes\n * a plain `string` assignable again, which erases the whole guarantee. Measured, not assumed.\n */\nexport type TEntityId = string & { readonly [entityIdBrand]: never };\n\n/** Path-param id shape every entity family resolves to (`AbstractEntity.getIdType()`). */\nexport type TIdSchemaType = 'number' | 'string';\n"]}
1
+ {"version":3,"file":"id.js","sourceRoot":"","sources":["../../../../../../src/base/models/common/types/id.ts"],"names":[],"mappings":"","sourcesContent":["export type NumberIdType = number;\nexport type StringIdType = string;\nexport type BigIntIdType = bigint;\nexport type IdType = NumberIdType | StringIdType | BigIntIdType;\n\ndeclare const entityIdBrand: unique symbol;\n\n/**\n * A string id a plain `string` cannot be assigned to, so passing a name, code or email where an id\n * belongs is a compile error. Opt a column in with `.$type<TEntityId>()`.\n *\n * IT VALIDATES NOTHING. `toEntityId` is a cast with a non-empty check; the value is making the\n * laundering VISIBLE at each boundary, not proving the string is a real id.\n *\n * The cost is not optional: Drizzle derives `$inferInsert` and `$inferSelect` from the same field,\n * so a branded column rejects every literal - `create({ data: { merchantId: 'M1' } })`, seeds,\n * fixtures, path params - until each converts. A union with `string` would restore those but makes\n * a plain `string` assignable again, which erases the whole guarantee. Measured, not assumed.\n */\nexport type TEntityId = string & { readonly [entityIdBrand]: never };\n"]}