@venizia/ignis-kernel 0.4.6 → 0.4.7-1
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/LICENSE.md +1 -4
- package/dist/esm/base/applications/artifact-group.d.ts.map +1 -1
- package/dist/esm/base/applications/artifact-group.js +4 -1
- package/dist/esm/base/applications/artifact-group.js.map +1 -1
- package/dist/esm/base/applications/artifact-index.d.ts.map +1 -1
- package/dist/esm/base/applications/artifact-index.js +2 -1
- package/dist/esm/base/applications/artifact-index.js.map +1 -1
- package/dist/esm/base/applications/cors.d.ts +12 -10
- package/dist/esm/base/applications/cors.d.ts.map +1 -1
- package/dist/esm/base/applications/cors.js +37 -35
- package/dist/esm/base/applications/cors.js.map +1 -1
- package/dist/esm/base/applications/rest.js +11 -11
- package/dist/esm/base/applications/rest.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/codecs.js +2 -2
- package/dist/esm/base/auth/authenticate/common/codecs.js.map +1 -1
- package/dist/esm/base/auth/authenticate/strategies/strategy-registry.d.ts +1 -1
- package/dist/esm/base/auth/authenticate/strategies/strategy-registry.js +1 -1
- package/dist/esm/base/auth/authenticate/strategies/strategy-registry.js.map +1 -1
- package/dist/esm/base/auth/authorize/providers/authorization.provider.d.ts.map +1 -1
- package/dist/esm/base/auth/authorize/providers/authorization.provider.js +14 -11
- package/dist/esm/base/auth/authorize/providers/authorization.provider.js.map +1 -1
- package/dist/esm/base/auth/authorize/providers/request-domain.d.ts +14 -11
- package/dist/esm/base/auth/authorize/providers/request-domain.d.ts.map +1 -1
- package/dist/esm/base/auth/authorize/providers/request-domain.js +42 -39
- package/dist/esm/base/auth/authorize/providers/request-domain.js.map +1 -1
- package/dist/esm/base/auth/base/abstract-auth-registry.js +2 -2
- package/dist/esm/base/auth/base/abstract-auth-registry.js.map +1 -1
- package/dist/esm/base/auth/models/requests/change-password.schema.js +3 -3
- package/dist/esm/base/auth/models/requests/change-password.schema.js.map +1 -1
- package/dist/esm/base/auth/models/requests/sign-in.schema.js +5 -5
- package/dist/esm/base/auth/models/requests/sign-in.schema.js.map +1 -1
- package/dist/esm/base/components/controller/rest/rest.component.js +2 -2
- package/dist/esm/base/components/controller/rest/rest.component.js.map +1 -1
- package/dist/esm/base/controllers/common/index.d.ts +0 -1
- package/dist/esm/base/controllers/common/index.d.ts.map +1 -1
- package/dist/esm/base/controllers/common/index.js +0 -1
- package/dist/esm/base/controllers/common/index.js.map +1 -1
- package/dist/esm/base/controllers/common/schema-builders.d.ts +0 -5
- package/dist/esm/base/controllers/common/schema-builders.d.ts.map +1 -1
- package/dist/esm/base/controllers/common/schema-builders.js +0 -14
- package/dist/esm/base/controllers/common/schema-builders.js.map +1 -1
- package/dist/esm/base/controllers/context.d.ts +7 -2
- package/dist/esm/base/controllers/context.d.ts.map +1 -1
- package/dist/esm/base/controllers/context.js +7 -4
- package/dist/esm/base/controllers/context.js.map +1 -1
- package/dist/esm/base/controllers/factory/controller.d.ts +33 -1
- package/dist/esm/base/controllers/factory/controller.d.ts.map +1 -1
- package/dist/esm/base/controllers/factory/controller.js +90 -6
- package/dist/esm/base/controllers/factory/controller.js.map +1 -1
- package/dist/esm/base/controllers/factory/crud/persistable.d.ts.map +1 -1
- package/dist/esm/base/controllers/factory/crud/persistable.js +40 -25
- package/dist/esm/base/controllers/factory/crud/persistable.js.map +1 -1
- package/dist/esm/base/controllers/factory/crud/readable.d.ts.map +1 -1
- package/dist/esm/base/controllers/factory/crud/readable.js +4 -3
- package/dist/esm/base/controllers/factory/crud/readable.js.map +1 -1
- package/dist/esm/base/controllers/factory/definition.d.ts +1 -8
- package/dist/esm/base/controllers/factory/definition.d.ts.map +1 -1
- package/dist/esm/base/controllers/factory/definition.js +17 -24
- package/dist/esm/base/controllers/factory/definition.js.map +1 -1
- package/dist/esm/base/controllers/factory/index.d.ts +0 -1
- package/dist/esm/base/controllers/factory/index.d.ts.map +1 -1
- package/dist/esm/base/controllers/factory/index.js +0 -1
- package/dist/esm/base/controllers/factory/index.js.map +1 -1
- package/dist/esm/base/controllers/rest/abstract.d.ts.map +1 -1
- package/dist/esm/base/controllers/rest/abstract.js +6 -6
- package/dist/esm/base/controllers/rest/abstract.js.map +1 -1
- package/dist/esm/base/controllers/rest/base.d.ts +0 -5
- package/dist/esm/base/controllers/rest/base.d.ts.map +1 -1
- package/dist/esm/base/controllers/rest/base.js +14 -14
- package/dist/esm/base/controllers/rest/base.js.map +1 -1
- package/dist/esm/base/datasources/abstract.js +2 -2
- package/dist/esm/base/datasources/abstract.js.map +1 -1
- package/dist/esm/base/events/event-bus.js +4 -4
- package/dist/esm/base/events/event-bus.js.map +1 -1
- package/dist/esm/base/metadata/injectable.d.ts +7 -4
- package/dist/esm/base/metadata/injectable.d.ts.map +1 -1
- package/dist/esm/base/metadata/injectable.js +26 -23
- package/dist/esm/base/metadata/injectable.js.map +1 -1
- package/dist/esm/base/metadata/model-metadata.d.ts +27 -13
- package/dist/esm/base/metadata/model-metadata.d.ts.map +1 -1
- package/dist/esm/base/metadata/model-metadata.js +56 -26
- package/dist/esm/base/metadata/model-metadata.js.map +1 -1
- package/dist/esm/base/metadata/persistents.d.ts.map +1 -1
- package/dist/esm/base/metadata/persistents.js +21 -13
- package/dist/esm/base/metadata/persistents.js.map +1 -1
- package/dist/esm/base/metadata/routes/controller.d.ts.map +1 -1
- package/dist/esm/base/metadata/routes/controller.js +5 -2
- package/dist/esm/base/metadata/routes/controller.js.map +1 -1
- package/dist/esm/base/middlewares/app-error/app-error.middleware.js +7 -7
- package/dist/esm/base/middlewares/app-error/app-error.middleware.js.map +1 -1
- package/dist/esm/base/middlewares/app-error/database.handler.d.ts +14 -12
- package/dist/esm/base/middlewares/app-error/database.handler.d.ts.map +1 -1
- package/dist/esm/base/middlewares/app-error/database.handler.js +37 -35
- package/dist/esm/base/middlewares/app-error/database.handler.js.map +1 -1
- package/dist/esm/base/middlewares/app-error/zod.handler.d.ts +28 -23
- package/dist/esm/base/middlewares/app-error/zod.handler.d.ts.map +1 -1
- package/dist/esm/base/middlewares/app-error/zod.handler.js +56 -53
- package/dist/esm/base/middlewares/app-error/zod.handler.js.map +1 -1
- package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.d.ts +6 -4
- package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.d.ts.map +1 -1
- package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.js +14 -12
- package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.js.map +1 -1
- package/dist/esm/base/middlewares/form-body/form-body.middleware.d.ts +15 -11
- package/dist/esm/base/middlewares/form-body/form-body.middleware.d.ts.map +1 -1
- package/dist/esm/base/middlewares/form-body/form-body.middleware.js +25 -21
- package/dist/esm/base/middlewares/form-body/form-body.middleware.js.map +1 -1
- package/dist/esm/base/models/common/schemas.d.ts +184 -105
- package/dist/esm/base/models/common/schemas.d.ts.map +1 -1
- package/dist/esm/base/models/common/schemas.js +105 -54
- package/dist/esm/base/models/common/schemas.js.map +1 -1
- package/dist/esm/base/models/common/utilities.d.ts +10 -5
- package/dist/esm/base/models/common/utilities.d.ts.map +1 -1
- package/dist/esm/base/models/common/utilities.js +22 -16
- package/dist/esm/base/models/common/utilities.js.map +1 -1
- package/dist/esm/base/repositories/common/types/results.d.ts +15 -7
- package/dist/esm/base/repositories/common/types/results.d.ts.map +1 -1
- package/dist/esm/base/repositories/common/types/results.js +16 -7
- package/dist/esm/base/repositories/common/types/results.js.map +1 -1
- package/dist/esm/base/repositories/core/abstract.d.ts.map +1 -1
- package/dist/esm/base/repositories/core/abstract.js +5 -3
- package/dist/esm/base/repositories/core/abstract.js.map +1 -1
- package/dist/esm/base/repositories/query-schemas/index.d.ts +1 -1
- package/dist/esm/base/repositories/query-schemas/index.d.ts.map +1 -1
- package/dist/esm/base/repositories/query-schemas/index.js +3 -3
- package/dist/esm/base/repositories/query-schemas/index.js.map +1 -1
- package/dist/esm/helpers/inversion/common/relation-builder.js.map +1 -1
- package/dist/esm/helpers/inversion/index.d.ts +1 -1
- package/dist/esm/helpers/inversion/index.d.ts.map +1 -1
- package/dist/esm/helpers/inversion/index.js +1 -1
- package/dist/esm/helpers/inversion/index.js.map +1 -1
- package/dist/esm/helpers/inversion/mixins/repository.mixin.d.ts.map +1 -1
- package/dist/esm/helpers/inversion/mixins/repository.mixin.js +5 -5
- package/dist/esm/helpers/inversion/mixins/repository.mixin.js.map +1 -1
- package/dist/esm/metadata.d.ts +1 -1
- package/dist/esm/metadata.d.ts.map +1 -1
- package/dist/esm/metadata.js +1 -1
- package/dist/esm/metadata.js.map +1 -1
- package/dist/esm/repository.d.ts +2 -2
- package/dist/esm/repository.d.ts.map +1 -1
- package/dist/esm/repository.js +2 -2
- package/dist/esm/repository.js.map +1 -1
- package/dist/esm/utilities/index.d.ts +1 -1
- package/dist/esm/utilities/index.d.ts.map +1 -1
- package/dist/esm/utilities/index.js +1 -1
- package/dist/esm/utilities/index.js.map +1 -1
- package/dist/esm/utilities/not-supported.utility.d.ts +11 -0
- package/dist/esm/utilities/not-supported.utility.d.ts.map +1 -0
- package/dist/esm/utilities/not-supported.utility.js +19 -0
- package/dist/esm/utilities/not-supported.utility.js.map +1 -0
- package/package.json +6 -7
- package/dist/esm/base/controllers/common/html-response.d.ts +0 -70
- package/dist/esm/base/controllers/common/html-response.d.ts.map +0 -1
- package/dist/esm/base/controllers/common/html-response.js +0 -30
- package/dist/esm/base/controllers/common/html-response.js.map +0 -1
- package/dist/esm/base/controllers/factory/authorize-guard.d.ts +0 -19
- package/dist/esm/base/controllers/factory/authorize-guard.d.ts.map +0 -1
- package/dist/esm/base/controllers/factory/authorize-guard.js +0 -56
- package/dist/esm/base/controllers/factory/authorize-guard.js.map +0 -1
- package/dist/esm/base/controllers/factory/helper.d.ts +0 -2
- package/dist/esm/base/controllers/factory/helper.d.ts.map +0 -1
- package/dist/esm/base/controllers/factory/helper.js +0 -2
- package/dist/esm/base/controllers/factory/helper.js.map +0 -1
- package/dist/esm/base/controllers/factory/repository-injection.d.ts +0 -14
- package/dist/esm/base/controllers/factory/repository-injection.d.ts.map +0 -1
- package/dist/esm/base/controllers/factory/repository-injection.js +0 -27
- package/dist/esm/base/controllers/factory/repository-injection.js.map +0 -1
- package/dist/esm/base/metadata/model-settings.d.ts +0 -11
- package/dist/esm/base/metadata/model-settings.d.ts.map +0 -1
- package/dist/esm/base/metadata/model-settings.js +0 -30
- package/dist/esm/base/metadata/model-settings.js.map +0 -1
- package/dist/esm/utilities/error.utility.d.ts +0 -8
- package/dist/esm/utilities/error.utility.d.ts.map +0 -1
- package/dist/esm/utilities/error.utility.js +0 -14
- package/dist/esm/utilities/error.utility.js.map +0 -1
|
@@ -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,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,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,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAE7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;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AE,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 { assertBindingsResolve } from '@venizia/ignis-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 { 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`. */\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 { verified } = assertBindingsResolve({\n container: this,\n namespaces: [BindingNamespaces.SERVICE, BindingNamespaces.REPOSITORY],\n scope: this.verifyBindings.name,\n });\n\n logger.info('Every service and repository binding resolves | verified: %d', verified.length);\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 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,MAAM,mBAAmB,CAAC;AAExF,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtE,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UAAU,CAAC,IAAI,IAAI,GAAG,EAAU,CAAC;QACxF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,IAAI,MAAM,CAAC;QAClE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAE3D,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAc,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;gBACpE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC;oBACvB,MAAM,CAAC,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 { BindingVerifier } from '@venizia/ignis-inversion';\nimport { OpenAPIHono } from '@hono/zod-openapi';\nimport type { AnyType, IConfigurable, TClass, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport {\n PerformanceUtility,\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 { CorsUtility } from './cors';\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`. */\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 CorsUtility.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 { verified } = BindingVerifier.assertResolve({\n container: this,\n namespaces: [BindingNamespaces.SERVICE, BindingNamespaces.REPOSITORY],\n scope: this.verifyBindings.name,\n });\n\n logger.info('Every service and repository binding resolves | verified: %d', verified.length);\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 PerformanceUtility.executeWithMeasure({\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 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 PerformanceUtility.executeWithMeasure({\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 PerformanceUtility.executeWithMeasure({\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 PerformanceUtility.executeWithMeasure({\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 PerformanceUtility.executeWithMeasure({\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 PerformanceUtility.executeWithMeasure({\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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ParseUtility } from '@venizia/ignis-helpers/core';
|
|
2
2
|
export class AuthenticationFieldCodecs {
|
|
3
3
|
static { this.ROLES_CODEC = {
|
|
4
4
|
key: 'roles',
|
|
@@ -8,7 +8,7 @@ export class AuthenticationFieldCodecs {
|
|
|
8
8
|
deserialize(opts) {
|
|
9
9
|
return JSON.parse(opts.raw).map((el) => {
|
|
10
10
|
const [id, identifier, priority] = el.split('|');
|
|
11
|
-
return { id, identifier, priority:
|
|
11
|
+
return { id, identifier, priority: ParseUtility.toInt({ input: priority }) };
|
|
12
12
|
});
|
|
13
13
|
},
|
|
14
14
|
}; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../../../../../src/base/auth/authenticate/common/codecs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../../../../../src/base/auth/authenticate/common/codecs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,MAAM,OAAO,yBAAyB;aACpB,gBAAW,GAAkD;QAC3E,GAAG,EAAE,OAAO;QACZ,SAAS,CAAC,IAAI;YACZ,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC5F,CAAC;QACD,WAAW,CAAC,IAAI;YACd,OAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAc,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;gBACnD,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACjD,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;YAC/E,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IAEF,2CAA2C;IAC3C,MAAM,CAAC,KAAK,CAAc,IAIzB;QACC,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;IACJ,CAAC","sourcesContent":["import { ParseUtility } from '@venizia/ignis-helpers/core';\nimport type { IJWTTokenPayload, IPayloadFieldCodec } from './types';\n\nexport class AuthenticationFieldCodecs {\n static readonly ROLES_CODEC: IPayloadFieldCodec<IJWTTokenPayload['roles']> = {\n key: 'roles',\n serialize(opts) {\n return JSON.stringify(opts.value.map((el) => `${el.id}|${el.identifier}|${el.priority}`));\n },\n deserialize(opts) {\n return (JSON.parse(opts.raw) as string[]).map((el) => {\n const [id, identifier, priority] = el.split('|');\n return { id, identifier, priority: ParseUtility.toInt({ input: priority }) };\n });\n },\n };\n\n /** Builds a single payload field codec. */\n static build<T = unknown>(opts: {\n key: string;\n serialize: IPayloadFieldCodec<T>['serialize'];\n deserialize: IPayloadFieldCodec<T>['deserialize'];\n }): IPayloadFieldCodec<T> {\n return {\n key: opts.key,\n serialize: opts.serialize,\n deserialize: opts.deserialize,\n };\n }\n}\n"]}
|
|
@@ -36,7 +36,7 @@ export declare class AuthenticationStrategyRegistry extends AbstractAuthRegistry
|
|
|
36
36
|
*
|
|
37
37
|
* The framework does NOT call this - it reports instead. A hard failure cannot be the default
|
|
38
38
|
* here: a route listing several strategies in ANY mode tolerates one that does not resolve, and
|
|
39
|
-
* `
|
|
39
|
+
* `AuthControllerFactory.define` hard-codes `'jwt'` on four of its routes, so an application that
|
|
40
40
|
* registers its JWT strategy under a different name works today and would stop booting.
|
|
41
41
|
*/
|
|
42
42
|
assertRegistered(opts: {
|
|
@@ -49,7 +49,7 @@ export class AuthenticationStrategyRegistry extends AbstractAuthRegistry {
|
|
|
49
49
|
*
|
|
50
50
|
* The framework does NOT call this - it reports instead. A hard failure cannot be the default
|
|
51
51
|
* here: a route listing several strategies in ANY mode tolerates one that does not resolve, and
|
|
52
|
-
* `
|
|
52
|
+
* `AuthControllerFactory.define` hard-codes `'jwt'` on four of its routes, so an application that
|
|
53
53
|
* registers its JWT strategy under a different name works today and would stop booting.
|
|
54
54
|
*/
|
|
55
55
|
assertRegistered(opts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategy-registry.js","sourceRoot":"","sources":["../../../../../../src/base/auth/authenticate/strategies/strategy-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,OAAO,8BAA+B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,KAAK,EAAE,KAAK,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;QAExC,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO;QACT,CAAC;QAED,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE,IAAI,KAAK,qDAAqD,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,4FAA4F;SACvO,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,kBAAkB,CAAC,IAAyC;QAC1D,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;QAExC,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO;QACT,CAAC;QAED,IAAI,CAAC,MAAM;aACR,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC;aACjC,KAAK,CACJ,uHAAuH,EACvH,KAAK,EACL,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EACvB,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAC3B,CAAC;IACN,CAAC","sourcesContent":["import type { Container } from '@/helpers/inversion/container';\nimport { SingletonRealm } from '@/helpers/singleton-realm';\nimport type { TClass } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { AbstractAuthRegistry } from '../../base';\nimport type { IAuthenticationStrategy } from '../common';\nimport { Authentication } from '../common';\n\nexport class AuthenticationStrategyRegistry extends AbstractAuthRegistry<IAuthenticationStrategy> {\n static readonly SINGLETON_REAL_KEY = 'authentication-strategy-registry';\n\n constructor() {\n super({ scope: AuthenticationStrategyRegistry.name });\n }\n\n static getInstance() {\n return SingletonRealm.resolve({\n key: AuthenticationStrategyRegistry.SINGLETON_REAL_KEY,\n create: () => new AuthenticationStrategyRegistry(),\n });\n }\n\n protected getBindingPrefix(): string {\n return Authentication.AUTHENTICATION_STRATEGY;\n }\n\n register(opts: {\n container: Container;\n strategies: { strategy: TClass<IAuthenticationStrategy>; name: string }[];\n }) {\n const { container, strategies } = opts;\n\n for (const { strategy, name } of strategies) {\n this.registerDescriptor({ container, target: strategy, name });\n }\n\n return this;\n }\n\n resolveStrategy(opts: { name: string }): IAuthenticationStrategy {\n return this.resolveDescriptor(opts);\n }\n\n /**\n * The names on this list that no registered strategy answers to.\n *\n * An EMPTY list yields nothing - it is the framework's own encoding of\n * `authenticate: { skip: true }`, so treating it as a problem would flag every public route.\n *\n * Nothing is reported while the registry is empty. Route configs are built during\n * `registerControllers()`, after `preConfigure()` and `registerComponents()`, so a real\n * application has registered by then; an empty registry means this is running outside that\n * lifecycle - a unit test on a controller - where no name could resolve either way.\n */\n findUnregistered(opts: { names: string[] }): string[] {\n const { names } = opts;\n\n if (names.length === 0 || this.descriptors.size === 0) {\n return [];\n }\n\n return names.filter((name) => !this.has({ name }));\n }\n\n /**\n * Refuses to continue past an unregistered name. For an APPLICATION's own startup check.\n *\n * The framework does NOT call this - it reports instead. A hard failure cannot be the default\n * here: a route listing several strategies in ANY mode tolerates one that does not resolve, and\n * `
|
|
1
|
+
{"version":3,"file":"strategy-registry.js","sourceRoot":"","sources":["../../../../../../src/base/auth/authenticate/strategies/strategy-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,OAAO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AM,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;QAExC,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO;QACT,CAAC;QAED,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE,IAAI,KAAK,qDAAqD,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,4FAA4F;SACvO,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,kBAAkB,CAAC,IAAyC;QAC1D,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;QAExC,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO;QACT,CAAC;QAED,IAAI,CAAC,MAAM;aACR,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC;aACjC,KAAK,CACJ,uHAAuH,EACvH,KAAK,EACL,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EACvB,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAC3B,CAAC;IACN,CAAC","sourcesContent":["import type { Container } from '@/helpers/inversion/container';\nimport { SingletonRealm } from '@/helpers/singleton-realm';\nimport type { TClass } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { AbstractAuthRegistry } from '../../base';\nimport type { IAuthenticationStrategy } from '../common';\nimport { Authentication } from '../common';\n\nexport class AuthenticationStrategyRegistry extends AbstractAuthRegistry<IAuthenticationStrategy> {\n static readonly SINGLETON_REAL_KEY = 'authentication-strategy-registry';\n\n constructor() {\n super({ scope: AuthenticationStrategyRegistry.name });\n }\n\n static getInstance() {\n return SingletonRealm.resolve({\n key: AuthenticationStrategyRegistry.SINGLETON_REAL_KEY,\n create: () => new AuthenticationStrategyRegistry(),\n });\n }\n\n protected getBindingPrefix(): string {\n return Authentication.AUTHENTICATION_STRATEGY;\n }\n\n register(opts: {\n container: Container;\n strategies: { strategy: TClass<IAuthenticationStrategy>; name: string }[];\n }) {\n const { container, strategies } = opts;\n\n for (const { strategy, name } of strategies) {\n this.registerDescriptor({ container, target: strategy, name });\n }\n\n return this;\n }\n\n resolveStrategy(opts: { name: string }): IAuthenticationStrategy {\n return this.resolveDescriptor(opts);\n }\n\n /**\n * The names on this list that no registered strategy answers to.\n *\n * An EMPTY list yields nothing - it is the framework's own encoding of\n * `authenticate: { skip: true }`, so treating it as a problem would flag every public route.\n *\n * Nothing is reported while the registry is empty. Route configs are built during\n * `registerControllers()`, after `preConfigure()` and `registerComponents()`, so a real\n * application has registered by then; an empty registry means this is running outside that\n * lifecycle - a unit test on a controller - where no name could resolve either way.\n */\n findUnregistered(opts: { names: string[] }): string[] {\n const { names } = opts;\n\n if (names.length === 0 || this.descriptors.size === 0) {\n return [];\n }\n\n return names.filter((name) => !this.has({ name }));\n }\n\n /**\n * Refuses to continue past an unregistered name. For an APPLICATION's own startup check.\n *\n * The framework does NOT call this - it reports instead. A hard failure cannot be the default\n * here: a route listing several strategies in ANY mode tolerates one that does not resolve, and\n * `AuthControllerFactory.define` hard-codes `'jwt'` on four of its routes, so an application that\n * registers its JWT strategy under a different name works today and would stop booting.\n */\n assertRegistered(opts: { names: string[]; scope?: string }): void {\n const { names, scope = 'route' } = opts;\n\n const unregistered = this.findUnregistered({ names });\n if (unregistered.length === 0) {\n return;\n }\n\n throw getError({\n message: `[${scope}] Unknown authentication strategy | unregistered: ${unregistered.join(', ')} | registered: ${this.getNames().join(', ')} | register it with AuthenticationStrategyRegistry.register() before controllers are bound`,\n });\n }\n\n /**\n * Names an unregistered strategy at boot, at a level someone sees. Never throws.\n *\n * This is what replaces the guard the open `TAuthStrategy` gave up: `resolveStrategy` throws at\n * request time, the provider's ANY mode swallows it at DEBUG, and the route 401s with nothing to\n * explain why.\n */\n reportUnregistered(opts: { names: string[]; scope?: string }): void {\n const { names, scope = 'route' } = opts;\n\n const unregistered = this.findUnregistered({ names });\n if (unregistered.length === 0) {\n return;\n }\n\n this.logger\n .for(this.reportUnregistered.name)\n .error(\n '[%s] Unknown authentication strategy - requests relying on it cannot authenticate | unregistered: %s | registered: %s',\n scope,\n unregistered.join(', '),\n this.getNames().join(', '),\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization.provider.d.ts","sourceRoot":"","sources":["../../../../../../src/base/auth/authorize/providers/authorization.provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAY,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAK1D,OAAO,KAAK,EAAsB,YAAY,EAAE,MAAM,WAAW,CAAC;AAKlE,qBAAa,qBAAsB,SAAQ,UAAW,YAAW,SAAS,CAAC,YAAY,CAAC;;IAKtF,KAAK,IAAI,YAAY;IAMrB,OAAO,CAAC,yBAAyB;
|
|
1
|
+
{"version":3,"file":"authorization.provider.d.ts","sourceRoot":"","sources":["../../../../../../src/base/auth/authorize/providers/authorization.provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAY,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAK1D,OAAO,KAAK,EAAsB,YAAY,EAAE,MAAM,WAAW,CAAC;AAKlE,qBAAa,qBAAsB,SAAQ,UAAW,YAAW,SAAS,CAAC,YAAY,CAAC;;IAKtF,KAAK,IAAI,YAAY;IAMrB,OAAO,CAAC,yBAAyB;IAoKjC,OAAO,CAAC,gBAAgB;CAezB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContextUtility } from '../../../controllers/context.js';
|
|
2
2
|
import { BaseHelper, getError } from '@venizia/ignis-helpers/core';
|
|
3
3
|
import { createMiddleware } from 'hono/factory';
|
|
4
4
|
// Deep import (not the authenticate barrel): the barrel re-exports ./controllers, whose factory extends BaseRestController - a value import here forms the base/controllers <-> auth init cycle.
|
|
5
5
|
import { Authentication } from '../../authenticate/common/constants/index.js';
|
|
6
6
|
import { Authorization, AuthorizationDecisions, AuthorizationErrors } from '../common/index.js';
|
|
7
7
|
import { AuthorizationEnforcerRegistry } from '../enforcers/enforcer-registry.js';
|
|
8
|
-
import {
|
|
8
|
+
import { RequestDomainResolver } from './request-domain.js';
|
|
9
9
|
export class AuthorizationProvider extends BaseHelper {
|
|
10
10
|
constructor() {
|
|
11
11
|
super({ scope: AuthorizationProvider.name });
|
|
@@ -52,7 +52,7 @@ export class AuthorizationProvider extends BaseHelper {
|
|
|
52
52
|
user,
|
|
53
53
|
action: spec.action,
|
|
54
54
|
resource: spec.resource,
|
|
55
|
-
context: asTypedContext(context),
|
|
55
|
+
context: ContextUtility.asTypedContext({ context }),
|
|
56
56
|
});
|
|
57
57
|
if (decision === AuthorizationDecisions.DENY) {
|
|
58
58
|
throw getError({
|
|
@@ -87,13 +87,15 @@ export class AuthorizationProvider extends BaseHelper {
|
|
|
87
87
|
// domain-less spec inherited the tenant domain a PREVIOUS spec had written - silently
|
|
88
88
|
// widening a check that should have run at SYSTEM_WIDE. The context is still set, for
|
|
89
89
|
// observability, but nothing decides on it.
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
let domainScope;
|
|
91
|
+
if (spec.domain || options?.domainResolver) {
|
|
92
|
+
const resolvedDomain = await RequestDomainResolver.resolveRequestDomain({
|
|
92
93
|
spec,
|
|
93
|
-
context: asTypedContext(context),
|
|
94
|
+
context: ContextUtility.asTypedContext({ context }),
|
|
94
95
|
options,
|
|
95
|
-
})
|
|
96
|
-
|
|
96
|
+
});
|
|
97
|
+
domainScope = resolvedDomain;
|
|
98
|
+
}
|
|
97
99
|
context.set(Authorization.DOMAIN, domainScope);
|
|
98
100
|
// Keyed by enforcer. The slot used to hold one rule set for the whole request, so a second
|
|
99
101
|
// `authorize()` naming a DIFFERENT enforcer evaluated against the first enforcer's rules -
|
|
@@ -112,10 +114,11 @@ export class AuthorizationProvider extends BaseHelper {
|
|
|
112
114
|
message: 'Authorization failed: user.principalType is required for enforcer-based authorization',
|
|
113
115
|
});
|
|
114
116
|
}
|
|
115
|
-
|
|
117
|
+
const result = await enforcer.buildRules({
|
|
116
118
|
user: user,
|
|
117
|
-
context: asTypedContext(context),
|
|
119
|
+
context: ContextUtility.asTypedContext({ context }),
|
|
118
120
|
});
|
|
121
|
+
rules = result;
|
|
119
122
|
rulesByEnforcer.set(resolvedName, rules);
|
|
120
123
|
context.set(Authorization.RULES, rulesByEnforcer);
|
|
121
124
|
}
|
|
@@ -127,7 +130,7 @@ export class AuthorizationProvider extends BaseHelper {
|
|
|
127
130
|
conditions: spec.conditions,
|
|
128
131
|
domain: domainScope,
|
|
129
132
|
},
|
|
130
|
-
context: asTypedContext(context),
|
|
133
|
+
context: ContextUtility.asTypedContext({ context }),
|
|
131
134
|
});
|
|
132
135
|
if (decision === AuthorizationDecisions.ABSTAIN) {
|
|
133
136
|
decision = options?.defaultDecision ?? AuthorizationDecisions.DENY;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization.provider.js","sourceRoot":"","sources":["../../../../../../src/base/auth/authorize/providers/authorization.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,iMAAiM;AACjM,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CA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,CAAC;CACF","sourcesContent":["import { asTypedContext } from '@/base/controllers/context';\nimport { BaseHelper, getError } from '@venizia/ignis-helpers/core';\nimport type { IProvider } from '@venizia/ignis-inversion';\nimport { createMiddleware } from 'hono/factory';\nimport type { IAuthUser } from '../../authenticate/common/types';\n// Deep import (not the authenticate barrel): the barrel re-exports ./controllers, whose factory extends BaseRestController - a value import here forms the base/controllers <-> auth init cycle.\nimport { Authentication } from '../../authenticate/common/constants';\nimport type { IAuthorizationSpec, TAuthorizeFn } from '../common';\nimport { Authorization, AuthorizationDecisions, AuthorizationErrors } from '../common';\nimport { AuthorizationEnforcerRegistry } from '../enforcers/enforcer-registry';\nimport { resolveRequestDomain } from './request-domain';\n\nexport class AuthorizationProvider extends BaseHelper implements IProvider<TAuthorizeFn> {\n constructor() {\n super({ scope: AuthorizationProvider.name });\n }\n\n value(): TAuthorizeFn {\n return (opts) => {\n return this.createAuthorizeMiddleware(opts);\n };\n }\n\n private createAuthorizeMiddleware(opts: { spec: IAuthorizationSpec; enforcerName?: string }) {\n const { spec, enforcerName } = opts;\n const logger = this.logger.for(this.createAuthorizeMiddleware.name);\n\n return createMiddleware(async (context, next) => {\n const registry = AuthorizationEnforcerRegistry.getInstance();\n const options = registry.resolveOptions();\n\n const isSkipAuthorize = context.get(Authorization.SKIP_AUTHORIZATION);\n if (isSkipAuthorize) {\n logger.warn('SKIP checking authorization | path: %s', context.req.path);\n return next();\n }\n\n const user = context.get(Authentication.CURRENT_USER) as IAuthUser | undefined;\n if (!user) {\n throw getError({\n error: AuthorizationErrors.UNAUTHENTICATED,\n message: 'Authorization failed: No authenticated user found',\n });\n }\n\n const needsRoleCheck =\n Boolean(options?.alwaysAllowRoles?.length) || Boolean(spec.allowedRoles?.length);\n if (needsRoleCheck) {\n const userRoles = this.extractUserRoles({ user });\n\n if (\n options?.alwaysAllowRoles?.length &&\n userRoles.some((r) => options.alwaysAllowRoles!.includes(r))\n ) {\n logger.warn(\n 'SKIP checking authorization | User has always-allow role | userRoles: %s',\n userRoles,\n );\n return next();\n }\n\n if (spec.allowedRoles?.length && userRoles.some((r) => spec.allowedRoles!.includes(r))) {\n logger.warn('GRANT access | User has allowed role for route | userRoles: %s', userRoles);\n return next();\n }\n }\n\n const votersList = spec.voters ?? [];\n for (const voter of votersList) {\n const decision = await voter({\n user,\n action: spec.action,\n resource: spec.resource,\n context: asTypedContext(context),\n });\n\n if (decision === AuthorizationDecisions.DENY) {\n throw getError({\n error: AuthorizationErrors.DENIED_BY_VOTER,\n message: `Authorization denied by voter | action: ${spec.action} | resource: ${spec.resource}`,\n messageArgs: { action: spec.action, resource: spec.resource },\n });\n }\n\n if (decision === AuthorizationDecisions.ALLOW) {\n await next();\n return;\n }\n\n // ABSTAIN → continue to enforcer\n }\n\n if (!registry.hasEnforcers()) {\n const noEnforcerDecision = options?.defaultDecision ?? AuthorizationDecisions.DENY;\n\n if (noEnforcerDecision === AuthorizationDecisions.ALLOW) {\n logger.warn(\n 'ALLOW checking authorization | No enforcers registered | path: %s',\n context.req.path,\n );\n return next();\n }\n\n throw getError({\n error: AuthorizationErrors.ENFORCER_NOT_REGISTERED,\n message: `Authorization failed: authorize() was declared for this route but no enforcer is registered | path: ${context.req.path}`,\n });\n }\n\n const resolvedName = enforcerName ?? registry.getDefaultEnforcerName();\n const enforcer = await registry.resolveEnforcer({ name: resolvedName });\n\n // Only resolve domain scope when it is actually in play (per-route domain OR a configured global resolver) - avoids a resolver call (possible DB hit) for legacy enforcers.\n //\n // Held in a LOCAL, not read back out of the context. One middleware is pushed per spec onto\n // the same Hono context, so reading `Authorization.DOMAIN` at decision time meant a\n // domain-less spec inherited the tenant domain a PREVIOUS spec had written - silently\n // widening a check that should have run at SYSTEM_WIDE. The context is still set, for\n // observability, but nothing decides on it.\n const domainScope =\n spec.domain || options?.domainResolver\n ? await resolveRequestDomain({\n spec,\n context: asTypedContext(context),\n options,\n })\n : undefined;\n context.set(Authorization.DOMAIN, domainScope);\n\n // Keyed by enforcer. The slot used to hold one rule set for the whole request, so a second\n // `authorize()` naming a DIFFERENT enforcer evaluated against the first enforcer's rules -\n // granting where its own policy set denies.\n //\n // `instanceof Map`, not a truthiness test: the slot previously held a bare rule set, so\n // anything that pre-populates it with the old shape would otherwise reach `.get` on a value\n // that has no such method and take the request down with a TypeError.\n const existingRules = context.get(Authorization.RULES);\n const rulesByEnforcer =\n existingRules instanceof Map ? existingRules : new Map<string, unknown>();\n let rules = rulesByEnforcer.get(resolvedName);\n\n if (!rules) {\n if (!user.principalType) {\n throw getError({\n error: AuthorizationErrors.PRINCIPAL_TYPE_MISSING,\n message:\n 'Authorization failed: user.principalType is required for enforcer-based authorization',\n });\n }\n\n rules = await enforcer.buildRules({\n user: user as { principalType: string } & IAuthUser,\n context: asTypedContext(context),\n });\n rulesByEnforcer.set(resolvedName, rules);\n context.set(Authorization.RULES, rulesByEnforcer);\n }\n\n let decision = await enforcer.evaluate({\n rules,\n request: {\n action: spec.action,\n resource: spec.resource,\n conditions: spec.conditions,\n domain: domainScope,\n },\n context: asTypedContext(context),\n });\n\n if (decision === AuthorizationDecisions.ABSTAIN) {\n decision = options?.defaultDecision ?? AuthorizationDecisions.DENY;\n }\n\n if (decision !== AuthorizationDecisions.ALLOW) {\n throw getError({\n error: AuthorizationErrors.DENIED,\n message: `Authorization denied | action: ${spec.action} | resource: ${spec.resource}`,\n messageArgs: { action: spec.action, resource: spec.resource },\n });\n }\n\n await next();\n });\n }\n\n private extractUserRoles(opts: { user: IAuthUser }): string[] {\n const { user } = opts;\n const roles = user.roles;\n\n if (!Array.isArray(roles)) {\n return [];\n }\n\n return roles.map((r: string | { identifier?: string; name?: string; id?: unknown }) => {\n if (typeof r === 'string') {\n return r;\n }\n return r.identifier ?? r.name ?? String(r.id ?? '');\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"authorization.provider.js","sourceRoot":"","sources":["../../../../../../src/base/auth/authorize/providers/authorization.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE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,CAAC;QAEzB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAgE,EAAE,EAAE;YACpF,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;gBAC1B,OAAO,CAAC,CAAC;YACX,CAAC;YACD,OAAO,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { ContextUtility } from '@/base/controllers/context';\nimport { BaseHelper, getError } from '@venizia/ignis-helpers/core';\nimport type { IProvider } from '@venizia/ignis-inversion';\nimport { createMiddleware } from 'hono/factory';\nimport type { IAuthUser } from '../../authenticate/common/types';\n// Deep import (not the authenticate barrel): the barrel re-exports ./controllers, whose factory extends BaseRestController - a value import here forms the base/controllers <-> auth init cycle.\nimport { Authentication } from '../../authenticate/common/constants';\nimport type { IAuthorizationSpec, TAuthorizeFn } from '../common';\nimport { Authorization, AuthorizationDecisions, AuthorizationErrors } from '../common';\nimport { AuthorizationEnforcerRegistry } from '../enforcers/enforcer-registry';\nimport { RequestDomainResolver } from './request-domain';\n\nexport class AuthorizationProvider extends BaseHelper implements IProvider<TAuthorizeFn> {\n constructor() {\n super({ scope: AuthorizationProvider.name });\n }\n\n value(): TAuthorizeFn {\n return (opts) => {\n return this.createAuthorizeMiddleware(opts);\n };\n }\n\n private createAuthorizeMiddleware(opts: { spec: IAuthorizationSpec; enforcerName?: string }) {\n const { spec, enforcerName } = opts;\n const logger = this.logger.for(this.createAuthorizeMiddleware.name);\n\n return createMiddleware(async (context, next) => {\n const registry = AuthorizationEnforcerRegistry.getInstance();\n const options = registry.resolveOptions();\n\n const isSkipAuthorize = context.get(Authorization.SKIP_AUTHORIZATION);\n if (isSkipAuthorize) {\n logger.warn('SKIP checking authorization | path: %s', context.req.path);\n return next();\n }\n\n const user = context.get(Authentication.CURRENT_USER) as IAuthUser | undefined;\n if (!user) {\n throw getError({\n error: AuthorizationErrors.UNAUTHENTICATED,\n message: 'Authorization failed: No authenticated user found',\n });\n }\n\n const needsRoleCheck =\n Boolean(options?.alwaysAllowRoles?.length) || Boolean(spec.allowedRoles?.length);\n if (needsRoleCheck) {\n const userRoles = this.extractUserRoles({ user });\n\n if (\n options?.alwaysAllowRoles?.length &&\n userRoles.some((r) => options.alwaysAllowRoles!.includes(r))\n ) {\n logger.warn(\n 'SKIP checking authorization | User has always-allow role | userRoles: %s',\n userRoles,\n );\n return next();\n }\n\n if (spec.allowedRoles?.length && userRoles.some((r) => spec.allowedRoles!.includes(r))) {\n logger.warn('GRANT access | User has allowed role for route | userRoles: %s', userRoles);\n return next();\n }\n }\n\n const votersList = spec.voters ?? [];\n for (const voter of votersList) {\n const decision = await voter({\n user,\n action: spec.action,\n resource: spec.resource,\n context: ContextUtility.asTypedContext({ context }),\n });\n\n if (decision === AuthorizationDecisions.DENY) {\n throw getError({\n error: AuthorizationErrors.DENIED_BY_VOTER,\n message: `Authorization denied by voter | action: ${spec.action} | resource: ${spec.resource}`,\n messageArgs: { action: spec.action, resource: spec.resource },\n });\n }\n\n if (decision === AuthorizationDecisions.ALLOW) {\n await next();\n return;\n }\n\n // ABSTAIN → continue to enforcer\n }\n\n if (!registry.hasEnforcers()) {\n const noEnforcerDecision = options?.defaultDecision ?? AuthorizationDecisions.DENY;\n\n if (noEnforcerDecision === AuthorizationDecisions.ALLOW) {\n logger.warn(\n 'ALLOW checking authorization | No enforcers registered | path: %s',\n context.req.path,\n );\n return next();\n }\n\n throw getError({\n error: AuthorizationErrors.ENFORCER_NOT_REGISTERED,\n message: `Authorization failed: authorize() was declared for this route but no enforcer is registered | path: ${context.req.path}`,\n });\n }\n\n const resolvedName = enforcerName ?? registry.getDefaultEnforcerName();\n const enforcer = await registry.resolveEnforcer({ name: resolvedName });\n\n // Only resolve domain scope when it is actually in play (per-route domain OR a configured global resolver) - avoids a resolver call (possible DB hit) for legacy enforcers.\n //\n // Held in a LOCAL, not read back out of the context. One middleware is pushed per spec onto\n // the same Hono context, so reading `Authorization.DOMAIN` at decision time meant a\n // domain-less spec inherited the tenant domain a PREVIOUS spec had written - silently\n // widening a check that should have run at SYSTEM_WIDE. The context is still set, for\n // observability, but nothing decides on it.\n let domainScope: string | undefined;\n if (spec.domain || options?.domainResolver) {\n const resolvedDomain = await RequestDomainResolver.resolveRequestDomain({\n spec,\n context: ContextUtility.asTypedContext({ context }),\n options,\n });\n domainScope = resolvedDomain;\n }\n context.set(Authorization.DOMAIN, domainScope);\n\n // Keyed by enforcer. The slot used to hold one rule set for the whole request, so a second\n // `authorize()` naming a DIFFERENT enforcer evaluated against the first enforcer's rules -\n // granting where its own policy set denies.\n //\n // `instanceof Map`, not a truthiness test: the slot previously held a bare rule set, so\n // anything that pre-populates it with the old shape would otherwise reach `.get` on a value\n // that has no such method and take the request down with a TypeError.\n const existingRules = context.get(Authorization.RULES);\n const rulesByEnforcer =\n existingRules instanceof Map ? existingRules : new Map<string, unknown>();\n let rules = rulesByEnforcer.get(resolvedName);\n\n if (!rules) {\n if (!user.principalType) {\n throw getError({\n error: AuthorizationErrors.PRINCIPAL_TYPE_MISSING,\n message:\n 'Authorization failed: user.principalType is required for enforcer-based authorization',\n });\n }\n\n const result = await enforcer.buildRules({\n user: user as { principalType: string } & IAuthUser,\n context: ContextUtility.asTypedContext({ context }),\n });\n rules = result;\n rulesByEnforcer.set(resolvedName, rules);\n context.set(Authorization.RULES, rulesByEnforcer);\n }\n\n let decision = await enforcer.evaluate({\n rules,\n request: {\n action: spec.action,\n resource: spec.resource,\n conditions: spec.conditions,\n domain: domainScope,\n },\n context: ContextUtility.asTypedContext({ context }),\n });\n\n if (decision === AuthorizationDecisions.ABSTAIN) {\n decision = options?.defaultDecision ?? AuthorizationDecisions.DENY;\n }\n\n if (decision !== AuthorizationDecisions.ALLOW) {\n throw getError({\n error: AuthorizationErrors.DENIED,\n message: `Authorization denied | action: ${spec.action} | resource: ${spec.resource}`,\n messageArgs: { action: spec.action, resource: spec.resource },\n });\n }\n\n await next();\n });\n }\n\n private extractUserRoles(opts: { user: IAuthUser }): string[] {\n const { user } = opts;\n const roles = user.roles;\n\n if (!Array.isArray(roles)) {\n return [];\n }\n\n return roles.map((r: string | { identifier?: string; name?: string; id?: unknown }) => {\n if (typeof r === 'string') {\n return r;\n }\n return r.identifier ?? r.name ?? String(r.id ?? '');\n });\n }\n}\n"]}
|
|
@@ -2,15 +2,18 @@ import type { TContext } from '../../../controllers/common/types/index.js';
|
|
|
2
2
|
import type { TNullable } from '@venizia/ignis-helpers/common';
|
|
3
3
|
import type { Env } from 'hono';
|
|
4
4
|
import type { IAuthorizationDomainSource, IAuthorizationSpec, IAuthorizeOptions } from '../common/types/index.js';
|
|
5
|
-
/**
|
|
6
|
-
export declare
|
|
7
|
-
source
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
spec
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
/** Reads the domain of an authorization check off the request. */
|
|
6
|
+
export declare class RequestDomainResolver {
|
|
7
|
+
/** Read a domain value from a declarative source on the Hono context. */
|
|
8
|
+
static readDeclarative(opts: {
|
|
9
|
+
source: IAuthorizationDomainSource;
|
|
10
|
+
context: TContext<Env, string>;
|
|
11
|
+
}): TNullable<string>;
|
|
12
|
+
/** Resolve the request domain, precedence spec.domain (method | declarative) -> options.domainResolver -> SYSTEM_WIDE, as a casbin domain string ("<type>_<id>") or the SYSTEM_WIDE sentinel. */
|
|
13
|
+
static resolveRequestDomain(opts: {
|
|
14
|
+
spec: IAuthorizationSpec;
|
|
15
|
+
context: TContext<Env, string>;
|
|
16
|
+
options: TNullable<IAuthorizeOptions>;
|
|
17
|
+
}): Promise<string>;
|
|
18
|
+
}
|
|
16
19
|
//# sourceMappingURL=request-domain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-domain.d.ts","sourceRoot":"","sources":["../../../../../../src/base/auth/authorize/providers/request-domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,KAAK,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,yEAAyE;
|
|
1
|
+
{"version":3,"file":"request-domain.d.ts","sourceRoot":"","sources":["../../../../../../src/base/auth/authorize/providers/request-domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,KAAK,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,kEAAkE;AAClE,qBAAa,qBAAqB;IAChC,yEAAyE;IACzE,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE;QAC3B,MAAM,EAAE,0BAA0B,CAAC;QACnC,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;KAChC,GAAG,SAAS,CAAC,MAAM,CAAC;IAsBrB,iMAAiM;WACpL,oBAAoB,CAAC,IAAI,EAAE;QACtC,IAAI,EAAE,kBAAkB,CAAC;QACzB,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC/B,OAAO,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;KACvC,GAAG,OAAO,CAAC,MAAM,CAAC;CAyBpB"}
|