yinzerflow 0.2.1 → 0.2.2
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/YinzerFlow.d.ts +54 -18
- package/YinzerFlow.js +13 -15
- package/YinzerFlow.js.map +18 -17
- package/docs/advanced-configuration-options.md +11 -2
- package/docs/logging.md +334 -0
- package/package.json +2 -2
- package/example/index.ts +0 -119
package/YinzerFlow.js.map
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../node_modules/dayjs/dayjs.min.js", "../app/core/YinzerFlow.ts", "../app/core/execution/RequestHandlerImpl.ts", "../app/constants/http.ts", "../app/core/
|
|
3
|
+
"sources": ["../node_modules/dayjs/dayjs.min.js", "../app/core/YinzerFlow.ts", "../app/core/execution/RequestHandlerImpl.ts", "../app/constants/http.ts", "../app/core/utils/cors.ts", "../app/core/utils/networkLog.ts", "../app/core/utils/log.ts", "../app/core/execution/utils/parseJson.ts", "../app/core/execution/utils/parseMultipart.ts", "../app/core/execution/utils/parseUrlEncodedForm.ts", "../app/core/execution/utils/determineEncoding.ts", "../app/core/execution/utils/inferContentType.ts", "../app/core/execution/utils/parseBody.ts", "../app/core/utils/string.ts", "../app/core/execution/utils/parseHttpRequest.ts", "../app/core/execution/utils/parseQuery.ts", "../app/core/execution/utils/parseIpAddress.ts", "../app/core/execution/utils/extractBoundaryFromHeader.ts", "../app/core/execution/utils/parseRequestHeaders.ts", "../app/core/execution/RequestImpl.ts", "../app/core/execution/ResponseImpl.ts", "../app/core/execution/utils/formatBodyIntoString.ts", "../app/core/execution/utils/mapStatusCodeToMessage.ts", "../app/core/execution/utils/validateResponseHeaders.ts", "../app/core/execution/utils/determineContentLength.ts", "../app/core/execution/ContextImpl.ts", "../app/constants/log.ts", "../app/core/setup/utils/handleCustomConfiguration.ts", "../app/core/execution/HookRegistryImpl.ts", "../app/core/setup/utils/compileRoutePatter.ts", "../app/core/setup/utils/normalizeStringPatterns.ts", "../app/core/setup/utils/validateParameterNames.ts", "../app/core/setup/RouteRegistryImpl.ts", "../app/core/setup/SetupImpl.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define(e):(t=\"undefined\"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){\"use strict\";var t=1e3,e=6e4,n=36e5,r=\"millisecond\",i=\"second\",s=\"minute\",u=\"hour\",a=\"day\",o=\"week\",c=\"month\",f=\"quarter\",h=\"year\",d=\"date\",l=\"Invalid Date\",$=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,y=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:\"en\",weekdays:\"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday\".split(\"_\"),months:\"January_February_March_April_May_June_July_August_September_October_November_December\".split(\"_\"),ordinal:function(t){var e=[\"th\",\"st\",\"nd\",\"rd\"],n=t%100;return\"[\"+t+(e[(n-20)%10]||e[n]||e[0])+\"]\"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:\"\"+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?\"+\":\"-\")+m(r,2,\"0\")+\":\"+m(i,2,\"0\")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||\"\").toLowerCase().replace(/s$/,\"\")},u:function(t){return void 0===t}},g=\"en\",D={};D[g]=M;var p=\"$isDayjsObject\",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if(\"string\"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split(\"-\");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n=\"object\"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if(\"string\"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||\"0\").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate(\"s\"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v=\"set\"+(this.$u?\"UTC\":\"\");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+\"Hours\",0);case u:return $(v+\"Minutes\",1);case s:return $(v+\"Seconds\",2);case i:return $(v+\"Milliseconds\",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f=\"set\"+(this.$u?\"UTC\":\"\"),l=(n={},n[a]=f+\"Date\",n[d]=f+\"Date\",n[c]=f+\"Month\",n[h]=f+\"FullYear\",n[u]=f+\"Hours\",n[s]=f+\"Minutes\",n[i]=f+\"Seconds\",n[r]=f+\"Milliseconds\",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||\"YYYY-MM-DDTHH:mm:ssZ\",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,\"0\")},$=f||function(t,e,n){var r=t<12?\"AM\":\"PM\";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case\"YY\":return String(e.$y).slice(-2);case\"YYYY\":return b.s(e.$y,4,\"0\");case\"M\":return a+1;case\"MM\":return b.s(a+1,2,\"0\");case\"MMM\":return h(n.monthsShort,a,c,3);case\"MMMM\":return h(c,a);case\"D\":return e.$D;case\"DD\":return b.s(e.$D,2,\"0\");case\"d\":return String(e.$W);case\"dd\":return h(n.weekdaysMin,e.$W,o,2);case\"ddd\":return h(n.weekdaysShort,e.$W,o,3);case\"dddd\":return o[e.$W];case\"H\":return String(s);case\"HH\":return b.s(s,2,\"0\");case\"h\":return d(1);case\"hh\":return d(2);case\"a\":return $(s,u,!0);case\"A\":return $(s,u,!1);case\"m\":return String(u);case\"mm\":return b.s(u,2,\"0\");case\"s\":return String(e.$s);case\"ss\":return b.s(e.$s,2,\"0\");case\"SSS\":return b.s(e.$ms,3,\"0\");case\"Z\":return i}return null}(t)||i.replace(\":\",\"\")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[[\"$ms\",r],[\"$s\",i],[\"$m\",s],[\"$H\",u],[\"$W\",a],[\"$M\",c],[\"$y\",h],[\"$D\",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));",
|
|
6
|
-
"import { createServer } from 'net';\nimport type { Socket } from 'net';\n\nimport { RequestHandlerImpl } from '@core/execution/RequestHandlerImpl.ts';\nimport { ContextImpl } from '@core/execution/ContextImpl.ts';\nimport { SetupImpl } from '@core/setup/SetupImpl.ts';\nimport { log } from '@core/utils/log.ts';\nimport {
|
|
7
|
-
"import dayjs from 'dayjs';\nimport type { SetupImpl } from '@core/setup/SetupImpl.ts';\nimport type { InternalContextImpl } from '@typedefs/internal/InternalContextImpl.ts';\nimport type { InternalSetupImpl } from '@typedefs/internal/InternalSetupImpl.js';\nimport {
|
|
8
|
-
"/**\n * HTTP Constants\n *\n * This file contains all HTTP-related constants used throughout the application.\n * Centralizing these constants makes them easier to maintain and ensures consistency.\n */\n\n/**\n * HTTP Status Text\n * Maps status codes to their standard text representations\n */\nexport const httpStatus = {\n ok: 'OK',\n created: 'Created',\n accepted: 'Accepted',\n noContent: 'No Content',\n movedPermanently: 'Moved Permanently',\n found: 'Found',\n notModified: 'Not Modified',\n badRequest: 'Bad Request',\n unauthorized: 'Unauthorized',\n forbidden: 'Forbidden',\n notFound: 'Not Found',\n methodNotAllowed: 'Method Not Allowed',\n conflict: 'Conflict',\n unsupportedMediaType: 'Unsupported Media Type',\n tooManyRequests: 'Too Many Requests',\n internalServerError: 'Internal Server Error',\n} as const;\n\n/**\n * HTTP Status Codes\n * Standard HTTP status codes used in responses\n */\nexport const httpStatusCode = {\n ok: 200,\n created: 201,\n accepted: 202,\n noContent: 204,\n movedPermanently: 301,\n found: 302,\n notModified: 304,\n badRequest: 400,\n unauthorized: 401,\n forbidden: 403,\n notFound: 404,\n methodNotAllowed: 405,\n conflict: 409,\n unsupportedMediaType: 415,\n tooManyRequests: 429,\n internalServerError: 500,\n} as const;\n\n/**\n * HTTP Methods\n * Standard HTTP methods used in requests\n */\nexport const httpMethod = {\n delete: 'DELETE',\n get: 'GET',\n head: 'HEAD',\n post: 'POST',\n put: 'PUT',\n patch: 'PATCH',\n options: 'OPTIONS',\n} as const;\n\n/**\n * Common Content Types\n * Frequently used content types for HTTP communication\n */\nexport const contentType = {\n json: 'application/json',\n html: 'text/html',\n form: 'application/x-www-form-urlencoded',\n multipart: 'multipart/form-data',\n xml: 'application/xml',\n text: 'text/plain',\n csv: 'text/csv',\n yamlApplication: 'application/yaml',\n yamlText: 'text/yaml',\n urlEncodedJson: 'application/x-www-form-urlencoded+json',\n} as const;\n\n/**\n * HTTP header names organized by category\n * Use with CreateEnum to get type-safe header names with intellisense\n */\nexport const httpHeaders = {\n // Authentication & Authorization\n authorization: 'Authorization', // Bearer tokens, Basic auth, etc.\n proxyAuthorization: 'Proxy-Authorization', // Auth through proxy\n wwwAuthenticate: 'WWW-Authenticate', // Server auth challenge\n\n // Caching & Validation\n cacheControl: 'Cache-Control', // Cache directives\n etag: 'ETag', // Resource version identifier\n expires: 'Expires', // Cache expiration date\n lastModified: 'Last-Modified', // Resource modification date\n ifMatch: 'If-Match', // Conditional request based on ETag\n ifNoneMatch: 'If-None-Match', // Conditional request based on ETag\n ifModifiedSince: 'If-Modified-Since', // Conditional request based on date\n ifUnmodifiedSince: 'If-Unmodified-Since', // Conditional request based on date\n ifRange: 'If-Range', // Conditional range request\n age: 'Age', // Time in proxy cache\n vary: 'Vary', // Response varies based on headers\n\n // Content Information\n contentType: 'Content-Type', // Media type of content\n contentLength: 'Content-Length', // Size in bytes\n contentEncoding: 'Content-Encoding', // Compression method\n contentLanguage: 'Content-Language', // Natural language\n contentDisposition: 'Content-Disposition', // Inline vs attachment\n contentLocation: 'Content-Location', // Alternate location\n contentRange: 'Content-Range', // Partial content range\n\n // CORS (Cross-Origin Resource Sharing)\n accessControlAllowCredentials: 'Access-Control-Allow-Credentials', // Allow credentials in CORS\n accessControlAllowHeaders: 'Access-Control-Allow-Headers', // Allowed request headers\n accessControlAllowMethods: 'Access-Control-Allow-Methods', // Allowed HTTP methods\n accessControlAllowOrigin: 'Access-Control-Allow-Origin', // Allowed origins\n accessControlExposeHeaders: 'Access-Control-Expose-Headers', // Exposed response headers\n accessControlMaxAge: 'Access-Control-Max-Age', // Preflight cache duration\n accessControlRequestHeaders: 'Access-Control-Request-Headers', // Preflight request headers\n accessControlRequestMethod: 'Access-Control-Request-Method', // Preflight request method\n\n // Request Information\n accept: 'Accept', // Acceptable media types\n acceptEncoding: 'Accept-Encoding', // Acceptable encodings\n acceptLanguage: 'Accept-Language', // Acceptable languages\n acceptRanges: 'Accept-Ranges', // Server supports ranges\n host: 'Host', // Target host and port\n userAgent: 'User-Agent', // Client software info\n referer: 'Referer', // Previous page URL\n origin: 'Origin', // Request origin\n from: 'From', // User email address\n expect: 'Expect', // Server requirements\n\n // Response Information\n location: 'Location', // Redirect URL\n server: 'Server', // Server software info\n date: 'Date', // Message timestamp\n allow: 'Allow', // Supported HTTP methods\n retryAfter: 'Retry-After', // Retry delay\n\n // Range Requests\n range: 'Range', // Requested byte range\n\n // Security Headers\n contentSecurityPolicy: 'Content-Security-Policy', // CSP directives\n contentSecurityPolicyReportOnly: 'Content-Security-Policy-Report-Only', // CSP report mode\n strictTransportSecurity: 'Strict-Transport-Security', // HTTPS enforcement\n xContentTypeOptions: 'X-Content-Type-Options', // Prevent MIME sniffing\n xFrameOptions: 'X-Frame-Options', // Clickjacking protection\n xXSSProtection: 'X-XSS-Protection', // XSS filter control\n referrerPolicy: 'Referrer-Policy', // Referrer info policy\n permissionsPolicy: 'Permissions-Policy', // Feature permissions\n crossOriginEmbedderPolicy: 'Cross-Origin-Embedder-Policy', // Embedding control\n crossOriginOpenerPolicy: 'Cross-Origin-Opener-Policy', // Window opening control\n crossOriginResourcePolicy: 'Cross-Origin-Resource-Policy', // Resource sharing control\n\n // Cookies\n cookie: 'Cookie', // Client cookies\n setCookie: 'Set-Cookie', // Server cookie instructions\n\n // Connection Management\n connection: 'Connection', // Connection control\n keepAlive: 'Keep-Alive', // Keep-alive parameters\n upgrade: 'Upgrade', // Protocol upgrade\n upgradeInsecureRequests: 'Upgrade-Insecure-Requests', // HTTPS upgrade\n\n // Transfer & Encoding\n transferEncoding: 'Transfer-Encoding', // Transfer encoding method\n te: 'TE', // Acceptable transfer encodings\n trailer: 'Trailer', // Trailer field names\n\n // Proxy & Forwarding\n forwarded: 'Forwarded', // Proxy information\n xForwardedFor: 'X-Forwarded-For', // Proxy information\n via: 'Via', // Proxy chain info\n maxForwards: 'Max-Forwards', // Hop limit\n\n // Alternative Services\n altSvc: 'Alt-Svc', // Alternative services\n altUsed: 'Alt-Used', // Used alternative service\n\n // Timing & Performance\n timingAllowOrigin: 'Timing-Allow-Origin', // Timing API access\n serverTiming: 'Server-Timing', // Server performance metrics\n\n // Refresh & Links\n refresh: 'Refresh', // Auto-refresh directive\n link: 'Link', // Related resources\n\n // Custom & Extension Headers\n xPoweredBy: 'X-Powered-By', // Server technology\n xPermittedCrossDomainPolicies: 'X-Permitted-Cross-Domain-Policies', // Flash policy\n reportTo: 'Report-To', // Error reporting endpoint\n serviceWorkerAllowed: 'Service-Worker-Allowed', // Service worker scope\n sourceMap: 'SourceMap', // Source map location\n priority: 'Priority', // Request priority\n secGPC: 'Sec-GPC', // Global Privacy Control\n\n // Data & Clearing\n clearSiteData: 'Clear-Site-Data', // Clear browser data\n noVarySearch: 'No-Vary-Search', // Search param cache control\n} as const;\n\nexport const httpEncoding = {\n base64: 'base64',\n binary: 'binary',\n utf8: 'utf8',\n} as const;\n",
|
|
9
|
-
"import type {
|
|
10
|
-
"import
|
|
11
|
-
"import type {
|
|
12
|
-
"import type {
|
|
6
|
+
"import { createServer } from 'net';\nimport type { Socket } from 'net';\n\nimport { RequestHandlerImpl } from '@core/execution/RequestHandlerImpl.ts';\nimport { ContextImpl } from '@core/execution/ContextImpl.ts';\nimport { SetupImpl } from '@core/setup/SetupImpl.ts';\nimport { log } from '@core/utils/log.ts';\nimport { colors, networkLog } from '@core/utils/networkLog.ts';\nimport type { ServerConfiguration } from '@typedefs/public/Configuration.js';\n\nexport class YinzerFlow extends SetupImpl {\n private _isListening = false;\n private _server?: ReturnType<typeof createServer>;\n\n constructor(configuration?: ServerConfiguration) {\n super(configuration);\n\n // Set custom logger if provided (routes all log calls to user's logger)\n if (this._configuration.logger) {\n log.setCustomLogger(this._configuration.logger);\n }\n\n // Set log level on built-in logger (always available)\n log.setLogLevel(this._configuration.logLevel);\n\n // Configure network logging - simple boolean toggle\n networkLog.setEnabled(this._configuration.networkLogs);\n\n // Set network logger if provided (optional - can be same as app logger or different)\n if (this._configuration.networkLogger) {\n networkLog.setNetworkLogger(this._configuration.networkLogger);\n }\n\n // This will route to custom logger if set, otherwise use built-in styling\n log.info(\n 'YinzerFlow initialized with logging enabled',\n `${colors.green}level: ${this._configuration.logLevel}, networkLogs: ${this._configuration.networkLogs}${colors.reset}`,\n );\n }\n\n /**\n * Setup server with all event listeners\n */\n private _setupServer(resolve: () => void, reject: (error: Error) => void, requestHandler: RequestHandlerImpl): void {\n if (!this._server) return;\n\n this._server.on('error', (error: Error) => {\n networkLog.serverError(this._configuration.port, this._configuration.host, error.message);\n reject(error);\n });\n\n this._server.on('listening', () => {\n this._isListening = true;\n networkLog.serverStart(this._configuration.port, this._configuration.host);\n resolve();\n });\n\n this._server.on('connection', (socket) => {\n this._handleConnection(socket, requestHandler);\n });\n }\n\n /**\n * Process incoming request data\n */\n private async _processRequest({\n data,\n socket,\n requestHandler,\n clientAddress,\n }: {\n data: Buffer;\n socket: Socket;\n requestHandler: RequestHandlerImpl;\n clientAddress: string;\n }): Promise<void> {\n const startTime = Date.now();\n\n log.info('Processing incoming request', { clientAddress, dataSize: data.length });\n\n const context = new ContextImpl(data, this, clientAddress);\n\n await requestHandler.handle(context);\n\n socket.write(context._response._stringBody);\n socket.end();\n\n const endTime = Date.now();\n const processingTime = endTime - startTime;\n\n // Log request\n networkLog.request(context, startTime, endTime);\n if (processingTime > 500) {\n log.warn('Slow request detected', {\n method: context.request.method,\n path: context.request.path,\n statusCode: context._response._statusCode,\n responseTime: `${processingTime}ms`,\n clientAddress,\n });\n }\n }\n\n /**\n * Handle socket connection and all its events\n */\n private _handleConnection(socket: Socket, requestHandler: RequestHandlerImpl): void {\n const clientAddress = socket.remoteAddress ?? 'unknown';\n\n networkLog.connection('connect', clientAddress);\n\n socket.on('data', (data) => {\n this._processRequest({ data, socket, requestHandler, clientAddress }).catch((error: unknown) => {\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n networkLog.connection('error', clientAddress, `Unexpected error: ${errorMessage}`);\n socket.destroy();\n });\n });\n\n socket.on('error', (error: Error) => {\n networkLog.connection('error', clientAddress, error.message);\n });\n\n socket.on('close', () => {\n networkLog.connection('disconnect', clientAddress);\n });\n }\n\n async listen(): Promise<void> {\n if (this._isListening) {\n throw new Error('Server is already listening');\n }\n\n return new Promise((resolve, reject) => {\n const requestHandler = new RequestHandlerImpl(this);\n this._server = createServer();\n\n this._setupServer(resolve, reject, requestHandler);\n this._server.listen(this._configuration.port, this._configuration.host);\n });\n }\n\n async close(): Promise<void> {\n if (!this._isListening || !this._server) {\n return;\n }\n\n return new Promise((resolve) => {\n if (!this._server) {\n this._isListening = false; // Probably redundant but just in case\n resolve();\n return;\n }\n\n this._server.close(() => {\n this._isListening = false;\n networkLog.serverStop(this._configuration.port, this._configuration.host);\n resolve();\n });\n });\n }\n\n status(): {\n isListening: boolean;\n port: number | undefined;\n host: string | undefined;\n } {\n return {\n isListening: this._isListening,\n port: this._configuration.port,\n host: this._configuration.host,\n };\n }\n}\n",
|
|
7
|
+
"import dayjs from 'dayjs';\nimport type { SetupImpl } from '@core/setup/SetupImpl.ts';\nimport type { InternalContextImpl } from '@typedefs/internal/InternalContextImpl.ts';\nimport type { InternalSetupImpl } from '@typedefs/internal/InternalSetupImpl.js';\nimport { handleCors } from '@core/utils/cors.ts';\nimport { log } from '@core/utils/log.ts';\n\n/**\n * Handles the complete lifecycle of an HTTP request\n *\n * Flow:\n * 1. Receive parsed context (request + response builders)\n * 2. Match route and execute handlers\n * 3. Build final response in context\n * 4. Context.rawResponse is ready for sending\n */\nexport class RequestHandlerImpl {\n private readonly setup: InternalSetupImpl;\n\n constructor(setup: SetupImpl) {\n this.setup = setup;\n }\n\n /**\n * Process an HTTP request using the provided context\n */\n async handle(context: InternalContextImpl): Promise<void> {\n try {\n // 1. Handle CORS before anything else. The cors handler will handle return true if it was a preflight request, otherwise it will return false.\n if (handleCors(context, this.setup._configuration.cors)) {\n context._response._parseResponseIntoString(); // Needed so the YinzerFlow can send the response as a string\n return void 0;\n }\n\n // 2. Match route based on context.request.method + context.request.path\n const matchedRoute = this.setup._routeRegistry._findRoute(context.request.method, context.request.path);\n if (!matchedRoute) {\n const notFoundResponse = await this.setup._hooks._onNotFound(context);\n context._response._setBody(notFoundResponse);\n context._response._parseResponseIntoString(); // Needed so the YinzerFlow can send the response as a string\n return void 0;\n }\n\n const { handler, options } = matchedRoute;\n const { beforeHooks, afterHooks } = options;\n\n // 3. Run beforeAll hooks\n const beforeAllHooks = this.setup._hooks._beforeAll;\n for (const hook of beforeAllHooks) await hook.handler(context);\n\n // 4. Run beforeGroup hooks and beforeRoute hooks\n // * The before group hooks and beforeRoute hooks are in the same array and ordered on route registration.\n for (const hook of beforeHooks) await hook(context);\n\n // 5. Execute route handler.\n // * We are saving the response to a variable because in this case we might not\n // * send a response to the client until after the after hooks since the after hooks might modify the response.\n const routeResponse = await handler(context);\n\n // 6. Run afterRoute hooks and afterGroup hooks\n // * The after group hooks and afterRoute hooks are in the same array and ordered on route registration.\n for (const hook of afterHooks) await hook(context);\n\n // 7. Run afterAll hooks\n const afterAllHooks = this.setup._hooks._afterAll;\n for (const hook of afterAllHooks) await hook.handler(context);\n\n // 8. Build response (set content-type, etc.)\n context._response._setBody(routeResponse);\n\n // 10. If this was a HEAD request, remove the body and convert it to a GET request.\n // Im waiting to do this until after the after hooks since the after hooks might modify the response, headers, etc.\n if (context.request.method === 'HEAD') {\n context._response._setBody(null);\n }\n\n // 11. Add default framework headers and parse the body into a string\n // This is done when we call context._response._parseResponseIntoString()\n context._response._parseResponseIntoString();\n return void 0;\n } catch (error) {\n // Use the error handler from setup\n await this.handleError(context, error);\n }\n }\n\n /**\n * Handle errors using the user-defined or default error handler\n * The error handler returns a response object that we apply to the context\n */\n private async handleError(context: InternalContextImpl, error: unknown): Promise<void> {\n log.error('Request handling error', error);\n\n try {\n // Get the error handler (user-defined or default)\n const errorHandler = this.setup._hooks._onError;\n\n // Call the error handler - it returns a response object\n const errorResponse = await errorHandler(context);\n\n // Apply the response to the context\n context._response._setBody(errorResponse);\n\n // Add CORS headers to error responses too\n handleCors(context, this.setup._configuration.cors);\n\n // Format the response for sending (same as normal flow)\n context._response._parseResponseIntoString();\n context._response._setHeadersIfNotSet({\n Date: dayjs().format('ddd, DD MMM YYYY HH:mm:ss [GMT]'),\n 'Content-Length': context._response._stringBody.split('\\n\\n')[1]?.length.toString() ?? '0',\n });\n } catch (errorHandlerError) {\n // If the error handler itself fails, fall back to basic response\n log.error('Error handler failed', errorHandlerError);\n\n context.response.setStatusCode(500);\n context._response._setBody({\n success: false,\n message: 'Internal Server Error',\n });\n\n // Add CORS headers to fallback error responses too\n handleCors(context, this.setup._configuration.cors);\n\n // Format the fallback response too\n context._response._parseResponseIntoString();\n context._response._setHeadersIfNotSet({\n Date: dayjs().format('ddd, DD MMM YYYY HH:mm:ss [GMT]'),\n 'Content-Length': context._response._stringBody.split('\\n\\n')[1]?.length.toString() ?? '0',\n });\n }\n }\n}\n",
|
|
8
|
+
"/**\n * HTTP Constants\n *\n * This file contains all HTTP-related constants used throughout the application.\n * Centralizing these constants makes them easier to maintain and ensures consistency.\n */\n\n/**\n * HTTP Status Text\n * Maps status codes to their standard text representations\n */\n// Use const assertions for better tree-shaking\nexport const httpStatus = {\n ok: 'OK',\n created: 'Created',\n accepted: 'Accepted',\n noContent: 'No Content',\n movedPermanently: 'Moved Permanently',\n found: 'Found',\n notModified: 'Not Modified',\n badRequest: 'Bad Request',\n unauthorized: 'Unauthorized',\n forbidden: 'Forbidden',\n notFound: 'Not Found',\n methodNotAllowed: 'Method Not Allowed',\n conflict: 'Conflict',\n unsupportedMediaType: 'Unsupported Media Type',\n tooManyRequests: 'Too Many Requests',\n internalServerError: 'Internal Server Error',\n} as const;\n\n/**\n * HTTP Status Codes\n * Standard HTTP status codes used in responses\n */\nexport const httpStatusCode = {\n ok: 200,\n created: 201,\n accepted: 202,\n noContent: 204,\n movedPermanently: 301,\n found: 302,\n notModified: 304,\n badRequest: 400,\n unauthorized: 401,\n forbidden: 403,\n notFound: 404,\n methodNotAllowed: 405,\n conflict: 409,\n unsupportedMediaType: 415,\n tooManyRequests: 429,\n internalServerError: 500,\n} as const;\n\n/**\n * HTTP Methods\n * Standard HTTP methods used in requests\n */\nexport const httpMethod = {\n delete: 'DELETE',\n get: 'GET',\n head: 'HEAD',\n post: 'POST',\n put: 'PUT',\n patch: 'PATCH',\n options: 'OPTIONS',\n} as const;\n\n/**\n * Common Content Types\n * Frequently used content types for HTTP communication\n */\nexport const contentType = {\n json: 'application/json',\n html: 'text/html',\n form: 'application/x-www-form-urlencoded',\n multipart: 'multipart/form-data',\n xml: 'application/xml',\n text: 'text/plain',\n csv: 'text/csv',\n yamlApplication: 'application/yaml',\n yamlText: 'text/yaml',\n urlEncodedJson: 'application/x-www-form-urlencoded+json',\n} as const;\n\n/**\n * HTTP header names organized by category\n * Use with CreateEnum to get type-safe header names with intellisense\n */\nexport const httpHeaders = {\n // Authentication & Authorization\n authorization: 'Authorization', // Bearer tokens, Basic auth, etc.\n proxyAuthorization: 'Proxy-Authorization', // Auth through proxy\n wwwAuthenticate: 'WWW-Authenticate', // Server auth challenge\n\n // Caching & Validation\n cacheControl: 'Cache-Control', // Cache directives\n etag: 'ETag', // Resource version identifier\n expires: 'Expires', // Cache expiration date\n lastModified: 'Last-Modified', // Resource modification date\n ifMatch: 'If-Match', // Conditional request based on ETag\n ifNoneMatch: 'If-None-Match', // Conditional request based on ETag\n ifModifiedSince: 'If-Modified-Since', // Conditional request based on date\n ifUnmodifiedSince: 'If-Unmodified-Since', // Conditional request based on date\n ifRange: 'If-Range', // Conditional range request\n age: 'Age', // Time in proxy cache\n vary: 'Vary', // Response varies based on headers\n\n // Content Information\n contentType: 'Content-Type', // Media type of content\n contentLength: 'Content-Length', // Size in bytes\n contentEncoding: 'Content-Encoding', // Compression method\n contentLanguage: 'Content-Language', // Natural language\n contentDisposition: 'Content-Disposition', // Inline vs attachment\n contentLocation: 'Content-Location', // Alternate location\n contentRange: 'Content-Range', // Partial content range\n\n // CORS (Cross-Origin Resource Sharing)\n accessControlAllowCredentials: 'Access-Control-Allow-Credentials', // Allow credentials in CORS\n accessControlAllowHeaders: 'Access-Control-Allow-Headers', // Allowed request headers\n accessControlAllowMethods: 'Access-Control-Allow-Methods', // Allowed HTTP methods\n accessControlAllowOrigin: 'Access-Control-Allow-Origin', // Allowed origins\n accessControlExposeHeaders: 'Access-Control-Expose-Headers', // Exposed response headers\n accessControlMaxAge: 'Access-Control-Max-Age', // Preflight cache duration\n accessControlRequestHeaders: 'Access-Control-Request-Headers', // Preflight request headers\n accessControlRequestMethod: 'Access-Control-Request-Method', // Preflight request method\n\n // Request Information\n accept: 'Accept', // Acceptable media types\n acceptEncoding: 'Accept-Encoding', // Acceptable encodings\n acceptLanguage: 'Accept-Language', // Acceptable languages\n acceptRanges: 'Accept-Ranges', // Server supports ranges\n host: 'Host', // Target host and port\n userAgent: 'User-Agent', // Client software info\n referer: 'Referer', // Previous page URL\n origin: 'Origin', // Request origin\n from: 'From', // User email address\n expect: 'Expect', // Server requirements\n\n // Response Information\n location: 'Location', // Redirect URL\n server: 'Server', // Server software info\n date: 'Date', // Message timestamp\n allow: 'Allow', // Supported HTTP methods\n retryAfter: 'Retry-After', // Retry delay\n\n // Range Requests\n range: 'Range', // Requested byte range\n\n // Security Headers\n contentSecurityPolicy: 'Content-Security-Policy', // CSP directives\n contentSecurityPolicyReportOnly: 'Content-Security-Policy-Report-Only', // CSP report mode\n strictTransportSecurity: 'Strict-Transport-Security', // HTTPS enforcement\n xContentTypeOptions: 'X-Content-Type-Options', // Prevent MIME sniffing\n xFrameOptions: 'X-Frame-Options', // Clickjacking protection\n xXSSProtection: 'X-XSS-Protection', // XSS filter control\n referrerPolicy: 'Referrer-Policy', // Referrer info policy\n permissionsPolicy: 'Permissions-Policy', // Feature permissions\n crossOriginEmbedderPolicy: 'Cross-Origin-Embedder-Policy', // Embedding control\n crossOriginOpenerPolicy: 'Cross-Origin-Opener-Policy', // Window opening control\n crossOriginResourcePolicy: 'Cross-Origin-Resource-Policy', // Resource sharing control\n\n // Cookies\n cookie: 'Cookie', // Client cookies\n setCookie: 'Set-Cookie', // Server cookie instructions\n\n // Connection Management\n connection: 'Connection', // Connection control\n keepAlive: 'Keep-Alive', // Keep-alive parameters\n upgrade: 'Upgrade', // Protocol upgrade\n upgradeInsecureRequests: 'Upgrade-Insecure-Requests', // HTTPS upgrade\n\n // Transfer & Encoding\n transferEncoding: 'Transfer-Encoding', // Transfer encoding method\n te: 'TE', // Acceptable transfer encodings\n trailer: 'Trailer', // Trailer field names\n\n // Proxy & Forwarding\n forwarded: 'Forwarded', // Proxy information\n xForwardedFor: 'X-Forwarded-For', // Proxy information\n via: 'Via', // Proxy chain info\n maxForwards: 'Max-Forwards', // Hop limit\n\n // Alternative Services\n altSvc: 'Alt-Svc', // Alternative services\n altUsed: 'Alt-Used', // Used alternative service\n\n // Timing & Performance\n timingAllowOrigin: 'Timing-Allow-Origin', // Timing API access\n serverTiming: 'Server-Timing', // Server performance metrics\n\n // Refresh & Links\n refresh: 'Refresh', // Auto-refresh directive\n link: 'Link', // Related resources\n\n // Custom & Extension Headers\n xPoweredBy: 'X-Powered-By', // Server technology\n xPermittedCrossDomainPolicies: 'X-Permitted-Cross-Domain-Policies', // Flash policy\n reportTo: 'Report-To', // Error reporting endpoint\n serviceWorkerAllowed: 'Service-Worker-Allowed', // Service worker scope\n sourceMap: 'SourceMap', // Source map location\n priority: 'Priority', // Request priority\n secGPC: 'Sec-GPC', // Global Privacy Control\n\n // Data & Clearing\n clearSiteData: 'Clear-Site-Data', // Clear browser data\n noVarySearch: 'No-Vary-Search', // Search param cache control\n} as const;\n\nexport const httpEncoding = {\n base64: 'base64',\n binary: 'binary',\n utf8: 'utf8',\n} as const;\n",
|
|
9
|
+
"import { httpHeaders } from '@constants/http.ts';\nimport type { InternalContextImpl } from '@typedefs/internal/InternalContextImpl.js';\nimport type { CorsConfiguration } from '@typedefs/public/Configuration.js';\nimport type { InternalCorsEnabledConfiguration } from '@typedefs/internal/InternalConfiguration.js';\n\nexport const handleCors = (context: InternalContextImpl, config: CorsConfiguration): boolean => {\n if (!config.enabled) return false;\n\n if (context.request.method === 'OPTIONS') {\n // Validate origin is accepted - SECURITY CRITICAL: Actually use the result!\n const isOriginAllowed = _validateOrigin(context, config);\n\n if (!isOriginAllowed) {\n // Reject unauthorized CORS preflight requests\n context.response.setStatusCode(403);\n context._response._setBody({\n error: 'CORS: Origin not allowed',\n origin: context.request.headers.origin,\n });\n return true; // SECURITY: Return true to prevent RequestHandler from overwriting our rejection\n }\n\n // Set response headers ONLY for allowed origins\n context.response.setStatusCode(config.optionsSuccessStatus);\n\n // Determine the allowed origin to echo back\n const allowedOrigin = _determineAllowedOrigin(context, config);\n\n // Configure allowed methods and headers\n context._response._setHeadersIfNotSet({\n [httpHeaders.accessControlAllowOrigin]: allowedOrigin,\n [httpHeaders.accessControlAllowMethods]: config.methods.join(', '),\n [httpHeaders.accessControlAllowHeaders]: typeof config.allowedHeaders === 'string' ? config.allowedHeaders : config.allowedHeaders.join(', '),\n [httpHeaders.accessControlAllowCredentials]: config.credentials ? 'true' : 'false',\n [httpHeaders.accessControlExposeHeaders]: config.exposedHeaders.join(', '),\n [httpHeaders.accessControlMaxAge]: config.maxAge.toString(),\n });\n\n if (config.preflightContinue) {\n // Don't set body, let next handler run\n return false; // CORS did not handle, let next handler run\n }\n // Only set body if preflightContinue is false\n context._response._setBody('');\n return true; // CORS handled it\n }\n\n // For non-OPTIONS requests, still validate origin and set appropriate headers\n const isOriginAllowed = _validateOrigin(context, config);\n\n if (isOriginAllowed) {\n const allowedOrigin = _determineAllowedOrigin(context, config);\n context._response._setHeadersIfNotSet({\n [httpHeaders.accessControlAllowOrigin]: allowedOrigin,\n [httpHeaders.accessControlAllowCredentials]: config.credentials ? 'true' : 'false',\n });\n }\n\n return true;\n};\n\n/**\n * Determine the correct origin value to send back in Access-Control-Allow-Origin\n * SECURITY: Never echo back the request origin without validation\n */\nconst _determineAllowedOrigin = (context: InternalContextImpl, config: InternalCorsEnabledConfiguration): string => {\n if (config.origin === '*') {\n // SECURITY: Block dangerous wildcard + credentials combination (CORS spec violation)\n if (config.credentials) {\n throw new Error(\n 'CORS Security Error: origin: \"*\" with credentials: true is forbidden by CORS spec and creates security vulnerabilities. Use specific origins instead.',\n );\n }\n\n // SECURITY: For wildcard, always return literal '*', never echo back the request origin\n // Echoing back the request origin defeats the purpose of CORS validation\n return '*';\n }\n\n // For specific origins, echo back the validated request origin\n const requestOrigin = context.request.headers.origin;\n if (requestOrigin) {\n // At this point, validation should have already passed\n return requestOrigin;\n }\n\n // If no request origin (shouldn't happen for validated requests), return first configured origin\n if (typeof config.origin === 'string') {\n return config.origin;\n }\n\n if (Array.isArray(config.origin) && config.origin.length > 0) {\n const [firstOrigin] = config.origin;\n return firstOrigin ?? 'null';\n }\n\n // This shouldn't happen if validation passed, but safety fallback\n return 'null';\n};\n\nconst _validateOrigin = (context: InternalContextImpl, config: InternalCorsEnabledConfiguration): boolean => {\n if (config.origin === '*') return true;\n\n const normalizedOrigin = context.request.headers.origin?.toLowerCase() ?? '';\n\n if (typeof config.origin === 'function') {\n return Boolean(config.origin(normalizedOrigin, context.request));\n }\n\n if (typeof config.origin === 'string') {\n return normalizedOrigin === config.origin.toLowerCase();\n }\n\n if (Array.isArray(config.origin)) {\n return config.origin.some((origin) => normalizedOrigin === origin.toLowerCase());\n }\n\n if (config.origin instanceof RegExp) {\n return config.origin.test(normalizedOrigin);\n }\n\n return false;\n};\n",
|
|
10
|
+
"import dayjs from 'dayjs';\nimport type { InternalContextImpl } from '@typedefs/internal/InternalContextImpl.ts';\nimport type { Logger } from '@typedefs/public/Logger.js';\n\n/**\n * YinzerFlow Network Logging System 🌐\n *\n * Separate network logging with Pittsburgh personality!\n * Boolean controlled, independent of main log levels.\n * Nginx-style access logs with performance tracking.\n */\n\n// Shared constants for both logging systems\nexport const logPrefix = 'YINZER';\n\n// Shared ANSI Color codes (reused from main log system)\nexport const colors = {\n reset: '\\x1b[0m',\n cyan: '\\x1b[96m', // Cyan for info\n yellow: '\\x1b[93m', // Yellow for warn\n red: '\\x1b[91m', // Red for error\n green: '\\x1b[92m', // Green for success\n magenta: '\\x1b[95m', // Magenta for performance\n gray: '\\x1b[90m', // Gray for network logs\n} as const;\n\nconst yinzerPhrases = {\n positive: [\"n'at!\", 'yinz are good!', \"that's the way!\", 'right on!', \"lookin' good!\", 'way to go!', 'keep it up!'],\n neutral: [\"n'at\", 'yinz know', \"just sayin'\", \"that's how it is\", 'what can ya do', 'it happens'],\n negative: ['aw jeez', \"that ain't right\", 'what a jagoff move', \"that's terrible n'at\", 'somebody messed up', 'this is bad news', 'yinz better fix this'],\n} as const;\n\n// Global network logging configuration\nlet networkLoggingEnabled = false;\nlet networkLogger: Logger | null = null;\n\n// Helper functions (shared utilities)\nexport const formatTimestamp = (): string => dayjs().format('YYYY-MM-DD HH:mm:ss.SSS');\n\nconst getRandomPhrase = (type: 'negative' | 'neutral' | 'positive'): string => {\n const phrases = yinzerPhrases[type];\n return phrases[Math.floor(Math.random() * phrases.length)] ?? '';\n};\n\n/**\n * Calculate response size for logging\n */\nconst _calculateResponseSize = (responseBody: unknown): number => {\n if (typeof responseBody === 'string') {\n return Buffer.byteLength(responseBody, 'utf8');\n }\n if (Buffer.isBuffer(responseBody)) {\n return responseBody.length;\n }\n if (typeof responseBody === 'object' && responseBody !== null) {\n try {\n return Buffer.byteLength(JSON.stringify(responseBody), 'utf8');\n } catch {\n return 0;\n }\n }\n return 0;\n};\n\n/**\n * Get status emoji for response codes\n */\nconst _getStatusEmoji = (statusCode: number): string => {\n if (statusCode >= 200 && statusCode < 300) return '✅';\n if (statusCode >= 300 && statusCode < 400) return '🔄';\n if (statusCode >= 400 && statusCode < 500) return '❌';\n if (statusCode >= 500) return '💥';\n return '❓';\n};\n\n/**\n * Get performance details for response time with Pittsburgh personality\n */\nconst _getPerformanceDetails = (timeMs: number): { emoji: string; phrase: string } => {\n // < 50ms: Truly instant, users can't perceive any delay\n if (timeMs < 50) {\n return {\n emoji: '⚡',\n phrase: Math.random() < 0.5 ? \"lightning quick n'at!\" : 'faster than a Stillers touchdown!',\n };\n }\n // 50-100ms: Still feels instant for most interactions\n if (timeMs < 100) {\n return {\n emoji: '🔥',\n phrase: Math.random() < 0.5 ? \"that's the way!\" : \"smooth as butter n'at!\",\n };\n }\n // 100-200ms: Google's \"good\" threshold, still very responsive\n if (timeMs < 200) {\n return {\n emoji: '✅',\n phrase: Math.random() < 0.5 ? 'not bad yinz!' : \"keepin' up just fine!\",\n };\n }\n // 200-500ms: Noticeable but acceptable for complex operations\n if (timeMs < 500) {\n return {\n emoji: '⚠️',\n phrase: Math.random() < 0.5 ? 'eh, could be better' : \"slowin' down a bit there\",\n };\n }\n // 500ms-1s: Users start getting impatient\n if (timeMs < 1000) {\n return {\n emoji: '🐌',\n phrase: Math.random() < 0.5 ? \"that's draggin' n'at\" : \"c'mon, pick up the pace!\",\n };\n }\n // > 1s: Definitely problematic, needs attention\n return {\n emoji: '💥',\n phrase: Math.random() < 0.5 ? 'what a jagoff response time!' : 'slower than traffic on the Parkway!',\n };\n};\n\n// =============================================================================\n// NETWORK LOGGING FUNCTIONS\n// =============================================================================\n\nconst connection = (event: 'connect' | 'disconnect' | 'error', clientIp?: string, details?: string): void => {\n if (!networkLoggingEnabled) return;\n\n const timestamp = formatTimestamp();\n const ip = clientIp ?? 'unknown';\n const eventDetails = details ? ` - ${details}` : '';\n\n let message = '';\n let level: 'error' | 'info' | 'warn' = 'info';\n\n if (event === 'connect') {\n message = `🤝 [NETWORK] New visitor from ${ip} - Welcome to the 'Burgh!`;\n } else if (event === 'disconnect') {\n message = `👋 [NETWORK] ${ip} headed out - Thanks for stopping by, yinz come back now!`;\n } else {\n message = `💥 [NETWORK] Connection trouble with ${ip}${eventDetails} - That's not good, n'at!`;\n level = 'error';\n }\n\n if (networkLogger) {\n // Route to custom network logger - let it handle timestamp formatting\n networkLogger[level](message);\n } else {\n // Use built-in styling with timestamp\n const color = level === 'error' ? colors.red : colors.gray;\n console.log(`${color}[${logPrefix}] [${timestamp}] ${message}${colors.reset}`);\n }\n};\n\nconst request = (context: InternalContextImpl, startTime: number, endTime: number): void => {\n if (!networkLoggingEnabled) return;\n\n const { request: req } = context;\n const response = context._response;\n const responseTimeMs = (endTime - startTime).toFixed(1);\n\n const clientIp = req.ipAddress || 'unknown';\n const { method, path, protocol } = req;\n const statusCode = response._statusCode;\n const responseSize = _calculateResponseSize(response._body);\n const referer = req.headers.referer ? `\"${req.headers.referer}\"` : '\"-\"';\n const userAgent = req.headers['user-agent'] ? `\"${req.headers['user-agent']}\"` : '\"-\"';\n const statusEmoji = _getStatusEmoji(statusCode);\n\n // Main nginx-style log entry\n const logEntry = `🏠 ${clientIp} - - [${formatTimestamp()}] \"${method} ${path} ${protocol}\" ${statusCode} ${responseSize}b ${referer} ${userAgent} ${responseTimeMs}ms ${statusEmoji}`;\n\n // Performance details\n const timeMs = parseFloat(responseTimeMs);\n const { emoji, phrase } = _getPerformanceDetails(timeMs);\n const perfEntry = `${emoji} [PERF] Response time: ${responseTimeMs}ms - ${phrase}`;\n\n if (networkLogger) {\n // Route to custom network logger - let it handle timestamp formatting\n networkLogger.info(`[NETWORK] ${logEntry}`);\n networkLogger.info(`[PERF] ${perfEntry}`);\n } else {\n // Use built-in styling with timestamp\n console.log(`${colors.gray}[${logPrefix}] [${formatTimestamp()}] [NETWORK] ${logEntry}${colors.reset}`);\n console.log(`${colors.magenta}[${logPrefix}] ${emoji} [${formatTimestamp()}] [PERF] Response time: ${responseTimeMs}ms - ${phrase}${colors.reset}`);\n }\n};\n\nconst serverStart = (port?: number, host?: string): void => {\n if (!networkLoggingEnabled) return;\n\n const timestamp = formatTimestamp();\n const address = port && host ? `${host}:${port}` : 'unknown';\n const phrase = getRandomPhrase('positive');\n const message = `🚀 [NETWORK] YinzerFlow server is up and running at ${address} - Ready to serve yinz all, ${phrase}!`;\n\n if (networkLogger) {\n // Route to custom network logger - let it handle timestamp formatting\n networkLogger.info(message);\n } else {\n // Use built-in styling with timestamp\n console.log(`${colors.gray}[${logPrefix}] [${timestamp}] ${message}${colors.reset}`);\n }\n};\n\nconst serverStop = (port?: number, host?: string): void => {\n if (!networkLoggingEnabled) return;\n\n const timestamp = formatTimestamp();\n const address = port && host ? `${host}:${port}` : 'unknown';\n const phrase = getRandomPhrase('neutral');\n const message = `🛑 [NETWORK] YinzerFlow server at ${address} is shutting down - See yinz later, ${phrase}!`;\n\n if (networkLogger) {\n // Route to custom network logger - let it handle timestamp formatting\n networkLogger.info(message);\n } else {\n // Use built-in styling with timestamp\n console.log(`${colors.gray}[${logPrefix}] [${timestamp}] ${message}${colors.reset}`);\n }\n};\n\nconst serverError = (port?: number, host?: string, details?: string): void => {\n if (!networkLoggingEnabled) return;\n\n const timestamp = formatTimestamp();\n const address = port && host ? `${host}:${port}` : 'unknown';\n const eventDetails = details ? ` - ${details}` : '';\n const phrase = getRandomPhrase('negative');\n const message = `💥 [NETWORK] Server error at ${address}${eventDetails} - Something's not right, ${phrase}!`;\n\n if (networkLogger) {\n // Route to custom network logger - let it handle timestamp formatting\n networkLogger.error(message);\n } else {\n // Use built-in styling with timestamp\n console.log(`${colors.red}[${logPrefix}] [${timestamp}] ${message}${colors.reset}`);\n }\n};\n\n// =============================================================================\n// CONFIGURATION & EXPORTS\n// =============================================================================\n\n/**\n * Enable or disable network logging (independent of main log level)\n */\nconst setEnabled = (enabled: boolean): void => {\n networkLoggingEnabled = enabled;\n};\n\n/**\n * Set a custom logger for network logging (optional)\n */\nconst setNetworkLogger = (logger: Logger): void => {\n networkLogger = logger;\n};\n\nexport const networkLog = {\n // Configuration\n setEnabled,\n setNetworkLogger,\n\n // Network logging functions\n connection,\n request,\n serverStart,\n serverStop,\n serverError,\n};\n",
|
|
11
|
+
"import { colors, formatTimestamp, logPrefix } from '@core/utils/networkLog.ts';\nimport type { Logger } from '@typedefs/public/Logger.js';\n\n/**\n * YinzerFlow Main Logging System 🏗️\n *\n * Simple, clean logging with Pittsburgh personality!\n * - Numeric levels (0=off, 1=error, 2=warn, 3=info)\n * - Smart formatting: Objects get pretty JSON, strings get YinzerFlow colors\n * - Network logging is separate (see networkLog.ts)\n */\n\n// logPrefix imported from networkLog.ts\n\n// Internal numeric log levels for main logging\nconst internalLogLevels = {\n off: 0,\n error: 1,\n warn: 2,\n info: 3,\n} as const;\n\n// Colors are imported from networkLog.ts for consistency\n\nconst yinzerPhrases = {\n positive: [\"n'at!\", 'yinz are good!', \"that's the way!\", 'right on!', \"lookin' good!\", 'way to go!', 'keep it up!'],\n neutral: [\"n'at\", 'yinz know', \"just sayin'\", \"that's how it is\", 'what can ya do', 'it happens'],\n negative: ['aw jeez', \"that ain't right\", 'what a jagoff move', \"that's terrible n'at\", 'somebody messed up', 'this is bad news', 'yinz better fix this'],\n} as const;\n\n// Global configuration\nlet currentLogLevel: number = internalLogLevels.warn;\nlet customLogger: Logger | null = null;\n\n// Helper functions (formatTimestamp imported from networkLog.ts)\n\nconst getRandomPhrase = (type: 'negative' | 'neutral' | 'positive'): string => {\n const phrases = yinzerPhrases[type];\n return phrases[Math.floor(Math.random() * phrases.length)] ?? '';\n};\n\n// formatData function removed - using console.log's native formatting instead\n\n// =============================================================================\n// MAIN LOGGING SYSTEM (Numeric Levels)\n// =============================================================================\n\nconst info = (...args: Array<unknown>): void => {\n if (currentLogLevel < internalLogLevels.info) return;\n\n if (customLogger) {\n // Route to user's custom logger\n customLogger.info(...args);\n } else {\n // Use built-in YinzerFlow styling\n logWithStyle('info', ...args);\n }\n};\n\nconst warn = (...args: Array<unknown>): void => {\n if (currentLogLevel < internalLogLevels.warn) return;\n\n if (customLogger) {\n // Route to user's custom logger\n customLogger.warn(...args);\n } else {\n // Use built-in YinzerFlow styling\n logWithStyle('warn', ...args);\n }\n};\n\nconst error = (...args: Array<unknown>): void => {\n if (currentLogLevel < internalLogLevels.error) return;\n\n if (customLogger) {\n // Route to user's custom logger\n customLogger.error(...args);\n } else {\n // Use built-in YinzerFlow styling\n logWithStyle('error', ...args);\n }\n};\n\n// Verbose logging removed - just use info for detailed logging\n\nconst perf = (message: string, timeMs: number, data?: unknown): void => {\n if (currentLogLevel < internalLogLevels.info) return;\n const timestamp = formatTimestamp();\n\n // Performance-based emojis and phrases\n let emoji = '❓ ';\n let phrase = '';\n\n // < 50ms: Truly instant, users can't perceive any delay\n if (timeMs < 50) {\n emoji = '⚡ ';\n phrase = Math.random() < 0.5 ? \"lightning quick n'at!\" : 'faster than a Stillers touchdown!';\n // 50-100ms: Still feels instant for most interactions\n } else if (timeMs < 100) {\n emoji = '🔥 ';\n phrase = Math.random() < 0.5 ? \"that's the way!\" : \"smooth as butter n'at!\";\n // 100-200ms: Google's \"good\" threshold, still very responsive\n } else if (timeMs < 200) {\n emoji = '✅ ';\n phrase = Math.random() < 0.5 ? 'not bad yinz!' : \"keepin' up just fine!\";\n // 200-500ms: Noticeable but acceptable for complex operations\n } else if (timeMs < 500) {\n emoji = '⚠️ ';\n phrase = Math.random() < 0.5 ? 'eh, could be better' : \"slowin' down a bit there\";\n // 500ms-1s: Users start getting impatient\n } else if (timeMs < 1000) {\n emoji = '🐌 ';\n phrase = Math.random() < 0.5 ? \"that's draggin' n'at\" : \"c'mon, pick up the pace!\";\n // > 1s: Definitely problematic, needs attention\n } else {\n emoji = '💥 ';\n phrase = Math.random() < 0.5 ? 'what a jagoff response time!' : 'slower than traffic on the Parkway!';\n }\n\n const prefix = `${colors.magenta}[${logPrefix}] ${emoji} [${timestamp}] [PERF]${colors.reset}`;\n\n // Include timing in the data object for console.log's native formatting\n const perfData = data ? { ...data, executionTime: `${timeMs}ms` } : { executionTime: `${timeMs}ms` };\n console.log(`${prefix} ${message} -`, perfData, `- ${phrase}`);\n};\n\n// Network logging moved to networkLog.ts\n\n// =============================================================================\n// CONFIGURATION & EXPORTS\n// =============================================================================\n\n/**\n * Set the main log level using string values for intuitive configuration\n */\nconst setLogLevel = (level: 'error' | 'info' | 'off' | 'warn'): void => {\n const levelMap = {\n off: 0,\n error: 1,\n warn: 2,\n info: 3,\n } as const;\n\n currentLogLevel = levelMap[level];\n};\n\n/**\n * Set a custom logger for output routing\n */\nconst setCustomLogger = (logger: Logger): void => {\n customLogger = logger;\n};\n\n/**\n * Simple logging that mimics console.log behavior but with YinzerFlow styling\n */\nconst logWithStyle = (level: 'error' | 'info' | 'warn', ...args: Array<unknown>): void => {\n const timestamp = formatTimestamp();\n\n // Determine emoji, color, and phrase type based on level\n let emoji = '✅ ';\n let color: string = colors.cyan;\n let phraseType: 'negative' | 'neutral' | 'positive' = 'positive';\n let consoleMethod: 'error' | 'log' | 'warn' = 'log';\n\n if (level === 'error') {\n emoji = '❌ ';\n color = colors.red;\n phraseType = 'negative';\n consoleMethod = 'error';\n } else if (level === 'warn') {\n emoji = '⚠️ ';\n color = colors.yellow;\n phraseType = 'neutral';\n consoleMethod = 'warn';\n } else {\n emoji = '✅ ';\n color = colors.cyan;\n phraseType = 'positive';\n consoleMethod = 'log';\n }\n\n const phrase = getRandomPhrase(phraseType);\n const prefix = `${color}[${logPrefix}] ${emoji}[${timestamp}] [${level.toUpperCase()}]${colors.reset}`;\n\n // Let console.log handle all arguments naturally - just like console.log does\n // In production, this could be replaced with a no-op for zero bundle impact\n console[consoleMethod](`${prefix}`, ...args, `- ${phrase}`);\n};\n\nexport const log = {\n // Configuration\n setLogLevel,\n setCustomLogger,\n\n // Main logging functions with Pittsburgh personality\n info,\n warn,\n error,\n perf,\n\n // Constants for convenience\n levels: internalLogLevels,\n};\n\n// Export the Logger interface for custom implementations\nexport type { Logger } from '@typedefs/public/Logger.js';\n",
|
|
12
|
+
"import type { InternalJsonParserConfiguration } from '@typedefs/internal/InternalConfiguration.js';\nimport { log } from '@core/utils/log.ts';\n\n/**\n * Dangerous prototype properties that can lead to prototype pollution\n */\nconst DANGEROUS_PROPERTIES = ['__proto__', 'constructor', 'prototype'];\n\n/**\n * Parse JSON request body with comprehensive security protections\n *\n * Security Features:\n * - Request size validation\n * - Nesting depth limits to prevent stack overflow\n * - Prototype pollution protection\n * - Memory exhaustion protection (max keys, string length, array length)\n * - Proper error handling with security context\n */\nexport const parseApplicationJson = (body: string, config: InternalJsonParserConfiguration): unknown => {\n // Handle empty strings, whitespace, and null characters\n if (!body || !body.trim() || body.trim() === '\\0') {\n return undefined;\n }\n\n // SECURITY: Validate request body size to prevent DoS attacks\n const bodySize = Buffer.byteLength(body, 'utf8');\n if (bodySize > config.maxSize) {\n log.warn('[SECURITY] JSON request body too large', {\n size: bodySize,\n limit: config.maxSize,\n sizeMB: Math.round(bodySize / 1024 / 1024),\n });\n throw new Error(`Request body too large: ${bodySize} bytes exceeds limit of ${config.maxSize} bytes`);\n }\n\n let parsedData: unknown = null; // Initialize to fix linting\n\n try {\n // First pass: Parse JSON to get structure\n parsedData = JSON.parse(body);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Invalid JSON syntax: ${message}`);\n }\n\n // SECURITY: Validate parsed data structure for security vulnerabilities\n try {\n _validateJsonStructure(parsedData, config, 1); // Start at depth 1 (root level)\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`JSON security validation failed: ${message}`);\n }\n\n return parsedData;\n};\n\n/**\n * Validate primitive values (strings, numbers, etc.)\n */\nconst _validatePrimitive = (data: unknown, config: InternalJsonParserConfiguration): void => {\n if (typeof data === 'string' && data.length > config.maxStringLength) {\n throw new Error(`String too long: ${data.length} characters exceeds limit of ${config.maxStringLength}`);\n }\n};\n\n/**\n * Validate array structure and elements\n */\nconst _validateArray = (data: Array<unknown>, config: InternalJsonParserConfiguration, depth: number): void => {\n // SECURITY: Check array length to prevent memory exhaustion\n if (data.length > config.maxArrayLength) {\n throw new Error(`Array too large: ${data.length} elements exceeds limit of ${config.maxArrayLength}`);\n }\n\n // Recursively validate array elements\n for (const item of data) {\n _validateJsonStructure(item, config, depth + 1);\n }\n};\n\n/**\n * Validate object keys for security issues\n */\nconst _validateObjectKeys = (keys: Array<string>, config: InternalJsonParserConfiguration): void => {\n // SECURITY: Check number of keys to prevent memory exhaustion\n if (keys.length > config.maxKeys) {\n throw new Error(`Object has too many keys: ${keys.length} exceeds limit of ${config.maxKeys}`);\n }\n\n // SECURITY: Check for prototype pollution attempts\n if (!config.allowPrototypeProperties) {\n for (const key of keys) {\n if (DANGEROUS_PROPERTIES.includes(key)) {\n log.warn('[SECURITY] Prototype pollution attempt detected', {\n property: key,\n dangerousProperties: DANGEROUS_PROPERTIES,\n });\n throw new Error(`Prototype pollution attempt detected: property '${key}' is not allowed`);\n }\n }\n }\n};\n\n/**\n * Validate object properties and values\n */\nconst _validateObjectProperties = (data: Record<string, unknown>, config: InternalJsonParserConfiguration, depth: number): void => {\n const keys = Object.keys(data);\n\n for (const key of keys) {\n // SECURITY: Check key length\n if (key.length > config.maxStringLength) {\n throw new Error(`Object key too long: '${key.substring(0, 50)}...' exceeds limit of ${config.maxStringLength}`);\n }\n\n const value = data[key];\n\n // SECURITY: Check string value length\n if (typeof value === 'string' && value.length > config.maxStringLength) {\n throw new Error(`String value too long: property '${key}' has ${value.length} characters, exceeds limit of ${config.maxStringLength}`);\n }\n\n // Recursively validate nested structures\n _validateJsonStructure(value, config, depth + 1);\n }\n};\n\n/**\n * Recursively validate JSON structure for security vulnerabilities\n *\n * @param data - Data to validate\n * @param config - Security configuration\n * @param depth - Current nesting depth (starts at 1 for root level)\n */\nconst _validateJsonStructure = (data: unknown, config: InternalJsonParserConfiguration, depth: number): void => {\n // SECURITY: Check nesting depth to prevent stack overflow attacks\n if (depth > config.maxDepth) {\n log.warn('[SECURITY] JSON nesting too deep - potential stack overflow attack', {\n currentDepth: depth,\n maxDepth: config.maxDepth,\n });\n throw new Error(`JSON nesting too deep: current depth ${depth} exceeds maximum depth of ${config.maxDepth}`);\n }\n\n // Handle null and primitives\n if (data === null || typeof data !== 'object') {\n _validatePrimitive(data, config);\n return;\n }\n\n // Handle arrays\n if (Array.isArray(data)) {\n _validateArray(data, config, depth);\n return;\n }\n\n // Handle objects\n const keys = Object.keys(data);\n _validateObjectKeys(keys, config);\n _validateObjectProperties(data as Record<string, unknown>, config, depth);\n};\n",
|
|
13
|
+
"import type { InternalContentDisposition, InternalFileUpload, InternalMultipartFormData } from '@typedefs/internal/InternalRequestImpl.ts';\nimport type { InternalFileUploadConfiguration } from '@typedefs/internal/InternalConfiguration.js';\nimport { log } from '@core/utils/log.ts';\n\n/**\n * Split a multipart section into headers and content\n *\n * @example\n * ```ts\n * splitMultipartSection('Content-Disposition: form-data; name=\"file\"; filename=\"example.txt\"\\r\\nContent-Type: text/plain\\r\\n\\r\\nThis is the content of the file.\\r\\n');\n * // Returns ['Content-Disposition: form-data; name=\"file\"; filename=\"example.txt\"\\r\\nContent-Type: text/plain\\r\\n', 'This is the content of the file.\\r\\n']\n * ```\n */\nconst splitMultipartSection = (section: string): [string, string] => {\n const trimmedSection = section.startsWith('\\r\\n') ? section.slice(2) : section;\n const headerEndIndex = trimmedSection.indexOf('\\r\\n\\r\\n');\n\n if (headerEndIndex === -1) {\n return ['', ''];\n }\n\n const headers = trimmedSection.slice(0, headerEndIndex);\n const content = trimmedSection.slice(headerEndIndex + 4);\n return [headers, content];\n};\n\n/**\n * Simple Content-Disposition parser for multipart sections\n *\n * @example\n * ```ts\n * parseContentDisposition('Content-Disposition: form-data; name=\"file\"; filename=\"example.txt\"\\r\\nContent-Type: text/plain\\r\\n\\r\\nThis is the content of the file.\\r\\n');\n * // Returns { name: 'file', filename: 'example.txt' }\n * ```\n */\nconst parseContentDisposition = (headerLine: string): InternalContentDisposition => {\n const result: InternalContentDisposition = { name: '' };\n\n const nameMatch = /name=(?:\"(?<temp2>[^\"]*)\"|(?<temp1>[^;,\\s]+))/i.exec(headerLine);\n const filenameMatch = /filename=(?:\"(?<temp2>[^\"]*)\"|(?<temp1>[^;,\\s]+))/i.exec(headerLine);\n\n if (nameMatch) {\n result.name = nameMatch[1] ?? nameMatch[2] ?? '';\n }\n\n if (filenameMatch) {\n const filename = filenameMatch[1] ?? filenameMatch[2];\n if (filename) {\n result.filename = filename;\n }\n }\n\n return result;\n};\n\n/**\n * Extract Content-Type from multipart section headers\n *\n * @example\n * ```ts\n * extractSectionContentType('Content-Type: text/plain\\r\\n\\r\\nThis is the content of the file.\\r\\n');\n * // Returns 'text/plain'\n * ```\n */\nconst extractSectionContentType = (headers: string): string => {\n const lines = headers.split(/\\r?\\n/);\n const contentTypeLine = lines.find((line) => line.toLowerCase().startsWith('content-type:'));\n\n if (!contentTypeLine) return 'application/octet-stream';\n\n return (\n contentTypeLine\n .slice(contentTypeLine.indexOf(':') + 1)\n .trim()\n .split(';')[0]\n ?.trim() ?? 'application/octet-stream'\n );\n};\n\n/**\n * Determine if content should be treated as binary\n *\n * @example\n * ```ts\n * isBinaryContent('image/png');\n * // Returns true\n * ```\n */\nconst isBinaryContent = (contentTypeValue: string): boolean => {\n const binaryTypes = ['image/', 'audio/', 'video/', 'application/octet-stream', 'application/pdf', 'application/zip', 'application/x-'];\n\n return binaryTypes.some((type) => contentTypeValue.toLowerCase().startsWith(type));\n};\n\n/**\n * Calculate content length for string or Buffer\n *\n * @example\n * ```ts\n * calculateContentLength('Hello, world!');\n * // Returns 13\n * ```\n */\nconst calculateContentLength = (content: Buffer | string): number => (Buffer.isBuffer(content) ? content.length : Buffer.byteLength(content, 'utf8'));\n\n/**\n * Validate file against security configuration\n */\nconst _validateFileUpload = (file: InternalFileUpload, config?: InternalFileUploadConfiguration): void => {\n if (!config) return;\n\n // SECURITY: Check file size\n if (file.size > config.maxFileSize) {\n log.warn('[SECURITY] File upload too large', {\n filename: file.filename,\n size: file.size,\n limit: config.maxFileSize,\n sizeMB: Math.round(file.size / 1024 / 1024),\n });\n throw new Error(`File too large: ${file.filename} is ${file.size} bytes, exceeds limit of ${config.maxFileSize} bytes`);\n }\n\n // SECURITY: Check filename length\n if (file.filename && file.filename.length > config.maxFilenameLength) {\n throw new Error(`Filename too long: ${file.filename.length} characters exceeds limit of ${config.maxFilenameLength}`);\n }\n\n // SECURITY: Check file extension\n if (file.filename) {\n const extension = file.filename.toLowerCase().substring(file.filename.lastIndexOf('.'));\n\n // Check blocked extensions\n if (config.blockedExtensions.includes(extension)) {\n log.warn('[SECURITY] Blocked file type upload attempt', {\n filename: file.filename,\n extension,\n blockedExtensions: config.blockedExtensions,\n });\n throw new Error(`File type not allowed: ${extension} files are blocked for security reasons`);\n }\n\n // Check allowed extensions (if specified)\n if (config.allowedExtensions.length > 0 && !config.allowedExtensions.includes(extension)) {\n throw new Error(`File type not allowed: ${extension} is not in the allowed extensions list`);\n }\n }\n};\n\n/**\n * Handle file upload processing with binary support and security validation\n *\n * @example\n * ```ts\n * handleFileUpload({\n * contentDisposition: { name: 'file', filename: 'example.txt' },\n * contentSection: 'This is the content of the file.\\r\\n',\n * });\n * ```\n */\nconst handleFileUpload = ({\n contentDisposition,\n contentSection,\n headersSection,\n config,\n}: {\n contentDisposition: InternalContentDisposition;\n contentSection: string;\n headersSection: string;\n config?: InternalFileUploadConfiguration | undefined;\n}): InternalFileUpload => {\n const contentTypeValue = extractSectionContentType(headersSection);\n\n // Remove trailing \\r\\n that's part of the multipart boundary\n const trimmedContent = contentSection.endsWith('\\r\\n') ? contentSection.slice(0, -2) : contentSection;\n\n // For binary files, convert string to Buffer\n const content: Buffer | string = isBinaryContent(contentTypeValue) ? Buffer.from(trimmedContent, 'binary') : trimmedContent;\n\n const file: InternalFileUpload = {\n filename: contentDisposition.filename ?? '',\n contentType: contentTypeValue,\n size: calculateContentLength(content),\n content,\n };\n\n // SECURITY: Validate file against configuration\n _validateFileUpload(file, config);\n\n return file;\n};\n\n/**\n * Parse multipart form data request body with binary file support and security protections\n *\n * Security Features:\n * - File size validation per file and total\n * - File extension filtering (allow/block lists)\n * - Filename length validation\n * - File count limits\n *\n * @example\n * ```ts\n * const config = { maxFileSize: 10485760, maxFiles: 10, blockedExtensions: ['.exe'] };\n * parseMultipartFormData('...multipart body...', 'boundary123', config);\n * // Returns { fields: { ... }, files: [...] }\n * ```\n */\nexport const parseMultipartFormData = (body: string, boundary: string, config?: InternalFileUploadConfiguration): InternalMultipartFormData => {\n const result: InternalMultipartFormData = {\n fields: {},\n files: [],\n };\n\n // Split the body into parts using the boundary\n const parts = body.split(`--${boundary}`).slice(1); // Skip the first empty part\n\n let totalFileSize = 0;\n\n for (const part of parts) {\n // Skip empty parts and the final boundary marker\n if (!part || part.trim() === '' || part.trim() === '--') continue;\n\n // Parse the part headers and content\n const [headersSection, contentSection] = splitMultipartSection(part);\n if (!headersSection) continue; // Skip malformed parts\n\n // Find Content-Disposition header\n const lines = headersSection.split(/\\r?\\n/);\n const dispositionLine = lines.find((line) => line.toLowerCase().startsWith('content-disposition:'));\n if (!dispositionLine) continue;\n\n const contentDisposition = parseContentDisposition(dispositionLine);\n if (!contentDisposition.name) continue;\n\n // Handle file upload\n if (contentDisposition.filename !== undefined) {\n // SECURITY: Check file count limit\n if (config && result.files.length >= config.maxFiles) {\n log.warn('[SECURITY] Too many files in upload request', {\n fileCount: result.files.length,\n maxFiles: config.maxFiles,\n });\n throw new Error(`Too many files: maximum of ${config.maxFiles} files allowed per request`);\n }\n\n const file = handleFileUpload({\n contentDisposition,\n contentSection,\n headersSection,\n config,\n });\n\n totalFileSize += file.size;\n\n // SECURITY: Check total file size\n if (config && totalFileSize > config.maxTotalSize) {\n log.warn('[SECURITY] Total upload size too large', {\n totalSize: totalFileSize,\n limit: config.maxTotalSize,\n totalSizeMB: Math.round(totalFileSize / 1024 / 1024),\n });\n throw new Error(`Total file size too large: ${totalFileSize} bytes exceeds limit of ${config.maxTotalSize} bytes`);\n }\n\n result.files.push(file);\n }\n\n // Handle regular form field\n if (contentDisposition.filename === undefined) {\n // Remove trailing \\r\\n that's part of the multipart boundary\n const trimmedContent = contentSection.endsWith('\\r\\n') ? contentSection.slice(0, -2) : contentSection;\n result.fields[contentDisposition.name] = trimmedContent;\n }\n }\n\n return result;\n};\n",
|
|
13
14
|
"import type { InternalUrlEncodedConfiguration } from '@typedefs/internal/InternalConfiguration.js';\n\n/**\n * Validate form field counts and basic structure\n */\nconst _validateFormStructure = (pairs: Array<string>, config: InternalUrlEncodedConfiguration): void => {\n // SECURITY: Check field count to prevent memory exhaustion\n if (pairs.length > config.maxFields) {\n throw new Error(`Too many form fields: ${pairs.length} exceeds limit of ${config.maxFields}`);\n }\n};\n\n/**\n * Validate individual field name and value lengths\n */\nconst _validateFieldLengths = (key: string, value: string | undefined, config: InternalUrlEncodedConfiguration): void => {\n // SECURITY: Check field name length\n if (key.length > config.maxFieldNameLength) {\n throw new Error(`Form field name too long: ${key.length} characters exceeds limit of ${config.maxFieldNameLength}`);\n }\n\n // SECURITY: Check field value length\n if (value && value.length > config.maxFieldLength) {\n throw new Error(`Form field value too long: field '${key}' has ${value.length} characters, exceeds limit of ${config.maxFieldLength}`);\n }\n};\n\n/**\n * Validate decoded field lengths (they may expand during decoding)\n */\nconst _validateDecodedLengths = (decodedKey: string, decodedValue: string, config: InternalUrlEncodedConfiguration): void => {\n // SECURITY: Check decoded field name length (could expand during decoding)\n if (decodedKey.length > config.maxFieldNameLength) {\n throw new Error(`Decoded form field name too long: ${decodedKey.length} characters exceeds limit of ${config.maxFieldNameLength}`);\n }\n\n // SECURITY: Check decoded field value length\n if (decodedValue.length > config.maxFieldLength) {\n throw new Error(\n `Decoded form field value too long: field '${decodedKey}' has ${decodedValue.length} characters, exceeds limit of ${config.maxFieldLength}`,\n );\n }\n};\n\n/**\n * Process a single form field pair with security validation\n */\nconst _processFieldPair = (pair: string, params: Record<string, string>, config?: InternalUrlEncodedConfiguration): void => {\n const [key, value] = pair.split('=');\n if (!key) return;\n\n // Validate field lengths if config provided\n if (config) {\n _validateFieldLengths(key, value, config);\n }\n\n try {\n const decodedKey = decodeURIComponent(key);\n const decodedValue = value ? decodeURIComponent(value) : '';\n\n // Validate decoded lengths if config provided\n if (config) {\n _validateDecodedLengths(decodedKey, decodedValue, config);\n }\n\n params[decodedKey] = decodedValue;\n } catch (error) {\n // Handle malformed URL encoding - check if it's a validation error or decoding error\n if (error instanceof Error && error.message.includes('exceeds limit')) {\n throw error; // Re-throw validation errors\n }\n\n // Handle malformed URL encoding gracefully by using original values\n params[key] = value ?? '';\n }\n};\n\n/**\n * Parse URL-encoded form data with security protections\n *\n * Security Features:\n * - Field count limits to prevent memory exhaustion\n * - Field name length validation\n * - Field value length validation\n * - Malformed URL encoding handling\n *\n * @example\n * ```ts\n * const config = { maxFields: 1000, maxFieldNameLength: 100, maxFieldLength: 1048576 };\n * parseUrlEncodedForm('name=John&age=30', config);\n * // Returns { name: 'John', age: '30' }\n * ```\n */\nexport const parseUrlEncodedForm = (body: string, config?: InternalUrlEncodedConfiguration): Record<string, string> => {\n const params: Record<string, string> = {};\n const pairs = body.split('&');\n\n // Validate form structure if config provided\n if (config) {\n _validateFormStructure(pairs, config);\n }\n\n // Process each field pair\n for (const pair of pairs) {\n _processFieldPair(pair, params, config);\n }\n\n return params;\n};\n",
|
|
14
15
|
"import type { InternalHttpEncoding } from '@typedefs/constants/http.js';\n\n/**\n * Common binary file signatures (magic numbers)\n * Used for detecting file types when Content-Type header is missing\n */\nconst BINARY_SIGNATURES = {\n // Images\n JPEG: [0xff, 0xd8, 0xff],\n PNG: [0x89, 0x50, 0x4e, 0x47],\n GIF87A: [0x47, 0x49, 0x46, 0x38, 0x37, 0x61], // GIF87a\n GIF89A: [0x47, 0x49, 0x46, 0x38, 0x39, 0x61], // GIF89a\n BMP: [0x42, 0x4d],\n TIFF_LE: [0x49, 0x49, 0x2a, 0x00], // Little endian\n TIFF_BE: [0x4d, 0x4d, 0x00, 0x2a], // Big endian\n WEBP: [0x52, 0x49, 0x46, 0x46], // RIFF header (WebP has 'WEBP' at offset 8)\n ICO: [0x00, 0x00, 0x01, 0x00],\n\n // Audio\n MP3_ID3: [0x49, 0x44, 0x33], // ID3 tag\n MP3_FRAME: [0xff, 0xfb], // MP3 frame\n WAV: [0x52, 0x49, 0x46, 0x46], // RIFF header (WAV has 'WAVE' at offset 8)\n FLAC: [0x66, 0x4c, 0x61, 0x43], // fLaC\n OGG: [0x4f, 0x67, 0x67, 0x53], // OggS\n\n // Video\n MP4_FTYP: [0x00, 0x00, 0x00, 0x18, 0x66, 0x74, 0x79, 0x70], // Common MP4 signature\n MP4_FTYP_ALT: [0x00, 0x00, 0x00, 0x1c, 0x66, 0x74, 0x79, 0x70], // Alternative MP4\n AVI: [0x52, 0x49, 0x46, 0x46], // RIFF header (AVI has 'AVI ' at offset 8)\n WEBM: [0x1a, 0x45, 0xdf, 0xa3], // EBML header\n\n // Documents\n PDF: [0x25, 0x50, 0x44, 0x46], // %PDF\n\n // Archives\n ZIP: [0x50, 0x4b, 0x03, 0x04], // ZIP file\n ZIP_EMPTY: [0x50, 0x4b, 0x05, 0x06], // Empty ZIP\n ZIP_SPANNED: [0x50, 0x4b, 0x07, 0x08], // Spanned ZIP\n RAR: [0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00], // Rar!\n RAR5: [0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x01, 0x00], // Rar! v5\n SEVENZ: [0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c], // 7z\n GZIP: [0x1f, 0x8b], // gzip\n\n // Executables\n EXE: [0x4d, 0x5a], // MZ (DOS/Windows executable)\n ELF: [0x7f, 0x45, 0x4c, 0x46], // ELF (Linux executable)\n\n // Office Documents (modern Office files are ZIP-based)\n OFFICE_OLD: [0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1], // Old MS Office\n} as const;\n\n/**\n * Check if buffer matches a binary signature\n */\nconst matchesSignature = (buffer: Buffer, signature: ReadonlyArray<number>): boolean => {\n if (buffer.length < signature.length) return false;\n return signature.every((byte, index) => buffer[index] === byte);\n};\n\n/**\n * Check for special cases that require additional validation\n */\nconst validateSpecialSignatures = (buffer: Buffer): boolean => {\n // WebP: RIFF header + 'WEBP' at offset 8\n if (matchesSignature(buffer, BINARY_SIGNATURES.WEBP) && buffer.length >= 12) {\n const webpMarker = buffer.subarray(8, 12);\n return webpMarker.toString('ascii') === 'WEBP';\n }\n\n // WAV: RIFF header + 'WAVE' at offset 8\n if (matchesSignature(buffer, BINARY_SIGNATURES.WAV) && buffer.length >= 12) {\n const waveMarker = buffer.subarray(8, 12);\n return waveMarker.toString('ascii') === 'WAVE';\n }\n\n // AVI: RIFF header + 'AVI ' at offset 8\n if (matchesSignature(buffer, BINARY_SIGNATURES.AVI) && buffer.length >= 12) {\n const aviMarker = buffer.subarray(8, 12);\n return aviMarker.toString('ascii') === 'AVI ';\n }\n\n return false;\n};\n\n/**\n * Determine the appropriate encoding based on Content-Type header\n * Falls back to content inspection if no header is present\n */\nexport const determineEncoding = (contentType?: string, body?: unknown): InternalHttpEncoding => {\n if (!contentType) {\n // No content-type header, infer from body content\n return inferEncodingFromBody(body);\n }\n\n const lowerContentType = contentType.toLowerCase();\n\n // Binary content types that should use base64 encoding\n if (\n lowerContentType.startsWith('image/') ||\n lowerContentType.startsWith('video/') ||\n lowerContentType.startsWith('audio/') ||\n lowerContentType === 'application/pdf' ||\n lowerContentType === 'application/octet-stream' ||\n lowerContentType.startsWith('application/zip') ||\n lowerContentType.startsWith('application/x-') // Many binary formats use x- prefix\n ) {\n return 'base64';\n }\n\n // Text-based content types use utf8\n if (\n lowerContentType.startsWith('text/') ||\n lowerContentType.startsWith('application/json') ||\n lowerContentType.startsWith('application/xml') ||\n lowerContentType.startsWith('application/javascript')\n ) {\n return 'utf8';\n }\n\n // Default to binary for unknown types\n return 'binary';\n};\n\n/**\n * Infer encoding when no Content-Type header is present\n */\nexport const inferEncodingFromBody = (body?: unknown): 'base64' | 'binary' | 'utf8' => {\n // If it's a Buffer, check for binary signatures\n if (Buffer.isBuffer(body)) {\n return detectBinaryFormat(body) ? 'base64' : 'utf8';\n }\n\n // Objects and arrays should be JSON, use utf8\n if (typeof body === 'object' && body !== null) return 'utf8';\n\n // Strings use utf8\n if (typeof body === 'string') return 'utf8';\n\n // Everything else defaults to utf8\n return 'utf8';\n};\n\n/**\n * Detect if buffer contains binary data based on file signatures\n */\nconst detectBinaryFormat = (buffer: Buffer): boolean => {\n if (buffer.length === 0) return false;\n\n // Check all known binary signatures\n const signatures = Object.values(BINARY_SIGNATURES);\n\n for (const signature of signatures) {\n if (matchesSignature(buffer, signature)) {\n return true;\n }\n }\n\n // Check special cases that need additional validation\n if (validateSpecialSignatures(buffer)) {\n return true;\n }\n\n // Heuristic: if buffer contains a lot of null bytes or non-printable chars, likely binary\n const nullBytes = buffer.filter((byte) => byte === 0).length;\n const nonPrintableBytes = buffer.filter((byte) => byte < 32 && byte !== 9 && byte !== 10 && byte !== 13).length;\n\n // If more than 10% null bytes or 30% non-printable, consider it binary\n return nullBytes / buffer.length > 0.1 || nonPrintableBytes / buffer.length > 0.3;\n};\n",
|
|
15
16
|
"import { determineEncoding } from './determineEncoding.ts';\nimport { contentType } from '@constants/http.ts';\n\n// =============================================================================\n// JSON Detection\n// =============================================================================\n\n/**\n * Detect if string content is valid JSON\n * Validates by attempting to parse the content\n */\nconst isJsonContent = (content: string): boolean => {\n if (!((content.startsWith('{') && content.endsWith('}')) || (content.startsWith('[') && content.endsWith(']')))) {\n return false;\n }\n\n try {\n JSON.parse(content);\n return true;\n } catch {\n return false;\n }\n};\n\n// =============================================================================\n// Form Data Detection\n// =============================================================================\n\n/**\n * Detect if string content is URL-encoded form data\n */\nconst isUrlEncodedFormContent = (content: string): boolean => content.includes('=') && content.includes('&');\n\n/**\n * Detect if string content is multipart form data\n */\nconst isMultipartFormContent = (content: string): boolean => content.includes('boundary=');\n\n// =============================================================================\n// Object Type Detection\n// =============================================================================\n\n/**\n * Check if value is a plain object or array (but not special object types)\n */\nconst isPlainObjectOrArray = (value: unknown): boolean =>\n typeof value === 'object' &&\n value !== null &&\n !Buffer.isBuffer(value) &&\n !(value instanceof Uint8Array) &&\n !(value instanceof ArrayBuffer) &&\n !(value instanceof Date);\n\n/**\n * Check if value is a Date object\n */\nconst isDateObject = (value: unknown): value is Date => value instanceof Date;\n\n// =============================================================================\n// Binary Data Helpers\n// =============================================================================\n\n/**\n * Convert various binary types to Buffer for consistent processing\n */\nconst convertToBuffer = (data: ArrayBuffer | Buffer | Uint8Array): Buffer => {\n if (Buffer.isBuffer(data)) return data;\n return Buffer.from(data as ArrayBuffer);\n};\n\n/**\n * Determine content type for binary data using encoding detection\n */\nconst inferBinaryContentType = (buffer: Buffer): string => {\n const encoding = determineEncoding(undefined, buffer);\n return encoding === 'base64' ? 'application/octet-stream' : 'text/plain';\n};\n\n// =============================================================================\n// Main String Content Type Inference\n// =============================================================================\n\n/**\n * Infer content type from string body content when Content-Type header is missing\n * Focuses on main HTTP content types: JSON, form data, plain text\n *\n * @param body - String content to analyze\n * @returns Detected content type\n */\nexport const inferContentTypeFromString = (body: string): string => {\n const trimmedBody = body.trim();\n\n // Check for JSON first (most specific)\n if (isJsonContent(trimmedBody)) {\n return contentType.json;\n }\n\n // Check for form data\n if (isUrlEncodedFormContent(trimmedBody)) {\n return contentType.form;\n }\n\n if (isMultipartFormContent(trimmedBody)) {\n return contentType.multipart;\n }\n\n // Default to plain text for everything else\n return 'text/plain';\n};\n\n// =============================================================================\n// Main Content Type Inference\n// =============================================================================\n\n/**\n * Infer content type from any response body type when Content-Type header is missing\n * Handles the main types: objects (JSON), strings, binary data, primitives\n *\n * @param body - Response body of any supported type\n * @returns Detected content type\n */\nexport const inferContentType = (body: unknown): string => {\n // Handle null/undefined\n if (body === null || body === undefined) {\n return 'text/plain';\n }\n\n // Handle Date objects specially (convert to string)\n if (isDateObject(body)) {\n return 'text/plain';\n }\n\n // Handle plain objects and arrays -> JSON\n if (isPlainObjectOrArray(body)) {\n return contentType.json;\n }\n\n // Handle strings with basic detection\n if (typeof body === 'string') {\n return inferContentTypeFromString(body);\n }\n\n // Handle binary data types\n if (Buffer.isBuffer(body) || body instanceof Uint8Array || body instanceof ArrayBuffer) {\n const buffer = convertToBuffer(body);\n return inferBinaryContentType(buffer);\n }\n\n // All other primitives -> plain text\n return 'text/plain';\n};\n",
|
|
@@ -20,23 +21,23 @@
|
|
|
20
21
|
"import type { InternalHttpHeaders } from '@typedefs/constants/http.js';\nimport type { InternalIpAddressResult } from '@typedefs/internal/InternalIpAddress.js';\nimport type { InternalIpValidationConfig } from '@typedefs/internal/InternalConfiguration.js';\nimport type { InternalSetupImpl } from '@typedefs/internal/InternalSetupImpl.ts';\n\n// Private IP ranges (RFC 1918, RFC 4193, RFC 3927)\nconst PRIVATE_IP_RANGES = [\n // IPv4 private ranges\n /^(?<classA>10)\\./,\n /^(?<classB>172)\\.(?<classBRange>1[6-9]|2[0-9]|3[0-1])\\./,\n /^(?<classC>192)\\.(?<classCRange>168)\\./,\n /^(?<linkLocal>169)\\.(?<linkLocalRange>254)\\./, // link-local\n /^(?<loopback>127)\\./, // loopback\n // IPv6 private ranges\n /^(?<ipv6Loopback>::1)$/, // loopback\n /^(?<ipv6LinkLocal>fe80):/i, // link-local\n /^(?<ipv6UniqueLocalFC>fc00):/i, // unique local\n /^(?<ipv6UniqueLocalFD>fd00):/i, // unique local\n];\n\n/**\n * Validates if an IP address is properly formatted\n */\nexport const isValidIpAddress = (ip: string): boolean => {\n if (!ip || typeof ip !== 'string') return false;\n\n // Remove brackets from IPv6 addresses\n const cleanIp = ip.replace(/^\\[|\\]$/g, '');\n\n // IPv4 validation with named capture groups\n const ipv4Regex = /^(?<octet>(?<highByte>25[0-5]|(?<midByte>2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}$/;\n if (ipv4Regex.test(cleanIp)) {\n const parts = cleanIp.split('.');\n return (\n parts.length === 4 &&\n parts.every((part) => {\n const num = parseInt(part, 10);\n return num >= 0 && num <= 255;\n })\n );\n }\n\n // IPv6 validation with named capture groups (simplified but robust)\n // First check for invalid patterns (multiple :: compression)\n if (cleanIp.includes('::') && (cleanIp.match(/::/g) ?? []).length > 1) {\n return false; // Multiple :: compression is invalid\n }\n\n const ipv6Regex =\n /^(?<ipv6Address>(?<fullAddress>(?<hexQuad>[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4})|(?<compressedAddress>(?<leadingPart>[0-9a-fA-F]{1,4}:){1,7}:)|(?<mixedCompression>(?<frontPart>[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4})|(?<doubleColonOnly>::)|(?<linkLocal>fe80:(?<linkSuffix>:[0-9a-fA-F]{0,4}){0,4}(?<zoneId>%[0-9a-zA-Z]+)?)|(?<ipv4MappedFull>::ffff:(?<mappedIpv4>(?<mappedOctet>[0-9]{1,3}\\.){3}[0-9]{1,3}))|(?<generalPattern>(?<segmentGroup>[0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}))$/;\n\n return ipv6Regex.test(cleanIp);\n};\n\n/**\n * Checks if an IP address is in a private range\n */\nexport const isPrivateIp = (ip: string): boolean => {\n if (!ip) return false;\n const cleanIp = ip.replace(/^\\[|\\]$/g, '');\n return PRIVATE_IP_RANGES.some((range) => range.test(cleanIp));\n};\n\n/**\n * Checks if an IP is in the trusted proxy list\n * Supports '*' wildcard to trust any proxy\n */\nexport const isTrustedProxy = (ip: string, trustedProxies: Array<string>): boolean => {\n if (!ip || !trustedProxies.length) return false;\n\n // Support '*' wildcard to trust any proxy\n if (trustedProxies.includes('*')) return true;\n\n return trustedProxies.includes(ip);\n};\n\n/**\n * Detects potential IP spoofing patterns\n */\nexport const detectSpoofingPatterns = (chain: Array<string>, config: InternalIpValidationConfig): boolean => {\n if (!config.detectSpoofing || chain.length <= 1) return false;\n\n // Pattern 1: Too many hops (potential amplification attack)\n if (chain.length > config.maxChainLength) return true;\n\n // Pattern 2: Duplicate IPs in chain (suspicious)\n const uniqueIps = new Set(chain);\n if (uniqueIps.size !== chain.length) return true;\n\n // Pattern 3: Mix of invalid and valid IPs (obfuscation attempt)\n const validCount = chain.filter(isValidIpAddress).length;\n if (validCount > 0 && validCount < chain.length) return true;\n\n // Pattern 4: Reverse proxy spoofing detection disabled\n // Note: The pattern \"public_ip, private_ip\" is normal for legitimate X-Forwarded-For headers\n // More sophisticated detection would require knowledge of expected network topology\n\n return false;\n};\n\n/**\n * Validates X-Forwarded-For proxy chain\n */\nconst _validateXForwardedForChain = (ipChain: Array<string>, config: InternalIpValidationConfig): boolean => {\n if (ipChain.length <= 1) return true;\n\n const lastIp = ipChain[ipChain.length - 1];\n return Boolean(lastIp && isTrustedProxy(lastIp, config.trustedProxies));\n};\n\n/**\n * Extracts client IP from IP chain based on header type\n */\nconst _extractClientIp = (ipChain: Array<string>, headerName: string): string | undefined => {\n if (headerName === 'x-forwarded-for') {\n return ipChain[0]; // Client IP is first in X-Forwarded-For\n }\n return ipChain[ipChain.length - 1]; // For other headers, take the last value\n};\n\n/**\n * Creates a valid IP result object\n */\nconst _createValidIpResult = (options: {\n clientIp: string;\n headerName: string;\n ipChain: Array<string>;\n config: InternalIpValidationConfig;\n}): InternalIpAddressResult => {\n const { clientIp, headerName, ipChain, config } = options;\n const isPrivate = isPrivateIp(clientIp);\n const trusted = headerName === 'x-forwarded-for' ? isTrustedProxy(ipChain[ipChain.length - 1] ?? '', config.trustedProxies) : true;\n\n return {\n ip: clientIp,\n isValid: true,\n isPrivate,\n source: headerName,\n trusted,\n };\n};\n\n/**\n * Creates an invalid IP result object\n */\nconst _createInvalidIpResult = (): InternalIpAddressResult => ({\n ip: '',\n isValid: false,\n isPrivate: false,\n source: 'socket',\n trusted: false,\n});\n\n/**\n * Extracts and validates IP addresses from headers with security checks\n */\nconst _extractIpFromHeaders = (headers: Partial<Record<InternalHttpHeaders, string>>, config: InternalIpValidationConfig): InternalIpAddressResult => {\n // Try each header in preference order\n for (const headerName of config.headerPreference) {\n const headerValue = headers[headerName];\n if (!headerValue) continue;\n\n // Handle comma-separated IP chains\n const ipChain = headerValue\n .split(',')\n .map((ip) => ip.trim())\n .filter(Boolean);\n if (ipChain.length === 0) continue;\n\n // Detect spoofing patterns\n if (detectSpoofingPatterns(ipChain, config)) continue;\n\n // For X-Forwarded-For, validate the proxy chain\n if (headerName === 'x-forwarded-for' && !_validateXForwardedForChain(ipChain, config)) {\n continue;\n }\n\n // Extract the client IP\n const clientIp = _extractClientIp(ipChain, headerName);\n if (!clientIp || !isValidIpAddress(clientIp)) continue;\n\n // Check if private IPs are allowed\n const isPrivate = isPrivateIp(clientIp);\n if (isPrivate && !config.allowPrivateIps) continue;\n\n return _createValidIpResult({ clientIp, headerName, ipChain, config });\n }\n\n return _createInvalidIpResult();\n};\n\n/**\n * Advanced IP parsing with comprehensive security validation\n * Uses server-level IP security configuration with optional overrides\n */\nexport const parseIpAddressSecure = (\n setup: InternalSetupImpl,\n headers: Partial<Record<InternalHttpHeaders, string>>,\n configOverride: Partial<InternalIpValidationConfig> = {},\n): InternalIpAddressResult => {\n const serverConfig = setup._configuration.ipSecurity;\n const finalConfig = { ...serverConfig, ...configOverride };\n\n // Try to extract IP from headers first\n const headerResult = _extractIpFromHeaders(headers, finalConfig);\n if (headerResult.isValid) {\n return headerResult;\n }\n\n // No valid IP found from headers\n return {\n ip: '',\n isValid: false,\n isPrivate: false,\n source: 'socket',\n trusted: false,\n };\n};\n\n/**\n * Simple IP parsing function that returns just the IP address string\n * Provides backward compatibility for existing code\n */\nexport const parseIpAddress = (setup: InternalSetupImpl, headers: Partial<Record<InternalHttpHeaders, string>>): string => {\n const result = parseIpAddressSecure(setup, headers);\n return result.ip;\n};\n",
|
|
21
22
|
"/**\n * Extract the boundary from the content type header\n *\n * @example\n * ```ts\n * extractBoundaryFromHeader('multipart/form-data; boundary=----WebKitFormBoundary1234567890');\n * // Returns '----WebKitFormBoundary1234567890'\n * ```\n */\nexport const extractBoundaryFromHeader = (contentTypeHeader?: string): string | undefined => {\n if (!contentTypeHeader) return undefined;\n\n const boundaryMatch = /boundary\\s*=\\s*(?<temp1>[^;,\\s]*)/i.exec(contentTypeHeader);\n return boundaryMatch?.[1];\n};\n",
|
|
22
23
|
"import type { InternalHttpHeaders } from '@typedefs/constants/http.js';\n\n// Security limits to prevent DoS attacks\nconst MAX_HEADERS = 100;\nconst MAX_HEADER_NAME_LENGTH = 200;\nconst MAX_HEADER_VALUE_LENGTH = 8192;\n\n/**\n * Parse incoming request headers from raw headers string with security validation\n *\n * This is the main orchestrator function that delegates to specialized helpers\n * for each processing step: validation → parsing → sanitization → security\n *\n * @example\n * ```ts\n * parseRequestHeaders('Host: example.com\\r\\nContent-Type: application/json\\r\\n\\r\\n');\n * // Returns { host: 'example.com', 'content-type': 'application/json' }\n * ```\n */\nexport const parseRequestHeaders = (rawHeaders: string): Partial<Record<InternalHttpHeaders, string>> => {\n if (!rawHeaders) return {};\n\n // Step 1: Pre-parse validation (format, DoS protection)\n validateRawHeaders(rawHeaders);\n\n // Step 2: Parse header structure into key-value pairs\n const parsedHeaders = parseHeaderStructure(rawHeaders);\n\n // Step 3: Sanitize header values (remove control chars, etc.)\n const sanitizedHeaders = sanitizeHeaders(parsedHeaders);\n\n // Step 4: Apply security policies (business logic, injection prevention)\n const securedHeaders = applySecurityPolicies(sanitizedHeaders);\n\n return securedHeaders;\n};\n\n/**\n * Step 1: Validate raw headers before parsing\n * Checks for DoS protection and basic format sanity\n */\nexport const validateRawHeaders = (rawHeaders: string): void => {\n // SECURITY: Limit number of potential headers to prevent DoS\n const headerLines = rawHeaders.split(/\\r\\n|\\r|\\n/);\n if (headerLines.length > MAX_HEADERS) {\n throw new Error(`Too many headers: maximum ${MAX_HEADERS} allowed`);\n }\n\n // Basic format validation could go here\n // (e.g., overall size limits, obvious malformation)\n};\n\n/**\n * Step 2: Parse header structure into key-value pairs\n * Handles line ending normalization and basic parsing\n */\nexport const parseHeaderStructure = (rawHeaders: string): Record<string, string> => {\n const headers: Record<string, string> = {};\n\n // Normalize line endings and split\n const normalizedHeaders = rawHeaders.replace(/\\r\\n|\\r|\\n/g, '\\n');\n const headerLines = normalizedHeaders.split('\\n');\n\n for (const line of headerLines) {\n if (!line.trim()) continue;\n\n const colonIndex = line.indexOf(':');\n if (colonIndex === -1) continue;\n\n const key = line.slice(0, colonIndex).trim();\n const value = line.slice(colonIndex + 1).trim();\n\n if (!key) continue;\n\n // SECURITY: Validate header name against RFC 7230\n if (!isValidHeaderName(key)) {\n throw new Error(`Invalid header name: ${key}`);\n }\n\n // SECURITY: Limit header name length\n if (key.length > MAX_HEADER_NAME_LENGTH) {\n throw new Error(`Header name too long: maximum ${MAX_HEADER_NAME_LENGTH} characters allowed`);\n }\n\n // SECURITY: Limit header value length\n if (value.length > MAX_HEADER_VALUE_LENGTH) {\n throw new Error(`Header value too long: maximum ${MAX_HEADER_VALUE_LENGTH} characters allowed`);\n }\n\n // Store with lowercase key for consistency\n headers[key.toLowerCase()] = value;\n }\n\n return headers;\n};\n\n/**\n * Step 3: Sanitize header values\n * Removes control characters and normalizes values\n */\nexport const sanitizeHeaders = (headers: Record<string, string>): Record<string, string> => {\n const sanitized: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(headers)) {\n sanitized[key] = sanitizeHeaderValue(value);\n }\n\n return sanitized;\n};\n\n/**\n * Step 4: Apply security policies\n * Business logic validation and injection prevention\n */\nexport const applySecurityPolicies = (headers: Record<string, string>): Record<string, string> =>\n // Note: CRLF injection detection would go here if we were setting response headers\n // For parsing incoming request headers, this step mainly handles business logic validation\n\n // Could add checks like:\n // - Suspicious header combinations\n // - Known attack patterns in values\n // - Business-specific header validation\n\n headers;\n\n/**\n * Validate header name according to RFC 7230\n */\nconst isValidHeaderName = (name: string): boolean => {\n // RFC 7230: header-name = token\n // token = 1*tchar\n // tchar = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" / \"*\" / \"+\" / \"-\" / \".\" /\n // \"^\" / \"_\" / \"`\" / \"|\" / \"~\" / DIGIT / ALPHA\n const validHeaderNameRegex = /^[a-zA-Z0-9!#$%&'*+\\-.^_`|~]+$/;\n return validHeaderNameRegex.test(name);\n};\n\n/**\n * Sanitize header value to prevent injection attacks\n */\nconst sanitizeHeaderValue = (value: string): string => {\n // SECURITY: Remove control characters except horizontal tab\n // Allow printable ASCII, horizontal tab (0x09), and extended ASCII\n const sanitized = value.replace(/[\\x00-\\x08\\x0A-\\x1F\\x7F]/g, '');\n return sanitized;\n};\n",
|
|
23
|
-
"import { parseBody } from './utils/parseBody.ts';\nimport type { InternalContentType, InternalHttpHeaders, InternalHttpMethod } from '@typedefs/constants/http.js';\nimport { parseHttpRequest } from '@core/execution/utils/parseHttpRequest.ts';\nimport { parseQuery } from '@core/execution/utils/parseQuery.ts';\nimport { parseIpAddress } from '@core/execution/utils/parseIpAddress.ts';\nimport { extractBoundaryFromHeader } from '@core/execution/utils/extractBoundaryFromHeader.ts';\nimport { parseRequestHeaders } from '@core/execution/utils/parseRequestHeaders.ts';\nimport type { Request } from '@typedefs/public/Request.ts';\nimport type { SetupImpl } from '@core/setup/SetupImpl.ts';\nimport type { InternalRequestImpl } from '@typedefs/internal/InternalRequestImpl.ts';\nimport type { InternalSetupImpl } from '@typedefs/internal/InternalSetupImpl.ts';\n\nexport class RequestImpl implements InternalRequestImpl {\n readonly _rawRequest: Buffer | string;\n readonly _setup: InternalSetupImpl;\n\n method: InternalHttpMethod;\n path: string;\n protocol: string;\n headers: Partial<Record<InternalHttpHeaders, string>>;\n body: unknown;\n query: Record<string, string>;\n params: Record<string, string>;\n ipAddress: string;\n rawBody: Buffer | string;\n\n constructor(rawRequest: Request['rawBody'], setup: SetupImpl, clientAddress?: string) {\n this._rawRequest = rawRequest;\n this._setup = setup;\n\n // Set initial IP address from socket, will be updated if headers provide better info\n this.ipAddress = clientAddress ?? '';\n\n const { method, path, protocol, headers, body, query, params, rawBody } = this._parseRequestIntoObject();\n\n this.method = method;\n this.path = path;\n this.protocol = protocol;\n this.headers = headers;\n this.body = body;\n this.query = query;\n this.params = params;\n this.rawBody = rawBody;\n\n // Update IP address if parsing from headers provides something\n const parsedIpAddress = parseIpAddress(this._setup, headers);\n if (parsedIpAddress) {\n this.ipAddress = parsedIpAddress;\n }\n }\n\n private _parseRequestIntoObject(): Omit<Request, 'ipAddress'> {\n const request = this._rawRequest.toString();\n\n const { method, path, protocol, headersRaw, rawBody } = parseHttpRequest(request);\n\n const route = this._setup._routeRegistry._findRoute(method, path);\n const headers = parseRequestHeaders(headersRaw);\n\n // Extract content type and boundary for body parsing\n const contentTypeHeader = headers['content-type'];\n const mainContentType = contentTypeHeader?.split(';')[0]?.trim().toLowerCase() as InternalContentType;\n const boundary = extractBoundaryFromHeader(contentTypeHeader);\n\n return {\n method,\n path,\n protocol,\n headers,\n body: parseBody(rawBody, {\n headerContentType: mainContentType,\n boundary,\n config: this._setup._configuration.bodyParser,\n }),\n query: parseQuery(path),\n params: route?.params ?? {},\n rawBody,\n };\n }\n}\n",
|
|
24
|
+
"import { parseBody } from './utils/parseBody.ts';\nimport type { InternalContentType, InternalHttpHeaders, InternalHttpMethod } from '@typedefs/constants/http.js';\nimport { parseHttpRequest } from '@core/execution/utils/parseHttpRequest.ts';\nimport { parseQuery } from '@core/execution/utils/parseQuery.ts';\nimport { parseIpAddress } from '@core/execution/utils/parseIpAddress.ts';\nimport { extractBoundaryFromHeader } from '@core/execution/utils/extractBoundaryFromHeader.ts';\nimport { parseRequestHeaders } from '@core/execution/utils/parseRequestHeaders.ts';\nimport type { Request } from '@typedefs/public/Request.ts';\nimport type { SetupImpl } from '@core/setup/SetupImpl.ts';\nimport type { InternalRequestImpl } from '@typedefs/internal/InternalRequestImpl.ts';\nimport type { InternalSetupImpl } from '@typedefs/internal/InternalSetupImpl.ts';\n\nexport class RequestImpl implements InternalRequestImpl {\n readonly _rawRequest: Buffer | string;\n readonly _setup: InternalSetupImpl;\n\n method: InternalHttpMethod;\n path: string;\n protocol: string;\n headers: Partial<Record<InternalHttpHeaders, string>>;\n body: unknown;\n query: Record<string, string>;\n params: Record<string, string>;\n ipAddress: string;\n rawBody: Buffer | string;\n\n constructor(rawRequest: Request['rawBody'], setup: SetupImpl, clientAddress?: string) {\n this._rawRequest = rawRequest;\n this._setup = setup;\n\n // Set initial IP address from socket, will be updated if headers provide better info\n this.ipAddress = clientAddress ?? '';\n\n const { method, path, protocol, headers, body, query, params, rawBody } = this._parseRequestIntoObject();\n\n this.method = method;\n this.path = path;\n this.protocol = protocol;\n this.headers = headers;\n this.body = body;\n this.query = query ?? {};\n this.params = params ?? {};\n this.rawBody = rawBody;\n\n // Update IP address if parsing from headers provides something\n const parsedIpAddress = parseIpAddress(this._setup, headers);\n if (parsedIpAddress) {\n this.ipAddress = parsedIpAddress;\n }\n }\n\n private _parseRequestIntoObject(): Omit<Request, 'ipAddress'> {\n const request = this._rawRequest.toString();\n\n const { method, path, protocol, headersRaw, rawBody } = parseHttpRequest(request);\n\n const route = this._setup._routeRegistry._findRoute(method, path);\n const headers = parseRequestHeaders(headersRaw);\n\n // Extract content type and boundary for body parsing\n const contentTypeHeader = headers['content-type'];\n const mainContentType = contentTypeHeader?.split(';')[0]?.trim().toLowerCase() as InternalContentType;\n const boundary = extractBoundaryFromHeader(contentTypeHeader);\n\n return {\n method,\n path,\n protocol,\n headers,\n body: parseBody(rawBody, {\n headerContentType: mainContentType,\n boundary,\n config: this._setup._configuration.bodyParser,\n }),\n query: parseQuery(path),\n params: route?.params ?? {},\n rawBody,\n };\n }\n}\n",
|
|
25
|
+
"import dayjs from 'dayjs';\nimport { formatBodyIntoString } from '@core/execution/utils/formatBodyIntoString.ts';\nimport { determineEncoding } from '@core/execution/utils/determineEncoding.ts';\nimport { inferContentType } from '@core/execution/utils/inferContentType.ts';\nimport { mapStatusCodeToMessage } from '@core/execution/utils/mapStatusCodeToMessage.ts';\nimport { filterAndValidateHeaders } from '@core/execution/utils/validateResponseHeaders.ts';\nimport { httpEncoding, httpStatus, httpStatusCode } from '@constants/http.ts';\nimport type { InternalHttpEncoding, InternalHttpHeaders, InternalHttpStatus, InternalHttpStatusCode } from '@typedefs/constants/http.js';\nimport type { Request } from '@typedefs/public/Request.ts';\nimport type { InternalResponseImpl } from '@typedefs/internal/InternalResponseImpl.d.ts';\nimport { determineContentLength } from '@core/execution/utils/determineContentLength.ts';\n\nexport class ResponseImpl implements InternalResponseImpl {\n readonly _request: Request;\n\n _statusCode: InternalHttpStatusCode = httpStatusCode.ok;\n _status: InternalHttpStatus = httpStatus.ok;\n _headers: Partial<Record<InternalHttpHeaders, string>> = {};\n _body: unknown = '';\n _stringBody = '';\n _encoding: InternalHttpEncoding = httpEncoding.utf8;\n\n constructor(request: Request) {\n this._request = request;\n this._setSecurityHeaders();\n }\n\n _parseResponseIntoString(): void {\n // Example: HTTP/1.1 200 OK\n const statusLine = `${this._request.protocol} ${this._statusCode} ${this._status}`;\n\n // Example: Content-Type: text/html\n const headerLines = Object.entries(this._headers).map(([key, value]) => `${key}: ${value}`);\n\n // Determine encoding based on Content-Type header and body content\n const encoding = determineEncoding(this._headers['content-type'], this._body);\n\n // Example: <html><body><h1>Hello, world!</h1></body></html> or { \"message\": \"Hello, world!\" }\n const body = formatBodyIntoString(this._body, { encoding });\n\n // Example: HTTP/1.1 200 OK\\nContent-Type: text/html\\n\\n<html><body><h1>Hello, world!</h1></body></html>\n this._encoding = encoding;\n this._stringBody = `${statusLine}\\n${headerLines.join('\\n')}\\n\\n${body}`;\n\n const contentLength = determineContentLength(this._stringBody, this._encoding);\n this._setHeadersIfNotSet({\n Date: dayjs().format('ddd, DD MMM YYYY HH:mm:ss [GMT]'),\n 'Content-Length': contentLength,\n });\n }\n\n _setHeadersIfNotSet(headers: Partial<Record<InternalHttpHeaders, string>>): void {\n // SECURITY: Filter undefined values and validate response headers for CRLF injection\n // Only validate headers that aren't already set\n const headersToSet: Record<string, string> = {};\n for (const [key, value] of Object.entries(headers)) {\n if (value !== undefined && !(key in this._headers)) {\n headersToSet[key] = value;\n }\n }\n\n const validatedHeaders = filterAndValidateHeaders(headersToSet);\n\n // Set headers after validation passes\n Object.assign(this._headers, validatedHeaders);\n }\n\n _setBody(body: unknown): void {\n this._body = body;\n\n // Auto-set content-type if not already set\n if (!this._headers['content-type']) {\n const detectedContentType = inferContentType(body);\n this._setHeadersIfNotSet({\n 'Content-Type': detectedContentType,\n });\n }\n }\n\n setStatusCode(statusCode: InternalHttpStatusCode): void {\n this._statusCode = statusCode;\n this._status = mapStatusCodeToMessage(statusCode);\n }\n\n addHeaders(headers: Partial<Record<InternalHttpHeaders, string>>): void {\n // SECURITY: Filter undefined values and validate response headers for CRLF injection\n const validatedHeaders = filterAndValidateHeaders(headers);\n\n // Set headers after validation passes\n this._headers = { ...this._headers, ...validatedHeaders };\n }\n\n removeHeaders(headerNames: Array<InternalHttpHeaders>): void {\n for (const headerName of headerNames) {\n delete this._headers[headerName];\n }\n }\n\n /**\n * Set default security headers to protect against common vulnerabilities\n * These headers are set only if not already present, allowing users to override if needed\n */\n _setSecurityHeaders(): void {\n this._setHeadersIfNotSet({\n 'X-Content-Type-Options': 'nosniff',\n 'X-Frame-Options': 'DENY',\n 'X-XSS-Protection': '1; mode=block',\n 'Referrer-Policy': 'strict-origin-when-cross-origin',\n });\n }\n}\n",
|
|
24
26
|
"/**\n * Format the body into a string for HTTP response transmission\n *\n * Handles various body types including:\n * - Objects/Arrays: JSON stringified\n * - Strings: returned as-is\n * - Binary data (Buffer/Uint8Array): converted to base64 or kept as binary string\n * - Primitives: converted to string\n * - null/undefined: empty string\n *\n * @example\n * ```typescript\n * // JSON object\n * const body = { message: 'Hello, world!' };\n * const formattedBody = formatBodyIntoString(body);\n * // formattedBody === '{\"message\":\"Hello, world!\"}'\n *\n * // Binary data\n * const binaryBody = Buffer.from('binary data');\n * const formattedBinary = formatBodyIntoString(binaryBody);\n * // formattedBinary === 'binary data' (as string)\n *\n * // Base64 encoding option for true binary\n * const imageBuffer = Buffer.from([0xFF, 0xD8, 0xFF]); // JPEG header\n * const base64Body = formatBodyIntoString(imageBuffer, { encoding: 'base64' });\n * // base64Body === '/9j/' (base64 encoded)\n * ```\n */\nexport const formatBodyIntoString = (body: unknown, options?: { encoding?: 'base64' | 'binary' | 'utf8' }): string => {\n const encoding = options?.encoding ?? 'utf8';\n\n // Handle null/undefined\n if (body === null || body === undefined) return '';\n\n // Handle binary data types\n if (Buffer.isBuffer(body)) return handleBuffer(body, encoding);\n if (body instanceof Uint8Array) return handleUint8Array(body, encoding);\n if (body instanceof ArrayBuffer) return handleArrayBuffer(body, encoding);\n\n // Handle strings\n if (typeof body === 'string') return body;\n\n // Handle objects and arrays (including Date, etc.)\n if (typeof body === 'object') return handleObjectsAndArrays(body);\n\n // Handle all primitives and functions - they all stringify the same way\n // This covers: number, boolean, bigint, symbol, function\n return String(body as string);\n};\n\nconst handleBuffer = (body: Buffer, encoding: 'base64' | 'binary' | 'utf8'): string => {\n if (encoding === 'base64') return body.toString('base64');\n if (encoding === 'binary') return body.toString('binary');\n return body.toString('utf8');\n};\n\nconst handleUint8Array = (body: Uint8Array, encoding: 'base64' | 'binary' | 'utf8'): string => {\n const buffer = Buffer.from(body);\n return handleBuffer(buffer, encoding);\n};\n\nconst handleArrayBuffer = (body: ArrayBuffer, encoding: 'base64' | 'binary' | 'utf8'): string => {\n const buffer = Buffer.from(body);\n return handleBuffer(buffer, encoding);\n};\n\nconst handleObjectsAndArrays = (body: unknown): string => {\n try {\n return JSON.stringify(body);\n } catch (_) {\n // Fallback for non-serializable objects (circular refs, etc.)\n // This will return something like \"[object Object]\" but that's better than crashing\n return String(body);\n }\n};\n",
|
|
25
27
|
"import { httpStatus, httpStatusCode } from '@constants/http.ts';\nimport type { InternalHttpStatus, InternalHttpStatusCode } from '@typedefs/constants/http.js';\n\n/**\n * Map of status codes to their corresponding status messages\n * Built dynamically from the constants to ensure they stay in sync\n */\nconst statusCodeMap = new Map<number, string>();\n\n// Build the map from the constants\nfor (const [key, code] of Object.entries(httpStatusCode)) {\n const statusKey = key as keyof typeof httpStatus;\n const message = httpStatus[statusKey];\n\n statusCodeMap.set(code, message);\n}\n\n/**\n * Map a status code to its corresponding HTTP status message\n *\n * @param statusCode - The HTTP status code to map\n * @returns The corresponding HTTP status message\n *\n * @example\n * ```typescript\n * mapStatusCodeToMessage(200) // returns \"OK\"\n * mapStatusCodeToMessage(404) // returns \"Not Found\"\n * mapStatusCodeToMessage(500) // returns \"Internal Server Error\"\n * ```\n */\nexport const mapStatusCodeToMessage = (statusCode: InternalHttpStatusCode): InternalHttpStatus => {\n const message = statusCodeMap.get(statusCode);\n\n if (!message) {\n throw new Error(`Unknown status code: ${statusCode}`);\n }\n\n return message as InternalHttpStatus;\n};\n\n/**\n * Check if a status code is valid/supported\n *\n * @param statusCode - The status code to validate\n * @returns true if the status code is supported\n */\nexport const isValidStatusCode = (statusCode: number): statusCode is InternalHttpStatusCode => statusCodeMap.has(statusCode);\n",
|
|
26
28
|
"/**\n * Response header validation utilities for security and format compliance\n *\n * This module contains security-focused header validation functions,\n * particularly for preventing CRLF injection attacks in outgoing response headers.\n */\n\n/**\n * Validate response header value for CRLF injection attempts\n * Use this when setting response headers with user input\n */\nexport const validateResponseHeaderValue = (headerName: string, headerValue: string): void => {\n // SECURITY: Check for CRLF injection in response header values\n // This is where CRLF injection actually matters - when setting response headers\n\n if (typeof headerValue !== 'string') {\n throw new Error(`Header value must be a string, got ${typeof headerValue}`);\n }\n\n // SECURITY: Detect CRLF injection patterns that could inject additional headers\n if (headerValue.includes('\\r') || headerValue.includes('\\n')) {\n throw new Error(`Header value contains invalid line break characters: ${headerName}`);\n }\n\n // SECURITY: Detect common injection patterns\n const suspiciousPatterns = [\n // Pattern: value\\r\\nSet-Cookie: or value\\nLocation: etc.\n /[\\r\\n](?:set-cookie|location|authorization|www-authenticate):/i,\n // Pattern: Double CRLF (could inject HTTP response)\n /\\r\\n\\r\\n|\\n\\n/,\n // Pattern: HTTP response line injection\n /[\\r\\n]http\\/\\d\\.\\d\\s+\\d+/i,\n ];\n\n for (const pattern of suspiciousPatterns) {\n if (pattern.test(headerValue)) {\n throw new Error(`Header value contains suspicious injection pattern: ${headerName}`);\n }\n }\n};\n\n/**\n * Validate multiple response header values\n * Convenience function for validating header objects\n */\nexport const validateResponseHeaders = (headers: Record<string, string>): void => {\n for (const [name, value] of Object.entries(headers)) {\n validateResponseHeaderValue(name, value);\n }\n};\n\n/**\n * Filter and validate headers, removing undefined values and validating security\n * Returns only valid, defined header entries\n */\nexport const filterAndValidateHeaders = (headers: Partial<Record<string, string | undefined>>): Record<string, string> => {\n // Filter out undefined values using simple, readable approach\n const definedHeaders: Record<string, string> = {};\n for (const [key, value] of Object.entries(headers)) {\n if (value !== undefined) {\n definedHeaders[key] = value;\n }\n }\n\n // Validate the filtered headers\n validateResponseHeaders(definedHeaders);\n\n return definedHeaders;\n};\n",
|
|
27
|
-
"import
|
|
29
|
+
"import type { InternalHttpEncoding } from '@typedefs/constants/http.js';\nimport { httpEncoding } from '@constants/http.ts';\n\n/**\n * Determine the Content-Length header value for a response body\n *\n * Calculates the byte length of the response body after it's been\n * formatted into a string for HTTP transmission. This accounts for\n * different encodings and body types.\n */\n\nexport const determineContentLength = (body: string | null | undefined, encoding?: InternalHttpEncoding): string => {\n if (!body) return '0';\n\n // Calculate byte length based on encoding\n let byteLength = 0;\n\n if (encoding === httpEncoding.base64) {\n // For base64, we need the length of the base64 string\n byteLength = Buffer.byteLength(body, 'utf8');\n }\n if (encoding === httpEncoding.binary) {\n // For binary encoding, each character represents one byte\n byteLength = body.length;\n }\n\n // For utf8 and default cases\n if (encoding === httpEncoding.utf8) {\n byteLength = Buffer.byteLength(body, 'utf8');\n }\n\n return String(byteLength);\n};\n",
|
|
28
30
|
"import { RequestImpl } from '@core/execution/RequestImpl.ts';\nimport { ResponseImpl } from '@core/execution/ResponseImpl.ts';\nimport type { SetupImpl } from '@core/setup/SetupImpl.ts';\nimport type { InternalContextImpl } from '@typedefs/internal/InternalContextImpl.ts';\nimport type { InternalRequestImpl } from '@typedefs/internal/InternalRequestImpl.js';\nimport type { InternalResponseImpl } from '@typedefs/internal/InternalResponseImpl.js';\nimport type { Request } from '@typedefs/public/Request.ts';\nimport type { Response } from '@typedefs/public/Response.ts';\n\n/**\n * ContextImpl is the core class that handles the building of the context.\n * It is responsible for building the request and response objects.\n */\nexport class ContextImpl implements InternalContextImpl {\n readonly _request: InternalRequestImpl;\n readonly _response: InternalResponseImpl;\n\n request: Request;\n response: Response;\n\n constructor(rawRequest: Buffer | string, setup: SetupImpl, clientAddress?: string) {\n this._request = new RequestImpl(rawRequest, setup, clientAddress);\n this._response = new ResponseImpl(this._request);\n\n this.request = this._request;\n this.response = this._response;\n }\n}\n",
|
|
29
|
-
"/**\n * YinzerFlow Logging Levels\n *\n *
|
|
30
|
-
"import type { ServerConfiguration } from '@typedefs/public/Configuration.js';\nimport type { InternalServerConfiguration } from '@typedefs/internal/InternalConfiguration.js';\nimport { logLevels } from '@constants/log.ts';\nimport { httpStatusCode } from '@constants/http.ts';\n\n/**\n * Default CORS configuration for when CORS is enabled\n */\nconst DEFAULT_CORS_ENABLED_CONFIG = {\n enabled: true,\n origin: '*',\n methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],\n allowedHeaders: '*',\n exposedHeaders: [],\n credentials: false,\n maxAge: 86400, // 24 hours\n preflightContinue: false,\n optionsSuccessStatus: httpStatusCode.noContent,\n};\n\n/**\n * Default body parser configuration with secure defaults\n */\nconst DEFAULT_BODY_PARSER_CONFIG = {\n json: {\n maxSize: 262144, // 256KB - reasonable for JSON APIs (Express uses 100KB)\n maxDepth: 10, // Prevent deeply nested objects that can cause stack overflow\n allowPrototypeProperties: false, // SECURITY: Block prototype pollution by default\n maxKeys: 1000, // Prevent memory exhaustion from objects with too many keys\n maxStringLength: 1048576, // 1MB per string - prevent memory exhaustion\n maxArrayLength: 10000, // Prevent memory exhaustion from large arrays\n },\n fileUploads: {\n maxFileSize: 10485760, // 10MB per file - reasonable for documents/images\n maxTotalSize: 52428800, // 50MB total - prevent bulk upload attacks\n maxFiles: 10, // Reasonable number of files per request\n allowedExtensions: [], // Empty array = all extensions allowed\n blockedExtensions: ['.exe', '.bat', '.cmd', '.scr', '.pif', '.com'], // Block dangerous executables\n maxFilenameLength: 255, // Standard filesystem limit\n },\n urlEncoded: {\n maxSize: 1048576, // 1MB for form data\n maxFields: 1000, // Prevent field spam attacks\n maxFieldNameLength: 100, // Reasonable field name length\n maxFieldLength: 1048576, // 1MB per field value\n },\n};\n\n/**\n * Default IP security configuration with secure defaults\n */\nconst DEFAULT_IP_SECURITY_CONFIG = {\n trustedProxies: ['127.0.0.1', '::1'], // Localhost only by default\n allowPrivateIps: true, // Allow private IPs for internal usage\n headerPreference: ['x-forwarded-for', 'x-real-ip', 'cf-connecting-ip', 'x-client-ip', 'true-client-ip'],\n maxChainLength: 10, // Reasonable proxy chain length\n detectSpoofing: true, // Enable security by default\n};\n\n/**\n * Default configuration object\n */\nconst DEFAULT_CONFIGURATION: InternalServerConfiguration = {\n port: 5000,\n host: '0.0.0.0',\n logLevel: logLevels.off,\n cors: {\n enabled: false, // Disabled by default\n },\n bodyParser: DEFAULT_BODY_PARSER_CONFIG,\n ipSecurity: DEFAULT_IP_SECURITY_CONFIG,\n connectionOptions: {\n socketTimeout: 30000,\n gracefulShutdownTimeout: 30000,\n keepAliveTimeout: 65000,\n headersTimeout: 66000,\n },\n};\n\n/**\n * Validate JSON parser configuration minimums\n */\nconst _validateJsonConfig = (config: InternalServerConfiguration['bodyParser']['json']): void => {\n if (config.maxSize < 1) {\n throw new Error('bodyParser.json.maxSize must be at least 1 byte');\n }\n\n if (config.maxDepth < 1) {\n throw new Error('bodyParser.json.maxDepth must be at least 1');\n }\n\n if (config.maxKeys < 1) {\n throw new Error('bodyParser.json.maxKeys must be at least 1');\n }\n\n if (config.maxStringLength < 1) {\n throw new Error('bodyParser.json.maxStringLength must be at least 1 byte');\n }\n\n if (config.maxArrayLength < 1) {\n throw new Error('bodyParser.json.maxArrayLength must be at least 1');\n }\n};\n\n/**\n * Validate file upload configuration minimums\n */\nconst _validateFileUploadConfig = (config: InternalServerConfiguration['bodyParser']['fileUploads']): void => {\n if (config.maxFileSize < 1) {\n throw new Error('bodyParser.fileUploads.maxFileSize must be at least 1 byte');\n }\n\n if (config.maxTotalSize < 1) {\n throw new Error('bodyParser.fileUploads.maxTotalSize must be at least 1 byte');\n }\n\n if (config.maxFiles < 1) {\n throw new Error('bodyParser.fileUploads.maxFiles must be at least 1');\n }\n\n if (config.maxFilenameLength < 1) {\n throw new Error('bodyParser.fileUploads.maxFilenameLength must be at least 1 character');\n }\n};\n\n/**\n * Validate URL-encoded configuration minimums\n */\nconst _validateUrlEncodedConfig = (config: InternalServerConfiguration['bodyParser']['urlEncoded']): void => {\n if (config.maxSize < 1) {\n throw new Error('bodyParser.urlEncoded.maxSize must be at least 1 byte');\n }\n\n if (config.maxFields < 1) {\n throw new Error('bodyParser.urlEncoded.maxFields must be at least 1');\n }\n\n if (config.maxFieldNameLength < 1) {\n throw new Error('bodyParser.urlEncoded.maxFieldNameLength must be at least 1 character');\n }\n\n if (config.maxFieldLength < 1) {\n throw new Error('bodyParser.urlEncoded.maxFieldLength must be at least 1 byte');\n }\n};\n\n/**\n * Validate IP security configuration minimums\n */\nconst _validateIpSecurityConfig = (config: InternalServerConfiguration['ipSecurity']): void => {\n if (!Array.isArray(config.trustedProxies)) {\n throw new Error('ipSecurity.trustedProxies must be an array');\n }\n\n if (!Array.isArray(config.headerPreference)) {\n throw new Error('ipSecurity.headerPreference must be an array');\n }\n\n if (config.headerPreference.length === 0) {\n throw new Error('ipSecurity.headerPreference must contain at least one header');\n }\n\n if (config.maxChainLength < 1) {\n throw new Error('ipSecurity.maxChainLength must be at least 1');\n }\n\n if (config.maxChainLength > 50) {\n throw new Error('ipSecurity.maxChainLength must not exceed 50 to prevent DoS attacks');\n }\n};\n\n/**\n * Issue security warnings for risky JSON configurations\n */\nconst _warnJsonConfig = (config: InternalServerConfiguration['bodyParser']['json']): void => {\n if (config.allowPrototypeProperties) {\n console.warn(\n '[SECURITY WARNING] bodyParser.json.allowPrototypeProperties is enabled. This allows prototype pollution attacks. ' +\n 'Only enable this if you absolutely need it and have other protections in place.',\n );\n }\n\n // Warn about very large JSON sizes (but don't block them)\n if (config.maxSize > 10485760) {\n // 10MB\n console.warn(\n `[SECURITY WARNING] bodyParser.json.maxSize is set to ${config.maxSize} bytes (${Math.round(config.maxSize / 1024 / 1024)}MB). ` +\n 'Large JSON payloads can cause memory exhaustion and DoS attacks. Consider if this size is necessary.',\n );\n }\n\n // Warn about very deep nesting (but don't block it)\n if (config.maxDepth > 50) {\n console.warn(\n `[SECURITY WARNING] bodyParser.json.maxDepth is set to ${config.maxDepth}. ` +\n 'Very deep JSON nesting can cause stack overflow attacks. Consider if this depth is necessary.',\n );\n }\n};\n\n/**\n * Issue security warnings for risky file upload configurations\n */\nconst _warnFileUploadConfig = (config: InternalServerConfiguration['bodyParser']['fileUploads']): void => {\n // Warn about very large file uploads (but don't block them)\n if (config.maxFileSize > 104857600) {\n // 100MB\n console.warn(\n `[SECURITY WARNING] bodyParser.fileUploads.maxFileSize is set to ${config.maxFileSize} bytes (${Math.round(config.maxFileSize / 1024 / 1024)}MB). ` +\n 'Large file uploads can consume significant server resources.',\n );\n }\n\n if (config.maxTotalSize > 1073741824) {\n // 1GB\n console.warn(\n `[SECURITY WARNING] bodyParser.fileUploads.maxTotalSize is set to ${config.maxTotalSize} bytes (${Math.round(config.maxTotalSize / 1024 / 1024 / 1024)}GB). ` +\n 'Very large total upload sizes can cause memory and disk space exhaustion.',\n );\n }\n\n // Validate file extension security\n const dangerousExtensions = ['.exe', '.bat', '.cmd', '.scr', '.pif', '.com', '.vbs', '.jar', '.app'];\n const allowedDangerous = config.allowedExtensions.filter((ext) => dangerousExtensions.includes(ext.toLowerCase()));\n\n if (allowedDangerous.length > 0) {\n console.warn(\n `[SECURITY WARNING] bodyParser.fileUploads.allowedExtensions includes dangerous file types: ${allowedDangerous.join(', ')}. ` +\n 'This could allow execution of malicious files. Only allow these if absolutely necessary.',\n );\n }\n\n // Warn if no blocked extensions and no allowed extensions (completely open)\n if (config.blockedExtensions.length === 0 && config.allowedExtensions.length === 0) {\n console.warn(\n '[SECURITY WARNING] File uploads have no extension restrictions (no blockedExtensions and no allowedExtensions). ' +\n 'Consider adding blockedExtensions or allowedExtensions to improve security.',\n );\n }\n};\n\n/**\n * Issue security warnings for risky IP security configurations\n */\nconst _warnIpSecurityConfig = (config: InternalServerConfiguration['ipSecurity']): void => {\n // Warn about wildcard or overly permissive trusted proxies\n if (config.trustedProxies.length === 0) {\n console.warn('[SECURITY WARNING] ipSecurity.trustedProxies is empty. No proxy headers will be trusted, which may prevent proper client IP detection.');\n }\n\n // Warn about very long proxy chains\n if (config.maxChainLength > 20) {\n console.warn(\n `[SECURITY WARNING] ipSecurity.maxChainLength is set to ${config.maxChainLength}. ` +\n 'Very long proxy chains can consume significant resources and may indicate amplification attacks.',\n );\n }\n\n // Warn if spoofing detection is disabled\n if (!config.detectSpoofing) {\n console.warn(\n '[SECURITY WARNING] ipSecurity.detectSpoofing is disabled. ' +\n 'This reduces protection against IP spoofing attacks. Only disable if you have other protective measures.',\n );\n }\n};\n\n/**\n * Handle CORS configuration merging\n */\nconst _handleCorsConfig = (defaultConfig: InternalServerConfiguration, userConfig?: ServerConfiguration): void => {\n if (userConfig?.cors?.enabled) {\n // When CORS is enabled, merge with enabled defaults\n // We ensure enabled is literally true to satisfy the type constraint\n defaultConfig.cors = {\n ...DEFAULT_CORS_ENABLED_CONFIG,\n ...userConfig.cors,\n enabled: true, // Override to ensure literal true type\n };\n }\n};\n\n/**\n * Handle body parser configuration merging and validation\n */\nconst _handleBodyParserConfig = (defaultConfig: InternalServerConfiguration, userConfig?: ServerConfiguration): void => {\n if (userConfig?.bodyParser) {\n defaultConfig.bodyParser = {\n json: {\n ...DEFAULT_BODY_PARSER_CONFIG.json,\n ...userConfig.bodyParser.json,\n },\n fileUploads: {\n ...DEFAULT_BODY_PARSER_CONFIG.fileUploads,\n ...userConfig.bodyParser.fileUploads,\n },\n urlEncoded: {\n ...DEFAULT_BODY_PARSER_CONFIG.urlEncoded,\n ...userConfig.bodyParser.urlEncoded,\n },\n };\n\n // Validate configuration for security\n _validateBodyParserConfig(defaultConfig.bodyParser);\n }\n};\n\n/**\n * Handle IP security configuration merging and validation\n */\nconst _handleIpSecurityConfig = (defaultConfig: InternalServerConfiguration, userConfig?: ServerConfiguration): void => {\n if (userConfig?.ipSecurity) {\n defaultConfig.ipSecurity = {\n ...DEFAULT_IP_SECURITY_CONFIG,\n ...userConfig.ipSecurity,\n };\n\n // Validate configuration for security\n _validateIpSecurityConfig(defaultConfig.ipSecurity);\n _warnIpSecurityConfig(defaultConfig.ipSecurity);\n }\n};\n\n/**\n * Validate port number\n */\nconst _validatePort = (defaultConfig: InternalServerConfiguration, userConfig?: ServerConfiguration): void => {\n if (userConfig?.port !== undefined) {\n const normalizedPort = Number(userConfig.port);\n if (isNaN(normalizedPort) || normalizedPort < 1 || normalizedPort > 65535) {\n throw new Error('Invalid port number');\n }\n defaultConfig.port = normalizedPort;\n }\n};\n\n/**\n * Validate body parser configuration to prevent broken settings and warn about risky configurations\n */\nconst _validateBodyParserConfig = (config: InternalServerConfiguration['bodyParser']): void => {\n // Validate minimums for all parser types\n _validateJsonConfig(config.json);\n _validateFileUploadConfig(config.fileUploads);\n _validateUrlEncodedConfig(config.urlEncoded);\n\n // Issue security warnings for risky configurations (but don't block them)\n _warnJsonConfig(config.json);\n _warnFileUploadConfig(config.fileUploads);\n};\n\n/**\n * Handle custom configuration\n */\nexport const handleCustomConfiguration = (configuration?: ServerConfiguration): InternalServerConfiguration => {\n // Start with default configuration\n const result = { ...DEFAULT_CONFIGURATION };\n\n // Merge user configuration with proper handling of nested objects\n Object.assign(result, configuration);\n\n // Handle special configuration sections\n _handleCorsConfig(result, configuration);\n _handleBodyParserConfig(result, configuration);\n _handleIpSecurityConfig(result, configuration);\n _validatePort(result, configuration);\n\n return result;\n};\n",
|
|
31
|
+
"/**\n * YinzerFlow Logging Levels\n *\n * String-based logging levels for intuitive configuration:\n * - 'off': No logging except errors\n * - 'error': Only errors\n * - 'warn': Warnings and errors (includes security warnings, slow requests)\n * - 'info': Info, warnings, and errors (standard application logging)\n *\n * Network logging is controlled separately via boolean networkLogging config.\n */\nexport const logLevels = {\n off: 'off',\n error: 'error',\n warn: 'warn',\n info: 'info',\n} as const;\n",
|
|
32
|
+
"import type { ServerConfiguration } from '@typedefs/public/Configuration.js';\nimport type { InternalServerConfiguration } from '@typedefs/internal/InternalConfiguration.js';\nimport { logLevels } from '@constants/log.ts';\nimport { httpStatusCode } from '@constants/http.ts';\nimport { log } from '@core/utils/log.ts';\n\n/**\n * Default CORS configuration for when CORS is enabled\n */\nconst DEFAULT_CORS_ENABLED_CONFIG = {\n enabled: true,\n origin: '*',\n methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],\n allowedHeaders: '*',\n exposedHeaders: [],\n credentials: false,\n maxAge: 86400, // 24 hours\n preflightContinue: false,\n optionsSuccessStatus: httpStatusCode.noContent,\n};\n\n/**\n * Default body parser configuration with secure defaults\n */\nconst DEFAULT_BODY_PARSER_CONFIG = {\n json: {\n maxSize: 262144, // 256KB - reasonable for JSON APIs (Express uses 100KB)\n maxDepth: 10, // Prevent deeply nested objects that can cause stack overflow\n allowPrototypeProperties: false, // SECURITY: Block prototype pollution by default\n maxKeys: 1000, // Prevent memory exhaustion from objects with too many keys\n maxStringLength: 1048576, // 1MB per string - prevent memory exhaustion\n maxArrayLength: 10000, // Prevent memory exhaustion from large arrays\n },\n fileUploads: {\n maxFileSize: 10485760, // 10MB per file - reasonable for documents/images\n maxTotalSize: 52428800, // 50MB total - prevent bulk upload attacks\n maxFiles: 10, // Reasonable number of files per request\n allowedExtensions: [], // Empty array = all extensions allowed\n blockedExtensions: ['.exe', '.bat', '.cmd', '.scr', '.pif', '.com'], // Block dangerous executables\n maxFilenameLength: 255, // Standard filesystem limit\n },\n urlEncoded: {\n maxSize: 1048576, // 1MB for form data\n maxFields: 1000, // Prevent field spam attacks\n maxFieldNameLength: 100, // Reasonable field name length\n maxFieldLength: 1048576, // 1MB per field value\n },\n};\n\n/**\n * Default IP security configuration with secure defaults\n */\nconst DEFAULT_IP_SECURITY_CONFIG = {\n trustedProxies: ['127.0.0.1', '::1'], // Localhost only by default\n allowPrivateIps: true, // Allow private IPs for internal usage\n headerPreference: ['x-forwarded-for', 'x-real-ip', 'cf-connecting-ip', 'x-client-ip', 'true-client-ip'],\n maxChainLength: 10, // Reasonable proxy chain length\n detectSpoofing: true, // Enable security by default\n};\n\n/**\n * Default configuration object\n */\nconst DEFAULT_CONFIGURATION: InternalServerConfiguration = {\n port: 5000,\n host: '0.0.0.0',\n logLevel: logLevels.warn,\n networkLogs: false,\n cors: {\n enabled: false, // Disabled by default\n },\n bodyParser: DEFAULT_BODY_PARSER_CONFIG,\n ipSecurity: DEFAULT_IP_SECURITY_CONFIG,\n connectionOptions: {\n socketTimeout: 30000,\n gracefulShutdownTimeout: 30000,\n keepAliveTimeout: 65000,\n headersTimeout: 66000,\n },\n};\n\n/**\n * Validate JSON parser configuration minimums\n */\nconst _validateJsonConfig = (config: InternalServerConfiguration['bodyParser']['json']): void => {\n if (config.maxSize < 1) {\n throw new Error('bodyParser.json.maxSize must be at least 1 byte');\n }\n\n if (config.maxDepth < 1) {\n throw new Error('bodyParser.json.maxDepth must be at least 1');\n }\n\n if (config.maxKeys < 1) {\n throw new Error('bodyParser.json.maxKeys must be at least 1');\n }\n\n if (config.maxStringLength < 1) {\n throw new Error('bodyParser.json.maxStringLength must be at least 1 byte');\n }\n\n if (config.maxArrayLength < 1) {\n throw new Error('bodyParser.json.maxArrayLength must be at least 1');\n }\n};\n\n/**\n * Validate file upload configuration minimums\n */\nconst _validateFileUploadConfig = (config: InternalServerConfiguration['bodyParser']['fileUploads']): void => {\n if (config.maxFileSize < 1) {\n throw new Error('bodyParser.fileUploads.maxFileSize must be at least 1 byte');\n }\n\n if (config.maxTotalSize < 1) {\n throw new Error('bodyParser.fileUploads.maxTotalSize must be at least 1 byte');\n }\n\n if (config.maxFiles < 1) {\n throw new Error('bodyParser.fileUploads.maxFiles must be at least 1');\n }\n\n if (config.maxFilenameLength < 1) {\n throw new Error('bodyParser.fileUploads.maxFilenameLength must be at least 1 character');\n }\n};\n\n/**\n * Validate URL-encoded configuration minimums\n */\nconst _validateUrlEncodedConfig = (config: InternalServerConfiguration['bodyParser']['urlEncoded']): void => {\n if (config.maxSize < 1) {\n throw new Error('bodyParser.urlEncoded.maxSize must be at least 1 byte');\n }\n\n if (config.maxFields < 1) {\n throw new Error('bodyParser.urlEncoded.maxFields must be at least 1');\n }\n\n if (config.maxFieldNameLength < 1) {\n throw new Error('bodyParser.urlEncoded.maxFieldNameLength must be at least 1 character');\n }\n\n if (config.maxFieldLength < 1) {\n throw new Error('bodyParser.urlEncoded.maxFieldLength must be at least 1 byte');\n }\n};\n\n/**\n * Validate IP security configuration minimums\n */\nconst _validateIpSecurityConfig = (config: InternalServerConfiguration['ipSecurity']): void => {\n if (!Array.isArray(config.trustedProxies)) {\n throw new Error('ipSecurity.trustedProxies must be an array');\n }\n\n if (!Array.isArray(config.headerPreference)) {\n throw new Error('ipSecurity.headerPreference must be an array');\n }\n\n if (config.headerPreference.length === 0) {\n throw new Error('ipSecurity.headerPreference must contain at least one header');\n }\n\n if (config.maxChainLength < 1) {\n throw new Error('ipSecurity.maxChainLength must be at least 1');\n }\n\n if (config.maxChainLength > 50) {\n throw new Error('ipSecurity.maxChainLength must not exceed 50 to prevent DoS attacks');\n }\n};\n\n/**\n * Issue security warnings for risky JSON configurations\n */\nconst _warnJsonConfig = (config: InternalServerConfiguration['bodyParser']['json']): void => {\n if (config.allowPrototypeProperties) {\n log.warn(\n '[SECURITY WARNING] bodyParser.json.allowPrototypeProperties is enabled. This allows prototype pollution attacks. ' +\n 'Only enable this if you absolutely need it and have other protections in place.',\n );\n }\n\n // Warn about very large JSON sizes (but don't block them)\n if (config.maxSize > 10485760) {\n // 10MB\n log.warn(\n `[SECURITY WARNING] bodyParser.json.maxSize is set to ${config.maxSize} bytes (${Math.round(config.maxSize / 1024 / 1024)}MB). ` +\n 'Large JSON payloads can cause memory exhaustion and DoS attacks. Consider if this size is necessary.',\n );\n }\n\n // Warn about very deep nesting (but don't block it)\n if (config.maxDepth > 50) {\n log.warn(\n `[SECURITY WARNING] bodyParser.json.maxDepth is set to ${config.maxDepth}. ` +\n 'Very deep JSON nesting can cause stack overflow attacks. Consider if this depth is necessary.',\n );\n }\n};\n\n/**\n * Issue security warnings for risky file upload configurations\n */\nconst _warnFileUploadConfig = (config: InternalServerConfiguration['bodyParser']['fileUploads']): void => {\n // Warn about very large file uploads (but don't block them)\n if (config.maxFileSize > 104857600) {\n // 100MB\n log.warn(\n `[SECURITY WARNING] bodyParser.fileUploads.maxFileSize is set to ${config.maxFileSize} bytes (${Math.round(config.maxFileSize / 1024 / 1024)}MB). ` +\n 'Large file uploads can consume significant server resources.',\n );\n }\n\n if (config.maxTotalSize > 1073741824) {\n // 1GB\n log.warn(\n `[SECURITY WARNING] bodyParser.fileUploads.maxTotalSize is set to ${config.maxTotalSize} bytes (${Math.round(config.maxTotalSize / 1024 / 1024 / 1024)}GB). ` +\n 'Very large total upload sizes can cause memory and disk space exhaustion.',\n );\n }\n\n // Validate file extension security\n const dangerousExtensions = ['.exe', '.bat', '.cmd', '.scr', '.pif', '.com', '.vbs', '.jar', '.app'];\n const allowedDangerous = config.allowedExtensions.filter((ext) => dangerousExtensions.includes(ext.toLowerCase()));\n\n if (allowedDangerous.length > 0) {\n log.warn(\n `[SECURITY WARNING] bodyParser.fileUploads.allowedExtensions includes dangerous file types: ${allowedDangerous.join(', ')}. ` +\n 'This could allow execution of malicious files. Only allow these if absolutely necessary.',\n );\n }\n\n // Warn if no blocked extensions and no allowed extensions (completely open)\n if (config.blockedExtensions.length === 0 && config.allowedExtensions.length === 0) {\n log.warn(\n '[SECURITY WARNING] File uploads have no extension restrictions (no blockedExtensions and no allowedExtensions). ' +\n 'Consider adding blockedExtensions or allowedExtensions to improve security.',\n );\n }\n};\n\n/**\n * Issue security warnings for risky IP security configurations\n */\nconst _warnIpSecurityConfig = (config: InternalServerConfiguration['ipSecurity']): void => {\n // Warn about wildcard or overly permissive trusted proxies\n if (config.trustedProxies.length === 0) {\n log.warn('[SECURITY WARNING] ipSecurity.trustedProxies is empty. No proxy headers will be trusted, which may prevent proper client IP detection.');\n }\n\n // Warn about very long proxy chains\n if (config.maxChainLength > 20) {\n log.warn(\n `[SECURITY WARNING] ipSecurity.maxChainLength is set to ${config.maxChainLength}. ` +\n 'Very long proxy chains can consume significant resources and may indicate amplification attacks.',\n );\n }\n\n // Warn if spoofing detection is disabled\n if (!config.detectSpoofing) {\n log.warn(\n '[SECURITY WARNING] ipSecurity.detectSpoofing is disabled. ' +\n 'This reduces protection against IP spoofing attacks. Only disable if you have other protective measures.',\n );\n }\n};\n\n/**\n * Handle CORS configuration merging\n */\nconst _handleCorsConfig = (defaultConfig: InternalServerConfiguration, userConfig?: ServerConfiguration): void => {\n if (userConfig?.cors?.enabled) {\n // When CORS is enabled, merge with enabled defaults\n // We ensure enabled is literally true to satisfy the type constraint\n defaultConfig.cors = {\n ...DEFAULT_CORS_ENABLED_CONFIG,\n ...userConfig.cors,\n enabled: true, // Override to ensure literal true type\n };\n }\n};\n\n/**\n * Handle body parser configuration merging and validation\n */\nconst _handleBodyParserConfig = (defaultConfig: InternalServerConfiguration, userConfig?: ServerConfiguration): void => {\n if (userConfig?.bodyParser) {\n defaultConfig.bodyParser = {\n json: {\n ...DEFAULT_BODY_PARSER_CONFIG.json,\n ...userConfig.bodyParser.json,\n },\n fileUploads: {\n ...DEFAULT_BODY_PARSER_CONFIG.fileUploads,\n ...userConfig.bodyParser.fileUploads,\n },\n urlEncoded: {\n ...DEFAULT_BODY_PARSER_CONFIG.urlEncoded,\n ...userConfig.bodyParser.urlEncoded,\n },\n };\n\n // Validate configuration for security\n _validateBodyParserConfig(defaultConfig.bodyParser);\n }\n};\n\n/**\n * Handle IP security configuration merging and validation\n */\nconst _handleIpSecurityConfig = (defaultConfig: InternalServerConfiguration, userConfig?: ServerConfiguration): void => {\n if (userConfig?.ipSecurity) {\n defaultConfig.ipSecurity = {\n ...DEFAULT_IP_SECURITY_CONFIG,\n ...userConfig.ipSecurity,\n };\n\n // Validate configuration for security\n _validateIpSecurityConfig(defaultConfig.ipSecurity);\n _warnIpSecurityConfig(defaultConfig.ipSecurity);\n }\n};\n\n/**\n * Validate port number\n */\nconst _validatePort = (defaultConfig: InternalServerConfiguration, userConfig?: ServerConfiguration): void => {\n if (userConfig?.port !== undefined) {\n const normalizedPort = Number(userConfig.port);\n if (isNaN(normalizedPort) || normalizedPort < 1 || normalizedPort > 65535) {\n throw new Error('Invalid port number');\n }\n defaultConfig.port = normalizedPort;\n }\n};\n\n/**\n * Validate body parser configuration to prevent broken settings and warn about risky configurations\n */\nconst _validateBodyParserConfig = (config: InternalServerConfiguration['bodyParser']): void => {\n // Validate minimums for all parser types\n _validateJsonConfig(config.json);\n _validateFileUploadConfig(config.fileUploads);\n _validateUrlEncodedConfig(config.urlEncoded);\n\n // Issue security warnings for risky configurations (but don't block them)\n _warnJsonConfig(config.json);\n _warnFileUploadConfig(config.fileUploads);\n};\n\n/**\n * Handle custom configuration\n */\nexport const handleCustomConfiguration = (configuration?: ServerConfiguration): InternalServerConfiguration => {\n // Start with default configuration\n const result = { ...DEFAULT_CONFIGURATION };\n\n // Merge user configuration with proper handling of nested objects\n Object.assign(result, configuration);\n\n // Handle special configuration sections\n _handleCorsConfig(result, configuration);\n _handleBodyParserConfig(result, configuration);\n _handleIpSecurityConfig(result, configuration);\n _validatePort(result, configuration);\n\n return result;\n};\n",
|
|
31
33
|
"import { httpStatusCode } from '@constants/http.ts';\nimport type { InternalGlobalHookOptions, InternalHookRegistryImpl } from '@typedefs/internal/InternalHookRegistryImpl.js';\nimport type { HandlerCallback } from '@typedefs/public/Context.js';\n\nexport class HookRegistryImpl implements InternalHookRegistryImpl {\n readonly _beforeAll: Set<{\n handler: HandlerCallback;\n options?: InternalGlobalHookOptions;\n }>;\n readonly _afterAll: Set<{\n handler: HandlerCallback;\n options?: InternalGlobalHookOptions;\n }>;\n _onError: HandlerCallback;\n _onNotFound: HandlerCallback;\n\n constructor() {\n this._beforeAll = new Set();\n this._afterAll = new Set();\n this._onError = (ctx): unknown => {\n ctx.response.setStatusCode(httpStatusCode.internalServerError);\n return { success: false, message: 'Internal Server Error' };\n };\n this._onNotFound = (ctx): unknown => {\n ctx.response.setStatusCode(httpStatusCode.notFound);\n return { success: false, message: '404 Not Found' };\n };\n }\n\n _addBeforeHooks(handlers: Array<HandlerCallback>, options?: InternalGlobalHookOptions): void {\n for (const handler of handlers) this._beforeAll.add({ handler, options: options ?? { routesToExclude: [], routesToInclude: [] } });\n }\n\n _addAfterHooks(handlers: Array<HandlerCallback>, options?: InternalGlobalHookOptions): void {\n for (const handler of handlers) this._afterAll.add({ handler, options: options ?? { routesToExclude: [], routesToInclude: [] } });\n }\n\n _addOnError(handler: HandlerCallback): void {\n this._onError = handler;\n }\n\n _addOnNotFound(handler: HandlerCallback): void {\n this._onNotFound = handler;\n }\n}\n",
|
|
32
34
|
"import type { InternalPreCompiledRoute, InternalRouteRegistry } from '@typedefs/internal/InternalRouteRegistryImpl.d.ts';\n\n/**\n * Compile a route pattern into a regular expression\n *\n * @example\n * ```ts\n * compileRoutePattern({ path: '/users/:id/posts/:postId' });\n * // Returns { pattern: /^users\\/([^/]+)\\/posts\\/([^/]+)$/, paramNames: ['id', 'postId'], isParameterized: true }\n * ```\n */\nexport const compileRoutePattern = (route: InternalRouteRegistry): InternalPreCompiledRoute => {\n const paramNames: Array<string> = [];\n\n // Convert route pattern to regex with capture groups\n // Example: /users/:id/posts/:postId → /users/([^/]+)/posts/([^/]+)\n const pattern = route.path\n .replace(/:\\w+/g, (match) => {\n const paramName = match.slice(1); // Remove the ':' prefix\n paramNames.push(paramName);\n return '([^/]+)'; // Capture group: match any characters except '/'\n })\n .replace(/\\//g, '\\\\/'); // Escape forward slashes for regex\n\n return {\n ...route,\n pattern: new RegExp(`^${pattern}$`), // ^ and $ ensure full string match\n paramNames,\n isParameterized: true,\n };\n};\n",
|
|
33
|
-
"/**\n * Normalize the path to ensure consistent format\n *\n * Handles common HTTP path variations for consistent route matching:\n * - Always starts with '/'\n * - No double slashes\n * - Consistent trailing slash handling\n * - Strips query parameters (for route matching)\n * - URL decodes encoded characters\n * - Resolves dot segments for security\n *\n * Examples:\n * - \"users\" → \"/users\"\n * - \"//users\" → \"/users\"\n * - \"/users/\" → \"/users\" (consistent - no trailing slash)\n * - \"/users?page=1\" → \"/users\"\n * - \"/users%20profile\" → \"/users profile\"\n * - \"/users/../admin\" → \"/admin\" (dot segment resolved)\n * - \"/api/./users\" → \"/api/users\" (current dir resolved)\n *\n * @example\n * ```ts\n * normalizePath('users');\n * // Returns \"/users\"\n * ```\n */\nexport const normalizePath = (path: string): string => {\n // Step 1: Strip query parameters and fragments for route matching\n // \"/users?page=1#section\" → \"/users\"\n let [normalizedPath] = path.split('?');\n if (!normalizedPath) return '';\n\n [normalizedPath] = normalizedPath.split('#');\n if (!normalizedPath) return '';\n\n // Step 2: URL decode encoded characters\n // \"/users%20profile\" → \"/users profile\"\n try {\n normalizedPath = decodeURIComponent(normalizedPath);\n } catch (_) {\n // If decoding fails (malformed URL), use original\n // This prevents crashes from malicious URLs\n
|
|
35
|
+
"import { log } from '@core/utils/log.ts';\n\n/**\n * Normalize the path to ensure consistent format\n *\n * Handles common HTTP path variations for consistent route matching:\n * - Always starts with '/'\n * - No double slashes\n * - Consistent trailing slash handling\n * - Strips query parameters (for route matching)\n * - URL decodes encoded characters\n * - Resolves dot segments for security\n *\n * Examples:\n * - \"users\" → \"/users\"\n * - \"//users\" → \"/users\"\n * - \"/users/\" → \"/users\" (consistent - no trailing slash)\n * - \"/users?page=1\" → \"/users\"\n * - \"/users%20profile\" → \"/users profile\"\n * - \"/users/../admin\" → \"/admin\" (dot segment resolved)\n * - \"/api/./users\" → \"/api/users\" (current dir resolved)\n *\n * @example\n * ```ts\n * normalizePath('users');\n * // Returns \"/users\"\n * ```\n */\nexport const normalizePath = (path: string): string => {\n // Step 1: Strip query parameters and fragments for route matching\n // \"/users?page=1#section\" → \"/users\"\n let [normalizedPath] = path.split('?');\n if (!normalizedPath) return '';\n\n [normalizedPath] = normalizedPath.split('#');\n if (!normalizedPath) return '';\n\n // Step 2: URL decode encoded characters\n // \"/users%20profile\" → \"/users profile\"\n try {\n normalizedPath = decodeURIComponent(normalizedPath);\n } catch (_) {\n // If decoding fails (malformed URL), use original\n // This prevents crashes from malicious URLs\n log.warn('Failed to decode URL path', { path: normalizedPath });\n }\n\n // Step 3: Add leading slash if not present\n // \"users\" → \"/users\"\n normalizedPath = normalizedPath.startsWith('/') ? normalizedPath : `/${normalizedPath}`;\n\n // Step 4: Remove double slashes\n // \"//users\" → \"/users\"\n normalizedPath = normalizedPath.replace(/\\/\\/+/g, '/');\n\n // Step 5: Resolve dot segments for security and consistency\n // SECURITY CRITICAL: Prevents directory traversal attacks\n // \"/users/../admin\" → \"/admin\"\n // \"/api/./users\" → \"/api/users\"\n // \"/users/../../etc/passwd\" → \"/etc/passwd\" (contained within app context)\n normalizedPath = resolveDotSegments(normalizedPath);\n\n // Step 6: Remove trailing slash for consistency (except root path)\n // \"/users/\" → \"/users\", but \"/\" stays \"/\"\n if (normalizedPath.length > 1 && normalizedPath.endsWith('/')) {\n normalizedPath = normalizedPath.slice(0, -1);\n }\n\n return normalizedPath;\n};\n\n/**\n * Resolve dot segments according to RFC 3986 Section 5.2.4\n *\n * SECURITY PURPOSE: Prevents directory traversal attacks by resolving relative paths\n *\n * Dot segments are dangerous because they allow attackers to:\n * - Bypass access controls: \"/users/../admin\" → \"/admin\"\n * - Access system files: \"/api/../../etc/passwd\" → \"/etc/passwd\"\n * - Traverse outside intended directories\n *\n * ALGORITHM:\n * - \".\" (current directory) → remove completely\n * - \"..\" (parent directory) → remove this segment AND the previous segment\n * - Regular segments → keep as-is\n *\n * Examples:\n * - \"/users/./profile\" → \"/users/profile\"\n * - \"/users/../admin\" → \"/admin\"\n * - \"/a/b/c/../../d\" → \"/a/d\"\n * - \"/../secret\" → \"/secret\" (can't go above root)\n *\n * @param path - Path with potential dot segments\n * @returns Path with dot segments resolved\n */\nconst resolveDotSegments = (path: string): string => {\n // Split path into segments, preserving empty strings from leading slash\n const segments = path.split('/');\n const resolved: Array<string> = [];\n\n for (const segment of segments) {\n if (segment === '.' || segment === '') {\n // Current directory \".\" - skip completely\n // Empty segments from double slashes - also skip\n if (segment === '' && resolved.length === 0) {\n // Keep the first empty segment to maintain leading slash\n resolved.push(segment);\n }\n continue;\n }\n\n if (segment === '..') {\n // Parent directory \"..\" - go up one level\n if (resolved.length > 1) {\n // Remove last segment (go to parent)\n // But don't remove the leading empty string (which represents root \"/\")\n resolved.pop();\n }\n // If we're already at root, ignore \"..\" (can't go above root)\n } else {\n // Regular segment - keep it\n resolved.push(segment);\n }\n }\n\n // Rejoin segments\n const result = resolved.join('/');\n\n // Ensure we always have at least \"/\" for root\n return result || '/';\n};\n\n/**\n * Normalize route structure for conflict detection\n * Converts /users/:id and /users/:userId to the same structure: /users/:param\n */\nexport const normalizeRouteStructure = (path: string): string => path.replace(/:\\w+/g, ':param');\n",
|
|
34
36
|
"/**\n * Validate that parameter names are unique within a single route\n *\n * WHY THIS MATTERS:\n * - Routes like \"/users/:id/jobs/:id\" are confusing and error-prone\n * - Multiple params with same name would overwrite each other: { id: \"lastValue\" }\n * - Forces developers to use descriptive, unique names: \"/users/:userId/jobs/:jobId\"\n * - Makes code self-documenting and prevents runtime bugs\n *\n * EXAMPLES OF PROBLEMS THIS PREVENTS:\n * - Bad: \"/users/:id/posts/:id\" → unclear which :id refers to what\n * - Good: \"/users/:userId/posts/:postId\" → crystal clear intent\n *\n * @example\n * ```ts\n * validateParameterNames('/users/:id/posts/:id');\n * // Throws error: \"Route /users/:id/posts/:id has duplicate parameter names: id. Parameter names must be unique within a route for clarity and to prevent conflicts.\"\n * ```\n */\nexport const validateParameterNames = (routePath: string): void => {\n // Extract all parameter names from the route\n // \"/users/:userId/posts/:postId\" → [\":userId\", \":postId\"] → [\"userId\", \"postId\"]\n const paramMatches = routePath.match(/:\\w+/g);\n if (!paramMatches) return; // No parameters to validate\n\n const paramNames = paramMatches.map((param) => param.slice(1)); // Remove ':' prefix\n const uniqueParamNames = new Set(paramNames);\n\n // Check for duplicates\n if (paramNames.length !== uniqueParamNames.size) {\n const duplicates = paramNames.filter((name, index) => paramNames.indexOf(name) !== index);\n throw new Error(\n `Route ${routePath} has duplicate parameter names: ${duplicates.join(', ')}. ` +\n 'Parameter names must be unique within a route for clarity and to prevent conflicts.',\n );\n }\n};\n",
|
|
35
37
|
"import { compileRoutePattern } from '@core/setup/utils/compileRoutePatter.ts';\nimport { normalizePath, normalizeRouteStructure } from '@core/setup/utils/normalizeStringPatterns.ts';\nimport { validateParameterNames } from '@core/setup/utils/validateParameterNames.ts';\nimport type { InternalHttpMethod } from '@typedefs/constants/http.ts';\nimport type { InternalPreCompiledRoute, InternalRouteRegistry, InternalRouteRegistryImpl } from '@typedefs/internal/InternalRouteRegistryImpl.js';\n\n/**\n * RouteRegistry: Efficient route storage and matching\n *\n * DESIGN DECISION: Parameter extraction happens here (not in RequestImpl) because:\n * 1. We already compile regexes for route matching - reusing them for param extraction is free\n * 2. Avoids duplicate regex compilation at request time (performance critical)\n * 3. Single source of truth for route patterns and their compiled forms\n *\n * PERFORMANCE STRATEGY:\n * - Exact routes (no params): O(1) Map lookup\n * - Parameterized routes: O(n) iteration with pre-compiled regex matching\n * - Most apps have few parameterized routes, so O(n) is acceptable\n *\n * EXAMPLES:\n * - \"/users\" (exact) → stored in exactRoutes Map for instant lookup\n * - \"/users/:id\" (parameterized) → compiled to regex, stored in parameterizedRoutes Array\n */\nexport class RouteRegistryImpl implements InternalRouteRegistryImpl {\n /**\n * Fast O(1) lookup for routes without parameters\n * Example: GET /users, POST /login, etc.\n */\n readonly _exactRoutes = new Map<InternalHttpMethod, Map<string, InternalRouteRegistry>>();\n\n /**\n * Array of pre-compiled parameterized routes for O(n) matching\n * Example: GET /users/:id, POST /users/:id/posts/:postId, etc.\n *\n * We use an array because:\n * 1. Route patterns can't be used as Map keys (they're not exact matches)\n * 2. Most apps have relatively few parameterized routes\n * 3. Pre-compiled regexes make matching fast\n */\n readonly _parameterizedRoutes = new Map<InternalHttpMethod, Array<InternalPreCompiledRoute>>();\n\n /**\n * Register a new route\n *\n * PERFORMANCE NOTE: This happens at server startup, so we can afford\n * more expensive operations like regex compilation here.\n */\n _register({ method, path, handler, options }: InternalRouteRegistry): void {\n const normalizedPath = normalizePath(path);\n const isParameterized = normalizedPath.includes(':');\n\n // Validate route before registration\n if (isParameterized) {\n validateParameterNames(normalizedPath);\n }\n\n // Prevent duplicate route registration\n // We check for exact pattern duplicates, not request path matches\n if (this._hasExactRoutePattern(method, normalizedPath)) {\n throw new Error(`Route ${normalizedPath} already exists for method ${method}`);\n }\n\n const route = { method, path: normalizedPath, handler, options, params: {} };\n\n if (isParameterized) {\n // Store in parameterized routes with pre-compiled regex\n this._storeParameterizedRoute(method, route);\n } else {\n // Store in exact routes for O(1) lookup\n this._storeExactRoute(method, normalizedPath, route);\n }\n }\n\n /**\n * Find a route and extract parameters from the request path\n *\n * RUNTIME PERFORMANCE: This is called for every HTTP request, so it must be fast!\n * 1. Try exact match first (O(1) - fastest case)\n * 2. Fall back to parameterized routes (O(n) with pre-compiled regex)\n */\n _findRoute(method: InternalHttpMethod, path: string): InternalRouteRegistry | undefined {\n const normalizedPath = normalizePath(path);\n\n // FAST PATH: Try exact match first (most common case)\n const exactRoute = this._exactRoutes.get(method)?.get(normalizedPath);\n if (exactRoute) {\n return exactRoute;\n }\n\n // PARAMETERIZED PATH: Check routes with parameters\n return this._findParameterizedRoute(method, normalizedPath);\n }\n\n /**\n * Check if a route pattern already exists (for conflict detection)\n * This is different from findRoute which matches request paths to patterns\n */\n private _hasExactRoutePattern(method: InternalHttpMethod, pattern: string): boolean {\n // Check exact routes\n if (this._exactRoutes.get(method)?.has(pattern)) {\n return true;\n }\n\n // For parameterized routes, check if the structure conflicts\n // Example: /users/:id conflicts with /users/:userId (same structure, different param names)\n if (pattern.includes(':')) {\n const normalizedPattern = normalizeRouteStructure(pattern);\n const paramRoutes = this._parameterizedRoutes.get(method);\n\n if (paramRoutes) {\n return paramRoutes.some((route) => normalizeRouteStructure(route.path) === normalizedPattern);\n }\n } else {\n // Check parameterized routes for exact pattern match\n const paramRoutes = this._parameterizedRoutes.get(method);\n if (paramRoutes) {\n return paramRoutes.some((route) => route.path === pattern);\n }\n }\n\n return false;\n }\n\n /**\n * Store an exact route (no parameters) for O(1) lookup\n */\n private _storeExactRoute(method: InternalHttpMethod, path: string, route: InternalRouteRegistry): void {\n if (!this._exactRoutes.has(method)) {\n this._exactRoutes.set(method, new Map());\n }\n\n this._exactRoutes.get(method)?.set(path, route);\n }\n\n /**\n * Store a parameterized route with pre-compiled regex pattern\n */\n private _storeParameterizedRoute(method: InternalHttpMethod, route: InternalRouteRegistry): void {\n if (!this._parameterizedRoutes.has(method)) {\n this._parameterizedRoutes.set(method, []);\n }\n\n /**\n * Compile a route pattern into a regex with parameter extraction\n *\n * This is the magic that converts route patterns to regexes:\n * - \"/users/:id\" → /^\\/users\\/([^\\/]+)$/\n * - \"/users/:id/posts/:postId\" → /^\\/users\\/([^\\/]+)\\/posts\\/([^\\/]+)$/\n *\n * WHY AT REGISTRATION TIME: Regex compilation is expensive, so we do it once\n * at server startup rather than on every request.\n */\n const compiled = compileRoutePattern(route);\n this._parameterizedRoutes.get(method)?.push(compiled);\n }\n\n /**\n * Find and match a parameterized route, extracting parameters\n * This is slower than the exact route match (O(n)) because it has to iterate through all the parameterized routes\n * and should only be used if the route is parameterized, otherwise it will be slower than the exact route match.\n */\n private _findParameterizedRoute(method: InternalHttpMethod, path: string): InternalRouteRegistry | undefined {\n const paramRoutes = this._parameterizedRoutes.get(method);\n if (!paramRoutes) return undefined;\n\n // Try each parameterized route until we find a match\n for (const compiledRoute of paramRoutes) {\n const match = path.match(compiledRoute.pattern);\n if (match) {\n const params: Record<string, string> = {};\n\n // Extract parameters from regex capture groups\n // match[0] is the full match, match[1+] are the captured groups\n for (let i = 0; i < compiledRoute.paramNames.length; i++) {\n const paramValue = match[i + 1];\n const paramName = compiledRoute.paramNames[i];\n\n if (paramValue !== undefined && paramName !== undefined) {\n params[paramName] = paramValue;\n }\n }\n\n return { ...compiledRoute, params };\n }\n }\n\n return undefined;\n }\n}\n",
|
|
36
|
-
"import { httpMethod } from '@constants/http.ts';\nimport type { InternalHttpMethod } from '@typedefs/constants/http.ts';\nimport { handleCustomConfiguration } from '@core/setup/utils/handleCustomConfiguration.ts';\nimport type { InternalSetupImpl, InternalSetupMethod } from '@typedefs/internal/InternalSetupImpl.ts';\nimport { HookRegistryImpl } from '@core/execution/HookRegistryImpl.ts';\nimport type { InternalGlobalHookOptions } from '@typedefs/internal/InternalHookRegistryImpl.js';\nimport type { InternalServerConfiguration } from '@typedefs/internal/InternalConfiguration.js';\nimport type { ServerConfiguration } from '@typedefs/public/Configuration.js';\nimport type { InternalRouteRegistryOptions } from '@typedefs/internal/InternalRouteRegistryImpl.js';\nimport { RouteRegistryImpl } from '@core/setup/RouteRegistryImpl.ts';\nimport type { HandlerCallback } from '@typedefs/public/Context.js';\n\nexport class SetupImpl implements InternalSetupImpl {\n readonly _configuration: InternalServerConfiguration;\n readonly _routeRegistry = new RouteRegistryImpl();\n readonly _hooks = new HookRegistryImpl();\n\n constructor(customConfiguration?: ServerConfiguration) {\n this._configuration = handleCustomConfiguration(customConfiguration);\n }\n\n // ===== Route Registration =====\n get(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n const routeOptions = options ?? { beforeHooks: [], afterHooks: [] };\n // Register GET route\n this._routeRegistry._register({ method: httpMethod.get, handler, path, options: routeOptions, params: {} });\n // Automatically register corresponding HEAD route\n this._routeRegistry._register({ method: httpMethod.head, handler, path, options: routeOptions, params: {} });\n }\n\n head(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n this._routeRegistry._register({ method: httpMethod.head, handler, path, options: options ?? { beforeHooks: [], afterHooks: [] }, params: {} });\n }\n\n post(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n this._routeRegistry._register({ method: httpMethod.post, handler, path, options: options ?? { beforeHooks: [], afterHooks: [] }, params: {} });\n }\n\n put(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n this._routeRegistry._register({ method: httpMethod.put, handler, path, options: options ?? { beforeHooks: [], afterHooks: [] }, params: {} });\n }\n\n patch(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n this._routeRegistry._register({ method: httpMethod.patch, handler, path, options: options ?? { beforeHooks: [], afterHooks: [] }, params: {} });\n }\n\n delete(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n this._routeRegistry._register({ method: httpMethod.delete, handler, path, options: options ?? { beforeHooks: [], afterHooks: [] }, params: {} });\n }\n\n options(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n this._routeRegistry._register({ method: httpMethod.options, handler, path, options: options ?? { beforeHooks: [], afterHooks: [] }, params: {} });\n }\n\n group(\n prefix: string,\n callback: (group: Record<Lowercase<InternalHttpMethod>, InternalSetupMethod>) => void,\n options?: InternalRouteRegistryOptions, // These follow the same pattern as the individual route registration methods\n ): void {\n const createRouteHandler =\n (method: InternalHttpMethod) =>\n (path: string, handler: HandlerCallback, routeOptions?: InternalRouteRegistryOptions): void => {\n const fullPath = `${prefix}${path}`;\n const mergedOptions = {\n beforeHooks: [...(options?.beforeHooks ?? []), ...(routeOptions?.beforeHooks ?? [])],\n afterHooks: [...(routeOptions?.afterHooks ?? []), ...(options?.afterHooks ?? [])],\n };\n\n this._routeRegistry._register({\n method,\n handler,\n path: fullPath,\n options: mergedOptions,\n params: {},\n });\n\n // If this is a GET route, automatically register the corresponding HEAD route\n if (method === httpMethod.get) {\n this._routeRegistry._register({\n method: httpMethod.head,\n handler,\n path: fullPath,\n options: mergedOptions,\n params: {},\n });\n }\n };\n\n // Create a group app that registers routes with prefix and group hooks\n const group = {\n get: createRouteHandler(httpMethod.get),\n head: createRouteHandler(httpMethod.head),\n post: createRouteHandler(httpMethod.post),\n put: createRouteHandler(httpMethod.put),\n delete: createRouteHandler(httpMethod.delete),\n patch: createRouteHandler(httpMethod.patch),\n options: createRouteHandler(httpMethod.options),\n };\n\n // Execute callback to register routes\n callback(group);\n }\n\n /**\n * Hook Registration\n *\n * Note these are going to be called dynamically at run time, for now\n * we are just storing them in the server object until runtime. Although\n * it is slower during lookup, it is more flexible and memory efficient\n * allowing for more flexibility to include hook modification, conditional\n * hook execution, and better debugging.\n */\n beforeAll(handlers: Array<HandlerCallback>, options?: InternalGlobalHookOptions): void {\n this._hooks._addBeforeHooks(handlers, options);\n }\n\n afterAll(handlers: Array<HandlerCallback>, options?: InternalGlobalHookOptions): void {\n this._hooks._addAfterHooks(handlers, options);\n }\n\n onError(handler: HandlerCallback): void {\n this._hooks._addOnError(handler);\n }\n\n onNotFound(handler: HandlerCallback): void {\n this._hooks._addOnNotFound(handler);\n }\n}\n"
|
|
37
|
-
"import dayjs from 'dayjs';\nimport type { InternalContextImpl } from '@typedefs/internal/InternalContextImpl.ts';\nimport type { CreateEnum } from '@typedefs/internal/Generics.js';\n\n/**\n * YinzerFlow Unified Logging System 🏗️\n *\n * Pittsburgh-style functional logging with yinzer personality!\n * Direct logging for maximum performance with consistent formatting and colors.\n */\n\nconst logPrefix = 'YINZER';\n\nconst logLevels = {\n info: 1,\n warn: 2,\n error: 3,\n} as const;\n\ntype LogLevels = CreateEnum<typeof logLevels>;\n\n// ANSI Color codes\nconst colors = {\n reset: '\\x1b[0m',\n cyan: '\\x1b[96m', // Cyan for info\n orange: '\\x1b[38;5;208m', // Fluorescent orange for warn\n red: '\\x1b[91m', // Blood red for error\n green: '\\x1b[92m', // Green for success\n yellow: '\\x1b[93m', // Yellow for performance\n gray: '\\x1b[90m', // Gray for network logs\n} as const;\n\nconst yinzerPhrases = {\n positive: [\"n'at!\", 'yinz are good!', \"that's the way!\", 'right on!', \"lookin' good!\", 'way to go!', 'keep it up!'],\n neutral: [\"n'at\", 'yinz know', \"just sayin'\", \"that's how it is\", 'what can ya do', 'it happens'],\n negative: ['aw jeez', \"that ain't right\", 'what a jagoff move', \"that's terrible n'at\", 'somebody messed up', 'this is bad news', 'yinz better fix this'],\n} as const;\n\nlet currentLogLevel: LogLevels = logLevels.info;\n\n// Helper functions\nconst formatTimestamp = (): string => dayjs().format('YYYY-MM-DD HH:mm:ss.SSS');\nconst formatNetworkTimestamp = (): string => dayjs().format('DD/MMM/YYYY:HH:mm:ss ZZ');\n\nconst getRandomPhrase = (type: 'negative' | 'neutral' | 'positive'): string => {\n const phrases = yinzerPhrases[type];\n return phrases[Math.floor(Math.random() * phrases.length)] ?? '';\n};\n\nconst shouldLog = (level: LogLevels): boolean => level >= currentLogLevel;\n\n// Main logging functions - direct execution for maximum performance with consistent formatting\nconst info = (message: string, data?: unknown): void => {\n if (!shouldLog(logLevels.info)) return;\n const timestamp = formatTimestamp();\n const phrase = getRandomPhrase('positive');\n const dataText = data ? ` ${JSON.stringify(data, null, 0)}` : '';\n console.info(`${colors.cyan}[${logPrefix}] ✅ [${timestamp}] [INFO] ${message}${dataText} - ${phrase}${colors.reset}`);\n};\n\nconst warn = (message: string, data?: unknown): void => {\n if (!shouldLog(logLevels.warn)) return;\n const timestamp = formatTimestamp();\n const phrase = getRandomPhrase('neutral');\n const dataText = data ? ` ${JSON.stringify(data, null, 0)}` : '';\n console.warn(`${colors.yellow}[${logPrefix}] ⚠️ [${timestamp}] [WARN] ${message}${dataText} - ${phrase}${colors.reset}`);\n};\n\nconst error = (message: string, data?: unknown): void => {\n if (!shouldLog(logLevels.error)) return;\n const timestamp = formatTimestamp();\n const phrase = getRandomPhrase('negative');\n const dataText = data ? ` ${JSON.stringify(data, null, 0)}` : '';\n console.error(`${colors.red}[${logPrefix}] ❌ [${timestamp}] [ERROR] ${message}${dataText} - ${phrase}${colors.reset}`);\n};\n\nconst success = (message: string, data?: unknown): void => {\n if (!shouldLog(logLevels.info)) return;\n const timestamp = formatTimestamp();\n const phrase = getRandomPhrase('positive');\n const dataText = data ? ` ${JSON.stringify(data, null, 0)}` : '';\n console.log(`${colors.green}[${logPrefix}] 🎉 [${timestamp}] [SUCCESS] ${message}${dataText} - ${phrase}${colors.reset}`);\n};\n\nconst perf = (message: string, timeMs: number, data?: unknown): void => {\n if (!shouldLog(logLevels.info)) return;\n const timestamp = formatTimestamp();\n\n // Performance-based emojis and phrases\n let emoji = '❓';\n let phrase = '';\n\n // < 50ms: Truly instant, users can't perceive any delay\n if (timeMs < 50) {\n emoji = '⚡';\n phrase = Math.random() < 0.5 ? \"lightning quick n'at!\" : 'faster than a Stillers touchdown!';\n // 50-100ms: Still feels instant for most interactions\n } else if (timeMs < 100) {\n emoji = '🔥';\n phrase = Math.random() < 0.5 ? \"that's the way!\" : \"smooth as butter n'at!\";\n // 100-200ms: Google's \"good\" threshold, still very responsive\n } else if (timeMs < 200) {\n emoji = '✅';\n phrase = Math.random() < 0.5 ? 'not bad yinz!' : \"keepin' up just fine!\";\n // 200-500ms: Noticeable but acceptable for complex operations\n } else if (timeMs < 500) {\n emoji = '⚠️';\n phrase = Math.random() < 0.5 ? 'eh, could be better' : \"slowin' down a bit there\";\n // 500ms-1s: Users start getting impatient\n } else if (timeMs < 1000) {\n emoji = '🐌';\n phrase = Math.random() < 0.5 ? \"that's draggin' n'at\" : \"c'mon, pick up the pace!\";\n // > 1s: Definitely problematic, needs attention\n } else {\n emoji = '💥';\n phrase = Math.random() < 0.5 ? 'what a jagoff response time!' : 'slower than traffic on the Parkway!';\n }\n\n const perfData = data ? { ...data, executionTime: `${timeMs}ms` } : { executionTime: `${timeMs}ms` };\n const dataText = ` ${JSON.stringify(perfData, null, 0)}`;\n console.log(`${colors.orange}[${logPrefix}] ${emoji} [${timestamp}] [PERF] ${message}${dataText} - ${phrase}${colors.reset}`);\n};\n\n/**\n * Calculate response size for logging\n */\nconst _calculateResponseSize = (responseBody: unknown): number => {\n if (typeof responseBody === 'string') {\n return Buffer.byteLength(responseBody, 'utf8');\n }\n\n if (Buffer.isBuffer(responseBody)) {\n return responseBody.length;\n }\n\n if (typeof responseBody === 'object' && responseBody !== null) {\n try {\n return Buffer.byteLength(JSON.stringify(responseBody), 'utf8');\n } catch {\n return 0;\n }\n }\n\n return 0;\n};\n\n/**\n * Get status emoji for response codes\n */\nconst _getStatusEmoji = (statusCode: number): string => {\n if (statusCode >= 200 && statusCode < 300) return '✅';\n if (statusCode >= 300 && statusCode < 400) return '🔄';\n if (statusCode >= 400 && statusCode < 500) return '❌';\n if (statusCode >= 500) return '💥';\n return '❓';\n};\n\n/**\n * Get performance emoji and phrase for response time\n */\nconst _getPerformanceDetails = (timeMs: number): { emoji: string; phrase: string } => {\n // < 50ms: Truly instant, users can't perceive any delay\n if (timeMs < 50) {\n return {\n emoji: '⚡',\n phrase: Math.random() < 0.5 ? \"lightning quick n'at!\" : 'faster than a Stillers touchdown!',\n };\n }\n\n // 50-100ms: Still feels instant for most interactions\n if (timeMs < 100) {\n return {\n emoji: '🔥',\n phrase: Math.random() < 0.5 ? \"that's the way!\" : \"smooth as butter n'at!\",\n };\n }\n\n // 100-200ms: Google's \"good\" threshold, still very responsive\n if (timeMs < 200) {\n return {\n emoji: '✅',\n phrase: Math.random() < 0.5 ? 'not bad yinz!' : \"keepin' up just fine!\",\n };\n }\n\n // 200-500ms: Noticeable but acceptable for complex operations\n if (timeMs < 500) {\n return {\n emoji: '⚠️',\n phrase: Math.random() < 0.5 ? 'eh, could be better' : \"slowin' down a bit there\",\n };\n }\n\n // 500ms-1s: Users start getting impatient\n if (timeMs < 1000) {\n return {\n emoji: '🐌',\n phrase: Math.random() < 0.5 ? \"that's draggin' n'at\" : \"c'mon, pick up the pace!\",\n };\n }\n\n // > 1s: Definitely problematic, needs attention\n return {\n emoji: '💥',\n phrase: Math.random() < 0.5 ? 'what a jagoff response time!' : 'slower than traffic on the Parkway!',\n };\n};\n\n/**\n * Log nginx-style access log entry\n */\nconst _logAccessEntry = (options: {\n clientIp: string;\n method: string;\n path: string;\n protocol: string;\n statusCode: number;\n responseSize: number;\n referer: string;\n userAgent: string;\n responseTimeMs: string;\n statusEmoji: string;\n}): void => {\n const timestamp = formatTimestamp();\n const networkTimestamp = formatNetworkTimestamp();\n\n const { clientIp, method, path, protocol, statusCode, responseSize, referer, userAgent, responseTimeMs, statusEmoji } = options;\n\n const logEntry = `🏠 ${clientIp} - - [${networkTimestamp}] \"${method} ${path} ${protocol}\" ${statusCode} ${responseSize}b ${referer} ${userAgent} ${responseTimeMs}ms ${statusEmoji}`;\n console.log(`${colors.gray}[${logPrefix}] [${timestamp}] [NETWORK] ${logEntry}${colors.reset}`);\n};\n\n/**\n * Log performance entry with Pittsburgh personality\n */\nconst _logPerformanceEntry = (responseTimeMs: string): void => {\n const timestamp = formatTimestamp();\n const timeMs = parseFloat(responseTimeMs);\n const { emoji, phrase } = _getPerformanceDetails(timeMs);\n\n console.log(`${colors.orange}[${logPrefix}] ${emoji} [${timestamp}] [PERF] Response time: ${responseTimeMs}ms - ${phrase}${colors.reset}`);\n};\n\n// Network logging functions - direct execution for maximum performance with consistent formatting\nconst logRequest = (context: InternalContextImpl, startTime: number, endTime: number): void => {\n const { request } = context;\n const response = context._response;\n const responseTimeMs = (endTime - startTime).toFixed(1);\n\n const clientIp = request.ipAddress || 'unknown';\n const { method, path, protocol } = request;\n const statusCode = response._statusCode;\n\n // Calculate response size\n const responseSize = _calculateResponseSize(response._body);\n\n const referer = request.headers.referer ? `\"${request.headers.referer}\"` : '\"-\"';\n const userAgent = request.headers['user-agent'] ? `\"${request.headers['user-agent']}\"` : '\"-\"';\n const statusEmoji = _getStatusEmoji(statusCode);\n\n // Main nginx-style log with consistent formatting\n _logAccessEntry({\n clientIp,\n method,\n path,\n protocol,\n statusCode,\n responseSize,\n referer,\n userAgent,\n responseTimeMs,\n statusEmoji,\n });\n\n // Performance log with Pittsburgh personality and consistent formatting\n _logPerformanceEntry(responseTimeMs);\n};\n\nconst logConnection = (event: 'connect' | 'disconnect' | 'error', clientIp?: string, details?: string): void => {\n const timestamp = formatTimestamp();\n const ip = clientIp ?? 'unknown';\n const eventDetails = details ? ` - ${details}` : '';\n\n if (event === 'connect') {\n console.log(`${colors.gray}[${logPrefix}] 🤝 [${timestamp}] [NETWORK] New visitor from ${ip} - Welcome to the 'Burgh!${colors.reset}`);\n } else if (event === 'disconnect') {\n console.log(`${colors.gray}[${logPrefix}] 👋 [${timestamp}] [NETWORK] ${ip} headed out - Thanks for stopping by, yinz come back now!${colors.reset}`);\n } else {\n console.log(`${colors.red}[${logPrefix}] 💥 [${timestamp}] [NETWORK] Connection trouble with ${ip}${eventDetails} - That's not good, n'at!${colors.reset}`);\n }\n};\n\nconst logServerStart = (port?: number, host?: string): void => {\n const timestamp = formatTimestamp();\n const address = port && host ? `${host}:${port}` : 'unknown';\n const phrase = getRandomPhrase('positive');\n console.log(\n `${colors.gray}[${logPrefix}] 🚀 [${timestamp}] [NETWORK] YinzerFlow server is up and running at ${address} - Ready to serve yinz all, ${phrase}!${colors.reset}`,\n );\n};\n\nconst logServerStop = (port?: number, host?: string): void => {\n const timestamp = formatTimestamp();\n const address = port && host ? `${host}:${port}` : 'unknown';\n const phrase = getRandomPhrase('neutral');\n console.log(\n `${colors.gray}[${logPrefix}] 🛑 [${timestamp}] [NETWORK] YinzerFlow server at ${address} is shutting down - See yinz later, ${phrase}!${colors.reset}`,\n );\n};\n\nconst logServerError = (port?: number, host?: string, details?: string): void => {\n const timestamp = formatTimestamp();\n const address = port && host ? `${host}:${port}` : 'unknown';\n const eventDetails = details ? ` - ${details}` : '';\n const phrase = getRandomPhrase('negative');\n console.log(\n `${colors.red}[${logPrefix}] 💥 [${timestamp}] [NETWORK] Server error at ${address}${eventDetails} - Something's not right, ${phrase}!${colors.reset}`,\n );\n};\n\n// Configuration function\nconst setLogLevel = (level: LogLevels): void => {\n currentLogLevel = level;\n};\n\n// Export the unified logging API\nexport const log = {\n // Configuration\n setLogLevel,\n\n // Application logging\n info,\n warn,\n error,\n success,\n perf,\n\n // Network logging\n network: {\n request: logRequest,\n connection: logConnection,\n serverStart: logServerStart,\n serverStop: logServerStop,\n serverError: logServerError,\n },\n};\n"
|
|
38
|
+
"import { httpMethod } from '@constants/http.ts';\nimport type { InternalHttpMethod } from '@typedefs/constants/http.ts';\nimport { handleCustomConfiguration } from '@core/setup/utils/handleCustomConfiguration.ts';\nimport type { InternalSetupImpl, InternalSetupMethod } from '@typedefs/internal/InternalSetupImpl.ts';\nimport { HookRegistryImpl } from '@core/execution/HookRegistryImpl.ts';\nimport type { InternalGlobalHookOptions } from '@typedefs/internal/InternalHookRegistryImpl.js';\nimport type { InternalServerConfiguration } from '@typedefs/internal/InternalConfiguration.js';\nimport type { ServerConfiguration } from '@typedefs/public/Configuration.js';\nimport type { InternalRouteRegistryOptions } from '@typedefs/internal/InternalRouteRegistryImpl.js';\nimport { RouteRegistryImpl } from '@core/setup/RouteRegistryImpl.ts';\nimport type { HandlerCallback } from '@typedefs/public/Context.js';\n\nexport class SetupImpl implements InternalSetupImpl {\n readonly _configuration: InternalServerConfiguration;\n readonly _routeRegistry = new RouteRegistryImpl();\n readonly _hooks = new HookRegistryImpl();\n\n constructor(customConfiguration?: ServerConfiguration) {\n this._configuration = handleCustomConfiguration(customConfiguration);\n }\n\n // ===== Route Registration =====\n get(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n const routeOptions = options ?? { beforeHooks: [], afterHooks: [] };\n // Register GET route\n this._routeRegistry._register({ method: httpMethod.get, handler, path, options: routeOptions, params: {} });\n // Automatically register corresponding HEAD route\n this._routeRegistry._register({ method: httpMethod.head, handler, path, options: routeOptions, params: {} });\n }\n\n head(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n this._routeRegistry._register({ method: httpMethod.head, handler, path, options: options ?? { beforeHooks: [], afterHooks: [] }, params: {} });\n }\n\n post(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n this._routeRegistry._register({ method: httpMethod.post, handler, path, options: options ?? { beforeHooks: [], afterHooks: [] }, params: {} });\n }\n\n put(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n this._routeRegistry._register({ method: httpMethod.put, handler, path, options: options ?? { beforeHooks: [], afterHooks: [] }, params: {} });\n }\n\n patch(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n this._routeRegistry._register({ method: httpMethod.patch, handler, path, options: options ?? { beforeHooks: [], afterHooks: [] }, params: {} });\n }\n\n delete(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n this._routeRegistry._register({ method: httpMethod.delete, handler, path, options: options ?? { beforeHooks: [], afterHooks: [] }, params: {} });\n }\n\n options(path: string, handler: HandlerCallback, options?: InternalRouteRegistryOptions): void {\n this._routeRegistry._register({ method: httpMethod.options, handler, path, options: options ?? { beforeHooks: [], afterHooks: [] }, params: {} });\n }\n\n group(\n prefix: string,\n callback: (group: Record<Lowercase<InternalHttpMethod>, InternalSetupMethod>) => void,\n options?: InternalRouteRegistryOptions, // These follow the same pattern as the individual route registration methods\n ): void {\n const createRouteHandler =\n (method: InternalHttpMethod) =>\n (path: string, handler: HandlerCallback, routeOptions?: InternalRouteRegistryOptions): void => {\n const fullPath = `${prefix}${path}`;\n const mergedOptions = {\n beforeHooks: [...(options?.beforeHooks ?? []), ...(routeOptions?.beforeHooks ?? [])],\n afterHooks: [...(routeOptions?.afterHooks ?? []), ...(options?.afterHooks ?? [])],\n };\n\n this._routeRegistry._register({\n method,\n handler,\n path: fullPath,\n options: mergedOptions,\n params: {},\n });\n\n // If this is a GET route, automatically register the corresponding HEAD route\n if (method === httpMethod.get) {\n this._routeRegistry._register({\n method: httpMethod.head,\n handler,\n path: fullPath,\n options: mergedOptions,\n params: {},\n });\n }\n };\n\n // Create a group app that registers routes with prefix and group hooks\n const group = {\n get: createRouteHandler(httpMethod.get),\n head: createRouteHandler(httpMethod.head),\n post: createRouteHandler(httpMethod.post),\n put: createRouteHandler(httpMethod.put),\n delete: createRouteHandler(httpMethod.delete),\n patch: createRouteHandler(httpMethod.patch),\n options: createRouteHandler(httpMethod.options),\n };\n\n // Execute callback to register routes\n callback(group);\n }\n\n /**\n * Hook Registration\n *\n * Note these are going to be called dynamically at run time, for now\n * we are just storing them in the server object until runtime. Although\n * it is slower during lookup, it is more flexible and memory efficient\n * allowing for more flexibility to include hook modification, conditional\n * hook execution, and better debugging.\n */\n beforeAll(handlers: Array<HandlerCallback>, options?: InternalGlobalHookOptions): void {\n this._hooks._addBeforeHooks(handlers, options);\n }\n\n afterAll(handlers: Array<HandlerCallback>, options?: InternalGlobalHookOptions): void {\n this._hooks._addAfterHooks(handlers, options);\n }\n\n onError(handler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