@venizia/ignis-kernel 0.4.8-0 → 0.4.8-2

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 (191) hide show
  1. package/README.md +5 -4
  2. package/dist/esm/base/applications/abstract.d.ts +1 -0
  3. package/dist/esm/base/applications/abstract.js +1 -0
  4. package/dist/esm/base/applications/abstract.js.map +1 -1
  5. package/dist/esm/base/applications/boot-sequence.d.ts +2 -0
  6. package/dist/esm/base/applications/boot-sequence.js.map +1 -1
  7. package/dist/esm/base/applications/common/constants.d.ts +2 -0
  8. package/dist/esm/base/applications/common/constants.js +1 -0
  9. package/dist/esm/base/applications/common/constants.js.map +1 -1
  10. package/dist/esm/base/applications/common/types/application.d.ts +30 -8
  11. package/dist/esm/base/applications/common/types/application.js.map +1 -1
  12. package/dist/esm/base/applications/common/types/middlewares.d.ts +16 -1
  13. package/dist/esm/base/applications/common/types/middlewares.js.map +1 -1
  14. package/dist/esm/base/auth/authenticate/common/codecs.d.ts +1 -0
  15. package/dist/esm/base/auth/authenticate/common/codecs.js +1 -0
  16. package/dist/esm/base/auth/authenticate/common/codecs.js.map +1 -1
  17. package/dist/esm/base/auth/authenticate/common/constants/authentication.d.ts +6 -0
  18. package/dist/esm/base/auth/authenticate/common/constants/authentication.js +4 -0
  19. package/dist/esm/base/auth/authenticate/common/constants/authentication.js.map +1 -1
  20. package/dist/esm/base/auth/authenticate/common/constants/jose.d.ts +8 -0
  21. package/dist/esm/base/auth/authenticate/common/constants/jose.js +4 -0
  22. package/dist/esm/base/auth/authenticate/common/constants/jose.js.map +1 -1
  23. package/dist/esm/base/auth/authenticate/common/keys.d.ts +1 -0
  24. package/dist/esm/base/auth/authenticate/common/keys.js +1 -0
  25. package/dist/esm/base/auth/authenticate/common/keys.js.map +1 -1
  26. package/dist/esm/base/auth/authenticate/common/types/basic.d.ts +1 -0
  27. package/dist/esm/base/auth/authenticate/common/types/basic.js.map +1 -1
  28. package/dist/esm/base/auth/authenticate/common/types/jwt.d.ts +42 -0
  29. package/dist/esm/base/auth/authenticate/common/types/jwt.js.map +1 -1
  30. package/dist/esm/base/auth/authenticate/common/types/rest.d.ts +2 -0
  31. package/dist/esm/base/auth/authenticate/common/types/rest.js.map +1 -1
  32. package/dist/esm/base/auth/authenticate/common/types/service.d.ts +10 -1
  33. package/dist/esm/base/auth/authenticate/common/types/service.js.map +1 -1
  34. package/dist/esm/base/auth/authenticate/common/types/strategy.d.ts +5 -0
  35. package/dist/esm/base/auth/authenticate/common/types/strategy.js.map +1 -1
  36. package/dist/esm/base/auth/authenticate/middlewares/authenticate.middleware.d.ts +1 -0
  37. package/dist/esm/base/auth/authenticate/middlewares/authenticate.middleware.js +1 -0
  38. package/dist/esm/base/auth/authenticate/middlewares/authenticate.middleware.js.map +1 -1
  39. package/dist/esm/base/auth/authenticate/providers/authentication.provider.d.ts +5 -0
  40. package/dist/esm/base/auth/authenticate/providers/authentication.provider.js +5 -0
  41. package/dist/esm/base/auth/authenticate/providers/authentication.provider.js.map +1 -1
  42. package/dist/esm/base/auth/authenticate/strategies/strategy-registry.d.ts +1 -0
  43. package/dist/esm/base/auth/authenticate/strategies/strategy-registry.js +1 -0
  44. package/dist/esm/base/auth/authenticate/strategies/strategy-registry.js.map +1 -1
  45. package/dist/esm/base/auth/authorize/builders/grant.builder.d.ts +1 -0
  46. package/dist/esm/base/auth/authorize/builders/grant.builder.js +1 -0
  47. package/dist/esm/base/auth/authorize/builders/grant.builder.js.map +1 -1
  48. package/dist/esm/base/auth/authorize/builders/policy.builder.d.ts +1 -0
  49. package/dist/esm/base/auth/authorize/builders/policy.builder.js +1 -0
  50. package/dist/esm/base/auth/authorize/builders/policy.builder.js.map +1 -1
  51. package/dist/esm/base/auth/authorize/common/constants/authorization.d.ts +8 -0
  52. package/dist/esm/base/auth/authorize/common/constants/authorization.js +5 -0
  53. package/dist/esm/base/auth/authorize/common/constants/authorization.js.map +1 -1
  54. package/dist/esm/base/auth/authorize/common/constants/binding-keys.d.ts +1 -0
  55. package/dist/esm/base/auth/authorize/common/constants/binding-keys.js +1 -0
  56. package/dist/esm/base/auth/authorize/common/constants/binding-keys.js.map +1 -1
  57. package/dist/esm/base/auth/authorize/common/constants/enforcer.d.ts +9 -0
  58. package/dist/esm/base/auth/authorize/common/constants/enforcer.js +4 -0
  59. package/dist/esm/base/auth/authorize/common/constants/enforcer.js.map +1 -1
  60. package/dist/esm/base/auth/authorize/common/types/enforcer.d.ts +21 -3
  61. package/dist/esm/base/auth/authorize/common/types/enforcer.js.map +1 -1
  62. package/dist/esm/base/auth/authorize/common/types/grant.d.ts +1 -0
  63. package/dist/esm/base/auth/authorize/common/types/grant.js.map +1 -1
  64. package/dist/esm/base/auth/authorize/common/types/request.d.ts +3 -0
  65. package/dist/esm/base/auth/authorize/common/types/request.js.map +1 -1
  66. package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.d.ts +1 -0
  67. package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.js +1 -0
  68. package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.js.map +1 -1
  69. package/dist/esm/base/auth/authorize/middlewares/authorize.middleware.d.ts +1 -0
  70. package/dist/esm/base/auth/authorize/middlewares/authorize.middleware.js +1 -0
  71. package/dist/esm/base/auth/authorize/middlewares/authorize.middleware.js.map +1 -1
  72. package/dist/esm/base/auth/authorize/models/authorization-role.model.d.ts +6 -0
  73. package/dist/esm/base/auth/authorize/models/authorization-role.model.js +1 -0
  74. package/dist/esm/base/auth/authorize/models/authorization-role.model.js.map +1 -1
  75. package/dist/esm/base/auth/authorize/providers/authorization.provider.d.ts +1 -0
  76. package/dist/esm/base/auth/authorize/providers/authorization.provider.js +1 -0
  77. package/dist/esm/base/auth/authorize/providers/authorization.provider.js.map +1 -1
  78. package/dist/esm/base/auth/base/abstract-auth-registry.d.ts +2 -0
  79. package/dist/esm/base/auth/base/abstract-auth-registry.js +1 -0
  80. package/dist/esm/base/auth/base/abstract-auth-registry.js.map +1 -1
  81. package/dist/esm/base/auth/models/requests/change-password.schema.d.ts +2 -0
  82. package/dist/esm/base/auth/models/requests/change-password.schema.js +1 -0
  83. package/dist/esm/base/auth/models/requests/change-password.schema.js.map +1 -1
  84. package/dist/esm/base/auth/models/requests/sign-in.schema.d.ts +2 -0
  85. package/dist/esm/base/auth/models/requests/sign-in.schema.js +1 -0
  86. package/dist/esm/base/auth/models/requests/sign-in.schema.js.map +1 -1
  87. package/dist/esm/base/auth/models/requests/sign-up.schema.d.ts +2 -0
  88. package/dist/esm/base/auth/models/requests/sign-up.schema.js +1 -0
  89. package/dist/esm/base/auth/models/requests/sign-up.schema.js.map +1 -1
  90. package/dist/esm/base/components/base.d.ts +1 -0
  91. package/dist/esm/base/components/base.js +1 -0
  92. package/dist/esm/base/components/base.js.map +1 -1
  93. package/dist/esm/base/components/controller/rest/common/types.d.ts +2 -0
  94. package/dist/esm/base/components/controller/rest/common/types.js +1 -0
  95. package/dist/esm/base/components/controller/rest/common/types.js.map +1 -1
  96. package/dist/esm/base/configurations/base.d.ts +1 -0
  97. package/dist/esm/base/configurations/base.js +1 -0
  98. package/dist/esm/base/configurations/base.js.map +1 -1
  99. package/dist/esm/base/configurations/common/types.d.ts +1 -0
  100. package/dist/esm/base/configurations/common/types.js.map +1 -1
  101. package/dist/esm/base/controllers/common/constants.d.ts +4 -0
  102. package/dist/esm/base/controllers/common/constants.js +2 -0
  103. package/dist/esm/base/controllers/common/constants.js.map +1 -1
  104. package/dist/esm/base/controllers/common/schema-builders.d.ts +3 -0
  105. package/dist/esm/base/controllers/common/schema-builders.js +1 -0
  106. package/dist/esm/base/controllers/common/schema-builders.js.map +1 -1
  107. package/dist/esm/base/controllers/common/schemas.d.ts +2 -0
  108. package/dist/esm/base/controllers/common/schemas.js +2 -0
  109. package/dist/esm/base/controllers/common/schemas.js.map +1 -1
  110. package/dist/esm/base/controllers/common/types/context.d.ts +2 -0
  111. package/dist/esm/base/controllers/common/types/context.js.map +1 -1
  112. package/dist/esm/base/controllers/common/types/controller.d.ts +5 -1
  113. package/dist/esm/base/controllers/common/types/controller.js.map +1 -1
  114. package/dist/esm/base/controllers/common/types/route.d.ts +7 -1
  115. package/dist/esm/base/controllers/common/types/route.js.map +1 -1
  116. package/dist/esm/base/datasources/common/types.d.ts +5 -0
  117. package/dist/esm/base/datasources/common/types.js +1 -0
  118. package/dist/esm/base/datasources/common/types.js.map +1 -1
  119. package/dist/esm/base/events/common/constants.d.ts +4 -0
  120. package/dist/esm/base/events/common/constants.js +3 -0
  121. package/dist/esm/base/events/common/constants.js.map +1 -1
  122. package/dist/esm/base/events/common/types.d.ts +10 -2
  123. package/dist/esm/base/events/common/types.js.map +1 -1
  124. package/dist/esm/base/metadata/injectable.d.ts +46 -0
  125. package/dist/esm/base/metadata/injectable.js +46 -0
  126. package/dist/esm/base/metadata/injectable.js.map +1 -1
  127. package/dist/esm/base/metadata/persistents.d.ts +47 -2
  128. package/dist/esm/base/metadata/persistents.js +47 -2
  129. package/dist/esm/base/metadata/persistents.js.map +1 -1
  130. package/dist/esm/base/metadata/routes/controller.d.ts +17 -0
  131. package/dist/esm/base/metadata/routes/controller.js +17 -0
  132. package/dist/esm/base/metadata/routes/controller.js.map +1 -1
  133. package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.d.ts +1 -0
  134. package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.js +1 -0
  135. package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.js.map +1 -1
  136. package/dist/esm/base/middlewares/not-found/not-found.middleware.d.ts +1 -0
  137. package/dist/esm/base/middlewares/not-found/not-found.middleware.js +1 -0
  138. package/dist/esm/base/middlewares/not-found/not-found.middleware.js.map +1 -1
  139. package/dist/esm/base/mixins/common/types.d.ts +14 -1
  140. package/dist/esm/base/mixins/common/types.js.map +1 -1
  141. package/dist/esm/base/models/common/constants.d.ts +2 -0
  142. package/dist/esm/base/models/common/constants.js +1 -0
  143. package/dist/esm/base/models/common/constants.js.map +1 -1
  144. package/dist/esm/base/models/common/schemas.d.ts +1 -0
  145. package/dist/esm/base/models/common/schemas.js.map +1 -1
  146. package/dist/esm/base/models/common/types/id.d.ts +4 -0
  147. package/dist/esm/base/models/common/types/id.js.map +1 -1
  148. package/dist/esm/base/providers/base.d.ts +1 -0
  149. package/dist/esm/base/providers/base.js +1 -0
  150. package/dist/esm/base/providers/base.js.map +1 -1
  151. package/dist/esm/base/repositories/common/constants.d.ts +2 -2
  152. package/dist/esm/base/repositories/common/constants.js +2 -2
  153. package/dist/esm/base/repositories/common/constants.js.map +1 -1
  154. package/dist/esm/base/repositories/common/scope-through.d.ts +18 -1
  155. package/dist/esm/base/repositories/common/scope-through.js +18 -1
  156. package/dist/esm/base/repositories/common/scope-through.js.map +1 -1
  157. package/dist/esm/base/repositories/common/types/options.d.ts +10 -4
  158. package/dist/esm/base/repositories/common/types/options.js.map +1 -1
  159. package/dist/esm/base/repositories/query-schemas/index.d.ts +18 -3
  160. package/dist/esm/base/repositories/query-schemas/index.js +17 -1
  161. package/dist/esm/base/repositories/query-schemas/index.js.map +1 -1
  162. package/dist/esm/base/request-context/registry.d.ts +1 -0
  163. package/dist/esm/base/request-context/registry.js +1 -0
  164. package/dist/esm/base/request-context/registry.js.map +1 -1
  165. package/dist/esm/base/services/base.d.ts +1 -0
  166. package/dist/esm/base/services/base.js +1 -0
  167. package/dist/esm/base/services/base.js.map +1 -1
  168. package/dist/esm/base/services/common/types.d.ts +1 -0
  169. package/dist/esm/base/services/common/types.js.map +1 -1
  170. package/dist/esm/common/bindings.d.ts +1 -0
  171. package/dist/esm/common/bindings.js.map +1 -1
  172. package/dist/esm/common/error-codes.d.ts +2 -0
  173. package/dist/esm/common/error-codes.js.map +1 -1
  174. package/dist/esm/helpers/inversion/common/keys.d.ts +1 -0
  175. package/dist/esm/helpers/inversion/common/keys.js +1 -0
  176. package/dist/esm/helpers/inversion/common/keys.js.map +1 -1
  177. package/dist/esm/helpers/inversion/common/relation-builder.d.ts +1 -0
  178. package/dist/esm/helpers/inversion/common/relation-builder.js +1 -0
  179. package/dist/esm/helpers/inversion/common/relation-builder.js.map +1 -1
  180. package/dist/esm/helpers/inversion/common/types/artifact.d.ts +9 -2
  181. package/dist/esm/helpers/inversion/common/types/artifact.js.map +1 -1
  182. package/dist/esm/helpers/inversion/common/types/controller.d.ts +4 -0
  183. package/dist/esm/helpers/inversion/common/types/controller.js.map +1 -1
  184. package/dist/esm/helpers/inversion/common/types/model.d.ts +80 -8
  185. package/dist/esm/helpers/inversion/common/types/model.js.map +1 -1
  186. package/dist/esm/helpers/inversion/common/types/persistence.d.ts +9 -1
  187. package/dist/esm/helpers/inversion/common/types/persistence.js.map +1 -1
  188. package/dist/esm/helpers/inversion/container.d.ts +1 -0
  189. package/dist/esm/helpers/inversion/container.js +1 -0
  190. package/dist/esm/helpers/inversion/container.js.map +1 -1
  191. package/package.json +5 -5
@@ -5,7 +5,23 @@ import { z } from '@hono/zod-openapi';
5
5
  const openApiDecorator = (schema, metadata) => {
6
6
  return schema.openapi(metadata);
7
7
  };
8
- export const { FieldsSchema, FilterSchema, InclusionSchema, LimitSchema, OffsetSchema, OrderBySchema, SkipSchema, WhereSchema, } = QuerySchemaFactory.build({ decorate: openApiDecorator });
8
+ const schemas = QuerySchemaFactory.build({ decorate: openApiDecorator });
9
+ /** Selected fields: an array of names to include, or a name-to-boolean map. */
10
+ export const FieldsSchema = schemas.FieldsSchema;
11
+ /** The whole `filter` query: an object of where, fields, include, order, limit, offset and skip, or a JSON string of one. */
12
+ export const FilterSchema = schemas.FilterSchema;
13
+ /** Relations to include: an array of `{ relation, scope? }` where `scope` is a nested filter. */
14
+ export const InclusionSchema = schemas.InclusionSchema;
15
+ /** Maximum number of rows; a non-negative integer. */
16
+ export const LimitSchema = schemas.LimitSchema;
17
+ /** Number of rows to offset; a non-negative integer. */
18
+ export const OffsetSchema = schemas.OffsetSchema;
19
+ /** Sort order: an array of strings such as `'createdAt ASC'`. */
20
+ export const OrderBySchema = schemas.OrderBySchema;
21
+ /** Number of rows to skip; a non-negative integer. */
22
+ export const SkipSchema = schemas.SkipSchema;
23
+ /** Query conditions, with nested AND/OR. */
24
+ export const WhereSchema = schemas.WhereSchema;
9
25
  /**
10
26
  * The query shape of a route that accepts a `filter`. The framework's own `find`, `findById` and
11
27
  * `findOne` use it, and a hand-written route gets the same contract by naming it.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/base/repositories/query-schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAyB,MAAM,+BAA+B,CAAC;AAE1F,gbAAgb;AAChb,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAEtC,wVAAwV;AACxV,MAAM,gBAAgB,GAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;IAC9D,OAAQ,MAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,EACX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,EACV,WAAW,GACZ,GAAG,kBAAkB,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC;IAC1E,WAAW,EAAE,wDAAwD;CACtE,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC;IAClF,WAAW,EAAE,mBAAmB;CACjC,CAAC,CAAC","sourcesContent":["import { QuerySchemaFactory, type TSchemaDecorator } from '@venizia/ignis-filter/schemas';\n\n/** Load order is the point: `@hono/zod-openapi` peers on `zod`, so importing it patches `.openapi()` onto the shared `ZodType` prototype. `QuerySchemaFactory.build` runs at module scope below, and ESM evaluates imports first, so the method exists by the time the decorator is called. Without this import the schemas silently build undecorated whenever this module happens to load before anything else pulls in the OpenAPI layer. */\nimport { z } from '@hono/zod-openapi';\n\n/** The schemas themselves live in `@venizia/ignis-filter`, built with plain `zod` so a browser can use them. Documentation metadata is injected here because it is a server concern - `.openapi()` returns a new schema rather than mutating, and three of the decorations sit on inner nodes, so they cannot be applied after the tree is composed. */\nconst openApiDecorator: TSchemaDecorator = (schema, metadata) => {\n return (schema as any).openapi(metadata);\n};\n\nexport const {\n FieldsSchema,\n FilterSchema,\n InclusionSchema,\n LimitSchema,\n OffsetSchema,\n OrderBySchema,\n SkipSchema,\n WhereSchema,\n} = QuerySchemaFactory.build({ decorate: openApiDecorator });\n\n/**\n * The query shape of a route that accepts a `filter`. The framework's own `find`, `findById` and\n * `findOne` use it, and a hand-written route gets the same contract by naming it.\n *\n * `filter` needs no `.optional()` at the call site - {@link FilterSchema} already carries one, so a\n * second is a no-op and so is a trailing `.partial()`.\n *\n * Extend it rather than rebuilding it when a route takes more than `filter`:\n * `FilterQuerySchema.extend({ q: z.string().optional() })`.\n */\nexport const FilterQuerySchema = z.object({ filter: FilterSchema }).openapi({\n description: 'Filter with where, fields, limit, skip, order, include',\n});\n\n/**\n * The query shape of a route that accepts conditions and nothing else - `count` and anything shaped\n * like it. `where` is OPTIONAL here.\n *\n * `updateBy` and `deleteBy` deliberately do not use this. Their `where` is optional in the query\n * because it may ride in the body instead; the handler refuses a request that carries it in neither\n * place - a missing one there rewrites or deletes every row in the table.\n */\nexport const WhereQuerySchema = z.object({ where: WhereSchema.optional() }).openapi({\n description: 'Filter conditions',\n});\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/base/repositories/query-schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAyB,MAAM,+BAA+B,CAAC;AAE1F,gbAAgb;AAChb,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAEtC,wVAAwV;AACxV,MAAM,gBAAgB,GAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;IAC9D,OAAQ,MAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAEzE,+EAA+E;AAC/E,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AAEjD,6HAA6H;AAC7H,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AAEjD,iGAAiG;AACjG,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;AAEvD,sDAAsD;AACtD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;AAE/C,wDAAwD;AACxD,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AAEjD,iEAAiE;AACjE,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEnD,sDAAsD;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;AAE7C,4CAA4C;AAC5C,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC;IAC1E,WAAW,EAAE,wDAAwD;CACtE,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC;IAClF,WAAW,EAAE,mBAAmB;CACjC,CAAC,CAAC","sourcesContent":["import { QuerySchemaFactory, type TSchemaDecorator } from '@venizia/ignis-filter/schemas';\n\n/** Load order is the point: `@hono/zod-openapi` peers on `zod`, so importing it patches `.openapi()` onto the shared `ZodType` prototype. `QuerySchemaFactory.build` runs at module scope below, and ESM evaluates imports first, so the method exists by the time the decorator is called. Without this import the schemas silently build undecorated whenever this module happens to load before anything else pulls in the OpenAPI layer. */\nimport { z } from '@hono/zod-openapi';\n\n/** The schemas themselves live in `@venizia/ignis-filter`, built with plain `zod` so a browser can use them. Documentation metadata is injected here because it is a server concern - `.openapi()` returns a new schema rather than mutating, and three of the decorations sit on inner nodes, so they cannot be applied after the tree is composed. */\nconst openApiDecorator: TSchemaDecorator = (schema, metadata) => {\n return (schema as any).openapi(metadata);\n};\n\nconst schemas = QuerySchemaFactory.build({ decorate: openApiDecorator });\n\n/** Selected fields: an array of names to include, or a name-to-boolean map. */\nexport const FieldsSchema = schemas.FieldsSchema;\n\n/** The whole `filter` query: an object of where, fields, include, order, limit, offset and skip, or a JSON string of one. */\nexport const FilterSchema = schemas.FilterSchema;\n\n/** Relations to include: an array of `{ relation, scope? }` where `scope` is a nested filter. */\nexport const InclusionSchema = schemas.InclusionSchema;\n\n/** Maximum number of rows; a non-negative integer. */\nexport const LimitSchema = schemas.LimitSchema;\n\n/** Number of rows to offset; a non-negative integer. */\nexport const OffsetSchema = schemas.OffsetSchema;\n\n/** Sort order: an array of strings such as `'createdAt ASC'`. */\nexport const OrderBySchema = schemas.OrderBySchema;\n\n/** Number of rows to skip; a non-negative integer. */\nexport const SkipSchema = schemas.SkipSchema;\n\n/** Query conditions, with nested AND/OR. */\nexport const WhereSchema = schemas.WhereSchema;\n\n/**\n * The query shape of a route that accepts a `filter`. The framework's own `find`, `findById` and\n * `findOne` use it, and a hand-written route gets the same contract by naming it.\n *\n * `filter` needs no `.optional()` at the call site - {@link FilterSchema} already carries one, so a\n * second is a no-op and so is a trailing `.partial()`.\n *\n * Extend it rather than rebuilding it when a route takes more than `filter`:\n * `FilterQuerySchema.extend({ q: z.string().optional() })`.\n */\nexport const FilterQuerySchema = z.object({ filter: FilterSchema }).openapi({\n description: 'Filter with where, fields, limit, skip, order, include',\n});\n\n/**\n * The query shape of a route that accepts conditions and nothing else - `count` and anything shaped\n * like it. `where` is OPTIONAL here.\n *\n * `updateBy` and `deleteBy` deliberately do not use this. Their `where` is optional in the query\n * because it may ride in the body instead; the handler refuses a request that carries it in neither\n * place - a missing one there rewrites or deletes every row in the table.\n */\nexport const WhereQuerySchema = z.object({ where: WhereSchema.optional() }).openapi({\n description: 'Filter conditions',\n});\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { Context } from 'hono';
2
2
  import type { TRequestContextResolver } from './common/types.js';
3
+ /** Process-wide holder of the function that returns the current request context. `resolve()` is `undefined` when no resolver is installed or no request is active. */
3
4
  export declare class RequestContextRegistry {
4
5
  static readonly SINGLETON_REAL_KEY = "request-context-resolver";
5
6
  /** Realm-anchored, so a second copy of this package installs the resolver the first copy reads. */
@@ -1,4 +1,5 @@
1
1
  import { SingletonRealm } from '../../helpers/singleton-realm.js';
2
+ /** Process-wide holder of the function that returns the current request context. `resolve()` is `undefined` when no resolver is installed or no request is active. */
2
3
  export class RequestContextRegistry {
3
4
  static { this.SINGLETON_REAL_KEY = 'request-context-resolver'; }
4
5
  /** Realm-anchored, so a second copy of this package installs the resolver the first copy reads. */
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/base/request-context/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAkB3D,MAAM,OAAO,sBAAsB;aACjB,uBAAkB,GAAG,0BAA0B,CAAC;IAEhE,mGAAmG;IAC3F,MAAM,CAAC,IAAI;QACjB,OAAO,cAAc,CAAC,OAAO,CAAC;YAC5B,GAAG,EAAE,sBAAsB,CAAC,kBAAkB;YAC9C,MAAM,EAAE,GAAkB,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;SACvD,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,IAA2C;QAC5D,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,aAAa;QAClB,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,GAAG,SAAS,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;IAClC,CAAC","sourcesContent":["import { SingletonRealm } from '@/helpers/singleton-realm';\nimport type { Context } from 'hono';\nimport type { TRequestContextResolver } from './common/types';\n\n/**\n * The seam that keeps `hono/context-storage` out of the kernel and the connectors: that module runs\n * `new AsyncLocalStorage()` in its own body, so importing it is a `TypeError` at load in a browser -\n * not a lazy failure at first use. The server layer installs a resolver over it; a host that\n * installs none resolves to `undefined`.\n *\n * `resolve()` returning `undefined` means NO REQUEST CONTEXT. A context that exists but carries no\n * user is a different state, reported by that context's own variables - callers that collapse the\n * two lose the distinction their error handling is built on.\n */\ninterface IResolverSlot {\n resolver: TRequestContextResolver | undefined;\n}\n\nexport class RequestContextRegistry {\n static readonly SINGLETON_REAL_KEY = 'request-context-resolver';\n\n /** Realm-anchored, so a second copy of this package installs the resolver the first copy reads. */\n private static slot(): IResolverSlot {\n return SingletonRealm.resolve({\n key: RequestContextRegistry.SINGLETON_REAL_KEY,\n create: (): IResolverSlot => ({ resolver: undefined }),\n });\n }\n\n static setResolver(opts: { resolver: TRequestContextResolver }): void {\n this.slot().resolver = opts.resolver;\n }\n\n static clearResolver(): void {\n this.slot().resolver = undefined;\n }\n\n static resolve(): Context | undefined {\n return this.slot().resolver?.();\n }\n}\n"]}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/base/request-context/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAkB3D,sKAAsK;AACtK,MAAM,OAAO,sBAAsB;aACjB,uBAAkB,GAAG,0BAA0B,CAAC;IAEhE,mGAAmG;IAC3F,MAAM,CAAC,IAAI;QACjB,OAAO,cAAc,CAAC,OAAO,CAAC;YAC5B,GAAG,EAAE,sBAAsB,CAAC,kBAAkB;YAC9C,MAAM,EAAE,GAAkB,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;SACvD,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,IAA2C;QAC5D,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,aAAa;QAClB,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,GAAG,SAAS,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;IAClC,CAAC","sourcesContent":["import { SingletonRealm } from '@/helpers/singleton-realm';\nimport type { Context } from 'hono';\nimport type { TRequestContextResolver } from './common/types';\n\n/**\n * The seam that keeps `hono/context-storage` out of the kernel and the connectors: that module runs\n * `new AsyncLocalStorage()` in its own body, so importing it is a `TypeError` at load in a browser -\n * not a lazy failure at first use. The server layer installs a resolver over it; a host that\n * installs none resolves to `undefined`.\n *\n * `resolve()` returning `undefined` means NO REQUEST CONTEXT. A context that exists but carries no\n * user is a different state, reported by that context's own variables - callers that collapse the\n * two lose the distinction their error handling is built on.\n */\ninterface IResolverSlot {\n resolver: TRequestContextResolver | undefined;\n}\n\n/** Process-wide holder of the function that returns the current request context. `resolve()` is `undefined` when no resolver is installed or no request is active. */\nexport class RequestContextRegistry {\n static readonly SINGLETON_REAL_KEY = 'request-context-resolver';\n\n /** Realm-anchored, so a second copy of this package installs the resolver the first copy reads. */\n private static slot(): IResolverSlot {\n return SingletonRealm.resolve({\n key: RequestContextRegistry.SINGLETON_REAL_KEY,\n create: (): IResolverSlot => ({ resolver: undefined }),\n });\n }\n\n static setResolver(opts: { resolver: TRequestContextResolver }): void {\n this.slot().resolver = opts.resolver;\n }\n\n static clearResolver(): void {\n this.slot().resolver = undefined;\n }\n\n static resolve(): Context | undefined {\n return this.slot().resolver?.();\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { BaseHelper } from '@venizia/ignis-helpers/core';
2
2
  import type { IService } from './common/index.js';
3
+ /** Base class for services; `scope` names the logger scope. */
3
4
  export declare abstract class BaseService extends BaseHelper implements IService {
4
5
  constructor(opts: {
5
6
  scope: string;
@@ -1,4 +1,5 @@
1
1
  import { BaseHelper } from '@venizia/ignis-helpers/core';
2
+ /** Base class for services; `scope` names the logger scope. */
2
3
  export class BaseService extends BaseHelper {
3
4
  constructor(opts) {
4
5
  super(opts);
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/base/services/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGzD,MAAM,OAAgB,WAAY,SAAQ,UAAU;IAClD,YAAY,IAA4C;QACtD,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;CACF","sourcesContent":["import { BaseHelper } from '@venizia/ignis-helpers/core';\nimport type { IService } from './common';\n\nexport abstract class BaseService extends BaseHelper implements IService {\n constructor(opts: { scope: string; identifier?: string }) {\n super(opts);\n }\n}\n"]}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/base/services/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGzD,+DAA+D;AAC/D,MAAM,OAAgB,WAAY,SAAQ,UAAU;IAClD,YAAY,IAA4C;QACtD,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;CACF","sourcesContent":["import { BaseHelper } from '@venizia/ignis-helpers/core';\nimport type { IService } from './common';\n\n/** Base class for services; `scope` names the logger scope. */\nexport abstract class BaseService extends BaseHelper implements IService {\n constructor(opts: { scope: string; identifier?: string }) {\n super(opts);\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ /** Marker interface every service implements, so mixins can constrain registration to services. */
1
2
  export interface IService {
2
3
  }
3
4
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/base/services/common/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface IService {}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/base/services/common/types.ts"],"names":[],"mappings":"","sourcesContent":["/** Marker interface every service implements, so mixins can constrain registration to services. */\nexport interface IService {}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { BindingKeys } from '../helpers/inversion/index.js';
2
2
  import type { TConstValue } from '@venizia/ignis-helpers/common';
3
+ /** Valid `BindingNamespaces` values. */
3
4
  export type TBindingNamespace = TConstValue<typeof BindingNamespaces>;
4
5
  /** Static binding namespaces for dependency injection. */
5
6
  export declare class BindingNamespaces {
@@ -1 +1 @@
1
- {"version":3,"file":"bindings.js","sourceRoot":"","sources":["../../../src/common/bindings.ts"],"names":[],"mappings":"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","sourcesContent":["import { ArtifactTypes, BindingKeys } from '@/helpers/inversion';\nimport type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\n\nexport type TBindingNamespace = TConstValue<typeof BindingNamespaces>;\n\n/** Static binding namespaces for dependency injection. */\nexport class BindingNamespaces {\n // Declared first: every constant below runs through createNamespace while this class initializes.\n private static readonly NAME_PATTERN = /^[^.\\s]+$/;\n\n static readonly COMPONENT = BindingNamespaces.createNamespace({ name: 'components' });\n\n static readonly DATASOURCE = BindingNamespaces.createNamespace({ name: 'datasources' });\n static readonly REPOSITORY = BindingNamespaces.createNamespace({ name: 'repositories' });\n static readonly MODEL = BindingNamespaces.createNamespace({ name: 'models' });\n\n static readonly SERVICE = BindingNamespaces.createNamespace({ name: 'services' });\n static readonly MIDDLEWARE = BindingNamespaces.createNamespace({ name: 'middlewares' });\n static readonly PROVIDER = BindingNamespaces.createNamespace({ name: 'providers' });\n static readonly CONTROLLER = BindingNamespaces.createNamespace({ name: 'controllers' });\n\n static readonly CONFIGURATION = BindingNamespaces.createNamespace({ name: 'configurations' });\n\n /**\n * A namespace is the leading segment of a binding key, and a binding is tagged with that segment\n * alone - a name carrying '.' or whitespace yields a key no boot step can drain by tag.\n */\n static isValid(opts: { name: string }): boolean {\n const { name } = opts;\n\n return typeof name === 'string' && BindingNamespaces.NAME_PATTERN.test(name);\n }\n\n static createNamespace(opts: { name: string }) {\n const { name } = opts;\n\n if (!BindingNamespaces.isValid({ name })) {\n throw getError({\n message: `[BindingNamespaces][createNamespace] Invalid namespace | Expected a single non-empty segment without '.' or whitespace | Got: '${name}'`,\n });\n }\n\n return name;\n }\n\n /** A namespace-less key is untagged: no boot step drains it and `doVerify` never sees it. */\n static assertArtifactNamespace(opts: { namespace: string; artifact: string; caller: string }) {\n const { namespace, artifact, caller } = opts;\n\n if (BindingNamespaces.isValid({ name: namespace })) {\n return namespace;\n }\n\n throw getError({\n message: `[${caller}] '${artifact}' declares a binding with no usable namespace | namespace: '${namespace}' | A key with no leading namespace segment carries no tag, so no boot step drains it and 'bootChecks.binding.doVerify' never sees it`,\n });\n }\n}\n\n/** Artifact kind -> namespace. `registerArtifact` gets its namespace from the call site; `@injectable` has only the class. */\nexport class ArtifactNamespaces {\n private static readonly BY_TYPE: Record<string, TBindingNamespace> = {\n [ArtifactTypes.CONFIGURATION]: BindingNamespaces.CONFIGURATION,\n [ArtifactTypes.COMPONENT]: BindingNamespaces.COMPONENT,\n [ArtifactTypes.CONTROLLER]: BindingNamespaces.CONTROLLER,\n [ArtifactTypes.SERVICE]: BindingNamespaces.SERVICE,\n [ArtifactTypes.REPOSITORY]: BindingNamespaces.REPOSITORY,\n [ArtifactTypes.DATASOURCE]: BindingNamespaces.DATASOURCE,\n [ArtifactTypes.MODEL]: BindingNamespaces.MODEL,\n };\n\n static resolve(opts: { type: string }): TBindingNamespace {\n const namespace = ArtifactNamespaces.BY_TYPE[opts.type];\n\n if (namespace === undefined) {\n throw getError({\n message: `[ArtifactNamespaces][resolve] No namespace for artifact type | type: '${opts.type}' | known: ${Object.keys(ArtifactNamespaces.BY_TYPE).join(', ')}`,\n });\n }\n\n return namespace;\n }\n}\n\n/** Core binding keys for fundamental application components and configuration. */\nexport class CoreBindings extends BindingKeys {\n static readonly APPLICATION_INSTANCE = '@app/instance';\n static readonly APPLICATION_SERVER = '@app/server';\n static readonly APPLICATION_CONFIG = '@app/config';\n static readonly APPLICATION_PROJECT_ROOT = '@app/project_root';\n\n static readonly APPLICATION_ROOT_ROUTER = '@app/router/root';\n\n static readonly APPLICATION_ENVIRONMENTS = '@app/environments';\n static readonly APPLICATION_MIDDLEWARE_OPTIONS = '@app/middleware_options';\n}\n"]}
1
+ {"version":3,"file":"bindings.js","sourceRoot":"","sources":["../../../src/common/bindings.ts"],"names":[],"mappings":"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","sourcesContent":["import { ArtifactTypes, BindingKeys } from '@/helpers/inversion';\nimport type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\n\n/** Valid `BindingNamespaces` values. */\nexport type TBindingNamespace = TConstValue<typeof BindingNamespaces>;\n\n/** Static binding namespaces for dependency injection. */\nexport class BindingNamespaces {\n // Declared first: every constant below runs through createNamespace while this class initializes.\n private static readonly NAME_PATTERN = /^[^.\\s]+$/;\n\n static readonly COMPONENT = BindingNamespaces.createNamespace({ name: 'components' });\n\n static readonly DATASOURCE = BindingNamespaces.createNamespace({ name: 'datasources' });\n static readonly REPOSITORY = BindingNamespaces.createNamespace({ name: 'repositories' });\n static readonly MODEL = BindingNamespaces.createNamespace({ name: 'models' });\n\n static readonly SERVICE = BindingNamespaces.createNamespace({ name: 'services' });\n static readonly MIDDLEWARE = BindingNamespaces.createNamespace({ name: 'middlewares' });\n static readonly PROVIDER = BindingNamespaces.createNamespace({ name: 'providers' });\n static readonly CONTROLLER = BindingNamespaces.createNamespace({ name: 'controllers' });\n\n static readonly CONFIGURATION = BindingNamespaces.createNamespace({ name: 'configurations' });\n\n /**\n * A namespace is the leading segment of a binding key, and a binding is tagged with that segment\n * alone - a name carrying '.' or whitespace yields a key no boot step can drain by tag.\n */\n static isValid(opts: { name: string }): boolean {\n const { name } = opts;\n\n return typeof name === 'string' && BindingNamespaces.NAME_PATTERN.test(name);\n }\n\n static createNamespace(opts: { name: string }) {\n const { name } = opts;\n\n if (!BindingNamespaces.isValid({ name })) {\n throw getError({\n message: `[BindingNamespaces][createNamespace] Invalid namespace | Expected a single non-empty segment without '.' or whitespace | Got: '${name}'`,\n });\n }\n\n return name;\n }\n\n /** A namespace-less key is untagged: no boot step drains it and `doVerify` never sees it. */\n static assertArtifactNamespace(opts: { namespace: string; artifact: string; caller: string }) {\n const { namespace, artifact, caller } = opts;\n\n if (BindingNamespaces.isValid({ name: namespace })) {\n return namespace;\n }\n\n throw getError({\n message: `[${caller}] '${artifact}' declares a binding with no usable namespace | namespace: '${namespace}' | A key with no leading namespace segment carries no tag, so no boot step drains it and 'bootChecks.binding.doVerify' never sees it`,\n });\n }\n}\n\n/** Artifact kind -> namespace. `registerArtifact` gets its namespace from the call site; `@injectable` has only the class. */\nexport class ArtifactNamespaces {\n private static readonly BY_TYPE: Record<string, TBindingNamespace> = {\n [ArtifactTypes.CONFIGURATION]: BindingNamespaces.CONFIGURATION,\n [ArtifactTypes.COMPONENT]: BindingNamespaces.COMPONENT,\n [ArtifactTypes.CONTROLLER]: BindingNamespaces.CONTROLLER,\n [ArtifactTypes.SERVICE]: BindingNamespaces.SERVICE,\n [ArtifactTypes.REPOSITORY]: BindingNamespaces.REPOSITORY,\n [ArtifactTypes.DATASOURCE]: BindingNamespaces.DATASOURCE,\n [ArtifactTypes.MODEL]: BindingNamespaces.MODEL,\n };\n\n static resolve(opts: { type: string }): TBindingNamespace {\n const namespace = ArtifactNamespaces.BY_TYPE[opts.type];\n\n if (namespace === undefined) {\n throw getError({\n message: `[ArtifactNamespaces][resolve] No namespace for artifact type | type: '${opts.type}' | known: ${Object.keys(ArtifactNamespaces.BY_TYPE).join(', ')}`,\n });\n }\n\n return namespace;\n }\n}\n\n/** Core binding keys for fundamental application components and configuration. */\nexport class CoreBindings extends BindingKeys {\n static readonly APPLICATION_INSTANCE = '@app/instance';\n static readonly APPLICATION_SERVER = '@app/server';\n static readonly APPLICATION_CONFIG = '@app/config';\n static readonly APPLICATION_PROJECT_ROOT = '@app/project_root';\n\n static readonly APPLICATION_ROOT_ROUTER = '@app/router/root';\n\n static readonly APPLICATION_ENVIRONMENTS = '@app/environments';\n static readonly APPLICATION_MIDDLEWARE_OPTIONS = '@app/middleware_options';\n}\n"]}
@@ -4,6 +4,7 @@ export declare class CoreErrorCodes {
4
4
  static readonly NOT_SUPPORTED: string;
5
5
  static readonly DATABASE_CONFLICT: string;
6
6
  }
7
+ /** Valid `CoreErrorCodes` values. */
7
8
  export type TCoreErrorCode = TConstValue<typeof CoreErrorCodes>;
8
9
  /** Failures raised by the search connectors (Typesense, Meilisearch) and the neutral search tier. */
9
10
  export declare class SearchErrorCodes {
@@ -12,5 +13,6 @@ export declare class SearchErrorCodes {
12
13
  static readonly TASK_TIMEOUT: string;
13
14
  static readonly DEPENDENCY_UNAVAILABLE: string;
14
15
  }
16
+ /** Valid `SearchErrorCodes` values. */
15
17
  export type TSearchErrorCode = TConstValue<typeof SearchErrorCodes>;
16
18
  //# sourceMappingURL=error-codes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-codes.js","sourceRoot":"","sources":["../../../src/common/error-codes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,kSAAkS;AAClS,MAAM,KAAK,GAAG,CAAC,KAAoB,EAAU,EAAE;IAC7C,OAAO,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,oFAAoF;AACpF,MAAM,OAAO,cAAc;aACT,kBAAa,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;aACjD,sBAAiB,GAAG,KAAK,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;;AAKtE,qGAAqG;AACrG,MAAM,OAAO,gBAAgB;aACX,cAAS,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC;aAC1D,mBAAc,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC,CAAC;aACpE,iBAAY,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;aAChE,2BAAsB,GAAG,KAAK,CAAC;QAC7C,MAAM;QACN,eAAe;QACf,wBAAwB;KACzB,CAAC,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { MessageCode } from '@venizia/ignis-helpers/core';\n\n/** Every machine-readable code the framework raises - clients branch on the code, so these strings ARE a public contract. Built via {@link MessageCode.build}, which rejects a malformed code at import time; `core.*` and `database.*` belong to IGNIS, applications use their own namespace. */\nconst build = (parts: Array<string>): string => {\n return MessageCode.build({ parts });\n};\n\n/** Framework-level failures that are not specific to one connector or component. */\nexport class CoreErrorCodes {\n static readonly NOT_SUPPORTED = build(['core', 'not_supported']);\n static readonly DATABASE_CONFLICT = build(['database', 'conflict']);\n}\n\nexport type TCoreErrorCode = TConstValue<typeof CoreErrorCodes>;\n\n/** Failures raised by the search connectors (Typesense, Meilisearch) and the neutral search tier. */\nexport class SearchErrorCodes {\n static readonly NOT_FOUND = build(['core', 'search_engine', 'not_found']);\n static readonly ALREADY_EXISTS = build(['core', 'search_engine', 'already_exists']);\n static readonly TASK_TIMEOUT = build(['core', 'search_engine', 'task_timeout']);\n static readonly DEPENDENCY_UNAVAILABLE = build([\n 'core',\n 'search_engine',\n 'dependency_unavailable',\n ]);\n}\n\nexport type TSearchErrorCode = TConstValue<typeof SearchErrorCodes>;\n"]}
1
+ {"version":3,"file":"error-codes.js","sourceRoot":"","sources":["../../../src/common/error-codes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,kSAAkS;AAClS,MAAM,KAAK,GAAG,CAAC,KAAoB,EAAU,EAAE;IAC7C,OAAO,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,oFAAoF;AACpF,MAAM,OAAO,cAAc;aACT,kBAAa,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;aACjD,sBAAiB,GAAG,KAAK,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;;AAMtE,qGAAqG;AACrG,MAAM,OAAO,gBAAgB;aACX,cAAS,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC;aAC1D,mBAAc,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC,CAAC;aACpE,iBAAY,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;aAChE,2BAAsB,GAAG,KAAK,CAAC;QAC7C,MAAM;QACN,eAAe;QACf,wBAAwB;KACzB,CAAC,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { MessageCode } from '@venizia/ignis-helpers/core';\n\n/** Every machine-readable code the framework raises - clients branch on the code, so these strings ARE a public contract. Built via {@link MessageCode.build}, which rejects a malformed code at import time; `core.*` and `database.*` belong to IGNIS, applications use their own namespace. */\nconst build = (parts: Array<string>): string => {\n return MessageCode.build({ parts });\n};\n\n/** Framework-level failures that are not specific to one connector or component. */\nexport class CoreErrorCodes {\n static readonly NOT_SUPPORTED = build(['core', 'not_supported']);\n static readonly DATABASE_CONFLICT = build(['database', 'conflict']);\n}\n\n/** Valid `CoreErrorCodes` values. */\nexport type TCoreErrorCode = TConstValue<typeof CoreErrorCodes>;\n\n/** Failures raised by the search connectors (Typesense, Meilisearch) and the neutral search tier. */\nexport class SearchErrorCodes {\n static readonly NOT_FOUND = build(['core', 'search_engine', 'not_found']);\n static readonly ALREADY_EXISTS = build(['core', 'search_engine', 'already_exists']);\n static readonly TASK_TIMEOUT = build(['core', 'search_engine', 'task_timeout']);\n static readonly DEPENDENCY_UNAVAILABLE = build([\n 'core',\n 'search_engine',\n 'dependency_unavailable',\n ]);\n}\n\n/** Valid `SearchErrorCodes` values. */\nexport type TSearchErrorCode = TConstValue<typeof SearchErrorCodes>;\n"]}
@@ -1,3 +1,4 @@
1
+ /** Reflect metadata keys: the inversion package keys plus the IGNIS keys for controllers, routes, models, datasources, repositories, artifacts and `@provide` methods. */
1
2
  export declare const MetadataKeys: {
2
3
  PROPERTIES: symbol;
3
4
  INJECT: symbol;
@@ -1,4 +1,5 @@
1
1
  import { MetadataKeys as _MetadataKeys } from '@venizia/ignis-inversion';
2
+ /** Reflect metadata keys: the inversion package keys plus the IGNIS keys for controllers, routes, models, datasources, repositories, artifacts and `@provide` methods. */
2
3
  export const MetadataKeys = Object.assign({}, _MetadataKeys, {
3
4
  CONTROLLER: Symbol.for('ignis:controller'),
4
5
  CONTROLLER_REST_ROUTE: Symbol.for('ignis:controller:rest:route'),
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/helpers/inversion/common/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzE,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,EAAE;IAC3D,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAC1C,qBAAqB,EAAE,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC;IAChE,qBAAqB,EAAE,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC;IAEhE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAC1C,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAE1C,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;CACvC,CAAC,CAAC","sourcesContent":["import { MetadataKeys as _MetadataKeys } from '@venizia/ignis-inversion';\n\nexport const MetadataKeys = Object.assign({}, _MetadataKeys, {\n CONTROLLER: Symbol.for('ignis:controller'),\n CONTROLLER_REST_ROUTE: Symbol.for('ignis:controller:rest:route'),\n CONTROLLER_GRPC_ROUTE: Symbol.for('ignis:controller:grpc:route'),\n\n MODEL: Symbol.for('ignis:model'),\n DATASOURCE: Symbol.for('ignis:datasource'),\n REPOSITORY: Symbol.for('ignis:repository'),\n\n ARTIFACT: Symbol.for('ignis:artifact'),\n PROVIDES: Symbol.for('ignis:provides'),\n});\n"]}
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/helpers/inversion/common/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzE,0KAA0K;AAC1K,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,EAAE;IAC3D,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAC1C,qBAAqB,EAAE,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC;IAChE,qBAAqB,EAAE,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC;IAEhE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAC1C,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAE1C,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;CACvC,CAAC,CAAC","sourcesContent":["import { MetadataKeys as _MetadataKeys } from '@venizia/ignis-inversion';\n\n/** Reflect metadata keys: the inversion package keys plus the IGNIS keys for controllers, routes, models, datasources, repositories, artifacts and `@provide` methods. */\nexport const MetadataKeys = Object.assign({}, _MetadataKeys, {\n CONTROLLER: Symbol.for('ignis:controller'),\n CONTROLLER_REST_ROUTE: Symbol.for('ignis:controller:rest:route'),\n CONTROLLER_GRPC_ROUTE: Symbol.for('ignis:controller:grpc:route'),\n\n MODEL: Symbol.for('ignis:model'),\n DATASOURCE: Symbol.for('ignis:datasource'),\n REPOSITORY: Symbol.for('ignis:repository'),\n\n ARTIFACT: Symbol.for('ignis:artifact'),\n PROVIDES: Symbol.for('ignis:provides'),\n});\n"]}
@@ -5,6 +5,7 @@ export type TRelationBuilder = (opts: {
5
5
  }) => {
6
6
  relations?: unknown;
7
7
  } | undefined;
8
+ /** Process-wide slot where the relational connector installs its relation builder; `resolve()` is `undefined` until one is set. */
8
9
  export declare class RelationBuilderRegistry {
9
10
  static readonly SINGLETON_REAL_KEY = "relation-builder";
10
11
  /** Realm-anchored like the other cross-package registries: connectors installs into one copy of this package and the `@repository` mixin resolves from the other, which throws "no relation builder is registered". */
@@ -1,4 +1,5 @@
1
1
  import { SingletonRealm } from '../../singleton-realm.js';
2
+ /** Process-wide slot where the relational connector installs its relation builder; `resolve()` is `undefined` until one is set. */
2
3
  export class RelationBuilderRegistry {
3
4
  static { this.SINGLETON_REAL_KEY = 'relation-builder'; }
4
5
  /** Realm-anchored like the other cross-package registries: connectors installs into one copy of this package and the `@repository` mixin resolves from the other, which throws "no relation builder is registered". */
@@ -1 +1 @@
1
- {"version":3,"file":"relation-builder.js","sourceRoot":"","sources":["../../../../../src/helpers/inversion/common/relation-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAiBvD,MAAM,OAAO,uBAAuB;aAClB,uBAAkB,GAAG,kBAAkB,CAAC;IAExD,uNAAuN;IAC/M,MAAM,CAAC,IAAI;QACjB,OAAO,cAAc,CAAC,OAAO,CAAC;YAC5B,GAAG,EAAE,uBAAuB,CAAC,kBAAkB;YAC/C,MAAM,EAAE,GAAiB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;SACrD,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,IAAmC;QAC5C,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC;IAC7B,CAAC","sourcesContent":["import { SingletonRealm } from '../../singleton-realm';\n\n/** Engine-neutral: the registry is shared across connectors, so each connector narrows at its own call site. */\nexport type TRelationBuilder = (opts: {\n source: unknown;\n relations: unknown;\n}) => { relations?: unknown } | undefined;\n\n/**\n * The relational connector installs itself here from its own module body. The mixin must not import\n * the connector: one value import of `RelationsFactory.create` drags `drizzle-orm` into every graph that\n * uses `@repository`.\n */\ninterface IBuilderSlot {\n builder: TRelationBuilder | undefined;\n}\n\nexport class RelationBuilderRegistry {\n static readonly SINGLETON_REAL_KEY = 'relation-builder';\n\n /** Realm-anchored like the other cross-package registries: connectors installs into one copy of this package and the `@repository` mixin resolves from the other, which throws \"no relation builder is registered\". */\n private static slot(): IBuilderSlot {\n return SingletonRealm.resolve({\n key: RelationBuilderRegistry.SINGLETON_REAL_KEY,\n create: (): IBuilderSlot => ({ builder: undefined }),\n });\n }\n\n static set(opts: { builder: TRelationBuilder }): void {\n this.slot().builder = opts.builder;\n }\n\n static resolve(): TRelationBuilder | undefined {\n return this.slot().builder;\n }\n}\n"]}
1
+ {"version":3,"file":"relation-builder.js","sourceRoot":"","sources":["../../../../../src/helpers/inversion/common/relation-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAiBvD,mIAAmI;AACnI,MAAM,OAAO,uBAAuB;aAClB,uBAAkB,GAAG,kBAAkB,CAAC;IAExD,uNAAuN;IAC/M,MAAM,CAAC,IAAI;QACjB,OAAO,cAAc,CAAC,OAAO,CAAC;YAC5B,GAAG,EAAE,uBAAuB,CAAC,kBAAkB;YAC/C,MAAM,EAAE,GAAiB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;SACrD,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,IAAmC;QAC5C,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC;IAC7B,CAAC","sourcesContent":["import { SingletonRealm } from '../../singleton-realm';\n\n/** Engine-neutral: the registry is shared across connectors, so each connector narrows at its own call site. */\nexport type TRelationBuilder = (opts: {\n source: unknown;\n relations: unknown;\n}) => { relations?: unknown } | undefined;\n\n/**\n * The relational connector installs itself here from its own module body. The mixin must not import\n * the connector: one value import of `RelationsFactory.create` drags `drizzle-orm` into every graph that\n * uses `@repository`.\n */\ninterface IBuilderSlot {\n builder: TRelationBuilder | undefined;\n}\n\n/** Process-wide slot where the relational connector installs its relation builder; `resolve()` is `undefined` until one is set. */\nexport class RelationBuilderRegistry {\n static readonly SINGLETON_REAL_KEY = 'relation-builder';\n\n /** Realm-anchored like the other cross-package registries: connectors installs into one copy of this package and the `@repository` mixin resolves from the other, which throws \"no relation builder is registered\". */\n private static slot(): IBuilderSlot {\n return SingletonRealm.resolve({\n key: RelationBuilderRegistry.SINGLETON_REAL_KEY,\n create: (): IBuilderSlot => ({ builder: undefined }),\n });\n }\n\n static set(opts: { builder: TRelationBuilder }): void {\n this.slot().builder = opts.builder;\n }\n\n static resolve(): TRelationBuilder | undefined {\n return this.slot().builder;\n }\n}\n"]}
@@ -3,6 +3,7 @@ import type { TBindingScope } from '@venizia/ignis-inversion';
3
3
  import { type ArtifactTypes } from '../constants.js';
4
4
  /** Decorator target for any constructable class (includes Function for ClassDecorator). */
5
5
  export type TDecoratorTarget<T = unknown> = TClass<T> | Function;
6
+ /** Valid `ArtifactTypes` values. */
6
7
  export type TArtifactType = TConstValue<typeof ArtifactTypes>;
7
8
  /** Decides at registration time whether the class is registered at all. Sync or async; runs before `preConfigure`, so it may read config and env, never another artifact's binding. */
8
9
  export type TArtifactCondition<ApplicationType = unknown> = (opts: {
@@ -16,19 +17,25 @@ export interface IArtifactRegistrationOptions<ApplicationType = unknown> {
16
17
  };
17
18
  allowOverride?: boolean;
18
19
  scope?: TBindingScope;
19
- /** Lower registers first within its kind. Default 0; ties keep index order. */
20
+ /**
21
+ * Lower registers first within its kind; ties keep index order.
22
+ *
23
+ * @default 0
24
+ */
20
25
  order?: number;
21
26
  when?: TArtifactCondition<ApplicationType>;
22
27
  /** Topological ordering for configurations: must run after these configuration classes. */
23
28
  after?: ReadonlyArray<TClass<unknown>>;
24
29
  }
30
+ /** Registration options of an artifact plus its `type`. */
25
31
  export interface IArtifactMetadata<ApplicationType = unknown> extends IArtifactRegistrationOptions<ApplicationType> {
26
32
  type: TArtifactType;
27
33
  }
28
- /** One `@provide` method: the key it binds, and the binding scope of the value (default SINGLETON). */
34
+ /** One `@provide` method: the key it binds, and the binding scope of the value. */
29
35
  export interface IProvideMetadata {
30
36
  methodName: string | symbol;
31
37
  key: string;
38
+ /** @default BindingScopes.SINGLETON */
32
39
  scope?: TBindingScope;
33
40
  }
34
41
  //# sourceMappingURL=artifact.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"artifact.js","sourceRoot":"","sources":["../../../../../../src/helpers/inversion/common/types/artifact.ts"],"names":[],"mappings":"","sourcesContent":["import type { TClass, TConstValue, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { TBindingScope } from '@venizia/ignis-inversion';\nimport { type ArtifactTypes } from '../constants';\n\n/** Decorator target for any constructable class (includes Function for ClassDecorator). */\nexport type TDecoratorTarget<T = unknown> = TClass<T> | Function;\n\nexport type TArtifactType = TConstValue<typeof ArtifactTypes>;\n\n/** Decides at registration time whether the class is registered at all. Sync or async; runs before `preConfigure`, so it may read config and env, never another artifact's binding. */\nexport type TArtifactCondition<ApplicationType = unknown> = (opts: {\n application: ApplicationType;\n}) => ValueOrPromise<boolean>;\n\n/** Registration defaults a class carries for itself; an explicit `TMixinOpts` at the call site still wins. */\nexport interface IArtifactRegistrationOptions<ApplicationType = unknown> {\n binding?: { namespace: string; key: string };\n allowOverride?: boolean;\n scope?: TBindingScope;\n /** Lower registers first within its kind. Default 0; ties keep index order. */\n order?: number;\n when?: TArtifactCondition<ApplicationType>;\n /** Topological ordering for configurations: must run after these configuration classes. */\n after?: ReadonlyArray<TClass<unknown>>;\n}\n\nexport interface IArtifactMetadata<\n ApplicationType = unknown,\n> extends IArtifactRegistrationOptions<ApplicationType> {\n type: TArtifactType;\n}\n\n/** One `@provide` method: the key it binds, and the binding scope of the value (default SINGLETON). */\nexport interface IProvideMetadata {\n methodName: string | symbol;\n key: string;\n scope?: TBindingScope;\n}\n"]}
1
+ {"version":3,"file":"artifact.js","sourceRoot":"","sources":["../../../../../../src/helpers/inversion/common/types/artifact.ts"],"names":[],"mappings":"","sourcesContent":["import type { TClass, TConstValue, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { TBindingScope } from '@venizia/ignis-inversion';\nimport { type ArtifactTypes } from '../constants';\n\n/** Decorator target for any constructable class (includes Function for ClassDecorator). */\nexport type TDecoratorTarget<T = unknown> = TClass<T> | Function;\n\n/** Valid `ArtifactTypes` values. */\nexport type TArtifactType = TConstValue<typeof ArtifactTypes>;\n\n/** Decides at registration time whether the class is registered at all. Sync or async; runs before `preConfigure`, so it may read config and env, never another artifact's binding. */\nexport type TArtifactCondition<ApplicationType = unknown> = (opts: {\n application: ApplicationType;\n}) => ValueOrPromise<boolean>;\n\n/** Registration defaults a class carries for itself; an explicit `TMixinOpts` at the call site still wins. */\nexport interface IArtifactRegistrationOptions<ApplicationType = unknown> {\n binding?: { namespace: string; key: string };\n allowOverride?: boolean;\n scope?: TBindingScope;\n /**\n * Lower registers first within its kind; ties keep index order.\n *\n * @default 0\n */\n order?: number;\n when?: TArtifactCondition<ApplicationType>;\n /** Topological ordering for configurations: must run after these configuration classes. */\n after?: ReadonlyArray<TClass<unknown>>;\n}\n\n/** Registration options of an artifact plus its `type`. */\nexport interface IArtifactMetadata<\n ApplicationType = unknown,\n> extends IArtifactRegistrationOptions<ApplicationType> {\n type: TArtifactType;\n}\n\n/** One `@provide` method: the key it binds, and the binding scope of the value. */\nexport interface IProvideMetadata {\n methodName: string | symbol;\n key: string;\n\n /** @default BindingScopes.SINGLETON */\n scope?: TBindingScope;\n}\n"]}
@@ -8,14 +8,18 @@ interface IBaseControllerMetadata extends IArtifactRegistrationOptions {
8
8
  tags?: string[];
9
9
  description?: string;
10
10
  }
11
+ /** Metadata of a REST controller; `transport` may be left out. */
11
12
  export interface IRestControllerMetadata extends IBaseControllerMetadata {
12
13
  transport?: typeof ControllerTransports.REST;
13
14
  }
15
+ /** Metadata of a gRPC controller; `service` is the gRPC service definition it implements. */
14
16
  export interface IGrpcControllerMetadata<ServiceType = unknown> extends IBaseControllerMetadata {
15
17
  transport: typeof ControllerTransports.GRPC;
16
18
  service: ServiceType;
17
19
  }
20
+ /** Metadata accepted by `@controller`, discriminated on `transport`. */
18
21
  export type TControllerMetadata = IRestControllerMetadata | IGrpcControllerMetadata;
22
+ /** Metadata of one gRPC method on a controller. */
19
23
  export interface IRpcMetadata {
20
24
  /** Proto method name. */
21
25
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../../../src/helpers/inversion/common/types/controller.ts"],"names":[],"mappings":"","sourcesContent":["import type { TAuthMode, TAuthStrategy } from '@/base/auth/authenticate/common';\nimport type { IAuthorizationSpec } from '@/base/auth/authorize/common/types';\nimport type { ControllerTransports } from '@/base/controllers/common/constants';\nimport type { TGrpcMethod } from '@venizia/ignis-helpers/common';\nimport type { IArtifactRegistrationOptions } from './artifact';\n\ninterface IBaseControllerMetadata extends IArtifactRegistrationOptions {\n path: string;\n tags?: string[];\n description?: string;\n}\n\nexport interface IRestControllerMetadata extends IBaseControllerMetadata {\n transport?: typeof ControllerTransports.REST;\n}\n\nexport interface IGrpcControllerMetadata<ServiceType = unknown> extends IBaseControllerMetadata {\n transport: typeof ControllerTransports.GRPC;\n service: ServiceType;\n}\n\nexport type TControllerMetadata = IRestControllerMetadata | IGrpcControllerMetadata;\n\nexport interface IRpcMetadata {\n /** Proto method name. */\n name: string;\n\n /** RPC method type (unary, server_streaming, etc.). */\n method: TGrpcMethod;\n\n /** Authentication config for this RPC method. */\n authenticate?: { strategies?: TAuthStrategy[]; mode?: TAuthMode };\n\n /** Authorization spec(s) for this RPC method. */\n authorize?: IAuthorizationSpec | IAuthorizationSpec[];\n}\n"]}
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../../../src/helpers/inversion/common/types/controller.ts"],"names":[],"mappings":"","sourcesContent":["import type { TAuthMode, TAuthStrategy } from '@/base/auth/authenticate/common';\nimport type { IAuthorizationSpec } from '@/base/auth/authorize/common/types';\nimport type { ControllerTransports } from '@/base/controllers/common/constants';\nimport type { TGrpcMethod } from '@venizia/ignis-helpers/common';\nimport type { IArtifactRegistrationOptions } from './artifact';\n\ninterface IBaseControllerMetadata extends IArtifactRegistrationOptions {\n path: string;\n tags?: string[];\n description?: string;\n}\n\n/** Metadata of a REST controller; `transport` may be left out. */\nexport interface IRestControllerMetadata extends IBaseControllerMetadata {\n transport?: typeof ControllerTransports.REST;\n}\n\n/** Metadata of a gRPC controller; `service` is the gRPC service definition it implements. */\nexport interface IGrpcControllerMetadata<ServiceType = unknown> extends IBaseControllerMetadata {\n transport: typeof ControllerTransports.GRPC;\n service: ServiceType;\n}\n\n/** Metadata accepted by `@controller`, discriminated on `transport`. */\nexport type TControllerMetadata = IRestControllerMetadata | IGrpcControllerMetadata;\n\n/** Metadata of one gRPC method on a controller. */\nexport interface IRpcMetadata {\n /** Proto method name. */\n name: string;\n\n /** RPC method type (unary, server_streaming, etc.). */\n method: TGrpcMethod;\n\n /** Authentication config for this RPC method. */\n authenticate?: { strategies?: TAuthStrategy[]; mode?: TAuthMode };\n\n /** Authorization spec(s) for this RPC method. */\n authorize?: IAuthorizationSpec | IAuthorizationSpec[];\n}\n"]}
@@ -2,6 +2,7 @@ import type { AbstractEntity, TModelType } from '../../../../base/models/index.j
2
2
  import type { ScopeFilters, ScopeThrough, TFilter, TScopeFilterMissingBehavior, TScopeOperation, TScopeWriteGuard, TWhere } from '../../../../base/repositories/index.js';
3
3
  import type { TClass, TNullable, TValueOrResolver } from '@venizia/ignis-helpers/common';
4
4
  import type { IArtifactRegistrationOptions } from './artifact.js';
5
+ /** The `authorize` settings of a model. */
5
6
  export interface IModelAuthorizeSettings {
6
7
  /** The authorization principal name (resource/subject) for this model. */
7
8
  principal: string;
@@ -12,7 +13,7 @@ export interface IModelAuthorizeSettings {
12
13
  export interface IModelAccessWriteSettings {
13
14
  /**
14
15
  * What a create, createAll or an update payload that names a scope column does when its value
15
- * disagrees with the resolved scope. `reject` (default) refuses the write and writes nothing - for
16
+ * disagrees with the resolved scope. `reject` refuses the write and writes nothing - for
16
17
  * `createAll` not even the valid rows. `assign` also fills a scope column that is ABSENT from a
17
18
  * created row, when the scope is a single equality; a value that is present and disagrees is
18
19
  * still refused.
@@ -24,13 +25,17 @@ export interface IModelAccessWriteSettings {
24
25
  *
25
26
  * Not checked: an update that does not name the scope column (the row was already selected through
26
27
  * the scoped `where`), and raw statements that bypass the repository.
28
+ *
29
+ * @default 'reject'
27
30
  */
28
31
  mode?: TScopeWriteGuard;
29
32
  /**
30
33
  * `true` lets a restricted caller write `null` to a scope column, or leave it out on create: the
31
- * row has no owner and is shared. Default `false`, so `null` is refused like any other value
34
+ * row has no owner and is shared. Without it, `null` is refused like any other value
32
35
  * outside the scope, even when the resolved scope has a `null` branch (that branch lets the caller
33
36
  * READ shared rows, a separate permission). Reads are scoped as before.
37
+ *
38
+ * @default false
34
39
  */
35
40
  sharedRows?: boolean;
36
41
  }
@@ -38,6 +43,21 @@ export interface IModelAccessWriteSettings {
38
43
  * Row access for `@model` settings.access - resolved per query, so it can depend on the current
39
44
  * request (tenant, org, membership). Framework-internal escape hatches aside, nothing short of
40
45
  * removing this setting from the model turns scoping off.
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * import { model, ScopeWriteGuards } from '@venizia/ignis';
50
+ * import { ModelFactory } from '@venizia/ignis-connectors/postgres';
51
+ * import { pgTable, serial, text } from 'drizzle-orm/pg-core';
52
+ *
53
+ * const productTable = pgTable('Product', { id: serial('id').primaryKey(), merchantId: text('merchant_id') });
54
+ *
55
+ * export @model({ settings: { access: {
56
+ * resolve: () => ({ merchantId: 'm-1' }),
57
+ * write: { mode: ScopeWriteGuards.ASSIGN },
58
+ * } } })
59
+ * class Product extends ModelFactory.defineEntity({ table: productTable }) {}
60
+ * ```
41
61
  */
42
62
  export interface IModelAccessSettings {
43
63
  /** A model declares a resolver or a `through`, never both. */
@@ -60,9 +80,11 @@ export interface IModelAccessSettings {
60
80
  }) => TNullable<TWhere> | typeof ScopeFilters.UNRESTRICTED;
61
81
  /**
62
82
  * What `applyScopeFilter` does when `resolve()` returns null/undefined - no request context, no
63
- * tenant, a background job. Defaults to `deny`: an unresolved scope matches zero rows, never
83
+ * tenant, a background job. With `deny`, an unresolved scope matches zero rows, never
64
84
  * every row. `allow` is an explicit, reviewed opt-out for migrations and background jobs, declared
65
85
  * per MODEL - it cannot express a per-USER bypass; use `ScopeFilters.UNRESTRICTED` for that.
86
+ *
87
+ * @default 'deny'
66
88
  */
67
89
  onMissing?: TScopeFilterMissingBehavior;
68
90
  /**
@@ -78,6 +100,38 @@ export interface IModelAccessSettings {
78
100
  * Row access for a child model that has no scope columns of its own: it inherits the scope of the parent a `one`
79
101
  * relation points at. A parent that resolves no scope always denies the child: `onMissing` is not offered here, because
80
102
  * `'allow'` would show the child's rows of every tenant while the parent shows none.
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * import { model, ScopeThrough } from '@venizia/ignis';
107
+ * import { ModelFactory, one } from '@venizia/ignis-connectors/postgres';
108
+ * import { integer, pgTable, serial } from 'drizzle-orm/pg-core';
109
+ * const productTable = pgTable('Product', { id: serial('id').primaryKey() });
110
+ * const variantTable = pgTable('Variant', {
111
+ * id: serial('id').primaryKey(),
112
+ * productId: integer('product_id').references(() => productTable.id),
113
+ * });
114
+ * const VariantBase = ModelFactory.defineEntity({ table: variantTable, relations: () => ({ product: one(productTable) }) });
115
+ * export @model({ settings: { access: { through: ScopeThrough.of({ entity: VariantBase, relation: 'product' }) } } })
116
+ * class Variant extends VariantBase {}
117
+ * ```
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * // A hand-written entity declares the same relation by hand.
122
+ * import { ScopeThrough } from '@venizia/ignis';
123
+ * import { BaseEntity, one, RelationDeclarations } from '@venizia/ignis-connectors/postgres';
124
+ * import { integer, pgTable, serial } from 'drizzle-orm/pg-core';
125
+ * const productTable = pgTable('Product', { id: serial('id').primaryKey() });
126
+ * const variantTable = pgTable('Variant', { id: serial('id').primaryKey(), productId: integer('product_id').references(() => productTable.id) });
127
+ * const relations = { product: one(productTable) };
128
+ * class VariantBase extends BaseEntity<typeof variantTable> {
129
+ * static override schema = variantTable;
130
+ * static readonly relationDefinitions = relations;
131
+ * static override relations = () => RelationDeclarations.toRelationConfigs({ relations });
132
+ * }
133
+ * const through = ScopeThrough.of({ entity: VariantBase, relation: 'product' });
134
+ * ```
81
135
  */
82
136
  export interface IModelAccessThroughSettings {
83
137
  through: ScopeThrough;
@@ -93,19 +147,25 @@ export interface IModelQuerySettings {
93
147
  /** Default filter auto-applied to all repository operations. Bypassable via shouldSkipDefaultFilter. */
94
148
  filter?: TFilter;
95
149
  limit?: {
96
- /** Default row limit when a query omits `limit`. Must be a positive integer. Falls back to DEFAULT_LIMIT (10). */
150
+ /**
151
+ * Row limit when a query omits `limit`. Must be a positive integer.
152
+ *
153
+ * @default DEFAULT_LIMIT
154
+ */
97
155
  default?: number;
98
156
  /**
99
- * Largest `limit` a CALLER may ask for. Must be a positive integer. Falls back to
100
- * DEFAULT_MAX_LIMIT (1000).
157
+ * Largest `limit` a CALLER may ask for. Must be a positive integer.
101
158
  *
102
159
  * Policy, not capacity - the engine's own ceiling sits far above it. The number is chosen so
103
160
  * that reaching it means the caller is doing something unusual, and raising it is how a model
104
161
  * says so deliberately.
162
+ *
163
+ * @default DEFAULT_MAX_LIMIT
105
164
  */
106
165
  max?: number;
107
166
  };
108
167
  }
168
+ /** Per-model settings passed to `@model` as `settings`. */
109
169
  export interface IModelSettings {
110
170
  /** Properties excluded from all query results at SQL level. */
111
171
  hiddenProperties?: string[];
@@ -126,24 +186,36 @@ export interface IModelSettings {
126
186
  }
127
187
  /** Whether tooling that reads the model registry should migrate this model (`@model({ migration })`). */
128
188
  export interface IModelMigrationSettings {
129
- /** Default `true`. `false` marks the model as one a migration tool leaves alone. IGNIS generates no migrations itself. */
189
+ /**
190
+ * `false` marks the model as one a migration tool leaves alone. IGNIS generates no migrations itself.
191
+ *
192
+ * @default true
193
+ */
130
194
  use?: boolean;
131
195
  }
196
+ /** Metadata accepted by `@model`. */
132
197
  export interface IModelMetadata extends IArtifactRegistrationOptions {
133
- /** Optional: `ModelTypes.ENTITY` is the only value and the default. */
198
+ /**
199
+ * `ModelTypes.ENTITY` is the only value.
200
+ *
201
+ * @default ModelTypes.ENTITY
202
+ */
134
203
  type?: TModelType;
135
204
  tableName?: string;
136
205
  /** Migration marker for consumer tooling that reads the public registry. */
137
206
  migration?: IModelMigrationSettings;
138
207
  settings?: IModelSettings;
139
208
  }
209
+ /** Static members an entity class carries: its `schema` and its `relations` (value or resolver). */
140
210
  export interface IEntityStatics {
141
211
  schema?: unknown;
142
212
  relations?: TValueOrResolver<Array<unknown>>;
143
213
  }
214
+ /** A model class together with its entity statics. */
144
215
  export type TModelClass<Model extends AbstractEntity = AbstractEntity> = TClass<Model> & IEntityStatics;
145
216
  /** Decorator target for model classes (supports both strongly typed and ClassDecorator patterns). */
146
217
  export type TDecoratorModelTarget<Model extends AbstractEntity = AbstractEntity> = TModelClass<Model> | (Function & IEntityStatics);
218
+ /** One model as stored in the metadata registry: class, metadata and schema, with lazily resolved relations. */
147
219
  export interface IModelRegistryEntry<Model extends AbstractEntity = AbstractEntity> {
148
220
  target: TValueOrResolver<TClass<Model>>;
149
221
  metadata: IModelMetadata;
@@ -1 +1 @@
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 ScopeThrough,\n TFilter,\n TScopeFilterMissingBehavior,\n TScopeOperation,\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 /** A model declares a resolver or a `through`, never both. */\n through?: never;\n\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 * Receives `{ operation }`: the one concrete operation the call performs (`ScopeOperations.READ`,\n * `CREATE`, `UPDATE` or `DELETE`, never a group), so one function can answer a wide scope for a\n * read and a narrow one for a write. A read, and an included relation, pass `READ`; a create passes\n * `CREATE`; an update passes `UPDATE` for the payload check and for choosing the rows to update; a\n * delete, a soft delete included, passes `DELETE` for both; a restore passes `UPDATE`. A read with a\n * row `lock` passes `READ`. A resolver that takes no argument keeps working. An `or` over different\n * columns is still refused on a write, so return the narrow scope for a write operation.\n */\n resolve: (context: {\n operation: TScopeOperation;\n }) => 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/**\n * Row access for a child model that has no scope columns of its own: it inherits the scope of the parent a `one`\n * relation points at. A parent that resolves no scope always denies the child: `onMissing` is not offered here, because\n * `'allow'` would show the child's rows of every tenant while the parent shows none.\n */\nexport interface IModelAccessThroughSettings {\n through: ScopeThrough;\n onMissing?: never;\n resolve?: never;\n columns?: never;\n write?: never;\n}\n\n/** The two shapes of `@model` settings.access: a resolver, or a `through`. */\nexport type TModelAccessSettings = IModelAccessSettings | IModelAccessThroughSettings;\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?: TModelAccessSettings;\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\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 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 ScopeThrough,\n TFilter,\n TScopeFilterMissingBehavior,\n TScopeOperation,\n TScopeWriteGuard,\n TWhere,\n} from '@/base/repositories';\nimport type { TClass, TNullable, TValueOrResolver } from '@venizia/ignis-helpers/common';\nimport type { IArtifactRegistrationOptions } from './artifact';\n\n/** The `authorize` settings of a model. */\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` 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 * @default 'reject'\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. Without it, `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 * @default false\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 *\n * @example\n * ```typescript\n * import { model, ScopeWriteGuards } from '@venizia/ignis';\n * import { ModelFactory } from '@venizia/ignis-connectors/postgres';\n * import { pgTable, serial, text } from 'drizzle-orm/pg-core';\n *\n * const productTable = pgTable('Product', { id: serial('id').primaryKey(), merchantId: text('merchant_id') });\n *\n * export @model({ settings: { access: {\n * resolve: () => ({ merchantId: 'm-1' }),\n * write: { mode: ScopeWriteGuards.ASSIGN },\n * } } })\n * class Product extends ModelFactory.defineEntity({ table: productTable }) {}\n * ```\n */\nexport interface IModelAccessSettings {\n /** A model declares a resolver or a `through`, never both. */\n through?: never;\n\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 * Receives `{ operation }`: the one concrete operation the call performs (`ScopeOperations.READ`,\n * `CREATE`, `UPDATE` or `DELETE`, never a group), so one function can answer a wide scope for a\n * read and a narrow one for a write. A read, and an included relation, pass `READ`; a create passes\n * `CREATE`; an update passes `UPDATE` for the payload check and for choosing the rows to update; a\n * delete, a soft delete included, passes `DELETE` for both; a restore passes `UPDATE`. A read with a\n * row `lock` passes `READ`. A resolver that takes no argument keeps working. An `or` over different\n * columns is still refused on a write, so return the narrow scope for a write operation.\n */\n resolve: (context: {\n operation: TScopeOperation;\n }) => 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. With `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 * @default 'deny'\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/**\n * Row access for a child model that has no scope columns of its own: it inherits the scope of the parent a `one`\n * relation points at. A parent that resolves no scope always denies the child: `onMissing` is not offered here, because\n * `'allow'` would show the child's rows of every tenant while the parent shows none.\n *\n * @example\n * ```typescript\n * import { model, ScopeThrough } from '@venizia/ignis';\n * import { ModelFactory, one } from '@venizia/ignis-connectors/postgres';\n * import { integer, pgTable, serial } from 'drizzle-orm/pg-core';\n * const productTable = pgTable('Product', { id: serial('id').primaryKey() });\n * const variantTable = pgTable('Variant', {\n * id: serial('id').primaryKey(),\n * productId: integer('product_id').references(() => productTable.id),\n * });\n * const VariantBase = ModelFactory.defineEntity({ table: variantTable, relations: () => ({ product: one(productTable) }) });\n * export @model({ settings: { access: { through: ScopeThrough.of({ entity: VariantBase, relation: 'product' }) } } })\n * class Variant extends VariantBase {}\n * ```\n *\n * @example\n * ```typescript\n * // A hand-written entity declares the same relation by hand.\n * import { ScopeThrough } from '@venizia/ignis';\n * import { BaseEntity, one, RelationDeclarations } from '@venizia/ignis-connectors/postgres';\n * import { integer, pgTable, serial } from 'drizzle-orm/pg-core';\n * const productTable = pgTable('Product', { id: serial('id').primaryKey() });\n * const variantTable = pgTable('Variant', { id: serial('id').primaryKey(), productId: integer('product_id').references(() => productTable.id) });\n * const relations = { product: one(productTable) };\n * class VariantBase extends BaseEntity<typeof variantTable> {\n * static override schema = variantTable;\n * static readonly relationDefinitions = relations;\n * static override relations = () => RelationDeclarations.toRelationConfigs({ relations });\n * }\n * const through = ScopeThrough.of({ entity: VariantBase, relation: 'product' });\n * ```\n */\nexport interface IModelAccessThroughSettings {\n through: ScopeThrough;\n onMissing?: never;\n resolve?: never;\n columns?: never;\n write?: never;\n}\n\n/** The two shapes of `@model` settings.access: a resolver, or a `through`. */\nexport type TModelAccessSettings = IModelAccessSettings | IModelAccessThroughSettings;\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 /**\n * Row limit when a query omits `limit`. Must be a positive integer.\n *\n * @default DEFAULT_LIMIT\n */\n default?: number;\n\n /**\n * Largest `limit` a CALLER may ask for. Must be a positive integer.\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 * @default DEFAULT_MAX_LIMIT\n */\n max?: number;\n };\n}\n\n/** Per-model settings passed to `@model` as `settings`. */\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?: TModelAccessSettings;\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 /**\n * `false` marks the model as one a migration tool leaves alone. IGNIS generates no migrations itself.\n *\n * @default true\n */\n use?: boolean;\n}\n\n/** Metadata accepted by `@model`. */\nexport interface IModelMetadata extends IArtifactRegistrationOptions {\n /**\n * `ModelTypes.ENTITY` is the only value.\n *\n * @default ModelTypes.ENTITY\n */\n type?: TModelType;\n tableName?: string;\n\n /** Migration marker for consumer tooling that reads the public registry. */\n migration?: IModelMigrationSettings;\n\n settings?: IModelSettings;\n}\n\n/** Static members an entity class carries: its `schema` and its `relations` (value or resolver). */\nexport interface IEntityStatics {\n schema?: unknown;\n relations?: TValueOrResolver<Array<unknown>>;\n}\n\n/** A model class together with its entity statics. */\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\n/** One model as stored in the metadata registry: class, metadata and schema, with lazily resolved relations. */\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"]}
@@ -3,8 +3,14 @@ import type { AbstractEntity } from '../../../../base/models/index.js';
3
3
  import type { IRepository, RepositoryTypes, TRepositoryOperationScope, TRepositoryType } from '../../../../base/repositories/index.js';
4
4
  import type { TClass, TValueOrResolver } from '@venizia/ignis-helpers/common';
5
5
  import type { IArtifactRegistrationOptions, TDecoratorTarget } from './artifact.js';
6
+ /** Metadata accepted by `@datasource`. */
6
7
  export interface IDataSourceMetadata extends IArtifactRegistrationOptions {
7
8
  driver?: TDataSourceDriverClass;
9
+ /**
10
+ * `false` stops model schema discovery for the datasource.
11
+ *
12
+ * @default true
13
+ */
8
14
  autoDiscovery?: boolean;
9
15
  }
10
16
  /** Members every repository type shares. */
@@ -12,8 +18,9 @@ export interface IRepositoryMetadataBase<DataSource extends IDataSource = IDataS
12
18
  dataSource: string | TValueOrResolver<TClass<DataSource>>;
13
19
  operationScope?: TRepositoryOperationScope;
14
20
  }
15
- /** `RepositoryTypes.MODEL` - the default when `type` is omitted - a model this application declares. */
21
+ /** `RepositoryTypes.MODEL` - a model this application declares. */
16
22
  export interface IRepositoryMetadata<Model extends AbstractEntity = AbstractEntity, DataSource extends IDataSource = IDataSource> extends IRepositoryMetadataBase<DataSource> {
23
+ /** @default RepositoryTypes.MODEL */
17
24
  type?: typeof RepositoryTypes.MODEL;
18
25
  model: TValueOrResolver<TClass<Model>>;
19
26
  }
@@ -31,6 +38,7 @@ export interface IResolvedRepositoryMetadata<Model extends AbstractEntity = Abst
31
38
  dataSource?: string | TClass<DataSource>;
32
39
  operationScope?: TRepositoryOperationScope;
33
40
  }
41
+ /** Links a model to the repository and datasource that serve it, each given as a value or a resolver. */
34
42
  export interface IRepositoryBinding<Model extends AbstractEntity = AbstractEntity, DataSource extends IDataSource = IDataSource> {
35
43
  model: TValueOrResolver<TClass<Model>>;
36
44
  repository: TValueOrResolver<TDecoratorTarget<IRepository>>;