@venizia/ignis-kernel 0.5.0-3 → 0.5.0-4

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 (54) hide show
  1. package/dist/esm/base/applications/boot-sequence.d.ts +2 -3
  2. package/dist/esm/base/applications/boot-sequence.js +2 -17
  3. package/dist/esm/base/applications/boot-sequence.js.map +1 -1
  4. package/dist/esm/base/applications/common/constants.d.ts +3 -6
  5. package/dist/esm/base/applications/common/constants.js +3 -17
  6. package/dist/esm/base/applications/common/constants.js.map +1 -1
  7. package/dist/esm/base/auth/authenticate/common/constants/authentication.d.ts +3 -7
  8. package/dist/esm/base/auth/authenticate/common/constants/authentication.js +3 -11
  9. package/dist/esm/base/auth/authenticate/common/constants/authentication.js.map +1 -1
  10. package/dist/esm/base/auth/authenticate/common/constants/jose.d.ts +6 -15
  11. package/dist/esm/base/auth/authenticate/common/constants/jose.js +6 -25
  12. package/dist/esm/base/auth/authenticate/common/constants/jose.js.map +1 -1
  13. package/dist/esm/base/auth/authorize/common/constants/authorization.d.ts +4 -9
  14. package/dist/esm/base/auth/authorize/common/constants/authorization.js +4 -15
  15. package/dist/esm/base/auth/authorize/common/constants/authorization.js.map +1 -1
  16. package/dist/esm/base/auth/authorize/common/constants/enforcer.d.ts +5 -12
  17. package/dist/esm/base/auth/authorize/common/constants/enforcer.js +5 -26
  18. package/dist/esm/base/auth/authorize/common/constants/enforcer.js.map +1 -1
  19. package/dist/esm/base/controllers/common/constants.d.ts +3 -6
  20. package/dist/esm/base/controllers/common/constants.js +3 -11
  21. package/dist/esm/base/controllers/common/constants.js.map +1 -1
  22. package/dist/esm/base/controllers/factory/controller.js +1 -1
  23. package/dist/esm/base/controllers/factory/controller.js.map +1 -1
  24. package/dist/esm/base/datasources/common/types.d.ts +2 -3
  25. package/dist/esm/base/datasources/common/types.js +2 -5
  26. package/dist/esm/base/datasources/common/types.js.map +1 -1
  27. package/dist/esm/base/events/common/constants.d.ts +2 -3
  28. package/dist/esm/base/events/common/constants.js +2 -5
  29. package/dist/esm/base/events/common/constants.js.map +1 -1
  30. package/dist/esm/base/events/event-bus.js +1 -1
  31. package/dist/esm/base/events/event-bus.js.map +1 -1
  32. package/dist/esm/base/metadata/injectable.js +1 -1
  33. package/dist/esm/base/metadata/injectable.js.map +1 -1
  34. package/dist/esm/base/metadata/model-metadata.js +1 -1
  35. package/dist/esm/base/metadata/model-metadata.js.map +1 -1
  36. package/dist/esm/base/metadata/persistents/datasource.js +1 -1
  37. package/dist/esm/base/metadata/persistents/datasource.js.map +1 -1
  38. package/dist/esm/base/metadata/persistents/repository/validate.js +1 -1
  39. package/dist/esm/base/metadata/persistents/repository/validate.js.map +1 -1
  40. package/dist/esm/base/models/common/constants.d.ts +5 -11
  41. package/dist/esm/base/models/common/constants.js +5 -23
  42. package/dist/esm/base/models/common/constants.js.map +1 -1
  43. package/dist/esm/base/repositories/common/constants.d.ts +7 -18
  44. package/dist/esm/base/repositories/common/constants.js +7 -35
  45. package/dist/esm/base/repositories/common/constants.js.map +1 -1
  46. package/dist/esm/common/statuses/user.d.ts +2 -3
  47. package/dist/esm/common/statuses/user.js +2 -5
  48. package/dist/esm/common/statuses/user.js.map +1 -1
  49. package/dist/esm/helpers/inversion/common/constants.d.ts +3 -6
  50. package/dist/esm/helpers/inversion/common/constants.js +3 -18
  51. package/dist/esm/helpers/inversion/common/constants.js.map +1 -1
  52. package/dist/esm/helpers/inversion/common/types/model.d.ts +1 -1
  53. package/dist/esm/helpers/inversion/common/types/model.js.map +1 -1
  54. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"model-metadata.js","sourceRoot":"","sources":["../../../../src/base/metadata/model-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,MAAM,OAAO,oBAAoB;IAC/B;;;;;;;OAOG;IACH,MAAM,CAAC,sBAAsB,CAAC,IAAiD;QAC7E,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QACjC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC;QAErC,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACpD,MAAM,QAAQ,CAAC;gBACb,OAAO,EAAE,WAAW,KAAK,uCAAuC,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,6BAA6B,MAAM,CAAC,IAAI,CAAC,EAAE;aACjJ,CAAC,CAAC;QACL,CAAC;QAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,OAAO,EAAE,GAAG,QAAQ,EAAE,SAAS,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,KAAK,KAAK,EAAE,EAAE,CAAC;IACpF,CAAC;CACF","sourcesContent":["import { getError } from '@venizia/ignis-helpers/core';\nimport type { IModelMetadata } from '@/helpers/inversion';\nimport { ModelTypes } from '../models/common/constants';\n\nexport class ModelMetadataUtility {\n /**\n * The one place the `@model` metadata outside `settings` is checked and normalised.\n *\n * - `type` is optional; a value must be one of {@link ModelTypes}.\n * - The old keys (`skipMigrate`, and the flat `defaultFilter`, `defaultLimit`, `maxLimit`, `scopeFilter` of `settings`)\n * are not read: the types refuse them as excess properties, and an untyped caller's key is ignored.\n * - When the model declares `migration`, the registry entry carries it with `use` filled in.\n */\n static normalizeModelMetadata(opts: { model: string; metadata: IModelMetadata }): IModelMetadata {\n const { model, metadata } = opts;\n const { type, migration } = metadata;\n\n if (type !== undefined && !ModelTypes.isValid(type)) {\n throw getError({\n message: `[model][${model}] Invalid 'type' | Expected one of: ${[...ModelTypes.SCHEME_SET].join(', ')} (or leave it out) | Got: ${String(type)}`,\n });\n }\n\n if (migration === undefined) {\n return metadata;\n }\n\n return { ...metadata, migration: { ...migration, use: migration.use !== false } };\n }\n}\n"]}
1
+ {"version":3,"file":"model-metadata.js","sourceRoot":"","sources":["../../../../src/base/metadata/model-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,MAAM,OAAO,oBAAoB;IAC/B;;;;;;;OAOG;IACH,MAAM,CAAC,sBAAsB,CAAC,IAAiD;QAC7E,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QACjC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC;QAErC,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACpD,MAAM,QAAQ,CAAC;gBACb,OAAO,EAAE,WAAW,KAAK,uCAAuC,UAAU,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,6BAA6B,MAAM,CAAC,IAAI,CAAC,EAAE;aAC1I,CAAC,CAAC;QACL,CAAC;QAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,OAAO,EAAE,GAAG,QAAQ,EAAE,SAAS,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,KAAK,KAAK,EAAE,EAAE,CAAC;IACpF,CAAC;CACF","sourcesContent":["import { getError } from '@venizia/ignis-helpers/core';\nimport type { IModelMetadata } from '@/helpers/inversion';\nimport { ModelTypes } from '../models/common/constants';\n\nexport class ModelMetadataUtility {\n /**\n * The one place the `@model` metadata outside `settings` is checked and normalised.\n *\n * - `type` is optional; a value must be one of {@link ModelTypes}.\n * - The old keys (`skipMigrate`, and the flat `defaultFilter`, `defaultLimit`, `maxLimit`, `scopeFilter` of `settings`)\n * are not read: the types refuse them as excess properties, and an untyped caller's key is ignored.\n * - When the model declares `migration`, the registry entry carries it with `use` filled in.\n */\n static normalizeModelMetadata(opts: { model: string; metadata: IModelMetadata }): IModelMetadata {\n const { model, metadata } = opts;\n const { type, migration } = metadata;\n\n if (type !== undefined && !ModelTypes.isValid(type)) {\n throw getError({\n message: `[model][${model}] Invalid 'type' | Expected one of: ${ModelTypes.values().join(', ')} (or leave it out) | Got: ${String(type)}`,\n });\n }\n\n if (migration === undefined) {\n return metadata;\n }\n\n return { ...metadata, migration: { ...migration, use: migration.use !== false } };\n }\n}\n"]}
@@ -33,7 +33,7 @@ export const datasource = (metadata) => {
33
33
  // Untyped JS callers: a misspelt mode would silently mean "start", so it is refused where it is written.
34
34
  if (openMode !== undefined && !DataSourceOpenModes.isValid(openMode)) {
35
35
  throw getError({
36
- message: `[datasource][@datasource][${target.name}] Invalid metadata | Unknown 'open.on': ${String(openMode)} | Expected one of: ${[...DataSourceOpenModes.SCHEME_SET].join(', ')}`,
36
+ message: `[datasource][@datasource][${target.name}] Invalid metadata | Unknown 'open.on': ${String(openMode)} | Expected one of: ${DataSourceOpenModes.values().join(', ')}`,
37
37
  });
38
38
  }
39
39
  injectable({
@@ -1 +1 @@
1
- {"version":3,"file":"datasource.js","sourceRoot":"","sources":["../../../../../src/base/metadata/persistents/datasource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAA8B,EAAkB,EAAE;IAC3E,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,MAAM,WAAW,GAAG,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC;QAE9C,IACE,WAAW,KAAK,SAAS;YACzB,CAAC,OAAO,WAAW,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC,EACtF,CAAC;YACD,MAAM,QAAQ,CAAC;gBACb,OAAO,EAAE,6BAA6B,MAAM,CAAC,IAAI,sGAAsG,MAAM,CAAC,WAAW,CAAC,EAAE;aAC7K,CAAC,CAAC;QACL,CAAC;QAED,MAAM,QAAQ,GAAG,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC;QAEpC,yGAAyG;QACzG,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrE,MAAM,QAAQ,CAAC;gBACb,OAAO,EAAE,6BAA6B,MAAM,CAAC,IAAI,2CAA2C,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAC,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;aACpL,CAAC,CAAC;QACL,CAAC;QAED,UAAU,CAAC;YACT,IAAI,EAAE,aAAa,CAAC,UAAU;YAC9B,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,EAAE,QAAQ,EAAE,QAAQ,IAAI,EAAE,EAAE,CAAC;SAC3E,CAAC,CAAC,MAAM,CAAC,CAAC;QACX,gBAAgB,CAAC,WAAW,EAAE,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC7E,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { ArtifactTypes, MetadataRegistry } from '@/helpers/inversion';\nimport type { IDataSourceMetadata } from '@/helpers/inversion';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { DataSourceOpenModes } from '../../datasources';\nimport { injectable, InjectableUtility } from '../injectable';\n\n/**\n * Registers a datasource with driver and auto-discovery settings.\n *\n * @example\n * ```typescript\n * import { datasource } from '@venizia/ignis';\n * import { BasePostgresDataSource } from '@venizia/ignis-connectors/postgres';\n * import { NodePostgresDriver } from '@venizia/ignis-connectors/postgres/node-postgres';\n * import { Pool } from 'pg';\n *\n * export @datasource({ driver: NodePostgresDriver })\n * class AppDataSource extends BasePostgresDataSource<{ connectionString: string }> {\n * constructor() { super({ name: AppDataSource.name, config: { connectionString: 'postgres://localhost/app' } }); }\n * override configure(): void { this.client = new Pool(this.settings); }\n * override getConnectionString(): string { return this.settings.connectionString; }\n * }\n * ```\n */\nexport const datasource = (metadata?: IDataSourceMetadata): ClassDecorator => {\n return (target) => {\n const openTimeout = metadata?.open?.timeoutMs;\n\n if (\n openTimeout !== undefined &&\n (typeof openTimeout !== 'number' || !Number.isInteger(openTimeout) || openTimeout < 0)\n ) {\n throw getError({\n message: `[datasource][@datasource][${target.name}] Invalid metadata | 'open.timeoutMs' must be a non-negative integer (ms; 0 waits for ever) | Got: ${String(openTimeout)}`,\n });\n }\n\n const openMode = metadata?.open?.on;\n\n // Untyped JS callers: a misspelt mode would silently mean \"start\", so it is refused where it is written.\n if (openMode !== undefined && !DataSourceOpenModes.isValid(openMode)) {\n throw getError({\n message: `[datasource][@datasource][${target.name}] Invalid metadata | Unknown 'open.on': ${String(openMode)} | Expected one of: ${[...DataSourceOpenModes.SCHEME_SET].join(', ')}`,\n });\n }\n\n injectable({\n type: ArtifactTypes.DATASOURCE,\n ...InjectableUtility.pickRegistrationOptions({ metadata: metadata ?? {} }),\n })(target);\n MetadataRegistry.getInstance().setDataSourceMetadata({ target, metadata });\n };\n};\n"]}
1
+ {"version":3,"file":"datasource.js","sourceRoot":"","sources":["../../../../../src/base/metadata/persistents/datasource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAE,MAAM,6B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MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC7E,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { ArtifactTypes, MetadataRegistry } from '@/helpers/inversion';\nimport type { IDataSourceMetadata } from '@/helpers/inversion';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { DataSourceOpenModes } from '../../datasources';\nimport { injectable, InjectableUtility } from '../injectable';\n\n/**\n * Registers a datasource with driver and auto-discovery settings.\n *\n * @example\n * ```typescript\n * import { datasource } from '@venizia/ignis';\n * import { BasePostgresDataSource } from '@venizia/ignis-connectors/postgres';\n * import { NodePostgresDriver } from '@venizia/ignis-connectors/postgres/node-postgres';\n * import { Pool } from 'pg';\n *\n * export @datasource({ driver: NodePostgresDriver })\n * class AppDataSource extends BasePostgresDataSource<{ connectionString: string }> {\n * constructor() { super({ name: AppDataSource.name, config: { connectionString: 'postgres://localhost/app' } }); }\n * override configure(): void { this.client = new Pool(this.settings); }\n * override getConnectionString(): string { return this.settings.connectionString; }\n * }\n * ```\n */\nexport const datasource = (metadata?: IDataSourceMetadata): ClassDecorator => {\n return (target) => {\n const openTimeout = metadata?.open?.timeoutMs;\n\n if (\n openTimeout !== undefined &&\n (typeof openTimeout !== 'number' || !Number.isInteger(openTimeout) || openTimeout < 0)\n ) {\n throw getError({\n message: `[datasource][@datasource][${target.name}] Invalid metadata | 'open.timeoutMs' must be a non-negative integer (ms; 0 waits for ever) | Got: ${String(openTimeout)}`,\n });\n }\n\n const openMode = metadata?.open?.on;\n\n // Untyped JS callers: a misspelt mode would silently mean \"start\", so it is refused where it is written.\n if (openMode !== undefined && !DataSourceOpenModes.isValid(openMode)) {\n throw getError({\n message: `[datasource][@datasource][${target.name}] Invalid metadata | Unknown 'open.on': ${String(openMode)} | Expected one of: ${DataSourceOpenModes.values().join(', ')}`,\n });\n }\n\n injectable({\n type: ArtifactTypes.DATASOURCE,\n ...InjectableUtility.pickRegistrationOptions({ metadata: metadata ?? {} }),\n })(target);\n MetadataRegistry.getInstance().setDataSourceMetadata({ target, metadata });\n };\n};\n"]}
@@ -7,7 +7,7 @@ export const validateRepositoryMetadata = (opts) => {
7
7
  const type = metadata.type ?? RepositoryTypes.MODEL;
8
8
  if (!RepositoryTypes.isValid(type)) {
9
9
  throw getError({
10
- message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Unknown 'type': ${type} | Expected one of: ${[...RepositoryTypes.SCHEME_SET].join(', ')}`,
10
+ message: `[validateRepositoryMetadata][@repository][${target.name}] Invalid metadata | Unknown 'type': ${type} | Expected one of: ${RepositoryTypes.values().join(', ')}`,
11
11
  });
12
12
  }
13
13
  if (type === RepositoryTypes.MODEL && !metadata.model) {
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../../../src/base/metadata/persistents/repository/validate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAEzE,iKAAiK;AACjK,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAGxC,IAGD,EAAQ,EAAE;IACT,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAClC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,eAAe,CAAC,KAAK,CAAC;IAEpD,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE,6CAA6C,MAAM,CAAC,IAAI,wCAAwC,IAAI,uBAAuB,CAAC,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;SACjL,CAAC,CAAC;IACL,CAAC;IAED,IAAI,IAAI,KAAK,eAAe,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,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AAG;SACnL,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { TRepositoryMetadata } from '@/helpers/inversion';\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';\n\n/** Mirrors the `TRepositoryMetadata` union for JavaScript callers: a known type, a dataSource always, a model exactly when the type is RepositoryTypes.MODEL. */\nexport const 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 a datasource class (`AbstractDataSource` or the `DataSourceRoot` it extends) compatible with what @repository declared. */\nexport const 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 `DataSourceRoot` 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 (or DataSourceRoot) | 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"]}
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../../../src/base/metadata/persistents/repository/validate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAEzE,iKAAiK;AACjK,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAGxC,IAGD,EAAQ,EAAE;IACT,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAClC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,eAAe,CAAC,KAAK,CAAC;IAEpD,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE,6CAA6C,MAAM,CAAC,IAAI,wCAAwC,IAAI,uBAAuB,eAAe,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;SAC1K,CAAC,CAAC;IACL,CAAC;IAED,IAAI,IAAI,KAAK,eAAe,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtD,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE,6CAA6C,MAAM,CAAC,I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ryMetadata } from '@/helpers/inversion';\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';\n\n/** Mirrors the `TRepositoryMetadata` union for JavaScript callers: a known type, a dataSource always, a model exactly when the type is RepositoryTypes.MODEL. */\nexport const 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.values().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 a datasource class (`AbstractDataSource` or the `DataSourceRoot` it extends) compatible with what @repository declared. */\nexport const 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 `DataSourceRoot` 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 (or DataSourceRoot) | 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"]}
@@ -1,38 +1,32 @@
1
1
  import type { TConstValue } from '@venizia/ignis-helpers/common';
2
+ import { ConstClass } from '@venizia/ignis-helpers/common';
2
3
  /** The schema variants an entity can produce (`getSchema({ type })`): select, create, update and execute. */
3
- export declare class SchemaTypes {
4
+ export declare class SchemaTypes extends ConstClass {
4
5
  static readonly SELECT = "select";
5
6
  static readonly UPDATE = "update";
6
7
  static readonly CREATE = "create";
7
8
  static readonly EXECUTE = "execute";
8
- static readonly SCHEME_SET: Set<string>;
9
- static isValid(input: string): input is TSchemaType;
10
9
  }
11
10
  /** Valid `SchemaTypes` values. */
12
11
  export type TSchemaType = TConstValue<typeof SchemaTypes>;
13
12
  /** The keys a write stamps, which a generated create or update body leaves out by default (`@model` `settings.properties.stamped`). */
14
- export declare class AuditFields {
13
+ export declare class AuditFields extends ConstClass {
15
14
  static readonly CREATED_BY = "createdBy";
16
15
  static readonly MODIFIED_BY = "modifiedBy";
17
16
  static readonly CREATED_AT = "createdAt";
18
17
  static readonly MODIFIED_AT = "modifiedAt";
19
18
  static readonly DELETED_AT = "deletedAt";
20
- static readonly SCHEME_SET: Set<string>;
21
19
  }
22
20
  /** What `@model` declares. Only ENTITY (a table-backed model) exists; `type` may be left out. */
23
- export declare class ModelTypes {
21
+ export declare class ModelTypes extends ConstClass {
24
22
  static readonly ENTITY = "entity";
25
- static readonly SCHEME_SET: Set<string>;
26
- static isValid(value: string): boolean;
27
23
  }
28
24
  /** Valid model type values. */
29
25
  export type TModelType = TConstValue<typeof ModelTypes>;
30
26
  /** The path-param id shape an entity family resolves to (`AbstractEntity.getIdType()`). */
31
- export declare class IdSchemaTypes {
27
+ export declare class IdSchemaTypes extends ConstClass {
32
28
  static readonly NUMBER = "number";
33
29
  static readonly STRING = "string";
34
- static readonly SCHEME_SET: Set<string>;
35
- static isValid(value: string): boolean;
36
30
  }
37
31
  /** Valid id schema type values. */
38
32
  export type TIdSchemaType = TConstValue<typeof IdSchemaTypes>;
@@ -1,44 +1,26 @@
1
+ import { ConstClass } from '@venizia/ignis-helpers/common';
1
2
  /** The schema variants an entity can produce (`getSchema({ type })`): select, create, update and execute. */
2
- export class SchemaTypes {
3
+ export class SchemaTypes extends ConstClass {
3
4
  static { this.SELECT = 'select'; }
4
5
  static { this.UPDATE = 'update'; }
5
6
  static { this.CREATE = 'create'; }
6
7
  static { this.EXECUTE = 'execute'; }
7
- static { this.SCHEME_SET = new Set([this.SELECT, this.UPDATE, this.CREATE, this.EXECUTE]); }
8
- static isValid(input) {
9
- return this.SCHEME_SET.has(input);
10
- }
11
8
  }
12
9
  /** The keys a write stamps, which a generated create or update body leaves out by default (`@model` `settings.properties.stamped`). */
13
- export class AuditFields {
10
+ export class AuditFields extends ConstClass {
14
11
  static { this.CREATED_BY = 'createdBy'; }
15
12
  static { this.MODIFIED_BY = 'modifiedBy'; }
16
13
  static { this.CREATED_AT = 'createdAt'; }
17
14
  static { this.MODIFIED_AT = 'modifiedAt'; }
18
15
  static { this.DELETED_AT = 'deletedAt'; }
19
- static { this.SCHEME_SET = new Set([
20
- this.CREATED_BY,
21
- this.MODIFIED_BY,
22
- this.CREATED_AT,
23
- this.MODIFIED_AT,
24
- this.DELETED_AT,
25
- ]); }
26
16
  }
27
17
  /** What `@model` declares. Only ENTITY (a table-backed model) exists; `type` may be left out. */
28
- export class ModelTypes {
18
+ export class ModelTypes extends ConstClass {
29
19
  static { this.ENTITY = 'entity'; }
30
- static { this.SCHEME_SET = new Set([this.ENTITY]); }
31
- static isValid(value) {
32
- return this.SCHEME_SET.has(value);
33
- }
34
20
  }
35
21
  /** The path-param id shape an entity family resolves to (`AbstractEntity.getIdType()`). */
36
- export class IdSchemaTypes {
22
+ export class IdSchemaTypes extends ConstClass {
37
23
  static { this.NUMBER = 'number'; }
38
24
  static { this.STRING = 'string'; }
39
- static { this.SCHEME_SET = new Set([this.NUMBER, this.STRING]); }
40
- static isValid(value) {
41
- return this.SCHEME_SET.has(value);
42
- }
43
25
  }
44
26
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/models/common/constants.ts"],"names":[],"mappings":"AAEA,6GAA6G;AAC7G,MAAM,OAAO,WAAW;aACN,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,YAAO,GAAG,SAAS,CAAC;aAEpB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5F,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,uIAAuI;AACvI,MAAM,OAAO,WAAW;aACN,eAAU,GAAG,WAAW,CAAC;aACzB,gBAAW,GAAG,YAAY,CAAC;aAC3B,eAAU,GAAG,WAAW,CAAC;aACzB,gBAAW,GAAG,YAAY,CAAC;aAC3B,eAAU,GAAG,WAAW,CAAC;aAEzB,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,WAAW;QAChB,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,WAAW;QAChB,IAAI,CAAC,UAAU;KAChB,CAAC,CAAC;;AAGL,iGAAiG;AACjG,MAAM,OAAO,UAAU;aACL,WAAM,GAAG,QAAQ,CAAC;aAClB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEpD,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,2FAA2F;AAC3F,MAAM,OAAO,aAAa;aACR,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\n\n/** The schema variants an entity can produce (`getSchema({ type })`): select, create, update and execute. */\nexport class SchemaTypes {\n static readonly SELECT = 'select';\n static readonly UPDATE = 'update';\n static readonly CREATE = 'create';\n static readonly EXECUTE = 'execute';\n\n static readonly SCHEME_SET = new Set([this.SELECT, this.UPDATE, this.CREATE, this.EXECUTE]);\n\n static isValid(input: string): input is TSchemaType {\n return this.SCHEME_SET.has(input);\n }\n}\n\n/** Valid `SchemaTypes` values. */\nexport type TSchemaType = TConstValue<typeof SchemaTypes>;\n\n/** The keys a write stamps, which a generated create or update body leaves out by default (`@model` `settings.properties.stamped`). */\nexport class AuditFields {\n static readonly CREATED_BY = 'createdBy';\n static readonly MODIFIED_BY = 'modifiedBy';\n static readonly CREATED_AT = 'createdAt';\n static readonly MODIFIED_AT = 'modifiedAt';\n static readonly DELETED_AT = 'deletedAt';\n\n static readonly SCHEME_SET = new Set<string>([\n this.CREATED_BY,\n this.MODIFIED_BY,\n this.CREATED_AT,\n this.MODIFIED_AT,\n this.DELETED_AT,\n ]);\n}\n\n/** What `@model` declares. Only ENTITY (a table-backed model) exists; `type` may be left out. */\nexport class ModelTypes {\n static readonly ENTITY = 'entity';\n static readonly SCHEME_SET = new Set([this.ENTITY]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid model type values. */\nexport type TModelType = TConstValue<typeof ModelTypes>;\n\n/** The path-param id shape an entity family resolves to (`AbstractEntity.getIdType()`). */\nexport class IdSchemaTypes {\n static readonly NUMBER = 'number';\n static readonly STRING = 'string';\n\n static readonly SCHEME_SET = new Set<string>([this.NUMBER, this.STRING]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid id schema type values. */\nexport type TIdSchemaType = TConstValue<typeof IdSchemaTypes>;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/models/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,6GAA6G;AAC7G,MAAM,OAAO,WAAY,SAAQ,UAAU;aACzB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,YAAO,GAAG,SAAS,CAAC;;AAMtC,uIAAuI;AACvI,MAAM,OAAO,WAAY,SAAQ,UAAU;aACzB,eAAU,GAAG,WAAW,CAAC;aACzB,gBAAW,GAAG,YAAY,CAAC;aAC3B,eAAU,GAAG,WAAW,CAAC;aACzB,gBAAW,GAAG,YAAY,CAAC;aAC3B,eAAU,GAAG,WAAW,CAAC;;AAG3C,iGAAiG;AACjG,MAAM,OAAO,UAAW,SAAQ,UAAU;aACxB,WAAM,GAAG,QAAQ,CAAC;;AAMpC,2FAA2F;AAC3F,MAAM,OAAO,aAAc,SAAQ,UAAU;aAC3B,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { ConstClass } from '@venizia/ignis-helpers/common';\n\n/** The schema variants an entity can produce (`getSchema({ type })`): select, create, update and execute. */\nexport class SchemaTypes extends ConstClass {\n static readonly SELECT = 'select';\n static readonly UPDATE = 'update';\n static readonly CREATE = 'create';\n static readonly EXECUTE = 'execute';\n}\n\n/** Valid `SchemaTypes` values. */\nexport type TSchemaType = TConstValue<typeof SchemaTypes>;\n\n/** The keys a write stamps, which a generated create or update body leaves out by default (`@model` `settings.properties.stamped`). */\nexport class AuditFields extends ConstClass {\n static readonly CREATED_BY = 'createdBy';\n static readonly MODIFIED_BY = 'modifiedBy';\n static readonly CREATED_AT = 'createdAt';\n static readonly MODIFIED_AT = 'modifiedAt';\n static readonly DELETED_AT = 'deletedAt';\n}\n\n/** What `@model` declares. Only ENTITY (a table-backed model) exists; `type` may be left out. */\nexport class ModelTypes extends ConstClass {\n static readonly ENTITY = 'entity';\n}\n\n/** Valid model type values. */\nexport type TModelType = TConstValue<typeof ModelTypes>;\n\n/** The path-param id shape an entity family resolves to (`AbstractEntity.getIdType()`). */\nexport class IdSchemaTypes extends ConstClass {\n static readonly NUMBER = 'number';\n static readonly STRING = 'string';\n}\n\n/** Valid id schema type values. */\nexport type TIdSchemaType = TConstValue<typeof IdSchemaTypes>;\n"]}
@@ -1,4 +1,5 @@
1
1
  import type { TConstValue } from '@venizia/ignis-helpers/common';
2
+ import { ConstClass } from '@venizia/ignis-helpers/common';
2
3
  /** Default pagination limit for repository queries. */
3
4
  export declare const DEFAULT_LIMIT = 10;
4
5
  /**
@@ -14,32 +15,26 @@ export declare const DEFAULT_LIMIT = 10;
14
15
  */
15
16
  export declare const DEFAULT_MAX_LIMIT = 1000;
16
17
  /** Defines the operation scope for repository instances (READ_ONLY, WRITE_ONLY, READ_WRITE). */
17
- export declare class RepositoryOperationScopes {
18
+ export declare class RepositoryOperationScopes extends ConstClass {
18
19
  static readonly READ_ONLY = "READ_ONLY";
19
20
  static readonly WRITE_ONLY = "WRITE_ONLY";
20
21
  static readonly READ_WRITE = "READ_WRITE";
21
- static readonly SCHEME_SET: Set<string>;
22
- static isValid(orgType: string): boolean;
23
22
  }
24
23
  /** Valid repository operation scope values. */
25
24
  export type TRepositoryOperationScope = TConstValue<typeof RepositoryOperationScopes>;
26
25
  /** What `@repository` binds: MODEL, a model this application declares; REMOTE, data behind another service's API, with no model. */
27
- export declare class RepositoryTypes {
26
+ export declare class RepositoryTypes extends ConstClass {
28
27
  static readonly MODEL = "model";
29
28
  static readonly REMOTE = "remote";
30
- static readonly SCHEME_SET: Set<string>;
31
- static isValid(value: string): boolean;
32
29
  }
33
30
  /** Valid repository type values. */
34
31
  export type TRepositoryType = TConstValue<typeof RepositoryTypes>;
35
32
  /** What a row-scope filter (`@model` settings.access) does when `resolve()` returns null/undefined. */
36
- export declare class ScopeFilterMissingBehaviors {
33
+ export declare class ScopeFilterMissingBehaviors extends ConstClass {
37
34
  /** An unresolved scope matches ZERO rows - the safe reading of "caller's scope is unknown". */
38
35
  static readonly DENY = "deny";
39
36
  /** Explicit opt-out: no scope is applied. For migrations and background jobs, never inferred from a request. */
40
37
  static readonly ALLOW = "allow";
41
- static readonly SCHEME_SET: Set<string>;
42
- static isValid(behavior: string): boolean;
43
38
  }
44
39
  /** Valid scope-filter missing-behavior values. */
45
40
  export type TScopeFilterMissingBehavior = TConstValue<typeof ScopeFilterMissingBehaviors>;
@@ -48,13 +43,11 @@ export type TScopeFilterMissingBehavior = TConstValue<typeof ScopeFilterMissingB
48
43
  * (`@model` settings.access.write.mode). A scope that returns `ScopeFilters.UNRESTRICTED`
49
44
  * passes either way.
50
45
  */
51
- export declare class ScopeWriteGuards {
46
+ export declare class ScopeWriteGuards extends ConstClass {
52
47
  /** A row whose scope column disagrees, or is absent on create, is refused and nothing is written. */
53
48
  static readonly REJECT = "reject";
54
49
  /** An ABSENT scope column is filled from an equality scope; a value that disagrees is still refused. */
55
50
  static readonly ASSIGN = "assign";
56
- static readonly SCHEME_SET: Set<string>;
57
- static isValid(guard: string): boolean;
58
51
  }
59
52
  /** Valid scope write-guard values. */
60
53
  export type TScopeWriteGuard = TConstValue<typeof ScopeWriteGuards>;
@@ -83,22 +76,18 @@ export declare class RepositoryErrorCodes {
83
76
  /** Valid repository error code values. */
84
77
  export type TRepositoryErrorCode = TConstValue<typeof RepositoryErrorCodes>;
85
78
  /** Entity relation types (one-to-one/many-to-one, one-to-many). */
86
- export declare class RelationTypes {
79
+ export declare class RelationTypes extends ConstClass {
87
80
  static readonly ONE = "one";
88
81
  static readonly MANY = "many";
89
- static readonly SCHEME_SET: Set<string>;
90
- static isValid(orgType: string): boolean;
91
82
  }
92
83
  /** Valid relation type values. */
93
84
  export type TRelationType = TConstValue<typeof RelationTypes>;
94
85
  /** PostgreSQL row-level lock strengths for SELECT ... FOR <strength>. */
95
- export declare class LockStrengths {
86
+ export declare class LockStrengths extends ConstClass {
96
87
  static readonly UPDATE = "update";
97
88
  static readonly NO_KEY_UPDATE = "no key update";
98
89
  static readonly SHARE = "share";
99
90
  static readonly KEY_SHARE = "key share";
100
- static readonly SCHEME_SET: Set<string>;
101
- static isValid(strength: string): boolean;
102
91
  }
103
92
  /** Valid lock strength values. */
104
93
  export type TLockStrength = TConstValue<typeof LockStrengths>;
@@ -1,4 +1,5 @@
1
1
  import { MessageCode } from '@venizia/ignis-helpers/core';
2
+ import { ConstClass } from '@venizia/ignis-helpers/common';
2
3
  /** Default pagination limit for repository queries. */
3
4
  export const DEFAULT_LIMIT = 10;
4
5
  /**
@@ -14,49 +15,33 @@ export const DEFAULT_LIMIT = 10;
14
15
  */
15
16
  export const DEFAULT_MAX_LIMIT = 1000;
16
17
  /** Defines the operation scope for repository instances (READ_ONLY, WRITE_ONLY, READ_WRITE). */
17
- export class RepositoryOperationScopes {
18
+ export class RepositoryOperationScopes extends ConstClass {
18
19
  static { this.READ_ONLY = 'READ_ONLY'; }
19
20
  static { this.WRITE_ONLY = 'WRITE_ONLY'; }
20
21
  static { this.READ_WRITE = 'READ_WRITE'; }
21
- static { this.SCHEME_SET = new Set([this.READ_ONLY, this.WRITE_ONLY, this.READ_WRITE]); }
22
- static isValid(orgType) {
23
- return this.SCHEME_SET.has(orgType);
24
- }
25
22
  }
26
23
  /** What `@repository` binds: MODEL, a model this application declares; REMOTE, data behind another service's API, with no model. */
27
- export class RepositoryTypes {
24
+ export class RepositoryTypes extends ConstClass {
28
25
  static { this.MODEL = 'model'; }
29
26
  static { this.REMOTE = 'remote'; }
30
- static { this.SCHEME_SET = new Set([this.MODEL, this.REMOTE]); }
31
- static isValid(value) {
32
- return this.SCHEME_SET.has(value);
33
- }
34
27
  }
35
28
  /** What a row-scope filter (`@model` settings.access) does when `resolve()` returns null/undefined. */
36
- export class ScopeFilterMissingBehaviors {
29
+ export class ScopeFilterMissingBehaviors extends ConstClass {
37
30
  /** An unresolved scope matches ZERO rows - the safe reading of "caller's scope is unknown". */
38
31
  static { this.DENY = 'deny'; }
39
32
  /** Explicit opt-out: no scope is applied. For migrations and background jobs, never inferred from a request. */
40
33
  static { this.ALLOW = 'allow'; }
41
- static { this.SCHEME_SET = new Set([this.DENY, this.ALLOW]); }
42
- static isValid(behavior) {
43
- return this.SCHEME_SET.has(behavior);
44
- }
45
34
  }
46
35
  /**
47
36
  * What a scoped write does with a row whose scope column disagrees with the resolved scope
48
37
  * (`@model` settings.access.write.mode). A scope that returns `ScopeFilters.UNRESTRICTED`
49
38
  * passes either way.
50
39
  */
51
- export class ScopeWriteGuards {
40
+ export class ScopeWriteGuards extends ConstClass {
52
41
  /** A row whose scope column disagrees, or is absent on create, is refused and nothing is written. */
53
42
  static { this.REJECT = 'reject'; }
54
43
  /** An ABSENT scope column is filled from an equality scope; a value that disagrees is still refused. */
55
44
  static { this.ASSIGN = 'assign'; }
56
- static { this.SCHEME_SET = new Set([this.REJECT, this.ASSIGN]); }
57
- static isValid(guard) {
58
- return this.SCHEME_SET.has(guard);
59
- }
60
45
  }
61
46
  /**
62
47
  * The third `resolve()` state, beside a `where` and `deny`-by-default null/undefined: unrestricted
@@ -85,29 +70,16 @@ export class RepositoryErrorCodes {
85
70
  }); }
86
71
  }
87
72
  /** Entity relation types (one-to-one/many-to-one, one-to-many). */
88
- export class RelationTypes {
73
+ export class RelationTypes extends ConstClass {
89
74
  static { this.ONE = 'one'; }
90
75
  static { this.MANY = 'many'; }
91
- static { this.SCHEME_SET = new Set([this.ONE, this.MANY]); }
92
- static isValid(orgType) {
93
- return this.SCHEME_SET.has(orgType);
94
- }
95
76
  }
96
77
  /** PostgreSQL row-level lock strengths for SELECT ... FOR <strength>. */
97
- export class LockStrengths {
78
+ export class LockStrengths extends ConstClass {
98
79
  static { this.UPDATE = 'update'; }
99
80
  static { this.NO_KEY_UPDATE = 'no key update'; }
100
81
  static { this.SHARE = 'share'; }
101
82
  static { this.KEY_SHARE = 'key share'; }
102
- static { this.SCHEME_SET = new Set([
103
- this.UPDATE,
104
- this.NO_KEY_UPDATE,
105
- this.SHARE,
106
- this.KEY_SHARE,
107
- ]); }
108
- static isValid(strength) {
109
- return this.SCHEME_SET.has(strength);
110
- }
111
83
  }
112
84
  /**
113
85
  * What a repository call does to rows, as the row scope (`@model` settings.access) sees it.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/repositories/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAEtC,gGAAgG;AAChG,MAAM,OAAO,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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izia/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 `query.limit.max`.\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; 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 /** 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\n/**\n * What a repository call does to rows, as the row scope (`@model` settings.access) sees it.\n * `access.resolve` receives one CONCRETE operation (READ, CREATE, UPDATE or DELETE), never a group,\n * so one function can answer a wide scope for a read and a narrow one for a write. WRITE and ALL\n * are groups of concrete operations, for application code that asks \"is this a write?\".\n */\nexport class ScopeOperations {\n // concrete: what a repository call is\n static readonly READ = 'read';\n static readonly CREATE = 'create';\n static readonly UPDATE = 'update';\n static readonly DELETE = 'delete';\n\n // groups: sets of concrete operations\n /** CREATE, UPDATE and DELETE. */\n static readonly WRITE = 'write';\n /** Every concrete operation. */\n static readonly ALL = 'all';\n\n /** All six values: the four concrete operations and the two groups. */\n static readonly SCHEME_SET = new Set<string>([\n this.READ,\n this.CREATE,\n this.UPDATE,\n this.DELETE,\n this.WRITE,\n this.ALL,\n ]);\n\n /** The concrete operations: what `access.resolve` can receive. */\n static readonly OPERATION_SET = new Set<string>([\n this.READ,\n this.CREATE,\n this.UPDATE,\n this.DELETE,\n ]);\n\n /** Which concrete operations each group holds. */\n static readonly GROUP_MAP: ReadonlyMap<string, ReadonlySet<string>> = new Map([\n [this.WRITE, new Set<string>([this.CREATE, this.UPDATE, this.DELETE])],\n [this.ALL, this.OPERATION_SET],\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n\n /**\n * Whether `operation` belongs to `group`. A concrete operation includes itself and nothing else;\n * WRITE includes CREATE, UPDATE and DELETE; ALL includes all four.\n */\n static includes(opts: { group: TScopeOperationGroup; operation: TScopeOperation }): boolean {\n const { group, operation } = opts;\n\n return group === operation || (this.GROUP_MAP.get(group)?.has(operation) ?? false);\n }\n}\n\n/** The four concrete operations: what `access.resolve` receives. Never WRITE or ALL. */\nexport type TScopeOperation =\n | typeof ScopeOperations.READ\n | typeof ScopeOperations.CREATE\n | typeof ScopeOperations.UPDATE\n | typeof ScopeOperations.DELETE;\n\n/** All six values: a concrete operation or a group. What `ScopeOperations.includes` takes as its group. */\nexport type TScopeOperationGroup = TConstValue<typeof ScopeOperations>;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/repositories/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAEtC,gGAAgG;AAChG,MAAM,OAAO,yBAA0B,SAAQ,UAAU;aACvC,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG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CAAC;IACrF,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { MessageCode } from '@venizia/ignis-helpers/core';\nimport { ConstClass } from '@venizia/ignis-helpers/common';\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 `query.limit.max`.\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 extends ConstClass {\n static readonly READ_ONLY = 'READ_ONLY';\n static readonly WRITE_ONLY = 'WRITE_ONLY';\n static readonly READ_WRITE = 'READ_WRITE';\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; REMOTE, data behind another service's API, with no model. */\nexport class RepositoryTypes extends ConstClass {\n static readonly MODEL = 'model';\n static readonly REMOTE = 'remote';\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 extends ConstClass {\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}\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 extends ConstClass {\n /** 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}\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 extends ConstClass {\n static readonly ONE = 'one';\n static readonly MANY = 'many';\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 extends ConstClass {\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}\n\n/** Valid lock strength values. */\nexport type TLockStrength = TConstValue<typeof LockStrengths>;\n\n/**\n * What a repository call does to rows, as the row scope (`@model` settings.access) sees it.\n * `access.resolve` receives one CONCRETE operation (READ, CREATE, UPDATE or DELETE), never a group,\n * so one function can answer a wide scope for a read and a narrow one for a write. WRITE and ALL\n * are groups of concrete operations, for application code that asks \"is this a write?\".\n */\nexport class ScopeOperations {\n // concrete: what a repository call is\n static readonly READ = 'read';\n static readonly CREATE = 'create';\n static readonly UPDATE = 'update';\n static readonly DELETE = 'delete';\n\n // groups: sets of concrete operations\n /** CREATE, UPDATE and DELETE. */\n static readonly WRITE = 'write';\n /** Every concrete operation. */\n static readonly ALL = 'all';\n\n /** All six values: the four concrete operations and the two groups. */\n static readonly SCHEME_SET = new Set<string>([\n this.READ,\n this.CREATE,\n this.UPDATE,\n this.DELETE,\n this.WRITE,\n this.ALL,\n ]);\n\n /** The concrete operations: what `access.resolve` can receive. */\n static readonly OPERATION_SET = new Set<string>([\n this.READ,\n this.CREATE,\n this.UPDATE,\n this.DELETE,\n ]);\n\n /** Which concrete operations each group holds. */\n static readonly GROUP_MAP: ReadonlyMap<string, ReadonlySet<string>> = new Map([\n [this.WRITE, new Set<string>([this.CREATE, this.UPDATE, this.DELETE])],\n [this.ALL, this.OPERATION_SET],\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n\n /**\n * Whether `operation` belongs to `group`. A concrete operation includes itself and nothing else;\n * WRITE includes CREATE, UPDATE and DELETE; ALL includes all four.\n */\n static includes(opts: { group: TScopeOperationGroup; operation: TScopeOperation }): boolean {\n const { group, operation } = opts;\n\n return group === operation || (this.GROUP_MAP.get(group)?.has(operation) ?? false);\n }\n}\n\n/** The four concrete operations: what `access.resolve` receives. Never WRITE or ALL. */\nexport type TScopeOperation =\n | typeof ScopeOperations.READ\n | typeof ScopeOperations.CREATE\n | typeof ScopeOperations.UPDATE\n | typeof ScopeOperations.DELETE;\n\n/** All six values: a concrete operation or a group. What `ScopeOperations.includes` takes as its group. */\nexport type TScopeOperationGroup = TConstValue<typeof ScopeOperations>;\n"]}
@@ -1,12 +1,11 @@
1
1
  import { CommonStatuses } from './common.js';
2
+ import { ConstClass } from '@venizia/ignis-helpers/common';
2
3
  /** User statuses. */
3
4
  export declare class UserStatuses extends CommonStatuses {
4
5
  }
5
6
  /** User types within the application. */
6
- export declare class UserTypes {
7
+ export declare class UserTypes extends ConstClass {
7
8
  static readonly SYSTEM = "SYSTEM";
8
9
  static readonly LINKED = "LINKED";
9
- static readonly SCHEME_SET: Set<string>;
10
- static isValid(orgType: string): boolean;
11
10
  }
12
11
  //# sourceMappingURL=user.d.ts.map
@@ -1,14 +1,11 @@
1
1
  import { CommonStatuses } from './common.js';
2
+ import { ConstClass } from '@venizia/ignis-helpers/common';
2
3
  /** User statuses. */
3
4
  export class UserStatuses extends CommonStatuses {
4
5
  }
5
6
  /** User types within the application. */
6
- export class UserTypes {
7
+ export class UserTypes extends ConstClass {
7
8
  static { this.SYSTEM = 'SYSTEM'; }
8
9
  static { this.LINKED = 'LINKED'; }
9
- static { this.SCHEME_SET = new Set([this.SYSTEM, this.LINKED]); }
10
- static isValid(orgType) {
11
- return this.SCHEME_SET.has(orgType);
12
- }
13
10
  }
14
11
  //# sourceMappingURL=user.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"user.js","sourceRoot":"","sources":["../../../../src/common/statuses/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,qBAAqB;AACrB,MAAM,OAAO,YAAa,SAAQ,cAAc;CAAG;AAEnD,yCAAyC;AACzC,MAAM,OAAO,SAAS;aACJ,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEjE,MAAM,CAAC,OAAO,CAAC,OAAe;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC","sourcesContent":["import { CommonStatuses } from './common';\n\n/** User statuses. */\nexport class UserStatuses extends CommonStatuses {}\n\n/** User types within the application. */\nexport class UserTypes {\n static readonly SYSTEM = 'SYSTEM';\n static readonly LINKED = 'LINKED';\n\n static readonly SCHEME_SET = new Set([this.SYSTEM, this.LINKED]);\n\n static isValid(orgType: string): boolean {\n return this.SCHEME_SET.has(orgType);\n }\n}\n"]}
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../../../src/common/statuses/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,qBAAqB;AACrB,MAAM,OAAO,YAAa,SAAQ,cAAc;CAAG;AAEnD,yCAAyC;AACzC,MAAM,OAAO,SAAU,SAAQ,UAAU;aACvB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC","sourcesContent":["import { CommonStatuses } from './common';\nimport { ConstClass } from '@venizia/ignis-helpers/common';\n\n/** User statuses. */\nexport class UserStatuses extends CommonStatuses {}\n\n/** User types within the application. */\nexport class UserTypes extends ConstClass {\n static readonly SYSTEM = 'SYSTEM';\n static readonly LINKED = 'LINKED';\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { TConstValue } from '@venizia/ignis-helpers/common';
2
+ import { ConstClass } from '@venizia/ignis-helpers/common';
2
3
  /** What a decorated class is to the application - the one fact the artifact generator and the registration methods both read. */
3
- export declare class ArtifactTypes {
4
+ export declare class ArtifactTypes extends ConstClass {
4
5
  static readonly CONFIGURATION = "configuration";
5
6
  static readonly COMPONENT = "component";
6
7
  static readonly CONTROLLER = "controller";
@@ -8,15 +9,11 @@ export declare class ArtifactTypes {
8
9
  static readonly REPOSITORY = "repository";
9
10
  static readonly DATASOURCE = "datasource";
10
11
  static readonly MODEL = "model";
11
- static readonly SCHEME_SET: Set<string>;
12
- static isValid(value: string): boolean;
13
12
  }
14
13
  /** The `format` of `getAuthorizeModelPrincipals` and `getAuthorizeModelSettings`: ARRAY or RECORD. */
15
- export declare class AuthorizeModelFormats {
14
+ export declare class AuthorizeModelFormats extends ConstClass {
16
15
  static readonly ARRAY = "array";
17
16
  static readonly RECORD = "record";
18
- static readonly SCHEME_SET: Set<string>;
19
- static isValid(value: string): boolean;
20
17
  }
21
18
  /** Valid authorize model format values. */
22
19
  export type TAuthorizeModelFormat = TConstValue<typeof AuthorizeModelFormats>;
@@ -1,5 +1,6 @@
1
+ import { ConstClass } from '@venizia/ignis-helpers/common';
1
2
  /** What a decorated class is to the application - the one fact the artifact generator and the registration methods both read. */
2
- export class ArtifactTypes {
3
+ export class ArtifactTypes extends ConstClass {
3
4
  static { this.CONFIGURATION = 'configuration'; }
4
5
  static { this.COMPONENT = 'component'; }
5
6
  static { this.CONTROLLER = 'controller'; }
@@ -7,26 +8,10 @@ export class ArtifactTypes {
7
8
  static { this.REPOSITORY = 'repository'; }
8
9
  static { this.DATASOURCE = 'datasource'; }
9
10
  static { this.MODEL = 'model'; }
10
- static { this.SCHEME_SET = new Set([
11
- this.CONFIGURATION,
12
- this.COMPONENT,
13
- this.CONTROLLER,
14
- this.SERVICE,
15
- this.REPOSITORY,
16
- this.DATASOURCE,
17
- this.MODEL,
18
- ]); }
19
- static isValid(value) {
20
- return this.SCHEME_SET.has(value);
21
- }
22
11
  }
23
12
  /** The `format` of `getAuthorizeModelPrincipals` and `getAuthorizeModelSettings`: ARRAY or RECORD. */
24
- export class AuthorizeModelFormats {
13
+ export class AuthorizeModelFormats extends ConstClass {
25
14
  static { this.ARRAY = 'array'; }
26
15
  static { this.RECORD = 'record'; }
27
- static { this.SCHEME_SET = new Set([this.ARRAY, this.RECORD]); }
28
- static isValid(value) {
29
- return this.SCHEME_SET.has(value);
30
- }
31
16
  }
32
17
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/helpers/inversion/common/constants.ts"],"names":[],"mappings":"AAEA,iIAAiI;AACjI,MAAM,OAAO,aAAa;aACR,kBAAa,GAAG,eAAe,CAAC;aAChC,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,YAAY,CAAC;aAC1B,YAAO,GAAG,SAAS,CAAC;aACpB,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,YAAY,CAAC;aAC1B,UAAK,GAAG,OAAO,CAAC;aAEhB,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,aAAa;QAClB,IAAI,CAAC,SAAS;QACd,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,KAAK;KACX,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAGH,sGAAsG;AACtG,MAAM,OAAO,qBAAqB;aAChB,UAAK,GAAG,OAAO,CAAC;aAChB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAExE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\n\n/** What a decorated class is to the application - the one fact the artifact generator and the registration methods both read. */\nexport class ArtifactTypes {\n static readonly CONFIGURATION = 'configuration';\n static readonly COMPONENT = 'component';\n static readonly CONTROLLER = 'controller';\n static readonly SERVICE = 'service';\n static readonly REPOSITORY = 'repository';\n static readonly DATASOURCE = 'datasource';\n static readonly MODEL = 'model';\n\n static readonly SCHEME_SET = new Set<string>([\n this.CONFIGURATION,\n this.COMPONENT,\n this.CONTROLLER,\n this.SERVICE,\n this.REPOSITORY,\n this.DATASOURCE,\n this.MODEL,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** The `format` of `getAuthorizeModelPrincipals` and `getAuthorizeModelSettings`: ARRAY or RECORD. */\nexport class AuthorizeModelFormats {\n static readonly ARRAY = 'array';\n static readonly RECORD = 'record';\n\n static readonly SCHEME_SET = new Set<string>([this.ARRAY, this.RECORD]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid authorize model format values. */\nexport type TAuthorizeModelFormat = TConstValue<typeof AuthorizeModelFormats>;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/helpers/inversion/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,iIAAiI;AACjI,MAAM,OAAO,aAAc,SAAQ,UAAU;aAC3B,kBAAa,GAAG,eAAe,CAAC;aAChC,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,YAAY,CAAC;aAC1B,YAAO,GAAG,SAAS,CAAC;aACpB,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,YAAY,CAAC;aAC1B,UAAK,GAAG,OAAO,CAAC;;AAGlC,sGAAsG;AACtG,MAAM,OAAO,qBAAsB,SAAQ,UAAU;aACnC,UAAK,GAAG,OAAO,CAAC;aAChB,WAAM,GAAG,QAAQ,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { ConstClass } from '@venizia/ignis-helpers/common';\n\n/** What a decorated class is to the application - the one fact the artifact generator and the registration methods both read. */\nexport class ArtifactTypes extends ConstClass {\n static readonly CONFIGURATION = 'configuration';\n static readonly COMPONENT = 'component';\n static readonly CONTROLLER = 'controller';\n static readonly SERVICE = 'service';\n static readonly REPOSITORY = 'repository';\n static readonly DATASOURCE = 'datasource';\n static readonly MODEL = 'model';\n}\n\n/** The `format` of `getAuthorizeModelPrincipals` and `getAuthorizeModelSettings`: ARRAY or RECORD. */\nexport class AuthorizeModelFormats extends ConstClass {\n static readonly ARRAY = 'array';\n static readonly RECORD = 'record';\n}\n\n/** Valid authorize model format values. */\nexport type TAuthorizeModelFormat = TConstValue<typeof AuthorizeModelFormats>;\n"]}
@@ -172,7 +172,7 @@ export interface IModelProperties {
172
172
  /**
173
173
  * Properties the server fills on every write, which a generated create or update body leaves out.
174
174
  *
175
- * @default AuditFields.SCHEME_SET
175
+ * @default AuditFields.values()
176
176
  */
177
177
  stamped?: ReadonlyArray<string> | ReadonlySet<string>;
178
178
  }