@forinda/kickjs 9.2.0 → 10.1.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.
Files changed (164) hide show
  1. package/dist/{adapter-DjfRMob8.d.mts → adapter-ClEh-Oos.d.mts} +24 -2
  2. package/dist/adapter-ClEh-Oos.d.mts.map +1 -0
  3. package/dist/application-Dv514EeR.mjs +12 -0
  4. package/dist/application-Dv514EeR.mjs.map +1 -0
  5. package/dist/{application-CGxZCYl1.d.mts → application-oIPzgjfk.d.mts} +38 -11
  6. package/dist/application-oIPzgjfk.d.mts.map +1 -0
  7. package/dist/bootstrap-BdyBlBMe.mjs +12 -0
  8. package/dist/bootstrap-BdyBlBMe.mjs.map +1 -0
  9. package/dist/{client-ip-pcINkkPr.mjs → client-ip-BbLDp03S.mjs} +2 -2
  10. package/dist/{client-ip-pcINkkPr.mjs.map → client-ip-BbLDp03S.mjs.map} +1 -1
  11. package/dist/config/index.mjs +2 -2
  12. package/dist/{config-DmGiAIuH.mjs → config-CJiGeOca.mjs} +3 -3
  13. package/dist/{config-DmGiAIuH.mjs.map → config-CJiGeOca.mjs.map} +1 -1
  14. package/dist/{container-CAPN7pBG.mjs → container-CS9v9UFU.mjs} +4 -4
  15. package/dist/{container-CAPN7pBG.mjs.map → container-CS9v9UFU.mjs.map} +1 -1
  16. package/dist/context-CtL9RxXp.mjs +12 -0
  17. package/dist/context-CtL9RxXp.mjs.map +1 -0
  18. package/dist/{context-errors-DYJjhalQ.mjs → context-errors-7C5TBYn7.mjs} +2 -2
  19. package/dist/{context-errors-DYJjhalQ.mjs.map → context-errors-7C5TBYn7.mjs.map} +1 -1
  20. package/dist/contributor-runner-DBpRR5dl.mjs +12 -0
  21. package/dist/{contributor-runner-vk9XlOED.mjs.map → contributor-runner-DBpRR5dl.mjs.map} +1 -1
  22. package/dist/core/adapter.d.mts +1 -1
  23. package/dist/core/adapter.mjs +1 -1
  24. package/dist/core/app-module.mjs +1 -1
  25. package/dist/core/cache.mjs +2 -2
  26. package/dist/core/cache.mjs.map +1 -1
  27. package/dist/core/container.mjs +2 -2
  28. package/dist/core/cron.mjs +2 -2
  29. package/dist/core/cron.mjs.map +1 -1
  30. package/dist/core/decorators.mjs +2 -2
  31. package/dist/core/decorators.mjs.map +1 -1
  32. package/dist/core/errors.mjs +1 -1
  33. package/dist/core/interfaces.mjs +2 -2
  34. package/dist/core/interfaces.mjs.map +1 -1
  35. package/dist/core/logger.mjs +2 -2
  36. package/dist/core/logger.mjs.map +1 -1
  37. package/dist/core/path.mjs +1 -1
  38. package/dist/core/plugin.d.mts +1 -1
  39. package/dist/core/plugin.mjs +1 -1
  40. package/dist/core/reactivity.mjs +2 -2
  41. package/dist/core/reactivity.mjs.map +1 -1
  42. package/dist/core-B0JmdBvX.mjs +12 -0
  43. package/dist/{core-DKrKVLfj.mjs.map → core-B0JmdBvX.mjs.map} +1 -1
  44. package/dist/{csrf-CxJItZVa.mjs → csrf--1t4qDov.mjs} +3 -3
  45. package/dist/{csrf-CxJItZVa.mjs.map → csrf--1t4qDov.mjs.map} +1 -1
  46. package/dist/{decorate-DfH1NIqV.mjs → decorate-BHkdkV4l.mjs} +1 -1
  47. package/dist/{define-adapter-C6lFhCL-.mjs → define-adapter-BLKlUbSL.mjs} +2 -2
  48. package/dist/{define-adapter-C6lFhCL-.mjs.map → define-adapter-BLKlUbSL.mjs.map} +1 -1
  49. package/dist/disposables-CuY2S3bw.mjs +12 -0
  50. package/dist/{disposables-NlW6Mibk.mjs.map → disposables-CuY2S3bw.mjs.map} +1 -1
  51. package/dist/env-BwzF9MkZ.mjs +13 -0
  52. package/dist/env-BwzF9MkZ.mjs.map +1 -0
  53. package/dist/{error-handler-itG65lj0.d.mts → error-handler-BB9wAElm.d.mts} +2 -2
  54. package/dist/{error-handler-itG65lj0.d.mts.map → error-handler-BB9wAElm.d.mts.map} +1 -1
  55. package/dist/handler-zKfIgNo4.mjs +13 -0
  56. package/dist/handler-zKfIgNo4.mjs.map +1 -0
  57. package/dist/http/application.d.mts +1 -1
  58. package/dist/http/application.mjs +2 -2
  59. package/dist/http/bootstrap.d.mts +1 -1
  60. package/dist/http/bootstrap.mjs +2 -2
  61. package/dist/http/context.d.mts +1 -1
  62. package/dist/http/context.mjs +2 -2
  63. package/dist/http/middleware/cors.mjs +2 -2
  64. package/dist/http/middleware/cors.mjs.map +1 -1
  65. package/dist/http/middleware/csrf.mjs +2 -2
  66. package/dist/http/middleware/error-handler.d.mts +1 -1
  67. package/dist/http/middleware/error-handler.mjs +2 -2
  68. package/dist/http/middleware/helmet.mjs +1 -1
  69. package/dist/http/middleware/rate-limit.mjs +2 -2
  70. package/dist/http/middleware/rate-limit.mjs.map +1 -1
  71. package/dist/http/middleware/request-id.mjs +1 -1
  72. package/dist/http/middleware/request-logger.mjs +2 -2
  73. package/dist/http/middleware/session.d.mts +1 -1
  74. package/dist/http/middleware/session.mjs +2 -2
  75. package/dist/http/middleware/session.mjs.map +1 -1
  76. package/dist/http/middleware/spa.d.mts +1 -1
  77. package/dist/http/middleware/spa.mjs +2 -2
  78. package/dist/http/middleware/spa.mjs.map +1 -1
  79. package/dist/http/middleware/upload.d.mts +1 -1
  80. package/dist/http/middleware/upload.mjs +2 -2
  81. package/dist/http/middleware/validate.mjs +1 -1
  82. package/dist/http/middleware/views.d.mts +1 -1
  83. package/dist/http/middleware/views.mjs +2 -2
  84. package/dist/http/middleware/views.mjs.map +1 -1
  85. package/dist/http/query/index.mjs +2 -2
  86. package/dist/http/router-builder.d.mts +1 -1
  87. package/dist/http/router-builder.mjs +2 -2
  88. package/dist/http/runtimes/fastify.d.mts +2 -1
  89. package/dist/http/runtimes/fastify.d.mts.map +1 -1
  90. package/dist/http/runtimes/fastify.mjs +3 -3
  91. package/dist/http/runtimes/fastify.mjs.map +1 -1
  92. package/dist/http/runtimes/h3-web.d.mts +2 -49
  93. package/dist/http/runtimes/h3-web.mjs +2 -3
  94. package/dist/http/runtimes/h3.d.mts +48 -18
  95. package/dist/http/runtimes/h3.d.mts.map +1 -1
  96. package/dist/http/runtimes/h3.mjs +2 -2
  97. package/dist/http/runtimes/h3.mjs.map +1 -1
  98. package/dist/index.d.mts +8 -8
  99. package/dist/index.mjs +2 -2
  100. package/dist/index.mjs.map +1 -1
  101. package/dist/jobs-BQ4t3TAb.mjs +12 -0
  102. package/dist/{jobs-BmpeFvi0.mjs.map → jobs-BQ4t3TAb.mjs.map} +1 -1
  103. package/dist/{kv-stores-BZTe23Tw.d.mts → kv-stores-Co5k2PYA.d.mts} +21 -6
  104. package/dist/kv-stores-Co5k2PYA.d.mts.map +1 -0
  105. package/dist/kv-stores-DsfVy2fk.mjs +12 -0
  106. package/dist/{kv-stores-DJwxntyw.mjs.map → kv-stores-DsfVy2fk.mjs.map} +1 -1
  107. package/dist/{metadata-CzzRUnAx.mjs → metadata-zvd6AWkE.mjs} +3 -3
  108. package/dist/{metadata-CzzRUnAx.mjs.map → metadata-zvd6AWkE.mjs.map} +1 -1
  109. package/dist/{module-registry-BnmRNy-3.mjs → module-registry-Daf_P2oD.mjs} +2 -2
  110. package/dist/{module-registry-BnmRNy-3.mjs.map → module-registry-Daf_P2oD.mjs.map} +1 -1
  111. package/dist/{observers-COlQfinD.mjs → observers-DZgs48UM.mjs} +2 -2
  112. package/dist/{observers-COlQfinD.mjs.map → observers-DZgs48UM.mjs.map} +1 -1
  113. package/dist/query-B_k9qn0R.mjs +12 -0
  114. package/dist/{query-B5DTq_4W.mjs.map → query-B_k9qn0R.mjs.map} +1 -1
  115. package/dist/reply-BDK9xt7Z.mjs +12 -0
  116. package/dist/{reply-CbTYIj_e.mjs.map → reply-BDK9xt7Z.mjs.map} +1 -1
  117. package/dist/{respond-wbMSqHYo.mjs → respond-DFRj2-7q.mjs} +3 -3
  118. package/dist/{respond-wbMSqHYo.mjs.map → respond-DFRj2-7q.mjs.map} +1 -1
  119. package/dist/route-flag-BWuvJsGZ.mjs +12 -0
  120. package/dist/{route-flag-Bb7n9Mnp.mjs.map → route-flag-BWuvJsGZ.mjs.map} +1 -1
  121. package/dist/route-policy-B3vM6bSf.mjs +12 -0
  122. package/dist/{route-policy-C_Wsc-b1.mjs.map → route-policy-B3vM6bSf.mjs.map} +1 -1
  123. package/dist/router-builder-JvMTp50k.mjs +12 -0
  124. package/dist/{router-builder-DawnRzlp.mjs.map → router-builder-JvMTp50k.mjs.map} +1 -1
  125. package/dist/{router-builder-CDkW88KQ.d.mts → router-builder-zWuVIOmd.d.mts} +2 -2
  126. package/dist/{router-builder-CDkW88KQ.d.mts.map → router-builder-zWuVIOmd.d.mts.map} +1 -1
  127. package/dist/{session-4Tb6q0Ny.d.mts → session-B4hOZj90.d.mts} +13 -4
  128. package/dist/session-B4hOZj90.d.mts.map +1 -0
  129. package/dist/{upload-Cy7qQy7M.d.mts → upload-CiMtdXWD.d.mts} +2 -2
  130. package/dist/upload-CiMtdXWD.d.mts.map +1 -0
  131. package/dist/{upload-config-D01Ty40f.mjs → upload-config-Dz2INCaa.mjs} +2 -2
  132. package/dist/{upload-config-D01Ty40f.mjs.map → upload-config-Dz2INCaa.mjs.map} +1 -1
  133. package/dist/web.d.mts +9 -7
  134. package/dist/web.d.mts.map +1 -1
  135. package/dist/web.mjs +2 -2
  136. package/dist/web.mjs.map +1 -1
  137. package/package.json +7 -8
  138. package/dist/adapter-DjfRMob8.d.mts.map +0 -1
  139. package/dist/application-BSJpaiSY.mjs +0 -12
  140. package/dist/application-BSJpaiSY.mjs.map +0 -1
  141. package/dist/application-CGxZCYl1.d.mts.map +0 -1
  142. package/dist/bootstrap-CbTF6xvv.mjs +0 -12
  143. package/dist/bootstrap-CbTF6xvv.mjs.map +0 -1
  144. package/dist/context-gpvcMlG5.mjs +0 -12
  145. package/dist/context-gpvcMlG5.mjs.map +0 -1
  146. package/dist/contributor-runner-vk9XlOED.mjs +0 -12
  147. package/dist/core-DKrKVLfj.mjs +0 -12
  148. package/dist/disposables-NlW6Mibk.mjs +0 -12
  149. package/dist/env-__fzPsHD.mjs +0 -13
  150. package/dist/env-__fzPsHD.mjs.map +0 -1
  151. package/dist/handler-DnZbcleS.mjs +0 -13
  152. package/dist/handler-DnZbcleS.mjs.map +0 -1
  153. package/dist/http/runtimes/h3-web.d.mts.map +0 -1
  154. package/dist/http/runtimes/h3-web.mjs.map +0 -1
  155. package/dist/jobs-BmpeFvi0.mjs +0 -12
  156. package/dist/kv-stores-BZTe23Tw.d.mts.map +0 -1
  157. package/dist/kv-stores-DJwxntyw.mjs +0 -12
  158. package/dist/query-B5DTq_4W.mjs +0 -12
  159. package/dist/reply-CbTYIj_e.mjs +0 -12
  160. package/dist/route-flag-Bb7n9Mnp.mjs +0 -12
  161. package/dist/route-policy-C_Wsc-b1.mjs +0 -12
  162. package/dist/router-builder-DawnRzlp.mjs +0 -12
  163. package/dist/session-4Tb6q0Ny.d.mts.map +0 -1
  164. package/dist/upload-Cy7qQy7M.d.mts.map +0 -1
@@ -1,28 +1,58 @@
1
1
 
2
- import { p as HttpRuntime } from "../../adapter-DjfRMob8.mjs";
2
+ import { p as HttpRuntime } from "../../adapter-ClEh-Oos.mjs";
3
+ import { IncomingMessage, ServerResponse } from "node:http";
3
4
  //#region src/http/runtimes/h3.d.ts
4
5
  interface H3AppLike {
5
- use(arg1: unknown, arg2?: unknown): unknown;
6
- handler: unknown;
6
+ on(method: string, path: string, handler: (event: H3EventLike) => unknown): unknown;
7
+ all(path: string, handler: (event: H3EventLike) => unknown): unknown;
8
+ use(...args: unknown[]): unknown;
9
+ fetch(request: Request): Promise<Response>;
7
10
  }
8
- export declare function h3Runtime(): HttpRuntime<H3AppLike>;
11
+ interface H3EventLike {
12
+ req: Request & {
13
+ runtime?: {
14
+ node?: {
15
+ req: IncomingMessage;
16
+ res: ServerResponse;
17
+ };
18
+ };
19
+ };
20
+ url: URL;
21
+ context: {
22
+ params?: Record<string, string>;
23
+ };
24
+ }
25
+ export interface H3RuntimeOptions {
26
+ /**
27
+ * Pre-imported h3 module, for when the app's `h3` is not the one this
28
+ * package resolves (a linked checkout, a bundler):
29
+ * `h3Runtime({ h3: await import('h3') })`.
30
+ * Omitted → the installed `h3` peer.
31
+ */
32
+ h3?: unknown;
33
+ }
34
+ /**
35
+ * The h3 HTTP runtime. Pass to `bootstrap({ runtime: h3Runtime() })`.
36
+ * Requires the h3 v2 peer; fails fast with guidance when v1 is installed.
37
+ */
38
+ export declare function h3Runtime(options?: H3RuntimeOptions): HttpRuntime<H3AppLike>;
9
39
  /**
10
- * The h3 runtime's engine-native types — what the runtime-typed escape hatches
11
- * resolve to once the `kick/runtime` typegen emits a `KickRuntimeRegister`
12
- * augmentation pointing here (spec §4.3b). `AdapterContext.app` / `getRuntimeApp()`
13
- * become the h3 `App`; `ctx.req` / `ctx.res` the per-request `H3Event` (h3 v1
14
- * routes everything through the event). Mirrors `ExpressRuntimeTypes`.
40
+ * The h3 runtime's engine-native types, for the `kick/runtime` typegen
41
+ * augmentation. Mirrors `ExpressRuntimeTypes`.
15
42
  */
16
- type H3AppType = typeof import('h3') extends {
17
- App: infer A;
18
- } ? A : unknown;
19
- type H3EventType = typeof import('h3') extends {
20
- H3Event: new (...args: never[]) => infer E;
21
- } ? E : unknown;
22
43
  export interface H3RuntimeTypes {
23
- request: H3EventType;
24
- response: H3EventType;
25
- app: H3AppType;
44
+ request: Request;
45
+ response: Response;
46
+ app: typeof import('h3') extends {
47
+ H3: new (...args: never[]) => infer A;
48
+ } ? A : unknown;
26
49
  }
50
+ /** @deprecated Use {@link h3Runtime} — the same runtime. Removed in the next major. */
51
+ export declare const h3WebRuntime: typeof h3Runtime;
52
+ /** @deprecated Use {@link H3RuntimeOptions}. */
53
+ export type H3WebRuntimeOptions = H3RuntimeOptions;
54
+ /** @deprecated Use {@link H3RuntimeTypes}. */
55
+ export type H3WebRuntimeTypes = H3RuntimeTypes;
27
56
  //#endregion
57
+ export {};
28
58
  //# sourceMappingURL=h3.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"h3.d.mts","names":[],"sources":["../../../src/http/runtimes/h3.ts"],"mappings":";;;UA+CU;EACR,IAAI,eAAe;EACnB;;wBAoSc,aAAa,YAAY;;;;;;;;KAiJpC;EAA0C,WAAW;IAAM;KAC3D;EAA4C,iBAAiB,wBAAwB;IACtF;iBAGa;EACf,SAAS;EACT,UAAU;EACV,KAAK"}
1
+ {"version":3,"file":"h3.d.mts","names":[],"sources":["../../../src/http/runtimes/h3.ts"],"mappings":";;;;UA+CU;EACR,GAAG,gBAAgB,cAAc,UAAU,OAAO;EAClD,IAAI,cAAc,UAAU,OAAO;EACnC,OAAO;EACP,MAAM,SAAS,UAAU,QAAQ;;UAEzB;EACR,KAAK;IAAY;MAAY;QAAS,KAAK;QAAiB,KAAK;;;;EACjE,KAAK;EACL;IAAW,SAAS;;;iBASL;;;;;;;EAOf;;;;;;wBA8Yc,UAAU,UAAS,mBAAwB,YAAY;;;;;iBA+JtD;EACf,SAAS;EACT,UAAU;EACV;IAAmC,YAAY,wBAAwB;MAAM;;;qBAYlE,qBAAY;;YAEb,sBAAsB;;YAEtB,oBAAoB"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v9.2.0
2
+ * @forinda/kickjs v10.1.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{HttpException}from"../../core/errors.mjs";import{a as disposeRequestStore,d as unsupportedMediaTypeError,i as createRequestStore,l as classifyMediaType,t as applyHandlerResult}from"../../reply-CbTYIj_e.mjs";import{d as requestStore,i as stringifyJson,r as publishMatchedRoute,t as RequestContext}from"../../context-gpvcMlG5.mjs";import{validate}from"../middleware/validate.mjs";import{t as applyUploadConfig}from"../../upload-config-D01Ty40f.mjs";import"../middleware/upload.mjs";import{createRequire}from"node:module";const peerRequire=createRequire(import.meta.url),h3=()=>peerRequire(`h3`),NEXT=Symbol(`kickjs.h3.next`),ERROR_MW=Symbol(`kickjs.h3.errorMw`),ROUTER=Symbol(`kickjs.h3.router`),NOTFOUND_MW=Symbol(`kickjs.h3.notFoundMw`),ASSEMBLED=Symbol(`kickjs.h3.assembled`),NOOP_NEXT=()=>{},BODY_METHODS=new Set([`POST`,`PUT`,`PATCH`,`DELETE`]);var NodeResDriver=class{res;constructor(res){this.res=res}status(code){return this.res.statusCode=code,this}json(data){return!this.res.headersSent&&!this.res.getHeader(`content-type`)&&this.res.setHeader(`content-type`,`application/json; charset=utf-8`),this.res.end(stringifyJson(data)),this}send(data){return this.res.end(data),this}type(contentType){return this.res.setHeader(`content-type`,contentType),this}setHeader(name,value){return this.res.setHeader(name,value),this}render(){throw Error(`ctx.render() is not supported on the h3 runtime (no view engine).`)}writeHead(statusCode,headers){return this.res.writeHead(statusCode,headers),this}flushHeaders(){return this.res.flushHeaders(),this}write(chunk){return this.res.write(chunk)}end(data){return this.res.end(data),this}once(event,listener){return this.res.once(event,listener),this}get headersSent(){return this.res.headersSent}};function resDriver(res){return new NodeResDriver(res)}const TRUST_PROXY=Symbol(`kickjs.h3.trustProxy`);function makeEventHandler(entry,trustProxy){let{getRouterParams,getQuery,readRawBody,readMultipartFormData}=h3(),upload=entry.meta.upload,validator=entry.meta.validation?validate(entry.meta.validation):void 0;return async event=>{let req=event.node.req,res=event.node.res;if(trustProxy&&!req.ip){let forwarded=req.headers[`x-forwarded-for`],first=(Array.isArray(forwarded)?forwarded[0]:forwarded)?.split(`,`)[0]?.trim();first&&(req.ip=first)}if(req.params=getRouterParams(event)??{},req.query=getQuery(event)??{},req.httpVersionMajor===2&&req.headers[`content-length`]===void 0&&BODY_METHODS.has(req.method??`GET`)&&(req.rawBody=await readStreamBuffer(req)),upload&&upload.mode!==`none`){let form=await readMultipartFormData(event).catch(()=>void 0),rawParts=[],fields={};for(let part of form??[])part.filename?rawParts.push({fieldname:part.name??``,filename:part.filename,mimetype:part.type??`application/octet-stream`,buffer:part.data}):part.name&&(fields[part.name]=part.data.toString(`utf-8`));let{file,files}=applyUploadConfig(rawParts,upload);req.file=file,req.files=files,req.body=fields}else if(BODY_METHODS.has(req.method??`GET`)){let{"content-length":length,"transfer-encoding":encoding}=req.headers;if(encoding!==void 0||length!==void 0&&length!==`0`||req.httpVersionMajor===2&&length!==`0`){let kind=classifyMediaType(req.headers[`content-type`]);if(kind!==`multipart`){let raw=await readRawBody(event,`utf8`);if(raw){if(kind===`unsupported`)throw unsupportedMediaTypeError(req.headers[`content-type`]);if(kind===`json`)try{req.body=JSON.parse(raw)}catch(err){throw HttpException.badRequest(err instanceof Error?err.message:`Request body could not be parsed`)}else req.body=kind===`urlencoded`?Object.fromEntries(new URLSearchParams(raw)):raw}}}}let headerId=req.headers[`x-request-id`],requestId=(Array.isArray(headerId)?headerId[0]:headerId)||req.requestId,store=createRequestStore(requestId);req.requestId=store.requestId,res.once(`close`,()=>disposeRequestStore(store)),await requestStore.run(store,async()=>{publishMatchedRoute(req,entry);let ctx=new RequestContext(req,res,NOOP_NEXT,resDriver(res));if(entry.earlyContributorRunner&&(await entry.earlyContributorRunner(ctx),res.writableEnded))return;validator&&await new Promise((resolve,reject)=>{validator(req,void 0,err=>err?reject(err):resolve())});for(let mw of entry.middlewares){let advanced=!1;if(await new Promise((resolve,reject)=>{Promise.resolve(mw(ctx,err=>{advanced=!0,err?reject(err):resolve()})).catch(reject)}),!advanced||res.writableEnded)return}if(entry.contributorRunner&&await entry.contributorRunner(ctx),res.writableEnded)return;let result=await entry.handler(ctx);!res.writableEnded&&!res.headersSent&&applyHandlerResult(ctx,result)})}}function unwrapH3Error(error){if(!(error instanceof Error))return error;let{cause}=error;return cause instanceof Error?cause:error}async function readStreamBuffer(req){let chunks=[];for await(let chunk of req)chunks.push(typeof chunk==`string`?Buffer.from(chunk):chunk);return Buffer.concat(chunks)}function h3Runtime(){return{name:`h3`,createApp(options={}){let{createApp}=h3(),app=createApp({onError:(error,event)=>{let res=event.node.res;if(res.writableEnded)return;let state=app,status=error?.statusCode,thrownByHandler=error?.cause instanceof Error;if(status===404&&!thrownByHandler){let next=event.node.req[NEXT];if(next){next();return}let nf=state[NOTFOUND_MW];if(nf){nf(event.node.req,resDriver(res),NOOP_NEXT);return}}let mw=state[ERROR_MW];mw&&mw(unwrapH3Error(error),event.node.req,resDriver(res),NOOP_NEXT)}});return app[TRUST_PROXY]=options.trustProxy,app},nodeHandler(app){let{toNodeListener}=h3(),state=app;state[ASSEMBLED]||(state[ASSEMBLED]=!0,state[ROUTER]&&app.use(state[ROUTER]));let listener=toNodeListener(app);return(req,res,next)=>{next&&(req[NEXT]=next),Promise.resolve(listener(req,res)).catch(err=>{next&&next(err)})}},mountRoutes(app,table){let{createRouter,eventHandler}=h3(),trustProxy=!!app[TRUST_PROXY],state=app;state[ROUTER]||(state[ROUTER]=createRouter());let router=state[ROUTER];for(let{mountPath,routes}of table)for(let entry of routes){let url=joinPath(mountPath,entry.path);router[entry.method.toLowerCase()](url,eventHandler(makeEventHandler(entry,trustProxy)))}},useConnect(app,mw,opts){let{fromNodeMiddleware}=h3(),handler=fromNodeMiddleware(mw);opts?.path===void 0?app.use(handler):app.use(opts.path,handler)},serveStatic(app,prefix,dir){let serveStatic=peerRequire(`serve-static`);this.useConnect(app,serveStatic(dir),{path:prefix})},setNotFound(app,mw){app[NOTFOUND_MW]=mw},setErrorHandler(app,mw){app[ERROR_MW]=mw},capabilities:{render:!1,uploads:!0,connectMiddleware:!0,nativeBodyParsing:!0,http2:!0}}}function joinPath(mountPath,path){let a=mountPath.endsWith(`/`)?mountPath.slice(0,-1):mountPath;return path===`/`||path===``?a===``?`/`:a:`${a}${path.startsWith(`/`)?path:`/${path}`}`}export{h3Runtime};
11
+ import{createLogger,describeError}from"../../core/logger.mjs";import{i as WebResponseDriver,n as readThrough,r as WebRequestShim,t as compileWebRoute}from"../../handler-zKfIgNo4.mjs";import{createRequire}from"node:module";const log=createLogger(`H3Runtime`),peerRequire=createRequire(import.meta.url),NOTFOUND_MW=Symbol(`kickjs.h3web.notFoundMw`),ERROR_MW=Symbol(`kickjs.h3web.errorMw`),ASSEMBLED=Symbol(`kickjs.h3web.assembled`),NOOP_NEXT=()=>{},NEXT=Symbol(`kickjs.h3web.next`),NO_FALLTHROUGH=Symbol(`kickjs.h3web.noFallthrough`),TRUST_PROXY=Symbol(`kickjs.h3.trustProxy`),H3_HANDLED=Symbol.for(`h3.handled`);function unwrapH3Module(mod){let m=mod;return m&&m.__esModule&&m.default?{...m.default,...m}:m}function loadH3v2(injected){let resolved=unwrapH3Module(injected??peerRequire(`h3`));if(typeof resolved.H3!=`function`)throw Error("@forinda/kickjs: h3Runtime() requires h3 v2, but the installed h3 has no H3 class — that is the v1 line, which this version of KickJS no longer supports. Upgrade: `pnpm add h3@^2`.");return resolved}async function runConnectTerminal(mw,event,err){let shim=new WebRequestShim(event.req,event.url),carry=event.req.runtime?.node?.req??FETCH_CONNECT.get(event)?.req,req=carry?readThrough(shim,carry):shim,driver=new WebResponseDriver(event.req.signal);if(mw){let returned=err===void 0?mw(req,driver,NOOP_NEXT):mw(err,req,driver,NOOP_NEXT);if(typeof returned?.then==`function`)try{await returned}catch(handlerErr){driver.settled||(log.error(handlerErr,`h3: the ${err===void 0?`not-found`:`error`} handler failed`),driver.status(500).json({error:`Internal Server Error`}))}}return driver.settled||(err===void 0?driver.status(404).json({error:`Not Found`}):(log.error(err,`h3: error handler did not settle the response — ${describeError(err)}`),driver.status(500).json({error:`Internal Server Error`,...typeof process<`u`&&process.env?.NODE_ENV===`production`?{}:{message:describeError(err)}}))),driver.ready}const FETCH_CONNECT=/* @__PURE__ */ new WeakMap;function fetchConnectState(event){let state=FETCH_CONNECT.get(event);return state||(state={req:new WebRequestShim(event.req,event.url),headers:new Headers},FETCH_CONNECT.set(event,state)),state}function withConnectHeaders(event,response){let state=FETCH_CONNECT.get(event);if(!state)return response;let missing=[...state.headers].filter(([name])=>name===`set-cookie`||!response.headers.has(name));if(state.headers=new Headers,missing.length===0)return response;try{for(let[name,value]of missing)response.headers.append(name,value);return response}catch{let headers=new Headers(response.headers);for(let[name,value]of missing)headers.append(name,value);return new Response(response.body,{status:response.status,statusText:response.statusText,headers})}}var FetchConnectResponse=class extends WebResponseDriver{prepared;code=200;listeners=[];constructor(prepared,signal){super(signal),this.prepared=prepared}get statusCode(){return this.code}set statusCode(code){this.status(code)}status(code){return this.code=code,super.status(code)}writeHead(code,headers){return this.code=code,super.writeHead(code,headers)}setHeader(name,value){if(Array.isArray(value)){this.prepared.delete(name);for(let v of value)this.prepared.append(name,String(v))}else this.prepared.set(name,String(value));return this}getHeader(name){return this.prepared.get(name)??void 0}hasHeader(name){return this.prepared.has(name)}removeHeader(name){this.prepared.delete(name)}once(event,listener){return this.listeners.push([event,listener]),this}on(event,listener){return this.once(event,listener)}removeListener(event,listener){return this.listeners=this.listeners.filter(([e,l])=>e!==event||l!==listener),this}off(event,listener){return this.removeListener(event,listener)}done(){for(let event of[`finish`,`close`]){for(let[e,listener]of this.listeners)e===event&&listener();this.listeners=this.listeners.filter(([e])=>e!==event)}}};function runConnectOnFetch(mw,event,next){let state=fetchConnectState(event),res=new FetchConnectResponse(state.headers,event.req.signal);return new Promise((resolve,reject)=>{let respond=response=>{res.done(),resolve(withConnectHeaders(event,response))},fail=err=>{res.done(),reject(err)};res.ready.then(respond);let connectNext=err=>{if(err)return fail(err);if(res.settled)return;let id=state.req.requestId;if(id&&event.req.headers.get(`x-request-id`)!==id)try{event.req.headers.set(`x-request-id`,id)}catch{}let downstream;try{downstream=next()}catch(e){return fail(e)}Promise.resolve(downstream).then(value=>{if(value instanceof Response)return respond(value);res.done(),resolve(value)},fail)};try{mw(state.req,res,connectNext)}catch(err){fail(err)}})}function assembleCatchAll(app){let state=app;state[ASSEMBLED]||(state[ASSEMBLED]=!0,app.all(`/**`,event=>{let node=event.req.runtime?.node,next=node?.req?.[NEXT];if(node&&next&&!state[NO_FALLTHROUGH])return new Promise(resolve=>{let done=()=>resolve(H3_HANDLED);node.res.once(`finish`,done),node.res.once(`close`,done),next()});let mw=state[NOTFOUND_MW];return runConnectTerminal(mw,event)}))}function proxyTrust(option){if(option!==void 0&&option!==!1){if(option===!0)return()=>!0;if(typeof option==`number`)return(_address,hop)=>hop<option;if(typeof option==`function`)return option;log.warn(`h3: trustProxy as an address or subnet list is not supported; client IPs use the socket address. Use a hop count or a function instead.`)}}function forwardedClientIp(req,trust){let socket=req.socket?.remoteAddress;if(!socket)return;let header=req.headers[`x-forwarded-for`],chain=[socket,...(Array.isArray(header)?header.join(`,`):header??``).split(`,`).map(s=>s.trim()).filter(Boolean).toReversed()];for(let hop=0;hop<chain.length-1;hop++)if(!trust(chain[hop],hop))return chain[hop];return chain[chain.length-1]}function stripMountPrefix(path,mw){let prefix=path.endsWith(`/`)?path.slice(0,-1):path;return prefix===``?mw:((req,res,next)=>{let url=req.url??`/`,rest=url.startsWith(prefix)?url.slice(prefix.length):null;return rest===null||rest!==``&&rest[0]!==`/`&&rest[0]!==`?`?mw(req,res,next):(req.originalUrl??=url,req.url=rest.startsWith(`/`)?rest:`/${rest}`,mw(req,res,err=>{req.url=url,next(err)}))})}function h3Runtime(options={}){let{H3,toNodeHandler,fromNodeHandler}=loadH3v2(options.h3);return{name:`h3`,createApp(options={}){let holder={},app=new H3({onError:(error,event)=>{let mw=holder.app?.[ERROR_MW];return runConnectTerminal(mw,event,error).then(response=>withConnectHeaders(event,response))}});return holder.app=app,app[NO_FALLTHROUGH]=options.notFoundFallthrough===!1,app[TRUST_PROXY]=proxyTrust(options.trustProxy),app},nodeHandler(app){assembleCatchAll(app);let listener=toNodeHandler(app),trust=app[TRUST_PROXY];return(req,res,next)=>{if(next&&(req[NEXT]=next),trust&&!req.ip){let ip=forwardedClientIp(req,trust);ip&&(req.ip=ip)}res.setMaxListeners(0);try{let result=listener(req,res);result&&typeof result.then==`function`&&result.catch(err=>next?.(err))}catch(err){next?.(err)}}},mountRoutes(app,table){for(let{mountPath,routes}of table)for(let entry of routes){let url=joinPath(mountPath,entry.path),run=compileWebRoute(entry,{onError:async(err,req,driver)=>{let mw=app[ERROR_MW];if(mw)try{await mw(err,req,driver,NOOP_NEXT)}catch(handlerErr){driver.settled||(log.error(handlerErr,`h3: the error handler failed`),driver.status(500).json({error:`Internal Server Error`}))}}});app.on(entry.method,url,event=>run({request:event.req,url:event.url,params:event.context.params??{},carry:event.req.runtime?.node?.req??FETCH_CONNECT.get(event)?.req}))}},useConnect(app,rawMw,opts){let path=opts?.path;if(Array.isArray(path)){for(let member of path)this.useConnect(app,rawMw,{path:member});return}let mw=typeof path==`string`?stripMountPrefix(path,rawMw):rawMw,viaNode=fromNodeHandler(mw),handler=(event,next)=>event.req.runtime?.node?.res?viaNode(event):runConnectOnFetch(mw,event,next);path instanceof RegExp?app.use((event,next)=>path.test(event.url.pathname)?handler(event,next):next()):typeof path==`string`?app.use(joinPath(path,`/**`),handler):app.use(handler)},serveStatic(app,prefix,dir){let serveStatic=peerRequire(`serve-static`);this.useConnect(app,serveStatic(dir),{path:prefix})},setNotFound(app,mw){app[NOTFOUND_MW]=mw,assembleCatchAll(app)},setErrorHandler(app,mw){app[ERROR_MW]=mw},capabilities:{render:!1,uploads:!0,connectMiddleware:!0,nativeBodyParsing:!0,http2:!0}}}function joinPath(mountPath,path){let a=mountPath.endsWith(`/`)?mountPath.slice(0,-1):mountPath;return path===`/`||path===``?a===``?`/`:a:`${a}${path.startsWith(`/`)?path:`/${path}`}`}const h3WebRuntime=h3Runtime;export{h3Runtime,h3WebRuntime};
12
12
  //# sourceMappingURL=h3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"h3.mjs","names":[],"sources":["../../../src/http/runtimes/h3.ts"],"sourcesContent":["// The h3 runtime — `@forinda/kickjs/h3`.\n//\n// h3 (unjs) is the HTTP layer behind Nitro / Nuxt. This binds it to the same\n// HttpRuntime contract as Express and Fastify: routes become native h3 router\n// routes, and the node `ServerResponse` (h3 exposes it as `event.node.res`) is\n// wrapped in a RuntimeResponse so `ctx.json` / `ctx.html` / `ctx.sse` work\n// unchanged.\n//\n// Targets h3 **v1** (stable, node-based: `createApp` / `createRouter` /\n// `toNodeListener`, with `event.node.req` / `event.node.res`). `h3` is an\n// optional peer pinned to `^1`.\n//\n// h3 v2 (https://h3.dev/migration) moves to a web-standard `Request`/`Response`\n// core. Adopting it is the spec's §8 \"web-standard driver\" — `RuntimeResponse`\n// was shaped so a future `webRuntime()` can implement it over WHATWG streams,\n// at which point h3 v2 (and edge/Bun/Deno) become a driver swap rather than a\n// rewrite. Until that lands, this binding uses the node-compatible v1 surface.\n\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport { createRequire } from 'node:module'\n\nimport { classifyMediaType, unsupportedMediaTypeError } from '../body-policy'\nimport { RequestContext } from '../context'\nimport { publishMatchedRoute, stringifyJson } from '../runtime'\nimport { applyHandlerResult } from '../reply'\nimport { requestStore } from '../request-store'\nimport { createRequestStore, disposeRequestStore } from '../middleware/request-scope'\nimport { validate } from '../middleware/validate'\nimport { HttpException } from '../../core/errors'\nimport { applyUploadConfig, type RawUploadPart } from '../middleware/upload'\nimport type {\n ConnectMiddleware,\n HttpRuntime,\n RouteEntry,\n RouteTable,\n RuntimeAppOptions,\n RuntimeResponse,\n UseConnectOptions,\n} from '../runtime'\n\nconst peerRequire = createRequire(import.meta.url)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst h3 = (): any => peerRequire('h3')\n\ninterface H3EventLike {\n node: { req: IncomingMessage; res: ServerResponse }\n}\ninterface H3AppLike {\n use(arg1: unknown, arg2?: unknown): unknown\n handler: unknown\n}\n\nconst NEXT = Symbol('kickjs.h3.next')\nconst ERROR_MW = Symbol('kickjs.h3.errorMw')\n// h3's `createRouter` is terminal — on no match it THROWS a 404, it does not\n// fall through to the next `app.use` layer like an Express Router. So every\n// route source (controllers, /health, devtools /_debug, ad-hoc adapter routes)\n// must live on ONE shared router, registered AFTER all connect middleware.\nconst ROUTER = Symbol('kickjs.h3.router')\nconst NOTFOUND_MW = Symbol('kickjs.h3.notFoundMw')\nconst ASSEMBLED = Symbol('kickjs.h3.assembled')\nconst NOOP_NEXT = (): void => {}\nconst BODY_METHODS = new Set(['POST', 'PUT', 'PATCH', 'DELETE'])\n\n/**\n * Wrap a node ServerResponse (from `event.node.res`) as a RuntimeResponse.\n * A class so the ~12 driver methods live on a shared prototype — the previous\n * object-literal version re-allocated every method closure on each request.\n */\nclass NodeResDriver implements RuntimeResponse {\n constructor(private readonly res: ServerResponse) {}\n status(code: number): this {\n this.res.statusCode = code\n return this\n }\n json(data: unknown): this {\n // Do not clobber a content-type the caller already chose. This used to set\n // `application/json` unconditionally, so every `application/problem+json`\n // response — RFC 9457 problem details, which the error handler sets the\n // header for before serialising — went out as plain JSON on this runtime\n // alone. Express and Fastify both leave an existing value alone.\n if (!this.res.headersSent && !this.res.getHeader('content-type')) {\n this.res.setHeader('content-type', 'application/json; charset=utf-8')\n }\n this.res.end(stringifyJson(data))\n return this\n }\n send(data: unknown): this {\n this.res.end(data as never)\n return this\n }\n type(contentType: string): this {\n this.res.setHeader('content-type', contentType)\n return this\n }\n setHeader(name: string, value: unknown): this {\n this.res.setHeader(name, value as never)\n return this\n }\n render(): never {\n throw new Error('ctx.render() is not supported on the h3 runtime (no view engine).')\n }\n writeHead(statusCode: number, headers?: Record<string, string | number | string[]>): this {\n this.res.writeHead(statusCode, headers)\n return this\n }\n flushHeaders(): this {\n this.res.flushHeaders()\n return this\n }\n write(chunk: unknown): boolean {\n return this.res.write(chunk as never)\n }\n end(data?: unknown): this {\n this.res.end(data as never)\n return this\n }\n once(event: string, listener: (...args: unknown[]) => void): this {\n this.res.once(event, listener)\n return this\n }\n get headersSent(): boolean {\n return this.res.headersSent\n }\n}\n\nfunction resDriver(res: ServerResponse): RuntimeResponse {\n return new NodeResDriver(res) as unknown as RuntimeResponse\n}\n\n/** Carries `trustProxy` from createApp() to the per-route handlers. */\nconst TRUST_PROXY = Symbol('kickjs.h3.trustProxy')\n\n/** Build the h3 event handler that runs the kickjs pipeline for one route. */\nfunction makeEventHandler(\n entry: RouteEntry,\n trustProxy: boolean,\n): (event: H3EventLike) => Promise<void> {\n const { getRouterParams, getQuery, readRawBody, readMultipartFormData } = h3()\n const upload = entry.meta.upload\n // Validation middleware built ONCE per route (parity with Express) — calling\n // validate() per request re-allocated the closure every time.\n const validator = entry.meta.validation ? validate(entry.meta.validation) : undefined\n return async (event: H3EventLike) => {\n const req = event.node.req as IncomingMessage & {\n requestId?: string\n body?: unknown\n params?: unknown\n query?: unknown\n file?: unknown\n files?: unknown\n }\n const res = event.node.res\n\n // h3 computes no client address of its own, so `resolveClientIp` fell\n // straight through to the socket — which behind a proxy is the proxy, and\n // put every caller in one rate-limit bucket with no way to configure out\n // of it (#614). Express and Fastify derive `req.ip` from their own\n // trust-proxy settings; this is h3's equivalent, and like theirs it is\n // OFF unless the app opts in, because an unverified `x-forwarded-for` is\n // client-controllable.\n if (trustProxy && !(req as { ip?: string }).ip) {\n const forwarded = req.headers['x-forwarded-for']\n const first = (Array.isArray(forwarded) ? forwarded[0] : forwarded)?.split(',')[0]?.trim()\n if (first) (req as { ip?: string }).ip = first\n }\n\n // Populate the express-shaped request fields h3 keeps elsewhere.\n req.params = getRouterParams(event) ?? {}\n req.query = getQuery(event) ?? {}\n\n // HTTP/2 frames a body in DATA frames: no `transfer-encoding`, and\n // `content-length` is optional. h3's `readRawBody` — behind both the\n // JSON/text path and `readMultipartFormData` — returns `undefined` when\n // neither header is present, dropping the body. Read it once as bytes and\n // hand it over on `req.rawBody`, which `readRawBody` checks first.\n if (\n req.httpVersionMajor === 2 &&\n req.headers['content-length'] === undefined &&\n BODY_METHODS.has(req.method ?? 'GET')\n ) {\n ;(req as { rawBody?: Buffer }).rawBody = await readStreamBuffer(req)\n }\n if (upload && upload.mode !== 'none') {\n // @FileUpload: read the multipart body once (readBody would consume the\n // same stream, so the two are mutually exclusive). File parts → the\n // multer-shaped ctx.file/ctx.files; non-file fields → req.body.\n const form = (await readMultipartFormData(event).catch(() => undefined)) as\n | Array<{ name?: string; filename?: string; type?: string; data: Buffer }>\n | undefined\n const rawParts: RawUploadPart[] = []\n const fields: Record<string, unknown> = {}\n for (const part of form ?? []) {\n if (part.filename) {\n rawParts.push({\n fieldname: part.name ?? '',\n filename: part.filename,\n mimetype: part.type ?? 'application/octet-stream',\n buffer: part.data,\n })\n } else if (part.name) {\n fields[part.name] = part.data.toString('utf-8')\n }\n }\n const { file, files } = applyUploadConfig(rawParts, upload)\n req.file = file\n req.files = files\n req.body = fields\n } else if (BODY_METHODS.has(req.method ?? 'GET')) {\n // Swallow ONLY the absent-body case. `.catch(() => undefined)` also\n // swallowed a malformed one, so h3 answered 200 with the handler running\n // on `undefined` where Express and Fastify both answer 400 — a client\n // sending broken JSON got a success response, and the handler executed\n // against data that was never valid.\n // HTTP/2 frames the body in DATA frames: no `transfer-encoding`, and\n // `content-length` is optional, so there a body may be present with\n // neither header — only an explicit `content-length: 0` rules it out.\n const { 'content-length': length, 'transfer-encoding': encoding } = req.headers\n const sentBody =\n encoding !== undefined ||\n (length !== undefined && length !== '0') ||\n (req.httpVersionMajor === 2 && length !== '0')\n if (sentBody) {\n // Read raw and apply the shared policy rather than calling `readBody`,\n // whose own content-type dispatch is the source of the divergence:\n // it matches `application/json` with `===` (so `; charset=utf-8` misses)\n // and routes everything unrecognised through `destr`, which returns the\n // RAW STRING for malformed input instead of throwing (#590).\n const kind = classifyMediaType(req.headers['content-type'])\n if (kind !== 'multipart') {\n const raw = await readRawBody(event, 'utf8')\n // Reject only once the body is known to be non-empty. `sentBody` is\n // true for an empty CHUNKED post — `transfer-encoding` is present\n // with no payload — and rejecting on that alone would 415 a request\n // that sent nothing, contradicting the rule the other runtimes apply.\n if (raw) {\n if (kind === 'unsupported') {\n // A body was sent in a format the framework does not parse. Say\n // so rather than handing the handler `undefined` and letting it\n // fail somewhere less obvious.\n throw unsupportedMediaTypeError(req.headers['content-type'])\n }\n if (kind === 'json') {\n try {\n req.body = JSON.parse(raw)\n } catch (err) {\n throw HttpException.badRequest(\n err instanceof Error ? err.message : 'Request body could not be parsed',\n )\n }\n } else if (kind === 'urlencoded') {\n req.body = Object.fromEntries(new URLSearchParams(raw))\n } else {\n req.body = raw\n }\n }\n }\n }\n }\n\n const headerId = req.headers['x-request-id']\n const requestId = (Array.isArray(headerId) ? headerId[0] : headerId) || req.requestId\n const store = createRequestStore(requestId)\n req.requestId = store.requestId\n\n // @PreDestroy teardown for REQUEST-scoped instances once the response\n // closes (finished or aborted) — parity with requestScopeMiddleware.\n res.once('close', () => disposeRequestStore(store))\n\n await requestStore.run(store, async () => {\n publishMatchedRoute(req, entry)\n const ctx = new RequestContext(req as never, res as never, NOOP_NEXT, resDriver(res))\n\n // `beforeValidation` contributors (#677) — ahead of validation and middleware.\n if (entry.earlyContributorRunner) {\n await entry.earlyContributorRunner(ctx)\n if (res.writableEnded) return\n }\n\n if (validator) {\n await new Promise<void>((resolve, reject) => {\n validator(req as never, undefined as never, (err?: unknown) =>\n err ? reject(err) : resolve(),\n )\n })\n }\n\n for (const mw of entry.middlewares) {\n let advanced = false\n await new Promise<void>((resolve, reject) => {\n const next = (err?: unknown): void => {\n advanced = true\n if (err) reject(err)\n else resolve()\n }\n Promise.resolve(mw(ctx, next)).catch(reject)\n })\n if (!advanced || res.writableEnded) return\n }\n\n if (entry.contributorRunner) await entry.contributorRunner(ctx)\n if (res.writableEnded) return\n const result = await entry.handler(ctx)\n // Return-value handlers (reply.ts): auto-send when nothing was written.\n if (!res.writableEnded && !res.headersSent) applyHandlerResult(ctx, result)\n })\n }\n}\n\n/**\n * The original error h3 wrapped.\n *\n * h3 routes every thrown value through `createError()`, which returns its own\n * error with the original on `cause`. Handing that wrapper to the shared error\n * middleware means it sees something Express and Fastify never give it, and the\n * responses diverge: `instanceof HttpException` fails, so a thrown\n * `HttpException(418)` falls through to the generic branch and picks up a\n * `requestId` the other two omit, and `describeError` walks the cause chain to\n * report `kaboom ← caused by kaboom`.\n *\n * Only an `Error` cause is unwrapped. h3's own 404 carries no cause, so the\n * not-found path above is unaffected.\n */\nfunction unwrapH3Error(error: unknown): unknown {\n if (!(error instanceof Error)) return error\n const { cause } = error as { cause?: unknown }\n return cause instanceof Error ? cause : error\n}\n\n/**\n * The h3 HTTP runtime. Pass to `bootstrap({ runtime: h3Runtime() })`.\n * h3 parses bodies itself (`readBody`), so the Application skips its default\n * `express.json()` (see `nativeBodyParsing`).\n */\n/** Collect a request stream as bytes — never decoded, so file parts stay intact. */\nasync function readStreamBuffer(req: AsyncIterable<Buffer | string>): Promise<Buffer> {\n const chunks: Buffer[] = []\n for await (const chunk of req) chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk)\n return Buffer.concat(chunks)\n}\n\nexport function h3Runtime(): HttpRuntime<H3AppLike> {\n return {\n name: 'h3',\n\n createApp(options: RuntimeAppOptions = {}): H3AppLike {\n const { createApp } = h3()\n const app = createApp({\n onError: (error: unknown, event: H3EventLike) => {\n const res = event.node.res\n if (res.writableEnded) return\n const state = app as {\n [ERROR_MW]?: ConnectMiddleware\n [NOTFOUND_MW]?: ConnectMiddleware\n }\n // The shared router throws a 404 on no match (it's terminal). Treat\n // that as \"not found\", not a server error: hand back to the outer\n // chain (Vite dev fall-through) when present, else run the framework's\n // notFound handler so it returns a proper 404 — only genuine handler\n // errors reach the error middleware (and the ErrorHandler log).\n //\n // Only the ROUTER's no-match counts: h3 builds it from a plain object,\n // so its `cause` is not an Error. A handler that throws\n // `HttpException(404, '…')` arrives wrapped with the exception as\n // `cause` — that is a handler error and belongs to the error\n // middleware, which keeps its detail (and reports it to observers).\n const status = (error as { statusCode?: number } | undefined)?.statusCode\n const thrownByHandler = (error as { cause?: unknown } | undefined)?.cause instanceof Error\n if (status === 404 && !thrownByHandler) {\n const next = (event.node.req as IncomingMessage & { [NEXT]?: () => void })[NEXT]\n if (next) {\n next()\n return\n }\n const nf = state[NOTFOUND_MW]\n if (nf) {\n ;(nf as (req: unknown, res: unknown, next: () => void) => void)(\n event.node.req,\n resDriver(res),\n NOOP_NEXT,\n )\n return\n }\n }\n const mw = state[ERROR_MW]\n if (mw) {\n ;(mw as (e: unknown, req: unknown, res: unknown, next: () => void) => void)(\n unwrapH3Error(error),\n event.node.req,\n resDriver(res),\n NOOP_NEXT,\n )\n }\n },\n })\n // Stash the setting for mountRoutes — h3 has no app-level config object\n // of its own to hang it on.\n ;(app as { [TRUST_PROXY]?: unknown })[TRUST_PROXY] = options.trustProxy\n return app as H3AppLike\n },\n\n nodeHandler(app) {\n const { toNodeListener } = h3()\n // Register the shared router exactly once, AFTER all connect middleware\n // (serveStatic / useConnect) the setup phase added via `app.use` — the\n // router is terminal, so anything that must run for non-route paths has to\n // sit before it in the stack.\n const state = app as { [ROUTER]?: unknown; [ASSEMBLED]?: boolean }\n if (!state[ASSEMBLED]) {\n state[ASSEMBLED] = true\n if (state[ROUTER]) app.use(state[ROUTER])\n }\n const listener = toNodeListener(app)\n return (req: IncomingMessage, res: ServerResponse, next?: (err?: unknown) => void) => {\n if (next) (req as IncomingMessage & { [NEXT]?: (err?: unknown) => void })[NEXT] = next\n Promise.resolve(listener(req, res)).catch((err) => {\n if (next) next(err)\n })\n }\n },\n\n mountRoutes(app, table: RouteTable) {\n const { createRouter, eventHandler } = h3()\n const trustProxy = Boolean((app as { [TRUST_PROXY]?: unknown })[TRUST_PROXY])\n // One shared router per app — every mountRoutes call (controllers, health,\n // devtools, ad-hoc adapter routes) adds to it. `app.use(router)` is\n // deferred to nodeHandler so the router lands after connect middleware.\n const state = app as { [ROUTER]?: ReturnType<typeof createRouter> }\n if (!state[ROUTER]) state[ROUTER] = createRouter()\n const router = state[ROUTER]\n for (const { mountPath, routes } of table) {\n for (const entry of routes) {\n const url = joinPath(mountPath, entry.path)\n const method = entry.method.toLowerCase() as 'get' | 'post' | 'put' | 'delete' | 'patch'\n router[method](url, eventHandler(makeEventHandler(entry, trustProxy)))\n }\n }\n },\n\n useConnect(app, mw: ConnectMiddleware, opts?: UseConnectOptions) {\n const { fromNodeMiddleware } = h3()\n const handler = fromNodeMiddleware(mw)\n if (opts?.path !== undefined) app.use(opts.path, handler)\n else app.use(handler)\n },\n\n serveStatic(app, prefix, dir) {\n // `serve-static` (the standalone connect middleware behind express.static)\n // so the h3 runtime carries no `express` dependency — bridged via\n // fromNodeMiddleware like any other connect middleware.\n const serveStatic = peerRequire('serve-static')\n this.useConnect(app, serveStatic(dir) as ConnectMiddleware, { path: prefix })\n },\n\n setNotFound(app, mw: ConnectMiddleware) {\n // Stash it — the shared router throws a 404 on no match, which `onError`\n // (createApp) dispatches to this handler (or to the Vite fall-through when\n // a `next` is present). A post-router `app.use` could never run, since the\n // terminal router throws before the stack advances.\n ;(app as { [NOTFOUND_MW]?: ConnectMiddleware })[NOTFOUND_MW] = mw\n },\n\n setErrorHandler(app, mw: ConnectMiddleware) {\n ;(app as { [ERROR_MW]?: ConnectMiddleware })[ERROR_MW] = mw\n },\n\n capabilities: {\n render: false,\n uploads: true,\n connectMiddleware: true,\n nativeBodyParsing: true,\n http2: true,\n },\n }\n}\n\n/**\n * The h3 runtime's engine-native types — what the runtime-typed escape hatches\n * resolve to once the `kick/runtime` typegen emits a `KickRuntimeRegister`\n * augmentation pointing here (spec §4.3b). `AdapterContext.app` / `getRuntimeApp()`\n * become the h3 `App`; `ctx.req` / `ctx.res` the per-request `H3Event` (h3 v1\n * routes everything through the event). Mirrors `ExpressRuntimeTypes`.\n */\n// Resolved conditionally so this file typechecks against EITHER installed h3\n// major: v1 exports `App`; v2 (used by the sibling h3-web runtime) does not.\n// Runtime behavior is untouched — this block is type-only.\ntype H3AppType = typeof import('h3') extends { App: infer A } ? A : unknown\ntype H3EventType = typeof import('h3') extends { H3Event: new (...args: never[]) => infer E }\n ? E\n : unknown\n\nexport interface H3RuntimeTypes {\n request: H3EventType\n response: H3EventType\n app: H3AppType\n}\n\n/** Join a mount prefix and a route path; a root path maps to the prefix itself. */\nfunction joinPath(mountPath: string, path: string): string {\n const a = mountPath.endsWith('/') ? mountPath.slice(0, -1) : mountPath\n if (path === '/' || path === '') return a === '' ? '/' : a\n const b = path.startsWith('/') ? path : `/${path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,MAAO,CAAC,CAC9E,EAEA,YAAY,IAAK,GAAuB,CAKrC,IAA+C,aAAe,EACjE,EAEA,gBAAgB,IAAK,GAAuB,CACzC,IAA4C,UAAY,EAC3D,EAEA,aAAc,CACZ,OAAQ,GACR,QAAS,GACT,kBAAmB,GACnB,kBAAmB,GACnB,MAAO,EACT,CACF,CACF,CAwBA,SAAS,SAAS,UAAmB,KAAsB,CACzD,IAAM,EAAI,UAAU,SAAS,GAAG,EAAI,UAAU,MAAM,EAAG,EAAE,EAAI,UAG7D,OAFI,OAAS,KAAO,OAAS,GAAW,IAAM,GAAK,IAAM,EAElD,GAAG,IADA,KAAK,WAAW,GAAG,EAAI,KAAO,IAAI,QAE9C"}
1
+ {"version":3,"file":"h3.mjs","names":[],"sources":["../../../src/http/runtimes/h3.ts"],"sourcesContent":["// The h3 runtime — `@forinda/kickjs/h3`.\n//\n// Targets h3 v2: the web-standard line where `event.req` is a WHATWG Request,\n// handlers return values/Responses, and `app.fetch(request)` is the universal\n// entry. h3 v1 is not supported; loading it fails fast with upgrade guidance.\n//\n// The request pipeline runs through the shared web driver pair\n// (`../web/driver`, `../web/handler`) — the same code path the\n// `@forinda/kickjs/web` edge entry uses, so node bootstrap and edge deploys\n// exercise identical request semantics.\n//\n// Unmatched requests: behind a node host that passed `next` (`kick dev`'s\n// Vite server, `app.handle(req, res, next)`), they are handed back to it\n// like the Fastify runtime does, unless `notFoundFallthrough: false`;\n// everywhere else kick's notFound handler answers them.\n\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport { createRequire } from 'node:module'\n\nimport type {\n ConnectMiddleware,\n HttpRuntime,\n RouteTable,\n RuntimeAppOptions,\n UseConnectOptions,\n} from '../runtime'\nimport { compileWebRoute, readThrough, type WebRouteHooks } from '../web/handler'\nimport { WebRequestShim, WebResponseDriver } from '../web/driver'\nimport { createLogger, describeError } from '../../core/logger'\n\nconst log = createLogger('H3Runtime')\n\nconst peerRequire = createRequire(import.meta.url)\n\nconst NOTFOUND_MW = Symbol('kickjs.h3web.notFoundMw')\nconst ERROR_MW = Symbol('kickjs.h3web.errorMw')\nconst ASSEMBLED = Symbol('kickjs.h3web.assembled')\nconst NOOP_NEXT = (): void => {}\n/** The host's `next`, stashed on the node request by `nodeHandler`. */\nconst NEXT = Symbol('kickjs.h3web.next')\n/** `notFoundFallthrough: false` — answer unmatched requests instead of handing them back. */\nconst NO_FALLTHROUGH = Symbol('kickjs.h3web.noFallthrough')\nconst TRUST_PROXY = Symbol('kickjs.h3.trustProxy')\n/** h3 v2's \"the node response was handled elsewhere\" return value. */\nconst H3_HANDLED = Symbol.for('h3.handled')\n\n// Minimal structural surface of h3 v2 we depend on.\ninterface H3AppLike {\n on(method: string, path: string, handler: (event: H3EventLike) => unknown): unknown\n all(path: string, handler: (event: H3EventLike) => unknown): unknown\n use(...args: unknown[]): unknown\n fetch(request: Request): Promise<Response>\n}\ninterface H3EventLike {\n req: Request & { runtime?: { node?: { req: IncomingMessage; res: ServerResponse } } }\n url: URL\n context: { params?: Record<string, string> }\n}\n\ninterface H3v2Module {\n H3: new (config?: unknown) => H3AppLike\n toNodeHandler: (app: H3AppLike) => (req: IncomingMessage, res: ServerResponse) => void\n fromNodeHandler: (mw: unknown) => unknown\n}\n\nexport interface H3RuntimeOptions {\n /**\n * Pre-imported h3 module, for when the app's `h3` is not the one this\n * package resolves (a linked checkout, a bundler):\n * `h3Runtime({ h3: await import('h3') })`.\n * Omitted → the installed `h3` peer.\n */\n h3?: unknown\n}\n\n/** An h3 module as `import()` or `require()` hands it over, ESM interop unwrapped. */\nfunction unwrapH3Module(mod: unknown): Record<string, unknown> {\n const m = mod as { __esModule?: boolean; default?: Record<string, unknown> } & Record<\n string,\n unknown\n >\n return m && m.__esModule && m.default ? { ...m.default, ...m } : m\n}\n\n/** Resolve h3 (injected or peer-required) and fail fast unless it is v2. */\nfunction loadH3v2(injected?: unknown): H3v2Module {\n const resolved = unwrapH3Module(injected ?? peerRequire('h3')) as unknown as H3v2Module\n if (typeof resolved.H3 !== 'function') {\n throw new Error(\n '@forinda/kickjs: h3Runtime() requires h3 v2, but the installed h3 has no H3 class — that is the v1 line, ' +\n 'which this version of KickJS no longer supports. Upgrade: `pnpm add h3@^2`.',\n )\n }\n return resolved\n}\n\n/**\n * Bridge a connect-style terminal middleware (kick's notFound / error\n * handlers) onto the web driver pair, returning the produced Response.\n */\nasync function runConnectTerminal(\n mw: ConnectMiddleware | undefined,\n event: H3EventLike,\n err?: unknown,\n): Promise<Response> {\n const shim = new WebRequestShim(event.req, event.url)\n // What the app's connect middleware set (session, an adapter's slot) is\n // visible to the error / not-found handler, as on the route itself.\n const carry = event.req.runtime?.node?.req ?? FETCH_CONNECT.get(event)?.req\n const req = carry ? readThrough(shim, carry) : shim\n const driver = new WebResponseDriver(event.req.signal)\n if (mw) {\n const returned =\n err !== undefined\n ? (mw as (e: unknown, rq: unknown, rs: unknown, n: () => void) => unknown)(\n err,\n req,\n driver,\n NOOP_NEXT,\n )\n : (mw as (rq: unknown, rs: unknown, n: () => void) => unknown)(req, driver, NOOP_NEXT)\n // An async handler answers after an await: wait for it before deciding\n // nothing answered. One that rejects is an error in its own right.\n if (typeof (returned as PromiseLike<void> | undefined)?.then === 'function') {\n try {\n await returned\n } catch (handlerErr) {\n if (!driver.settled) {\n log.error(\n handlerErr,\n `h3: the ${err !== undefined ? 'error' : 'not-found'} handler failed`,\n )\n driver.status(500).json({ error: 'Internal Server Error' })\n }\n }\n }\n }\n if (!driver.settled) {\n if (err !== undefined) {\n // The configured error handler ran but didn't settle the response\n // (or there wasn't one). Emitting a bare 500 with no log entry\n // makes this failure invisible on both sides — log it here, since\n // by definition nothing downstream will.\n log.error(err, `h3: error handler did not settle the response — ${describeError(err)}`)\n driver.status(500).json({\n error: 'Internal Server Error',\n ...(typeof process !== 'undefined' && process.env?.NODE_ENV === 'production'\n ? {}\n : { message: describeError(err) }),\n })\n } else {\n driver.status(404).json({ error: 'Not Found' })\n }\n }\n return driver.ready\n}\n\n// ── Connect middleware on the fetch path ─────────────────────────────────\n//\n// `app.fetch(request)` (edge, Bun, Deno, a serverless function) carries no\n// node req/res, and h3's `fromNodeHandler` throws without one. Connect\n// middleware there runs against the web driver pair instead: one request shim\n// per event (so `req.requestId` set by one middleware is seen by the next) and\n// one header bag per event that is merged into whatever Response comes back.\n// The merge is ours rather than h3's `event.res.headers` because h3 skips\n// prepared headers on non-2xx responses, and a 404/422/500 must still carry\n// helmet's headers and the request id, exactly as on node.\n\ninterface FetchConnectState {\n req: WebRequestShim\n headers: Headers\n}\n\nconst FETCH_CONNECT = new WeakMap<object, FetchConnectState>()\n\nfunction fetchConnectState(event: H3EventLike): FetchConnectState {\n let state = FETCH_CONNECT.get(event)\n if (!state) {\n state = { req: new WebRequestShim(event.req, event.url), headers: new Headers() }\n FETCH_CONNECT.set(event, state)\n }\n return state\n}\n\n/**\n * Add the headers connect middleware set to `response`. The response's own\n * headers win — a later `setHeader` overrides an earlier one on node too.\n * Consumed once, so every middleware layer can call it on the way out.\n */\nfunction withConnectHeaders(event: H3EventLike, response: Response): Response {\n const state = FETCH_CONNECT.get(event)\n if (!state) return response\n const missing = [...state.headers].filter(\n ([name]) => name === 'set-cookie' || !response.headers.has(name),\n )\n state.headers = new Headers()\n if (missing.length === 0) return response\n try {\n for (const [name, value] of missing) response.headers.append(name, value)\n return response\n } catch {\n // Immutable headers (a Response from fetch) — rebuild around the body.\n const headers = new Headers(response.headers)\n for (const [name, value] of missing) headers.append(name, value)\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers,\n })\n }\n}\n\n/**\n * The node `res` surface connect middleware uses, over the web driver:\n * headers go to the per-event bag, `statusCode`, and `finish`/`close`\n * emitted once the response exists.\n */\nclass FetchConnectResponse extends WebResponseDriver {\n private code = 200\n private listeners: Array<[string, (...args: unknown[]) => void]> = []\n\n constructor(\n private readonly prepared: Headers,\n signal: AbortSignal,\n ) {\n super(signal)\n }\n\n get statusCode(): number {\n return this.code\n }\n\n set statusCode(code: number) {\n this.status(code)\n }\n\n override status(code: number): this {\n this.code = code\n return super.status(code)\n }\n\n override writeHead(code: number, headers?: Record<string, string | number | string[]>): this {\n this.code = code\n return super.writeHead(code, headers)\n }\n\n override setHeader(name: string, value: unknown): this {\n if (Array.isArray(value)) {\n this.prepared.delete(name)\n for (const v of value) this.prepared.append(name, String(v))\n } else {\n this.prepared.set(name, String(value))\n }\n return this\n }\n\n getHeader(name: string): string | undefined {\n return this.prepared.get(name) ?? undefined\n }\n\n hasHeader(name: string): boolean {\n return this.prepared.has(name)\n }\n\n removeHeader(name: string): void {\n this.prepared.delete(name)\n }\n\n override once(event: string, listener: (...args: unknown[]) => void): this {\n this.listeners.push([event, listener])\n return this\n }\n\n on(event: string, listener: (...args: unknown[]) => void): this {\n return this.once(event, listener)\n }\n\n removeListener(event: string, listener: (...args: unknown[]) => void): this {\n this.listeners = this.listeners.filter(([e, l]) => e !== event || l !== listener)\n return this\n }\n\n off(event: string, listener: (...args: unknown[]) => void): this {\n return this.removeListener(event, listener)\n }\n\n /**\n * The response exists (or the request failed): fire `finish` then `close`.\n * Runs before `withConnectHeaders` merges this response's headers into the\n * route's, so a `finish` listener can still set one — the cookie session\n * store writes its cookie there.\n */\n done(): void {\n for (const event of ['finish', 'close']) {\n for (const [e, listener] of this.listeners) if (e === event) listener()\n this.listeners = this.listeners.filter(([e]) => e !== event)\n }\n }\n}\n\nfunction runConnectOnFetch(\n mw: ConnectMiddleware,\n event: H3EventLike,\n next: () => unknown,\n): Promise<unknown> {\n const state = fetchConnectState(event)\n const res = new FetchConnectResponse(state.headers, event.req.signal)\n\n return new Promise((resolve, reject) => {\n const respond = (response: Response): void => {\n res.done()\n resolve(withConnectHeaders(event, response))\n }\n const fail = (err: unknown): void => {\n res.done()\n reject(err)\n }\n\n // The middleware answered itself (`res.end`, `res.json`, `writeHead`).\n void res.ready.then(respond)\n\n const connectNext = (err?: unknown): void => {\n if (err) return fail(err)\n if (res.settled) return\n // The route builds its request store from the inbound header; hand it the\n // id requestScope/requestId settled on so body, logs and header agree.\n const id = state.req.requestId\n if (id && event.req.headers.get('x-request-id') !== id) {\n try {\n event.req.headers.set('x-request-id', id)\n } catch {\n // Immutable request headers on some runtimes — the route mints its own id.\n }\n }\n let downstream: unknown\n try {\n // Synchronous, so downstream work starts inside any AsyncLocalStorage\n // scope this middleware opened (requestScopeMiddleware).\n downstream = next()\n } catch (e) {\n return fail(e)\n }\n Promise.resolve(downstream).then((value) => {\n if (value instanceof Response) return respond(value)\n res.done()\n resolve(value)\n }, fail)\n }\n\n try {\n ;(mw as (rq: unknown, rs: unknown, n: (err?: unknown) => void) => void)(\n state.req,\n res,\n connectNext,\n )\n } catch (err) {\n fail(err)\n }\n })\n}\n\n/**\n * Terminal catch-all AFTER all mounted routes: kick's own notFound handler\n * answers unmatched paths (h3 v2's default 404 never fires). rou3 ranks `/**`\n * below every concrete route, so registration time does not matter.\n */\nfunction assembleCatchAll(app: H3AppLike): void {\n const state = app as unknown as Record<symbol, unknown>\n if (state[ASSEMBLED]) return\n state[ASSEMBLED] = true\n app.all('/**', (event: H3EventLike) => {\n const node = event.req.runtime?.node\n const next = (node?.req as (IncomingMessage & { [NEXT]?: () => void }) | undefined)?.[NEXT]\n if (node && next && !state[NO_FALLTHROUGH]) {\n // Hand the request back to the host and tell h3 the node response is\n // taken care of; srvx then leaves the already-written response alone.\n return new Promise((resolve) => {\n const done = () => resolve(H3_HANDLED)\n node.res.once('finish', done)\n node.res.once('close', done)\n next()\n })\n }\n const mw = state[NOTFOUND_MW] as ConnectMiddleware | undefined\n return runConnectTerminal(mw, event)\n })\n}\n\ntype ProxyTrust = (address: string, hop: number) => boolean\n\n/**\n * The `trustProxy` forms h3 can honour without an address-matching library:\n * `true` (every hop), a hop count, or a predicate — Express's semantics for\n * each. Address and subnet lists are not supported here; they are refused\n * with a warning and the socket address is kept, so a misread rule never\n * trusts a header it should not.\n */\nfunction proxyTrust(option: RuntimeAppOptions['trustProxy']): ProxyTrust | undefined {\n if (option === undefined || option === false) return undefined\n if (option === true) return () => true\n if (typeof option === 'number') return (_address, hop) => hop < option\n if (typeof option === 'function') return option\n log.warn(\n 'h3: trustProxy as an address or subnet list is not supported; client IPs ' +\n 'use the socket address. Use a hop count or a function instead.',\n )\n return undefined\n}\n\n/**\n * Express's `proxy-addr` walk: from the socket outward through\n * `x-forwarded-for`, stop at the first address the rule does not trust.\n */\nfunction forwardedClientIp(req: IncomingMessage, trust: ProxyTrust): string | undefined {\n const socket = req.socket?.remoteAddress\n if (!socket) return undefined\n const header = req.headers['x-forwarded-for']\n const forwarded = (Array.isArray(header) ? header.join(',') : (header ?? ''))\n .split(',')\n .map((s) => s.trim())\n .filter(Boolean)\n .toReversed()\n const chain = [socket, ...forwarded]\n for (let hop = 0; hop < chain.length - 1; hop++) {\n if (!trust(chain[hop]!, hop)) return chain[hop]\n }\n return chain[chain.length - 1]\n}\n\n/**\n * A middleware mounted at a path sees `req.url` relative to that path, as on\n * Express — `serve-static` mounted at `/files` must look up\n * `/nested/a.txt`, not `/files/nested/a.txt`. h3 v2 leaves the URL whole, so\n * strip the prefix for the call and restore it when the middleware passes on.\n * `req.originalUrl` keeps the full URL, as Express sets it.\n */\nfunction stripMountPrefix(path: string, mw: ConnectMiddleware): ConnectMiddleware {\n const prefix = path.endsWith('/') ? path.slice(0, -1) : path\n if (prefix === '') return mw\n return ((\n req: IncomingMessage & { originalUrl?: string },\n res: unknown,\n next: (err?: unknown) => void,\n ) => {\n const url = req.url ?? '/'\n const rest = url.startsWith(prefix) ? url.slice(prefix.length) : null\n if (rest === null || (rest !== '' && rest[0] !== '/' && rest[0] !== '?')) {\n return (mw as (rq: unknown, rs: unknown, n: (err?: unknown) => void) => unknown)(\n req,\n res,\n next,\n )\n }\n req.originalUrl ??= url\n req.url = rest.startsWith('/') ? rest : `/${rest}`\n return (mw as (rq: unknown, rs: unknown, n: (err?: unknown) => void) => unknown)(\n req,\n res,\n (err?: unknown) => {\n req.url = url\n next(err)\n },\n )\n }) as unknown as ConnectMiddleware\n}\n\n/**\n * The h3 HTTP runtime. Pass to `bootstrap({ runtime: h3Runtime() })`.\n * Requires the h3 v2 peer; fails fast with guidance when v1 is installed.\n */\nexport function h3Runtime(options: H3RuntimeOptions = {}): HttpRuntime<H3AppLike> {\n const { H3, toNodeHandler, fromNodeHandler } = loadH3v2(options.h3)\n\n return {\n name: 'h3',\n\n createApp(options: RuntimeAppOptions = {}): H3AppLike {\n const holder: { app?: H3AppLike } = {}\n const app = new H3({\n // Engine-level errors (middleware throws outside the kick pipeline)\n // dispatch to the kick error handler once setErrorHandler stashes it.\n onError: (error: unknown, event: H3EventLike) => {\n const mw = (holder.app as unknown as Record<symbol, ConnectMiddleware | undefined>)?.[\n ERROR_MW\n ]\n return runConnectTerminal(mw, event, error).then((response) =>\n withConnectHeaders(event, response),\n )\n },\n })\n holder.app = app\n ;(app as unknown as Record<symbol, unknown>)[NO_FALLTHROUGH] =\n options.notFoundFallthrough === false\n ;(app as unknown as Record<symbol, unknown>)[TRUST_PROXY] = proxyTrust(options.trustProxy)\n return app\n },\n\n nodeHandler(app) {\n assembleCatchAll(app)\n const listener = toNodeHandler(app)\n const trust = (app as unknown as Record<symbol, unknown>)[TRUST_PROXY] as\n | ProxyTrust\n | undefined\n return (req: IncomingMessage, res: ServerResponse, next?: (err?: unknown) => void) => {\n if (next) (req as IncomingMessage & { [NEXT]?: (err?: unknown) => void })[NEXT] = next\n // Express and Fastify derive `req.ip` from their trust-proxy settings;\n // this is h3's equivalent, off unless the app opts in, because an\n // unverified `x-forwarded-for` is client-controllable. Without it every\n // caller behind a proxy shares the proxy's address (one rate-limit bucket).\n if (trust && !(req as { ip?: string }).ip) {\n const ip = forwardedClientIp(req, trust)\n if (ip) (req as { ip?: string }).ip = ip\n }\n // h3 v2 adds 'close' / 'finish' listeners for every connect middleware\n // and keeps them until the response ends, so an ordinary middleware\n // stack crosses Node's default of 10 and warns about a leak on every\n // request. They go away with the response; no limit is needed.\n res.setMaxListeners(0)\n try {\n const result = listener(req, res) as unknown\n if (result && typeof (result as Promise<unknown>).then === 'function') {\n void (result as Promise<unknown>).catch((err) => next?.(err))\n }\n } catch (err) {\n next?.(err)\n }\n }\n },\n\n mountRoutes(app, table: RouteTable) {\n for (const { mountPath, routes } of table) {\n for (const entry of routes) {\n const url = joinPath(mountPath, entry.path)\n const hooks: WebRouteHooks = {\n onError: async (err, req, driver) => {\n const mw = (app as unknown as Record<symbol, ConnectMiddleware | undefined>)[ERROR_MW]\n if (!mw) return\n // Awaited: an async handler answers after its await, and the\n // pipeline falls back to its own answer once this returns.\n try {\n await (mw as (e: unknown, rq: unknown, rs: unknown, n: () => void) => unknown)(\n err,\n req,\n driver,\n NOOP_NEXT,\n )\n } catch (handlerErr) {\n if (!driver.settled) {\n log.error(handlerErr, 'h3: the error handler failed')\n driver.status(500).json({ error: 'Internal Server Error' })\n }\n }\n },\n }\n const run = compileWebRoute(entry, hooks)\n app.on(entry.method, url, (event: H3EventLike) =>\n run({\n request: event.req,\n url: event.url,\n params: event.context.params ?? {},\n carry: event.req.runtime?.node?.req ?? FETCH_CONNECT.get(event)?.req,\n }),\n )\n }\n }\n },\n\n useConnect(app, rawMw: ConnectMiddleware, opts?: UseConnectOptions) {\n const path = opts?.path\n // A list mounts each member, as Express does.\n if (Array.isArray(path)) {\n for (const member of path) this.useConnect!(app, rawMw, { path: member })\n return\n }\n const mw = typeof path === 'string' ? stripMountPrefix(path, rawMw) : rawMw\n // Behind a node server (toNodeHandler) the event carries node req/res and\n // h3's own bridge runs the middleware unchanged. Called through\n // `app.fetch(request)` there is none and fromNodeHandler would throw, so\n // the middleware runs against the web driver pair instead.\n const viaNode = fromNodeHandler(mw) as (event: H3EventLike) => unknown\n const handler = (event: H3EventLike, next: () => unknown) =>\n event.req.runtime?.node?.res ? viaNode(event) : runConnectOnFetch(mw, event, next)\n if (path instanceof RegExp) {\n // h3 routes by string pattern only; test the pathname per request.\n // Like Express, a pattern mount leaves `req.url` whole.\n app.use((event: H3EventLike, next: () => unknown) =>\n path.test(event.url.pathname) ? handler(event, next) : next(),\n )\n } else if (typeof path === 'string') {\n // h3 `use` is exact-match; `/**` covers the subtree.\n app.use(joinPath(path, '/**'), handler)\n } else {\n app.use(handler)\n }\n },\n\n serveStatic(app, prefix, dir) {\n // serve-static bridged like any other connect middleware (node only).\n const serveStatic = peerRequire('serve-static')\n this.useConnect(app, serveStatic(dir) as ConnectMiddleware, { path: prefix })\n },\n\n setNotFound(app, mw: ConnectMiddleware) {\n ;(app as unknown as Record<symbol, ConnectMiddleware>)[NOTFOUND_MW] = mw\n // Here as well as in nodeHandler: an app only ever called through\n // `app.fetch` never reaches nodeHandler, and would answer h3's own 404.\n assembleCatchAll(app)\n },\n\n setErrorHandler(app, mw: ConnectMiddleware) {\n ;(app as unknown as Record<symbol, ConnectMiddleware>)[ERROR_MW] = mw\n },\n\n capabilities: {\n render: false,\n uploads: true,\n connectMiddleware: true,\n nativeBodyParsing: true,\n // srvx's node adapter writes HTTP/2 compat responses (it branches on\n // httpVersion \"2.0\"), so the node path serves `server.http2` too.\n http2: true,\n },\n }\n}\n\n/**\n * The h3 runtime's engine-native types, for the `kick/runtime` typegen\n * augmentation. Mirrors `ExpressRuntimeTypes`.\n */\nexport interface H3RuntimeTypes {\n request: Request\n response: Response\n app: typeof import('h3') extends { H3: new (...args: never[]) => infer A } ? A : unknown\n}\n\n/** Join a mount prefix and a route path into one URL, collapsing slashes. */\nfunction joinPath(mountPath: string, path: string): string {\n const a = mountPath.endsWith('/') ? mountPath.slice(0, -1) : mountPath\n if (path === '/' || path === '') return a === '' ? '/' : a\n const b = path.startsWith('/') ? path : `/${path}`\n return `${a}${b}`\n}\n\n/** @deprecated Use {@link h3Runtime} — the same runtime. Removed in the next major. */\nexport const h3WebRuntime = h3Runtime\n/** @deprecated Use {@link H3RuntimeOptions}. */\nexport type H3WebRuntimeOptions = H3RuntimeOptions\n/** @deprecated Use {@link H3RuntimeTypes}. */\nexport type H3WebRuntimeTypes = H3Runtime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wB,CAAE,KAAM,MAAO,CAAC,CAC9E,EAEA,YAAY,IAAK,GAAuB,CACrC,IAAsD,aAAe,GAGtE,iBAAiB,GAAG,CACtB,EAEA,gBAAgB,IAAK,GAAuB,CACzC,IAAsD,UAAY,EACrE,EAEA,aAAc,CACZ,OAAQ,GACR,QAAS,GACT,kBAAmB,GACnB,kBAAmB,GAGnB,MAAO,EACT,CACF,CACF,CAaA,SAAS,SAAS,UAAmB,KAAsB,CACzD,IAAM,EAAI,UAAU,SAAS,GAAG,EAAI,UAAU,MAAM,EAAG,EAAE,EAAI,UAG7D,OAFI,OAAS,KAAO,OAAS,GAAW,IAAM,GAAK,IAAM,EAElD,GAAG,IADA,KAAK,WAAW,GAAG,EAAI,KAAO,IAAI,QAE9C,CAGA,MAAa,aAAe"}
package/dist/index.d.mts CHANGED
@@ -3,27 +3,27 @@ import { a as METADATA, c as Scope, i as Constructor, l as ServiceOptions, n as
3
3
  import { a as tokenName, c as createToken, i as KickJsRegistry, l as isInjectionToken, n as ContainerChangeEvent, o as INJECTION_TOKEN, r as ContainerChangeListener, s as InjectionToken, t as Container } from "./container-Dpvd66Yt.mjs";
4
4
  import { A as Service, B as resolveAsset, C as Post, D as Put, F as ASSET_MANIFEST_VERSION, I as KickAssets, L as UnknownAssetError, M as normalizeApiQueryParamsConfig, N as withBuilder, O as Repository, P as ASSETS, R as assets, S as Patch, T as PreDestroy, V as useAssets, _ 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 Value, k as RouteDefinition, 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, z as clearAssetCache } from "./decorators-BxNSz9Qt.mjs";
5
5
  import { a as baseEnvSchema, c as loadEnv, d as resetEnvCache, f as withEnv, l as loadEnvFromSchema, n as TypedConfigService, o as defineEnv, r as createConfigService, s as getEnv, t as ConfigService, u as reloadEnv } from "./index-CNHSbZTE.mjs";
6
- import { $ as setInMetaRecord, B as SourcedRegistration, C as RuntimeTypeMap, Ct as reportResponse, D as RequestContext, E as DeepReadonly, F as RunContributorsOptions, G as getMetaRecord, H as getClassMeta, I as runContributors, J as hasClassMeta, K as getMethodMeta, L as BuildPipelineOptions, M as AdapterFactory, N as DefineAdapterOptions, O as RouteShape, P as defineAdapter, Q as setInMetaMap, R as ContributorPipeline, S as RuntimeResponse, St as reportError, T as Ctx, U as getClassMetaOrUndefined, V as buildPipeline, W as getMetaMap, X as pushMethodMeta, Y as pushClassMeta, Z as setClassMeta, _ as RouteMeta, _t as IntrospectionKind, a as KickServer, at as defineModule, b as RuntimeAppOptions, bt as ErrorSource, c as ActiveRuntime, ct as PluginAsyncOptions, d as CtxHandler, dt as KickPlugin, et as setMethodMeta, f as ExpressRuntimeTypes, ft as ModuleRegistry, g as RouteEntry, gt as IntrospectFn, h as MatchedRoute, ht as KickJsPluginRegistry, i as AppAdapterClass, it as ModuleFactory, j as AdapterAsyncOptions, k as SseHandler, l as AdapterHttp, lt as PluginFactory, m as KickRuntimeRegister, mt as KickJsPluginName, n as AdapterMiddleware, nt as defineModules, o as MiddlewarePath, ot as BuildContext, p as HttpRuntime, pt as MutableModuleRegistry, q as getMethodMetaOrUndefined, r as AppAdapter, rt as DefineModuleOptions, s as MiddlewarePhase, st as DefinePluginOptions, t as AdapterContext, tt as ModuleList, u as ConnectMiddleware, ut as definePlugin, v as RouteMethod, vt as IntrospectionSnapshot, w as UseConnectOptions, x as RuntimeCapabilities, xt as ResponseInfo, y as RouteTable, yt as ErrorInfo, z as ContributorSource } from "./adapter-DjfRMob8.mjs";
6
+ import { $ as setInMetaRecord, B as SourcedRegistration, C as RuntimeTypeMap, Ct as reportResponse, D as RequestContext, E as DeepReadonly, F as RunContributorsOptions, G as getMetaRecord, H as getClassMeta, I as runContributors, J as hasClassMeta, K as getMethodMeta, L as BuildPipelineOptions, M as AdapterFactory, N as DefineAdapterOptions, O as RouteShape, P as defineAdapter, Q as setInMetaMap, R as ContributorPipeline, S as RuntimeResponse, St as reportError, T as Ctx, U as getClassMetaOrUndefined, V as buildPipeline, W as getMetaMap, X as pushMethodMeta, Y as pushClassMeta, Z as setClassMeta, _ as RouteMeta, _t as IntrospectionKind, a as KickServer, at as defineModule, b as RuntimeAppOptions, bt as ErrorSource, c as ActiveRuntime, ct as PluginAsyncOptions, d as CtxHandler, dt as KickPlugin, et as setMethodMeta, f as ExpressRuntimeTypes, ft as ModuleRegistry, g as RouteEntry, gt as IntrospectFn, h as MatchedRoute, ht as KickJsPluginRegistry, i as AppAdapterClass, it as ModuleFactory, j as AdapterAsyncOptions, k as SseHandler, l as AdapterHttp, lt as PluginFactory, m as KickRuntimeRegister, mt as KickJsPluginName, n as AdapterMiddleware, nt as defineModules, o as MiddlewarePath, ot as BuildContext, p as HttpRuntime, pt as MutableModuleRegistry, q as getMethodMetaOrUndefined, r as AppAdapter, rt as DefineModuleOptions, s as MiddlewarePhase, st as DefinePluginOptions, t as AdapterContext, tt as ModuleList, u as ConnectMiddleware, ut as definePlugin, v as RouteMethod, vt as IntrospectionSnapshot, w as UseConnectOptions, x as RuntimeCapabilities, xt as ResponseInfo, y as RouteTable, yt as ErrorInfo, z as ContributorSource } from "./adapter-ClEh-Oos.mjs";
7
7
  import { _ as getRouteFlags, a as RouteFlagContext, c as RouteFlagName, d as RouteFlagTest, f as RouteFlagValue, g as defineRouteFlag, h as assertFlagTest, i as RouteFlag, l as RouteFlagPredicate, m as ValuedRouteFlag, n as KickRouteFlags, o as RouteFlagDeclaration, p as RouteFlags, r as NegatedRouteFlagName, s as RouteFlagDeclarations, t as BareRouteFlag, u as RouteFlagRecord, v as matchesFlagTest, y as resolveRouteFlags } from "./route-flag-B1lQht6v.mjs";
8
8
  import { C as MetaValue, S as ExecutionContext, _ as ResolvedDeps, a as ModuleRoutes, b as ContextMeta, c as ContextDecorator, d as ContextDecoratorTarget, f as ContextDecoratorWithDefaults, g as MissingParamKeys, h as DepValue, l as ContextDecoratorRequiringParams, m as ContributorRegistrations, n as AppModuleClass, o as AnyContributorRegistration, p as ContributorRegistration, r as AppModuleEntry, s as CallSiteParams, t as AppModule, u as ContextDecoratorSpec, v as defineContextDecorator, x as ContextMetaKey, y as ContextKeys } from "./app-module-DCA65GZZ.mjs";
9
9
  import { a as CronOptions, c as getCronJobs, d as runCronJob, f as runCronJobs, i as CronJobMeta, l as isCronJobEnabled, n as Cron, o as CronRun, r as CronJob, s as cronScheduleId, t as CRON_META, u as listCronJobs } from "./cron-BTGytNg-.mjs";
10
- import { A as runJob, C as JobLike, D as listJobHandlers, E as ProcessDefinition, O as listJobQueues, S as JobHandler, T as Process, _ as JOB_DISPATCHER, a as KvSessionStoreOptions, b as JobContextCarrier, c as InferHandlerResponse, d as isReply, f as reply, g as JOB_CONTEXT_FIELD, h as waitUntil, i as KvSessionStore, j as stampJobContext, k as registerJobContext, l as Reply, m as settleBackgroundWork, n as KvRateLimitStore, o as RateLimitGuardOptions, p as PlatformContext, r as KvRateLimitStoreOptions, s as rateLimitGuard, t as KvLike, u as applyHandlerResult, v as JOB_META, w as NoJobHandlerError, x as JobDispatcher, y as Job } from "./kv-stores-BZTe23Tw.mjs";
10
+ import { A as listJobHandlers, C as JobContextCarrier, D as NoJobHandlerError, E as JobLike, M as registerJobContext, N as runJob, O as Process, P as stampJobContext, S as Job, T as JobHandler, _ as settleBackgroundWork, a as KvSessionStoreOptions, b as JOB_DISPATCHER, c as InferHandlerResponse, d as Respondable, f as applyHandlerResult, g as PlatformContext, h as reply, i as KvSessionStore, j as listJobQueues, k as ProcessDefinition, l as RESPOND, m as isRespondable, n as KvRateLimitStore, o as RateLimitGuardOptions, p as isReply, r as KvRateLimitStoreOptions, s as rateLimitGuard, t as KvLike, u as Reply, v as waitUntil, w as JobDispatcher, x as JOB_META, y as JOB_CONTEXT_FIELD } from "./kv-stores-Co5k2PYA.mjs";
11
11
  import { a as Cacheable, c as setCacheProvider, i as CacheProvider, n as CacheEvict, o as MemoryCacheProvider, r as CacheOptions, s as getCacheProvider } from "./cache-C0qL0NSD.mjs";
12
12
  import { a as describeError, i as createLogger, n as Logger, r as LoggerProvider, t as ConsoleLoggerProvider } from "./logger-xE9qI_FS.mjs";
13
- import { $ as MissingMountDepError, A as defineHttpContextDecorator, B as CRON_WORKER_ENV, C as RequestStore, D as buildRoutes, E as requestStore, F as bootstrap, G as offerRoutePolicy, H as KickCronAdapter, I as ERROR_CHANNEL, J as GroupAssetKeysOptions, K as AssetKeyPair, L as HANDLER_CHANNEL, M as isClusterPrimary, N as KickHandler, O as expressRuntime, P as createHandler, Q as DuplicateMountNameError, R as HandlerTraceContext, S as requestScopeMiddleware, T as getRequestValue, U as RoutePolicyTable, V as CronAdapterOptions, W as bindRoutePolicy, X as groupAssetKeys, Y as GroupAssetKeysResult, Z as stripExt, _ as TRACEPARENT_HEADER, _t as Disposable, at as DuplicateContributorError, b as parseTraceparent, c as HealthController, ct as CircuitBreaker, d as healthModule, dt as CircuitBreakerStats, et as MountCycleError, f as SpaAdapter, ft as CircuitOpenError, g as ViewAdapterOptions, gt as formatKickError, h as ViewAdapter, ht as KickErrorInit, i as ServerOptions, it as ContributorCycleError, j as ClusterOptions, k as materializeRouter, l as HealthModuleConfig, lt as CircuitBreakerOptions, mt as KickError, n as ApplicationOptions, nt as MountSortItem, o as HEALTH_PROBE, ot as MissingContextValueError, p as SpaAdapterOptions, pt as FormatKickErrorOptions, q as AssetKeyStrategy, r as MiddlewareEntry, rt as mountSort, s as HealthCheckResult, st as MissingContributorError, t as Application, tt as MountKind, u as HealthProbe, ut as CircuitBreakerState, v as TraceContext, vt as disposeAll, w as getRequestStore, x as traceContext, y as TraceContextOptions, yt as registerDisposable, z as RESPONSE_CHANNEL } from "./application-CGxZCYl1.mjs";
13
+ import { $ as MissingMountDepError, A as defineHttpContextDecorator, B as CRON_WORKER_ENV, C as RequestStore, D as buildRoutes, E as requestStore, F as bootstrap, G as offerRoutePolicy, H as KickCronAdapter, I as ERROR_CHANNEL, J as GroupAssetKeysOptions, K as AssetKeyPair, L as HANDLER_CHANNEL, M as isClusterPrimary, N as KickHandler, O as expressRuntime, P as createHandler, Q as DuplicateMountNameError, R as HandlerTraceContext, S as requestScopeMiddleware, T as getRequestValue, U as RoutePolicyTable, V as CronAdapterOptions, W as bindRoutePolicy, X as groupAssetKeys, Y as GroupAssetKeysResult, Z as stripExt, _ as TRACEPARENT_HEADER, _t as Disposable, at as DuplicateContributorError, b as parseTraceparent, c as HealthController, ct as CircuitBreaker, d as healthModule, dt as CircuitBreakerStats, et as MountCycleError, f as SpaAdapter, ft as CircuitOpenError, g as ViewAdapterOptions, gt as formatKickError, h as ViewAdapter, ht as KickErrorInit, i as ServerOptions, it as ContributorCycleError, j as ClusterOptions, k as materializeRouter, l as HealthModuleConfig, lt as CircuitBreakerOptions, mt as KickError, n as ApplicationOptions, nt as MountSortItem, o as HEALTH_PROBE, ot as MissingContextValueError, p as SpaAdapterOptions, pt as FormatKickErrorOptions, q as AssetKeyStrategy, r as MiddlewareEntry, rt as mountSort, s as HealthCheckResult, st as MissingContributorError, t as Application, tt as MountKind, u as HealthProbe, ut as CircuitBreakerState, v as TraceContext, vt as disposeAll, w as getRequestStore, x as traceContext, y as TraceContextOptions, yt as registerDisposable, z as RESPONSE_CHANNEL } from "./application-oIPzgjfk.mjs";
14
14
  import { a as ProblemException, c as defaultProblemTitle, i as ProblemDetails, l as normalizeProblem, n as HttpStatus, o as Problems, r as HttpStatusCode, s as ValidationError, t as HttpException } from "./errors-By6UueCm.mjs";
15
15
  import { n as joinPaths, r as normalizePath, t as buildMountPath } from "./path-CMwIHsdv.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-BkMNA0kp.mjs";
17
- import { a as session, i as SessionStore, n as SessionData, r as SessionOptions, t as Session } from "./session-4Tb6q0Ny.mjs";
17
+ import { a as session, i as SessionStore, n as SessionData, r as SessionOptions, t as Session } from "./session-B4hOZj90.mjs";
18
18
  import { C as SortItem, S as QueryFieldConfig, T as TypedParsedQuery, _ as FilterOperator, a as getQueryParsingDefaults, b as ParsedQuery, c as parseQuery, d as resetQueryParsingDefaults, f as setQueryParsingDefaults, g as FilterItem, h as FieldsOf, i as buildQueryParams, l as parseSearchQuery, m as FILTER_OPERATORS, n as QueryRejectReason, o as parseFilters, r as QueryRejection, s as parsePagination, t as ParseQueryOptions, u as parseSort, v as PaginatedResponse, x as QueryBuilderAdapter, y as PaginationParams } from "./index-BfT5KZ-M.mjs";
19
- import { i as buildRouteTable, t as BuildRoutesOptions } from "./router-builder-CDkW88KQ.mjs";
19
+ import { i as buildRouteTable, t as BuildRoutesOptions } from "./router-builder-zWuVIOmd.mjs";
20
20
  import { n as requestId, t as REQUEST_ID_HEADER } from "./request-id-CVzJ1uHD.mjs";
21
21
  import { n as validate } from "./validate-DMYpUnrf.mjs";
22
- import { n as errorHandler, r as notFoundHandler } from "./error-handler-itG65lj0.mjs";
22
+ import { n as errorHandler, r as notFoundHandler } from "./error-handler-BB9wAElm.mjs";
23
23
  import { i as csrfGuard, n as CsrfOptions, r as csrf, t as CsrfGuardOptions } from "./csrf-C73UkRgc.mjs";
24
24
  import { i as requestLogger, n as LoggedResponse, r as RequestLoggerOptions, t as LoggedRequest } from "./request-logger-TgcKRNDD.mjs";
25
25
  import { n as HelmetOptions, r as helmet } from "./helmet-C2QEU6S-.mjs";
26
26
  import { n as cors, t as CorsOptions } from "./cors-CsibNTQ6.mjs";
27
27
  import { n as RateLimitStore, r as rateLimit, t as RateLimitOptions } from "./rate-limit-Bwed3jOV.mjs";
28
- import { i as upload, l as resolveMimeTypes, n as buildUploadMiddleware, r as cleanupFiles, t as UploadOptions } from "./upload-Cy7qQy7M.mjs";
29
- export { ASSETS, ASSET_MANIFEST_VERSION, type ActiveRuntime, type AdapterAsyncOptions, type AdapterContext, type AdapterFactory, type AdapterHttp, type AdapterMiddleware, type AnyContributorRegistration, ApiQueryParams, type ApiQueryParamsConfig, type ApiQueryParamsConfig as QueryParamsConfig, type AppAdapter, type AppAdapterClass, type AppModule, type AppModuleClass, type AppModuleEntry, Application, type ApplicationOptions, Asset, type AssetKey, type AssetKeyPair, type AssetKeyStrategy, Autowired, type BareRouteFlag, type BaseUploadOptions, type BuildContext, type BuildPipelineOptions, type BuildRoutesOptions, type Buildable, Builder, type BuilderOf, CRON_META, CRON_WORKER_ENV, CacheEvict, type CacheOptions, type CacheProvider, Cacheable, type CallSiteParams, CircuitBreaker, type CircuitBreakerOptions, type CircuitBreakerState, type CircuitBreakerStats, CircuitOpenError, type ClassKind, type ClusterOptions, type ColumnApiQueryParamsConfig, Component, type ComputedRef, ConfigService, type ConnectMiddleware, ConsoleLoggerProvider, type Constructor, Container, type ContainerChangeEvent, type ContainerChangeListener, type ContextDecorator, type ContextDecoratorRequiringParams, type ContextDecoratorSpec, type ContextDecoratorTarget, type ContextDecoratorWithDefaults, type ContextKeys, type ContextMeta, type ContextMetaKey, ContributorCycleError, type ContributorPipeline, type ContributorRegistration, type ContributorRegistrations, type ContributorSource, Controller, type CorsOptions, Cron, type CronAdapterOptions, type CronJob, type CronJobMeta, type CronOptions, type CronRun, type CsrfGuardOptions, type CsrfOptions, type Ctx, type CtxHandler, type DeepReadonly, type DefineAdapterOptions, type DefineModuleOptions, type DefinePluginOptions, Delete, type DepValue, type Disposable, DuplicateContributorError, DuplicateMountNameError, ERROR_CHANNEL, type Env, type EnvKey, type ErrorInfo, type ErrorSource, type ExecutionContext, type ExpressRuntimeTypes, FILTER_OPERATORS, type FieldsOf, type FileTypeFilter, FileUpload, type FileUploadConfig, type FilterItem, type FilterOperator, type FormatKickErrorOptions, Get, type GroupAssetKeysOptions, type GroupAssetKeysResult, HANDLER_CHANNEL, HEALTH_PROBE, type HandlerTraceContext, type HealthCheckResult, HealthController, type HealthModuleConfig, type HealthProbe, type HelmetOptions, HttpException, type HttpRuntime, HttpStatus, type HttpStatusCode, INJECTION_TOKEN, type InferHandlerResponse, Inject, Injectable, type InjectionToken, type IntrospectFn, type IntrospectionKind, type IntrospectionSnapshot, JOB_CONTEXT_FIELD, JOB_DISPATCHER, JOB_META, Job, type JobContextCarrier, type JobDispatcher, type JobHandler, type JobLike, type KickAssets, KickCronAdapter, KickError, type KickErrorInit, type KickHandler, type KickJsPluginName, type KickJsPluginRegistry, type KickJsRegistry, type KickPlugin, type KickRouteFlags, type KickRuntimeRegister, type KickServer, type KvLike, KvRateLimitStore, type KvRateLimitStoreOptions, KvSessionStore, type KvSessionStoreOptions, type LoggedRequest, type LoggedResponse, Logger, type LoggerProvider, METADATA, type MatchedRoute, type MaybePromise, MemoryCacheProvider, type MetaValue, Middleware, type MiddlewareEntry, type MiddlewareHandler, type MiddlewarePath, type MiddlewarePhase, MissingContextValueError, MissingContributorError, MissingMountDepError, type MissingParamKeys, type ModuleFactory, ModuleList, type ModuleRegistry, type ModuleRoutes, MountCycleError, type MountKind, type MountSortItem, MutableModuleRegistry, type NegatedRouteFlagName, NoJobHandlerError, type PaginatedResponse, type PaginationParams, type ParseQueryOptions, type ParsedQuery, Patch, type PlatformContext, type PluginAsyncOptions, type PluginFactory, Post, PostConstruct, type PostConstructStatus, PreDestroy, type ProblemDetails, ProblemException, Problems, Process, type ProcessDefinition, Put, type QueryBuilderAdapter, type QueryFieldConfig, type QueryRejectReason, type QueryRejection, REQUEST_ID_HEADER, RESPONSE_CHANNEL, type RateLimitGuardOptions, type RateLimitOptions, type RateLimitStore, type Ref, type Reply, Repository, RequestContext, type RequestLoggerOptions, type RequestStore, type ResolvedDeps, type ResponseInfo, type RouteDefinition, type RouteEntry, type RouteFlag, type RouteFlagContext, type RouteFlagDeclaration, type RouteFlagDeclarations, type RouteFlagName, type RouteFlagPredicate, type RouteFlagRecord, type RouteFlagTest, type RouteFlagValue, type RouteFlags, type RouteMeta, type RouteMethod, RoutePolicyTable, type RouteShape, type RouteTable, type RunContributorsOptions, type RuntimeAppOptions, type RuntimeCapabilities, type RuntimeResponse, type RuntimeTypeMap, Scope, type ServerOptions, Service, type ServiceOptions, type Session, type SessionData, type SessionOptions, type SessionStore, type SortItem, type SourcedRegistration, SpaAdapter, type SpaAdapterOptions, type SseHandler, TRACEPARENT_HEADER, type TraceContext, type TraceContextOptions, type TypedConfigService, type TypedParsedQuery, UnknownAssetError, type UploadOptions, type UseConnectOptions, type ValidationError, Value, type ValuedRouteFlag, ViewAdapter, type ViewAdapterOptions, type WatchOptions, applyHandlerResult, assertFlagTest, assets, baseEnvSchema, bindRoutePolicy, bootstrap, buildMountPath, buildPipeline, buildQueryParams, buildRouteTable, buildRoutes, buildUploadMiddleware, cleanupFiles, clearAssetCache, computed, cors, createConfigService, createHandler, createLogger, createToken, cronScheduleId, csrf, csrfGuard, defaultProblemTitle, defineAdapter, defineContextDecorator, defineEnv, defineHttpContextDecorator, defineModule, defineModules, definePlugin, defineRouteFlag, describeError, disposeAll, errorHandler, expressRuntime, formatKickError, getCacheProvider, getClassMeta, getClassMetaOrUndefined, getCronJobs, getEnv, getMetaMap, getMetaRecord, getMethodMeta, getMethodMetaOrUndefined, getQueryParsingDefaults, getRequestStore, getRequestValue, getRouteFlags, groupAssetKeys, hasClassMeta, healthModule, helmet, isClusterPrimary, isCronJobEnabled, isInjectionToken, isRef, isReply, joinPaths, listCronJobs, listJobHandlers, listJobQueues, loadEnv, loadEnvFromSchema, matchesFlagTest, materializeRouter, mountSort, normalizeApiQueryParamsConfig, normalizePath, normalizeProblem, notFoundHandler, offerRoutePolicy, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort, parseTraceparent, pushClassMeta, pushMethodMeta, rateLimit, rateLimitGuard, reactive, ref, registerDisposable, registerJobContext, reloadEnv, reply, reportError, reportResponse, requestId, requestLogger, requestScopeMiddleware, requestStore, resetEnvCache, resetQueryParsingDefaults, resolveAsset, resolveMimeTypes, resolveRouteFlags, runContributors, runCronJob, runCronJobs, runJob, session, setCacheProvider, setClassMeta, setInMetaMap, setInMetaRecord, setMethodMeta, setQueryParsingDefaults, settleBackgroundWork, stampJobContext, stripExt, toRefs, tokenName, traceContext, unref, upload, useAssets, validate, waitUntil, watch, withBuilder, withEnv };
28
+ import { i as upload, l as resolveMimeTypes, n as buildUploadMiddleware, r as cleanupFiles, t as UploadOptions } from "./upload-CiMtdXWD.mjs";
29
+ export { ASSETS, ASSET_MANIFEST_VERSION, type ActiveRuntime, type AdapterAsyncOptions, type AdapterContext, type AdapterFactory, type AdapterHttp, type AdapterMiddleware, type AnyContributorRegistration, ApiQueryParams, type ApiQueryParamsConfig, type ApiQueryParamsConfig as QueryParamsConfig, type AppAdapter, type AppAdapterClass, type AppModule, type AppModuleClass, type AppModuleEntry, Application, type ApplicationOptions, Asset, type AssetKey, type AssetKeyPair, type AssetKeyStrategy, Autowired, type BareRouteFlag, type BaseUploadOptions, type BuildContext, type BuildPipelineOptions, type BuildRoutesOptions, type Buildable, Builder, type BuilderOf, CRON_META, CRON_WORKER_ENV, CacheEvict, type CacheOptions, type CacheProvider, Cacheable, type CallSiteParams, CircuitBreaker, type CircuitBreakerOptions, type CircuitBreakerState, type CircuitBreakerStats, CircuitOpenError, type ClassKind, type ClusterOptions, type ColumnApiQueryParamsConfig, Component, type ComputedRef, ConfigService, type ConnectMiddleware, ConsoleLoggerProvider, type Constructor, Container, type ContainerChangeEvent, type ContainerChangeListener, type ContextDecorator, type ContextDecoratorRequiringParams, type ContextDecoratorSpec, type ContextDecoratorTarget, type ContextDecoratorWithDefaults, type ContextKeys, type ContextMeta, type ContextMetaKey, ContributorCycleError, type ContributorPipeline, type ContributorRegistration, type ContributorRegistrations, type ContributorSource, Controller, type CorsOptions, Cron, type CronAdapterOptions, type CronJob, type CronJobMeta, type CronOptions, type CronRun, type CsrfGuardOptions, type CsrfOptions, type Ctx, type CtxHandler, type DeepReadonly, type DefineAdapterOptions, type DefineModuleOptions, type DefinePluginOptions, Delete, type DepValue, type Disposable, DuplicateContributorError, DuplicateMountNameError, ERROR_CHANNEL, type Env, type EnvKey, type ErrorInfo, type ErrorSource, type ExecutionContext, type ExpressRuntimeTypes, FILTER_OPERATORS, type FieldsOf, type FileTypeFilter, FileUpload, type FileUploadConfig, type FilterItem, type FilterOperator, type FormatKickErrorOptions, Get, type GroupAssetKeysOptions, type GroupAssetKeysResult, HANDLER_CHANNEL, HEALTH_PROBE, type HandlerTraceContext, type HealthCheckResult, HealthController, type HealthModuleConfig, type HealthProbe, type HelmetOptions, HttpException, type HttpRuntime, HttpStatus, type HttpStatusCode, INJECTION_TOKEN, type InferHandlerResponse, Inject, Injectable, type InjectionToken, type IntrospectFn, type IntrospectionKind, type IntrospectionSnapshot, JOB_CONTEXT_FIELD, JOB_DISPATCHER, JOB_META, Job, type JobContextCarrier, type JobDispatcher, type JobHandler, type JobLike, type KickAssets, KickCronAdapter, KickError, type KickErrorInit, type KickHandler, type KickJsPluginName, type KickJsPluginRegistry, type KickJsRegistry, type KickPlugin, type KickRouteFlags, type KickRuntimeRegister, type KickServer, type KvLike, KvRateLimitStore, type KvRateLimitStoreOptions, KvSessionStore, type KvSessionStoreOptions, type LoggedRequest, type LoggedResponse, Logger, type LoggerProvider, METADATA, type MatchedRoute, type MaybePromise, MemoryCacheProvider, type MetaValue, Middleware, type MiddlewareEntry, type MiddlewareHandler, type MiddlewarePath, type MiddlewarePhase, MissingContextValueError, MissingContributorError, MissingMountDepError, type MissingParamKeys, type ModuleFactory, ModuleList, type ModuleRegistry, type ModuleRoutes, MountCycleError, type MountKind, type MountSortItem, MutableModuleRegistry, type NegatedRouteFlagName, NoJobHandlerError, type PaginatedResponse, type PaginationParams, type ParseQueryOptions, type ParsedQuery, Patch, type PlatformContext, type PluginAsyncOptions, type PluginFactory, Post, PostConstruct, type PostConstructStatus, PreDestroy, type ProblemDetails, ProblemException, Problems, Process, type ProcessDefinition, Put, type QueryBuilderAdapter, type QueryFieldConfig, type QueryRejectReason, type QueryRejection, REQUEST_ID_HEADER, RESPOND, RESPONSE_CHANNEL, type RateLimitGuardOptions, type RateLimitOptions, type RateLimitStore, type Ref, type Reply, Repository, RequestContext, type RequestLoggerOptions, type RequestStore, type ResolvedDeps, type Respondable, type ResponseInfo, type RouteDefinition, type RouteEntry, type RouteFlag, type RouteFlagContext, type RouteFlagDeclaration, type RouteFlagDeclarations, type RouteFlagName, type RouteFlagPredicate, type RouteFlagRecord, type RouteFlagTest, type RouteFlagValue, type RouteFlags, type RouteMeta, type RouteMethod, RoutePolicyTable, type RouteShape, type RouteTable, type RunContributorsOptions, type RuntimeAppOptions, type RuntimeCapabilities, type RuntimeResponse, type RuntimeTypeMap, Scope, type ServerOptions, Service, type ServiceOptions, type Session, type SessionData, type SessionOptions, type SessionStore, type SortItem, type SourcedRegistration, SpaAdapter, type SpaAdapterOptions, type SseHandler, TRACEPARENT_HEADER, type TraceContext, type TraceContextOptions, type TypedConfigService, type TypedParsedQuery, UnknownAssetError, type UploadOptions, type UseConnectOptions, type ValidationError, Value, type ValuedRouteFlag, ViewAdapter, type ViewAdapterOptions, type WatchOptions, applyHandlerResult, assertFlagTest, assets, baseEnvSchema, bindRoutePolicy, bootstrap, buildMountPath, buildPipeline, buildQueryParams, buildRouteTable, buildRoutes, buildUploadMiddleware, cleanupFiles, clearAssetCache, computed, cors, createConfigService, createHandler, createLogger, createToken, cronScheduleId, csrf, csrfGuard, defaultProblemTitle, defineAdapter, defineContextDecorator, defineEnv, defineHttpContextDecorator, defineModule, defineModules, definePlugin, defineRouteFlag, describeError, disposeAll, errorHandler, expressRuntime, formatKickError, getCacheProvider, getClassMeta, getClassMetaOrUndefined, getCronJobs, getEnv, getMetaMap, getMetaRecord, getMethodMeta, getMethodMetaOrUndefined, getQueryParsingDefaults, getRequestStore, getRequestValue, getRouteFlags, groupAssetKeys, hasClassMeta, healthModule, helmet, isClusterPrimary, isCronJobEnabled, isInjectionToken, isRef, isReply, isRespondable, joinPaths, listCronJobs, listJobHandlers, listJobQueues, loadEnv, loadEnvFromSchema, matchesFlagTest, materializeRouter, mountSort, normalizeApiQueryParamsConfig, normalizePath, normalizeProblem, notFoundHandler, offerRoutePolicy, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort, parseTraceparent, pushClassMeta, pushMethodMeta, rateLimit, rateLimitGuard, reactive, ref, registerDisposable, registerJobContext, reloadEnv, reply, reportError, reportResponse, requestId, requestLogger, requestScopeMiddleware, requestStore, resetEnvCache, resetQueryParsingDefaults, resolveAsset, resolveMimeTypes, resolveRouteFlags, runContributors, runCronJob, runCronJobs, runJob, session, setCacheProvider, setClassMeta, setInMetaMap, setInMetaRecord, setMethodMeta, setQueryParsingDefaults, settleBackgroundWork, stampJobContext, stripExt, toRefs, tokenName, traceContext, unref, upload, useAssets, validate, waitUntil, watch, withBuilder, withEnv };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v9.2.0
2
+ * @forinda/kickjs v10.1.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 loadEnvFromSchema,c as withEnv,i as loadEnv,n as defineEnv,o as reloadEnv,r as getEnv,s as resetEnvCache,t as baseEnvSchema}from"./env-__fzPsHD.mjs";import{METADATA,Scope}from"./core/interfaces.mjs";import{a as isInjectionToken,d as KickError,f as formatKickError,i as createToken,n as tokenName,r as INJECTION_TOKEN,t as Container}from"./container-CAPN7pBG.mjs";import{ConsoleLoggerProvider,Logger,createLogger,describeError}from"./core/logger.mjs";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-CzzRUnAx.mjs";import{ApiQueryParams,Asset,Autowired,Builder,Component,Controller,Delete,FileUpload,Get,Inject,Injectable,Middleware,Patch,Post,PostConstruct,PreDestroy,Put,Repository,Service,Value,normalizeApiQueryParamsConfig,withBuilder}from"./core/decorators.mjs";import{a as HEALTH_PROBE,c as ERROR_CHANNEL,d as DuplicateMountNameError,f as MissingMountDepError,h as defineModule,i as materializeRouter,l as HANDLER_CHANNEL,m as mountSort,n as buildRoutes,o as HealthController,p as MountCycleError,r as expressRuntime,s as healthModule,t as Application,u as RESPONSE_CHANNEL}from"./application-BSJpaiSY.mjs";import{t as MutableModuleRegistry}from"./module-registry-BnmRNy-3.mjs";import{i as reportResponse,r as reportError}from"./observers-COlQfinD.mjs";import{CRON_META,Cron,cronScheduleId,getCronJobs,isCronJobEnabled,listCronJobs,runCronJob,runCronJobs}from"./core/cron.mjs";import{a as NoJobHandlerError,c as listJobQueues,d as stampJobContext,i as Job,l as registerJobContext,n as JOB_DISPATCHER,o as Process,r as JOB_META,s as listJobHandlers,t as JOB_CONTEXT_FIELD,u as runJob}from"./jobs-BmpeFvi0.mjs";import{CacheEvict,Cacheable,MemoryCacheProvider,getCacheProvider,setCacheProvider}from"./core/cache.mjs";import{r as registerDisposable,t as disposeAll}from"./disposables-NlW6Mibk.mjs";import{HttpException,HttpStatus,ProblemException,Problems,defaultProblemTitle,normalizeProblem}from"./core/errors.mjs";import{buildMountPath,joinPaths,normalizePath}from"./core/path.mjs";import{computed,isRef,reactive,ref,toRefs,unref,watch}from"./core/reactivity.mjs";import{l as resolveRouteFlags,n as assertFlagTest,o as getRouteFlags,r as defineRouteFlag,s as matchesFlagTest}from"./route-flag-Bb7n9Mnp.mjs";import{a as clearAssetCache,c as groupAssetKeys,i as assets,l as stripExt,n as ASSET_MANIFEST_VERSION,o as resolveAsset,r as UnknownAssetError,s as useAssets,t as ASSETS,u as defineContextDecorator}from"./core-DKrKVLfj.mjs";import{i as MissingContributorError,n as DuplicateContributorError,r as MissingContextValueError,t as ContributorCycleError}from"./context-errors-DYJjhalQ.mjs";import{i as buildPipeline,r as buildRouteTable}from"./router-builder-DawnRzlp.mjs";import{t as runContributors}from"./contributor-runner-vk9XlOED.mjs";import{t as defineAdapter}from"./define-adapter-C6lFhCL-.mjs";import{n as bindRoutePolicy,r as offerRoutePolicy,t as RoutePolicyTable}from"./route-policy-C_Wsc-b1.mjs";import{n as isReply,r as reply,s as requestScopeMiddleware,t as applyHandlerResult}from"./reply-CbTYIj_e.mjs";import{REQUEST_ID_HEADER,requestId}from"./http/middleware/request-id.mjs";import{a as forwardBackgroundWork,c as waitUntil,d as requestStore,l as getRequestStore,s as settleBackgroundWork,t as RequestContext,u as getRequestValue}from"./context-gpvcMlG5.mjs";import{errorHandler,notFoundHandler}from"./http/middleware/error-handler.mjs";import{a as parseQuery,c as resetQueryParsingDefaults,i as parsePagination,l as setQueryParsingDefaults,n as getQueryParsingDefaults,o as parseSearchQuery,r as parseFilters,s as parseSort,t as buildQueryParams,u as FILTER_OPERATORS}from"./query-B5DTq_4W.mjs";import{validate}from"./http/middleware/validate.mjs";import{r as resolveMimeTypes}from"./upload-config-D01Ty40f.mjs";import{buildUploadMiddleware,cleanupFiles,upload}from"./http/middleware/upload.mjs";import{i as KickCronAdapter,n as isClusterPrimary,r as CRON_WORKER_ENV,t as bootstrap}from"./bootstrap-CbTF6xvv.mjs";import{n as csrfGuard,r as randomHex,t as csrf}from"./csrf-CxJItZVa.mjs";import{requestLogger}from"./http/middleware/request-logger.mjs";import{helmet}from"./http/middleware/helmet.mjs";import{cors}from"./http/middleware/cors.mjs";import{rateLimit}from"./http/middleware/rate-limit.mjs";import{n as KvSessionStore,r as rateLimitGuard,t as KvRateLimitStore}from"./kv-stores-DJwxntyw.mjs";import{session}from"./http/middleware/session.mjs";import{ViewAdapter}from"./http/middleware/views.mjs";import{SpaAdapter}from"./http/middleware/spa.mjs";import{n as createConfigService,t as ConfigService}from"./config-DmGiAIuH.mjs";var ModuleList=class extends Array{mount(module){return this.push(module),this}};function defineModules(...initial){let list=new ModuleList;for(let entry of initial)list.push(entry);return list}var CircuitOpenError=class extends Error{breakerName;constructor(breakerName){super(`Circuit breaker "${breakerName}" is open — request rejected`),this.breakerName=breakerName,this.name=`CircuitOpenError`}},CircuitBreaker=class{name;state=`closed`;failures=0;successes=0;halfOpenAttempts=0;lastFailure;openedAt;failureThreshold;resetTimeout;halfOpenMax;constructor(name,options){this.name=name,this.failureThreshold=options.failureThreshold,this.resetTimeout=options.resetTimeout,this.halfOpenMax=options.halfOpenMax??1}async execute(fn){if(this.maybeTransitionToHalfOpen(),this.state===`open`||this.state===`half_open`&&this.halfOpenAttempts>=this.halfOpenMax)throw new CircuitOpenError(this.name);this.state===`half_open`&&this.halfOpenAttempts++;try{let result=await fn();return this.onSuccess(),result}catch(error){throw this.onFailure(),error}}getState(){return this.maybeTransitionToHalfOpen(),this.state}getStats(){return this.maybeTransitionToHalfOpen(),{failures:this.failures,successes:this.successes,state:this.state,...this.lastFailure?{lastFailure:this.lastFailure}:{}}}reset(){this.state=`closed`,this.failures=0,this.successes=0,this.halfOpenAttempts=0,this.lastFailure=void 0,this.openedAt=void 0}onSuccess(){this.state===`half_open`&&(this.state=`closed`,this.failures=0,this.halfOpenAttempts=0,this.openedAt=void 0),this.successes++}onFailure(){this.failures++,this.lastFailure=new Date,this.state===`half_open`?(this.state=`open`,this.openedAt=Date.now(),this.halfOpenAttempts=0):this.state===`closed`&&this.failures>=this.failureThreshold&&(this.state=`open`,this.openedAt=Date.now())}maybeTransitionToHalfOpen(){this.state===`open`&&this.openedAt!=null&&Date.now()-this.openedAt>=this.resetTimeout&&(this.state=`half_open`,this.halfOpenAttempts=0)}};const mergeConfig=(defaults={},overrides={})=>({...defaults,...overrides}),composeName=(base,scope)=>`${base}:${scope}`;function definePlugin(options){let buildSync=(instanceName,scoped,overrides)=>{let config=mergeConfig(options.defaults,overrides),built=options.build(config,{name:instanceName,scoped});return built.name=instanceName,built},buildAsync=(instanceName,opts)=>{let inner,ensureInner=async container=>{if(inner)return inner;let deps=(opts.inject??[]).map(tok=>container.resolve(tok)),config=await opts.useFactory(...deps);return inner=buildSync(instanceName,!1,config),inner};return{name:instanceName,async onReady(container){let built=await ensureInner(container);built.register?.(container),await built.onReady?.(container)},async shutdown(){await inner?.shutdown?.()}}},factory=(config=>buildSync(options.name,!1,config));return factory.scoped=(scopeName,config)=>buildSync(composeName(options.name,scopeName),!0,config),factory.async=opts=>buildAsync(options.name,opts),Object.defineProperty(factory,"definition",{value:Object.freeze({...options})}),factory}function createHandler(options){let app,ready=()=>(app??=(async()=>{let instance=new Application(options);try{await instance.startWithoutServer()}catch(err){throw app=void 0,await instance.shutdown().catch(()=>{}),err}return instance})(),app);return{ready,async fetch(request,platform){let response=await(await ready()).fetch(request);return forwardBackgroundWork(platform),response},async node(req,res,platform){if((await ready()).handle(req,res),platform?.waitUntil){let sent=new Promise(resolve=>res.once(`close`,()=>resolve()));platform.waitUntil(sent.then(settleBackgroundWork))}},async close(){let current=app;app=void 0,current&&await(await current).shutdown()}}}function defineHttpContextDecoratorImpl(spec){return defineContextDecorator(spec)}const defineHttpContextDecorator=Object.freeze(Object.assign(defineHttpContextDecoratorImpl,{withParams:()=>spec=>defineHttpContextDecoratorImpl(spec)})),TRACEPARENT_HEADER=`traceparent`,TRACEPARENT_RE=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;function generateTraceId(){return randomHex(16)}function generateSpanId(){return randomHex(8)}function parseTraceparent(header){let match=TRACEPARENT_RE.exec(header.trim().toLowerCase());if(!match)return null;let version=match[1],traceId=match[2],parentSpanId=match[3],flags=match[4];return version===`ff`||traceId===`00000000000000000000000000000000`||parentSpanId===`0000000000000000`?null:{version,traceId,parentSpanId,flags}}function traceContext(options={}){return(req,res,next)=>{let store=requestStore.getStore(),traceparentHeader=req.headers[TRACEPARENT_HEADER],raw=Array.isArray(traceparentHeader)?traceparentHeader[0]:traceparentHeader,parsed=raw?parseTraceparent(raw):null,traceId=parsed?.traceId??generateTraceId(),spanId=generateSpanId();store&&(store.values.set(`traceId`,traceId),store.values.set(`spanId`,spanId),parsed&&(store.values.set(`parentSpanId`,parsed.parentSpanId),store.values.set(`traceFlags`,parsed.flags),store.values.set(`traceVersion`,parsed.version))),req.traceId=traceId,req.spanId=spanId,options.propagateResponse&&res.setHeader(`traceresponse`,traceId),next()}}export{ASSETS,ASSET_MANIFEST_VERSION,ApiQueryParams,Application,Asset,Autowired,Builder,CRON_META,CRON_WORKER_ENV,CacheEvict,Cacheable,CircuitBreaker,CircuitOpenError,Component,ConfigService,ConsoleLoggerProvider,Container,ContributorCycleError,Controller,Cron,Delete,DuplicateContributorError,DuplicateMountNameError,ERROR_CHANNEL,FILTER_OPERATORS,FileUpload,Get,HANDLER_CHANNEL,HEALTH_PROBE,HealthController,HttpException,HttpStatus,INJECTION_TOKEN,Inject,Injectable,JOB_CONTEXT_FIELD,JOB_DISPATCHER,JOB_META,Job,KickCronAdapter,KickError,KvRateLimitStore,KvSessionStore,Logger,METADATA,MemoryCacheProvider,Middleware,MissingContextValueError,MissingContributorError,MissingMountDepError,ModuleList,MountCycleError,MutableModuleRegistry,NoJobHandlerError,Patch,Post,PostConstruct,PreDestroy,ProblemException,Problems,Process,Put,REQUEST_ID_HEADER,RESPONSE_CHANNEL,Repository,RequestContext,RoutePolicyTable,Scope,Service,SpaAdapter,TRACEPARENT_HEADER,UnknownAssetError,Value,ViewAdapter,applyHandlerResult,assertFlagTest,assets,baseEnvSchema,bindRoutePolicy,bootstrap,buildMountPath,buildPipeline,buildQueryParams,buildRouteTable,buildRoutes,buildUploadMiddleware,cleanupFiles,clearAssetCache,computed,cors,createConfigService,createHandler,createLogger,createToken,cronScheduleId,csrf,csrfGuard,defaultProblemTitle,defineAdapter,defineContextDecorator,defineEnv,defineHttpContextDecorator,defineModule,defineModules,definePlugin,defineRouteFlag,describeError,disposeAll,errorHandler,expressRuntime,formatKickError,getCacheProvider,getClassMeta,getClassMetaOrUndefined,getCronJobs,getEnv,getMetaMap,getMetaRecord,getMethodMeta,getMethodMetaOrUndefined,getQueryParsingDefaults,getRequestStore,getRequestValue,getRouteFlags,groupAssetKeys,hasClassMeta,healthModule,helmet,isClusterPrimary,isCronJobEnabled,isInjectionToken,isRef,isReply,joinPaths,listCronJobs,listJobHandlers,listJobQueues,loadEnv,loadEnvFromSchema,matchesFlagTest,materializeRouter,mountSort,normalizeApiQueryParamsConfig,normalizePath,normalizeProblem,notFoundHandler,offerRoutePolicy,parseFilters,parsePagination,parseQuery,parseSearchQuery,parseSort,parseTraceparent,pushClassMeta,pushMethodMeta,rateLimit,rateLimitGuard,reactive,ref,registerDisposable,registerJobContext,reloadEnv,reply,reportError,reportResponse,requestId,requestLogger,requestScopeMiddleware,requestStore,resetEnvCache,resetQueryParsingDefaults,resolveAsset,resolveMimeTypes,resolveRouteFlags,runContributors,runCronJob,runCronJobs,runJob,session,setCacheProvider,setClassMeta,setInMetaMap,setInMetaRecord,setMethodMeta,setQueryParsingDefaults,settleBackgroundWork,stampJobContext,stripExt,toRefs,tokenName,traceContext,unref,upload,useAssets,validate,waitUntil,watch,withBuilder,withEnv};
11
+ import{a as loadEnvFromSchema,c as withEnv,i as loadEnv,n as defineEnv,o as reloadEnv,r as getEnv,s as resetEnvCache,t as baseEnvSchema}from"./env-BwzF9MkZ.mjs";import{METADATA,Scope}from"./core/interfaces.mjs";import{a as isInjectionToken,d as KickError,f as formatKickError,i as createToken,n as tokenName,r as INJECTION_TOKEN,t as Container}from"./container-CS9v9UFU.mjs";import{ConsoleLoggerProvider,Logger,createLogger,describeError}from"./core/logger.mjs";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-zvd6AWkE.mjs";import{ApiQueryParams,Asset,Autowired,Builder,Component,Controller,Delete,FileUpload,Get,Inject,Injectable,Middleware,Patch,Post,PostConstruct,PreDestroy,Put,Repository,Service,Value,normalizeApiQueryParamsConfig,withBuilder}from"./core/decorators.mjs";import{a as HEALTH_PROBE,c as ERROR_CHANNEL,d as DuplicateMountNameError,f as MissingMountDepError,h as defineModule,i as materializeRouter,l as HANDLER_CHANNEL,m as mountSort,n as buildRoutes,o as HealthController,p as MountCycleError,r as expressRuntime,s as healthModule,t as Application,u as RESPONSE_CHANNEL}from"./application-Dv514EeR.mjs";import{t as MutableModuleRegistry}from"./module-registry-Daf_P2oD.mjs";import{i as reportResponse,r as reportError}from"./observers-DZgs48UM.mjs";import{CRON_META,Cron,cronScheduleId,getCronJobs,isCronJobEnabled,listCronJobs,runCronJob,runCronJobs}from"./core/cron.mjs";import{a as NoJobHandlerError,c as listJobQueues,d as stampJobContext,i as Job,l as registerJobContext,n as JOB_DISPATCHER,o as Process,r as JOB_META,s as listJobHandlers,t as JOB_CONTEXT_FIELD,u as runJob}from"./jobs-BQ4t3TAb.mjs";import{CacheEvict,Cacheable,MemoryCacheProvider,getCacheProvider,setCacheProvider}from"./core/cache.mjs";import{r as registerDisposable,t as disposeAll}from"./disposables-CuY2S3bw.mjs";import{HttpException,HttpStatus,ProblemException,Problems,defaultProblemTitle,normalizeProblem}from"./core/errors.mjs";import{buildMountPath,joinPaths,normalizePath}from"./core/path.mjs";import{computed,isRef,reactive,ref,toRefs,unref,watch}from"./core/reactivity.mjs";import{l as resolveRouteFlags,n as assertFlagTest,o as getRouteFlags,r as defineRouteFlag,s as matchesFlagTest}from"./route-flag-BWuvJsGZ.mjs";import{a as clearAssetCache,c as groupAssetKeys,i as assets,l as stripExt,n as ASSET_MANIFEST_VERSION,o as resolveAsset,r as UnknownAssetError,s as useAssets,t as ASSETS,u as defineContextDecorator}from"./core-B0JmdBvX.mjs";import{i as MissingContributorError,n as DuplicateContributorError,r as MissingContextValueError,t as ContributorCycleError}from"./context-errors-7C5TBYn7.mjs";import{i as buildPipeline,r as buildRouteTable}from"./router-builder-JvMTp50k.mjs";import{t as runContributors}from"./contributor-runner-DBpRR5dl.mjs";import{t as defineAdapter}from"./define-adapter-BLKlUbSL.mjs";import{n as bindRoutePolicy,r as offerRoutePolicy,t as RoutePolicyTable}from"./route-policy-B3vM6bSf.mjs";import{a as reply,i as isRespondable,l as requestScopeMiddleware,n as applyHandlerResult,r as isReply,t as RESPOND}from"./reply-BDK9xt7Z.mjs";import{REQUEST_ID_HEADER,requestId}from"./http/middleware/request-id.mjs";import{c as waitUntil,d as requestStore,l as getRequestStore,s as settleBackgroundWork,t as RequestContext,u as getRequestValue}from"./context-CtL9RxXp.mjs";import{errorHandler,notFoundHandler}from"./http/middleware/error-handler.mjs";import{a as parseQuery,c as resetQueryParsingDefaults,i as parsePagination,l as setQueryParsingDefaults,n as getQueryParsingDefaults,o as parseSearchQuery,r as parseFilters,s as parseSort,t as buildQueryParams,u as FILTER_OPERATORS}from"./query-B_k9qn0R.mjs";import{validate}from"./http/middleware/validate.mjs";import{r as resolveMimeTypes}from"./upload-config-Dz2INCaa.mjs";import{buildUploadMiddleware,cleanupFiles,upload}from"./http/middleware/upload.mjs";import{a as KickCronAdapter,i as CRON_WORKER_ENV,n as createHandler,r as isClusterPrimary,t as bootstrap}from"./bootstrap-BdyBlBMe.mjs";import{n as csrfGuard,r as randomHex,t as csrf}from"./csrf--1t4qDov.mjs";import{requestLogger}from"./http/middleware/request-logger.mjs";import{helmet}from"./http/middleware/helmet.mjs";import{cors}from"./http/middleware/cors.mjs";import{rateLimit}from"./http/middleware/rate-limit.mjs";import{n as KvSessionStore,r as rateLimitGuard,t as KvRateLimitStore}from"./kv-stores-DsfVy2fk.mjs";import{session}from"./http/middleware/session.mjs";import{ViewAdapter}from"./http/middleware/views.mjs";import{SpaAdapter}from"./http/middleware/spa.mjs";import{n as createConfigService,t as ConfigService}from"./config-CJiGeOca.mjs";var ModuleList=class extends Array{mount(module){return this.push(module),this}};function defineModules(...initial){let list=new ModuleList;for(let entry of initial)list.push(entry);return list}var CircuitOpenError=class extends Error{breakerName;constructor(breakerName){super(`Circuit breaker "${breakerName}" is open — request rejected`),this.breakerName=breakerName,this.name=`CircuitOpenError`}},CircuitBreaker=class{name;state=`closed`;failures=0;successes=0;halfOpenAttempts=0;lastFailure;openedAt;failureThreshold;resetTimeout;halfOpenMax;constructor(name,options){this.name=name,this.failureThreshold=options.failureThreshold,this.resetTimeout=options.resetTimeout,this.halfOpenMax=options.halfOpenMax??1}async execute(fn){if(this.maybeTransitionToHalfOpen(),this.state===`open`||this.state===`half_open`&&this.halfOpenAttempts>=this.halfOpenMax)throw new CircuitOpenError(this.name);this.state===`half_open`&&this.halfOpenAttempts++;try{let result=await fn();return this.onSuccess(),result}catch(error){throw this.onFailure(),error}}getState(){return this.maybeTransitionToHalfOpen(),this.state}getStats(){return this.maybeTransitionToHalfOpen(),{failures:this.failures,successes:this.successes,state:this.state,...this.lastFailure?{lastFailure:this.lastFailure}:{}}}reset(){this.state=`closed`,this.failures=0,this.successes=0,this.halfOpenAttempts=0,this.lastFailure=void 0,this.openedAt=void 0}onSuccess(){this.state===`half_open`&&(this.state=`closed`,this.failures=0,this.halfOpenAttempts=0,this.openedAt=void 0),this.successes++}onFailure(){this.failures++,this.lastFailure=/* @__PURE__ */ new Date,this.state===`half_open`?(this.state=`open`,this.openedAt=Date.now(),this.halfOpenAttempts=0):this.state===`closed`&&this.failures>=this.failureThreshold&&(this.state=`open`,this.openedAt=Date.now())}maybeTransitionToHalfOpen(){this.state===`open`&&this.openedAt!=null&&Date.now()-this.openedAt>=this.resetTimeout&&(this.state=`half_open`,this.halfOpenAttempts=0)}};const mergeConfig=(defaults={},overrides={})=>({...defaults,...overrides}),composeName=(base,scope)=>`${base}:${scope}`;function definePlugin(options){let buildSync=(instanceName,scoped,overrides)=>{let config=mergeConfig(options.defaults,overrides),built=options.build(config,{name:instanceName,scoped});return built.name=instanceName,built},buildAsync=(instanceName,opts)=>{let inner,ensureInner=async container=>{if(inner)return inner;let deps=(opts.inject??[]).map(tok=>container.resolve(tok)),config=await opts.useFactory(...deps);return inner=buildSync(instanceName,!1,config),inner};return{name:instanceName,async onReady(container){let built=await ensureInner(container);built.register?.(container),await built.onReady?.(container)},async shutdown(){await inner?.shutdown?.()}}},factory=(config=>buildSync(options.name,!1,config));return factory.scoped=(scopeName,config)=>buildSync(composeName(options.name,scopeName),!0,config),factory.async=opts=>buildAsync(options.name,opts),Object.defineProperty(factory,"definition",{value:Object.freeze({...options})}),factory}function defineHttpContextDecoratorImpl(spec){return defineContextDecorator(spec)}const defineHttpContextDecorator=Object.freeze(Object.assign(defineHttpContextDecoratorImpl,{withParams:()=>spec=>defineHttpContextDecoratorImpl(spec)})),TRACEPARENT_HEADER=`traceparent`,TRACEPARENT_RE=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;function generateTraceId(){return randomHex(16)}function generateSpanId(){return randomHex(8)}function parseTraceparent(header){let match=TRACEPARENT_RE.exec(header.trim().toLowerCase());if(!match)return null;let version=match[1],traceId=match[2],parentSpanId=match[3],flags=match[4];return version===`ff`||traceId===`00000000000000000000000000000000`||parentSpanId===`0000000000000000`?null:{version,traceId,parentSpanId,flags}}function traceContext(options={}){return(req,res,next)=>{let store=requestStore.getStore(),traceparentHeader=req.headers[TRACEPARENT_HEADER],raw=Array.isArray(traceparentHeader)?traceparentHeader[0]:traceparentHeader,parsed=raw?parseTraceparent(raw):null,traceId=parsed?.traceId??generateTraceId(),spanId=generateSpanId();store&&(store.values.set(`traceId`,traceId),store.values.set(`spanId`,spanId),parsed&&(store.values.set(`parentSpanId`,parsed.parentSpanId),store.values.set(`traceFlags`,parsed.flags),store.values.set(`traceVersion`,parsed.version))),req.traceId=traceId,req.spanId=spanId,options.propagateResponse&&res.setHeader(`traceresponse`,traceId),next()}}export{ASSETS,ASSET_MANIFEST_VERSION,ApiQueryParams,Application,Asset,Autowired,Builder,CRON_META,CRON_WORKER_ENV,CacheEvict,Cacheable,CircuitBreaker,CircuitOpenError,Component,ConfigService,ConsoleLoggerProvider,Container,ContributorCycleError,Controller,Cron,Delete,DuplicateContributorError,DuplicateMountNameError,ERROR_CHANNEL,FILTER_OPERATORS,FileUpload,Get,HANDLER_CHANNEL,HEALTH_PROBE,HealthController,HttpException,HttpStatus,INJECTION_TOKEN,Inject,Injectable,JOB_CONTEXT_FIELD,JOB_DISPATCHER,JOB_META,Job,KickCronAdapter,KickError,KvRateLimitStore,KvSessionStore,Logger,METADATA,MemoryCacheProvider,Middleware,MissingContextValueError,MissingContributorError,MissingMountDepError,ModuleList,MountCycleError,MutableModuleRegistry,NoJobHandlerError,Patch,Post,PostConstruct,PreDestroy,ProblemException,Problems,Process,Put,REQUEST_ID_HEADER,RESPOND,RESPONSE_CHANNEL,Repository,RequestContext,RoutePolicyTable,Scope,Service,SpaAdapter,TRACEPARENT_HEADER,UnknownAssetError,Value,ViewAdapter,applyHandlerResult,assertFlagTest,assets,baseEnvSchema,bindRoutePolicy,bootstrap,buildMountPath,buildPipeline,buildQueryParams,buildRouteTable,buildRoutes,buildUploadMiddleware,cleanupFiles,clearAssetCache,computed,cors,createConfigService,createHandler,createLogger,createToken,cronScheduleId,csrf,csrfGuard,defaultProblemTitle,defineAdapter,defineContextDecorator,defineEnv,defineHttpContextDecorator,defineModule,defineModules,definePlugin,defineRouteFlag,describeError,disposeAll,errorHandler,expressRuntime,formatKickError,getCacheProvider,getClassMeta,getClassMetaOrUndefined,getCronJobs,getEnv,getMetaMap,getMetaRecord,getMethodMeta,getMethodMetaOrUndefined,getQueryParsingDefaults,getRequestStore,getRequestValue,getRouteFlags,groupAssetKeys,hasClassMeta,healthModule,helmet,isClusterPrimary,isCronJobEnabled,isInjectionToken,isRef,isReply,isRespondable,joinPaths,listCronJobs,listJobHandlers,listJobQueues,loadEnv,loadEnvFromSchema,matchesFlagTest,materializeRouter,mountSort,normalizeApiQueryParamsConfig,normalizePath,normalizeProblem,notFoundHandler,offerRoutePolicy,parseFilters,parsePagination,parseQuery,parseSearchQuery,parseSort,parseTraceparent,pushClassMeta,pushMethodMeta,rateLimit,rateLimitGuard,reactive,ref,registerDisposable,registerJobContext,reloadEnv,reply,reportError,reportResponse,requestId,requestLogger,requestScopeMiddleware,requestStore,resetEnvCache,resetQueryParsingDefaults,resolveAsset,resolveMimeTypes,resolveRouteFlags,runContributors,runCronJob,runCronJobs,runJob,session,setCacheProvider,setClassMeta,setInMetaMap,setInMetaRecord,setMethodMeta,setQueryParsingDefaults,settleBackgroundWork,stampJobContext,stripExt,toRefs,tokenName,traceContext,unref,upload,useAssets,validate,waitUntil,watch,withBuilder,withEnv};
12
12
  //# sourceMappingURL=index.mjs.map