@venizia/ignis-kernel 0.4.2 → 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 (143) 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/deprecations.d.ts +2 -2
  9. package/dist/cjs/base/applications/deprecations.js +7 -7
  10. package/dist/cjs/base/applications/deprecations.js.map +1 -1
  11. package/dist/cjs/base/applications/rest.js +1 -1
  12. package/dist/cjs/base/applications/rest.js.map +1 -1
  13. package/dist/cjs/base/auth/authenticate/common/constants/jose.d.ts +10 -0
  14. package/dist/cjs/base/auth/authenticate/common/constants/jose.d.ts.map +1 -1
  15. package/dist/cjs/base/auth/authenticate/common/constants/jose.js +12 -1
  16. package/dist/cjs/base/auth/authenticate/common/constants/jose.js.map +1 -1
  17. package/dist/cjs/base/auth/authenticate/common/types/jwt.d.ts +1 -2
  18. package/dist/cjs/base/auth/authenticate/common/types/jwt.d.ts.map +1 -1
  19. package/dist/cjs/base/auth/authenticate/common/types/jwt.js.map +1 -1
  20. package/dist/cjs/base/auth/authorize/common/constants/authorization.d.ts +11 -0
  21. package/dist/cjs/base/auth/authorize/common/constants/authorization.d.ts.map +1 -1
  22. package/dist/cjs/base/auth/authorize/common/constants/authorization.js +13 -1
  23. package/dist/cjs/base/auth/authorize/common/constants/authorization.js.map +1 -1
  24. package/dist/cjs/base/auth/authorize/common/types/request.d.ts +2 -1
  25. package/dist/cjs/base/auth/authorize/common/types/request.d.ts.map +1 -1
  26. package/dist/cjs/base/auth/authorize/common/types/request.js.map +1 -1
  27. package/dist/cjs/base/auth/authorize/providers/request-domain.js +4 -4
  28. package/dist/cjs/base/auth/authorize/providers/request-domain.js.map +1 -1
  29. package/dist/cjs/base/controllers/common/constants.d.ts +10 -0
  30. package/dist/cjs/base/controllers/common/constants.d.ts.map +1 -1
  31. package/dist/cjs/base/controllers/common/constants.js +12 -1
  32. package/dist/cjs/base/controllers/common/constants.js.map +1 -1
  33. package/dist/cjs/base/controllers/factory/controller.d.ts +1 -1
  34. package/dist/cjs/base/controllers/factory/controller.d.ts.map +1 -1
  35. package/dist/cjs/base/controllers/rest/abstract.d.ts +2 -1
  36. package/dist/cjs/base/controllers/rest/abstract.d.ts.map +1 -1
  37. package/dist/cjs/base/controllers/rest/abstract.js +6 -4
  38. package/dist/cjs/base/controllers/rest/abstract.js.map +1 -1
  39. package/dist/cjs/base/metadata/model-metadata.d.ts +17 -0
  40. package/dist/cjs/base/metadata/model-metadata.d.ts.map +1 -0
  41. package/dist/cjs/base/metadata/model-metadata.js +50 -0
  42. package/dist/cjs/base/metadata/model-metadata.js.map +1 -0
  43. package/dist/cjs/base/metadata/model-settings.d.ts +7 -17
  44. package/dist/cjs/base/metadata/model-settings.d.ts.map +1 -1
  45. package/dist/cjs/base/metadata/model-settings.js +22 -65
  46. package/dist/cjs/base/metadata/model-settings.js.map +1 -1
  47. package/dist/cjs/base/metadata/persistents.d.ts +1 -1
  48. package/dist/cjs/base/metadata/persistents.d.ts.map +1 -1
  49. package/dist/cjs/base/metadata/persistents.js +5 -12
  50. package/dist/cjs/base/metadata/persistents.js.map +1 -1
  51. package/dist/cjs/base/models/common/constants.d.ts +17 -0
  52. package/dist/cjs/base/models/common/constants.d.ts.map +1 -1
  53. package/dist/cjs/base/models/common/constants.js +20 -1
  54. package/dist/cjs/base/models/common/constants.js.map +1 -1
  55. package/dist/cjs/base/models/common/schemas.d.ts +1 -1
  56. package/dist/cjs/base/models/common/schemas.d.ts.map +1 -1
  57. package/dist/cjs/base/models/common/schemas.js.map +1 -1
  58. package/dist/cjs/base/models/common/types/id.d.ts +0 -2
  59. package/dist/cjs/base/models/common/types/id.d.ts.map +1 -1
  60. package/dist/cjs/base/models/common/types/id.js.map +1 -1
  61. package/dist/cjs/helpers/inversion/common/constants.d.ts +10 -0
  62. package/dist/cjs/helpers/inversion/common/constants.d.ts.map +1 -1
  63. package/dist/cjs/helpers/inversion/common/constants.js +11 -1
  64. package/dist/cjs/helpers/inversion/common/constants.js.map +1 -1
  65. package/dist/cjs/helpers/inversion/common/types/model.d.ts +17 -29
  66. package/dist/cjs/helpers/inversion/common/types/model.d.ts.map +1 -1
  67. package/dist/cjs/helpers/inversion/common/types/model.js.map +1 -1
  68. package/dist/cjs/helpers/inversion/mixins/model.mixin.d.ts +5 -4
  69. package/dist/cjs/helpers/inversion/mixins/model.mixin.d.ts.map +1 -1
  70. package/dist/cjs/helpers/inversion/mixins/model.mixin.js +5 -4
  71. package/dist/cjs/helpers/inversion/mixins/model.mixin.js.map +1 -1
  72. package/dist/esm/base/applications/common/constants.d.ts +9 -0
  73. package/dist/esm/base/applications/common/constants.d.ts.map +1 -1
  74. package/dist/esm/base/applications/common/constants.js +9 -0
  75. package/dist/esm/base/applications/common/constants.js.map +1 -1
  76. package/dist/esm/base/applications/common/types/middlewares.d.ts +2 -2
  77. package/dist/esm/base/applications/common/types/middlewares.d.ts.map +1 -1
  78. package/dist/esm/base/applications/common/types/middlewares.js.map +1 -1
  79. package/dist/esm/base/applications/deprecations.d.ts +2 -2
  80. package/dist/esm/base/applications/deprecations.js +5 -5
  81. package/dist/esm/base/applications/deprecations.js.map +1 -1
  82. package/dist/esm/base/applications/rest.js +2 -2
  83. package/dist/esm/base/applications/rest.js.map +1 -1
  84. package/dist/esm/base/auth/authenticate/common/constants/jose.d.ts +10 -0
  85. package/dist/esm/base/auth/authenticate/common/constants/jose.d.ts.map +1 -1
  86. package/dist/esm/base/auth/authenticate/common/constants/jose.js +10 -0
  87. package/dist/esm/base/auth/authenticate/common/constants/jose.js.map +1 -1
  88. package/dist/esm/base/auth/authenticate/common/types/jwt.d.ts +1 -2
  89. package/dist/esm/base/auth/authenticate/common/types/jwt.d.ts.map +1 -1
  90. package/dist/esm/base/auth/authenticate/common/types/jwt.js.map +1 -1
  91. package/dist/esm/base/auth/authorize/common/constants/authorization.d.ts +11 -0
  92. package/dist/esm/base/auth/authorize/common/constants/authorization.d.ts.map +1 -1
  93. package/dist/esm/base/auth/authorize/common/constants/authorization.js +11 -0
  94. package/dist/esm/base/auth/authorize/common/constants/authorization.js.map +1 -1
  95. package/dist/esm/base/auth/authorize/common/types/request.d.ts +2 -1
  96. package/dist/esm/base/auth/authorize/common/types/request.d.ts.map +1 -1
  97. package/dist/esm/base/auth/authorize/common/types/request.js.map +1 -1
  98. package/dist/esm/base/auth/authorize/providers/request-domain.js +5 -5
  99. package/dist/esm/base/auth/authorize/providers/request-domain.js.map +1 -1
  100. package/dist/esm/base/controllers/common/constants.d.ts +10 -0
  101. package/dist/esm/base/controllers/common/constants.d.ts.map +1 -1
  102. package/dist/esm/base/controllers/common/constants.js +10 -0
  103. package/dist/esm/base/controllers/common/constants.js.map +1 -1
  104. package/dist/esm/base/controllers/factory/controller.d.ts +1 -1
  105. package/dist/esm/base/controllers/factory/controller.d.ts.map +1 -1
  106. package/dist/esm/base/controllers/rest/abstract.d.ts +2 -1
  107. package/dist/esm/base/controllers/rest/abstract.d.ts.map +1 -1
  108. package/dist/esm/base/controllers/rest/abstract.js +6 -4
  109. package/dist/esm/base/controllers/rest/abstract.js.map +1 -1
  110. package/dist/esm/base/metadata/model-metadata.d.ts +17 -0
  111. package/dist/esm/base/metadata/model-metadata.d.ts.map +1 -0
  112. package/dist/esm/base/metadata/model-metadata.js +46 -0
  113. package/dist/esm/base/metadata/model-metadata.js.map +1 -0
  114. package/dist/esm/base/metadata/model-settings.d.ts +7 -17
  115. package/dist/esm/base/metadata/model-settings.d.ts.map +1 -1
  116. package/dist/esm/base/metadata/model-settings.js +20 -63
  117. package/dist/esm/base/metadata/model-settings.js.map +1 -1
  118. package/dist/esm/base/metadata/persistents.d.ts +1 -1
  119. package/dist/esm/base/metadata/persistents.d.ts.map +1 -1
  120. package/dist/esm/base/metadata/persistents.js +6 -13
  121. package/dist/esm/base/metadata/persistents.js.map +1 -1
  122. package/dist/esm/base/models/common/constants.d.ts +17 -0
  123. package/dist/esm/base/models/common/constants.d.ts.map +1 -1
  124. package/dist/esm/base/models/common/constants.js +17 -0
  125. package/dist/esm/base/models/common/constants.js.map +1 -1
  126. package/dist/esm/base/models/common/schemas.d.ts +1 -1
  127. package/dist/esm/base/models/common/schemas.d.ts.map +1 -1
  128. package/dist/esm/base/models/common/schemas.js.map +1 -1
  129. package/dist/esm/base/models/common/types/id.d.ts +0 -2
  130. package/dist/esm/base/models/common/types/id.d.ts.map +1 -1
  131. package/dist/esm/base/models/common/types/id.js.map +1 -1
  132. package/dist/esm/helpers/inversion/common/constants.d.ts +10 -0
  133. package/dist/esm/helpers/inversion/common/constants.d.ts.map +1 -1
  134. package/dist/esm/helpers/inversion/common/constants.js +9 -0
  135. package/dist/esm/helpers/inversion/common/constants.js.map +1 -1
  136. package/dist/esm/helpers/inversion/common/types/model.d.ts +17 -29
  137. package/dist/esm/helpers/inversion/common/types/model.d.ts.map +1 -1
  138. package/dist/esm/helpers/inversion/common/types/model.js.map +1 -1
  139. package/dist/esm/helpers/inversion/mixins/model.mixin.d.ts +5 -4
  140. package/dist/esm/helpers/inversion/mixins/model.mixin.d.ts.map +1 -1
  141. package/dist/esm/helpers/inversion/mixins/model.mixin.js +5 -4
  142. package/dist/esm/helpers/inversion/mixins/model.mixin.js.map +1 -1
  143. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../../../../../../src/base/auth/authorize/common/constants/authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EA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AAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAI5C,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAG3C;AAED,6IAA6I;AAC7I,MAAM,MAAM,2BAA2B,GACrC,CAAC,OAAO,2BAA2B,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;AAE7D,2EAA2E;AAC3E,qBAAa,0BAA0B;IACrC,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAChC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAChC,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IAEpC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAwE;IAElG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,gDAAgD;AAChD,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthorizationPolicyVariants = exports.AuthorizationDomainScopes = exports.AuthorizationRoles = exports.AuthorizationDecisions = exports.AuthorizationActions = exports.Authorization = void 0;
3
+ exports.AuthorizationDomainSources = exports.AuthorizationPolicyVariants = exports.AuthorizationDomainScopes = exports.AuthorizationRoles = exports.AuthorizationDecisions = exports.AuthorizationActions = exports.Authorization = void 0;
4
4
  const authorization_role_model_1 = require("../../models/authorization-role.model");
5
5
  const enforcer_1 = require("./enforcer");
6
6
  class Authorization {
@@ -160,4 +160,16 @@ class AuthorizationPolicyVariants {
160
160
  }
161
161
  }
162
162
  exports.AuthorizationPolicyVariants = AuthorizationPolicyVariants;
163
+ /** Where an `IAuthorizationDomainSource` reads the request domain from. */
164
+ class AuthorizationDomainSources {
165
+ static { this.PARAM = 'param'; }
166
+ static { this.HEADER = 'header'; }
167
+ static { this.QUERY = 'query'; }
168
+ static { this.CONTEXT = 'context'; }
169
+ static { this.SCHEME_SET = new Set([this.PARAM, this.HEADER, this.QUERY, this.CONTEXT]); }
170
+ static isValid(value) {
171
+ return this.SCHEME_SET.has(value);
172
+ }
173
+ }
174
+ exports.AuthorizationDomainSources = AuthorizationDomainSources;
163
175
  //# sourceMappingURL=authorization.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authorize/common/constants/authorization.ts"],"names":[],"mappings":";;;AACA,oFAA0E;AAC1E,yCAAgD;AAEhD,MAAa,aAAa;aACR,UAAK,GAAG,qBAAqB,CAAC;aAC9B,uBAAkB,GAAG,oBAAoB,CAAC;aAC1C,aAAQ,GAAG,wBAAwB,CAAC;aACpC,WAAM,GAAG,sBAAsB,CAAC;;AAJlD,sCAKC;AAED,MAAa,oBAAoB;aACf,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,YAAO,GAAG,SAAS,CAAC;aAEpB,SAAI,GAAG,MAAM,CAAC;aACd,UAAK,GAAG,OAAO,CAAC;aAChB,WAAM,GAAG,QAAQ,CAAC;IAElC,+FAA+F;aAC/E,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAC;QACnC,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,OAAO;QAEZ,IAAI,CAAC,IAAI;QACT,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,MAAM;QAEX,IAAI,CAAC,MAAM;KACZ,CAAC,CAAC;aAEa,YAAO,GAGlB;QACH,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;QACzC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI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AW;QAChB,IAAI,CAAC,aAAa;QAClB,IAAI,CAAC,WAAW;QAChB,IAAI,CAAC,eAAe;QACpB,IAAI,CAAC,iBAAiB;QACtB,IAAI,CAAC,eAAe;KACZ,CAAC;aAEK,sBAAiB,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;aAElF,oBAAe,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAE9F,MAAM,CAAC,aAAa,CAAC,KAAa;QAChC,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,KAAa;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;;AApDH,kEAqDC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { AuthorizationRole } from '../../models/authorization-role.model';\nimport { CasbinRuleVariants } from './enforcer';\n\nexport class Authorization {\n static readonly RULES = 'authorization.rules';\n static readonly SKIP_AUTHORIZATION = 'authorization.skip';\n static readonly ENFORCER = 'authorization.enforcer';\n static readonly DOMAIN = 'authorization.domain';\n}\n\nexport class AuthorizationActions {\n static readonly CREATE = 'create';\n static readonly UPDATE = 'update';\n static readonly DELETE = 'delete';\n static readonly EXECUTE = 'execute';\n\n static readonly READ = 'read';\n static readonly WRITE = 'write';\n static readonly MANAGE = 'manage';\n\n /** Grant-mode marker for a subset grant carrying `metadata.ops`; never a member of LATTICE. */\n static readonly CUSTOM = 'custom';\n\n static readonly SCHEME_SET = new Set([\n this.CREATE,\n this.UPDATE,\n this.DELETE,\n this.EXECUTE,\n\n this.READ,\n this.WRITE,\n this.MANAGE,\n\n this.CUSTOM,\n ]);\n\n static readonly LATTICE: ReadonlyArray<{\n child: TAuthorizationAction;\n parent: TAuthorizationAction;\n }> = [\n { child: this.READ, parent: this.MANAGE },\n { child: this.WRITE, parent: this.MANAGE },\n { child: this.EXECUTE, parent: this.MANAGE },\n { child: this.CREATE, parent: this.WRITE },\n { child: this.UPDATE, parent: this.WRITE },\n { child: this.DELETE, parent: this.WRITE },\n ];\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\nexport type TAuthorizationAction = TConstValue<typeof AuthorizationActions>;\n\nexport class AuthorizationDecisions {\n static readonly ALLOW = 'allow';\n static readonly DENY = 'deny';\n static readonly ABSTAIN = 'abstain';\n\n static readonly SCHEME_SET = new Set([this.ALLOW, this.DENY, this.ABSTAIN]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n\n static isAllow(input: string | number): boolean {\n if (typeof input === 'number') {\n return input > 0;\n }\n return input.toLowerCase() === this.ALLOW;\n }\n\n static isDeny(input: string | number): boolean {\n if (typeof input === 'number') {\n return input < 0;\n }\n return input.toLowerCase() === this.DENY;\n }\n\n static isAbstain(input: string | number): boolean {\n if (typeof input === 'number') {\n return input === 0;\n }\n return input.toLowerCase() === this.ABSTAIN;\n }\n}\nexport type TAuthorizationDecision = TConstValue<typeof AuthorizationDecisions>;\n\nexport class AuthorizationRoles {\n static readonly SUPER_ADMIN = AuthorizationRole.build({\n name: 'super-admin',\n priority: 999,\n });\n static readonly ADMIN = AuthorizationRole.build({\n name: 'admin',\n priority: 900,\n });\n static readonly USER = AuthorizationRole.build({\n name: 'user',\n priority: 10,\n });\n static readonly GUEST = AuthorizationRole.build({\n name: 'guest',\n priority: 1,\n });\n static readonly UNKNOWN_USER = AuthorizationRole.build({\n name: 'unknown-user',\n priority: 0,\n });\n\n static readonly SCHEME_SET = new Set<string>([\n this.SUPER_ADMIN.identifier,\n this.ADMIN.identifier,\n this.USER.identifier,\n this.GUEST.identifier,\n this.UNKNOWN_USER.identifier,\n ]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n\nexport class AuthorizationDomainScopes {\n /** Grant applies in EVERY domain the subject is a member of (checked via join_domain / g2). */\n static readonly ANY_MEMBER = 'ANY_MEMBER';\n\n /** Grant applies system-wide, bypassing membership - super-admin only. */\n static readonly SYSTEM_WIDE = 'SYSTEM_WIDE';\n\n static readonly SCHEME_SET = new Set([this.ANY_MEMBER, this.SYSTEM_WIDE]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\nexport type TAuthorizationDomainScope = TConstValue<typeof AuthorizationDomainScopes>;\n\n/** Edge kinds in the `PolicyDefinition` table (each row: subject -> target, `variant` = kind), carrying `action` (DB `variant` value) + `rule` (casbin prefix emitted per edge). Per-USER edges: GRANT, ASSIGN_ROLE, JOIN_DOMAIN; shared org-structure edges: the *_INHERITS ones. */\nexport class AuthorizationPolicyVariants {\n /** Give a Permission to a User/Role (row also carries action / effect / domain). casbin `p`: `p, <Role|User>_<id>, <domain>, <permissionCode>, <action>, <allow|deny>` */\n static readonly GRANT = { action: 'grant', rule: CasbinRuleVariants.P } as const;\n\n /** Give a User a Role (optionally domain-scoped; no domain -> `*` = every domain). casbin `g`: `g, User_<id>, Role_<id>, <domain|*>` */\n static readonly ASSIGN_ROLE = { action: 'assign_role', rule: CasbinRuleVariants.G } as const;\n\n /** A Role inherits another Role (DAG). Shares `g` with ASSIGN_ROLE so user -> role -> parent-role resolves in one lookup. Emitted with domain `*`: `g, Role_<child>, Role_<parent>, *` */\n static readonly ROLE_INHERITS = { action: 'role_inherits', rule: CasbinRuleVariants.G } as const;\n\n /** User is a member of a Domain; powers the `ANY_MEMBER` grant scope via `g2(r.sub, r.dom)`. casbin `g2`: `g2, User_<id>, <Type>_<domainId>` */\n static readonly JOIN_DOMAIN = { action: 'join_domain', rule: CasbinRuleVariants.G2 } as const;\n\n /** DOMAIN axis (`dom`): domain nesting. Matcher: `g3(r.dom, p.dom)` + self-link so an exact domain always matches itself. casbin `g3`: `g3, <Type>_<childId>, <Type>_<parentId>` */\n static readonly DOMAIN_INHERITS = {\n action: 'domain_inherits',\n rule: CasbinRuleVariants.G3,\n } as const;\n\n /** RESOURCE axis (`obj`), NON-standard nesting only - dotted nesting (`Order.findById ⊂ Order`) is handled by `objectMatch` WITHOUT an edge. Matcher: `objectMatch(r.obj, p.obj) || g4(r.obj, p.obj)`, casbin `g4`: `g4, <childCode>, <parentCode>` */\n static readonly RESOURCE_INHERITS = {\n action: 'resource_inherits',\n rule: CasbinRuleVariants.G4,\n } as const;\n\n /** ACTION axis (`act`): a narrow action covered by a broader one; no dotted shortcut, so it needs an explicit edge. Matcher: `g5(r.act, p.act)`, casbin `g5`: `g5, <childAction>, <parentAction>`. g4 + g5 combine multiplicatively: `manage Order` covers a `read OrderItem` request. */\n static readonly ACTION_INHERITS = {\n action: 'action_inherits',\n rule: CasbinRuleVariants.G5,\n } as const;\n\n /** Every edge kind, in declaration order - the one place the scheme sets and the `variant` column's literal type both derive from. */\n static readonly ALL = [\n this.GRANT,\n this.ASSIGN_ROLE,\n this.ROLE_INHERITS,\n this.JOIN_DOMAIN,\n this.DOMAIN_INHERITS,\n this.RESOURCE_INHERITS,\n this.ACTION_INHERITS,\n ] as const;\n\n static readonly ACTION_SCHEME_SET = new Set(this.ALL.map((variant) => variant.action.toString()));\n\n static readonly RULE_SCHEME_SET = new Set(this.ALL.map((variant) => variant.rule.toString()));\n\n static isValidAction(input: string): boolean {\n return this.ACTION_SCHEME_SET.has(input);\n }\n\n static isValidRule(input: string): boolean {\n return this.RULE_SCHEME_SET.has(input);\n }\n}\n\n/** The `variant` column's full value set, derived from {@link AuthorizationPolicyVariants.ALL} - never hand-list the seven strings again. */\nexport type TAuthorizationPolicyVariant =\n (typeof AuthorizationPolicyVariants.ALL)[number]['action'];\n"]}
1
+ {"version":3,"file":"authorization.js","sourceRoot":"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,CAAC,CAAC;aAElF,oBAAe,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAE9F,MAAM,CAAC,aAAa,CAAC,KAAa;QAChC,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,KAAa;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;;AApDH,kEAqDC;AAMD,2EAA2E;AAC3E,MAAa,0BAA0B;aACrB,UAAK,GAAG,OAAO,CAAC;aAChB,WAAM,GAAG,QAAQ,CAAC;aAClB,UAAK,GAAG,OAAO,CAAC;aAChB,YAAO,GAAG,SAAS,CAAC;aAEpB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAElG,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAVH,gEAWC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { AuthorizationRole } from '../../models/authorization-role.model';\nimport { CasbinRuleVariants } from './enforcer';\n\nexport class Authorization {\n static readonly RULES = 'authorization.rules';\n static readonly SKIP_AUTHORIZATION = 'authorization.skip';\n static readonly ENFORCER = 'authorization.enforcer';\n static readonly DOMAIN = 'authorization.domain';\n}\n\nexport class AuthorizationActions {\n static readonly CREATE = 'create';\n static readonly UPDATE = 'update';\n static readonly DELETE = 'delete';\n static readonly EXECUTE = 'execute';\n\n static readonly READ = 'read';\n static readonly WRITE = 'write';\n static readonly MANAGE = 'manage';\n\n /** Grant-mode marker for a subset grant carrying `metadata.ops`; never a member of LATTICE. */\n static readonly CUSTOM = 'custom';\n\n static readonly SCHEME_SET = new Set([\n this.CREATE,\n this.UPDATE,\n this.DELETE,\n this.EXECUTE,\n\n this.READ,\n this.WRITE,\n this.MANAGE,\n\n this.CUSTOM,\n ]);\n\n static readonly LATTICE: ReadonlyArray<{\n child: TAuthorizationAction;\n parent: TAuthorizationAction;\n }> = [\n { child: this.READ, parent: this.MANAGE },\n { child: this.WRITE, parent: this.MANAGE },\n { child: this.EXECUTE, parent: this.MANAGE },\n { child: this.CREATE, parent: this.WRITE },\n { child: this.UPDATE, parent: this.WRITE },\n { child: this.DELETE, parent: this.WRITE },\n ];\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\nexport type TAuthorizationAction = TConstValue<typeof AuthorizationActions>;\n\nexport class AuthorizationDecisions {\n static readonly ALLOW = 'allow';\n static readonly DENY = 'deny';\n static readonly ABSTAIN = 'abstain';\n\n static readonly SCHEME_SET = new Set([this.ALLOW, this.DENY, this.ABSTAIN]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n\n static isAllow(input: string | number): boolean {\n if (typeof input === 'number') {\n return input > 0;\n }\n return input.toLowerCase() === this.ALLOW;\n }\n\n static isDeny(input: string | number): boolean {\n if (typeof input === 'number') {\n return input < 0;\n }\n return input.toLowerCase() === this.DENY;\n }\n\n static isAbstain(input: string | number): boolean {\n if (typeof input === 'number') {\n return input === 0;\n }\n return input.toLowerCase() === this.ABSTAIN;\n }\n}\nexport type TAuthorizationDecision = TConstValue<typeof AuthorizationDecisions>;\n\nexport class AuthorizationRoles {\n static readonly SUPER_ADMIN = AuthorizationRole.build({\n name: 'super-admin',\n priority: 999,\n });\n static readonly ADMIN = AuthorizationRole.build({\n name: 'admin',\n priority: 900,\n });\n static readonly USER = AuthorizationRole.build({\n name: 'user',\n priority: 10,\n });\n static readonly GUEST = AuthorizationRole.build({\n name: 'guest',\n priority: 1,\n });\n static readonly UNKNOWN_USER = AuthorizationRole.build({\n name: 'unknown-user',\n priority: 0,\n });\n\n static readonly SCHEME_SET = new Set<string>([\n this.SUPER_ADMIN.identifier,\n this.ADMIN.identifier,\n this.USER.identifier,\n this.GUEST.identifier,\n this.UNKNOWN_USER.identifier,\n ]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n\nexport class AuthorizationDomainScopes {\n /** Grant applies in EVERY domain the subject is a member of (checked via join_domain / g2). */\n static readonly ANY_MEMBER = 'ANY_MEMBER';\n\n /** Grant applies system-wide, bypassing membership - super-admin only. */\n static readonly SYSTEM_WIDE = 'SYSTEM_WIDE';\n\n static readonly SCHEME_SET = new Set([this.ANY_MEMBER, this.SYSTEM_WIDE]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\nexport type TAuthorizationDomainScope = TConstValue<typeof AuthorizationDomainScopes>;\n\n/** Edge kinds in the `PolicyDefinition` table (each row: subject -> target, `variant` = kind), carrying `action` (DB `variant` value) + `rule` (casbin prefix emitted per edge). Per-USER edges: GRANT, ASSIGN_ROLE, JOIN_DOMAIN; shared org-structure edges: the *_INHERITS ones. */\nexport class AuthorizationPolicyVariants {\n /** Give a Permission to a User/Role (row also carries action / effect / domain). casbin `p`: `p, <Role|User>_<id>, <domain>, <permissionCode>, <action>, <allow|deny>` */\n static readonly GRANT = { action: 'grant', rule: CasbinRuleVariants.P } as const;\n\n /** Give a User a Role (optionally domain-scoped; no domain -> `*` = every domain). casbin `g`: `g, User_<id>, Role_<id>, <domain|*>` */\n static readonly ASSIGN_ROLE = { action: 'assign_role', rule: CasbinRuleVariants.G } as const;\n\n /** A Role inherits another Role (DAG). Shares `g` with ASSIGN_ROLE so user -> role -> parent-role resolves in one lookup. Emitted with domain `*`: `g, Role_<child>, Role_<parent>, *` */\n static readonly ROLE_INHERITS = { action: 'role_inherits', rule: CasbinRuleVariants.G } as const;\n\n /** User is a member of a Domain; powers the `ANY_MEMBER` grant scope via `g2(r.sub, r.dom)`. casbin `g2`: `g2, User_<id>, <Type>_<domainId>` */\n static readonly JOIN_DOMAIN = { action: 'join_domain', rule: CasbinRuleVariants.G2 } as const;\n\n /** DOMAIN axis (`dom`): domain nesting. Matcher: `g3(r.dom, p.dom)` + self-link so an exact domain always matches itself. casbin `g3`: `g3, <Type>_<childId>, <Type>_<parentId>` */\n static readonly DOMAIN_INHERITS = {\n action: 'domain_inherits',\n rule: CasbinRuleVariants.G3,\n } as const;\n\n /** RESOURCE axis (`obj`), NON-standard nesting only - dotted nesting (`Order.findById ⊂ Order`) is handled by `objectMatch` WITHOUT an edge. Matcher: `objectMatch(r.obj, p.obj) || g4(r.obj, p.obj)`, casbin `g4`: `g4, <childCode>, <parentCode>` */\n static readonly RESOURCE_INHERITS = {\n action: 'resource_inherits',\n rule: CasbinRuleVariants.G4,\n } as const;\n\n /** ACTION axis (`act`): a narrow action covered by a broader one; no dotted shortcut, so it needs an explicit edge. Matcher: `g5(r.act, p.act)`, casbin `g5`: `g5, <childAction>, <parentAction>`. g4 + g5 combine multiplicatively: `manage Order` covers a `read OrderItem` request. */\n static readonly ACTION_INHERITS = {\n action: 'action_inherits',\n rule: CasbinRuleVariants.G5,\n } as const;\n\n /** Every edge kind, in declaration order - the one place the scheme sets and the `variant` column's literal type both derive from. */\n static readonly ALL = [\n this.GRANT,\n this.ASSIGN_ROLE,\n this.ROLE_INHERITS,\n this.JOIN_DOMAIN,\n this.DOMAIN_INHERITS,\n this.RESOURCE_INHERITS,\n this.ACTION_INHERITS,\n ] as const;\n\n static readonly ACTION_SCHEME_SET = new Set(this.ALL.map((variant) => variant.action.toString()));\n\n static readonly RULE_SCHEME_SET = new Set(this.ALL.map((variant) => variant.rule.toString()));\n\n static isValidAction(input: string): boolean {\n return this.ACTION_SCHEME_SET.has(input);\n }\n\n static isValidRule(input: string): boolean {\n return this.RULE_SCHEME_SET.has(input);\n }\n}\n\n/** The `variant` column's full value set, derived from {@link AuthorizationPolicyVariants.ALL} - never hand-list the seven strings again. */\nexport type TAuthorizationPolicyVariant =\n (typeof AuthorizationPolicyVariants.ALL)[number]['action'];\n\n/** Where an `IAuthorizationDomainSource` reads the request domain from. */\nexport class AuthorizationDomainSources {\n static readonly PARAM = 'param';\n static readonly HEADER = 'header';\n static readonly QUERY = 'query';\n static readonly CONTEXT = 'context';\n\n static readonly SCHEME_SET = new Set<string>([this.PARAM, this.HEADER, this.QUERY, this.CONTEXT]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid authorization domain source values. */\nexport type TAuthorizationDomainSource = TConstValue<typeof AuthorizationDomainSources>;\n"]}
@@ -3,6 +3,7 @@ import type { TContext } from '../../../../controllers/common/types';
3
3
  import { type TNullable, type ValueOrPromise } from '@venizia/ignis-helpers/common';
4
4
  import type { Env } from 'hono';
5
5
  import type { IAuthUser } from '../../../authenticate/common/types';
6
+ import type { TAuthorizationDomainSource } from '../constants';
6
7
  export interface IAuthorizationRole {
7
8
  readonly name: string;
8
9
  readonly priority: number;
@@ -22,7 +23,7 @@ export interface IAuthorizationUser extends IAuthUser {
22
23
  }
23
24
  /** Declarative description of where to read the request domain from. */
24
25
  export interface IAuthorizationDomainSource {
25
- from: 'param' | 'header' | 'query' | 'context';
26
+ from: TAuthorizationDomainSource;
26
27
  key: string;
27
28
  type: string;
28
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../../../../src/base/auth/authorize/common/types/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,K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AC5E,MAAM,MAAM,4BAA4B,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE;IACrE,OAAO,EAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;CAC9B,KAAK,cAAc,CAAC,SAAS,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authorize/common/types/request.ts"],"names":[],"mappings":"","sourcesContent":["import type { IdType } from '@/base';\nimport type { TContext } from '@/base/controllers/common/types';\nimport { type TNullable, type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { Env } from 'hono';\nimport type { IAuthUser } from '../../../authenticate/common/types';\n\nexport interface IAuthorizationRole {\n readonly name: string;\n readonly priority: number;\n readonly identifier: string;\n}\n\n/** Key-value conditions for attribute-based access control. Values compared with strict equality. */\nexport type TAuthorizationConditions<\n KeyType extends string | symbol = string | symbol,\n ValueType = string | number | boolean | null,\n> = Record<KeyType, ValueType>;\n\nexport interface IAuthorizationRequest<TAction = string, TResource = string> {\n action: TAction;\n resource: TResource;\n conditions?: TAuthorizationConditions;\n /** Resolved domain scope for this request as a casbin domain string `\"<DomainType>_<id>\"` (e.g. `\"Merchant_7\"`), or the `\"SYSTEM_WIDE\"` sentinel to enforce across all domains. */\n domain?: string;\n}\n\nexport interface IAuthorizationUser extends IAuthUser {\n principalType: string;\n}\n\n/** Declarative description of where to read the request domain from. */\nexport interface IAuthorizationDomainSource {\n from: 'param' | 'header' | 'query' | 'context';\n key: string;\n type: string; // domain type, e.g. 'Merchant' | 'Organizer'\n}\n\n/** Returns the current request domain; null = no domain (→ SYSTEM_WIDE). */\nexport type TAuthorizationDomainResolver<E extends Env = Env> = (opts: {\n context: TContext<E, string>;\n}) => ValueOrPromise<TNullable<{ type: string; id: IdType }>>;\n"]}
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authorize/common/types/request.ts"],"names":[],"mappings":"","sourcesContent":["import type { IdType } from '@/base';\nimport type { TContext } from '@/base/controllers/common/types';\nimport { type TNullable, type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { Env } from 'hono';\nimport type { IAuthUser } from '../../../authenticate/common/types';\nimport type { TAuthorizationDomainSource } from '../constants';\n\nexport interface IAuthorizationRole {\n readonly name: string;\n readonly priority: number;\n readonly identifier: string;\n}\n\n/** Key-value conditions for attribute-based access control. Values compared with strict equality. */\nexport type TAuthorizationConditions<\n KeyType extends string | symbol = string | symbol,\n ValueType = string | number | boolean | null,\n> = Record<KeyType, ValueType>;\n\nexport interface IAuthorizationRequest<TAction = string, TResource = string> {\n action: TAction;\n resource: TResource;\n conditions?: TAuthorizationConditions;\n /** Resolved domain scope for this request as a casbin domain string `\"<DomainType>_<id>\"` (e.g. `\"Merchant_7\"`), or the `\"SYSTEM_WIDE\"` sentinel to enforce across all domains. */\n domain?: string;\n}\n\nexport interface IAuthorizationUser extends IAuthUser {\n principalType: string;\n}\n\n/** Declarative description of where to read the request domain from. */\nexport interface IAuthorizationDomainSource {\n from: TAuthorizationDomainSource;\n key: string;\n type: string; // domain type, e.g. 'Merchant' | 'Organizer'\n}\n\n/** Returns the current request domain; null = no domain (→ SYSTEM_WIDE). */\nexport type TAuthorizationDomainResolver<E extends Env = Env> = (opts: {\n context: TContext<E, string>;\n}) => ValueOrPromise<TNullable<{ type: string; id: IdType }>>;\n"]}
@@ -6,16 +6,16 @@ const constants_1 = require("../common/constants");
6
6
  const readDeclarative = (opts) => {
7
7
  const { source, context } = opts;
8
8
  switch (source.from) {
9
- case 'param': {
9
+ case constants_1.AuthorizationDomainSources.PARAM: {
10
10
  return context.req.param(source.key) ?? null;
11
11
  }
12
- case 'header': {
12
+ case constants_1.AuthorizationDomainSources.HEADER: {
13
13
  return context.req.header(source.key) ?? null;
14
14
  }
15
- case 'query': {
15
+ case constants_1.AuthorizationDomainSources.QUERY: {
16
16
  return context.req.query(source.key) ?? null;
17
17
  }
18
- case 'context': {
18
+ case constants_1.AuthorizationDomainSources.CONTEXT: {
19
19
  const value = context.get(source.key);
20
20
  return value == null ? null : String(value);
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"request-domain.js","sourceRoot":"","sources":["../../../../../../src/base/auth/authorize/providers/request-domain.ts"],"names":[],"mappings":";;;AAGA,mDAAgE;AAOhE,yEAAyE;AAClE,MAAM,eAAe,GAAG,CAAC,IAG/B,EAAqB,EAAE;IACtB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;QAC/C,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;QAChD,CAAC;QACD,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;QAC/C,CAAC;QACD,KAAK,SAAS,CAAC,CAAC,CAAC;YACf,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAU,CAAC,CAAC;YAC7C,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAvBW,QAAA,eAAe,mBAuB1B;AAEF,iMAAiM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TContext } from '@/base/controllers/common/types';\nimport type { TNullable } from '@venizia/ignis-helpers/common';\nimport type { Env } from 'hono';\nimport { AuthorizationDomainScopes } from '../common/constants';\nimport type {\n IAuthorizationDomainSource,\n IAuthorizationSpec,\n IAuthorizeOptions,\n} from '../common/types';\n\n/** Read a domain value from a declarative source on the Hono context. */\nexport const readDeclarative = (opts: {\n source: IAuthorizationDomainSource;\n context: TContext<Env, string>;\n}): TNullable<string> => {\n const { source, context } = opts;\n switch (source.from) {\n case 'param': {\n return context.req.param(source.key) ?? null;\n }\n case 'header': {\n return context.req.header(source.key) ?? null;\n }\n case 'query': {\n return context.req.query(source.key) ?? null;\n }\n case 'context': {\n const value = context.get(source.key as any);\n return value == null ? null : String(value);\n }\n default: {\n return null;\n }\n }\n};\n\n/** Resolve the request domain, precedence spec.domain (method | declarative) -> options.domainResolver -> SYSTEM_WIDE, as a casbin domain string (\"<type>_<id>\") or the SYSTEM_WIDE sentinel. */\nexport const resolveRequestDomain = async (opts: {\n spec: IAuthorizationSpec;\n context: TContext<Env, string>;\n options: TNullable<IAuthorizeOptions>;\n}): Promise<string> => {\n const { spec, context, options } = opts;\n\n if (typeof spec.domain === 'function') {\n const resolved = await spec.domain({ context });\n return resolved\n ? [resolved.type, resolved.id].join('_')\n : AuthorizationDomainScopes.SYSTEM_WIDE;\n }\n\n if (spec.domain) {\n const id = readDeclarative({ source: spec.domain, context });\n return id ? [spec.domain.type, id].join('_') : AuthorizationDomainScopes.SYSTEM_WIDE;\n }\n\n const globalResolver = options?.domainResolver ?? null;\n if (globalResolver) {\n const resolved = await globalResolver({ context });\n return resolved\n ? [resolved.type, resolved.id].join('_')\n : AuthorizationDomainScopes.SYSTEM_WIDE;\n }\n\n return AuthorizationDomainScopes.SYSTEM_WIDE;\n};\n"]}
1
+ {"version":3,"file":"request-domain.js","sourceRoot":"","sources":["../../../../../../src/base/auth/authorize/providers/request-domain.ts"],"names":[],"mappings":";;;AAGA,mDAA4F;AAO5F,yEAAyE;AACl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C,EAAE,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO,QAAQ;YACb,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YACxC,CAAC,CAAC,qCAAyB,CAAC,WAAW,CAAC;IAC5C,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,MAAM,EAAE,GAAG,IAAA,uBAAe,EAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7D,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,qCAAyB,CAAC,WAAW,CAAC;IACvF,CAAC;IAED,MAAM,cAAc,GAAG,OAAO,EAAE,cAAc,IAAI,IAAI,CAAC;IACvD,IAAI,cAAc,EAAE,CAAC;QACnB,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QACnD,OAAO,QAAQ;YACb,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YACxC,CAAC,CAAC,qCAAyB,CAAC,WAAW,CAAC;IAC5C,CAAC;IAED,OAAO,qCAAyB,CAAC,WAAW,CAAC;AAC/C,CAAC,CAAC;AA5BW,QAAA,oBAAoB,wBA4B/B","sourcesContent":["import type { TContext } from '@/base/controllers/common/types';\nimport type { TNullable } from '@venizia/ignis-helpers/common';\nimport type { Env } from 'hono';\nimport { AuthorizationDomainScopes, AuthorizationDomainSources } from '../common/constants';\nimport type {\n IAuthorizationDomainSource,\n IAuthorizationSpec,\n IAuthorizeOptions,\n} from '../common/types';\n\n/** Read a domain value from a declarative source on the Hono context. */\nexport const readDeclarative = (opts: {\n source: IAuthorizationDomainSource;\n context: TContext<Env, string>;\n}): TNullable<string> => {\n const { source, context } = opts;\n switch (source.from) {\n case AuthorizationDomainSources.PARAM: {\n return context.req.param(source.key) ?? null;\n }\n case AuthorizationDomainSources.HEADER: {\n return context.req.header(source.key) ?? null;\n }\n case AuthorizationDomainSources.QUERY: {\n return context.req.query(source.key) ?? null;\n }\n case AuthorizationDomainSources.CONTEXT: {\n const value = context.get(source.key as any);\n return value == null ? null : String(value);\n }\n default: {\n return null;\n }\n }\n};\n\n/** Resolve the request domain, precedence spec.domain (method | declarative) -> options.domainResolver -> SYSTEM_WIDE, as a casbin domain string (\"<type>_<id>\") or the SYSTEM_WIDE sentinel. */\nexport const resolveRequestDomain = async (opts: {\n spec: IAuthorizationSpec;\n context: TContext<Env, string>;\n options: TNullable<IAuthorizeOptions>;\n}): Promise<string> => {\n const { spec, context, options } = opts;\n\n if (typeof spec.domain === 'function') {\n const resolved = await spec.domain({ context });\n return resolved\n ? [resolved.type, resolved.id].join('_')\n : AuthorizationDomainScopes.SYSTEM_WIDE;\n }\n\n if (spec.domain) {\n const id = readDeclarative({ source: spec.domain, context });\n return id ? [spec.domain.type, id].join('_') : AuthorizationDomainScopes.SYSTEM_WIDE;\n }\n\n const globalResolver = options?.domainResolver ?? null;\n if (globalResolver) {\n const resolved = await globalResolver({ context });\n return resolved\n ? [resolved.type, resolved.id].join('_')\n : AuthorizationDomainScopes.SYSTEM_WIDE;\n }\n\n return AuthorizationDomainScopes.SYSTEM_WIDE;\n};\n"]}
@@ -27,4 +27,14 @@ export declare class RestPaths {
27
27
  }
28
28
  export declare const commonResponseHeaders: TResponseHeaders;
29
29
  export declare const findResponseHeaders: TResponseHeaders;
30
+ /** Which decorator-defined routes `registerRoutesFromRegistry` registers: STATIC (no path parameter), PARAM (a path parameter) or ALL. */
31
+ export declare class RoutePathScopes {
32
+ static readonly STATIC = "static";
33
+ static readonly PARAM = "param";
34
+ static readonly ALL = "all";
35
+ static readonly SCHEME_SET: Set<string>;
36
+ static isValid(value: string): boolean;
37
+ }
38
+ /** Valid route path scope values. */
39
+ export type TRoutePathScope = TConstValue<typeof RoutePathScopes>;
30
40
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/base/controllers/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;;GAIG;AAEH,oDAAoD;AACpD,qBAAa,oBAAoB;IAC/B,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAC9B,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;CAC/B;AAED,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE5E,iGAAiG;AACjG,qBAAa,eAAe;IAC1B,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAEhC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAA8C;IAExE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,eAAe,CAAC,CAAC;AAElE,6DAA6D;AAC7D,qBAAa,SAAS;IACpB,MAAM,CAAC,QAAQ,CAAC,IAAI,OAAO;IAC3B,MAAM,CAAC,QAAQ,CAAC,KAAK,YAAY;IACjC,MAAM,CAAC,QAAQ,CAAC,QAAQ,eAAe;CACxC;AAED,eAAO,MAAM,qBAAqB,EAAE,gBAanC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,gBAMjC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/base/controllers/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW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@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findResponseHeaders = exports.commonResponseHeaders = exports.RestPaths = exports.ResponseFormats = exports.ControllerTransports = void 0;
3
+ exports.RoutePathScopes = exports.findResponseHeaders = exports.commonResponseHeaders = exports.RestPaths = exports.ResponseFormats = exports.ControllerTransports = void 0;
4
4
  const common_1 = require("@venizia/ignis-helpers/common");
5
5
  /**
6
6
  * Constants with NO zod import, deliberately. The container's controller mixin imports
@@ -51,4 +51,15 @@ exports.findResponseHeaders = {
51
51
  schema: { type: 'string', examples: ['records 0-24/100', 'records 25-49/100'] },
52
52
  },
53
53
  };
54
+ /** Which decorator-defined routes `registerRoutesFromRegistry` registers: STATIC (no path parameter), PARAM (a path parameter) or ALL. */
55
+ class RoutePathScopes {
56
+ static { this.STATIC = 'static'; }
57
+ static { this.PARAM = 'param'; }
58
+ static { this.ALL = 'all'; }
59
+ static { this.SCHEME_SET = new Set([this.STATIC, this.PARAM, this.ALL]); }
60
+ static isValid(value) {
61
+ return this.SCHEME_SET.has(value);
62
+ }
63
+ }
64
+ exports.RoutePathScopes = RoutePathScopes;
54
65
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/controllers/common/constants.ts"],"names":[],"mappings":";;;AACA,0DAAqD;AAGrD;;;;GAIG;AAEH,oDAAoD;AACpD,MAAa,oBAAoB;aACf,SAAI,GAAG,MAAM,CAAC;aACd,SAAI,GAAG,MAAM,CAAC;;AAFhC,oDAGC;AAID,iGAAiG;AACjG,MAAa,eAAe;aACV,WAAM,GAAG,QAAQ,CAAC;aAClB,UAAK,GAAG,OAAO,CAAC;aAEhB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAExE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AARH,0CASC;AAID,6DAA6D;AAC7D,MAAa,SAAS;aACJ,SAAI,GAAG,GAAG,CAAC;aACX,UAAK,GAAG,QAAQ,CAAC;aACjB,aAAQ,GAAG,WAAW,CAAC;;AAHzC,8BAIC;AAEY,QAAA,qBAAqB,GAAqB;IACrD,CAAC,aAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;QACjC,WAAW,EAAE,gCAAgC;QAC7C,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC3B;IACD,CAAC,aAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE;QAClC,WAAW,EAAE,+BAA+B;QAC5C,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE;KACzD;IACD,CAAC,aAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;QAC9B,WAAW,EAAE,2BAA2B;QACxC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;KAC1D;CACF,CAAC;AAEW,QAAA,mBAAmB,GAAqB;IACnD,GAAG,6BAAqB;IACxB,CAAC,aAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QAC5B,WAAW,EAAE,yDAAyD;QACtE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,EAAE;KAChF;CACF,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport type { TResponseHeaders } from './types';\n\n/**\n * Constants with NO zod import, deliberately. The container's controller mixin imports\n * `ControllerTransports` from here, so anything this file pulls in reaches every consumer of\n * `Container` - the request schemas live in `schemas.ts` for exactly that reason.\n */\n\n/** Transport protocol constants for controllers. */\nexport class ControllerTransports {\n static readonly REST = 'rest';\n static readonly GRPC = 'grpc';\n}\n\nexport type TControllerTransport = TConstValue<typeof ControllerTransports>;\n\n/** Shape of `data` in a `{ count, data }` response, echoed in the `X-Response-Format` header. */\nexport class ResponseFormats {\n static readonly OBJECT = 'object';\n static readonly ARRAY = 'array';\n\n static readonly SCHEME_SET = new Set<string>([this.OBJECT, this.ARRAY]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type TResponseFormat = TConstValue<typeof ResponseFormats>;\n\n/** Standard REST API path constants for CRUD controllers. */\nexport class RestPaths {\n static readonly ROOT = '/';\n static readonly COUNT = '/count';\n static readonly FIND_ONE = '/find-one';\n}\n\nexport const commonResponseHeaders: TResponseHeaders = {\n [HTTP.Headers.REQUEST_TRACING_ID]: {\n description: 'Echo of the request tracing ID',\n schema: { type: 'string' },\n },\n [HTTP.Headers.RESPONSE_COUNT_DATA]: {\n description: 'Number of records in response',\n schema: { type: 'string', examples: ['1', '10', '100'] },\n },\n [HTTP.Headers.RESPONSE_FORMAT]: {\n description: 'Response format indicator',\n schema: { type: 'string', examples: ['array', 'object'] },\n },\n};\n\nexport const findResponseHeaders: TResponseHeaders = {\n ...commonResponseHeaders,\n [HTTP.Headers.CONTENT_RANGE]: {\n description: 'Content range for pagination (e.g., \"records 0-24/100\")',\n schema: { type: 'string', examples: ['records 0-24/100', 'records 25-49/100'] },\n },\n};\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/controllers/common/constants.ts"],"names":[],"mappings":";;;AACA,0DAAqD;AAGrD;;;;GAIG;AAEH,oDAAoD;AACpD,MAAa,oBAAoB;aACf,SAAI,GAAG,MAAM,CAAC;aACd,SAAI,GAAG,MAAM,CAAC;;AAFhC,oDAGC;AAID,iGAAiG;AACjG,MAAa,eAAe;aACV,WAAM,GAAG,QAAQ,CAAC;aAClB,UAAK,G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eAAe;aACV,WAAM,GAAG,QAAQ,CAAC;aAClB,UAAK,GAAG,OAAO,CAAC;aAChB,QAAG,GAAG,KAAK,CAAC;aAEZ,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAElF,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AATH,0CAUC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport type { TResponseHeaders } from './types';\n\n/**\n * Constants with NO zod import, deliberately. The container's controller mixin imports\n * `ControllerTransports` from here, so anything this file pulls in reaches every consumer of\n * `Container` - the request schemas live in `schemas.ts` for exactly that reason.\n */\n\n/** Transport protocol constants for controllers. */\nexport class ControllerTransports {\n static readonly REST = 'rest';\n static readonly GRPC = 'grpc';\n}\n\nexport type TControllerTransport = TConstValue<typeof ControllerTransports>;\n\n/** Shape of `data` in a `{ count, data }` response, echoed in the `X-Response-Format` header. */\nexport class ResponseFormats {\n static readonly OBJECT = 'object';\n static readonly ARRAY = 'array';\n\n static readonly SCHEME_SET = new Set<string>([this.OBJECT, this.ARRAY]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type TResponseFormat = TConstValue<typeof ResponseFormats>;\n\n/** Standard REST API path constants for CRUD controllers. */\nexport class RestPaths {\n static readonly ROOT = '/';\n static readonly COUNT = '/count';\n static readonly FIND_ONE = '/find-one';\n}\n\nexport const commonResponseHeaders: TResponseHeaders = {\n [HTTP.Headers.REQUEST_TRACING_ID]: {\n description: 'Echo of the request tracing ID',\n schema: { type: 'string' },\n },\n [HTTP.Headers.RESPONSE_COUNT_DATA]: {\n description: 'Number of records in response',\n schema: { type: 'string', examples: ['1', '10', '100'] },\n },\n [HTTP.Headers.RESPONSE_FORMAT]: {\n description: 'Response format indicator',\n schema: { type: 'string', examples: ['array', 'object'] },\n },\n};\n\nexport const findResponseHeaders: TResponseHeaders = {\n ...commonResponseHeaders,\n [HTTP.Headers.CONTENT_RANGE]: {\n description: 'Content range for pagination (e.g., \"records 0-24/100\")',\n schema: { type: 'string', examples: ['records 0-24/100', 'records 25-49/100'] },\n },\n};\n\n/** Which decorator-defined routes `registerRoutesFromRegistry` registers: STATIC (no path parameter), PARAM (a path parameter) or ALL. */\nexport class RoutePathScopes {\n static readonly STATIC = 'static';\n static readonly PARAM = 'param';\n static readonly ALL = 'all';\n\n static readonly SCHEME_SET = new Set<string>([this.STATIC, this.PARAM, this.ALL]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid route path scope values. */\nexport type TRoutePathScope = TConstValue<typeof RoutePathScopes>;\n"]}
@@ -176,7 +176,7 @@ export declare class ControllerFactory extends BaseHelper {
176
176
  definitions: Record<string, import("../common").IAuthRouteConfig>;
177
177
  getRouter(): import("@hono/zod-openapi").OpenAPIHono<RouteEnv, RouteSchema, BasePath>;
178
178
  registerRoutesFromRegistry(opts?: {
179
- paths?: "static" | "param" | "all";
179
+ paths?: import("../common").TRoutePathScope;
180
180
  }): void;
181
181
  configure(opts?: ConfigurableOptions | undefined): Promise<import("@hono/zod-openapi").OpenAPIHono<RouteEnv, RouteSchema, BasePath>>;
182
182
  buildRouteMiddlewares<RouteConfig extends import("../common").IAuthRouteConfig>(opts: {
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../../../src/base/controllers/factory/controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAXG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmGjD"}
@@ -1,3 +1,4 @@
1
+ import { type TRoutePathScope } from '../common/constants';
1
2
  import type { Hook } from '@hono/zod-openapi';
2
3
  import { OpenAPIHono } from '@hono/zod-openapi';
3
4
  import type { ValueOrPromise } from '@venizia/ignis-helpers/common';
@@ -15,7 +16,7 @@ export declare abstract class AbstractRestController<RouteEnv extends Env = Env,
15
16
  getRouter(): OpenAPIHono<RouteEnv, RouteSchema, BasePath>;
16
17
  /** Registers decorator-defined routes from the metadata registry; `paths` selects them by shape - see the two-phase call in {@link configure}. */
17
18
  registerRoutesFromRegistry(opts?: {
18
- paths?: 'static' | 'param' | 'all';
19
+ paths?: TRoutePathScope;
19
20
  }): void;
20
21
  /** Configures the controller by binding all routes and registering decorator-based routes. Idempotent. */
21
22
  configure(opts?: ConfigurableOptions): Promise<OpenAPIHono<RouteEnv, RouteSchema, BasePath>>;
@@ -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,GA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OAAO,EAAE,WAAW,CAAC;KACtB,GAAG,iBAAiB,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC;IAEnE,uEAAuE;IACvE,QAAQ,CAAC,WAAW,CAAC,WAAW,SAAS,gBAAgB,EAAE,YAAY,GAAG,OAAO,EAAE,IAAI,EAAE;QACvF,OAAO,EAAE,WAAW,CAAC;QACrB,OAAO,EAAE,aAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAC/C,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;KACzD,GAAG,mBAAmB,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC;CACtE"}
@@ -8,6 +8,7 @@ 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,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,GAAG,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;YAC3B,QAAQ;SACT,CAAQ,CACV,CAAC;IACJ,CAAC;IAED,4EAA4E;IAC5E,kBAAkB,CAAuC,IAA8B;QACrF,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QACvE,MAAM,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,UAAU,CAAC;QAE5C,qEAAqE;QACrE,OAAO,IAAA,yBAAW,EAChB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE;YAC5B,UAAU,EAAE,GAAG;YACf,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAA,4BAAY,EAAC,EAAE,WAAW,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":";;;AAAA,yEAAgF;AAChF,0GAA8G;AAE9G,iGAAkG;AAClG,4FAAgG;AAChG,6FAAuG;AACvG,0DAAuE;AACvE,2DAAgE;AAChE,mEAA4F;AAC5F,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,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AAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QACvE,MAAM,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,UAAU,CAAC;QAE5C,qEAAqE;QACrE,OAAO,IAAA,yBAAW,EAChB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE;YAC5B,UAAU,EAAE,GAAG;YACf,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAA,4BAAY,EAAC,EAAE,WAAW,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;AA3MD,wDA2MC","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 { 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,EAAE,GAAG,QAAQ,CAAC;IAElD,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,sBAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,IAAA,eAAQ,EAAC;YACb,OAAO,EAAE,WAAW,KAAK,uCAAuC,CAAC,GAAG,sBAAU,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,6BAA6B,MAAM,CAAC,IAAI,CAAC,EAAE;SACjJ,CAAC,CAAC;IACL,CAAC;IAED,IAAI,WAAW,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QACzD,MAAM,IAAA,eAAQ,EAAC;YACb,OAAO,EAAE,WAAW,KAAK,mJAAmJ;SAC7K,CAAC,CAAC;IACL,CAAC;IAED,IAAI,WAAW,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QACzD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,kBAAkB,GAA+B,EAAE,CAAC;IAC1D,IAAI,GAAY,CAAC;IAEjB,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,GAAG,GAAG,CAAC,WAAW,CAAC;QACnB,kBAAkB,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,2BAA2B,EAAE,CAAC,CAAC;IACpF,CAAC;SAAM,CAAC;QACN,GAAG,GAAG,SAAS,EAAE,GAAG,KAAK,KAAK,CAAC;IACjC,CAAC;IAED,OAAO;QACL,GAAG,QAAQ;QACX,SAAS,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,EAAE;QAChC,WAAW,EAAE,CAAC,GAAG;QACjB,GAAG,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC;AACJ,CAAC,CAAC;AAvCW,QAAA,sBAAsB,0BAuCjC","sourcesContent":["import { getError } from '@venizia/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"]}
@@ -1,21 +1,11 @@
1
- import type { IDeprecatedModelSetting, IModelSettings } from '../../helpers/inversion';
2
- /** The release that drops the deprecated keys. */
3
- export declare const DEPRECATED_MODEL_SETTINGS_REMOVED_IN = "0.4.3";
4
1
  /**
5
- * The one place the old flat settings become the new grouped ones. Everything that reads model
6
- * settings reads the result, so no reader knows two shapes.
7
- *
8
- * - `defaultFilter` -> `query.filter`; `defaultLimit` -> `query.limit.default`; `maxLimit` ->
9
- * `query.limit.max`; `scopeFilter` -> `access` (`writeGuard` -> `access.write.mode`, `sharedRows`
10
- * -> `access.write.sharedRows`).
11
- * - An old key together with the key that replaces it is an error.
12
- * - Returns the old keys in use so the application can warn once at boot.
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.
13
6
  */
14
- export declare const normalizeModelSettings: (opts: {
7
+ export declare const assertNoRemovedModelSettings: (opts: {
15
8
  model: string;
16
- settings: IModelSettings | undefined;
17
- }) => {
18
- settings: IModelSettings | undefined;
19
- deprecated: IDeprecatedModelSetting[];
20
- };
9
+ settings: object | undefined;
10
+ }) => void;
21
11
  //# sourceMappingURL=model-settings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-settings.d.ts","sourceRoot":"","sources":["../../../../src/base/metadata/model-settings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uBAAuB,EAEvB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAE7B,kDAAkD;AAClD,eAAO,MAAM,oCAAoC,UAAU,CAAC;AAQ5D;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAC;CACtC,KAAG;IAAE,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAC;IAAC,UAAU,EAAE,uBAAuB,EAAE,CAAA;CAmEhF,CAAC"}
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"}