@forinda/kickjs 10.1.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter-C5I5e_-i.d.mts +4866 -0
- package/dist/adapter-C5I5e_-i.d.mts.map +1 -0
- package/dist/allowed-hosts-D6qcuK5I.d.mts +46 -0
- package/dist/allowed-hosts-D6qcuK5I.d.mts.map +1 -0
- package/dist/{app-module-DCA65GZZ.d.mts → app-module-Ftz6m7SO.d.mts} +8 -2
- package/dist/app-module-Ftz6m7SO.d.mts.map +1 -0
- package/dist/application-Ch5jT4fj.mjs +14 -0
- package/dist/application-Ch5jT4fj.mjs.map +1 -0
- package/dist/bootstrap-D56HIq1N.mjs +12 -0
- package/dist/{bootstrap-BdyBlBMe.mjs.map → bootstrap-D56HIq1N.mjs.map} +1 -1
- package/dist/bounded-counters-B9dzk5o_.mjs +12 -0
- package/dist/bounded-counters-B9dzk5o_.mjs.map +1 -0
- package/dist/breach-padding-C-Dnq8CS.d.mts +39 -0
- package/dist/breach-padding-C-Dnq8CS.d.mts.map +1 -0
- package/dist/{client-ip-BbLDp03S.mjs → client-ip-lYnBU2PR.mjs} +2 -2
- package/dist/{client-ip-BbLDp03S.mjs.map → client-ip-lYnBU2PR.mjs.map} +1 -1
- package/dist/config/index.d.mts +1 -1
- package/dist/config/index.mjs +2 -2
- package/dist/config-BfImCyaG.mjs +12 -0
- package/dist/{config-CJiGeOca.mjs.map → config-BfImCyaG.mjs.map} +1 -1
- package/dist/{container-CS9v9UFU.mjs → container-C2aTj8Cb.mjs} +3 -3
- package/dist/{container-CS9v9UFU.mjs.map → container-C2aTj8Cb.mjs.map} +1 -1
- package/dist/context-C6iKf9hN.mjs +12 -0
- package/dist/context-C6iKf9hN.mjs.map +1 -0
- package/dist/{context-errors-7C5TBYn7.mjs → context-errors-6psUheqc.mjs} +2 -2
- package/dist/{context-errors-7C5TBYn7.mjs.map → context-errors-6psUheqc.mjs.map} +1 -1
- package/dist/{contributor-runner-DBpRR5dl.mjs → contributor-runner-Bn-ipSS5.mjs} +3 -3
- package/dist/{contributor-runner-DBpRR5dl.mjs.map → contributor-runner-Bn-ipSS5.mjs.map} +1 -1
- package/dist/core/adapter.d.mts +1 -1
- package/dist/core/adapter.mjs +1 -1
- package/dist/core/app-module.d.mts +1 -1
- package/dist/core/app-module.mjs +1 -1
- package/dist/core/cache.mjs +1 -1
- package/dist/core/container.mjs +2 -2
- package/dist/core/cron.mjs +2 -2
- package/dist/core/decorators.d.mts +1 -1
- package/dist/core/decorators.mjs +2 -2
- package/dist/core/errors.mjs +2 -2
- package/dist/core/errors.mjs.map +1 -1
- package/dist/core/interfaces.mjs +1 -1
- package/dist/core/logger.mjs +1 -1
- package/dist/core/path.mjs +1 -1
- package/dist/core/plugin.d.mts +1 -1
- package/dist/core/plugin.mjs +1 -1
- package/dist/core/reactivity.mjs +1 -1
- package/dist/core-CFXpwc7m.mjs +12 -0
- package/dist/{core-B0JmdBvX.mjs.map → core-CFXpwc7m.mjs.map} +1 -1
- package/dist/{cors-CsibNTQ6.d.mts → cors-2Bwhyhpt.d.mts} +4 -1
- package/dist/{cors-CsibNTQ6.d.mts.map → cors-2Bwhyhpt.d.mts.map} +1 -1
- package/dist/csrf-C3RRSCMs.mjs +12 -0
- package/dist/csrf-C3RRSCMs.mjs.map +1 -0
- package/dist/{csrf-C73UkRgc.d.mts → csrf-Cy1meSpf.d.mts} +27 -3
- package/dist/csrf-Cy1meSpf.d.mts.map +1 -0
- package/dist/decorate-DkxaoRo5.mjs +13 -0
- package/dist/decorate-DkxaoRo5.mjs.map +1 -0
- package/dist/{decorators-BxNSz9Qt.d.mts → decorators-DaQUNXOn.d.mts} +2 -2
- package/dist/{decorators-BxNSz9Qt.d.mts.map → decorators-DaQUNXOn.d.mts.map} +1 -1
- package/dist/{define-adapter-BLKlUbSL.mjs → define-adapter-BRJ6lXkV.mjs} +2 -2
- package/dist/{define-adapter-BLKlUbSL.mjs.map → define-adapter-BRJ6lXkV.mjs.map} +1 -1
- package/dist/{disposables-CuY2S3bw.mjs → disposables-5nFqc1aC.mjs} +2 -2
- package/dist/{disposables-CuY2S3bw.mjs.map → disposables-5nFqc1aC.mjs.map} +1 -1
- package/dist/errors-By6UueCm.d.mts.map +1 -1
- package/dist/handler-Dl_1fGxE.mjs +12 -0
- package/dist/handler-Dl_1fGxE.mjs.map +1 -0
- package/dist/{helmet-C2QEU6S-.d.mts → helmet-CEOmo516.d.mts} +4 -1
- package/dist/helmet-CEOmo516.d.mts.map +1 -0
- package/dist/host-DTQ5pZgg.mjs +12 -0
- package/dist/host-DTQ5pZgg.mjs.map +1 -0
- package/dist/http/application.d.mts +2 -2
- package/dist/http/application.mjs +2 -2
- package/dist/http/bootstrap.d.mts +1 -1
- package/dist/http/bootstrap.mjs +2 -2
- package/dist/http/context.d.mts +2 -2
- package/dist/http/context.mjs +2 -2
- package/dist/http/middleware/allowed-hosts.d.mts +3 -0
- package/dist/http/middleware/allowed-hosts.mjs +12 -0
- package/dist/http/middleware/allowed-hosts.mjs.map +1 -0
- package/dist/http/middleware/breach-padding.d.mts +3 -0
- package/dist/http/middleware/breach-padding.mjs +12 -0
- package/dist/http/middleware/breach-padding.mjs.map +1 -0
- package/dist/http/middleware/cors.d.mts +1 -1
- package/dist/http/middleware/cors.mjs +2 -2
- package/dist/http/middleware/cors.mjs.map +1 -1
- package/dist/http/middleware/csrf.d.mts +2 -2
- package/dist/http/middleware/csrf.mjs +2 -2
- package/dist/http/middleware/error-handler.d.mts +1 -1
- package/dist/http/middleware/error-handler.mjs +2 -2
- package/dist/http/middleware/error-handler.mjs.map +1 -1
- package/dist/http/middleware/helmet.d.mts +1 -1
- package/dist/http/middleware/helmet.mjs +2 -2
- package/dist/http/middleware/helmet.mjs.map +1 -1
- package/dist/http/middleware/rate-limit.d.mts +2 -2
- package/dist/http/middleware/rate-limit.mjs +2 -2
- package/dist/http/middleware/rate-limit.mjs.map +1 -1
- package/dist/http/middleware/request-id.mjs +2 -2
- package/dist/http/middleware/request-id.mjs.map +1 -1
- package/dist/http/middleware/request-logger.mjs +2 -2
- package/dist/http/middleware/session.d.mts +2 -2
- package/dist/http/middleware/session.mjs +2 -2
- package/dist/http/middleware/session.mjs.map +1 -1
- package/dist/http/middleware/spa.d.mts +1 -1
- package/dist/http/middleware/spa.mjs +2 -2
- package/dist/http/middleware/upload.d.mts +1 -1
- package/dist/http/middleware/upload.mjs +2 -2
- package/dist/http/middleware/validate.d.mts +2 -2
- package/dist/http/middleware/validate.mjs +2 -2
- package/dist/http/middleware/validate.mjs.map +1 -1
- package/dist/http/middleware/views.d.mts +1 -1
- package/dist/http/middleware/views.mjs +2 -2
- package/dist/http/query/index.mjs +2 -2
- package/dist/http/router-builder.d.mts +1 -1
- package/dist/http/router-builder.mjs +2 -2
- package/dist/http/runtimes/fastify.d.mts +5 -1
- package/dist/http/runtimes/fastify.d.mts.map +1 -1
- package/dist/http/runtimes/fastify.mjs +3 -3
- package/dist/http/runtimes/fastify.mjs.map +1 -1
- package/dist/http/runtimes/h3-web.mjs +1 -1
- package/dist/http/runtimes/h3.d.mts +1 -1
- package/dist/http/runtimes/h3.d.mts.map +1 -1
- package/dist/http/runtimes/h3.mjs +2 -2
- package/dist/http/runtimes/h3.mjs.map +1 -1
- package/dist/{index-CNHSbZTE.d.mts → index-CuiWSnZL.d.mts} +3 -2
- package/dist/index-CuiWSnZL.d.mts.map +1 -0
- package/dist/index.d.mts +16 -18
- package/dist/index.mjs +6 -2
- package/dist/index.mjs.map +1 -1
- package/dist/is-production-tnFh6NCj.mjs +12 -0
- package/dist/is-production-tnFh6NCj.mjs.map +1 -0
- package/dist/{jobs-BQ4t3TAb.mjs → jobs-lLcPhIqq.mjs} +3 -3
- package/dist/{jobs-BQ4t3TAb.mjs.map → jobs-lLcPhIqq.mjs.map} +1 -1
- package/dist/kv-stores-_wz4DEiw.mjs +12 -0
- package/dist/kv-stores-_wz4DEiw.mjs.map +1 -0
- package/dist/{metadata-zvd6AWkE.mjs → metadata-Tc6jhIBi.mjs} +2 -2
- package/dist/{metadata-zvd6AWkE.mjs.map → metadata-Tc6jhIBi.mjs.map} +1 -1
- package/dist/{observers-DZgs48UM.mjs → observers-IGga6yut.mjs} +2 -2
- package/dist/{observers-DZgs48UM.mjs.map → observers-IGga6yut.mjs.map} +1 -1
- package/dist/{query-B_k9qn0R.mjs → query-AnbWMCd6.mjs} +2 -2
- package/dist/{query-B_k9qn0R.mjs.map → query-AnbWMCd6.mjs.map} +1 -1
- package/dist/{rate-limit-Bwed3jOV.d.mts → rate-limit-BgoeahE5.d.mts} +17 -2
- package/dist/rate-limit-BgoeahE5.d.mts.map +1 -0
- package/dist/reply-DjysdCPI.mjs +12 -0
- package/dist/reply-DjysdCPI.mjs.map +1 -0
- package/dist/respond-vPZlRnZR.mjs +12 -0
- package/dist/respond-vPZlRnZR.mjs.map +1 -0
- package/dist/{route-flag-BWuvJsGZ.mjs → route-flag-BjRpxryx.mjs} +3 -3
- package/dist/{route-flag-BWuvJsGZ.mjs.map → route-flag-BjRpxryx.mjs.map} +1 -1
- package/dist/{route-policy-B3vM6bSf.mjs → route-policy-Pffte5M1.mjs} +2 -2
- package/dist/{route-policy-B3vM6bSf.mjs.map → route-policy-Pffte5M1.mjs.map} +1 -1
- package/dist/{router-builder-JvMTp50k.mjs → router-builder-CrWKq6O2.mjs} +3 -3
- package/dist/router-builder-CrWKq6O2.mjs.map +1 -0
- package/dist/{session-B4hOZj90.d.mts → session-ChXx7jG5.d.mts} +31 -4
- package/dist/session-ChXx7jG5.d.mts.map +1 -0
- package/dist/settings-C8VKewNS.d.mts +119 -0
- package/dist/settings-C8VKewNS.d.mts.map +1 -0
- package/dist/settings-CFtEAQUs.mjs +14 -0
- package/dist/settings-CFtEAQUs.mjs.map +1 -0
- package/dist/{upload-config-Dz2INCaa.mjs → upload-config-DLgt4l7F.mjs} +2 -2
- package/dist/{upload-config-Dz2INCaa.mjs.map → upload-config-DLgt4l7F.mjs.map} +1 -1
- package/dist/url-for-Cyh7pJCb.mjs +12 -0
- package/dist/url-for-Cyh7pJCb.mjs.map +1 -0
- package/dist/validate-CzjCbRUn.d.mts +53 -0
- package/dist/validate-CzjCbRUn.d.mts.map +1 -0
- package/dist/web.d.mts +19 -19
- package/dist/web.d.mts.map +1 -1
- package/dist/web.mjs +2 -2
- package/dist/web.mjs.map +1 -1
- package/package.json +14 -1
- package/dist/adapter-ClEh-Oos.d.mts +0 -2134
- package/dist/adapter-ClEh-Oos.d.mts.map +0 -1
- package/dist/app-module-DCA65GZZ.d.mts.map +0 -1
- package/dist/application-Dv514EeR.mjs +0 -12
- package/dist/application-Dv514EeR.mjs.map +0 -1
- package/dist/application-oIPzgjfk.d.mts +0 -1589
- package/dist/application-oIPzgjfk.d.mts.map +0 -1
- package/dist/bootstrap-BdyBlBMe.mjs +0 -12
- package/dist/config-CJiGeOca.mjs +0 -12
- package/dist/context-CtL9RxXp.mjs +0 -12
- package/dist/context-CtL9RxXp.mjs.map +0 -1
- package/dist/core-B0JmdBvX.mjs +0 -12
- package/dist/csrf--1t4qDov.mjs +0 -12
- package/dist/csrf--1t4qDov.mjs.map +0 -1
- package/dist/csrf-C73UkRgc.d.mts.map +0 -1
- package/dist/decorate-BHkdkV4l.mjs +0 -11
- package/dist/env-BwzF9MkZ.mjs +0 -13
- package/dist/env-BwzF9MkZ.mjs.map +0 -1
- package/dist/error-handler-BB9wAElm.d.mts +0 -63
- package/dist/error-handler-BB9wAElm.d.mts.map +0 -1
- package/dist/handler-zKfIgNo4.mjs +0 -13
- package/dist/handler-zKfIgNo4.mjs.map +0 -1
- package/dist/helmet-C2QEU6S-.d.mts.map +0 -1
- package/dist/index-CNHSbZTE.d.mts.map +0 -1
- package/dist/kv-stores-Co5k2PYA.d.mts +0 -367
- package/dist/kv-stores-Co5k2PYA.d.mts.map +0 -1
- package/dist/kv-stores-DsfVy2fk.mjs +0 -12
- package/dist/kv-stores-DsfVy2fk.mjs.map +0 -1
- package/dist/module-registry-Daf_P2oD.mjs +0 -12
- package/dist/module-registry-Daf_P2oD.mjs.map +0 -1
- package/dist/rate-limit-Bwed3jOV.d.mts.map +0 -1
- package/dist/reply-BDK9xt7Z.mjs +0 -12
- package/dist/reply-BDK9xt7Z.mjs.map +0 -1
- package/dist/respond-DFRj2-7q.mjs +0 -12
- package/dist/respond-DFRj2-7q.mjs.map +0 -1
- package/dist/router-builder-JvMTp50k.mjs.map +0 -1
- package/dist/router-builder-zWuVIOmd.d.mts +0 -56
- package/dist/router-builder-zWuVIOmd.d.mts.map +0 -1
- package/dist/session-B4hOZj90.d.mts.map +0 -1
- package/dist/upload-CiMtdXWD.d.mts +0 -104
- package/dist/upload-CiMtdXWD.d.mts.map +0 -1
- package/dist/validate-DMYpUnrf.d.mts +0 -25
- package/dist/validate-DMYpUnrf.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-config-
|
|
1
|
+
{"version":3,"file":"upload-config-DLgt4l7F.mjs","names":[],"sources":["../src/http/middleware/upload-config.ts"],"sourcesContent":["// Pure (edge-safe) upload core — the engine-neutral half of the upload\n// middleware. Extracted from `upload.ts` so the `@forinda/kickjs/web` entry\n// graph can validate/shape buffered multipart parts WITHOUT dragging in\n// upload.ts's node-only surface (multer peer loading via `node:module`,\n// disk cleanup via `node:fs/promises`). `upload.ts` re-exports everything\n// here, so existing import sites are unchanged.\n\nimport { HttpException, HttpStatus } from '../../core/errors'\nimport type { BaseUploadOptions, FileUploadConfig } from '../../core/decorators'\n\nexport const MIME_MAP: Record<string, string> = {\n // Images\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n png: 'image/png',\n gif: 'image/gif',\n webp: 'image/webp',\n svg: 'image/svg+xml',\n bmp: 'image/bmp',\n ico: 'image/x-icon',\n tiff: 'image/tiff',\n tif: 'image/tiff',\n avif: 'image/avif',\n // Documents\n pdf: 'application/pdf',\n doc: 'application/msword',\n docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n xls: 'application/vnd.ms-excel',\n xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n ppt: 'application/vnd.ms-powerpoint',\n pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n odt: 'application/vnd.oasis.opendocument.text',\n ods: 'application/vnd.oasis.opendocument.spreadsheet',\n odp: 'application/vnd.oasis.opendocument.presentation',\n rtf: 'application/rtf',\n txt: 'text/plain',\n csv: 'text/csv',\n // Archives\n zip: 'application/zip',\n gz: 'application/gzip',\n tar: 'application/x-tar',\n rar: 'application/vnd.rar',\n '7z': 'application/x-7z-compressed',\n // Audio\n mp3: 'audio/mpeg',\n wav: 'audio/wav',\n ogg: 'audio/ogg',\n flac: 'audio/flac',\n aac: 'audio/aac',\n // Video\n mp4: 'video/mp4',\n webm: 'video/webm',\n avi: 'video/x-msvideo',\n mov: 'video/quicktime',\n mkv: 'video/x-matroska',\n // Other\n json: 'application/json',\n xml: 'application/xml',\n html: 'text/html',\n}\n\n/**\n * Resolves a list of file type identifiers to MIME type strings.\n * Accepts short extensions (`'jpg'`, `'pdf'`) or full MIME types (`'image/jpeg'`).\n *\n * @example\n * ```ts\n * resolveMimeTypes(['jpg', 'png', 'application/pdf'])\n * // → ['image/jpeg', 'image/png', 'application/pdf']\n * ```\n */\nexport function resolveMimeTypes(types: string[]): string[] {\n return types.map((t) => {\n const lower = t.toLowerCase().replace(/^\\./, '')\n return MIME_MAP[lower] ?? t\n })\n}\n\n/**\n * Build a runtime-agnostic `(mimetype, filename) => boolean` file-type filter\n * from `allowedTypes` (a predicate, or a list of extensions / MIME types /\n * wildcards). Returned by both the multer middleware (Express) and the\n * Fastify / h3 / web multipart paths so the accept/reject rule stays\n * identical across engines. No `allowedTypes` → accept everything.\n */\nexport function buildFileTypeFilter(\n allowedTypes: BaseUploadOptions['allowedTypes'],\n customMimeMap?: Record<string, string>,\n): (mimetype: string, filename: string) => boolean {\n if (!allowedTypes) return () => true\n if (typeof allowedTypes === 'function') return allowedTypes\n const mimeMap = customMimeMap ? { ...MIME_MAP, ...customMimeMap } : MIME_MAP\n const resolved = allowedTypes.map((t) => mimeMap[t.toLowerCase().replace(/^\\./, '')] ?? t)\n return (mimetype: string) =>\n resolved.some((type) =>\n type.endsWith('/*') ? mimetype.startsWith(type.replace('/*', '/')) : mimetype === type,\n )\n}\n\n/** A multer-shaped uploaded file — what `ctx.file` / `ctx.files` expose. */\nexport interface UploadedFileLike {\n fieldname: string\n originalname: string\n encoding: string\n mimetype: string\n size: number\n buffer: Buffer\n}\n\n/** A buffered multipart file part, as the runtime hands it to {@link applyUploadConfig}. */\nexport interface RawUploadPart {\n fieldname: string\n filename: string\n mimetype: string\n buffer: Buffer\n}\n\nconst DEFAULT_MAX_SIZE = 5 * 1024 * 1024\n\n/**\n * Apply a `@FileUpload` config to already-buffered multipart parts and return\n * the multer-shaped `file` / `files` for `ctx`. Enforces the field name, type\n * filter, per-file size limit, and (array mode) max count — throwing\n * `HttpException` on a violation, mirroring the Express/multer error path.\n * Used by the Fastify, h3 and web runtimes; Express keeps using multer directly.\n */\nexport function applyUploadConfig(\n parts: RawUploadPart[],\n config: FileUploadConfig,\n): { file?: UploadedFileLike; files?: UploadedFileLike[] } {\n if (config.mode === 'none') return {}\n\n const field = config.fieldName ?? 'file'\n const maxSize = config.maxSize ?? DEFAULT_MAX_SIZE\n const typeAllowed = buildFileTypeFilter(config.allowedTypes, config.customMimeMap)\n\n const matched = parts.filter((p) => p.fieldname === field)\n const files: UploadedFileLike[] = matched.map((p) => {\n if (!typeAllowed(p.mimetype, p.filename)) {\n throw new HttpException(\n HttpStatus.UNSUPPORTED_MEDIA_TYPE,\n `File type ${p.mimetype} is not allowed`,\n )\n }\n if (p.buffer.length > maxSize) {\n throw new HttpException(\n HttpStatus.PAYLOAD_TOO_LARGE,\n `File ${p.filename} exceeds the ${maxSize}-byte limit`,\n )\n }\n return {\n fieldname: p.fieldname,\n originalname: p.filename,\n encoding: '7bit',\n mimetype: p.mimetype,\n size: p.buffer.length,\n buffer: p.buffer,\n }\n })\n\n if (config.mode === 'single') return { file: files[0] }\n const maxCount = config.maxCount ?? 10\n return { files: files.slice(0, maxCount) }\n}\n"],"mappings":";;;;;;;;;;wDAUA,MAAa,SAAmC,CAE9C,IAAK,aACL,KAAM,aACN,IAAK,YACL,IAAK,YACL,KAAM,aACN,IAAK,gBACL,IAAK,YACL,IAAK,eACL,KAAM,aACN,IAAK,aACL,KAAM,aAEN,IAAK,kBACL,IAAK,qBACL,KAAM,0EACN,IAAK,2BACL,KAAM,oEACN,IAAK,gCACL,KAAM,4EACN,IAAK,0CACL,IAAK,iDACL,IAAK,kDACL,IAAK,kBACL,IAAK,aACL,IAAK,WAEL,IAAK,kBACL,GAAI,mBACJ,IAAK,oBACL,IAAK,sBACL,KAAM,8BAEN,IAAK,aACL,IAAK,YACL,IAAK,YACL,KAAM,aACN,IAAK,YAEL,IAAK,YACL,KAAM,aACN,IAAK,kBACL,IAAK,kBACL,IAAK,mBAEL,KAAM,mBACN,IAAK,kBACL,KAAM,WACR,EAYA,SAAgB,iBAAiB,MAA2B,CAC1D,OAAO,MAAM,IAAK,GAAM,CACtB,IAAM,MAAQ,EAAE,YAAY,CAAC,CAAC,QAAQ,MAAO,EAAE,EAC/C,OAAO,SAAS,QAAU,CAC5B,CAAC,CACH,CASA,SAAgB,oBACd,aACA,cACiD,CACjD,GAAI,CAAC,aAAc,UAAa,GAChC,GAAI,OAAO,cAAiB,WAAY,OAAO,aAC/C,IAAM,QAAU,cAAgB,CAAE,GAAG,SAAU,GAAG,aAAc,EAAI,SAC9D,SAAW,aAAa,IAAK,GAAM,QAAQ,EAAE,YAAY,CAAC,CAAC,QAAQ,MAAO,EAAE,IAAM,CAAC,EACzF,MAAQ,WACN,SAAS,KAAM,MACb,KAAK,SAAS,IAAI,EAAI,SAAS,WAAW,KAAK,QAAQ,KAAM,GAAG,CAAC,EAAI,WAAa,IACpF,CACJ,CA6BA,SAAgB,kBACd,MACA,OACyD,CACzD,GAAI,OAAO,OAAS,OAAQ,MAAO,CAAC,EAEpC,IAAM,MAAQ,OAAO,WAAa,OAC5B,QAAU,OAAO,SAAW,QAC5B,YAAc,oBAAoB,OAAO,aAAc,OAAO,aAAa,EAG3E,MADU,MAAM,OAAQ,GAAM,EAAE,YAAc,KACZ,CAAC,CAAC,IAAK,GAAM,CACnD,GAAI,CAAC,YAAY,EAAE,SAAU,EAAE,QAAQ,EACrC,MAAM,IAAI,cACR,WAAW,uBACX,aAAa,EAAE,SAAS,gBAC1B,EAEF,GAAI,EAAE,OAAO,OAAS,QACpB,MAAM,IAAI,cACR,WAAW,kBACX,QAAQ,EAAE,SAAS,eAAe,QAAQ,YAC5C,EAEF,MAAO,CACL,UAAW,EAAE,UACb,aAAc,EAAE,SAChB,SAAU,OACV,SAAU,EAAE,SACZ,KAAM,EAAE,OAAO,OACf,OAAQ,EAAE,MACZ,CACF,CAAC,EAED,GAAI,OAAO,OAAS,SAAU,MAAO,CAAE,KAAM,MAAM,EAAG,EACtD,IAAM,SAAW,OAAO,UAAY,GACpC,MAAO,CAAE,MAAO,MAAM,MAAM,EAAG,QAAQ,CAAE,CAC3C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @forinda/kickjs v10.2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Felix Orinda
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import{i as createToken}from"./container-C2aTj8Cb.mjs";var MutableModuleRegistry=class{entries=[];mount(module){this.entries.push(module)}};const ROUTE_URLS=createToken(`kick/Http/routeUrls`);var RouteUrls=class{paths=/* @__PURE__ */ new Map;add(name,path){this.paths.has(name)||this.paths.set(name,path)}urlFor(name,...args){let[params,query]=args;return this.build(name,params,query)}build(name,params,query){let pattern=this.paths.get(name);if(pattern===void 0)throw Error(`urlFor: no route named '${name}' — expected 'Controller.method'`);let path=pattern.replace(/:([A-Za-z0-9_]+)/g,(_,key)=>{let value=params?.[key];if(value==null||value===``)throw Error(`urlFor('${name}'): missing param '${key}' for '${pattern}'`);return encodeURIComponent(String(value))});if(!query)return path;let search=new URLSearchParams;for(let[key,value]of Object.entries(query))for(let v of Array.isArray(value)?value:[value])search.append(key,String(v));let qs=search.toString();return qs?`${path}?${qs}`:path}};export{RouteUrls as n,MutableModuleRegistry as r,ROUTE_URLS as t};
|
|
12
|
+
//# sourceMappingURL=url-for-Cyh7pJCb.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-for-Cyh7pJCb.mjs","names":[],"sources":["../src/core/module-registry.ts","../src/http/url-for.ts"],"sourcesContent":["import type { AppModuleEntry } from './app-module'\n\n/**\n * Imperative receiver passed to {@link KickPlugin.setup} and the\n * top-level `bootstrap({ setup })` callback so adopters can register\n * modules conditionally — based on env flags, runtime config,\n * tenant lists, etc. — instead of being limited to the static\n * `modules: [...]` array.\n *\n * @example\n * ```ts\n * bootstrap({\n * modules: [HelloModule()], // static — always mounted\n * setup(registry) {\n * if (env.ENABLE_ADMIN) registry.mount(AdminModule())\n * for (const tenant of env.TENANTS) {\n * registry.mount(TenantModule.scoped(tenant.id, { id: tenant.id }))\n * }\n * },\n * })\n * ```\n *\n * **Currently exposes only `.mount(module)` — the HTTP-feature path.**\n * A future `.use(module)` for non-HTTP modules (queues, cron, workers,\n * DI-only seeds) is planned but not yet implemented; existing non-HTTP\n * modules continue returning `null` from `routes()` and registering\n * via `.mount()`.\n *\n * Same dispatch rules as the static `modules: [...]` array — class\n * entries get `new`-ed at boot, `defineModule` factory output is used\n * directly. The registry doesn't validate the entry shape itself; the\n * Application loader does the typeof discrimination at mount time.\n */\nexport interface ModuleRegistry {\n /**\n * Register a module for the full HTTP lifecycle: `register()` runs,\n * `import.meta.glob` decorator side-effects fire, `routes()` is\n * called and its result mounted, `contributors()` are merged at\n * `'module'` precedence and applied to the mounted routes.\n *\n * Modules are mounted in registration order (first call → first\n * mount). Order across sources is: plugin static modules → plugin\n * `setup()` calls → user static modules → user `setup()` callback.\n */\n mount(module: AppModuleEntry): void\n}\n\n/**\n * Internal collector implementing {@link ModuleRegistry}. Application\n * passes one of these to every `setup()` callback during bootstrap;\n * the collected `entries` array is then run through the same\n * class-vs-instance dispatch as the static `modules: [...]` array.\n *\n * Not exported from the public surface — adopters interact only\n * through the {@link ModuleRegistry} interface.\n */\nexport class MutableModuleRegistry implements ModuleRegistry {\n readonly entries: AppModuleEntry[] = []\n\n mount(module: AppModuleEntry): void {\n this.entries.push(module)\n }\n}\n","/**\n * Build a route's URL from its name — `'UsersController.show'` — instead of\n * spelling the path where you link to it, so a moved route can't leave a\n * redirect, a `Location` header or an email link pointing at the old one.\n *\n * @module @forinda/kickjs/http/url-for\n */\n\nimport { createToken } from '../core/token'\n\n/**\n * Route names `kick typegen` knows: `'Controller.method'` → the route's\n * shape. Falls back to `string` before typegen has run.\n */\nexport type RouteName = [keyof KickRoutes.Named] extends [never]\n ? string\n : Extract<keyof KickRoutes.Named, string>\n\ntype ParamsOf<N> = N extends keyof KickRoutes.Named\n ? KickRoutes.Named[N] extends { params: infer P }\n ? P\n : Record<string, string | number>\n : Record<string, string | number>\n\n/** `params` is optional when the route has none, required otherwise. */\nexport type UrlForArgs<N> =\n Record<string, never> extends ParamsOf<N>\n ? [params?: ParamsOf<N>, query?: UrlQuery]\n : [params: ParamsOf<N>, query?: UrlQuery]\n\nexport type UrlQuery = Record<string, string | number | boolean | Array<string | number>>\n\n/** Builds route URLs by name — what `ROUTE_URLS` resolves to. */\nexport interface UrlBuilder {\n /**\n * The URL of a route, by name — `'Controller.method'` — with its `:params`\n * filled (encoded) and an optional query string.\n */\n urlFor<N extends RouteName>(name: N, ...args: UrlForArgs<N>): string\n}\n\n/**\n * The app's {@link UrlBuilder}, for code outside a request — a job, a mailer,\n * a service building a link:\n *\n * ```ts\n * @Service()\n * class Mailer {\n * constructor(@Inject(ROUTE_URLS) private readonly urls: UrlBuilder) {}\n * resetLink(token: string) {\n * return `https://example.com${this.urls.urlFor('AuthController.reset', { token })}`\n * }\n * }\n * ```\n */\nexport const ROUTE_URLS = createToken<UrlBuilder>('kick/Http/routeUrls')\n// One per process, like every DI binding: the container is process-wide, so\n// with two apps in one process this is the one set up last. `ctx.urlFor()`\n// always uses the app that is serving the request.\n\n/** One app's route name → full path pattern (`/api/v1/users/:id`). */\nexport class RouteUrls implements UrlBuilder {\n private readonly paths = new Map<string, string>()\n\n /** First registration wins — a controller mounted twice keeps its first path. */\n add(name: string, path: string): void {\n if (!this.paths.has(name)) this.paths.set(name, path)\n }\n\n urlFor<N extends RouteName>(name: N, ...args: UrlForArgs<N>): string {\n const [params, query] = args\n return this.build(name, params as Record<string, unknown> | undefined, query)\n }\n\n build(name: string, params?: Record<string, unknown>, query?: UrlQuery): string {\n const pattern = this.paths.get(name)\n if (pattern === undefined) {\n throw new Error(`urlFor: no route named '${name}' — expected 'Controller.method'`)\n }\n const path = pattern.replace(/:([A-Za-z0-9_]+)/g, (_, key: string) => {\n const value = params?.[key]\n if (value === undefined || value === null || value === '') {\n throw new Error(`urlFor('${name}'): missing param '${key}' for '${pattern}'`)\n }\n return encodeURIComponent(String(value))\n })\n if (!query) return path\n const search = new URLSearchParams()\n for (const [key, value] of Object.entries(query)) {\n for (const v of Array.isArray(value) ? value : [value]) search.append(key, String(v))\n }\n const qs = search.toString()\n return qs ? `${path}?${qs}` : path\n }\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace KickRoutes {\n /** `'Controller.method'` → route shape, written by `kick typegen`. */\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n interface Named {}\n }\n}\n"],"mappings":";;;;;;;;;;uDAwDA,IAAa,sBAAb,KAA6D,CAC3D,QAAqC,CAAC,EAEtC,MAAM,OAA8B,CAClC,KAAK,QAAQ,KAAK,MAAM,CAC1B,CACF,ECPA,MAAa,WAAa,YAAwB,qBAAqB,EAMvE,IAAa,UAAb,KAA6C,CAC3C,sBAAyB,IAAI,IAG7B,IAAI,KAAc,KAAoB,CAC/B,KAAK,MAAM,IAAI,IAAI,GAAG,KAAK,MAAM,IAAI,KAAM,IAAI,CACtD,CAEA,OAA4B,KAAS,GAAG,KAA6B,CACnE,GAAM,CAAC,OAAQ,OAAS,KACxB,OAAO,KAAK,MAAM,KAAM,OAA+C,KAAK,CAC9E,CAEA,MAAM,KAAc,OAAkC,MAA0B,CAC9E,IAAM,QAAU,KAAK,MAAM,IAAI,IAAI,EACnC,GAAI,UAAY,IAAA,GACd,MAAU,MAAM,2BAA2B,KAAK,iCAAiC,EAEnF,IAAM,KAAO,QAAQ,QAAQ,qBAAsB,EAAG,MAAgB,CACpE,IAAM,MAAQ,SAAS,KACvB,GAAI,OAAiC,MAAQ,QAAU,GACrD,MAAU,MAAM,WAAW,KAAK,qBAAqB,IAAI,SAAS,QAAQ,EAAE,EAE9E,OAAO,mBAAmB,OAAO,KAAK,CAAC,CACzC,CAAC,EACD,GAAI,CAAC,MAAO,OAAO,KACnB,IAAM,OAAS,IAAI,gBACnB,IAAK,GAAM,CAAC,IAAK,SAAU,OAAO,QAAQ,KAAK,EAC7C,IAAK,IAAM,KAAK,MAAM,QAAQ,KAAK,EAAI,MAAQ,CAAC,KAAK,EAAG,OAAO,OAAO,IAAK,OAAO,CAAC,CAAC,EAEtF,IAAM,GAAK,OAAO,SAAS,EAC3B,OAAO,GAAK,GAAG,KAAK,GAAG,KAAO,IAChC,CACF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
import { t as HttpException } from "./errors-By6UueCm.mjs";
|
|
3
|
+
import { NextFunction, Request, Response } from "express";
|
|
4
|
+
import { SchemaIssue } from "@forinda/kickjs-schema";
|
|
5
|
+
//#region src/http/middleware/validate.d.ts
|
|
6
|
+
interface ValidationSchema {
|
|
7
|
+
body?: any;
|
|
8
|
+
query?: any;
|
|
9
|
+
params?: any;
|
|
10
|
+
}
|
|
11
|
+
/** A request that failed route validation — what a `validationError` hook receives. */
|
|
12
|
+
interface ValidationFailure {
|
|
13
|
+
/** The part of the request that failed. */
|
|
14
|
+
source: 'body' | 'query' | 'params';
|
|
15
|
+
/** Every issue the schema reported, adapter-neutral (Zod, Valibot, Yup, …). */
|
|
16
|
+
issues: SchemaIssue[];
|
|
17
|
+
/** The request, as the runtime hands it to middleware. */
|
|
18
|
+
req: unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Turns a validation failure into the error the request fails with. Return
|
|
22
|
+
* (or throw) any error — an `HttpException` or `ProblemException` keeps the
|
|
23
|
+
* error handler's problem-details response — or return `undefined` to use
|
|
24
|
+
* {@link defaultValidationError} for this one.
|
|
25
|
+
*/
|
|
26
|
+
type ValidationErrorFactory = (failure: ValidationFailure) => unknown;
|
|
27
|
+
/**
|
|
28
|
+
* The built-in failure: 422 with `details` as `[{ field, message }]`. A body
|
|
29
|
+
* failure leads with its first issue's message. `@forinda/kickjs-inertia`
|
|
30
|
+
* reads these `details` for the page's `errors`, so a custom factory serving
|
|
31
|
+
* Inertia pages should keep the shape — or call this and adjust the result.
|
|
32
|
+
*/
|
|
33
|
+
declare function defaultValidationError({ source, issues }: ValidationFailure): HttpException;
|
|
34
|
+
/**
|
|
35
|
+
* Express middleware that validates request body/query/params against schemas.
|
|
36
|
+
*
|
|
37
|
+
* Accepts any schema supported by `@forinda/kickjs-schema`:
|
|
38
|
+
* - Zod schemas (auto-detected)
|
|
39
|
+
* - Standard Schema v1 objects
|
|
40
|
+
* - KickSchema instances (from adapters like fromZod, fromValibot, etc.)
|
|
41
|
+
* - Plain validator functions
|
|
42
|
+
*
|
|
43
|
+
* Validation failures are forwarded via `next(err)` as an `HttpException`, so
|
|
44
|
+
* they flow through the application's global error handler (`onError`) and
|
|
45
|
+
* produce a uniform response envelope.
|
|
46
|
+
*/
|
|
47
|
+
declare function validate(schema: ValidationSchema, options?: {
|
|
48
|
+
/** What a failure throws — see `bootstrap({ validationError })`. Default: a 422. */
|
|
49
|
+
validationError?: ValidationErrorFactory;
|
|
50
|
+
}): (req: Request, _res: Response, next: NextFunction) => void;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { validate as a, defaultValidationError as i, ValidationFailure as n, ValidationSchema as r, ValidationErrorFactory as t };
|
|
53
|
+
//# sourceMappingURL=validate-CzjCbRUn.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-CzjCbRUn.d.mts","names":[],"sources":["../src/http/middleware/validate.ts"],"mappings":";;;;;UAMiB;EACf;EACA;EACA;;;UAIe;;EAEf;;EAEA,QAAQ;;EAER;;;;;;;;KASU,0BAA0B,SAAS;;;;;;;iBAQ/B,yBAAyB,QAAQ,UAAU,oBAAoB;;;;;;;;;;;;;;iBA0D/D,SACd,QAAQ,kBACR;;EAEE,kBAAkB;KACd,KAcO,SAAO,MAAQ,UAAQ,MAAQ"}
|
package/dist/web.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { i as SettingsDeclaration } from "./settings-C8VKewNS.mjs";
|
|
3
|
+
import { x as MiddlewareHandler } from "./decorators-DaQUNXOn.mjs";
|
|
4
|
+
import { A as SseHandler, C as RuntimeResponse, Cn as reply, Gr as registerJobContext, Ir as JobContextCarrier, Kr as runJob, Mr as JOB_CONTEXT_FIELD, Yt as waitUntil, _ as RouteEntry, at as KvSessionStore, ct as rateLimitGuard, gn as InferHandlerResponse, it as KvRateLimitStoreOptions, nt as KvLike, ot as KvSessionStoreOptions, qr as stampJobContext, qt as PlatformContext, rt as KvRateLimitStore, st as RateLimitGuardOptions, vn as Reply, xn as isReply, zr as JobLike } from "./adapter-C5I5e_-i.mjs";
|
|
5
|
+
import { m as ContributorRegistrations, r as AppModuleEntry } from "./app-module-Ftz6m7SO.mjs";
|
|
5
6
|
import { f as runCronJobs, o as CronRun } from "./cron-BTGytNg-.mjs";
|
|
6
|
-
import {
|
|
7
|
+
import { t as ValidationErrorFactory } from "./validate-CzjCbRUn.mjs";
|
|
7
8
|
//#region src/http/web/driver.d.ts
|
|
8
9
|
/**
|
|
9
10
|
* Presents a web `Request` as the express-shaped `req` object that
|
|
@@ -31,20 +32,6 @@ export declare class WebRequestShim {
|
|
|
31
32
|
/** `req.on('close')` — same bridge; signals only abort once anyway. */
|
|
32
33
|
on(event: string, listener: () => void): this;
|
|
33
34
|
}
|
|
34
|
-
/**
|
|
35
|
-
* `RuntimeResponse` over a web `Response`.
|
|
36
|
-
*
|
|
37
|
-
* Two modes:
|
|
38
|
-
* - **Buffered** (default): `status/json/send/type/setHeader` record state;
|
|
39
|
-
* the terminal call resolves {@link ready} with a complete `Response`.
|
|
40
|
-
* - **Streaming**: the first `writeHead`/`flushHeaders`/`write` call switches
|
|
41
|
-
* to a `TransformStream` and resolves {@link ready} IMMEDIATELY with a
|
|
42
|
-
* streamed `Response` — SSE works on edge this way; `write` feeds the
|
|
43
|
-
* writer, `end` closes it.
|
|
44
|
-
*
|
|
45
|
-
* A class so the method table lives on a shared prototype (one allocation
|
|
46
|
-
* per request — same rationale as the Fastify/h3 driver classes).
|
|
47
|
-
*/
|
|
48
35
|
export declare class WebResponseDriver implements RuntimeResponse {
|
|
49
36
|
private readonly signal?;
|
|
50
37
|
/** Resolves with the final (or streamed) Response. */
|
|
@@ -61,6 +48,8 @@ export declare class WebResponseDriver implements RuntimeResponse {
|
|
|
61
48
|
json(data: unknown): this;
|
|
62
49
|
send(data: unknown): this;
|
|
63
50
|
type(contentType: string): this;
|
|
51
|
+
/** What `setHeader` recorded — `Set-Cookie` as its list, like node's `res.getHeader`. */
|
|
52
|
+
getHeader(name: string): string | string[] | undefined;
|
|
64
53
|
setHeader(name: string, value: unknown): this;
|
|
65
54
|
render(): never;
|
|
66
55
|
writeHead(statusCode: number, headers?: Record<string, string | number | string[]>): this;
|
|
@@ -98,7 +87,9 @@ interface WebRouteHooks {
|
|
|
98
87
|
*/
|
|
99
88
|
onError?: (err: unknown, req: WebRequestShim, res: WebResponseDriver) => void | Promise<void>;
|
|
100
89
|
}
|
|
101
|
-
export declare function compileWebRoute(entry: RouteEntry, hooks?: WebRouteHooks
|
|
90
|
+
export declare function compileWebRoute(entry: RouteEntry, hooks?: WebRouteHooks, options?: {
|
|
91
|
+
bodyLimit?: number;
|
|
92
|
+
}): (invocation: WebRouteInvocation) => Promise<Response>;
|
|
102
93
|
//#endregion
|
|
103
94
|
//#region src/web.d.ts
|
|
104
95
|
export interface CreateWebAppOptions {
|
|
@@ -132,6 +123,15 @@ export interface CreateWebAppOptions {
|
|
|
132
123
|
* ctx-style handlers are accepted (no connect/express middleware here).
|
|
133
124
|
*/
|
|
134
125
|
middlewares?: MiddlewareHandler[];
|
|
126
|
+
/**
|
|
127
|
+
* Largest request body parsed, as bytes or `'1mb'`-style (default `'1mb'`)
|
|
128
|
+
* — parity with `bootstrap({ jsonLimit })`. A larger body answers 413.
|
|
129
|
+
*/
|
|
130
|
+
jsonLimit?: string | number;
|
|
131
|
+
/** App-wide settings sections — parity with `bootstrap({ settings })`. */
|
|
132
|
+
settings?: SettingsDeclaration[];
|
|
133
|
+
/** What a failed route validation throws — parity with `bootstrap({ validationError })`. */
|
|
134
|
+
validationError?: ValidationErrorFactory;
|
|
135
135
|
}
|
|
136
136
|
export interface WebApp {
|
|
137
137
|
/**
|
package/dist/web.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.mts","names":[],"sources":["../src/http/web/driver.ts","../src/http/web/handler.ts","../src/web.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"web.d.mts","names":[],"sources":["../src/http/web/driver.ts","../src/http/web/handler.ts","../src/web.ts"],"mappings":";;;;;;;;;;;;;;;qBAgBa;WACF;WACA;;WAEA,SAAS;EAClB;EACA,QAAQ;EACR,OAAO;EACP;E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yright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{t as Container}from"./container-
|
|
11
|
+
import{t as Container}from"./container-C2aTj8Cb.mjs";import{n as RouteUrls,r as MutableModuleRegistry,t as ROUTE_URLS}from"./url-for-Cyh7pJCb.mjs";import{runCronJobs}from"./core/cron.mjs";import{d as stampJobContext,l as registerJobContext,t as JOB_CONTEXT_FIELD,u as runJob}from"./jobs-lLcPhIqq.mjs";import{buildMountPath}from"./core/path.mjs";import{n as assertRouteUnique,r as buildRouteTable,t as _setExternalContributorSources}from"./router-builder-CrWKq6O2.mjs";import{a as reply,p as parseByteSize,r as isReply}from"./reply-DjysdCPI.mjs";import{f as requestStore,l as waitUntil,o as forwardBackgroundWork}from"./context-C6iKf9hN.mjs";import{notFoundHandler}from"./http/middleware/error-handler.mjs";import{i as loadSettings}from"./settings-CFtEAQUs.mjs";import{n as KvSessionStore,r as rateLimitGuard,t as KvRateLimitStore}from"./kv-stores-_wz4DEiw.mjs";import{i as WebResponseDriver,r as WebRequestShim,t as compileWebRoute}from"./handler-Dl_1fGxE.mjs";function createWebApp(options){let h3mod=options.h3;if(typeof h3mod?.H3!=`function`)throw Error(`@forinda/kickjs/web: pass the h3 v2 module — \`createWebApp({ h3: await import("h3"), ... })\`. The installed h3 must be v2 (npm dist-tag 'latest'); v1 has no H3 class.`);let container=Container.getInstance(),routeUrls=new RouteUrls;if(container.registerInstance(ROUTE_URLS,routeUrls),options.env){let env=options.env;Container._envResolver=key=>env[key]}Container._requestStoreProvider=()=>requestStore.getStore()??null;let registry=new MutableModuleRegistry;for(let m of options.modules)registry.mount(m);let modules=registry.entries.map(entry=>typeof entry==`function`?new entry:entry),settingsEnv=options.env??(typeof process<`u`?process.env:{});for(let[section,value]of loadSettings([...options.settings??[],...modules.flatMap(mod=>mod.settings?.()??[])],settingsEnv))container.registerInstance(section,value);for(let mod of modules)mod.register?.(container);container.bootstrap();let app=new h3mod.H3,apiPrefix=options.apiPrefix??`/api`,defaultVersion=options.defaultVersion??1,globalMiddleware=options.middlewares??[],bodyLimit=parseByteSize(options.jsonLimit??`1mb`),globalSources=(options.contributors??[]).map(registration=>({source:`global`,registration,label:`createWebApp`})),seenRoutes=/* @__PURE__ */ new Map,mounted=[];for(let mod of modules){let declaredName=mod.name,moduleLabel=typeof declaredName==`string`&&declaredName.length>0?declaredName:mod.constructor?.name??`module`,moduleSources=(mod.contributors?.()??[]).map(registration=>({source:`module`,registration,label:moduleLabel}));_setExternalContributorSources([...moduleSources,...globalSources]);try{let result=mod.routes();if(!result)continue;let routeSets=Array.isArray(result)?result:[result];for(let route of routeSets){if(!route.controller)throw Error(`@forinda/kickjs/web: module route at '${route.path}' has no controller. Express-style \`router\` mounts are not supported on the web entry.`);let version=route.version??defaultVersion,mountPath=buildMountPath(apiPrefix,version,route.path);for(let entry of buildRouteTable(route.controller,{mountFlags:route.flags})){let url=joinPath(mountPath,entry.path),owner=`${route.controller.name??`controller`}.${String(entry.meta.handlerName??`?`)}`;assertRouteUnique(seenRoutes,entry.method,url,owner),mounted.push({method:entry.method,path:url}),globalMiddleware.length>0&&(entry.middlewares=[...globalMiddleware,...entry.middlewares]),entry.validationError=options.validationError,entry.urls=routeUrls,routeUrls.add(owner,url);let run=compileWebRoute(entry,void 0,{bodyLimit});app.on(entry.method,url,event=>run({request:event.req,url:event.url,params:event.context.params??{}}))}}}finally{_setExternalContributorSources([])}}let notFound=notFoundHandler(mounted);return app.all(`/**`,event=>{let driver=new WebResponseDriver(event.req.signal);return notFound(new WebRequestShim(event.req,event.url),driver,()=>{}),driver.ready}),{fetch:async(request,platform)=>{let response=await app.fetch(request);return forwardBackgroundWork(platform),response},h3:app}}function createFetchHandler(build){let app;return{fetch:(request,env={},ctx)=>(app??=createWebApp(build(env)),app.fetch(request,ctx)),scheduled:async(event,env={},ctx)=>{app??=createWebApp(build(env));let run=runCronJobs(Container.getInstance(),{expression:event.cron},`workers`).then(()=>{});ctx?.waitUntil?.(run),await run},queue:async(batch,env={})=>{app??=createWebApp(build(env));let container=Container.getInstance();await Promise.all(batch.messages.map(async message=>{let body=message.body,named=typeof body==`object`&&!!body&&typeof body.name==`string`;try{await runJob(container,batch.queue,{name:named?body.name:``,data:named?body.data:message.body,id:message.id}),message.ack()}catch{message.retry()}}))}}}function joinPath(mountPath,path){let a=mountPath.endsWith(`/`)?mountPath.slice(0,-1):mountPath;return path===`/`||path===``?a===``?`/`:a:`${a}${path.startsWith(`/`)?path:`/${path}`}`}export{JOB_CONTEXT_FIELD,KvRateLimitStore,KvSessionStore,WebRequestShim,WebResponseDriver,compileWebRoute,createFetchHandler,createWebApp,isReply,rateLimitGuard,registerJobContext,reply,runCronJobs,runJob,stampJobContext,waitUntil};
|
|
12
12
|
//# sourceMappingURL=web.mjs.map
|
package/dist/web.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.mjs","names":[],"sources":["../src/web.ts"],"sourcesContent":["// `@forinda/kickjs/web` — the web-standard fetch entry for edge runtimes\n// (Cloudflare Workers), Bun, and Deno.\n//\n// PURITY CONTRACT: this entry's import graph must stay free of node-only\n// runtime imports — no `node:http`, `node:cluster`, `node:fs`, `node:module`,\n// no `express`, no `Application`/`bootstrap`. The single sanctioned node API\n// is `node:async_hooks` (AsyncLocalStorage — available on Workers with\n// `nodejs_compat`, Deno, and Bun). Enforced by the bundle-graph purity test.\n//\n// ```ts\n// // Cloudflare Workers (wrangler.toml: compatibility_flags = [\"nodejs_compat\"])\n// import { createWebApp } from '@forinda/kickjs/web'\n// import * as h3 from 'h3'\n// import { modules } from './modules'\n//\n// const app = createWebApp({ h3, modules })\n// export default { fetch: (req: Request) => app.fetch(req) }\n//\n// // Bun\n// Bun.serve({ fetch: (req) => app.fetch(req) })\n// ```\n\nimport { Container } from './core/container'\nimport { MutableModuleRegistry } from './core/module-registry'\nimport type { AppModule, AppModuleClass, AppModuleEntry } from './core/app-module'\nimport type { ContributorRegistrations } from './core/context-decorator'\nimport type { MiddlewareHandler } from './core/decorators'\nimport type { SourcedRegistration } from './core/contributor-pipeline'\nimport {\n _setExternalContributorSources,\n assertRouteUnique,\n buildRouteTable,\n} from './http/router-builder'\nimport { requestStore } from './http/request-store'\nimport { forwardBackgroundWork, type PlatformContext } from './http/background'\nimport { runCronJobs } from './core/cron'\nimport { runJob } from './core/jobs'\nimport { compileWebRoute } from './http/web/handler'\nimport { buildMountPath } from './core/path'\n\nexport { WebRequestShim, WebResponseDriver } from './http/web/driver'\nexport { compileWebRoute } from './http/web/handler'\n// Return-value handler helpers — edge consumers can't import the main barrel.\nexport { reply, isReply, type Reply, type InferHandlerResponse } from './http/reply'\nexport type { SseHandler } from './http/context'\nexport { waitUntil, type PlatformContext } from './http/background'\nexport { runCronJobs, type CronRun } from './core/cron'\nexport {\n runJob,\n registerJobContext,\n stampJobContext,\n JOB_CONTEXT_FIELD,\n type JobLike,\n type JobContextCarrier,\n} from './core/jobs'\n// Edge-safe stores + ctx-style rate limiter (zero runtime imports).\nexport {\n KvRateLimitStore,\n KvSessionStore,\n type KvLike,\n type KvRateLimitStoreOptions,\n type KvSessionStoreOptions,\n} from './http/middleware/kv-stores'\nexport { rateLimitGuard, type RateLimitGuardOptions } from './http/middleware/rate-limit-guard'\n\n// Minimal structural surface of h3 v2 used here (kept local so this entry\n// never imports the node-coupled h3 runtime module).\ninterface H3AppLike {\n on(method: string, path: string, handler: (event: H3EventLike) => unknown): unknown\n all(path: string, handler: (event: H3EventLike) => unknown): unknown\n fetch(request: Request): Promise<Response>\n}\ninterface H3EventLike {\n req: Request\n url: URL\n context: { params?: Record<string, string> }\n}\n\nexport interface CreateWebAppOptions {\n /**\n * The h3 v2 module, statically imported by the caller:\n * `import * as h3 from 'h3'`. Passed in (rather than loaded here) because\n * edge bundlers have no `createRequire`, and a static `import 'h3'` inside\n * this entry would force the peer on every consumer of the subpath.\n */\n h3: unknown\n /** App modules — same shapes `bootstrap({ modules })` accepts. */\n modules: AppModuleEntry[]\n /** Route prefix (default '/api') — parity with bootstrap. */\n apiPrefix?: string\n /**\n * Default route version (default 1) — parity with bootstrap. `false` opts\n * out of URL versioning; a module's own `version` still overrides it.\n */\n defaultVersion?: number | false\n /** Global Context Contributors — parity with `bootstrap({ contributors })`. */\n contributors?: ContributorRegistrations\n /**\n * Env values for ConfigService/@Value resolution. On Workers, pass the\n * `env` binding from the fetch handler (see `createFetchHandler`); on\n * Bun/Deno, ambient `process.env` already works and this can be omitted.\n */\n env?: Record<string, string | undefined>\n /**\n * Global `(ctx, next)` middlewares, run before route middlewares on every\n * route — the web-entry counterpart of `bootstrap({ middlewares })`. Only\n * ctx-style handlers are accepted (no connect/express middleware here).\n */\n middlewares?: MiddlewareHandler[]\n}\n\nexport interface WebApp {\n /**\n * Web-standard entry: `Request` in, `Response` out. Pass the platform\n * context (Workers `ctx`, Netlify `context`) so work handed to\n * `ctx.waitUntil()` finishes after the response.\n */\n fetch: (request: Request, platform?: PlatformContext) => Promise<Response>\n /** The underlying h3 v2 app, for advanced composition. */\n h3: unknown\n}\n\n/**\n * Build a KickJS app as a web-standard fetch handler — no node http server,\n * no Application/bootstrap. Module registration, DI, and the contributor\n * pipeline behave exactly like `bootstrap()`; routes are compiled once here\n * and served through h3 v2's router.\n */\nexport function createWebApp(options: CreateWebAppOptions): WebApp {\n const h3mod = options.h3 as { H3?: new () => H3AppLike }\n if (typeof h3mod?.H3 !== 'function') {\n throw new Error(\n '@forinda/kickjs/web: pass the h3 v2 module — `createWebApp({ h3: await import(\"h3\"), ... })`. ' +\n \"The installed h3 must be v2 (npm dist-tag 'latest'); v1 has no H3 class.\",\n )\n }\n\n const container = Container.getInstance()\n\n // Wire ConfigService/@Value env resolution when the platform has no\n // ambient process.env (Workers). Latest-wins like loadEnv().\n if (options.env) {\n const env = options.env\n Container._envResolver = (key: string) => env[key]\n }\n\n // Request-scope provider — same wiring Application.setup() performs.\n Container._requestStoreProvider = () => requestStore.getStore() ?? null\n\n // Module mounting — mirrors Application.setup() steps 1:1 for the module\n // path (plugins/adapters are out of scope for the edge entry at launch).\n const registry = new MutableModuleRegistry()\n for (const m of options.modules) registry.mount(m)\n const modules = registry.entries.map((entry) => {\n const mod: AppModule = typeof entry === 'function' ? new (entry as AppModuleClass)() : entry\n mod.register?.(container)\n return mod\n })\n container.bootstrap()\n\n const app = new h3mod.H3()\n const apiPrefix = options.apiPrefix ?? '/api'\n const defaultVersion = options.defaultVersion ?? 1\n const globalMiddleware = options.middlewares ?? []\n\n const globalSources: SourcedRegistration[] = (options.contributors ?? []).map(\n (registration): SourcedRegistration => ({\n source: 'global',\n registration: registration as SourcedRegistration['registration'],\n label: 'createWebApp',\n }),\n )\n\n // Duplicate-route guard (KICK006) — same boot-time check as the node path.\n const seenRoutes = new Map<string, string>()\n\n for (const mod of modules) {\n const declaredName = (mod as { name?: unknown }).name\n const moduleLabel =\n typeof declaredName === 'string' && declaredName.length > 0\n ? declaredName\n : (mod.constructor?.name ?? 'module')\n const moduleSources: SourcedRegistration[] = (mod.contributors?.() ?? []).map(\n (registration): SourcedRegistration => ({\n source: 'module',\n registration,\n label: moduleLabel,\n }),\n )\n\n _setExternalContributorSources([...moduleSources, ...globalSources])\n try {\n const result = mod.routes()\n if (!result) continue\n const routeSets = Array.isArray(result) ? result : [result]\n for (const route of routeSets) {\n if (!route.controller) {\n throw new Error(\n `@forinda/kickjs/web: module route at '${route.path}' has no controller. ` +\n 'Express-style `router` mounts are not supported on the web entry.',\n )\n }\n const version = route.version ?? defaultVersion\n const mountPath = buildMountPath(apiPrefix, version, route.path)\n for (const entry of buildRouteTable(route.controller, { mountFlags: route.flags })) {\n const url = joinPath(mountPath, entry.path)\n // Per-handler owner so intra-controller duplicates name both methods.\n const owner = `${route.controller.name ?? 'controller'}.${String(entry.meta.handlerName ?? '?')}`\n assertRouteUnique(seenRoutes, entry.method, url, owner)\n if (globalMiddleware.length > 0) {\n entry.middlewares = [...globalMiddleware, ...entry.middlewares]\n }\n const run = compileWebRoute(entry)\n app.on(entry.method, url, (event: H3EventLike) =>\n run({\n request: event.req,\n url: event.url,\n params: event.context.params ?? {},\n }),\n )\n }\n }\n } finally {\n _setExternalContributorSources([])\n }\n }\n\n return {\n fetch: async (request: Request, platform?: PlatformContext) => {\n const response = await app.fetch(request)\n forwardBackgroundWork(platform)\n return response\n },\n h3: app,\n }\n}\n\n/**\n * Cloudflare Workers convenience: lazily build the app on the first request\n * so the Workers `env` binding can seed config before any module resolves.\n *\n * The Workers execution context (third argument) is forwarded, so work\n * handed to `ctx.waitUntil()` keeps running after the response.\n *\n * `scheduled` runs the `@Cron` jobs whose expression equals the trigger's\n * `event.cron` — list the same expressions under `[triggers] crons` in\n * wrangler.toml.\n *\n * `queue` consumes Cloudflare Queues: each message goes to the `@Job` class\n * for the batch's queue via `runJob`, and is acked when its handler\n * succeeds or retried when it throws. A message body of `{ name, data }`\n * picks the `@Process(name)` method; any other body goes to the queue's\n * catch-all `@Process()` as `data`.\n *\n * ```ts\n * export default createFetchHandler((env) => ({ h3, modules, env }))\n * ```\n */\nexport function createFetchHandler(\n build: (env: Record<string, string | undefined>) => CreateWebAppOptions,\n): {\n fetch: (\n request: Request,\n env?: Record<string, string | undefined>,\n ctx?: PlatformContext,\n ) => Promise<Response>\n scheduled: (\n event: { cron: string },\n env?: Record<string, string | undefined>,\n ctx?: PlatformContext,\n ) => Promise<void>\n queue: (\n batch: QueueBatch,\n env?: Record<string, string | undefined>,\n ctx?: PlatformContext,\n ) => Promise<void>\n} {\n let app: WebApp | undefined\n return {\n fetch: (request, env = {}, ctx) => {\n app ??= createWebApp(build(env))\n return app.fetch(request, ctx)\n },\n scheduled: async (event, env = {}, ctx) => {\n app ??= createWebApp(build(env))\n const run = runCronJobs(Container.getInstance(), { expression: event.cron }, 'workers').then(\n () => {},\n )\n ctx?.waitUntil?.(run)\n await run\n },\n queue: async (batch, env = {}) => {\n app ??= createWebApp(build(env))\n const container = Container.getInstance()\n await Promise.all(\n batch.messages.map(async (message) => {\n const body = message.body as { name?: unknown; data?: unknown } | null\n const named = body !== null && typeof body === 'object' && typeof body.name === 'string'\n try {\n await runJob(container, batch.queue, {\n name: named ? (body!.name as string) : '',\n data: named ? body!.data : message.body,\n id: message.id,\n })\n message.ack()\n } catch {\n // Reported by runJob; Cloudflare redelivers per the queue's retry settings.\n message.retry()\n }\n }),\n )\n },\n }\n}\n\n/** The part of a Cloudflare Queues `MessageBatch` the consumer uses. */\nexport interface QueueBatch {\n readonly queue: string\n readonly messages: ReadonlyArray<{\n readonly id: string\n readonly body: unknown\n ack(): void\n retry(): void\n }>\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"],"mappings":";;;;;;;;;;+xBAgIA,SAAgB,aAAa,QAAsC,CACjE,IAAM,MAAQ,QAAQ,GACtB,GAAI,OAAO,OAAO,IAAO,WACvB,MAAU,MACR,0KAEF,EAGF,IAAM,UAAY,UAAU,YAAY,EAIxC,GAAI,QAAQ,IAAK,CACf,IAAM,IAAM,QAAQ,IACpB,UAAU,aAAgB,KAAgB,IAAI,IAChD,CAGA,UAAU,0BAA8B,aAAa,SAAS,GAAK,KAInE,IAAM,SAAW,IAAI,sBACrB,IAAK,IAAM,KAAK,QAAQ,QAAS,SAAS,MAAM,CAAC,EACjD,IAAM,QAAU,SAAS,QAAQ,IAAK,OAAU,CAC9C,IAAM,IAAiB,OAAO,OAAU,WAAa,IAAK,MAA6B,MAEvF,OADA,IAAI,WAAW,SAAS,EACjB,GACT,CAAC,EACD,UAAU,UAAU,EAEpB,IAAM,IAAM,IAAI,MAAM,GAChB,UAAY,QAAQ,WAAa,OACjC,eAAiB,QAAQ,gBAAkB,EAC3C,iBAAmB,QAAQ,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,KAAK,WAAW,GAAG,EAAI,KAAO,IAAI,QAE9C"}
|
|
1
|
+
{"version":3,"file":"web.mjs","names":[],"sources":["../src/web.ts"],"sourcesContent":["// `@forinda/kickjs/web` — the web-standard fetch entry for edge runtimes\n// (Cloudflare Workers), Bun, and Deno.\n//\n// PURITY CONTRACT: this entry's import graph must stay free of node-only\n// runtime imports — no `node:http`, `node:cluster`, `node:fs`, `node:module`,\n// no `express`, no `Application`/`bootstrap`. The single sanctioned node API\n// is `node:async_hooks` (AsyncLocalStorage — available on Workers with\n// `nodejs_compat`, Deno, and Bun). Enforced by the bundle-graph purity test.\n//\n// ```ts\n// // Cloudflare Workers (wrangler.toml: compatibility_flags = [\"nodejs_compat\"])\n// import { createWebApp } from '@forinda/kickjs/web'\n// import * as h3 from 'h3'\n// import { modules } from './modules'\n//\n// const app = createWebApp({ h3, modules })\n// export default { fetch: (req: Request) => app.fetch(req) }\n//\n// // Bun\n// Bun.serve({ fetch: (req) => app.fetch(req) })\n// ```\n\nimport { Container } from './core/container'\nimport { MutableModuleRegistry } from './core/module-registry'\nimport type { AppModule, AppModuleClass, AppModuleEntry } from './core/app-module'\nimport type { ContributorRegistrations } from './core/context-decorator'\nimport type { MiddlewareHandler } from './core/decorators'\nimport type { SourcedRegistration } from './core/contributor-pipeline'\nimport {\n _setExternalContributorSources,\n assertRouteUnique,\n buildRouteTable,\n} from './http/router-builder'\nimport { requestStore } from './http/request-store'\nimport { forwardBackgroundWork, type PlatformContext } from './http/background'\nimport { runCronJobs } from './core/cron'\nimport { runJob } from './core/jobs'\nimport { compileWebRoute } from './http/web/handler'\nimport { ROUTE_URLS, RouteUrls } from './http/url-for'\nimport { loadSettings, type SettingsDeclaration } from './config/settings'\nimport { DEFAULT_BODY_LIMIT, parseByteSize } from './http/body-policy'\nimport { WebRequestShim, WebResponseDriver } from './http/web/driver'\nimport { notFoundHandler, type MountedRoute } from './http/middleware/error-handler'\nimport type { ValidationErrorFactory } from './http/middleware/validate'\nimport { buildMountPath } from './core/path'\n\nexport { WebRequestShim, WebResponseDriver } from './http/web/driver'\nexport { compileWebRoute } from './http/web/handler'\n// Return-value handler helpers — edge consumers can't import the main barrel.\nexport { reply, isReply, type Reply, type InferHandlerResponse } from './http/reply'\nexport type { SseHandler } from './http/context'\nexport { waitUntil, type PlatformContext } from './http/background'\nexport { runCronJobs, type CronRun } from './core/cron'\nexport {\n runJob,\n registerJobContext,\n stampJobContext,\n JOB_CONTEXT_FIELD,\n type JobLike,\n type JobContextCarrier,\n} from './core/jobs'\n// Edge-safe stores + ctx-style rate limiter (zero runtime imports).\nexport {\n KvRateLimitStore,\n KvSessionStore,\n type KvLike,\n type KvRateLimitStoreOptions,\n type KvSessionStoreOptions,\n} from './http/middleware/kv-stores'\nexport { rateLimitGuard, type RateLimitGuardOptions } from './http/middleware/rate-limit-guard'\n\n// Minimal structural surface of h3 v2 used here (kept local so this entry\n// never imports the node-coupled h3 runtime module).\ninterface H3AppLike {\n on(method: string, path: string, handler: (event: H3EventLike) => unknown): unknown\n all(path: string, handler: (event: H3EventLike) => unknown): unknown\n fetch(request: Request): Promise<Response>\n}\ninterface H3EventLike {\n req: Request\n url: URL\n context: { params?: Record<string, string> }\n}\n\nexport interface CreateWebAppOptions {\n /**\n * The h3 v2 module, statically imported by the caller:\n * `import * as h3 from 'h3'`. Passed in (rather than loaded here) because\n * edge bundlers have no `createRequire`, and a static `import 'h3'` inside\n * this entry would force the peer on every consumer of the subpath.\n */\n h3: unknown\n /** App modules — same shapes `bootstrap({ modules })` accepts. */\n modules: AppModuleEntry[]\n /** Route prefix (default '/api') — parity with bootstrap. */\n apiPrefix?: string\n /**\n * Default route version (default 1) — parity with bootstrap. `false` opts\n * out of URL versioning; a module's own `version` still overrides it.\n */\n defaultVersion?: number | false\n /** Global Context Contributors — parity with `bootstrap({ contributors })`. */\n contributors?: ContributorRegistrations\n /**\n * Env values for ConfigService/@Value resolution. On Workers, pass the\n * `env` binding from the fetch handler (see `createFetchHandler`); on\n * Bun/Deno, ambient `process.env` already works and this can be omitted.\n */\n env?: Record<string, string | undefined>\n /**\n * Global `(ctx, next)` middlewares, run before route middlewares on every\n * route — the web-entry counterpart of `bootstrap({ middlewares })`. Only\n * ctx-style handlers are accepted (no connect/express middleware here).\n */\n middlewares?: MiddlewareHandler[]\n /**\n * Largest request body parsed, as bytes or `'1mb'`-style (default `'1mb'`)\n * — parity with `bootstrap({ jsonLimit })`. A larger body answers 413.\n */\n jsonLimit?: string | number\n /** App-wide settings sections — parity with `bootstrap({ settings })`. */\n settings?: SettingsDeclaration[]\n /** What a failed route validation throws — parity with `bootstrap({ validationError })`. */\n validationError?: ValidationErrorFactory\n}\n\nexport interface WebApp {\n /**\n * Web-standard entry: `Request` in, `Response` out. Pass the platform\n * context (Workers `ctx`, Netlify `context`) so work handed to\n * `ctx.waitUntil()` finishes after the response.\n */\n fetch: (request: Request, platform?: PlatformContext) => Promise<Response>\n /** The underlying h3 v2 app, for advanced composition. */\n h3: unknown\n}\n\n/**\n * Build a KickJS app as a web-standard fetch handler — no node http server,\n * no Application/bootstrap. Module registration, DI, and the contributor\n * pipeline behave exactly like `bootstrap()`; routes are compiled once here\n * and served through h3 v2's router.\n */\nexport function createWebApp(options: CreateWebAppOptions): WebApp {\n const h3mod = options.h3 as { H3?: new () => H3AppLike }\n if (typeof h3mod?.H3 !== 'function') {\n throw new Error(\n '@forinda/kickjs/web: pass the h3 v2 module — `createWebApp({ h3: await import(\"h3\"), ... })`. ' +\n \"The installed h3 must be v2 (npm dist-tag 'latest'); v1 has no H3 class.\",\n )\n }\n\n const container = Container.getInstance()\n // Route names for ctx.urlFor() / the ROUTE_URLS token — bound before modules\n // register so their services can inject it.\n const routeUrls = new RouteUrls()\n container.registerInstance(ROUTE_URLS, routeUrls)\n // Wire ConfigService/@Value env resolution when the platform has no\n // ambient process.env (Workers). Latest-wins like loadEnv().\n if (options.env) {\n const env = options.env\n Container._envResolver = (key: string) => env[key]\n }\n\n // Request-scope provider — same wiring Application.setup() performs.\n Container._requestStoreProvider = () => requestStore.getStore() ?? null\n\n // Module mounting — mirrors Application.setup() steps 1:1 for the module\n // path (plugins/adapters are out of scope for the edge entry at launch).\n const registry = new MutableModuleRegistry()\n for (const m of options.modules) registry.mount(m)\n const modules = registry.entries.map((entry) =>\n typeof entry === 'function' ? new (entry as AppModuleClass)() : (entry as AppModule),\n )\n // Declared settings sections — app-wide and mounted modules' — from the\n // platform env (Workers bindings) when given, bound before modules register.\n const settingsEnv = (options.env ??\n (typeof process !== 'undefined' ? process.env : {})) as NodeJS.ProcessEnv\n for (const [section, value] of loadSettings(\n [...(options.settings ?? []), ...modules.flatMap((mod) => mod.settings?.() ?? [])],\n settingsEnv,\n )) {\n container.registerInstance(section, value)\n }\n for (const mod of modules) mod.register?.(container)\n container.bootstrap()\n\n const app = new h3mod.H3()\n const apiPrefix = options.apiPrefix ?? '/api'\n const defaultVersion = options.defaultVersion ?? 1\n const globalMiddleware = options.middlewares ?? []\n const bodyLimit = parseByteSize(options.jsonLimit ?? DEFAULT_BODY_LIMIT)\n\n const globalSources: SourcedRegistration[] = (options.contributors ?? []).map(\n (registration): SourcedRegistration => ({\n source: 'global',\n registration: registration as SourcedRegistration['registration'],\n label: 'createWebApp',\n }),\n )\n\n // Duplicate-route guard (KICK006) — same boot-time check as the node path.\n const seenRoutes = new Map<string, string>()\n // For the catch-all: a known path with the wrong verb is a 405, not a 404.\n const mounted: MountedRoute[] = []\n\n for (const mod of modules) {\n const declaredName = (mod as { name?: unknown }).name\n const moduleLabel =\n typeof declaredName === 'string' && declaredName.length > 0\n ? declaredName\n : (mod.constructor?.name ?? 'module')\n const moduleSources: SourcedRegistration[] = (mod.contributors?.() ?? []).map(\n (registration): SourcedRegistration => ({\n source: 'module',\n registration,\n label: moduleLabel,\n }),\n )\n\n _setExternalContributorSources([...moduleSources, ...globalSources])\n try {\n const result = mod.routes()\n if (!result) continue\n const routeSets = Array.isArray(result) ? result : [result]\n for (const route of routeSets) {\n if (!route.controller) {\n throw new Error(\n `@forinda/kickjs/web: module route at '${route.path}' has no controller. ` +\n 'Express-style `router` mounts are not supported on the web entry.',\n )\n }\n const version = route.version ?? defaultVersion\n const mountPath = buildMountPath(apiPrefix, version, route.path)\n for (const entry of buildRouteTable(route.controller, { mountFlags: route.flags })) {\n const url = joinPath(mountPath, entry.path)\n // Per-handler owner so intra-controller duplicates name both methods.\n const owner = `${route.controller.name ?? 'controller'}.${String(entry.meta.handlerName ?? '?')}`\n assertRouteUnique(seenRoutes, entry.method, url, owner)\n mounted.push({ method: entry.method, path: url })\n if (globalMiddleware.length > 0) {\n entry.middlewares = [...globalMiddleware, ...entry.middlewares]\n }\n entry.validationError = options.validationError\n entry.urls = routeUrls\n routeUrls.add(owner, url)\n const run = compileWebRoute(entry, undefined, { bodyLimit })\n app.on(entry.method, url, (event: H3EventLike) =>\n run({\n request: event.req,\n url: event.url,\n params: event.context.params ?? {},\n }),\n )\n }\n }\n } finally {\n _setExternalContributorSources([])\n }\n }\n\n // Anything no route answered: the same 404 / 405 problem details as the\n // node engines, instead of h3's own 404 body.\n const notFound = notFoundHandler(mounted)\n app.all('/**', (event: H3EventLike) => {\n const driver = new WebResponseDriver(event.req.signal)\n notFound(new WebRequestShim(event.req, event.url), driver, () => {})\n return driver.ready\n })\n\n return {\n fetch: async (request: Request, platform?: PlatformContext) => {\n const response = await app.fetch(request)\n forwardBackgroundWork(platform)\n return response\n },\n h3: app,\n }\n}\n\n/**\n * Cloudflare Workers convenience: lazily build the app on the first request\n * so the Workers `env` binding can seed config before any module resolves.\n *\n * The Workers execution context (third argument) is forwarded, so work\n * handed to `ctx.waitUntil()` keeps running after the response.\n *\n * `scheduled` runs the `@Cron` jobs whose expression equals the trigger's\n * `event.cron` — list the same expressions under `[triggers] crons` in\n * wrangler.toml.\n *\n * `queue` consumes Cloudflare Queues: each message goes to the `@Job` class\n * for the batch's queue via `runJob`, and is acked when its handler\n * succeeds or retried when it throws. A message body of `{ name, data }`\n * picks the `@Process(name)` method; any other body goes to the queue's\n * catch-all `@Process()` as `data`.\n *\n * ```ts\n * export default createFetchHandler((env) => ({ h3, modules, env }))\n * ```\n */\nexport function createFetchHandler(\n build: (env: Record<string, string | undefined>) => CreateWebAppOptions,\n): {\n fetch: (\n request: Request,\n env?: Record<string, string | undefined>,\n ctx?: PlatformContext,\n ) => Promise<Response>\n scheduled: (\n event: { cron: string },\n env?: Record<string, string | undefined>,\n ctx?: PlatformContext,\n ) => Promise<void>\n queue: (\n batch: QueueBatch,\n env?: Record<string, string | undefined>,\n ctx?: PlatformContext,\n ) => Promise<void>\n} {\n let app: WebApp | undefined\n return {\n fetch: (request, env = {}, ctx) => {\n app ??= createWebApp(build(env))\n return app.fetch(request, ctx)\n },\n scheduled: async (event, env = {}, ctx) => {\n app ??= createWebApp(build(env))\n const run = runCronJobs(Container.getInstance(), { expression: event.cron }, 'workers').then(\n () => {},\n )\n ctx?.waitUntil?.(run)\n await run\n },\n queue: async (batch, env = {}) => {\n app ??= createWebApp(build(env))\n const container = Container.getInstance()\n await Promise.all(\n batch.messages.map(async (message) => {\n const body = message.body as { name?: unknown; data?: unknown } | null\n const named = body !== null && typeof body === 'object' && typeof body.name === 'string'\n try {\n await runJob(container, batch.queue, {\n name: named ? (body!.name as string) : '',\n data: named ? body!.data : message.body,\n id: message.id,\n })\n message.ack()\n } catch {\n // Reported by runJob; Cloudflare redelivers per the queue's retry settings.\n message.retry()\n }\n }),\n )\n },\n }\n}\n\n/** The part of a Cloudflare Queues `MessageBatch` the consumer uses. */\nexport interface QueueBatch {\n readonly queue: string\n readonly messages: ReadonlyArray<{\n readonly id: string\n readonly body: unknown\n ack(): void\n retry(): void\n }>\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"],"mappings":";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AM,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forinda/kickjs",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "Modern type-safe backend framework, powered by Vite. Built for developer experience, pluggable as you need — runs on Express, Fastify or h3.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kickjs",
|
|
@@ -52,6 +52,14 @@
|
|
|
52
52
|
"import": "./dist/core/reactivity.mjs",
|
|
53
53
|
"types": "./dist/core/reactivity.d.mts"
|
|
54
54
|
},
|
|
55
|
+
"./middleware/breach-padding": {
|
|
56
|
+
"import": "./dist/http/middleware/breach-padding.mjs",
|
|
57
|
+
"types": "./dist/http/middleware/breach-padding.d.mts"
|
|
58
|
+
},
|
|
59
|
+
"./middleware/allowed-hosts": {
|
|
60
|
+
"import": "./dist/http/middleware/allowed-hosts.mjs",
|
|
61
|
+
"types": "./dist/http/middleware/allowed-hosts.d.mts"
|
|
62
|
+
},
|
|
55
63
|
"./middleware/helmet": {
|
|
56
64
|
"import": "./dist/http/middleware/helmet.mjs",
|
|
57
65
|
"types": "./dist/http/middleware/helmet.d.mts"
|
|
@@ -159,18 +167,23 @@
|
|
|
159
167
|
"@fastify/middie": "^9.3.5",
|
|
160
168
|
"@fastify/multipart": "^10.1.3",
|
|
161
169
|
"@swc/core": "^1.16.13",
|
|
170
|
+
"@types/compression": "1.8.1",
|
|
162
171
|
"@types/express": "^5.0.6",
|
|
163
172
|
"@types/multer": "^2.3.0",
|
|
164
173
|
"@types/node": "^26.6.5",
|
|
165
174
|
"@types/serve-static": "^2.2.0",
|
|
175
|
+
"@valibot/to-json-schema": "1.6.0",
|
|
176
|
+
"compression": "1.8.1",
|
|
166
177
|
"croner": "^10.0.1",
|
|
167
178
|
"fastify": "^5.12.5",
|
|
168
179
|
"h3": "2.0.2",
|
|
169
180
|
"multer": "^2.4.0",
|
|
170
181
|
"serve-static": "^2.2.0",
|
|
171
182
|
"typescript": "^7.0.2",
|
|
183
|
+
"valibot": "1.4.1",
|
|
172
184
|
"vite": "^8.3.4",
|
|
173
185
|
"vitest": "^5.0.3",
|
|
186
|
+
"yup": "1.7.1",
|
|
174
187
|
"zod": "^4.6.5"
|
|
175
188
|
},
|
|
176
189
|
"publishConfig": {
|