@forinda/kickjs 4.0.0 → 4.2.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/README.md +14 -1
- package/dist/{adapter-BNw2pGbg.d.mts → adapter-6Pp4kFdM.d.mts} +47 -12
- package/dist/adapter-6Pp4kFdM.d.mts.map +1 -0
- package/dist/{app-module-CO0ksPCm.d.mts → app-module-Blgz4Rti.d.mts} +3 -3
- package/dist/app-module-Blgz4Rti.d.mts.map +1 -0
- package/dist/{application-Ce4DQN6m.mjs → application-Biij-nW3.mjs} +6 -6
- package/dist/application-Biij-nW3.mjs.map +1 -0
- package/dist/{application-Czwm7Gty.d.mts → application-CHvMXqbO.d.mts} +32 -6
- package/dist/application-CHvMXqbO.d.mts.map +1 -0
- package/dist/{bootstrap-NxFRaNTh.d.mts → bootstrap-C6GpMEpX.d.mts} +2 -2
- package/dist/{bootstrap-NxFRaNTh.d.mts.map → bootstrap-C6GpMEpX.d.mts.map} +1 -1
- package/dist/{bootstrap-CB7bJeJG.mjs → bootstrap-dBvDIX5s.mjs} +16 -13
- package/dist/{bootstrap-CB7bJeJG.mjs.map → bootstrap-dBvDIX5s.mjs.map} +1 -1
- package/dist/{cache-BStrqXSZ.d.mts → cache-XrNWj1KQ.d.mts} +2 -2
- package/dist/{cache-BStrqXSZ.d.mts.map → cache-XrNWj1KQ.d.mts.map} +1 -1
- package/dist/config/index.mjs +3 -3
- package/dist/{config-wZ_TgBfs.mjs → config-Cc4gFfYi.mjs} +3 -3
- package/dist/{config-wZ_TgBfs.mjs.map → config-Cc4gFfYi.mjs.map} +1 -1
- package/dist/{container-DYYSu58w.mjs → container-DsIzeXq2.mjs} +4 -3
- package/dist/container-DsIzeXq2.mjs.map +1 -0
- package/dist/{context-BAGzqT7-.mjs → context-DUUn4-S-.mjs} +33 -4
- package/dist/context-DUUn4-S-.mjs.map +1 -0
- package/dist/{context-decorator-B5v3VQCN.d.mts → context-decorator-DrPvQ9Ag.d.mts} +60 -10
- package/dist/context-decorator-DrPvQ9Ag.d.mts.map +1 -0
- package/dist/core/adapter.d.mts +1 -1
- package/dist/core/adapter.mjs +1 -1
- package/dist/core/app-module.d.mts +1 -1
- package/dist/core/app-module.mjs +1 -1
- package/dist/core/cache.d.mts +1 -1
- package/dist/core/cache.mjs +2 -2
- package/dist/core/cache.mjs.map +1 -1
- package/dist/core/container.mjs +2 -2
- package/dist/core/cron.d.mts +1 -1
- package/dist/core/cron.mjs +3 -3
- package/dist/core/cron.mjs.map +1 -1
- package/dist/core/decorators.mjs +3 -3
- package/dist/core/errors.mjs +1 -1
- package/dist/core/interfaces.mjs +1 -1
- package/dist/core/logger.mjs +1 -1
- package/dist/core/path.mjs +1 -1
- package/dist/core/plugin.d.mts +1 -1
- package/dist/core/plugin.mjs +1 -1
- package/dist/core/reactivity.mjs +1 -1
- package/dist/{core-DBcoqPHM.mjs → core-1aWIOsnH.mjs} +34 -11
- package/dist/core-1aWIOsnH.mjs.map +1 -0
- package/dist/{cron-7zqvsmMI.d.mts → cron-GNoYydfg.d.mts} +2 -2
- package/dist/cron-GNoYydfg.d.mts.map +1 -0
- package/dist/decorators-BMvaLliz.d.mts.map +1 -1
- package/dist/{env-CdH5-dM_.mjs → env-BLLlccEv.mjs} +3 -3
- package/dist/{env-CdH5-dM_.mjs.map → env-BLLlccEv.mjs.map} +1 -1
- package/dist/http/application.d.mts +1 -1
- package/dist/http/application.mjs +2 -2
- package/dist/http/bootstrap.d.mts +1 -1
- package/dist/http/bootstrap.mjs +2 -2
- package/dist/http/context.mjs +2 -2
- package/dist/http/middleware/cors.mjs +1 -1
- package/dist/http/middleware/csrf.mjs +1 -1
- package/dist/http/middleware/error-handler.mjs +2 -2
- package/dist/http/middleware/helmet.mjs +1 -1
- package/dist/http/middleware/rate-limit.mjs +1 -1
- package/dist/http/middleware/request-id.mjs +1 -1
- package/dist/http/middleware/request-logger.mjs +2 -2
- package/dist/http/middleware/session.mjs +1 -1
- package/dist/http/middleware/spa.d.mts +1 -1
- package/dist/http/middleware/spa.mjs +3 -3
- package/dist/http/middleware/upload.mjs +1 -1
- package/dist/http/middleware/validate.mjs +2 -2
- package/dist/http/middleware/views.d.mts +1 -1
- package/dist/http/middleware/views.mjs +2 -2
- package/dist/http/query/index.mjs +2 -2
- package/dist/http/router-builder.d.mts +1 -1
- package/dist/http/router-builder.mjs +5 -5
- package/dist/{index-DQyWtyp0.d.mts → index-Yhs9sTMW.d.mts} +4 -4
- package/dist/{index-DQyWtyp0.d.mts.map → index-Yhs9sTMW.d.mts.map} +1 -1
- package/dist/index.d.mts +13 -13
- package/dist/index.mjs +47 -11
- package/dist/index.mjs.map +1 -1
- package/dist/{metadata-VQM9wChy.mjs → metadata-BMS91Yvv.mjs} +2 -2
- package/dist/{metadata-VQM9wChy.mjs.map → metadata-BMS91Yvv.mjs.map} +1 -1
- package/dist/{plugin-WdrDgNzk.d.mts → plugin-DDjoN4XI.d.mts} +5 -5
- package/dist/plugin-DDjoN4XI.d.mts.map +1 -0
- package/dist/{query-DJMxdx5r.mjs → query-DZvCV3Pv.mjs} +2 -2
- package/dist/{query-DJMxdx5r.mjs.map → query-DZvCV3Pv.mjs.map} +1 -1
- package/dist/{router-builder-C799BAf0.d.mts → router-builder-zsX4Oq7c.d.mts} +2 -2
- package/dist/{router-builder-C799BAf0.d.mts.map → router-builder-zsX4Oq7c.d.mts.map} +1 -1
- package/dist/{spa-CrFR2_cz.d.mts → spa-CwIbdvPc.d.mts} +2 -2
- package/dist/{spa-CrFR2_cz.d.mts.map → spa-CwIbdvPc.d.mts.map} +1 -1
- package/dist/{views-DhQSXV2P.d.mts → views-DhuvHYPA.d.mts} +44 -3
- package/dist/views-DhuvHYPA.d.mts.map +1 -0
- package/package.json +1 -1
- package/dist/adapter-BNw2pGbg.d.mts.map +0 -1
- package/dist/app-module-CO0ksPCm.d.mts.map +0 -1
- package/dist/application-Ce4DQN6m.mjs.map +0 -1
- package/dist/application-Czwm7Gty.d.mts.map +0 -1
- package/dist/container-DYYSu58w.mjs.map +0 -1
- package/dist/context-BAGzqT7-.mjs.map +0 -1
- package/dist/context-decorator-B5v3VQCN.d.mts.map +0 -1
- package/dist/core-DBcoqPHM.mjs.map +0 -1
- package/dist/cron-7zqvsmMI.d.mts.map +0 -1
- package/dist/plugin-WdrDgNzk.d.mts.map +0 -1
- package/dist/views-DhQSXV2P.d.mts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v4.
|
|
2
|
+
* @forinda/kickjs v4.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { a as parseSearchQuery, i as parseQuery, n as parseFilters, o as parseSort, r as parsePagination, s as FILTER_OPERATORS, t as buildQueryParams } from "../../query-
|
|
11
|
+
import { a as parseSearchQuery, i as parseQuery, n as parseFilters, o as parseSort, r as parsePagination, s as FILTER_OPERATORS, t as buildQueryParams } from "../../query-DZvCV3Pv.mjs";
|
|
12
12
|
export { FILTER_OPERATORS, buildQueryParams, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { n as _setExternalContributorSources, r as buildRoutes, t as BuildRoutesOptions } from "../router-builder-
|
|
2
|
+
import { n as _setExternalContributorSources, r as buildRoutes, t as BuildRoutesOptions } from "../router-builder-zsX4Oq7c.mjs";
|
|
3
3
|
export { BuildRoutesOptions, _setExternalContributorSources, buildRoutes };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v4.
|
|
2
|
+
* @forinda/kickjs v4.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { t as Container } from "../container-
|
|
11
|
+
import { t as Container } from "../container-DsIzeXq2.mjs";
|
|
12
12
|
import { METADATA } from "../core/interfaces.mjs";
|
|
13
|
-
import { a as getMethodMeta, o as getMethodMetaOrUndefined, t as getClassMeta } from "../metadata-
|
|
14
|
-
import { c as runContributors, l as buildPipeline } from "../core-
|
|
15
|
-
import { t as RequestContext } from "../context-
|
|
13
|
+
import { a as getMethodMeta, o as getMethodMetaOrUndefined, t as getClassMeta } from "../metadata-BMS91Yvv.mjs";
|
|
14
|
+
import { c as runContributors, l as buildPipeline } from "../core-1aWIOsnH.mjs";
|
|
15
|
+
import { t as RequestContext } from "../context-DUUn4-S-.mjs";
|
|
16
16
|
import { validate } from "./middleware/validate.mjs";
|
|
17
17
|
import { buildUploadMiddleware } from "./middleware/upload.mjs";
|
|
18
18
|
import { Router } from "express";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import { s as InjectionToken, t as Container } from "./container-CnWDsxi-.mjs";
|
|
3
3
|
import { n as ExecutionContext } from "./execution-context-DKnt61pY.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { r as AppAdapter } from "./adapter-
|
|
6
|
-
import { t as KickPlugin } from "./plugin-
|
|
4
|
+
import { a as ContributorRegistration } from "./context-decorator-DrPvQ9Ag.mjs";
|
|
5
|
+
import { r as AppAdapter } from "./adapter-6Pp4kFdM.mjs";
|
|
6
|
+
import { t as KickPlugin } from "./plugin-DDjoN4XI.mjs";
|
|
7
7
|
//#region src/core/metadata.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Typed utilities for reflect-metadata operations.
|
|
@@ -508,4 +508,4 @@ interface AdapterFactory<TConfig, TExtra = unknown> {
|
|
|
508
508
|
declare function defineAdapter<TConfig = Record<string, unknown>, TExtra = unknown>(options: DefineAdapterOptions<TConfig, TExtra>): AdapterFactory<TConfig, TExtra>;
|
|
509
509
|
//#endregion
|
|
510
510
|
export { CircuitOpenError as A, setClassMeta as B, ContributorCycleError as C, CircuitBreakerOptions as D, CircuitBreaker as E, getMethodMeta as F, setInMetaRecord as H, getMethodMetaOrUndefined as I, hasClassMeta as L, getClassMetaOrUndefined as M, getMetaMap as N, CircuitBreakerState as O, getMetaRecord as P, pushClassMeta as R, buildPipeline as S, MissingContributorError as T, setMethodMeta as U, setInMetaMap as V, runContributors as _, BuildContext as a, ContributorSource as b, PluginFactory as c, MissingMountDepError as d, MountCycleError as f, RunContributorsOptions as g, mountSort as h, defineAdapter as i, getClassMeta as j, CircuitBreakerStats as k, definePlugin as l, MountSortItem as m, AdapterFactory as n, DefinePluginOptions as o, MountKind as p, DefineAdapterOptions as r, PluginAsyncOptions as s, AdapterAsyncOptions as t, DuplicateMountNameError as u, BuildPipelineOptions as v, DuplicateContributorError as w, SourcedRegistration as x, ContributorPipeline as y, pushMethodMeta as z };
|
|
511
|
-
//# sourceMappingURL=index-
|
|
511
|
+
//# sourceMappingURL=index-Yhs9sTMW.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-Yhs9sTMW.d.mts","names":[],"sources":["../src/core/metadata.ts","../src/core/circuit-breaker.ts","../src/core/context-errors.ts","../src/core/contributor-pipeline.ts","../src/core/contributor-runner.ts","../src/core/mount-sort.ts","../src/core/define-plugin.ts","../src/core/define-adapter.ts"],"mappings":";;;;;;;;;;;;;;;;;;KAeK,OAAA,qBAA4B,cAAA;;iBAKjB,YAAA,GAAA,CAAgB,GAAA,EAAK,OAAA,EAAS,KAAA,EAAO,CAAA,EAAG,MAAA;;iBAKxC,aAAA,GAAA,CAAiB,GAAA,EAAK,OAAA,EAAS,KAAA,EAAO,CAAA,EAAG,MAAA,UAAgB,MAAA;AALzE;AAAA,iBAYgB,YAAA,GAAA,CAAgB,GAAA,EAAK,OAAA,EAAS,MAAA,UAAgB,QAAA,EAAU,CAAA,GAAI,CAAA;;i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,EAAS,MAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -4,19 +4,19 @@ import { a as tokenName, c as createToken, i as KickJsRegistry, l as isInjection
|
|
|
4
4
|
import { A as normalizeApiQueryParamsConfig, C as Post, D as RouteDefinition, E as Repository, F as assets, I as clearAssetCache, L as resolveAsset, M as ASSET_MANIFEST_VERSION, N as KickAssets, O as Service, P as UnknownAssetError, R as useAssets, S as Patch, T as Put, _ as Get, a as Autowired, b as Middleware, c as ColumnApiQueryParamsConfig, d as Delete, f as Env, g as FileUploadConfig, h as FileUpload, i as AssetKey, j as ASSETS, k as Value, l as Component, m as FileTypeFilter, n as ApiQueryParamsConfig, o as BaseUploadOptions, p as EnvKey, r as Asset, s as Builder, t as ApiQueryParams, u as Controller, v as Inject, w as PostConstruct, x as MiddlewareHandler, y as Injectable } from "./decorators-BMvaLliz.mjs";
|
|
5
5
|
import { a as baseEnvSchema, c as loadEnv, l as reloadEnv, n as TypedConfigService, o as defineEnv, r as createConfigService, s as getEnv, t as ConfigService, u as resetEnvCache } from "./index-D-qhXg9M.mjs";
|
|
6
6
|
import { n as ExecutionContext, r as MetaValue, t as ContextMeta } from "./execution-context-DKnt61pY.mjs";
|
|
7
|
-
import { a as
|
|
8
|
-
import { a as MiddlewarePhase, c as KickJsPluginRegistry, i as AppAdapterClass, l as defineAugmentation, n as AdapterMiddleware, o as AugmentationMeta, r as AppAdapter, s as KickJsPluginName, t as AdapterContext } from "./adapter-
|
|
9
|
-
import { n as AppModuleClass, r as ModuleRoutes, t as AppModule } from "./app-module-
|
|
10
|
-
import { a as Cacheable, c as setCacheProvider, i as CacheProvider, n as CacheEvict, o as MemoryCacheProvider, r as CacheOptions, s as getCacheProvider } from "./cache-
|
|
11
|
-
import { i as getCronJobs, n as Cron, r as CronJobMeta, t as CRON_META } from "./cron-
|
|
7
|
+
import { a as ContributorRegistration, c as ResolvedDeps, i as ContextMetaKey, l as defineContextDecorator, n as ContextDecorator, o as ContributorRegistrations, r as ContextDecoratorSpec, s as DepValue, t as AnyContributorRegistration } from "./context-decorator-DrPvQ9Ag.mjs";
|
|
8
|
+
import { a as MiddlewarePhase, c as KickJsPluginRegistry, i as AppAdapterClass, l as defineAugmentation, n as AdapterMiddleware, o as AugmentationMeta, r as AppAdapter, s as KickJsPluginName, t as AdapterContext } from "./adapter-6Pp4kFdM.mjs";
|
|
9
|
+
import { n as AppModuleClass, r as ModuleRoutes, t as AppModule } from "./app-module-Blgz4Rti.mjs";
|
|
10
|
+
import { a as Cacheable, c as setCacheProvider, i as CacheProvider, n as CacheEvict, o as MemoryCacheProvider, r as CacheOptions, s as getCacheProvider } from "./cache-XrNWj1KQ.mjs";
|
|
11
|
+
import { i as getCronJobs, n as Cron, r as CronJobMeta, t as CRON_META } from "./cron-GNoYydfg.mjs";
|
|
12
12
|
import { i as ValidationError, n as HttpStatus, r as HttpStatusCode, t as HttpException } from "./errors-uaHCeXRz.mjs";
|
|
13
13
|
import { a as rootLogger, i as createLogger, n as Logger, r as LoggerProvider, t as ConsoleLoggerProvider } from "./logger-CLVRZf2N.mjs";
|
|
14
14
|
import { n as normalizePath, t as joinPaths } from "./path-Diviu6hv.mjs";
|
|
15
|
-
import { t as KickPlugin } from "./plugin-
|
|
15
|
+
import { t as KickPlugin } from "./plugin-DDjoN4XI.mjs";
|
|
16
16
|
import { a as isRef, c as toRefs, i as computed, l as unref, n as Ref, o as reactive, r as WatchOptions, s as ref, t as ComputedRef, u as watch } from "./reactivity-CfJceo4H.mjs";
|
|
17
|
-
import { A as CircuitOpenError, B as setClassMeta, C as ContributorCycleError, D as CircuitBreakerOptions, E as CircuitBreaker, F as getMethodMeta, H as setInMetaRecord, I as getMethodMetaOrUndefined, L as hasClassMeta, M as getClassMetaOrUndefined, N as getMetaMap, O as CircuitBreakerState, P as getMetaRecord, R as pushClassMeta, S as buildPipeline, T as MissingContributorError, U as setMethodMeta, V as setInMetaMap, _ as runContributors, a as BuildContext, b as ContributorSource, c as PluginFactory, d as MissingMountDepError, f as MountCycleError, g as RunContributorsOptions, h as mountSort, i as defineAdapter, j as getClassMeta, k as CircuitBreakerStats, l as definePlugin, m as MountSortItem, n as AdapterFactory, o as DefinePluginOptions, p as MountKind, r as DefineAdapterOptions, s as PluginAsyncOptions, t as AdapterAsyncOptions, u as DuplicateMountNameError, v as BuildPipelineOptions, w as DuplicateContributorError, x as SourcedRegistration, y as ContributorPipeline, z as pushMethodMeta } from "./index-
|
|
18
|
-
import { n as ApplicationOptions, r as MiddlewareEntry, t as Application } from "./application-
|
|
19
|
-
import { t as bootstrap } from "./bootstrap-
|
|
17
|
+
import { A as CircuitOpenError, B as setClassMeta, C as ContributorCycleError, D as CircuitBreakerOptions, E as CircuitBreaker, F as getMethodMeta, H as setInMetaRecord, I as getMethodMetaOrUndefined, L as hasClassMeta, M as getClassMetaOrUndefined, N as getMetaMap, O as CircuitBreakerState, P as getMetaRecord, R as pushClassMeta, S as buildPipeline, T as MissingContributorError, U as setMethodMeta, V as setInMetaMap, _ as runContributors, a as BuildContext, b as ContributorSource, c as PluginFactory, d as MissingMountDepError, f as MountCycleError, g as RunContributorsOptions, h as mountSort, i as defineAdapter, j as getClassMeta, k as CircuitBreakerStats, l as definePlugin, m as MountSortItem, n as AdapterFactory, o as DefinePluginOptions, p as MountKind, r as DefineAdapterOptions, s as PluginAsyncOptions, t as AdapterAsyncOptions, u as DuplicateMountNameError, v as BuildPipelineOptions, w as DuplicateContributorError, x as SourcedRegistration, y as ContributorPipeline, z as pushMethodMeta } from "./index-Yhs9sTMW.mjs";
|
|
18
|
+
import { n as ApplicationOptions, r as MiddlewareEntry, t as Application } from "./application-CHvMXqbO.mjs";
|
|
19
|
+
import { t as bootstrap } from "./bootstrap-C6GpMEpX.mjs";
|
|
20
20
|
import { _ as SortItem, a as parseSearchQuery, c as FILTER_OPERATORS, d as FilterOperator, f as PaginatedResponse, g as QueryFieldConfig, h as QueryBuilderAdapter, i as parseQuery, l as FieldsOf, m as ParsedQuery, n as parseFilters, o as parseSort, p as PaginationParams, r as parsePagination, t as buildQueryParams, u as FilterItem, y as TypedParsedQuery } from "./index-B9cyOQAe.mjs";
|
|
21
21
|
import { n as RequestContext, r as RouteShape, t as Ctx } from "./context-Ymvv-85x.mjs";
|
|
22
22
|
import { n as cors, t as CorsOptions } from "./cors-BfgqfLPd.mjs";
|
|
@@ -27,9 +27,9 @@ import { n as RateLimitStore, r as rateLimit, t as RateLimitOptions } from "./ra
|
|
|
27
27
|
import { n as requestId, t as REQUEST_ID_HEADER } from "./request-id-BgglvZHN.mjs";
|
|
28
28
|
import { n as requestLogger, t as RequestLoggerOptions } from "./request-logger-CWHbAzTE.mjs";
|
|
29
29
|
import { a as session, i as SessionStore, n as SessionData, r as SessionOptions, t as Session } from "./session-N0hActOO.mjs";
|
|
30
|
-
import { n as SpaAdapterOptions, t as SpaAdapter } from "./spa-
|
|
30
|
+
import { n as SpaAdapterOptions, t as SpaAdapter } from "./spa-CwIbdvPc.mjs";
|
|
31
31
|
import { a as upload, i as resolveMimeTypes, n as buildUploadMiddleware, r as cleanupFiles, t as UploadOptions } from "./upload-BueOnnLw.mjs";
|
|
32
32
|
import { n as validate } from "./validate-HwAyWTwH.mjs";
|
|
33
|
-
import { a as TraceContextOptions, c as requestScopeMiddleware, d as
|
|
34
|
-
import { r as buildRoutes } from "./router-builder-
|
|
35
|
-
export { ASSETS, ASSET_MANIFEST_VERSION, AdapterAsyncOptions, AdapterContext, AdapterFactory, AdapterMiddleware, ApiQueryParams, ApiQueryParamsConfig, ApiQueryParamsConfig as QueryParamsConfig, AppAdapter, AppAdapterClass, AppModule, AppModuleClass, Application, ApplicationOptions, Asset, AssetKey, AugmentationMeta, Autowired, BaseUploadOptions, BuildContext, BuildPipelineOptions, Buildable, Builder, BuilderOf, CRON_META, CacheEvict, CacheOptions, CacheProvider, Cacheable, CircuitBreaker, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStats, CircuitOpenError, ClassKind, ClusterOptions, ColumnApiQueryParamsConfig, Component, ComputedRef, ConfigService, ConsoleLoggerProvider, Constructor, Container, ContainerChangeEvent, ContainerChangeListener, ContextDecorator, ContextDecoratorSpec, ContextMeta, ContributorCycleError, ContributorPipeline, ContributorRegistration, ContributorSource, Controller, CorsOptions, Cron, CronJobMeta, CsrfOptions, Ctx, DefineAdapterOptions, DefinePluginOptions, Delete, DuplicateContributorError, DuplicateMountNameError, Env, EnvKey, ExecutionContext, FILTER_OPERATORS, FieldsOf, FileTypeFilter, FileUpload, FileUploadConfig, FilterItem, FilterOperator, Get, HelmetOptions, HttpException, HttpStatus, HttpStatusCode, INJECTION_TOKEN, Inject, Injectable, InjectionToken, KickAssets, KickJsPluginName, KickJsPluginRegistry, KickJsRegistry, KickPlugin, Logger, LoggerProvider, METADATA, MaybePromise, MemoryCacheProvider, MetaValue, Middleware, MiddlewareEntry, MiddlewareHandler, MiddlewarePhase, MissingContributorError, MissingMountDepError, ModuleRoutes, MountCycleError, MountKind, MountSortItem, PaginatedResponse, PaginationParams, ParsedQuery, Patch, PluginAsyncOptions, PluginFactory, Post, PostConstruct, PostConstructStatus, Put, QueryBuilderAdapter, QueryFieldConfig, REQUEST_ID_HEADER, RateLimitOptions, RateLimitStore, Ref, Repository, RequestContext, RequestLoggerOptions, RequestStore, ResolvedDeps, RouteDefinition, RouteShape, RunContributorsOptions, Scope, Service, ServiceOptions, Session, SessionData, SessionOptions, SessionStore, SortItem, SourcedRegistration, SpaAdapter, SpaAdapterOptions, TRACEPARENT_HEADER, TraceContext, TraceContextOptions, TypedConfigService, TypedParsedQuery, UnknownAssetError, UploadOptions, ValidationError, Value, ViewAdapter, ViewAdapterOptions, WatchOptions, assets, baseEnvSchema, bootstrap, buildPipeline, buildQueryParams, buildRoutes, buildUploadMiddleware, cleanupFiles, clearAssetCache, computed, cors, createConfigService, createLogger, createToken, csrf, defineAdapter, defineAugmentation, defineContextDecorator, defineEnv, definePlugin, errorHandler, getCacheProvider, getClassMeta, getClassMetaOrUndefined, getCronJobs, getEnv, getMetaMap, getMetaRecord, getMethodMeta, getMethodMetaOrUndefined, getRequestStore, hasClassMeta, helmet, isClusterPrimary, isInjectionToken, isRef, joinPaths, loadEnv, mountSort, normalizeApiQueryParamsConfig, normalizePath, notFoundHandler, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort, parseTraceparent, pushClassMeta, pushMethodMeta, rateLimit, reactive, ref, reloadEnv, requestId, requestLogger, requestScopeMiddleware, requestStore, resetEnvCache, resolveAsset, resolveMimeTypes, rootLogger, runContributors, session, setCacheProvider, setClassMeta, setInMetaMap, setInMetaRecord, setMethodMeta, toRefs, tokenName, traceContext, unref, upload, useAssets, validate, watch };
|
|
33
|
+
import { a as TraceContextOptions, c as requestScopeMiddleware, d as getRequestValue, f as requestStore, h as isClusterPrimary, i as TraceContext, l as RequestStore, m as ClusterOptions, n as ViewAdapterOptions, o as parseTraceparent, p as defineHttpContextDecorator, r as TRACEPARENT_HEADER, s as traceContext, t as ViewAdapter, u as getRequestStore } from "./views-DhuvHYPA.mjs";
|
|
34
|
+
import { r as buildRoutes } from "./router-builder-zsX4Oq7c.mjs";
|
|
35
|
+
export { ASSETS, ASSET_MANIFEST_VERSION, AdapterAsyncOptions, AdapterContext, AdapterFactory, AdapterMiddleware, AnyContributorRegistration, ApiQueryParams, ApiQueryParamsConfig, ApiQueryParamsConfig as QueryParamsConfig, AppAdapter, AppAdapterClass, AppModule, AppModuleClass, Application, ApplicationOptions, Asset, AssetKey, AugmentationMeta, Autowired, BaseUploadOptions, BuildContext, BuildPipelineOptions, Buildable, Builder, BuilderOf, CRON_META, CacheEvict, CacheOptions, CacheProvider, Cacheable, CircuitBreaker, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStats, CircuitOpenError, ClassKind, ClusterOptions, ColumnApiQueryParamsConfig, Component, ComputedRef, ConfigService, ConsoleLoggerProvider, Constructor, Container, ContainerChangeEvent, ContainerChangeListener, ContextDecorator, ContextDecoratorSpec, ContextMeta, ContextMetaKey, ContributorCycleError, ContributorPipeline, ContributorRegistration, ContributorRegistrations, ContributorSource, Controller, CorsOptions, Cron, CronJobMeta, CsrfOptions, Ctx, DefineAdapterOptions, DefinePluginOptions, Delete, DepValue, DuplicateContributorError, DuplicateMountNameError, Env, EnvKey, ExecutionContext, FILTER_OPERATORS, FieldsOf, FileTypeFilter, FileUpload, FileUploadConfig, FilterItem, FilterOperator, Get, HelmetOptions, HttpException, HttpStatus, HttpStatusCode, INJECTION_TOKEN, Inject, Injectable, InjectionToken, KickAssets, KickJsPluginName, KickJsPluginRegistry, KickJsRegistry, KickPlugin, Logger, LoggerProvider, METADATA, MaybePromise, MemoryCacheProvider, MetaValue, Middleware, MiddlewareEntry, MiddlewareHandler, MiddlewarePhase, MissingContributorError, MissingMountDepError, ModuleRoutes, MountCycleError, MountKind, MountSortItem, PaginatedResponse, PaginationParams, ParsedQuery, Patch, PluginAsyncOptions, PluginFactory, Post, PostConstruct, PostConstructStatus, Put, QueryBuilderAdapter, QueryFieldConfig, REQUEST_ID_HEADER, RateLimitOptions, RateLimitStore, Ref, Repository, RequestContext, RequestLoggerOptions, RequestStore, ResolvedDeps, RouteDefinition, RouteShape, RunContributorsOptions, Scope, Service, ServiceOptions, Session, SessionData, SessionOptions, SessionStore, SortItem, SourcedRegistration, SpaAdapter, SpaAdapterOptions, TRACEPARENT_HEADER, TraceContext, TraceContextOptions, TypedConfigService, TypedParsedQuery, UnknownAssetError, UploadOptions, ValidationError, Value, ViewAdapter, ViewAdapterOptions, WatchOptions, assets, baseEnvSchema, bootstrap, buildPipeline, buildQueryParams, buildRoutes, buildUploadMiddleware, cleanupFiles, clearAssetCache, computed, cors, createConfigService, createLogger, createToken, csrf, defineAdapter, defineAugmentation, defineContextDecorator, defineEnv, defineHttpContextDecorator, definePlugin, errorHandler, getCacheProvider, getClassMeta, getClassMetaOrUndefined, getCronJobs, getEnv, getMetaMap, getMetaRecord, getMethodMeta, getMethodMetaOrUndefined, getRequestStore, getRequestValue, hasClassMeta, helmet, isClusterPrimary, isInjectionToken, isRef, joinPaths, loadEnv, mountSort, normalizeApiQueryParamsConfig, normalizePath, notFoundHandler, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort, parseTraceparent, pushClassMeta, pushMethodMeta, rateLimit, reactive, ref, reloadEnv, requestId, requestLogger, requestScopeMiddleware, requestStore, resetEnvCache, resolveAsset, resolveMimeTypes, rootLogger, runContributors, session, setCacheProvider, setClassMeta, setInMetaMap, setInMetaRecord, setMethodMeta, toRefs, tokenName, traceContext, unref, upload, useAssets, validate, watch };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v4.
|
|
2
|
+
* @forinda/kickjs v4.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,27 +8,27 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { a as UnknownAssetError, c as resolveAsset, d as createToken, f as isInjectionToken, i as ASSET_MANIFEST_VERSION, l as useAssets, n as tokenName, o as assets, r as ASSETS, s as clearAssetCache, t as Container, u as INJECTION_TOKEN } from "./container-
|
|
11
|
+
import { a as UnknownAssetError, c as resolveAsset, d as createToken, f as isInjectionToken, i as ASSET_MANIFEST_VERSION, l as useAssets, n as tokenName, o as assets, r as ASSETS, s as clearAssetCache, t as Container, u as INJECTION_TOKEN } from "./container-DsIzeXq2.mjs";
|
|
12
12
|
import { METADATA, Scope } from "./core/interfaces.mjs";
|
|
13
13
|
import { ConsoleLoggerProvider, Logger, createLogger, rootLogger } from "./core/logger.mjs";
|
|
14
|
-
import { a as getMethodMeta, c as pushClassMeta, d as setInMetaMap, f as setInMetaRecord, i as getMetaRecord, l as pushMethodMeta, n as getClassMetaOrUndefined, o as getMethodMetaOrUndefined, p as setMethodMeta, r as getMetaMap, s as hasClassMeta, t as getClassMeta, u as setClassMeta } from "./metadata-
|
|
14
|
+
import { a as getMethodMeta, c as pushClassMeta, d as setInMetaMap, f as setInMetaRecord, i as getMetaRecord, l as pushMethodMeta, n as getClassMetaOrUndefined, o as getMethodMetaOrUndefined, p as setMethodMeta, r as getMetaMap, s as hasClassMeta, t as getClassMeta, u as setClassMeta } from "./metadata-BMS91Yvv.mjs";
|
|
15
15
|
import { ApiQueryParams, Asset, Autowired, Builder, Component, Controller, Delete, FileUpload, Get, Inject, Injectable, Middleware, Patch, Post, PostConstruct, Put, Repository, Service, Value, normalizeApiQueryParamsConfig } from "./core/decorators.mjs";
|
|
16
16
|
import { CRON_META, Cron, getCronJobs } from "./core/cron.mjs";
|
|
17
17
|
import { CacheEvict, Cacheable, MemoryCacheProvider, getCacheProvider, setCacheProvider } from "./core/cache.mjs";
|
|
18
18
|
import { HttpException, HttpStatus } from "./core/errors.mjs";
|
|
19
19
|
import { joinPaths, normalizePath } from "./core/path.mjs";
|
|
20
|
-
import { a as MissingMountDepError, c as runContributors, d as DuplicateContributorError, f as MissingContributorError, h as CircuitOpenError, i as DuplicateMountNameError, l as buildPipeline, m as CircuitBreaker, n as defineAdapter, o as MountCycleError, p as defineContextDecorator, r as definePlugin, s as mountSort, t as defineAugmentation, u as ContributorCycleError } from "./core-
|
|
20
|
+
import { a as MissingMountDepError, c as runContributors, d as DuplicateContributorError, f as MissingContributorError, h as CircuitOpenError, i as DuplicateMountNameError, l as buildPipeline, m as CircuitBreaker, n as defineAdapter, o as MountCycleError, p as defineContextDecorator, r as definePlugin, s as mountSort, t as defineAugmentation, u as ContributorCycleError } from "./core-1aWIOsnH.mjs";
|
|
21
21
|
import { computed, isRef, reactive, ref, toRefs, unref, watch } from "./core/reactivity.mjs";
|
|
22
22
|
import { REQUEST_ID_HEADER, requestId } from "./http/middleware/request-id.mjs";
|
|
23
23
|
import { errorHandler, notFoundHandler } from "./http/middleware/error-handler.mjs";
|
|
24
|
-
import { n as getRequestStore, r as
|
|
25
|
-
import { n as requestScopeMiddleware, t as Application } from "./application-
|
|
26
|
-
import { a as parseSearchQuery, i as parseQuery, n as parseFilters, o as parseSort, r as parsePagination, s as FILTER_OPERATORS, t as buildQueryParams } from "./query-
|
|
24
|
+
import { i as requestStore, n as getRequestStore, r as getRequestValue, t as RequestContext } from "./context-DUUn4-S-.mjs";
|
|
25
|
+
import { n as requestScopeMiddleware, t as Application } from "./application-Biij-nW3.mjs";
|
|
26
|
+
import { a as parseSearchQuery, i as parseQuery, n as parseFilters, o as parseSort, r as parsePagination, s as FILTER_OPERATORS, t as buildQueryParams } from "./query-DZvCV3Pv.mjs";
|
|
27
27
|
import { validate } from "./http/middleware/validate.mjs";
|
|
28
28
|
import { buildUploadMiddleware, cleanupFiles, resolveMimeTypes, upload } from "./http/middleware/upload.mjs";
|
|
29
29
|
import { buildRoutes } from "./http/router-builder.mjs";
|
|
30
|
-
import { a as reloadEnv, i as loadEnv, n as defineEnv, o as resetEnvCache, r as getEnv, t as baseEnvSchema } from "./env-
|
|
31
|
-
import { n as isClusterPrimary, t as bootstrap } from "./bootstrap-
|
|
30
|
+
import { a as reloadEnv, i as loadEnv, n as defineEnv, o as resetEnvCache, r as getEnv, t as baseEnvSchema } from "./env-BLLlccEv.mjs";
|
|
31
|
+
import { n as isClusterPrimary, t as bootstrap } from "./bootstrap-dBvDIX5s.mjs";
|
|
32
32
|
import { csrf } from "./http/middleware/csrf.mjs";
|
|
33
33
|
import { requestLogger } from "./http/middleware/request-logger.mjs";
|
|
34
34
|
import { helmet } from "./http/middleware/helmet.mjs";
|
|
@@ -37,8 +37,44 @@ import { rateLimit } from "./http/middleware/rate-limit.mjs";
|
|
|
37
37
|
import { session } from "./http/middleware/session.mjs";
|
|
38
38
|
import { ViewAdapter } from "./http/middleware/views.mjs";
|
|
39
39
|
import { SpaAdapter } from "./http/middleware/spa.mjs";
|
|
40
|
-
import { n as createConfigService, t as ConfigService } from "./config-
|
|
40
|
+
import { n as createConfigService, t as ConfigService } from "./config-Cc4gFfYi.mjs";
|
|
41
41
|
import crypto from "node:crypto";
|
|
42
|
+
//#region src/http/define-http-context-decorator.ts
|
|
43
|
+
/**
|
|
44
|
+
* HTTP-flavoured wrapper around {@link defineContextDecorator}.
|
|
45
|
+
*
|
|
46
|
+
* The core factory leaves `Ctx` defaulted to {@link ExecutionContext} so the
|
|
47
|
+
* Context Contributor pipeline stays transport-agnostic — future WebSocket,
|
|
48
|
+
* queue, and cron contexts share the same primitive. The cost is that the
|
|
49
|
+
* vast majority of contributors (which are HTTP) have to spell the third
|
|
50
|
+
* generic by hand to get `ctx.req` / `ctx.headers` typing:
|
|
51
|
+
*
|
|
52
|
+
* ```ts
|
|
53
|
+
* defineContextDecorator<'tenant', Record<string, never>, RequestContext>({ ... })
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* `defineHttpContextDecorator` removes that ceremony — the spec is typed
|
|
57
|
+
* against `RequestContext` from the start, so resolvers can read `ctx.req`,
|
|
58
|
+
* `ctx.headers`, `ctx.params`, etc. without a cast or generic dance:
|
|
59
|
+
*
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { defineHttpContextDecorator } from '@forinda/kickjs'
|
|
62
|
+
*
|
|
63
|
+
* const LoadTenant = defineHttpContextDecorator({
|
|
64
|
+
* key: 'tenant',
|
|
65
|
+
* resolve: (ctx) => ({ id: ctx.req.headers['x-tenant-id'] as string }),
|
|
66
|
+
* })
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* Use {@link defineContextDecorator} directly when authoring contributors
|
|
70
|
+
* for non-HTTP transports or when you want to share one contributor across
|
|
71
|
+
* HTTP + WS + queue (the resolver then has to stick to the
|
|
72
|
+
* `ExecutionContext` surface — `ctx.get` / `ctx.set` / `ctx.requestId`).
|
|
73
|
+
*/
|
|
74
|
+
function defineHttpContextDecorator(spec) {
|
|
75
|
+
return defineContextDecorator(spec);
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
42
78
|
//#region src/http/middleware/trace-context.ts
|
|
43
79
|
/**
|
|
44
80
|
* W3C Trace Context header name.
|
|
@@ -123,6 +159,6 @@ function traceContext(options = {}) {
|
|
|
123
159
|
};
|
|
124
160
|
}
|
|
125
161
|
//#endregion
|
|
126
|
-
export { ASSETS, ASSET_MANIFEST_VERSION, ApiQueryParams, Application, Asset, Autowired, Builder, CRON_META, CacheEvict, Cacheable, CircuitBreaker, CircuitOpenError, Component, ConfigService, ConsoleLoggerProvider, Container, ContributorCycleError, Controller, Cron, Delete, DuplicateContributorError, DuplicateMountNameError, FILTER_OPERATORS, FileUpload, Get, HttpException, HttpStatus, INJECTION_TOKEN, Inject, Injectable, Logger, METADATA, MemoryCacheProvider, Middleware, MissingContributorError, MissingMountDepError, MountCycleError, Patch, Post, PostConstruct, Put, REQUEST_ID_HEADER, Repository, RequestContext, Scope, Service, SpaAdapter, TRACEPARENT_HEADER, UnknownAssetError, Value, ViewAdapter, assets, baseEnvSchema, bootstrap, buildPipeline, buildQueryParams, buildRoutes, buildUploadMiddleware, cleanupFiles, clearAssetCache, computed, cors, createConfigService, createLogger, createToken, csrf, defineAdapter, defineAugmentation, defineContextDecorator, defineEnv, definePlugin, errorHandler, getCacheProvider, getClassMeta, getClassMetaOrUndefined, getCronJobs, getEnv, getMetaMap, getMetaRecord, getMethodMeta, getMethodMetaOrUndefined, getRequestStore, hasClassMeta, helmet, isClusterPrimary, isInjectionToken, isRef, joinPaths, loadEnv, mountSort, normalizeApiQueryParamsConfig, normalizePath, notFoundHandler, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort, parseTraceparent, pushClassMeta, pushMethodMeta, rateLimit, reactive, ref, reloadEnv, requestId, requestLogger, requestScopeMiddleware, requestStore, resetEnvCache, resolveAsset, resolveMimeTypes, rootLogger, runContributors, session, setCacheProvider, setClassMeta, setInMetaMap, setInMetaRecord, setMethodMeta, toRefs, tokenName, traceContext, unref, upload, useAssets, validate, watch };
|
|
162
|
+
export { ASSETS, ASSET_MANIFEST_VERSION, ApiQueryParams, Application, Asset, Autowired, Builder, CRON_META, CacheEvict, Cacheable, CircuitBreaker, CircuitOpenError, Component, ConfigService, ConsoleLoggerProvider, Container, ContributorCycleError, Controller, Cron, Delete, DuplicateContributorError, DuplicateMountNameError, FILTER_OPERATORS, FileUpload, Get, HttpException, HttpStatus, INJECTION_TOKEN, Inject, Injectable, Logger, METADATA, MemoryCacheProvider, Middleware, MissingContributorError, MissingMountDepError, MountCycleError, Patch, Post, PostConstruct, Put, REQUEST_ID_HEADER, Repository, RequestContext, Scope, Service, SpaAdapter, TRACEPARENT_HEADER, UnknownAssetError, Value, ViewAdapter, assets, baseEnvSchema, bootstrap, buildPipeline, buildQueryParams, buildRoutes, buildUploadMiddleware, cleanupFiles, clearAssetCache, computed, cors, createConfigService, createLogger, createToken, csrf, defineAdapter, defineAugmentation, defineContextDecorator, defineEnv, defineHttpContextDecorator, definePlugin, errorHandler, getCacheProvider, getClassMeta, getClassMetaOrUndefined, getCronJobs, getEnv, getMetaMap, getMetaRecord, getMethodMeta, getMethodMetaOrUndefined, getRequestStore, getRequestValue, hasClassMeta, helmet, isClusterPrimary, isInjectionToken, isRef, joinPaths, loadEnv, mountSort, normalizeApiQueryParamsConfig, normalizePath, notFoundHandler, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort, parseTraceparent, pushClassMeta, pushMethodMeta, rateLimit, reactive, ref, reloadEnv, requestId, requestLogger, requestScopeMiddleware, requestStore, resetEnvCache, resolveAsset, resolveMimeTypes, rootLogger, runContributors, session, setCacheProvider, setClassMeta, setInMetaMap, setInMetaRecord, setMethodMeta, toRefs, tokenName, traceContext, unref, upload, useAssets, validate, watch };
|
|
127
163
|
|
|
128
164
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/http/middleware/trace-context.ts"],"sourcesContent":["import crypto from 'node:crypto'\nimport type { Request, Response, NextFunction } from 'express'\nimport { requestStore } from '../request-store'\n\n/**\n * W3C Trace Context header name.\n * @see https://www.w3.org/TR/trace-context/#traceparent-header\n */\nexport const TRACEPARENT_HEADER = 'traceparent'\n\n/** Regex for a valid W3C traceparent: {version}-{trace-id}-{parent-id}-{flags} */\nconst TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/\n\nexport interface TraceContextOptions {\n /**\n * When true, respond with a `traceresponse` header containing the trace ID.\n * Useful for debugging. Default: false.\n */\n propagateResponse?: boolean\n}\n\n/**\n * Parsed W3C trace context fields.\n */\nexport interface TraceContext {\n /** W3C traceparent version (usually '00') */\n version: string\n /** 32-hex-char distributed trace ID */\n traceId: string\n /** 16-hex-char parent span ID */\n parentSpanId: string\n /** 2-hex-char trace flags */\n flags: string\n}\n\n/**\n * Generate a random 32-hex-character trace ID.\n */\nfunction generateTraceId(): string {\n return crypto.randomBytes(16).toString('hex')\n}\n\n/**\n * Generate a random 16-hex-character span ID.\n */\nfunction generateSpanId(): string {\n return crypto.randomBytes(8).toString('hex')\n}\n\n/**\n * Parse a W3C traceparent header value.\n * Returns null if the format is invalid.\n */\nexport function parseTraceparent(header: string): TraceContext | null {\n const match = TRACEPARENT_RE.exec(header.trim().toLowerCase())\n if (!match) return null\n\n const version = match[1]\n const traceId = match[2]\n const parentSpanId = match[3]\n const flags = match[4]\n\n // W3C spec: version ff is invalid, all-zero trace-id and parent-id are invalid\n if (\n version === 'ff' ||\n traceId === '00000000000000000000000000000000' ||\n parentSpanId === '0000000000000000'\n ) {\n return null\n }\n\n return { version, traceId, parentSpanId, flags }\n}\n\n/**\n * Middleware that extracts W3C `traceparent` header and stores trace context\n * in the request's AsyncLocalStorage store.\n *\n * If no valid `traceparent` header is present, a new traceId is generated\n * so that every request always has a trace ID available for correlation.\n *\n * Must be mounted **after** `requestScopeMiddleware()` (which creates the store).\n *\n * @example\n * ```ts\n * bootstrap({\n * middleware: [\n * requestScopeMiddleware(),\n * traceContext(), // extracts or generates traceId\n * requestLogger(),\n * express.json(),\n * ],\n * })\n * ```\n */\nexport function traceContext(options: TraceContextOptions = {}) {\n return (req: Request, res: Response, next: NextFunction) => {\n const store = requestStore.getStore()\n\n const traceparentHeader = req.headers[TRACEPARENT_HEADER]\n const raw = Array.isArray(traceparentHeader) ? traceparentHeader[0] : traceparentHeader\n const parsed = raw ? parseTraceparent(raw) : null\n\n const traceId = parsed?.traceId ?? generateTraceId()\n const spanId = generateSpanId()\n\n // Attach to the request store so logger + downstream code can access it\n if (store) {\n store.values.set('traceId', traceId)\n store.values.set('spanId', spanId)\n if (parsed) {\n store.values.set('parentSpanId', parsed.parentSpanId)\n store.values.set('traceFlags', parsed.flags)\n store.values.set('traceVersion', parsed.version)\n }\n }\n\n // Also expose on req for convenience\n ;(req as any).traceId = traceId\n ;(req as any).spanId = spanId\n\n if (options.propagateResponse) {\n res.setHeader('traceresponse', traceId)\n }\n\n next()\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/http/define-http-context-decorator.ts","../src/http/middleware/trace-context.ts"],"sourcesContent":["/**\n * HTTP-flavoured wrapper around {@link defineContextDecorator}.\n *\n * The core factory leaves `Ctx` defaulted to {@link ExecutionContext} so the\n * Context Contributor pipeline stays transport-agnostic — future WebSocket,\n * queue, and cron contexts share the same primitive. The cost is that the\n * vast majority of contributors (which are HTTP) have to spell the third\n * generic by hand to get `ctx.req` / `ctx.headers` typing:\n *\n * ```ts\n * defineContextDecorator<'tenant', Record<string, never>, RequestContext>({ ... })\n * ```\n *\n * `defineHttpContextDecorator` removes that ceremony — the spec is typed\n * against `RequestContext` from the start, so resolvers can read `ctx.req`,\n * `ctx.headers`, `ctx.params`, etc. without a cast or generic dance:\n *\n * ```ts\n * import { defineHttpContextDecorator } from '@forinda/kickjs'\n *\n * const LoadTenant = defineHttpContextDecorator({\n * key: 'tenant',\n * resolve: (ctx) => ({ id: ctx.req.headers['x-tenant-id'] as string }),\n * })\n * ```\n *\n * Use {@link defineContextDecorator} directly when authoring contributors\n * for non-HTTP transports or when you want to share one contributor across\n * HTTP + WS + queue (the resolver then has to stick to the\n * `ExecutionContext` surface — `ctx.get` / `ctx.set` / `ctx.requestId`).\n */\n\nimport {\n defineContextDecorator,\n type ContextDecorator,\n type ContextDecoratorSpec,\n type DepValue,\n} from '../core/context-decorator'\nimport type { RequestContext } from './context'\n\nexport function defineHttpContextDecorator<\n K extends string,\n D extends Record<string, DepValue> = Record<string, never>,\n>(spec: ContextDecoratorSpec<K, D, RequestContext>): ContextDecorator<K, D, RequestContext> {\n return defineContextDecorator<K, D, RequestContext>(spec)\n}\n","import crypto from 'node:crypto'\nimport type { Request, Response, NextFunction } from 'express'\nimport { requestStore } from '../request-store'\n\n/**\n * W3C Trace Context header name.\n * @see https://www.w3.org/TR/trace-context/#traceparent-header\n */\nexport const TRACEPARENT_HEADER = 'traceparent'\n\n/** Regex for a valid W3C traceparent: {version}-{trace-id}-{parent-id}-{flags} */\nconst TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/\n\nexport interface TraceContextOptions {\n /**\n * When true, respond with a `traceresponse` header containing the trace ID.\n * Useful for debugging. Default: false.\n */\n propagateResponse?: boolean\n}\n\n/**\n * Parsed W3C trace context fields.\n */\nexport interface TraceContext {\n /** W3C traceparent version (usually '00') */\n version: string\n /** 32-hex-char distributed trace ID */\n traceId: string\n /** 16-hex-char parent span ID */\n parentSpanId: string\n /** 2-hex-char trace flags */\n flags: string\n}\n\n/**\n * Generate a random 32-hex-character trace ID.\n */\nfunction generateTraceId(): string {\n return crypto.randomBytes(16).toString('hex')\n}\n\n/**\n * Generate a random 16-hex-character span ID.\n */\nfunction generateSpanId(): string {\n return crypto.randomBytes(8).toString('hex')\n}\n\n/**\n * Parse a W3C traceparent header value.\n * Returns null if the format is invalid.\n */\nexport function parseTraceparent(header: string): TraceContext | null {\n const match = TRACEPARENT_RE.exec(header.trim().toLowerCase())\n if (!match) return null\n\n const version = match[1]\n const traceId = match[2]\n const parentSpanId = match[3]\n const flags = match[4]\n\n // W3C spec: version ff is invalid, all-zero trace-id and parent-id are invalid\n if (\n version === 'ff' ||\n traceId === '00000000000000000000000000000000' ||\n parentSpanId === '0000000000000000'\n ) {\n return null\n }\n\n return { version, traceId, parentSpanId, flags }\n}\n\n/**\n * Middleware that extracts W3C `traceparent` header and stores trace context\n * in the request's AsyncLocalStorage store.\n *\n * If no valid `traceparent` header is present, a new traceId is generated\n * so that every request always has a trace ID available for correlation.\n *\n * Must be mounted **after** `requestScopeMiddleware()` (which creates the store).\n *\n * @example\n * ```ts\n * bootstrap({\n * middleware: [\n * requestScopeMiddleware(),\n * traceContext(), // extracts or generates traceId\n * requestLogger(),\n * express.json(),\n * ],\n * })\n * ```\n */\nexport function traceContext(options: TraceContextOptions = {}) {\n return (req: Request, res: Response, next: NextFunction) => {\n const store = requestStore.getStore()\n\n const traceparentHeader = req.headers[TRACEPARENT_HEADER]\n const raw = Array.isArray(traceparentHeader) ? traceparentHeader[0] : traceparentHeader\n const parsed = raw ? parseTraceparent(raw) : null\n\n const traceId = parsed?.traceId ?? generateTraceId()\n const spanId = generateSpanId()\n\n // Attach to the request store so logger + downstream code can access it\n if (store) {\n store.values.set('traceId', traceId)\n store.values.set('spanId', spanId)\n if (parsed) {\n store.values.set('parentSpanId', parsed.parentSpanId)\n store.values.set('traceFlags', parsed.flags)\n store.values.set('traceVersion', parsed.version)\n }\n }\n\n // Also expose on req for convenience\n ;(req as any).traceId = traceId\n ;(req as any).spanId = spanId\n\n if (options.propagateResponse) {\n res.setHeader('traceresponse', traceId)\n }\n\n next()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,2BAGd,MAA0F;AAC1F,QAAO,uBAA6C,KAAK;;;;;;;;ACpC3D,MAAa,qBAAqB;;AAGlC,MAAM,iBAAiB;;;;AA2BvB,SAAS,k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
+
* @forinda/kickjs v4.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -73,4 +73,4 @@ function getMetaRecord(key, target) {
|
|
|
73
73
|
//#endregion
|
|
74
74
|
export { getMethodMeta as a, pushClassMeta as c, setInMetaMap as d, setInMetaRecord as f, getMetaRecord as i, pushMethodMeta as l, getClassMetaOrUndefined as n, getMethodMetaOrUndefined as o, setMethodMeta as p, getMetaMap as r, hasClassMeta as s, getClassMeta as t, setClassMeta as u };
|
|
75
75
|
|
|
76
|
-
//# sourceMappingURL=metadata-
|
|
76
|
+
//# sourceMappingURL=metadata-BMS91Yvv.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-
|
|
1
|
+
{"version":3,"file":"metadata-BMS91Yvv.mjs","names":[],"sources":["../src/core/metadata.ts"],"sourcesContent":["import 'reflect-metadata'\nimport type { InjectionToken } from './token'\n\n/**\n * Typed utilities for reflect-metadata operations.\n *\n * Replaces scattered Reflect.defineMetadata/getMetadata calls with a single\n * source of truth. If we later move to Stage 3 decorators or a WeakMap-based\n * store, only this file changes — all 24+ consumer files stay untouched.\n *\n * Keys may be symbols, strings, or `InjectionToken<T>` objects produced by\n * `createToken()`. Using `createToken` is the preferred pattern because the\n * token's phantom type flows through the helpers, enabling type-safe reads.\n */\n\ntype MetaKey = symbol | string | InjectionToken<unknown>\n\n// ── Setters ─────────────────────────────────────────────────────\n\n/** Set metadata on a class (or prototype for property decorators) */\nexport function setClassMeta<T>(key: MetaKey, value: T, target: object): void {\n Reflect.defineMetadata(key, value, target)\n}\n\n/** Set metadata on a specific method */\nexport function setMethodMeta<T>(key: MetaKey, value: T, target: object, method: string): void {\n Reflect.defineMetadata(key, value, target, method)\n}\n\n// ── Getters ─────────────────────────────────────────────────────\n\n/** Get metadata from a class, returning `fallback` if not set */\nexport function getClassMeta<T>(key: MetaKey, target: object, fallback: T): T {\n return (Reflect.getMetadata(key, target) as T) ?? fallback\n}\n\n/** Get metadata from a specific method, returning `fallback` if not set */\nexport function getMethodMeta<T>(key: MetaKey, target: object, method: string, fallback: T): T {\n return (Reflect.getMetadata(key, target, method) as T) ?? fallback\n}\n\n/** Check if metadata exists on a class */\nexport function hasClassMeta(key: MetaKey, target: object): boolean {\n return Reflect.hasMetadata(key, target)\n}\n\n/** Get metadata from a class with no default (returns undefined if absent) */\nexport function getClassMetaOrUndefined<T>(key: MetaKey, target: object): T | undefined {\n return Reflect.getMetadata(key, target) as T | undefined\n}\n\n/** Get metadata from a method with no default (returns undefined if absent) */\nexport function getMethodMetaOrUndefined<T>(\n key: MetaKey,\n target: object,\n method: string,\n): T | undefined {\n return Reflect.getMetadata(key, target, method) as T | undefined\n}\n\n// ── Accumulate: Arrays ──────────────────────────────────────────\n\n/** Append items to an array stored in class metadata */\nexport function pushClassMeta<T>(key: MetaKey, target: object, ...items: T[]): void {\n const existing: T[] = Reflect.getOwnMetadata(key, target) ?? []\n Reflect.defineMetadata(key, [...existing, ...items], target)\n}\n\n/** Append items to an array stored in method metadata */\nexport function pushMethodMeta<T>(\n key: MetaKey,\n target: object,\n method: string,\n ...items: T[]\n): void {\n const existing: T[] = Reflect.getOwnMetadata(key, target, method) ?? []\n Reflect.defineMetadata(key, [...existing, ...items], target, method)\n}\n\n// ── Accumulate: Maps ────────────────────────────────────────────\n\n/** Set a key/value in a Map stored in class metadata */\nexport function setInMetaMap<K, V>(key: MetaKey, target: object, mapKey: K, mapValue: V): void {\n const inherited: Map<K, V> | undefined = Reflect.getOwnMetadata(key, target)\n const map = inherited ? new Map(inherited) : new Map<K, V>()\n map.set(mapKey, mapValue)\n Reflect.defineMetadata(key, map, target)\n}\n\n/** Get a Map from class metadata (returns empty Map if absent) */\nexport function getMetaMap<K, V>(key: MetaKey, target: object): Map<K, V> {\n return Reflect.getMetadata(key, target) ?? new Map()\n}\n\n// ── Accumulate: Records ─────────────────────────────────────────\n\n/** Set a key/value in a Record stored in class metadata */\nexport function setInMetaRecord<V>(\n key: MetaKey,\n target: object,\n recKey: string | number,\n recValue: V,\n): void {\n const inherited: Record<string | number, V> | undefined = Reflect.getOwnMetadata(key, target)\n const rec = inherited ? { ...inherited } : {}\n rec[recKey] = recValue\n Reflect.defineMetadata(key, rec, target)\n}\n\n/** Get a Record from class metadata (returns empty object if absent) */\nexport function getMetaRecord<V>(key: MetaKey, target: object): Record<string | number, V> {\n return Reflect.getMetadata(key, target) ?? {}\n}\n"],"mappings":";;;;;;;;;;;;;AAoBA,SAAgB,aAAgB,KAAc,OAAU,QAAsB;AAC5E,SAAQ,eAAe,KAAK,OAAO,OAAO;;;AAI5C,SAAgB,cAAiB,KAAc,OAAU,QAAgB,QAAsB;AAC7F,SAAQ,eAAe,KAAK,OAAO,QAAQ,OAAO;;;AAMpD,SAAgB,aAAgB,KAAc,QAAgB,UAAgB;AAC5E,QAAQ,QAAQ,YAAY,KAAK,OAAO,IAAU;;;AAIpD,SAAgB,cAAiB,KAAc,QAAgB,QAAgB,UAAgB;AAC7F,QAAQ,QAAQ,YAAY,KAAK,QAAQ,OAAO,IAAU;;;AAI5D,SAAgB,aAAa,KAAc,QAAyB;AAClE,QAAO,QAAQ,YAAY,KAAK,OAAO;;;AAIzC,SAAgB,wBAA2B,KAAc,QAA+B;AACtF,QAAO,QAAQ,YAAY,KAAK,OAAO;;;AAIzC,SAAgB,yBACd,KACA,QACA,QACe;AACf,QAAO,QAAQ,YAAY,KAAK,QAAQ,OAAO;;;AAMjD,SAAgB,cAAiB,KAAc,QAAgB,GAAG,OAAkB;CAClF,MAAM,WAAgB,QAAQ,eAAe,KAAK,OAAO,IAAI,EAAE;AAC/D,SAAQ,eAAe,KAAK,CAAC,GAAG,UAAU,GAAG,MAAM,EAAE,OAAO;;;AAI9D,SAAgB,eACd,KACA,QACA,QACA,GAAG,OACG;CACN,MAAM,WAAgB,QAAQ,eAAe,KAAK,QAAQ,OAAO,IAAI,EAAE;AACvE,SAAQ,eAAe,KAAK,CAAC,GAAG,UAAU,GAAG,MAAM,EAAE,QAAQ,OAAO;;;AAMtE,SAAgB,aAAmB,KAAc,QAAgB,QAAW,UAAmB;CAC7F,MAAM,YAAmC,QAAQ,eAAe,KAAK,OAAO;CAC5E,MAAM,MAAM,YAAY,IAAI,IAAI,UAAU,mBAAG,IAAI,KAAW;AAC5D,KAAI,IAAI,QAAQ,SAAS;AACzB,SAAQ,eAAe,KAAK,KAAK,OAAO;;;AAI1C,SAAgB,WAAiB,KAAc,QAA2B;AACxE,QAAO,QAAQ,YAAY,KAAK,OAAO,oBAAI,IAAI,KAAK;;;AAMtD,SAAgB,gBACd,KACA,QACA,QACA,UACM;CACN,MAAM,YAAoD,QAAQ,eAAe,KAAK,OAAO;CAC7F,MAAM,MAAM,YAAY,EAAE,GAAG,WAAW,GAAG,EAAE;AAC7C,KAAI,UAAU;AACd,SAAQ,eAAe,KAAK,KAAK,OAAO;;;AAI1C,SAAgB,cAAiB,KAAc,QAA4C;AACzF,QAAO,QAAQ,YAAY,KAAK,OAAO,IAAI,EAAE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { t as Container } from "./container-CnWDsxi-.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { r as AppAdapter, s as KickJsPluginName } from "./adapter-
|
|
5
|
-
import { n as AppModuleClass } from "./app-module-
|
|
3
|
+
import { o as ContributorRegistrations } from "./context-decorator-DrPvQ9Ag.mjs";
|
|
4
|
+
import { r as AppAdapter, s as KickJsPluginName } from "./adapter-6Pp4kFdM.mjs";
|
|
5
|
+
import { n as AppModuleClass } from "./app-module-Blgz4Rti.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/core/plugin.d.ts
|
|
8
8
|
/**
|
|
@@ -129,7 +129,7 @@ interface KickPlugin {
|
|
|
129
129
|
* }
|
|
130
130
|
* ```
|
|
131
131
|
*/
|
|
132
|
-
contributors?():
|
|
132
|
+
contributors?(): ContributorRegistrations;
|
|
133
133
|
/**
|
|
134
134
|
* Called after the application has fully bootstrapped.
|
|
135
135
|
* Use for post-startup logic like logging, health registration, etc.
|
|
@@ -162,4 +162,4 @@ interface KickPlugin {
|
|
|
162
162
|
}
|
|
163
163
|
//#endregion
|
|
164
164
|
export { KickPlugin as t };
|
|
165
|
-
//# sourceMappingURL=plugin-
|
|
165
|
+
//# sourceMappingURL=plugin-DDjoN4XI.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-DDjoN4XI.d.mts","names":[],"sources":["../src/core/plugin.ts"],"mappings":";;;;;;;;AA0DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAAiB,UAAA;;EAEf,IAAA;;;;;;;;;;;;;;;;;;;EAoBA,SAAA,YAAqB,gBAAA;;;;;EAMrB,QAAA,EAAU,SAAA,EAAW,SAAA;;;;;EAMrB,OAAA,KAAY,cAAA;;;;;EAMZ,QAAA,KAAa,UAAA;;;;;EAMb,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCA,YAAA,KAAiB,wBAAA;;;;;EAMjB,OAAA,EAAS,SAAA,EAAW,SAAA,UAAmB,OAAA;;;;;EAMvC,QAAA,YAAoB,OAAA;;;;;;;;;;;;;EAcpB,UAAA,eAAyB,OAAA;;;;;;EAOzB,YAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v4.
|
|
2
|
+
* @forinda/kickjs v4.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -161,4 +161,4 @@ function buildQueryParams(parsed) {
|
|
|
161
161
|
//#endregion
|
|
162
162
|
export { parseSearchQuery as a, parseQuery as i, parseFilters as n, parseSort as o, parsePagination as r, FILTER_OPERATORS as s, buildQueryParams as t };
|
|
163
163
|
|
|
164
|
-
//# sourceMappingURL=query-
|
|
164
|
+
//# sourceMappingURL=query-DZvCV3Pv.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-DJMxdx5r.mjs","names":[],"sources":["../src/http/query/types.ts","../src/http/query/parse-query.ts"],"sourcesContent":["/** Supported filter operators for query string parsing */\nexport type FilterOperator =\n | 'eq'\n | 'neq'\n | 'gt'\n | 'gte'\n | 'lt'\n | 'lte'\n | 'between'\n | 'in'\n | 'contains'\n | 'starts'\n | 'ends'\n\nexport const FILTER_OPERATORS = new Set<string>([\n 'eq',\n 'neq',\n 'gt',\n 'gte',\n 'lt',\n 'lte',\n 'between',\n 'in',\n 'contains',\n 'starts',\n 'ends',\n])\n\nexport interface FilterItem {\n field: string\n operator: FilterOperator\n value: string\n}\n\nexport interface SortItem {\n field: string\n direction: 'asc' | 'desc'\n}\n\nexport interface PaginationParams {\n page: number\n limit: number\n offset: number\n}\n\n/**\n * The result of parsing a query string. ORM-agnostic — pass this to\n * a query builder adapter (Drizzle, Prisma, Sequelize, etc.) to produce\n * database-specific query objects.\n */\nexport interface ParsedQuery {\n filters: FilterItem[]\n sort: SortItem[]\n pagination: PaginationParams\n search: string\n}\n\n/**\n * Helper that extracts the literal field union from a `QueryFieldConfig`\n * key. When the user passes `{ filterable: ['status', 'category'] } as const`,\n * `FieldsOf<typeof config, 'filterable'>` resolves to `'status' | 'category'`.\n *\n * Without `as const`, the arrays widen to `string[]` and the union falls\n * back to `string`. This is the documented escape hatch.\n */\nexport type FieldsOf<\n TConfig extends QueryFieldConfig | undefined,\n K extends 'filterable' | 'sortable' | 'searchable',\n> = TConfig extends { readonly [P in K]: readonly (infer F)[] }\n ? F extends string\n ? F\n : string\n : TConfig extends { columns: infer C }\n ? K extends 'filterable'\n ? keyof C & string\n : string\n : string\n\n/**\n * Narrowed `ParsedQuery` whose `filters[].field` and `sort[].field`\n * unions are constrained to the literal whitelist passed to\n * `ctx.qs()` / `parseQuery()`. Extends `ParsedQuery`, so any function\n * accepting `ParsedQuery` accepts a `TypedParsedQuery<X>` automatically\n * (subtype assignment, no codegen, backward compatible).\n *\n * @example\n * ```ts\n * const parsed = ctx.qs({\n * filterable: ['status', 'priority'],\n * sortable: ['createdAt'],\n * } as const)\n * parsed.filters[0]?.field // 'status' | 'priority'\n * parsed.sort[0]?.field // 'createdAt'\n * ```\n */\nexport interface TypedParsedQuery<\n TConfig extends QueryFieldConfig | undefined,\n> extends ParsedQuery {\n filters: Array<FilterItem & { field: FieldsOf<TConfig, 'filterable'> }>\n sort: Array<SortItem & { field: FieldsOf<TConfig, 'sortable'> }>\n}\n\n/**\n * Restrict which fields can be filtered, sorted, or searched.\n * Fields not in the allow-list are silently ignored.\n *\n * Accepts two forms:\n * 1. **String arrays** (standard): `{ filterable: ['name', 'status'], sortable: ['createdAt'] }`\n * 2. **Column-object maps** (Drizzle-style): `{ columns: { name: col, status: col }, sortable: { createdAt: col } }`\n *\n * When column-object maps are provided, `Object.keys()` is used to derive the field names.\n */\nexport type QueryFieldConfig = StringQueryFieldConfig | ColumnQueryFieldConfig\n\nexport interface StringQueryFieldConfig {\n filterable?: string[]\n sortable?: string[]\n searchable?: string[]\n}\n\n/**\n * Column-object-based field config (e.g., from DrizzleQueryParamsConfig).\n * Keys are the field names used in query strings; values are ORM column references.\n */\nexport interface ColumnQueryFieldConfig {\n columns: Record<string, any>\n sortable?: Record<string, any>\n searchColumns?: any[]\n [key: string]: any\n}\n\n/** Standardized paginated response shape */\nexport interface PaginatedResponse<T = any> {\n data: T[]\n meta: {\n page: number\n limit: number\n total: number\n totalPages: number\n hasNext: boolean\n hasPrev: boolean\n }\n}\n\n/**\n * Interface for ORM-specific query builder adapters.\n * Implement this to translate a `ParsedQuery` into your ORM's query format.\n *\n * @example\n * ```ts\n * // Drizzle adapter\n * class DrizzleQueryAdapter implements QueryBuilderAdapter<DrizzleQueryResult> {\n * build(parsed: ParsedQuery, config: DrizzleConfig): DrizzleQueryResult {\n * // Convert filters → Drizzle SQL conditions\n * // Convert sort → Drizzle orderBy\n * return { where, orderBy, limit, offset }\n * }\n * }\n *\n * // Prisma adapter\n * class PrismaQueryAdapter implements QueryBuilderAdapter<PrismaQueryResult> {\n * build(parsed: ParsedQuery, config: PrismaConfig): PrismaQueryResult {\n * return { where, orderBy, skip, take }\n * }\n * }\n * ```\n */\nexport interface QueryBuilderAdapter<TResult = any, TConfig = any> {\n /** Human-readable name for debugging */\n readonly name: string\n\n /**\n * Convert a ParsedQuery into an ORM-specific query object.\n * @param parsed - The ORM-agnostic parsed query\n * @param config - ORM-specific configuration (column maps, search columns, etc.)\n */\n build(parsed: ParsedQuery, config: TConfig): TResult\n}\n","import {\n FILTER_OPERATORS,\n type FilterItem,\n type FilterOperator,\n type SortItem,\n type PaginationParams,\n type ParsedQuery,\n type QueryFieldConfig,\n type StringQueryFieldConfig,\n type TypedParsedQuery,\n} from './types'\n\nconst MAX_SEARCH_LENGTH = 200\nconst DEFAULT_PAGE = 1\nconst DEFAULT_LIMIT = 20\nconst MAX_LIMIT = 100\n\n// ── Individual parsers ──────────────────────────────────────────────────\n\n/** Parse filter strings like \"status:eq:active\" into structured objects */\nexport function parseFilters(\n filterParam: string | string[] | undefined,\n allowedFields?: string[],\n): FilterItem[] {\n if (!filterParam) return []\n\n const items = Array.isArray(filterParam) ? filterParam : [filterParam]\n const results: FilterItem[] = []\n const allowed = allowedFields ? new Set(allowedFields) : null\n\n for (const item of items) {\n // Split on first two colons only — value may contain colons (e.g. timestamps)\n const firstColon = item.indexOf(':')\n if (firstColon === -1) continue\n\n const secondColon = item.indexOf(':', firstColon + 1)\n if (secondColon === -1) continue\n\n const field = item.slice(0, firstColon)\n const operator = item.slice(firstColon + 1, secondColon)\n const value = item.slice(secondColon + 1)\n\n if (!field || !value) continue\n if (!FILTER_OPERATORS.has(operator)) continue\n if (allowed && !allowed.has(field)) continue\n\n results.push({ field, operator: operator as FilterOperator, value })\n }\n\n return results\n}\n\n/** Parse sort strings like \"firstName:asc\" into structured objects */\nexport function parseSort(\n sortParam: string | string[] | undefined,\n allowedFields?: string[],\n): SortItem[] {\n if (!sortParam) return []\n\n const items = Array.isArray(sortParam) ? sortParam : [sortParam]\n const results: SortItem[] = []\n const allowed = allowedFields ? new Set(allowedFields) : null\n\n for (const item of items) {\n // Split on last colon so field names with colons work\n const lastColon = item.lastIndexOf(':')\n if (lastColon === -1) continue\n\n const field = item.slice(0, lastColon)\n const dir = item.slice(lastColon + 1).toLowerCase()\n\n if (!field) continue\n if (dir !== 'asc' && dir !== 'desc') continue\n if (allowed && !allowed.has(field)) continue\n\n results.push({ field, direction: dir })\n }\n\n return results\n}\n\n/** Parse page/limit into pagination with computed offset */\nexport function parsePagination(params: {\n page?: string | number\n limit?: string | number\n}): PaginationParams {\n let page =\n typeof params.page === 'string'\n ? Number.parseInt(params.page, 10)\n : (params.page ?? DEFAULT_PAGE)\n let limit =\n typeof params.limit === 'string'\n ? Number.parseInt(params.limit, 10)\n : (params.limit ?? DEFAULT_LIMIT)\n\n if (Number.isNaN(page) || page < 1) page = DEFAULT_PAGE\n if (Number.isNaN(limit) || limit < 1) limit = DEFAULT_LIMIT\n if (limit > MAX_LIMIT) limit = MAX_LIMIT\n\n return { page, limit, offset: (page - 1) * limit }\n}\n\n/** Sanitize and truncate search query */\nexport function parseSearchQuery(q: string | undefined): string {\n if (!q) return ''\n return q.trim().slice(0, MAX_SEARCH_LENGTH)\n}\n\n// ── Config normalizer ───────────────────────────────────────────────────\n\n/**\n * Normalize a QueryFieldConfig into the string-based form.\n * Detects column-object-based configs (DrizzleQueryParamsConfig) by checking\n * for a `columns` property and extracts `Object.keys()`.\n */\nfunction normalizeFieldConfig(config?: QueryFieldConfig): StringQueryFieldConfig | undefined {\n if (!config) return undefined\n\n // Column-object-based config (e.g., DrizzleQueryParamsConfig)\n if ('columns' in config && config.columns && typeof config.columns === 'object') {\n return {\n filterable: Object.keys(config.columns),\n sortable: config.sortable ? Object.keys(config.sortable) : undefined,\n searchable: undefined, // searchColumns are Column objects, not used for string filtering\n }\n }\n\n // Already string-based\n return config as StringQueryFieldConfig\n}\n\n// ── Combined parser ─────────────────────────────────────────────────────\n\n/**\n * Parse a raw Express query object into a structured, ORM-agnostic ParsedQuery.\n *\n * @param query - Raw query string object from `req.query` or Zod-validated object\n * @param fieldConfig - Optional field restrictions (whitelist filterable/sortable/searchable).\n * Accepts both string-based configs (`{ filterable, sortable, searchable }`) and\n * column-object configs (`{ columns, sortable, searchColumns }`).\n *\n * @example\n * ```ts\n * // String-based config\n * const parsed = parseQuery(ctx.query, {\n * filterable: ['status', 'priority'],\n * sortable: ['createdAt', 'title'],\n * })\n *\n * // Column-object config (DrizzleQueryParamsConfig)\n * const parsed = parseQuery(ctx.query, TASK_QUERY_CONFIG)\n * ```\n *\n * Query string format:\n * - Filters: `?filter=field:operator:value` (repeatable)\n * - Sort: `?sort=field:asc|desc` (repeatable)\n * - Pagination: `?page=1&limit=20`\n * - Search: `?q=search+term`\n *\n * Filter operators: eq, neq, gt, gte, lt, lte, between, in, contains, starts, ends\n */\nexport function parseQuery<TConfig extends QueryFieldConfig | undefined = undefined>(\n query: Record<string, any>,\n fieldConfig?: TConfig,\n): TypedParsedQuery<TConfig> {\n const normalized = normalizeFieldConfig(fieldConfig)\n return {\n filters: parseFilters(query.filter, normalized?.filterable),\n sort: parseSort(query.sort, normalized?.sortable),\n pagination: parsePagination({ page: query.page, limit: query.limit }),\n search: parseSearchQuery(query.q),\n } as TypedParsedQuery<TConfig>\n}\n\n// ── Query URL builder (for client-side or testing) ──────────────────────\n\n/** Convert ParsedQuery back into query string parameters */\nexport function buildQueryParams(\n parsed: Partial<ParsedQuery>,\n): Record<string, string | string[] | number> {\n const params: Record<string, string | string[] | number> = {}\n\n if (parsed.filters?.length) {\n params.filter = parsed.filters.map((f) => `${f.field}:${f.operator}:${f.value}`)\n }\n\n if (parsed.sort?.length) {\n params.sort = parsed.sort.map((s) => `${s.field}:${s.direction}`)\n }\n\n if (parsed.pagination) {\n params.page = parsed.pagination.page\n params.limit = parsed.pagination.limit\n }\n\n if (parsed.search) {\n params.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W;EAC3D,MAAM,UAAU,MAAM,MAAM,YAAY,SAAS;EACjD,YAAY,gBAAgB;GAAE,MAAM,MAAM;GAAM,OAAO,MAAM;GAAO,CAAC;EACrE,QAAQ,iBAAiB,MAAM,EAAE;EAClC;;;AAMH,SAAgB,iBACd,QAC4C;CAC5C,MAAM,SAAqD,EAAE;AAE7D,KAAI,OAAO,SAAS,OAClB,QAAO,SAAS,OAAO,QAAQ,KAAK,MAAM,GAAG,EAAE,MAAM,GAAG,EAAE,SAAS,GAAG,EAAE,QAAQ;AAGlF,KAAI,OAAO,MAAM,OACf,QAAO,OAAO,OAAO,KAAK,KAAK,MAAM,GAAG,EAAE,MAAM,GAAG,EAAE,YAAY;AAGnE,KAAI,OAAO,YAAY;AACrB,SAAO,OAAO,OAAO,WAAW;AAChC,SAAO,QAAQ,OAAO,WAAW;;AAGnC,KAAI,OAAO,OACT,QAAO,IAAI,OAAO;AAGpB,QAAO"}
|
|
1
|
+
{"version":3,"file":"query-DZvCV3Pv.mjs","names":[],"sources":["../src/http/query/types.ts","../src/http/query/parse-query.ts"],"sourcesContent":["/** Supported filter operators for query string parsing */\nexport type FilterOperator =\n | 'eq'\n | 'neq'\n | 'gt'\n | 'gte'\n | 'lt'\n | 'lte'\n | 'between'\n | 'in'\n | 'contains'\n | 'starts'\n | 'ends'\n\nexport const FILTER_OPERATORS = new Set<string>([\n 'eq',\n 'neq',\n 'gt',\n 'gte',\n 'lt',\n 'lte',\n 'between',\n 'in',\n 'contains',\n 'starts',\n 'ends',\n])\n\nexport interface FilterItem {\n field: string\n operator: FilterOperator\n value: string\n}\n\nexport interface SortItem {\n field: string\n direction: 'asc' | 'desc'\n}\n\nexport interface PaginationParams {\n page: number\n limit: number\n offset: number\n}\n\n/**\n * The result of parsing a query string. ORM-agnostic — pass this to\n * a query builder adapter (Drizzle, Prisma, Sequelize, etc.) to produce\n * database-specific query objects.\n */\nexport interface ParsedQuery {\n filters: FilterItem[]\n sort: SortItem[]\n pagination: PaginationParams\n search: string\n}\n\n/**\n * Helper that extracts the literal field union from a `QueryFieldConfig`\n * key. When the user passes `{ filterable: ['status', 'category'] } as const`,\n * `FieldsOf<typeof config, 'filterable'>` resolves to `'status' | 'category'`.\n *\n * Without `as const`, the arrays widen to `string[]` and the union falls\n * back to `string`. This is the documented escape hatch.\n */\nexport type FieldsOf<\n TConfig extends QueryFieldConfig | undefined,\n K extends 'filterable' | 'sortable' | 'searchable',\n> = TConfig extends { readonly [P in K]: readonly (infer F)[] }\n ? F extends string\n ? F\n : string\n : TConfig extends { columns: infer C }\n ? K extends 'filterable'\n ? keyof C & string\n : string\n : string\n\n/**\n * Narrowed `ParsedQuery` whose `filters[].field` and `sort[].field`\n * unions are constrained to the literal whitelist passed to\n * `ctx.qs()` / `parseQuery()`. Extends `ParsedQuery`, so any function\n * accepting `ParsedQuery` accepts a `TypedParsedQuery<X>` automatically\n * (subtype assignment, no codegen, backward compatible).\n *\n * @example\n * ```ts\n * const parsed = ctx.qs({\n * filterable: ['status', 'priority'],\n * sortable: ['createdAt'],\n * } as const)\n * parsed.filters[0]?.field // 'status' | 'priority'\n * parsed.sort[0]?.field // 'createdAt'\n * ```\n */\nexport interface TypedParsedQuery<\n TConfig extends QueryFieldConfig | undefined,\n> extends ParsedQuery {\n filters: Array<FilterItem & { field: FieldsOf<TConfig, 'filterable'> }>\n sort: Array<SortItem & { field: FieldsOf<TConfig, 'sortable'> }>\n}\n\n/**\n * Restrict which fields can be filtered, sorted, or searched.\n * Fields not in the allow-list are silently ignored.\n *\n * Accepts two forms:\n * 1. **String arrays** (standard): `{ filterable: ['name', 'status'], sortable: ['createdAt'] }`\n * 2. **Column-object maps** (Drizzle-style): `{ columns: { name: col, status: col }, sortable: { createdAt: col } }`\n *\n * When column-object maps are provided, `Object.keys()` is used to derive the field names.\n */\nexport type QueryFieldConfig = StringQueryFieldConfig | ColumnQueryFieldConfig\n\nexport interface StringQueryFieldConfig {\n filterable?: string[]\n sortable?: string[]\n searchable?: string[]\n}\n\n/**\n * Column-object-based field config (e.g., from DrizzleQueryParamsConfig).\n * Keys are the field names used in query strings; values are ORM column references.\n */\nexport interface ColumnQueryFieldConfig {\n columns: Record<string, any>\n sortable?: Record<string, any>\n searchColumns?: any[]\n [key: string]: any\n}\n\n/** Standardized paginated response shape */\nexport interface PaginatedResponse<T = any> {\n data: T[]\n meta: {\n page: number\n limit: number\n total: number\n totalPages: number\n hasNext: boolean\n hasPrev: boolean\n }\n}\n\n/**\n * Interface for ORM-specific query builder adapters.\n * Implement this to translate a `ParsedQuery` into your ORM's query format.\n *\n * @example\n * ```ts\n * // Drizzle adapter\n * class DrizzleQueryAdapter implements QueryBuilderAdapter<DrizzleQueryResult> {\n * build(parsed: ParsedQuery, config: DrizzleConfig): DrizzleQueryResult {\n * // Convert filters → Drizzle SQL conditions\n * // Convert sort → Drizzle orderBy\n * return { where, orderBy, limit, offset }\n * }\n * }\n *\n * // Prisma adapter\n * class PrismaQueryAdapter implements QueryBuilderAdapter<PrismaQueryResult> {\n * build(parsed: ParsedQuery, config: PrismaConfig): PrismaQueryResult {\n * return { where, orderBy, skip, take }\n * }\n * }\n * ```\n */\nexport interface QueryBuilderAdapter<TResult = any, TConfig = any> {\n /** Human-readable name for debugging */\n readonly name: string\n\n /**\n * Convert a ParsedQuery into an ORM-specific query object.\n * @param parsed - The ORM-agnostic parsed query\n * @param config - ORM-specific configuration (column maps, search columns, etc.)\n */\n build(parsed: ParsedQuery, config: TConfig): TResult\n}\n","import {\n FILTER_OPERATORS,\n type FilterItem,\n type FilterOperator,\n type SortItem,\n type PaginationParams,\n type ParsedQuery,\n type QueryFieldConfig,\n type StringQueryFieldConfig,\n type TypedParsedQuery,\n} from './types'\n\nconst MAX_SEARCH_LENGTH = 200\nconst DEFAULT_PAGE = 1\nconst DEFAULT_LIMIT = 20\nconst MAX_LIMIT = 100\n\n// ── Individual parsers ──────────────────────────────────────────────────\n\n/** Parse filter strings like \"status:eq:active\" into structured objects */\nexport function parseFilters(\n filterParam: string | string[] | undefined,\n allowedFields?: string[],\n): FilterItem[] {\n if (!filterParam) return []\n\n const items = Array.isArray(filterParam) ? filterParam : [filterParam]\n const results: FilterItem[] = []\n const allowed = allowedFields ? new Set(allowedFields) : null\n\n for (const item of items) {\n // Split on first two colons only — value may contain colons (e.g. timestamps)\n const firstColon = item.indexOf(':')\n if (firstColon === -1) continue\n\n const secondColon = item.indexOf(':', firstColon + 1)\n if (secondColon === -1) continue\n\n const field = item.slice(0, firstColon)\n const operator = item.slice(firstColon + 1, secondColon)\n const value = item.slice(secondColon + 1)\n\n if (!field || !value) continue\n if (!FILTER_OPERATORS.has(operator)) continue\n if (allowed && !allowed.has(field)) continue\n\n results.push({ field, operator: operator as FilterOperator, value })\n }\n\n return results\n}\n\n/** Parse sort strings like \"firstName:asc\" into structured objects */\nexport function parseSort(\n sortParam: string | string[] | undefined,\n allowedFields?: string[],\n): SortItem[] {\n if (!sortParam) return []\n\n const items = Array.isArray(sortParam) ? sortParam : [sortParam]\n const results: SortItem[] = []\n const allowed = allowedFields ? new Set(allowedFields) : null\n\n for (const item of items) {\n // Split on last colon so field names with colons work\n const lastColon = item.lastIndexOf(':')\n if (lastColon === -1) continue\n\n const field = item.slice(0, lastColon)\n const dir = item.slice(lastColon + 1).toLowerCase()\n\n if (!field) continue\n if (dir !== 'asc' && dir !== 'desc') continue\n if (allowed && !allowed.has(field)) continue\n\n results.push({ field, direction: dir })\n }\n\n return results\n}\n\n/** Parse page/limit into pagination with computed offset */\nexport function parsePagination(params: {\n page?: string | number\n limit?: string | number\n}): PaginationParams {\n let page =\n typeof params.page === 'string'\n ? Number.parseInt(params.page, 10)\n : (params.page ?? DEFAULT_PAGE)\n let limit =\n typeof params.limit === 'string'\n ? Number.parseInt(params.limit, 10)\n : (params.limit ?? DEFAULT_LIMIT)\n\n if (Number.isNaN(page) || page < 1) page = DEFAULT_PAGE\n if (Number.isNaN(limit) || limit < 1) limit = DEFAULT_LIMIT\n if (limit > MAX_LIMIT) limit = MAX_LIMIT\n\n return { page, limit, offset: (page - 1) * limit }\n}\n\n/** Sanitize and truncate search query */\nexport function parseSearchQuery(q: string | undefined): string {\n if (!q) return ''\n return q.trim().slice(0, MAX_SEARCH_LENGTH)\n}\n\n// ── Config normalizer ───────────────────────────────────────────────────\n\n/**\n * Normalize a QueryFieldConfig into the string-based form.\n * Detects column-object-based configs (DrizzleQueryParamsConfig) by checking\n * for a `columns` property and extracts `Object.keys()`.\n */\nfunction normalizeFieldConfig(config?: QueryFieldConfig): StringQueryFieldConfig | undefined {\n if (!config) return undefined\n\n // Column-object-based config (e.g., DrizzleQueryParamsConfig)\n if ('columns' in config && config.columns && typeof config.columns === 'object') {\n return {\n filterable: Object.keys(config.columns),\n sortable: config.sortable ? Object.keys(config.sortable) : undefined,\n searchable: undefined, // searchColumns are Column objects, not used for string filtering\n }\n }\n\n // Already string-based\n return config as StringQueryFieldConfig\n}\n\n// ── Combined parser ─────────────────────────────────────────────────────\n\n/**\n * Parse a raw Express query object into a structured, ORM-agnostic ParsedQuery.\n *\n * @param query - Raw query string object from `req.query` or Zod-validated object\n * @param fieldConfig - Optional field restrictions (whitelist filterable/sortable/searchable).\n * Accepts both string-based configs (`{ filterable, sortable, searchable }`) and\n * column-object configs (`{ columns, sortable, searchColumns }`).\n *\n * @example\n * ```ts\n * // String-based config\n * const parsed = parseQuery(ctx.query, {\n * filterable: ['status', 'priority'],\n * sortable: ['createdAt', 'title'],\n * })\n *\n * // Column-object config (DrizzleQueryParamsConfig)\n * const parsed = parseQuery(ctx.query, TASK_QUERY_CONFIG)\n * ```\n *\n * Query string format:\n * - Filters: `?filter=field:operator:value` (repeatable)\n * - Sort: `?sort=field:asc|desc` (repeatable)\n * - Pagination: `?page=1&limit=20`\n * - Search: `?q=search+term`\n *\n * Filter operators: eq, neq, gt, gte, lt, lte, between, in, contains, starts, ends\n */\nexport function parseQuery<TConfig extends QueryFieldConfig | undefined = undefined>(\n query: Record<string, any>,\n fieldConfig?: TConfig,\n): TypedParsedQuery<TConfig> {\n const normalized = normalizeFieldConfig(fieldConfig)\n return {\n filters: parseFilters(query.filter, normalized?.filterable),\n sort: parseSort(query.sort, normalized?.sortable),\n pagination: parsePagination({ page: query.page, limit: query.limit }),\n search: parseSearchQuery(query.q),\n } as TypedParsedQuery<TConfig>\n}\n\n// ── Query URL builder (for client-side or testing) ──────────────────────\n\n/** Convert ParsedQuery back into query string parameters */\nexport function buildQueryParams(\n parsed: Partial<ParsedQuery>,\n): Record<string, string | string[] | number> {\n const params: Record<string, string | string[] | number> = {}\n\n if (parsed.filters?.length) {\n params.filter = parsed.filters.map((f) => `${f.field}:${f.operator}:${f.value}`)\n }\n\n if (parsed.sort?.length) {\n params.sort = parsed.sort.map((s) => `${s.field}:${s.direction}`)\n }\n\n if (parsed.pagination) {\n params.page = parsed.pagination.page\n params.limit = parsed.pagination.limit\n }\n\n if (parsed.search) {\n params.q = parsed.search\n }\n\n return params\n}\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,mBAAmB,IAAI,IAAY;CAC9C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;ACdF,MAAM,oBAAoB;AAC1B,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,YAAY;;AAKlB,SAAgB,aACd,aACA,eACc;AACd,KAAI,CAAC,YAAa,QAAO,EAAE;CAE3B,MAAM,QAAQ,MAAM,QAAQ,YAAY,GAAG,cAAc,CAAC,YAAY;CACtE,MAAM,UAAwB,EAAE;CAChC,MAAM,UAAU,gBAAgB,IAAI,IAAI,cAAc,GAAG;AAEzD,MAAK,MAAM,QAAQ,OAAO;EAExB,MAAM,aAAa,KAAK,QAAQ,IAAI;AACpC,MAAI,eAAe,GAAI;EAEvB,MAAM,cAAc,KAAK,QAAQ,KAAK,aAAa,EAAE;AACrD,MAAI,gBAAgB,GAAI;EAExB,MAAM,QAAQ,KAAK,MAAM,GAAG,WAAW;EACvC,MAAM,WAAW,KAAK,MAAM,aAAa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ration } from "./index-Yhs9sTMW.mjs";
|
|
3
3
|
import { Router } from "express";
|
|
4
4
|
|
|
5
5
|
//#region src/http/router-builder.d.ts
|
|
@@ -28,4 +28,4 @@ interface BuildRoutesOptions {
|
|
|
28
28
|
declare function buildRoutes(controllerClass: any, options?: BuildRoutesOptions): Router;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { _setExternalContributorSources as n, buildRoutes as r, BuildRoutesOptions as t };
|
|
31
|
-
//# sourceMappingURL=router-builder-
|
|
31
|
+
//# sourceMappingURL=router-builder-zsX4Oq7c.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-builder-
|
|
1
|
+
{"version":3,"file":"router-builder-zsX4Oq7c.d.mts","names":[],"sources":["../src/http/router-builder.ts"],"mappings":";;;;;;iBAoCgB,8BAAA,CAA+B,OAAA,WAAkB,mBAAA;AAAA,UAIhD,kBAAA;EAJ6B;;;;AAI9C;;EAOE,eAAA,YAA2B,mBAAA;AAAA;;AAc7B;;;;;;;;;;iBAAgB,WAAA,CAAY,eAAA,OAAsB,OAAA,GAAS,kBAAA,GAA0B,MAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { r as AppAdapter, t as AdapterContext } from "./adapter-
|
|
2
|
+
import { r as AppAdapter, t as AdapterContext } from "./adapter-6Pp4kFdM.mjs";
|
|
3
3
|
//#region src/http/middleware/spa.d.ts
|
|
4
4
|
interface SpaAdapterOptions {
|
|
5
5
|
/**
|
|
@@ -98,4 +98,4 @@ declare class SpaAdapter implements AppAdapter {
|
|
|
98
98
|
}
|
|
99
99
|
//#endregion
|
|
100
100
|
export { SpaAdapterOptions as n, SpaAdapter as t };
|
|
101
|
-
//# sourceMappingURL=spa-
|
|
101
|
+
//# sourceMappingURL=spa-CwIbdvPc.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spa-
|
|
1
|
+
{"version":3,"file":"spa-CwIbdvPc.d.mts","names":[],"sources":["../src/http/middleware/spa.ts"],"mappings":";;;UAMiB,iBAAA;;;AAAjB;;;;;;;;;;;EAcE,SAAA;EAqEsB;;;;;;;;;;EAzDtB,SAAA;EAkEoB;;;;;;;;;EAvDpB,OAAA;EAuDoB;;;;EAjDpB,YAAA;EAoGA;;;;EA9FA,iBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkCW,UAAA,YAAsB,UAAA;EAAA,QASb,OAAA;EARpB,IAAA;EAAA,QACQ,SAAA;EAAA,QACA,WAAA;EAAA,QACA,YAAA;EAAA,QACA,YAAA;EAAA,QACA,iBAAA;EAAA,QACA,SAAA;cAEY,OAAA,GAAS,iBAAA;EAU7B,WAAA,CAAA;IAAc;EAAA,GAAO,cAAA;EAyCrB,WAAA,CAAA;IAAc;EAAA,GAAO,cAAA;AAAA"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { r as MetaValue } from "./execution-context-DKnt61pY.mjs";
|
|
3
|
+
import { n as ContextDecorator, r as ContextDecoratorSpec, s as DepValue } from "./context-decorator-DrPvQ9Ag.mjs";
|
|
4
|
+
import { n as AdapterFactory } from "./index-Yhs9sTMW.mjs";
|
|
5
|
+
import { n as RequestContext } from "./context-Ymvv-85x.mjs";
|
|
3
6
|
import { NextFunction, Request, Response } from "express";
|
|
4
7
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
8
|
|
|
@@ -19,6 +22,9 @@ interface ClusterOptions {
|
|
|
19
22
|
/** Returns true if the current process is the cluster primary */
|
|
20
23
|
declare function isClusterPrimary(): boolean;
|
|
21
24
|
//#endregion
|
|
25
|
+
//#region src/http/define-http-context-decorator.d.ts
|
|
26
|
+
declare function defineHttpContextDecorator<K extends string, D extends Record<string, DepValue> = Record<string, never>>(spec: ContextDecoratorSpec<K, D, RequestContext>): ContextDecorator<K, D, RequestContext>;
|
|
27
|
+
//#endregion
|
|
22
28
|
//#region src/http/request-store.d.ts
|
|
23
29
|
/** Per-request storage for REQUEST-scoped DI and request context propagation */
|
|
24
30
|
interface RequestStore {
|
|
@@ -41,6 +47,14 @@ interface RequestStore {
|
|
|
41
47
|
* `architecture.md` §20.12 (#4); the value type is `unknown` because
|
|
42
48
|
* the concrete shape at each key is determined by the consumer's
|
|
43
49
|
* `ContextMeta` augmentation, not by the store itself.
|
|
50
|
+
*
|
|
51
|
+
* Prefer the {@link getRequestValue} helper over reaching into this
|
|
52
|
+
* map directly — it threads the augmented `ContextMeta` shape through
|
|
53
|
+
* `MetaValue<K>` so consumers get typed reads without an `as` cast.
|
|
54
|
+
* Writes should flow through `ctx.set(key, value)` or a Context
|
|
55
|
+
* Contributor's return value — see the `setRequestValue` note below
|
|
56
|
+
* for why this package intentionally does NOT ship a service-level
|
|
57
|
+
* write helper.
|
|
44
58
|
*/
|
|
45
59
|
values: Map<string, unknown>;
|
|
46
60
|
}
|
|
@@ -51,6 +65,33 @@ declare const requestStore: AsyncLocalStorage<RequestStore>;
|
|
|
51
65
|
* Used by the Container to resolve REQUEST-scoped dependencies.
|
|
52
66
|
*/
|
|
53
67
|
declare function getRequestStore(): RequestStore;
|
|
68
|
+
/**
|
|
69
|
+
* Read a per-request `ContextMeta`-keyed value from outside a controller
|
|
70
|
+
* (services, repositories, anywhere with no `ctx` reference). Returns
|
|
71
|
+
* the augmented type for the key — `MetaValue<K>` — so consumers get the
|
|
72
|
+
* same static safety as `ctx.get(key)` without holding the context.
|
|
73
|
+
*
|
|
74
|
+
* Returns `undefined` outside an active request frame (background jobs,
|
|
75
|
+
* startup code, tests without `requestScopeMiddleware()`) — the helper
|
|
76
|
+
* is intentionally null-tolerant so calling it from a service that
|
|
77
|
+
* runs in both request and non-request paths doesn't throw.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* declare module '@forinda/kickjs' {
|
|
82
|
+
* interface ContextMeta { tenant: { id: string; name: string } }
|
|
83
|
+
* }
|
|
84
|
+
*
|
|
85
|
+
* @Service()
|
|
86
|
+
* class AuditService {
|
|
87
|
+
* log(action: string) {
|
|
88
|
+
* const tenant = getRequestValue('tenant') // typed: { id; name } | undefined
|
|
89
|
+
* db.audit.insert({ action, tenantId: tenant?.id })
|
|
90
|
+
* }
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
declare function getRequestValue<K extends string>(key: K): MetaValue<K> | undefined;
|
|
54
95
|
//#endregion
|
|
55
96
|
//#region src/http/middleware/request-scope.d.ts
|
|
56
97
|
/**
|
|
@@ -172,5 +213,5 @@ interface ViewAdapterOptions {
|
|
|
172
213
|
*/
|
|
173
214
|
declare const ViewAdapter: AdapterFactory<ViewAdapterOptions, unknown>;
|
|
174
215
|
//#endregion
|
|
175
|
-
export { TraceContextOptions as a, requestScopeMiddleware as c,
|
|
176
|
-
//# sourceMappingURL=views-
|
|
216
|
+
export { TraceContextOptions as a, requestScopeMiddleware as c, getRequestValue as d, requestStore as f, isClusterPrimary as h, TraceContext as i, RequestStore as l, ClusterOptions as m, ViewAdapterOptions as n, parseTraceparent as o, defineHttpContextDecorator as p, TRACEPARENT_HEADER as r, traceContext as s, ViewAdapter as t, getRequestStore as u };
|
|
217
|
+
//# sourceMappingURL=views-DhuvHYPA.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views-DhuvHYPA.d.mts","names":[],"sources":["../src/http/cluster.ts","../src/http/define-http-context-decorator.ts","../src/http/request-store.ts","../src/http/middleware/request-scope.ts","../src/http/middleware/trace-context.ts","../src/http/middleware/views.ts"],"mappings":";;;;;;;;;UAOiB,cAAA;;EAEf,OAAA;;EAEA,uBAAA;;EAEA,YAAA;;EAEA,WAAA;;EAEA,aAAA;AAAA;;iBAIc,gBAAA,CAAA;;;iBCmBA,0BAAA,6BAEJ,MAAA,SAAe,QAAA,IAAY,MAAA,gBAAA,CACrC,IAAA,EAAM,oBAAA,CAAqB,CAAA,EAAG,CAAA,EA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