@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,6 +1,7 @@
1
1
  import type { TConstValue, ValueOrPromise } from '@venizia/ignis-helpers/common';
2
+ import { ConstClass } from '@venizia/ignis-helpers/common';
2
3
  /** The step names the kernel defines - the vocabulary a subclass targets with `BootSequence.insertAfter`. A server application adds its own on top (`ServerBootSteps` in `@venizia/ignis`). */
3
- export declare class BootSteps {
4
+ export declare class BootSteps extends ConstClass {
4
5
  static readonly STATIC_CONFIGURE = "staticConfigure";
5
6
  static readonly REGISTER_ARTIFACTS = "registerArtifacts";
6
7
  static readonly PRE_CONFIGURE = "preConfigure";
@@ -12,8 +13,6 @@ export declare class BootSteps {
12
13
  static readonly REGISTER_CONTROLLERS = "registerControllers";
13
14
  static readonly POST_CONFIGURE = "postConfigure";
14
15
  static readonly VERIFY_BINDINGS = "verifyBindings";
15
- static readonly SCHEME_SET: Set<string>;
16
- static isValid(value: string): boolean;
17
16
  }
18
17
  /** Union of the step names in `BootSteps`. */
19
18
  export type TBootStep = TConstValue<typeof BootSteps>;
@@ -1,6 +1,7 @@
1
1
  import { getError } from '@venizia/ignis-helpers/core';
2
+ import { ConstClass } from '@venizia/ignis-helpers/common';
2
3
  /** The step names the kernel defines - the vocabulary a subclass targets with `BootSequence.insertAfter`. A server application adds its own on top (`ServerBootSteps` in `@venizia/ignis`). */
3
- export class BootSteps {
4
+ export class BootSteps extends ConstClass {
4
5
  static { this.STATIC_CONFIGURE = 'staticConfigure'; }
5
6
  static { this.REGISTER_ARTIFACTS = 'registerArtifacts'; }
6
7
  static { this.PRE_CONFIGURE = 'preConfigure'; }
@@ -12,22 +13,6 @@ export class BootSteps {
12
13
  static { this.REGISTER_CONTROLLERS = 'registerControllers'; }
13
14
  static { this.POST_CONFIGURE = 'postConfigure'; }
14
15
  static { this.VERIFY_BINDINGS = 'verifyBindings'; }
15
- static { this.SCHEME_SET = new Set([
16
- this.STATIC_CONFIGURE,
17
- this.REGISTER_ARTIFACTS,
18
- this.PRE_CONFIGURE,
19
- this.REGISTER_DEFAULT_MIDDLEWARES,
20
- this.REGISTER_CONFIGURATIONS,
21
- this.REGISTER_DATA_SOURCES,
22
- this.REGISTER_COMPONENTS,
23
- this.REGISTER_CONTRIBUTED_DATA_SOURCES,
24
- this.REGISTER_CONTROLLERS,
25
- this.POST_CONFIGURE,
26
- this.VERIFY_BINDINGS,
27
- ]); }
28
- static isValid(value) {
29
- return this.SCHEME_SET.has(value);
30
- }
31
16
  }
32
17
  /** Composes a boot sequence by name instead of copying the array - a subclass reads exactly what it adds by reading its own override, without diffing two files by eye. */
33
18
  export class BootSequence {
@@ -1 +1 @@
1
- {"version":3,"file":"boot-sequence.js","sourceRoot":"","sources":["../../../../src/base/applications/boot-sequence.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,+LAA+L;AAC/L,MAAM,OAAO,SAAS;aACJ,qBAAgB,GAAG,iBAAiB,CAAC;aACrC,uBAAkB,GAAG,mBAAmB,CAAC;aACzC,kBAAa,GAAG,cAAc,CAAC;aAC/B,iCAA4B,GAAG,4BAA4B,CAAC;aAC5D,4BAAuB,GAAG,wBAAwB,CAAC;aACnD,0BAAqB,GAAG,qBAAqB,CAAC;aAC9C,wBAAmB,GAAG,oBAAoB,CAAC;aAC3C,sCAAiC,GAAG,gCAAgC,CAAC;aACrE,yBAAoB,GAAG,qBAAqB,CAAC;aAC7C,mBAAc,GAAG,eAAe,CAAC;aACjC,oBAAe,GAAG,gBAAgB,CAAC;aACnC,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,gBAAgB;QACrB,IAAI,CAAC,kBAAkB;QACvB,IAAI,CAAC,aAAa;QAClB,IAAI,CAAC,4BAA4B;QACjC,IAAI,CAAC,uBAAuB;QAC5B,IAAI,CAAC,qBAAqB;QAC1B,IAAI,CAAC,mBAAmB;QACxB,IAAI,CAAC,iCAAiC;QACtC,IAAI,CAAC,oBAAoB;QACzB,IAAI,CAAC,cAAc;QACnB,IAAI,CAAC,eAAe;KACrB,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAYH,2KAA2K;AAC3K,MAAM,OAAO,YAAY;IACvB,2IAA2I;IACnI,MAAM,CAAC,OAAO,CAAC,IAAoD;QACzE,MAAM,EAAE,KAA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esContent":["import type { TConstValue, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\n\n/** The step names the kernel defines - the vocabulary a subclass targets with `BootSequence.insertAfter`. A server application adds its own on top (`ServerBootSteps` in `@venizia/ignis`). */\nexport class BootSteps {\n static readonly STATIC_CONFIGURE = 'staticConfigure';\n static readonly REGISTER_ARTIFACTS = 'registerArtifacts';\n static readonly PRE_CONFIGURE = 'preConfigure';\n static readonly REGISTER_DEFAULT_MIDDLEWARES = 'registerDefaultMiddlewares';\n static readonly REGISTER_CONFIGURATIONS = 'registerConfigurations';\n static readonly REGISTER_DATA_SOURCES = 'registerDataSources';\n static readonly REGISTER_COMPONENTS = 'registerComponents';\n static readonly REGISTER_CONTRIBUTED_DATA_SOURCES = 'registerContributedDataSources';\n static readonly REGISTER_CONTROLLERS = 'registerControllers';\n static readonly POST_CONFIGURE = 'postConfigure';\n static readonly VERIFY_BINDINGS = 'verifyBindings';\n static readonly SCHEME_SET = new Set<string>([\n this.STATIC_CONFIGURE,\n this.REGISTER_ARTIFACTS,\n this.PRE_CONFIGURE,\n this.REGISTER_DEFAULT_MIDDLEWARES,\n this.REGISTER_CONFIGURATIONS,\n this.REGISTER_DATA_SOURCES,\n this.REGISTER_COMPONENTS,\n this.REGISTER_CONTRIBUTED_DATA_SOURCES,\n this.REGISTER_CONTROLLERS,\n this.POST_CONFIGURE,\n this.VERIFY_BINDINGS,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Union of the step names in `BootSteps`. */\nexport type TBootStep = TConstValue<typeof BootSteps>;\n\n/** One named step of a boot sequence. `name` is what `BootSequence.insertAfter` targets; `run` is the work done when the sequence reaches the step. */\nexport interface IBootSequenceStep {\n name: string;\n run: () => ValueOrPromise<void>;\n}\n\n/** Composes a boot sequence by name instead of copying the array - a subclass reads exactly what it adds by reading its own override, without diffing two files by eye. */\nexport class BootSequence {\n /** A duplicated name is refused as loudly as a missing one - picking the first match would splice a step into the wrong place silently. */\n private static indexOf(opts: { steps: IBootSequenceStep[]; target: string }): number {\n const { steps, target } = opts;\n const matches = steps.flatMap((step, index) => (step.name === target ? [index] : []));\n const known = steps.map((step) => step.name).join(', ');\n\n switch (matches.length) {\n case 0: {\n throw getError({\n message: `[BootSequence] Unknown step: '${target}' | Known steps: ${known}`,\n });\n }\n case 1: {\n return matches[0];\n }\n default: {\n throw getError({\n message: `[BootSequence] Ambiguous step: '${target}' appears ${matches.length} times | Known steps: ${known}`,\n });\n }\n }\n }\n\n static insertAfter(opts: {\n steps: IBootSequenceStep[];\n target: string;\n step: IBootSequenceStep;\n }): IBootSequenceStep[] {\n const { steps, target, step } = opts;\n const index = BootSequence.indexOf({ steps, target });\n\n return [...steps.slice(0, index + 1), step, ...steps.slice(index + 1)];\n }\n}\n"]}
1
+ {"version":3,"file":"boot-sequence.js","sourceRoot":"","sources":["../../../../src/base/applications/boot-sequence.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,+LAA+L;AAC/L,MAAM,OAAO,SAAU,SAAQ,UAAU;aACvB,qBAAgB,GAAG,iBAAiB,CAAC;aACrC,uBAAkB,GAAG,mBAAmB,CAAC;aACzC,kBAAa,GAAG,cAAc,CAAC;aAC/B,iCAA4B,GAAG,4BAA4B,CAAC;aAC5D,4BAAuB,GAAG,wBAAwB,CAAC;aACnD,0BAAqB,GAAG,qBAAqB,CAAC;aAC9C,wBAAmB,GAAG,oBAAoB,CAAC;aAC3C,sCAAiC,GAAG,gCAAgC,CAAC;aACrE,yBAAoB,GAAG,qBAAqB,CAAC;aAC7C,mBAAc,GAAG,eAAe,CAAC;aACjC,oBAAe,GAAG,gBAAgB,CAAC;;AAYrD,2KAA2K;AAC3K,MAAM,OAAO,YAAY;IACvB,2IAA2I;IACnI,MAAM,CAAC,OAAO,CAAC,IAAo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AC;IACzE,CAAC;CACF","sourcesContent":["import type { TConstValue, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { ConstClass } from '@venizia/ignis-helpers/common';\n\n/** The step names the kernel defines - the vocabulary a subclass targets with `BootSequence.insertAfter`. A server application adds its own on top (`ServerBootSteps` in `@venizia/ignis`). */\nexport class BootSteps extends ConstClass {\n static readonly STATIC_CONFIGURE = 'staticConfigure';\n static readonly REGISTER_ARTIFACTS = 'registerArtifacts';\n static readonly PRE_CONFIGURE = 'preConfigure';\n static readonly REGISTER_DEFAULT_MIDDLEWARES = 'registerDefaultMiddlewares';\n static readonly REGISTER_CONFIGURATIONS = 'registerConfigurations';\n static readonly REGISTER_DATA_SOURCES = 'registerDataSources';\n static readonly REGISTER_COMPONENTS = 'registerComponents';\n static readonly REGISTER_CONTRIBUTED_DATA_SOURCES = 'registerContributedDataSources';\n static readonly REGISTER_CONTROLLERS = 'registerControllers';\n static readonly POST_CONFIGURE = 'postConfigure';\n static readonly VERIFY_BINDINGS = 'verifyBindings';\n}\n\n/** Union of the step names in `BootSteps`. */\nexport type TBootStep = TConstValue<typeof BootSteps>;\n\n/** One named step of a boot sequence. `name` is what `BootSequence.insertAfter` targets; `run` is the work done when the sequence reaches the step. */\nexport interface IBootSequenceStep {\n name: string;\n run: () => ValueOrPromise<void>;\n}\n\n/** Composes a boot sequence by name instead of copying the array - a subclass reads exactly what it adds by reading its own override, without diffing two files by eye. */\nexport class BootSequence {\n /** A duplicated name is refused as loudly as a missing one - picking the first match would splice a step into the wrong place silently. */\n private static indexOf(opts: { steps: IBootSequenceStep[]; target: string }): number {\n const { steps, target } = opts;\n const matches = steps.flatMap((step, index) => (step.name === target ? [index] : []));\n const known = steps.map((step) => step.name).join(', ');\n\n switch (matches.length) {\n case 0: {\n throw getError({\n message: `[BootSequence] Unknown step: '${target}' | Known steps: ${known}`,\n });\n }\n case 1: {\n return matches[0];\n }\n default: {\n throw getError({\n message: `[BootSequence] Ambiguous step: '${target}' appears ${matches.length} times | Known steps: ${known}`,\n });\n }\n }\n }\n\n static insertAfter(opts: {\n steps: IBootSequenceStep[];\n target: string;\n step: IBootSequenceStep;\n }): IBootSequenceStep[] {\n const { steps, target, step } = opts;\n const index = BootSequence.indexOf({ steps, target });\n\n return [...steps.slice(0, index + 1), step, ...steps.slice(index + 1)];\n }\n}\n"]}
@@ -1,25 +1,22 @@
1
1
  import type { TConstValue } from '@venizia/ignis-helpers/common';
2
+ import { ConstClass } from '@venizia/ignis-helpers/common';
2
3
  /** The `IArtifactIndex` field names, in registration order. `@venizia/ignis-boot` mirrors these values in its own `ArtifactIndexFields` - boot cannot depend on kernel. */
3
- export declare class ArtifactIndexFields {
4
+ export declare class ArtifactIndexFields extends ConstClass {
4
5
  static readonly CONFIGURATIONS = "configurations";
5
6
  static readonly DATA_SOURCES = "dataSources";
6
7
  static readonly COMPONENTS = "components";
7
8
  static readonly REPOSITORIES = "repositories";
8
9
  static readonly SERVICES = "services";
9
10
  static readonly CONTROLLERS = "controllers";
10
- static readonly SCHEME_SET: Set<string>;
11
- static isValid(value: string): boolean;
12
11
  }
13
12
  /** Union of the `ArtifactIndexFields` values. */
14
13
  export type TArtifactIndexField = TConstValue<typeof ArtifactIndexFields>;
15
14
  /** The values of the `Sec-Fetch-Site` request header, the vocabulary of `TSecFetchSite`. */
16
15
  export declare const SecFetchSiteValues: readonly ["same-origin", "same-site", "none", "cross-site"];
17
16
  /** The `encoding` of `ICompressOptions`. */
18
- export declare class CompressEncodings {
17
+ export declare class CompressEncodings extends ConstClass {
19
18
  static readonly GZIP = "gzip";
20
19
  static readonly DEFLATE = "deflate";
21
- static readonly SCHEME_SET: Set<string>;
22
- static isValid(value: string): boolean;
23
20
  }
24
21
  /** Valid compress encoding values. */
25
22
  export type TCompressEncoding = TConstValue<typeof CompressEncodings>;
@@ -1,32 +1,18 @@
1
+ import { ConstClass } from '@venizia/ignis-helpers/common';
1
2
  /** The `IArtifactIndex` field names, in registration order. `@venizia/ignis-boot` mirrors these values in its own `ArtifactIndexFields` - boot cannot depend on kernel. */
2
- export class ArtifactIndexFields {
3
+ export class ArtifactIndexFields extends ConstClass {
3
4
  static { this.CONFIGURATIONS = 'configurations'; }
4
5
  static { this.DATA_SOURCES = 'dataSources'; }
5
6
  static { this.COMPONENTS = 'components'; }
6
7
  static { this.REPOSITORIES = 'repositories'; }
7
8
  static { this.SERVICES = 'services'; }
8
9
  static { this.CONTROLLERS = 'controllers'; }
9
- static { this.SCHEME_SET = new Set([
10
- this.CONFIGURATIONS,
11
- this.DATA_SOURCES,
12
- this.COMPONENTS,
13
- this.REPOSITORIES,
14
- this.SERVICES,
15
- this.CONTROLLERS,
16
- ]); }
17
- static isValid(value) {
18
- return this.SCHEME_SET.has(value);
19
- }
20
10
  }
21
11
  /** The values of the `Sec-Fetch-Site` request header, the vocabulary of `TSecFetchSite`. */
22
12
  export const SecFetchSiteValues = ['same-origin', 'same-site', 'none', 'cross-site'];
23
13
  /** The `encoding` of `ICompressOptions`. */
24
- export class CompressEncodings {
14
+ export class CompressEncodings extends ConstClass {
25
15
  static { this.GZIP = 'gzip'; }
26
16
  static { this.DEFLATE = 'deflate'; }
27
- static { this.SCHEME_SET = new Set([this.GZIP, this.DEFLATE]); }
28
- static isValid(value) {
29
- return this.SCHEME_SET.has(value);
30
- }
31
17
  }
32
18
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/applications/common/constants.ts"],"names":[],"mappings":"AAEA,2KAA2K;AAC3K,MAAM,OAAO,mBAAmB;aACd,mBAAc,GAAG,gBAAgB,CAAC;aAClC,iBAAY,GAAG,aAAa,CAAC;aAC7B,eAAU,GAAG,YAAY,CAAC;aAC1B,iBAAY,GAAG,cAAc,CAAC;aAC9B,aAAQ,GAAG,UAAU,CAAC;aACtB,gBAAW,GAAG,aAAa,CAAC;aAE5B,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,cAAc;QACnB,IAAI,CAAC,YAAY;QACjB,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,YAAY;QACjB,IAAI,CAAC,QAAQ;QACb,IAAI,CAAC,WAAW;KACjB,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,4FAA4F;AAC5F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,CAAU,CAAC;AAE9F,4CAA4C;AAC5C,MAAM,OAAO,iBAAiB;aACZ,SAAI,GAAG,MAAM,CAAC;aACd,YAAO,GAAG,SAAS,CAAC;aAEpB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,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/** The `IArtifactIndex` field names, in registration order. `@venizia/ignis-boot` mirrors these values in its own `ArtifactIndexFields` - boot cannot depend on kernel. */\nexport class ArtifactIndexFields {\n static readonly CONFIGURATIONS = 'configurations';\n static readonly DATA_SOURCES = 'dataSources';\n static readonly COMPONENTS = 'components';\n static readonly REPOSITORIES = 'repositories';\n static readonly SERVICES = 'services';\n static readonly CONTROLLERS = 'controllers';\n\n static readonly SCHEME_SET = new Set<string>([\n this.CONFIGURATIONS,\n this.DATA_SOURCES,\n this.COMPONENTS,\n this.REPOSITORIES,\n this.SERVICES,\n this.CONTROLLERS,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Union of the `ArtifactIndexFields` values. */\nexport type TArtifactIndexField = TConstValue<typeof ArtifactIndexFields>;\n\n/** The values of the `Sec-Fetch-Site` request header, the vocabulary of `TSecFetchSite`. */\nexport const SecFetchSiteValues = ['same-origin', 'same-site', 'none', 'cross-site'] as const;\n\n/** The `encoding` of `ICompressOptions`. */\nexport class CompressEncodings {\n static readonly GZIP = 'gzip';\n static readonly DEFLATE = 'deflate';\n\n static readonly SCHEME_SET = new Set<string>([this.GZIP, this.DEFLATE]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid compress encoding values. */\nexport type TCompressEncoding = TConstValue<typeof CompressEncodings>;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/applications/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,2KAA2K;AAC3K,MAAM,OAAO,mBAAoB,SAAQ,UAAU;aACjC,mBAAc,GAAG,gBAAgB,CAAC;aAClC,iBAAY,GAAG,aAAa,CAAC;aAC7B,eAAU,GAAG,YAAY,CAAC;aAC1B,iBAAY,GAAG,cAAc,CAAC;aAC9B,aAAQ,GAAG,UAAU,CAAC;aACtB,gBAAW,GAAG,aAAa,CAAC;;AAM9C,4FAA4F;AAC5F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,CAAU,CAAC;AAE9F,4CAA4C;AAC5C,MAAM,OAAO,iBAAkB,SAAQ,UAAU;aAC/B,SAAI,GAAG,MAAM,CAAC;aACd,YAAO,GAAG,SAAS,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { ConstClass } from '@venizia/ignis-helpers/common';\n\n/** The `IArtifactIndex` field names, in registration order. `@venizia/ignis-boot` mirrors these values in its own `ArtifactIndexFields` - boot cannot depend on kernel. */\nexport class ArtifactIndexFields extends ConstClass {\n static readonly CONFIGURATIONS = 'configurations';\n static readonly DATA_SOURCES = 'dataSources';\n static readonly COMPONENTS = 'components';\n static readonly REPOSITORIES = 'repositories';\n static readonly SERVICES = 'services';\n static readonly CONTROLLERS = 'controllers';\n}\n\n/** Union of the `ArtifactIndexFields` values. */\nexport type TArtifactIndexField = TConstValue<typeof ArtifactIndexFields>;\n\n/** The values of the `Sec-Fetch-Site` request header, the vocabulary of `TSecFetchSite`. */\nexport const SecFetchSiteValues = ['same-origin', 'same-site', 'none', 'cross-site'] as const;\n\n/** The `encoding` of `ICompressOptions`. */\nexport class CompressEncodings extends ConstClass {\n static readonly GZIP = 'gzip';\n static readonly DEFLATE = 'deflate';\n}\n\n/** Valid compress encoding values. */\nexport type TCompressEncoding = TConstValue<typeof CompressEncodings>;\n"]}
@@ -1,12 +1,10 @@
1
1
  import type { TConstValue } from '@venizia/ignis-helpers/common';
2
+ import { ConstClass } from '@venizia/ignis-helpers/common';
2
3
  /** Names of the strategies the framework ships: `basic`, `jwt` and `service`. */
3
- export declare class AuthenticateStrategy {
4
+ export declare class AuthenticateStrategy extends ConstClass {
4
5
  static readonly BASIC = "basic";
5
6
  static readonly JWT = "jwt";
6
7
  static readonly SERVICE = "service";
7
- /** The strategies the FRAMEWORK ships. An application registers its own beyond these. */
8
- static readonly SCHEME_SET: Set<string>;
9
- static isValid(input: string): boolean;
10
8
  }
11
9
  /** A strategy name: a built-in from `AuthenticateStrategy` or any name an application registers. */
12
10
  export type TAuthStrategy = TConstValue<typeof AuthenticateStrategy> | (string & {});
@@ -29,11 +27,9 @@ export declare class AuthenticationTokenTypes {
29
27
  static readonly TYPE_REFRESH_TOKEN = "200_REFRESH_TOKEN";
30
28
  }
31
29
  /** How the `authenticate` middleware combines several strategies: `any` passes when one succeeds, `all` requires every one to succeed. */
32
- export declare class AuthenticationModes {
30
+ export declare class AuthenticationModes extends ConstClass {
33
31
  static readonly ANY = "any";
34
32
  static readonly ALL = "all";
35
- static readonly SCHEME_SET: Set<string>;
36
- static isValid(input: string): boolean;
37
33
  }
38
34
  /** A valid value of `AuthenticationModes`. */
39
35
  export type TAuthMode = TConstValue<typeof AuthenticationModes>;
@@ -1,13 +1,9 @@
1
+ import { ConstClass } from '@venizia/ignis-helpers/common';
1
2
  /** Names of the strategies the framework ships: `basic`, `jwt` and `service`. */
2
- export class AuthenticateStrategy {
3
+ export class AuthenticateStrategy extends ConstClass {
3
4
  static { this.BASIC = 'basic'; }
4
5
  static { this.JWT = 'jwt'; }
5
6
  static { this.SERVICE = 'service'; }
6
- /** The strategies the FRAMEWORK ships. An application registers its own beyond these. */
7
- static { this.SCHEME_SET = new Set([this.BASIC, this.JWT, this.SERVICE]); }
8
- static isValid(input) {
9
- return this.SCHEME_SET.has(input);
10
- }
11
7
  }
12
8
  /** Shared auth string constants: strategy names, `Authorization` header token types, and the request-context keys the authentication middleware reads and writes. */
13
9
  export class Authentication {
@@ -30,12 +26,8 @@ export class AuthenticationTokenTypes {
30
26
  static { this.TYPE_REFRESH_TOKEN = '200_REFRESH_TOKEN'; }
31
27
  }
32
28
  /** How the `authenticate` middleware combines several strategies: `any` passes when one succeeds, `all` requires every one to succeed. */
33
- export class AuthenticationModes {
29
+ export class AuthenticationModes extends ConstClass {
34
30
  static { this.ANY = 'any'; }
35
31
  static { this.ALL = 'all'; }
36
- static { this.SCHEME_SET = new Set([this.ANY, this.ALL]); }
37
- static isValid(input) {
38
- return this.SCHEME_SET.has(input);
39
- }
40
32
  }
41
33
  //# sourceMappingURL=authentication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authenticate/common/constants/authentication.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,MAAM,OAAO,oBAAoB;aACf,UAAK,GAAG,OAAO,CAAC;aAChB,QAAG,GAAG,KAAK,CAAC;aACZ,YAAO,GAAG,SAAS,CAAC;IAEpC,yFAAyF;aACzE,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3E,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAQH,qKAAqK;AACrK,MAAM,OAAO,cAAc;IACzB,WAAW;aACK,mBAAc,GAAG,oBAAoB,CAAC,KAAK,CAAC;aAC5C,iBAAY,GAAG,oBAAoB,CAAC,GAAG,CAAC;aACxC,qBAAgB,GAAG,oBAAoB,CAAC,OAAO,CAAC;IAEhE,aAAa;aACG,eAAU,GAAG,OAAO,CAAC;aACrB,gBAAW,GAAG,QAAQ,CAAC;aAEvB,4BAAuB,GAAG,yBAAyB,CAAC;aACpD,wBAAmB,GAAG,qBAAqB,CAAC;aAE5C,iBAAY,GAAG,mBAAmB,CAAC;aACnC,kBAAa,GAAG,eAAe,CAAC;;AAGlD,qGAAqG;AACrG,MAAM,OAAO,wBAAwB;aACnB,4BAAuB,GAAG,wBAAwB,CAAC;aACnD,sBAAiB,GAAG,kBAAkB,CAAC;aACvC,uBAAkB,GAAG,mBAAmB,CAAC;;AAG3D,0IAA0I;AAC1I,MAAM,OAAO,mBAAmB;aACd,QAAG,GAAG,KAAK,CAAC;aACZ,QAAG,GAAG,KAAK,CAAC;aAEZ,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAE3D,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/** Names of the strategies the framework ships: `basic`, `jwt` and `service`. */\nexport class AuthenticateStrategy {\n static readonly BASIC = 'basic';\n static readonly JWT = 'jwt';\n static readonly SERVICE = 'service';\n\n /** The strategies the FRAMEWORK ships. An application registers its own beyond these. */\n static readonly SCHEME_SET = new Set([this.BASIC, this.JWT, this.SERVICE]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n\n// `(string & {})` keeps autocomplete for the built-in values while still accepting any name an\n// application registers with `AuthenticationStrategyRegistry`. Same idiom as `TDataSourceDriver`.\n/** A strategy name: a built-in from `AuthenticateStrategy` or any name an application registers. */\nexport type TAuthStrategy = TConstValue<typeof AuthenticateStrategy> | (string & {});\n\n/** Shared auth string constants: strategy names, `Authorization` header token types, and the request-context keys the authentication middleware reads and writes. */\nexport class Authentication {\n // Strategy\n static readonly STRATEGY_BASIC = AuthenticateStrategy.BASIC;\n static readonly STRATEGY_JWT = AuthenticateStrategy.JWT;\n static readonly STRATEGY_SERVICE = AuthenticateStrategy.SERVICE;\n\n // Token type\n static readonly TYPE_BASIC = 'Basic';\n static readonly TYPE_BEARER = 'Bearer';\n\n static readonly AUTHENTICATION_STRATEGY = 'authentication.strategy';\n static readonly SKIP_AUTHENTICATION = 'authentication.skip';\n\n static readonly CURRENT_USER = 'auth.current.user';\n static readonly AUDIT_USER_ID = 'audit.user.id';\n}\n\n/** Token type tags, each prefixed with a number: authorization code, access token, refresh token. */\nexport class AuthenticationTokenTypes {\n static readonly TYPE_AUTHORIZATION_CODE = '000_AUTHORIZATION_CODE';\n static readonly TYPE_ACCESS_TOKEN = '100_ACCESS_TOKEN';\n static readonly TYPE_REFRESH_TOKEN = '200_REFRESH_TOKEN';\n}\n\n/** How the `authenticate` middleware combines several strategies: `any` passes when one succeeds, `all` requires every one to succeed. */\nexport class AuthenticationModes {\n static readonly ANY = 'any';\n static readonly ALL = 'all';\n\n static readonly SCHEME_SET = new Set([this.ANY, this.ALL]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n\n/** A valid value of `AuthenticationModes`. */\nexport type TAuthMode = TConstValue<typeof AuthenticationModes>;\n"]}
1
+ {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authenticate/common/constants/authentication.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,iFAAiF;AACjF,MAAM,OAAO,oBAAqB,SAAQ,UAAU;aAClC,UAAK,GAAG,OAAO,CAAC;aAChB,QAAG,GAAG,KAAK,CAAC;aACZ,YAAO,GAAG,SAAS,CAAC;;AAQtC,qKAAqK;AACrK,MAAM,OAAO,cAAc;IACzB,WAAW;aACK,mBAAc,GAAG,oBAAoB,CAAC,KAAK,CAAC;aAC5C,iBAAY,GAAG,oBAAoB,CAAC,GAAG,CAAC;aACxC,qBAAgB,GAAG,oBAAoB,CAAC,OAAO,CAAC;IAEhE,aAAa;aACG,eAAU,GAAG,OAAO,CAAC;aACrB,gBAAW,GAAG,QAAQ,CAAC;aAEvB,4BAAuB,GAAG,yBAAyB,CAAC;aACpD,wBAAmB,GAAG,qBAAqB,CAAC;aAE5C,iBAAY,GAAG,mBAAmB,CAAC;aACnC,kBAAa,GAAG,eAAe,CAAC;;AAGlD,qGAAqG;AACrG,MAAM,OAAO,wBAAwB;aACnB,4BAAuB,GAAG,wBAAwB,CAAC;aACnD,sBAAiB,GAAG,kBAAkB,CAAC;aACvC,uBAAkB,GAAG,mBAAmB,CAAC;;AAG3D,0IAA0I;AAC1I,MAAM,OAAO,mBAAoB,SAAQ,UAAU;aACjC,QAAG,GAAG,KAAK,CAAC;aACZ,QAAG,GAAG,KAAK,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { ConstClass } from '@venizia/ignis-helpers/common';\n\n/** Names of the strategies the framework ships: `basic`, `jwt` and `service`. */\nexport class AuthenticateStrategy extends ConstClass {\n static readonly BASIC = 'basic';\n static readonly JWT = 'jwt';\n static readonly SERVICE = 'service';\n}\n\n// `(string & {})` keeps autocomplete for the built-in values while still accepting any name an\n// application registers with `AuthenticationStrategyRegistry`. Same idiom as `TDataSourceDriver`.\n/** A strategy name: a built-in from `AuthenticateStrategy` or any name an application registers. */\nexport type TAuthStrategy = TConstValue<typeof AuthenticateStrategy> | (string & {});\n\n/** Shared auth string constants: strategy names, `Authorization` header token types, and the request-context keys the authentication middleware reads and writes. */\nexport class Authentication {\n // Strategy\n static readonly STRATEGY_BASIC = AuthenticateStrategy.BASIC;\n static readonly STRATEGY_JWT = AuthenticateStrategy.JWT;\n static readonly STRATEGY_SERVICE = AuthenticateStrategy.SERVICE;\n\n // Token type\n static readonly TYPE_BASIC = 'Basic';\n static readonly TYPE_BEARER = 'Bearer';\n\n static readonly AUTHENTICATION_STRATEGY = 'authentication.strategy';\n static readonly SKIP_AUTHENTICATION = 'authentication.skip';\n\n static readonly CURRENT_USER = 'auth.current.user';\n static readonly AUDIT_USER_ID = 'audit.user.id';\n}\n\n/** Token type tags, each prefixed with a number: authorization code, access token, refresh token. */\nexport class AuthenticationTokenTypes {\n static readonly TYPE_AUTHORIZATION_CODE = '000_AUTHORIZATION_CODE';\n static readonly TYPE_ACCESS_TOKEN = '100_ACCESS_TOKEN';\n static readonly TYPE_REFRESH_TOKEN = '200_REFRESH_TOKEN';\n}\n\n/** How the `authenticate` middleware combines several strategies: `any` passes when one succeeds, `all` requires every one to succeed. */\nexport class AuthenticationModes extends ConstClass {\n static readonly ANY = 'any';\n static readonly ALL = 'all';\n}\n\n/** A valid value of `AuthenticationModes`. */\nexport type TAuthMode = TConstValue<typeof AuthenticationModes>;\n"]}
@@ -1,47 +1,38 @@
1
1
  import type { TConstValue } from '@venizia/ignis-helpers/common';
2
+ import { ConstClass } from '@venizia/ignis-helpers/common';
2
3
  /** The token standards the JWT service can use: `JWS` (shared-secret signing) or `JWKS` (key-pair signing, published or fetched as a key set). */
3
- export declare class JOSEStandards {
4
+ export declare class JOSEStandards extends ConstClass {
4
5
  static readonly JWS = "JWS";
5
6
  static readonly JWKS = "JWKS";
6
- static readonly SCHEME_SET: Set<string>;
7
- static isValid(input: string): boolean;
8
7
  }
9
8
  /** A valid value of `JOSEStandards`. */
10
9
  export type TJOSEStandard = TConstValue<typeof JOSEStandards>;
11
10
  /** The role a JWKS setup plays: `issuer` signs tokens, `verifier` checks them against a remote key set. */
12
- export declare class JWKSModes {
11
+ export declare class JWKSModes extends ConstClass {
13
12
  static readonly ISSUER = "issuer";
14
13
  static readonly VERIFIER = "verifier";
15
- static readonly SCHEME_SET: Set<string>;
16
- static isValid(input: string): boolean;
17
14
  }
18
15
  /** A valid value of `JWKSModes`. */
19
16
  export type TJWKSMode = TConstValue<typeof JWKSModes>;
20
17
  /** Where JWKS key material comes from: inline `text` content or a `file` path. */
21
- export declare class JWKSKeyDrivers {
18
+ export declare class JWKSKeyDrivers extends ConstClass {
22
19
  static readonly TEXT = "text";
23
20
  static readonly FILE = "file";
24
- static readonly SCHEME_SET: Set<string>;
25
- static isValid(input: string): boolean;
26
21
  }
27
22
  /** A valid value of `JWKSKeyDrivers`. */
28
23
  export type TJWKSKeyDriver = TConstValue<typeof JWKSKeyDrivers>;
29
24
  /** Encoding of JWKS key material: `pem` or `jwk`. */
30
- export declare class JWKSKeyFormats {
25
+ export declare class JWKSKeyFormats extends ConstClass {
31
26
  static readonly PEM = "pem";
32
27
  static readonly JWK = "jwk";
33
- static readonly SCHEME_SET: Set<string>;
34
- static isValid(input: string): boolean;
35
28
  }
36
29
  /** A valid value of `JWKSKeyFormats`. */
37
30
  export type TJWKSKeyFormat = TConstValue<typeof JWKSKeyFormats>;
38
31
  /** The signing algorithms a JWKS issuer supports. */
39
- export declare class JWKSAlgorithms {
32
+ export declare class JWKSAlgorithms extends ConstClass {
40
33
  static readonly ES256 = "ES256";
41
34
  static readonly RS256 = "RS256";
42
35
  static readonly EDDSA = "EdDSA";
43
- static readonly SCHEME_SET: Set<string>;
44
- static isValid(value: string): boolean;
45
36
  }
46
37
  /** Valid JWKS algorithm values. */
47
38
  export type TJWKSAlgorithm = TConstValue<typeof JWKSAlgorithms>;
@@ -1,47 +1,28 @@
1
+ import { ConstClass } from '@venizia/ignis-helpers/common';
1
2
  /** The token standards the JWT service can use: `JWS` (shared-secret signing) or `JWKS` (key-pair signing, published or fetched as a key set). */
2
- export class JOSEStandards {
3
+ export class JOSEStandards extends ConstClass {
3
4
  static { this.JWS = 'JWS'; }
4
5
  static { this.JWKS = 'JWKS'; }
5
- static { this.SCHEME_SET = new Set([this.JWS, this.JWKS]); }
6
- static isValid(input) {
7
- return this.SCHEME_SET.has(input);
8
- }
9
6
  }
10
7
  /** The role a JWKS setup plays: `issuer` signs tokens, `verifier` checks them against a remote key set. */
11
- export class JWKSModes {
8
+ export class JWKSModes extends ConstClass {
12
9
  static { this.ISSUER = 'issuer'; }
13
10
  static { this.VERIFIER = 'verifier'; }
14
- static { this.SCHEME_SET = new Set([this.ISSUER, this.VERIFIER]); }
15
- static isValid(input) {
16
- return this.SCHEME_SET.has(input);
17
- }
18
11
  }
19
12
  /** Where JWKS key material comes from: inline `text` content or a `file` path. */
20
- export class JWKSKeyDrivers {
13
+ export class JWKSKeyDrivers extends ConstClass {
21
14
  static { this.TEXT = 'text'; }
22
15
  static { this.FILE = 'file'; }
23
- static { this.SCHEME_SET = new Set([this.TEXT, this.FILE]); }
24
- static isValid(input) {
25
- return this.SCHEME_SET.has(input);
26
- }
27
16
  }
28
17
  /** Encoding of JWKS key material: `pem` or `jwk`. */
29
- export class JWKSKeyFormats {
18
+ export class JWKSKeyFormats extends ConstClass {
30
19
  static { this.PEM = 'pem'; }
31
20
  static { this.JWK = 'jwk'; }
32
- static { this.SCHEME_SET = new Set([this.PEM, this.JWK]); }
33
- static isValid(input) {
34
- return this.SCHEME_SET.has(input);
35
- }
36
21
  }
37
22
  /** The signing algorithms a JWKS issuer supports. */
38
- export class JWKSAlgorithms {
23
+ export class JWKSAlgorithms extends ConstClass {
39
24
  static { this.ES256 = 'ES256'; }
40
25
  static { this.RS256 = 'RS256'; }
41
26
  static { this.EDDSA = 'EdDSA'; }
42
- static { this.SCHEME_SET = new Set([this.ES256, this.RS256, this.EDDSA]); }
43
- static isValid(value) {
44
- return this.SCHEME_SET.has(value);
45
- }
46
27
  }
47
28
  //# sourceMappingURL=jose.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jose.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authenticate/common/constants/jose.ts"],"names":[],"mappings":"AAEA,kJAAkJ;AAClJ,MAAM,OAAO,aAAa;aACR,QAAG,GAAG,KAAK,CAAC;aACZ,SAAI,GAAG,MAAM,CAAC;aAEd,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAE5D,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,2GAA2G;AAC3G,MAAM,OAAO,SAAS;aACJ,WAAM,GAAG,QAAQ,CAAC;aAClB,aAAQ,GAAG,UAAU,CAAC;aAEtB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEnE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,kFAAkF;AAClF,MAAM,OAAO,cAAc;aACT,SAAI,GAAG,MAAM,CAAC;aACd,SAAI,GAAG,MAAM,CAAC;aAEd,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAE7D,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,qDAAqD;AACrD,MAAM,OAAO,cAAc;aACT,QAAG,GAAG,KAAK,CAAC;aACZ,QAAG,GAAG,KAAK,CAAC;aAEZ,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAE3D,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,qDAAqD;AACrD,MAAM,OAAO,cAAc;aACT,UAAK,GAAG,OAAO,CAAC;aAChB,UAAK,GAAG,OAAO,CAAC;aAChB,UAAK,GAAG,OAAO,CAAC;aAEhB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAEnF,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 token standards the JWT service can use: `JWS` (shared-secret signing) or `JWKS` (key-pair signing, published or fetched as a key set). */\nexport class JOSEStandards {\n static readonly JWS = 'JWS';\n static readonly JWKS = 'JWKS';\n\n static readonly SCHEME_SET = new Set([this.JWS, this.JWKS]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n\n/** A valid value of `JOSEStandards`. */\nexport type TJOSEStandard = TConstValue<typeof JOSEStandards>;\n\n/** The role a JWKS setup plays: `issuer` signs tokens, `verifier` checks them against a remote key set. */\nexport class JWKSModes {\n static readonly ISSUER = 'issuer';\n static readonly VERIFIER = 'verifier';\n\n static readonly SCHEME_SET = new Set([this.ISSUER, this.VERIFIER]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n\n/** A valid value of `JWKSModes`. */\nexport type TJWKSMode = TConstValue<typeof JWKSModes>;\n\n/** Where JWKS key material comes from: inline `text` content or a `file` path. */\nexport class JWKSKeyDrivers {\n static readonly TEXT = 'text';\n static readonly FILE = 'file';\n\n static readonly SCHEME_SET = new Set([this.TEXT, this.FILE]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n\n/** A valid value of `JWKSKeyDrivers`. */\nexport type TJWKSKeyDriver = TConstValue<typeof JWKSKeyDrivers>;\n\n/** Encoding of JWKS key material: `pem` or `jwk`. */\nexport class JWKSKeyFormats {\n static readonly PEM = 'pem';\n static readonly JWK = 'jwk';\n\n static readonly SCHEME_SET = new Set([this.PEM, this.JWK]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n\n/** A valid value of `JWKSKeyFormats`. */\nexport type TJWKSKeyFormat = TConstValue<typeof JWKSKeyFormats>;\n\n/** The signing algorithms a JWKS issuer supports. */\nexport class JWKSAlgorithms {\n static readonly ES256 = 'ES256';\n static readonly RS256 = 'RS256';\n static readonly EDDSA = 'EdDSA';\n\n static readonly SCHEME_SET = new Set<string>([this.ES256, this.RS256, this.EDDSA]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid JWKS algorithm values. */\nexport type TJWKSAlgorithm = TConstValue<typeof JWKSAlgorithms>;\n"]}
1
+ {"version":3,"file":"jose.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authenticate/common/constants/jose.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,kJAAkJ;AAClJ,MAAM,OAAO,aAAc,SAAQ,UAAU;aAC3B,QAAG,GAAG,KAAK,CAAC;aACZ,SAAI,GAAG,MAAM,CAAC;;AAMhC,2GAA2G;AAC3G,MAAM,OAAO,SAAU,SAAQ,UAAU;aACvB,WAAM,GAAG,QAAQ,CAAC;aAClB,aAAQ,GAAG,UAAU,CAAC;;AAMxC,kFAAkF;AAClF,MAAM,OAAO,cAAe,SAAQ,UAAU;aAC5B,SAAI,GAAG,MAAM,CAAC;aACd,SAAI,GAAG,MAAM,CAAC;;AAMhC,qDAAqD;AACrD,MAAM,OAAO,cAAe,SAAQ,UAAU;aAC5B,QAAG,GAAG,KAAK,CAAC;aACZ,QAAG,GAAG,KAAK,CAAC;;AAM9B,qDAAqD;AACrD,MAAM,OAAO,cAAe,SAAQ,UAAU;aAC5B,UAAK,GAAG,OAAO,CAAC;aAChB,UAAK,GAAG,OAAO,CAAC;aAChB,UAAK,GAAG,OAAO,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { ConstClass } from '@venizia/ignis-helpers/common';\n\n/** The token standards the JWT service can use: `JWS` (shared-secret signing) or `JWKS` (key-pair signing, published or fetched as a key set). */\nexport class JOSEStandards extends ConstClass {\n static readonly JWS = 'JWS';\n static readonly JWKS = 'JWKS';\n}\n\n/** A valid value of `JOSEStandards`. */\nexport type TJOSEStandard = TConstValue<typeof JOSEStandards>;\n\n/** The role a JWKS setup plays: `issuer` signs tokens, `verifier` checks them against a remote key set. */\nexport class JWKSModes extends ConstClass {\n static readonly ISSUER = 'issuer';\n static readonly VERIFIER = 'verifier';\n}\n\n/** A valid value of `JWKSModes`. */\nexport type TJWKSMode = TConstValue<typeof JWKSModes>;\n\n/** Where JWKS key material comes from: inline `text` content or a `file` path. */\nexport class JWKSKeyDrivers extends ConstClass {\n static readonly TEXT = 'text';\n static readonly FILE = 'file';\n}\n\n/** A valid value of `JWKSKeyDrivers`. */\nexport type TJWKSKeyDriver = TConstValue<typeof JWKSKeyDrivers>;\n\n/** Encoding of JWKS key material: `pem` or `jwk`. */\nexport class JWKSKeyFormats extends ConstClass {\n static readonly PEM = 'pem';\n static readonly JWK = 'jwk';\n}\n\n/** A valid value of `JWKSKeyFormats`. */\nexport type TJWKSKeyFormat = TConstValue<typeof JWKSKeyFormats>;\n\n/** The signing algorithms a JWKS issuer supports. */\nexport class JWKSAlgorithms extends ConstClass {\n static readonly ES256 = 'ES256';\n static readonly RS256 = 'RS256';\n static readonly EDDSA = 'EdDSA';\n}\n\n/** Valid JWKS algorithm values. */\nexport type TJWKSAlgorithm = TConstValue<typeof JWKSAlgorithms>;\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { TConstValue } from '@venizia/ignis-helpers/common';
2
2
  import { AuthorizationRole } from '../../models/authorization-role.model.js';
3
+ import { ConstClass } from '@venizia/ignis-helpers/common';
3
4
  /** Keys of the authorization state on the Hono context (`RULES`, `SKIP_AUTHORIZATION`, `DOMAIN`) and the binding prefix for registered enforcers (`ENFORCER`). */
4
5
  export declare class Authorization {
5
6
  static readonly RULES = "authorization.rules";
@@ -28,12 +29,10 @@ export declare class AuthorizationActions {
28
29
  /** Union of the `AuthorizationActions` values. */
29
30
  export type TAuthorizationAction = TConstValue<typeof AuthorizationActions>;
30
31
  /** Outcome of a voter or enforcer. The `isAllow`/`isDeny`/`isAbstain` helpers also accept a number: positive allows, negative denies, zero abstains. */
31
- export declare class AuthorizationDecisions {
32
+ export declare class AuthorizationDecisions extends ConstClass {
32
33
  static readonly ALLOW = "allow";
33
34
  static readonly DENY = "deny";
34
35
  static readonly ABSTAIN = "abstain";
35
- static readonly SCHEME_SET: Set<string>;
36
- static isValid(input: string): boolean;
37
36
  static isAllow(input: string | number): boolean;
38
37
  static isDeny(input: string | number): boolean;
39
38
  static isAbstain(input: string | number): boolean;
@@ -51,13 +50,11 @@ export declare class AuthorizationRoles {
51
50
  static isValid(input: string): boolean;
52
51
  }
53
52
  /** Scope literals a grant can carry instead of a concrete domain. */
54
- export declare class AuthorizationDomainScopes {
53
+ export declare class AuthorizationDomainScopes extends ConstClass {
55
54
  /** Grant applies in EVERY domain the subject is a member of (checked via join_domain / g2). */
56
55
  static readonly ANY_MEMBER = "ANY_MEMBER";
57
56
  /** Grant applies system-wide, bypassing membership - super-admin only. */
58
57
  static readonly SYSTEM_WIDE = "SYSTEM_WIDE";
59
- static readonly SCHEME_SET: Set<string>;
60
- static isValid(input: string): boolean;
61
58
  }
62
59
  /** Union of the `AuthorizationDomainScopes` values. */
63
60
  export type TAuthorizationDomainScope = TConstValue<typeof AuthorizationDomainScopes>;
@@ -129,13 +126,11 @@ export declare class AuthorizationPolicyVariants {
129
126
  /** The `variant` column's full value set, derived from {@link AuthorizationPolicyVariants.ALL} - never hand-list the seven strings again. */
130
127
  export type TAuthorizationPolicyVariant = (typeof AuthorizationPolicyVariants.ALL)[number]['action'];
131
128
  /** Where an `IAuthorizationDomainSource` reads the request domain from. */
132
- export declare class AuthorizationDomainSources {
129
+ export declare class AuthorizationDomainSources extends ConstClass {
133
130
  static readonly PARAM = "param";
134
131
  static readonly HEADER = "header";
135
132
  static readonly QUERY = "query";
136
133
  static readonly CONTEXT = "context";
137
- static readonly SCHEME_SET: Set<string>;
138
- static isValid(value: string): boolean;
139
134
  }
140
135
  /** Valid authorization domain source values. */
141
136
  export type TAuthorizationDomainSource = TConstValue<typeof AuthorizationDomainSources>;
@@ -1,5 +1,6 @@
1
1
  import { AuthorizationRole } from '../../models/authorization-role.model.js';
2
2
  import { CasbinRuleVariants } from './enforcer.js';
3
+ import { ConstClass } from '@venizia/ignis-helpers/common';
3
4
  /** Keys of the authorization state on the Hono context (`RULES`, `SKIP_AUTHORIZATION`, `DOMAIN`) and the binding prefix for registered enforcers (`ENFORCER`). */
4
5
  export class Authorization {
5
6
  static { this.RULES = 'authorization.rules'; }
@@ -41,14 +42,10 @@ export class AuthorizationActions {
41
42
  }
42
43
  }
43
44
  /** Outcome of a voter or enforcer. The `isAllow`/`isDeny`/`isAbstain` helpers also accept a number: positive allows, negative denies, zero abstains. */
44
- export class AuthorizationDecisions {
45
+ export class AuthorizationDecisions extends ConstClass {
45
46
  static { this.ALLOW = 'allow'; }
46
47
  static { this.DENY = 'deny'; }
47
48
  static { this.ABSTAIN = 'abstain'; }
48
- static { this.SCHEME_SET = new Set([this.ALLOW, this.DENY, this.ABSTAIN]); }
49
- static isValid(input) {
50
- return this.SCHEME_SET.has(input);
51
- }
52
49
  static isAllow(input) {
53
50
  if (typeof input === 'number') {
54
51
  return input > 0;
@@ -102,15 +99,11 @@ export class AuthorizationRoles {
102
99
  }
103
100
  }
104
101
  /** Scope literals a grant can carry instead of a concrete domain. */
105
- export class AuthorizationDomainScopes {
102
+ export class AuthorizationDomainScopes extends ConstClass {
106
103
  /** Grant applies in EVERY domain the subject is a member of (checked via join_domain / g2). */
107
104
  static { this.ANY_MEMBER = 'ANY_MEMBER'; }
108
105
  /** Grant applies system-wide, bypassing membership - super-admin only. */
109
106
  static { this.SYSTEM_WIDE = 'SYSTEM_WIDE'; }
110
- static { this.SCHEME_SET = new Set([this.ANY_MEMBER, this.SYSTEM_WIDE]); }
111
- static isValid(input) {
112
- return this.SCHEME_SET.has(input);
113
- }
114
107
  }
115
108
  /** Edge kinds in the `PolicyDefinition` table (each row: subject -> target, `variant` = kind), carrying `action` (DB `variant` value) + `rule` (casbin prefix emitted per edge). Per-USER edges: GRANT, ASSIGN_ROLE, JOIN_DOMAIN; shared org-structure edges: the *_INHERITS ones. */
116
109
  export class AuthorizationPolicyVariants {
@@ -157,14 +150,10 @@ export class AuthorizationPolicyVariants {
157
150
  }
158
151
  }
159
152
  /** Where an `IAuthorizationDomainSource` reads the request domain from. */
160
- export class AuthorizationDomainSources {
153
+ export class AuthorizationDomainSources extends ConstClass {
161
154
  static { this.PARAM = 'param'; }
162
155
  static { this.HEADER = 'header'; }
163
156
  static { this.QUERY = 'query'; }
164
157
  static { this.CONTEXT = 'context'; }
165
- static { this.SCHEME_SET = new Set([this.PARAM, this.HEADER, this.QUERY, this.CONTEXT]); }
166
- static isValid(value) {
167
- return this.SCHEME_SET.has(value);
168
- }
169
158
  }
170
159
  //# sourceMappingURL=authorization.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authorize/common/constants/authorization.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEh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AAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAE9F,MAAM,CAAC,aAAa,CAAC,KAAa;QAChC,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,KAAa;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;;AAOH,2EAA2E;AAC3E,MAAM,OAAO,0BAA0B;aACrB,UAAK,GAAG,OAAO,CAAC;aAChB,WAAM,GAAG,QAAQ,CAAC;aAClB,UAAK,GAAG,OAAO,CAAC;aAChB,YAAO,GAAG,SAAS,CAAC;aAEpB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAElG,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { AuthorizationRole } from '../../models/authorization-role.model';\nimport { CasbinRuleVariants } from './enforcer';\n\n/** Keys of the authorization state on the Hono context (`RULES`, `SKIP_AUTHORIZATION`, `DOMAIN`) and the binding prefix for registered enforcers (`ENFORCER`). */\nexport class Authorization {\n static readonly RULES = 'authorization.rules';\n static readonly SKIP_AUTHORIZATION = 'authorization.skip';\n static readonly ENFORCER = 'authorization.enforcer';\n static readonly DOMAIN = 'authorization.domain';\n}\n\n/** Actions a grant or request can name. `manage` covers `read`/`write`/`execute`, and `write` covers `create`/`update`/`delete` (see `LATTICE`). */\nexport class AuthorizationActions {\n static readonly CREATE = 'create';\n static readonly UPDATE = 'update';\n static readonly DELETE = 'delete';\n static readonly EXECUTE = 'execute';\n\n static readonly READ = 'read';\n static readonly WRITE = 'write';\n static readonly MANAGE = 'manage';\n\n /** Grant-mode marker for a subset grant carrying `metadata.ops`; never a member of LATTICE. */\n static readonly CUSTOM = 'custom';\n\n static readonly SCHEME_SET = new Set([\n this.CREATE,\n this.UPDATE,\n this.DELETE,\n this.EXECUTE,\n\n this.READ,\n this.WRITE,\n this.MANAGE,\n\n this.CUSTOM,\n ]);\n\n static readonly LATTICE: ReadonlyArray<{\n child: TAuthorizationAction;\n parent: TAuthorizationAction;\n }> = [\n { child: this.READ, parent: this.MANAGE },\n { child: this.WRITE, parent: this.MANAGE },\n { child: this.EXECUTE, parent: this.MANAGE },\n { child: this.CREATE, parent: this.WRITE },\n { child: this.UPDATE, parent: this.WRITE },\n { child: this.DELETE, parent: this.WRITE },\n ];\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n/** Union of the `AuthorizationActions` values. */\nexport type TAuthorizationAction = TConstValue<typeof AuthorizationActions>;\n\n/** Outcome of a voter or enforcer. The `isAllow`/`isDeny`/`isAbstain` helpers also accept a number: positive allows, negative denies, zero abstains. */\nexport class AuthorizationDecisions {\n static readonly ALLOW = 'allow';\n static readonly DENY = 'deny';\n static readonly ABSTAIN = 'abstain';\n\n static readonly SCHEME_SET = new Set([this.ALLOW, this.DENY, this.ABSTAIN]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n\n static isAllow(input: string | number): boolean {\n if (typeof input === 'number') {\n return input > 0;\n }\n\n return input.toLowerCase() === this.ALLOW;\n }\n\n static isDeny(input: string | number): boolean {\n if (typeof input === 'number') {\n return input < 0;\n }\n\n return input.toLowerCase() === this.DENY;\n }\n\n static isAbstain(input: string | number): boolean {\n if (typeof input === 'number') {\n return input === 0;\n }\n\n return input.toLowerCase() === this.ABSTAIN;\n }\n}\n/** Union of the `AuthorizationDecisions` values. */\nexport type TAuthorizationDecision = TConstValue<typeof AuthorizationDecisions>;\n\n/** Built-in roles ordered by priority (`super-admin` 999, `admin` 900, `user` 10, `guest` 1, `unknown-user` 0). `SCHEME_SET` and `isValid` work on the role `identifier` (e.g. `010_user`), not the bare name. */\nexport class AuthorizationRoles {\n static readonly SUPER_ADMIN = AuthorizationRole.build({\n name: 'super-admin',\n priority: 999,\n });\n\n static readonly ADMIN = AuthorizationRole.build({\n name: 'admin',\n priority: 900,\n });\n\n static readonly USER = AuthorizationRole.build({\n name: 'user',\n priority: 10,\n });\n\n static readonly GUEST = AuthorizationRole.build({\n name: 'guest',\n priority: 1,\n });\n\n static readonly UNKNOWN_USER = AuthorizationRole.build({\n name: 'unknown-user',\n priority: 0,\n });\n\n static readonly SCHEME_SET = new Set<string>([\n this.SUPER_ADMIN.identifier,\n this.ADMIN.identifier,\n this.USER.identifier,\n this.GUEST.identifier,\n this.UNKNOWN_USER.identifier,\n ]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n\n/** Scope literals a grant can carry instead of a concrete domain. */\nexport class AuthorizationDomainScopes {\n /** Grant applies in EVERY domain the subject is a member of (checked via join_domain / g2). */\n static readonly ANY_MEMBER = 'ANY_MEMBER';\n\n /** Grant applies system-wide, bypassing membership - super-admin only. */\n static readonly SYSTEM_WIDE = 'SYSTEM_WIDE';\n\n static readonly SCHEME_SET = new Set([this.ANY_MEMBER, this.SYSTEM_WIDE]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n/** Union of the `AuthorizationDomainScopes` values. */\nexport type TAuthorizationDomainScope = TConstValue<typeof AuthorizationDomainScopes>;\n\n/** Edge kinds in the `PolicyDefinition` table (each row: subject -> target, `variant` = kind), carrying `action` (DB `variant` value) + `rule` (casbin prefix emitted per edge). Per-USER edges: GRANT, ASSIGN_ROLE, JOIN_DOMAIN; shared org-structure edges: the *_INHERITS ones. */\nexport class AuthorizationPolicyVariants {\n /** Give a Permission to a User/Role (row also carries action / effect / domain). casbin `p`: `p, <Role|User>_<id>, <domain>, <permissionCode>, <action>, <allow|deny>` */\n static readonly GRANT = { action: 'grant', rule: CasbinRuleVariants.P } as const;\n\n /** Give a User a Role (optionally domain-scoped; no domain -> `*` = every domain). casbin `g`: `g, User_<id>, Role_<id>, <domain|*>` */\n static readonly ASSIGN_ROLE = { action: 'assign_role', rule: CasbinRuleVariants.G } as const;\n\n /** A Role inherits another Role (DAG). Shares `g` with ASSIGN_ROLE so user -> role -> parent-role resolves in one lookup. Emitted with domain `*`: `g, Role_<child>, Role_<parent>, *` */\n static readonly ROLE_INHERITS = { action: 'role_inherits', rule: CasbinRuleVariants.G } as const;\n\n /** User is a member of a Domain; powers the `ANY_MEMBER` grant scope via `g2(r.sub, r.dom)`. casbin `g2`: `g2, User_<id>, <Type>_<domainId>` */\n static readonly JOIN_DOMAIN = { action: 'join_domain', rule: CasbinRuleVariants.G2 } as const;\n\n /** DOMAIN axis (`dom`): domain nesting. Matcher: `g3(r.dom, p.dom)` + self-link so an exact domain always matches itself. casbin `g3`: `g3, <Type>_<childId>, <Type>_<parentId>` */\n static readonly DOMAIN_INHERITS = {\n action: 'domain_inherits',\n rule: CasbinRuleVariants.G3,\n } as const;\n\n /** RESOURCE axis (`obj`), NON-standard nesting only - dotted nesting (`Order.findById ⊂ Order`) is handled by `objectMatch` WITHOUT an edge. Matcher: `objectMatch(r.obj, p.obj) || g4(r.obj, p.obj)`, casbin `g4`: `g4, <childCode>, <parentCode>` */\n static readonly RESOURCE_INHERITS = {\n action: 'resource_inherits',\n rule: CasbinRuleVariants.G4,\n } as const;\n\n /** ACTION axis (`act`): a narrow action covered by a broader one; no dotted shortcut, so it needs an explicit edge. Matcher: `g5(r.act, p.act)`, casbin `g5`: `g5, <childAction>, <parentAction>`. g4 + g5 combine multiplicatively: `manage Order` covers a `read OrderItem` request. */\n static readonly ACTION_INHERITS = {\n action: 'action_inherits',\n rule: CasbinRuleVariants.G5,\n } as const;\n\n /** Every edge kind, in declaration order - the one place the scheme sets and the `variant` column's literal type both derive from. */\n static readonly ALL = [\n this.GRANT,\n this.ASSIGN_ROLE,\n this.ROLE_INHERITS,\n this.JOIN_DOMAIN,\n this.DOMAIN_INHERITS,\n this.RESOURCE_INHERITS,\n this.ACTION_INHERITS,\n ] as const;\n\n static readonly ACTION_SCHEME_SET = new Set(this.ALL.map((variant) => variant.action.toString()));\n\n static readonly RULE_SCHEME_SET = new Set(this.ALL.map((variant) => variant.rule.toString()));\n\n static isValidAction(input: string): boolean {\n return this.ACTION_SCHEME_SET.has(input);\n }\n\n static isValidRule(input: string): boolean {\n return this.RULE_SCHEME_SET.has(input);\n }\n}\n\n/** The `variant` column's full value set, derived from {@link AuthorizationPolicyVariants.ALL} - never hand-list the seven strings again. */\nexport type TAuthorizationPolicyVariant =\n (typeof AuthorizationPolicyVariants.ALL)[number]['action'];\n\n/** Where an `IAuthorizationDomainSource` reads the request domain from. */\nexport class AuthorizationDomainSources {\n static readonly PARAM = 'param';\n static readonly HEADER = 'header';\n static readonly QUERY = 'query';\n static readonly CONTEXT = 'context';\n\n static readonly SCHEME_SET = new Set<string>([this.PARAM, this.HEADER, this.QUERY, this.CONTEXT]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid authorization domain source values. */\nexport type TAuthorizationDomainSource = TConstValue<typeof AuthorizationDomainSources>;\n"]}
1
+ {"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authorize/common/constants/authorization.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,kKAAkK;AAClK,MAAM,OAAO,aAAa;aACR,UAAK,GAAG,qBAAqB,CAAC;aAC9B,uBAAkB,GAAG,oBAAoB,CAAC;aAC1C,aAAQ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type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { AuthorizationRole } from '../../models/authorization-role.model';\nimport { CasbinRuleVariants } from './enforcer';\nimport { ConstClass } from '@venizia/ignis-helpers/common';\n\n/** Keys of the authorization state on the Hono context (`RULES`, `SKIP_AUTHORIZATION`, `DOMAIN`) and the binding prefix for registered enforcers (`ENFORCER`). */\nexport class Authorization {\n static readonly RULES = 'authorization.rules';\n static readonly SKIP_AUTHORIZATION = 'authorization.skip';\n static readonly ENFORCER = 'authorization.enforcer';\n static readonly DOMAIN = 'authorization.domain';\n}\n\n/** Actions a grant or request can name. `manage` covers `read`/`write`/`execute`, and `write` covers `create`/`update`/`delete` (see `LATTICE`). */\nexport class AuthorizationActions {\n static readonly CREATE = 'create';\n static readonly UPDATE = 'update';\n static readonly DELETE = 'delete';\n static readonly EXECUTE = 'execute';\n\n static readonly READ = 'read';\n static readonly WRITE = 'write';\n static readonly MANAGE = 'manage';\n\n /** Grant-mode marker for a subset grant carrying `metadata.ops`; never a member of LATTICE. */\n static readonly CUSTOM = 'custom';\n\n static readonly SCHEME_SET = new Set([\n this.CREATE,\n this.UPDATE,\n this.DELETE,\n this.EXECUTE,\n\n this.READ,\n this.WRITE,\n this.MANAGE,\n\n this.CUSTOM,\n ]);\n\n static readonly LATTICE: ReadonlyArray<{\n child: TAuthorizationAction;\n parent: TAuthorizationAction;\n }> = [\n { child: this.READ, parent: this.MANAGE },\n { child: this.WRITE, parent: this.MANAGE },\n { child: this.EXECUTE, parent: this.MANAGE },\n { child: this.CREATE, parent: this.WRITE },\n { child: this.UPDATE, parent: this.WRITE },\n { child: this.DELETE, parent: this.WRITE },\n ];\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n/** Union of the `AuthorizationActions` values. */\nexport type TAuthorizationAction = TConstValue<typeof AuthorizationActions>;\n\n/** Outcome of a voter or enforcer. The `isAllow`/`isDeny`/`isAbstain` helpers also accept a number: positive allows, negative denies, zero abstains. */\nexport class AuthorizationDecisions extends ConstClass {\n static readonly ALLOW = 'allow';\n static readonly DENY = 'deny';\n static readonly ABSTAIN = 'abstain';\n\n static isAllow(input: string | number): boolean {\n if (typeof input === 'number') {\n return input > 0;\n }\n\n return input.toLowerCase() === this.ALLOW;\n }\n\n static isDeny(input: string | number): boolean {\n if (typeof input === 'number') {\n return input < 0;\n }\n\n return input.toLowerCase() === this.DENY;\n }\n\n static isAbstain(input: string | number): boolean {\n if (typeof input === 'number') {\n return input === 0;\n }\n\n return input.toLowerCase() === this.ABSTAIN;\n }\n}\n/** Union of the `AuthorizationDecisions` values. */\nexport type TAuthorizationDecision = TConstValue<typeof AuthorizationDecisions>;\n\n/** Built-in roles ordered by priority (`super-admin` 999, `admin` 900, `user` 10, `guest` 1, `unknown-user` 0). `SCHEME_SET` and `isValid` work on the role `identifier` (e.g. `010_user`), not the bare name. */\nexport class AuthorizationRoles {\n static readonly SUPER_ADMIN = AuthorizationRole.build({\n name: 'super-admin',\n priority: 999,\n });\n\n static readonly ADMIN = AuthorizationRole.build({\n name: 'admin',\n priority: 900,\n });\n\n static readonly USER = AuthorizationRole.build({\n name: 'user',\n priority: 10,\n });\n\n static readonly GUEST = AuthorizationRole.build({\n name: 'guest',\n priority: 1,\n });\n\n static readonly UNKNOWN_USER = AuthorizationRole.build({\n name: 'unknown-user',\n priority: 0,\n });\n\n static readonly SCHEME_SET = new Set<string>([\n this.SUPER_ADMIN.identifier,\n this.ADMIN.identifier,\n this.USER.identifier,\n this.GUEST.identifier,\n this.UNKNOWN_USER.identifier,\n ]);\n\n static isValid(input: string): boolean {\n return this.SCHEME_SET.has(input);\n }\n}\n\n/** Scope literals a grant can carry instead of a concrete domain. */\nexport class AuthorizationDomainScopes extends ConstClass {\n /** Grant applies in EVERY domain the subject is a member of (checked via join_domain / g2). */\n static readonly ANY_MEMBER = 'ANY_MEMBER';\n\n /** Grant applies system-wide, bypassing membership - super-admin only. */\n static readonly SYSTEM_WIDE = 'SYSTEM_WIDE';\n}\n/** Union of the `AuthorizationDomainScopes` values. */\nexport type TAuthorizationDomainScope = TConstValue<typeof AuthorizationDomainScopes>;\n\n/** Edge kinds in the `PolicyDefinition` table (each row: subject -> target, `variant` = kind), carrying `action` (DB `variant` value) + `rule` (casbin prefix emitted per edge). Per-USER edges: GRANT, ASSIGN_ROLE, JOIN_DOMAIN; shared org-structure edges: the *_INHERITS ones. */\nexport class AuthorizationPolicyVariants {\n /** Give a Permission to a User/Role (row also carries action / effect / domain). casbin `p`: `p, <Role|User>_<id>, <domain>, <permissionCode>, <action>, <allow|deny>` */\n static readonly GRANT = { action: 'grant', rule: CasbinRuleVariants.P } as const;\n\n /** Give a User a Role (optionally domain-scoped; no domain -> `*` = every domain). casbin `g`: `g, User_<id>, Role_<id>, <domain|*>` */\n static readonly ASSIGN_ROLE = { action: 'assign_role', rule: CasbinRuleVariants.G } as const;\n\n /** A Role inherits another Role (DAG). Shares `g` with ASSIGN_ROLE so user -> role -> parent-role resolves in one lookup. Emitted with domain `*`: `g, Role_<child>, Role_<parent>, *` */\n static readonly ROLE_INHERITS = { action: 'role_inherits', rule: CasbinRuleVariants.G } as const;\n\n /** User is a member of a Domain; powers the `ANY_MEMBER` grant scope via `g2(r.sub, r.dom)`. casbin `g2`: `g2, User_<id>, <Type>_<domainId>` */\n static readonly JOIN_DOMAIN = { action: 'join_domain', rule: CasbinRuleVariants.G2 } as const;\n\n /** DOMAIN axis (`dom`): domain nesting. Matcher: `g3(r.dom, p.dom)` + self-link so an exact domain always matches itself. casbin `g3`: `g3, <Type>_<childId>, <Type>_<parentId>` */\n static readonly DOMAIN_INHERITS = {\n action: 'domain_inherits',\n rule: CasbinRuleVariants.G3,\n } as const;\n\n /** RESOURCE axis (`obj`), NON-standard nesting only - dotted nesting (`Order.findById ⊂ Order`) is handled by `objectMatch` WITHOUT an edge. Matcher: `objectMatch(r.obj, p.obj) || g4(r.obj, p.obj)`, casbin `g4`: `g4, <childCode>, <parentCode>` */\n static readonly RESOURCE_INHERITS = {\n action: 'resource_inherits',\n rule: CasbinRuleVariants.G4,\n } as const;\n\n /** ACTION axis (`act`): a narrow action covered by a broader one; no dotted shortcut, so it needs an explicit edge. Matcher: `g5(r.act, p.act)`, casbin `g5`: `g5, <childAction>, <parentAction>`. g4 + g5 combine multiplicatively: `manage Order` covers a `read OrderItem` request. */\n static readonly ACTION_INHERITS = {\n action: 'action_inherits',\n rule: CasbinRuleVariants.G5,\n } as const;\n\n /** Every edge kind, in declaration order - the one place the scheme sets and the `variant` column's literal type both derive from. */\n static readonly ALL = [\n this.GRANT,\n this.ASSIGN_ROLE,\n this.ROLE_INHERITS,\n this.JOIN_DOMAIN,\n this.DOMAIN_INHERITS,\n this.RESOURCE_INHERITS,\n this.ACTION_INHERITS,\n ] as const;\n\n static readonly ACTION_SCHEME_SET = new Set(this.ALL.map((variant) => variant.action.toString()));\n\n static readonly RULE_SCHEME_SET = new Set(this.ALL.map((variant) => variant.rule.toString()));\n\n static isValidAction(input: string): boolean {\n return this.ACTION_SCHEME_SET.has(input);\n }\n\n static isValidRule(input: string): boolean {\n return this.RULE_SCHEME_SET.has(input);\n }\n}\n\n/** The `variant` column's full value set, derived from {@link AuthorizationPolicyVariants.ALL} - never hand-list the seven strings again. */\nexport type TAuthorizationPolicyVariant =\n (typeof AuthorizationPolicyVariants.ALL)[number]['action'];\n\n/** Where an `IAuthorizationDomainSource` reads the request domain from. */\nexport class AuthorizationDomainSources extends ConstClass {\n static readonly PARAM = 'param';\n static readonly HEADER = 'header';\n static readonly QUERY = 'query';\n static readonly CONTEXT = 'context';\n}\n\n/** Valid authorization domain source values. */\nexport type TAuthorizationDomainSource = TConstValue<typeof AuthorizationDomainSources>;\n"]}
@@ -1,32 +1,27 @@
1
1
  import type { TConstValue } from '@venizia/ignis-helpers/common';
2
+ import { ConstClass } from '@venizia/ignis-helpers/common';
2
3
  /** Kinds of enforcer a registration can declare; `casbin` takes `ICasbinEnforcerOptions`, `custom` takes untyped options. */
3
- export declare class AuthorizationEnforcerTypes {
4
+ export declare class AuthorizationEnforcerTypes extends ConstClass {
4
5
  static readonly CASBIN = "casbin";
5
6
  static readonly CUSTOM = "custom";
6
- static readonly SCHEME_SET: Set<string>;
7
- static isValid(input: string): boolean;
8
7
  }
9
8
  /** Union of the `AuthorizationEnforcerTypes` values. */
10
9
  export type TAuthorizationEnforcerType = TConstValue<typeof AuthorizationEnforcerTypes>;
11
10
  /** Cache backends for a Casbin enforcer's per-user policy lines. */
12
- export declare class CasbinEnforcerCachedDrivers {
11
+ export declare class CasbinEnforcerCachedDrivers extends ConstClass {
13
12
  static readonly REDIS = "redis";
14
- static readonly SCHEME_SET: Set<string>;
15
- static isValid(input: string): boolean;
16
13
  }
17
14
  /** Union of the `CasbinEnforcerCachedDrivers` values. */
18
15
  export type TCasbinEnforcerCachedDriver = TConstValue<typeof CasbinEnforcerCachedDrivers>;
19
16
  /** Where a Casbin enforcer reads its model from: a `file` path or inline `text`. */
20
- export declare class CasbinEnforcerModelDrivers {
17
+ export declare class CasbinEnforcerModelDrivers extends ConstClass {
21
18
  static readonly FILE = "file";
22
19
  static readonly TEXT = "text";
23
- static readonly SCHEME_SET: Set<string>;
24
- static isValid(input: string): boolean;
25
20
  }
26
21
  /** Union of the `CasbinEnforcerModelDrivers` values. */
27
22
  export type TCasbinEnforcerModelDriver = TConstValue<typeof CasbinEnforcerModelDrivers>;
28
23
  /** Casbin matching functions selectable for the domain match in `ICasbinEnforcerOptions.domainMatching`. */
29
- export declare class CasbinDomainMatchingFunctions {
24
+ export declare class CasbinDomainMatchingFunctions extends ConstClass {
30
25
  /** `*` is the only wildcard; exact compare otherwise. Safest for `Merchant_<uuid>` domains. */
31
26
  static readonly KEY_MATCH = "keyMatch";
32
27
  /** Adds URL-path `:param` segment matching. */
@@ -37,8 +32,6 @@ export declare class CasbinDomainMatchingFunctions {
37
32
  static readonly KEY_MATCH_4 = "keyMatch4";
38
33
  /** Treats the stored/policy value as a full regular expression. */
39
34
  static readonly REGEX_MATCH = "regexMatch";
40
- static readonly SCHEME_SET: Set<string>;
41
- static isValid(input: string): boolean;
42
35
  }
43
36
  /** Union of the `CasbinDomainMatchingFunctions` values. */
44
37
  export type TCasbinDomainMatchingFunction = TConstValue<typeof CasbinDomainMatchingFunctions>;