@venizia/ignis-kernel 0.4.7-0 → 0.4.7-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 (172) hide show
  1. package/LICENSE.md +1 -4
  2. package/dist/esm/base/applications/cors.d.ts +12 -10
  3. package/dist/esm/base/applications/cors.d.ts.map +1 -1
  4. package/dist/esm/base/applications/cors.js +37 -35
  5. package/dist/esm/base/applications/cors.js.map +1 -1
  6. package/dist/esm/base/applications/rest.js +11 -11
  7. package/dist/esm/base/applications/rest.js.map +1 -1
  8. package/dist/esm/base/auth/authenticate/common/codecs.js +2 -2
  9. package/dist/esm/base/auth/authenticate/common/codecs.js.map +1 -1
  10. package/dist/esm/base/auth/authenticate/strategies/strategy-registry.d.ts +1 -1
  11. package/dist/esm/base/auth/authenticate/strategies/strategy-registry.js +1 -1
  12. package/dist/esm/base/auth/authenticate/strategies/strategy-registry.js.map +1 -1
  13. package/dist/esm/base/auth/authorize/providers/authorization.provider.js +7 -7
  14. package/dist/esm/base/auth/authorize/providers/authorization.provider.js.map +1 -1
  15. package/dist/esm/base/auth/authorize/providers/request-domain.d.ts +14 -11
  16. package/dist/esm/base/auth/authorize/providers/request-domain.d.ts.map +1 -1
  17. package/dist/esm/base/auth/authorize/providers/request-domain.js +42 -39
  18. package/dist/esm/base/auth/authorize/providers/request-domain.js.map +1 -1
  19. package/dist/esm/base/auth/base/abstract-auth-registry.js +2 -2
  20. package/dist/esm/base/auth/base/abstract-auth-registry.js.map +1 -1
  21. package/dist/esm/base/auth/models/requests/change-password.schema.js +3 -3
  22. package/dist/esm/base/auth/models/requests/change-password.schema.js.map +1 -1
  23. package/dist/esm/base/auth/models/requests/sign-in.schema.js +5 -5
  24. package/dist/esm/base/auth/models/requests/sign-in.schema.js.map +1 -1
  25. package/dist/esm/base/components/controller/rest/rest.component.js +2 -2
  26. package/dist/esm/base/components/controller/rest/rest.component.js.map +1 -1
  27. package/dist/esm/base/controllers/common/index.d.ts +0 -1
  28. package/dist/esm/base/controllers/common/index.d.ts.map +1 -1
  29. package/dist/esm/base/controllers/common/index.js +0 -1
  30. package/dist/esm/base/controllers/common/index.js.map +1 -1
  31. package/dist/esm/base/controllers/common/schema-builders.d.ts +0 -5
  32. package/dist/esm/base/controllers/common/schema-builders.d.ts.map +1 -1
  33. package/dist/esm/base/controllers/common/schema-builders.js +0 -14
  34. package/dist/esm/base/controllers/common/schema-builders.js.map +1 -1
  35. package/dist/esm/base/controllers/context.d.ts +7 -2
  36. package/dist/esm/base/controllers/context.d.ts.map +1 -1
  37. package/dist/esm/base/controllers/context.js +7 -4
  38. package/dist/esm/base/controllers/context.js.map +1 -1
  39. package/dist/esm/base/controllers/factory/controller.d.ts +33 -1
  40. package/dist/esm/base/controllers/factory/controller.d.ts.map +1 -1
  41. package/dist/esm/base/controllers/factory/controller.js +90 -6
  42. package/dist/esm/base/controllers/factory/controller.js.map +1 -1
  43. package/dist/esm/base/controllers/factory/crud/persistable.d.ts.map +1 -1
  44. package/dist/esm/base/controllers/factory/crud/persistable.js +9 -1
  45. package/dist/esm/base/controllers/factory/crud/persistable.js.map +1 -1
  46. package/dist/esm/base/controllers/factory/definition.d.ts +1 -8
  47. package/dist/esm/base/controllers/factory/definition.d.ts.map +1 -1
  48. package/dist/esm/base/controllers/factory/definition.js +17 -24
  49. package/dist/esm/base/controllers/factory/definition.js.map +1 -1
  50. package/dist/esm/base/controllers/factory/index.d.ts +0 -1
  51. package/dist/esm/base/controllers/factory/index.d.ts.map +1 -1
  52. package/dist/esm/base/controllers/factory/index.js +0 -1
  53. package/dist/esm/base/controllers/factory/index.js.map +1 -1
  54. package/dist/esm/base/controllers/rest/abstract.d.ts.map +1 -1
  55. package/dist/esm/base/controllers/rest/abstract.js +6 -6
  56. package/dist/esm/base/controllers/rest/abstract.js.map +1 -1
  57. package/dist/esm/base/controllers/rest/base.d.ts +0 -5
  58. package/dist/esm/base/controllers/rest/base.d.ts.map +1 -1
  59. package/dist/esm/base/controllers/rest/base.js +14 -14
  60. package/dist/esm/base/controllers/rest/base.js.map +1 -1
  61. package/dist/esm/base/datasources/abstract.js +2 -2
  62. package/dist/esm/base/datasources/abstract.js.map +1 -1
  63. package/dist/esm/base/events/event-bus.js +4 -4
  64. package/dist/esm/base/events/event-bus.js.map +1 -1
  65. package/dist/esm/base/metadata/injectable.d.ts +7 -4
  66. package/dist/esm/base/metadata/injectable.d.ts.map +1 -1
  67. package/dist/esm/base/metadata/injectable.js +26 -23
  68. package/dist/esm/base/metadata/injectable.js.map +1 -1
  69. package/dist/esm/base/metadata/model-metadata.d.ts +27 -13
  70. package/dist/esm/base/metadata/model-metadata.d.ts.map +1 -1
  71. package/dist/esm/base/metadata/model-metadata.js +56 -26
  72. package/dist/esm/base/metadata/model-metadata.js.map +1 -1
  73. package/dist/esm/base/metadata/persistents.d.ts.map +1 -1
  74. package/dist/esm/base/metadata/persistents.js +21 -13
  75. package/dist/esm/base/metadata/persistents.js.map +1 -1
  76. package/dist/esm/base/metadata/routes/controller.d.ts.map +1 -1
  77. package/dist/esm/base/metadata/routes/controller.js +5 -2
  78. package/dist/esm/base/metadata/routes/controller.js.map +1 -1
  79. package/dist/esm/base/middlewares/app-error/app-error.middleware.d.ts.map +1 -1
  80. package/dist/esm/base/middlewares/app-error/app-error.middleware.js +8 -7
  81. package/dist/esm/base/middlewares/app-error/app-error.middleware.js.map +1 -1
  82. package/dist/esm/base/middlewares/app-error/database.handler.d.ts +14 -12
  83. package/dist/esm/base/middlewares/app-error/database.handler.d.ts.map +1 -1
  84. package/dist/esm/base/middlewares/app-error/database.handler.js +37 -35
  85. package/dist/esm/base/middlewares/app-error/database.handler.js.map +1 -1
  86. package/dist/esm/base/middlewares/app-error/zod.handler.d.ts +28 -23
  87. package/dist/esm/base/middlewares/app-error/zod.handler.d.ts.map +1 -1
  88. package/dist/esm/base/middlewares/app-error/zod.handler.js +56 -53
  89. package/dist/esm/base/middlewares/app-error/zod.handler.js.map +1 -1
  90. package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.d.ts +6 -4
  91. package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.d.ts.map +1 -1
  92. package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.js +14 -12
  93. package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.js.map +1 -1
  94. package/dist/esm/base/middlewares/form-body/form-body.middleware.d.ts +15 -11
  95. package/dist/esm/base/middlewares/form-body/form-body.middleware.d.ts.map +1 -1
  96. package/dist/esm/base/middlewares/form-body/form-body.middleware.js +25 -21
  97. package/dist/esm/base/middlewares/form-body/form-body.middleware.js.map +1 -1
  98. package/dist/esm/base/models/common/schemas.d.ts +184 -105
  99. package/dist/esm/base/models/common/schemas.d.ts.map +1 -1
  100. package/dist/esm/base/models/common/schemas.js +105 -54
  101. package/dist/esm/base/models/common/schemas.js.map +1 -1
  102. package/dist/esm/base/models/common/utilities.d.ts +10 -5
  103. package/dist/esm/base/models/common/utilities.d.ts.map +1 -1
  104. package/dist/esm/base/models/common/utilities.js +22 -16
  105. package/dist/esm/base/models/common/utilities.js.map +1 -1
  106. package/dist/esm/base/repositories/common/response-reader.d.ts.map +1 -1
  107. package/dist/esm/base/repositories/common/response-reader.js +10 -1
  108. package/dist/esm/base/repositories/common/response-reader.js.map +1 -1
  109. package/dist/esm/base/repositories/common/types/results.d.ts +15 -7
  110. package/dist/esm/base/repositories/common/types/results.d.ts.map +1 -1
  111. package/dist/esm/base/repositories/common/types/results.js +16 -7
  112. package/dist/esm/base/repositories/common/types/results.js.map +1 -1
  113. package/dist/esm/base/repositories/core/abstract.d.ts.map +1 -1
  114. package/dist/esm/base/repositories/core/abstract.js +5 -3
  115. package/dist/esm/base/repositories/core/abstract.js.map +1 -1
  116. package/dist/esm/base/repositories/query-schemas/index.d.ts +1 -1
  117. package/dist/esm/base/repositories/query-schemas/index.d.ts.map +1 -1
  118. package/dist/esm/base/repositories/query-schemas/index.js +3 -3
  119. package/dist/esm/base/repositories/query-schemas/index.js.map +1 -1
  120. package/dist/esm/helpers/inversion/common/relation-builder.js.map +1 -1
  121. package/dist/esm/helpers/inversion/container.d.ts +1 -1
  122. package/dist/esm/helpers/inversion/container.d.ts.map +1 -1
  123. package/dist/esm/helpers/inversion/container.js +1 -1
  124. package/dist/esm/helpers/inversion/container.js.map +1 -1
  125. package/dist/esm/helpers/inversion/index.d.ts +1 -1
  126. package/dist/esm/helpers/inversion/index.d.ts.map +1 -1
  127. package/dist/esm/helpers/inversion/index.js +1 -1
  128. package/dist/esm/helpers/inversion/index.js.map +1 -1
  129. package/dist/esm/helpers/inversion/mixins/repository.mixin.d.ts.map +1 -1
  130. package/dist/esm/helpers/inversion/mixins/repository.mixin.js +5 -5
  131. package/dist/esm/helpers/inversion/mixins/repository.mixin.js.map +1 -1
  132. package/dist/esm/metadata.d.ts +1 -1
  133. package/dist/esm/metadata.d.ts.map +1 -1
  134. package/dist/esm/metadata.js +1 -1
  135. package/dist/esm/metadata.js.map +1 -1
  136. package/dist/esm/repository.d.ts +2 -2
  137. package/dist/esm/repository.d.ts.map +1 -1
  138. package/dist/esm/repository.js +2 -2
  139. package/dist/esm/repository.js.map +1 -1
  140. package/dist/esm/utilities/index.d.ts +1 -1
  141. package/dist/esm/utilities/index.d.ts.map +1 -1
  142. package/dist/esm/utilities/index.js +1 -1
  143. package/dist/esm/utilities/index.js.map +1 -1
  144. package/dist/esm/utilities/not-supported.utility.d.ts +11 -0
  145. package/dist/esm/utilities/not-supported.utility.d.ts.map +1 -0
  146. package/dist/esm/utilities/not-supported.utility.js +19 -0
  147. package/dist/esm/utilities/not-supported.utility.js.map +1 -0
  148. package/package.json +6 -7
  149. package/dist/esm/base/controllers/common/html-response.d.ts +0 -70
  150. package/dist/esm/base/controllers/common/html-response.d.ts.map +0 -1
  151. package/dist/esm/base/controllers/common/html-response.js +0 -30
  152. package/dist/esm/base/controllers/common/html-response.js.map +0 -1
  153. package/dist/esm/base/controllers/factory/authorize-guard.d.ts +0 -19
  154. package/dist/esm/base/controllers/factory/authorize-guard.d.ts.map +0 -1
  155. package/dist/esm/base/controllers/factory/authorize-guard.js +0 -56
  156. package/dist/esm/base/controllers/factory/authorize-guard.js.map +0 -1
  157. package/dist/esm/base/controllers/factory/helper.d.ts +0 -2
  158. package/dist/esm/base/controllers/factory/helper.d.ts.map +0 -1
  159. package/dist/esm/base/controllers/factory/helper.js +0 -2
  160. package/dist/esm/base/controllers/factory/helper.js.map +0 -1
  161. package/dist/esm/base/controllers/factory/repository-injection.d.ts +0 -14
  162. package/dist/esm/base/controllers/factory/repository-injection.d.ts.map +0 -1
  163. package/dist/esm/base/controllers/factory/repository-injection.js +0 -27
  164. package/dist/esm/base/controllers/factory/repository-injection.js.map +0 -1
  165. package/dist/esm/base/metadata/model-settings.d.ts +0 -11
  166. package/dist/esm/base/metadata/model-settings.d.ts.map +0 -1
  167. package/dist/esm/base/metadata/model-settings.js +0 -30
  168. package/dist/esm/base/metadata/model-settings.js.map +0 -1
  169. package/dist/esm/utilities/error.utility.d.ts +0 -8
  170. package/dist/esm/utilities/error.utility.d.ts.map +0 -1
  171. package/dist/esm/utilities/error.utility.js +0 -14
  172. package/dist/esm/utilities/error.utility.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../../../src/base/repositories/core/abstract.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAYpG,sGAAsG;AACtG,sFAAsF;AACtF,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAU7B;;;;GAIG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AC,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;YACjE,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAA0B;SAC5F,CAAC,CAAC;IACL,CAAC;IAqFD,QAAQ,CAAkB,IAIzB;QACC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEtC,IAAI,OAAO,EAAE,YAAY,KAAK,KAAK,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACvF,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC;IA+BD,QAAQ,CAAkB,IAGzB;QACC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEhC,IAAI,OAAO,EAAE,YAAY,KAAK,KAAK,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACjF,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF","sourcesContent":["import type { AbstractDataSource } from '@/base/datasources';\nimport type { AbstractEntity, IdType } from '@/base/models';\nimport type { IModelMetadata } from '@/helpers/inversion';\nimport { MetadataRegistry } from '@/helpers/inversion';\nimport type { TClass, TNullable } from '@venizia/ignis-helpers/common';\nimport { BaseHelper, getError } from '@venizia/ignis-helpers/core';\nimport { resolveValue } from '@venizia/ignis-helpers/common';\nimport { RetryBackoffStrategies, RetryHelper, RetryJitterModes } from '@venizia/ignis-helpers/core';\nimport type {\n IExtraOptions,\n IPersistableRepository,\n IWithReadRetry,\n TCount,\n TDataWithRange,\n TFindOneOptions,\n TFindOptions,\n TFindRangeOptions,\n TRepositoryOperationScope,\n} from '../common';\n// The file, not the `../common` barrel: the barrel re-exports the OpenAPI schemas, and this module is\n// on the `./repository` entry, which must load without `@hono/zod-openapi` installed.\nimport {\n DEFAULT_MAX_LIMIT,\n RepositoryErrorCodes,\n RepositoryOperationScopes,\n} from '../common/constants';\nimport type {\n TByIdFilter,\n TFields,\n TFilter,\n TInclusion,\n TRow,\n TWhere,\n} from '@venizia/ignis-filter';\n\n/**\n * Engine-neutral repository plumbing - lazy dataSource/entity resolution, class-keyed `@model`\n * settings, operation scope. `TOptions` defaults to `IExtraOptions` so connectors can narrow it\n * while staying assignable to this base.\n */\nexport abstract class AbstractRepository<\n TDataObject extends object,\n TPersistObject extends object = TDataObject,\n TOptions extends IExtraOptions = IExtraOptions,\n>\n extends BaseHelper\n implements IPersistableRepository<TDataObject, TPersistObject, TOptions>\n{\n protected _operationScope: TRepositoryOperationScope;\n\n /** Lazy-resolved on first access if not provided in constructor. */\n protected _dataSource?: AbstractDataSource;\n\n /** Lazy-resolved from @repository metadata on first access. */\n protected _entity?: AbstractEntity;\n\n /**\n * Memoized @model settings for `this.entity`'s class. `null` means not yet resolved - `undefined`\n * is itself a valid resolved value: the model declares no settings.\n */\n private _modelSettings: IModelMetadata['settings'] | null = null;\n\n constructor(\n dataSource?: AbstractDataSource,\n opts?: {\n scope?: string;\n entityClass?: TClass<AbstractEntity>;\n operationScope?: TRepositoryOperationScope;\n },\n ) {\n const scopeName =\n opts?.scope ??\n (opts?.entityClass?.name ? [opts.entityClass.name, 'Repository'].join('') : new.target.name);\n\n super({ scope: scopeName });\n\n this._operationScope = opts?.operationScope ?? RepositoryOperationScopes.READ_ONLY;\n\n if (dataSource) {\n this._dataSource = dataSource;\n }\n\n if (opts?.entityClass) {\n this._entity = new opts.entityClass();\n }\n }\n\n get dataSource(): AbstractDataSource {\n if (!this._dataSource) {\n throw getError({\n message: `[${this.constructor.name}] DataSource not available. Use @repository({ model: YourModel, dataSource: YourDataSource }) or pass dataSource in constructor.`,\n });\n }\n\n return this._dataSource;\n }\n\n set dataSource(value: AbstractDataSource) {\n this._dataSource = value;\n }\n\n /** Auto-resolves from @repository metadata if not explicitly set. */\n get entity(): AbstractEntity {\n this._entity ??= this.resolveEntity();\n return this._entity;\n }\n\n set entity(value: AbstractEntity) {\n this._entity = value;\n }\n\n get operationScope(): TRepositoryOperationScope {\n return this._operationScope;\n }\n\n setDataSource(opts: { dataSource: AbstractDataSource }): void {\n this._dataSource = opts.dataSource;\n }\n\n getEntity(): AbstractEntity {\n return this.entity;\n }\n\n /**\n * Resolved `@model` settings for `this.entity`'s class, keyed by Reflect target - not by\n * `entity.name`, which can diverge from the `@model` registry key.\n */\n protected get modelSettings(): IModelMetadata['settings'] {\n if (this._modelSettings !== null) {\n return this._modelSettings;\n }\n\n this._modelSettings = MetadataRegistry.getInstance().getModelMetadata({\n target: this.entity.constructor,\n })?.settings;\n\n return this._modelSettings;\n }\n\n protected get hiddenFields(): string[] {\n return this.modelSettings?.hiddenProperties ?? [];\n }\n\n /** Default where from @model settings.query.filter.where, AND-merged into every query unless skipped. */\n protected get defaultWhere(): TWhere | undefined {\n return this.modelSettings?.query?.filter?.where;\n }\n\n protected get defaultLimit(): number | undefined {\n return this.modelSettings?.query?.limit?.default;\n }\n\n /** Largest `limit` a caller may ask for, when the model declares one; undefined leaves the tier's own default in force. */\n protected get maxLimit(): number | undefined {\n return this.modelSettings?.query?.limit?.max;\n }\n\n /**\n * Both bounds, in one place, for every tier.\n *\n * The upper bound is the point: `@model({ settings: { maxLimit } })` is public and validated at\n * decoration time, but the relational tier read it nowhere, so `maxLimit: 2` still issued\n * `LIMIT 50000000`.\n *\n * The lower bound matters just as much and is easy to miss: a NEGATIVE limit is not a smaller\n * page. Drizzle renders the LIMIT clause only when the value is `>= 0`, so a negative one removes\n * the clause and returns the whole table. The wire schema now rejects it too, but a server-side\n * caller reaches this method without passing through the schema at all.\n */\n protected assertLimitWithinCeiling(opts: { limit?: number; scope?: string }): void {\n const { limit, scope = 'find' } = opts;\n\n if (limit === undefined) {\n return;\n }\n\n // The shape check first, because it needs no metadata at all.\n if (!Number.isInteger(limit) || limit < 0) {\n throw getError({\n message: `[${this.constructor.name}][${scope}] Invalid 'limit' | Expected a non-negative integer | Got: ${limit}`,\n });\n }\n\n // `maxLimit` reaches `modelSettings`, which resolves the entity - and THAT throws for a\n // repository with no `@repository` model binding. Such a repository is a misconfiguration this\n // method has no business reporting, and the caller path that used to reach `getDefaultLimit()`\n // never touched it either, because `??` short-circuits when a limit is given. So the ceiling is\n // consulted only when the binding that makes it resolvable is actually present.\n const hasModelBinding = Boolean(\n MetadataRegistry.getInstance().getRepositoryBinding({ target: this.constructor })?.model,\n );\n const ceiling = (hasModelBinding ? this.maxLimit : undefined) ?? DEFAULT_MAX_LIMIT;\n\n if (limit > ceiling) {\n throw getError({\n message: `[${this.constructor.name}][${scope}] Requested page exceeds this model's limit | requested: ${limit} | maximum: ${ceiling} | raise it with @model settings.maxLimit if larger pages are genuinely needed`,\n });\n }\n }\n\n /**\n * The whole filter, relations included. Checking only the top-level `limit` left the identical\n * defect reachable one level down: a relation scope's negative limit drops Drizzle's LIMIT clause\n * for that relation and loads the entire related table.\n *\n * A relation's limit gets the SHAPE check only, not a ceiling. The ceiling belongs to the\n * relation's own model, which this repository cannot resolve - claiming otherwise would enforce\n * the parent's `maxLimit` on a different entity.\n */\n protected assertFilterLimits(opts: { filter?: TFilter; scope?: string }): void {\n const { filter, scope = 'find' } = opts;\n\n if (!filter) {\n return;\n }\n\n this.assertLimitWithinCeiling({ limit: filter.limit, scope });\n\n const walk = (inclusions: TInclusion[] | undefined, path: string): void => {\n const inclusionsList = inclusions ?? [];\n for (const inclusion of inclusionsList) {\n const relationScope = inclusion.scope;\n if (!relationScope) {\n continue;\n }\n\n const relationPath = `${path}.${inclusion.relation}`;\n const relationLimit = relationScope.limit;\n\n if (\n relationLimit !== undefined &&\n (!Number.isInteger(relationLimit) || relationLimit < 0)\n ) {\n throw getError({\n message: `[${this.constructor.name}][${scope}] Invalid 'limit' on relation scope | relation: ${relationPath} | Expected a non-negative integer | Got: ${relationLimit}`,\n });\n }\n\n walk(relationScope.include, relationPath);\n }\n };\n\n walk(filter.include, scope);\n }\n\n /** Resolves the entity instance from @repository metadata on first access. */\n protected resolveEntity(): AbstractEntity {\n const registry = MetadataRegistry.getInstance();\n const binding = registry.getRepositoryBinding({ target: this.constructor });\n\n if (!binding?.model) {\n throw getError({\n message: `[${this.constructor.name}] Cannot resolve entity. Either pass entityClass in constructor or use @repository decorator with model option.`,\n });\n }\n\n // resolveValue() erases to the resolved value's structural type, not this class-or-resolver\n // union's member - the `@repository` decorator guarantees a class constructor here.\n const ModelClass = resolveValue({ value: binding.model }) as TClass<AbstractEntity>;\n return new ModelClass();\n }\n\n /** Rejects a verb the current operation scope does not permit. */\n protected denyOperation(opts: { methodName: string }): never {\n throw getError({\n messageCode: RepositoryErrorCodes.OPERATION_NOT_ALLOWED,\n message: `[${opts.methodName}] Repository operation is NOT ALLOWED | scope: ${this.operationScope}`,\n });\n }\n\n /**\n * Shared retry orchestration for read verbs. Inside a transaction retry is skipped - the pool\n * routes transactions to the primary, so there is no replica lag to wait out.\n */\n protected executeReadWithRetry<TResult>(opts: {\n operation: string;\n options: IExtraOptions & IWithReadRetry<TResult>;\n defaultUntil: (result: TResult) => boolean;\n execution: () => Promise<TResult>;\n }): Promise<TResult> {\n const { operation, options, defaultUntil, execution } = opts;\n\n if (!options.retry) {\n return execution();\n }\n\n if (options.transaction) {\n this.logger.for(operation).debug('Read retry skipped inside transaction');\n return execution();\n }\n\n const { maxAttempts, maxTotalMs, signal, backoff, until } = options.retry;\n\n return RetryHelper.executeWithRetryUntil<TResult>({\n operation: [this.constructor.name, operation].join('.'),\n execution,\n until: until ?? defaultUntil,\n maxAttempts,\n maxTotalMs,\n signal,\n backoff: backoff ?? {\n strategy: RetryBackoffStrategies.EXPONENTIAL,\n initialDelayMs: 50,\n maxDelayMs: 500,\n jitter: RetryJitterModes.EQUAL,\n },\n logger: this.logger,\n });\n }\n\n /**\n * A copy of `options` without `retry`, so re-entering a read verb takes its non-retry path - this\n * is what keeps the retry recursion single-depth. Copy-then-delete rather than a rest-destructure\n * (lint rejects the unused rest sibling) or `lodash/omit` (its `Omit<>` return type is not\n * assignable back to `TOptions`).\n */\n private omitReadRetry<TReadOptions extends { retry?: unknown }>(\n options: TReadOptions,\n ): TReadOptions {\n const rest = { ...options };\n delete rest.retry;\n return rest;\n }\n\n /** `find`, re-executed until the retry predicate holds - connectors dispatch here from `find` when `options.retry` is set. */\n protected findUntil<R = TDataObject>(opts: {\n filter: TFilter<TDataObject>;\n options: TFindOptions<TOptions, R>;\n }): Promise<Array<R>> {\n const options = this.omitReadRetry(opts.options);\n\n return this.executeReadWithRetry<Array<R>>({\n operation: 'find',\n options: opts.options,\n defaultUntil: (result) => result.length > 0,\n // `R` is named here, so the row is `R`; TypeScript cannot resolve `TRow` for an unresolved `R`.\n execution: () => this.find<R>({ filter: opts.filter, options }) as Promise<Array<R>>,\n });\n }\n\n /** `find` with the range envelope, re-executed until the retry predicate holds - split from `findUntil` so each result shape is checked against its own `find` overload. */\n protected findRangeUntil<R = TDataObject>(opts: {\n filter: TFilter<TDataObject>;\n options: TFindRangeOptions<TOptions, R>;\n }): Promise<TDataWithRange<R>> {\n const options = this.omitReadRetry(opts.options);\n\n return this.executeReadWithRetry<TDataWithRange<R>>({\n operation: 'find',\n options: opts.options,\n defaultUntil: (result) => result.data.length > 0,\n execution: () =>\n this.find<R>({ filter: opts.filter, options }) as unknown as Promise<TDataWithRange<R>>,\n });\n }\n\n /** `findOne`, re-executed until the retry predicate holds - also serves `findById` via its findOne delegation. */\n protected findOneUntil<R = TDataObject>(opts: {\n filter: TFilter<TDataObject>;\n options: TFindOneOptions<TOptions, R>;\n }): Promise<TNullable<R>> {\n const options = this.omitReadRetry(opts.options);\n\n return this.executeReadWithRetry<TNullable<R>>({\n operation: 'findOne',\n options: opts.options,\n defaultUntil: (result) => result !== null && result !== undefined,\n execution: () => this.findOne<R>({ filter: opts.filter, options }) as Promise<TNullable<R>>,\n });\n }\n\n abstract count(opts: { where: TWhere<TDataObject>; options?: TOptions }): Promise<TCount>;\n\n abstract existsWith(opts: { where: TWhere<TDataObject>; options?: TOptions }): Promise<boolean>;\n\n abstract find<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {\n filter: TFilter<TDataObject, F>;\n options: TFindRangeOptions<TOptions, TRow<TDataObject, R, F>>;\n }): Promise<TDataWithRange<TRow<TDataObject, R, F>>>;\n\n abstract find<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {\n filter: TFilter<TDataObject, F>;\n options?: TFindOptions<TOptions, TRow<TDataObject, R, F>>;\n }): Promise<Array<TRow<TDataObject, R, F>>>;\n\n abstract findOne<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {\n filter: TFilter<TDataObject, F>;\n options?: TFindOneOptions<TOptions, TRow<TDataObject, R, F>>;\n }): Promise<TNullable<TRow<TDataObject, R, F>>>;\n\n abstract findById<\n R = unknown,\n const F extends TFields<TDataObject> = TFields<TDataObject>,\n >(opts: {\n id: IdType;\n filter?: TByIdFilter<TDataObject, F>;\n options?: TFindOneOptions<TOptions, TRow<TDataObject, R, F>>;\n }): Promise<TNullable<TRow<TDataObject, R, F>>>;\n\n abstract create(opts: {\n data: TPersistObject;\n options: TOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n\n abstract create<R = TDataObject>(opts: {\n data: TPersistObject;\n options?: TOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n\n abstract createAll(opts: {\n data: Array<TPersistObject>;\n options: TOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n\n abstract createAll<R = TDataObject>(opts: {\n data: Array<TPersistObject>;\n options?: TOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: Array<R> }>;\n\n abstract updateById(opts: {\n id: IdType;\n data: Partial<TPersistObject>;\n options: TOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n\n abstract updateById<R = TDataObject>(opts: {\n id: IdType;\n data: Partial<TPersistObject>;\n options?: TOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n\n abstract updateAll(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options: TOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n\n abstract updateAll<R = TDataObject>(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options?: TOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n\n /** Alias for updateAll. */\n updateBy(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options: TOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n updateBy<R = TDataObject>(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options?: TOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n updateBy<R = TDataObject>(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options?: TOptions & { shouldReturn?: boolean; force?: boolean };\n }): Promise<TCount & { data: TNullable<Array<R>> }> {\n const { data, where, options } = opts;\n\n if (options?.shouldReturn === false) {\n return this.updateAll({ data, where, options: { ...options, shouldReturn: false } });\n }\n\n return this.updateAll<R>({ data, where, options });\n }\n\n abstract deleteById(opts: {\n id: IdType;\n options: TOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n\n abstract deleteById<R = TDataObject>(opts: {\n id: IdType;\n options?: TOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n\n abstract deleteAll(opts: {\n where?: TWhere<TDataObject>;\n options: TOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n\n abstract deleteAll<R = TDataObject>(opts: {\n where?: TWhere<TDataObject>;\n options?: TOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n\n /** Alias for deleteAll. */\n deleteBy(opts: {\n where: TWhere<TDataObject>;\n options: TOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n deleteBy<R = TDataObject>(opts: {\n where: TWhere<TDataObject>;\n options?: TOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n deleteBy<R = TDataObject>(opts: {\n where: TWhere<TDataObject>;\n options?: TOptions & { shouldReturn?: boolean; force?: boolean };\n }): Promise<TCount & { data: TNullable<Array<R>> }> {\n const { where, options } = opts;\n\n if (options?.shouldReturn === false) {\n return this.deleteAll({ where, options: { ...options, shouldReturn: false } });\n }\n\n return this.deleteAll<R>({ where, options });\n }\n}\n"]}
1
+ {"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../../../src/base/repositories/core/abstract.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAYpG,sGAAsG;AACtG,sFAAsF;AACtF,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAU7B;;;;GAIG;AACH,MAAM,OAAgB,kBAKpB,SAAQ,UAAU;IAiBlB,YACE,UAA+B,EAC/B,IAIC;QAED,MAAM,SAAS,GACb,I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AAI,CAAC,OAAO,CAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAA0B;SAC5F,CAAC,CAAC;IACL,CAAC;IAqFD,QAAQ,CAAkB,IAIzB;QACC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEtC,IAAI,OAAO,EAAE,YAAY,KAAK,KAAK,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACvF,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC;IA+BD,QAAQ,CAAkB,IAGzB;QACC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEhC,IAAI,OAAO,EAAE,YAAY,KAAK,KAAK,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACjF,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF","sourcesContent":["import type { AbstractDataSource } from '@/base/datasources';\nimport type { AbstractEntity, IdType } from '@/base/models';\nimport type { IModelMetadata } from '@/helpers/inversion';\nimport { MetadataRegistry } from '@/helpers/inversion';\nimport type { TClass, TNullable } from '@venizia/ignis-helpers/common';\nimport { BaseHelper, getError } from '@venizia/ignis-helpers/core';\nimport { ResolverUtility } from '@venizia/ignis-helpers/common';\nimport { RetryBackoffStrategies, RetryHelper, RetryJitterModes } from '@venizia/ignis-helpers/core';\nimport type {\n IExtraOptions,\n IPersistableRepository,\n IWithReadRetry,\n TCount,\n TDataWithRange,\n TFindOneOptions,\n TFindOptions,\n TFindRangeOptions,\n TRepositoryOperationScope,\n} from '../common';\n// The file, not the `../common` barrel: the barrel re-exports the OpenAPI schemas, and this module is\n// on the `./repository` entry, which must load without `@hono/zod-openapi` installed.\nimport {\n DEFAULT_MAX_LIMIT,\n RepositoryErrorCodes,\n RepositoryOperationScopes,\n} from '../common/constants';\nimport type {\n TByIdFilter,\n TFields,\n TFilter,\n TInclusion,\n TRow,\n TWhere,\n} from '@venizia/ignis-filter';\n\n/**\n * Engine-neutral repository plumbing - lazy dataSource/entity resolution, class-keyed `@model`\n * settings, operation scope. `TOptions` defaults to `IExtraOptions` so connectors can narrow it\n * while staying assignable to this base.\n */\nexport abstract class AbstractRepository<\n TDataObject extends object,\n TPersistObject extends object = TDataObject,\n TOptions extends IExtraOptions = IExtraOptions,\n>\n extends BaseHelper\n implements IPersistableRepository<TDataObject, TPersistObject, TOptions>\n{\n protected _operationScope: TRepositoryOperationScope;\n\n /** Lazy-resolved on first access if not provided in constructor. */\n protected _dataSource?: AbstractDataSource;\n\n /** Lazy-resolved from @repository metadata on first access. */\n protected _entity?: AbstractEntity;\n\n /**\n * Memoized @model settings for `this.entity`'s class. `null` means not yet resolved - `undefined`\n * is itself a valid resolved value: the model declares no settings.\n */\n private _modelSettings: IModelMetadata['settings'] | null = null;\n\n constructor(\n dataSource?: AbstractDataSource,\n opts?: {\n scope?: string;\n entityClass?: TClass<AbstractEntity>;\n operationScope?: TRepositoryOperationScope;\n },\n ) {\n const scopeName =\n opts?.scope ??\n (opts?.entityClass?.name ? [opts.entityClass.name, 'Repository'].join('') : new.target.name);\n\n super({ scope: scopeName });\n\n this._operationScope = opts?.operationScope ?? RepositoryOperationScopes.READ_ONLY;\n\n if (dataSource) {\n this._dataSource = dataSource;\n }\n\n if (opts?.entityClass) {\n this._entity = new opts.entityClass();\n }\n }\n\n get dataSource(): AbstractDataSource {\n if (!this._dataSource) {\n throw getError({\n message: `[${this.constructor.name}] DataSource not available. Use @repository({ model: YourModel, dataSource: YourDataSource }) or pass dataSource in constructor.`,\n });\n }\n\n return this._dataSource;\n }\n\n set dataSource(value: AbstractDataSource) {\n this._dataSource = value;\n }\n\n /** Auto-resolves from @repository metadata if not explicitly set. */\n get entity(): AbstractEntity {\n this._entity ??= this.resolveEntity();\n return this._entity;\n }\n\n set entity(value: AbstractEntity) {\n this._entity = value;\n }\n\n get operationScope(): TRepositoryOperationScope {\n return this._operationScope;\n }\n\n setDataSource(opts: { dataSource: AbstractDataSource }): void {\n this._dataSource = opts.dataSource;\n }\n\n getEntity(): AbstractEntity {\n return this.entity;\n }\n\n /**\n * Resolved `@model` settings for `this.entity`'s class, keyed by Reflect target - not by\n * `entity.name`, which can diverge from the `@model` registry key.\n */\n protected get modelSettings(): IModelMetadata['settings'] {\n if (this._modelSettings !== null) {\n return this._modelSettings;\n }\n\n this._modelSettings = MetadataRegistry.getInstance().getModelMetadata({\n target: this.entity.constructor,\n })?.settings;\n\n return this._modelSettings;\n }\n\n protected get hiddenFields(): string[] {\n return this.modelSettings?.hiddenProperties ?? [];\n }\n\n /** Default where from @model settings.query.filter.where, AND-merged into every query unless skipped. */\n protected get defaultWhere(): TWhere | undefined {\n return this.modelSettings?.query?.filter?.where;\n }\n\n protected get defaultLimit(): number | undefined {\n return this.modelSettings?.query?.limit?.default;\n }\n\n /** Largest `limit` a caller may ask for, when the model declares one; undefined leaves the tier's own default in force. */\n protected get maxLimit(): number | undefined {\n return this.modelSettings?.query?.limit?.max;\n }\n\n /**\n * Both bounds, in one place, for every tier.\n *\n * The upper bound is the point: `@model({ settings: { maxLimit } })` is public and validated at\n * decoration time, but the relational tier read it nowhere, so `maxLimit: 2` still issued\n * `LIMIT 50000000`.\n *\n * The lower bound matters just as much and is easy to miss: a NEGATIVE limit is not a smaller\n * page. Drizzle renders the LIMIT clause only when the value is `>= 0`, so a negative one removes\n * the clause and returns the whole table. The wire schema now rejects it too, but a server-side\n * caller reaches this method without passing through the schema at all.\n */\n protected assertLimitWithinCeiling(opts: { limit?: number; scope?: string }): void {\n const { limit, scope = 'find' } = opts;\n\n if (limit === undefined) {\n return;\n }\n\n // The shape check first, because it needs no metadata at all.\n if (!Number.isInteger(limit) || limit < 0) {\n throw getError({\n message: `[${this.constructor.name}][${scope}] Invalid 'limit' | Expected a non-negative integer | Got: ${limit}`,\n });\n }\n\n // `maxLimit` reaches `modelSettings`, which resolves the entity - and THAT throws for a\n // repository with no `@repository` model binding. Such a repository is a misconfiguration this\n // method has no business reporting, and the caller path that used to reach `getDefaultLimit()`\n // never touched it either, because `??` short-circuits when a limit is given. So the ceiling is\n // consulted only when the binding that makes it resolvable is actually present.\n const hasModelBinding = Boolean(\n MetadataRegistry.getInstance().getRepositoryBinding({ target: this.constructor })?.model,\n );\n const ceiling = (hasModelBinding ? this.maxLimit : undefined) ?? DEFAULT_MAX_LIMIT;\n\n if (limit > ceiling) {\n throw getError({\n message: `[${this.constructor.name}][${scope}] Requested page exceeds this model's limit | requested: ${limit} | maximum: ${ceiling} | raise it with @model settings.maxLimit if larger pages are genuinely needed`,\n });\n }\n }\n\n /**\n * The whole filter, relations included. Checking only the top-level `limit` left the identical\n * defect reachable one level down: a relation scope's negative limit drops Drizzle's LIMIT clause\n * for that relation and loads the entire related table.\n *\n * A relation's limit gets the SHAPE check only, not a ceiling. The ceiling belongs to the\n * relation's own model, which this repository cannot resolve - claiming otherwise would enforce\n * the parent's `maxLimit` on a different entity.\n */\n protected assertFilterLimits(opts: { filter?: TFilter; scope?: string }): void {\n const { filter, scope = 'find' } = opts;\n\n if (!filter) {\n return;\n }\n\n this.assertLimitWithinCeiling({ limit: filter.limit, scope });\n\n const walk = (inclusions: TInclusion[] | undefined, path: string): void => {\n const inclusionsList = inclusions ?? [];\n for (const inclusion of inclusionsList) {\n const relationScope = inclusion.scope;\n if (!relationScope) {\n continue;\n }\n\n const relationPath = `${path}.${inclusion.relation}`;\n const relationLimit = relationScope.limit;\n\n if (\n relationLimit !== undefined &&\n (!Number.isInteger(relationLimit) || relationLimit < 0)\n ) {\n throw getError({\n message: `[${this.constructor.name}][${scope}] Invalid 'limit' on relation scope | relation: ${relationPath} | Expected a non-negative integer | Got: ${relationLimit}`,\n });\n }\n\n walk(relationScope.include, relationPath);\n }\n };\n\n walk(filter.include, scope);\n }\n\n /** Resolves the entity instance from @repository metadata on first access. */\n protected resolveEntity(): AbstractEntity {\n const registry = MetadataRegistry.getInstance();\n const binding = registry.getRepositoryBinding({ target: this.constructor });\n\n if (!binding?.model) {\n throw getError({\n message: `[${this.constructor.name}] Cannot resolve entity. Either pass entityClass in constructor or use @repository decorator with model option.`,\n });\n }\n\n // ResolverUtility.resolveValue() erases to the resolved value's structural type, not this class-or-resolver\n // union's member - the `@repository` decorator guarantees a class constructor here.\n const ModelClass = ResolverUtility.resolveValue({\n value: binding.model,\n }) as TClass<AbstractEntity>;\n return new ModelClass();\n }\n\n /** Rejects a verb the current operation scope does not permit. */\n protected denyOperation(opts: { methodName: string }): never {\n throw getError({\n messageCode: RepositoryErrorCodes.OPERATION_NOT_ALLOWED,\n message: `[${opts.methodName}] Repository operation is NOT ALLOWED | scope: ${this.operationScope}`,\n });\n }\n\n /**\n * Shared retry orchestration for read verbs. Inside a transaction retry is skipped - the pool\n * routes transactions to the primary, so there is no replica lag to wait out.\n */\n protected executeReadWithRetry<TResult>(opts: {\n operation: string;\n options: IExtraOptions & IWithReadRetry<TResult>;\n defaultUntil: (result: TResult) => boolean;\n execution: () => Promise<TResult>;\n }): Promise<TResult> {\n const { operation, options, defaultUntil, execution } = opts;\n\n if (!options.retry) {\n return execution();\n }\n\n if (options.transaction) {\n this.logger.for(operation).debug('Read retry skipped inside transaction');\n return execution();\n }\n\n const { maxAttempts, maxTotalMs, signal, backoff, until } = options.retry;\n\n return RetryHelper.executeWithRetryUntil<TResult>({\n operation: [this.constructor.name, operation].join('.'),\n execution,\n until: until ?? defaultUntil,\n maxAttempts,\n maxTotalMs,\n signal,\n backoff: backoff ?? {\n strategy: RetryBackoffStrategies.EXPONENTIAL,\n initialDelayMs: 50,\n maxDelayMs: 500,\n jitter: RetryJitterModes.EQUAL,\n },\n logger: this.logger,\n });\n }\n\n /**\n * A copy of `options` without `retry`, so re-entering a read verb takes its non-retry path - this\n * is what keeps the retry recursion single-depth. Copy-then-delete rather than a rest-destructure\n * (lint rejects the unused rest sibling) or `lodash/omit` (its `Omit<>` return type is not\n * assignable back to `TOptions`).\n */\n private omitReadRetry<TReadOptions extends { retry?: unknown }>(\n options: TReadOptions,\n ): TReadOptions {\n const rest = { ...options };\n delete rest.retry;\n return rest;\n }\n\n /** `find`, re-executed until the retry predicate holds - connectors dispatch here from `find` when `options.retry` is set. */\n protected findUntil<R = TDataObject>(opts: {\n filter: TFilter<TDataObject>;\n options: TFindOptions<TOptions, R>;\n }): Promise<Array<R>> {\n const options = this.omitReadRetry(opts.options);\n\n return this.executeReadWithRetry<Array<R>>({\n operation: 'find',\n options: opts.options,\n defaultUntil: (result) => result.length > 0,\n // `R` is named here, so the row is `R`; TypeScript cannot resolve `TRow` for an unresolved `R`.\n execution: () => this.find<R>({ filter: opts.filter, options }) as Promise<Array<R>>,\n });\n }\n\n /** `find` with the range envelope, re-executed until the retry predicate holds - split from `findUntil` so each result shape is checked against its own `find` overload. */\n protected findRangeUntil<R = TDataObject>(opts: {\n filter: TFilter<TDataObject>;\n options: TFindRangeOptions<TOptions, R>;\n }): Promise<TDataWithRange<R>> {\n const options = this.omitReadRetry(opts.options);\n\n return this.executeReadWithRetry<TDataWithRange<R>>({\n operation: 'find',\n options: opts.options,\n defaultUntil: (result) => result.data.length > 0,\n execution: () =>\n this.find<R>({ filter: opts.filter, options }) as unknown as Promise<TDataWithRange<R>>,\n });\n }\n\n /** `findOne`, re-executed until the retry predicate holds - also serves `findById` via its findOne delegation. */\n protected findOneUntil<R = TDataObject>(opts: {\n filter: TFilter<TDataObject>;\n options: TFindOneOptions<TOptions, R>;\n }): Promise<TNullable<R>> {\n const options = this.omitReadRetry(opts.options);\n\n return this.executeReadWithRetry<TNullable<R>>({\n operation: 'findOne',\n options: opts.options,\n defaultUntil: (result) => result !== null && result !== undefined,\n execution: () => this.findOne<R>({ filter: opts.filter, options }) as Promise<TNullable<R>>,\n });\n }\n\n abstract count(opts: { where: TWhere<TDataObject>; options?: TOptions }): Promise<TCount>;\n\n abstract existsWith(opts: { where: TWhere<TDataObject>; options?: TOptions }): Promise<boolean>;\n\n abstract find<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {\n filter: TFilter<TDataObject, F>;\n options: TFindRangeOptions<TOptions, TRow<TDataObject, R, F>>;\n }): Promise<TDataWithRange<TRow<TDataObject, R, F>>>;\n\n abstract find<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {\n filter: TFilter<TDataObject, F>;\n options?: TFindOptions<TOptions, TRow<TDataObject, R, F>>;\n }): Promise<Array<TRow<TDataObject, R, F>>>;\n\n abstract findOne<R = unknown, const F extends TFields<TDataObject> = TFields<TDataObject>>(opts: {\n filter: TFilter<TDataObject, F>;\n options?: TFindOneOptions<TOptions, TRow<TDataObject, R, F>>;\n }): Promise<TNullable<TRow<TDataObject, R, F>>>;\n\n abstract findById<\n R = unknown,\n const F extends TFields<TDataObject> = TFields<TDataObject>,\n >(opts: {\n id: IdType;\n filter?: TByIdFilter<TDataObject, F>;\n options?: TFindOneOptions<TOptions, TRow<TDataObject, R, F>>;\n }): Promise<TNullable<TRow<TDataObject, R, F>>>;\n\n abstract create(opts: {\n data: TPersistObject;\n options: TOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n\n abstract create<R = TDataObject>(opts: {\n data: TPersistObject;\n options?: TOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n\n abstract createAll(opts: {\n data: Array<TPersistObject>;\n options: TOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n\n abstract createAll<R = TDataObject>(opts: {\n data: Array<TPersistObject>;\n options?: TOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: Array<R> }>;\n\n abstract updateById(opts: {\n id: IdType;\n data: Partial<TPersistObject>;\n options: TOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n\n abstract updateById<R = TDataObject>(opts: {\n id: IdType;\n data: Partial<TPersistObject>;\n options?: TOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n\n abstract updateAll(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options: TOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n\n abstract updateAll<R = TDataObject>(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options?: TOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n\n /** Alias for updateAll. */\n updateBy(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options: TOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n updateBy<R = TDataObject>(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options?: TOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n updateBy<R = TDataObject>(opts: {\n data: Partial<TPersistObject>;\n where: TWhere<TDataObject>;\n options?: TOptions & { shouldReturn?: boolean; force?: boolean };\n }): Promise<TCount & { data: TNullable<Array<R>> }> {\n const { data, where, options } = opts;\n\n if (options?.shouldReturn === false) {\n return this.updateAll({ data, where, options: { ...options, shouldReturn: false } });\n }\n\n return this.updateAll<R>({ data, where, options });\n }\n\n abstract deleteById(opts: {\n id: IdType;\n options: TOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n\n abstract deleteById<R = TDataObject>(opts: {\n id: IdType;\n options?: TOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n\n abstract deleteAll(opts: {\n where?: TWhere<TDataObject>;\n options: TOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n\n abstract deleteAll<R = TDataObject>(opts: {\n where?: TWhere<TDataObject>;\n options?: TOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n\n /** Alias for deleteAll. */\n deleteBy(opts: {\n where: TWhere<TDataObject>;\n options: TOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n deleteBy<R = TDataObject>(opts: {\n where: TWhere<TDataObject>;\n options?: TOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n deleteBy<R = TDataObject>(opts: {\n where: TWhere<TDataObject>;\n options?: TOptions & { shouldReturn?: boolean; force?: boolean };\n }): Promise<TCount & { data: TNullable<Array<R>> }> {\n const { where, options } = opts;\n\n if (options?.shouldReturn === false) {\n return this.deleteAll({ where, options: { ...options, shouldReturn: false } });\n }\n\n return this.deleteAll<R>({ where, options });\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- /** Load order is the point: `@hono/zod-openapi` peers on `zod`, so importing it patches `.openapi()` onto the shared `ZodType` prototype. `buildQuerySchemas` 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. */
1
+ /** 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. */
2
2
  import { z } from '@hono/zod-openapi';
3
3
  export declare const FieldsSchema: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodBoolean>, z.ZodArray<z.ZodString>]>>, FilterSchema: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
4
4
  where: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>]>>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/base/repositories/query-schemas/index.ts"],"names":[],"mappings":"AAEA,yaAAya;AACza,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAOtC,eAAO,MACL,YAAY,gGACZ,YAAY;;;;;;;;;;;;;;;;;;;;;;uBACZ,eAAe;;;qBACf,WAAW,8BACX,YAAY,8BACZ,aAAa,0CACb,UAAU,8BACV,WAAW,yNACwC,CAAC;AAEtD;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;iBAE5B,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/base/repositories/query-schemas/index.ts"],"names":[],"mappings":"AAEA,gbAAgb;AAChb,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAOtC,eAAO,MACL,YAAY,gGACZ,YAAY;;;;;;;;;;;;;;;;;;;;;;uBACZ,eAAe;;;qBACf,WAAW,8BACX,YAAY,8BACZ,aAAa,0CACb,UAAU,8BACV,WAAW,yNAC+C,CAAC;AAE7D;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;iBAE5B,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC"}
@@ -1,11 +1,11 @@
1
- import { buildQuerySchemas } from '@venizia/ignis-filter/schemas';
2
- /** Load order is the point: `@hono/zod-openapi` peers on `zod`, so importing it patches `.openapi()` onto the shared `ZodType` prototype. `buildQuerySchemas` 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. */
1
+ import { QuerySchemaFactory } from '@venizia/ignis-filter/schemas';
2
+ /** 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. */
3
3
  import { z } from '@hono/zod-openapi';
4
4
  /** 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. */
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, } = buildQuerySchemas({ decorate: openApiDecorator });
8
+ export const { FieldsSchema, FilterSchema, InclusionSchema, LimitSchema, OffsetSchema, OrderBySchema, SkipSchema, WhereSchema, } = QuerySchemaFactory.build({ decorate: openApiDecorator });
9
9
  /**
10
10
  * The query shape of a route that accepts a `filter`. The framework's own `find`, `findById` and
11
11
  * `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,iBAAiB,EAAyB,MAAM,+BAA+B,CAAC;AAEzF,yaAAya;AACza,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,iBAAiB,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAEtD;;;;;;;;;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 { buildQuerySchemas, 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. `buildQuerySchemas` 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} = buildQuerySchemas({ 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,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 +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 `createRelations` 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,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"]}
@@ -3,7 +3,7 @@ import type { MetadataRegistry as _MetadataRegistry } from '@venizia/ignis-inver
3
3
  import { Container as DIContainer } from '@venizia/ignis-inversion';
4
4
  export declare class Container extends DIContainer {
5
5
  logger: ILogger;
6
- /** Resolved through `BaseHelper`/`LoggerResolver`, never `LoggerFactory` directly - the resolver's console fallback is what keeps this constructor (and everything that extends it) browser-pure. A server host still gets the real provider: importing `LoggerFactory` as a value anywhere in the process (core's own `helpers/base-helper.ts` already does) installs it as the active resolver. */
6
+ /** Resolved through `BaseHelper`, which asks `LoggerFactory` (browser-pure, the console by default). A server host gets the provider the application chose, or Winston when it chose none. */
7
7
  constructor(opts?: {
8
8
  scope: string;
9
9
  });
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../../src/helpers/inversion/container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGpE,qBAAa,SAAU,SAAQ,WAAW;IACxC,MAAM,EAAE,OAAO,CAAC;IAEhB,qYAAqY;gBACzX,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IAK3B,mBAAmB,IAAI,iBAAiB;CAGlD"}
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../../src/helpers/inversion/container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGpE,qBAAa,SAAU,SAAQ,WAAW;IACxC,MAAM,EAAE,OAAO,CAAC;IAEhB,8LAA8L;gBAClL,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IAK3B,mBAAmB,IAAI,iBAAiB;CAGlD"}
@@ -2,7 +2,7 @@ import { BaseHelper } from '@venizia/ignis-helpers/core';
2
2
  import { Container as DIContainer } from '@venizia/ignis-inversion';
3
3
  import { MetadataRegistry } from './registry.js';
4
4
  export class Container extends DIContainer {
5
- /** Resolved through `BaseHelper`/`LoggerResolver`, never `LoggerFactory` directly - the resolver's console fallback is what keeps this constructor (and everything that extends it) browser-pure. A server host still gets the real provider: importing `LoggerFactory` as a value anywhere in the process (core's own `helpers/base-helper.ts` already does) installs it as the active resolver. */
5
+ /** Resolved through `BaseHelper`, which asks `LoggerFactory` (browser-pure, the console by default). A server host gets the provider the application chose, or Winston when it chose none. */
6
6
  constructor(opts) {
7
7
  super({ scope: opts?.scope ?? Container.name });
8
8
  this.logger = new BaseHelper({ scope: opts?.scope ?? Container.name }).getLogger();
@@ -1 +1 @@
1
- {"version":3,"file":"container.js","sourceRoot":"","sources":["../../../../src/helpers/inversion/container.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,OAAO,SAAU,SAAQ,WAAW;IAGxC,qYAAqY;IACrY,YAAY,IAAwB;QAClC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;IACrF,CAAC;IAEQ,mBAAmB;QAC1B,OAAO,gBAAgB,CAAC,WAAW,EAAE,CAAC;IACxC,CAAC;CACF","sourcesContent":["import type { ILogger } from '@venizia/ignis-helpers/core';\nimport { BaseHelper } from '@venizia/ignis-helpers/core';\nimport type { MetadataRegistry as _MetadataRegistry } from '@venizia/ignis-inversion';\nimport { Container as DIContainer } from '@venizia/ignis-inversion';\nimport { MetadataRegistry } from './registry';\n\nexport class Container extends DIContainer {\n logger: ILogger;\n\n /** Resolved through `BaseHelper`/`LoggerResolver`, never `LoggerFactory` directly - the resolver's console fallback is what keeps this constructor (and everything that extends it) browser-pure. A server host still gets the real provider: importing `LoggerFactory` as a value anywhere in the process (core's own `helpers/base-helper.ts` already does) installs it as the active resolver. */\n constructor(opts?: { scope: string }) {\n super({ scope: opts?.scope ?? Container.name });\n this.logger = new BaseHelper({ scope: opts?.scope ?? Container.name }).getLogger();\n }\n\n override getMetadataRegistry(): _MetadataRegistry {\n return MetadataRegistry.getInstance();\n }\n}\n"]}
1
+ {"version":3,"file":"container.js","sourceRoot":"","sources":["../../../../src/helpers/inversion/container.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,OAAO,SAAU,SAAQ,WAAW;IAGxC,8LAA8L;IAC9L,YAAY,IAAwB;QAClC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;IACrF,CAAC;IAEQ,mBAAmB;QAC1B,OAAO,gBAAgB,CAAC,WAAW,EAAE,CAAC;IACxC,CAAC;CACF","sourcesContent":["import type { ILogger } from '@venizia/ignis-helpers/core';\nimport { BaseHelper } from '@venizia/ignis-helpers/core';\nimport type { MetadataRegistry as _MetadataRegistry } from '@venizia/ignis-inversion';\nimport { Container as DIContainer } from '@venizia/ignis-inversion';\nimport { MetadataRegistry } from './registry';\n\nexport class Container extends DIContainer {\n logger: ILogger;\n\n /** Resolved through `BaseHelper`, which asks `LoggerFactory` (browser-pure, the console by default). A server host gets the provider the application chose, or Winston when it chose none. */\n constructor(opts?: { scope: string }) {\n super({ scope: opts?.scope ?? Container.name });\n this.logger = new BaseHelper({ scope: opts?.scope ?? Container.name }).getLogger();\n }\n\n override getMetadataRegistry(): _MetadataRegistry {\n return MetadataRegistry.getInstance();\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- export { Binding, BindingKeys, BindingScopes, BindingValueTypes, isClass, isClassProvider, resolveInjectTarget, type IProvider, type TBindingKey, type TBindingScope, type TBindingValueType, type IBindingTag, type TInjectTarget, } from '@venizia/ignis-inversion';
1
+ export { Binding, BindingKeys, BindingScopes, BindingValueTypes, isClass, isClassProvider, ResolverUtility, type IProvider, type TBindingKey, type TBindingScope, type TBindingValueType, type IBindingTag, type TInjectTarget, } from '@venizia/ignis-inversion';
2
2
  export * from './common/index.js';
3
3
  export * from './container.js';
4
4
  export * from './registry.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/helpers/inversion/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,mBAAmB,EACnB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,aAAa,GACnB,MAAM,0BAA0B,CAAC;AAElC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/helpers/inversion/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,eAAe,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,aAAa,GACnB,MAAM,0BAA0B,CAAC;AAElC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -1,5 +1,5 @@
1
1
  // DI-specific symbols only available in inversion (not in helpers)
2
- export { Binding, BindingKeys, BindingScopes, BindingValueTypes, isClass, isClassProvider, resolveInjectTarget, } from '@venizia/ignis-inversion';
2
+ export { Binding, BindingKeys, BindingScopes, BindingValueTypes, isClass, isClassProvider, ResolverUtility, } from '@venizia/ignis-inversion';
3
3
  export * from './common/index.js';
4
4
  export * from './container.js';
5
5
  export * from './registry.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/helpers/inversion/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EACL,OAAO,EACP,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,mBAAmB,GAOpB,MAAM,0BAA0B,CAAC;AAElC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC","sourcesContent":["// DI-specific symbols only available in inversion (not in helpers)\nexport {\n Binding,\n BindingKeys,\n BindingScopes,\n BindingValueTypes,\n isClass,\n isClassProvider,\n resolveInjectTarget,\n type IProvider,\n type TBindingKey,\n type TBindingScope,\n type TBindingValueType,\n type IBindingTag,\n type TInjectTarget,\n} from '@venizia/ignis-inversion';\n\nexport * from './common';\nexport * from './container';\nexport * from './registry';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/helpers/inversion/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EACL,OAAO,EACP,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,eAAe,GAOhB,MAAM,0BAA0B,CAAC;AAElC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC","sourcesContent":["// DI-specific symbols only available in inversion (not in helpers)\nexport {\n Binding,\n BindingKeys,\n BindingScopes,\n BindingValueTypes,\n isClass,\n isClassProvider,\n ResolverUtility,\n type IProvider,\n type TBindingKey,\n type TBindingScope,\n type TBindingValueType,\n type IBindingTag,\n type TInjectTarget,\n} from '@venizia/ignis-inversion';\n\nexport * from './common';\nexport * from './container';\nexport * from './registry';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"repository.mixin.d.ts","sourceRoot":"","sources":["../../../../../src/helpers/inversion/mixins/repository.mixin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGnF,OAAO,KAAK,EAAE,gBAAgB,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGtF,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAEzB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;;;;;;;;;;;yBApMhD,CAAC;;;;;;;uBA/BN,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC;iCACxB;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,KAAG,cAAc,GAAG,SAAS;;aAsO3E,CAAC"}
@@ -1,4 +1,4 @@
1
- import { resolveValue } from '@venizia/ignis-helpers/common';
1
+ import { ResolverUtility } from '@venizia/ignis-helpers/common';
2
2
  import { getError } from '@venizia/ignis-helpers/core';
3
3
  import { MetadataKeys } from '../common/keys.js';
4
4
  import { RelationBuilderRegistry } from '../common/relation-builder.js';
@@ -17,11 +17,11 @@ export const RepositoryMetadataMixin = (baseClass) => {
17
17
  // Every member of the binding may be a resolver, the escape hatch for circular imports.
18
18
  // Reading `.name` off the resolver keys the registry by the arrow's inferred name, and the
19
19
  // datasource then silently discovers no schema.
20
- const repositoryClass = resolveValue({ value: opts.repository });
20
+ const repositoryClass = ResolverUtility.resolveValue({ value: opts.repository });
21
21
  this.repositoryBindings.set(repositoryClass.name, opts);
22
22
  this.repositoryBindingsByClass.set(repositoryClass, opts);
23
- const dataSourceRef = resolveValue({ value: opts.dataSource });
24
- const modelClass = resolveValue({ value: opts.model });
23
+ const dataSourceRef = ResolverUtility.resolveValue({ value: opts.dataSource });
24
+ const modelClass = ResolverUtility.resolveValue({ value: opts.model });
25
25
  if (!this.datasourceModels.has(dataSourceRef)) {
26
26
  this.datasourceModels.set(dataSourceRef, new Set());
27
27
  }
@@ -63,7 +63,7 @@ export const RepositoryMetadataMixin = (baseClass) => {
63
63
  if (!modelMeta.relationsResolver) {
64
64
  return undefined;
65
65
  }
66
- const relations = resolveValue({ value: modelMeta.relationsResolver });
66
+ const relations = ResolverUtility.resolveValue({ value: modelMeta.relationsResolver });
67
67
  if (!relations || !modelMeta.schema) {
68
68
  return undefined;
69
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"repository.mixin.js","sourceRoot":"","sources":["../../../../../src/helpers/inversion/mixins/repository.mixin.ts"],"names":[],"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C,IAAkD;YAI5D,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;YAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;YAE9C,MAAM,EAAE,GAGJ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;YAElC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBAC3B,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;oBACjB,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;gBAC5C,CAAC;gBAED,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;oBACpB,EAAE,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,WAAW,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;gBAChE,CAAC;YACH,CAAC;YAED,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,SAAS,CAAC,IAAkD;YAC1D,OAAO,IAAI,CAAC,yBAAyB,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;QAClF,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { IDataSource } from '@/base/datasources';\nimport type { AbstractEntity } from '@/base/models';\nimport type { AnyType, TClass, TMixinTarget } from '@venizia/ignis-helpers/common';\nimport { resolveValue } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { MetadataRegistry as _MetadataRegistry } from '@venizia/ignis-inversion';\nimport { MetadataKeys } from '../common/keys';\nimport { RelationBuilderRegistry } from '../common/relation-builder';\nimport type {\n IModelMetadata,\n IModelRegistryEntry,\n IRepositoryBinding,\n IResolvedRepositoryMetadata,\n TRepositoryMetadata,\n} from '../common/types';\n\nexport const RepositoryMetadataMixin = <\n BaseClass extends TMixinTarget<\n _MetadataRegistry & {\n modelRegistry: Map<string, IModelRegistryEntry>;\n getModelMetadata(opts: { target: object }): IModelMetadata | undefined;\n }\n >,\n>(\n baseClass: BaseClass,\n) => {\n return class extends baseClass {\n /** By repository class name, for the by-name API. Two classes may share a name; `repositoryBindingsByClass` cannot confuse them. */\n repositoryBindings: Map<string, IRepositoryBinding<AbstractEntity>>;\n\n /** By repository class: a minified build renames classes, and two chunks may give two of them one name. */\n repositoryBindingsByClass: Map<Function, IRepositoryBinding<AbstractEntity>>;\n\n /**\n * The model classes each datasource owns, keyed by the datasource class - or by the string a\n * repository named it with (`dataSource: 'PgDataSource'`), which only a class of that name\n * can match. Never by class name alone: a minified build gives two datasources one name.\n */\n datasourceModels: Map<string | Function, Set<TClass<AnyType>>>;\n\n setRepositoryMetadata<\n Target extends object = object,\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n >(opts: {\n target: Target;\n metadata: TRepositoryMetadata<Model, DataSource> & {\n _resolved?: IResolvedRepositoryMetadata<Model, DataSource>;\n };\n }): void {\n const { target, metadata } = opts;\n Reflect.defineMetadata(MetadataKeys.REPOSITORY, metadata, target);\n }\n\n getRepositoryMetadata<Target extends object = object>(opts: {\n target: Target;\n }): (TRepositoryMetadata & { _resolved?: IResolvedRepositoryMetadata }) | undefined {\n const { target } = opts;\n return Reflect.getMetadata(MetadataKeys.REPOSITORY, target);\n }\n\n /** Registers a repository binding (called by @repository) linking a repository to its model + datasource. */\n registerRepositoryBinding<\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n >(opts: IRepositoryBinding<Model, DataSource>) {\n // Every member of the binding may be a resolver, the escape hatch for circular imports.\n // Reading `.name` off the resolver keys the registry by the arrow's inferred name, and the\n // datasource then silently discovers no schema.\n const repositoryClass = resolveValue({ value: opts.repository });\n this.repositoryBindings.set(repositoryClass.name, opts);\n this.repositoryBindingsByClass.set(repositoryClass, opts);\n\n const dataSourceRef = resolveValue({ value: opts.dataSource });\n const modelClass = resolveValue({ value: opts.model });\n\n if (!this.datasourceModels.has(dataSourceRef)) {\n this.datasourceModels.set(dataSourceRef, new Set());\n }\n\n this.datasourceModels.get(dataSourceRef)!.add(modelClass);\n }\n\n /** By class, walking up to the nearest decorated parent; by name only for callers holding a name. */\n getRepositoryBinding(\n opts: { target: Function } | { name: string },\n ): IRepositoryBinding<AbstractEntity> | undefined {\n if ('name' in opts) {\n return this.repositoryBindings.get(opts.name);\n }\n\n for (\n let current: Function | null = opts.target;\n current && current !== Function.prototype;\n current = Object.getPrototypeOf(current)\n ) {\n const binding = this.repositoryBindingsByClass.get(current);\n if (binding) {\n return binding;\n }\n }\n\n return undefined;\n }\n\n /** A class finds what was registered under it, and under a string equal to its name. */\n getDataSourceModelClasses(opts: {\n dataSource: string | TClass<IDataSource>;\n }): Set<TClass<AnyType>> {\n const { dataSource } = opts;\n\n if (typeof dataSource === 'string') {\n return this.datasourceModels.get(dataSource) ?? new Set();\n }\n\n return new Set([\n ...(this.datasourceModels.get(dataSource) ?? []),\n ...(this.datasourceModels.get(dataSource.name) ?? []),\n ]);\n }\n\n /**\n * Resolves and caches relations for a model entry - called lazily from buildSchema() so that\n * every `@model` class is registered first, which avoids circular-dependency ordering issues.\n * @internal\n */\n resolveModelRelations(modelMeta: IModelRegistryEntry): unknown {\n if (modelMeta._builtRelations !== undefined) {\n return modelMeta._builtRelations;\n }\n\n if (!modelMeta.relationsResolver) {\n return undefined;\n }\n\n const relations = resolveValue({ value: modelMeta.relationsResolver });\n\n if (!relations || !modelMeta.schema) {\n return undefined;\n }\n\n const builder = RelationBuilderRegistry.resolve();\n\n // Relations were declared but no connector installed a builder - silently dropping them\n // would surface much later as an empty `with` clause.\n if (!builder) {\n throw getError({\n message: `[RepositoryMetadataMixin][resolveModelRelations] Model declares relations but no relation builder is registered | Import the relational connector so it installs one`,\n });\n }\n\n const builtRelations = builder({ source: modelMeta.schema, relations });\n\n modelMeta._builtRelations = builtRelations?.relations;\n return modelMeta._builtRelations;\n }\n\n /**\n * Models registered for a datasource, relations resolved lazily. `schema`/`relations` stay\n * `unknown` - the registry is shared across connectors, so each connector narrows at its call\n * site.\n */\n getModels(opts: { dataSource: string | TClass<IDataSource> }): Array<{\n tableName: string;\n schema: unknown;\n relations?: unknown;\n }> {\n const modelClasses = this.getDataSourceModelClasses({ dataSource: opts.dataSource });\n\n const rs = Array.from(modelClasses)\n .map((modelClass) => {\n // Read straight off the class: a class -> name -> modelRegistry round-trip collapses two\n // same-named models onto one entry, silently swapping schemas. `modelRegistry` stays\n // name-keyed for the by-name APIs that need it.\n const entry: IModelRegistryEntry = {\n target: modelClass as AnyType,\n metadata:\n this.getModelMetadata({ target: modelClass }) ?? ({ settings: {} } as AnyType),\n schema: (modelClass as AnyType).schema,\n relationsResolver: (modelClass as AnyType).relations,\n };\n\n if (entry.schema === undefined) {\n return null;\n }\n\n return {\n tableName: this.resolveModelKey({ modelClass }),\n schema: entry.schema,\n relations: this.resolveModelRelations(entry),\n };\n })\n .filter((item): item is NonNullable<typeof item> => {\n return item !== undefined && item !== null;\n });\n\n return rs;\n }\n\n /**\n * Like getModels but returns only resolved model classes - used by BaseSearchDataSource, which\n * has no pgTable to resolve.\n */\n getModelClasses(opts: { dataSource: string | TClass<IDataSource> }): Array<TClass<unknown>> {\n // Straight from the stored class refs: a name round-trip through the shared modelRegistry\n // would hand back whichever same-named class registered last.\n return Array.from(this.getDataSourceModelClasses({ dataSource: opts.dataSource }));\n }\n\n /** The key a model occupies in `modelRegistry` - its table name, or its class name when it has none. */\n resolveModelKey(opts: { modelClass: TClass<AnyType> }): string {\n const { modelClass } = opts;\n const modelMetadata = this.getModelMetadata({ target: modelClass });\n\n return (\n [modelMetadata?.tableName, (modelClass as AnyType).TABLE_NAME].find(Boolean) ??\n modelClass.name\n );\n }\n\n /** Assembles table schemas + relations for a datasource's registered models. */\n buildSchema(opts: { dataSource: string | TClass<IDataSource> }): {\n schema: Record<string, unknown>;\n relations: Record<string, unknown>;\n } {\n const { dataSource } = opts;\n const models = this.getModels({ dataSource });\n\n const rs: {\n schema: Record<string, unknown>;\n relations: Record<string, unknown>;\n } = { schema: {}, relations: {} };\n\n for (const model of models) {\n if (model.schema) {\n rs.schema[model.tableName] = model.schema;\n }\n\n if (model.relations) {\n rs.relations[`${model.tableName}Relations`] = model.relations;\n }\n }\n\n return rs;\n }\n\n hasModels(opts: { dataSource: string | TClass<IDataSource> }): boolean {\n return this.getDataSourceModelClasses({ dataSource: opts.dataSource }).size > 0;\n }\n };\n};\n"]}
1
+ {"version":3,"file":"repository.mixin.js","sourceRoot":"","sources":["../../../../../src/helpers/inversion/mixins/repository.mixin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AASrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAQrC,SAAoB,EACpB,EAAE;IACF,OAAO,KAAM,SAAQ,SAAS;QAc5B,qBAAqB,CAInB,IAKD;YACC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;YAClC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACpE,CAAC;QAED,qBAAqB,CAAiC,IAErD;YACC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;YACxB,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC9D,CAAC;QAED,6GAA6G;QAC7G,yBAAyB,CAGvB,IAA2C;YAC3C,wFAAwF;YACxF,2FAA2F;YAC3F,gDAAgD;YAChD,MAAM,eAAe,GAAG,eAAe,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,IAAI,CAA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AC;AACJ,CAAC,CAAC","sourcesContent":["import type { IDataSource } from '@/base/datasources';\nimport type { AbstractEntity } from '@/base/models';\nimport type { AnyType, TClass, TMixinTarget } from '@venizia/ignis-helpers/common';\nimport { ResolverUtility } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { MetadataRegistry as _MetadataRegistry } from '@venizia/ignis-inversion';\nimport { MetadataKeys } from '../common/keys';\nimport { RelationBuilderRegistry } from '../common/relation-builder';\nimport type {\n IModelMetadata,\n IModelRegistryEntry,\n IRepositoryBinding,\n IResolvedRepositoryMetadata,\n TRepositoryMetadata,\n} from '../common/types';\n\nexport const RepositoryMetadataMixin = <\n BaseClass extends TMixinTarget<\n _MetadataRegistry & {\n modelRegistry: Map<string, IModelRegistryEntry>;\n getModelMetadata(opts: { target: object }): IModelMetadata | undefined;\n }\n >,\n>(\n baseClass: BaseClass,\n) => {\n return class extends baseClass {\n /** By repository class name, for the by-name API. Two classes may share a name; `repositoryBindingsByClass` cannot confuse them. */\n repositoryBindings: Map<string, IRepositoryBinding<AbstractEntity>>;\n\n /** By repository class: a minified build renames classes, and two chunks may give two of them one name. */\n repositoryBindingsByClass: Map<Function, IRepositoryBinding<AbstractEntity>>;\n\n /**\n * The model classes each datasource owns, keyed by the datasource class - or by the string a\n * repository named it with (`dataSource: 'PgDataSource'`), which only a class of that name\n * can match. Never by class name alone: a minified build gives two datasources one name.\n */\n datasourceModels: Map<string | Function, Set<TClass<AnyType>>>;\n\n setRepositoryMetadata<\n Target extends object = object,\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n >(opts: {\n target: Target;\n metadata: TRepositoryMetadata<Model, DataSource> & {\n _resolved?: IResolvedRepositoryMetadata<Model, DataSource>;\n };\n }): void {\n const { target, metadata } = opts;\n Reflect.defineMetadata(MetadataKeys.REPOSITORY, metadata, target);\n }\n\n getRepositoryMetadata<Target extends object = object>(opts: {\n target: Target;\n }): (TRepositoryMetadata & { _resolved?: IResolvedRepositoryMetadata }) | undefined {\n const { target } = opts;\n return Reflect.getMetadata(MetadataKeys.REPOSITORY, target);\n }\n\n /** Registers a repository binding (called by @repository) linking a repository to its model + datasource. */\n registerRepositoryBinding<\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n >(opts: IRepositoryBinding<Model, DataSource>) {\n // Every member of the binding may be a resolver, the escape hatch for circular imports.\n // Reading `.name` off the resolver keys the registry by the arrow's inferred name, and the\n // datasource then silently discovers no schema.\n const repositoryClass = ResolverUtility.resolveValue({ value: opts.repository });\n this.repositoryBindings.set(repositoryClass.name, opts);\n this.repositoryBindingsByClass.set(repositoryClass, opts);\n\n const dataSourceRef = ResolverUtility.resolveValue({ value: opts.dataSource });\n const modelClass = ResolverUtility.resolveValue({ value: opts.model });\n\n if (!this.datasourceModels.has(dataSourceRef)) {\n this.datasourceModels.set(dataSourceRef, new Set());\n }\n\n this.datasourceModels.get(dataSourceRef)!.add(modelClass);\n }\n\n /** By class, walking up to the nearest decorated parent; by name only for callers holding a name. */\n getRepositoryBinding(\n opts: { target: Function } | { name: string },\n ): IRepositoryBinding<AbstractEntity> | undefined {\n if ('name' in opts) {\n return this.repositoryBindings.get(opts.name);\n }\n\n for (\n let current: Function | null = opts.target;\n current && current !== Function.prototype;\n current = Object.getPrototypeOf(current)\n ) {\n const binding = this.repositoryBindingsByClass.get(current);\n if (binding) {\n return binding;\n }\n }\n\n return undefined;\n }\n\n /** A class finds what was registered under it, and under a string equal to its name. */\n getDataSourceModelClasses(opts: {\n dataSource: string | TClass<IDataSource>;\n }): Set<TClass<AnyType>> {\n const { dataSource } = opts;\n\n if (typeof dataSource === 'string') {\n return this.datasourceModels.get(dataSource) ?? new Set();\n }\n\n return new Set([\n ...(this.datasourceModels.get(dataSource) ?? []),\n ...(this.datasourceModels.get(dataSource.name) ?? []),\n ]);\n }\n\n /**\n * Resolves and caches relations for a model entry - called lazily from buildSchema() so that\n * every `@model` class is registered first, which avoids circular-dependency ordering issues.\n * @internal\n */\n resolveModelRelations(modelMeta: IModelRegistryEntry): unknown {\n if (modelMeta._builtRelations !== undefined) {\n return modelMeta._builtRelations;\n }\n\n if (!modelMeta.relationsResolver) {\n return undefined;\n }\n\n const relations = ResolverUtility.resolveValue({ value: modelMeta.relationsResolver });\n\n if (!relations || !modelMeta.schema) {\n return undefined;\n }\n\n const builder = RelationBuilderRegistry.resolve();\n\n // Relations were declared but no connector installed a builder - silently dropping them\n // would surface much later as an empty `with` clause.\n if (!builder) {\n throw getError({\n message: `[RepositoryMetadataMixin][resolveModelRelations] Model declares relations but no relation builder is registered | Import the relational connector so it installs one`,\n });\n }\n\n const builtRelations = builder({ source: modelMeta.schema, relations });\n\n modelMeta._builtRelations = builtRelations?.relations;\n return modelMeta._builtRelations;\n }\n\n /**\n * Models registered for a datasource, relations resolved lazily. `schema`/`relations` stay\n * `unknown` - the registry is shared across connectors, so each connector narrows at its call\n * site.\n */\n getModels(opts: { dataSource: string | TClass<IDataSource> }): Array<{\n tableName: string;\n schema: unknown;\n relations?: unknown;\n }> {\n const modelClasses = this.getDataSourceModelClasses({ dataSource: opts.dataSource });\n\n const rs = Array.from(modelClasses)\n .map((modelClass) => {\n // Read straight off the class: a class -> name -> modelRegistry round-trip collapses two\n // same-named models onto one entry, silently swapping schemas. `modelRegistry` stays\n // name-keyed for the by-name APIs that need it.\n const entry: IModelRegistryEntry = {\n target: modelClass as AnyType,\n metadata:\n this.getModelMetadata({ target: modelClass }) ?? ({ settings: {} } as AnyType),\n schema: (modelClass as AnyType).schema,\n relationsResolver: (modelClass as AnyType).relations,\n };\n\n if (entry.schema === undefined) {\n return null;\n }\n\n return {\n tableName: this.resolveModelKey({ modelClass }),\n schema: entry.schema,\n relations: this.resolveModelRelations(entry),\n };\n })\n .filter((item): item is NonNullable<typeof item> => {\n return item !== undefined && item !== null;\n });\n\n return rs;\n }\n\n /**\n * Like getModels but returns only resolved model classes - used by BaseSearchDataSource, which\n * has no pgTable to resolve.\n */\n getModelClasses(opts: { dataSource: string | TClass<IDataSource> }): Array<TClass<unknown>> {\n // Straight from the stored class refs: a name round-trip through the shared modelRegistry\n // would hand back whichever same-named class registered last.\n return Array.from(this.getDataSourceModelClasses({ dataSource: opts.dataSource }));\n }\n\n /** The key a model occupies in `modelRegistry` - its table name, or its class name when it has none. */\n resolveModelKey(opts: { modelClass: TClass<AnyType> }): string {\n const { modelClass } = opts;\n const modelMetadata = this.getModelMetadata({ target: modelClass });\n\n return (\n [modelMetadata?.tableName, (modelClass as AnyType).TABLE_NAME].find(Boolean) ??\n modelClass.name\n );\n }\n\n /** Assembles table schemas + relations for a datasource's registered models. */\n buildSchema(opts: { dataSource: string | TClass<IDataSource> }): {\n schema: Record<string, unknown>;\n relations: Record<string, unknown>;\n } {\n const { dataSource } = opts;\n const models = this.getModels({ dataSource });\n\n const rs: {\n schema: Record<string, unknown>;\n relations: Record<string, unknown>;\n } = { schema: {}, relations: {} };\n\n for (const model of models) {\n if (model.schema) {\n rs.schema[model.tableName] = model.schema;\n }\n\n if (model.relations) {\n rs.relations[`${model.tableName}Relations`] = model.relations;\n }\n }\n\n return rs;\n }\n\n hasModels(opts: { dataSource: string | TClass<IDataSource> }): boolean {\n return this.getDataSourceModelClasses({ dataSource: opts.dataSource }).size > 0;\n }\n };\n};\n"]}
@@ -6,7 +6,7 @@
6
6
  * decided on, not whatever a directory grows into. Weight is a contract, checked by
7
7
  * `src/__tests__/bundle/browser-weight.test.ts`.
8
8
  */
9
- export { component, configuration, injectable, pickRegistrationOptions, provide, service, } from './base/metadata/injectable.js';
9
+ export { component, configuration, injectable, InjectableUtility, provide, service, } from './base/metadata/injectable.js';
10
10
  export { datasource, model, repository } from './base/metadata/persistents.js';
11
11
  export { inject } from './base/metadata/injectors.js';
12
12
  export { ArtifactBindingKeys } from './base/metadata/artifact-keys.js';
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/metadata.ts"],"names":[],"mappings":"AAA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EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACnF,YAAY,EACV,iBAAiB,EACjB,4BAA4B,EAC5B,aAAa,GACd,MAAM,qBAAqB,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * decided on, not whatever a directory grows into. Weight is a contract, checked by
7
7
  * `src/__tests__/bundle/browser-weight.test.ts`.
8
8
  */
9
- export { component, configuration, injectable, pickRegistrationOptions, provide, service, } from './base/metadata/injectable.js';
9
+ export { component, configuration, injectable, InjectableUtility, provide, service, } from './base/metadata/injectable.js';
10
10
  export { datasource, model, repository } from './base/metadata/persistents.js';
11
11
  export { inject } from './base/metadata/injectors.js';
12
12
  export { ArtifactBindingKeys } from './base/metadata/artifact-keys.js';
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,uBAAuB,EACvB,OAAO,EACP,OAAO,GACR,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,qIAAqI;AACrI,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAGnE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG1E;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["/**\n * How a class is MARKED as an artifact, and nothing about how one is served. 23 KB gzipped against\n * the root barrel's 161 KB, which carries the REST surface and is right to.\n *\n * Listed export by export rather than re-exporting `base/metadata`: a sub-path is a surface someone\n * decided on, not whatever a directory grows into. Weight is a contract, checked by\n * `src/__tests__/bundle/browser-weight.test.ts`.\n */\n\nexport {\n component,\n configuration,\n injectable,\n pickRegistrationOptions,\n provide,\n service,\n} from '@/base/metadata/injectable';\nexport { datasource, model, repository } from '@/base/metadata/persistents';\nexport { inject } from '@/base/metadata/injectors';\nexport { ArtifactBindingKeys } from '@/base/metadata/artifact-keys';\n\n// A group of a package's classes, borrowed by an application - a browser kit defines its groups from here, not from the root barrel.\nexport { ArtifactGroup } from '@/base/applications/artifact-group';\nexport type { IArtifactGroup, IArtifactIndex } from '@/base/applications/common';\n\nexport { ArtifactNamespaces, BindingNamespaces } from '@/common/bindings';\nexport type { TBindingNamespace } from '@/common/bindings';\n\n/**\n * `CoreBindings` is deliberately NOT here. The namespaces above are the GRAMMAR of a binding key;\n * `CoreBindings` is one application's DICTIONARY (`APPLICATION_SERVER`, `APPLICATION_ROOT_ROUTER`).\n * A sibling framework ships a class of the same name whose `APPLICATION_INSTANCE` is a different\n * string, so shipping ours beside the stereotypes means binding under one key and resolving under\n * another, with nothing failing until run time. It stays on the root barrel.\n */\n\nexport { ArtifactTypes, BindingKeys, MetadataRegistry } from '@/helpers/inversion';\nexport type {\n IArtifactMetadata,\n IArtifactRegistrationOptions,\n TBindingScope,\n} from '@/helpers/inversion';\n"]}
1
+ {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,OAAO,GACR,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,qIAAqI;AACrI,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAGnE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG1E;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["/**\n * How a class is MARKED as an artifact, and nothing about how one is served. 23 KB gzipped against\n * the root barrel's 161 KB, which carries the REST surface and is right to.\n *\n * Listed export by export rather than re-exporting `base/metadata`: a sub-path is a surface someone\n * decided on, not whatever a directory grows into. Weight is a contract, checked by\n * `src/__tests__/bundle/browser-weight.test.ts`.\n */\n\nexport {\n component,\n configuration,\n injectable,\n InjectableUtility,\n provide,\n service,\n} from '@/base/metadata/injectable';\nexport { datasource, model, repository } from '@/base/metadata/persistents';\nexport { inject } from '@/base/metadata/injectors';\nexport { ArtifactBindingKeys } from '@/base/metadata/artifact-keys';\n\n// A group of a package's classes, borrowed by an application - a browser kit defines its groups from here, not from the root barrel.\nexport { ArtifactGroup } from '@/base/applications/artifact-group';\nexport type { IArtifactGroup, IArtifactIndex } from '@/base/applications/common';\n\nexport { ArtifactNamespaces, BindingNamespaces } from '@/common/bindings';\nexport type { TBindingNamespace } from '@/common/bindings';\n\n/**\n * `CoreBindings` is deliberately NOT here. The namespaces above are the GRAMMAR of a binding key;\n * `CoreBindings` is one application's DICTIONARY (`APPLICATION_SERVER`, `APPLICATION_ROOT_ROUTER`).\n * A sibling framework ships a class of the same name whose `APPLICATION_INSTANCE` is a different\n * string, so shipping ours beside the stereotypes means binding under one key and resolving under\n * another, with nothing failing until run time. It stays on the root barrel.\n */\n\nexport { ArtifactTypes, BindingKeys, MetadataRegistry } from '@/helpers/inversion';\nexport type {\n IArtifactMetadata,\n IArtifactRegistrationOptions,\n TBindingScope,\n} from '@/helpers/inversion';\n"]}
@@ -15,14 +15,14 @@
15
15
  export { AbstractRepository } from './base/repositories/core/abstract.js';
16
16
  export { AbstractDataSource } from './base/datasources/abstract.js';
17
17
  export type { ICreatableRepository, ICrudRepository, IDeletableRepository, IPersistableRepository, IReadableRepository, IRepository, IUpdatableRepository, } from './base/repositories/common/types/contracts.js';
18
- export { buildDataRange } from './base/repositories/common/types/results.js';
18
+ export { DataRangeUtility } from './base/repositories/common/types/results.js';
19
19
  export { HttpResponseReader } from './base/repositories/common/response-reader.js';
20
20
  export { HttpExtraRequest } from './base/repositories/common/extra-request.js';
21
21
  export type { TExtraRequest, TExtraResult } from './base/repositories/common/extra-request.js';
22
22
  export { DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, RepositoryOperationScopes, RepositoryTypes, } from './base/repositories/common/constants.js';
23
23
  export type { TRepositoryType } from './base/repositories/common/constants.js';
24
24
  export { CoreErrorCodes, SearchErrorCodes } from './common/error-codes.js';
25
- export { throwNotSupported } from './utilities/error.utility.js';
25
+ export { NotSupportedUtility } from './utilities/not-supported.utility.js';
26
26
  export type { TCount, TDataRange, TDataWithRange } from './base/repositories/common/types/results.js';
27
27
  export type { IDataSource } from './base/datasources/common/types.js';
28
28
  export { AbstractEntity } from './base/models/base.js';
@@ -1 +1 @@
1
- {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,oBAAoB,GACrB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAI1E,OAAO,EAAE,kBAAkB,EA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E,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAI5F,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,eAAe,GAChB,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAEnG,YAAY,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAInE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGvE,YAAY,EACV,WAAW,EACX,OAAO,EACP,OAAO,EACP,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,MAAM,GACP,MAAM,uBAAuB,CAAC"}
@@ -14,7 +14,7 @@
14
14
  */
15
15
  export { AbstractRepository } from './base/repositories/core/abstract.js';
16
16
  export { AbstractDataSource } from './base/datasources/abstract.js';
17
- export { buildDataRange } from './base/repositories/common/types/results.js';
17
+ export { DataRangeUtility } from './base/repositories/common/types/results.js';
18
18
  // How a client reads what an IGNIS server answers - shared by the http connector and any client
19
19
  // that reads the same server without it.
20
20
  export { HttpResponseReader } from './base/repositories/common/response-reader.js';
@@ -23,7 +23,7 @@ export { HttpExtraRequest } from './base/repositories/common/extra-request.js';
23
23
  // and the helper an engine that lacks an operation throws through.
24
24
  export { DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, RepositoryOperationScopes, RepositoryTypes, } from './base/repositories/common/constants.js';
25
25
  export { CoreErrorCodes, SearchErrorCodes } from './common/error-codes.js';
26
- export { throwNotSupported } from './utilities/error.utility.js';
26
+ export { NotSupportedUtility } from './utilities/not-supported.utility.js';
27
27
  // `IRepository` names an entity, so a consumer implementing the contract needs the base to extend.
28
28
  // Engine-neutral like the datasource: a name, `getSchema({ type })`, and an id type.
29
29
  export { AbstractEntity } from './base/models/base.js';
@@ -1 +1 @@
1
- {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAYjE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE1E,gGAAgG;AAChG,yCAAyC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAG5E,mGAAmG;AACnG,mEAAmE;AACnE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,eAAe,GAChB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAK9D,mGAAmG;AACnG,qFAAqF;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["/**\n * The persistence contract, and nothing about how a row is served or validated.\n *\n * A repository talks to a datasource. `AbstractDataSource` is engine-neutral - its only required\n * member is `configure()` - so \"an HTTP request to another server\" is a datasource in the same sense\n * Drizzle-over-Postgres is one: same role, different transport. This entry exists so a consumer can\n * implement that without taking the OpenAPI layer, which `base/repositories` reaches through\n * `query-schemas` and `result-schemas`.\n *\n * Both halves already speak `@venizia/ignis-filter`, so a consumer on another transport shares the\n * query vocabulary rather than translating into one.\n *\n * Weight is a contract, checked by `src/__tests__/bundle/browser-weight.test.ts`.\n */\n\nexport { AbstractRepository } from '@/base/repositories/core/abstract';\nexport { AbstractDataSource } from '@/base/datasources/abstract';\n\nexport type {\n ICreatableRepository,\n ICrudRepository,\n IDeletableRepository,\n IPersistableRepository,\n IReadableRepository,\n IRepository,\n IUpdatableRepository,\n} from '@/base/repositories/common/types/contracts';\n\nexport { buildDataRange } from '@/base/repositories/common/types/results';\n\n// How a client reads what an IGNIS server answers - shared by the http connector and any client\n// that reads the same server without it.\nexport { HttpResponseReader } from '@/base/repositories/common/response-reader';\nexport { HttpExtraRequest } from '@/base/repositories/common/extra-request';\nexport type { TExtraRequest, TExtraResult } from '@/base/repositories/common/extra-request';\n\n// What a repository on any transport raises and bounds itself by - the constants, the error codes,\n// and the helper an engine that lacks an operation throws through.\nexport {\n DEFAULT_LIMIT,\n DEFAULT_MAX_LIMIT,\n RepositoryOperationScopes,\n RepositoryTypes,\n} from '@/base/repositories/common/constants';\nexport type { TRepositoryType } from '@/base/repositories/common/constants';\nexport { CoreErrorCodes, SearchErrorCodes } from '@/common/error-codes';\nexport { throwNotSupported } from '@/utilities/error.utility';\nexport type { TCount, TDataRange, TDataWithRange } from '@/base/repositories/common/types/results';\n\nexport type { IDataSource } from '@/base/datasources/common/types';\n\n// `IRepository` names an entity, so a consumer implementing the contract needs the base to extend.\n// Engine-neutral like the datasource: a name, `getSchema({ type })`, and an id type.\nexport { AbstractEntity } from '@/base/models/base';\nexport { SchemaTypes } from '@/base/models/common/constants';\nexport type { TIdSchemaType, TSchemaType } from '@/base/models/common';\n\n// The query vocabulary both transports share.\nexport type {\n TByIdFilter,\n TFields,\n TFilter,\n TInclusion,\n TRow,\n TSelectedRow,\n TWhere,\n} from '@venizia/ignis-filter';\n"]}
1
+ {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAYjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,gGAAgG;AAChG,yCAAyC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAG5E,mGAAmG;AACnG,mEAAmE;AACnE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,eAAe,GAChB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAKxE,mGAAmG;AACnG,qFAAqF;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["/**\n * The persistence contract, and nothing about how a row is served or validated.\n *\n * A repository talks to a datasource. `AbstractDataSource` is engine-neutral - its only required\n * member is `configure()` - so \"an HTTP request to another server\" is a datasource in the same sense\n * Drizzle-over-Postgres is one: same role, different transport. This entry exists so a consumer can\n * implement that without taking the OpenAPI layer, which `base/repositories` reaches through\n * `query-schemas` and `result-schemas`.\n *\n * Both halves already speak `@venizia/ignis-filter`, so a consumer on another transport shares the\n * query vocabulary rather than translating into one.\n *\n * Weight is a contract, checked by `src/__tests__/bundle/browser-weight.test.ts`.\n */\n\nexport { AbstractRepository } from '@/base/repositories/core/abstract';\nexport { AbstractDataSource } from '@/base/datasources/abstract';\n\nexport type {\n ICreatableRepository,\n ICrudRepository,\n IDeletableRepository,\n IPersistableRepository,\n IReadableRepository,\n IRepository,\n IUpdatableRepository,\n} from '@/base/repositories/common/types/contracts';\n\nexport { DataRangeUtility } from '@/base/repositories/common/types/results';\n\n// How a client reads what an IGNIS server answers - shared by the http connector and any client\n// that reads the same server without it.\nexport { HttpResponseReader } from '@/base/repositories/common/response-reader';\nexport { HttpExtraRequest } from '@/base/repositories/common/extra-request';\nexport type { TExtraRequest, TExtraResult } from '@/base/repositories/common/extra-request';\n\n// What a repository on any transport raises and bounds itself by - the constants, the error codes,\n// and the helper an engine that lacks an operation throws through.\nexport {\n DEFAULT_LIMIT,\n DEFAULT_MAX_LIMIT,\n RepositoryOperationScopes,\n RepositoryTypes,\n} from '@/base/repositories/common/constants';\nexport type { TRepositoryType } from '@/base/repositories/common/constants';\nexport { CoreErrorCodes, SearchErrorCodes } from '@/common/error-codes';\nexport { NotSupportedUtility } from '@/utilities/not-supported.utility';\nexport type { TCount, TDataRange, TDataWithRange } from '@/base/repositories/common/types/results';\n\nexport type { IDataSource } from '@/base/datasources/common/types';\n\n// `IRepository` names an entity, so a consumer implementing the contract needs the base to extend.\n// Engine-neutral like the datasource: a name, `getSchema({ type })`, and an id type.\nexport { AbstractEntity } from '@/base/models/base';\nexport { SchemaTypes } from '@/base/models/common/constants';\nexport type { TIdSchemaType, TSchemaType } from '@/base/models/common';\n\n// The query vocabulary both transports share.\nexport type {\n TByIdFilter,\n TFields,\n TFilter,\n TInclusion,\n TRow,\n TSelectedRow,\n TWhere,\n} from '@venizia/ignis-filter';\n"]}
@@ -1,2 +1,2 @@
1
- export * from './error.utility.js';
1
+ export * from './not-supported.utility.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":"AAEA,cAAc,yBAAyB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  // Zod-free by design: this barrel must stay reachable from a browser bundle. The OpenAPI schema
2
2
  // builders that used to live here are under `base/controllers/common/`, with the REST surface.
3
- export * from './error.utility.js';
3
+ export * from './not-supported.utility.js';
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,+FAA+F;AAC/F,cAAc,iBAAiB,CAAC","sourcesContent":["// Zod-free by design: this barrel must stay reachable from a browser bundle. The OpenAPI schema\n// builders that used to live here are under `base/controllers/common/`, with the REST surface.\nexport * from './error.utility';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,+FAA+F;AAC/F,cAAc,yBAAyB,CAAC","sourcesContent":["// Zod-free by design: this barrel must stay reachable from a browser bundle. The OpenAPI schema\n// builders that used to live here are under `base/controllers/common/`, with the REST surface.\nexport * from './not-supported.utility';\n"]}
@@ -0,0 +1,11 @@
1
+ import type { ILogger } from '@venizia/ignis-helpers/core';
2
+ /** Errors an implementation raises on purpose. */
3
+ export declare class NotSupportedUtility {
4
+ /** Standardized NotSupported error (HTTP 501) for a capability an implementation deliberately does not provide - logs a warning before throwing so the gap shows in operational logs, not just to the caller. */
5
+ static throwNotSupported(opts: {
6
+ scope: string;
7
+ feature: string;
8
+ logger: ILogger;
9
+ }): never;
10
+ }
11
+ //# sourceMappingURL=not-supported.utility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not-supported.utility.d.ts","sourceRoot":"","sources":["../../../src/utilities/not-supported.utility.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAG3D,kDAAkD;AAClD,qBAAa,mBAAmB;IAC9B,iNAAiN;IACjN,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,KAAK;CAa3F"}
@@ -0,0 +1,19 @@
1
+ import { CoreErrorCodes } from '../common/error-codes.js';
2
+ import { HTTP } from '@venizia/ignis-helpers/common';
3
+ import { getError } from '@venizia/ignis-helpers/core';
4
+ /** Errors an implementation raises on purpose. */
5
+ export class NotSupportedUtility {
6
+ /** Standardized NotSupported error (HTTP 501) for a capability an implementation deliberately does not provide - logs a warning before throwing so the gap shows in operational logs, not just to the caller. */
7
+ static throwNotSupported(opts) {
8
+ const { scope, feature, logger } = opts;
9
+ logger
10
+ .for(NotSupportedUtility.throwNotSupported.name)
11
+ .warn('%s is not supported | Scope: %s', feature, scope);
12
+ throw getError({
13
+ statusCode: HTTP.ResultCodes.RS_5.NotImplemented,
14
+ messageCode: CoreErrorCodes.NOT_SUPPORTED,
15
+ message: `[${scope}] ${feature} is not supported.`,
16
+ });
17
+ }
18
+ }
19
+ //# sourceMappingURL=not-supported.utility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not-supported.utility.js","sourceRoot":"","sources":["../../../src/utilities/not-supported.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,kDAAkD;AAClD,MAAM,OAAO,mBAAmB;IAC9B,iNAAiN;IACjN,MAAM,CAAC,iBAAiB,CAAC,IAAyD;QAChF,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAExC,MAAM;aACH,GAAG,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,IAAI,CAAC;aAC/C,IAAI,CAAC,iCAAiC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAE3D,MAAM,QAAQ,CAAC;YACb,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc;YAChD,WAAW,EAAE,cAAc,CAAC,aAAa;YACzC,OAAO,EAAE,IAAI,KAAK,KAAK,OAAO,oBAAoB;SACnD,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { CoreErrorCodes } from '@/common/error-codes';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport type { ILogger } from '@venizia/ignis-helpers/core';\nimport { getError } from '@venizia/ignis-helpers/core';\n\n/** Errors an implementation raises on purpose. */\nexport class NotSupportedUtility {\n /** Standardized NotSupported error (HTTP 501) for a capability an implementation deliberately does not provide - logs a warning before throwing so the gap shows in operational logs, not just to the caller. */\n static throwNotSupported(opts: { scope: string; feature: string; logger: ILogger }): never {\n const { scope, feature, logger } = opts;\n\n logger\n .for(NotSupportedUtility.throwNotSupported.name)\n .warn('%s is not supported | Scope: %s', feature, scope);\n\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.NotImplemented,\n messageCode: CoreErrorCodes.NOT_SUPPORTED,\n message: `[${scope}] ${feature} is not supported.`,\n });\n }\n}\n"]}