@venizia/ignis-kernel 0.4.8 → 0.5.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/base/applications/rest.d.ts +2 -2
- package/dist/esm/base/applications/rest.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/keys.d.ts +21 -7
- package/dist/esm/base/auth/authenticate/common/keys.js +34 -7
- package/dist/esm/base/auth/authenticate/common/keys.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/types/jwt.d.ts +8 -17
- package/dist/esm/base/auth/authenticate/common/types/jwt.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/types/rest.d.ts +3 -1
- package/dist/esm/base/auth/authenticate/common/types/rest.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/types/service.d.ts +3 -3
- package/dist/esm/base/auth/authenticate/common/types/service.js.map +1 -1
- package/dist/esm/base/auth/authorize/common/constants/binding-keys.d.ts +6 -3
- package/dist/esm/base/auth/authorize/common/constants/binding-keys.js +8 -3
- package/dist/esm/base/auth/authorize/common/constants/binding-keys.js.map +1 -1
- package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.js.map +1 -1
- package/dist/esm/base/auth/base/abstract-auth-registry.d.ts +2 -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/components/base.d.ts +3 -3
- package/dist/esm/base/components/base.js +3 -3
- package/dist/esm/base/components/base.js.map +1 -1
- package/dist/esm/base/components/controller/rest/common/types.d.ts +2 -1
- package/dist/esm/base/components/controller/rest/common/types.js +3 -1
- package/dist/esm/base/components/controller/rest/common/types.js.map +1 -1
- package/dist/esm/base/components/controller/rest/rest.component.js.map +1 -1
- package/dist/esm/base/controllers/factory/controller.js +4 -1
- package/dist/esm/base/controllers/factory/controller.js.map +1 -1
- package/dist/esm/base/controllers/factory/definition.d.ts +48 -48
- package/dist/esm/base/events/common/types.d.ts +2 -1
- package/dist/esm/base/events/common/types.js.map +1 -1
- package/dist/esm/base/events/event-bus.js.map +1 -1
- package/dist/esm/base/metadata/artifact-keys.d.ts +2 -1
- package/dist/esm/base/metadata/artifact-keys.js.map +1 -1
- package/dist/esm/base/metadata/injectable.d.ts +2 -1
- package/dist/esm/base/metadata/injectable.js.map +1 -1
- package/dist/esm/base/metadata/persistents/repository/injection.js.map +1 -1
- package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.js +2 -1
- package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.js.map +1 -1
- package/dist/esm/base/models/common/schemas.d.ts +9 -9
- package/dist/esm/base/models/common/schemas.js +1 -1
- package/dist/esm/base/models/common/schemas.js.map +1 -1
- package/dist/esm/base/repositories/common/response-reader.d.ts +10 -1
- package/dist/esm/base/repositories/common/response-reader.js +17 -3
- package/dist/esm/base/repositories/common/response-reader.js.map +1 -1
- package/dist/esm/common/bindings.d.ts +7 -7
- package/dist/esm/common/bindings.js +21 -7
- package/dist/esm/common/bindings.js.map +1 -1
- package/dist/esm/helpers/inversion/common/types/artifact.d.ts +2 -2
- package/dist/esm/helpers/inversion/common/types/artifact.js.map +1 -1
- package/dist/esm/helpers/inversion/index.d.ts +1 -1
- package/dist/esm/helpers/inversion/index.js.map +1 -1
- package/dist/esm/helpers/inversion/mixins/artifact.mixin.d.ts +5 -5
- package/dist/esm/helpers/inversion/mixins/controllers/controller.d.ts +5 -5
- package/dist/esm/helpers/inversion/mixins/controllers/grpc.d.ts +5 -5
- package/dist/esm/helpers/inversion/mixins/controllers/rest.d.ts +5 -5
- package/dist/esm/helpers/inversion/mixins/datasource.mixin.d.ts +5 -5
- package/dist/esm/helpers/inversion/mixins/model.mixin.d.ts +5 -5
- package/dist/esm/helpers/inversion/mixins/repository.mixin.d.ts +5 -5
- package/dist/esm/helpers/inversion/registry.d.ts +35 -35
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injectable.js","sourceRoot":"","sources":["../../../../src/base/metadata/injectable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"injectable.js","sourceRoot":"","sources":["../../../../src/base/metadata/injectable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAoB,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,oJAAoJ;AACpJ,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAwC,EACxB,EAAE;IAClB,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACtC,MAAM,QAAQ,CAAC;gBACb,OAAO,EAAE,gBAAgB,MAAM,CAAC,IAAI,6BAA6B,IAAI,CAAC,IAAI,wBAAwB,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;aAC7I,CAAC,CAAC;QACL,CAAC;QAED,kFAAkF;QAClF,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,iBAAiB,CAAC,uBAAuB,CAAC;gBACxC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS;gBACjC,QAAQ,EAAE,MAAM,CAAC,IAAI;gBACrB,MAAM,EAAE,YAAY;aACrB,CAAC,CAAC;QACL,CAAC;QAED,MAAM,QAAQ,GAAG,gBAAgB,CAAC,WAAW,EAAE,CAAC;QAChD,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,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["import type {\n IArtifactMetadata,\n IArtifactRegistrationOptions,\n TBindingScope,\n} from '@/helpers/inversion';\nimport { ArtifactNamespaces, BindingNamespaces } from '@/common/bindings';\nimport { ArtifactTypes, MetadataRegistry, type TBindingKey } from '@/helpers/inversion';\nimport { ArtifactBindingKeys } from './artifact-keys';\nimport { getError } from '@venizia/ignis-helpers/core';\n\n/** The root stereotype: marks a class as an artifact the application registers, with its registration defaults. Every other stereotype calls it. */\nexport const injectable = <ApplicationType = unknown>(\n opts: IArtifactMetadata<ApplicationType>,\n): ClassDecorator => {\n return (target) => {\n if (!ArtifactTypes.isValid(opts.type)) {\n throw getError({\n message: `[injectable][${target.name}] Invalid artifact type: '${opts.type}' | Expected one of: ${[...ArtifactTypes.SCHEME_SET].join(', ')}`,\n });\n }\n\n // At import time, so the failure lands where the binding is written, not at boot.\n if (opts.binding) {\n BindingNamespaces.assertArtifactNamespace({\n namespace: opts.binding.namespace,\n artifact: target.name,\n caller: 'injectable',\n });\n }\n\n const registry = MetadataRegistry.getInstance();\n registry.setArtifactMetadata({ target, metadata: opts });\n\n // Discovery happens HERE, at import time. A boot-time filesystem scan cannot see a compiled\n // single-file binary, and a class exists at run time only because something imported it.\n registry.addDiscoveredArtifact({ target });\n\n // The key this class WOULD get; `registerArtifact` overwrites it with the one actually bound.\n registry.setBindingKey({\n target,\n key: ArtifactBindingKeys.resolve({\n target,\n namespace: ArtifactNamespaces.resolve({ type: opts.type }),\n binding: opts.binding,\n }).key,\n isProvisional: true,\n });\n };\n};\n\n/**\n * Class decorator that registers the class as a service artifact; accepts the same registration options as `injectable`.\n *\n * @example\n * ```typescript\n * import { BaseService, service } from '@venizia/ignis';\n *\n * export @service()\n * class MailService extends BaseService {\n * constructor() {\n * super({ scope: MailService.name });\n * }\n * }\n * ```\n */\nexport const service = <ApplicationType = unknown>(\n opts?: IArtifactRegistrationOptions<ApplicationType>,\n): ClassDecorator => {\n return injectable<ApplicationType>({ type: ArtifactTypes.SERVICE, ...opts });\n};\n\n/**\n * Class decorator that registers the class as a component artifact; accepts the same registration options as `injectable`.\n *\n * @example\n * ```typescript\n * import { BaseComponent, component } from '@venizia/ignis';\n *\n * export @component()\n * class AuditComponent extends BaseComponent {\n * constructor() {\n * super({ scope: AuditComponent.name });\n * }\n *\n * override binding(): void {}\n * }\n * ```\n */\nexport const component = <ApplicationType = unknown>(\n opts?: IArtifactRegistrationOptions<ApplicationType>,\n): ClassDecorator => {\n return injectable<ApplicationType>({ type: ArtifactTypes.COMPONENT, ...opts });\n};\n\n/**\n * Class decorator that registers the class as a configuration artifact; `after` orders it behind other configuration classes.\n *\n * @example\n * ```typescript\n * import { BaseConfiguration, configuration } from '@venizia/ignis';\n *\n * export @configuration()\n * class SeedConfiguration extends BaseConfiguration {}\n *\n * export @configuration({ after: [SeedConfiguration] })\n * class IndexConfiguration extends BaseConfiguration {}\n * ```\n */\nexport const configuration = <ApplicationType = unknown>(\n opts?: IArtifactRegistrationOptions<ApplicationType>,\n): ClassDecorator => {\n return injectable<ApplicationType>({ type: ArtifactTypes.CONFIGURATION, ...opts });\n};\n\n/** Marks a component method as the provider of `key`. `registerArtifacts` binds the key to a lazy provider that resolves the component and calls the method; SINGLETON unless `scope` says otherwise. */\nexport const provide = (opts: { key: TBindingKey; scope?: TBindingScope }): MethodDecorator => {\n return (target, propertyKey) => {\n MetadataRegistry.getInstance().addProvideMetadata({\n target: target.constructor,\n metadata: {\n methodName: propertyKey,\n key: opts.key,\n ...(opts.scope ? { scope: opts.scope } : {}),\n },\n });\n };\n};\n\n/** Helpers of the stereotype decorators; the decorators themselves stay functions. */\nexport class InjectableUtility {\n /** The registration defaults a stereotype forwards to `@injectable`, copied field by field so an absent option stays absent. */\n static pickRegistrationOptions<ApplicationType = unknown>(opts: {\n metadata: IArtifactRegistrationOptions<ApplicationType>;\n }): IArtifactRegistrationOptions<ApplicationType> {\n const { binding, allowOverride, scope, order, when, after } = opts.metadata;\n const registration: IArtifactRegistrationOptions<ApplicationType> = {};\n\n if (binding !== undefined) {\n registration.binding = binding;\n }\n\n if (allowOverride !== undefined) {\n registration.allowOverride = allowOverride;\n }\n\n if (scope !== undefined) {\n registration.scope = scope;\n }\n\n if (order !== undefined) {\n registration.order = order;\n }\n\n if (when !== undefined) {\n registration.when = when;\n }\n\n if (after !== undefined) {\n registration.after = after;\n }\n\n return registration;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injection.js","sourceRoot":"","sources":["../../../../../../src/base/metadata/persistents/repository/injection.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,IAK3C,EAAQ,EAAE;IACT,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC;IAErE,+MAA+M;IAC/M,MAAM,UAAU,GAAkC,OAAO,CAAC,cAAc,CACtE,YAAY,CAAC,MAAM,EACnB,MAAM,CACP,CAAC;IACF,MAAM,cAAc,GAAG,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC;IAEvE,IAAI,cAAc,EAAE,CAAC;QACnB,8FAA8F;QAC9F,qFAAqF;QACrF,MAAM,cAAc,GAAG,cAAc,CAAC,MAAM;YAC1C,CAAC,CAAC,eAAe,CAAC,mBAAmB,CAA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D,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"injection.js","sourceRoot":"","sources":["../../../../../../src/base/metadata/persistents/repository/injection.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,IAK3C,EAAQ,EAAE;IACT,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC;IAErE,+MAA+M;IAC/M,MAAM,UAAU,GAAkC,OAAO,CAAC,cAAc,CACtE,YAAY,CAAC,MAAM,EACnB,MAAM,CACP,CAAC;IACF,MAAM,cAAc,GAAG,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC;IAEvE,IAAI,cAAc,EAAE,CAAC;QACnB,8FAA8F;QAC9F,qFAAqF;QACrF,MAAM,cAAc,GAAG,cAAc,CAAC,MAAM;YAC1C,CAAC,CAAC,eAAe,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM,EAAE,CAAC;YACxE,CAAC,CAAC,SAAS,CAAC;QACd,MAAM,SAAS,GACb,cAAc,CAAC,GAAG;YAClB,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa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,CAAC,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI;KAC3F,CAAC,CAAC;IAEH,kGAAkG;IAClG,oGAAoG;IACpG,0FAA0F;IAC1F,QAAQ,CAAC,iBAAiB,CAAC;QACzB,MAAM;QACN,KAAK,EAAE,CAAC;QACR,QAAQ,EACN,OAAO,aAAa,KAAK,QAAQ;YAC/B,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE;YAClD,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE;KAC9E,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import 'reflect-metadata';\n\nimport { BindingNamespaces } from '@/common/bindings';\nimport type { TRepositoryMetadata } from '@/helpers/inversion';\nimport { BindingKeys, MetadataKeys } from '@/helpers/inversion';\nimport type { MetadataRegistry } from '@/helpers/inversion';\nimport { ResolverUtility } from '@venizia/ignis-helpers/common';\nimport type { IInjectMetadata } from '@venizia/ignis-inversion';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { isDataSourceClass } from '../../../datasources';\nimport { validateFirstConstructorParameter } from './validate';\n\n/**\n * Auto-injects dataSource at constructor param[0] unless explicit @inject exists. A class is injected\n * by the class itself, so the container reads the key its registration recorded: a pinned\n * `binding` and a minified class name both resolve. Only a string reference is a key.\n */\nexport const registerDataSourceInjection = (opts: {\n target: Function;\n registry: MetadataRegistry;\n dataSourceRef: TRepositoryMetadata['dataSource'];\n resolvedDataSource: string | Function;\n}): void => {\n const { target, registry, dataSourceRef, resolvedDataSource } = opts;\n\n // Own metadata only: `getInjectMetadata` walks the prototype chain, so a repository extending another @repository class would see the BASE's injection at param[0] and silently resolve the base's dataSource.\n const ownInjects: IInjectMetadata[] | undefined = Reflect.getOwnMetadata(\n MetadataKeys.INJECT,\n target,\n );\n const injectAtIndex0 = ownInjects?.find((entry) => entry?.index === 0);\n\n if (injectAtIndex0) {\n // `@inject({ target })` carries no key; read the one recorded on the class. The function form\n // resolves through the same helper the container uses, so both paths read one class.\n const injectedTarget = injectAtIndex0.target\n ? ResolverUtility.resolveInjectTarget({ target: injectAtIndex0.target })\n : undefined;\n const injectKey =\n injectAtIndex0.key ??\n (injectedTarget ? registry.getBindingKey({ target: injectedTarget }) : undefined);\n\n // A class is judged by its brand: its key may sit under any namespace a `binding` pinned, and\n // a provisional key may still change at registration. Only a bare key is judged by its prefix.\n const isDataSourceTarget = injectedTarget\n ? isDataSourceClass(injectedTarget)\n : typeof injectKey === 'string' && injectKey.startsWith(`${BindingNamespaces.DATASOURCE}.`);\n\n if (!isDataSourceTarget) {\n throw getError({\n message: `[@repository][${target.name}] Invalid constructor | First parameter must be a DataSource | Found @inject with key: '${String(injectKey)}' | Expected a key starting with '${BindingNamespaces.DATASOURCE}.' or a DataSource class`,\n });\n }\n\n return;\n }\n\n // Checked only when this decorator writes the injection: an explicit @inject decides for itself.\n // An interface emits `Object` and a type-only class import emits `Function` under tsc (`Object`\n // under bun); neither names the class, so neither is judged.\n const firstParamType = Reflect.getMetadata('design:paramtypes', target)?.[0];\n\n if (firstParamType && firstParamType !== Object && firstParamType !== Function) {\n validateFirstConstructorParameter({ target, firstParamType, resolvedDataSource });\n }\n\n // The inherited list is the base repository's own, and setInjectMetadata may write straight into it.\n if (!ownInjects) {\n Reflect.defineMetadata(\n MetadataKeys.INJECT,\n [...(registry.getInjectMetadata({ target }) ?? [])],\n target,\n );\n }\n\n const derivedKey = BindingKeys.build<unknown>({\n namespace: BindingNamespaces.DATASOURCE,\n key: typeof resolvedDataSource === 'string' ? resolvedDataSource : resolvedDataSource.name,\n });\n\n // The class first, decided when the repository is resolved: by then any registration - decorated,\n // `bindingList()`, or `dataSource(X, { binding })` - has recorded its key on the class. The derived\n // key is the fallback for a class nothing recorded, bound by hand under exactly that key.\n registry.setInjectMetadata({\n target,\n index: 0,\n metadata:\n typeof dataSourceRef === 'string'\n ? { key: derivedKey, index: 0, isOptional: false }\n : { target: dataSourceRef, key: derivedKey, index: 0, isOptional: false },\n });\n};\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HTTP } from '@venizia/ignis-helpers/common';
|
|
1
2
|
import { createMiddleware } from 'hono/factory';
|
|
2
3
|
/** Factory for a middleware that answers `/favicon.ico` with an emoji rendered as SVG. */
|
|
3
4
|
export class EmojiFaviconMiddleware {
|
|
@@ -8,7 +9,7 @@ export class EmojiFaviconMiddleware {
|
|
|
8
9
|
if (context.req.path !== '/favicon.ico') {
|
|
9
10
|
return next();
|
|
10
11
|
}
|
|
11
|
-
context.res.headers.set(
|
|
12
|
+
context.res.headers.set(HTTP.Headers.CONTENT_TYPE, HTTP.HeaderValues.IMAGE_SVG);
|
|
12
13
|
return context.body(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" x="-0.1em" font-size="90">${icon}</text></svg>`);
|
|
13
14
|
});
|
|
14
15
|
return mw;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emoji-favicon.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/emoji-favicon/emoji-favicon.middleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emoji-favicon.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/emoji-favicon/emoji-favicon.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,0FAA0F;AAC1F,MAAM,OAAO,sBAAsB;IACjC,yDAAyD;IACzD,MAAM,CAAC,MAAM,CAAC,IAAsB;QAClC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QAEtB,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YAClD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBACxC,OAAO,IAAI,EAAE,CAAC;YAChB,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;YAEhF,OAAO,OAAO,CAAC,IAAI,CACjB,0GAA0G,IAAI,eAAe,CAC9H,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["import { HTTP } from '@venizia/ignis-helpers/common';\nimport type { MiddlewareHandler } from 'hono';\nimport { createMiddleware } from 'hono/factory';\n\n/** Factory for a middleware that answers `/favicon.ico` with an emoji rendered as SVG. */\nexport class EmojiFaviconMiddleware {\n /** Serves an emoji as an SVG favicon on /favicon.ico. */\n static create(opts: { icon: string }): MiddlewareHandler {\n const { icon } = opts;\n\n const mw = createMiddleware(async (context, next) => {\n if (context.req.path !== '/favicon.ico') {\n return next();\n }\n\n context.res.headers.set(HTTP.Headers.CONTENT_TYPE, HTTP.HeaderValues.IMAGE_SVG);\n\n return context.body(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\"><text y=\".9em\" x=\"-0.1em\" font-size=\"90\">${icon}</text></svg>`,\n );\n });\n\n return mw;\n }\n}\n"]}
|
|
@@ -72,7 +72,7 @@ export declare class OpenApiResponses {
|
|
|
72
72
|
'4XX': {
|
|
73
73
|
description: string;
|
|
74
74
|
content: {
|
|
75
|
-
|
|
75
|
+
"application/json": {
|
|
76
76
|
schema: z.ZodObject<{
|
|
77
77
|
statusCode: z.ZodOptional<z.ZodNumber>;
|
|
78
78
|
message: z.ZodString;
|
|
@@ -92,7 +92,7 @@ export declare class OpenApiResponses {
|
|
|
92
92
|
'5XX': {
|
|
93
93
|
description: string;
|
|
94
94
|
content: {
|
|
95
|
-
|
|
95
|
+
"application/json": {
|
|
96
96
|
schema: z.ZodObject<{
|
|
97
97
|
statusCode: z.ZodOptional<z.ZodNumber>;
|
|
98
98
|
message: z.ZodString;
|
|
@@ -126,7 +126,7 @@ export declare class OpenApiResponses {
|
|
|
126
126
|
}): {
|
|
127
127
|
description: string;
|
|
128
128
|
content: {
|
|
129
|
-
|
|
129
|
+
"application/json": {
|
|
130
130
|
schema: T;
|
|
131
131
|
};
|
|
132
132
|
};
|
|
@@ -137,7 +137,7 @@ export declare class OpenApiResponses {
|
|
|
137
137
|
'4XX': {
|
|
138
138
|
description: string;
|
|
139
139
|
content: {
|
|
140
|
-
|
|
140
|
+
"application/json": {
|
|
141
141
|
schema: z.ZodObject<{
|
|
142
142
|
statusCode: z.ZodOptional<z.ZodNumber>;
|
|
143
143
|
message: z.ZodString;
|
|
@@ -157,7 +157,7 @@ export declare class OpenApiResponses {
|
|
|
157
157
|
'5XX': {
|
|
158
158
|
description: string;
|
|
159
159
|
content: {
|
|
160
|
-
|
|
160
|
+
"application/json": {
|
|
161
161
|
schema: z.ZodObject<{
|
|
162
162
|
statusCode: z.ZodOptional<z.ZodNumber>;
|
|
163
163
|
message: z.ZodString;
|
|
@@ -179,7 +179,7 @@ export declare class OpenApiResponses {
|
|
|
179
179
|
'4XX': {
|
|
180
180
|
description: string;
|
|
181
181
|
content: {
|
|
182
|
-
|
|
182
|
+
"application/json": {
|
|
183
183
|
schema: z.ZodObject<{
|
|
184
184
|
statusCode: z.ZodOptional<z.ZodNumber>;
|
|
185
185
|
message: z.ZodString;
|
|
@@ -199,7 +199,7 @@ export declare class OpenApiResponses {
|
|
|
199
199
|
'5XX': {
|
|
200
200
|
description: string;
|
|
201
201
|
content: {
|
|
202
|
-
|
|
202
|
+
"application/json": {
|
|
203
203
|
schema: z.ZodObject<{
|
|
204
204
|
statusCode: z.ZodOptional<z.ZodNumber>;
|
|
205
205
|
message: z.ZodString;
|
|
@@ -219,7 +219,7 @@ export declare class OpenApiResponses {
|
|
|
219
219
|
200: {
|
|
220
220
|
description: string;
|
|
221
221
|
content: {
|
|
222
|
-
|
|
222
|
+
"application/json": {
|
|
223
223
|
schema: ContentSchema;
|
|
224
224
|
};
|
|
225
225
|
};
|
|
@@ -228,7 +228,7 @@ export declare class OpenApiResponses {
|
|
|
228
228
|
headers: NonNullable<HeaderSchema>;
|
|
229
229
|
description: string;
|
|
230
230
|
content: {
|
|
231
|
-
|
|
231
|
+
"application/json": {
|
|
232
232
|
schema: ContentSchema;
|
|
233
233
|
};
|
|
234
234
|
};
|
|
@@ -117,7 +117,7 @@ export class OpenApiResponses {
|
|
|
117
117
|
static jsonContent(opts) {
|
|
118
118
|
return {
|
|
119
119
|
description: opts.description,
|
|
120
|
-
content: {
|
|
120
|
+
content: { [HTTP.HeaderValues.APPLICATION_JSON]: { schema: opts.schema } },
|
|
121
121
|
required: opts.required,
|
|
122
122
|
};
|
|
123
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../../../src/base/models/common/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGvD;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,MAAM,CAAC;IACN,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,CAAC;SACV,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,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AAC,YAAY,CAGjB,IAAoD;QACpD,MAAM,YAAY,GAAG,gBAAgB,CAAC,WAAW,CAAC;YAChD,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,kBAAkB;YACnD,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC;QAEH,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO;YAClC,CAAC,CAAC,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;YAC5C,CAAC,CAAC,YAAY,CAAC;QAEjB,OAAO;YACL,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,eAAe;YAC3C,GAAG,gBAAgB,CAAC,cAAc,EAAE;SACrC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { z } from '@hono/zod-openapi';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { TIdSchemaType } from './constants';\n\n/**\n * The error RESPONSE for OpenAPI docs - here, beside the REST layer that already needs `@hono/zod-openapi`.\n * Named, so every route's `4XX` and `5XX` reference one `ErrorResponse` component.\n */\nexport const ErrorSchema = z\n .object({\n statusCode: z.number().optional(),\n message: z.string(),\n normalized: z\n .object({\n text: z.string(),\n code: z.string(),\n args: z.record(z.string(), z.any()),\n })\n .optional(),\n extra: z.record(z.string(), z.any()).optional(),\n requestId: z.string().optional(),\n details: z.record(z.string(), z.any()).optional(),\n })\n .openapi('ErrorResponse', {\n description: 'Error Schema',\n example: {\n statusCode: HTTP.ResultCodes.RS_4.Conflict,\n message: 'A category named %{name} already exists.',\n normalized: {\n text: 'A category named %{name} already exists.',\n code: 'server.commerce.category.create.duplicate_name',\n args: { name: 'Ticket' },\n },\n extra: { categoryId: 42 },\n requestId: 'abc-123-def',\n details: { url: 'http://localhost:3000/categories', path: '/categories' },\n },\n });\n\n/** The error response body type inferred from `ErrorSchema`. */\nexport type TErrorResponse = z.infer<typeof ErrorSchema>;\n\n/** OpenAPI schema builders for the parts of a route that every controller repeats. */\nexport class OpenApiSchemas {\n static idParams(opts?: { idType: TIdSchemaType }) {\n const { idType = 'number' } = opts ?? {};\n\n switch (idType) {\n case 'number': {\n return z.object({\n id: z.number().openapi({\n param: {\n name: 'id',\n in: 'path',\n description: 'The unique id of the resource',\n },\n examples: [1, 2, 3],\n }),\n });\n }\n case 'string': {\n return z.object({\n id: z.string().openapi({\n param: {\n name: 'id',\n in: 'path',\n description: 'The unique id of the resource',\n },\n examples: ['4651e634-a530-4484-9b09-9616a28f35e3', 'some_unique_id'],\n }),\n });\n }\n default: {\n throw getError({\n message: `[OpenApiSchemas.idParams] Invalid input idType | valid: [string | number] | idType: ${idType}`,\n });\n }\n }\n }\n\n static requiredString(opts?: { min?: number; max?: number; fixed?: number }) {\n const { min, max, fixed } = opts ?? {};\n let rs = z.string().nonempty();\n\n if (min) {\n rs = rs.min(min);\n }\n\n if (max) {\n rs = rs.max(max);\n }\n\n if (fixed) {\n rs = rs.length(fixed);\n }\n\n return rs;\n }\n}\n\n/** OpenAPI Header Object format */\ntype THeaderObject = {\n description?: string;\n schema: { type: string; examples?: Array<string> };\n};\n\n/** Map of header names to Header Objects */\ntype TResponseHeaders = Record<string, THeaderObject>;\n\ntype TJsonResponseOpts<T extends z.ZodType, H extends TResponseHeaders | undefined> = {\n schema: T;\n description?: string;\n required?: boolean;\n headers?: H;\n};\n\n/** OpenAPI response builders: the JSON and HTML bodies of a route, and the error bodies every route shares. */\nexport class OpenApiResponses {\n /** Creates HTML content configuration for OpenAPI documentation. */\n static htmlContent(opts: { description: string; required?: boolean }) {\n const { description } = opts;\n\n return {\n description,\n content: {\n 'text/html': {\n schema: z.string().openapi({\n description: 'HTML content',\n example: '<!DOCTYPE html><html><head><title>Page</title></head><body>...</body></html>',\n }),\n },\n },\n required: opts?.required ?? false,\n };\n }\n\n /** Creates HTML response configuration for OpenAPI documentation. */\n static htmlResponse(opts: { description: string; required?: boolean }) {\n return {\n [HTTP.ResultCodes.RS_2.Ok]: OpenApiResponses.htmlContent({\n description: opts.description,\n required: opts.required,\n }),\n ...OpenApiResponses.errorResponses(),\n };\n }\n\n static jsonContent<T extends z.ZodType>(opts: {\n schema: T;\n description: string;\n required?: boolean;\n }) {\n return {\n description: opts.description,\n content: { [HTTP.HeaderValues.APPLICATION_JSON]: { schema: opts.schema } },\n required: opts.required,\n };\n }\n\n /** The JSON error body of a route, under `4XX` and `5XX` - the range keys OpenAPI accepts. */\n static errorResponses() {\n const errorResponse = OpenApiResponses.jsonContent({\n description: 'Error Response',\n schema: ErrorSchema,\n });\n\n return { '4XX': errorResponse, '5XX': errorResponse };\n }\n\n static jsonResponse<\n ContentSchema extends z.ZodType,\n HeaderSchema extends TResponseHeaders | undefined = undefined,\n >(opts: TJsonResponseOpts<ContentSchema, HeaderSchema>) {\n const baseResponse = OpenApiResponses.jsonContent({\n required: opts.required,\n description: opts.description ?? 'Success Response',\n schema: opts.schema,\n });\n\n const successResponse = opts.headers\n ? { ...baseResponse, headers: opts.headers }\n : baseResponse;\n\n return {\n [HTTP.ResultCodes.RS_2.Ok]: successResponse,\n ...OpenApiResponses.errorResponses(),\n };\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TJsonValue } from '@venizia/ignis-helpers/common';
|
|
2
|
-
import type { ApplicationError, TResponsedError } from '@venizia/ignis-helpers/core';
|
|
2
|
+
import type { ApplicationError, TResponsedError, UrlFetchError } from '@venizia/ignis-helpers/core';
|
|
3
3
|
/**
|
|
4
4
|
* What an IGNIS server answers - `Content-Range`, the error envelope - read once, here, for every
|
|
5
5
|
* client of that server: the http connector, and a client that reads it without the connector.
|
|
@@ -54,6 +54,15 @@ export declare class HttpResponseReader {
|
|
|
54
54
|
context: string;
|
|
55
55
|
rootKey?: string;
|
|
56
56
|
}): Promise<ApplicationError>;
|
|
57
|
+
/**
|
|
58
|
+
* `toApplicationError` for a fetcher's refused answer: it reads the body the `UrlFetchError` kept (the first 64 KiB),
|
|
59
|
+
* and an error that carries none is described by its status alone.
|
|
60
|
+
*/
|
|
61
|
+
static fromFetchError(opts: {
|
|
62
|
+
error: UrlFetchError<Response>;
|
|
63
|
+
context: string;
|
|
64
|
+
rootKey?: string;
|
|
65
|
+
}): Promise<ApplicationError>;
|
|
57
66
|
/**
|
|
58
67
|
* The body as text: `''` for a 204 or an empty body. `response.json()` throws on those, and each client
|
|
59
68
|
* that reads a response has copied the guard.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTTP } from '@venizia/ignis-helpers/common';
|
|
2
|
-
import { getError } from '@venizia/ignis-helpers/core';
|
|
2
|
+
import { getError, ResponseReader } from '@venizia/ignis-helpers/core';
|
|
3
3
|
/**
|
|
4
4
|
* What an IGNIS server answers - `Content-Range`, the error envelope - read once, here, for every
|
|
5
5
|
* client of that server: the http connector, and a client that reads it without the connector.
|
|
@@ -120,13 +120,27 @@ export class HttpResponseReader {
|
|
|
120
120
|
transform: ({ message }) => ({ ...message, text: displayText }),
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* `toApplicationError` for a fetcher's refused answer: it reads the body the `UrlFetchError` kept (the first 64 KiB),
|
|
125
|
+
* and an error that carries none is described by its status alone.
|
|
126
|
+
*/
|
|
127
|
+
static async fromFetchError(opts) {
|
|
128
|
+
const { error, context, rootKey } = opts;
|
|
129
|
+
// A hand-built error may carry a status a `Response` refuses (below 200 or above 599, e.g. 0): that is a bad gateway.
|
|
130
|
+
const isResponseStatus = error.status >= 200 && error.status <= 599;
|
|
131
|
+
const response = error.response ??
|
|
132
|
+
new Response(null, {
|
|
133
|
+
status: isResponseStatus ? error.status : HTTP.ResultCodes.RS_5.BadGateway,
|
|
134
|
+
headers: error.headers,
|
|
135
|
+
});
|
|
136
|
+
return HttpResponseReader.toApplicationError({ response, context, rootKey });
|
|
137
|
+
}
|
|
123
138
|
/**
|
|
124
139
|
* The body as text: `''` for a 204 or an empty body. `response.json()` throws on those, and each client
|
|
125
140
|
* that reads a response has copied the guard.
|
|
126
141
|
*/
|
|
127
142
|
static async readText(opts) {
|
|
128
|
-
|
|
129
|
-
return response.status === HTTP.ResultCodes.RS_2.NoContent ? '' : response.text();
|
|
143
|
+
return ResponseReader.readText(opts);
|
|
130
144
|
}
|
|
131
145
|
/**
|
|
132
146
|
* The body of a success answer, by what it says it is: `null` for a 204 or an empty body, the parsed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-reader.js","sourceRoot":"","sources":["../../../../../src/base/repositories/common/response-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGvD;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAC7B,6GAA6G;aAC7F,8BAAyB,GAAG,OAAO,CAAC;IAEpD,MAAM,CAAC,aAAa,CAAC,KAAc;QACjC,OAAO,CACL,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,SAAS,CAC1F,CAAC;IACJ,CAAC;IAED,oEAAoE;IACpE,MAAM,CAAC,MAAM,CAAC,KAAc;QAC1B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAExB;QACC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAExB,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAE7D,IAAI,KAAK,EAAE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CAAC,IAAI,CAAC;YACvC,CAAC,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAC7C,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,CAAC;QAClB,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;QAEpC,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,CAAC;IACvF,CAAC","sourcesContent":["import { HTTP } from '@venizia/ignis-helpers/common';\nimport type { TJsonValue } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { ApplicationError, TResponsedError } from '@venizia/ignis-helpers/core';\n\n/**\n * What an IGNIS server answers - `Content-Range`, the error envelope - read once, here, for every\n * client of that server: the http connector, and a client that reads it without the connector.\n */\nexport class HttpResponseReader {\n /** A content type that names JSON: `application/json`, `application/problem+json`, `application/ld+json`. */\n static readonly JSON_CONTENT_TYPE_PATTERN = /json/i;\n\n static isPlainObject(value: unknown): value is Record<string, unknown> {\n return (\n !!value && typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype\n );\n }\n\n /** An empty string reads as absent, so a fallback still applies. */\n static toText(value: unknown): string | undefined {\n return typeof value === 'string' && value !== '' ? value : undefined;\n }\n\n /**\n * A `Content-Range` header as the IGNIS server writes it: `records 0-24/137` -> skip 0, total 137;\n * an empty page, `records *\\/137` -> total 137. Anything else, including an absent header or an\n * unknown total, is `undefined`.\n */\n static parseContentRange(opts: {\n header?: string | null;\n }): { skip?: number; total: number } | undefined {\n const { header } = opts;\n\n if (!header) {\n return undefined;\n }\n\n const range = header.match(/(\\d+)\\s*-\\s*(\\d+)\\s*\\/\\s*(\\d+)/);\n\n if (range) {\n return { skip: Number(range[1]), total: Number(range[3]) };\n }\n\n const unsatisfied = header.match(/\\*\\s*\\/\\s*(\\d+)/);\n\n if (unsatisfied) {\n return { total: Number(unsatisfied[1]) };\n }\n\n return undefined;\n }\n\n /**\n * The IGNIS error envelope - `{ message, statusCode, normalized: { text, code, args }, requestId,\n * extra, details }` - read off a parsed response body. A server configured with `error.rootKey`\n * wraps it under that key; pass the same `rootKey` to unwrap it. A body without that key, or with a\n * non-object under it (a proxy's `{ error: 'Bad Gateway' }`), is read as it stands.\n *\n * A body that is not a plain object yields `{}`; any other body yields its known fields, each\n * `undefined` when absent or mistyped. An empty string reads as absent.\n */\n static readErrorEnvelope(opts: { body: unknown; rootKey?: string }): TResponsedError {\n const { body, rootKey } = opts;\n\n const wrapped = rootKey && HttpResponseReader.isPlainObject(body) ? body[rootKey] : undefined;\n const envelope = HttpResponseReader.isPlainObject(wrapped) ? wrapped : body;\n\n if (!HttpResponseReader.isPlainObject(envelope)) {\n return {};\n }\n\n const { message, statusCode, normalized, requestId, extra, details } = envelope;\n const normalizedRecord = HttpResponseReader.isPlainObject(normalized) ? normalized : {};\n const { text, code, args } = normalizedRecord;\n\n return {\n message: HttpResponseReader.toText(message),\n statusCode: typeof statusCode === 'number' ? statusCode : undefined,\n normalized: {\n text: HttpResponseReader.toText(text),\n code: HttpResponseReader.toText(code),\n args: HttpResponseReader.isPlainObject(args) ? { ...args } : undefined,\n },\n requestId: HttpResponseReader.toText(requestId),\n extra: HttpResponseReader.isPlainObject(extra) ? { ...extra } : undefined,\n details: HttpResponseReader.isPlainObject(details) ? { ...details } : undefined,\n };\n }\n\n /** A failed response's envelope. A body that is not JSON yields `{}`, and the status alone still describes it. */\n static async readError(opts: { response: Response; rootKey?: string }): Promise<TResponsedError> {\n let text;\n\n try {\n const result = await opts.response.text();\n text = result;\n // eslint-disable-next-line venizia/no-silent-catch -- an unreadable body is read as no text; the status alone still describes the failure\n } catch {\n text = '';\n }\n\n let body: unknown;\n\n try {\n body = text ? JSON.parse(text) : undefined;\n // eslint-disable-next-line venizia/no-silent-catch -- a body that is not JSON yields `{}`; the status alone still describes the failure\n } catch {\n return {};\n }\n\n return HttpResponseReader.readErrorEnvelope({ body, rootKey: opts.rootKey });\n }\n\n /**\n * A failed response as the error the server threw: its status, code, args and text, and its\n * `extra` with the `requestId` added. `message` is `context` plus the server's text, for logs;\n * `normalized.text` stays the server's, for display - `HTTP <status>` when the server sent none.\n * `cause` is the server's `details.cause` - a 422's per-field issues, `{ path, message, code }`.\n *\n * `requestId` names the request this client made. A relaying server's `extra` carries the id of\n * the request it made upstream: it joins `upstreamRequestIds`, nearest first, at every hop.\n */\n static async toApplicationError(opts: {\n response: Response;\n /** Where it failed, for logs - e.g. `[HttpDataSource][read] 404 | /tickets`. */\n context: string;\n rootKey?: string;\n }): Promise<ApplicationError> {\n const { response, context, rootKey } = opts;\n const server = await HttpResponseReader.readError({ response, rootKey });\n const serverText = server.normalized?.text ?? server.message;\n const displayText = serverText ?? `HTTP ${response.status}`;\n\n const extra: Record<string, unknown> = { ...server.extra };\n\n if (server.requestId) {\n const upstreamRequestId = extra.requestId;\n extra.requestId = server.requestId;\n\n if (upstreamRequestId !== undefined && upstreamRequestId !== server.requestId) {\n const known = Array.isArray(extra.upstreamRequestIds) ? extra.upstreamRequestIds : [];\n extra.upstreamRequestIds = [upstreamRequestId, ...known];\n }\n }\n\n return getError({\n statusCode: response.status,\n message: serverText ? `${context} | ${serverText}` : context,\n messageCode: server.normalized?.code,\n messageArgs: server.normalized?.args,\n extra: Object.keys(extra).length > 0 ? extra : undefined,\n cause: server.details?.cause,\n transform: ({ message }) => ({ ...message, text: displayText }),\n });\n }\n\n /**\n * The body as text: `''` for a 204 or an empty body. `response.json()` throws on those, and each client\n * that reads a response has copied the guard.\n */\n static async readText(opts: { response: Response }): Promise<string> {\n const { response } = opts;\n\n return response.status === HTTP.ResultCodes.RS_2.NoContent ? '' : response.text();\n }\n\n /**\n * The body of a success answer, by what it says it is: `null` for a 204 or an empty body, the parsed\n * value when the content type names JSON (`application/json`, `application/problem+json`), the text itself\n * for any other type (`text/plain`, `text/csv`). A body that claims JSON and is not is a `502` that names\n * `context` (where it happened, e.g. `[Client][read] 200 | /tickets`), its size and its content type; its\n * content stays out of the message, which a relaying server may pass to its own clients.\n */\n static async readBody(opts: { response: Response; context: string }): Promise<TJsonValue> {\n const { response, context } = opts;\n const text = await HttpResponseReader.readText({ response });\n\n if (!text) {\n return null;\n }\n\n if (\n !HttpResponseReader.JSON_CONTENT_TYPE_PATTERN.test(\n response.headers.get(HTTP.Headers.CONTENT_TYPE) ?? '',\n )\n ) {\n return text;\n }\n\n return HttpResponseReader.parseJson({ text, response, context });\n }\n\n /**\n * The body as JSON whatever its content type says, `null` for a 204 or an empty body: for a route that\n * answers JSON under a type a proxy rewrote. Errors as `readBody` does.\n */\n static async readJson(opts: { response: Response; context: string }): Promise<TJsonValue> {\n const { response, context } = opts;\n const text = await HttpResponseReader.readText({ response });\n\n if (!text) {\n return null;\n }\n\n return HttpResponseReader.parseJson({ text, response, context });\n }\n\n private static parseJson(opts: {\n text: string;\n response: Response;\n context: string;\n }): TJsonValue {\n const { text, response, context } = opts;\n\n try {\n return JSON.parse(text);\n } catch {\n const contentType = response.headers.get(HTTP.Headers.CONTENT_TYPE) ?? 'none';\n\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.BadGateway,\n message: `${context} | The response body is not JSON (${text.length} chars, content-type: ${contentType})`,\n });\n }\n }\n\n /**\n * A body the server marked with `x-response-extra` carries `extra` beside its rows. `body` is what\n * the route answers without extras: the `{ count, data }` envelope when the count was asked for in\n * the body, the rows otherwise. Any other body is returned as it stands - an unmarked object is\n * never unwrapped, so a row that has `data` and `extra` columns of its own is never misread.\n */\n static readExtra(opts: { body: unknown; headers: Pick<Headers, 'has'> }): {\n body: unknown;\n extra?: Record<string, unknown>;\n } {\n const { body, headers } = opts;\n const isMarked = headers.has(HTTP.Headers.RESPONSE_EXTRA);\n\n if (\n !isMarked ||\n !HttpResponseReader.isPlainObject(body) ||\n !HttpResponseReader.isPlainObject(body.extra)\n ) {\n return { body };\n }\n\n const { extra, ...envelope } = body;\n\n return { body: 'count' in envelope ? envelope : envelope.data, extra: { ...extra } };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"response-reader.js","sourceRoot":"","sources":["../../../../../src/base/repositories/common/response-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGvE;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAC7B,6GAA6G;aAC7F,8BAAyB,GAAG,OAAO,CAAC;IAEpD,MAAM,CAAC,aAAa,CAAC,KAAc;QACjC,OAAO,CACL,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,SAAS,CAC1F,CAAC;IACJ,CAAC;IAED,oEAAoE;IACpE,MAAM,CAAC,MAAM,CAAC,KAAc;QAC1B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAExB;QACC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAExB,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAE7D,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,CAAC;QAED,MAAM,WAAW,GAAG,MAAM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AC;IACH,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,IAAsD;QAIrE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAE1D,IACE,CAAC,QAAQ;YACT,CAAC,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC;YACvC,CAAC,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAC7C,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,CAAC;QAClB,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;QAEpC,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,CAAC;IACvF,CAAC","sourcesContent":["import { HTTP } from '@venizia/ignis-helpers/common';\nimport type { TJsonValue } from '@venizia/ignis-helpers/common';\nimport { getError, ResponseReader } from '@venizia/ignis-helpers/core';\nimport type { ApplicationError, TResponsedError, UrlFetchError } from '@venizia/ignis-helpers/core';\n\n/**\n * What an IGNIS server answers - `Content-Range`, the error envelope - read once, here, for every\n * client of that server: the http connector, and a client that reads it without the connector.\n */\nexport class HttpResponseReader {\n /** A content type that names JSON: `application/json`, `application/problem+json`, `application/ld+json`. */\n static readonly JSON_CONTENT_TYPE_PATTERN = /json/i;\n\n static isPlainObject(value: unknown): value is Record<string, unknown> {\n return (\n !!value && typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype\n );\n }\n\n /** An empty string reads as absent, so a fallback still applies. */\n static toText(value: unknown): string | undefined {\n return typeof value === 'string' && value !== '' ? value : undefined;\n }\n\n /**\n * A `Content-Range` header as the IGNIS server writes it: `records 0-24/137` -> skip 0, total 137;\n * an empty page, `records *\\/137` -> total 137. Anything else, including an absent header or an\n * unknown total, is `undefined`.\n */\n static parseContentRange(opts: {\n header?: string | null;\n }): { skip?: number; total: number } | undefined {\n const { header } = opts;\n\n if (!header) {\n return undefined;\n }\n\n const range = header.match(/(\\d+)\\s*-\\s*(\\d+)\\s*\\/\\s*(\\d+)/);\n\n if (range) {\n return { skip: Number(range[1]), total: Number(range[3]) };\n }\n\n const unsatisfied = header.match(/\\*\\s*\\/\\s*(\\d+)/);\n\n if (unsatisfied) {\n return { total: Number(unsatisfied[1]) };\n }\n\n return undefined;\n }\n\n /**\n * The IGNIS error envelope - `{ message, statusCode, normalized: { text, code, args }, requestId,\n * extra, details }` - read off a parsed response body. A server configured with `error.rootKey`\n * wraps it under that key; pass the same `rootKey` to unwrap it. A body without that key, or with a\n * non-object under it (a proxy's `{ error: 'Bad Gateway' }`), is read as it stands.\n *\n * A body that is not a plain object yields `{}`; any other body yields its known fields, each\n * `undefined` when absent or mistyped. An empty string reads as absent.\n */\n static readErrorEnvelope(opts: { body: unknown; rootKey?: string }): TResponsedError {\n const { body, rootKey } = opts;\n\n const wrapped = rootKey && HttpResponseReader.isPlainObject(body) ? body[rootKey] : undefined;\n const envelope = HttpResponseReader.isPlainObject(wrapped) ? wrapped : body;\n\n if (!HttpResponseReader.isPlainObject(envelope)) {\n return {};\n }\n\n const { message, statusCode, normalized, requestId, extra, details } = envelope;\n const normalizedRecord = HttpResponseReader.isPlainObject(normalized) ? normalized : {};\n const { text, code, args } = normalizedRecord;\n\n return {\n message: HttpResponseReader.toText(message),\n statusCode: typeof statusCode === 'number' ? statusCode : undefined,\n normalized: {\n text: HttpResponseReader.toText(text),\n code: HttpResponseReader.toText(code),\n args: HttpResponseReader.isPlainObject(args) ? { ...args } : undefined,\n },\n requestId: HttpResponseReader.toText(requestId),\n extra: HttpResponseReader.isPlainObject(extra) ? { ...extra } : undefined,\n details: HttpResponseReader.isPlainObject(details) ? { ...details } : undefined,\n };\n }\n\n /** A failed response's envelope. A body that is not JSON yields `{}`, and the status alone still describes it. */\n static async readError(opts: { response: Response; rootKey?: string }): Promise<TResponsedError> {\n let text;\n\n try {\n const result = await opts.response.text();\n text = result;\n // eslint-disable-next-line venizia/no-silent-catch -- an unreadable body is read as no text; the status alone still describes the failure\n } catch {\n text = '';\n }\n\n let body: unknown;\n\n try {\n body = text ? JSON.parse(text) : undefined;\n // eslint-disable-next-line venizia/no-silent-catch -- a body that is not JSON yields `{}`; the status alone still describes the failure\n } catch {\n return {};\n }\n\n return HttpResponseReader.readErrorEnvelope({ body, rootKey: opts.rootKey });\n }\n\n /**\n * A failed response as the error the server threw: its status, code, args and text, and its\n * `extra` with the `requestId` added. `message` is `context` plus the server's text, for logs;\n * `normalized.text` stays the server's, for display - `HTTP <status>` when the server sent none.\n * `cause` is the server's `details.cause` - a 422's per-field issues, `{ path, message, code }`.\n *\n * `requestId` names the request this client made. A relaying server's `extra` carries the id of\n * the request it made upstream: it joins `upstreamRequestIds`, nearest first, at every hop.\n */\n static async toApplicationError(opts: {\n response: Response;\n /** Where it failed, for logs - e.g. `[HttpDataSource][read] 404 | /tickets`. */\n context: string;\n rootKey?: string;\n }): Promise<ApplicationError> {\n const { response, context, rootKey } = opts;\n const server = await HttpResponseReader.readError({ response, rootKey });\n const serverText = server.normalized?.text ?? server.message;\n const displayText = serverText ?? `HTTP ${response.status}`;\n\n const extra: Record<string, unknown> = { ...server.extra };\n\n if (server.requestId) {\n const upstreamRequestId = extra.requestId;\n extra.requestId = server.requestId;\n\n if (upstreamRequestId !== undefined && upstreamRequestId !== server.requestId) {\n const known = Array.isArray(extra.upstreamRequestIds) ? extra.upstreamRequestIds : [];\n extra.upstreamRequestIds = [upstreamRequestId, ...known];\n }\n }\n\n return getError({\n statusCode: response.status,\n message: serverText ? `${context} | ${serverText}` : context,\n messageCode: server.normalized?.code,\n messageArgs: server.normalized?.args,\n extra: Object.keys(extra).length > 0 ? extra : undefined,\n cause: server.details?.cause,\n transform: ({ message }) => ({ ...message, text: displayText }),\n });\n }\n\n /**\n * `toApplicationError` for a fetcher's refused answer: it reads the body the `UrlFetchError` kept (the first 64 KiB),\n * and an error that carries none is described by its status alone.\n */\n static async fromFetchError(opts: {\n error: UrlFetchError<Response>;\n context: string;\n rootKey?: string;\n }): Promise<ApplicationError> {\n const { error, context, rootKey } = opts;\n // A hand-built error may carry a status a `Response` refuses (below 200 or above 599, e.g. 0): that is a bad gateway.\n const isResponseStatus = error.status >= 200 && error.status <= 599;\n const response =\n error.response ??\n new Response(null, {\n status: isResponseStatus ? error.status : HTTP.ResultCodes.RS_5.BadGateway,\n headers: error.headers,\n });\n\n return HttpResponseReader.toApplicationError({ response, context, rootKey });\n }\n\n /**\n * The body as text: `''` for a 204 or an empty body. `response.json()` throws on those, and each client\n * that reads a response has copied the guard.\n */\n static async readText(opts: { response: Response }): Promise<string> {\n return ResponseReader.readText(opts);\n }\n\n /**\n * The body of a success answer, by what it says it is: `null` for a 204 or an empty body, the parsed\n * value when the content type names JSON (`application/json`, `application/problem+json`), the text itself\n * for any other type (`text/plain`, `text/csv`). A body that claims JSON and is not is a `502` that names\n * `context` (where it happened, e.g. `[Client][read] 200 | /tickets`), its size and its content type; its\n * content stays out of the message, which a relaying server may pass to its own clients.\n */\n static async readBody(opts: { response: Response; context: string }): Promise<TJsonValue> {\n const { response, context } = opts;\n const text = await HttpResponseReader.readText({ response });\n\n if (!text) {\n return null;\n }\n\n if (\n !HttpResponseReader.JSON_CONTENT_TYPE_PATTERN.test(\n response.headers.get(HTTP.Headers.CONTENT_TYPE) ?? '',\n )\n ) {\n return text;\n }\n\n return HttpResponseReader.parseJson({ text, response, context });\n }\n\n /**\n * The body as JSON whatever its content type says, `null` for a 204 or an empty body: for a route that\n * answers JSON under a type a proxy rewrote. Errors as `readBody` does.\n */\n static async readJson(opts: { response: Response; context: string }): Promise<TJsonValue> {\n const { response, context } = opts;\n const text = await HttpResponseReader.readText({ response });\n\n if (!text) {\n return null;\n }\n\n return HttpResponseReader.parseJson({ text, response, context });\n }\n\n private static parseJson(opts: {\n text: string;\n response: Response;\n context: string;\n }): TJsonValue {\n const { text, response, context } = opts;\n\n try {\n return JSON.parse(text);\n } catch {\n const contentType = response.headers.get(HTTP.Headers.CONTENT_TYPE) ?? 'none';\n\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.BadGateway,\n message: `${context} | The response body is not JSON (${text.length} chars, content-type: ${contentType})`,\n });\n }\n }\n\n /**\n * A body the server marked with `x-response-extra` carries `extra` beside its rows. `body` is what\n * the route answers without extras: the `{ count, data }` envelope when the count was asked for in\n * the body, the rows otherwise. Any other body is returned as it stands - an unmarked object is\n * never unwrapped, so a row that has `data` and `extra` columns of its own is never misread.\n */\n static readExtra(opts: { body: unknown; headers: Pick<Headers, 'has'> }): {\n body: unknown;\n extra?: Record<string, unknown>;\n } {\n const { body, headers } = opts;\n const isMarked = headers.has(HTTP.Headers.RESPONSE_EXTRA);\n\n if (\n !isMarked ||\n !HttpResponseReader.isPlainObject(body) ||\n !HttpResponseReader.isPlainObject(body.extra)\n ) {\n return { body };\n }\n\n const { extra, ...envelope } = body;\n\n return { body: 'count' in envelope ? envelope : envelope.data, extra: { ...extra } };\n }\n}\n"]}
|
|
@@ -40,12 +40,12 @@ export declare class ArtifactNamespaces {
|
|
|
40
40
|
}
|
|
41
41
|
/** Core binding keys for fundamental application components and configuration. */
|
|
42
42
|
export declare class CoreBindings extends BindingKeys {
|
|
43
|
-
static readonly APPLICATION_INSTANCE
|
|
44
|
-
static readonly APPLICATION_SERVER
|
|
45
|
-
static readonly APPLICATION_CONFIG
|
|
46
|
-
static readonly APPLICATION_PROJECT_ROOT
|
|
47
|
-
static readonly APPLICATION_ROOT_ROUTER
|
|
48
|
-
static readonly APPLICATION_ENVIRONMENTS
|
|
49
|
-
static readonly APPLICATION_MIDDLEWARE_OPTIONS
|
|
43
|
+
static readonly APPLICATION_INSTANCE: import("@venizia/ignis-inversion").TBindingKey<unknown>;
|
|
44
|
+
static readonly APPLICATION_SERVER: import("@venizia/ignis-inversion").TBindingKey<unknown>;
|
|
45
|
+
static readonly APPLICATION_CONFIG: import("@venizia/ignis-inversion").TBindingKey<unknown>;
|
|
46
|
+
static readonly APPLICATION_PROJECT_ROOT: import("@venizia/ignis-inversion").TBindingKey<string>;
|
|
47
|
+
static readonly APPLICATION_ROOT_ROUTER: import("@venizia/ignis-inversion").TBindingKey<unknown>;
|
|
48
|
+
static readonly APPLICATION_ENVIRONMENTS: import("@venizia/ignis-inversion").TBindingKey<unknown>;
|
|
49
|
+
static readonly APPLICATION_MIDDLEWARE_OPTIONS: import("@venizia/ignis-inversion").TBindingKey<unknown>;
|
|
50
50
|
}
|
|
51
51
|
//# sourceMappingURL=bindings.d.ts.map
|
|
@@ -64,12 +64,26 @@ export class ArtifactNamespaces {
|
|
|
64
64
|
}
|
|
65
65
|
/** Core binding keys for fundamental application components and configuration. */
|
|
66
66
|
export class CoreBindings extends BindingKeys {
|
|
67
|
-
static { this.APPLICATION_INSTANCE =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
static { this.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
static { this.
|
|
67
|
+
static { this.APPLICATION_INSTANCE = BindingKeys.build({
|
|
68
|
+
key: '@app/instance',
|
|
69
|
+
}); }
|
|
70
|
+
static { this.APPLICATION_SERVER = BindingKeys.build({
|
|
71
|
+
key: '@app/server',
|
|
72
|
+
}); }
|
|
73
|
+
static { this.APPLICATION_CONFIG = BindingKeys.build({
|
|
74
|
+
key: '@app/config',
|
|
75
|
+
}); }
|
|
76
|
+
static { this.APPLICATION_PROJECT_ROOT = BindingKeys.build({
|
|
77
|
+
key: '@app/project_root',
|
|
78
|
+
}); }
|
|
79
|
+
static { this.APPLICATION_ROOT_ROUTER = BindingKeys.build({
|
|
80
|
+
key: '@app/router/root',
|
|
81
|
+
}); }
|
|
82
|
+
static { this.APPLICATION_ENVIRONMENTS = BindingKeys.build({
|
|
83
|
+
key: '@app/environments',
|
|
84
|
+
}); }
|
|
85
|
+
static { this.APPLICATION_MIDDLEWARE_OPTIONS = BindingKeys.build({
|
|
86
|
+
key: '@app/middleware_options',
|
|
87
|
+
}); }
|
|
74
88
|
}
|
|
75
89
|
//# sourceMappingURL=bindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../../../src/common/bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKvD,0DAA0D;AAC1D,MAAM,OAAO,iBAAiB;IAC5B,kGAAkG;aAC1E,iBAAY,GAAG,WAAW,CAAC;aAEnC,cAAS,GAAG,iBAAiB,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;aAEtE,eAAU,GAAG,iBAAiB,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;aACxE,eAAU,GAAG,iBAAiB,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;aACzE,UAAK,GAAG,iBAAiB,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;aAE9D,YAAO,GAAG,iBAAiB,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;aAClE,eAAU,GAAG,iBAAiB,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;aACxE,aAAQ,GAAG,iBAAiB,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;aACpE,eAAU,GAAG,iBAAiB,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;aAExE,kBAAa,GAAG,iBAAiB,CAAC,eAAe,CAAC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AAG,WAAW,CAAC,KAAK,CAAU;QAC9D,GAAG,EAAE,aAAa;KACnB,CAAC,CAAC;aAEa,uBAAkB,GAAG,WAAW,CAAC,KAAK,CAAU;QAC9D,GAAG,EAAE,aAAa;KACnB,CAAC,CAAC;aAEa,6BAAwB,GAAG,WAAW,CAAC,KAAK,CAAS;QACnE,GAAG,EAAE,mBAAmB;KACzB,CAAC,CAAC;aAEa,4BAAuB,GAAG,WAAW,CAAC,KAAK,CAAU;QACnE,GAAG,EAAE,kBAAkB;KACxB,CAAC,CAAC;aAEa,6BAAwB,GAAG,WAAW,CAAC,KAAK,CAAU;QACpE,GAAG,EAAE,mBAAmB;KACzB,CAAC,CAAC;aAEa,mCAA8B,GAAG,WAAW,CAAC,KAAK,CAAU;QAC1E,GAAG,EAAE,yBAAyB;KAC/B,CAAC,CAAC","sourcesContent":["import { ArtifactTypes, BindingKeys } from '@/helpers/inversion';\nimport type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\n\n/** Valid `BindingNamespaces` values. */\nexport type TBindingNamespace = TConstValue<typeof BindingNamespaces>;\n\n/** Static binding namespaces for dependency injection. */\nexport class BindingNamespaces {\n // Declared first: every constant below runs through createNamespace while this class initializes.\n private static readonly NAME_PATTERN = /^[^.\\s]+$/;\n\n static readonly COMPONENT = BindingNamespaces.createNamespace({ name: 'components' });\n\n static readonly DATASOURCE = BindingNamespaces.createNamespace({ name: 'datasources' });\n static readonly REPOSITORY = BindingNamespaces.createNamespace({ name: 'repositories' });\n static readonly MODEL = BindingNamespaces.createNamespace({ name: 'models' });\n\n static readonly SERVICE = BindingNamespaces.createNamespace({ name: 'services' });\n static readonly MIDDLEWARE = BindingNamespaces.createNamespace({ name: 'middlewares' });\n static readonly PROVIDER = BindingNamespaces.createNamespace({ name: 'providers' });\n static readonly CONTROLLER = BindingNamespaces.createNamespace({ name: 'controllers' });\n\n static readonly CONFIGURATION = BindingNamespaces.createNamespace({ name: 'configurations' });\n\n /**\n * A namespace is the leading segment of a binding key, and a binding is tagged with that segment\n * alone - a name carrying '.' or whitespace yields a key no boot step can drain by tag.\n */\n static isValid(opts: { name: string }): boolean {\n const { name } = opts;\n\n return typeof name === 'string' && BindingNamespaces.NAME_PATTERN.test(name);\n }\n\n static createNamespace(opts: { name: string }) {\n const { name } = opts;\n\n if (!BindingNamespaces.isValid({ name })) {\n throw getError({\n message: `[BindingNamespaces][createNamespace] Invalid namespace | Expected a single non-empty segment without '.' or whitespace | Got: '${name}'`,\n });\n }\n\n return name;\n }\n\n /** A namespace-less key is untagged: no boot step drains it and `doVerify` never sees it. */\n static assertArtifactNamespace(opts: { namespace: string; artifact: string; caller: string }) {\n const { namespace, artifact, caller } = opts;\n\n if (BindingNamespaces.isValid({ name: namespace })) {\n return namespace;\n }\n\n throw getError({\n message: `[${caller}] '${artifact}' declares a binding with no usable namespace | namespace: '${namespace}' | A key with no leading namespace segment carries no tag, so no boot step drains it and 'bootChecks.binding.doVerify' never sees it`,\n });\n }\n}\n\n/** Artifact kind -> namespace. `registerArtifact` gets its namespace from the call site; `@injectable` has only the class. */\nexport class ArtifactNamespaces {\n private static readonly BY_TYPE: Record<string, TBindingNamespace> = {\n [ArtifactTypes.CONFIGURATION]: BindingNamespaces.CONFIGURATION,\n [ArtifactTypes.COMPONENT]: BindingNamespaces.COMPONENT,\n [ArtifactTypes.CONTROLLER]: BindingNamespaces.CONTROLLER,\n [ArtifactTypes.SERVICE]: BindingNamespaces.SERVICE,\n [ArtifactTypes.REPOSITORY]: BindingNamespaces.REPOSITORY,\n [ArtifactTypes.DATASOURCE]: BindingNamespaces.DATASOURCE,\n [ArtifactTypes.MODEL]: BindingNamespaces.MODEL,\n };\n\n static resolve(opts: { type: string }): TBindingNamespace {\n const namespace = ArtifactNamespaces.BY_TYPE[opts.type];\n\n if (namespace === undefined) {\n throw getError({\n message: `[ArtifactNamespaces][resolve] No namespace for artifact type | type: '${opts.type}' | known: ${Object.keys(ArtifactNamespaces.BY_TYPE).join(', ')}`,\n });\n }\n\n return namespace;\n }\n}\n\n/** Core binding keys for fundamental application components and configuration. */\nexport class CoreBindings extends BindingKeys {\n static readonly APPLICATION_INSTANCE = BindingKeys.build<unknown>({\n key: '@app/instance',\n });\n\n static readonly APPLICATION_SERVER = BindingKeys.build<unknown>({\n key: '@app/server',\n });\n\n static readonly APPLICATION_CONFIG = BindingKeys.build<unknown>({\n key: '@app/config',\n });\n\n static readonly APPLICATION_PROJECT_ROOT = BindingKeys.build<string>({\n key: '@app/project_root',\n });\n\n static readonly APPLICATION_ROOT_ROUTER = BindingKeys.build<unknown>({\n key: '@app/router/root',\n });\n\n static readonly APPLICATION_ENVIRONMENTS = BindingKeys.build<unknown>({\n key: '@app/environments',\n });\n\n static readonly APPLICATION_MIDDLEWARE_OPTIONS = BindingKeys.build<unknown>({\n key: '@app/middleware_options',\n });\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TClass, TConstValue, ValueOrPromise } from '@venizia/ignis-helpers/common';
|
|
2
|
-
import type { TBindingScope } from '@venizia/ignis-inversion';
|
|
2
|
+
import type { TBindingKey, TBindingScope } from '@venizia/ignis-inversion';
|
|
3
3
|
import { type ArtifactTypes } from '../constants.js';
|
|
4
4
|
/** Decorator target for any constructable class (includes Function for ClassDecorator). */
|
|
5
5
|
export type TDecoratorTarget<T = unknown> = TClass<T> | Function;
|
|
@@ -34,7 +34,7 @@ export interface IArtifactMetadata<ApplicationType = unknown> extends IArtifactR
|
|
|
34
34
|
/** One `@provide` method: the key it binds, and the binding scope of the value. */
|
|
35
35
|
export interface IProvideMetadata {
|
|
36
36
|
methodName: string | symbol;
|
|
37
|
-
key:
|
|
37
|
+
key: TBindingKey;
|
|
38
38
|
/** @default BindingScopes.SINGLETON */
|
|
39
39
|
scope?: TBindingScope;
|
|
40
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact.js","sourceRoot":"","sources":["../../../../../../src/helpers/inversion/common/types/artifact.ts"],"names":[],"mappings":"","sourcesContent":["import type { TClass, TConstValue, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { TBindingScope } from '@venizia/ignis-inversion';\nimport { type ArtifactTypes } from '../constants';\n\n/** Decorator target for any constructable class (includes Function for ClassDecorator). */\nexport type TDecoratorTarget<T = unknown> = TClass<T> | Function;\n\n/** Valid `ArtifactTypes` values. */\nexport type TArtifactType = TConstValue<typeof ArtifactTypes>;\n\n/** Decides at registration time whether the class is registered at all. Sync or async; runs before `preConfigure`, so it may read config and env, never another artifact's binding. */\nexport type TArtifactCondition<ApplicationType = unknown> = (opts: {\n application: ApplicationType;\n}) => ValueOrPromise<boolean>;\n\n/** Registration defaults a class carries for itself; an explicit `TMixinOpts` at the call site still wins. */\nexport interface IArtifactRegistrationOptions<ApplicationType = unknown> {\n binding?: { namespace: string; key: string };\n allowOverride?: boolean;\n scope?: TBindingScope;\n /**\n * Lower registers first within its kind; ties keep index order.\n *\n * @default 0\n */\n order?: number;\n when?: TArtifactCondition<ApplicationType>;\n /** Topological ordering for configurations: must run after these configuration classes. */\n after?: ReadonlyArray<TClass<unknown>>;\n}\n\n/** Registration options of an artifact plus its `type`. */\nexport interface IArtifactMetadata<\n ApplicationType = unknown,\n> extends IArtifactRegistrationOptions<ApplicationType> {\n type: TArtifactType;\n}\n\n/** One `@provide` method: the key it binds, and the binding scope of the value. */\nexport interface IProvideMetadata {\n methodName: string | symbol;\n key:
|
|
1
|
+
{"version":3,"file":"artifact.js","sourceRoot":"","sources":["../../../../../../src/helpers/inversion/common/types/artifact.ts"],"names":[],"mappings":"","sourcesContent":["import type { TClass, TConstValue, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { TBindingKey, TBindingScope } from '@venizia/ignis-inversion';\nimport { type ArtifactTypes } from '../constants';\n\n/** Decorator target for any constructable class (includes Function for ClassDecorator). */\nexport type TDecoratorTarget<T = unknown> = TClass<T> | Function;\n\n/** Valid `ArtifactTypes` values. */\nexport type TArtifactType = TConstValue<typeof ArtifactTypes>;\n\n/** Decides at registration time whether the class is registered at all. Sync or async; runs before `preConfigure`, so it may read config and env, never another artifact's binding. */\nexport type TArtifactCondition<ApplicationType = unknown> = (opts: {\n application: ApplicationType;\n}) => ValueOrPromise<boolean>;\n\n/** Registration defaults a class carries for itself; an explicit `TMixinOpts` at the call site still wins. */\nexport interface IArtifactRegistrationOptions<ApplicationType = unknown> {\n binding?: { namespace: string; key: string };\n allowOverride?: boolean;\n scope?: TBindingScope;\n /**\n * Lower registers first within its kind; ties keep index order.\n *\n * @default 0\n */\n order?: number;\n when?: TArtifactCondition<ApplicationType>;\n /** Topological ordering for configurations: must run after these configuration classes. */\n after?: ReadonlyArray<TClass<unknown>>;\n}\n\n/** Registration options of an artifact plus its `type`. */\nexport interface IArtifactMetadata<\n ApplicationType = unknown,\n> extends IArtifactRegistrationOptions<ApplicationType> {\n type: TArtifactType;\n}\n\n/** One `@provide` method: the key it binds, and the binding scope of the value. */\nexport interface IProvideMetadata {\n methodName: string | symbol;\n key: TBindingKey;\n\n /** @default BindingScopes.SINGLETON */\n scope?: TBindingScope;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Binding, BindingKeys, BindingScopes, BindingValueTypes, isClass, isClassProvider, ResolverUtility, type IProvider, type TBindingKey, type TBindingScope, type TBindingValueType, type IBindingTag, type TInjectTarget, } from '@venizia/ignis-inversion';
|
|
1
|
+
export { Binding, BindingKeys, BindingScopes, BindingValueTypes, isClass, isClassProvider, ResolverUtility, type IProvider, type TBindingKey, type TBindingKeyValue, type TBindingScope, type TBindingValueType, type IBindingTag, type TInjectTarget, } from '@venizia/ignis-inversion';
|
|
2
2
|
export * from './common/index.js';
|
|
3
3
|
export * from './container.js';
|
|
4
4
|
export * from './registry.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/helpers/inversion/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EACL,OAAO,EACP,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,eAAe,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/helpers/inversion/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EACL,OAAO,EACP,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,eAAe,GAQhB,MAAM,0BAA0B,CAAC;AAElC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC","sourcesContent":["// DI-specific symbols only available in inversion (not in helpers)\nexport {\n Binding,\n BindingKeys,\n BindingScopes,\n BindingValueTypes,\n isClass,\n isClassProvider,\n ResolverUtility,\n type IProvider,\n type TBindingKey,\n type TBindingKeyValue,\n type TBindingScope,\n type TBindingValueType,\n type IBindingTag,\n type TInjectTarget,\n} from '@venizia/ignis-inversion';\n\nexport * from './common';\nexport * from './container';\nexport * from './registry';\n"]}
|
|
@@ -28,24 +28,24 @@ export declare const ArtifactMetadataMixin: <BaseClass extends TMixinTarget<_Met
|
|
|
28
28
|
}): IProvideMetadata[];
|
|
29
29
|
define: <Target extends object = object, Value = unknown>(opts: {
|
|
30
30
|
target: Target;
|
|
31
|
-
key: import("@venizia/ignis-inversion").
|
|
31
|
+
key: import("@venizia/ignis-inversion").TMetadataKey;
|
|
32
32
|
value: Value;
|
|
33
33
|
}) => void;
|
|
34
34
|
get: <Target extends object = object, Value_1 = unknown>(opts: {
|
|
35
35
|
target: Target;
|
|
36
|
-
key: import("@venizia/ignis-inversion").
|
|
36
|
+
key: import("@venizia/ignis-inversion").TMetadataKey;
|
|
37
37
|
}) => Value_1 | undefined;
|
|
38
38
|
has: <Target extends object = object>(opts: {
|
|
39
39
|
target: Target;
|
|
40
|
-
key: import("@venizia/ignis-inversion").
|
|
40
|
+
key: import("@venizia/ignis-inversion").TMetadataKey;
|
|
41
41
|
}) => boolean;
|
|
42
42
|
delete: <Target extends object = object>(opts: {
|
|
43
43
|
target: Target;
|
|
44
|
-
key: import("@venizia/ignis-inversion").
|
|
44
|
+
key: import("@venizia/ignis-inversion").TMetadataKey;
|
|
45
45
|
}) => boolean;
|
|
46
46
|
getKeys: <Target extends object = object>(opts: {
|
|
47
47
|
target: Target;
|
|
48
|
-
}) => import("@venizia/ignis-inversion").
|
|
48
|
+
}) => import("@venizia/ignis-inversion").TMetadataKey[];
|
|
49
49
|
getMethodNames: <T = unknown>(opts: {
|
|
50
50
|
target: import("@venizia/ignis-inversion").TClass<T>;
|
|
51
51
|
}) => string[];
|
|
@@ -19,24 +19,24 @@ export declare const ControllerMetadataMixin: <BaseClass extends TMixinTarget<_M
|
|
|
19
19
|
}): IGrpcControllerMetadata | undefined;
|
|
20
20
|
define: <Target extends object = object, Value = unknown>(opts: {
|
|
21
21
|
target: Target;
|
|
22
|
-
key: import("@venizia/ignis-inversion").
|
|
22
|
+
key: import("@venizia/ignis-inversion").TMetadataKey;
|
|
23
23
|
value: Value;
|
|
24
24
|
}) => void;
|
|
25
25
|
get: <Target extends object = object, Value_1 = unknown>(opts: {
|
|
26
26
|
target: Target;
|
|
27
|
-
key: import("@venizia/ignis-inversion").
|
|
27
|
+
key: import("@venizia/ignis-inversion").TMetadataKey;
|
|
28
28
|
}) => Value_1 | undefined;
|
|
29
29
|
has: <Target extends object = object>(opts: {
|
|
30
30
|
target: Target;
|
|
31
|
-
key: import("@venizia/ignis-inversion").
|
|
31
|
+
key: import("@venizia/ignis-inversion").TMetadataKey;
|
|
32
32
|
}) => boolean;
|
|
33
33
|
delete: <Target extends object = object>(opts: {
|
|
34
34
|
target: Target;
|
|
35
|
-
key: import("@venizia/ignis-inversion").
|
|
35
|
+
key: import("@venizia/ignis-inversion").TMetadataKey;
|
|
36
36
|
}) => boolean;
|
|
37
37
|
getKeys: <Target extends object = object>(opts: {
|
|
38
38
|
target: Target;
|
|
39
|
-
}) => import("@venizia/ignis-inversion").
|
|
39
|
+
}) => import("@venizia/ignis-inversion").TMetadataKey[];
|
|
40
40
|
getMethodNames: <T = unknown>(opts: {
|
|
41
41
|
target: import("@venizia/ignis-inversion").TClass<T>;
|
|
42
42
|
}) => string[];
|