@forinda/kickjs 10.3.0 → 10.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter-BZ1WzN1z.d.mts +2354 -0
- package/dist/adapter-BZ1WzN1z.d.mts.map +1 -0
- package/dist/{app-module-Ftz6m7SO.d.mts → app-module-Cuu-Ma_E.d.mts} +5 -4
- package/dist/app-module-Cuu-Ma_E.d.mts.map +1 -0
- package/dist/{application-B2e5XYHm.mjs → application-Bs30gJF1.mjs} +4 -4
- package/dist/application-Bs30gJF1.mjs.map +1 -0
- package/dist/application-D5Iiy7rt.d.mts +1996 -0
- package/dist/application-D5Iiy7rt.d.mts.map +1 -0
- package/dist/bootstrap-B_sGJNSz.mjs +12 -0
- package/dist/{bootstrap-BmALF-1Y.mjs.map → bootstrap-B_sGJNSz.mjs.map} +1 -1
- package/dist/{bounded-counters-aA3iI_Ei.mjs → bounded-counters-DS-IbDW9.mjs} +2 -2
- package/dist/{bounded-counters-aA3iI_Ei.mjs.map → bounded-counters-DS-IbDW9.mjs.map} +1 -1
- package/dist/{client-ip-D2dsx8RG.mjs → client-ip-BLkoQTIR.mjs} +2 -2
- package/dist/{client-ip-D2dsx8RG.mjs.map → client-ip-BLkoQTIR.mjs.map} +1 -1
- package/dist/config/index.d.mts +1 -1
- package/dist/config/index.mjs +2 -2
- package/dist/{config-B77LTW_E.mjs → config-B6EeAw4P.mjs} +3 -3
- package/dist/{config-B77LTW_E.mjs.map → config-B6EeAw4P.mjs.map} +1 -1
- package/dist/container-4iJdDkRH.d.mts +3 -0
- package/dist/context-CRJzl_Mj.mjs +12 -0
- package/dist/context-CRJzl_Mj.mjs.map +1 -0
- package/dist/{context-errors-CPqYYhl0.mjs → context-errors-CR5NCXfl.mjs} +2 -2
- package/dist/{context-errors-CPqYYhl0.mjs.map → context-errors-CR5NCXfl.mjs.map} +1 -1
- package/dist/{contributor-runner-Cl5yZZy1.mjs → contributor-runner--ofCRZ0d.mjs} +3 -3
- package/dist/{contributor-runner-Cl5yZZy1.mjs.map → contributor-runner--ofCRZ0d.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.d.mts +2 -2
- package/dist/core/container.mjs +2 -2
- package/dist/core/cron.mjs +2 -2
- package/dist/core/decorators.d.mts +2 -2
- package/dist/core/decorators.mjs +2 -2
- package/dist/core/decorators.mjs.map +1 -1
- package/dist/core/errors.mjs +1 -1
- package/dist/core/interfaces.d.mts +2 -2
- package/dist/core/interfaces.mjs +2 -2
- package/dist/core/interfaces.mjs.map +1 -1
- package/dist/core/logger.mjs +1 -1
- package/dist/core/path.mjs +1 -1
- package/dist/core/plugin.d.mts +1 -1
- package/dist/core/plugin.mjs +1 -1
- package/dist/core/reactivity.mjs +1 -1
- package/dist/core-CsMDdzNE.mjs +12 -0
- package/dist/{core-D1AV-Tvd.mjs.map → core-CsMDdzNE.mjs.map} +1 -1
- package/dist/{csrf-Cy1meSpf.d.mts → csrf-BDAZK2mm.d.mts} +2 -2
- package/dist/{csrf-Cy1meSpf.d.mts.map → csrf-BDAZK2mm.d.mts.map} +1 -1
- package/dist/decorate-CLeX6hbL.mjs +13 -0
- package/dist/{decorate-BiXL-9e9.mjs.map → decorate-CLeX6hbL.mjs.map} +1 -1
- package/dist/{decorators-DaQUNXOn.d.mts → decorators-Dvy0JZ5L.d.mts} +8 -200
- package/dist/decorators-Dvy0JZ5L.d.mts.map +1 -0
- package/dist/{define-adapter-D22SDe0U.mjs → define-adapter-RbKRSG3i.mjs} +2 -2
- package/dist/{define-adapter-D22SDe0U.mjs.map → define-adapter-RbKRSG3i.mjs.map} +1 -1
- package/dist/di-hooks-CiNaIu12.mjs +132 -0
- package/dist/di-hooks-CiNaIu12.mjs.map +1 -0
- package/dist/disposables-DYTkgNiG.mjs +11 -0
- package/dist/error-handler-CbP7hKdJ.d.mts +63 -0
- package/dist/error-handler-CbP7hKdJ.d.mts.map +1 -0
- package/dist/{handler-gW_h2miq.mjs → handler-Cw4mr3ls.mjs} +3 -3
- package/dist/{handler-gW_h2miq.mjs.map → handler-Cw4mr3ls.mjs.map} +1 -1
- package/dist/{host-D__uZPyz.mjs → host-H7CIkHNB.mjs} +2 -2
- package/dist/{host-D__uZPyz.mjs.map → host-H7CIkHNB.mjs.map} +1 -1
- package/dist/http/application.d.mts +2 -2
- package/dist/http/application.mjs +2 -2
- package/dist/http/bootstrap.d.mts +1 -1
- package/dist/http/bootstrap.mjs +2 -2
- package/dist/http/context.d.mts +2 -2
- package/dist/http/context.mjs +2 -2
- package/dist/http/middleware/allowed-hosts.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.d.mts +1 -1
- package/dist/http/middleware/csrf.mjs +3 -2
- package/dist/http/middleware/csrf.mjs.map +1 -0
- package/dist/http/middleware/error-handler.d.mts +1 -1
- package/dist/http/middleware/error-handler.mjs +2 -2
- package/dist/http/middleware/error-handler.mjs.map +1 -1
- package/dist/http/middleware/helmet.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 +1 -1
- 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.d.mts +2 -2
- package/dist/http/query/index.mjs +2 -2
- package/dist/http/router-builder.d.mts +1 -1
- package/dist/http/router-builder.mjs +2 -2
- package/dist/http/runtimes/fastify.d.mts +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-CuiWSnZL.d.mts → index-B4aOLoId.d.mts} +4 -4
- package/dist/{index-CuiWSnZL.d.mts.map → index-B4aOLoId.d.mts.map} +1 -1
- package/dist/{index-BfT5KZ-M.d.mts → index-Blgka75E.d.mts} +63 -4
- package/dist/index-Blgka75E.d.mts.map +1 -0
- package/dist/index.d.mts +17 -11
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/dist/interfaces-C6LHcYsg.d.mts +34 -0
- package/dist/interfaces-C6LHcYsg.d.mts.map +1 -0
- package/dist/is-production-BTroGhp5.mjs +12 -0
- package/dist/is-production-BTroGhp5.mjs.map +1 -0
- package/dist/jobs-xqoMmdr4.mjs +12 -0
- package/dist/{jobs-s4__kZLr.mjs.map → jobs-xqoMmdr4.mjs.map} +1 -1
- package/dist/{kv-stores-Cjel_Dkc.mjs → kv-stores-0-6blGzh.mjs} +3 -3
- package/dist/{kv-stores-Cjel_Dkc.mjs.map → kv-stores-0-6blGzh.mjs.map} +1 -1
- package/dist/kv-stores-DXFBEYYu.d.mts +390 -0
- package/dist/kv-stores-DXFBEYYu.d.mts.map +1 -0
- package/dist/{lazy-serve-static-w94Xs3wQ.mjs → lazy-serve-static-D94xvah5.mjs} +2 -2
- package/dist/{lazy-serve-static-w94Xs3wQ.mjs.map → lazy-serve-static-D94xvah5.mjs.map} +1 -1
- package/dist/metadata-Bm65Y-5O.mjs +11 -0
- package/dist/{observers-boPE9XGi.mjs → observers-BAXkwMx0.mjs} +2 -2
- package/dist/{observers-boPE9XGi.mjs.map → observers-BAXkwMx0.mjs.map} +1 -1
- package/dist/query-CGyw7vNi.mjs +12 -0
- package/dist/query-CGyw7vNi.mjs.map +1 -0
- package/dist/{reply-CYY_CzRf.mjs → reply-tlUaowib.mjs} +3 -3
- package/dist/{reply-CYY_CzRf.mjs.map → reply-tlUaowib.mjs.map} +1 -1
- package/dist/{respond-Dc18G0X7.mjs → respond-BOlh-baJ.mjs} +2 -2
- package/dist/{respond-Dc18G0X7.mjs.map → respond-BOlh-baJ.mjs.map} +1 -1
- package/dist/{route-flag-BOQZs2Wn.mjs → route-flag-BPSq2JCs.mjs} +3 -3
- package/dist/{route-flag-BOQZs2Wn.mjs.map → route-flag-BPSq2JCs.mjs.map} +1 -1
- package/dist/{route-policy-B8c6QfiU.mjs → route-policy-DDszB6dQ.mjs} +2 -2
- package/dist/{route-policy-B8c6QfiU.mjs.map → route-policy-DDszB6dQ.mjs.map} +1 -1
- package/dist/router-builder-BewIsj7V.d.mts +56 -0
- package/dist/router-builder-BewIsj7V.d.mts.map +1 -0
- package/dist/router-builder-DoaDAmK8.mjs +12 -0
- package/dist/{router-builder-DoWOIGmG.mjs.map → router-builder-DoaDAmK8.mjs.map} +1 -1
- package/dist/{settings-C8VKewNS.d.mts → settings-BnE75hnr.d.mts} +2 -2
- package/dist/{settings-C8VKewNS.d.mts.map → settings-BnE75hnr.d.mts.map} +1 -1
- package/dist/settings-CRkMOwcz.mjs +14 -0
- package/dist/{settings-DcytOCC6.mjs.map → settings-CRkMOwcz.mjs.map} +1 -1
- package/dist/token-2CJq89za.mjs +11 -0
- package/dist/token-D6jfTQLA.d.mts +3 -0
- package/dist/upload-DkT2p1gd.d.mts +104 -0
- package/dist/upload-DkT2p1gd.d.mts.map +1 -0
- package/dist/{upload-config-CzxbJALL.mjs → upload-config-Be7w0Dfx.mjs} +2 -2
- package/dist/{upload-config-CzxbJALL.mjs.map → upload-config-Be7w0Dfx.mjs.map} +1 -1
- package/dist/url-for-EQsmb3yi.mjs +12 -0
- package/dist/url-for-EQsmb3yi.mjs.map +1 -0
- package/dist/web-crypto-G-m6c6w2.mjs +12 -0
- package/dist/web-crypto-G-m6c6w2.mjs.map +1 -0
- package/dist/web.d.mts +6 -5
- package/dist/web.d.mts.map +1 -1
- package/dist/web.mjs +2 -2
- package/dist/web.mjs.map +1 -1
- package/package.json +2 -1
- package/dist/adapter-BYdxuKiM.d.mts +0 -4916
- package/dist/adapter-BYdxuKiM.d.mts.map +0 -1
- package/dist/app-module-Ftz6m7SO.d.mts.map +0 -1
- package/dist/application-B2e5XYHm.mjs.map +0 -1
- package/dist/bootstrap-BmALF-1Y.mjs +0 -12
- package/dist/container-Dpvd66Yt.d.mts +0 -298
- package/dist/container-Dpvd66Yt.d.mts.map +0 -1
- package/dist/container-mvaAYThX.mjs +0 -132
- package/dist/container-mvaAYThX.mjs.map +0 -1
- package/dist/context-GbQnJB-L.mjs +0 -12
- package/dist/context-GbQnJB-L.mjs.map +0 -1
- package/dist/core-D1AV-Tvd.mjs +0 -12
- package/dist/csrf-D3prC4FK.mjs +0 -12
- package/dist/csrf-D3prC4FK.mjs.map +0 -1
- package/dist/decorate-BiXL-9e9.mjs +0 -13
- package/dist/decorators-DaQUNXOn.d.mts.map +0 -1
- package/dist/disposables-CJD_gWlA.mjs +0 -12
- package/dist/disposables-CJD_gWlA.mjs.map +0 -1
- package/dist/index-BfT5KZ-M.d.mts.map +0 -1
- package/dist/interfaces-C1hCSoLD.d.mts +0 -75
- package/dist/interfaces-C1hCSoLD.d.mts.map +0 -1
- package/dist/is-production-Dbm13WNL.mjs +0 -12
- package/dist/is-production-Dbm13WNL.mjs.map +0 -1
- package/dist/jobs-s4__kZLr.mjs +0 -12
- package/dist/metadata-C2GK_17k.mjs +0 -12
- package/dist/metadata-C2GK_17k.mjs.map +0 -1
- package/dist/query-DjTeF1d4.mjs +0 -12
- package/dist/query-DjTeF1d4.mjs.map +0 -1
- package/dist/router-builder-DoWOIGmG.mjs +0 -12
- package/dist/settings-DcytOCC6.mjs +0 -14
- package/dist/url-for-DGSrVfdD.mjs +0 -12
- package/dist/url-for-DGSrVfdD.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.4.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{HttpException,HttpStatus}from"../../core/errors.mjs";import{n as buildFileTypeFilter,r as resolveMimeTypes,t as applyUploadConfig}from"../../upload-config-
|
|
11
|
+
import{HttpException,HttpStatus}from"../../core/errors.mjs";import{n as buildFileTypeFilter,r as resolveMimeTypes,t as applyUploadConfig}from"../../upload-config-Be7w0Dfx.mjs";import{unlink}from"node:fs/promises";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){let maxSize=options.maxSize??5242880;return(req,res,next)=>{mw(req,res,err=>{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`))}next(err)})}}function createMulter(options){let limits={fileSize:options.maxSize??5242880},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,...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 single(fieldName,options={}){return bothConventions(translateMulterErrors(createMulter(options).single(fieldName),options))}function array(fieldName,maxCount=10,options={}){return bothConventions(translateMulterErrors(createMulter(options).array(fieldName,maxCount),options))}function none(options={}){return bothConventions(translateMulterErrors(createMulter(options).none(),options))}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);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.4.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{Logger}from"../../core/logger.mjs";import"../../core-
|
|
11
|
+
import{Logger}from"../../core/logger.mjs";import"../../core-CsMDdzNE.mjs";import{t as defineAdapter}from"../../define-adapter-RbKRSG3i.mjs";import{dirname,resolve}from"node:path";const log=Logger.for(`ViewEngine`),ViewAdapter=defineAdapter({name:`ViewAdapter`,build:options=>({beforeMount({app}){let{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,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { C as SortItem, S as
|
|
3
|
-
export { type ColumnQueryFieldConfig, FILTER_OPERATORS, type FieldsOf, type FilterItem, type FilterOperator, type PaginatedResponse, type PaginationParams, type ParseQueryOptions, type ParsedQuery, type QueryBuilderAdapter, type QueryFieldConfig, type QueryRejectReason, type QueryRejection, type SortItem, type StringQueryFieldConfig, type TypedParsedQuery, buildQueryParams, getQueryParsingDefaults, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort, resetQueryParsingDefaults, setQueryParsingDefaults };
|
|
2
|
+
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, k as StringQueryFieldConfig, l as parseSearchQuery, m as CursorPaginateOptions, n as QueryRejectReason, o as parseFilters, p as ColumnQueryFieldConfig, 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";
|
|
3
|
+
export { type ColumnQueryFieldConfig, type CursorPaginateOptions, type CursorPaginatedResponse, type CursorPosition, type CursorQuery, type CursorValue, FILTER_OPERATORS, type FieldsOf, type FilterItem, type FilterOperator, type PaginatedResponse, type PaginationParams, type ParseQueryOptions, type ParsedQuery, type QueryBuilderAdapter, type QueryFieldConfig, type QueryRejectReason, type QueryRejection, type SortItem, type StringQueryFieldConfig, type TypedParsedQuery, buildQueryParams, getQueryParsingDefaults, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort, resetQueryParsingDefaults, setQueryParsingDefaults };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.4.0
|
|
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-CGyw7vNi.mjs";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { i as buildRouteTable, n as _setExternalContributorSources, r as assertRouteUnique, t as BuildRoutesOptions } from "../router-builder-BewIsj7V.mjs";
|
|
3
3
|
export { BuildRoutesOptions, _setExternalContributorSources, assertRouteUnique, buildRouteTable };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.4.0
|
|
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-DoaDAmK8.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.4.0
|
|
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{_ as unsupportedMediaTypeError,m as parseForm,n as applyHandlerResult,o as createRequestStore,s as disposeRequestStore}from"../../reply-
|
|
11
|
+
import{createLogger}from"../../core/logger.mjs";import{HttpException}from"../../core/errors.mjs";import{_ as unsupportedMediaTypeError,m as parseForm,n as applyHandlerResult,o as createRequestStore,s as disposeRequestStore}from"../../reply-tlUaowib.mjs";import{f as requestStore,i as stringifyJson,r as publishMatchedRoute,t as RequestContext}from"../../context-CRJzl_Mj.mjs";import{validate}from"../middleware/validate.mjs";import{t as applyUploadConfig}from"../../upload-config-Be7w0Dfx.mjs";import"../middleware/upload.mjs";import{t as lazyServeStatic}from"../../lazy-serve-static-D94xvah5.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`),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`})})}const NO_FALLTHROUGH=Symbol(`kickjs.fastify.noFallthrough`);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 rawParts=[],fields={};for await(let part of request.parts())part.type===`file`&&part.toBuffer?rawParts.push({fieldname:part.fieldname,filename:part.filename??``,mimetype:part.mimetype??`application/octet-stream`,buffer:await part.toBuffer()}):fields[part.fieldname]=part.value;let{file,files}=applyUploadConfig(rawParts,entry.meta.upload);raw.file=file,raw.files=files,raw.body={...raw.body,...fields}}let headerId=raw.headers[`x-request-id`],requestId=raw.requestId||(Array.isArray(headerId)?headerId[0]:headerId),store=createRequestStore(requestId);raw.requestId=store.requestId,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()):settleOrFail(reply,mw(request.raw,replyDriver(reply),NOOP_NEXT))})},setErrorHandler(app,mw){app.setErrorHandler((err,request,reply)=>{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.4.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{createLogger}from"../../core/logger.mjs";import{errorHandler,notFoundHandler}from"../middleware/error-handler.mjs";import{i as WebResponseDriver,n as readThrough,r as WebRequestShim,t as compileWebRoute}from"../../handler-
|
|
11
|
+
import{createLogger}from"../../core/logger.mjs";import{errorHandler,notFoundHandler}from"../middleware/error-handler.mjs";import{i as WebResponseDriver,n as readThrough,r as WebRequestShim,t as compileWebRoute}from"../../handler-Cw4mr3ls.mjs";import{t as lazyServeStatic}from"../../lazy-serve-static-D94xvah5.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),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}}return driver.settled||(failure===void 0?builtInNotFound(req,driver,NOOP_NEXT):await builtInError(failure,req,driver,NOOP_NEXT)),driver.ready}const FETCH_CONNECT=/* @__PURE__ */ new WeakMap;function fetchConnectState(event){let state=FETCH_CONNECT.get(event);return state||(state={req:new WebRequestShim(event.req,event.url),headers:new Headers},FETCH_CONNECT.set(event,state)),state}function withConnectHeaders(event,response){let state=FETCH_CONNECT.get(event);if(!state)return response;let missing=[...state.headers].filter(([name])=>name===`set-cookie`||!response.headers.has(name));if(state.headers=new Headers,missing.length===0)return response;try{for(let[name,value]of missing)response.headers.append(name,value);return response}catch{let headers=new Headers(response.headers);for(let[name,value]of missing)headers.append(name,value);return new Response(response.body,{status:response.status,statusText:response.statusText,headers})}}var FetchConnectResponse=class extends WebResponseDriver{prepared;code=200;listeners=[];constructor(prepared,signal){super(signal),this.prepared=prepared}get statusCode(){return this.code}set statusCode(code){this.status(code)}status(code){return this.code=code,super.status(code)}writeHead(code,headers){return this.code=code,super.writeHead(code,headers)}setHeader(name,value){if(Array.isArray(value)){this.prepared.delete(name);for(let v of value)this.prepared.append(name,String(v))}else this.prepared.set(name,String(value));return this}getHeader(name){return this.prepared.get(name)??void 0}hasHeader(name){return this.prepared.has(name)}removeHeader(name){this.prepared.delete(name)}once(event,listener){return this.listeners.push([event,listener]),this}on(event,listener){return this.once(event,listener)}removeListener(event,listener){return this.listeners=this.listeners.filter(([e,l])=>e!==event||l!==listener),this}off(event,listener){return this.removeListener(event,listener)}done(){for(let event of[`finish`,`close`]){for(let[e,listener]of this.listeners)e===event&&listener();this.listeners=this.listeners.filter(([e])=>e!==event)}}};function runConnectOnFetch(mw,event,next){let state=fetchConnectState(event),res=new FetchConnectResponse(state.headers,event.req.signal);return new Promise((resolve,reject)=>{let respond=response=>{res.done(),resolve(withConnectHeaders(event,response))},fail=err=>{res.done(),reject(err)};res.ready.then(respond);let connectNext=err=>{if(err)return fail(err);if(res.settled)return;let id=state.req.requestId;if(id&&event.req.headers.get(`x-request-id`)!==id)try{event.req.headers.set(`x-request-id`,id)}catch{}let downstream;try{downstream=next()}catch(e){return fail(e)}Promise.resolve(downstream).then(value=>{if(value instanceof Response)return respond(value);res.done(),resolve(value)},fail)};try{mw(state.req,res,connectNext)}catch(err){fail(err)}})}function assembleCatchAll(app){let state=app;state[ASSEMBLED]||(state[ASSEMBLED]=!0,app.all(`/**`,event=>{let node=event.req.runtime?.node,next=node?.req?.[NEXT];if(node&&next&&!state[NO_FALLTHROUGH])return new Promise(resolve=>{let done=()=>resolve(H3_HANDLED);node.res.once(`finish`,done),node.res.once(`close`,done),next()});let mw=state[NOTFOUND_MW];return runConnectTerminal(mw,event)}))}function proxyTrust(option){if(option!==void 0&&option!==!1){if(option===!0)return()=>!0;if(typeof option==`number`)return(_address,hop)=>hop<option;if(typeof option==`function`)return option;log.warn(`h3: trustProxy as an address or subnet list is not supported; client IPs use the socket address. Use a hop count or a function instead.`)}}function forwardedClientIp(req,trust){let socket=req.socket?.remoteAddress;if(!socket)return;let header=req.headers[`x-forwarded-for`],chain=[socket,...(Array.isArray(header)?header.join(`,`):header??``).split(`,`).map(s=>s.trim()).filter(Boolean).toReversed()];for(let hop=0;hop<chain.length-1;hop++)if(!trust(chain[hop],hop))return chain[hop];return chain[chain.length-1]}function stripMountPrefix(path,mw){let prefix=path.endsWith(`/`)?path.slice(0,-1):path;return prefix===``?mw:((req,res,next)=>{let url=req.url??`/`,rest=url.startsWith(prefix)?url.slice(prefix.length):null;return rest===null||rest!==``&&rest[0]!==`/`&&rest[0]!==`?`?mw(req,res,next):(req.originalUrl??=url,req.url=rest.startsWith(`/`)?rest:`/${rest}`,mw(req,res,err=>{req.url=url,next(err)}))})}function h3Runtime(options={}){let{H3,toNodeHandler,fromNodeHandler}=loadH3v2(options.h3);return{name:`h3`,createApp(options={}){let holder={},app=new H3({onError:(error,event)=>{let mw=holder.app?.[ERROR_MW];return runConnectTerminal(mw,event,error).then(response=>withConnectHeaders(event,response))}});return holder.app=app,app[NO_FALLTHROUGH]=options.notFoundFallthrough===!1,app[TRUST_PROXY]=proxyTrust(options.trustProxy),app[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]});app.on(entry.method,url,event=>run({request:event.req,url:event.url,params:event.context.params??{},carry:event.req.runtime?.node?.req??FETCH_CONNECT.get(event)?.req}))}},useConnect(app,rawMw,opts){let path=opts?.path;if(Array.isArray(path)){for(let member of path)this.useConnect(app,rawMw,{path:member});return}let mw=typeof path==`string`?stripMountPrefix(path,rawMw):rawMw,viaNode=fromNodeHandler(mw),handler=(event,next)=>event.req.runtime?.node?.res?viaNode(event):runConnectOnFetch(mw,event,next);path instanceof RegExp?app.use((event,next)=>path.test(event.url.pathname)?handler(event,next):next()):typeof path==`string`?app.use(joinPath(path,`/**`),handler):app.use(handler)},serveStatic(app,prefix,dir){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,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import "./settings-
|
|
3
|
-
import { p as EnvKey } from "./decorators-
|
|
2
|
+
import "./settings-BnE75hnr.mjs";
|
|
3
|
+
import { p as EnvKey } from "./decorators-Dvy0JZ5L.mjs";
|
|
4
4
|
import { InferSchemaOutput } from "@forinda/kickjs-schema";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region src/config/env.d.ts
|
|
@@ -158,7 +158,7 @@ declare function resetEnvCache(): void;
|
|
|
158
158
|
* NODE_ENV: v.picklist(['development', 'production', 'test']),
|
|
159
159
|
* }))
|
|
160
160
|
*
|
|
161
|
-
*
|
|
161
|
+
* loadEnvFromSchema(envSchema) // registers the schema; read values with getEnv('PORT')
|
|
162
162
|
* ```
|
|
163
163
|
*/
|
|
164
164
|
/**
|
|
@@ -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-B4aOLoId.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-B4aOLoId.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"}
|
|
@@ -101,6 +101,61 @@ interface PaginatedResponse<T = any> {
|
|
|
101
101
|
hasNext: boolean;
|
|
102
102
|
hasPrev: boolean;
|
|
103
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* Relative links (path + query, never a host) to this page and its
|
|
106
|
+
* neighbours. `next` / `prev` are `null` at the ends.
|
|
107
|
+
*/
|
|
108
|
+
links: {
|
|
109
|
+
self: string;
|
|
110
|
+
next: string | null;
|
|
111
|
+
prev: string | null;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** A JSON primitive stored in a cursor. Dates arrive as ISO strings. */
|
|
115
|
+
type CursorValue = string | number | boolean | null;
|
|
116
|
+
/**
|
|
117
|
+
* Where the previous page ended: the last row's values for the active sort
|
|
118
|
+
* fields plus the id tie-breaker, keyed by field name — e.g.
|
|
119
|
+
* `{ createdAt: '2026-01-01T00:00:00.000Z', id: 'u7' }`.
|
|
120
|
+
*
|
|
121
|
+
* Decoded from a client-supplied cursor and NOT signed: treat it as untrusted
|
|
122
|
+
* input. Bind the values as query parameters and keep filters / authorization
|
|
123
|
+
* scoping in the fetcher, so a forged cursor can only move the position,
|
|
124
|
+
* never widen what the caller may see.
|
|
125
|
+
*/
|
|
126
|
+
type CursorPosition = Readonly<Record<string, CursorValue>>;
|
|
127
|
+
/** What `ctx.paginateCursor()` hands its fetcher. */
|
|
128
|
+
interface CursorQuery<TConfig extends QueryFieldConfig | undefined = undefined> extends Omit<TypedParsedQuery<TConfig>, 'pagination'> {
|
|
129
|
+
/** `null` on the first page. */
|
|
130
|
+
cursor: CursorPosition | null;
|
|
131
|
+
/** Page size. Fetch `limit + 1` rows — the extra one tells whether a next page exists. */
|
|
132
|
+
limit: number;
|
|
133
|
+
}
|
|
134
|
+
/** Options for `ctx.paginateCursor()`. */
|
|
135
|
+
interface CursorPaginateOptions<T = any> {
|
|
136
|
+
/** Unique, stable tie-breaker field read off each row. Default `'id'`. */
|
|
137
|
+
idField?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Build the cursor values from a row yourself, instead of reading the sort
|
|
140
|
+
* fields + `idField` off it (e.g. when the row shape differs from the
|
|
141
|
+
* sortable field names). Values must be JSON primitives.
|
|
142
|
+
*/
|
|
143
|
+
cursorKey?: (row: T) => Record<string, CursorValue>;
|
|
144
|
+
}
|
|
145
|
+
/** Standardized cursor (keyset) paginated response shape */
|
|
146
|
+
interface CursorPaginatedResponse<T = any> {
|
|
147
|
+
data: T[];
|
|
148
|
+
meta: {
|
|
149
|
+
limit: number;
|
|
150
|
+
hasNext: boolean;
|
|
151
|
+
/** Opaque; pass back as `?cursor=` for the next page. `null` on the last page. */
|
|
152
|
+
nextCursor: string | null;
|
|
153
|
+
};
|
|
154
|
+
/** Relative links (path + query, never a host); `next` is `null` on the last page. */
|
|
155
|
+
links: {
|
|
156
|
+
self: string;
|
|
157
|
+
next: string | null;
|
|
158
|
+
};
|
|
104
159
|
}
|
|
105
160
|
/**
|
|
106
161
|
* Interface for ORM-specific query builder adapters.
|
|
@@ -184,7 +239,11 @@ declare function getQueryParsingDefaults(): Readonly<QueryParsingDefaults>;
|
|
|
184
239
|
declare function resetQueryParsingDefaults(): void;
|
|
185
240
|
/** Parse filter strings like "status:eq:active" into structured objects */
|
|
186
241
|
declare function parseFilters(filterParam: string | string[] | undefined, allowedFields?: string[], options?: Pick<ParseQueryOptions, 'onReject'>): FilterItem[];
|
|
187
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* Parse sort into structured items. Accepts `field:asc|desc`, `-field`
|
|
244
|
+
* (descending), and `field` / `+field` (ascending), repeated or
|
|
245
|
+
* comma-separated: `?sort=-featured,price` = `?sort=featured:desc&sort=price:asc`.
|
|
246
|
+
*/
|
|
188
247
|
declare function parseSort(sortParam: string | string[] | undefined, allowedFields?: string[], options?: Pick<ParseQueryOptions, 'onReject'>): SortItem[];
|
|
189
248
|
/** Parse page/limit into pagination with computed offset */
|
|
190
249
|
declare function parsePagination(params: {
|
|
@@ -216,7 +275,7 @@ declare function parseSearchQuery(q: string | undefined, options?: Pick<ParseQue
|
|
|
216
275
|
*
|
|
217
276
|
* Query string format:
|
|
218
277
|
* - Filters: `?filter=field:operator:value` (repeatable)
|
|
219
|
-
* - Sort: `?sort=field:asc|desc`
|
|
278
|
+
* - Sort: `?sort=field:asc|desc`, `-field` / `field`, repeatable or comma-separated
|
|
220
279
|
* - Pagination: `?page=1&limit=20`
|
|
221
280
|
* - Search: `?q=search+term`
|
|
222
281
|
*
|
|
@@ -226,5 +285,5 @@ declare function parseQuery<TConfig extends QueryFieldConfig | undefined = undef
|
|
|
226
285
|
/** Convert ParsedQuery back into query string parameters */
|
|
227
286
|
declare function buildQueryParams(parsed: Partial<ParsedQuery>): Record<string, string | string[] | number>;
|
|
228
287
|
//#endregion
|
|
229
|
-
export {
|
|
230
|
-
//# sourceMappingURL=index-
|
|
288
|
+
export { TypedParsedQuery as A, PaginatedResponse as C, QueryFieldConfig as D, QueryBuilderAdapter as E, SortItem as O, FilterOperator as S, ParsedQuery as T, CursorQuery as _, getQueryParsingDefaults as a, FieldsOf as b, parseQuery as c, resetQueryParsingDefaults as d, setQueryParsingDefaults as f, CursorPosition as g, CursorPaginatedResponse as h, buildQueryParams as i, StringQueryFieldConfig as k, parseSearchQuery as l, CursorPaginateOptions as m, QueryRejectReason as n, parseFilters as o, ColumnQueryFieldConfig as p, QueryRejection as r, parsePagination as s, ParseQueryOptions as t, parseSort as u, CursorValue as v, PaginationParams as w, FilterItem as x, FILTER_OPERATORS as y };
|
|
289
|
+
//# sourceMappingURL=index-Blgka75E.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Blgka75E.d.mts","names":[],"sources":["../src/http/query/types.ts","../src/http/query/parse-query.ts"],"mappings":";;;KACY;cAaC,kBAAgB;UAcZ;EACf;EACA,UAAU;EACV;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;;;;;;;UAQe;EACf,SAAS;EACT,MAAM;EACN,YAAY;EACZ;;;;;;;;;;KAWU,SACV,gBAAgB,8BAChB,sDACE,4BAA4B,KAAK,oBAAoB,UACrD,mBACE,aAEF;EAAkB,eAAe;IAC/B,+BACQ;;;;;;;;;;;;;;;;;;UAqBG,iBACf,gBAAgB,sCACR;EACR,SAAS,MAAM;IAAe,OAAO,SAAS;;EAC9C,MAAM,MAAM;IAAa,OAAO,SAAS;;;;;;;;;;;;;KAa/B,mBAAmB,yBAAyB;UAEvC;EACf;EACA;EACA;;;;;;UAOe;EACf,SAAS;EACT,WAAW;EACX;GACC;;;UAIc,kBAAkB;EACjC,MAAM;EACN;IACE;IACA;IACA;IACA;IACA;IACA;;;;;;EAMF;IAAS;IAAc;IAAqB;;;;KAIlC;;;;;;;;;;;KAYA,iBAAiB,SAAS,eAAe;;UAGpC,YAAY,gBAAgB,kDAAkD,KAC7F,iBAAiB;;EAIjB,QAAQ;;EAER;;;UAIe,sBAAsB;;EAErC;;;;;;EAMA,aAAa,KAAK,MAAM,eAAe;;;UAIxB,wBAAwB;EACvC,MAAM;EACN;IACE;IACA;;IAEA;;;EAGF;IAAS;IAAc;;;;;;;;;;;;;;;;;;;;;;;;;;UA0BR,oBAAoB,eAAe;;WAEzC;;;;;;EAOT,MAAM,QAAQ,aAAa,QAAQ,UAAU;;;;;;;;;KCrNnC;UAEK;EACf;EACA;EACA,QAAQ;;UAGO;;EAEf;;EAEA;;EAEA;;;;;;EAMA,YAAY,WAAW;;UAGf;EACR;EACA;EACA;EACA;;;;;;iBAgBc,wBACd,SAAS,QAAQ,KAAK;;iBAQR,2BAA2B,SAAS;;;;;;;iBAUpC;;iBAOA,aACd,4CACA,0BACA,UAAU,KAAK,iCACd;;;;;;iBAyCa,UACd,0CACA,0BACA,UAAU,KAAK,iCACd;;iBAyCa,gBACd;EACE;EACA;GAEF,UAAU,KAAK,kDACd;;iBAqBa,iBACd,uBACA,UAAU,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkED,WAAW,gBAAgB,0CACzC,OAAO,qBACP,cAAc,SACd,UAAU,oBACT,iBAAiB;;iBAcJ,iBACd,QAAQ,QAAQ,eACf"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { a as SettingsOf, c as defineSettings, i as SettingsDeclaration, l as loadSettings, n as ProvidedSettings, o as ValueOrigin, r as Settings, s as VarOrigin, t as ConfigVar, u as originsOf } from "./settings-
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import { a as
|
|
7
|
-
import {
|
|
2
|
+
import { i as isInjectionToken, n as InjectionToken, r as createToken, t as INJECTION_TOKEN } from "./token-D6jfTQLA.mjs";
|
|
3
|
+
import { a as SettingsOf, c as defineSettings, i as SettingsDeclaration, l as loadSettings, n as ProvidedSettings, o as ValueOrigin, r as Settings, s as VarOrigin, t as ConfigVar, u as originsOf } from "./settings-BnE75hnr.mjs";
|
|
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-Dvy0JZ5L.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-B4aOLoId.mjs";
|
|
6
|
+
import { $ as getMetaMap, A as SseHandler, At as IntrospectionSnapshot, B as AdapterAsyncOptions, Bt as onEnv, C as RuntimeResponse, Ct as KickPlugin, D as DeepReadonly, Dt as KickJsPluginRegistry, E as Ctx, Et as KickJsPluginName, F as ROUTE_URLS, Ft as reportResponse, G as runContributors, H as DefineAdapterOptions, I as RouteName, It as FailureAdvice, J as ContributorSource, K as BuildPipelineOptions, L as UrlBuilder, Lt as AdapterCondition, M as ConditionalOutcome, Mt as ErrorSource, N as Validators, Nt as ResponseInfo, O as RequestContext, Ot as IntrospectFn, P as evaluatePreconditions, Pt as reportError, Q as getClassMetaOrUndefined, R as UrlForArgs, Rt as ConditionOutcome, S as RuntimeCapabilities, St as definePlugin, T as UseConnectOptions, Tt as MutableModuleRegistry, U as defineAdapter, V as AdapterFactory, Vt as onPackage, W as RunContributorsOptions, X as buildPipeline, Y as SourcedRegistration, Z as getClassMeta, _ as RouteEntry, _t as defineModule, a as KickServer, at as pushMethodMeta, b as RouteTable, bt as PluginAsyncOptions, c as ActiveRuntime, ct as setInMetaRecord, d as CtxHandler, dt as disposeAll, et as getMetaRecord, f as ExpressRuntimeTypes, ft as registerDisposable, g as RouteContributor, gt as ModuleFactory, h as MatchedRoute, ht as DefineModuleOptions, i as AppAdapterClass, it as pushClassMeta, jt as ErrorInfo, k as RouteShape, kt as IntrospectionKind, l as AdapterHttp, lt as setMethodMeta, m as KickRuntimeRegister, mt as defineModules, n as AdapterMiddleware, nt as getMethodMetaOrUndefined, o as MiddlewarePath, ot as setClassMeta, p as HttpRuntime, pt as ModuleList, q as ContributorPipeline, r as AppAdapter, rt as hasClassMeta, s as MiddlewarePhase, st as setInMetaMap, t as AdapterContext, tt as getMethodMeta, u as ConnectMiddleware, ut as Disposable, v as RouteMeta, vt as BuildContext, w as RuntimeTypeMap, wt as ModuleRegistry, x as RuntimeAppOptions, xt as PluginFactory, y as RouteMethod, yt as DefinePluginOptions, z as UrlQuery, zt as allOf } from "./adapter-BZ1WzN1z.mjs";
|
|
7
|
+
import { a as tokenName, i as KickJsRegistry, n as ContainerChangeEvent, r as ContainerChangeListener, t as Container } from "./container-4iJdDkRH.mjs";
|
|
8
8
|
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";
|
|
9
|
-
import {
|
|
9
|
+
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";
|
|
10
|
+
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-Cuu-Ma_E.mjs";
|
|
10
11
|
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";
|
|
12
|
+
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-DXFBEYYu.mjs";
|
|
11
13
|
import { a as Cacheable, c as setCacheProvider, i as CacheProvider, n as CacheEvict, o as MemoryCacheProvider, r as CacheOptions, s as getCacheProvider } from "./cache-C0qL0NSD.mjs";
|
|
12
14
|
import { a as describeError, i as createLogger, n as Logger, r as LoggerProvider, t as ConsoleLoggerProvider } from "./logger-xE9qI_FS.mjs";
|
|
13
15
|
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";
|
|
16
|
+
import { $ as HANDLER_CHANNEL, A as getRequestValue, At as mountSort, B as LegacyHasher, Bt as FormatKickErrorOptions, C as TraceContext, Ct as groupAssetKeys, D as requestScopeMiddleware, Dt as MountCycleError, E as traceContext, Et as MissingMountDepError, F as SignedCheck, Ft as CircuitBreaker, G as verifyPassword, H as PasswordHashOptions, Ht as KickErrorInit, I as Signer, It as CircuitBreakerOptions, J as isClusterPrimary, K as defineHttpContextDecorator, L as SignerOptions, Lt as CircuitBreakerState, M as buildRoutes, Mt as DuplicateContributorError, N as expressRuntime, Nt as MissingContextValueError, O as RequestStore, Ot as MountKind, P as materializeRouter, Pt as MissingContributorError, Q as ERROR_CHANNEL, R as VerifyOptions, Rt as CircuitBreakerStats, S as TRACEPARENT_HEADER, St as GroupAssetKeysResult, T as parseTraceparent, Tt as DuplicateMountNameError, U as VerifyPasswordOptions, Ut as formatKickError, V as PasswordCheck, Vt as KickError, W as hashPassword, X as createHandler, Y as KickHandler, Z as bootstrap, _ as SpaAdapterOptions, _t as bindRoutePolicy, a as ConfigOrigins, at as RAW_BODY, b as ViewAdapterOptions, bt as AssetKeyStrategy, c as ServerOptions, ct as metricsAdapter, d as HealthCheckResult, dt as StartupCheck, et as HandlerTraceContext, f as HealthController, ft as StartupCheckError, g as SpaAdapter, gt as RoutePolicyTable, h as healthModule, ht as StartupTimelineSnapshot, i as ConfigDescription, it as KickCronAdapter, j as requestStore, jt as ContributorCycleError, k as getRequestStore, kt as MountSortItem, lt as CheckContext, m as HealthProbe, mt as StartupStep, n as Application, nt as CRON_WORKER_ENV, o as MiddlewareEntry, ot as MetricsOptions, p as HealthModuleConfig, pt as defineCheck, q as ClusterOptions, r as ApplicationOptions, rt as CronAdapterOptions, s as MountedRouteInfo, st as RequestHistogram, t as APPLICATION, tt as RESPONSE_CHANNEL, u as HEALTH_PROBE, ut as CheckMessage, vt as offerRoutePolicy, w as TraceContextOptions, wt as stripExt, xt as GroupAssetKeysOptions, y as ViewAdapter, yt as AssetKeyPair, z as createSigner, zt as CircuitOpenError } from "./application-D5Iiy7rt.mjs";
|
|
14
17
|
import { n as joinPaths, r as normalizePath, t as buildMountPath } from "./path-CMwIHsdv.mjs";
|
|
15
18
|
import { a as isRef, c as toRefs, i as computed, l as unref, n as Ref, o as reactive, r as WatchOptions, s as ref, t as ComputedRef, u as watch } from "./reactivity-BkMNA0kp.mjs";
|
|
19
|
+
import { a as SessionStore, i as SessionOptions, n as Session, o as session, r as SessionData } from "./session-ChXx7jG5.mjs";
|
|
20
|
+
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";
|
|
16
21
|
import { a as validate, i as defaultValidationError, n as ValidationFailure, t as ValidationErrorFactory } from "./validate-CzjCbRUn.mjs";
|
|
17
22
|
import { n as allowedHosts, t as AllowedHostsOptions } from "./allowed-hosts-D6qcuK5I.mjs";
|
|
23
|
+
import { i as buildRouteTable, t as BuildRoutesOptions } from "./router-builder-BewIsj7V.mjs";
|
|
18
24
|
import { n as requestId, t as REQUEST_ID_HEADER } from "./request-id-CVzJ1uHD.mjs";
|
|
19
|
-
import {
|
|
25
|
+
import { n as errorHandler, r as notFoundHandler } from "./error-handler-CbP7hKdJ.mjs";
|
|
26
|
+
import { i as csrfGuard, n as CsrfOptions, r as csrf, t as CsrfGuardOptions } from "./csrf-BDAZK2mm.mjs";
|
|
20
27
|
import { i as requestLogger, n as LoggedResponse, r as RequestLoggerOptions, t as LoggedRequest } from "./request-logger-TgcKRNDD.mjs";
|
|
21
28
|
import { n as HelmetOptions, r as helmet } from "./helmet-CEOmo516.mjs";
|
|
22
29
|
import { n as breachPadding, t as BreachPaddingOptions } from "./breach-padding-C-Dnq8CS.mjs";
|
|
23
30
|
import { n as cors, t as CorsOptions } from "./cors-2Bwhyhpt.mjs";
|
|
24
31
|
import { i as rateLimit, n as RateLimitOptions, r as RateLimitStore } from "./rate-limit-BgoeahE5.mjs";
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
export { 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, 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, 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 ConnectMiddleware, ConsoleLoggerProvider, type Constructor, Container, type ContainerChangeEvent, type ContainerChangeListener, type ContextDecorator, type ContextDecoratorRequiringParams, type ContextDecoratorSpec, type ContextDecoratorTarget, type ContextDecoratorWithDefaults, type ContextKeys, type ContextMeta, type ContextMetaKey, ContributorCycleError, type ContributorPipeline, type ContributorRegistration, type ContributorRegistrations, type ContributorSource, Controller, type CorsOptions, Cron, type CronAdapterOptions, type CronJob, type CronJobMeta, type CronOptions, type CronRun, type CsrfGuardOptions, type CsrfOptions, type Ctx, type CtxHandler, type DeepReadonly, type DefineAdapterOptions, type DefineModuleOptions, type DefinePluginOptions, Delete, type DepValue, type Disposable, DuplicateContributorError, DuplicateMountNameError, ERROR_CHANNEL, type Env, type EnvKey, type ErrorInfo, type ErrorSource, type ExecutionContext, type ExpressRuntimeTypes, FILTER_OPERATORS, type FailureAdvice, type FieldsOf, type FileTypeFilter, FileUpload, type FileUploadConfig, type FilterItem, type FilterOperator, type FormatKickErrorOptions, Get, type GroupAssetKeysOptions, type GroupAssetKeysResult, HANDLER_CHANNEL, HEALTH_PROBE, type HandlerTraceContext, type HealthCheckResult, HealthController, type HealthModuleConfig, type HealthProbe, type HelmetOptions, HttpException, type HttpRuntime, HttpStatus, type HttpStatusCode, INJECTION_TOKEN, type InferHandlerResponse, Inject, Injectable, type InjectionToken, type IntrospectFn, type IntrospectionKind, type IntrospectionSnapshot, JOB_CONTEXT_FIELD, JOB_DISPATCHER, JOB_META, Job, type JobContextCarrier, type JobDispatcher, type JobHandler, type JobLike, type KickAssets, KickCronAdapter, KickError, type KickErrorInit, type KickHandler, type KickJsPluginName, type KickJsPluginRegistry, type KickJsRegistry, type KickPlugin, type KickRouteFlags, type KickRuntimeRegister, type KickServer, type KvLike, KvRateLimitStore, type KvRateLimitStoreOptions, KvSessionStore, type KvSessionStoreOptions, type LegacyHasher, type LoggedRequest, type LoggedResponse, Logger, type LoggerProvider, METADATA, 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, type PaginatedResponse, type PaginationParams, type ParseQueryOptions, type ParsedQuery, type PasswordCheck, type PasswordHashOptions, Patch, type PlatformContext, type PluginAsyncOptions, type PluginFactory, 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 Reply, 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, 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 UrlBuilder, type UrlForArgs, type UrlQuery, type UseConnectOptions, type ValidationError, type ValidationErrorFactory, type ValidationFailure, type Validators, Value, type ValueOrigin, type ValuedRouteFlag, type VarOrigin, type VerifyOptions, type VerifyPasswordOptions, ViewAdapter, type ViewAdapterOptions, type WatchOptions, allOf, allowedHosts, applyHandlerResult, assertFlagTest, assets, baseEnvSchema, bindRoutePolicy, bootstrap, breachPadding, buildMountPath, buildPipeline, buildQueryParams, buildRouteTable, buildRoutes, buildUploadMiddleware, cleanupFiles, clearAssetCache, computed, cors, createConfigService, createHandler, createLogger, createSigner, createToken, cronScheduleId, csrf, csrfGuard, defaultProblemTitle, defaultValidationError, defineAdapter, defineCheck, defineContextDecorator, defineEnv, defineHttpContextDecorator, defineModule, defineModules, definePlugin, defineRouteFlag, defineSettings, describeError, disposeAll, errorHandler, evaluatePreconditions, expressRuntime, 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, matchesFlagTest, materializeRouter, metricsAdapter, mountSort, normalizeApiQueryParamsConfig, normalizePath, normalizeProblem, notFoundHandler, offerRoutePolicy, 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, toRefs, tokenName, traceContext, unref, upload, useAssets, validate, verifyPassword, waitUntil, watch, withBuilder, withEnv };
|
|
32
|
+
import { i as upload, l as resolveMimeTypes, n as buildUploadMiddleware, r as cleanupFiles, t as UploadOptions } from "./upload-DkT2p1gd.mjs";
|
|
33
|
+
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, 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, 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 ConnectMiddleware, ConsoleLoggerProvider, type Constructor, Container, type ContainerChangeEvent, type ContainerChangeListener, type ContextDecorator, type ContextDecoratorRequiringParams, type ContextDecoratorSpec, type ContextDecoratorTarget, type ContextDecoratorWithDefaults, type ContextKeys, type ContextMeta, type ContextMetaKey, ContributorCycleError, type ContributorPipeline, type ContributorRegistration, type ContributorRegistrations, type ContributorSource, Controller, type CorsOptions, Cron, type CronAdapterOptions, type CronJob, type CronJobMeta, type CronOptions, type CronRun, type CsrfGuardOptions, type CsrfOptions, type Ctx, type CtxHandler, type 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, type ExpressRuntimeTypes, FILTER_OPERATORS, type FailureAdvice, type FieldsOf, type FileTypeFilter, FileUpload, type FileUploadConfig, type FilterItem, type FilterOperator, type FormatKickErrorOptions, Get, type GroupAssetKeysOptions, type GroupAssetKeysResult, HANDLER_CHANNEL, HEALTH_PROBE, type HandlerTraceContext, type HealthCheckResult, HealthController, type HealthModuleConfig, type HealthProbe, type HelmetOptions, HttpException, type HttpRuntime, HttpStatus, type HttpStatusCode, INJECTION_TOKEN, type InferHandlerResponse, Inject, Injectable, type InjectionToken, type IntrospectFn, type IntrospectionKind, type IntrospectionSnapshot, JOB_CONTEXT_FIELD, JOB_DISPATCHER, JOB_META, Job, type JobContextCarrier, type JobDispatcher, type JobHandler, type JobLike, type KickAssets, KickCronAdapter, KickError, type KickErrorInit, type KickHandler, type KickJsPluginName, type KickJsPluginRegistry, type KickJsRegistry, type KickPlugin, type KickRouteFlags, type KickRuntimeRegister, type KickServer, type KvLike, KvRateLimitStore, type KvRateLimitStoreOptions, KvSessionStore, type KvSessionStoreOptions, type LegacyHasher, type LoggedRequest, type LoggedResponse, Logger, type LoggerProvider, METADATA, 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, type PaginatedResponse, type PaginationParams, type ParseQueryOptions, type ParsedQuery, type PasswordCheck, type PasswordHashOptions, Patch, type PlatformContext, type PluginAsyncOptions, type PluginFactory, 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 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, 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 UrlBuilder, type UrlForArgs, type UrlQuery, type UseConnectOptions, type ValidationError, type ValidationErrorFactory, type ValidationFailure, type Validators, Value, type ValueOrigin, type ValuedRouteFlag, type VarOrigin, type VerifyOptions, type VerifyPasswordOptions, ViewAdapter, type ViewAdapterOptions, type WatchOptions, allOf, allowedHosts, applyHandlerResult, assertFlagTest, assets, baseEnvSchema, bindRoutePolicy, bootstrap, breachPadding, buildMountPath, buildPipeline, buildQueryParams, buildRouteTable, buildRoutes, buildUploadMiddleware, cleanupFiles, clearAssetCache, computed, cors, createConfigService, createHandler, createLogger, createSigner, createToken, cronScheduleId, csrf, csrfGuard, defaultProblemTitle, defaultValidationError, defineAdapter, defineCheck, defineContextDecorator, defineEnv, defineHttpContextDecorator, defineModule, defineModules, definePlugin, defineRouteFlag, defineSettings, describeError, disposeAll, errorHandler, evaluatePreconditions, expressRuntime, 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, 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, toRefs, tokenName, traceContext, unref, upload, useAssets, validate, verifyPassword, waitUntil, watch, withBuilder, withEnv };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v10.
|
|
2
|
+
* @forinda/kickjs v10.4.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
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-
|
|
11
|
+
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-CLeX6hbL.mjs";import{o as KickError,s as formatKickError}from"./di-hooks-CiNaIu12.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{n as createToken,r as isInjectionToken,t as INJECTION_TOKEN}from"./token-2CJq89za.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-Bm65Y-5O.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-EQsmb3yi.mjs";import{i as reportResponse,r as reportError}from"./observers-BAXkwMx0.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-xqoMmdr4.mjs";import{CacheEvict,Cacheable,MemoryCacheProvider,getCacheProvider,setCacheProvider}from"./core/cache.mjs";import{r as registerDisposable,t as disposeAll}from"./disposables-DYTkgNiG.mjs";import{HttpException,HttpStatus,ProblemException,Problems,defaultProblemTitle,normalizeProblem}from"./core/errors.mjs";import{buildMountPath,joinPaths,normalizePath}from"./core/path.mjs";import{computed,isRef,reactive,ref,toRefs,unref,watch}from"./core/reactivity.mjs";import{l as resolveRouteFlags,n as assertFlagTest,o as getRouteFlags,r as defineRouteFlag,s as matchesFlagTest}from"./route-flag-BPSq2JCs.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-CsMDdzNE.mjs";import{i as MissingContributorError,n as DuplicateContributorError,r as MissingContextValueError,t as ContributorCycleError}from"./context-errors-CR5NCXfl.mjs";import{i as buildPipeline,r as buildRouteTable}from"./router-builder-DoaDAmK8.mjs";import{t as runContributors}from"./contributor-runner--ofCRZ0d.mjs";import{_ as DuplicateMountNameError,a as materializeRouter,b as mountSort,c as healthModule,d as allOf,f as onEnv,g as RESPONSE_CHANNEL,h as HANDLER_CHANNEL,i as expressRuntime,l as StartupCheckError,m as ERROR_CHANNEL,n as Application,o as HEALTH_PROBE,p as onPackage,r as buildRoutes,s as HealthController,t as APPLICATION,u as defineCheck,v as MissingMountDepError,y as MountCycleError}from"./application-Bs30gJF1.mjs";import{t as defineAdapter}from"./define-adapter-RbKRSG3i.mjs";import{n as bindRoutePolicy,r as offerRoutePolicy,t as RoutePolicyTable}from"./route-policy-DDszB6dQ.mjs";import{n as randomHex,t as matchesBearer}from"./web-crypto-G-m6c6w2.mjs";import{a as reply,d as RAW_BODY,i as isRespondable,l as requestScopeMiddleware,n as applyHandlerResult,r as isReply,t as RESPOND}from"./reply-tlUaowib.mjs";import{REQUEST_ID_HEADER,requestId}from"./http/middleware/request-id.mjs";import{a as evaluatePreconditions,c as settleBackgroundWork,d as getRequestValue,f as requestStore,l as waitUntil,t as RequestContext,u as getRequestStore}from"./context-CRJzl_Mj.mjs";import{errorHandler,notFoundHandler}from"./http/middleware/error-handler.mjs";import{allowedHosts}from"./http/middleware/allowed-hosts.mjs";import{a as originsOf,i as loadSettings,n as defineSettings}from"./settings-CRkMOwcz.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-CGyw7vNi.mjs";import{defaultValidationError,validate}from"./http/middleware/validate.mjs";import{r as resolveMimeTypes}from"./upload-config-Be7w0Dfx.mjs";import{buildUploadMiddleware,cleanupFiles,upload}from"./http/middleware/upload.mjs";import{a as KickCronAdapter,i as CRON_WORKER_ENV,n as createHandler,r as isClusterPrimary,t as bootstrap}from"./bootstrap-B_sGJNSz.mjs";import{csrf,csrfGuard}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-0-6blGzh.mjs";import{session}from"./http/middleware/session.mjs";import{ViewAdapter}from"./http/middleware/views.mjs";import{SpaAdapter}from"./http/middleware/spa.mjs";import{n as createConfigService,t as ConfigService}from"./config-B6EeAw4P.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 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
|
-
`)}};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),
|
|
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
|
|
|
15
|
-
`)};return{name:`MetricsAdapter`,beforeMount({http}){loop=monitorEventLoopDelay({resolution:20}),loop.enable(),http.route(`GET`,path,ctx=>{let
|
|
15
|
+
`)};return{name:`MetricsAdapter`,beforeMount({http}){loop=monitorEventLoopDelay({resolution:20}),loop.enable(),http.route(`GET`,path,ctx=>{let{token}=options;if(token!==void 0&&!matchesBearer(ctx.headers.authorization,token)){ctx.setHeader(`WWW-Authenticate`,`Bearer`),ctx.json({message:`Unauthorized`},401);return}let body=render();loop?.reset(),ctx.setHeader(`Cache-Control`,`no-store`),ctx.send(`${body}\n`,{type:`text/plain; version=0.0.4; charset=utf-8`})})},onResponse(info){info.route!==path&&histogram.observe(info)},shutdown(){loop?.disable()}}}function defineHttpContextDecoratorImpl(spec){return defineContextDecorator(spec)}const defineHttpContextDecorator=Object.freeze(Object.assign(defineHttpContextDecoratorImpl,{withParams:()=>spec=>defineHttpContextDecoratorImpl(spec)})),DEFAULTS={N:2**14,r:8,p:5};function derive(password,salt,cost){let options={...cost,maxmem:128*cost.r*(cost.N+cost.p+2)+1048576};return new Promise((resolve,reject)=>scrypt(password.normalize(`NFKC`),salt,64,options,(err,key)=>err?reject(err):resolve(key)))}function costOf(options){let cost={...DEFAULTS,...options};if(!Number.isInteger(Math.log2(cost.N))||cost.N<2)throw Error(`hashPassword: N must be a power of two`);return cost}async function hashPassword(password,options={}){let cost=costOf(options),salt=randomBytes(16),encoded=[salt,await derive(password,salt,cost)].map(bytes=>bytes.toString(`base64`));return[`scrypt`,cost.N,cost.r,cost.p,...encoded].join(`$`)}const DUMMY_SALT=randomBytes(16);async function verifyPassword(password,stored,options={}){let{legacy=[],...scryptCost}=options,parsed=stored?parse(stored):void 0,older=!parsed&&stored?legacy.find(hasher=>matches(hasher,stored)):void 0,[scrypt,checks]=await Promise.all([parsed?derive(password,parsed.salt,parsed.cost).catch(()=>void 0):derive(password,DUMMY_SALT,costOf(scryptCost)),Promise.all(legacy.map(hasher=>check(hasher,password,hasher===older?stored:hasher.dummy)))]);if(older){let ok=checks[legacy.indexOf(older)];return{ok,needsRehash:ok}}if(!parsed||!scrypt)return{ok:!1,needsRehash:!1};let ok=scrypt.length===parsed.key.length&&timingSafeEqual(scrypt,parsed.key),wanted=costOf(scryptCost);return{ok,needsRehash:ok&&(parsed.cost.N!==wanted.N||parsed.cost.r!==wanted.r||parsed.cost.p!==wanted.p)}}function matches(hasher,stored){try{return hasher.matches(stored)===!0}catch{return!1}}function check(hasher,password,hash){return Promise.resolve().then(()=>hasher.verify(password,hash)).then(result=>result===!0,()=>!1)}function parse(stored){let[algorithm,N,r,pp,salt,key]=stored.split(`$`);if(algorithm!==`scrypt`||key===void 0)return;let cost={N:Number(N),r:Number(r),p:Number(pp)};if(!(!Number.isInteger(Math.log2(cost.N))||cost.N<2||!Number.isInteger(cost.r)||cost.r<1||cost.r>32||!Number.isInteger(cost.p)||cost.p<1||cost.p>16||128*cost.N*cost.r>2**28))return{cost,salt:Buffer.from(salt,`base64`),key:Buffer.from(key,`base64`)}}function createSigner(options){let secrets=Array.isArray(options.secret)?options.secret:[options.secret];if(secrets.length===0||secrets.some(s=>typeof s!=`string`||s.length===0))throw Error("createSigner: `secret` must be a non-empty string or list of strings");if(!options.salt)throw Error("createSigner: `salt` names what the tokens are for");let keys=secrets.map(secret=>createHmac(`sha256`,secret).update(`kickjs.signing:${options.salt}`).digest()),mac=(key,data)=>createHmac(`sha256`,key).update(data).digest(`base64url`);return{sign(value){let json=JSON.stringify(value);if(json===void 0)throw Error(`signer.sign: the value must be JSON-serialisable`);let signed=`${Buffer.from(json).toString(`base64url`)}.${Date.now().toString(36)}`;return`${signed}.${mac(keys[0],signed)}`},verify(token,verifyOptions={}){let invalid={ok:!1,reason:`invalid`};if(typeof token!=`string`)return invalid;let cut=token.lastIndexOf(`.`),signed=token.slice(0,cut),signature=Buffer.from(token.slice(cut+1)),[payload,stamp,extra]=signed.split(`.`);if(cut<0||stamp===void 0||extra!==void 0||!keys.some(key=>{let expected=Buffer.from(mac(key,signed));return expected.length===signature.length&&timingSafeEqual(expected,signature)}))return invalid;let issued=parseInt(stamp,36);if(!Number.isFinite(issued))return invalid;if(verifyOptions.maxAge!==void 0&&Date.now()-issued>verifyOptions.maxAge)return{ok:!1,reason:`expired`};try{return{ok:!0,value:JSON.parse(Buffer.from(payload,`base64url`).toString()),issuedAt:new Date(issued)}}catch{return invalid}}}}const TRACEPARENT_HEADER=`traceparent`,TRACEPARENT_RE=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;function generateTraceId(){return randomHex(16)}function generateSpanId(){return randomHex(8)}function parseTraceparent(header){let match=TRACEPARENT_RE.exec(header.trim().toLowerCase());if(!match)return null;let version=match[1],traceId=match[2],parentSpanId=match[3],flags=match[4];return version===`ff`||traceId===`00000000000000000000000000000000`||parentSpanId===`0000000000000000`?null:{version,traceId,parentSpanId,flags}}function traceContext(options={}){return(req,res,next)=>{let store=requestStore.getStore(),traceparentHeader=req.headers[TRACEPARENT_HEADER],raw=Array.isArray(traceparentHeader)?traceparentHeader[0]:traceparentHeader,parsed=raw?parseTraceparent(raw):null,traceId=parsed?.traceId??generateTraceId(),spanId=generateSpanId();store&&(store.values.set(`traceId`,traceId),store.values.set(`spanId`,spanId),parsed&&(store.values.set(`parentSpanId`,parsed.parentSpanId),store.values.set(`traceFlags`,parsed.flags),store.values.set(`traceVersion`,parsed.version))),req.traceId=traceId,req.spanId=spanId,options.propagateResponse&&res.setHeader(`traceresponse`,traceId),next()}}export{APPLICATION,ASSETS,ASSET_MANIFEST_VERSION,ApiQueryParams,Application,Asset,Autowired,Builder,CRON_META,CRON_WORKER_ENV,CacheEvict,Cacheable,CircuitBreaker,CircuitOpenError,Component,ConfigService,ConsoleLoggerProvider,Container,ContributorCycleError,Controller,Cron,Delete,DuplicateContributorError,DuplicateMountNameError,ERROR_CHANNEL,FILTER_OPERATORS,FileUpload,Get,HANDLER_CHANNEL,HEALTH_PROBE,HealthController,HttpException,HttpStatus,INJECTION_TOKEN,Inject,Injectable,JOB_CONTEXT_FIELD,JOB_DISPATCHER,JOB_META,Job,KickCronAdapter,KickError,KvRateLimitStore,KvSessionStore,Logger,METADATA,MemoryCacheProvider,Middleware,MissingContextValueError,MissingContributorError,MissingMountDepError,ModuleList,MountCycleError,MutableModuleRegistry,NoJobHandlerError,Patch,Post,PostConstruct,PreDestroy,ProblemException,Problems,Process,Put,RAW_BODY,REQUEST_ID_HEADER,RESPOND,RESPONSE_CHANNEL,ROUTE_URLS,Repository,RequestContext,RequestHistogram,RoutePolicyTable,Scope,Service,SpaAdapter,StartupCheckError,TRACEPARENT_HEADER,UnknownAssetError,Value,ViewAdapter,allOf,allowedHosts,applyHandlerResult,assertFlagTest,assets,baseEnvSchema,bindRoutePolicy,bootstrap,breachPadding,buildMountPath,buildPipeline,buildQueryParams,buildRouteTable,buildRoutes,buildUploadMiddleware,cleanupFiles,clearAssetCache,computed,cors,createConfigService,createHandler,createLogger,createSigner,createToken,cronScheduleId,csrf,csrfGuard,defaultProblemTitle,defaultValidationError,defineAdapter,defineCheck,defineContextDecorator,defineEnv,defineHttpContextDecorator,defineModule,defineModules,definePlugin,defineRouteFlag,defineSettings,describeError,disposeAll,errorHandler,evaluatePreconditions,expressRuntime,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,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,toRefs,tokenName,traceContext,unref,upload,useAssets,validate,verifyPassword,waitUntil,watch,withBuilder,withEnv};
|
|
16
16
|
//# sourceMappingURL=index.mjs.map
|