@forinda/kickjs 10.13.3 → 10.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-g_vQffKr.d.mts → adapter-DL9JPcvC.d.mts} +3 -3
- package/dist/{adapter-g_vQffKr.d.mts.map → adapter-DL9JPcvC.d.mts.map} +1 -1
- package/dist/{app-module-Bk3glnPP.d.mts → app-module-Dk2Wenqx.d.mts} +2 -2
- package/dist/{app-module-Bk3glnPP.d.mts.map → app-module-Dk2Wenqx.d.mts.map} +1 -1
- package/dist/application-BosHcuBZ.mjs +14 -0
- package/dist/application-BosHcuBZ.mjs.map +1 -0
- package/dist/{application-DsHdZoZK.d.mts → application-D921r4MW.d.mts} +15 -10
- package/dist/{application-DsHdZoZK.d.mts.map → application-D921r4MW.d.mts.map} +1 -1
- package/dist/{body-policy-mOP2Y9X_.mjs → body-policy-CwgUYBw7.mjs} +2 -2
- package/dist/{body-policy-mOP2Y9X_.mjs.map → body-policy-CwgUYBw7.mjs.map} +1 -1
- package/dist/{bootstrap-CMwBEDZq.mjs → bootstrap-CY0v5VVF.mjs} +3 -3
- package/dist/{bootstrap-CMwBEDZq.mjs.map → bootstrap-CY0v5VVF.mjs.map} +1 -1
- package/dist/{bounded-counters-BMVTNLG4.mjs → bounded-counters-CF8EnVUm.mjs} +2 -2
- package/dist/{bounded-counters-BMVTNLG4.mjs.map → bounded-counters-CF8EnVUm.mjs.map} +1 -1
- package/dist/{client-ip-C4TZ7y05.mjs → client-ip-CpEuptqr.mjs} +2 -2
- package/dist/{client-ip-C4TZ7y05.mjs.map → client-ip-CpEuptqr.mjs.map} +1 -1
- package/dist/config/index.d.mts +1 -1
- package/dist/config/index.mjs +2 -2
- package/dist/{config-DzmeCXg4.mjs → config-Djisd0f5.mjs} +3 -3
- package/dist/{config-DzmeCXg4.mjs.map → config-Djisd0f5.mjs.map} +1 -1
- package/dist/{context-CvicRipm.mjs → context-Cgr5dtIZ.mjs} +3 -3
- package/dist/{context-CvicRipm.mjs.map → context-Cgr5dtIZ.mjs.map} +1 -1
- package/dist/{context-errors-CXGtzjTQ.mjs → context-errors-6x0bjldv.mjs} +2 -2
- package/dist/{context-errors-CXGtzjTQ.mjs.map → context-errors-6x0bjldv.mjs.map} +1 -1
- package/dist/{contributor-runner-Dx-TDNgk.mjs → contributor-runner-DQ2fXJ29.mjs} +3 -3
- package/dist/{contributor-runner-Dx-TDNgk.mjs.map → contributor-runner-DQ2fXJ29.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.mjs +2 -2
- package/dist/core/errors.mjs +1 -1
- package/dist/core/interfaces.mjs +1 -1
- package/dist/core/logger.mjs +1 -1
- package/dist/core/path.mjs +1 -1
- package/dist/core/plugin.d.mts +1 -1
- package/dist/core/plugin.mjs +1 -1
- package/dist/core/reactivity.mjs +2 -2
- package/dist/{core-CXAMJq3w.mjs → core-g3y9VDwr.mjs} +3 -3
- package/dist/{core-CXAMJq3w.mjs.map → core-g3y9VDwr.mjs.map} +1 -1
- package/dist/{decorate-JtGrMqV1.mjs → decorate-LMK39Sn6.mjs} +4 -4
- package/dist/{decorate-JtGrMqV1.mjs.map → decorate-LMK39Sn6.mjs.map} +1 -1
- package/dist/{define-adapter-C_97M6VW.mjs → define-adapter-CZCFyDp5.mjs} +2 -2
- package/dist/{define-adapter-C_97M6VW.mjs.map → define-adapter-CZCFyDp5.mjs.map} +1 -1
- package/dist/{di-hooks-CBFaF0h-.mjs → di-hooks-ZfnBZMDp.mjs} +2 -2
- package/dist/{di-hooks-CBFaF0h-.mjs.map → di-hooks-ZfnBZMDp.mjs.map} +1 -1
- package/dist/{disposables-BBiL1YqI.mjs → disposables-DFZXQuVg.mjs} +1 -1
- package/dist/{driver-B8NPLeRC.mjs → driver-D_bUSW7N.mjs} +3 -3
- package/dist/{driver-B8NPLeRC.mjs.map → driver-D_bUSW7N.mjs.map} +1 -1
- package/dist/{error-handler-vox7HLaR.d.mts → error-handler-D7DLWe1Q.d.mts} +2 -2
- package/dist/{error-handler-vox7HLaR.d.mts.map → error-handler-D7DLWe1Q.d.mts.map} +1 -1
- package/dist/{express-_PaI8hxC.mjs → express-31o4SoCz.mjs} +3 -3
- package/dist/{express-_PaI8hxC.mjs.map → express-31o4SoCz.mjs.map} +1 -1
- package/dist/{express-lazy-DaYQBnt_.mjs → express-lazy-GCgYyykt.mjs} +3 -3
- package/dist/{express-lazy-DaYQBnt_.mjs.map → express-lazy-GCgYyykt.mjs.map} +1 -1
- package/dist/{handler-B5jN9Wms.mjs → handler-Bvs0gx1o.mjs} +3 -3
- package/dist/{handler-B5jN9Wms.mjs.map → handler-Bvs0gx1o.mjs.map} +1 -1
- package/dist/{host-Ix7FHVzW.mjs → host-CKz7eCtO.mjs} +2 -2
- package/dist/{host-Ix7FHVzW.mjs.map → host-CKz7eCtO.mjs.map} +1 -1
- package/dist/http/application.d.mts +1 -1
- package/dist/http/application.mjs +2 -2
- package/dist/http/bootstrap.d.mts +1 -1
- package/dist/http/bootstrap.mjs +2 -2
- package/dist/http/context.d.mts +2 -2
- package/dist/http/context.mjs +2 -2
- package/dist/http/middleware/allowed-hosts.mjs +2 -2
- package/dist/http/middleware/breach-padding.mjs +1 -1
- package/dist/http/middleware/cors.mjs +1 -1
- 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/helmet.mjs +1 -1
- package/dist/http/middleware/rate-limit.mjs +2 -2
- package/dist/http/middleware/request-id.mjs +1 -1
- package/dist/http/middleware/request-logger.mjs +2 -2
- package/dist/http/middleware/session.mjs +2 -2
- package/dist/http/middleware/spa.d.mts +1 -1
- package/dist/http/middleware/spa.mjs +2 -2
- package/dist/http/middleware/upload.d.mts +2 -2
- package/dist/http/middleware/upload.mjs +2 -2
- package/dist/http/middleware/validate.mjs +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/express.d.mts +2 -2
- package/dist/http/runtimes/express.mjs +2 -2
- package/dist/http/runtimes/fastify.d.mts +1 -1
- package/dist/http/runtimes/fastify.mjs +2 -2
- package/dist/http/runtimes/h3-web.mjs +1 -1
- package/dist/http/runtimes/h3.d.mts +1 -1
- package/dist/http/runtimes/h3.mjs +2 -2
- package/dist/{index-CNBYZDto.d.mts → index-DP_I4puv.d.mts} +2 -2
- package/dist/{index-CNBYZDto.d.mts.map → index-DP_I4puv.d.mts.map} +1 -1
- package/dist/index.d.mts +10 -10
- package/dist/index.mjs +2 -2
- package/dist/{is-production-BiWSKvPw.mjs → is-production-6wpWSGvS.mjs} +2 -2
- package/dist/{is-production-BiWSKvPw.mjs.map → is-production-6wpWSGvS.mjs.map} +1 -1
- package/dist/{jobs-CZeIt0gU.mjs → jobs-BTnyyRY1.mjs} +3 -3
- package/dist/{jobs-CZeIt0gU.mjs.map → jobs-BTnyyRY1.mjs.map} +1 -1
- package/dist/{kv-stores-B6KIUgPS.d.mts → kv-stores-CwJdsMln.d.mts} +2 -2
- package/dist/{kv-stores-B6KIUgPS.d.mts.map → kv-stores-CwJdsMln.d.mts.map} +1 -1
- package/dist/{kv-stores-C10enmKH.mjs → kv-stores-HUdUibOx.mjs} +3 -3
- package/dist/{kv-stores-C10enmKH.mjs.map → kv-stores-HUdUibOx.mjs.map} +1 -1
- package/dist/{lazy-serve-static-BYRJI_As.mjs → lazy-serve-static-CZBn-40v.mjs} +3 -3
- package/dist/{lazy-serve-static-BYRJI_As.mjs.map → lazy-serve-static-CZBn-40v.mjs.map} +1 -1
- package/dist/{metadata-CVsp-IZS.mjs → metadata-UjLEzS06.mjs} +1 -1
- package/dist/{observers-DBTDcQ62.mjs → observers-C4bWQTop.mjs} +2 -2
- package/dist/{observers-DBTDcQ62.mjs.map → observers-C4bWQTop.mjs.map} +1 -1
- package/dist/{precompressed-Cc2hpa1k.mjs → precompressed-BNkw1Vrz.mjs} +2 -2
- package/dist/{precompressed-Cc2hpa1k.mjs.map → precompressed-BNkw1Vrz.mjs.map} +1 -1
- package/dist/{query-sD0UtM2N.mjs → query-DXIo1mII.mjs} +2 -2
- package/dist/{query-sD0UtM2N.mjs.map → query-DXIo1mII.mjs.map} +1 -1
- package/dist/{reply-CjA0lh5T.mjs → reply-CpMbB8uH.mjs} +3 -3
- package/dist/{reply-CjA0lh5T.mjs.map → reply-CpMbB8uH.mjs.map} +1 -1
- package/dist/{request-scope-BjBvqXuj.mjs → request-scope-DZQceiLY.mjs} +3 -3
- package/dist/{request-scope-BjBvqXuj.mjs.map → request-scope-DZQceiLY.mjs.map} +1 -1
- package/dist/{respond--cbHjP4v.mjs → respond-Bc71p7sN.mjs} +2 -2
- package/dist/{respond--cbHjP4v.mjs.map → respond-Bc71p7sN.mjs.map} +1 -1
- package/dist/{rolldown-runtime-Bdw01CLM.mjs → rolldown-runtime-Z3gdyCfQ.mjs} +1 -1
- package/dist/{route-flag-Bjnd8inS.mjs → route-flag-DWNbpMIE.mjs} +3 -3
- package/dist/{route-flag-Bjnd8inS.mjs.map → route-flag-DWNbpMIE.mjs.map} +1 -1
- package/dist/{route-policy-CiSCSa16.mjs → route-policy-DsdJx3bk.mjs} +2 -2
- package/dist/{route-policy-CiSCSa16.mjs.map → route-policy-DsdJx3bk.mjs.map} +1 -1
- package/dist/{router-builder-DdfPBl09.d.mts → router-builder-C5EtcFSL.d.mts} +2 -2
- package/dist/{router-builder-DdfPBl09.d.mts.map → router-builder-C5EtcFSL.d.mts.map} +1 -1
- package/dist/{router-builder-BgoS_JoM.mjs → router-builder-CiwYhiUM.mjs} +3 -3
- package/dist/{router-builder-BgoS_JoM.mjs.map → router-builder-CiwYhiUM.mjs.map} +1 -1
- package/dist/{runtime-BMyg1FYH.mjs → runtime-Bus9RVyU.mjs} +3 -3
- package/dist/{runtime-BMyg1FYH.mjs.map → runtime-Bus9RVyU.mjs.map} +1 -1
- package/dist/settings-CNZ7iRli.mjs +14 -0
- package/dist/settings-CNZ7iRli.mjs.map +1 -0
- package/dist/{settings-BFQisfqG.d.mts → settings-DgZLgcNU.d.mts} +25 -4
- package/dist/settings-DgZLgcNU.d.mts.map +1 -0
- package/dist/{token-BRZwz7iz.mjs → token-CroYM4Lm.mjs} +1 -1
- package/dist/{upload-DodgN_Ef.d.mts → upload-DnwvZQyi.d.mts} +2 -2
- package/dist/{upload-DodgN_Ef.d.mts.map → upload-DnwvZQyi.d.mts.map} +1 -1
- package/dist/{upload-config-C_SlwFq0.mjs → upload-config-Bq3qcDel.mjs} +2 -2
- package/dist/{upload-config-C_SlwFq0.mjs.map → upload-config-Bq3qcDel.mjs.map} +1 -1
- package/dist/{url-for-C5R5ZrDW.mjs → url-for-BCQLTEJj.mjs} +3 -3
- package/dist/{url-for-C5R5ZrDW.mjs.map → url-for-BCQLTEJj.mjs.map} +1 -1
- package/dist/{view-renderer-BvDWb7GV.mjs → view-renderer-Dbha_94K.mjs} +3 -3
- package/dist/{view-renderer-BvDWb7GV.mjs.map → view-renderer-Dbha_94K.mjs.map} +1 -1
- package/dist/{web-crypto-Dm0fWL80.mjs → web-crypto-CJiyfQrv.mjs} +2 -2
- package/dist/{web-crypto-Dm0fWL80.mjs.map → web-crypto-CJiyfQrv.mjs.map} +1 -1
- package/dist/web.d.mts +4 -4
- package/dist/web.mjs +2 -2
- package/package.json +8 -8
- package/dist/application-Bq0CzA-N.mjs +0 -14
- package/dist/application-Bq0CzA-N.mjs.map +0 -1
- package/dist/settings-BFQisfqG.d.mts.map +0 -1
- package/dist/settings-Ck0vWbOD.mjs +0 -14
- package/dist/settings-Ck0vWbOD.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as RawUploadPart, F as buildFileTypeFilter, I as resolveMimeTypes, M as UploadedFile, N as UploadedFileLike, P as applyUploadConfig, j as UploadStorageEngine } from "../../adapter-
|
|
3
|
-
import { i as upload, n as buildUploadMiddleware, r as cleanupFiles, t as UploadOptions } from "../../upload-
|
|
2
|
+
import { A as RawUploadPart, F as buildFileTypeFilter, I as resolveMimeTypes, M as UploadedFile, N as UploadedFileLike, P as applyUploadConfig, j as UploadStorageEngine } from "../../adapter-DL9JPcvC.mjs";
|
|
3
|
+
import { i as upload, n as buildUploadMiddleware, r as cleanupFiles, t as UploadOptions } from "../../upload-DnwvZQyi.mjs";
|
|
4
4
|
export { type RawUploadPart, UploadOptions, type UploadStorageEngine, type UploadedFile, type UploadedFileLike, applyUploadConfig, buildFileTypeFilter, buildUploadMiddleware, cleanupFiles, resolveMimeTypes, upload };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.14.1
|
|
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,HttpStatus}from"../../core/errors.mjs";import{f as tooLarge}from"../../body-policy-
|
|
11
|
+
import{HttpException,HttpStatus}from"../../core/errors.mjs";import{f as tooLarge}from"../../body-policy-CwgUYBw7.mjs";import{a as normalizeOriginalName,c as tooManyFiles,i as buildFileTypeFilter,l as uploadLimits,n as UPLOAD_FIELDS_ALLOWANCE,o as resolveMimeTypes,r as applyUploadConfig,s as serverFileName,t as MAX_UPLOAD_FIELDS}from"../../upload-config-Bq3qcDel.mjs";import{unlink}from"node:fs/promises";import{Transform}from"node:stream";let _multer;function loadMulter(){return _multer??=import(`multer`).then(mod=>mod.default??mod,()=>{throw Error(`@forinda/kickjs: file uploads require the 'multer' package, which is not installed. Add it to your dependencies.`)})}function translateMulterErrors(mw,options,files){let maxSize=options.maxSize??5242880;return(req,res,next)=>{mw(req,res,err=>{if(files&&err?.code===`LIMIT_UNEXPECTED_FILE`&&err.field===files.field)return next(tooManyFiles(files.max));if(err&&err.code===`LIMIT_FILE_SIZE`){let name=err.field??`file`;return next(new HttpException(HttpStatus.PAYLOAD_TOO_LARGE,`File ${name} exceeds the ${maxSize}-byte limit`))}if(!err)try{nameUploads(req,options)}catch(error){return next(error)}next(err)})}}function nameUploads(req,options){let files=[req.file,...Array.isArray(req.files)?req.files:[]];for(let file of files)file&&(file.originalname=normalizeOriginalName(file.originalname),file.filename??=serverFileName(file,options))}function createMulter(options){let limits={fileSize:options.maxSize??5242880,fields:MAX_UPLOAD_FIELDS,fieldSize:UPLOAD_FIELDS_ALLOWANCE},fileFilter;if(options.allowedTypes){let typeAllowed=buildFileTypeFilter(options.allowedTypes,options.customMimeMap);fileFilter=(_req,file,cb)=>{typeAllowed(file.mimetype,file.originalname)?cb(null,!0):cb(new HttpException(HttpStatus.UNSUPPORTED_MEDIA_TYPE,`File type ${file.mimetype} is not allowed`))}}let multerOptions={limits,defParamCharset:`utf8`,...fileFilter?{fileFilter}:{},...options.storage?{storage:options.storage}:{},...options.dest?{dest:options.dest}:{}},built,lazy=pick=>{let handler;return(req,res,next)=>{handler??=(built??=loadMulter().then(multer=>multer(multerOptions))).then(pick),handler.then(run=>run(req,res,next),err=>{handler=built=_multer=void 0,next(err)})}};return{single:field=>lazy(m=>m.single(field)),array:(field,maxCount)=>lazy(m=>m.array(field,maxCount)),none:()=>lazy(m=>m.none())}}function bothConventions(handler){return((first,second,third)=>third===void 0&&typeof second==`function`&&typeof first==`object`&&first&&`req`in first&&`res`in first?new Promise((resolve,reject)=>{handler(first.req,first.res,err=>{if(err)return reject(err);resolve(),second()})}):handler(first,second,third))}function capBody(mw,limit){return(req,res,next)=>{if(Number(req.headers[`content-length`])>limit)return next(tooLarge(limit));if(typeof req.pipe!=`function`)return mw(req,res,next);let pipe=req.pipe.bind(req);req.pipe=(destination=>{let received=0,counter=new Transform({transform(chunk,_encoding,done){if(received+=chunk.length,received<=limit)return done(null,chunk);received-chunk.length<=limit&&destination.destroy(tooLarge(limit)),done()}});return pipe(counter),counter.pipe(destination)}),mw(req,res,next)}}function single(fieldName,options={}){let m=createMulter(options),{total}=uploadLimits({mode:`single`,maxSize:options.maxSize});return bothConventions(capBody(translateMulterErrors(m.single(fieldName),options,{field:fieldName,max:1}),total))}function array(fieldName,maxCount=10,options={}){let m=createMulter(options),{total}=uploadLimits({mode:`array`,maxSize:options.maxSize,maxCount});return bothConventions(capBody(translateMulterErrors(m.array(fieldName,maxCount),options,{field:fieldName,max:maxCount}),total))}function none(options={}){let m=createMulter(options),{total}=uploadLimits({mode:`none`});return bothConventions(capBody(translateMulterErrors(m.none(),options),total))}function cleanupFiles(){return(req,res,next)=>{res.on(`finish`,async()=>{let files=[];if(req.file?.path&&files.push(req.file),Array.isArray(req.files))for(let f of req.files)f?.path&&files.push(f);for(let file of files)try{await unlink(file.path)}catch{}}),next()}}function buildUploadMiddleware(config){let options={};config.maxSize&&(options.maxSize=config.maxSize),config.allowedTypes&&(options.allowedTypes=config.allowedTypes),config.customMimeMap&&(options.customMimeMap=config.customMimeMap),config.rename&&(options.rename=config.rename);let fieldName=config.fieldName??`file`;switch(config.mode){case`single`:return single(fieldName,options);case`array`:return array(fieldName,config.maxCount??10,options);case`none`:return none(options)}}const upload={single,array,none};export{applyUploadConfig,buildFileTypeFilter,buildUploadMiddleware,cleanupFiles,resolveMimeTypes,upload};
|
|
12
12
|
//# sourceMappingURL=upload.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.14.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{Logger}from"../../core/logger.mjs";import"../../core-
|
|
11
|
+
import{Logger}from"../../core/logger.mjs";import"../../core-g3y9VDwr.mjs";import{t as defineAdapter}from"../../define-adapter-CZCFyDp5.mjs";import{dirname,resolve}from"node:path";const log=Logger.for(`ViewEngine`),ViewAdapter=defineAdapter({name:`ViewAdapter`,build:options=>({beforeMount({app:engineApp}){let app=engineApp,{engine,ext,viewsDir=`src/views`}=options;engine.__express?app.engine(ext,engine.__express):typeof engine.renderFile==`function`?app.engine(ext,(path,opts,callback)=>{engine.renderFile(path,opts,callback)}):(typeof engine==`function`||log.warn(`Engine for .${ext} does not have __express or renderFile. Trying as-is.`),app.engine(ext,engine)),app.set(`view engine`,ext),app.set(`views`,viewDirs(viewsDir)),log.debug(`View engine: ${ext} (${viewDirs(viewsDir).join(`, `)})`)}})});function viewDirs(viewsDir){let root=resolve(process.env.KICK_APP_ROOT??process.cwd(),viewsDir),entry=process.argv[1]?resolve(dirname(resolve(process.argv[1])),viewsDir):root;return[.../* @__PURE__ */ new Set([root,entry])]}export{ViewAdapter,viewDirs};
|
|
12
12
|
//# sourceMappingURL=views.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.14.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
export{u as FILTER_OPERATORS,t as buildQueryParams,n as getQueryParsingDefaults,r as parseFilters,i as parsePagination,a as parseQuery,o as parseSearchQuery,s as parseSort,c as resetQueryParsingDefaults,l as setQueryParsingDefaults}from"../../query-
|
|
11
|
+
export{u as FILTER_OPERATORS,t as buildQueryParams,n as getQueryParsingDefaults,r as parseFilters,i as parsePagination,a as parseQuery,o as parseSearchQuery,s as parseSort,c as resetQueryParsingDefaults,l as setQueryParsingDefaults}from"../../query-DXIo1mII.mjs";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { i as buildRouteTable, n as _setExternalContributorSources, r as assertRouteUnique, t as BuildRoutesOptions } from "../router-builder-
|
|
2
|
+
import { i as buildRouteTable, n as _setExternalContributorSources, r as assertRouteUnique, t as BuildRoutesOptions } from "../router-builder-C5EtcFSL.mjs";
|
|
3
3
|
export { BuildRoutesOptions, _setExternalContributorSources, assertRouteUnique, buildRouteTable };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.14.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
export{t as _setExternalContributorSources,n as assertRouteUnique,r as buildRouteTable}from"../router-builder-
|
|
11
|
+
export{t as _setExternalContributorSources,n as assertRouteUnique,r as buildRouteTable}from"../router-builder-CiwYhiUM.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { d as HttpRuntime, h as RouteEntry } from "../../adapter-
|
|
2
|
+
import { d as HttpRuntime, h as RouteEntry } from "../../adapter-DL9JPcvC.mjs";
|
|
3
3
|
import { n as ConnectHandler } from "../../connect-BlIamapT.mjs";
|
|
4
|
-
import { t as BuildRoutesOptions } from "../../router-builder-
|
|
4
|
+
import { t as BuildRoutesOptions } from "../../router-builder-C5EtcFSL.mjs";
|
|
5
5
|
import { Express, Request, Response } from "express";
|
|
6
6
|
//#region src/http/runtimes/express.d.ts
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.14.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
export{t as buildRoutes,n as expressRuntime,i as materializeRouter}from"../../express-
|
|
11
|
+
export{t as buildRoutes,n as expressRuntime,i as materializeRouter}from"../../express-31o4SoCz.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.14.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{createLogger}from"../../core/logger.mjs";import{HttpException}from"../../core/errors.mjs";import{a as hasPrototypeKey,c as prototypeKeyError,f as tooLarge,i as formFields,p as unsupportedMediaTypeError,s as parseForm}from"../../body-policy-
|
|
11
|
+
import{createLogger}from"../../core/logger.mjs";import{HttpException}from"../../core/errors.mjs";import{a as hasPrototypeKey,c as prototypeKeyError,f as tooLarge,i as formFields,p as unsupportedMediaTypeError,s as parseForm}from"../../body-policy-CwgUYBw7.mjs";import{f as requestStore}from"../../view-renderer-Dbha_94K.mjs";import{n as disposeRequestStore,t as createRequestStore}from"../../request-scope-DZQceiLY.mjs";import{n as applyHandlerResult}from"../../reply-CpMbB8uH.mjs";import{t as RequestContext}from"../../context-Cgr5dtIZ.mjs";import{n as publishMatchedRoute,r as stringifyJson}from"../../runtime-Bus9RVyU.mjs";import{validate}from"../middleware/validate.mjs";import{c as tooManyFiles,l as uploadLimits,n as UPLOAD_FIELDS_ALLOWANCE,r as applyUploadConfig,t as MAX_UPLOAD_FIELDS}from"../../upload-config-Bq3qcDel.mjs";import"../middleware/upload.mjs";import{t as lazyServeStatic}from"../../lazy-serve-static-CZBn-40v.mjs";import Fastify from"fastify";const pluginOf=mod=>mod.default??mod,createFastify=Fastify,log=createLogger(`FastifyRuntime`),QUEUE=Symbol(`kickjs.fastify.connectQueue`),READY=Symbol(`kickjs.fastify.ready`),NEXT=Symbol(`kickjs.fastify.next`),STORE=Symbol(`kickjs.fastify.store`),NEEDS_MULTIPART=Symbol(`kickjs.fastify.needsMultipart`),NOOP_NEXT=()=>{};function settleOrFail(reply,returned){typeof returned?.then==`function`&&Promise.resolve(returned).then(void 0,()=>{!reply.sent&&!reply.raw.headersSent&&reply.code(500).send({message:`Internal Server Error`})})}function inRouteStore(raw,res,fn){let own=raw[STORE];if(own)return void requestStore.run(own,fn);if(requestStore.getStore())return fn();let header=raw.headers[`x-request-id`],store=createRequestStore(raw.requestId||(Array.isArray(header)?header[0]:header));res.once(`close`,()=>disposeRequestStore(store)),requestStore.run(store,fn)}const NO_FALLTHROUGH=Symbol(`kickjs.fastify.noFallthrough`);function multipartError(err,limits,file){switch(err?.code){case`FST_REQ_FILE_TOO_LARGE`:return new HttpException(413,`File ${file} exceeds the ${limits.fileSize}-byte limit`);case`FST_FILES_LIMIT`:return tooManyFiles(limits.files);case`FST_FIELDS_LIMIT`:case`FST_PARTS_LIMIT`:return new HttpException(413,`Too many form fields`);case`FST_PROTO_VIOLATION`:return prototypeKeyError();default:return err}}var FastifyReplyDriver=class{reply;constructor(reply){this.reply=reply}status(code){return this.reply.code(code),this}json(data){return this.reply.getHeader(`content-type`)||this.reply.type(`application/json; charset=utf-8`),this.reply.serializer(stringifyJson).send(data),this}send(data){return this.reply.send(data),this}type(contentType){return this.reply.type(contentType),this}getHeader(name){return this.reply.getHeader(name)}setHeader(name,value){return this.reply.removeHeader(name),this.reply.header(name,value),this}render(){throw Error(`ctx.render() is not supported on the Fastify runtime (no view engine).`)}writeHead(statusCode,headers){return this.reply.hijack(),this.reply.raw.writeHead(statusCode,headers),this}flushHeaders(){return this.reply.raw.flushHeaders?.(),this}write(chunk){return this.reply.raw.write(chunk)}end(data){return this.reply.raw.headersSent?this.reply.raw.end(data):this.reply.send(data??``),this}once(event,listener){return this.reply.raw.once(event,listener),this}get headersSent(){return this.reply.sent||this.reply.raw.headersSent}};function replyDriver(reply){return new FastifyReplyDriver(reply)}function routeHandler(entry){let validator=entry.meta.validation?validate(entry.meta.validation,{validationError:entry.validationError}):void 0;return async(request,reply)=>{let raw=request.raw;if(raw.body=request.body,raw.params=request.params,raw.query=request.query,entry.meta.upload&&entry.meta.upload.mode!==`none`){if(typeof request.parts!=`function`)throw Error(`@forinda/kickjs: @FileUpload on the Fastify runtime requires '@fastify/multipart'.
|
|
12
12
|
Install it as a peer dependency: pnpm add @fastify/multipart.`);let limits=uploadLimits(entry.meta.upload),rawParts=[],fields=[],current=`file`,received=0,count=bytes=>{if(received+=bytes,received>limits.total)throw tooLarge(limits.total)};try{for await(let part of request.parts({limits:{fileSize:limits.fileSize,files:limits.files,fields:MAX_UPLOAD_FIELDS,fieldSize:UPLOAD_FIELDS_ALLOWANCE}}))if(part.type===`file`&&part.toBuffer){current=part.filename??part.fieldname;let buffer=await part.toBuffer();count(buffer.length),rawParts.push({fieldname:part.fieldname,filename:part.filename??``,mimetype:part.mimetype??`application/octet-stream`,buffer})}else{let value=String(part.value);count(Buffer.byteLength(part.fieldname)+Buffer.byteLength(value)),fields.push([part.fieldname,value])}}catch(err){throw multipartError(err,limits,current)}let{file,files}=applyUploadConfig(rawParts,entry.meta.upload);raw.file=file,raw.files=files,raw.body={...raw.body,...formFields(fields)}}if(hasPrototypeKey(raw.body))throw prototypeKeyError();let headerId=raw.headers[`x-request-id`],requestId=raw.requestId||(Array.isArray(headerId)?headerId[0]:headerId),store=createRequestStore(requestId);raw.requestId=store.requestId,raw[STORE]=store,reply.getHeader(`x-request-id`)||reply.header(`x-request-id`,store.requestId),reply.raw.once(`close`,()=>disposeRequestStore(store)),await requestStore.run(store,async()=>{publishMatchedRoute(raw,entry);let ctx=new RequestContext(raw,reply,NOOP_NEXT,replyDriver(reply));if(entry.earlyContributorRunner&&(await entry.earlyContributorRunner(ctx),reply.sent))return;validator&&await new Promise((resolve,reject)=>{validator(raw,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||reply.sent)return}if(entry.contributorRunner&&await entry.contributorRunner(ctx),reply.sent)return;let result=await entry.handler(ctx);!reply.sent&&!await applyHandlerResult(ctx,result)&&reply.callNotFound()})}}function hopTrust(hops){return(_ip,hopIndex)=>hopIndex<hops}function fastifyRuntime(){return{name:`fastify`,createApp(options={}){let app=createFastify({logger:!1,routerOptions:{ignoreTrailingSlash:!0},...options.bodyLimit===void 0?{}:{bodyLimit:options.bodyLimit},trustProxy:typeof options.trustProxy==`number`?hopTrust(options.trustProxy):options.trustProxy});app[QUEUE]=[];let addParser=app.addContentTypeParser?.bind(app);return addParser&&(addParser(/^application\/[\w.+-]+\+json$/,{parseAs:`string`},(_req,body,done)=>{if(body===``)return done(null,void 0);try{done(null,JSON.parse(body))}catch(err){done(HttpException.badRequest(err instanceof Error?err.message:`Request body could not be parsed`),void 0)}}),addParser(`application/x-www-form-urlencoded`,{parseAs:`string`},(_req,body,done)=>{done(null,parseForm(body))}),addParser(/^text\//,{parseAs:`string`},(_req,body,done)=>{done(null,body)}),addParser(`*`,{parseAs:`string`},(req,body,done)=>{if(!body)return done(null,void 0);done(unsupportedMediaTypeError(req.headers?.[`content-type`]),void 0)})),options.notFoundFallthrough===!1&&(app[NO_FALLTHROUGH]=!0),app},nodeHandler(app){let state=app;state[READY]||(state[READY]=(async()=>{if(state[NEEDS_MULTIPART]){let multipart=pluginOf(await import(`@fastify/multipart`));await app.register(multipart,{limits:{fileSize:2**53-1}})}let middie=pluginOf(await import(`@fastify/middie`));await app.register(middie);for(let{mw,opts}of state[QUEUE]??[])opts?.path===void 0?app.use(mw):app.use(opts.path,mw);await app.ready()})());let readyP=state[READY],ready=!1;return readyP.then(()=>ready=!0,()=>{}),(req,res,next)=>{next&&(req[NEXT]=next),ready?app.routing(req,res):readyP.then(()=>app.routing(req,res)).catch(err=>{if(next)return next(err);log.error(err,`Fastify failed to start`),res.statusCode=500,res.end(`Internal Server Error`)})}},mountRoutes(app,table){for(let{mountPath,routes}of table)for(let entry of routes){entry.meta.upload&&(app[NEEDS_MULTIPART]=!0);let url=joinPath(mountPath,entry.path);app.route({method:entry.method,url,handler:routeHandler(entry)})}},useConnect(app,mw,opts){app[QUEUE]?.push({mw,opts})},serveStatic(app,prefix,dir){this.useConnect(app,lazyServeStatic(dir),{path:prefix})},setNotFound(app,mw){app.setNotFoundHandler((request,reply)=>{let next=request.raw[NEXT];next&&!app[NO_FALLTHROUGH]?(reply.hijack(),next()):inRouteStore(request.raw,reply.raw,()=>settleOrFail(reply,mw(request.raw,replyDriver(reply),NOOP_NEXT)))})},setErrorHandler(app,mw){app.setErrorHandler((err,request,reply)=>{inRouteStore(request.raw,reply.raw,()=>settleOrFail(reply,mw(err,request.raw,replyDriver(reply),NOOP_NEXT)))})},close(app){return app.close()},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{fastifyRuntime};
|
|
13
13
|
//# sourceMappingURL=fastify.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.14.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{createLogger}from"../../core/logger.mjs";import{f as requestStore}from"../../view-renderer-
|
|
11
|
+
import{createLogger}from"../../core/logger.mjs";import{f as requestStore}from"../../view-renderer-Dbha_94K.mjs";import{errorHandler,notFoundHandler}from"../middleware/error-handler.mjs";import{n as disposeRequestStore,t as createRequestStore}from"../../request-scope-DZQceiLY.mjs";import{n as WebResponseDriver,t as WebRequestShim}from"../../driver-D_bUSW7N.mjs";import{n as headFromGet,r as readThrough,t as compileWebRoute}from"../../handler-Bvs0gx1o.mjs";import{t as lazyServeStatic}from"../../lazy-serve-static-CZBn-40v.mjs";import*as h3Peer from"h3";const builtInError=errorHandler(),builtInNotFound=notFoundHandler(),log=createLogger(`H3Runtime`),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`),BODY_LIMIT=Symbol(`kickjs.h3.bodyLimit`),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??h3Peer);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 h3 to ^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),store=createRequestStore(req.requestId||(event.req.headers.get(`x-request-id`)??``)),work=requestStore.run(store,()=>answerTerminal(mw,req,driver,err)),dispose=()=>disposeRequestStore(store);return work.then(()=>driver.ready).then(dispose,dispose),await work,driver.ready}async function answerTerminal(mw,req,driver,err){let failure=err;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){log.error(handlerErr,`h3: the ${err===void 0?`not-found`:`error`} handler failed`),failure??=handlerErr}}driver.settled||(failure===void 0?builtInNotFound(req,driver,NOOP_NEXT):await builtInError(failure,req,driver,NOOP_NEXT))}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(){let pending=[];for(let event of[`finish`,`close`]){for(let[e,listener]of this.listeners){if(e!==event)continue;let out;try{out=listener()}catch(err){log.error(err,`h3: a '${event}' listener failed`);continue}out&&typeof out.then==`function`&&pending.push(Promise.resolve(out).catch(()=>{}))}this.listeners=this.listeners.filter(([e])=>e!==event)}return Promise.all(pending).then(()=>{})}};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().then(()=>resolve(withConnectHeaders(event,response)))},fail=err=>{res.done().then(()=>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().then(()=>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[BODY_LIMIT]=options.bodyLimit,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){log.error(handlerErr,`h3: the error handler failed`),driver.settled||await builtInError(err,req,driver,NOOP_NEXT)}}},{bodyLimit:app[BODY_LIMIT]}),handler=event=>run({request:event.req,url:event.url,params:event.context.params??{},carry:event.req.runtime?.node?.req??FETCH_CONNECT.get(event)?.req});app.on(entry.method,url,handler),entry.method===`GET`&&app.on(`HEAD`,url,event=>headFromGet(handler(event)))}},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){this.useConnect(app,lazyServeStatic(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,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import "./settings-
|
|
2
|
+
import "./settings-DgZLgcNU.mjs";
|
|
3
3
|
import { p as EnvKey } from "./decorators-DxNb5mWw.mjs";
|
|
4
4
|
import { InferSchemaOutput } from "@forinda/kickjs-schema";
|
|
5
5
|
import { z } from "zod";
|
|
@@ -311,4 +311,4 @@ declare function createConfigService<T extends z.ZodObject<any>>(schema: T): {
|
|
|
311
311
|
};
|
|
312
312
|
//#endregion
|
|
313
313
|
export { baseEnvSchema as a, loadEnv as c, resetEnvCache as d, withEnv as f, Env as i, loadEnvFromSchema as l, TypedConfigService as n, defineEnv as o, createConfigService as r, getEnv as s, ConfigService as t, reloadEnv as u };
|
|
314
|
-
//# sourceMappingURL=index-
|
|
314
|
+
//# sourceMappingURL=index-DP_I4puv.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-DP_I4puv.d.mts","names":[],"sources":["../src/config/env.ts","../src/config/config-service.ts"],"mappings":";;;;;;;;;;;iBAuOS,sBAAkB,EAAA;;;;;;;;GAQ1B,EAAA,KAAA;;KAGW,gBAAgB,kBAAkB;;;;;;;;;;;cAsBjC,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6DZ,UAAU,UAAU,EAAE,aACpC,SAAS,aAAa,kBAAkB,EAAE,UAAU,KACnD,EAAE,iBAAiB,cAAc,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;iBAgC5B,QAAQ,UAAU,EAAE,gBAAgB,QAAQ,IAAI,EAAE,MAAM;iBACxD,YAAY,0BAA0B,MAAM;;;;;;;;;;;;;;;;;;;;iBAoC5C,OAAO,UAAU,QAAQ,KAAK,IAAI,QAAQ;iBAC1C,OAAO,UAAU,QAC/B,KAAK,GACL,UAAU,YAAY,QAAQ,MAC7B,YAAY,QAAQ;;;;;;;;iBAqCD,QAAQ,GAC5B,WAAW,yBACX,UAAU,IAAI,QAAQ,KACrB,QAAQ;;;;;;;;;;;;;;;;iBA2BK;;;;;;;iBA8BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+CA,kBAAkB,SAChC,QAAQ,0BACS,UAAU,0BAA0B,kBAAkB;;;;;;;;KAqE7D;EACV;EACA;EACA;;;;;;;;;;;KC9lBG,UAAU,qBAAqB,0BAA0B,IAAI,IAAI;;;;;;;KAQjE,YAAY,kBAAkB,KAAK,UAAU,SAAS,QAAQ,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;cA2B3D;;;;;;;;;;;;;;cAcC;;;;;;;;;;EAaZ,IAAI,kBAAkB,SAAS,KAAK,UAAU,KAAK,YAAY,GAAG;;EAElE,IAAI,kBAAkB,SACpB,KAAK,UAAU,IACf,UAAU,YAAY,YAAY,GAAG,MACpC,YAAY,YAAY,GAAG;;;;;;EAU9B,WAAW,0BAA0B,SAAS,uBAAuB,SAAS;;EAK9E;EAMA;EAIA;EAIA;;;;;;UASe,mBAAmB,aAAa;EAC/C,IAAI,yBAAyB,MAAM,KAAK,IAAI,KAAK;EACjD,IAAI,yBAAyB,MAAM,KAAK,GAAG,UAAU,YAAY,KAAK,MAAM,YAAY,KAAK;EAC7F,UAAU,SAAS;EACnB;EACA;EACA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+Bc,oBAAoB,UAAU,EAAE,gBAAgB,QAAQ;UAuC5D,mBAAkB,EAAA,MAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
|
|
2
2
|
import { a as isInjectionToken, i as ctn, n as InjectionToken, r as createToken, t as INJECTION_TOKEN } from "./token-0ZP--xsp.mjs";
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as SettingsDeclaration, c as VarOrigin, d as originsOf, i as Settings, l as defineSettings, n as OptionalSettings, o as SettingsOf, r as ProvidedSettings, s as ValueOrigin, t as ConfigVar, u as loadSettings } from "./settings-DgZLgcNU.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-DxNb5mWw.mjs";
|
|
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-
|
|
6
|
-
import { $ as DefineAdapterOptions, At as DefinePluginOptions, B as PositionalParams, Bt as IntrospectionKind, C as UseConnectOptions, Ct as registerDisposable, D as RouteShape, Dt as ModuleFactory, E as RequestContext, Et as DefineModuleOptions, Ft as ModuleRegistry, G as UrlQuery, Gt as reportError, H as RouteName, Ht as ErrorInfo, I as resolveMimeTypes, It as MutableModuleRegistry, J as ViewRenderer, Jt as AdapterCondition, K as VIEW_RENDERER, Kt as reportResponse, L as ConditionalOutcome, Lt as KickJsPluginName, M as UploadedFile, Mt as PluginFactory, Nt as definePlugin, O as SseHandler, Ot as defineModule, Pt as KickPlugin, Q as AdapterFactory, Qt as onPackage, R as Validators, Rt as KickJsPluginRegistry, S as RuntimeTypeMap, St as disposeAll, T as DeepReadonly, Tt as defineModules, U as UrlBuilder, Ut as ErrorSource, V as ROUTE_URLS, Vt as IntrospectionSnapshot, W as UrlForArgs, Wt as ResponseInfo, X as viewRendererFor, Xt as allOf, Y as bindViewRenderer, Yt as ConditionOutcome, Z as AdapterAsyncOptions, Zt as onEnv, _ as RouteMethod, _t as setClassMeta, a as KickServer, at as ContributorSource, b as RuntimeCapabilities, bt as setMethodMeta, c as ActiveRuntime, ct as getClassMeta, d as HttpRuntime, dt as getMetaRecord, et as defineAdapter, f as KickRuntimeRegister, ft as getMethodMeta, g as RouteMeta, gt as pushMethodMeta, h as RouteEntry, ht as pushClassMeta, i as AppAdapterClass, it as ContributorPipeline, j as UploadStorageEngine, jt as PluginAsyncOptions, kt as BuildContext, l as AdapterHttp, lt as getClassMetaOrUndefined, m as RouteContributor, mt as hasClassMeta, n as AdapterMiddleware, nt as runContributors, o as MiddlewarePath, ot as SourcedRegistration, p as MatchedRoute, pt as getMethodMetaOrUndefined, q as ViewRenderOptions, qt as FailureAdvice, r as AppAdapter, rt as BuildPipelineOptions, s as MiddlewarePhase, st as buildPipeline, t as AdapterContext, tt as RunContributorsOptions, u as CtxHandler, ut as getMetaMap, v as RouteTable, vt as setInMetaMap, w as Ctx, wt as ModuleList, x as RuntimeResponse, xt as Disposable, y as RuntimeAppOptions, yt as setInMetaRecord, z as evaluatePreconditions, zt as IntrospectFn } from "./adapter-
|
|
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-DP_I4puv.mjs";
|
|
6
|
+
import { $ as DefineAdapterOptions, At as DefinePluginOptions, B as PositionalParams, Bt as IntrospectionKind, C as UseConnectOptions, Ct as registerDisposable, D as RouteShape, Dt as ModuleFactory, E as RequestContext, Et as DefineModuleOptions, Ft as ModuleRegistry, G as UrlQuery, Gt as reportError, H as RouteName, Ht as ErrorInfo, I as resolveMimeTypes, It as MutableModuleRegistry, J as ViewRenderer, Jt as AdapterCondition, K as VIEW_RENDERER, Kt as reportResponse, L as ConditionalOutcome, Lt as KickJsPluginName, M as UploadedFile, Mt as PluginFactory, Nt as definePlugin, O as SseHandler, Ot as defineModule, Pt as KickPlugin, Q as AdapterFactory, Qt as onPackage, R as Validators, Rt as KickJsPluginRegistry, S as RuntimeTypeMap, St as disposeAll, T as DeepReadonly, Tt as defineModules, U as UrlBuilder, Ut as ErrorSource, V as ROUTE_URLS, Vt as IntrospectionSnapshot, W as UrlForArgs, Wt as ResponseInfo, X as viewRendererFor, Xt as allOf, Y as bindViewRenderer, Yt as ConditionOutcome, Z as AdapterAsyncOptions, Zt as onEnv, _ as RouteMethod, _t as setClassMeta, a as KickServer, at as ContributorSource, b as RuntimeCapabilities, bt as setMethodMeta, c as ActiveRuntime, ct as getClassMeta, d as HttpRuntime, dt as getMetaRecord, et as defineAdapter, f as KickRuntimeRegister, ft as getMethodMeta, g as RouteMeta, gt as pushMethodMeta, h as RouteEntry, ht as pushClassMeta, i as AppAdapterClass, it as ContributorPipeline, j as UploadStorageEngine, jt as PluginAsyncOptions, kt as BuildContext, l as AdapterHttp, lt as getClassMetaOrUndefined, m as RouteContributor, mt as hasClassMeta, n as AdapterMiddleware, nt as runContributors, o as MiddlewarePath, ot as SourcedRegistration, p as MatchedRoute, pt as getMethodMetaOrUndefined, q as ViewRenderOptions, qt as FailureAdvice, r as AppAdapter, rt as BuildPipelineOptions, s as MiddlewarePhase, st as buildPipeline, t as AdapterContext, tt as RunContributorsOptions, u as CtxHandler, ut as getMetaMap, v as RouteTable, vt as setInMetaMap, w as Ctx, wt as ModuleList, x as RuntimeResponse, xt as Disposable, y as RuntimeAppOptions, yt as setInMetaRecord, z as evaluatePreconditions, zt as IntrospectFn } from "./adapter-DL9JPcvC.mjs";
|
|
7
7
|
import { a as ConnectRequest, i as ConnectNext, n as ConnectHandler, o as ConnectResponse, r as ConnectMiddleware, t as ConnectErrorHandler } from "./connect-BlIamapT.mjs";
|
|
8
8
|
import { a as tokenName, i as KickJsRegistry, n as ContainerChangeEvent, r as ContainerChangeListener, t as Container } from "./container-4iJdDkRH.mjs";
|
|
9
9
|
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";
|
|
10
10
|
import { c as PostConstructStatus, i as Constructor, l as Scope, n as BuilderOf, o as METADATA, r as ClassKind, s as MaybePromise, t as Buildable, u as ServiceOptions } from "./interfaces-C6LHcYsg.mjs";
|
|
11
|
-
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-
|
|
11
|
+
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-Dk2Wenqx.mjs";
|
|
12
12
|
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";
|
|
13
|
-
import { A as NoJobHandlerError, C as JOB_DISPATCHER, D as JobDispatcher, E as JobContextCarrier, F as registerJobContext, I as runJob, L as stampJobContext, M as ProcessDefinition, N as listJobHandlers, O as JobHandler, P as listJobQueues, S as JOB_CONTEXT_FIELD, T as Job, _ as Respondable, a as KvSessionStoreOptions, b as isRespondable, c as matchesBearer, d as waitUntil, f as InferHandlerResponse, g as ReplyOptions, h as ReplyHeaders, i as KvSessionStore, j as Process, k as JobLike, l as PlatformContext, m as Reply, n as KvRateLimitStore, o as RateLimitGuardOptions, p as RESPOND, r as KvRateLimitStoreOptions, s as rateLimitGuard, t as KvLike, u as settleBackgroundWork, v as applyHandlerResult, w as JOB_META, x as reply, y as isReply } from "./kv-stores-
|
|
13
|
+
import { A as NoJobHandlerError, C as JOB_DISPATCHER, D as JobDispatcher, E as JobContextCarrier, F as registerJobContext, I as runJob, L as stampJobContext, M as ProcessDefinition, N as listJobHandlers, O as JobHandler, P as listJobQueues, S as JOB_CONTEXT_FIELD, T as Job, _ as Respondable, a as KvSessionStoreOptions, b as isRespondable, c as matchesBearer, d as waitUntil, f as InferHandlerResponse, g as ReplyOptions, h as ReplyHeaders, i as KvSessionStore, j as Process, k as JobLike, l as PlatformContext, m as Reply, n as KvRateLimitStore, o as RateLimitGuardOptions, p as RESPOND, r as KvRateLimitStoreOptions, s as rateLimitGuard, t as KvLike, u as settleBackgroundWork, v as applyHandlerResult, w as JOB_META, x as reply, y as isReply } from "./kv-stores-CwJdsMln.mjs";
|
|
14
14
|
import { a as Cacheable, c as setCacheProvider, i as CacheProvider, n as CacheEvict, o as MemoryCacheProvider, r as CacheOptions, s as getCacheProvider } from "./cache-CdRHSXow.mjs";
|
|
15
15
|
import { a as describeError, i as createLogger, n as Logger, r as LoggerProvider, t as ConsoleLoggerProvider } from "./logger-xE9qI_FS.mjs";
|
|
16
16
|
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";
|
|
17
|
-
import { $ as createSigner, $t as CircuitBreaker, A as requestScopeMiddleware, At as StartupCheckError, B as formErrorHandler, Bt as GroupAssetKeysResult, C as ViewAdapterOptions, Ct as RequestHistogram, D as TraceContextOptions, Dt as CheckContext, E as TraceContext, Et as CacheResponseOptions, F as buildRoutes, Ft as bindRoutePolicy, G as SECRET_FIELD, Gt as MountCycleError, H as FORM_ERRORS_KEY, Ht as stripExt, I as expressRuntime, It as offerRoutePolicy, J as oldInput, Jt as mountSort, K as fieldErrors, Kt as MountKind, L as materializeRouter, Lt as AssetKeyPair, M as getRequestStore, Mt as StartupStep, N as getRequestValue, Nt as StartupTimelineSnapshot, O as parseTraceparent, Ot as CheckMessage, P as requestStore, Pt as RoutePolicyTable, Q as VerifyOptions, Qt as MissingContributorError, R as FormErrorHandler, Rt as AssetKeyStrategy, S as ViewAdapter, St as MetricsOptions, T as TRACEPARENT_HEADER, Tt as CacheResponse, U as OLD_INPUT_KEY, Ut as DuplicateMountNameError, V as FLASH_KEY, Vt as groupAssetKeys, W as PREVIOUS_URL_KEY, Wt as MissingMountDepError, X as Signer, Xt as DuplicateContributorError, Y as SignedCheck, Yt as ContributorCycleError, Z as SignerOptions, Zt as MissingContextValueError, _ as HealthProbe, _t as CronAdapterOptions, a as ConfigDescription, an as KickError, at as verifyPassword, b as SpaAdapterOptions, bt as KickCronAdapter, c as MiddlewareEntry, ct as isClusterPrimary, dt as bootstrap, en as CircuitBreakerOptions, et as LegacyHasher, ft as ERROR_CHANNEL, g as HealthModuleConfig, gt as CRON_WORKER_ENV, h as HealthController, ht as RESPONSE_CHANNEL, i as ApplicationOptions, in as FormatKickErrorOptions, it as hashPassword, j as RequestStore, jt as defineCheck, k as traceContext, kt as StartupCheck, l as MountedRouteInfo, lt as KickHandler, m as HealthCheckResult, mt as HandlerTraceContext, n as AppStatus, nn as CircuitBreakerStats, nt as PasswordHashOptions, o as ConfigOrigins, on as KickErrorInit, ot as defineHttpContextDecorator, p as HEALTH_PROBE, pt as HANDLER_CHANNEL, q as flash, qt as MountSortItem, r as Application, rn as CircuitOpenError, rt as VerifyPasswordOptions, s as ManagementOptions, sn as formatKickError, st as ClusterOptions, t as APPLICATION, tn as CircuitBreakerState, tt as PasswordCheck, u as ServerOptions, ut as createHandler, v as healthModule, vt as CronSchedule, wt as metricsAdapter, xt as RAW_BODY, y as SpaAdapter, yt as CronScheduler, z as FormErrorHandlerOptions, zt as GroupAssetKeysOptions } from "./application-
|
|
17
|
+
import { $ as createSigner, $t as CircuitBreaker, A as requestScopeMiddleware, At as StartupCheckError, B as formErrorHandler, Bt as GroupAssetKeysResult, C as ViewAdapterOptions, Ct as RequestHistogram, D as TraceContextOptions, Dt as CheckContext, E as TraceContext, Et as CacheResponseOptions, F as buildRoutes, Ft as bindRoutePolicy, G as SECRET_FIELD, Gt as MountCycleError, H as FORM_ERRORS_KEY, Ht as stripExt, I as expressRuntime, It as offerRoutePolicy, J as oldInput, Jt as mountSort, K as fieldErrors, Kt as MountKind, L as materializeRouter, Lt as AssetKeyPair, M as getRequestStore, Mt as StartupStep, N as getRequestValue, Nt as StartupTimelineSnapshot, O as parseTraceparent, Ot as CheckMessage, P as requestStore, Pt as RoutePolicyTable, Q as VerifyOptions, Qt as MissingContributorError, R as FormErrorHandler, Rt as AssetKeyStrategy, S as ViewAdapter, St as MetricsOptions, T as TRACEPARENT_HEADER, Tt as CacheResponse, U as OLD_INPUT_KEY, Ut as DuplicateMountNameError, V as FLASH_KEY, Vt as groupAssetKeys, W as PREVIOUS_URL_KEY, Wt as MissingMountDepError, X as Signer, Xt as DuplicateContributorError, Y as SignedCheck, Yt as ContributorCycleError, Z as SignerOptions, Zt as MissingContextValueError, _ as HealthProbe, _t as CronAdapterOptions, a as ConfigDescription, an as KickError, at as verifyPassword, b as SpaAdapterOptions, bt as KickCronAdapter, c as MiddlewareEntry, ct as isClusterPrimary, dt as bootstrap, en as CircuitBreakerOptions, et as LegacyHasher, ft as ERROR_CHANNEL, g as HealthModuleConfig, gt as CRON_WORKER_ENV, h as HealthController, ht as RESPONSE_CHANNEL, i as ApplicationOptions, in as FormatKickErrorOptions, it as hashPassword, j as RequestStore, jt as defineCheck, k as traceContext, kt as StartupCheck, l as MountedRouteInfo, lt as KickHandler, m as HealthCheckResult, mt as HandlerTraceContext, n as AppStatus, nn as CircuitBreakerStats, nt as PasswordHashOptions, o as ConfigOrigins, on as KickErrorInit, ot as defineHttpContextDecorator, p as HEALTH_PROBE, pt as HANDLER_CHANNEL, q as flash, qt as MountSortItem, r as Application, rn as CircuitOpenError, rt as VerifyPasswordOptions, s as ManagementOptions, sn as formatKickError, st as ClusterOptions, t as APPLICATION, tn as CircuitBreakerState, tt as PasswordCheck, u as ServerOptions, ut as createHandler, v as healthModule, vt as CronSchedule, wt as metricsAdapter, xt as RAW_BODY, y as SpaAdapter, yt as CronScheduler, z as FormErrorHandlerOptions, zt as GroupAssetKeysOptions } from "./application-D921r4MW.mjs";
|
|
18
18
|
import { n as joinPaths, r as normalizePath, t as buildMountPath } from "./path-CMwIHsdv.mjs";
|
|
19
19
|
import { a as batch, c as reactive, d as toRefs, f as unref, i as WatchOptions, l as ref, n as Ref, o as computed, p as watch, r as RefOptions, s as isRef, t as ComputedRef, u as toRef } from "./reactivity-DZrc3Yhu.mjs";
|
|
20
20
|
import { a as SessionStore, i as SessionOptions, n as Session, o as session, r as SessionData } from "./session-DQG72vCf.mjs";
|
|
21
21
|
import { A as TypedParsedQuery, C as PaginatedResponse, D as QueryFieldConfig, E as QueryBuilderAdapter, O as SortItem, S as FilterOperator, T as ParsedQuery, _ as CursorQuery, a as getQueryParsingDefaults, b as FieldsOf, c as parseQuery, d as resetQueryParsingDefaults, f as setQueryParsingDefaults, g as CursorPosition, h as CursorPaginatedResponse, i as buildQueryParams, l as parseSearchQuery, m as CursorPaginateOptions, n as QueryRejectReason, o as parseFilters, r as QueryRejection, s as parsePagination, t as ParseQueryOptions, u as parseSort, v as CursorValue, w as PaginationParams, x as FilterItem, y as FILTER_OPERATORS } from "./index-Blgka75E.mjs";
|
|
22
22
|
import { a as validate, i as defaultValidationError, n as ValidationFailure, t as ValidationErrorFactory } from "./validate-D4Poe2EE.mjs";
|
|
23
23
|
import { n as allowedHosts, t as AllowedHostsOptions } from "./allowed-hosts-BpKwviq5.mjs";
|
|
24
|
-
import { i as buildRouteTable, t as BuildRoutesOptions } from "./router-builder-
|
|
24
|
+
import { i as buildRouteTable, t as BuildRoutesOptions } from "./router-builder-C5EtcFSL.mjs";
|
|
25
25
|
import { n as requestId, t as REQUEST_ID_HEADER } from "./request-id-Dn64nEHK.mjs";
|
|
26
|
-
import { n as errorHandler, r as notFoundHandler } from "./error-handler-
|
|
26
|
+
import { n as errorHandler, r as notFoundHandler } from "./error-handler-D7DLWe1Q.mjs";
|
|
27
27
|
import { a as csrfToken, i as csrfGuard, n as CsrfOptions, r as csrf, t as CsrfGuardOptions } from "./csrf-DOAaYozG.mjs";
|
|
28
28
|
import { i as requestLogger, n as LoggedResponse, r as RequestLoggerOptions, t as LoggedRequest } from "./request-logger-TgcKRNDD.mjs";
|
|
29
29
|
import { n as HelmetOptions, r as helmet } from "./helmet-BVuVBl-D.mjs";
|
|
30
30
|
import { n as breachPadding, t as BreachPaddingOptions } from "./breach-padding-FBVGmcBb.mjs";
|
|
31
31
|
import { n as cors, t as CorsOptions } from "./cors-BlR_b0Qb.mjs";
|
|
32
32
|
import { i as rateLimit, n as RateLimitOptions, r as RateLimitStore } from "./rate-limit-DQDk6bAH.mjs";
|
|
33
|
-
import { i as upload, n as buildUploadMiddleware, r as cleanupFiles, t as UploadOptions } from "./upload-
|
|
34
|
-
export { APPLICATION, ASSETS, ASSET_MANIFEST_VERSION, type ActiveRuntime, type AdapterAsyncOptions, type AdapterCondition, type AdapterContext, type AdapterFactory, type AdapterHttp, type AdapterMiddleware, type AllowedHostsOptions, type AnyContributorRegistration, ApiQueryParams, type ApiQueryParamsConfig, type ApiQueryParamsConfig as QueryParamsConfig, type AppAdapter, type AppAdapterClass, type AppModule, type AppModuleClass, type AppModuleEntry, type AppStatus, Application, type ApplicationOptions, Asset, type AssetKey, type AssetKeyPair, type AssetKeyStrategy, Autowired, type BareRouteFlag, type BaseUploadOptions, type BreachPaddingOptions, type BuildContext, type BuildPipelineOptions, type BuildRoutesOptions, type Buildable, Builder, type BuilderOf, CRON_META, CRON_WORKER_ENV, CacheEvict, type CacheOptions, type CacheProvider, CacheResponse, type CacheResponseOptions, Cacheable, type CallSiteParams, type CheckContext, type CheckMessage, CircuitBreaker, type CircuitBreakerOptions, type CircuitBreakerState, type CircuitBreakerStats, CircuitOpenError, type ClassKind, type ClusterOptions, type ColumnApiQueryParamsConfig, Component, type ComputedRef, type ConditionOutcome, type ConditionalOutcome, type ConfigDescription, type ConfigOrigins, ConfigService, type ConfigVar, type ConnectErrorHandler, type ConnectHandler, type ConnectMiddleware, type ConnectNext, type ConnectRequest, type ConnectResponse, 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 CronSchedule, type CronScheduler, type CsrfGuardOptions, type CsrfOptions, type Ctx, type CtxHandler, type CursorPaginateOptions, type CursorPaginatedResponse, type CursorPosition, type CursorQuery, type CursorValue, 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, FILTER_OPERATORS, FLASH_KEY, FORM_ERRORS_KEY, type FailureAdvice, type FieldsOf, type FileTypeFilter, FileUpload, type FileUploadConfig, type FilterItem, type FilterOperator, type FormErrorHandler, type FormErrorHandlerOptions, 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 LegacyHasher, type LoggedRequest, type LoggedResponse, Logger, type LoggerProvider, METADATA, type ManagementOptions, type MatchedRoute, type MaybePromise, MemoryCacheProvider, type MetaValue, type MetricsOptions, 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, type MountedRouteInfo, MutableModuleRegistry, type NegatedRouteFlagName, NoJobHandlerError, OLD_INPUT_KEY, PREVIOUS_URL_KEY, type PaginatedResponse, type PaginationParams, type ParseQueryOptions, type ParsedQuery, type PasswordCheck, type PasswordHashOptions, Patch, type PlatformContext, type PluginAsyncOptions, type PluginFactory, type PositionalParams, Post, PostConstruct, type PostConstructStatus, PreDestroy, type ProblemDetails, ProblemException, Problems, Process, type ProcessDefinition, type ProvidedSettings, Put, type QueryBuilderAdapter, type QueryFieldConfig, type QueryRejectReason, type QueryRejection, RAW_BODY, REQUEST_ID_HEADER, RESPOND, RESPONSE_CHANNEL, ROUTE_URLS, type RateLimitGuardOptions, type RateLimitOptions, type RateLimitStore, type Ref, type RefOptions, type Reply, type ReplyHeaders, type ReplyOptions, Repository, RequestContext, RequestHistogram, type RequestLoggerOptions, type RequestStore, type ResolvedDeps, type Respondable, type ResponseInfo, type RouteContributor, 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, type RouteName, RoutePolicyTable, type RouteShape, type RouteTable, type RunContributorsOptions, type RuntimeAppOptions, type RuntimeCapabilities, type RuntimeResponse, type RuntimeTypeMap, SECRET_FIELD, Scope, type ServerOptions, Service, type ServiceOptions, type Session, type SessionData, type SessionOptions, type SessionStore, type Settings, type SettingsDeclaration, type SettingsOf, type SignedCheck, type Signer, type SignerOptions, type SortItem, type SourcedRegistration, SpaAdapter, type SpaAdapterOptions, type SseHandler, type StartupCheck, StartupCheckError, type StartupStep, type StartupTimelineSnapshot, TRACEPARENT_HEADER, type TraceContext, type TraceContextOptions, type TypedConfigService, type TypedParsedQuery, UnknownAssetError, type UploadOptions, type UploadStorageEngine, type UploadedFile, type UrlBuilder, type UrlForArgs, type UrlQuery, type UseConnectOptions, VIEW_RENDERER, type ValidationError, type ValidationErrorFactory, type ValidationFailure, type Validators, Value, type ValueOrigin, type ValuedRouteFlag, type VarOrigin, type VerifyOptions, type VerifyPasswordOptions, ViewAdapter, type ViewAdapterOptions, type ViewRenderOptions, type ViewRenderer, type WatchOptions, allOf, allowedHosts, applyHandlerResult, assertFlagTest, assets, baseEnvSchema, batch, bindRoutePolicy, bindViewRenderer, bootstrap, breachPadding, buildMountPath, buildPipeline, buildQueryParams, buildRouteTable, buildRoutes, buildUploadMiddleware, cleanupFiles, clearAssetCache, computed, cors, createConfigService, createHandler, createLogger, createSigner, createToken, cronScheduleId, csrf, csrfGuard, csrfToken, ctn, defaultProblemTitle, defaultValidationError, defineAdapter, defineCheck, defineContextDecorator, defineEnv, defineHttpContextDecorator, defineModule, defineModules, definePlugin, defineRouteFlag, defineSettings, describeError, disposeAll, errorHandler, evaluatePreconditions, expressRuntime, fieldErrors, flash, formErrorHandler, formatKickError, getCacheProvider, getClassMeta, getClassMetaOrUndefined, getCronJobs, getEnv, getMetaMap, getMetaRecord, getMethodMeta, getMethodMetaOrUndefined, getQueryParsingDefaults, getRequestStore, getRequestValue, getRouteFlags, groupAssetKeys, hasClassMeta, hashPassword, healthModule, helmet, isClusterPrimary, isCronJobEnabled, isInjectionToken, isRef, isReply, isRespondable, joinPaths, listCronJobs, listJobHandlers, listJobQueues, loadEnv, loadEnvFromSchema, loadSettings, matchesBearer, matchesFlagTest, materializeRouter, metricsAdapter, mountSort, normalizeApiQueryParamsConfig, normalizePath, normalizeProblem, notFoundHandler, offerRoutePolicy, oldInput, onEnv, onPackage, originsOf, 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, toRef, toRefs, tokenName, traceContext, unref, upload, useAssets, validate, verifyPassword, viewRendererFor, waitUntil, watch, withBuilder, withEnv };
|
|
33
|
+
import { i as upload, n as buildUploadMiddleware, r as cleanupFiles, t as UploadOptions } from "./upload-DnwvZQyi.mjs";
|
|
34
|
+
export { APPLICATION, ASSETS, ASSET_MANIFEST_VERSION, type ActiveRuntime, type AdapterAsyncOptions, type AdapterCondition, type AdapterContext, type AdapterFactory, type AdapterHttp, type AdapterMiddleware, type AllowedHostsOptions, type AnyContributorRegistration, ApiQueryParams, type ApiQueryParamsConfig, type ApiQueryParamsConfig as QueryParamsConfig, type AppAdapter, type AppAdapterClass, type AppModule, type AppModuleClass, type AppModuleEntry, type AppStatus, Application, type ApplicationOptions, Asset, type AssetKey, type AssetKeyPair, type AssetKeyStrategy, Autowired, type BareRouteFlag, type BaseUploadOptions, type BreachPaddingOptions, type BuildContext, type BuildPipelineOptions, type BuildRoutesOptions, type Buildable, Builder, type BuilderOf, CRON_META, CRON_WORKER_ENV, CacheEvict, type CacheOptions, type CacheProvider, CacheResponse, type CacheResponseOptions, Cacheable, type CallSiteParams, type CheckContext, type CheckMessage, CircuitBreaker, type CircuitBreakerOptions, type CircuitBreakerState, type CircuitBreakerStats, CircuitOpenError, type ClassKind, type ClusterOptions, type ColumnApiQueryParamsConfig, Component, type ComputedRef, type ConditionOutcome, type ConditionalOutcome, type ConfigDescription, type ConfigOrigins, ConfigService, type ConfigVar, type ConnectErrorHandler, type ConnectHandler, type ConnectMiddleware, type ConnectNext, type ConnectRequest, type ConnectResponse, 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 CronSchedule, type CronScheduler, type CsrfGuardOptions, type CsrfOptions, type Ctx, type CtxHandler, type CursorPaginateOptions, type CursorPaginatedResponse, type CursorPosition, type CursorQuery, type CursorValue, 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, FILTER_OPERATORS, FLASH_KEY, FORM_ERRORS_KEY, type FailureAdvice, type FieldsOf, type FileTypeFilter, FileUpload, type FileUploadConfig, type FilterItem, type FilterOperator, type FormErrorHandler, type FormErrorHandlerOptions, 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 LegacyHasher, type LoggedRequest, type LoggedResponse, Logger, type LoggerProvider, METADATA, type ManagementOptions, type MatchedRoute, type MaybePromise, MemoryCacheProvider, type MetaValue, type MetricsOptions, 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, type MountedRouteInfo, MutableModuleRegistry, type NegatedRouteFlagName, NoJobHandlerError, OLD_INPUT_KEY, type OptionalSettings, PREVIOUS_URL_KEY, type PaginatedResponse, type PaginationParams, type ParseQueryOptions, type ParsedQuery, type PasswordCheck, type PasswordHashOptions, Patch, type PlatformContext, type PluginAsyncOptions, type PluginFactory, type PositionalParams, Post, PostConstruct, type PostConstructStatus, PreDestroy, type ProblemDetails, ProblemException, Problems, Process, type ProcessDefinition, type ProvidedSettings, Put, type QueryBuilderAdapter, type QueryFieldConfig, type QueryRejectReason, type QueryRejection, RAW_BODY, REQUEST_ID_HEADER, RESPOND, RESPONSE_CHANNEL, ROUTE_URLS, type RateLimitGuardOptions, type RateLimitOptions, type RateLimitStore, type Ref, type RefOptions, type Reply, type ReplyHeaders, type ReplyOptions, Repository, RequestContext, RequestHistogram, type RequestLoggerOptions, type RequestStore, type ResolvedDeps, type Respondable, type ResponseInfo, type RouteContributor, 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, type RouteName, RoutePolicyTable, type RouteShape, type RouteTable, type RunContributorsOptions, type RuntimeAppOptions, type RuntimeCapabilities, type RuntimeResponse, type RuntimeTypeMap, SECRET_FIELD, Scope, type ServerOptions, Service, type ServiceOptions, type Session, type SessionData, type SessionOptions, type SessionStore, type Settings, type SettingsDeclaration, type SettingsOf, type SignedCheck, type Signer, type SignerOptions, type SortItem, type SourcedRegistration, SpaAdapter, type SpaAdapterOptions, type SseHandler, type StartupCheck, StartupCheckError, type StartupStep, type StartupTimelineSnapshot, TRACEPARENT_HEADER, type TraceContext, type TraceContextOptions, type TypedConfigService, type TypedParsedQuery, UnknownAssetError, type UploadOptions, type UploadStorageEngine, type UploadedFile, type UrlBuilder, type UrlForArgs, type UrlQuery, type UseConnectOptions, VIEW_RENDERER, type ValidationError, type ValidationErrorFactory, type ValidationFailure, type Validators, Value, type ValueOrigin, type ValuedRouteFlag, type VarOrigin, type VerifyOptions, type VerifyPasswordOptions, ViewAdapter, type ViewAdapterOptions, type ViewRenderOptions, type ViewRenderer, type WatchOptions, allOf, allowedHosts, applyHandlerResult, assertFlagTest, assets, baseEnvSchema, batch, bindRoutePolicy, bindViewRenderer, bootstrap, breachPadding, buildMountPath, buildPipeline, buildQueryParams, buildRouteTable, buildRoutes, buildUploadMiddleware, cleanupFiles, clearAssetCache, computed, cors, createConfigService, createHandler, createLogger, createSigner, createToken, cronScheduleId, csrf, csrfGuard, csrfToken, ctn, defaultProblemTitle, defaultValidationError, defineAdapter, defineCheck, defineContextDecorator, defineEnv, defineHttpContextDecorator, defineModule, defineModules, definePlugin, defineRouteFlag, defineSettings, describeError, disposeAll, errorHandler, evaluatePreconditions, expressRuntime, fieldErrors, flash, formErrorHandler, formatKickError, getCacheProvider, getClassMeta, getClassMetaOrUndefined, getCronJobs, getEnv, getMetaMap, getMetaRecord, getMethodMeta, getMethodMetaOrUndefined, getQueryParsingDefaults, getRequestStore, getRequestValue, getRouteFlags, groupAssetKeys, hasClassMeta, hashPassword, healthModule, helmet, isClusterPrimary, isCronJobEnabled, isInjectionToken, isRef, isReply, isRespondable, joinPaths, listCronJobs, listJobHandlers, listJobQueues, loadEnv, loadEnvFromSchema, loadSettings, matchesBearer, matchesFlagTest, materializeRouter, metricsAdapter, mountSort, normalizeApiQueryParamsConfig, normalizePath, normalizeProblem, notFoundHandler, offerRoutePolicy, oldInput, onEnv, onPackage, originsOf, 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, toRef, toRefs, tokenName, traceContext, unref, upload, useAssets, validate, verifyPassword, viewRendererFor, waitUntil, watch, withBuilder, withEnv };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.14.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{o as KickError,s as formatKickError}from"./di-hooks-CBFaF0h-.mjs";import{METADATA,Scope}from"./core/interfaces.mjs";import{ConsoleLoggerProvider,Logger,createLogger,describeError}from"./core/logger.mjs";import{Container,tokenName}from"./core/container.mjs";import{i as isInjectionToken,n as createToken,r as ctn,t as INJECTION_TOKEN}from"./token-BRZwz7iz.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-CVsp-IZS.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{i as defineModule,r as MutableModuleRegistry,t as ROUTE_URLS}from"./url-for-C5R5ZrDW.mjs";import{i as reportResponse,r as reportError}from"./observers-DBTDcQ62.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-CZeIt0gU.mjs";import{CacheEvict,Cacheable,MemoryCacheProvider,getCacheProvider,setCacheProvider}from"./core/cache.mjs";import{r as registerDisposable,t as disposeAll}from"./disposables-BBiL1YqI.mjs";import{HttpException,HttpStatus,ProblemException,Problems,defaultProblemTitle,normalizeProblem}from"./core/errors.mjs";import{buildMountPath,joinPaths,normalizePath}from"./core/path.mjs";import{batch,computed,isRef,reactive,ref,toRef,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-Bjnd8inS.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-CXAMJq3w.mjs";import{i as MissingContributorError,n as DuplicateContributorError,r as MissingContextValueError,t as ContributorCycleError}from"./context-errors-CXGtzjTQ.mjs";import{i as buildPipeline,r as buildRouteTable}from"./router-builder-BgoS_JoM.mjs";import{t as runContributors}from"./contributor-runner-Dx-TDNgk.mjs";import{_ as MountCycleError,a as HealthController,c as defineCheck,d as onPackage,f as ERROR_CHANNEL,g as MissingMountDepError,h as DuplicateMountNameError,i as HEALTH_PROBE,l as allOf,m as RESPONSE_CHANNEL,n as Application,o as healthModule,p as HANDLER_CHANNEL,s as StartupCheckError,t as APPLICATION,u as onEnv,v as mountSort}from"./application-Bq0CzA-N.mjs";import{t as defineAdapter}from"./define-adapter-C_97M6VW.mjs";import{n as bindRoutePolicy,r as offerRoutePolicy,t as RoutePolicyTable}from"./route-policy-CiSCSa16.mjs";import{n as randomHex,t as matchesBearer}from"./web-crypto-Dm0fWL80.mjs";import{n as RAW_BODY}from"./body-policy-mOP2Y9X_.mjs";import{REQUEST_ID_HEADER,requestId}from"./http/middleware/request-id.mjs";import{a as viewRendererFor,c as settleBackgroundWork,d as getRequestValue,f as requestStore,l as waitUntil,n as bindViewRenderer,t as VIEW_RENDERER,u as getRequestStore}from"./view-renderer-BvDWb7GV.mjs";import{errorHandler,notFoundHandler}from"./http/middleware/error-handler.mjs";import{allowedHosts}from"./http/middleware/allowed-hosts.mjs";import{i as requestScopeMiddleware}from"./request-scope-BjBvqXuj.mjs";import{a as originsOf,i as loadSettings,n as defineSettings}from"./settings-Ck0vWbOD.mjs";import{a as getEnv,c as reloadEnv,l as resetEnvCache,n as baseEnvSchema,o as loadEnv,r as defineEnv,s as loadEnvFromSchema,u as withEnv}from"./decorate-JtGrMqV1.mjs";import{a as reply,i as isRespondable,n as applyHandlerResult,r as isReply,t as RESPOND}from"./reply-CjA0lh5T.mjs";import{a as materializeRouter,i as expressRuntime,n as buildRoutes}from"./express-lazy-DaYQBnt_.mjs";import{r as evaluatePreconditions,t as RequestContext}from"./context-CvicRipm.mjs";import{r as stringifyJson}from"./runtime-BMyg1FYH.mjs";import{a as KickCronAdapter,i as CRON_WORKER_ENV,n as createHandler,r as isClusterPrimary,t as bootstrap}from"./bootstrap-CMwBEDZq.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-sD0UtM2N.mjs";import{defaultValidationError,validate}from"./http/middleware/validate.mjs";import{csrf,csrfGuard,csrfToken}from"./http/middleware/csrf.mjs";import{requestLogger}from"./http/middleware/request-logger.mjs";import{helmet}from"./http/middleware/helmet.mjs";import{breachPadding}from"./http/middleware/breach-padding.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-C10enmKH.mjs";import{session}from"./http/middleware/session.mjs";import{o as resolveMimeTypes}from"./upload-config-C_SlwFq0.mjs";import{buildUploadMiddleware,cleanupFiles,upload}from"./http/middleware/upload.mjs";import{ViewAdapter}from"./http/middleware/views.mjs";import{SpaAdapter}from"./http/middleware/spa.mjs";import{n as createConfigService,t as ConfigService}from"./config-DzmeCXg4.mjs";import{createHmac,randomBytes,scrypt,timingSafeEqual}from"node:crypto";import{monitorEventLoopDelay}from"node:perf_hooks";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}const inFlight=/* @__PURE__ */ new Map,PERSONAL=[`authorization`,`proxy-authorization`,`x-api-key`,`cookie`];function CacheResponse(options){let maxAgeMs=options.maxAge*1e3,swrMs=(options.swr??0)*1e3,varies=(options.varies??[]).map(h=>h.toLowerCase());return(target,propertyKey,descriptor)=>{let original=descriptor.value,owner=typeof target==`function`?target.name:target.constructor?.name,prefix=typeof options.key==`string`?options.key:`kick:response:${owner??`anonymous`}.${String(propertyKey)}`,keyOf=typeof options.key==`function`?options.key:void 0;return descriptor.value=async function(ctx,...rest){let req=ctx.req,method=String(req.method??`GET`).toUpperCase(),headers=ctx.headers;if(method!==`GET`&&method!==`HEAD`||maxAgeMs+swrMs<=0)return original.call(this,ctx,...rest);let identity;if(keyOf){let chosen=keyOf(ctx);if(chosen===null)return original.call(this,ctx,...rest);identity=chosen}else{if(PERSONAL.some(h=>headers[h]!==void 0&&!varies.includes(h))||ctx.user!==void 0&&!varies.some(h=>PERSONAL.includes(h)))return original.call(this,ctx,...rest);let host=String(headers.host??``);if(!VALID_HOST.test(host))return original.call(this,ctx,...rest);identity=JSON.stringify([host.toLowerCase(),req.originalUrl??req.url??``])}let varied=varies.map(h=>`${h}=${String(headers[h]??``)}`).join(`&`),key=`${prefix}:${identity}|${varied}`,provider=getCacheProvider(),run=()=>record(original,this,ctx,rest),build=()=>buildOnce(key,run),store=async({recorded,shared})=>{if(!shared&&recorded&&cacheable(recorded)){let entry={recorded,storedAt:Date.now()};await provider.set(key,entry,maxAgeMs+swrMs)}},entry=await provider.get(key);if(entry){let age=Date.now()-entry.storedAt;if(age<maxAgeMs+swrMs){age>=maxAgeMs&&waitUntil(build().then(store)),replay(ctx,entry.recorded);return}}let built=await build();await store(built);let recorded=built.recorded;built.shared&&!(recorded&&cacheable(recorded))&&(recorded=await run()),recorded&&replay(ctx,recorded)},descriptor}}const VALID_HOST=/^(?:\[[0-9a-f:.]+\]|[a-z0-9-]+(?:\.[a-z0-9-]+)*)(?::\d{1,5})?$/i;async function buildOnce(key,run){let pending=inFlight.get(key);if(pending)return{recorded:await pending,shared:!0};let load=run().finally(()=>inFlight.delete(key));return inFlight.set(key,load),{recorded:await load,shared:!1}}function cacheable(recorded){return recorded.status===200&&!(`set-cookie`in recorded.headers)&&!recorded.native}async function record(handler,self,ctx,rest){let recorded={status:200,headers:{},body:``},sent=!1,finish=body=>{body instanceof Uint8Array?(recorded.body=toBase64(body),recorded.binary=!0):typeof body==`string`?recorded.body=body:body!=null&&(recorded.type??=`application/json; charset=utf-8`,recorded.body=stringifyJson(body)),sent=!0},unsupported=what=>()=>{throw Error(`@CacheResponse: the handler called ${what}. A cached route answers with ctx.json / ctx.send / ctx.html or a returned value, not a stream or a template.`)},response={status(code){return recorded.status=code,response},type(contentType){return recorded.type=contentType,response},json(data){return recorded.type??=`application/json; charset=utf-8`,recorded.body=stringifyJson(data),sent=!0,response},send(data){return finish(data),response},end(data){return finish(data),response},setHeader(name,value){recorded.headers[name.toLowerCase()]=Array.isArray(value)?[...value]:String(value)},get headersSent(){return sent},once(){},render:unsupported(`render()`),writeHead:unsupported(`writeHead()`),flushHeaders:unsupported(`flushHeaders()`),write:unsupported(`write()`)},native=new Proxy(ctx.res,{get(target,prop){let value=Reflect.get(target,prop,target);return typeof value==`function`?(...args)=>(recorded.native=!0,value.apply(target,args)):value},set(target,prop,value){return recorded.native=!0,Reflect.set(target,prop,value,target)}}),recordingCtx=Object.create(ctx,{_response:{value:response},res:{value:native}}),result=await handler.call(self,recordingCtx,...rest);return sent||await applyHandlerResult(recordingCtx,result),sent?recorded:null}function replay(ctx,recorded){if(ctx._response.headersSent)return;for(let[name,value]of Object.entries(recorded.headers))name!==`etag`&&name!==`content-type`&&ctx.setHeader(name,value);if(recorded.status===200){let etag=recorded.headers.etag??weakEtag(recorded.body);if(ctx.conditional({etag}))return}let options={status:recorded.status,type:recorded.type??`text/plain; charset=utf-8`};ctx.send(recorded.binary?fromBase64(recorded.body):recorded.body,options)}function weakEtag(body){let hash=2166136261;for(let i=0;i<body.length;i++)hash^=body.charCodeAt(i),hash=Math.imul(hash,16777619);return`W/"${body.length.toString(16)}-${(hash>>>0).toString(16)}"`}function toBase64(bytes){let binary=``;for(let i=0;i<bytes.length;i+=32768)binary+=String.fromCharCode(...bytes.subarray(i,i+32768));return btoa(binary)}function fromBase64(text){let binary=atob(text),bytes=new Uint8Array(binary.length);for(let i=0;i<binary.length;i++)bytes[i]=binary.charCodeAt(i);return bytes}const DEFAULT_BUCKETS=[.005,.01,.025,.05,.1,.25,.5,1,2.5,5,10],label=value=>value.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`).replaceAll(`
|
|
11
|
+
import{o as KickError,s as formatKickError}from"./di-hooks-ZfnBZMDp.mjs";import{METADATA,Scope}from"./core/interfaces.mjs";import{ConsoleLoggerProvider,Logger,createLogger,describeError}from"./core/logger.mjs";import{Container,tokenName}from"./core/container.mjs";import{i as isInjectionToken,n as createToken,r as ctn,t as INJECTION_TOKEN}from"./token-CroYM4Lm.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-UjLEzS06.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{i as defineModule,r as MutableModuleRegistry,t as ROUTE_URLS}from"./url-for-BCQLTEJj.mjs";import{i as reportResponse,r as reportError}from"./observers-C4bWQTop.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-BTnyyRY1.mjs";import{CacheEvict,Cacheable,MemoryCacheProvider,getCacheProvider,setCacheProvider}from"./core/cache.mjs";import{r as registerDisposable,t as disposeAll}from"./disposables-DFZXQuVg.mjs";import{HttpException,HttpStatus,ProblemException,Problems,defaultProblemTitle,normalizeProblem}from"./core/errors.mjs";import{buildMountPath,joinPaths,normalizePath}from"./core/path.mjs";import{batch,computed,isRef,reactive,ref,toRef,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-DWNbpMIE.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-g3y9VDwr.mjs";import{i as MissingContributorError,n as DuplicateContributorError,r as MissingContextValueError,t as ContributorCycleError}from"./context-errors-6x0bjldv.mjs";import{i as buildPipeline,r as buildRouteTable}from"./router-builder-CiwYhiUM.mjs";import{t as runContributors}from"./contributor-runner-DQ2fXJ29.mjs";import{_ as MountCycleError,a as HealthController,c as defineCheck,d as onPackage,f as ERROR_CHANNEL,g as MissingMountDepError,h as DuplicateMountNameError,i as HEALTH_PROBE,l as allOf,m as RESPONSE_CHANNEL,n as Application,o as healthModule,p as HANDLER_CHANNEL,s as StartupCheckError,t as APPLICATION,u as onEnv,v as mountSort}from"./application-BosHcuBZ.mjs";import{t as defineAdapter}from"./define-adapter-CZCFyDp5.mjs";import{n as bindRoutePolicy,r as offerRoutePolicy,t as RoutePolicyTable}from"./route-policy-DsdJx3bk.mjs";import{n as randomHex,t as matchesBearer}from"./web-crypto-CJiyfQrv.mjs";import{n as RAW_BODY}from"./body-policy-CwgUYBw7.mjs";import{REQUEST_ID_HEADER,requestId}from"./http/middleware/request-id.mjs";import{a as viewRendererFor,c as settleBackgroundWork,d as getRequestValue,f as requestStore,l as waitUntil,n as bindViewRenderer,t as VIEW_RENDERER,u as getRequestStore}from"./view-renderer-Dbha_94K.mjs";import{errorHandler,notFoundHandler}from"./http/middleware/error-handler.mjs";import{allowedHosts}from"./http/middleware/allowed-hosts.mjs";import{i as requestScopeMiddleware}from"./request-scope-DZQceiLY.mjs";import{a as loadSettings,n as defineSettings,o as originsOf}from"./settings-CNZ7iRli.mjs";import{a as getEnv,c as reloadEnv,l as resetEnvCache,n as baseEnvSchema,o as loadEnv,r as defineEnv,s as loadEnvFromSchema,u as withEnv}from"./decorate-LMK39Sn6.mjs";import{a as reply,i as isRespondable,n as applyHandlerResult,r as isReply,t as RESPOND}from"./reply-CpMbB8uH.mjs";import{a as materializeRouter,i as expressRuntime,n as buildRoutes}from"./express-lazy-GCgYyykt.mjs";import{r as evaluatePreconditions,t as RequestContext}from"./context-Cgr5dtIZ.mjs";import{r as stringifyJson}from"./runtime-Bus9RVyU.mjs";import{a as KickCronAdapter,i as CRON_WORKER_ENV,n as createHandler,r as isClusterPrimary,t as bootstrap}from"./bootstrap-CY0v5VVF.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-DXIo1mII.mjs";import{defaultValidationError,validate}from"./http/middleware/validate.mjs";import{csrf,csrfGuard,csrfToken}from"./http/middleware/csrf.mjs";import{requestLogger}from"./http/middleware/request-logger.mjs";import{helmet}from"./http/middleware/helmet.mjs";import{breachPadding}from"./http/middleware/breach-padding.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-HUdUibOx.mjs";import{session}from"./http/middleware/session.mjs";import{o as resolveMimeTypes}from"./upload-config-Bq3qcDel.mjs";import{buildUploadMiddleware,cleanupFiles,upload}from"./http/middleware/upload.mjs";import{ViewAdapter}from"./http/middleware/views.mjs";import{SpaAdapter}from"./http/middleware/spa.mjs";import{n as createConfigService,t as ConfigService}from"./config-Djisd0f5.mjs";import{createHmac,randomBytes,scrypt,timingSafeEqual}from"node:crypto";import{monitorEventLoopDelay}from"node:perf_hooks";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}const inFlight=/* @__PURE__ */ new Map,PERSONAL=[`authorization`,`proxy-authorization`,`x-api-key`,`cookie`];function CacheResponse(options){let maxAgeMs=options.maxAge*1e3,swrMs=(options.swr??0)*1e3,varies=(options.varies??[]).map(h=>h.toLowerCase());return(target,propertyKey,descriptor)=>{let original=descriptor.value,owner=typeof target==`function`?target.name:target.constructor?.name,prefix=typeof options.key==`string`?options.key:`kick:response:${owner??`anonymous`}.${String(propertyKey)}`,keyOf=typeof options.key==`function`?options.key:void 0;return descriptor.value=async function(ctx,...rest){let req=ctx.req,method=String(req.method??`GET`).toUpperCase(),headers=ctx.headers;if(method!==`GET`&&method!==`HEAD`||maxAgeMs+swrMs<=0)return original.call(this,ctx,...rest);let identity;if(keyOf){let chosen=keyOf(ctx);if(chosen===null)return original.call(this,ctx,...rest);identity=chosen}else{if(PERSONAL.some(h=>headers[h]!==void 0&&!varies.includes(h))||ctx.user!==void 0&&!varies.some(h=>PERSONAL.includes(h)))return original.call(this,ctx,...rest);let host=String(headers.host??``);if(!VALID_HOST.test(host))return original.call(this,ctx,...rest);identity=JSON.stringify([host.toLowerCase(),req.originalUrl??req.url??``])}let varied=varies.map(h=>`${h}=${String(headers[h]??``)}`).join(`&`),key=`${prefix}:${identity}|${varied}`,provider=getCacheProvider(),run=()=>record(original,this,ctx,rest),build=()=>buildOnce(key,run),store=async({recorded,shared})=>{if(!shared&&recorded&&cacheable(recorded)){let entry={recorded,storedAt:Date.now()};await provider.set(key,entry,maxAgeMs+swrMs)}},entry=await provider.get(key);if(entry){let age=Date.now()-entry.storedAt;if(age<maxAgeMs+swrMs){age>=maxAgeMs&&waitUntil(build().then(store)),replay(ctx,entry.recorded);return}}let built=await build();await store(built);let recorded=built.recorded;built.shared&&!(recorded&&cacheable(recorded))&&(recorded=await run()),recorded&&replay(ctx,recorded)},descriptor}}const VALID_HOST=/^(?:\[[0-9a-f:.]+\]|[a-z0-9-]+(?:\.[a-z0-9-]+)*)(?::\d{1,5})?$/i;async function buildOnce(key,run){let pending=inFlight.get(key);if(pending)return{recorded:await pending,shared:!0};let load=run().finally(()=>inFlight.delete(key));return inFlight.set(key,load),{recorded:await load,shared:!1}}function cacheable(recorded){return recorded.status===200&&!(`set-cookie`in recorded.headers)&&!recorded.native}async function record(handler,self,ctx,rest){let recorded={status:200,headers:{},body:``},sent=!1,finish=body=>{body instanceof Uint8Array?(recorded.body=toBase64(body),recorded.binary=!0):typeof body==`string`?recorded.body=body:body!=null&&(recorded.type??=`application/json; charset=utf-8`,recorded.body=stringifyJson(body)),sent=!0},unsupported=what=>()=>{throw Error(`@CacheResponse: the handler called ${what}. A cached route answers with ctx.json / ctx.send / ctx.html or a returned value, not a stream or a template.`)},response={status(code){return recorded.status=code,response},type(contentType){return recorded.type=contentType,response},json(data){return recorded.type??=`application/json; charset=utf-8`,recorded.body=stringifyJson(data),sent=!0,response},send(data){return finish(data),response},end(data){return finish(data),response},setHeader(name,value){recorded.headers[name.toLowerCase()]=Array.isArray(value)?[...value]:String(value)},get headersSent(){return sent},once(){},render:unsupported(`render()`),writeHead:unsupported(`writeHead()`),flushHeaders:unsupported(`flushHeaders()`),write:unsupported(`write()`)},native=new Proxy(ctx.res,{get(target,prop){let value=Reflect.get(target,prop,target);return typeof value==`function`?(...args)=>(recorded.native=!0,value.apply(target,args)):value},set(target,prop,value){return recorded.native=!0,Reflect.set(target,prop,value,target)}}),recordingCtx=Object.create(ctx,{_response:{value:response},res:{value:native}}),result=await handler.call(self,recordingCtx,...rest);return sent||await applyHandlerResult(recordingCtx,result),sent?recorded:null}function replay(ctx,recorded){if(ctx._response.headersSent)return;for(let[name,value]of Object.entries(recorded.headers))name!==`etag`&&name!==`content-type`&&ctx.setHeader(name,value);if(recorded.status===200){let etag=recorded.headers.etag??weakEtag(recorded.body);if(ctx.conditional({etag}))return}let options={status:recorded.status,type:recorded.type??`text/plain; charset=utf-8`};ctx.send(recorded.binary?fromBase64(recorded.body):recorded.body,options)}function weakEtag(body){let hash=2166136261;for(let i=0;i<body.length;i++)hash^=body.charCodeAt(i),hash=Math.imul(hash,16777619);return`W/"${body.length.toString(16)}-${(hash>>>0).toString(16)}"`}function toBase64(bytes){let binary=``;for(let i=0;i<bytes.length;i+=32768)binary+=String.fromCharCode(...bytes.subarray(i,i+32768));return btoa(binary)}function fromBase64(text){let binary=atob(text),bytes=new Uint8Array(binary.length);for(let i=0;i<binary.length;i++)bytes[i]=binary.charCodeAt(i);return bytes}const DEFAULT_BUCKETS=[.005,.01,.025,.05,.1,.25,.5,1,2.5,5,10],label=value=>value.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`).replaceAll(`
|
|
12
12
|
`,`\\n`);var RequestHistogram=class{series=/* @__PURE__ */ new Map;buckets;constructor(buckets=DEFAULT_BUCKETS){if(buckets.length===0||buckets.some(b=>!Number.isFinite(b)||b<=0))throw Error(`metrics: buckets must be finite positive numbers (seconds)`);this.buckets=[...new Set(buckets)].toSorted((a,b)=>a-b)}observe(info){let labels=`method="${label(knownMethod(info.method))}",route="${label(info.route??`unmatched`)}",status="${info.status}"`,series=this.series.get(labels);series||(series={labels,counts:this.buckets.map(()=>0),sum:0,count:0},this.series.set(labels,series));let seconds=info.durationMs/1e3;for(let[i,bound]of this.buckets.entries())seconds<=bound&&series.counts[i]++;series.sum+=seconds,series.count++}render(){let name=`http_request_duration_seconds`,lines=[`# HELP ${name} Time to answer an HTTP request, by route pattern.`,`# TYPE ${name} histogram`];for(let s of this.series.values()){for(let[i,bound]of this.buckets.entries())lines.push(`${name}_bucket{${s.labels},le="${bound}"} ${s.counts[i]}`);lines.push(`${name}_bucket{${s.labels},le="+Inf"} ${s.count}`),lines.push(`${name}_sum{${s.labels}} ${s.sum}`),lines.push(`${name}_count{${s.labels}} ${s.count}`)}return lines.join(`
|
|
13
13
|
`)}};const METHODS=/* @__PURE__ */ new Set([`GET`,`HEAD`,`POST`,`PUT`,`DELETE`,`PATCH`,`OPTIONS`,`QUERY`]);function knownMethod(method){let upper=method.toUpperCase();return METHODS.has(upper)?upper:`OTHER`}function gauge(name,help,value){return`# HELP ${name} ${help}\n# TYPE ${name} gauge\n${name} ${value}`}function metricsAdapter(options={}){let path=options.path??`/metrics`,histogram=new RequestHistogram(options.buckets??DEFAULT_BUCKETS),loop,render=()=>{let memory=process.memoryUsage(),lag=loop&&loop.count>0?loop.mean/1e9:0;return[histogram.render(),gauge(`process_resident_memory_bytes`,`Resident set size.`,memory.rss),gauge(`nodejs_heap_used_bytes`,`V8 heap in use.`,memory.heapUsed),gauge(`nodejs_heap_total_bytes`,`V8 heap allocated.`,memory.heapTotal),gauge(`nodejs_eventloop_lag_seconds`,`Mean event-loop delay since the last scrape.`,lag),gauge(`process_uptime_seconds`,`Seconds since the process started.`,process.uptime())].join(`
|
|
14
14
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.14.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
11
|
function isProduction(){let env=typeof process<`u`?process.env?.NODE_ENV:void 0;return env!==`development`&&env!==`test`}export{isProduction as t};
|
|
12
|
-
//# sourceMappingURL=is-production-
|
|
12
|
+
//# sourceMappingURL=is-production-6wpWSGvS.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-production-
|
|
1
|
+
{"version":3,"file":"is-production-6wpWSGvS.mjs","names":[],"sources":["../src/core/is-production.ts"],"sourcesContent":["/**\n * Whether the process should behave as production — true unless `NODE_ENV`\n * is exactly `development` or `test`. Fails closed: an unset (or any other)\n * `NODE_ENV` counts as production, so a deploy that forgets to set it still\n * gets secure cookies, opaque 500s and no dev-only aids.\n *\n * Read per call, not at module scope — tests and late config may set\n * `NODE_ENV` after import — and guarded, since edge runtimes may not expose\n * `process`. Reads `process.env` rather than `getEnv()`: the framework must\n * not depend on the app's env schema (or on zod) to decide this.\n */\nexport function isProduction(): boolean {\n const env = typeof process !== 'undefined' ? process.env?.NODE_ENV : undefined\n return env !== 'development' && env !== 'test'\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,cAAwB,CACtC,IAAM,IAAM,OAAO,QAAY,IAAc,QAAQ,KAAK,SAAW,IAAA,GACrE,OAAO,MAAQ,eAAiB,MAAQ,MAC1C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.14.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{createLogger}from"./core/logger.mjs";import{n as createToken}from"./token-
|
|
12
|
-
//# sourceMappingURL=jobs-
|
|
11
|
+
import{createLogger}from"./core/logger.mjs";import{n as createToken}from"./token-CroYM4Lm.mjs";import{c as pushClassMeta,n as getClassMetaOrUndefined,t as getClassMeta,u as setClassMeta}from"./metadata-UjLEzS06.mjs";import{Service}from"./core/decorators.mjs";import{r as reportError}from"./observers-C4bWQTop.mjs";const log=createLogger(`KickJobs`),JOB_META={JOB:`kick/queue/job`,PROCESS:`kick/queue/process`},jobClasses=/* @__PURE__ */ new Map;function Job(queue){return target=>{Service()(target),setClassMeta(JOB_META.JOB,queue,target),jobClasses.set(target.name,target)}}function Process(jobName){return(target,propertyKey)=>{pushClassMeta(JOB_META.PROCESS,target.constructor,{handlerName:propertyKey,jobName})}}function listJobHandlers(container){let handlers=[];for(let target of jobClasses.values()){if(!container.has(target))continue;let queue=getClassMetaOrUndefined(JOB_META.JOB,target);if(queue===void 0)continue;let processes=getClassMeta(JOB_META.PROCESS,target,[]);processes.length===0&&log.warn(`@Job('${queue}') class ${target.name} has no @Process methods`);for(let process of processes)handlers.push({...process,queue,target})}return handlers}function listJobQueues(container){return[...new Set(listJobHandlers(container).map(h=>h.queue))]}var NoJobHandlerError=class extends Error{queue;jobName;constructor(queue,jobName){super(`No @Process handler for job "${jobName}" on queue "${queue}"`),this.queue=queue,this.jobName=jobName,this.name=`NoJobHandlerError`}};async function runJob(container,queue,job,report={}){let handlers=listJobHandlers(container).filter(h=>h.queue===queue),handler=handlers.find(h=>h.jobName===job.name)??handlers.find(h=>h.jobName===void 0);try{if(!handler)throw new NoJobHandlerError(queue,job.name);let instance=container.resolve(handler.target);return await withJobContext(job,()=>instance[handler.handlerName](job))()}catch(err){throw log.error({err},`Job ${queue}/${job.name} failed`),reportError(err,{source:`job`,context:{queue,job:job.name,id:job.id,...report}}),err}}const JOB_CONTEXT_FIELD=`__kickContext`,jobContextCarriers=/* @__PURE__ */ new Map;function registerJobContext(carrier){jobContextCarriers.set(carrier.key,carrier)}const isPlainObject=v=>!!v&&typeof v==`object`&&Object.getPrototypeOf(v)===Object.prototype;function stampJobContext(data){if(!isPlainObject(data))return data;let{[JOB_CONTEXT_FIELD]:_untrusted,...rest}=data,context={};for(let[key,carrier]of jobContextCarriers){let value=carrier.capture();value!==void 0&&(context[key]=value)}return Object.keys(context).length>0?{...rest,[JOB_CONTEXT_FIELD]:context}:rest}function withJobContext(job,run){let data=job.data;if(!isPlainObject(data)||!(`__kickContext`in data))return run;let context=data[JOB_CONTEXT_FIELD];if(delete data[JOB_CONTEXT_FIELD],!isPlainObject(context))return run;let wrapped=run;for(let[key,value]of Object.entries(context)){let carrier=jobContextCarriers.get(key);if(!carrier)continue;let inner=wrapped;wrapped=()=>carrier.restore(value,inner)}return wrapped}const JOB_DISPATCHER=createToken(`kick/jobs/Dispatcher`);export{NoJobHandlerError as a,listJobQueues as c,stampJobContext as d,Job as i,registerJobContext as l,JOB_DISPATCHER as n,Process as o,JOB_META as r,listJobHandlers as s,JOB_CONTEXT_FIELD as t,runJob as u};
|
|
12
|
+
//# sourceMappingURL=jobs-BTnyyRY1.mjs.map
|