@venizia/ignis-kernel 0.4.1 → 0.4.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 (75) hide show
  1. package/dist/cjs/base/applications/cors.d.ts +13 -0
  2. package/dist/cjs/base/applications/cors.d.ts.map +1 -0
  3. package/dist/cjs/base/applications/cors.js +43 -0
  4. package/dist/cjs/base/applications/cors.js.map +1 -0
  5. package/dist/cjs/base/applications/deprecations.d.ts +10 -0
  6. package/dist/cjs/base/applications/deprecations.d.ts.map +1 -0
  7. package/dist/cjs/base/applications/deprecations.js +23 -0
  8. package/dist/cjs/base/applications/deprecations.js.map +1 -0
  9. package/dist/cjs/base/applications/rest.d.ts.map +1 -1
  10. package/dist/cjs/base/applications/rest.js +6 -0
  11. package/dist/cjs/base/applications/rest.js.map +1 -1
  12. package/dist/cjs/base/controllers/factory/authorize-guard.d.ts +19 -0
  13. package/dist/cjs/base/controllers/factory/authorize-guard.d.ts.map +1 -0
  14. package/dist/cjs/base/controllers/factory/authorize-guard.js +60 -0
  15. package/dist/cjs/base/controllers/factory/authorize-guard.js.map +1 -0
  16. package/dist/cjs/base/controllers/factory/controller.d.ts.map +1 -1
  17. package/dist/cjs/base/controllers/factory/controller.js +8 -0
  18. package/dist/cjs/base/controllers/factory/controller.js.map +1 -1
  19. package/dist/cjs/base/metadata/model-settings.d.ts +21 -0
  20. package/dist/cjs/base/metadata/model-settings.d.ts.map +1 -0
  21. package/dist/cjs/base/metadata/model-settings.js +77 -0
  22. package/dist/cjs/base/metadata/model-settings.js.map +1 -0
  23. package/dist/cjs/base/metadata/persistents.d.ts +1 -1
  24. package/dist/cjs/base/metadata/persistents.d.ts.map +1 -1
  25. package/dist/cjs/base/metadata/persistents.js +20 -8
  26. package/dist/cjs/base/metadata/persistents.js.map +1 -1
  27. package/dist/cjs/base/repositories/common/constants.d.ts +18 -1
  28. package/dist/cjs/base/repositories/common/constants.d.ts.map +1 -1
  29. package/dist/cjs/base/repositories/common/constants.js +22 -2
  30. package/dist/cjs/base/repositories/common/constants.js.map +1 -1
  31. package/dist/cjs/base/repositories/core/abstract.d.ts +1 -1
  32. package/dist/cjs/base/repositories/core/abstract.d.ts.map +1 -1
  33. package/dist/cjs/base/repositories/core/abstract.js +4 -4
  34. package/dist/cjs/base/repositories/core/abstract.js.map +1 -1
  35. package/dist/cjs/helpers/inversion/common/types/model.d.ts +94 -22
  36. package/dist/cjs/helpers/inversion/common/types/model.d.ts.map +1 -1
  37. package/dist/cjs/helpers/inversion/common/types/model.js.map +1 -1
  38. package/dist/esm/base/applications/cors.d.ts +13 -0
  39. package/dist/esm/base/applications/cors.d.ts.map +1 -0
  40. package/dist/esm/base/applications/cors.js +39 -0
  41. package/dist/esm/base/applications/cors.js.map +1 -0
  42. package/dist/esm/base/applications/deprecations.d.ts +10 -0
  43. package/dist/esm/base/applications/deprecations.d.ts.map +1 -0
  44. package/dist/esm/base/applications/deprecations.js +19 -0
  45. package/dist/esm/base/applications/deprecations.js.map +1 -0
  46. package/dist/esm/base/applications/rest.d.ts.map +1 -1
  47. package/dist/esm/base/applications/rest.js +6 -0
  48. package/dist/esm/base/applications/rest.js.map +1 -1
  49. package/dist/esm/base/controllers/factory/authorize-guard.d.ts +19 -0
  50. package/dist/esm/base/controllers/factory/authorize-guard.d.ts.map +1 -0
  51. package/dist/esm/base/controllers/factory/authorize-guard.js +56 -0
  52. package/dist/esm/base/controllers/factory/authorize-guard.js.map +1 -0
  53. package/dist/esm/base/controllers/factory/controller.d.ts.map +1 -1
  54. package/dist/esm/base/controllers/factory/controller.js +8 -0
  55. package/dist/esm/base/controllers/factory/controller.js.map +1 -1
  56. package/dist/esm/base/metadata/model-settings.d.ts +21 -0
  57. package/dist/esm/base/metadata/model-settings.d.ts.map +1 -0
  58. package/dist/esm/base/metadata/model-settings.js +73 -0
  59. package/dist/esm/base/metadata/model-settings.js.map +1 -0
  60. package/dist/esm/base/metadata/persistents.d.ts +1 -1
  61. package/dist/esm/base/metadata/persistents.d.ts.map +1 -1
  62. package/dist/esm/base/metadata/persistents.js +20 -8
  63. package/dist/esm/base/metadata/persistents.js.map +1 -1
  64. package/dist/esm/base/repositories/common/constants.d.ts +18 -1
  65. package/dist/esm/base/repositories/common/constants.d.ts.map +1 -1
  66. package/dist/esm/base/repositories/common/constants.js +20 -1
  67. package/dist/esm/base/repositories/common/constants.js.map +1 -1
  68. package/dist/esm/base/repositories/core/abstract.d.ts +1 -1
  69. package/dist/esm/base/repositories/core/abstract.d.ts.map +1 -1
  70. package/dist/esm/base/repositories/core/abstract.js +4 -4
  71. package/dist/esm/base/repositories/core/abstract.js.map +1 -1
  72. package/dist/esm/helpers/inversion/common/types/model.d.ts +94 -22
  73. package/dist/esm/helpers/inversion/common/types/model.d.ts.map +1 -1
  74. package/dist/esm/helpers/inversion/common/types/model.js.map +1 -1
  75. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../../src/base/controllers/factory/controller.ts"],"names":[],"mappings":";;;AACA,8DAA6D;AAI7D,sDAAmE;AACnE,8DAAmD;AAQnD,iCAAmD;AACnD,6CAA4D;AAC5D,iEAA4E;AAE5E,6EAA6E;AAC7E,MAAa,iBAAkB,SAAQ,iBAAU;IAC/C;QACE,KAAK,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,oBAAoB,CASzB,OAAgD;QAChD,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAExE,MAAM,EACJ,IAAI,EACJ,QAAQ,GAAG,cAAc,EACzB,QAAQ,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,GAC/C,GAAG,UAAU,CAAC;QACf,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,cAAc,EAAE,CAAC;YAC7C,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,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;qBACvD,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;QAEF,MAAM,CAAC,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QACpF,IAAA,yDAAkC,EAAC;YACjC,MAAM,EAAE,eAAe;YACvB,WAAW,EAAE,sBAAsB;YACnC,cAAc,EAAE,IAAI;YACpB,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;SACxC,CAAC,CAAC;QACH,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AA1JD,8CA0JC","sourcesContent":["import type { AbstractEntity } from '@/base/models';\nimport { SchemaTypes } from '@/base/models/common/constants';\nimport type { AbstractRepository } from '@/base/repositories';\nimport type { TAnyObjectSchema } from '@/base/controllers/common/schema-builders';\nimport type { AnyType, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport { BaseHelper, getError } from '@venizia/ignis-helpers/core';\nimport { isClass } from '@venizia/ignis-inversion';\nimport type { Env, Schema } from 'hono';\nimport type {\n ICrudControllerOptions,\n ICustomizableRoutes,\n TEntityDataObject,\n TEntityPersistObject,\n} from '../common';\nimport { PersistableCrudController } from './crud';\nimport { defineControllerRouteConfigs } from './definition';\nimport { registerFactoryRepositoryInjection } from './repository-injection';\n\n/** Factory for generating typed CRUD controllers from entity definitions. */\nexport class ControllerFactory extends BaseHelper {\n constructor() {\n super({ scope: ControllerFactory.name });\n }\n\n static defineCrudController<\n TEntity extends AbstractEntity<TAnyObjectSchema> = AbstractEntity<TAnyObjectSchema>,\n Routes extends ICustomizableRoutes = ICustomizableRoutes,\n RouteEnv extends Env = Env,\n RouteSchema extends Schema = {},\n BasePath extends string = '/',\n ConfigurableOptions extends object = {},\n TDataObject extends object = TEntityDataObject<TEntity>,\n TPersistObject extends object = TEntityPersistObject<TEntity>,\n >(defOpts: ICrudControllerOptions<TEntity, Routes>) {\n const { controller, entity, authenticate, authorize, routes } = defOpts;\n\n const {\n name,\n basePath = 'unknown_path',\n isStrict = { path: true, requestSchema: true },\n } = controller;\n if (!basePath || basePath === 'unknown_path') {\n throw getError({\n message: `[defineCrudController] Invalid controller basePath | name: ${name} | basePath: ${basePath}`,\n });\n }\n\n const entityClass = isClass(entity) ? entity : entity();\n const entityInstance = new entityClass();\n\n const routeDefinitions = defineControllerRouteConfigs({\n isStrict: isStrict.requestSchema ?? true,\n idType: entityInstance.getIdType(),\n authenticate,\n authorize,\n routes,\n schema: {\n select: entityInstance.getSchema({ type: SchemaTypes.SELECT }),\n create: entityInstance.getSchema({ type: SchemaTypes.CREATE }),\n update: entityInstance.getSchema({ type: SchemaTypes.UPDATE }),\n },\n serverStampedKeys: entityInstance.getServerStampedKeys(),\n });\n\n const controllerClass = class extends PersistableCrudController<\n TEntity,\n RouteEnv,\n RouteSchema,\n BasePath,\n ConfigurableOptions,\n TDataObject,\n TPersistObject\n > {\n // Any extra options: a repository whose options narrow `IExtraOptions` (a typed transaction) must fit.\n constructor(repository: AbstractRepository<TDataObject, TPersistObject, AnyType>) {\n super({\n scope: name,\n path: basePath,\n isStrict: isStrict.path ?? true,\n repository,\n definitions: routeDefinitions,\n });\n }\n\n /** Registers each CRUD route whose handler tier supplies it, honoring enabledRoutes/readonly. */\n override binding(): ValueOrPromise<void> {\n const isEnabled = (routeKey: keyof ICustomizableRoutes) => {\n if (controller.enabledRoutes) {\n return controller.enabledRoutes.includes(routeKey);\n }\n return routes?.[routeKey]?.enabled !== false;\n };\n\n // Read routes - always registered (unless explicitly disabled)\n if (isEnabled('count')) {\n this.defineRoute({\n configs: routeDefinitions.COUNT,\n handler: async (context) => this.count({ context }),\n });\n }\n\n if (isEnabled('find')) {\n this.defineRoute({\n configs: routeDefinitions.FIND,\n handler: async (context) => this.find({ context }),\n });\n }\n\n if (isEnabled('findOne')) {\n this.defineRoute({\n configs: routeDefinitions.FIND_ONE,\n handler: async (context) => this.findOne({ context }),\n });\n }\n\n if (isEnabled('findById')) {\n this.defineRoute({\n configs: routeDefinitions.FIND_BY_ID,\n handler: async (context) => this.findById({ context }),\n });\n }\n\n // Write routes - skipped when readonly\n if (controller.readonly) {\n return;\n }\n\n if (isEnabled('create')) {\n this.defineRoute({\n configs: routeDefinitions.CREATE,\n handler: async (context) => this.create({ context }),\n });\n }\n\n if (isEnabled('updateById')) {\n this.defineRoute({\n configs: routeDefinitions.UPDATE_BY_ID,\n handler: async (context) => this.updateById({ context }),\n });\n }\n\n if (isEnabled('updateBy')) {\n this.defineRoute({\n configs: routeDefinitions.UPDATE_BY,\n handler: async (context) => this.updateBy({ context }),\n });\n }\n\n if (isEnabled('deleteById')) {\n this.defineRoute({\n configs: routeDefinitions.DELETE_BY_ID,\n handler: async (context) => this.deleteById({ context }),\n });\n }\n\n if (isEnabled('deleteBy')) {\n this.defineRoute({\n configs: routeDefinitions.DELETE_BY,\n handler: async (context) => this.deleteBy({ context }),\n });\n }\n }\n };\n\n Object.defineProperty(controllerClass, 'name', { value: name, configurable: true });\n registerFactoryRepositoryInjection({\n target: controllerClass,\n factoryName: 'defineCrudController',\n controllerName: name,\n repositoryName: defOpts.repository.name,\n });\n return controllerClass;\n }\n}\n"]}
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../../src/base/controllers/factory/controller.ts"],"names":[],"mappings":";;;AACA,8DAA6D;AAI7D,sDAAmE;AACnE,8DAAmD;AAQnD,iCAAmD;AACnD,uDAAqE;AACrE,6CAA4D;AAC5D,iEAA4E;AAE5E,6EAA6E;AAC7E,MAAa,iBAAkB,SAAQ,iBAAU;IAC/C;QACE,KAAK,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,oBAAoB,CASzB,OAAgD;QAChD,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,GAA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,EAAE,CAAC;oBAC5B,IAAI,CAAC,WAAW,CAAC;wBACf,OAAO,EAAE,gBAAgB,CAAC,YAAY;wBACtC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC;qBACzD,CAAC,CAAC;gBACL,CAAC;gBAED,IAAI,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;oBAC1B,IAAI,CAAC,WAAW,CAAC;wBACf,OAAO,EAAE,gBAAgB,CAAC,SAAS;wBACnC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;qBACvD,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;QAEF,MAAM,CAAC,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QACpF,IAAA,yDAAkC,EAAC;YACjC,MAAM,EAAE,eAAe;YACvB,WAAW,EAAE,sBAAsB;YACnC,cAAc,EAAE,IAAI;YACpB,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;SACxC,CAAC,CAAC;QACH,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AAlKD,8CAkKC","sourcesContent":["import type { AbstractEntity } from '@/base/models';\nimport { SchemaTypes } from '@/base/models/common/constants';\nimport type { AbstractRepository } from '@/base/repositories';\nimport type { TAnyObjectSchema } from '@/base/controllers/common/schema-builders';\nimport type { AnyType, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport { BaseHelper, getError } from '@venizia/ignis-helpers/core';\nimport { isClass } from '@venizia/ignis-inversion';\nimport type { Env, Schema } from 'hono';\nimport type {\n ICrudControllerOptions,\n ICustomizableRoutes,\n TEntityDataObject,\n TEntityPersistObject,\n} from '../common';\nimport { PersistableCrudController } from './crud';\nimport { assertWriteVerbsDeclareAuthorize } from './authorize-guard';\nimport { defineControllerRouteConfigs } from './definition';\nimport { registerFactoryRepositoryInjection } from './repository-injection';\n\n/** Factory for generating typed CRUD controllers from entity definitions. */\nexport class ControllerFactory extends BaseHelper {\n constructor() {\n super({ scope: ControllerFactory.name });\n }\n\n static defineCrudController<\n TEntity extends AbstractEntity<TAnyObjectSchema> = AbstractEntity<TAnyObjectSchema>,\n Routes extends ICustomizableRoutes = ICustomizableRoutes,\n RouteEnv extends Env = Env,\n RouteSchema extends Schema = {},\n BasePath extends string = '/',\n ConfigurableOptions extends object = {},\n TDataObject extends object = TEntityDataObject<TEntity>,\n TPersistObject extends object = TEntityPersistObject<TEntity>,\n >(defOpts: ICrudControllerOptions<TEntity, Routes>) {\n const { controller, entity, authenticate, authorize, routes } = defOpts;\n\n const {\n name,\n basePath = 'unknown_path',\n isStrict = { path: true, requestSchema: true },\n } = controller;\n if (!basePath || basePath === 'unknown_path') {\n throw getError({\n message: `[defineCrudController] Invalid controller basePath | name: ${name} | basePath: ${basePath}`,\n });\n }\n\n assertWriteVerbsDeclareAuthorize({\n controllerName: name,\n authorize,\n routes,\n readonly: controller.readonly,\n enabledRoutes: controller.enabledRoutes,\n });\n\n const entityClass = isClass(entity) ? entity : entity();\n const entityInstance = new entityClass();\n\n const routeDefinitions = defineControllerRouteConfigs({\n isStrict: isStrict.requestSchema ?? true,\n idType: entityInstance.getIdType(),\n authenticate,\n authorize,\n routes,\n schema: {\n select: entityInstance.getSchema({ type: SchemaTypes.SELECT }),\n create: entityInstance.getSchema({ type: SchemaTypes.CREATE }),\n update: entityInstance.getSchema({ type: SchemaTypes.UPDATE }),\n },\n serverStampedKeys: entityInstance.getServerStampedKeys(),\n });\n\n const controllerClass = class extends PersistableCrudController<\n TEntity,\n RouteEnv,\n RouteSchema,\n BasePath,\n ConfigurableOptions,\n TDataObject,\n TPersistObject\n > {\n // Any extra options: a repository whose options narrow `IExtraOptions` (a typed transaction) must fit.\n constructor(repository: AbstractRepository<TDataObject, TPersistObject, AnyType>) {\n super({\n scope: name,\n path: basePath,\n isStrict: isStrict.path ?? true,\n repository,\n definitions: routeDefinitions,\n });\n }\n\n /** Registers each CRUD route whose handler tier supplies it, honoring enabledRoutes/readonly. */\n override binding(): ValueOrPromise<void> {\n const isEnabled = (routeKey: keyof ICustomizableRoutes) => {\n if (controller.enabledRoutes) {\n return controller.enabledRoutes.includes(routeKey);\n }\n return routes?.[routeKey]?.enabled !== false;\n };\n\n // Read routes - always registered (unless explicitly disabled)\n if (isEnabled('count')) {\n this.defineRoute({\n configs: routeDefinitions.COUNT,\n handler: async (context) => this.count({ context }),\n });\n }\n\n if (isEnabled('find')) {\n this.defineRoute({\n configs: routeDefinitions.FIND,\n handler: async (context) => this.find({ context }),\n });\n }\n\n if (isEnabled('findOne')) {\n this.defineRoute({\n configs: routeDefinitions.FIND_ONE,\n handler: async (context) => this.findOne({ context }),\n });\n }\n\n if (isEnabled('findById')) {\n this.defineRoute({\n configs: routeDefinitions.FIND_BY_ID,\n handler: async (context) => this.findById({ context }),\n });\n }\n\n // Write routes - skipped when readonly\n if (controller.readonly) {\n return;\n }\n\n if (isEnabled('create')) {\n this.defineRoute({\n configs: routeDefinitions.CREATE,\n handler: async (context) => this.create({ context }),\n });\n }\n\n if (isEnabled('updateById')) {\n this.defineRoute({\n configs: routeDefinitions.UPDATE_BY_ID,\n handler: async (context) => this.updateById({ context }),\n });\n }\n\n if (isEnabled('updateBy')) {\n this.defineRoute({\n configs: routeDefinitions.UPDATE_BY,\n handler: async (context) => this.updateBy({ context }),\n });\n }\n\n if (isEnabled('deleteById')) {\n this.defineRoute({\n configs: routeDefinitions.DELETE_BY_ID,\n handler: async (context) => this.deleteById({ context }),\n });\n }\n\n if (isEnabled('deleteBy')) {\n this.defineRoute({\n configs: routeDefinitions.DELETE_BY,\n handler: async (context) => this.deleteBy({ context }),\n });\n }\n }\n };\n\n Object.defineProperty(controllerClass, 'name', { value: name, configurable: true });\n registerFactoryRepositoryInjection({\n target: controllerClass,\n factoryName: 'defineCrudController',\n controllerName: name,\n repositoryName: defOpts.repository.name,\n });\n return controllerClass;\n }\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import type { IDeprecatedModelSetting, IModelSettings } from '../../helpers/inversion';
2
+ /** The release that drops the deprecated keys. */
3
+ export declare const DEPRECATED_MODEL_SETTINGS_REMOVED_IN = "0.4.3";
4
+ /**
5
+ * The one place the old flat settings become the new grouped ones. Everything that reads model
6
+ * settings reads the result, so no reader knows two shapes.
7
+ *
8
+ * - `defaultFilter` -> `query.filter`; `defaultLimit` -> `query.limit.default`; `maxLimit` ->
9
+ * `query.limit.max`; `scopeFilter` -> `access` (`writeGuard` -> `access.write.mode`, `sharedRows`
10
+ * -> `access.write.sharedRows`).
11
+ * - An old key together with the key that replaces it is an error.
12
+ * - Returns the old keys in use so the application can warn once at boot.
13
+ */
14
+ export declare const normalizeModelSettings: (opts: {
15
+ model: string;
16
+ settings: IModelSettings | undefined;
17
+ }) => {
18
+ settings: IModelSettings | undefined;
19
+ deprecated: IDeprecatedModelSetting[];
20
+ };
21
+ //# sourceMappingURL=model-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-settings.d.ts","sourceRoot":"","sources":["../../../../src/base/metadata/model-settings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uBAAuB,EAEvB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAE7B,kDAAkD;AAClD,eAAO,MAAM,oCAAoC,UAAU,CAAC;AAQ5D;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAC;CACtC,KAAG;IAAE,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAC;IAAC,UAAU,EAAE,uBAAuB,EAAE,CAAA;CAmEhF,CAAC"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeModelSettings = exports.DEPRECATED_MODEL_SETTINGS_REMOVED_IN = void 0;
4
+ const core_1 = require("@venizia/ignis-helpers/core");
5
+ /** The release that drops the deprecated keys. */
6
+ exports.DEPRECATED_MODEL_SETTINGS_REMOVED_IN = '0.4.3';
7
+ const conflict = (opts) => {
8
+ return (0, core_1.getError)({
9
+ message: `[model][${opts.model}] settings.${opts.old} and settings.${opts.use} are both set | ${opts.old} is the deprecated name of ${opts.use} | keep ${opts.use} and remove ${opts.old}`,
10
+ });
11
+ };
12
+ /**
13
+ * The one place the old flat settings become the new grouped ones. Everything that reads model
14
+ * settings reads the result, so no reader knows two shapes.
15
+ *
16
+ * - `defaultFilter` -> `query.filter`; `defaultLimit` -> `query.limit.default`; `maxLimit` ->
17
+ * `query.limit.max`; `scopeFilter` -> `access` (`writeGuard` -> `access.write.mode`, `sharedRows`
18
+ * -> `access.write.sharedRows`).
19
+ * - An old key together with the key that replaces it is an error.
20
+ * - Returns the old keys in use so the application can warn once at boot.
21
+ */
22
+ const normalizeModelSettings = (opts) => {
23
+ const { model, settings } = opts;
24
+ if (!settings) {
25
+ return { settings, deprecated: [] };
26
+ }
27
+ const { defaultFilter, defaultLimit, maxLimit, scopeFilter, ...current } = settings;
28
+ const deprecated = [];
29
+ const normalized = { ...current };
30
+ if (defaultFilter !== undefined) {
31
+ if (current.query?.filter !== undefined) {
32
+ throw conflict({ model, old: 'defaultFilter', use: 'query.filter' });
33
+ }
34
+ normalized.query = { ...normalized.query, filter: defaultFilter };
35
+ deprecated.push({ key: 'defaultFilter', use: 'query.filter' });
36
+ }
37
+ if (defaultLimit !== undefined) {
38
+ if (current.query?.limit?.default !== undefined) {
39
+ throw conflict({ model, old: 'defaultLimit', use: 'query.limit.default' });
40
+ }
41
+ normalized.query = {
42
+ ...normalized.query,
43
+ limit: { ...normalized.query?.limit, default: defaultLimit },
44
+ };
45
+ deprecated.push({ key: 'defaultLimit', use: 'query.limit.default' });
46
+ }
47
+ if (maxLimit !== undefined) {
48
+ if (current.query?.limit?.max !== undefined) {
49
+ throw conflict({ model, old: 'maxLimit', use: 'query.limit.max' });
50
+ }
51
+ normalized.query = {
52
+ ...normalized.query,
53
+ limit: { ...normalized.query?.limit, max: maxLimit },
54
+ };
55
+ deprecated.push({ key: 'maxLimit', use: 'query.limit.max' });
56
+ }
57
+ if (scopeFilter !== undefined) {
58
+ if (current.access !== undefined) {
59
+ throw conflict({ model, old: 'scopeFilter', use: 'access' });
60
+ }
61
+ const { writeGuard, sharedRows, ...rest } = scopeFilter;
62
+ const access = { ...rest };
63
+ deprecated.push({ key: 'scopeFilter', use: 'access' });
64
+ if (writeGuard !== undefined) {
65
+ access.write = { ...access.write, mode: writeGuard };
66
+ deprecated.push({ key: 'scopeFilter.writeGuard', use: 'access.write.mode' });
67
+ }
68
+ if (sharedRows !== undefined) {
69
+ access.write = { ...access.write, sharedRows };
70
+ deprecated.push({ key: 'scopeFilter.sharedRows', use: 'access.write.sharedRows' });
71
+ }
72
+ normalized.access = access;
73
+ }
74
+ return { settings: normalized, deprecated };
75
+ };
76
+ exports.normalizeModelSettings = normalizeModelSettings;
77
+ //# sourceMappingURL=model-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-settings.js","sourceRoot":"","sources":["../../../../src/base/metadata/model-settings.ts"],"names":[],"mappings":";;;AAAA,sDAAuD;AAOvD,kDAAkD;AACrC,QAAA,oCAAoC,GAAG,OAAO,CAAC;AAE5D,MAAM,QAAQ,GAAG,CAAC,IAAiD,EAAE,EAAE;IACrE,OAAO,IAAA,eAAQ,EAAC;QACd,OAAO,EAAE,WAAW,IAAI,CAAC,KAAK,cAAc,IAAI,CAAC,GAAG,iBAAiB,IAAI,CAAC,GAAG,mBAAmB,IAAI,CAAC,GAAG,8BAA8B,IAAI,CAAC,GAAG,WAAW,IAAI,CAAC,GAAG,eAAe,IAAI,CAAC,GAAG,EAAE;KAC3L,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;;;GASG;A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AU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,wBAAwB,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,CAAC;QAC/E,CAAC;QAED,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,MAAM,CAAC,KAAK,GAAG,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC;YAC/C,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,wBAAwB,EAAE,GAAG,EAAE,yBAAyB,EAAE,CAAC,CAAC;QACrF,CAAC;QAED,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC;IAC7B,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AAC9C,CAAC,CAAC;AAtEW,QAAA,sBAAsB,0BAsEjC","sourcesContent":["import { getError } from '@venizia/ignis-helpers/core';\nimport type {\n IDeprecatedModelSetting,\n IModelAccessSettings,\n IModelSettings,\n} from '@/helpers/inversion';\n\n/** The release that drops the deprecated keys. */\nexport const DEPRECATED_MODEL_SETTINGS_REMOVED_IN = '0.4.3';\n\nconst conflict = (opts: { model: string; old: string; use: string }) => {\n return getError({\n message: `[model][${opts.model}] settings.${opts.old} and settings.${opts.use} are both set | ${opts.old} is the deprecated name of ${opts.use} | keep ${opts.use} and remove ${opts.old}`,\n });\n};\n\n/**\n * The one place the old flat settings become the new grouped ones. Everything that reads model\n * settings reads the result, so no reader knows two shapes.\n *\n * - `defaultFilter` -> `query.filter`; `defaultLimit` -> `query.limit.default`; `maxLimit` ->\n * `query.limit.max`; `scopeFilter` -> `access` (`writeGuard` -> `access.write.mode`, `sharedRows`\n * -> `access.write.sharedRows`).\n * - An old key together with the key that replaces it is an error.\n * - Returns the old keys in use so the application can warn once at boot.\n */\nexport const normalizeModelSettings = (opts: {\n model: string;\n settings: IModelSettings | undefined;\n}): { settings: IModelSettings | undefined; deprecated: IDeprecatedModelSetting[] } => {\n const { model, settings } = opts;\n\n if (!settings) {\n return { settings, deprecated: [] };\n }\n\n const { defaultFilter, defaultLimit, maxLimit, scopeFilter, ...current } = settings;\n const deprecated: IDeprecatedModelSetting[] = [];\n const normalized: IModelSettings = { ...current };\n\n if (defaultFilter !== undefined) {\n if (current.query?.filter !== undefined) {\n throw conflict({ model, old: 'defaultFilter', use: 'query.filter' });\n }\n\n normalized.query = { ...normalized.query, filter: defaultFilter };\n deprecated.push({ key: 'defaultFilter', use: 'query.filter' });\n }\n\n if (defaultLimit !== undefined) {\n if (current.query?.limit?.default !== undefined) {\n throw conflict({ model, old: 'defaultLimit', use: 'query.limit.default' });\n }\n\n normalized.query = {\n ...normalized.query,\n limit: { ...normalized.query?.limit, default: defaultLimit },\n };\n deprecated.push({ key: 'defaultLimit', use: 'query.limit.default' });\n }\n\n if (maxLimit !== undefined) {\n if (current.query?.limit?.max !== undefined) {\n throw conflict({ model, old: 'maxLimit', use: 'query.limit.max' });\n }\n\n normalized.query = {\n ...normalized.query,\n limit: { ...normalized.query?.limit, max: maxLimit },\n };\n deprecated.push({ key: 'maxLimit', use: 'query.limit.max' });\n }\n\n if (scopeFilter !== undefined) {\n if (current.access !== undefined) {\n throw conflict({ model, old: 'scopeFilter', use: 'access' });\n }\n\n const { writeGuard, sharedRows, ...rest } = scopeFilter;\n const access: IModelAccessSettings = { ...rest };\n deprecated.push({ key: 'scopeFilter', use: 'access' });\n\n if (writeGuard !== undefined) {\n access.write = { ...access.write, mode: writeGuard };\n deprecated.push({ key: 'scopeFilter.writeGuard', use: 'access.write.mode' });\n }\n\n if (sharedRows !== undefined) {\n access.write = { ...access.write, sharedRows };\n deprecated.push({ key: 'scopeFilter.sharedRows', use: 'access.write.sharedRows' });\n }\n\n normalized.access = access;\n }\n\n return { settings: normalized, deprecated };\n};\n"]}
@@ -2,7 +2,7 @@ import type { IDataSourceMetadata, IModelMetadata, TRepositoryMetadata } from '.
2
2
  import type { IDataSource } from '../datasources';
3
3
  import type { AbstractEntity } from '../models';
4
4
  /** Registers a model class with its static schema and relations. */
5
- export declare const model: (metadata: IModelMetadata) => ClassDecorator;
5
+ export declare const model: (input: IModelMetadata) => ClassDecorator;
6
6
  /** Registers a datasource with driver and auto-discovery settings. */
7
7
  export declare const datasource: (metadata?: IDataSourceMetadata) => ClassDecorator;
8
8
  export declare const repository: <Model extends AbstractEntity = AbstractEntity, DataSource extends IDataSource = IDataSource>(metadata?: TRepositoryMetadata<Model, DataSource>) => ClassDecorator;
@@ -1 +1 @@
1
- {"version":3,"file":"persistents.d.ts","sourceRoot":"","sources":["../../../../src/base/metadata/persistents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,mBAAmB,EAEnB,cAAc,EAEd,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAU7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIhD,oEAAoE;AACpE,eAAO,MAAM,KAAK,GAAI,UAAU,cAAc,KAAG,cA4BhD,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,UAAU,GAAI,WAAW,mBAAmB,KAAG,cAQ3D,CAAC;AA0PF,eAAO,MAAM,UAAU,GACrB,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,UAAU,SAAS,WAAW,GAAG,WAAW,EAE5C,WAAW,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,KAChD,cAeF,CAAC"}
1
+ {"version":3,"file":"persistents.d.ts","sourceRoot":"","sources":["../../../../src/base/metadata/persistents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,mBAAmB,EAEnB,cAAc,EAEd,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAU7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAKhD,oEAAoE;AACpE,eAAO,MAAM,KAAK,GAAI,OAAO,cAAc,KAAG,cA0C7C,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,UAAU,GAAI,WAAW,mBAAmB,KAAG,cAQ3D,CAAC;AA0PF,eAAO,MAAM,UAAU,GACrB,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,UAAU,SAAS,WAAW,GAAG,WAAW,EAE5C,WAAW,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,KAChD,cAeF,CAAC"}
@@ -8,26 +8,38 @@ const core_1 = require("@venizia/ignis-helpers/core");
8
8
  const datasources_1 = require("../datasources");
9
9
  const constants_1 = require("../repositories/common/constants");
10
10
  const injectable_1 = require("./injectable");
11
+ const model_settings_1 = require("./model-settings");
11
12
  /** Registers a model class with its static schema and relations. */
12
- const model = (metadata) => {
13
+ const model = (input) => {
13
14
  return (target) => {
14
- (0, injectable_1.injectable)({ type: inversion_1.ArtifactTypes.MODEL, ...(0, injectable_1.pickRegistrationOptions)({ metadata }) })(target);
15
- const defaultLimit = metadata.settings?.defaultLimit;
15
+ (0, injectable_1.injectable)({ type: inversion_1.ArtifactTypes.MODEL, ...(0, injectable_1.pickRegistrationOptions)({ metadata: input }) })(target);
16
+ // The one place the deprecated flat keys become the grouped ones; the registry, and so every
17
+ // reader, only ever sees the grouped shape.
18
+ const { settings, deprecated } = (0, model_settings_1.normalizeModelSettings)({
19
+ model: target.name,
20
+ settings: input.settings,
21
+ });
22
+ const metadata = {
23
+ ...input,
24
+ settings,
25
+ ...(deprecated.length > 0 ? { deprecatedSettings: deprecated } : {}),
26
+ };
27
+ const defaultLimit = settings?.query?.limit?.default;
16
28
  if (defaultLimit !== undefined && (!Number.isInteger(defaultLimit) || defaultLimit <= 0)) {
17
29
  throw (0, core_1.getError)({
18
- message: `[model][${target.name}] Invalid 'defaultLimit' | Expected a positive integer | Got: ${defaultLimit}`,
30
+ message: `[model][${target.name}] Invalid 'query.limit.default' | Expected a positive integer | Got: ${defaultLimit}`,
19
31
  });
20
32
  }
21
- // Validated at DECORATION time, like defaultLimit: a bad ceiling is a wiring mistake, and
33
+ // Validated at DECORATION time, like the default limit: a bad ceiling is a wiring mistake, and
22
34
  // catching it at boot beats catching it on the one request that happens to reach the limit.
23
- const maxLimit = metadata.settings?.maxLimit;
35
+ const maxLimit = settings?.query?.limit?.max;
24
36
  if (maxLimit !== undefined && (!Number.isInteger(maxLimit) || maxLimit <= 0)) {
25
37
  throw (0, core_1.getError)({
26
- message: `[model][${target.name}] Invalid 'maxLimit' | Expected a positive integer | Got: ${maxLimit}`,
38
+ message: `[model][${target.name}] Invalid 'query.limit.max' | Expected a positive integer | Got: ${maxLimit}`,
27
39
  });
28
40
  }
29
41
  // Auto-populate AUTHORIZATION_SUBJECT from authorize.principal if not already set
30
- const principal = metadata.settings?.authorize?.principal;
42
+ const principal = settings?.authorize?.principal;
31
43
  if (principal && !Object.hasOwn(target, 'AUTHORIZATION_SUBJECT')) {
32
44
  target.AUTHORIZATION_SUBJECT = principal;
33
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"persistents.js","sourceRoot":"","sources":["../../../../src/base/metadata/persistents.ts"],"names":[],"mappings":";;;AAAA,gDAAsD;AAStD,mDAM6B;AAC7B,0DAA2E;AAC3E,sDAAuD;AAEvD,gDAAmD;AAEnD,gEAAmE;AACnE,6CAAmE;AAEnE,oEAAoE;AAC7D,MAAM,KAAK,GAAG,CAAC,QAAwB,EAAkB,EAAE;IAChE,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,IAAA,uBAAU,EAAC,EAAE,IAAI,EAAE,yBAAa,CAAC,KAAK,EAAE,GAAG,IAAA,oCAAuB,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;QAE5F,MAAM,YAAY,GAAG,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;QACrD,IAAI,YAAY,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,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EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClF,CAAC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,UAAU,cAoBrB","sourcesContent":["import { BindingNamespaces } from '@/common/bindings';\nimport type {\n IArtifactRegistrationOptions,\n IDataSourceMetadata,\n IInjectMetadata,\n IModelMetadata,\n IResolvedRepositoryMetadata,\n TRepositoryMetadata,\n} from '@/helpers/inversion';\nimport {\n ArtifactTypes,\n BindingKeys,\n MetadataKeys,\n MetadataRegistry,\n resolveInjectTarget,\n} from '@/helpers/inversion';\nimport { resolveClass, resolveValue } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { IDataSource } from '../datasources';\nimport { isDataSourceClass } from '../datasources';\nimport type { AbstractEntity } from '../models';\nimport { RepositoryTypes } from '../repositories/common/constants';\nimport { injectable, pickRegistrationOptions } from './injectable';\n\n/** Registers a model class with its static schema and relations. */\nexport const model = (metadata: IModelMetadata): ClassDecorator => {\n return (target) => {\n injectable({ type: ArtifactTypes.MODEL, ...pickRegistrationOptions({ metadata }) })(target);\n\n const defaultLimit = metadata.settings?.defaultLimit;\n if (defaultLimit !== undefined && (!Number.isInteger(defaultLimit) || defaultLimit <= 0)) {\n throw getError({\n message: `[model][${target.name}] Invalid 'defaultLimit' | Expected a positive integer | Got: ${defaultLimit}`,\n });\n }\n\n // Validated at DECORATION time, like defaultLimit: a bad ceiling is a wiring mistake, and\n // catching it at boot beats catching it on the one request that happens to reach the limit.\n const maxLimit = metadata.settings?.maxLimit;\n if (maxLimit !== undefined && (!Number.isInteger(maxLimit) || maxLimit <= 0)) {\n throw getError({\n message: `[model][${target.name}] Invalid 'maxLimit' | Expected a positive integer | Got: ${maxLimit}`,\n });\n }\n\n // Auto-populate AUTHORIZATION_SUBJECT from authorize.principal if not already set\n const principal = metadata.settings?.authorize?.principal;\n if (principal && !Object.hasOwn(target, 'AUTHORIZATION_SUBJECT')) {\n (target as Record<string, unknown>).AUTHORIZATION_SUBJECT = principal;\n }\n\n MetadataRegistry.getInstance().registerModel({ target, metadata });\n };\n};\n\n/** Registers a datasource with driver and auto-discovery settings. */\nexport const datasource = (metadata?: IDataSourceMetadata): ClassDecorator => {\n return (target) => {\n injectable({\n type: ArtifactTypes.DATASOURCE,\n ...pickRegistrationOptions({ metadata: metadata ?? {} }),\n })(target);\n MetadataRegistry.getInstance().setDataSourceMetadata({ target, metadata });\n };\n};\n\n/** Mirrors the `TRepositoryMetadata` union for JavaScript callers: a known type, a dataSource always, a model exactly when the type is RepositoryTypes.MODEL. */\nconst validateRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n target: Function;\n}): void => {\n const { metadata, target } = opts;\n const type = metadata.type ?? RepositoryTypes.MODEL;\n\n if (!RepositoryTypes.isValid(type)) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Unknown 'type': ${type} | Expected one of: ${[...RepositoryTypes.SCHEME_SET].join(', ')}`,\n });\n }\n\n if (type === RepositoryTypes.MODEL && !metadata.model) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Missing 'model'`,\n });\n }\n\n if (type === RepositoryTypes.REMOTE && metadata.model) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | A '${RepositoryTypes.REMOTE}' repository takes no 'model'`,\n });\n }\n\n if (!metadata.dataSource) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Missing 'dataSource'`,\n });\n }\n};\n\n/** Asserts the constructor's first parameter is an AbstractDataSource compatible with what @repository declared. */\nconst validateFirstConstructorParameter = (opts: {\n target: Function;\n firstParamType: Function;\n resolvedDataSource: string | Function;\n}): void => {\n const { target, firstParamType, resolvedDataSource } = opts;\n\n // NOT `instanceof`: two copies of this package give two `AbstractDataSource` classes and the\n // check would be false across them, rejecting a perfectly valid repository at import time.\n const isDataSourceType = isDataSourceClass(firstParamType);\n\n if (!isDataSourceType) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must extend AbstractDataSource | Received: '${firstParamType.name}'`,\n });\n }\n\n if (typeof resolvedDataSource !== 'function') {\n return;\n }\n\n const isCompatible =\n firstParamType === resolvedDataSource || resolvedDataSource.prototype instanceof firstParamType;\n\n if (!isCompatible) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | Type mismatch | Constructor expects '${firstParamType.name}' but @repository specifies '${resolvedDataSource.name}'`,\n });\n }\n};\n\n/**\n * Auto-injects dataSource at constructor param[0] unless explicit @inject exists. A class is injected\n * by the class itself, so the container reads the key its registration recorded: a pinned\n * `binding` and a minified class name both resolve. Only a string reference is a key.\n */\nconst registerDataSourceInjection = (opts: {\n target: Function;\n registry: MetadataRegistry;\n dataSourceRef: TRepositoryMetadata['dataSource'];\n resolvedDataSource: string | Function;\n}): void => {\n const { target, registry, dataSourceRef, resolvedDataSource } = opts;\n\n // Own metadata only: `getInjectMetadata` walks the prototype chain, so a repository extending another @repository class would see the BASE's injection at param[0] and silently resolve the base's dataSource.\n const ownInjects: IInjectMetadata[] | undefined = Reflect.getOwnMetadata(\n MetadataKeys.INJECT,\n target,\n );\n const injectAtIndex0 = ownInjects?.find((entry) => entry?.index === 0);\n\n if (injectAtIndex0) {\n // `@inject({ target })` carries no key; read the one recorded on the class. The function form\n // resolves through the same helper the container uses, so both paths read one class.\n const injectedTarget = injectAtIndex0.target\n ? resolveInjectTarget({ target: injectAtIndex0.target })\n : undefined;\n const injectKey =\n injectAtIndex0.key ??\n (injectedTarget ? registry.getBindingKey({ target: injectedTarget }) : undefined);\n\n // A class is judged by its brand: its key may sit under any namespace a `binding` pinned, and\n // a provisional key may still change at registration. Only a bare key is judged by its prefix.\n const isDataSourceTarget = injectedTarget\n ? isDataSourceClass(injectedTarget)\n : typeof injectKey === 'string' && injectKey.startsWith(`${BindingNamespaces.DATASOURCE}.`);\n\n if (!isDataSourceTarget) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must be a DataSource | Found @inject with key: '${String(injectKey)}' | Expected a key starting with '${BindingNamespaces.DATASOURCE}.' or a DataSource class`,\n });\n }\n\n return;\n }\n\n // Checked only when this decorator writes the injection: an explicit @inject decides for itself.\n // An interface emits `Object` and a type-only class import emits `Function` under tsc (`Object`\n // under bun); neither names the class, so neither is judged.\n const firstParamType = Reflect.getMetadata('design:paramtypes', target)?.[0];\n if (firstParamType && firstParamType !== Object && firstParamType !== Function) {\n validateFirstConstructorParameter({ target, firstParamType, resolvedDataSource });\n }\n\n // The inherited list is the base repository's own, and setInjectMetadata may write straight into it.\n if (!ownInjects) {\n Reflect.defineMetadata(\n MetadataKeys.INJECT,\n [...(registry.getInjectMetadata({ target }) ?? [])],\n target,\n );\n }\n\n const derivedKey = BindingKeys.build({\n namespace: BindingNamespaces.DATASOURCE,\n key: typeof resolvedDataSource === 'string' ? resolvedDataSource : resolvedDataSource.name,\n });\n\n // The class first, decided when the repository is resolved: by then any registration - decorated,\n // `bindingList()`, or `dataSource(X, { binding })` - has recorded its key on the class. The derived\n // key is the fallback for a class nothing recorded, bound by hand under exactly that key.\n registry.setInjectMetadata({\n target,\n index: 0,\n metadata:\n typeof dataSourceRef === 'string'\n ? { key: derivedKey, index: 0, isOptional: false }\n : { target: dataSourceRef, key: derivedKey, index: 0, isOptional: false },\n });\n};\n\n/** Resolves repository metadata and registers bindings for schema auto-discovery. */\nconst resolveRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n target: Function;\n registry: MetadataRegistry;\n}): IResolvedRepositoryMetadata<Model, DataSource> => {\n const { metadata, target, registry } = opts;\n\n validateRepositoryMetadata({ metadata, target });\n\n const resolvedDataSource = resolveClass({ ref: metadata.dataSource });\n if (!resolvedDataSource) {\n throw getError({\n message: `[@repository][${target.name}] The dataSource resolver returned nothing at decoration time | An import cycle leaves the datasource class undefined here; import it without the cycle, or name it as a string`,\n });\n }\n\n // No model, so no binding: the datasource owns no schema through this repository.\n if (metadata.type === RepositoryTypes.REMOTE) {\n registerDataSourceInjection({\n target,\n registry,\n dataSourceRef: metadata.dataSource,\n resolvedDataSource,\n });\n return {\n type: RepositoryTypes.REMOTE,\n dataSource: resolvedDataSource,\n operationScope: metadata.operationScope,\n };\n }\n\n const resolvedModel = resolveValue({ value: metadata.model });\n\n registry.registerRepositoryBinding({\n repository: target,\n model: resolvedModel,\n dataSource: resolvedDataSource,\n });\n\n registerDataSourceInjection({\n target,\n registry,\n dataSourceRef: metadata.dataSource,\n resolvedDataSource,\n });\n\n return {\n type: RepositoryTypes.MODEL,\n model: resolvedModel,\n dataSource: resolvedDataSource,\n operationScope: metadata.operationScope,\n };\n};\n\n/** A bare `@repository()` on a subclass reuses the type, model and datasource its nearest decorated parent declared; the registration options (`binding`, `when`, ...) are never inherited, so the subclass registers under its own name. */\nconst inheritRepositoryMetadata = (opts: {\n target: Function;\n registry: MetadataRegistry;\n}): TRepositoryMetadata => {\n // Own metadata does not exist yet at decoration time, so this read walks the prototype chain.\n const inherited = opts.registry.getRepositoryMetadata({ target: opts.target });\n if (!inherited) {\n throw getError({\n message: `[@repository][${opts.target.name}] No metadata given and no decorated repository above it in the prototype chain | pass { model, dataSource } or decorate the parent`,\n });\n }\n\n if (inherited.type === RepositoryTypes.REMOTE) {\n const { type, dataSource, operationScope } = inherited;\n return { type, dataSource, operationScope };\n }\n\n const { type, model: parentModel, dataSource, operationScope } = inherited;\n return { type, model: parentModel, dataSource, operationScope };\n};\n\nconst applyRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n registration: IArtifactRegistrationOptions;\n target: Function;\n registry: MetadataRegistry;\n}): void => {\n const { metadata, registration, target, registry } = opts;\n injectable({\n type: ArtifactTypes.REPOSITORY,\n ...pickRegistrationOptions({ metadata: registration }),\n })(target);\n\n const resolved = resolveRepositoryMetadata({ metadata, target, registry });\n\n registry.setRepositoryMetadata({ target, metadata: { ...metadata, _resolved: resolved } });\n};\n\nexport const repository = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(\n metadata?: TRepositoryMetadata<Model, DataSource>,\n): ClassDecorator => {\n return (target) => {\n const registry = MetadataRegistry.getInstance();\n if (!metadata) {\n applyRepositoryMetadata({\n metadata: inheritRepositoryMetadata({ target, registry }),\n registration: {},\n target,\n registry,\n });\n return;\n }\n\n applyRepositoryMetadata({ metadata, registration: metadata, target, registry });\n };\n};\n"]}
1
+ {"version":3,"file":"persistents.js","sourceRoot":"","sources":["../../../../src/base/metadata/persistents.ts"],"names":[],"mappings":";;;AAAA,gDAAsD;AAStD,mDAM6B;AAC7B,0DAA2E;AAC3E,sDAAuD;AAEvD,gDAAmD;AAEnD,gEAAmE;AACnE,6CAAmE;AACnE,qDAA0D;AAE1D,oEAAoE;AAC7D,MAAM,KAAK,GAAG,CAAC,KAAqB,EAAkB,EAAE;IAC7D,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,IAAA,uBAAU,EAAC,EAAE,IAAI,EAAE,yBAAa,CAAC,KAAK,EAAE,GAAG,IAAA,oCAAuB,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CACxF,MAAM,CACP,CAAC;QAEF,6FAA6F;QAC7F,4CAA4C;QAC5C,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAA,uCAAsB,EAAC;YACtD,KAAK,EAAE,MAAM,CAAC,IAAI;YAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;SACzB,CAAC,CAAC;QACH,MAAM,QAAQ,GAAmB;YAC/B,GAAG,KAAK;YACR,QAAQ;YACR,GAAG,CAAC,UAAU,CAAC,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ChB,MAAM,QAAQ,GAAG,4BAAgB,CAAC,WAAW,EAAE,CAAC;QAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,uBAAuB,CAAC;gBACtB,QAAQ,EAAE,yBAAyB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;gBACzD,YAAY,EAAE,EAAE;gBAChB,MAAM;gBACN,QAAQ;aACT,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,uBAAuB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClF,CAAC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,UAAU,cAoBrB","sourcesContent":["import { BindingNamespaces } from '@/common/bindings';\nimport type {\n IArtifactRegistrationOptions,\n IDataSourceMetadata,\n IInjectMetadata,\n IModelMetadata,\n IResolvedRepositoryMetadata,\n TRepositoryMetadata,\n} from '@/helpers/inversion';\nimport {\n ArtifactTypes,\n BindingKeys,\n MetadataKeys,\n MetadataRegistry,\n resolveInjectTarget,\n} from '@/helpers/inversion';\nimport { resolveClass, resolveValue } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { IDataSource } from '../datasources';\nimport { isDataSourceClass } from '../datasources';\nimport type { AbstractEntity } from '../models';\nimport { RepositoryTypes } from '../repositories/common/constants';\nimport { injectable, pickRegistrationOptions } from './injectable';\nimport { normalizeModelSettings } from './model-settings';\n\n/** Registers a model class with its static schema and relations. */\nexport const model = (input: IModelMetadata): ClassDecorator => {\n return (target) => {\n injectable({ type: ArtifactTypes.MODEL, ...pickRegistrationOptions({ metadata: input }) })(\n target,\n );\n\n // The one place the deprecated flat keys become the grouped ones; the registry, and so every\n // reader, only ever sees the grouped shape.\n const { settings, deprecated } = normalizeModelSettings({\n model: target.name,\n settings: input.settings,\n });\n const metadata: IModelMetadata = {\n ...input,\n settings,\n ...(deprecated.length > 0 ? { deprecatedSettings: deprecated } : {}),\n };\n\n const defaultLimit = settings?.query?.limit?.default;\n if (defaultLimit !== undefined && (!Number.isInteger(defaultLimit) || defaultLimit <= 0)) {\n throw getError({\n message: `[model][${target.name}] Invalid 'query.limit.default' | Expected a positive integer | Got: ${defaultLimit}`,\n });\n }\n\n // Validated at DECORATION time, like the default limit: a bad ceiling is a wiring mistake, and\n // catching it at boot beats catching it on the one request that happens to reach the limit.\n const maxLimit = settings?.query?.limit?.max;\n if (maxLimit !== undefined && (!Number.isInteger(maxLimit) || maxLimit <= 0)) {\n throw getError({\n message: `[model][${target.name}] Invalid 'query.limit.max' | Expected a positive integer | Got: ${maxLimit}`,\n });\n }\n\n // Auto-populate AUTHORIZATION_SUBJECT from authorize.principal if not already set\n const principal = settings?.authorize?.principal;\n if (principal && !Object.hasOwn(target, 'AUTHORIZATION_SUBJECT')) {\n (target as Record<string, unknown>).AUTHORIZATION_SUBJECT = principal;\n }\n\n MetadataRegistry.getInstance().registerModel({ target, metadata });\n };\n};\n\n/** Registers a datasource with driver and auto-discovery settings. */\nexport const datasource = (metadata?: IDataSourceMetadata): ClassDecorator => {\n return (target) => {\n injectable({\n type: ArtifactTypes.DATASOURCE,\n ...pickRegistrationOptions({ metadata: metadata ?? {} }),\n })(target);\n MetadataRegistry.getInstance().setDataSourceMetadata({ target, metadata });\n };\n};\n\n/** Mirrors the `TRepositoryMetadata` union for JavaScript callers: a known type, a dataSource always, a model exactly when the type is RepositoryTypes.MODEL. */\nconst validateRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n target: Function;\n}): void => {\n const { metadata, target } = opts;\n const type = metadata.type ?? RepositoryTypes.MODEL;\n\n if (!RepositoryTypes.isValid(type)) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Unknown 'type': ${type} | Expected one of: ${[...RepositoryTypes.SCHEME_SET].join(', ')}`,\n });\n }\n\n if (type === RepositoryTypes.MODEL && !metadata.model) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Missing 'model'`,\n });\n }\n\n if (type === RepositoryTypes.REMOTE && metadata.model) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | A '${RepositoryTypes.REMOTE}' repository takes no 'model'`,\n });\n }\n\n if (!metadata.dataSource) {\n throw getError({\n message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Missing 'dataSource'`,\n });\n }\n};\n\n/** Asserts the constructor's first parameter is an AbstractDataSource compatible with what @repository declared. */\nconst validateFirstConstructorParameter = (opts: {\n target: Function;\n firstParamType: Function;\n resolvedDataSource: string | Function;\n}): void => {\n const { target, firstParamType, resolvedDataSource } = opts;\n\n // NOT `instanceof`: two copies of this package give two `AbstractDataSource` classes and the\n // check would be false across them, rejecting a perfectly valid repository at import time.\n const isDataSourceType = isDataSourceClass(firstParamType);\n\n if (!isDataSourceType) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must extend AbstractDataSource | Received: '${firstParamType.name}'`,\n });\n }\n\n if (typeof resolvedDataSource !== 'function') {\n return;\n }\n\n const isCompatible =\n firstParamType === resolvedDataSource || resolvedDataSource.prototype instanceof firstParamType;\n\n if (!isCompatible) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | Type mismatch | Constructor expects '${firstParamType.name}' but @repository specifies '${resolvedDataSource.name}'`,\n });\n }\n};\n\n/**\n * Auto-injects dataSource at constructor param[0] unless explicit @inject exists. A class is injected\n * by the class itself, so the container reads the key its registration recorded: a pinned\n * `binding` and a minified class name both resolve. Only a string reference is a key.\n */\nconst registerDataSourceInjection = (opts: {\n target: Function;\n registry: MetadataRegistry;\n dataSourceRef: TRepositoryMetadata['dataSource'];\n resolvedDataSource: string | Function;\n}): void => {\n const { target, registry, dataSourceRef, resolvedDataSource } = opts;\n\n // Own metadata only: `getInjectMetadata` walks the prototype chain, so a repository extending another @repository class would see the BASE's injection at param[0] and silently resolve the base's dataSource.\n const ownInjects: IInjectMetadata[] | undefined = Reflect.getOwnMetadata(\n MetadataKeys.INJECT,\n target,\n );\n const injectAtIndex0 = ownInjects?.find((entry) => entry?.index === 0);\n\n if (injectAtIndex0) {\n // `@inject({ target })` carries no key; read the one recorded on the class. The function form\n // resolves through the same helper the container uses, so both paths read one class.\n const injectedTarget = injectAtIndex0.target\n ? resolveInjectTarget({ target: injectAtIndex0.target })\n : undefined;\n const injectKey =\n injectAtIndex0.key ??\n (injectedTarget ? registry.getBindingKey({ target: injectedTarget }) : undefined);\n\n // A class is judged by its brand: its key may sit under any namespace a `binding` pinned, and\n // a provisional key may still change at registration. Only a bare key is judged by its prefix.\n const isDataSourceTarget = injectedTarget\n ? isDataSourceClass(injectedTarget)\n : typeof injectKey === 'string' && injectKey.startsWith(`${BindingNamespaces.DATASOURCE}.`);\n\n if (!isDataSourceTarget) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must be a DataSource | Found @inject with key: '${String(injectKey)}' | Expected a key starting with '${BindingNamespaces.DATASOURCE}.' or a DataSource class`,\n });\n }\n\n return;\n }\n\n // Checked only when this decorator writes the injection: an explicit @inject decides for itself.\n // An interface emits `Object` and a type-only class import emits `Function` under tsc (`Object`\n // under bun); neither names the class, so neither is judged.\n const firstParamType = Reflect.getMetadata('design:paramtypes', target)?.[0];\n if (firstParamType && firstParamType !== Object && firstParamType !== Function) {\n validateFirstConstructorParameter({ target, firstParamType, resolvedDataSource });\n }\n\n // The inherited list is the base repository's own, and setInjectMetadata may write straight into it.\n if (!ownInjects) {\n Reflect.defineMetadata(\n MetadataKeys.INJECT,\n [...(registry.getInjectMetadata({ target }) ?? [])],\n target,\n );\n }\n\n const derivedKey = BindingKeys.build({\n namespace: BindingNamespaces.DATASOURCE,\n key: typeof resolvedDataSource === 'string' ? resolvedDataSource : resolvedDataSource.name,\n });\n\n // The class first, decided when the repository is resolved: by then any registration - decorated,\n // `bindingList()`, or `dataSource(X, { binding })` - has recorded its key on the class. The derived\n // key is the fallback for a class nothing recorded, bound by hand under exactly that key.\n registry.setInjectMetadata({\n target,\n index: 0,\n metadata:\n typeof dataSourceRef === 'string'\n ? { key: derivedKey, index: 0, isOptional: false }\n : { target: dataSourceRef, key: derivedKey, index: 0, isOptional: false },\n });\n};\n\n/** Resolves repository metadata and registers bindings for schema auto-discovery. */\nconst resolveRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n target: Function;\n registry: MetadataRegistry;\n}): IResolvedRepositoryMetadata<Model, DataSource> => {\n const { metadata, target, registry } = opts;\n\n validateRepositoryMetadata({ metadata, target });\n\n const resolvedDataSource = resolveClass({ ref: metadata.dataSource });\n if (!resolvedDataSource) {\n throw getError({\n message: `[@repository][${target.name}] The dataSource resolver returned nothing at decoration time | An import cycle leaves the datasource class undefined here; import it without the cycle, or name it as a string`,\n });\n }\n\n // No model, so no binding: the datasource owns no schema through this repository.\n if (metadata.type === RepositoryTypes.REMOTE) {\n registerDataSourceInjection({\n target,\n registry,\n dataSourceRef: metadata.dataSource,\n resolvedDataSource,\n });\n return {\n type: RepositoryTypes.REMOTE,\n dataSource: resolvedDataSource,\n operationScope: metadata.operationScope,\n };\n }\n\n const resolvedModel = resolveValue({ value: metadata.model });\n\n registry.registerRepositoryBinding({\n repository: target,\n model: resolvedModel,\n dataSource: resolvedDataSource,\n });\n\n registerDataSourceInjection({\n target,\n registry,\n dataSourceRef: metadata.dataSource,\n resolvedDataSource,\n });\n\n return {\n type: RepositoryTypes.MODEL,\n model: resolvedModel,\n dataSource: resolvedDataSource,\n operationScope: metadata.operationScope,\n };\n};\n\n/** A bare `@repository()` on a subclass reuses the type, model and datasource its nearest decorated parent declared; the registration options (`binding`, `when`, ...) are never inherited, so the subclass registers under its own name. */\nconst inheritRepositoryMetadata = (opts: {\n target: Function;\n registry: MetadataRegistry;\n}): TRepositoryMetadata => {\n // Own metadata does not exist yet at decoration time, so this read walks the prototype chain.\n const inherited = opts.registry.getRepositoryMetadata({ target: opts.target });\n if (!inherited) {\n throw getError({\n message: `[@repository][${opts.target.name}] No metadata given and no decorated repository above it in the prototype chain | pass { model, dataSource } or decorate the parent`,\n });\n }\n\n if (inherited.type === RepositoryTypes.REMOTE) {\n const { type, dataSource, operationScope } = inherited;\n return { type, dataSource, operationScope };\n }\n\n const { type, model: parentModel, dataSource, operationScope } = inherited;\n return { type, model: parentModel, dataSource, operationScope };\n};\n\nconst applyRepositoryMetadata = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(opts: {\n metadata: TRepositoryMetadata<Model, DataSource>;\n registration: IArtifactRegistrationOptions;\n target: Function;\n registry: MetadataRegistry;\n}): void => {\n const { metadata, registration, target, registry } = opts;\n injectable({\n type: ArtifactTypes.REPOSITORY,\n ...pickRegistrationOptions({ metadata: registration }),\n })(target);\n\n const resolved = resolveRepositoryMetadata({ metadata, target, registry });\n\n registry.setRepositoryMetadata({ target, metadata: { ...metadata, _resolved: resolved } });\n};\n\nexport const repository = <\n Model extends AbstractEntity = AbstractEntity,\n DataSource extends IDataSource = IDataSource,\n>(\n metadata?: TRepositoryMetadata<Model, DataSource>,\n): ClassDecorator => {\n return (target) => {\n const registry = MetadataRegistry.getInstance();\n if (!metadata) {\n applyRepositoryMetadata({\n metadata: inheritRepositoryMetadata({ target, registry }),\n registration: {},\n target,\n registry,\n });\n return;\n }\n\n applyRepositoryMetadata({ metadata, registration: metadata, target, registry });\n };\n};\n"]}
@@ -32,7 +32,7 @@ export declare class RepositoryTypes {
32
32
  }
33
33
  /** Valid repository type values. */
34
34
  export type TRepositoryType = TConstValue<typeof RepositoryTypes>;
35
- /** What a row-scope filter (`@model` settings.scopeFilter) does when `resolve()` returns null/undefined. */
35
+ /** What a row-scope filter (`@model` settings.access) does when `resolve()` returns null/undefined. */
36
36
  export declare class ScopeFilterMissingBehaviors {
37
37
  /** An unresolved scope matches ZERO rows - the safe reading of "caller's scope is unknown". */
38
38
  static readonly DENY = "deny";
@@ -43,6 +43,21 @@ export declare class ScopeFilterMissingBehaviors {
43
43
  }
44
44
  /** Valid scope-filter missing-behavior values. */
45
45
  export type TScopeFilterMissingBehavior = TConstValue<typeof ScopeFilterMissingBehaviors>;
46
+ /**
47
+ * What a scoped write does with a row whose scope column disagrees with the resolved scope
48
+ * (`@model` settings.access.write.mode). A scope that returns `ScopeFilters.UNRESTRICTED`
49
+ * passes either way.
50
+ */
51
+ export declare class ScopeWriteGuards {
52
+ /** Default. A row whose scope column disagrees, or is absent on create, is refused and nothing is written. */
53
+ static readonly REJECT = "reject";
54
+ /** An ABSENT scope column is filled from an equality scope; a value that disagrees is still refused. */
55
+ static readonly ASSIGN = "assign";
56
+ static readonly SCHEME_SET: Set<string>;
57
+ static isValid(guard: string): boolean;
58
+ }
59
+ /** Valid scope write-guard values. */
60
+ export type TScopeWriteGuard = TConstValue<typeof ScopeWriteGuards>;
46
61
  /**
47
62
  * The third `resolve()` state, beside a `where` and `deny`-by-default null/undefined: unrestricted
48
63
  * for THIS call. `onMissing: 'allow'` cannot express it - `onMissing` lives on the model's static
@@ -62,6 +77,8 @@ export declare class ScopeFilters {
62
77
  export declare class RepositoryErrorCodes {
63
78
  /** A verb the repository's `operationScope` does not permit (e.g. `create()` on a READ_ONLY one). */
64
79
  static readonly OPERATION_NOT_ALLOWED: string;
80
+ /** A write whose scope column disagrees with the resolved scope, or whose scope cannot be verified (`access` write guard). */
81
+ static readonly SCOPE_WRITE_DENIED: string;
65
82
  }
66
83
  /** Valid repository error code values. */
67
84
  export type TRepositoryErrorCode = TConstValue<typeof RepositoryErrorCodes>;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/base/repositories/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGjE,uDAAu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perty(exports, "__esModule", { value: true });
3
- exports.LockStrengths = exports.RelationTypes = exports.RepositoryErrorCodes = exports.ScopeFilters = exports.ScopeFilterMissingBehaviors = exports.RepositoryTypes = exports.RepositoryOperationScopes = exports.DEFAULT_MAX_LIMIT = exports.DEFAULT_LIMIT = void 0;
3
+ exports.LockStrengths = exports.RelationTypes = exports.RepositoryErrorCodes = exports.ScopeFilters = exports.ScopeWriteGuards = exports.ScopeFilterMissingBehaviors = exports.RepositoryTypes = exports.RepositoryOperationScopes = exports.DEFAULT_MAX_LIMIT = exports.DEFAULT_LIMIT = void 0;
4
4
  const core_1 = require("@venizia/ignis-helpers/core");
5
5
  /** Default pagination limit for repository queries. */
6
6
  exports.DEFAULT_LIMIT = 10;
@@ -37,7 +37,7 @@ class RepositoryTypes {
37
37
  }
38
38
  }
39
39
  exports.RepositoryTypes = RepositoryTypes;
40
- /** What a row-scope filter (`@model` settings.scopeFilter) does when `resolve()` returns null/undefined. */
40
+ /** What a row-scope filter (`@model` settings.access) does when `resolve()` returns null/undefined. */
41
41
  class ScopeFilterMissingBehaviors {
42
42
  /** An unresolved scope matches ZERO rows - the safe reading of "caller's scope is unknown". */
43
43
  static { this.DENY = 'deny'; }
@@ -49,6 +49,22 @@ class ScopeFilterMissingBehaviors {
49
49
  }
50
50
  }
51
51
  exports.ScopeFilterMissingBehaviors = ScopeFilterMissingBehaviors;
52
+ /**
53
+ * What a scoped write does with a row whose scope column disagrees with the resolved scope
54
+ * (`@model` settings.access.write.mode). A scope that returns `ScopeFilters.UNRESTRICTED`
55
+ * passes either way.
56
+ */
57
+ class ScopeWriteGuards {
58
+ /** Default. A row whose scope column disagrees, or is absent on create, is refused and nothing is written. */
59
+ static { this.REJECT = 'reject'; }
60
+ /** An ABSENT scope column is filled from an equality scope; a value that disagrees is still refused. */
61
+ static { this.ASSIGN = 'assign'; }
62
+ static { this.SCHEME_SET = new Set([this.REJECT, this.ASSIGN]); }
63
+ static isValid(guard) {
64
+ return this.SCHEME_SET.has(guard);
65
+ }
66
+ }
67
+ exports.ScopeWriteGuards = ScopeWriteGuards;
52
68
  /**
53
69
  * The third `resolve()` state, beside a `where` and `deny`-by-default null/undefined: unrestricted
54
70
  * for THIS call. `onMissing: 'allow'` cannot express it - `onMissing` lives on the model's static
@@ -71,6 +87,10 @@ class RepositoryErrorCodes {
71
87
  static { this.OPERATION_NOT_ALLOWED = core_1.MessageCode.build({
72
88
  parts: ['core', 'repository', 'operation_not_allowed'],
73
89
  }); }
90
+ /** A write whose scope column disagrees with the resolved scope, or whose scope cannot be verified (`access` write guard). */
91
+ static { this.SCOPE_WRITE_DENIED = core_1.MessageCode.build({
92
+ parts: ['core', 'repository', 'scope_write_denied'],
93
+ }); }
74
94
  }
75
95
  exports.RepositoryErrorCodes = RepositoryErrorCodes;
76
96
  /** Entity relation types (one-to-one/many-to-one, one-to-many). */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/repositories/common/constants.ts"],"names":[],"mappings":";;;AACA,sDAA0D;AAE1D,uDAAuD;AAC1C,QAAA,aAAa,GAAG,EAAE,CAAC;AAEhC;;;;;;;;;;GAUG;AACU,QAAA,iBAAiB,GAAG,IAAI,CAAC;AAEtC,gGAAgG;AAChG,MAAa,yBAAyB;aACpB,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAEzF,MAAM,CAAC,OAAO,CAAC,OAAe;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;;AARH,8DASC;AAKD,kJAAkJ;AAClJ,MAAa,eAAe;aACV,UAAK,GAAG,OAAO,CAAC;aAChB,WAAM,GAAG,QAAQ,CAA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,sCAQC;AAKD,yEAAyE;AACzE,MAAa,aAAa;aACR,WAAM,GAAG,QAAQ,CAAC;aAClB,kBAAa,GAAG,eAAe,CAAC;aAChC,UAAK,GAAG,OAAO,CAAC;aAChB,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,IAAI,GAAG,CAAC;QACnC,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,aAAa;QAClB,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;;AAdH,sCAeC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { MessageCode } from '@venizia/ignis-helpers/core';\n\n/** Default pagination limit for repository queries. */\nexport const DEFAULT_LIMIT = 10;\n\n/**\n * Largest `limit` a caller may ask for when a model declares no `maxLimit`.\n *\n * POLICY, not capacity - it sits far below what an engine can physically serve. It exists because\n * removing an accidental guardrail without replacing it would leave the framework less safe than\n * before: a search engine refused a page over 250 hits, so `limit: 5000` failed fast and cheap.\n * Once that page is served, something has to decide when a page is unreasonable.\n *\n * 1000 sits above any list screen and well below the physical ceiling, so reaching it means the\n * caller is doing something unusual - and a model raises it by saying so explicitly.\n */\nexport const DEFAULT_MAX_LIMIT = 1000;\n\n/** Defines the operation scope for repository instances (READ_ONLY, WRITE_ONLY, READ_WRITE). */\nexport class RepositoryOperationScopes {\n static readonly READ_ONLY = 'READ_ONLY';\n static readonly WRITE_ONLY = 'WRITE_ONLY';\n static readonly READ_WRITE = 'READ_WRITE';\n static readonly SCHEME_SET = new Set([this.READ_ONLY, this.WRITE_ONLY, this.READ_WRITE]);\n\n static isValid(orgType: string): boolean {\n return this.SCHEME_SET.has(orgType);\n }\n}\n\n/** Valid repository operation scope values. */\nexport type TRepositoryOperationScope = TConstValue<typeof RepositoryOperationScopes>;\n\n/** What `@repository` binds: MODEL, a model this application declares (the default); REMOTE, data behind another service's API, with no model. */\nexport class RepositoryTypes {\n static readonly MODEL = 'model';\n static readonly REMOTE = 'remote';\n static readonly SCHEME_SET = new Set([this.MODEL, this.REMOTE]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid repository type values. */\nexport type TRepositoryType = TConstValue<typeof RepositoryTypes>;\n\n/** What a row-scope filter (`@model` settings.scopeFilter) does when `resolve()` returns null/undefined. */\nexport class ScopeFilterMissingBehaviors {\n /** An unresolved scope matches ZERO rows - the safe reading of \"caller's scope is unknown\". */\n static readonly DENY = 'deny';\n /** Explicit opt-out: no scope is applied. For migrations and background jobs, never inferred from a request. */\n static readonly ALLOW = 'allow';\n static readonly SCHEME_SET = new Set([this.DENY, this.ALLOW]);\n\n static isValid(behavior: string): boolean {\n return this.SCHEME_SET.has(behavior);\n }\n}\n\n/** Valid scope-filter missing-behavior values. */\nexport type TScopeFilterMissingBehavior = TConstValue<typeof ScopeFilterMissingBehaviors>;\n\n/**\n * The third `resolve()` state, beside a `where` and `deny`-by-default null/undefined: unrestricted\n * for THIS call. `onMissing: 'allow'` cannot express it - `onMissing` lives on the model's static\n * settings, so using it for a per-user bypass (an internal operator) would also unscope every\n * ordinary user whose `resolve()` happens to return nothing.\n */\nexport class ScopeFilters {\n /**\n * Return from `resolve()` to apply NO scope for this request - a caller the application has\n * decided sees everything. Deliberately a symbol: forgetting to return must land in deny, and no\n * JSON body, query string, or header can ever produce this value. `Symbol.for` so two installed\n * copies of this package agree on identity, same as `DATA_SOURCE_BRAND`.\n */\n static readonly UNRESTRICTED = Symbol.for('@venizia/ignis-kernel:scope-filter-unrestricted');\n}\n\n/** Machine-readable codes for repository-level failures, in the dotted namespace core already uses (`core.not_supported`, `core.search_engine.*`) - a client maps the code, never the message. */\nexport class RepositoryErrorCodes {\n /** A verb the repository's `operationScope` does not permit (e.g. `create()` on a READ_ONLY one). */\n static readonly OPERATION_NOT_ALLOWED = MessageCode.build({\n parts: ['core', 'repository', 'operation_not_allowed'],\n });\n}\n\n/** Valid repository error code values. */\nexport type TRepositoryErrorCode = TConstValue<typeof RepositoryErrorCodes>;\n\n/** Entity relation types (one-to-one/many-to-one, one-to-many). */\nexport class RelationTypes {\n static readonly ONE = 'one';\n static readonly MANY = 'many';\n static readonly SCHEME_SET = new Set([this.ONE, this.MANY]);\n\n static isValid(orgType: string): boolean {\n return this.SCHEME_SET.has(orgType);\n }\n}\n\n/** Valid relation type values. */\nexport type TRelationType = TConstValue<typeof RelationTypes>;\n\n/** PostgreSQL row-level lock strengths for SELECT ... FOR <strength>. */\nexport class LockStrengths {\n static readonly UPDATE = 'update';\n static readonly NO_KEY_UPDATE = 'no key update';\n static readonly SHARE = 'share';\n static readonly KEY_SHARE = 'key share';\n static readonly SCHEME_SET = new Set([\n this.UPDATE,\n this.NO_KEY_UPDATE,\n this.SHARE,\n this.KEY_SHARE,\n ]);\n\n static isValid(strength: string): boolean {\n return this.SCHEME_SET.has(strength);\n }\n}\n\n/** Valid lock strength values. */\nexport type TLockStrength = TConstValue<typeof LockStrengths>;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/repositories/common/constants.ts"],"names":[],"mappings":";;;AACA,sDAA0D;AAE1D,uDAAuD;AAC1C,QAAA,aAAa,GAAG,EAAE,CAAC;AAEhC;;;;;;;;;;GAUG;AACU,QAAA,iBAAiB,GAAG,IAAI,CAAC;AAEtC,gGAAgG;AAChG,MAAa,yBAAyB;aACpB,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAEzF,MAAM,CAAC,OAAO,CAAC,OAAe;QAC5B,OAAO,IAAI,CAAC,U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P/F,oCAQC;AAED,kMAAkM;AAClM,MAAa,oBAAoB;IAC/B,qGAAqG;aACrF,0BAAqB,GAAG,kBAAW,CAAC,KAAK,CAAC;QACxD,KAAK,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,uBAAuB,CAAC;KACvD,CAAC,CAAC;IAEH,8HAA8H;aAC9G,uBAAkB,GAAG,kBAAW,CAAC,KAAK,CAAC;QACrD,KAAK,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,oBAAoB,CAAC;KACpD,CAAC,CAAC;;AATL,oDAUC;AAKD,mEAAmE;AACnE,MAAa,aAAa;aACR,QAAG,GAAG,KAAK,CAAC;aACZ,SAAI,GAAG,MAAM,CAAC;aACd,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAE5D,MAAM,CAAC,OAAO,CAAC,OAAe;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;;AAPH,sCAQC;AAKD,yEAAyE;AACzE,MAAa,aAAa;aACR,WAAM,GAAG,QAAQ,CAAC;aAClB,kBAAa,GAAG,eAAe,CAAC;aAChC,UAAK,GAAG,OAAO,CAAC;aAChB,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,IAAI,GAAG,CAAC;QACnC,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,aAAa;QAClB,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;;AAdH,sCAeC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { MessageCode } from '@venizia/ignis-helpers/core';\n\n/** Default pagination limit for repository queries. */\nexport const DEFAULT_LIMIT = 10;\n\n/**\n * Largest `limit` a caller may ask for when a model declares no `maxLimit`.\n *\n * POLICY, not capacity - it sits far below what an engine can physically serve. It exists because\n * removing an accidental guardrail without replacing it would leave the framework less safe than\n * before: a search engine refused a page over 250 hits, so `limit: 5000` failed fast and cheap.\n * Once that page is served, something has to decide when a page is unreasonable.\n *\n * 1000 sits above any list screen and well below the physical ceiling, so reaching it means the\n * caller is doing something unusual - and a model raises it by saying so explicitly.\n */\nexport const DEFAULT_MAX_LIMIT = 1000;\n\n/** Defines the operation scope for repository instances (READ_ONLY, WRITE_ONLY, READ_WRITE). */\nexport class RepositoryOperationScopes {\n static readonly READ_ONLY = 'READ_ONLY';\n static readonly WRITE_ONLY = 'WRITE_ONLY';\n static readonly READ_WRITE = 'READ_WRITE';\n static readonly SCHEME_SET = new Set([this.READ_ONLY, this.WRITE_ONLY, this.READ_WRITE]);\n\n static isValid(orgType: string): boolean {\n return this.SCHEME_SET.has(orgType);\n }\n}\n\n/** Valid repository operation scope values. */\nexport type TRepositoryOperationScope = TConstValue<typeof RepositoryOperationScopes>;\n\n/** What `@repository` binds: MODEL, a model this application declares (the default); REMOTE, data behind another service's API, with no model. */\nexport class RepositoryTypes {\n static readonly MODEL = 'model';\n static readonly REMOTE = 'remote';\n static readonly SCHEME_SET = new Set([this.MODEL, this.REMOTE]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid repository type values. */\nexport type TRepositoryType = TConstValue<typeof RepositoryTypes>;\n\n/** What a row-scope filter (`@model` settings.access) does when `resolve()` returns null/undefined. */\nexport class ScopeFilterMissingBehaviors {\n /** An unresolved scope matches ZERO rows - the safe reading of \"caller's scope is unknown\". */\n static readonly DENY = 'deny';\n /** Explicit opt-out: no scope is applied. For migrations and background jobs, never inferred from a request. */\n static readonly ALLOW = 'allow';\n static readonly SCHEME_SET = new Set([this.DENY, this.ALLOW]);\n\n static isValid(behavior: string): boolean {\n return this.SCHEME_SET.has(behavior);\n }\n}\n\n/** Valid scope-filter missing-behavior values. */\nexport type TScopeFilterMissingBehavior = TConstValue<typeof ScopeFilterMissingBehaviors>;\n\n/**\n * What a scoped write does with a row whose scope column disagrees with the resolved scope\n * (`@model` settings.access.write.mode). A scope that returns `ScopeFilters.UNRESTRICTED`\n * passes either way.\n */\nexport class ScopeWriteGuards {\n /** Default. A row whose scope column disagrees, or is absent on create, is refused and nothing is written. */\n static readonly REJECT = 'reject';\n /** An ABSENT scope column is filled from an equality scope; a value that disagrees is still refused. */\n static readonly ASSIGN = 'assign';\n static readonly SCHEME_SET = new Set([this.REJECT, this.ASSIGN]);\n\n static isValid(guard: string): boolean {\n return this.SCHEME_SET.has(guard);\n }\n}\n\n/** Valid scope write-guard values. */\nexport type TScopeWriteGuard = TConstValue<typeof ScopeWriteGuards>;\n\n/**\n * The third `resolve()` state, beside a `where` and `deny`-by-default null/undefined: unrestricted\n * for THIS call. `onMissing: 'allow'` cannot express it - `onMissing` lives on the model's static\n * settings, so using it for a per-user bypass (an internal operator) would also unscope every\n * ordinary user whose `resolve()` happens to return nothing.\n */\nexport class ScopeFilters {\n /**\n * Return from `resolve()` to apply NO scope for this request - a caller the application has\n * decided sees everything. Deliberately a symbol: forgetting to return must land in deny, and no\n * JSON body, query string, or header can ever produce this value. `Symbol.for` so two installed\n * copies of this package agree on identity, same as `DATA_SOURCE_BRAND`.\n */\n static readonly UNRESTRICTED = Symbol.for('@venizia/ignis-kernel:scope-filter-unrestricted');\n}\n\n/** Machine-readable codes for repository-level failures, in the dotted namespace core already uses (`core.not_supported`, `core.search_engine.*`) - a client maps the code, never the message. */\nexport class RepositoryErrorCodes {\n /** A verb the repository's `operationScope` does not permit (e.g. `create()` on a READ_ONLY one). */\n static readonly OPERATION_NOT_ALLOWED = MessageCode.build({\n parts: ['core', 'repository', 'operation_not_allowed'],\n });\n\n /** A write whose scope column disagrees with the resolved scope, or whose scope cannot be verified (`access` write guard). */\n static readonly SCOPE_WRITE_DENIED = MessageCode.build({\n parts: ['core', 'repository', 'scope_write_denied'],\n });\n}\n\n/** Valid repository error code values. */\nexport type TRepositoryErrorCode = TConstValue<typeof RepositoryErrorCodes>;\n\n/** Entity relation types (one-to-one/many-to-one, one-to-many). */\nexport class RelationTypes {\n static readonly ONE = 'one';\n static readonly MANY = 'many';\n static readonly SCHEME_SET = new Set([this.ONE, this.MANY]);\n\n static isValid(orgType: string): boolean {\n return this.SCHEME_SET.has(orgType);\n }\n}\n\n/** Valid relation type values. */\nexport type TRelationType = TConstValue<typeof RelationTypes>;\n\n/** PostgreSQL row-level lock strengths for SELECT ... FOR <strength>. */\nexport class LockStrengths {\n static readonly UPDATE = 'update';\n static readonly NO_KEY_UPDATE = 'no key update';\n static readonly SHARE = 'share';\n static readonly KEY_SHARE = 'key share';\n static readonly SCHEME_SET = new Set([\n this.UPDATE,\n this.NO_KEY_UPDATE,\n this.SHARE,\n this.KEY_SHARE,\n ]);\n\n static isValid(strength: string): boolean {\n return this.SCHEME_SET.has(strength);\n }\n}\n\n/** Valid lock strength values. */\nexport type TLockStrength = TConstValue<typeof LockStrengths>;\n"]}
@@ -42,7 +42,7 @@ export declare abstract class AbstractRepository<TDataObject extends object, TPe
42
42
  */
43
43
  protected get modelSettings(): IModelMetadata['settings'];
44
44
  protected get hiddenFields(): string[];
45
- /** Default where from @model settings.defaultFilter.where, AND-merged into every query unless skipped. */
45
+ /** Default where from @model settings.query.filter.where, AND-merged into every query unless skipped. */
46
46
  protected get defaultWhere(): TWhere | undefined;
47
47
  protected get defaultLimit(): number | undefined;
48
48
  /** Largest `limit` a caller may ask for, when the model declares one; undefined leaves the tier's own default in force. */
@@ -1 +1 @@
1
- {"version":3,"file":"abstract.d.ts","sourceRoot":"","sources":["../../../../../src/base/repositories/core/abstract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAA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I,CAAA;KAAE,CAAC;IAEhD,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,WAAW,EAAE,IAAI,EAAE;QACxC,KAAK,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAC5B,OAAO,CAAC,EAAE,QAAQ,GAAG;YAAE,YAAY,CAAC,EAAE,IAAI,CAAC;YAAC,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;KAC/D,GAAG,OAAO,CAAC,MAAM,GAAG;QAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC;IAE/C,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE;QACb,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAC3B,OAAO,EAAE,QAAQ,GAAG;YAAE,YAAY,EAAE,KAAK,CAAC;YAAC,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;KAC9D,GAAG,OAAO,CAAC,MAAM,GAAG;QAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAAA;KAAE,CAAC;IAChD,QAAQ,CAAC,CAAC,GAAG,WAAW,EAAE,IAAI,EAAE;QAC9B,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAC3B,OAAO,CAAC,EAAE,QAAQ,GAAG;YAAE,YAAY,CAAC,EAAE,IAAI,CAAC;YAAC,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;KAC/D,GAAG,OAAO,CAAC,MAAM,GAAG;QAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC;CAahD"}
@@ -75,16 +75,16 @@ class AbstractRepository extends core_1.BaseHelper {
75
75
  get hiddenFields() {
76
76
  return this.modelSettings?.hiddenProperties ?? [];
77
77
  }
78
- /** Default where from @model settings.defaultFilter.where, AND-merged into every query unless skipped. */
78
+ /** Default where from @model settings.query.filter.where, AND-merged into every query unless skipped. */
79
79
  get defaultWhere() {
80
- return this.modelSettings?.defaultFilter?.where;
80
+ return this.modelSettings?.query?.filter?.where;
81
81
  }
82
82
  get defaultLimit() {
83
- return this.modelSettings?.defaultLimit;
83
+ return this.modelSettings?.query?.limit?.default;
84
84
  }
85
85
  /** Largest `limit` a caller may ask for, when the model declares one; undefined leaves the tier's own default in force. */
86
86
  get maxLimit() {
87
- return this.modelSettings?.maxLimit;
87
+ return this.modelSettings?.query?.limit?.max;
88
88
  }
89
89
  /**
90
90
  * Both bounds, in one place, for every tier.