@venizia/ignis-kernel 0.4.2 → 0.4.3
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.
- package/dist/cjs/base/applications/common/constants.d.ts +9 -0
- package/dist/cjs/base/applications/common/constants.d.ts.map +1 -1
- package/dist/cjs/base/applications/common/constants.js +11 -1
- package/dist/cjs/base/applications/common/constants.js.map +1 -1
- package/dist/cjs/base/applications/common/types/middlewares.d.ts +2 -2
- package/dist/cjs/base/applications/common/types/middlewares.d.ts.map +1 -1
- package/dist/cjs/base/applications/common/types/middlewares.js.map +1 -1
- package/dist/cjs/base/applications/deprecations.d.ts +2 -2
- package/dist/cjs/base/applications/deprecations.js +7 -7
- package/dist/cjs/base/applications/deprecations.js.map +1 -1
- package/dist/cjs/base/applications/rest.js +1 -1
- package/dist/cjs/base/applications/rest.js.map +1 -1
- package/dist/cjs/base/auth/authenticate/common/constants/jose.d.ts +10 -0
- package/dist/cjs/base/auth/authenticate/common/constants/jose.d.ts.map +1 -1
- package/dist/cjs/base/auth/authenticate/common/constants/jose.js +12 -1
- package/dist/cjs/base/auth/authenticate/common/constants/jose.js.map +1 -1
- package/dist/cjs/base/auth/authenticate/common/types/jwt.d.ts +1 -2
- package/dist/cjs/base/auth/authenticate/common/types/jwt.d.ts.map +1 -1
- package/dist/cjs/base/auth/authenticate/common/types/jwt.js.map +1 -1
- package/dist/cjs/base/auth/authorize/common/constants/authorization.d.ts +11 -0
- package/dist/cjs/base/auth/authorize/common/constants/authorization.d.ts.map +1 -1
- package/dist/cjs/base/auth/authorize/common/constants/authorization.js +13 -1
- package/dist/cjs/base/auth/authorize/common/constants/authorization.js.map +1 -1
- package/dist/cjs/base/auth/authorize/common/types/request.d.ts +2 -1
- package/dist/cjs/base/auth/authorize/common/types/request.d.ts.map +1 -1
- package/dist/cjs/base/auth/authorize/common/types/request.js.map +1 -1
- package/dist/cjs/base/auth/authorize/providers/request-domain.js +4 -4
- package/dist/cjs/base/auth/authorize/providers/request-domain.js.map +1 -1
- package/dist/cjs/base/controllers/common/constants.d.ts +10 -0
- package/dist/cjs/base/controllers/common/constants.d.ts.map +1 -1
- package/dist/cjs/base/controllers/common/constants.js +12 -1
- package/dist/cjs/base/controllers/common/constants.js.map +1 -1
- package/dist/cjs/base/controllers/factory/controller.d.ts +1 -1
- package/dist/cjs/base/controllers/factory/controller.d.ts.map +1 -1
- package/dist/cjs/base/controllers/rest/abstract.d.ts +2 -1
- package/dist/cjs/base/controllers/rest/abstract.d.ts.map +1 -1
- package/dist/cjs/base/controllers/rest/abstract.js +6 -4
- package/dist/cjs/base/controllers/rest/abstract.js.map +1 -1
- package/dist/cjs/base/metadata/model-metadata.d.ts +17 -0
- package/dist/cjs/base/metadata/model-metadata.d.ts.map +1 -0
- package/dist/cjs/base/metadata/model-metadata.js +50 -0
- package/dist/cjs/base/metadata/model-metadata.js.map +1 -0
- package/dist/cjs/base/metadata/model-settings.d.ts +7 -17
- package/dist/cjs/base/metadata/model-settings.d.ts.map +1 -1
- package/dist/cjs/base/metadata/model-settings.js +22 -65
- package/dist/cjs/base/metadata/model-settings.js.map +1 -1
- package/dist/cjs/base/metadata/persistents.d.ts +1 -1
- package/dist/cjs/base/metadata/persistents.d.ts.map +1 -1
- package/dist/cjs/base/metadata/persistents.js +5 -12
- package/dist/cjs/base/metadata/persistents.js.map +1 -1
- package/dist/cjs/base/models/common/constants.d.ts +17 -0
- package/dist/cjs/base/models/common/constants.d.ts.map +1 -1
- package/dist/cjs/base/models/common/constants.js +20 -1
- package/dist/cjs/base/models/common/constants.js.map +1 -1
- package/dist/cjs/base/models/common/schemas.d.ts +1 -1
- package/dist/cjs/base/models/common/schemas.d.ts.map +1 -1
- package/dist/cjs/base/models/common/schemas.js.map +1 -1
- package/dist/cjs/base/models/common/types/id.d.ts +0 -2
- package/dist/cjs/base/models/common/types/id.d.ts.map +1 -1
- package/dist/cjs/base/models/common/types/id.js.map +1 -1
- package/dist/cjs/helpers/inversion/common/constants.d.ts +10 -0
- package/dist/cjs/helpers/inversion/common/constants.d.ts.map +1 -1
- package/dist/cjs/helpers/inversion/common/constants.js +11 -1
- package/dist/cjs/helpers/inversion/common/constants.js.map +1 -1
- package/dist/cjs/helpers/inversion/common/types/model.d.ts +17 -29
- package/dist/cjs/helpers/inversion/common/types/model.d.ts.map +1 -1
- package/dist/cjs/helpers/inversion/common/types/model.js.map +1 -1
- package/dist/cjs/helpers/inversion/mixins/model.mixin.d.ts +5 -4
- package/dist/cjs/helpers/inversion/mixins/model.mixin.d.ts.map +1 -1
- package/dist/cjs/helpers/inversion/mixins/model.mixin.js +5 -4
- package/dist/cjs/helpers/inversion/mixins/model.mixin.js.map +1 -1
- package/dist/esm/base/applications/common/constants.d.ts +9 -0
- package/dist/esm/base/applications/common/constants.d.ts.map +1 -1
- package/dist/esm/base/applications/common/constants.js +9 -0
- package/dist/esm/base/applications/common/constants.js.map +1 -1
- package/dist/esm/base/applications/common/types/middlewares.d.ts +2 -2
- package/dist/esm/base/applications/common/types/middlewares.d.ts.map +1 -1
- package/dist/esm/base/applications/common/types/middlewares.js.map +1 -1
- package/dist/esm/base/applications/deprecations.d.ts +2 -2
- package/dist/esm/base/applications/deprecations.js +5 -5
- package/dist/esm/base/applications/deprecations.js.map +1 -1
- package/dist/esm/base/applications/rest.js +2 -2
- package/dist/esm/base/applications/rest.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/constants/jose.d.ts +10 -0
- package/dist/esm/base/auth/authenticate/common/constants/jose.d.ts.map +1 -1
- package/dist/esm/base/auth/authenticate/common/constants/jose.js +10 -0
- package/dist/esm/base/auth/authenticate/common/constants/jose.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/types/jwt.d.ts +1 -2
- package/dist/esm/base/auth/authenticate/common/types/jwt.d.ts.map +1 -1
- package/dist/esm/base/auth/authenticate/common/types/jwt.js.map +1 -1
- package/dist/esm/base/auth/authorize/common/constants/authorization.d.ts +11 -0
- package/dist/esm/base/auth/authorize/common/constants/authorization.d.ts.map +1 -1
- package/dist/esm/base/auth/authorize/common/constants/authorization.js +11 -0
- package/dist/esm/base/auth/authorize/common/constants/authorization.js.map +1 -1
- package/dist/esm/base/auth/authorize/common/types/request.d.ts +2 -1
- package/dist/esm/base/auth/authorize/common/types/request.d.ts.map +1 -1
- package/dist/esm/base/auth/authorize/common/types/request.js.map +1 -1
- package/dist/esm/base/auth/authorize/providers/request-domain.js +5 -5
- package/dist/esm/base/auth/authorize/providers/request-domain.js.map +1 -1
- package/dist/esm/base/controllers/common/constants.d.ts +10 -0
- package/dist/esm/base/controllers/common/constants.d.ts.map +1 -1
- package/dist/esm/base/controllers/common/constants.js +10 -0
- package/dist/esm/base/controllers/common/constants.js.map +1 -1
- package/dist/esm/base/controllers/factory/controller.d.ts +1 -1
- package/dist/esm/base/controllers/factory/controller.d.ts.map +1 -1
- package/dist/esm/base/controllers/rest/abstract.d.ts +2 -1
- package/dist/esm/base/controllers/rest/abstract.d.ts.map +1 -1
- package/dist/esm/base/controllers/rest/abstract.js +6 -4
- package/dist/esm/base/controllers/rest/abstract.js.map +1 -1
- package/dist/esm/base/metadata/model-metadata.d.ts +17 -0
- package/dist/esm/base/metadata/model-metadata.d.ts.map +1 -0
- package/dist/esm/base/metadata/model-metadata.js +46 -0
- package/dist/esm/base/metadata/model-metadata.js.map +1 -0
- package/dist/esm/base/metadata/model-settings.d.ts +7 -17
- package/dist/esm/base/metadata/model-settings.d.ts.map +1 -1
- package/dist/esm/base/metadata/model-settings.js +20 -63
- package/dist/esm/base/metadata/model-settings.js.map +1 -1
- package/dist/esm/base/metadata/persistents.d.ts +1 -1
- package/dist/esm/base/metadata/persistents.d.ts.map +1 -1
- package/dist/esm/base/metadata/persistents.js +6 -13
- package/dist/esm/base/metadata/persistents.js.map +1 -1
- package/dist/esm/base/models/common/constants.d.ts +17 -0
- package/dist/esm/base/models/common/constants.d.ts.map +1 -1
- package/dist/esm/base/models/common/constants.js +17 -0
- package/dist/esm/base/models/common/constants.js.map +1 -1
- package/dist/esm/base/models/common/schemas.d.ts +1 -1
- package/dist/esm/base/models/common/schemas.d.ts.map +1 -1
- package/dist/esm/base/models/common/schemas.js.map +1 -1
- package/dist/esm/base/models/common/types/id.d.ts +0 -2
- package/dist/esm/base/models/common/types/id.d.ts.map +1 -1
- package/dist/esm/base/models/common/types/id.js.map +1 -1
- package/dist/esm/helpers/inversion/common/constants.d.ts +10 -0
- package/dist/esm/helpers/inversion/common/constants.d.ts.map +1 -1
- package/dist/esm/helpers/inversion/common/constants.js +9 -0
- package/dist/esm/helpers/inversion/common/constants.js.map +1 -1
- package/dist/esm/helpers/inversion/common/types/model.d.ts +17 -29
- package/dist/esm/helpers/inversion/common/types/model.d.ts.map +1 -1
- package/dist/esm/helpers/inversion/common/types/model.js.map +1 -1
- package/dist/esm/helpers/inversion/mixins/model.mixin.d.ts +5 -4
- package/dist/esm/helpers/inversion/mixins/model.mixin.d.ts.map +1 -1
- package/dist/esm/helpers/inversion/mixins/model.mixin.js +5 -4
- package/dist/esm/helpers/inversion/mixins/model.mixin.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rest.js","sourceRoot":"","sources":["../../../../src/base/applications/rest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAExF,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,6BAA6B,EAC7B,QAAQ,EACR,kBAAkB,EAClB,WAAW,GACZ,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,UAAU,IAAI,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAA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AAC,2CAA2C,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;oBAC1E,SAAS;gBACX,CAAC;gBAED,MAAM,CAAC,KAAK,CAAC,kDAAkD,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;gBAC7E,SAAS;YACX,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { TBindingNamespace } from '@/common/bindings';\nimport { ArtifactNamespaces, BindingNamespaces, CoreBindings } from '@/common/bindings';\nimport type { Binding, TBindingScope } from '@/helpers/inversion';\nimport { BindingScopes, MetadataRegistry } from '@/helpers/inversion';\nimport { OpenAPIHono } from '@hono/zod-openapi';\nimport type { AnyType, IConfigurable, TClass, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport {\n executeWithPerformanceMeasure,\n getError,\n RequestIdGenerator,\n RetryHelper,\n} from '@venizia/ignis-helpers/core';\nimport type { Env, Schema } from 'hono';\nimport { showRoutes as showApplicationRoutes } from 'hono/dev';\nimport { bodyLimit } from 'hono/body-limit';\nimport { requestId } from 'hono/request-id';\nimport type { BaseComponent } from '../components';\nimport { ArtifactBindingKeys } from '../metadata/artifact-keys';\nimport { RestComponent } from '../components/controller/rest/rest.component';\nimport type { BaseConfiguration } from '../configurations';\nimport { ControllerTransports } from '../controllers/common/constants';\nimport type { IDataSource } from '../datasources';\nimport { BaseAppErrorMiddleware } from '../middlewares/app-error/app-error.middleware';\nimport { RequestErrors } from '../middlewares/common/errors';\nimport { notFoundHandler } from '../middlewares/not-found/not-found.middleware';\nimport type { TMixinOpts } from '../mixins/common';\nimport type { IRepository } from '../repositories';\nimport type { IService } from '../services';\nimport { AbstractApplication } from './abstract';\nimport { registerCors } from './cors';\nimport { warnDeprecatedModelSettings } from './deprecations';\nimport { ArtifactIndexHelper } from './artifact-index';\nimport type { IBootSequenceStep } from './boot-sequence';\nimport { BootSteps } from './boot-sequence';\nimport type { IApplicationConfigs, IBodyLimitOptions, TArtifactIndexInput } from './common';\n\ninterface IRegisterDynamicBindingsOptions<T extends IConfigurable = IConfigurable> {\n namespace: TBindingNamespace;\n\n onBeforeConfigure?: (opts: { binding: Binding<T> }) => Promise<void>;\n onAfterConfigure?: (opts: { binding: Binding<T>; instance: T }) => Promise<void>;\n}\n\n/** Adds the `OpenAPIHono` router surface on top of `AbstractApplication` - no listening server, so this is the layer a browser Worker or gRPC-only host can extend without pulling in `Bun.serve` / `@hono/node-server`. */\nexport abstract class RestApplication<\n AppEnv extends Env = Env,\n AppSchema extends Schema = {},\n BasePath extends string = '/',\n> extends AbstractApplication {\n private registeredBindings: Record<string, Set<string>> = {};\n private artifactOptions = new Map<string, object>();\n\n /** The router, and nothing else. What runtime is underneath and what socket is bound are `ServerApplication`'s to know - a browser Worker has neither, and carrying the union here made `RuntimeModules.detect()` answer `'node'` inside a Worker. */\n protected server: { hono: OpenAPIHono<AppEnv, AppSchema, BasePath> };\n\n protected rootRouter: OpenAPIHono<AppEnv, AppSchema, BasePath>;\n protected readonly requestIdGenerator: RequestIdGenerator;\n\n /** A copy of the `bodyLimit` the default stack installed, absent until `registerDefaultMiddlewares()` ran. */\n private installedBodyLimit?: { options?: IBodyLimitOptions };\n\n constructor(opts: { scope: string; config: IApplicationConfigs }) {\n super(opts);\n\n // A config built from the environment can lose `path.base` at run time; the router would only fail later, inside `route()`, with a message that names nothing.\n if (typeof this.configs.path?.base !== 'string') {\n throw getError({\n message: `[${opts.scope}] configs.path.base must be a string | value: ${String(this.configs.path?.base)} | an empty string mounts the application at the root`,\n });\n }\n\n // The index signature accepts any key, so a leftover `strictPath` would compile and be ignored.\n if (this.configs.strictPath !== undefined) {\n throw getError({\n message: `[${opts.scope}] configs.strictPath was removed | value: ${String(this.configs.strictPath)} | Use configs.path.isStrict`,\n });\n }\n\n this.requestIdGenerator = new RequestIdGenerator({ scope: opts.scope });\n\n const strict = this.configs.path.isStrict ?? true;\n const honoServer = new OpenAPIHono<AppEnv, AppSchema, BasePath>({ strict });\n this.rootRouter = new OpenAPIHono({ strict });\n\n this.server = { hono: honoServer };\n }\n\n getRootRouter(): OpenAPIHono<AppEnv, AppSchema, BasePath> {\n return this.rootRouter;\n }\n\n getServer(): OpenAPIHono<AppEnv, AppSchema, BasePath> {\n return this.server.hono;\n }\n\n protected override registerCoreBindings() {\n super.registerCoreBindings();\n\n this.bind<typeof this.server>({\n key: CoreBindings.APPLICATION_SERVER,\n }).toProvider((_) => this.server);\n this.bind<typeof this.rootRouter>({\n key: CoreBindings.APPLICATION_ROOT_ROUTER,\n }).toProvider((_) => this.rootRouter);\n }\n\n /** The correlation id every host stamps - see {@link RequestIdGenerator} for why `crypto.randomUUID` is refused. */\n protected generateRequestId(): string {\n return this.requestIdGenerator.nextId();\n }\n\n /** The error handler the default stack installs. `@venizia/ignis` overrides it to swap in the `ErrorPrettier`-backed formatter, which reaches `node:util` and so cannot live here. */\n protected buildErrorMiddleware(): BaseAppErrorMiddleware {\n const environment = this.configs.error?.environment;\n\n return new BaseAppErrorMiddleware({\n logger: this.logger,\n rootKey: this.configs.error?.rootKey ?? undefined,\n // Spread, not `environment: () => environment`: the option's PRESENCE is what claims this host\n // has an ambient environment at all, so an unset config must leave it absent.\n ...(environment === undefined ? {} : { environment: () => environment }),\n });\n }\n\n /**\n * The three registrations every host needs: request id, error envelope, JSON 404 - without them a\n * thrown `ApplicationError` is a generic 500, a 404 is `text/plain`, and no response carries a request id.\n * Registered before `initialize()`, so an application's own handlers still win.\n */\n protected registerDefaultMiddlewares(): ValueOrPromise<void> {\n const server = this.getServer();\n\n // First of all, so every response the framework produces on its own - a bodyLimit 413, a body the\n // request spy cannot parse, the error envelope - leaves with the headers a browser needs to read it.\n registerCors({ server, options: this.configs.middlewares?.cors });\n\n server.use(requestId({ generator: () => this.generateRequestId() }));\n\n // Ahead of every middleware a host adds after this one, so none of them buffers a body over it.\n const bodyLimitOptions = this.configs.middlewares?.bodyLimit;\n this.installedBodyLimit = { options: this.toInstalledBodyLimit({ options: bodyLimitOptions }) };\n\n if (bodyLimitOptions && bodyLimitOptions.enable !== false) {\n const { maxSize, path, onError } = bodyLimitOptions;\n\n if (typeof maxSize !== 'number' || !Number.isFinite(maxSize) || maxSize < 0) {\n throw getError({\n message: `[registerDefaultMiddlewares] configs.middlewares.bodyLimit.maxSize must be a non-negative number of bytes | value: ${String(maxSize)}`,\n });\n }\n\n const limiter = bodyLimit({\n maxSize,\n onError:\n onError ??\n (() => {\n throw getError({\n error: RequestErrors.BODY_TOO_LARGE,\n message: `Request body exceeds the maximum of ${maxSize} bytes`,\n });\n }),\n });\n\n if (path) {\n server.use(path, limiter);\n } else {\n server.use(limiter);\n }\n }\n\n server.onError(this.buildErrorMiddleware().value());\n server.notFound(notFoundHandler({ logger: this.logger }));\n }\n\n /** What a `bodyLimit` config installs: nothing when absent or disabled, else a copy, so a later in-place edit shows. */\n private toInstalledBodyLimit(opts: {\n options?: IBodyLimitOptions;\n }): IBodyLimitOptions | undefined {\n const { options } = opts;\n\n if (!options || options.enable === false) {\n return undefined;\n }\n\n return { ...options };\n }\n\n private isSameBodyLimit(opts: { left?: IBodyLimitOptions; right?: IBodyLimitOptions }): boolean {\n const { left, right } = opts;\n\n if (!left || !right) {\n return left === right;\n }\n\n const keys = new Set([...Object.keys(left), ...Object.keys(right)]);\n for (const key of keys) {\n if (!Object.is(left[key], right[key])) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * `configs.middlewares` is read by `registerDefaultMiddlewares()`, which runs before `staticConfigure()`.\n * A limit assigned in a boot hook would read back as configured while every request ran unlimited.\n */\n private assertBodyLimitUnchanged(opts: { step: string }): void {\n if (!this.installedBodyLimit) {\n return;\n }\n\n const installed = this.installedBodyLimit.options;\n const current = this.toInstalledBodyLimit({ options: this.configs.middlewares?.bodyLimit });\n\n if (this.isSameBodyLimit({ left: installed, right: current })) {\n return;\n }\n\n throw getError({\n message: `[${opts.step}] configs.middlewares.bodyLimit changed after registerDefaultMiddlewares() installed it | installed maxSize: ${installed?.maxSize ?? 'none'} | now maxSize: ${current?.maxSize ?? 'none'} | Pass it through the constructor config: new Application({ config: { middlewares: { bodyLimit } } })`,\n });\n }\n\n /**\n * The artifact order, stated once: datasources before the repositories that auto-resolve them,\n * components before the controllers they may contribute. `BaseApplication` splices its server-only\n * steps around these by name instead of rewriting the list.\n */\n protected getBootSequence(): IBootSequenceStep[] {\n return [\n {\n name: BootSteps.STATIC_CONFIGURE,\n run: async () => {\n // Declared `void`, but an override may be async; the step has always waited on it.\n await Promise.resolve(this.staticConfigure());\n this.assertBodyLimitUnchanged({ step: BootSteps.STATIC_CONFIGURE });\n },\n },\n { name: BootSteps.REGISTER_ARTIFACTS, run: () => this.registerConfiguredArtifacts() },\n {\n name: BootSteps.PRE_CONFIGURE,\n run: async () => {\n await this.runApplicationHook({\n name: BootSteps.PRE_CONFIGURE,\n hook: () => this.preConfigure(),\n });\n this.assertBodyLimitUnchanged({ step: BootSteps.PRE_CONFIGURE });\n },\n },\n {\n name: BootSteps.REGISTER_CONFIGURATIONS,\n run: () => this.registerConfigurations(),\n },\n { name: BootSteps.REGISTER_DATA_SOURCES, run: () => this.registerDataSources() },\n { name: BootSteps.REGISTER_COMPONENTS, run: () => this.registerComponents() },\n {\n name: BootSteps.REGISTER_CONTRIBUTED_DATA_SOURCES,\n run: () => this.registerContributedDataSources(),\n },\n { name: BootSteps.REGISTER_CONTROLLERS, run: () => this.registerControllers() },\n {\n name: BootSteps.POST_CONFIGURE,\n run: () =>\n this.runApplicationHook({\n name: BootSteps.POST_CONFIGURE,\n hook: () => this.postConfigure(),\n }),\n },\n { name: BootSteps.VERIFY_BINDINGS, run: () => this.verifyBindings() },\n ];\n }\n\n async initialize(): Promise<void> {\n await this.runBootSequence({ steps: this.getBootSequence() });\n }\n\n /** The application hook currently running, so `registerArtifact` can tell a hand registration inside `preConfigure`/`postConfigure` from one the index step made. */\n private runningApplicationHook: string | undefined;\n\n private async runApplicationHook(opts: {\n name: string;\n hook: () => ValueOrPromise<void>;\n }): Promise<void> {\n this.runningApplicationHook = opts.name;\n try {\n await opts.hook();\n } finally {\n this.runningApplicationHook = undefined;\n }\n }\n\n /**\n * Bound keys carrying one of `tags` that nothing has resolved since the counts were last reset.\n * The counter answers \"who was read\", never \"who is dead\" - an unread binding may be an\n * allow-list entry or a technical floor, and only the application can tell those apart.\n *\n * Counting is off by default. Call `startResolutionCounting()` after `initialize()` and run the\n * traffic that exercises the application, then read this.\n */\n getUnresolvedBindings(opts?: { tags?: string[] }): string[] {\n if (!this.hasStartedResolutionCounting) {\n throw getError({\n message: `[${this.getUnresolvedBindings.name}] Resolution counting never started | Call startResolutionCounting() after initialize(), run the traffic that exercises the application, then read this - without it every binding would be reported unresolved`,\n });\n }\n\n const tags = opts?.tags ?? [BindingNamespaces.SERVICE, BindingNamespaces.REPOSITORY];\n const counts = this.getResolutionCounts();\n const unresolved: string[] = [];\n\n for (const tag of tags) {\n const bindings = this.findByTag({ tag });\n for (const binding of bindings) {\n if (counts.has(binding.key)) {\n continue;\n }\n\n unresolved.push(binding.key);\n }\n }\n\n return unresolved;\n }\n\n /** `bootChecks.binding.doVerify`: resolve every service and repository once, collect every failure, throw once with the whole list - a made-up `@inject` key or a dependency a `when` excluded then fails the boot, not the first request. */\n protected verifyBindings(): void {\n if (!this.configs.bootChecks?.binding?.doVerify) {\n return;\n }\n\n const logger = this.logger.for(this.verifyBindings.name);\n const tags = [BindingNamespaces.SERVICE, BindingNamespaces.REPOSITORY];\n const failures: string[] = [];\n let verified = 0;\n\n for (const tag of tags) {\n const bindings = this.findByTag({ tag });\n for (const binding of bindings) {\n try {\n this.get({ key: binding.key });\n verified += 1;\n } catch (error) {\n failures.push(\n `${binding.key}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n }\n\n if (failures.length > 0) {\n throw getError({\n message: `[${this.verifyBindings.name}] ${failures.length} binding(s) cannot be resolved | ${failures.join(' | ')}`,\n });\n }\n\n logger.info('Every service and repository binding resolves | verified: %d', verified);\n }\n\n /** One measured log line per step, and a failure names its step before rethrowing, so a hung or failed boot is attributable without reading the sequence. */\n protected async runBootSequence(opts: { steps: IBootSequenceStep[] }): Promise<void> {\n const { steps } = opts;\n const logger = this.logger.for(this.initialize.name);\n const t = performance.now();\n\n const stepsEntries = steps.entries();\n for (const [index, step] of stepsEntries) {\n try {\n await executeWithPerformanceMeasure({\n logger: this.logger,\n scope: this.initialize.name,\n description: `Boot step ${index + 1}/${steps.length} ${step.name}`,\n task: () => step.run(),\n });\n } catch (error) {\n logger.error(\n 'Boot step failed | step: %s (%d/%d) | error: %s',\n step.name,\n index + 1,\n steps.length,\n error,\n );\n throw error;\n }\n }\n\n warnDeprecatedModelSettings({ logger });\n\n logger.info(\n 'Boot sequence complete | %d step(s) | Took: %s (ms) | %s',\n steps.length,\n performance.now() - t,\n steps.map((step) => step.name).join(' -> '),\n );\n }\n\n protected inspectRoutes() {\n const t = performance.now();\n const shouldShowRoutes = this.configs?.debug?.shouldShowRoutes ?? false;\n\n if (!shouldShowRoutes) {\n return;\n }\n\n this.logger.for(this.inspectRoutes.name).info('START | Inspect all application route(s)');\n showApplicationRoutes(this.getServer());\n this.logger\n .for(this.inspectRoutes.name)\n .info('DONE | Inspect all application route(s) | Took: %s (ms)', performance.now() - t);\n }\n\n /**\n * `configured` is the drain's state, mutated in place: a fresh `Set` gives a one-shot complete\n * drain (`RestComponent`); `registerDynamicBindings` passes its persistent per-namespace `Set`,\n * which is why a second sweep touches only what the first one missed.\n */\n async drainByTag<T>(opts: {\n tag: string;\n configured: Set<string>;\n onEach: (opts: { binding: Binding<T> }) => Promise<void>;\n }): Promise<void> {\n const { tag, configured, onEach } = opts;\n\n // A whole batch is drained before re-scanning: the re-scan exists only to pick up bindings a\n // `configure()` added, and asking after every single item makes boot N+1 full scans of the\n // binding map - 3.5ms at 200 controllers, against 0.04ms for this shape.\n let bindings = this.findByTag<T>({ tag, exclude: configured });\n\n while (bindings.length > 0) {\n for (const binding of bindings) {\n // Within a batch a nested `configure()` may already have taken this one.\n if (configured.has(binding.key)) {\n continue;\n }\n\n await onEach({ binding });\n configured.add(binding.key);\n }\n\n // Re-fetch excluding already configured - picks up dynamically added bindings\n bindings = this.findByTag<T>({ tag, exclude: configured });\n }\n }\n\n protected async registerDynamicBindings<T extends IConfigurable = IConfigurable>(\n opts: IRegisterDynamicBindingsOptions<T>,\n ): Promise<void> {\n const logger = this.logger.for(this.registerDynamicBindings.name);\n const { namespace, onBeforeConfigure, onAfterConfigure } = opts;\n\n if (!this.registeredBindings[namespace]) {\n this.registeredBindings[namespace] = new Set<string>();\n }\n const configured = this.registeredBindings[namespace];\n\n await this.drainByTag<T>({\n tag: namespace,\n configured,\n onEach: async ({ binding }) => {\n if (onBeforeConfigure) {\n await onBeforeConfigure({ binding });\n }\n\n const instance = this.get<T>({ key: binding.key, isOptional: false });\n if (!instance) {\n logger.debug('No binding instance | namespace: %s | key: %s', namespace, binding.key);\n return;\n }\n\n if (typeof (instance as Partial<IConfigurable>)?.configure === 'function') {\n const options = this.artifactOptions.get(binding.key);\n await (instance as IConfigurable).configure(options);\n }\n\n // Marked before the after-hook runs, so the hook sees its own binding as configured.\n configured.add(binding.key);\n\n if (onAfterConfigure) {\n await onAfterConfigure({ binding, instance });\n }\n },\n });\n }\n\n /** The same-key guard behind every artifact registration (`component`/`controller`/`service`/`repository`/`dataSource`). `allowOverride` defaults true to match `bind()`'s overwrite behavior; `allowOverride: false` on one registration, or `bootChecks.binding.allowOverride: false` for the whole application, opts into strict mode. */\n protected assertNoBindingCollision(opts: {\n key: string;\n allowOverride?: boolean;\n caller: string;\n }): void {\n const { key, caller } = opts;\n const allowOverride =\n opts.allowOverride ?? this.configs.bootChecks?.binding?.allowOverride ?? true;\n\n if (allowOverride || !this.isBound({ key })) {\n return;\n }\n\n const reason =\n opts.allowOverride === false\n ? `'allowOverride: false' was set and this key collides with an existing binding | Use a distinct 'opts.binding' key, or drop 'allowOverride: false' if overriding is intentional`\n : `'bootChecks.binding.allowOverride' is false and this key collides with an existing binding | Use a distinct 'opts.binding' key, or set 'allowOverride: true' on this registration if overriding is intentional`;\n\n throw getError({\n message: `[${caller}] Binding key already registered: '${key}' | ${reason}`,\n });\n }\n\n /** Resolution order for every registration: explicit `opts` > the class's `@injectable` defaults > the derived key and the kind's default scope. `order` and `when` are `registerArtifacts`' concern, not this one. */\n private registerArtifact<Base>(opts: {\n target: TClass<Base>;\n namespace: TBindingNamespace;\n defaultScope: TBindingScope;\n caller: string;\n opts?: TMixinOpts;\n }): Binding<Base> {\n const { target, namespace, defaultScope, caller } = opts;\n const declared = MetadataRegistry.getInstance().getArtifactMetadata({ target });\n\n if (\n this.runningApplicationHook &&\n this.configs.artifacts &&\n this.configs.bootChecks?.binding?.allowManual === false\n ) {\n throw getError({\n message: `[${caller}] '${target.name}' is registered by hand inside ${this.runningApplicationHook}() while 'configs.artifacts' is set and 'bootChecks.binding.allowManual' is false | Move the class into the generated index (or an explicit entry of 'configs.artifacts'), or allow manual registration`,\n });\n }\n\n const pinned = opts.opts?.binding ?? declared?.binding;\n BindingNamespaces.assertArtifactNamespace({\n namespace: pinned?.namespace ?? namespace,\n artifact: target.name,\n caller,\n });\n\n const { key } = ArtifactBindingKeys.resolve({ target, namespace, binding: pinned });\n\n // What `@inject({ target })` reads back. Only here knows the call site's `binding`, and a\n // class registered by hand has no stereotype metadata to derive one from.\n MetadataRegistry.getInstance().setBindingKey({ target, key });\n\n if (opts.opts?.options !== undefined) {\n this.artifactOptions.set(key, opts.opts.options);\n }\n\n this.assertNoBindingCollision({\n key,\n allowOverride: opts.opts?.allowOverride ?? declared?.allowOverride,\n caller,\n });\n\n return this.bind<Base>({ key })\n .toClass(target)\n .setScope(declared?.scope ?? defaultScope);\n }\n\n configuration<Base extends BaseConfiguration<Options>, Options extends object = {}>(\n target: TClass<Base>,\n opts?: TMixinOpts<Options>,\n ): Binding<Base> {\n return this.registerArtifact({\n target,\n namespace: BindingNamespaces.CONFIGURATION,\n defaultScope: BindingScopes.SINGLETON,\n caller: this.configuration.name,\n opts,\n });\n }\n\n async registerConfigurations(): Promise<void> {\n await executeWithPerformanceMeasure({\n logger: this.logger,\n scope: this.registerConfigurations.name,\n description: 'Register application configurations',\n task: async () => {\n await this.registerDynamicBindings({ namespace: BindingNamespaces.CONFIGURATION });\n },\n });\n }\n\n component<Base extends BaseComponent<Options>, Options extends object = {}>(\n target: TClass<Base>,\n opts?: TMixinOpts<Options>,\n ): Binding<Base> {\n return this.registerArtifact({\n target,\n namespace: BindingNamespaces.COMPONENT,\n defaultScope: BindingScopes.SINGLETON,\n caller: this.component.name,\n opts,\n });\n }\n\n async registerComponents(): Promise<void> {\n await executeWithPerformanceMeasure({\n logger: this.logger,\n scope: this.registerComponents.name,\n description: 'Register application components',\n task: async () => {\n await this.registerDynamicBindings({ namespace: BindingNamespaces.COMPONENT });\n },\n });\n }\n\n /**\n * Second DATASOURCE sweep, for datasources components contributed at any depth. Calls\n * `registerDynamicBindings` directly: `this.registerDataSources()` is polymorphic and an override\n * would run twice. Runs after every component, so a component a datasource registers is never configured.\n */\n async registerContributedDataSources(): Promise<void> {\n await executeWithPerformanceMeasure({\n logger: this.logger,\n scope: this.registerContributedDataSources.name,\n description: 'Register application contributed data sources',\n task: async () => {\n await this.registerDynamicBindings({ namespace: BindingNamespaces.DATASOURCE });\n },\n });\n }\n\n /** REST only - the kernel has no gRPC (it reaches `node:module`). `BaseApplication` adds the gRPC branch on top. */\n async registerControllers(): Promise<void> {\n await executeWithPerformanceMeasure({\n logger: this.logger,\n description: 'Register application REST controllers',\n scope: this.registerControllers.name,\n task: async () => {\n const transports = this.configs.transports ?? [ControllerTransports.REST];\n if (!transports.includes(ControllerTransports.REST)) {\n return;\n }\n\n const restComponent = new RestComponent(this);\n await restComponent.configure();\n },\n });\n }\n\n /** SINGLETON like `component()`: `RestComponent` mounts the one instance it resolves, so a second resolution must be that instance, not an unmounted twin. */\n controller<Base>(target: TClass<Base>, opts?: TMixinOpts): Binding<Base> {\n return this.registerArtifact({\n target,\n namespace: BindingNamespaces.CONTROLLER,\n defaultScope: BindingScopes.SINGLETON,\n caller: this.controller.name,\n opts,\n });\n }\n\n service<Base extends IService>(target: TClass<Base>, opts?: TMixinOpts): Binding<Base> {\n return this.registerArtifact({\n target,\n namespace: BindingNamespaces.SERVICE,\n defaultScope: BindingScopes.TRANSIENT,\n caller: this.service.name,\n opts,\n });\n }\n\n repository<Base extends IRepository>(target: TClass<Base>, opts?: TMixinOpts): Binding<Base> {\n return this.registerArtifact({\n target,\n namespace: BindingNamespaces.REPOSITORY,\n defaultScope: BindingScopes.TRANSIENT,\n caller: this.repository.name,\n opts,\n });\n }\n\n dataSource<Base extends IDataSource<Options>, Options extends object = {}>(\n target: TClass<Base>,\n opts?: TMixinOpts<Options>,\n ): Binding<Base> {\n return this.registerArtifact({\n target,\n namespace: BindingNamespaces.DATASOURCE,\n defaultScope: BindingScopes.SINGLETON,\n caller: this.dataSource.name,\n opts,\n });\n }\n\n /** The boot step body behind `configs.artifacts`, also callable by hand: registers every kind in dependency order across the given indexes. */\n async registerArtifacts(index: TArtifactIndexInput): Promise<void> {\n const resolved = await ArtifactIndexHelper.getInstance().resolve({\n input: index,\n application: this,\n });\n\n const registry = MetadataRegistry.getInstance();\n const kinds: Array<[ReadonlyArray<TClass<AnyType>>, TBindingNamespace]> = [\n [resolved.configurations, BindingNamespaces.CONFIGURATION],\n [resolved.dataSources, BindingNamespaces.DATASOURCE],\n [resolved.components, BindingNamespaces.COMPONENT],\n [resolved.repositories, BindingNamespaces.REPOSITORY],\n [resolved.services, BindingNamespaces.SERVICE],\n [resolved.controllers, BindingNamespaces.CONTROLLER],\n ];\n const collisions = ArtifactBindingKeys.findDerivedCollisions({\n entries: kinds.flatMap(([targets, namespace]) =>\n targets.map((target) => ({\n target,\n namespace,\n binding: registry.getArtifactMetadata({ target })?.binding,\n })),\n ),\n });\n\n for (const key of collisions) {\n const message = ArtifactBindingKeys.describeCollision({ key, caller: 'registerArtifacts' });\n\n if (!this.configs.bootChecks?.allowDerivedKeyCollision) {\n throw getError({ message });\n }\n\n this.logger.warn('%s', message);\n }\n\n for (const target of resolved.configurations) {\n this.configuration(target);\n this.bindProvidedKeys({ target });\n }\n\n for (const target of resolved.dataSources) {\n this.dataSource(target);\n }\n\n for (const target of resolved.components) {\n this.component(target);\n this.bindProvidedKeys({ target });\n }\n\n for (const target of resolved.repositories) {\n this.repository(target);\n }\n\n for (const target of resolved.services) {\n this.service(target);\n }\n\n for (const target of resolved.controllers) {\n this.controller(target);\n }\n }\n\n /** Registers every class a stereotype decorated, with no `configs.artifacts` entry anywhere. `when` and `order` apply exactly as they do to a declared index - which is how one process running several applications keeps them apart. */\n async registerDiscoveredArtifacts(): Promise<void> {\n await this.registerArtifacts(ArtifactIndexHelper.getInstance().buildDiscoveredIndex());\n }\n\n /**\n * The artifact boot step. `configs.discoverArtifacts` adds every decorated class in the import\n * graph; `configs.artifacts` adds exactly what it lists. Both together register the union.\n *\n * An absent `artifacts` still registers nothing. Reading it as \"register everything\" would change\n * what an existing application boots with, silently, and the failure would surface as ten times\n * the bindings rather than as an error.\n */\n protected async registerConfiguredArtifacts(): Promise<void> {\n const inputs: TArtifactIndexInput[] = [];\n\n if (this.configs.discoverArtifacts) {\n inputs.push(ArtifactIndexHelper.getInstance().buildDiscoveredIndex());\n }\n\n if (this.configs.artifacts) {\n inputs.push(this.configs.artifacts);\n }\n\n if (inputs.length === 0) {\n return;\n }\n\n await this.registerArtifacts(inputs);\n }\n\n /** Each `@provide` method becomes a lazy provider: the component is resolved (SINGLETON) and the method called on first `get`, so a provided value may depend on datasources or secrets that do not exist yet at registration time. */\n private bindProvidedKeys(opts: { target: TClass<any> }): void {\n const { target } = opts;\n const registry = MetadataRegistry.getInstance();\n const provides = registry.getProvideMetadata({ target });\n if (provides.length === 0) {\n return;\n }\n\n const declared = registry.getArtifactMetadata({ target });\n const defaultNamespace = declared?.type\n ? ArtifactNamespaces.resolve({ type: declared.type })\n : BindingNamespaces.COMPONENT;\n // The key the registration actually bound - a call-site override included.\n const componentKey =\n registry.getBindingKey({ target }) ??\n ArtifactBindingKeys.resolve({\n target,\n namespace: defaultNamespace,\n binding: declared?.binding,\n }).key;\n for (const entry of provides) {\n this.bind({ key: entry.key })\n .toProvider((container) => {\n const instance = container.get<Record<string | symbol, () => unknown>>({\n key: componentKey,\n });\n return instance[entry.methodName]();\n })\n .setScope(entry.scope ?? BindingScopes.SINGLETON);\n }\n }\n\n async registerDataSources(): Promise<void> {\n await executeWithPerformanceMeasure({\n logger: this.logger,\n scope: this.registerDataSources.name,\n description: 'Register application data sources',\n task: async () => {\n await this.registerDynamicBindings({ namespace: BindingNamespaces.DATASOURCE });\n },\n });\n }\n\n /**\n * Closes every datasource the boot configured, so a stopped application holds no pool, socket or\n * WASM instance. A failure, or a `close()` still pending after `dataSourceCloseTimeoutMs`, is logged\n * and never stops the rest. A datasource configured by hand is closed by whoever configured it.\n */\n protected async closeDataSources(): Promise<void> {\n const keys = this.registeredBindings[BindingNamespaces.DATASOURCE] ?? new Set<string>();\n const timeoutMs = this.configs.dataSourceCloseTimeoutMs ?? 10_000;\n const logger = this.logger.for(this.closeDataSources.name);\n\n for (const key of keys) {\n try {\n const dataSource = this.get<IDataSource>({ key, isOptional: true });\n if (!dataSource?.close) {\n logger.debug('Nothing to close | key: %s', key);\n continue;\n }\n\n const closing = dataSource.close();\n await RetryHelper.runWithTimeout({ operation: key, timeoutMs, execution: () => closing });\n } catch (error) {\n if (RetryHelper.isRetryTimeoutError(error)) {\n logger.error('Close timed out | key: %s | timeoutMs: %d', key, timeoutMs);\n continue;\n }\n\n logger.error('Failed to close datasource | key: %s | error: %s', key, error);\n continue;\n }\n\n logger.info('Closed datasource | key: %s', key);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rest.js","sourceRoot":"","sources":["../../../../src/base/applications/rest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,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,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;oBAChD,SAAS;gBACX,CAAC;gBAED,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;gBACnC,MAAM,WAAW,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5F,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,WAAW,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC3C,MAAM,CAAC,KAAK,CAAC,2CAA2C,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;oBAC1E,SAAS;gBACX,CAAC;gBAED,MAAM,CAAC,KAAK,CAAC,kDAAkD,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;gBAC7E,SAAS;YACX,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { TBindingNamespace } from '@/common/bindings';\nimport { ArtifactNamespaces, BindingNamespaces, CoreBindings } from '@/common/bindings';\nimport type { Binding, TBindingScope } from '@/helpers/inversion';\nimport { BindingScopes, MetadataRegistry } from '@/helpers/inversion';\nimport { OpenAPIHono } from '@hono/zod-openapi';\nimport type { AnyType, IConfigurable, TClass, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport {\n executeWithPerformanceMeasure,\n getError,\n RequestIdGenerator,\n RetryHelper,\n} from '@venizia/ignis-helpers/core';\nimport type { Env, Schema } from 'hono';\nimport { showRoutes as showApplicationRoutes } from 'hono/dev';\nimport { bodyLimit } from 'hono/body-limit';\nimport { requestId } from 'hono/request-id';\nimport type { BaseComponent } from '../components';\nimport { ArtifactBindingKeys } from '../metadata/artifact-keys';\nimport { RestComponent } from '../components/controller/rest/rest.component';\nimport type { BaseConfiguration } from '../configurations';\nimport { ControllerTransports } from '../controllers/common/constants';\nimport type { IDataSource } from '../datasources';\nimport { BaseAppErrorMiddleware } from '../middlewares/app-error/app-error.middleware';\nimport { RequestErrors } from '../middlewares/common/errors';\nimport { notFoundHandler } from '../middlewares/not-found/not-found.middleware';\nimport type { TMixinOpts } from '../mixins/common';\nimport type { IRepository } from '../repositories';\nimport type { IService } from '../services';\nimport { AbstractApplication } from './abstract';\nimport { registerCors } from './cors';\nimport { warnDeprecatedModelMetadata } from './deprecations';\nimport { ArtifactIndexHelper } from './artifact-index';\nimport type { IBootSequenceStep } from './boot-sequence';\nimport { BootSteps } from './boot-sequence';\nimport type { IApplicationConfigs, IBodyLimitOptions, TArtifactIndexInput } from './common';\n\ninterface IRegisterDynamicBindingsOptions<T extends IConfigurable = IConfigurable> {\n namespace: TBindingNamespace;\n\n onBeforeConfigure?: (opts: { binding: Binding<T> }) => Promise<void>;\n onAfterConfigure?: (opts: { binding: Binding<T>; instance: T }) => Promise<void>;\n}\n\n/** Adds the `OpenAPIHono` router surface on top of `AbstractApplication` - no listening server, so this is the layer a browser Worker or gRPC-only host can extend without pulling in `Bun.serve` / `@hono/node-server`. */\nexport abstract class RestApplication<\n AppEnv extends Env = Env,\n AppSchema extends Schema = {},\n BasePath extends string = '/',\n> extends AbstractApplication {\n private registeredBindings: Record<string, Set<string>> = {};\n private artifactOptions = new Map<string, object>();\n\n /** The router, and nothing else. What runtime is underneath and what socket is bound are `ServerApplication`'s to know - a browser Worker has neither, and carrying the union here made `RuntimeModules.detect()` answer `'node'` inside a Worker. */\n protected server: { hono: OpenAPIHono<AppEnv, AppSchema, BasePath> };\n\n protected rootRouter: OpenAPIHono<AppEnv, AppSchema, BasePath>;\n protected readonly requestIdGenerator: RequestIdGenerator;\n\n /** A copy of the `bodyLimit` the default stack installed, absent until `registerDefaultMiddlewares()` ran. */\n private installedBodyLimit?: { options?: IBodyLimitOptions };\n\n constructor(opts: { scope: string; config: IApplicationConfigs }) {\n super(opts);\n\n // A config built from the environment can lose `path.base` at run time; the router would only fail later, inside `route()`, with a message that names nothing.\n if (typeof this.configs.path?.base !== 'string') {\n throw getError({\n message: `[${opts.scope}] configs.path.base must be a string | value: ${String(this.configs.path?.base)} | an empty string mounts the application at the root`,\n });\n }\n\n // The index signature accepts any key, so a leftover `strictPath` would compile and be ignored.\n if (this.configs.strictPath !== undefined) {\n throw getError({\n message: `[${opts.scope}] configs.strictPath was removed | value: ${String(this.configs.strictPath)} | Use configs.path.isStrict`,\n });\n }\n\n this.requestIdGenerator = new RequestIdGenerator({ scope: opts.scope });\n\n const strict = this.configs.path.isStrict ?? true;\n const honoServer = new OpenAPIHono<AppEnv, AppSchema, BasePath>({ strict });\n this.rootRouter = new OpenAPIHono({ strict });\n\n this.server = { hono: honoServer };\n }\n\n getRootRouter(): OpenAPIHono<AppEnv, AppSchema, BasePath> {\n return this.rootRouter;\n }\n\n getServer(): OpenAPIHono<AppEnv, AppSchema, BasePath> {\n return this.server.hono;\n }\n\n protected override registerCoreBindings() {\n super.registerCoreBindings();\n\n this.bind<typeof this.server>({\n key: CoreBindings.APPLICATION_SERVER,\n }).toProvider((_) => this.server);\n this.bind<typeof this.rootRouter>({\n key: CoreBindings.APPLICATION_ROOT_ROUTER,\n }).toProvider((_) => this.rootRouter);\n }\n\n /** The correlation id every host stamps - see {@link RequestIdGenerator} for why `crypto.randomUUID` is refused. */\n protected generateRequestId(): string {\n return this.requestIdGenerator.nextId();\n }\n\n /** The error handler the default stack installs. `@venizia/ignis` overrides it to swap in the `ErrorPrettier`-backed formatter, which reaches `node:util` and so cannot live here. */\n protected buildErrorMiddleware(): BaseAppErrorMiddleware {\n const environment = this.configs.error?.environment;\n\n return new BaseAppErrorMiddleware({\n logger: this.logger,\n rootKey: this.configs.error?.rootKey ?? undefined,\n // Spread, not `environment: () => environment`: the option's PRESENCE is what claims this host\n // has an ambient environment at all, so an unset config must leave it absent.\n ...(environment === undefined ? {} : { environment: () => environment }),\n });\n }\n\n /**\n * The three registrations every host needs: request id, error envelope, JSON 404 - without them a\n * thrown `ApplicationError` is a generic 500, a 404 is `text/plain`, and no response carries a request id.\n * Registered before `initialize()`, so an application's own handlers still win.\n */\n protected registerDefaultMiddlewares(): ValueOrPromise<void> {\n const server = this.getServer();\n\n // First of all, so every response the framework produces on its own - a bodyLimit 413, a body the\n // request spy cannot parse, the error envelope - leaves with the headers a browser needs to read it.\n registerCors({ server, options: this.configs.middlewares?.cors });\n\n server.use(requestId({ generator: () => this.generateRequestId() }));\n\n // Ahead of every middleware a host adds after this one, so none of them buffers a body over it.\n const bodyLimitOptions = this.configs.middlewares?.bodyLimit;\n this.installedBodyLimit = { options: this.toInstalledBodyLimit({ options: bodyLimitOptions }) };\n\n if (bodyLimitOptions && bodyLimitOptions.enable !== false) {\n const { maxSize, path, onError } = bodyLimitOptions;\n\n if (typeof maxSize !== 'number' || !Number.isFinite(maxSize) || maxSize < 0) {\n throw getError({\n message: `[registerDefaultMiddlewares] configs.middlewares.bodyLimit.maxSize must be a non-negative number of bytes | value: ${String(maxSize)}`,\n });\n }\n\n const limiter = bodyLimit({\n maxSize,\n onError:\n onError ??\n (() => {\n throw getError({\n error: RequestErrors.BODY_TOO_LARGE,\n message: `Request body exceeds the maximum of ${maxSize} bytes`,\n });\n }),\n });\n\n if (path) {\n server.use(path, limiter);\n } else {\n server.use(limiter);\n }\n }\n\n server.onError(this.buildErrorMiddleware().value());\n server.notFound(notFoundHandler({ logger: this.logger }));\n }\n\n /** What a `bodyLimit` config installs: nothing when absent or disabled, else a copy, so a later in-place edit shows. */\n private toInstalledBodyLimit(opts: {\n options?: IBodyLimitOptions;\n }): IBodyLimitOptions | undefined {\n const { options } = opts;\n\n if (!options || options.enable === false) {\n return undefined;\n }\n\n return { ...options };\n }\n\n private isSameBodyLimit(opts: { left?: IBodyLimitOptions; right?: IBodyLimitOptions }): boolean {\n const { left, right } = opts;\n\n if (!left || !right) {\n return left === right;\n }\n\n const keys = new Set([...Object.keys(left), ...Object.keys(right)]);\n for (const key of keys) {\n if (!Object.is(left[key], right[key])) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * `configs.middlewares` is read by `registerDefaultMiddlewares()`, which runs before `staticConfigure()`.\n * A limit assigned in a boot hook would read back as configured while every request ran unlimited.\n */\n private assertBodyLimitUnchanged(opts: { step: string }): void {\n if (!this.installedBodyLimit) {\n return;\n }\n\n const installed = this.installedBodyLimit.options;\n const current = this.toInstalledBodyLimit({ options: this.configs.middlewares?.bodyLimit });\n\n if (this.isSameBodyLimit({ left: installed, right: current })) {\n return;\n }\n\n throw getError({\n message: `[${opts.step}] configs.middlewares.bodyLimit changed after registerDefaultMiddlewares() installed it | installed maxSize: ${installed?.maxSize ?? 'none'} | now maxSize: ${current?.maxSize ?? 'none'} | Pass it through the constructor config: new Application({ config: { middlewares: { bodyLimit } } })`,\n });\n }\n\n /**\n * The artifact order, stated once: datasources before the repositories that auto-resolve them,\n * components before the controllers they may contribute. `BaseApplication` splices its server-only\n * steps around these by name instead of rewriting the list.\n */\n protected getBootSequence(): IBootSequenceStep[] {\n return [\n {\n name: BootSteps.STATIC_CONFIGURE,\n run: async () => {\n // Declared `void`, but an override may be async; the step has always waited on it.\n await Promise.resolve(this.staticConfigure());\n this.assertBodyLimitUnchanged({ step: BootSteps.STATIC_CONFIGURE });\n },\n },\n { name: BootSteps.REGISTER_ARTIFACTS, run: () => this.registerConfiguredArtifacts() },\n {\n name: BootSteps.PRE_CONFIGURE,\n run: async () => {\n await this.runApplicationHook({\n name: BootSteps.PRE_CONFIGURE,\n hook: () => this.preConfigure(),\n });\n this.assertBodyLimitUnchanged({ step: BootSteps.PRE_CONFIGURE });\n },\n },\n {\n name: BootSteps.REGISTER_CONFIGURATIONS,\n run: () => this.registerConfigurations(),\n },\n { name: BootSteps.REGISTER_DATA_SOURCES, run: () => this.registerDataSources() },\n { name: BootSteps.REGISTER_COMPONENTS, run: () => this.registerComponents() },\n {\n name: BootSteps.REGISTER_CONTRIBUTED_DATA_SOURCES,\n run: () => this.registerContributedDataSources(),\n },\n { name: BootSteps.REGISTER_CONTROLLERS, run: () => this.registerControllers() },\n {\n name: BootSteps.POST_CONFIGURE,\n run: () =>\n this.runApplicationHook({\n name: BootSteps.POST_CONFIGURE,\n hook: () => this.postConfigure(),\n }),\n },\n { name: BootSteps.VERIFY_BINDINGS, run: () => this.verifyBindings() },\n ];\n }\n\n async initialize(): Promise<void> {\n await this.runBootSequence({ steps: this.getBootSequence() });\n }\n\n /** The application hook currently running, so `registerArtifact` can tell a hand registration inside `preConfigure`/`postConfigure` from one the index step made. */\n private runningApplicationHook: string | undefined;\n\n private async runApplicationHook(opts: {\n name: string;\n hook: () => ValueOrPromise<void>;\n }): Promise<void> {\n this.runningApplicationHook = opts.name;\n try {\n await opts.hook();\n } finally {\n this.runningApplicationHook = undefined;\n }\n }\n\n /**\n * Bound keys carrying one of `tags` that nothing has resolved since the counts were last reset.\n * The counter answers \"who was read\", never \"who is dead\" - an unread binding may be an\n * allow-list entry or a technical floor, and only the application can tell those apart.\n *\n * Counting is off by default. Call `startResolutionCounting()` after `initialize()` and run the\n * traffic that exercises the application, then read this.\n */\n getUnresolvedBindings(opts?: { tags?: string[] }): string[] {\n if (!this.hasStartedResolutionCounting) {\n throw getError({\n message: `[${this.getUnresolvedBindings.name}] Resolution counting never started | Call startResolutionCounting() after initialize(), run the traffic that exercises the application, then read this - without it every binding would be reported unresolved`,\n });\n }\n\n const tags = opts?.tags ?? [BindingNamespaces.SERVICE, BindingNamespaces.REPOSITORY];\n const counts = this.getResolutionCounts();\n const unresolved: string[] = [];\n\n for (const tag of tags) {\n const bindings = this.findByTag({ tag });\n for (const binding of bindings) {\n if (counts.has(binding.key)) {\n continue;\n }\n\n unresolved.push(binding.key);\n }\n }\n\n return unresolved;\n }\n\n /** `bootChecks.binding.doVerify`: resolve every service and repository once, collect every failure, throw once with the whole list - a made-up `@inject` key or a dependency a `when` excluded then fails the boot, not the first request. */\n protected verifyBindings(): void {\n if (!this.configs.bootChecks?.binding?.doVerify) {\n return;\n }\n\n const logger = this.logger.for(this.verifyBindings.name);\n const tags = [BindingNamespaces.SERVICE, BindingNamespaces.REPOSITORY];\n const failures: string[] = [];\n let verified = 0;\n\n for (const tag of tags) {\n const bindings = this.findByTag({ tag });\n for (const binding of bindings) {\n try {\n this.get({ key: binding.key });\n verified += 1;\n } catch (error) {\n failures.push(\n `${binding.key}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n }\n\n if (failures.length > 0) {\n throw getError({\n message: `[${this.verifyBindings.name}] ${failures.length} binding(s) cannot be resolved | ${failures.join(' | ')}`,\n });\n }\n\n logger.info('Every service and repository binding resolves | verified: %d', verified);\n }\n\n /** One measured log line per step, and a failure names its step before rethrowing, so a hung or failed boot is attributable without reading the sequence. */\n protected async runBootSequence(opts: { steps: IBootSequenceStep[] }): Promise<void> {\n const { steps } = opts;\n const logger = this.logger.for(this.initialize.name);\n const t = performance.now();\n\n const stepsEntries = steps.entries();\n for (const [index, step] of stepsEntries) {\n try {\n await executeWithPerformanceMeasure({\n logger: this.logger,\n scope: this.initialize.name,\n description: `Boot step ${index + 1}/${steps.length} ${step.name}`,\n task: () => step.run(),\n });\n } catch (error) {\n logger.error(\n 'Boot step failed | step: %s (%d/%d) | error: %s',\n step.name,\n index + 1,\n steps.length,\n error,\n );\n throw error;\n }\n }\n\n warnDeprecatedModelMetadata({ logger });\n\n logger.info(\n 'Boot sequence complete | %d step(s) | Took: %s (ms) | %s',\n steps.length,\n performance.now() - t,\n steps.map((step) => step.name).join(' -> '),\n );\n }\n\n protected inspectRoutes() {\n const t = performance.now();\n const shouldShowRoutes = this.configs?.debug?.shouldShowRoutes ?? false;\n\n if (!shouldShowRoutes) {\n return;\n }\n\n this.logger.for(this.inspectRoutes.name).info('START | Inspect all application route(s)');\n showApplicationRoutes(this.getServer());\n this.logger\n .for(this.inspectRoutes.name)\n .info('DONE | Inspect all application route(s) | Took: %s (ms)', performance.now() - t);\n }\n\n /**\n * `configured` is the drain's state, mutated in place: a fresh `Set` gives a one-shot complete\n * drain (`RestComponent`); `registerDynamicBindings` passes its persistent per-namespace `Set`,\n * which is why a second sweep touches only what the first one missed.\n */\n async drainByTag<T>(opts: {\n tag: string;\n configured: Set<string>;\n onEach: (opts: { binding: Binding<T> }) => Promise<void>;\n }): Promise<void> {\n const { tag, configured, onEach } = opts;\n\n // A whole batch is drained before re-scanning: the re-scan exists only to pick up bindings a\n // `configure()` added, and asking after every single item makes boot N+1 full scans of the\n // binding map - 3.5ms at 200 controllers, against 0.04ms for this shape.\n let bindings = this.findByTag<T>({ tag, exclude: configured });\n\n while (bindings.length > 0) {\n for (const binding of bindings) {\n // Within a batch a nested `configure()` may already have taken this one.\n if (configured.has(binding.key)) {\n continue;\n }\n\n await onEach({ binding });\n configured.add(binding.key);\n }\n\n // Re-fetch excluding already configured - picks up dynamically added bindings\n bindings = this.findByTag<T>({ tag, exclude: configured });\n }\n }\n\n protected async registerDynamicBindings<T extends IConfigurable = IConfigurable>(\n opts: IRegisterDynamicBindingsOptions<T>,\n ): Promise<void> {\n const logger = this.logger.for(this.registerDynamicBindings.name);\n const { namespace, onBeforeConfigure, onAfterConfigure } = opts;\n\n if (!this.registeredBindings[namespace]) {\n this.registeredBindings[namespace] = new Set<string>();\n }\n const configured = this.registeredBindings[namespace];\n\n await this.drainByTag<T>({\n tag: namespace,\n configured,\n onEach: async ({ binding }) => {\n if (onBeforeConfigure) {\n await onBeforeConfigure({ binding });\n }\n\n const instance = this.get<T>({ key: binding.key, isOptional: false });\n if (!instance) {\n logger.debug('No binding instance | namespace: %s | key: %s', namespace, binding.key);\n return;\n }\n\n if (typeof (instance as Partial<IConfigurable>)?.configure === 'function') {\n const options = this.artifactOptions.get(binding.key);\n await (instance as IConfigurable).configure(options);\n }\n\n // Marked before the after-hook runs, so the hook sees its own binding as configured.\n configured.add(binding.key);\n\n if (onAfterConfigure) {\n await onAfterConfigure({ binding, instance });\n }\n },\n });\n }\n\n /** The same-key guard behind every artifact registration (`component`/`controller`/`service`/`repository`/`dataSource`). `allowOverride` defaults true to match `bind()`'s overwrite behavior; `allowOverride: false` on one registration, or `bootChecks.binding.allowOverride: false` for the whole application, opts into strict mode. */\n protected assertNoBindingCollision(opts: {\n key: string;\n allowOverride?: boolean;\n caller: string;\n }): void {\n const { key, caller } = opts;\n const allowOverride =\n opts.allowOverride ?? this.configs.bootChecks?.binding?.allowOverride ?? true;\n\n if (allowOverride || !this.isBound({ key })) {\n return;\n }\n\n const reason =\n opts.allowOverride === false\n ? `'allowOverride: false' was set and this key collides with an existing binding | Use a distinct 'opts.binding' key, or drop 'allowOverride: false' if overriding is intentional`\n : `'bootChecks.binding.allowOverride' is false and this key collides with an existing binding | Use a distinct 'opts.binding' key, or set 'allowOverride: true' on this registration if overriding is intentional`;\n\n throw getError({\n message: `[${caller}] Binding key already registered: '${key}' | ${reason}`,\n });\n }\n\n /** Resolution order for every registration: explicit `opts` > the class's `@injectable` defaults > the derived key and the kind's default scope. `order` and `when` are `registerArtifacts`' concern, not this one. */\n private registerArtifact<Base>(opts: {\n target: TClass<Base>;\n namespace: TBindingNamespace;\n defaultScope: TBindingScope;\n caller: string;\n opts?: TMixinOpts;\n }): Binding<Base> {\n const { target, namespace, defaultScope, caller } = opts;\n const declared = MetadataRegistry.getInstance().getArtifactMetadata({ target });\n\n if (\n this.runningApplicationHook &&\n this.configs.artifacts &&\n this.configs.bootChecks?.binding?.allowManual === false\n ) {\n throw getError({\n message: `[${caller}] '${target.name}' is registered by hand inside ${this.runningApplicationHook}() while 'configs.artifacts' is set and 'bootChecks.binding.allowManual' is false | Move the class into the generated index (or an explicit entry of 'configs.artifacts'), or allow manual registration`,\n });\n }\n\n const pinned = opts.opts?.binding ?? declared?.binding;\n BindingNamespaces.assertArtifactNamespace({\n namespace: pinned?.namespace ?? namespace,\n artifact: target.name,\n caller,\n });\n\n const { key } = ArtifactBindingKeys.resolve({ target, namespace, binding: pinned });\n\n // What `@inject({ target })` reads back. Only here knows the call site's `binding`, and a\n // class registered by hand has no stereotype metadata to derive one from.\n MetadataRegistry.getInstance().setBindingKey({ target, key });\n\n if (opts.opts?.options !== undefined) {\n this.artifactOptions.set(key, opts.opts.options);\n }\n\n this.assertNoBindingCollision({\n key,\n allowOverride: opts.opts?.allowOverride ?? declared?.allowOverride,\n caller,\n });\n\n return this.bind<Base>({ key })\n .toClass(target)\n .setScope(declared?.scope ?? defaultScope);\n }\n\n configuration<Base extends BaseConfiguration<Options>, Options extends object = {}>(\n target: TClass<Base>,\n opts?: TMixinOpts<Options>,\n ): Binding<Base> {\n return this.registerArtifact({\n target,\n namespace: BindingNamespaces.CONFIGURATION,\n defaultScope: BindingScopes.SINGLETON,\n caller: this.configuration.name,\n opts,\n });\n }\n\n async registerConfigurations(): Promise<void> {\n await executeWithPerformanceMeasure({\n logger: this.logger,\n scope: this.registerConfigurations.name,\n description: 'Register application configurations',\n task: async () => {\n await this.registerDynamicBindings({ namespace: BindingNamespaces.CONFIGURATION });\n },\n });\n }\n\n component<Base extends BaseComponent<Options>, Options extends object = {}>(\n target: TClass<Base>,\n opts?: TMixinOpts<Options>,\n ): Binding<Base> {\n return this.registerArtifact({\n target,\n namespace: BindingNamespaces.COMPONENT,\n defaultScope: BindingScopes.SINGLETON,\n caller: this.component.name,\n opts,\n });\n }\n\n async registerComponents(): Promise<void> {\n await executeWithPerformanceMeasure({\n logger: this.logger,\n scope: this.registerComponents.name,\n description: 'Register application components',\n task: async () => {\n await this.registerDynamicBindings({ namespace: BindingNamespaces.COMPONENT });\n },\n });\n }\n\n /**\n * Second DATASOURCE sweep, for datasources components contributed at any depth. Calls\n * `registerDynamicBindings` directly: `this.registerDataSources()` is polymorphic and an override\n * would run twice. Runs after every component, so a component a datasource registers is never configured.\n */\n async registerContributedDataSources(): Promise<void> {\n await executeWithPerformanceMeasure({\n logger: this.logger,\n scope: this.registerContributedDataSources.name,\n description: 'Register application contributed data sources',\n task: async () => {\n await this.registerDynamicBindings({ namespace: BindingNamespaces.DATASOURCE });\n },\n });\n }\n\n /** REST only - the kernel has no gRPC (it reaches `node:module`). `BaseApplication` adds the gRPC branch on top. */\n async registerControllers(): Promise<void> {\n await executeWithPerformanceMeasure({\n logger: this.logger,\n description: 'Register application REST controllers',\n scope: this.registerControllers.name,\n task: async () => {\n const transports = this.configs.transports ?? [ControllerTransports.REST];\n if (!transports.includes(ControllerTransports.REST)) {\n return;\n }\n\n const restComponent = new RestComponent(this);\n await restComponent.configure();\n },\n });\n }\n\n /** SINGLETON like `component()`: `RestComponent` mounts the one instance it resolves, so a second resolution must be that instance, not an unmounted twin. */\n controller<Base>(target: TClass<Base>, opts?: TMixinOpts): Binding<Base> {\n return this.registerArtifact({\n target,\n namespace: BindingNamespaces.CONTROLLER,\n defaultScope: BindingScopes.SINGLETON,\n caller: this.controller.name,\n opts,\n });\n }\n\n service<Base extends IService>(target: TClass<Base>, opts?: TMixinOpts): Binding<Base> {\n return this.registerArtifact({\n target,\n namespace: BindingNamespaces.SERVICE,\n defaultScope: BindingScopes.TRANSIENT,\n caller: this.service.name,\n opts,\n });\n }\n\n repository<Base extends IRepository>(target: TClass<Base>, opts?: TMixinOpts): Binding<Base> {\n return this.registerArtifact({\n target,\n namespace: BindingNamespaces.REPOSITORY,\n defaultScope: BindingScopes.TRANSIENT,\n caller: this.repository.name,\n opts,\n });\n }\n\n dataSource<Base extends IDataSource<Options>, Options extends object = {}>(\n target: TClass<Base>,\n opts?: TMixinOpts<Options>,\n ): Binding<Base> {\n return this.registerArtifact({\n target,\n namespace: BindingNamespaces.DATASOURCE,\n defaultScope: BindingScopes.SINGLETON,\n caller: this.dataSource.name,\n opts,\n });\n }\n\n /** The boot step body behind `configs.artifacts`, also callable by hand: registers every kind in dependency order across the given indexes. */\n async registerArtifacts(index: TArtifactIndexInput): Promise<void> {\n const resolved = await ArtifactIndexHelper.getInstance().resolve({\n input: index,\n application: this,\n });\n\n const registry = MetadataRegistry.getInstance();\n const kinds: Array<[ReadonlyArray<TClass<AnyType>>, TBindingNamespace]> = [\n [resolved.configurations, BindingNamespaces.CONFIGURATION],\n [resolved.dataSources, BindingNamespaces.DATASOURCE],\n [resolved.components, BindingNamespaces.COMPONENT],\n [resolved.repositories, BindingNamespaces.REPOSITORY],\n [resolved.services, BindingNamespaces.SERVICE],\n [resolved.controllers, BindingNamespaces.CONTROLLER],\n ];\n const collisions = ArtifactBindingKeys.findDerivedCollisions({\n entries: kinds.flatMap(([targets, namespace]) =>\n targets.map((target) => ({\n target,\n namespace,\n binding: registry.getArtifactMetadata({ target })?.binding,\n })),\n ),\n });\n\n for (const key of collisions) {\n const message = ArtifactBindingKeys.describeCollision({ key, caller: 'registerArtifacts' });\n\n if (!this.configs.bootChecks?.allowDerivedKeyCollision) {\n throw getError({ message });\n }\n\n this.logger.warn('%s', message);\n }\n\n for (const target of resolved.configurations) {\n this.configuration(target);\n this.bindProvidedKeys({ target });\n }\n\n for (const target of resolved.dataSources) {\n this.dataSource(target);\n }\n\n for (const target of resolved.components) {\n this.component(target);\n this.bindProvidedKeys({ target });\n }\n\n for (const target of resolved.repositories) {\n this.repository(target);\n }\n\n for (const target of resolved.services) {\n this.service(target);\n }\n\n for (const target of resolved.controllers) {\n this.controller(target);\n }\n }\n\n /** Registers every class a stereotype decorated, with no `configs.artifacts` entry anywhere. `when` and `order` apply exactly as they do to a declared index - which is how one process running several applications keeps them apart. */\n async registerDiscoveredArtifacts(): Promise<void> {\n await this.registerArtifacts(ArtifactIndexHelper.getInstance().buildDiscoveredIndex());\n }\n\n /**\n * The artifact boot step. `configs.discoverArtifacts` adds every decorated class in the import\n * graph; `configs.artifacts` adds exactly what it lists. Both together register the union.\n *\n * An absent `artifacts` still registers nothing. Reading it as \"register everything\" would change\n * what an existing application boots with, silently, and the failure would surface as ten times\n * the bindings rather than as an error.\n */\n protected async registerConfiguredArtifacts(): Promise<void> {\n const inputs: TArtifactIndexInput[] = [];\n\n if (this.configs.discoverArtifacts) {\n inputs.push(ArtifactIndexHelper.getInstance().buildDiscoveredIndex());\n }\n\n if (this.configs.artifacts) {\n inputs.push(this.configs.artifacts);\n }\n\n if (inputs.length === 0) {\n return;\n }\n\n await this.registerArtifacts(inputs);\n }\n\n /** Each `@provide` method becomes a lazy provider: the component is resolved (SINGLETON) and the method called on first `get`, so a provided value may depend on datasources or secrets that do not exist yet at registration time. */\n private bindProvidedKeys(opts: { target: TClass<any> }): void {\n const { target } = opts;\n const registry = MetadataRegistry.getInstance();\n const provides = registry.getProvideMetadata({ target });\n if (provides.length === 0) {\n return;\n }\n\n const declared = registry.getArtifactMetadata({ target });\n const defaultNamespace = declared?.type\n ? ArtifactNamespaces.resolve({ type: declared.type })\n : BindingNamespaces.COMPONENT;\n // The key the registration actually bound - a call-site override included.\n const componentKey =\n registry.getBindingKey({ target }) ??\n ArtifactBindingKeys.resolve({\n target,\n namespace: defaultNamespace,\n binding: declared?.binding,\n }).key;\n for (const entry of provides) {\n this.bind({ key: entry.key })\n .toProvider((container) => {\n const instance = container.get<Record<string | symbol, () => unknown>>({\n key: componentKey,\n });\n return instance[entry.methodName]();\n })\n .setScope(entry.scope ?? BindingScopes.SINGLETON);\n }\n }\n\n async registerDataSources(): Promise<void> {\n await executeWithPerformanceMeasure({\n logger: this.logger,\n scope: this.registerDataSources.name,\n description: 'Register application data sources',\n task: async () => {\n await this.registerDynamicBindings({ namespace: BindingNamespaces.DATASOURCE });\n },\n });\n }\n\n /**\n * Closes every datasource the boot configured, so a stopped application holds no pool, socket or\n * WASM instance. A failure, or a `close()` still pending after `dataSourceCloseTimeoutMs`, is logged\n * and never stops the rest. A datasource configured by hand is closed by whoever configured it.\n */\n protected async closeDataSources(): Promise<void> {\n const keys = this.registeredBindings[BindingNamespaces.DATASOURCE] ?? new Set<string>();\n const timeoutMs = this.configs.dataSourceCloseTimeoutMs ?? 10_000;\n const logger = this.logger.for(this.closeDataSources.name);\n\n for (const key of keys) {\n try {\n const dataSource = this.get<IDataSource>({ key, isOptional: true });\n if (!dataSource?.close) {\n logger.debug('Nothing to close | key: %s', key);\n continue;\n }\n\n const closing = dataSource.close();\n await RetryHelper.runWithTimeout({ operation: key, timeoutMs, execution: () => closing });\n } catch (error) {\n if (RetryHelper.isRetryTimeoutError(error)) {\n logger.error('Close timed out | key: %s | timeoutMs: %d', key, timeoutMs);\n continue;\n }\n\n logger.error('Failed to close datasource | key: %s | error: %s', key, error);\n continue;\n }\n\n logger.info('Closed datasource | key: %s', key);\n }\n }\n}\n"]}
|
|
@@ -27,4 +27,14 @@ export declare class JWKSKeyFormats {
|
|
|
27
27
|
static isValid(input: string): boolean;
|
|
28
28
|
}
|
|
29
29
|
export type TJWKSKeyFormat = TConstValue<typeof JWKSKeyFormats>;
|
|
30
|
+
/** The signing algorithms a JWKS issuer supports. */
|
|
31
|
+
export declare class JWKSAlgorithms {
|
|
32
|
+
static readonly ES256 = "ES256";
|
|
33
|
+
static readonly RS256 = "RS256";
|
|
34
|
+
static readonly EDDSA = "EdDSA";
|
|
35
|
+
static readonly SCHEME_SET: Set<string>;
|
|
36
|
+
static isValid(value: string): boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Valid JWKS algorithm values. */
|
|
39
|
+
export type TJWKSAlgorithm = TConstValue<typeof JWKSAlgorithms>;
|
|
30
40
|
//# sourceMappingURL=jose.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jose.d.ts","sourceRoot":"","sources":["../../../../../../../src/base/auth/authenticate/common/constants/jose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,qBAAa,aAAa;IACxB,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS;IAC5B,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAE9B,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAkC;IAE5D,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAA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C;AACnC,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -30,4 +30,14 @@ export class JWKSKeyFormats {
|
|
|
30
30
|
return this.SCHEME_SET.has(input);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
/** The signing algorithms a JWKS issuer supports. */
|
|
34
|
+
export class JWKSAlgorithms {
|
|
35
|
+
static { this.ES256 = 'ES256'; }
|
|
36
|
+
static { this.RS256 = 'RS256'; }
|
|
37
|
+
static { this.EDDSA = 'EdDSA'; }
|
|
38
|
+
static { this.SCHEME_SET = new Set([this.ES256, this.RS256, this.EDDSA]); }
|
|
39
|
+
static isValid(value) {
|
|
40
|
+
return this.SCHEME_SET.has(value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
33
43
|
//# 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,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;;AAKH,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;;AAKH,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;;AAKH,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","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\n\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\nexport type TJOSEStandard = TConstValue<typeof JOSEStandards>;\n\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\nexport type TJWKSMode = TConstValue<typeof JWKSModes>;\n\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\nexport type TJWKSKeyDriver = TConstValue<typeof JWKSKeyDrivers>;\n\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\nexport type TJWKSKeyFormat = TConstValue<typeof JWKSKeyFormats>;\n"]}
|
|
1
|
+
{"version":3,"file":"jose.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authenticate/common/constants/jose.ts"],"names":[],"mappings":"AAEA,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;;AAKH,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;;AAKH,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;;AAKH,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;;AAKH,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\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\nexport type TJOSEStandard = TConstValue<typeof JOSEStandards>;\n\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\nexport type TJWKSMode = TConstValue<typeof JWKSModes>;\n\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\nexport type TJWKSKeyDriver = TConstValue<typeof JWKSKeyDrivers>;\n\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\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"]}
|
|
@@ -2,7 +2,7 @@ import type { IdType } from '../../../../models/common/index.js';
|
|
|
2
2
|
import type { ValueOrPromise } from '@venizia/ignis-helpers/common';
|
|
3
3
|
import type { AESAlgorithmType, IPayloadCipher } from '@venizia/ignis-helpers/core';
|
|
4
4
|
import type { JWTPayload } from 'jose';
|
|
5
|
-
import type { JOSEStandards, JWKSModes, TJWKSKeyDriver, TJWKSKeyFormat } from '../constants/index.js';
|
|
5
|
+
import type { JOSEStandards, JWKSModes, TJWKSAlgorithm, TJWKSKeyDriver, TJWKSKeyFormat } from '../constants/index.js';
|
|
6
6
|
import type { IAuthUser } from './strategy.js';
|
|
7
7
|
/**
|
|
8
8
|
* Claim checks applied when VERIFYING a JWT. Field names and types mirror jose's `JWTVerifyOptions`
|
|
@@ -65,7 +65,6 @@ export interface IJWSTokenServiceOptions {
|
|
|
65
65
|
/** Claims stamped on every issued token. A configured value WINS over one supplied in the payload. */
|
|
66
66
|
sign?: IJWTSignOptions;
|
|
67
67
|
}
|
|
68
|
-
export type TJWKSAlgorithm = 'ES256' | 'RS256' | 'EdDSA';
|
|
69
68
|
export interface IJWKSIssuerOptions {
|
|
70
69
|
mode: typeof JWKSModes.ISSUER;
|
|
71
70
|
algorithm: TJWKSAlgorithm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../../../../../../src/base/auth/authenticate/common/types/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../../../../../../src/base/auth/authenticate/common/types/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,cAAc,EACd,cAAc,EACd,cAAc,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAChC,sOAAsO;IACtO,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE7B,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB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,EAAE,SAAS;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAE9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,OAAO;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,CAAC,CAAA;KAAE,GAAG,MAAM,CAAC;IACtC,WAAW,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,CAAC,CAAC;CACvC;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authenticate/common/types/jwt.ts"],"names":[],"mappings":"","sourcesContent":["import type { IdType } from '@/base/models/common';\nimport type { ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { AESAlgorithmType, IPayloadCipher } from '@venizia/ignis-helpers/core';\nimport type { JWTPayload } from 'jose';\nimport type {
|
|
1
|
+
{"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authenticate/common/types/jwt.ts"],"names":[],"mappings":"","sourcesContent":["import type { IdType } from '@/base/models/common';\nimport type { ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { AESAlgorithmType, IPayloadCipher } from '@venizia/ignis-helpers/core';\nimport type { JWTPayload } from 'jose';\nimport type {\n JOSEStandards,\n JWKSModes,\n TJWKSAlgorithm,\n TJWKSKeyDriver,\n TJWKSKeyFormat,\n} from '../constants';\nimport type { IAuthUser } from './strategy';\n\n/**\n * Claim checks applied when VERIFYING a JWT. Field names and types mirror jose's `JWTVerifyOptions`\n * exactly, so this is a pass-through with no translation layer.\n *\n * Every field is optional and unset by default, which is today's behaviour: nothing is checked\n * beyond the signature and the time claims. In a fleet where every verifier points at the same\n * issuer JWKS, that means a token minted for one service is accepted verbatim by every other -\n * `audience` is what makes \"this token was meant for me\" a cryptographic statement rather than a\n * convention.\n */\nexport interface IJWTVerifyOptions {\n /** Expected `aud`. Setting it makes the claim required. Matching is jose's OVERLAP semantics, not equality: a token carrying `['a','b']` satisfies `audience: 'a'`. Enforce single-valued audiences at issue time if that matters. */\n audience?: string | string[];\n\n /** Expected `iss`. Setting it makes the claim required. */\n issuer?: string | string[];\n\n /** Expected `sub`. Setting it makes the claim required. */\n subject?: string;\n\n /** Clock skew tolerance: seconds, or a jose duration string such as `'30 seconds'`. */\n clockTolerance?: string | number;\n\n /** Accepted JWS `alg` header values. Unset means the accepted algorithm is decided entirely by what the JWKS serves. */\n algorithms?: string[];\n\n /** Caps elapsed time since `iat`. The real replay window for a short-lived assertion, independent of whatever `exp` the caller chose to stamp. */\n maxTokenAge?: string | number;\n\n /** Expected JWS `typ` header. The standard defence against cross-token-type confusion when one JWKS serves more than one kind of token. */\n typ?: string;\n\n /** Claims that must be present, beyond those implied by the checks above. */\n requiredClaims?: string[];\n}\n\n/** Default `iss` / `aud` stamped on every issued token. Configured values are AUTHORITATIVE - see {@link IJWTIssueClaims}. */\nexport interface IJWTSignOptions {\n issuer?: string;\n audience?: string | string[];\n}\n\n/**\n * Per-token registered claims, passed to `generate()`.\n *\n * This is the supported way to vary `aud` or `sub` per token. Putting them on the payload used to\n * work by accident - `iss`, `aud`, `sub` and `jti` ride through the AES envelope in the clear\n * because they are standard JWT fields - but a claim the payload can set is a claim any caller who\n * shapes the payload can forge. These win over {@link IJWTSignOptions}; the payload never does.\n */\nexport interface IJWTIssueClaims {\n issuer?: string;\n audience?: string | string[];\n subject?: string;\n jwtId?: string;\n}\n\nexport interface IJWSTokenServiceOptions {\n headerAlgorithm?: string;\n jwtSecret: string;\n getTokenExpiresFn: TGetTokenExpiresFn;\n aesAlgorithm?: AESAlgorithmType;\n applicationSecret?: string;\n fieldCodecs?: IPayloadFieldCodec[];\n /** Overrides the payload cipher - pass `LegacyAES` to keep reading tokens issued before the PBKDF2 envelope. */\n cipher?: IPayloadCipher;\n\n /** Claim checks applied on verify. Unset means signature and time claims only. */\n verify?: IJWTVerifyOptions;\n\n /** Claims stamped on every issued token. A configured value WINS over one supplied in the payload. */\n sign?: IJWTSignOptions;\n}\n\nexport interface IJWKSIssuerOptions {\n mode: typeof JWKSModes.ISSUER;\n algorithm: TJWKSAlgorithm;\n rest?: { path: string };\n keys: {\n driver: TJWKSKeyDriver;\n format: TJWKSKeyFormat;\n private: string; // Key content (text) or file path (file) — PEM or JWK based on format\n public: string; // Key content (text) or file path (file) — PEM or JWK based on format\n };\n kid: string;\n getTokenExpiresFn: TGetTokenExpiresFn;\n aesAlgorithm?: AESAlgorithmType;\n applicationSecret?: string;\n fieldCodecs?: IPayloadFieldCodec[];\n /** Overrides the payload cipher - pass `LegacyAES` to keep reading tokens issued before the PBKDF2 envelope. */\n cipher?: IPayloadCipher;\n\n /** Claim checks applied on verify. Unset means signature and time claims only. */\n verify?: IJWTVerifyOptions;\n\n /** Claims stamped on every issued token. A configured value WINS over one supplied in the payload. */\n sign?: IJWTSignOptions;\n}\n\nexport interface IJWKSVerifierOptions {\n mode: typeof JWKSModes.VERIFIER;\n jwksUrl: string;\n cacheTtlMs?: number; // Default: 43_200_000 (12h)\n cooldownMs?: number; // Default: 30_000 (30s)\n aesAlgorithm?: AESAlgorithmType;\n applicationSecret?: string;\n fieldCodecs?: IPayloadFieldCodec[];\n /** Overrides the payload cipher - pass `LegacyAES` to keep reading tokens issued before the PBKDF2 envelope. */\n cipher?: IPayloadCipher;\n\n /** Claim checks applied on verify. Unset means signature and time claims only. */\n verify?: IJWTVerifyOptions;\n}\n\nexport type TJWKSTokenServiceOptions = IJWKSIssuerOptions | IJWKSVerifierOptions;\n\nexport type TJWTTokenServiceOptions =\n | { standard: typeof JOSEStandards.JWS; options: IJWSTokenServiceOptions }\n | { standard: typeof JOSEStandards.JWKS; options: TJWKSTokenServiceOptions };\n\nexport interface IJWTTokenPayload extends JWTPayload, IAuthUser {\n userId: IdType;\n roles: { id: IdType; identifier: string; priority: number }[];\n\n clientId?: string;\n provider?: string;\n email?: string;\n name?: string;\n\n [extra: string | symbol]: any;\n}\n\nexport interface IPayloadFieldCodec<T = unknown> {\n key: string;\n serialize(opts: { value: T }): string;\n deserialize(opts: { raw: string }): T;\n}\n\nexport type TGetTokenExpiresFn = () => ValueOrPromise<number>;\n"]}
|
|
@@ -120,4 +120,15 @@ export declare class AuthorizationPolicyVariants {
|
|
|
120
120
|
}
|
|
121
121
|
/** The `variant` column's full value set, derived from {@link AuthorizationPolicyVariants.ALL} - never hand-list the seven strings again. */
|
|
122
122
|
export type TAuthorizationPolicyVariant = (typeof AuthorizationPolicyVariants.ALL)[number]['action'];
|
|
123
|
+
/** Where an `IAuthorizationDomainSource` reads the request domain from. */
|
|
124
|
+
export declare class AuthorizationDomainSources {
|
|
125
|
+
static readonly PARAM = "param";
|
|
126
|
+
static readonly HEADER = "header";
|
|
127
|
+
static readonly QUERY = "query";
|
|
128
|
+
static readonly CONTEXT = "context";
|
|
129
|
+
static readonly SCHEME_SET: Set<string>;
|
|
130
|
+
static isValid(value: string): boolean;
|
|
131
|
+
}
|
|
132
|
+
/** Valid authorization domain source values. */
|
|
133
|
+
export type TAuthorizationDomainSource = TConstValue<typeof AuthorizationDomainSources>;
|
|
123
134
|
//# sourceMappingURL=authorization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../../../../../../src/base/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;;;;;OAQR;IAEX,MAAM,CAAC,QAAQ,CAAC,iBAAiB,cAAiE;IAElG,MAAM,CAAC,QAAQ,CAAC,eAAe,cAA+D;IAE9F,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAI5C,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAG3C;AAED,6IAA6I;AAC7I,MAAM,MAAM,2BAA2B,GACrC,CAAC,OAAO,2BAA2B,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;AAE7D,2EAA2E;AAC3E,qBAAa,0BAA0B;IACrC,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAChC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAChC,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IAEpC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAwE;IAElG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,gDAAgD;AAChD,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
@@ -151,4 +151,15 @@ export class AuthorizationPolicyVariants {
|
|
|
151
151
|
return this.RULE_SCHEME_SET.has(input);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
+
/** Where an `IAuthorizationDomainSource` reads the request domain from. */
|
|
155
|
+
export class AuthorizationDomainSources {
|
|
156
|
+
static { this.PARAM = 'param'; }
|
|
157
|
+
static { this.HEADER = 'header'; }
|
|
158
|
+
static { this.QUERY = 'query'; }
|
|
159
|
+
static { this.CONTEXT = 'context'; }
|
|
160
|
+
static { this.SCHEME_SET = new Set([this.PARAM, this.HEADER, this.QUERY, this.CONTEXT]); }
|
|
161
|
+
static isValid(value) {
|
|
162
|
+
return this.SCHEME_SET.has(value);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
154
165
|
//# 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;AAEhD,MAAM,OAAO,aAAa;aACR,UAAK,GAAG,qBAAqB,CAAC;aAC9B,uBAAkB,GAAG,oBAAoB,CAAC;aAC1C,aAAQ,GAAG,wBAAwB,CAAC;aACpC,WAAM,GAAG,sBAAsB,CAAC;;AAGlD,MAAM,OAAO,oBAAoB;aACf,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,YAAO,GAAG,SAAS,CAAC;aAEpB,SAAI,GAAG,MAAM,CAAC;aACd,UAAK,GAAG,OAAO,CAAC;aAChB,WAAM,GAAG,QAAQ,CAAC;IAElC,+FAA+F;aAC/E,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAC;QACnC,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,OAAO;QAEZ,IAAI,CAAC,IAAI;QACT,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,MAAM;QAEX,IAAI,CAAC,MAAM;KACZ,CAAC,CAAC;aAEa,YAAO,GAGlB;QACH,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;QACzC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;QAC1C,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,E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AC;aAEK,sBAAiB,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;aAElF,oBAAe,GAAG,IAAI,GAAG,CAAC,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","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { AuthorizationRole } from '../../models/authorization-role.model';\nimport { CasbinRuleVariants } from './enforcer';\n\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\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}\nexport type TAuthorizationAction = TConstValue<typeof AuthorizationActions>;\n\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 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 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 return input.toLowerCase() === this.ABSTAIN;\n }\n}\nexport type TAuthorizationDecision = TConstValue<typeof AuthorizationDecisions>;\n\nexport class AuthorizationRoles {\n static readonly SUPER_ADMIN = AuthorizationRole.build({\n name: 'super-admin',\n priority: 999,\n });\n static readonly ADMIN = AuthorizationRole.build({\n name: 'admin',\n priority: 900,\n });\n static readonly USER = AuthorizationRole.build({\n name: 'user',\n priority: 10,\n });\n static readonly GUEST = AuthorizationRole.build({\n name: 'guest',\n priority: 1,\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\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}\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"]}
|
|
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,M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AAE,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\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\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}\nexport type TAuthorizationAction = TConstValue<typeof AuthorizationActions>;\n\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 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 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 return input.toLowerCase() === this.ABSTAIN;\n }\n}\nexport type TAuthorizationDecision = TConstValue<typeof AuthorizationDecisions>;\n\nexport class AuthorizationRoles {\n static readonly SUPER_ADMIN = AuthorizationRole.build({\n name: 'super-admin',\n priority: 999,\n });\n static readonly ADMIN = AuthorizationRole.build({\n name: 'admin',\n priority: 900,\n });\n static readonly USER = AuthorizationRole.build({\n name: 'user',\n priority: 10,\n });\n static readonly GUEST = AuthorizationRole.build({\n name: 'guest',\n priority: 1,\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\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}\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"]}
|
|
@@ -3,6 +3,7 @@ import type { TContext } from '../../../../controllers/common/types/index.js';
|
|
|
3
3
|
import { type TNullable, type ValueOrPromise } from '@venizia/ignis-helpers/common';
|
|
4
4
|
import type { Env } from 'hono';
|
|
5
5
|
import type { IAuthUser } from '../../../authenticate/common/types/index.js';
|
|
6
|
+
import type { TAuthorizationDomainSource } from '../constants/index.js';
|
|
6
7
|
export interface IAuthorizationRole {
|
|
7
8
|
readonly name: string;
|
|
8
9
|
readonly priority: number;
|
|
@@ -22,7 +23,7 @@ export interface IAuthorizationUser extends IAuthUser {
|
|
|
22
23
|
}
|
|
23
24
|
/** Declarative description of where to read the request domain from. */
|
|
24
25
|
export interface IAuthorizationDomainSource {
|
|
25
|
-
from:
|
|
26
|
+
from: TAuthorizationDomainSource;
|
|
26
27
|
key: string;
|
|
27
28
|
type: string;
|
|
28
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../../../../src/base/auth/authorize/common/types/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../../../../src/base/auth/authorize/common/types/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,qGAAqG;AACrG,MAAM,MAAM,wBAAwB,CAClC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EACjD,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,IAC1C,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAE/B,MAAM,WAAW,qBAAqB,CAAC,OAAO,GAAG,MAAM,EAAE,SAAS,GAAG,MAAM;IACzE,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,wBAAwB,CAAC;IACtC,mLAAmL;IACnL,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wEAAwE;AACxE,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,0BAA0B,CAAC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,4EAA4E;AAC5E,MAAM,MAAM,4BAA4B,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE;IACrE,OAAO,EAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;CAC9B,KAAK,cAAc,CAAC,SAAS,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authorize/common/types/request.ts"],"names":[],"mappings":"","sourcesContent":["import type { IdType } from '@/base';\nimport type { TContext } from '@/base/controllers/common/types';\nimport { type TNullable, type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { Env } from 'hono';\nimport type { IAuthUser } from '../../../authenticate/common/types';\n\nexport interface IAuthorizationRole {\n readonly name: string;\n readonly priority: number;\n readonly identifier: string;\n}\n\n/** Key-value conditions for attribute-based access control. Values compared with strict equality. */\nexport type TAuthorizationConditions<\n KeyType extends string | symbol = string | symbol,\n ValueType = string | number | boolean | null,\n> = Record<KeyType, ValueType>;\n\nexport interface IAuthorizationRequest<TAction = string, TResource = string> {\n action: TAction;\n resource: TResource;\n conditions?: TAuthorizationConditions;\n /** Resolved domain scope for this request as a casbin domain string `\"<DomainType>_<id>\"` (e.g. `\"Merchant_7\"`), or the `\"SYSTEM_WIDE\"` sentinel to enforce across all domains. */\n domain?: string;\n}\n\nexport interface IAuthorizationUser extends IAuthUser {\n principalType: string;\n}\n\n/** Declarative description of where to read the request domain from. */\nexport interface IAuthorizationDomainSource {\n from:
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../../../../src/base/auth/authorize/common/types/request.ts"],"names":[],"mappings":"","sourcesContent":["import type { IdType } from '@/base';\nimport type { TContext } from '@/base/controllers/common/types';\nimport { type TNullable, type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { Env } from 'hono';\nimport type { IAuthUser } from '../../../authenticate/common/types';\nimport type { TAuthorizationDomainSource } from '../constants';\n\nexport interface IAuthorizationRole {\n readonly name: string;\n readonly priority: number;\n readonly identifier: string;\n}\n\n/** Key-value conditions for attribute-based access control. Values compared with strict equality. */\nexport type TAuthorizationConditions<\n KeyType extends string | symbol = string | symbol,\n ValueType = string | number | boolean | null,\n> = Record<KeyType, ValueType>;\n\nexport interface IAuthorizationRequest<TAction = string, TResource = string> {\n action: TAction;\n resource: TResource;\n conditions?: TAuthorizationConditions;\n /** Resolved domain scope for this request as a casbin domain string `\"<DomainType>_<id>\"` (e.g. `\"Merchant_7\"`), or the `\"SYSTEM_WIDE\"` sentinel to enforce across all domains. */\n domain?: string;\n}\n\nexport interface IAuthorizationUser extends IAuthUser {\n principalType: string;\n}\n\n/** Declarative description of where to read the request domain from. */\nexport interface IAuthorizationDomainSource {\n from: TAuthorizationDomainSource;\n key: string;\n type: string; // domain type, e.g. 'Merchant' | 'Organizer'\n}\n\n/** Returns the current request domain; null = no domain (→ SYSTEM_WIDE). */\nexport type TAuthorizationDomainResolver<E extends Env = Env> = (opts: {\n context: TContext<E, string>;\n}) => ValueOrPromise<TNullable<{ type: string; id: IdType }>>;\n"]}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { AuthorizationDomainScopes } from '../common/constants/index.js';
|
|
1
|
+
import { AuthorizationDomainScopes, AuthorizationDomainSources } from '../common/constants/index.js';
|
|
2
2
|
/** Read a domain value from a declarative source on the Hono context. */
|
|
3
3
|
export const readDeclarative = (opts) => {
|
|
4
4
|
const { source, context } = opts;
|
|
5
5
|
switch (source.from) {
|
|
6
|
-
case
|
|
6
|
+
case AuthorizationDomainSources.PARAM: {
|
|
7
7
|
return context.req.param(source.key) ?? null;
|
|
8
8
|
}
|
|
9
|
-
case
|
|
9
|
+
case AuthorizationDomainSources.HEADER: {
|
|
10
10
|
return context.req.header(source.key) ?? null;
|
|
11
11
|
}
|
|
12
|
-
case
|
|
12
|
+
case AuthorizationDomainSources.QUERY: {
|
|
13
13
|
return context.req.query(source.key) ?? null;
|
|
14
14
|
}
|
|
15
|
-
case
|
|
15
|
+
case AuthorizationDomainSources.CONTEXT: {
|
|
16
16
|
const value = context.get(source.key);
|
|
17
17
|
return value == null ? null : String(value);
|
|
18
18
|
}
|