@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":"model.js","sourceRoot":"","sources":["../../../../../../src/helpers/inversion/common/types/model.ts"],"names":[],"mappings":"","sourcesContent":["import type { AbstractEntity } from '@/base/models';\nimport type {\n ScopeFilters,\n TFilter,\n TScopeFilterMissingBehavior,\n TWhere,\n} from '@/base/repositories';\nimport type { TClass, TNullable, TValueOrResolver } from '@venizia/ignis-helpers/common';\nimport type { IArtifactRegistrationOptions } from './artifact';\n\nexport interface IModelAuthorizeSettings {\n /** The authorization principal name (resource/subject) for this model. */\n principal: string;\n /** Extensible - consumers can add any extra authorization metadata. */\n [extra: string | symbol]: any;\n}\n\n/**\n * Row-scope resolver for `@model` settings.scopeFilter - resolved per query, so it can depend on\n * the current request (tenant, org, membership). Framework-internal escape hatches aside, nothing\n * short of removing this setting from the model turns scoping off.\n */\nexport interface IScopeFilterSettings {\n /**\n * Returns the scope `where`; `ScopeFilters.UNRESTRICTED` to apply no scope for THIS call (an\n * internal operator, a caller the application has decided sees everything); or null/undefined\n * when this caller's scope cannot be determined at all.\n */\n resolve: () => TNullable<TWhere> | typeof ScopeFilters.UNRESTRICTED;\n\n /**\n * What `applyScopeFilter` does when `resolve()` returns null/undefined - no request context, no\n * tenant, a background job. Defaults to `deny`: an unresolved scope matches zero rows, never\n * every row. `allow` is an explicit, reviewed opt-out for migrations and background jobs, declared\n * per MODEL - it cannot express a per-USER bypass; use `ScopeFilters.UNRESTRICTED` for that.\n */\n onMissing?: TScopeFilterMissingBehavior;\n}\n\nexport interface IModelSettings {\n /** Properties excluded from all query results at SQL level. */\n hiddenProperties?: string[];\n\n /** Default filter auto-applied to all repository operations. Bypassable via shouldSkipDefaultFilter. */\n defaultFilter?: TFilter;\n\n /**\n * Row scope: ANDed into every read and write whose scope is expressible as a filter clause, and\n * NOT removable by `shouldSkipDefaultFilter`. Resolved per query, so it can depend on the current\n * request. Ownership resolved per row or through a polymorphic reference is NOT expressible here -\n * that check is still the application's to perform.\n *\n * Relational repositories only - a search-backed model (Typesense, Meilisearch) never reads\n * this setting, so mirroring a scoped entity into a search index needs its own query-time scope.\n */\n scopeFilter?: IScopeFilterSettings;\n\n /** Default row limit when a query omits `limit`. Must be a positive integer. Falls back to DEFAULT_LIMIT (10). */\n defaultLimit?: number;\n\n /**\n * Largest `limit` a CALLER may ask for. Must be a positive integer. Falls back to\n * DEFAULT_MAX_LIMIT (1000).\n *\n * Policy, not capacity - the engine's own ceiling sits far above it. The number is chosen so\n * that reaching it means the caller is doing something unusual, and raising it is how a model\n * says so deliberately.\n */\n maxLimit?: number;\n\n /** Authorization settings for this model (principal name, etc.). */\n authorize?: IModelAuthorizeSettings;\n}\n\nexport interface IModelMetadata extends IArtifactRegistrationOptions {\n type: 'entity' | 'view';\n tableName?: string;\n skipMigrate?: boolean;\n settings?: IModelSettings;\n}\n\nexport interface IEntityStatics {\n schema?: unknown;\n relations?: TValueOrResolver<Array<unknown>>;\n}\n\nexport type TModelClass<Model extends AbstractEntity = AbstractEntity> = TClass<Model> &\n IEntityStatics;\n\n/** Decorator target for model classes (supports both strongly typed and ClassDecorator patterns). */\nexport type TDecoratorModelTarget<Model extends AbstractEntity = AbstractEntity> =\n | TModelClass<Model>\n | (Function & IEntityStatics);\n\nexport interface IModelRegistryEntry<Model extends AbstractEntity = AbstractEntity> {\n target: TValueOrResolver<TClass<Model>>;\n metadata: IModelMetadata;\n schema: unknown;\n\n /** Lazy resolver to avoid circular deps. Resolved when DataSource builds schema. */\n relationsResolver?: TValueOrResolver<Array<unknown>>;\n\n /** Cache populated on first buildSchema() call. */\n _builtRelations?: unknown;\n}\n"]}
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../../../src/helpers/inversion/common/types/model.ts"],"names":[],"mappings":"","sourcesContent":["import type { AbstractEntity, TModelType } from '@/base/models';\nimport type {\n ScopeFilters,\n TFilter,\n TScopeFilterMissingBehavior,\n TScopeWriteGuard,\n TWhere,\n} from '@/base/repositories';\nimport type { TClass, TNullable, TValueOrResolver } from '@venizia/ignis-helpers/common';\nimport type { IArtifactRegistrationOptions } from './artifact';\n\nexport interface IModelAuthorizeSettings {\n /** The authorization principal name (resource/subject) for this model. */\n principal: string;\n /** Extensible - consumers can add any extra authorization metadata. */\n [extra: string | symbol]: any;\n}\n\n/** What a restricted caller may write to the scope columns (`@model` settings.access.write). */\nexport interface IModelAccessWriteSettings {\n /**\n * What a create, createAll or an update payload that names a scope column does when its value\n * disagrees with the resolved scope. `reject` (default) refuses the write and writes nothing - for\n * `createAll` not even the valid rows. `assign` also fills a scope column that is ABSENT from a\n * created row, when the scope is a single equality; a value that is present and disagrees is\n * still refused.\n *\n * The scope's columns and allowed values are read from the resolved `where` (equality, `eq`, `inq`\n * and arrays, `and`, and an `or` over one column). Any other shape cannot be checked, and the write\n * is refused with its own message - never skipped. `ScopeFilters.UNRESTRICTED` bypasses the guard\n * too, which is the deliberate way to write across scopes (system scope, an admin role).\n *\n * Not checked: an update that does not name the scope column (the row was already selected through\n * the scoped `where`), and raw statements that bypass the repository.\n */\n mode?: TScopeWriteGuard;\n\n /**\n * `true` lets a restricted caller write `null` to a scope column, or leave it out on create: the\n * row has no owner and is shared. Default `false`, so `null` is refused like any other value\n * outside the scope, even when the resolved scope has a `null` branch (that branch lets the caller\n * READ shared rows, a separate permission). Reads are scoped as before.\n */\n sharedRows?: boolean;\n}\n\n/**\n * Row access for `@model` settings.access - resolved per query, so it can depend on the current\n * request (tenant, org, membership). Framework-internal escape hatches aside, nothing short of\n * removing this setting from the model turns scoping off.\n */\nexport interface IModelAccessSettings {\n /**\n * Returns the scope `where`; `ScopeFilters.UNRESTRICTED` to apply no scope for THIS call (an\n * internal operator, a caller the application has decided sees everything); or null/undefined\n * when this caller's scope cannot be determined at all.\n */\n resolve: () => TNullable<TWhere> | typeof ScopeFilters.UNRESTRICTED;\n\n /**\n * What `applyScopeFilter` does when `resolve()` returns null/undefined - no request context, no\n * tenant, a background job. Defaults to `deny`: an unresolved scope matches zero rows, never\n * every row. `allow` is an explicit, reviewed opt-out for migrations and background jobs, declared\n * per MODEL - it cannot express a per-USER bypass; use `ScopeFilters.UNRESTRICTED` for that.\n */\n onMissing?: TScopeFilterMissingBehavior;\n\n /**\n * The property names the write guard checks. Optional: with none declared the guard checks every\n * column the resolved scope constrains. When declared, each name must exist on the model (checked\n * at boot), and a resolved scope that constrains any other column is refused as unverifiable.\n */\n columns?: string[];\n\n /** What a restricted caller may write to the scope columns. See {@link IModelAccessWriteSettings}. */\n write?: IModelAccessWriteSettings;\n}\n\n/** What a query runs with when it names nothing (`@model` settings.query). */\nexport interface IModelQuerySettings {\n /** Default filter auto-applied to all repository operations. Bypassable via shouldSkipDefaultFilter. */\n filter?: TFilter;\n\n limit?: {\n /** Default row limit when a query omits `limit`. Must be a positive integer. Falls back to DEFAULT_LIMIT (10). */\n default?: number;\n\n /**\n * Largest `limit` a CALLER may ask for. Must be a positive integer. Falls back to\n * DEFAULT_MAX_LIMIT (1000).\n *\n * Policy, not capacity - the engine's own ceiling sits far above it. The number is chosen so\n * that reaching it means the caller is doing something unusual, and raising it is how a model\n * says so deliberately.\n */\n max?: number;\n };\n}\n\nexport interface IModelSettings {\n /** Properties excluded from all query results at SQL level. */\n hiddenProperties?: string[];\n\n /** Default filter and limits of a query: `filter`, `limit.default`, `limit.max`. */\n query?: IModelQuerySettings;\n\n /**\n * Row access: the scope ANDed into every read and write whose scope is expressible as a filter\n * clause, NOT removable by `shouldSkipDefaultFilter`, and the guard that holds writes to it.\n * Ownership resolved per row or through a polymorphic reference is NOT expressible here - that\n * check is still the application's to perform.\n *\n * Relational repositories only - a search-backed model (Typesense, Meilisearch) never reads\n * this setting, so mirroring a scoped entity into a search index needs its own query-time scope.\n */\n access?: IModelAccessSettings;\n\n /** Authorization settings for this model (principal name, etc.). */\n authorize?: IModelAuthorizeSettings;\n}\n\n/** Whether tooling that reads the model registry should migrate this model (`@model({ migration })`). */\nexport interface IModelMigrationSettings {\n /** Default `true`. `false` marks the model as one a migration tool leaves alone. IGNIS generates no migrations itself. */\n use?: boolean;\n}\n\n/** One deprecated metadata key a model still uses, and the key that replaces it. */\nexport interface IDeprecatedModelMetadata {\n key: string;\n use: string;\n}\n\nexport interface IModelMetadata extends IArtifactRegistrationOptions {\n /** Optional: `ModelTypes.ENTITY` is the only value and the default. */\n type?: TModelType;\n tableName?: string;\n\n /** Migration marker for consumer tooling that reads the public registry. */\n migration?: IModelMigrationSettings;\n\n /**\n * @deprecated Use `migration: { use: false }`. Removed in 0.4.4. On a registry entry it is\n * derived (`!migration.use`) so tooling that reads it keeps working this release.\n */\n skipMigrate?: boolean;\n settings?: IModelSettings;\n\n /** Set by the decorator, read by the boot warning; not for application code. */\n deprecatedMetadata?: IDeprecatedModelMetadata[];\n}\n\nexport interface IEntityStatics {\n schema?: unknown;\n relations?: TValueOrResolver<Array<unknown>>;\n}\n\nexport type TModelClass<Model extends AbstractEntity = AbstractEntity> = TClass<Model> &\n IEntityStatics;\n\n/** Decorator target for model classes (supports both strongly typed and ClassDecorator patterns). */\nexport type TDecoratorModelTarget<Model extends AbstractEntity = AbstractEntity> =\n | TModelClass<Model>\n | (Function & IEntityStatics);\n\nexport interface IModelRegistryEntry<Model extends AbstractEntity = AbstractEntity> {\n target: TValueOrResolver<TClass<Model>>;\n metadata: IModelMetadata;\n schema: unknown;\n\n /** Lazy resolver to avoid circular deps. Resolved when DataSource builds schema. */\n relationsResolver?: TValueOrResolver<Array<unknown>>;\n\n /** Cache populated on first buildSchema() call. */\n _builtRelations?: unknown;\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { AbstractEntity } from '../../../base/models';
2
2
  import type { TMixinTarget } from '@venizia/ignis-helpers/common';
3
3
  import type { MetadataRegistry as _MetadataRegistry } from '@venizia/ignis-inversion';
4
+ import { AuthorizeModelFormats } from '../common/constants';
4
5
  import type { IModelAuthorizeSettings, IModelMetadata, IModelRegistryEntry, TDecoratorModelTarget } from '../common/types';
5
6
  export declare const ModelMetadataMixin: <BaseClass extends TMixinTarget<_MetadataRegistry>>(baseClass: BaseClass) => {
6
7
  new (...args: any[]): {
@@ -30,20 +31,20 @@ export declare const ModelMetadataMixin: <BaseClass extends TMixinTarget<_Metada
30
31
  }): IModelAuthorizeSettings | undefined;
31
32
  /** Authorization principals across all models that declare an authorize setting. */
32
33
  getAuthorizeModelPrincipals(opts: {
33
- format: "array";
34
+ format: typeof AuthorizeModelFormats.ARRAY;
34
35
  }): string[];
35
36
  getAuthorizeModelPrincipals(opts: {
36
- format: "record";
37
+ format: typeof AuthorizeModelFormats.RECORD;
37
38
  }): Record<string, string>;
38
39
  getAuthorizeModelSettings(opts: {
39
- format: "array";
40
+ format: typeof AuthorizeModelFormats.ARRAY;
40
41
  }): Array<{
41
42
  name: string;
42
43
  authorize: IModelAuthorizeSettings;
43
44
  entry: IModelRegistryEntry;
44
45
  }>;
45
46
  getAuthorizeModelSettings(opts: {
46
- format: "record";
47
+ format: typeof AuthorizeModelFormats.RECORD;
47
48
  }): Record<string, {
48
49
  authorize: IModelAuthorizeSettings;
49
50
  entry: IModelRegistryEntry;
@@ -1 +1 @@
1
- {"version":3,"file":"model.mixin.d.ts","sourceRoot":"","sources":["../../../../../src/helpers/inversion/mixins/model.mixin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,gBAAgB,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAEtF,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EAEtB,MAAM,iBAAiB,CAAC;AA0CzB,eAAO,MAAM,kBAAkB,GAAI,SAAS,SAA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,CAAA;SAAE,GAAG,MAAM,EAAE;0CACzD;YAChC,MAAM,EAAE,OAAO,qBAAqB,CAAC,MAAM,CAAC;SAC7C,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;wCA4BM;YAAE,MAAM,EAAE,OAAO,qBAAqB,CAAC,KAAK,CAAA;SAAE,GAAG,KAAK,CAAC;YACrF,IAAI,EAAE,MAAM,CAAC;YACb,SAAS,EAAE,uBAAuB,CAAC;YACnC,KAAK,EAAE,mBAAmB,CAAC;SAC5B,CAAC;wCAC8B;YAC9B,MAAM,EAAE,OAAO,qBAAqB,CAAC,MAAM,CAAC;SAC7C,GAAG,MAAM,CAAC,MAAM,EAAE;YAAE,SAAS,EAAE,uBAAuB,CAAC;YAAC,KAAK,EAAE,mBAAmB,CAAA;SAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA1G5E,CAAC;;;;;;;;aAqId,CAAC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ModelMetadataMixin = void 0;
4
4
  const core_1 = require("@venizia/ignis-helpers/core");
5
+ const constants_1 = require("../common/constants");
5
6
  const keys_1 = require("../common/keys");
6
7
  /** Registered models that declare an authorize setting, in registry order. */
7
8
  const collectAuthorizeEntries = (opts) => {
@@ -82,10 +83,10 @@ const ModelMetadataMixin = (baseClass) => {
82
83
  }
83
84
  getAuthorizeModelPrincipals(opts) {
84
85
  switch (opts.format) {
85
- case 'array': {
86
+ case constants_1.AuthorizeModelFormats.ARRAY: {
86
87
  return collectAuthorizePrincipals({ modelRegistry: this.modelRegistry }).map((item) => item.principal);
87
88
  }
88
- case 'record': {
89
+ case constants_1.AuthorizeModelFormats.RECORD: {
89
90
  const record = {};
90
91
  const authorizePrincipals = collectAuthorizePrincipals({
91
92
  modelRegistry: this.modelRegistry,
@@ -104,10 +105,10 @@ const ModelMetadataMixin = (baseClass) => {
104
105
  }
105
106
  getAuthorizeModelSettings(opts) {
106
107
  switch (opts.format) {
107
- case 'array': {
108
+ case constants_1.AuthorizeModelFormats.ARRAY: {
108
109
  return collectAuthorizeEntries({ modelRegistry: this.modelRegistry });
109
110
  }
110
- case 'record': {
111
+ case constants_1.AuthorizeModelFormats.RECORD: {
111
112
  const record = {};
112
113
  const authorizeEntries = collectAuthorizeEntries({ modelRegistry: this.modelRegistry });
113
114
  for (const item of authorizeEntries) {
@@ -1 +1 @@
1
- {"version":3,"file":"model.mixin.js","sourceRoot":"","sources":["../../../../../src/helpers/inversion/mixins/model.mixin.ts"],"names":[],"mappings":";;;AAEA,sDAAuD;AAEvD,yCAA8C;AAS9C,8EAA8E;AAC9E,MAAM,uBAAuB,GAAG,CAAC,IAEhC,EAA2F,EAAE;IAC5F,MAAM,MAAM,GAIP,EAAE,CAAC;IAER,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QAC/C,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;QACrD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,SAAS;QACX,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,gFAAgF;AAChF,MAAM,0BAA0B,GAAG,CAAC,IAEnC,EAA8C,EAAE;IAC/C,MAAM,MAAM,GAA+C,EAAE,CAAC;IAE9D,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QAC/C,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;QAChE,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,SAAS;QACX,CAAC;QAED,MAAM,CAAC,IAAI,CAA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CAAC;AACJ,CAAC,CAAC;AA/IW,QAAA,kBAAkB,sBA+I7B","sourcesContent":["import type { AbstractEntity } from '@/base/models';\nimport type { TMixinTarget } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { MetadataRegistry as _MetadataRegistry } from '@venizia/ignis-inversion';\nimport { MetadataKeys } from '../common/keys';\nimport type {\n IModelAuthorizeSettings,\n IModelMetadata,\n IModelRegistryEntry,\n TDecoratorModelTarget,\n TModelClass,\n} from '../common/types';\n\n/** Registered models that declare an authorize setting, in registry order. */\nconst collectAuthorizeEntries = (opts: {\n modelRegistry: Map<string, IModelRegistryEntry>;\n}): Array<{ name: string; authorize: IModelAuthorizeSettings; entry: IModelRegistryEntry }> => {\n const result: Array<{\n name: string;\n authorize: IModelAuthorizeSettings;\n entry: IModelRegistryEntry;\n }> = [];\n\n for (const [name, entry] of opts.modelRegistry) {\n const authorize = entry.metadata.settings?.authorize;\n if (!authorize) {\n continue;\n }\n\n result.push({ name, authorize, entry });\n }\n\n return result;\n};\n\n/** Registered models that declare an authorize principal, in registry order. */\nconst collectAuthorizePrincipals = (opts: {\n modelRegistry: Map<string, IModelRegistryEntry>;\n}): Array<{ name: string; principal: string }> => {\n const result: Array<{ name: string; principal: string }> = [];\n\n for (const [name, entry] of opts.modelRegistry) {\n const principal = entry.metadata.settings?.authorize?.principal;\n if (!principal) {\n continue;\n }\n\n result.push({ name, principal });\n }\n\n return result;\n};\n\nexport const ModelMetadataMixin = <BaseClass extends TMixinTarget<_MetadataRegistry>>(\n baseClass: BaseClass,\n) => {\n return class extends baseClass {\n modelRegistry: Map<string, IModelRegistryEntry>;\n modelsBySchema: WeakMap<object, IModelRegistryEntry>;\n\n setModelMetadata<Target extends object = object>(opts: {\n target: Target;\n metadata: IModelMetadata;\n }): void {\n const { target, metadata } = opts;\n Reflect.defineMetadata(MetadataKeys.MODEL, metadata, target);\n }\n\n getModelMetadata<Target extends object = object>(opts: {\n target: Target;\n }): IModelMetadata | undefined {\n const { target } = opts;\n return Reflect.getMetadata(MetadataKeys.MODEL, target);\n }\n\n /** Registers a model (called by @model) - relations are stored as a resolver, not resolved immediately, so circular references between models resolve lazily in buildSchema(). */\n registerModel<Model extends AbstractEntity = AbstractEntity>(opts: {\n target: TDecoratorModelTarget<Model>;\n metadata: IModelMetadata;\n }) {\n const { target, metadata } = opts;\n\n // Decorator target is always a class constructor at runtime\n const modelClass = target as TModelClass<Model>;\n\n // Table name precedence: explicit metadata > static TABLE_NAME > class name. TABLE_NAME is deliberately outside IEntityStatics (not part of the neutral contract) but still honored here via a local cast.\n const tableName =\n [metadata.tableName, (modelClass as { TABLE_NAME?: string }).TABLE_NAME].find(Boolean) ??\n modelClass.name;\n\n // Resolver, not resolved value - executed lazily in buildSchema() once all models are loaded\n const relationsResolver = modelClass.relations;\n\n const entry: IModelRegistryEntry = {\n target: modelClass,\n metadata,\n schema: modelClass.schema,\n relationsResolver,\n };\n this.modelRegistry.set(tableName, entry);\n\n const { schema } = modelClass;\n if (schema && typeof schema === 'object') {\n const claimed = this.modelsBySchema.get(schema);\n if (claimed && claimed.target !== modelClass) {\n this.modelsBySchema.delete(schema);\n } else {\n this.modelsBySchema.set(schema, entry);\n }\n }\n\n // Also mirrored via Reflect so plain metadata lookups (getModelMetadata) still see it\n this.setModelMetadata({ target, metadata });\n }\n\n getModelEntry(opts: { name: string }): IModelRegistryEntry | undefined {\n return this.modelRegistry.get(opts.name);\n }\n\n getModelEntryBySchema(opts: { schema: object }): IModelRegistryEntry | undefined {\n return this.modelsBySchema.get(opts.schema);\n }\n\n getAllModels(): Map<string, IModelRegistryEntry> {\n return this.modelRegistry;\n }\n\n getModelAuthorizeSettings(opts: { name: string }): IModelAuthorizeSettings | undefined {\n const entry = this.getModelEntry(opts);\n return entry?.metadata?.settings?.authorize;\n }\n\n /** Authorization principals across all models that declare an authorize setting. */\n getAuthorizeModelPrincipals(opts: { format: 'array' }): string[];\n getAuthorizeModelPrincipals(opts: { format: 'record' }): Record<string, string>;\n getAuthorizeModelPrincipals(opts: { format: 'array' | 'record' }) {\n switch (opts.format) {\n case 'array': {\n return collectAuthorizePrincipals({ modelRegistry: this.modelRegistry }).map(\n (item) => item.principal,\n );\n }\n case 'record': {\n const record: Record<string, string> = {};\n\n const authorizePrincipals = collectAuthorizePrincipals({\n modelRegistry: this.modelRegistry,\n });\n for (const item of authorizePrincipals) {\n record[item.name] = item.principal;\n }\n\n return record;\n }\n default: {\n throw getError({\n message: `[getAuthorizeModelPrincipals] Invalid format | format: ${opts.format} | valid: array, record`,\n });\n }\n }\n }\n\n getAuthorizeModelSettings(opts: { format: 'array' }): Array<{\n name: string;\n authorize: IModelAuthorizeSettings;\n entry: IModelRegistryEntry;\n }>;\n getAuthorizeModelSettings(opts: {\n format: 'record';\n }): Record<string, { authorize: IModelAuthorizeSettings; entry: IModelRegistryEntry }>;\n getAuthorizeModelSettings(opts: { format: 'array' | 'record' }) {\n switch (opts.format) {\n case 'array': {\n return collectAuthorizeEntries({ modelRegistry: this.modelRegistry });\n }\n case 'record': {\n const record: Record<\n string,\n { authorize: IModelAuthorizeSettings; entry: IModelRegistryEntry }\n > = {};\n\n const authorizeEntries = collectAuthorizeEntries({ modelRegistry: this.modelRegistry });\n for (const item of authorizeEntries) {\n record[item.name] = { authorize: item.authorize, entry: item.entry };\n }\n\n return record;\n }\n default: {\n throw getError({\n message: `[getAuthorizeModelSettings] Invalid format | format: ${opts.format} | valid: array, record`,\n });\n }\n }\n }\n };\n};\n"]}
1
+ {"version":3,"file":"model.mixin.js","sourceRoot":"","sources":["../../../../../src/helpers/inversion/mixins/model.mixin.ts"],"names":[],"mappings":";;;AAEA,sDAAuD;AAEvD,mDAAwF;AACxF,yCAA8C;AAS9C,8EAA8E;AAC9E,MAAM,uBAAuB,GAAG,CAAC,IAEhC,EAA2F,EAAE;IAC5F,MAAM,MAAM,GAIP,EAAE,CAAC;IAER,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,I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AqB,CAAC,KAAK,CAAC,CAAC,CAAC;oBACjC,OAAO,uBAAuB,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;gBACxE,CAAC;gBACD,KAAK,iCAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAClC,MAAM,MAAM,GAGR,EAAE,CAAC;oBAEP,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;oBACxF,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;wBACpC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;oBACvE,CAAC;oBAED,OAAO,MAAM,CAAC;gBAChB,CAAC;gBACD,OAAO,CAAC,CAAC,CAAC;oBACR,MAAM,IAAA,eAAQ,EAAC;wBACb,OAAO,EAAE,wDAAwD,IAAI,CAAC,MAAM,yBAAyB;qBACtG,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAjJW,QAAA,kBAAkB,sBAiJ7B","sourcesContent":["import type { AbstractEntity } from '@/base/models';\nimport type { TMixinTarget } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { MetadataRegistry as _MetadataRegistry } from '@venizia/ignis-inversion';\nimport { AuthorizeModelFormats, type TAuthorizeModelFormat } from '../common/constants';\nimport { MetadataKeys } from '../common/keys';\nimport type {\n IModelAuthorizeSettings,\n IModelMetadata,\n IModelRegistryEntry,\n TDecoratorModelTarget,\n TModelClass,\n} from '../common/types';\n\n/** Registered models that declare an authorize setting, in registry order. */\nconst collectAuthorizeEntries = (opts: {\n modelRegistry: Map<string, IModelRegistryEntry>;\n}): Array<{ name: string; authorize: IModelAuthorizeSettings; entry: IModelRegistryEntry }> => {\n const result: Array<{\n name: string;\n authorize: IModelAuthorizeSettings;\n entry: IModelRegistryEntry;\n }> = [];\n\n for (const [name, entry] of opts.modelRegistry) {\n const authorize = entry.metadata.settings?.authorize;\n if (!authorize) {\n continue;\n }\n\n result.push({ name, authorize, entry });\n }\n\n return result;\n};\n\n/** Registered models that declare an authorize principal, in registry order. */\nconst collectAuthorizePrincipals = (opts: {\n modelRegistry: Map<string, IModelRegistryEntry>;\n}): Array<{ name: string; principal: string }> => {\n const result: Array<{ name: string; principal: string }> = [];\n\n for (const [name, entry] of opts.modelRegistry) {\n const principal = entry.metadata.settings?.authorize?.principal;\n if (!principal) {\n continue;\n }\n\n result.push({ name, principal });\n }\n\n return result;\n};\n\nexport const ModelMetadataMixin = <BaseClass extends TMixinTarget<_MetadataRegistry>>(\n baseClass: BaseClass,\n) => {\n return class extends baseClass {\n modelRegistry: Map<string, IModelRegistryEntry>;\n modelsBySchema: WeakMap<object, IModelRegistryEntry>;\n\n setModelMetadata<Target extends object = object>(opts: {\n target: Target;\n metadata: IModelMetadata;\n }): void {\n const { target, metadata } = opts;\n Reflect.defineMetadata(MetadataKeys.MODEL, metadata, target);\n }\n\n getModelMetadata<Target extends object = object>(opts: {\n target: Target;\n }): IModelMetadata | undefined {\n const { target } = opts;\n return Reflect.getMetadata(MetadataKeys.MODEL, target);\n }\n\n /** Registers a model (called by @model) - relations are stored as a resolver, not resolved immediately, so circular references between models resolve lazily in buildSchema(). */\n registerModel<Model extends AbstractEntity = AbstractEntity>(opts: {\n target: TDecoratorModelTarget<Model>;\n metadata: IModelMetadata;\n }) {\n const { target, metadata } = opts;\n\n // Decorator target is always a class constructor at runtime\n const modelClass = target as TModelClass<Model>;\n\n // Table name precedence: explicit metadata > static TABLE_NAME > class name. TABLE_NAME is deliberately outside IEntityStatics (not part of the neutral contract) but still honored here via a local cast.\n const tableName =\n [metadata.tableName, (modelClass as { TABLE_NAME?: string }).TABLE_NAME].find(Boolean) ??\n modelClass.name;\n\n // Resolver, not resolved value - executed lazily in buildSchema() once all models are loaded\n const relationsResolver = modelClass.relations;\n\n const entry: IModelRegistryEntry = {\n target: modelClass,\n metadata,\n schema: modelClass.schema,\n relationsResolver,\n };\n this.modelRegistry.set(tableName, entry);\n\n const { schema } = modelClass;\n if (schema && typeof schema === 'object') {\n const claimed = this.modelsBySchema.get(schema);\n if (claimed && claimed.target !== modelClass) {\n this.modelsBySchema.delete(schema);\n } else {\n this.modelsBySchema.set(schema, entry);\n }\n }\n\n // Also mirrored via Reflect so plain metadata lookups (getModelMetadata) still see it\n this.setModelMetadata({ target, metadata });\n }\n\n getModelEntry(opts: { name: string }): IModelRegistryEntry | undefined {\n return this.modelRegistry.get(opts.name);\n }\n\n getModelEntryBySchema(opts: { schema: object }): IModelRegistryEntry | undefined {\n return this.modelsBySchema.get(opts.schema);\n }\n\n getAllModels(): Map<string, IModelRegistryEntry> {\n return this.modelRegistry;\n }\n\n getModelAuthorizeSettings(opts: { name: string }): IModelAuthorizeSettings | undefined {\n const entry = this.getModelEntry(opts);\n return entry?.metadata?.settings?.authorize;\n }\n\n /** Authorization principals across all models that declare an authorize setting. */\n getAuthorizeModelPrincipals(opts: { format: typeof AuthorizeModelFormats.ARRAY }): string[];\n getAuthorizeModelPrincipals(opts: {\n format: typeof AuthorizeModelFormats.RECORD;\n }): Record<string, string>;\n getAuthorizeModelPrincipals(opts: { format: TAuthorizeModelFormat }) {\n switch (opts.format) {\n case AuthorizeModelFormats.ARRAY: {\n return collectAuthorizePrincipals({ modelRegistry: this.modelRegistry }).map(\n (item) => item.principal,\n );\n }\n case AuthorizeModelFormats.RECORD: {\n const record: Record<string, string> = {};\n\n const authorizePrincipals = collectAuthorizePrincipals({\n modelRegistry: this.modelRegistry,\n });\n for (const item of authorizePrincipals) {\n record[item.name] = item.principal;\n }\n\n return record;\n }\n default: {\n throw getError({\n message: `[getAuthorizeModelPrincipals] Invalid format | format: ${opts.format} | valid: array, record`,\n });\n }\n }\n }\n\n getAuthorizeModelSettings(opts: { format: typeof AuthorizeModelFormats.ARRAY }): Array<{\n name: string;\n authorize: IModelAuthorizeSettings;\n entry: IModelRegistryEntry;\n }>;\n getAuthorizeModelSettings(opts: {\n format: typeof AuthorizeModelFormats.RECORD;\n }): Record<string, { authorize: IModelAuthorizeSettings; entry: IModelRegistryEntry }>;\n getAuthorizeModelSettings(opts: { format: TAuthorizeModelFormat }) {\n switch (opts.format) {\n case AuthorizeModelFormats.ARRAY: {\n return collectAuthorizeEntries({ modelRegistry: this.modelRegistry });\n }\n case AuthorizeModelFormats.RECORD: {\n const record: Record<\n string,\n { authorize: IModelAuthorizeSettings; entry: IModelRegistryEntry }\n > = {};\n\n const authorizeEntries = collectAuthorizeEntries({ modelRegistry: this.modelRegistry });\n for (const item of authorizeEntries) {\n record[item.name] = { authorize: item.authorize, entry: item.entry };\n }\n\n return record;\n }\n default: {\n throw getError({\n message: `[getAuthorizeModelSettings] Invalid format | format: ${opts.format} | valid: array, record`,\n });\n }\n }\n }\n };\n};\n"]}
@@ -12,4 +12,13 @@ export declare class ArtifactIndexFields {
12
12
  }
13
13
  export type TArtifactIndexField = TConstValue<typeof ArtifactIndexFields>;
14
14
  export declare const SecFetchSiteValues: readonly ["same-origin", "same-site", "none", "cross-site"];
15
+ /** The `encoding` of `ICompressOptions`. */
16
+ export declare class CompressEncodings {
17
+ static readonly GZIP = "gzip";
18
+ static readonly DEFLATE = "deflate";
19
+ static readonly SCHEME_SET: Set<string>;
20
+ static isValid(value: string): boolean;
21
+ }
22
+ /** Valid compress encoding values. */
23
+ export type TCompressEncoding = TConstValue<typeof CompressEncodings>;
15
24
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/base/applications/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,2KAA2K;AAC3K,qBAAa,mBAAmB;IAC9B,MAAM,CAAC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AAC,IAAI,UAAU;IAC9B,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IAEpC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAA8C;IAExE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,sCAAsC;AACtC,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -19,4 +19,13 @@ export class ArtifactIndexFields {
19
19
  }
20
20
  }
21
21
  export const SecFetchSiteValues = ['same-origin', 'same-site', 'none', 'cross-site'];
22
+ /** The `encoding` of `ICompressOptions`. */
23
+ export class CompressEncodings {
24
+ static { this.GZIP = 'gzip'; }
25
+ static { this.DEFLATE = 'deflate'; }
26
+ static { this.SCHEME_SET = new Set([this.GZIP, this.DEFLATE]); }
27
+ static isValid(value) {
28
+ return this.SCHEME_SET.has(value);
29
+ }
30
+ }
22
31
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/applications/common/constants.ts"],"names":[],"mappings":"AAEA,2KAA2K;AAC3K,MAAM,OAAO,mBAAmB;aACd,mBAAc,GAAG,gBAAgB,CAAC;aAClC,iBAAY,GAAG,aAAa,CAAC;aAC7B,eAAU,GAAG,YAAY,CAAC;aAC1B,iBAAY,GAAG,cAAc,CAAC;aAC9B,aAAQ,GAAG,UAAU,CAAC;aACtB,gBAAW,GAAG,aAAa,CAAC;aAE5B,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,cAAc;QACnB,IAAI,CAAC,YAAY;QACjB,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,YAAY;QACjB,IAAI,CAAC,QAAQ;QACb,IAAI,CAAC,WAAW;KACjB,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAKH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,CAAU,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\n\n/** The `IArtifactIndex` field names, in registration order. `@venizia/ignis-boot` mirrors these values in its own `ArtifactIndexFields` - boot cannot depend on kernel. */\nexport class ArtifactIndexFields {\n static readonly CONFIGURATIONS = 'configurations';\n static readonly DATA_SOURCES = 'dataSources';\n static readonly COMPONENTS = 'components';\n static readonly REPOSITORIES = 'repositories';\n static readonly SERVICES = 'services';\n static readonly CONTROLLERS = 'controllers';\n\n static readonly SCHEME_SET = new Set<string>([\n this.CONFIGURATIONS,\n this.DATA_SOURCES,\n this.COMPONENTS,\n this.REPOSITORIES,\n this.SERVICES,\n this.CONTROLLERS,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type TArtifactIndexField = TConstValue<typeof ArtifactIndexFields>;\n\nexport const SecFetchSiteValues = ['same-origin', 'same-site', 'none', 'cross-site'] as const;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/applications/common/constants.ts"],"names":[],"mappings":"AAEA,2KAA2K;AAC3K,MAAM,OAAO,mBAAmB;aACd,mBAAc,GAAG,gBAAgB,CAAC;aAClC,iBAAY,GAAG,aAAa,CAAC;aAC7B,eAAU,GAAG,YAAY,CAAC;aAC1B,iBAAY,GAAG,cAAc,CAAC;aAC9B,aAAQ,GAAG,UAAU,CAAC;aACtB,gBAAW,GAAG,aAAa,CAAC;aAE5B,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,cAAc;QACnB,IAAI,CAAC,YAAY;QACjB,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,YAAY;QACjB,IAAI,CAAC,QAAQ;QACb,IAAI,CAAC,WAAW;KACjB,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAKH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,CAAU,CAAC;AAE9F,4CAA4C;AAC5C,MAAM,OAAO,iBAAiB;aACZ,SAAI,GAAG,MAAM,CAAC;aACd,YAAO,GAAG,SAAS,CAAC;aAEpB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAExE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\n\n/** The `IArtifactIndex` field names, in registration order. `@venizia/ignis-boot` mirrors these values in its own `ArtifactIndexFields` - boot cannot depend on kernel. */\nexport class ArtifactIndexFields {\n static readonly CONFIGURATIONS = 'configurations';\n static readonly DATA_SOURCES = 'dataSources';\n static readonly COMPONENTS = 'components';\n static readonly REPOSITORIES = 'repositories';\n static readonly SERVICES = 'services';\n static readonly CONTROLLERS = 'controllers';\n\n static readonly SCHEME_SET = new Set<string>([\n this.CONFIGURATIONS,\n this.DATA_SOURCES,\n this.COMPONENTS,\n this.REPOSITORIES,\n this.SERVICES,\n this.CONTROLLERS,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type TArtifactIndexField = TConstValue<typeof ArtifactIndexFields>;\n\nexport const SecFetchSiteValues = ['same-origin', 'same-site', 'none', 'cross-site'] as const;\n\n/** The `encoding` of `ICompressOptions`. */\nexport class CompressEncodings {\n static readonly GZIP = 'gzip';\n static readonly DEFLATE = 'deflate';\n\n static readonly SCHEME_SET = new Set<string>([this.GZIP, this.DEFLATE]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid compress encoding values. */\nexport type TCompressEncoding = TConstValue<typeof CompressEncodings>;\n"]}
@@ -1,13 +1,13 @@
1
1
  import type { Context } from 'hono';
2
2
  import type { IPRestrictionRules as IIPRestrictionRules } from 'hono/ip-restriction';
3
- import { type SecFetchSiteValues } from '../constants.js';
3
+ import { type SecFetchSiteValues, type TCompressEncoding } from '../constants.js';
4
4
  export interface IBaseMiddlewareOptions {
5
5
  enable: boolean;
6
6
  path?: string;
7
7
  [extra: string | symbol]: any;
8
8
  }
9
9
  export interface ICompressOptions extends IBaseMiddlewareOptions {
10
- encoding: 'gzip' | 'deflate';
10
+ encoding: TCompressEncoding;
11
11
  threshold?: number;
12
12
  }
13
13
  export type TOrigin = string | string[] | ((origin: string, c: Context) => Promise<string | undefined | null> | string | undefined | null);
@@ -1 +1 @@
1
- {"version":3,"file":"middlewares.d.ts","sourceRoot":"","sources":["../../../../../../src/base/applications/common/types/middlewares.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,kBAAkB,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAiB,SAAQ,sBAAsB;IAC9D,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,OAAO,GACf,MAAM,GACN,MAAM,EAAE,GACR,CAAC,CACC,MAAM,EAAE,MAAM,EACd,CAAC,EAAE,OAAO,KACP,OAAO,CAAC,MAAM,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B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,aAAa,CAAC,EAAE,sBAAsB,GAAG,mBAAmB,CAAC;IAC7D,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;CAC/B"}
1
+ {"version":3,"file":"middlewares.d.ts","sourceRoot":"","sources":["../../../../../../src/base/applications/common/types/middlewares.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,kBAAkB,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE/E,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAiB,SAAQ,sBAAsB;IAC9D,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,OAAO,GACf,MAAM,GACN,MAAM,EAAE,GACR,CAAC,CACC,MAAM,EAAE,MAAM,EACd,CAAC,EAAE,OAAO,KACP,OAAO,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;AACzE,MAAM,WAAW,YAAa,SAAQ,sBAAsB;IAC1D,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,KAAK,OAAO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,CAAC;CAC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"middlewares.js","sourceRoot":"","sources":["../../../../../../src/base/applications/common/types/middlewares.ts"],"names":[],"mappings":"","sourcesContent":["import type { Context } from 'hono';\nimport type { IPRestrictionRules as IIPRestrictionRules } from 'hono/ip-restriction';\nimport { type SecFetchSiteValues } from '../constants';\n\nexport interface IBaseMiddlewareOptions {\n enable: boolean;\n path?: string;\n [extra: string | symbol]: any;\n}\n\nexport interface ICompressOptions extends IBaseMiddlewareOptions {\n encoding: 'gzip' | 'deflate';\n threshold?: number;\n}\n\nexport type TOrigin =\n | string\n | string[]\n | ((\n origin: string,\n c: Context,\n ) => Promise<string | undefined | null> | string | undefined | null);\nexport interface ICORSOptions extends IBaseMiddlewareOptions {\n origin: TOrigin;\n allowMethods?: string[] | ((origin: string, c: Context) => Promise<string[]> | string[]);\n allowHeaders?: string[];\n maxAge?: number;\n credentials?: boolean;\n exposeHeaders?: string[];\n}\n\nexport type TIsAllowedOriginHandler = (origin: string, context: Context) => boolean;\nexport type TSecFetchSite = (typeof SecFetchSiteValues)[number];\nexport type TIsAllowedSecFetchSiteHandler = (\n secFetchSite: TSecFetchSite,\n context: Context,\n) => boolean;\n\nexport interface ICSRFOptions extends IBaseMiddlewareOptions {\n origin?: string | string[] | TIsAllowedOriginHandler;\n secFetchSite?: TSecFetchSite | TSecFetchSite[] | TIsAllowedSecFetchSiteHandler;\n}\n\nexport interface IBodyLimitOptions extends IBaseMiddlewareOptions {\n maxSize: number;\n onError?: (c: Context) => Response | Promise<Response>;\n}\n\nexport interface IRequestIdOptions extends IBaseMiddlewareOptions {}\n\nexport interface IMiddlewareConfigs {\n requestId?: IRequestIdOptions;\n compress?: ICompressOptions;\n cors?: ICORSOptions;\n csrf?: ICSRFOptions;\n bodyLimit?: IBodyLimitOptions;\n ipRestriction?: IBaseMiddlewareOptions & IIPRestrictionRules;\n [extra: string | symbol]: any;\n}\n"]}
1
+ {"version":3,"file":"middlewares.js","sourceRoot":"","sources":["../../../../../../src/base/applications/common/types/middlewares.ts"],"names":[],"mappings":"","sourcesContent":["import type { Context } from 'hono';\nimport type { IPRestrictionRules as IIPRestrictionRules } from 'hono/ip-restriction';\nimport { type SecFetchSiteValues, type TCompressEncoding } from '../constants';\n\nexport interface IBaseMiddlewareOptions {\n enable: boolean;\n path?: string;\n [extra: string | symbol]: any;\n}\n\nexport interface ICompressOptions extends IBaseMiddlewareOptions {\n encoding: TCompressEncoding;\n threshold?: number;\n}\n\nexport type TOrigin =\n | string\n | string[]\n | ((\n origin: string,\n c: Context,\n ) => Promise<string | undefined | null> | string | undefined | null);\nexport interface ICORSOptions extends IBaseMiddlewareOptions {\n origin: TOrigin;\n allowMethods?: string[] | ((origin: string, c: Context) => Promise<string[]> | string[]);\n allowHeaders?: string[];\n maxAge?: number;\n credentials?: boolean;\n exposeHeaders?: string[];\n}\n\nexport type TIsAllowedOriginHandler = (origin: string, context: Context) => boolean;\nexport type TSecFetchSite = (typeof SecFetchSiteValues)[number];\nexport type TIsAllowedSecFetchSiteHandler = (\n secFetchSite: TSecFetchSite,\n context: Context,\n) => boolean;\n\nexport interface ICSRFOptions extends IBaseMiddlewareOptions {\n origin?: string | string[] | TIsAllowedOriginHandler;\n secFetchSite?: TSecFetchSite | TSecFetchSite[] | TIsAllowedSecFetchSiteHandler;\n}\n\nexport interface IBodyLimitOptions extends IBaseMiddlewareOptions {\n maxSize: number;\n onError?: (c: Context) => Response | Promise<Response>;\n}\n\nexport interface IRequestIdOptions extends IBaseMiddlewareOptions {}\n\nexport interface IMiddlewareConfigs {\n requestId?: IRequestIdOptions;\n compress?: ICompressOptions;\n cors?: ICORSOptions;\n csrf?: ICSRFOptions;\n bodyLimit?: IBodyLimitOptions;\n ipRestriction?: IBaseMiddlewareOptions & IIPRestrictionRules;\n [extra: string | symbol]: any;\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import type { Hono } from 'hono';
2
+ import type { ICORSOptions } from './common/index.js';
3
+ /**
4
+ * Installs `configs.middlewares.cors` on the server when it is set and not disabled; with no config
5
+ * nothing is installed. Called first in the default stack, so every response the framework produces
6
+ * on its own - a bodyLimit 413, a body the request spy cannot parse, the error envelope - leaves
7
+ * with the headers a browser needs to read it.
8
+ */
9
+ export declare const registerCors: (opts: {
10
+ server: Hono<any, any, any>;
11
+ options?: ICORSOptions;
12
+ }) => void;
13
+ //# sourceMappingURL=cors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../../../../src/base/applications/cors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM;IACjC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC5B,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB,KAAG,IAwCH,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { getError } from '@venizia/ignis-helpers/core';
2
+ import { cors } from 'hono/cors';
3
+ /**
4
+ * Installs `configs.middlewares.cors` on the server when it is set and not disabled; with no config
5
+ * nothing is installed. Called first in the default stack, so every response the framework produces
6
+ * on its own - a bodyLimit 413, a body the request spy cannot parse, the error envelope - leaves
7
+ * with the headers a browser needs to read it.
8
+ */
9
+ export const registerCors = (opts) => {
10
+ const { server, options } = opts;
11
+ if (!options || options.enable === false) {
12
+ return;
13
+ }
14
+ const { origin, path, allowMethods, allowHeaders, maxAge, credentials, exposeHeaders } = options;
15
+ const hasOrigin = typeof origin === 'function' || (Array.isArray(origin) ? origin.length > 0 : !!origin);
16
+ if (!hasOrigin) {
17
+ throw getError({
18
+ message: '[registerCors] configs.middlewares.cors.origin is required | a string, a list of strings or a function',
19
+ });
20
+ }
21
+ const origins = Array.isArray(origin) ? origin : [origin];
22
+ if (credentials && origins.includes('*')) {
23
+ throw getError({
24
+ message: "[registerCors] configs.middlewares.cors.credentials cannot be combined with origin '*' | a browser refuses a wildcard origin on a credentialed request | list the origins instead",
25
+ });
26
+ }
27
+ // Only the keys that are set: hono spreads over its defaults, so an `undefined` would erase one
28
+ // (a missing `allowMethods` would then answer a preflight with no allowed methods).
29
+ const settings = Object.fromEntries(Object.entries({
30
+ origin,
31
+ allowMethods,
32
+ allowHeaders,
33
+ maxAge,
34
+ credentials,
35
+ exposeHeaders,
36
+ }).filter(([, value]) => value !== undefined));
37
+ server.use(path ?? '*', cors(settings));
38
+ };
39
+ //# sourceMappingURL=cors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cors.js","sourceRoot":"","sources":["../../../../src/base/applications/cors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAG5B,EAAQ,EAAE;IACT,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEjC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;QACzC,OAAO;IACT,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAEjG,MAAM,SAAS,GACb,OAAO,MAAM,KAAK,UAAU,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACzF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,QAAQ,CAAC;YACb,OAAO,EACL,wGAAwG;SAC3G,CAAC,CAAC;IACL,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1D,IAAI,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACzC,MAAM,QAAQ,CAAC;YACb,OAAO,EACL,mLAAmL;SACtL,CAAC,CAAC;IACL,CAAC;IAED,gGAAgG;IAChG,oFAAoF;IACpF,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CACjC,MAAM,CAAC,OAAO,CAAC;QACb,MAAM;QACN,YAAY;QACZ,YAAY;QACZ,MAAM;QACN,WAAW;QACX,aAAa;KACd,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAC9C,CAAC;IAEF,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,EAAE,IAAI,CAAC,QAAsC,CAAC,CAAC,CAAC;AACxE,CAAC,CAAC","sourcesContent":["import { getError } from '@venizia/ignis-helpers/core';\nimport type { Hono } from 'hono';\nimport { cors } from 'hono/cors';\nimport type { ICORSOptions } from './common';\n\n/**\n * Installs `configs.middlewares.cors` on the server when it is set and not disabled; with no config\n * nothing is installed. Called first in the default stack, so every response the framework produces\n * on its own - a bodyLimit 413, a body the request spy cannot parse, the error envelope - leaves\n * with the headers a browser needs to read it.\n */\nexport const registerCors = (opts: {\n server: Hono<any, any, any>;\n options?: ICORSOptions;\n}): void => {\n const { server, options } = opts;\n\n if (!options || options.enable === false) {\n return;\n }\n\n const { origin, path, allowMethods, allowHeaders, maxAge, credentials, exposeHeaders } = options;\n\n const hasOrigin =\n typeof origin === 'function' || (Array.isArray(origin) ? origin.length > 0 : !!origin);\n if (!hasOrigin) {\n throw getError({\n message:\n '[registerCors] configs.middlewares.cors.origin is required | a string, a list of strings or a function',\n });\n }\n\n const origins = Array.isArray(origin) ? origin : [origin];\n if (credentials && origins.includes('*')) {\n throw getError({\n message:\n \"[registerCors] configs.middlewares.cors.credentials cannot be combined with origin '*' | a browser refuses a wildcard origin on a credentialed request | list the origins instead\",\n });\n }\n\n // Only the keys that are set: hono spreads over its defaults, so an `undefined` would erase one\n // (a missing `allowMethods` would then answer a preflight with no allowed methods).\n const settings = Object.fromEntries(\n Object.entries({\n origin,\n allowMethods,\n allowHeaders,\n maxAge,\n credentials,\n exposeHeaders,\n }).filter(([, value]) => value !== undefined),\n );\n\n server.use(path ?? '*', cors(settings as Parameters<typeof cors>[0]));\n};\n"]}
@@ -0,0 +1,10 @@
1
+ import type { ILogger } from '@venizia/ignis-helpers/core';
2
+ /**
3
+ * One warning per deprecated `@model` metadata key a model still uses, naming the model, the old
4
+ * key, the key that replaces it and the release that removes it. Read from what the decorator
5
+ * recorded, so it covers models registered by components and auto-discovery too.
6
+ */
7
+ export declare const warnDeprecatedModelMetadata: (opts: {
8
+ logger: ILogger;
9
+ }) => number;
10
+ //# sourceMappingURL=deprecations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecations.d.ts","sourceRoot":"","sources":["../../../../src/base/applications/deprecations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAI3D;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GAAI,MAAM;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,KAAG,MAkBvE,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { MetadataRegistry } from '../../helpers/inversion/index.js';
2
+ import { DEPRECATED_MODEL_METADATA_REMOVED_IN } from '../metadata/model-metadata.js';
3
+ /**
4
+ * One warning per deprecated `@model` metadata key a model still uses, naming the model, the old
5
+ * key, the key that replaces it and the release that removes it. Read from what the decorator
6
+ * recorded, so it covers models registered by components and auto-discovery too.
7
+ */
8
+ export const warnDeprecatedModelMetadata = (opts) => {
9
+ const { logger } = opts;
10
+ let count = 0;
11
+ for (const [name, entry] of MetadataRegistry.getInstance().getAllModels()) {
12
+ for (const { key, use } of entry.metadata?.deprecatedMetadata ?? []) {
13
+ logger.warn('[deprecated] model %s uses %s | use %s instead | removed in %s', name, key, use, DEPRECATED_MODEL_METADATA_REMOVED_IN);
14
+ count += 1;
15
+ }
16
+ }
17
+ return count;
18
+ };
19
+ //# sourceMappingURL=deprecations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecations.js","sourceRoot":"","sources":["../../../../src/base/applications/deprecations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,oCAAoC,EAAE,MAAM,4BAA4B,CAAC;AAElF;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,IAAyB,EAAU,EAAE;IAC/E,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxB,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,gBAAgB,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC;QAC1E,KAAK,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,KAAK,CAAC,QAAQ,EAAE,kBAAkB,IAAI,EAAE,EAAE,CAAC;YACpE,MAAM,CAAC,IAAI,CACT,gEAAgE,EAChE,IAAI,EACJ,GAAG,EACH,GAAG,EACH,oCAAoC,CACrC,CAAC;YACF,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["import type { ILogger } from '@venizia/ignis-helpers/core';\nimport { MetadataRegistry } from '@/helpers/inversion';\nimport { DEPRECATED_MODEL_METADATA_REMOVED_IN } from '../metadata/model-metadata';\n\n/**\n * One warning per deprecated `@model` metadata key a model still uses, naming the model, the old\n * key, the key that replaces it and the release that removes it. Read from what the decorator\n * recorded, so it covers models registered by components and auto-discovery too.\n */\nexport const warnDeprecatedModelMetadata = (opts: { logger: ILogger }): number => {\n const { logger } = opts;\n let count = 0;\n\n for (const [name, entry] of MetadataRegistry.getInstance().getAllModels()) {\n for (const { key, use } of entry.metadata?.deprecatedMetadata ?? []) {\n logger.warn(\n '[deprecated] model %s uses %s | use %s instead | removed in %s',\n name,\n key,\n use,\n DEPRECATED_MODEL_METADATA_REMOVED_IN,\n );\n count += 1;\n }\n }\n\n return count;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rest.d.ts","sourceRoot":"","sources":["../../../../src/base/applications/rest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAW,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpG,OAAO,EAGL,kBAAkB,EAEnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAIxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAGvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY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WzC;;;;OAIG;IACG,8BAA8B,IAAI,OAAO,CAAC,IAAI,CAAC;IAWrD,oHAAoH;IAC9G,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB1C,8JAA8J;IAC9J,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxE,OAAO,CAAC,IAAI,SAAS,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAUtF,UAAU,CAAC,IAAI,SAAS,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAU5F,UAAU,CAAC,IAAI,SAAS,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,SAAS,MAAM,GAAG,EAAE,EACvE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EACpB,IAAI,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GACzB,OAAO,CAAC,IAAI,CAAC;IAUhB,+IAA+I;IACzI,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8DlE,0OAA0O;IACpO,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC;IAIlD;;;;;;;OAOG;cACa,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB5D,uOAAuO;IACvO,OAAO,CAAC,gBAAgB;IAgClB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAW1C;;;;OAIG;cACa,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CA4BlD"}
@@ -12,6 +12,8 @@ import { BaseAppErrorMiddleware } from '../middlewares/app-error/app-error.middl
12
12
  import { RequestErrors } from '../middlewares/common/errors.js';
13
13
  import { notFoundHandler } from '../middlewares/not-found/not-found.middleware.js';
14
14
  import { AbstractApplication } from './abstract.js';
15
+ import { registerCors } from './cors.js';
16
+ import { warnDeprecatedModelMetadata } from './deprecations.js';
15
17
  import { ArtifactIndexHelper } from './artifact-index.js';
16
18
  import { BootSteps } from './boot-sequence.js';
17
19
  /** Adds the `OpenAPIHono` router surface on top of `AbstractApplication` - no listening server, so this is the layer a browser Worker or gRPC-only host can extend without pulling in `Bun.serve` / `@hono/node-server`. */
@@ -75,6 +77,9 @@ export class RestApplication extends AbstractApplication {
75
77
  */
76
78
  registerDefaultMiddlewares() {
77
79
  const server = this.getServer();
80
+ // First of all, so every response the framework produces on its own - a bodyLimit 413, a body the
81
+ // request spy cannot parse, the error envelope - leaves with the headers a browser needs to read it.
82
+ registerCors({ server, options: this.configs.middlewares?.cors });
78
83
  server.use(requestId({ generator: () => this.generateRequestId() }));
79
84
  // Ahead of every middleware a host adds after this one, so none of them buffers a body over it.
80
85
  const bodyLimitOptions = this.configs.middlewares?.bodyLimit;
@@ -279,6 +284,7 @@ export class RestApplication extends AbstractApplication {
279
284
  throw error;
280
285
  }
281
286
  }
287
+ warnDeprecatedModelMetadata({ logger });
282
288
  logger.info('Boot sequence complete | %d step(s) | Took: %s (ms) | %s', steps.length, performance.now() - t, steps.map((step) => step.name).join(' -> '));
283
289
  }
284
290
  inspectRoutes() {