@lithia-js/core 1.0.0-canary.2 → 1.0.0-canary.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +26 -43
  2. package/dist/_index.d.ts +245 -0
  3. package/dist/_index.mjs +2106 -0
  4. package/dist/_index.mjs.map +1 -0
  5. package/dist/index.d.ts +824 -0
  6. package/dist/index.mjs +856 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/protocol-DBwVPJYN.d.ts +332 -0
  9. package/dist/tasks-X-3clDS8.d.ts +31 -0
  10. package/dist/workers/app-worker.d.ts +2 -0
  11. package/dist/workers/app-worker.mjs +1907 -0
  12. package/dist/workers/app-worker.mjs.map +1 -0
  13. package/dist/workers/task-worker.d.ts +45 -0
  14. package/dist/workers/task-worker.mjs +146 -0
  15. package/dist/workers/task-worker.mjs.map +1 -0
  16. package/package.json +47 -23
  17. package/CHANGELOG.md +0 -31
  18. package/dist/config.d.ts +0 -101
  19. package/dist/config.js +0 -113
  20. package/dist/config.js.map +0 -1
  21. package/dist/context/event-context.d.ts +0 -53
  22. package/dist/context/event-context.js +0 -42
  23. package/dist/context/event-context.js.map +0 -1
  24. package/dist/context/index.d.ts +0 -16
  25. package/dist/context/index.js +0 -29
  26. package/dist/context/index.js.map +0 -1
  27. package/dist/context/lithia-context.d.ts +0 -47
  28. package/dist/context/lithia-context.js +0 -43
  29. package/dist/context/lithia-context.js.map +0 -1
  30. package/dist/context/route-context.d.ts +0 -74
  31. package/dist/context/route-context.js +0 -42
  32. package/dist/context/route-context.js.map +0 -1
  33. package/dist/env.d.ts +0 -1
  34. package/dist/env.js +0 -32
  35. package/dist/env.js.map +0 -1
  36. package/dist/errors.d.ts +0 -51
  37. package/dist/errors.js +0 -80
  38. package/dist/errors.js.map +0 -1
  39. package/dist/hooks/dependency-hooks.d.ts +0 -105
  40. package/dist/hooks/dependency-hooks.js +0 -96
  41. package/dist/hooks/dependency-hooks.js.map +0 -1
  42. package/dist/hooks/event-hooks.d.ts +0 -61
  43. package/dist/hooks/event-hooks.js +0 -70
  44. package/dist/hooks/event-hooks.js.map +0 -1
  45. package/dist/hooks/index.d.ts +0 -41
  46. package/dist/hooks/index.js +0 -59
  47. package/dist/hooks/index.js.map +0 -1
  48. package/dist/hooks/route-hooks.d.ts +0 -154
  49. package/dist/hooks/route-hooks.js +0 -174
  50. package/dist/hooks/route-hooks.js.map +0 -1
  51. package/dist/lib.d.ts +0 -10
  52. package/dist/lib.js +0 -30
  53. package/dist/lib.js.map +0 -1
  54. package/dist/lithia.d.ts +0 -447
  55. package/dist/lithia.js +0 -649
  56. package/dist/lithia.js.map +0 -1
  57. package/dist/logger.d.ts +0 -11
  58. package/dist/logger.js +0 -55
  59. package/dist/logger.js.map +0 -1
  60. package/dist/module-loader.d.ts +0 -12
  61. package/dist/module-loader.js +0 -78
  62. package/dist/module-loader.js.map +0 -1
  63. package/dist/server/event-processor.d.ts +0 -195
  64. package/dist/server/event-processor.js +0 -253
  65. package/dist/server/event-processor.js.map +0 -1
  66. package/dist/server/http-server.d.ts +0 -196
  67. package/dist/server/http-server.js +0 -295
  68. package/dist/server/http-server.js.map +0 -1
  69. package/dist/server/middlewares/validation.d.ts +0 -12
  70. package/dist/server/middlewares/validation.js +0 -34
  71. package/dist/server/middlewares/validation.js.map +0 -1
  72. package/dist/server/request-processor.d.ts +0 -400
  73. package/dist/server/request-processor.js +0 -652
  74. package/dist/server/request-processor.js.map +0 -1
  75. package/dist/server/request.d.ts +0 -73
  76. package/dist/server/request.js +0 -207
  77. package/dist/server/request.js.map +0 -1
  78. package/dist/server/response.d.ts +0 -69
  79. package/dist/server/response.js +0 -173
  80. package/dist/server/response.js.map +0 -1
  81. package/src/config.ts +0 -212
  82. package/src/context/event-context.ts +0 -66
  83. package/src/context/index.ts +0 -32
  84. package/src/context/lithia-context.ts +0 -59
  85. package/src/context/route-context.ts +0 -89
  86. package/src/env.ts +0 -31
  87. package/src/errors.ts +0 -96
  88. package/src/hooks/dependency-hooks.ts +0 -122
  89. package/src/hooks/event-hooks.ts +0 -69
  90. package/src/hooks/index.ts +0 -58
  91. package/src/hooks/route-hooks.ts +0 -177
  92. package/src/lib.ts +0 -27
  93. package/src/lithia.ts +0 -777
  94. package/src/logger.ts +0 -66
  95. package/src/module-loader.ts +0 -45
  96. package/src/server/event-processor.ts +0 -344
  97. package/src/server/http-server.ts +0 -371
  98. package/src/server/middlewares/validation.ts +0 -46
  99. package/src/server/request-processor.ts +0 -860
  100. package/src/server/request.ts +0 -247
  101. package/src/server/response.ts +0 -204
  102. package/tsconfig.json +0 -8
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config.ts","../src/errors/base.ts","../src/errors/app/client.ts","../src/errors/app/server.ts","../src/errors/internal/context.ts","../src/context/event-context.ts","../src/hooks/event-hooks.ts","../src/context/lithia-context.ts","../src/hooks/lithia-hooks.ts","../src/context/request-context.ts","../src/hooks/route-hooks.ts","../src/transport/http/request.ts","../src/transport/http/response.ts"],"names":["AsyncLocalStorage","parseCookie","serializeCookie"],"mappings":";;;;;;;;;;AA4QO,SAAS,aAAa,MAAA,EAAoC;AAChE,EAAA,OAAO,MAAA;AACR;;;AC3QO,IAAM,WAAA,GAAN,cAA0B,KAAA,CAAM;AAAA,EACtB,aAAA,GAAgB,IAAA;AAAA,EAChC,YAAY,OAAA,EAAkB;AAC7B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,KAAK,WAAA,CAAY,IAAA;AAC7B,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,GAAA,CAAA,MAAA,CAAW,SAAS,CAAA;AAAA,EACjD;AACD;AAQO,IAAM,iBAAA,GAAN,cAAgC,WAAA,CAAY;AAAA,EAElD,WAAA,CACC,OAAA,EACgB,UAAA,EACA,OAAA,EACf;AACD,IAAA,KAAA,CAAM,OAAO,CAAA;AAHG,IAAA,IAAA,CAAA,UAAA,GAAA,U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EAAoB;AACzB,MAAA,MAAA,CAAO,IAAA,CAAK,KAAK,GAAG,CAAA;AAEpB,MAAA,MAAA,CAAO,EAAA,CAAG,SAAS,MAAM;AACxB,QAAA,IAAA,CAAK,OAAO,GAAG,CAAA,CAAE,KAAK,EAAE,KAAA,EAAO,kBAAkB,CAAA;AAAA,MAClD,CAAC,CAAA;AAAA,IACF,CAAA,CAAA,MAAQ;AACP,MAAA,IAAA,CAAK,OAAO,GAAG,CAAA,CAAE,KAAK,EAAE,KAAA,EAAO,kBAAkB,CAAA;AAAA,IAClD,CAAA,SAAE;AACD,MAAA,IAAA,CAAK,MAAA,GAAS,IAAA;AAAA,IACf;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASQ,mBAAA,GAA4B;AACnC,IAAA,IAAI,IAAA,CAAK,QAAA,CAAS,MAAA,KAAW,CAAA,EAAG;AAEhC,IAAA,MAAM,WAAY,IAAA,CAAK,GAAA,CAAI,SAAA,CAAU,YAAY,KAAkB,EAAC;AACpE,IAAA,MAAM,UAAA,GAAa,KAAK,QAAA,CAAS,GAAA;AAAA,MAAI,CAAC,WACrCC,SAAA,CAAgB,MAAA,CAAO,MAAM,MAAA,CAAO,KAAA,EAAO,OAAO,OAAc;AAAA,KACjE;AAEA,IAAA,IAAA,CAAK,GAAA,CAAI,UAAU,YAAA,EAAc,CAAC,GAAG,QAAA,EAAU,GAAG,UAAU,CAAC,CAAA;AAC7D,IAAA,IAAA,CAAK,WAAW,EAAC;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,YAAA,GAAqB;AAC5B,IAAA,IAAI,KAAK,MAAA,EAAQ;AAChB,MAAA,MAAM,IAAI,MAAM,iCAAiC,CAAA;AAAA,IAClD;AAAA,EACD;AACD","file":"index.mjs","sourcesContent":["import type { DeepPartial } from \"@lithia-js/utils\";\nimport type { C12InputConfig } from \"c12\";\n\n/**\n * Enables automatic OpenAPI generation and the Scalar docs UI for a Lithia app.\n */\nexport interface OpenAPIConfig {\n\t/**\n\t * Enables OpenAPI artifact generation and reserved docs routes.\n\t */\n\tenabled: boolean;\n\t/**\n\t * Public route used to serve the Scalar UI.\n\t * @default \"/docs\"\n\t */\n\tdocsPath: string;\n\t/**\n\t * Public route used to serve the generated OpenAPI document.\n\t * @default \"/openapi.json\"\n\t */\n\tspecPath: string;\n\t/**\n\t * API title used in the generated OpenAPI document.\n\t */\n\ttitle: string;\n\t/**\n\t * API version used in the generated OpenAPI document.\n\t */\n\tversion: string;\n\t/**\n\t * Optional API description shown by OpenAPI/Scalar consumers.\n\t */\n\tdescription?: string;\n}\n\n/**\n * Fully resolved Lithia runtime configuration.\n */\nexport interface LithiaOptions {\n\t/**\n\t * Directory containing the application source tree.\n\t * @default \"src\"\n\t */\n\tsourceDir: string;\n\n\t/**\n\t * Output directory used for generated runtime artifacts.\n\t * @default \"dist\"\n\t */\n\toutDir: string;\n\n\t/**\n\t * Environment files loaded in order. Later files override earlier values.\n\t * @default\n\t * [\".env\", \".env.local\", \".env.development\"]\n\t */\n\tenvFiles: string[];\n\n\thttp: {\n\t\t/**\n\t\t * TCP port used by the HTTP server.\n\t\t * @default 3000\n\t\t */\n\t\tport: number;\n\n\t\t/**\n\t\t * Hostname or interface address used by the HTTP server.\n\t\t * @default \"localhost\"\n\t\t */\n\t\thost: string;\n\n\t\t/**\n\t\t * Maximum accepted request body size, in bytes.\n\t\t * @default\n\t\t * 1024 * 1024 [1 MB]\n\t\t */\n\t\tmaxBodySize?: number;\n\n\t\t/**\n\t\t * Enables HTTPS when both key and certificate are provided.\n\t\t */\n\t\tssl?: {\n\t\t\t/**\n\t\t\t * PEM-encoded private key contents.\n\t\t\t */\n\t\t\tkey: string;\n\t\t\t/**\n\t\t\t * PEM-encoded certificate contents.\n\t\t\t */\n\t\t\tcert: string;\n\t\t\t/**\n\t\t\t * Optional passphrase for the private key.\n\t\t\t */\n\t\t\tpassphrase?: string;\n\t\t};\n\n\t\t/**\n\t\t * Cross-origin resource sharing configuration applied to HTTP requests.\n\t\t */\n\t\tcors: {\n\t\t\t/**\n\t\t\t * Allowed origins for CORS requests.\n\t\t\t * @default\n\t\t\t * [\"*\"]\n\t\t\t */\n\t\t\torigin?: string[];\n\n\t\t\t/**\n\t\t\t * Allowed HTTP methods for CORS requests.\n\t\t\t * @default\n\t\t\t * [\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\", \"OPTIONS\"]\n\t\t\t */\n\t\t\tmethods?: string[];\n\n\t\t\t/**\n\t\t\t * Allowed request headers for preflight requests.\n\t\t\t * @default\n\t\t\t * [\"Content-Type\", \"Authorization\"]\n\t\t\t */\n\t\t\tallowedHeaders?: string[];\n\n\t\t\t/**\n\t\t\t * Response headers exposed to the browser.\n\t\t\t * @default\n\t\t\t * [\"X-Powered-By\"]\n\t\t\t */\n\t\t\texposedHeaders?: string[];\n\n\t\t\t/**\n\t\t\t * Allows credentials such as cookies and authorization headers.\n\t\t\t * @default false\n\t\t\t */\n\t\t\tcredentials?: boolean;\n\n\t\t\t/**\n\t\t\t * How long preflight requests can be cached, in seconds.\n\t\t\t * @default 86400\n\t\t\t */\n\t\t\tmaxAge?: number;\n\t\t};\n\n\t\t/**\n\t\t * Additional MIME type mappings used when serving static assets.\n\t\t */\n\t\tmimeTypes?: Record<string, string>;\n\t};\n\n\t/**\n\t * Static file serving configuration.\n\t */\n\tstatic?: {\n\t\t/**\n\t\t * Directory used as the static asset root.\n\t\t */\n\t\troot: string;\n\t\t/**\n\t\t * URL prefix used to expose static assets.\n\t\t */\n\t\tprefix?: string;\n\t};\n\n\t/**\n\t * Reserved for Lithia Studio integration.\n\t */\n\tstudio?: {\n\t\tappId: string;\n\t};\n\n\t/**\n\t * Runtime logging controls.\n\t */\n\tlogging: {\n\t\t/**\n\t\t * Logs incoming HTTP requests and their final status/duration.\n\t\t * @default true\n\t\t */\n\t\trequests: boolean;\n\n\t\t/**\n\t\t * Logs internal framework/runtime events.\n\t\t * @default true\n\t\t */\n\t\tevents: boolean;\n\n\t\t/**\n\t\t * Logs async task completion and failure events.\n\t\t * @default true\n\t\t */\n\t\ttasks: boolean;\n\t};\n\n\t/**\n\t * Runtime controls for async task execution.\n\t */\n\tasyncTasks: {\n\t\t/**\n\t\t * Maximum execution time allowed for a single task, in milliseconds.\n\t\t * @default 30000\n\t\t */\n\t\ttimeoutMs: number;\n\t\t/**\n\t\t * Maximum number of tasks allowed to execute concurrently.\n\t\t * @default 10\n\t\t */\n\t\tconcurrencyLimit: number;\n\t};\n\n\t/**\n\t * Optional OpenAPI/Scalar integration settings.\n\t */\n\topenapi?: OpenAPIConfig;\n}\n\n/**\n * User-authored Lithia configuration accepted by `defineConfig()`.\n */\nexport interface LithiaConfig\n\textends DeepPartial<LithiaOptions>,\n\t\tC12InputConfig<LithiaConfig> {}\n\n/**\n * Default configuration applied by Lithia when a value is not explicitly set.\n */\nexport const DEFAULT_CONFIG: LithiaConfig = {\n\tsourceDir: \"src\",\n\toutDir: \"dist\",\n\tenvFiles: [\".env\", \".env.local\", \".env.development\"],\n\n\thttp: {\n\t\tport: 3000,\n\t\thost: \"localhost\",\n\t\tmaxBodySize: 1024 * 1024,\n\t\tcors: {\n\t\t\torigin: [\"*\"],\n\t\t\tmethods: [\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\", \"OPTIONS\"],\n\t\t\tallowedHeaders: [\"Content-Type\", \"Authorization\"],\n\t\t\texposedHeaders: [\"X-Powered-By\"],\n\t\t\tcredentials: false,\n\t\t\tmaxAge: 86400,\n\t\t},\n\t},\n\n\tlogging: {\n\t\trequests: true,\n\t\tevents: true,\n\t\ttasks: true,\n\t},\n\n\tasyncTasks: {\n\t\tconcurrencyLimit: 10,\n\t\ttimeoutMs: 30000,\n\t},\n\n\topenapi: {\n\t\tenabled: false,\n\t\tdocsPath: \"/docs\",\n\t\tspecPath: \"/openapi.json\",\n\t\ttitle: \"Lithia API\",\n\t\tversion: \"1.0.0\",\n\t},\n};\n\n/**\n * Defines a typed Lithia configuration file.\n *\n * Use this helper in `lithia.config.ts` to get autocomplete and validation for\n * the framework configuration surface.\n */\nexport function defineConfig(config: LithiaConfig): LithiaConfig {\n\treturn config;\n}\n","/**\n * Base error type for Lithia-specific failures.\n */\nexport class LithiaError extends Error {\n\tpublic readonly isLithiaError = true;\n\tconstructor(message?: string) {\n\t\tsuper(message);\n\t\tthis.name = this.constructor.name;\n\t\tObject.setPrototypeOf(this, new.target.prototype); // Fixes inheritance in older environments\n\t}\n}\n\n/**\n * HTTP-oriented application error with a status code and optional details.\n *\n * Throw this from routes when you want Lithia to return a structured client\n * error response.\n */\nexport class LithiaClientError extends LithiaError {\n\tpublic readonly timestamp = new Date();\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic readonly statusCode: number,\n\t\tpublic readonly details?: any,\n\t) {\n\t\tsuper(message);\n\t}\n}\n\n/**\n * Event-oriented error that captures the event name and optional details.\n *\n * Used when socket event handling needs to surface a structured failure.\n */\nexport class LithiaEventError extends LithiaError {\n\tpublic readonly timestamp = new Date();\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic readonly eventName: string,\n\t\tpublic readonly details?: any,\n\t) {\n\t\tsuper(message);\n\t}\n}\n","import { LithiaClientError } from \"../base\";\n\n/**\n * Indicates that the client sent an invalid request.\n */\nexport class BadRequestError extends LithiaClientError {\n\tconstructor(m: string, d?: any) {\n\t\tsuper(m, 400, d);\n\t}\n}\n/**\n * Indicates that authentication is required or invalid.\n */\nexport class UnauthorizedError extends LithiaClientError {\n\tconstructor(m: string, d?: any) {\n\t\tsuper(m, 401, d);\n\t}\n}\n/**\n * Indicates that the authenticated client is not allowed to perform the action.\n */\nexport class ForbiddenError extends LithiaClientError {\n\tconstructor(m: string, d?: any) {\n\t\tsuper(m, 403, d);\n\t}\n}\n/**\n * Indicates that no matching route was found for the current request.\n */\nexport class RouteNotFoundError extends LithiaClientError {\n\tconstructor(m: string, d?: any) {\n\t\tsuper(m, 404, d);\n\t}\n}\n/**\n * Indicates that a requested resource does not exist.\n */\nexport class NotFoundError extends LithiaClientError {\n\tconstructor(m: string, d?: any) {\n\t\tsuper(m, 404, d);\n\t}\n}\n/**\n * Indicates that the request conflicts with the current server state.\n */\nexport class ConflictError extends LithiaClientError {\n\tconstructor(m: string, d?: any) {\n\t\tsuper(m, 409, d);\n\t}\n}\n","import { LithiaClientError } from \"../base\";\n\n/**\n * Indicates that the server hit an unexpected internal failure.\n */\nexport class InternalServerError extends LithiaClientError {\n\tconstructor(m: string, d?: any) {\n\t\tsuper(m, 500, d);\n\t}\n}\n/**\n * Indicates that the service is temporarily unavailable.\n */\nexport class ServiceUnavailableError extends LithiaClientError {\n\tconstructor(m: string, d?: any) {\n\t\tsuper(m, 503, d);\n\t}\n}\n/**\n * Indicates that an upstream operation timed out.\n */\nexport class GatewayTimeoutError extends LithiaClientError {\n\tconstructor(m: string, d?: any) {\n\t\tsuper(m, 504, d);\n\t}\n}\n","import { LithiaError } from \"../base\";\n\n/**\n * Thrown when a Lithia hook is used outside a managed Lithia execution\n * context.\n */\nexport class NotInLithiaContextError extends LithiaError {\n\tconstructor() {\n\t\tsuper(\"Lithia hooks must be used within a managed invocation.\");\n\t}\n}\n\n/**\n * Thrown when `useDependency()` requests a dependency that has not been\n * registered with `provide()`.\n */\nexport class DependencyNotInitializedError extends LithiaError {\n\tconstructor(dependencyName: string) {\n\t\tsuper(`Dependency '${dependencyName}' not initialized. Check _app.ts.`);\n\t}\n}\n\n/**\n * Thrown when an event-only hook is used outside a socket event handler.\n */\nexport class NotInEventContextError extends NotInLithiaContextError {}\n/**\n * Thrown when a route-only hook is used outside an HTTP route handler.\n */\nexport class NotInRequestContextError extends NotInLithiaContextError {}\n","/**\n * @fileoverview Event Context Management for Lithia.js.\n * Utilizes AsyncLocalStorage to provide a thread-safe way to access\n * event-specific data (socket, payload, dependencies) without prop-drilling.\n */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { Socket } from \"socket.io\";\nimport type { Event } from \"../discovery/events\";\nimport { NotInEventContextError } from \"../errors/internal/index\";\n\nexport interface EventContext {\n\tdata: any;\n\tsocket: Socket;\n\tevent: Event;\n}\n\nconst CONTEXT_GLOBAL_KEY = Symbol.for(\"lithia.event_context.v1\");\n\nfunction getGlobalStore(): AsyncLocalStorage<EventContext> {\n\tconst globalAny = globalThis as any;\n\tif (!globalAny[CONTEXT_GLOBAL_KEY]) {\n\t\tglobalAny[CONTEXT_GLOBAL_KEY] = new AsyncLocalStorage<EventContext>();\n\t}\n\treturn globalAny[CONTEXT_GLOBAL_KEY];\n}\n\nexport const eventContextStore = getGlobalStore();\n\nexport function getEventContext(): EventContext {\n\tconst ctx = eventContextStore.getStore();\n\tif (!ctx) {\n\t\tthrow new NotInEventContextError();\n\t}\n\treturn ctx;\n}\n\nexport function runInEventContext<T>(context: EventContext, fn: () => T): T {\n\treturn eventContextStore.run(context, fn);\n}\n","import type { Socket } from \"socket.io\";\nimport { getEventContext } from \"../context/event-context\";\nimport type { Event } from \"../discovery/events\";\n\n/**\n * Returns the payload received by the current event handler.\n *\n * Use this inside helpers called from event handlers when passing the event\n * payload explicitly would add unnecessary plumbing. Event hook semantics are\n * described in [Event Handlers](https://lithiajs.org/docs/latest/events).\n *\n * @returns {T} Payload currently bound to the active event context.\n * @throws {NotInEventContextError} Throws when called outside a managed socket\n * event handler.\n */\nexport function useData<T = any>(): T {\n\treturn getEventContext().data as T;\n}\n\n/**\n * Returns the active Socket.IO connection for the current event handler.\n *\n * This hook exposes the socket boundary owned by the current event file, so\n * helper code can emit messages or inspect socket metadata without threading\n * the socket through every call.\n *\n * @returns {Socket} Socket.IO connection bound to the active event context.\n * @throws {NotInEventContextError} Throws when called outside a managed socket\n * event handler.\n */\nexport function useSocket(): Socket {\n\treturn getEventContext().socket;\n}\n\n/**\n * Returns the current event manifest entry being handled.\n *\n * The returned metadata includes the resolved event name and compiled module\n * path discovered from `src/app/events`.\n *\n * @returns {Event} Event manifest entry bound to the active event context.\n * @throws {NotInEventContextError} Throws when called outside a managed socket\n * event handler.\n */\nexport function useEvent(): Event {\n\treturn getEventContext().event;\n}\n\n/**\n * Returns the id of the active Socket.IO connection.\n *\n * This is a convenience wrapper around `useSocket().id` for code that only\n * needs the stable socket identifier.\n *\n * @returns {string} Socket.IO connection identifier for the active event\n * context.\n * @throws {NotInEventContextError} Throws when called outside a managed socket\n * event handler.\n */\nexport function useSocketId(): string {\n\treturn getEventContext().socket.id;\n}\n","import { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { LithiaOptions } from \"../config\";\nimport { NotInLithiaContextError } from \"../errors/internal/index\";\n\nexport interface LithiaContext {\n\tcontainer: Map<any, any>;\n\tconfig: LithiaOptions;\n}\n\nconst LITHIA_CONTEXT_KEY = Symbol.for(\"lithia.base_context.v1\");\n\nfunction getGlobalLithiaStore(): AsyncLocalStorage<LithiaContext> {\n\tconst globalAny = globalThis as any;\n\tif (!globalAny[LITHIA_CONTEXT_KEY]) {\n\t\tglobalAny[LITHIA_CONTEXT_KEY] = new AsyncLocalStorage<LithiaContext>();\n\t}\n\treturn globalAny[LITHIA_CONTEXT_KEY];\n}\n\nexport const lithiaContextStore = getGlobalLithiaStore();\n\nexport function getLithiaContext(): LithiaContext {\n\tconst ctx = lithiaContextStore.getStore();\n\tif (!ctx) {\n\t\tthrow new NotInLithiaContextError();\n\t}\n\treturn ctx;\n}\n\nexport function runInLithiaContext<T>(context: LithiaContext, fn: () => T): T {\n\treturn lithiaContextStore.run(context, fn);\n}\n","import { randomUUID } from \"node:crypto\";\nimport { parentPort } from \"node:worker_threads\";\nimport type { LithiaOptions } from \"../config\";\nimport { getLithiaContext } from \"../context/lithia-context\";\nimport { DependencyNotInitializedError } from \"../errors/internal/index\";\nimport type { InjectionKey } from \"../runtime/app/app-runtime\";\nimport type {\n\tTaskErrorPayload,\n\tTaskInvocationSource,\n} from \"../runtime/host/protocol\";\n\ndeclare module \"../hooks/lithia-hooks\" {\n\texport interface LithiaTasks {}\n}\n\ntype TaskInvocationKey = keyof LithiaTasks | (string & {});\n\n/**\n * Stores a value in the current app dependency container.\n *\n * Values registered with `provide()` can later be retrieved with\n * `useDependency()` or `useOptionalDependency()` from routes, events, tasks,\n * and `app/server.ts`.\n *\n * The value is written into the container bound to the current Lithia\n * execution context. When called during mutable bootstrap, the registration\n * becomes available to later route, event, and task executions.\n *\n * @param {InjectionKey<T>} key - Token used to register the dependency.\n * @param {T} value - Dependency instance stored under `key`.\n * @throws {NotInLithiaContextError} Throws when called outside a managed\n * Lithia execution context.\n */\nexport function provide<T>(key: InjectionKey<T>, value: T): void {\n\tconst { container } = getLithiaContext();\n\tcontainer.set(key, value);\n}\n\n/**\n * Resolves a dependency from the current Lithia context.\n *\n * Throws when the dependency has not been registered for the current app\n * lifecycle.\n *\n * @param {InjectionKey<T>} key - Token used to resolve the dependency.\n * @returns {T} Registered dependency instance for `key`.\n * @throws {NotInLithiaContextError} Throws when called outside a managed\n * Lithia execution context.\n * @throws {DependencyNotInitializedError} Throws when `key` has not been\n * registered in the current container.\n */\nexport function useDependency<T>(key: InjectionKey<T>): T {\n\tconst { container } = getLithiaContext();\n\n\tif (!container.has(key)) {\n\t\tconst name = typeof key === \"function\" ? key.name : String(key);\n\t\tthrow new DependencyNotInitializedError(name);\n\t}\n\n\treturn container.get(key) as T;\n}\n\n/**\n * Resolves a dependency from the current Lithia context when available.\n *\n * Returns `undefined` instead of throwing when the dependency has not been\n * registered.\n *\n * @param {InjectionKey<T>} key - Token used to resolve the dependency.\n * @returns {T | undefined} Registered dependency instance, or `undefined` when\n * the dependency is absent.\n * @throws {NotInLithiaContextError} Throws when called outside a managed\n * Lithia execution context.\n */\nexport function useOptionalDependency<T>(key: InjectionKey<T>): T | undefined {\n\tconst { container } = getLithiaContext();\n\treturn container.get(key) as T | undefined;\n}\n\ntype KnownTaskPayload<T> = T extends (...args: infer P) => any ? P : never;\ntype KnownTaskReturn<T> = T extends (...args: any[]) => Promise<infer R>\n\t? R\n\t: T extends (...args: any[]) => infer R\n\t\t? R\n\t\t: any;\n\ntype TaskPayload<K extends TaskInvocationKey> = K extends keyof LithiaTasks\n\t? KnownTaskPayload<LithiaTasks[K]>\n\t: any[];\n\ntype TaskReturn<K extends TaskInvocationKey> = K extends keyof LithiaTasks\n\t? KnownTaskReturn<LithiaTasks[K]>\n\t: unknown;\n\n/**\n * Returned by `dispatchTask()` to identify an async task execution.\n */\nexport type TaskExecutionHandle<K extends string = string> = {\n\ttaskId: K;\n\texecutionId: string;\n\tsource: TaskInvocationSource;\n};\n\n/**\n * Verifies that task arguments can cross the worker boundary through\n * structured cloning.\n *\n * @param {string} taskId - Task identifier used in error reporting.\n * @param {unknown[]} args - Task arguments about to be posted to a worker.\n * @throws {Error} Throws when one or more arguments cannot be cloned for\n * worker dispatch.\n */\nfunction ensureCloneableTaskArgs(taskId: string, args: unknown[]): void {\n\ttry {\n\t\tstructuredClone(args);\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`[task:${taskId}] Task arguments could not be cloned for worker dispatch.`,\n\t\t\t{ cause: error as Error },\n\t\t);\n\t}\n}\n\n/**\n * Reconstructs an `Error` instance from a serialized task failure payload.\n *\n * @param {TaskErrorPayload} payload - Serialized failure payload returned by a\n * task worker.\n * @returns {Error} Error object with restored name, message, cause, and stack\n * when available.\n */\nfunction createTaskError(payload: TaskErrorPayload): Error {\n\tconst error = new Error(payload.message, { cause: payload.cause });\n\terror.name = payload.name;\n\tif (payload.stack) {\n\t\terror.stack = payload.stack;\n\t}\n\treturn error;\n}\n\n/**\n * Posts a task invocation request to the Lithia host runtime.\n *\n * This helper validates that the argument list is cloneable, emits the worker\n * message expected by the host protocol, and returns a handle that identifies\n * the scheduled execution.\n *\n * @param {K} taskId - Task identifier to invoke.\n * @param {TaskPayload<K>} args - Serialized task arguments passed to the\n * worker.\n * @param {{ async: boolean; requestId?: string; executionId: string; source: TaskInvocationSource; }} options\n * Invocation metadata used by the host protocol.\n * @returns {TaskExecutionHandle<Extract<K, string>>} Handle that identifies\n * the dispatched task execution.\n * @throws {Error} Throws when task arguments cannot be structured-cloned.\n */\nfunction postTaskInvocation<K extends TaskInvocationKey>(\n\ttaskId: K,\n\targs: TaskPayload<K>,\n\toptions: {\n\t\tasync: boolean;\n\t\trequestId?: string;\n\t\texecutionId: string;\n\t\tsource: TaskInvocationSource;\n\t},\n): TaskExecutionHandle<Extract<K, string>> {\n\tensureCloneableTaskArgs(String(taskId), args as unknown[]);\n\tparentPort?.postMessage({\n\t\ttype: \"invoke\",\n\t\ttaskId,\n\t\tasync: options.async,\n\t\trequestId: options.requestId,\n\t\texecutionId: options.executionId,\n\t\targs,\n\t\tsource: options.source,\n\t\tattempt: 0,\n\t});\n\n\treturn {\n\t\ttaskId: String(taskId) as Extract<K, string>,\n\t\texecutionId: options.executionId,\n\t\tsource: options.source,\n\t};\n}\n\n/**\n * Executes an async task and waits for its result.\n *\n * This path uses Lithia's warm task workers to reduce latency for request-time\n * task execution while still keeping the work outside the app worker.\n *\n * Task semantics are described in\n * [Async Tasks](https://lithiajs.org/docs/latest/async-tasks).\n *\n * @param {K} taskId - Task identifier to execute.\n * @param {...TaskPayload<K>} args - Arguments forwarded to the task worker.\n * @returns {Promise<Awaited<TaskReturn<K>>>} Resolves with the task result\n * returned by the worker.\n * @throws {Error} Throws when called outside a Lithia-managed worker, when the\n * worker closes before replying, when arguments cannot be cloned, or when the\n * task worker reports a failure.\n */\nexport async function executeTask<K extends TaskInvocationKey>(\n\ttaskId: K,\n\t...args: TaskPayload<K>\n): Promise<Awaited<TaskReturn<K>>> {\n\tif (!parentPort) {\n\t\tthrow new Error(\n\t\t\t\"Async task invocations can only be used within a Lithia managed instance.\",\n\t\t);\n\t}\n\n\tconst requestId = randomUUID();\n\tconst executionId = randomUUID();\n\n\treturn new Promise<Awaited<TaskReturn<K>>>((resolve, reject) => {\n\t\tconst handler = (msg: any) => {\n\t\t\tif (msg.requestId === requestId) {\n\t\t\t\tcleanup();\n\t\t\t\tif (msg.type === \"invoke_success\") {\n\t\t\t\t\tresolve(msg.result);\n\t\t\t\t} else {\n\t\t\t\t\treject(createTaskError(msg.error));\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst closeHandler = () => {\n\t\t\tcleanup();\n\t\t\treject(\n\t\t\t\tnew Error(\n\t\t\t\t\t`[task:${String(taskId)}] Worker thread closed before task execution could complete.`,\n\t\t\t\t),\n\t\t\t);\n\t\t};\n\n\t\tconst cleanup = () => {\n\t\t\tparentPort?.off(\"message\", handler);\n\t\t\tparentPort?.off(\"close\", closeHandler);\n\t\t};\n\n\t\tparentPort?.on(\"message\", handler);\n\t\tparentPort?.on(\"close\", closeHandler);\n\n\t\tpostTaskInvocation(taskId, args, {\n\t\t\tasync: false,\n\t\t\trequestId,\n\t\t\texecutionId,\n\t\t\tsource: \"ON_DEMAND\",\n\t\t});\n\t});\n}\n\n/**\n * Dispatches an async task without awaiting its result.\n *\n * This path is fire-and-forget and returns a handle that can be logged or\n * correlated later.\n *\n * @param {K} taskId - Task identifier to dispatch.\n * @param {...TaskPayload<K>} args - Arguments forwarded to the task worker.\n * @returns {TaskExecutionHandle<Extract<K, string>>} Handle that identifies\n * the dispatched task execution.\n * @throws {Error} Throws when called outside a Lithia-managed worker or when\n * arguments cannot be cloned for worker dispatch.\n */\nexport function dispatchTask<K extends TaskInvocationKey>(\n\ttaskId: K,\n\t...args: TaskPayload<K>\n): TaskExecutionHandle<Extract<K, string>> {\n\tif (!parentPort) {\n\t\tthrow new Error(\n\t\t\t\"Async task invocations can only be used within a Lithia managed instance.\",\n\t\t);\n\t}\n\n\treturn postTaskInvocation(taskId, args, {\n\t\tasync: true,\n\t\texecutionId: randomUUID(),\n\t\tsource: \"ON_DEMAND\",\n\t});\n}\n\n/**\n * Legacy alias for `executeTask()`.\n *\n * Prefer `executeTask()` in new code.\n *\n * @param {K} taskId - Task identifier to execute.\n * @param {...TaskPayload<K>} args - Arguments forwarded to the task worker.\n * @returns {Promise<Awaited<TaskReturn<K>>>} Resolves with the task result.\n */\nexport async function runTask<K extends TaskInvocationKey>(\n\ttaskId: K,\n\t...args: TaskPayload<K>\n): Promise<Awaited<TaskReturn<K>>> {\n\treturn executeTask(taskId, ...args);\n}\n\n/**\n * Legacy alias for `dispatchTask()`.\n *\n * Prefer `dispatchTask()` in new code.\n *\n * @param {K} taskId - Task identifier to dispatch.\n * @param {...TaskPayload<K>} args - Arguments forwarded to the task worker.\n * @returns {TaskExecutionHandle<Extract<K, string>>} Handle that identifies\n * the dispatched task execution.\n */\nexport function runTaskAsync<K extends TaskInvocationKey>(\n\ttaskId: K,\n\t...args: TaskPayload<K>\n): TaskExecutionHandle<Extract<K, string>> {\n\treturn dispatchTask(taskId, ...args);\n}\n\n/**\n * Returns the resolved Lithia configuration for the current app lifecycle.\n *\n * This exposes the same fully resolved config object used by the active app\n * worker, including defaults and any loaded user configuration.\n *\n * @returns {LithiaOptions} Resolved Lithia configuration for the active\n * execution context.\n * @throws {NotInLithiaContextError} Throws when called outside a managed\n * Lithia execution context.\n */\nexport function useLithiaConfig(): LithiaOptions {\n\treturn getLithiaContext().config;\n}\n","/**\n * @fileoverview Route Context Management for Lithia.js.\n * Provides the execution scope for HTTP requests, wrapping the request,\n * response, and server metadata in a thread-safe AsyncLocalStorage container.\n */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { Server as SocketServer } from \"socket.io\";\nimport type { Route } from \"../discovery/routes\";\nimport { NotInRequestContextError } from \"../errors/internal/index\";\nimport type { LithiaRequest } from \"../transport/http/request\";\nimport type { LithiaResponse } from \"../transport/http/response\";\n\nexport interface RouteContext {\n\treq: LithiaRequest;\n\tres: LithiaResponse;\n\troute?: Route;\n\tsocketServer: SocketServer;\n}\n\nconst ROUTE_CONTEXT_KEY = Symbol.for(\"lithia.route_context.v1\");\n\nfunction getGlobalRouteStore(): AsyncLocalStorage<RouteContext> {\n\tconst globalAny = globalThis as any;\n\tif (!globalAny[ROUTE_CONTEXT_KEY]) {\n\t\tglobalAny[ROUTE_CONTEXT_KEY] = new AsyncLocalStorage<RouteContext>();\n\t}\n\treturn globalAny[ROUTE_CONTEXT_KEY];\n}\n\nexport const routeContextStore = getGlobalRouteStore();\n\nexport function getRouteContext(): RouteContext {\n\tconst ctx = routeContextStore.getStore();\n\tif (!ctx) {\n\t\tthrow new NotInRequestContextError();\n\t}\n\treturn ctx;\n}\n\nexport function runInRouteContext<T>(context: RouteContext, fn: () => T): T {\n\treturn routeContextStore.run(context, fn);\n}\n","import type { IncomingHttpHeaders } from \"node:http\";\nimport type { Server as SocketServer } from \"socket.io\";\nimport { getRouteContext } from \"../context/request-context\";\nimport type { Route } from \"../discovery/routes\";\nimport type { LithiaRequest, Params, Query } from \"../transport/http/request\";\nimport type { LithiaResponse } from \"../transport/http/response\";\n\n/**\n * Returns the current Lithia request object.\n *\n * This hook is only available while handling an HTTP route.\n * Route hook semantics are described in\n * [Route Handlers](https://lithiajs.org/docs/latest/routes).\n *\n * @returns {LithiaRequest} Request wrapper bound to the active route context.\n * @throws {NotInRequestContextError} Throws when called outside a managed HTTP\n * route handler.\n */\nexport function useRequest(): LithiaRequest {\n\treturn getRouteContext().req;\n}\n\n/**\n * Returns the current Lithia response object.\n *\n * This hook is only available while handling an HTTP route.\n *\n * @returns {LithiaResponse} Response wrapper bound to the active route\n * context.\n * @throws {NotInRequestContextError} Throws when called outside a managed HTTP\n * route handler.\n */\nexport function useResponse(): LithiaResponse {\n\treturn getRouteContext().res;\n}\n\n/**\n * Returns the matched route manifest entry for the current request.\n *\n * The route may be `undefined` when the current request context was created\n * without a resolved route manifest entry.\n *\n * @returns {Route | undefined} Matched route metadata for the current request.\n * @throws {NotInRequestContextError} Throws when called outside a managed HTTP\n * route handler.\n */\nexport function useRoute(): Route | undefined {\n\treturn getRouteContext().route;\n}\n\n/**\n * Returns the pathname for the current request.\n *\n * @returns {string} URL pathname of the active request.\n * @throws {NotInRequestContextError} Throws when called outside a managed HTTP\n * route handler.\n */\nexport function usePathname(): string {\n\treturn getRouteContext().req.pathname;\n}\n\n/**\n * Returns the typed route params for the current request.\n *\n * This is a typed view over the params already parsed and attached to the\n * current request object.\n *\n * @returns {T} Route params bound to the active request.\n * @throws {NotInRequestContextError} Throws when called outside a managed HTTP\n * route handler.\n */\nexport function useParams<T extends Params = Params>(): T {\n\treturn getRouteContext().req.params as T;\n}\n\n/**\n * Returns the typed query object for the current request.\n *\n * @returns {T} Query object parsed from the active request URL.\n * @throws {NotInRequestContextError} Throws when called outside a managed HTTP\n * route handler.\n */\nexport function useQuery<T extends Query = Query>(): T {\n\treturn getRouteContext().req.query as T;\n}\n\n/**\n * Returns the raw incoming HTTP headers for the current request.\n *\n * @returns {IncomingHttpHeaders} Raw request headers for the active HTTP\n * request.\n * @throws {NotInRequestContextError} Throws when called outside a managed HTTP\n * route handler.\n */\nexport function useHeaders(): IncomingHttpHeaders {\n\treturn getRouteContext().req.headers;\n}\n\n/**\n * Returns the shared Socket.IO server instance.\n *\n * Use this from HTTP routes when you need to emit socket events from the\n * request side of the app.\n *\n * @returns {SocketServer} Socket.IO server shared by the current application\n * runtime.\n * @throws {NotInRequestContextError} Throws when called outside a managed HTTP\n * route handler.\n */\nexport function useSocketServer(): SocketServer {\n\treturn getRouteContext().socketServer;\n}\n","import type { IncomingHttpHeaders, IncomingMessage } from \"node:http\";\nimport busboy, { type FileInfo } from \"busboy\";\nimport { type Cookies, parse as parseCookie } from \"cookie\";\nimport { BadRequestError } from \"../../errors/app/index\";\n\n/**\n * Route params object populated by the route matcher.\n *\n * Keys correspond to dynamic segments extracted from the matched route pattern.\n * The values are assigned by the HTTP transport before the handler runs and\n * remain mutable for the lifetime of the current request context.\n */\nexport type Params = Record<string, any>;\n\n/**\n * Query object parsed from the incoming request URL.\n *\n * Each value is currently stored as the last string value observed for a given\n * query key during URL parsing.\n */\nexport type Query = Record<string, any>;\n\n/**\n * Uploaded multipart file returned by `req.files()`.\n *\n * Each file entry contains the metadata reported by Busboy plus the fully\n * buffered file contents collected while the multipart stream is parsed.\n */\nexport interface UploadedFile extends FileInfo {\n\tfieldname: string;\n\tbuffer: Buffer;\n}\n\n/**\n * Lithia wrapper around Node's `IncomingMessage`.\n *\n * Provides helpers for reading params, query, body, cookies, and multipart\n * uploads from route handlers and middleware.\n *\n * The wrapper parses URL-derived data eagerly in the constructor and reads the\n * request stream lazily only when `body()` or `files()` is called. Parsed\n * payloads are cached so route handlers and middleware can safely reuse the\n * same request wrapper without reparsing the stream.\n *\n * Related docs:\n * - https://lithiajs.org/docs/latest/routes\n * - https://lithiajs.org/docs/latest/project-structure\n */\nexport class LithiaRequest {\n\tpublic readonly headers: Readonly<IncomingHttpHeaders>;\n\tpublic readonly method: Readonly<string>;\n\tpublic readonly pathname: Readonly<string>;\n\tpublic query: Query;\n\tpublic params: Params;\n\n\tprivate readonly storage = new Map<string, unknown>();\n\tprivate _bodyCache: unknown | null = null;\n\tprivate _filesCache: UploadedFile[] | null = null;\n\tprivate _cookies: Cookies | null = null;\n\n\t/**\n\t * Creates a request wrapper for the current HTTP transaction.\n\t *\n\t * The constructor captures headers, reconstructs a best-effort absolute URL,\n\t * normalizes the HTTP method to uppercase, and initializes parsed query and\n\t * route-param containers for later middleware and handler use.\n\t *\n\t * @param {IncomingMessage} req - Raw Node.js request object received by the\n\t * HTTP server.\n\t * @param {{ maxBodySize?: number }} opts - Per-request parsing options used\n\t * when consuming the request body stream.\n\t */\n\tconstructor(\n\t\tprivate readonly req: IncomingMessage,\n\t\tprivate readonly opts: { maxBodySize?: number },\n\t) {\n\t\tthis.headers = req.headers;\n\t\tconst isSecure = this.isSecure();\n\t\tconst host = this.headers.host || req.headers.host || \"unknown\";\n\t\tconst fullUrl = `${isSecure ? \"https\" : \"http\"}://${host}${req.url || \"/\"}`;\n\t\tconst url = new URL(fullUrl);\n\n\t\tthis.pathname = url.pathname;\n\t\tthis.method = (req.method || \"GET\").toUpperCase();\n\t\tthis.query = parseQueryToObject(url.searchParams);\n\t\tthis.params = {};\n\t}\n\n\t/**\n\t * Returns the best-effort client IP address for the current request.\n\t *\n\t * The lookup prefers proxy-forwarded headers before falling back to the raw\n\t * socket address, which makes the result suitable for deployments behind\n\t * reverse proxies that preserve `x-forwarded-for` or `x-real-ip`.\n\t *\n\t * @returns {string} The resolved client IP address, or `\"unknown\"` when no\n\t * address can be derived.\n\t */\n\tpublic ip(): string {\n\t\treturn (\n\t\t\t(this.headers[\"x-forwarded-for\"] as string)?.split(\",\")[0]?.trim() ||\n\t\t\t(this.headers[\"x-real-ip\"] as string) ||\n\t\t\t(this.req.socket as any)?.remoteAddress ||\n\t\t\t\"unknown\"\n\t\t);\n\t}\n\n\t/**\n\t * Returns the current request user-agent string.\n\t *\n\t * @returns {string} The raw `user-agent` header value, or an empty string\n\t * when the header is missing.\n\t */\n\tpublic userAgent(): string {\n\t\treturn (this.headers[\"user-agent\"] as string) || \"\";\n\t}\n\n\t/**\n\t * Returns whether the current request is using HTTPS.\n\t *\n\t * The check prefers `x-forwarded-proto` for proxy-aware deployments and then\n\t * falls back to the encrypted state of the underlying socket.\n\t *\n\t * @returns {boolean} `true` when the request should be treated as HTTPS.\n\t */\n\tpublic isSecure(): boolean {\n\t\treturn (\n\t\t\t(this.headers[\"x-forwarded-proto\"] as string) === \"https\" ||\n\t\t\t(this.req.socket as any)?.encrypted === true\n\t\t);\n\t}\n\n\t/**\n\t * Returns the request host header.\n\t *\n\t * @returns {string} The current host header value, or `\"unknown\"` when it is\n\t * not available.\n\t */\n\tpublic host(): string {\n\t\treturn (this.headers.host as string) || \"unknown\";\n\t}\n\n\t/**\n\t * Returns the absolute request URL reconstructed from the current request.\n\t *\n\t * This helper rebuilds the URL from the current security state, host header,\n\t * and parsed pathname. It does not append the original query string.\n\t *\n\t * @returns {string} Absolute URL for the current request pathname.\n\t */\n\tpublic url(): string {\n\t\treturn `${this.isSecure() ? \"https\" : \"http\"}://${this.host()}${this.pathname}`;\n\t}\n\n\t/**\n\t * Parses and returns the request body.\n\t *\n\t * JSON and plain text bodies are supported automatically. Multipart requests\n\t * populate both `body()` and `files()` through a shared parsing pass. The\n\t * parsed value is cached after the first read so later consumers do not touch\n\t * the underlying stream again.\n\t *\n\t * Requests whose method is not one of `POST`, `PUT`, `PATCH`, or `DELETE`\n\t * resolve to an empty object without reading the stream.\n\t *\n\t * @returns {Promise<T>} Parsed request body, multipart field map, raw text, or\n\t * an empty object for methods that do not consume a body by default.\n\t * @throws {BadRequestError} Thrown when the declared or streamed body size\n\t * exceeds `maxBodySize`, or when JSON parsing fails.\n\t */\n\tpublic async body<T>(): Promise<T> {\n\t\tconst methodsWithBody = [\"POST\", \"PUT\", \"PATCH\", \"DELETE\"];\n\t\tif (!methodsWithBody.includes(this.method)) {\n\t\t\treturn {} as T;\n\t\t}\n\n\t\tif (this._bodyCache !== null) return this._bodyCache as T;\n\n\t\tconst contentType = (this.headers[\"content-type\"] || \"\") as string;\n\n\t\tif (contentType.includes(\"multipart/form-data\")) {\n\t\t\tawait this.parseMultipart();\n\t\t\treturn this._bodyCache as T;\n\t\t}\n\n\t\tconst contentLength = parseInt(\n\t\t\t(this.headers[\"content-length\"] as string) || \"0\",\n\t\t\t10,\n\t\t);\n\t\tconst maxBodySize = this.opts.maxBodySize || 1024 * 1024;\n\n\t\tif (contentLength > maxBodySize) {\n\t\t\tthrow new BadRequestError(\"Request body too large.\");\n\t\t}\n\n\t\tconst body = await new Promise<T>((resolve, reject) => {\n\t\t\tconst chunks: Buffer[] = [];\n\t\t\tlet currentSize = 0;\n\n\t\t\tthis.req.on(\"data\", (chunk: Buffer) => {\n\t\t\t\tcurrentSize += chunk.length;\n\t\t\t\tif (currentSize > maxBodySize) {\n\t\t\t\t\treject(new BadRequestError(\"Request body too large.\"));\n\t\t\t\t}\n\t\t\t\tchunks.push(chunk);\n\t\t\t});\n\n\t\t\tthis.req.on(\"end\", () => {\n\t\t\t\tif (chunks.length === 0) return resolve({} as T);\n\n\t\t\t\tconst rawBody = Buffer.concat(chunks).toString(\"utf-8\");\n\t\t\t\ttry {\n\t\t\t\t\tif (contentType.includes(\"application/json\")) {\n\t\t\t\t\t\tresolve(JSON.parse(rawBody) as T);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresolve(rawBody as unknown as T);\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\treject(new BadRequestError(\"Invalid request body format.\"));\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.req.on(\"error\", (err) => reject(err));\n\t\t});\n\n\t\tthis._bodyCache = body;\n\t\tthis.storage.set(\"body\", body);\n\t\treturn body;\n\t}\n\n\t/**\n\t * Returns uploaded files for multipart/form-data requests.\n\t *\n\t * `files()` shares the same multipart parsing pass used by `body()`. The\n\t * first call buffers every uploaded file into memory and caches both the\n\t * parsed field object and file array for later access.\n\t *\n\t * @returns {Promise<UploadedFile[]>} Buffered multipart files, or an empty\n\t * array when the request is not multipart.\n\t */\n\tpublic async files(): Promise<UploadedFile[]> {\n\t\tconst contentType = (this.headers[\"content-type\"] || \"\") as string;\n\t\tif (!contentType.includes(\"multipart/form-data\")) return [];\n\n\t\tif (this._filesCache !== null) return this._filesCache;\n\n\t\tawait this.parseMultipart();\n\t\treturn this._filesCache || [];\n\t}\n\n\t/**\n\t * Overrides the cached body value for the current request context.\n\t *\n\t * This mutates only the wrapper cache and the internal storage map. It does\n\t * not modify the underlying Node.js request stream.\n\t *\n\t * @param {unknown} value - Replacement body value to expose through `body()`\n\t * and internal request storage.\n\t */\n\tpublic setBody(value: unknown): void {\n\t\tthis._bodyCache = value;\n\t\tthis.storage.set(\"body\", value);\n\t}\n\n\t/**\n\t * Returns all parsed cookies from the request.\n\t *\n\t * Cookies are parsed lazily on first access and cached for the remainder of\n\t * the request lifecycle.\n\t *\n\t * @returns {Cookies} Parsed cookie map for the current request.\n\t */\n\tpublic cookies(): Cookies {\n\t\tif (this._cookies === null) {\n\t\t\tconst cookieHeader = this.headers.cookie;\n\t\t\tthis._cookies = cookieHeader ? parseCookie(cookieHeader) : {};\n\t\t}\n\t\treturn this._cookies;\n\t}\n\n\t/**\n\t * Returns a single cookie value by name.\n\t *\n\t * @param {string} name - Cookie name to read from the parsed cookie map.\n\t * @returns {string | undefined} The cookie value when present.\n\t */\n\tpublic cookie(name: string): string | undefined {\n\t\treturn this.cookies()[name];\n\t}\n\n\t/**\n\t * Returns a value stored in the per-request internal storage map.\n\t *\n\t * This storage is local to the current request wrapper and can be used by\n\t * middleware and handlers to exchange derived values without mutating the\n\t * typed request surface.\n\t *\n\t * @param {string} key - Storage key associated with the requested value.\n\t * @returns {T | undefined} Stored value for the key, if one exists.\n\t */\n\tpublic get<T>(key: string): T | undefined {\n\t\treturn this.storage.get(key) as T | undefined;\n\t}\n\n\t/**\n\t * Stores a value in the per-request internal storage map.\n\t *\n\t * @param {string} key - Storage key to create or overwrite.\n\t * @param {unknown} value - Arbitrary value to retain for the lifetime of the\n\t * current request wrapper.\n\t */\n\tpublic set(key: string, value: unknown): void {\n\t\tthis.storage.set(key, value);\n\t}\n\n\t/**\n\t * Parses a multipart/form-data request into cached fields and file buffers.\n\t *\n\t * The request stream is piped into Busboy exactly once. Field values are\n\t * collected into a plain object, file contents are buffered fully in memory,\n\t * and both results are stored in the request cache and internal storage map.\n\t *\n\t * @returns {Promise<void>} Resolves after Busboy finishes consuming the\n\t * multipart stream and caches the parsed payload.\n\t */\n\tprivate async parseMultipart(): Promise<void> {\n\t\tif (this._bodyCache !== null && this._filesCache !== null) return;\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst bb = busboy({ headers: this.headers });\n\t\t\tconst fields: Record<string, any> = {};\n\t\t\tconst files: UploadedFile[] = [];\n\n\t\t\tbb.on(\"file\", (name, file, info) => {\n\t\t\t\tconst chunks: Buffer[] = [];\n\t\t\t\tfile.on(\"data\", (data) => chunks.push(data));\n\t\t\t\tfile.on(\"end\", () => {\n\t\t\t\t\tfiles.push({\n\t\t\t\t\t\tfieldname: name,\n\t\t\t\t\t\tbuffer: Buffer.concat(chunks),\n\t\t\t\t\t\t...info,\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tbb.on(\"field\", (name, value) => {\n\t\t\t\tfields[name] = value;\n\t\t\t});\n\n\t\t\tbb.on(\"finish\", () => {\n\t\t\t\tthis._bodyCache = fields;\n\t\t\t\tthis._filesCache = files;\n\t\t\t\tthis.storage.set(\"body\", fields);\n\t\t\t\tthis.storage.set(\"files\", files);\n\t\t\t\tresolve();\n\t\t\t});\n\n\t\t\tbb.on(\"error\", reject);\n\t\t\tthis.req.pipe(bb);\n\t\t});\n\t}\n}\n\n/**\n * Converts URL search parameters into the mutable query object exposed by the\n * request wrapper.\n *\n * When the same key appears multiple times, the last encountered value wins.\n *\n * @param {URLSearchParams} searchParams - Parsed search parameters from the\n * request URL.\n * @returns {Query} Plain object representation of the query string.\n */\nfunction parseQueryToObject(searchParams: URLSearchParams): Query {\n\tconst query: Query = {};\n\tfor (const [key, value] of searchParams.entries()) {\n\t\tquery[key] = value;\n\t}\n\treturn query;\n}\n","import { createReadStream, statSync } from \"node:fs\";\nimport type { OutgoingHttpHeaders, ServerResponse } from \"node:http\";\nimport { join } from \"node:path\";\nimport { logger } from \"@lithia-js/utils\";\nimport { serialize as serializeCookie } from \"cookie\";\n\n/**\n * Cookie attributes accepted by `LithiaResponse.cookie()`.\n *\n * These options are forwarded to the cookie serializer when pending cookies\n * are flushed into the `Set-Cookie` header.\n */\nexport interface CookieOptions {\n\tdomain?: string;\n\texpires?: Date;\n\thttpOnly?: boolean;\n\tmaxAge?: number;\n\tpath?: string;\n\tsameSite?: boolean | \"lax\" | \"strict\" | \"none\";\n\tsecure?: boolean;\n}\n\n/**\n * Cookie entry queued until the response writes headers.\n */\ninterface PendingCookie {\n\tname: string;\n\tvalue: string;\n\toptions?: CookieOptions;\n}\n\n/**\n * Lithia wrapper around Node's `ServerResponse`.\n *\n * Provides helpers for status management, JSON/text responses, redirects,\n * cookies, and file responses.\n *\n * The wrapper keeps response mutations centralized until one of the terminal\n * methods sends or streams the response. After that point, further mutations\n * are rejected to preserve a single-write HTTP lifecycle.\n *\n * Related docs:\n * - https://lithiajs.org/docs/latest/routes\n * - https://lithiajs.org/docs/latest/project-structure\n */\nexport class LithiaResponse {\n\tpublic _ended = false;\n\n\tprivate _cookies: PendingCookie[] = [];\n\tpublic on: (event: string, listener: (chunk: unknown) => void) => void;\n\n\t/**\n\t * Creates a response wrapper for the current HTTP transaction.\n\t *\n\t * The wrapper binds a pass-through `on()` helper to the underlying Node.js\n\t * response object so route-adjacent code can subscribe to response events\n\t * without holding the raw `ServerResponse`.\n\t *\n\t * @param {ServerResponse} res - Raw Node.js response object associated with\n\t * the current request.\n\t */\n\tconstructor(private readonly res: ServerResponse) {\n\t\tthis.on = this.res.on.bind(this.res);\n\t}\n\n\t/**\n\t * Returns the current HTTP status code.\n\t *\n\t * @returns {number} Status code currently assigned to the underlying\n\t * response.\n\t */\n\tpublic get statusCode(): number {\n\t\treturn this.res.statusCode;\n\t}\n\n\t/**\n\t * Sets the HTTP status code for the response.\n\t *\n\t * This mutates the underlying response only while it is still active.\n\t *\n\t * @param {number} status - HTTP status code to assign before the response is\n\t * sent.\n\t * @returns {this} The current response wrapper for fluent chaining.\n\t * @throws {Error} Thrown when the response has already ended or when the\n\t * supplied status code falls outside the valid HTTP range.\n\t */\n\tpublic status(status: number): this {\n\t\tthis.ensureActive();\n\t\tif (status < 100 || status > 599) {\n\t\t\tthrow new Error(`Invalid HTTP status code: ${status}`);\n\t\t}\n\t\tthis.res.statusCode = status;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns the currently assigned response headers.\n\t *\n\t * @returns {Readonly<OutgoingHttpHeaders>} Snapshot of the headers currently\n\t * stored on the underlying response.\n\t */\n\tpublic headers(): Readonly<OutgoingHttpHeaders> {\n\t\treturn this.res.getHeaders();\n\t}\n\n\t/**\n\t * Sets multiple response headers at once.\n\t *\n\t * @param {OutgoingHttpHeaders} headers - Header entries to assign to the\n\t * response before it is sent.\n\t * @returns {this} The current response wrapper for fluent chaining.\n\t * @throws {Error} Thrown when the response has already ended.\n\t */\n\tpublic setHeaders(headers: OutgoingHttpHeaders): this {\n\t\tthis.ensureActive();\n\t\tObject.entries(headers).forEach(([key, value]) => {\n\t\t\tthis.res.setHeader(key, value as any);\n\t\t});\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets a single response header.\n\t *\n\t * @param {string} name - Header name to create or overwrite.\n\t * @param {string | number | string[]} value - Header value written to the\n\t * underlying response.\n\t * @returns {this} The current response wrapper for fluent chaining.\n\t * @throws {Error} Thrown when the response has already ended.\n\t */\n\tpublic setHeader(name: string, value: string | number | string[]): this {\n\t\tthis.ensureActive();\n\t\tthis.res.setHeader(name, value as any);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes a response header.\n\t *\n\t * @param {string} name - Header name to remove.\n\t * @returns {this} The current response wrapper for fluent chaining.\n\t * @throws {Error} Thrown when the response has already ended.\n\t */\n\tpublic removeHeader(name: string): this {\n\t\tthis.ensureActive();\n\t\tthis.res.removeHeader(name);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Queues a cookie to be written when the response is sent.\n\t *\n\t * Cookies are accumulated in memory and serialized only when a terminal\n\t * response method flushes headers.\n\t *\n\t * @param {string} name - Cookie name.\n\t * @param {string} value - Cookie value.\n\t * @param {CookieOptions} [options={}] - Cookie serialization options.\n\t * @returns {this} The current response wrapper for fluent chaining.\n\t * @throws {Error} Thrown when the response has already ended.\n\t */\n\tpublic cookie(\n\t\tname: string,\n\t\tvalue: string,\n\t\toptions: CookieOptions = {},\n\t): this {\n\t\tthis.ensureActive();\n\t\tthis._cookies.push({ name, value, options });\n\t\treturn this;\n\t}\n\n\t/**\n\t * Clears a cookie by expiring it immediately.\n\t *\n\t * @param {string} name - Cookie name to expire.\n\t * @param {CookieOptions} [options={}] - Additional cookie attributes that\n\t * must match the original cookie scope.\n\t * @returns {this} The current response wrapper for fluent chaining.\n\t */\n\tpublic clearCookie(name: string, options: CookieOptions = {}): this {\n\t\treturn this.cookie(name, \"\", { ...options, expires: new Date(0) });\n\t}\n\n\t/**\n\t * Sends a response body using a best-effort content type.\n\t *\n\t * The method flushes pending cookies before writing, chooses a default\n\t * content type when none is set, and treats plain objects as JSON by\n\t * delegating to `json()`. Calling `send()` is a terminal operation for the\n\t * response lifecycle.\n\t *\n\t * @param {unknown} [data] - Response payload to send.\n\t * @throws {Error} Thrown when the response has already ended.\n\t */\n\tpublic send(data?: unknown): void {\n\t\tthis.applyPendingCookies();\n\t\tthis.ensureActive();\n\n\t\ttry {\n\t\t\tif (data === undefined || data === null) {\n\t\t\t\tthis.end();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (Buffer.isBuffer(data)) {\n\t\t\t\tif (!this.res.getHeader(\"Content-Type\")) {\n\t\t\t\t\tthis.setHeader(\"Content-Type\", \"application/octet-stream\");\n\t\t\t\t}\n\t\t\t\tthis.res.end(data);\n\t\t\t} else if (typeof data === \"object\") {\n\t\t\t\tthis.json(data as object);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tif (!this.res.getHeader(\"Content-Type\")) {\n\t\t\t\t\tthis.setHeader(\"Content-Type\", \"text/plain; charset=utf-8\");\n\t\t\t\t}\n\t\t\t\tthis.res.end(String(data));\n\t\t\t}\n\t\t} finally {\n\t\t\tthis._ended = true;\n\t\t}\n\t}\n\n\t/**\n\t * Sends a JSON response.\n\t *\n\t * Pending cookies are flushed before serialization. If JSON serialization\n\t * throws, the method logs the failure and falls back to a `500 Internal\n\t * Server Error` response body.\n\t *\n\t * @param {object} obj - Plain object to serialize as JSON.\n\t */\n\tpublic json(obj: object): void {\n\t\tthis.applyPendingCookies();\n\t\tthis.ensureActive();\n\n\t\ttry {\n\t\t\tconst body = JSON.stringify(obj);\n\t\t\tthis.res.setHeader(\"Content-Type\", \"application/json; charset=utf-8\");\n\t\t\tthis.res.end(body);\n\t\t} catch (err) {\n\t\t\tlogger.error(\"Failed to serialize JSON response:\", err);\n\t\t\tthis.res.statusCode = 500;\n\t\t\tthis.res.end(\"Internal Server Error\");\n\t\t} finally {\n\t\t\tthis._ended = true;\n\t\t}\n\t}\n\n\t/**\n\t * Sends a redirect response.\n\t *\n\t * This sets the status code, writes the `Location` header, and then ends the\n\t * response.\n\t *\n\t * @param {string} url - Redirect target written to the `Location` header.\n\t * @param {number} [status=302] - Redirect status code.\n\t */\n\tpublic redirect(url: string, status = 302): void {\n\t\tthis.status(status).setHeader(\"Location\", url).end();\n\t}\n\n\t/**\n\t * Ends the response without sending additional data.\n\t *\n\t * Pending cookies are flushed before the underlying response is closed.\n\t *\n\t * @throws {Error} Thrown when the response has already ended.\n\t */\n\tpublic end(): void {\n\t\tthis.applyPendingCookies();\n\t\tthis.ensureActive();\n\t\tthis.res.end();\n\t\tthis._ended = true;\n\t}\n\n\t/**\n\t * Streams a file to the client.\n\t *\n\t * The method resolves the final path, verifies that it points to a regular\n\t * file, sets `Content-Length`, flushes pending cookies, and pipes the file\n\t * stream into the underlying response. Missing files and stream failures fall\n\t * back to a `404` JSON error payload.\n\t *\n\t * @param {string} filePath - File path to stream. When `opts.root` is set, it\n\t * is resolved relative to that root.\n\t * @param {{ root?: string }} [opts={}] - Optional root directory used to\n\t * resolve relative file paths.\n\t */\n\tpublic sendFile(filePath: string, opts: { root?: string } = {}): void {\n\t\tthis.ensureActive();\n\t\ttry {\n\t\t\tconst fullPath = opts.root ? join(opts.root, filePath) : filePath;\n\t\t\tconst stats = statSync(fullPath);\n\n\t\t\tif (!stats.isFile()) throw new Error(\"Target is not a file\");\n\n\t\t\tthis.setHeader(\"Content-Length\", String(stats.size));\n\t\t\tconst stream = createReadStream(fullPath);\n\n\t\t\tthis.applyPendingCookies();\n\t\t\tstream.pipe(this.res);\n\n\t\t\tstream.on(\"error\", () => {\n\t\t\t\tthis.status(404).send({ error: \"File not found\" });\n\t\t\t});\n\t\t} catch {\n\t\t\tthis.status(404).send({ error: \"File not found\" });\n\t\t} finally {\n\t\t\tthis._ended = true;\n\t\t}\n\t}\n\n\t/**\n\t * Serializes queued cookies into the response headers and clears the queue.\n\t *\n\t * Existing `Set-Cookie` headers are preserved and extended so multiple\n\t * middleware and handler calls can contribute cookies before the response is\n\t * finalized.\n\t */\n\tprivate applyPendingCookies(): void {\n\t\tif (this._cookies.length === 0) return;\n\n\t\tconst existing = (this.res.getHeader(\"Set-Cookie\") as string[]) || [];\n\t\tconst serialized = this._cookies.map((cookie) =>\n\t\t\tserializeCookie(cookie.name, cookie.value, cookie.options as any),\n\t\t);\n\n\t\tthis.res.setHeader(\"Set-Cookie\", [...existing, ...serialized]);\n\t\tthis._cookies = [];\n\t}\n\n\t/**\n\t * Ensures the response has not already been finalized.\n\t *\n\t * @throws {Error} Thrown when a terminal response method has already sent or\n\t * ended the response.\n\t */\n\tprivate ensureActive(): void {\n\t\tif (this._ended) {\n\t\t\tthrow new Error(\"Response has already been sent.\");\n\t\t}\n\t}\n}\n"]}
@@ -0,0 +1,332 @@
1
+ import { DeepPartial } from '@lithia-js/utils';
2
+ import { C12InputConfig } from 'c12';
3
+
4
+ /**
5
+ * Enables automatic OpenAPI generation and the Scalar docs UI for a Lithia app.
6
+ */
7
+ interface OpenAPIConfig {
8
+ /**
9
+ * Enables OpenAPI artifact generation and reserved docs routes.
10
+ */
11
+ enabled: boolean;
12
+ /**
13
+ * Public route used to serve the Scalar UI.
14
+ * @default "/docs"
15
+ */
16
+ docsPath: string;
17
+ /**
18
+ * Public route used to serve the generated OpenAPI document.
19
+ * @default "/openapi.json"
20
+ */
21
+ specPath: string;
22
+ /**
23
+ * API title used in the generated OpenAPI document.
24
+ */
25
+ title: string;
26
+ /**
27
+ * API version used in the generated OpenAPI document.
28
+ */
29
+ version: string;
30
+ /**
31
+ * Optional API description shown by OpenAPI/Scalar consumers.
32
+ */
33
+ description?: string;
34
+ }
35
+ /**
36
+ * Fully resolved Lithia runtime configuration.
37
+ */
38
+ interface LithiaOptions {
39
+ /**
40
+ * Directory containing the application source tree.
41
+ * @default "src"
42
+ */
43
+ sourceDir: string;
44
+ /**
45
+ * Output directory used for generated runtime artifacts.
46
+ * @default "dist"
47
+ */
48
+ outDir: string;
49
+ /**
50
+ * Environment files loaded in order. Later files override earlier values.
51
+ * @default
52
+ * [".env", ".env.local", ".env.development"]
53
+ */
54
+ envFiles: string[];
55
+ http: {
56
+ /**
57
+ * TCP port used by the HTTP server.
58
+ * @default 3000
59
+ */
60
+ port: number;
61
+ /**
62
+ * Hostname or interface address used by the HTTP server.
63
+ * @default "localhost"
64
+ */
65
+ host: string;
66
+ /**
67
+ * Maximum accepted request body size, in bytes.
68
+ * @default
69
+ * 1024 * 1024 [1 MB]
70
+ */
71
+ maxBodySize?: number;
72
+ /**
73
+ * Enables HTTPS when both key and certificate are provided.
74
+ */
75
+ ssl?: {
76
+ /**
77
+ * PEM-encoded private key contents.
78
+ */
79
+ key: string;
80
+ /**
81
+ * PEM-encoded certificate contents.
82
+ */
83
+ cert: string;
84
+ /**
85
+ * Optional passphrase for the private key.
86
+ */
87
+ passphrase?: string;
88
+ };
89
+ /**
90
+ * Cross-origin resource sharing configuration applied to HTTP requests.
91
+ */
92
+ cors: {
93
+ /**
94
+ * Allowed origins for CORS requests.
95
+ * @default
96
+ * ["*"]
97
+ */
98
+ origin?: string[];
99
+ /**
100
+ * Allowed HTTP methods for CORS requests.
101
+ * @default
102
+ * ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
103
+ */
104
+ methods?: string[];
105
+ /**
106
+ * Allowed request headers for preflight requests.
107
+ * @default
108
+ * ["Content-Type", "Authorization"]
109
+ */
110
+ allowedHeaders?: string[];
111
+ /**
112
+ * Response headers exposed to the browser.
113
+ * @default
114
+ * ["X-Powered-By"]
115
+ */
116
+ exposedHeaders?: string[];
117
+ /**
118
+ * Allows credentials such as cookies and authorization headers.
119
+ * @default false
120
+ */
121
+ credentials?: boolean;
122
+ /**
123
+ * How long preflight requests can be cached, in seconds.
124
+ * @default 86400
125
+ */
126
+ maxAge?: number;
127
+ };
128
+ /**
129
+ * Additional MIME type mappings used when serving static assets.
130
+ */
131
+ mimeTypes?: Record<string, string>;
132
+ };
133
+ /**
134
+ * Static file serving configuration.
135
+ */
136
+ static?: {
137
+ /**
138
+ * Directory used as the static asset root.
139
+ */
140
+ root: string;
141
+ /**
142
+ * URL prefix used to expose static assets.
143
+ */
144
+ prefix?: string;
145
+ };
146
+ /**
147
+ * Reserved for Lithia Studio integration.
148
+ */
149
+ studio?: {
150
+ appId: string;
151
+ };
152
+ /**
153
+ * Runtime logging controls.
154
+ */
155
+ logging: {
156
+ /**
157
+ * Logs incoming HTTP requests and their final status/duration.
158
+ * @default true
159
+ */
160
+ requests: boolean;
161
+ /**
162
+ * Logs internal framework/runtime events.
163
+ * @default true
164
+ */
165
+ events: boolean;
166
+ /**
167
+ * Logs async task completion and failure events.
168
+ * @default true
169
+ */
170
+ tasks: boolean;
171
+ };
172
+ /**
173
+ * Runtime controls for async task execution.
174
+ */
175
+ asyncTasks: {
176
+ /**
177
+ * Maximum execution time allowed for a single task, in milliseconds.
178
+ * @default 30000
179
+ */
180
+ timeoutMs: number;
181
+ /**
182
+ * Maximum number of tasks allowed to execute concurrently.
183
+ * @default 10
184
+ */
185
+ concurrencyLimit: number;
186
+ };
187
+ /**
188
+ * Optional OpenAPI/Scalar integration settings.
189
+ */
190
+ openapi?: OpenAPIConfig;
191
+ }
192
+ /**
193
+ * User-authored Lithia configuration accepted by `defineConfig()`.
194
+ */
195
+ interface LithiaConfig extends DeepPartial<LithiaOptions>, C12InputConfig<LithiaConfig> {
196
+ }
197
+ /**
198
+ * Defines a typed Lithia configuration file.
199
+ *
200
+ * Use this helper in `lithia.config.ts` to get autocomplete and validation for
201
+ * the framework configuration surface.
202
+ */
203
+ declare function defineConfig(config: LithiaConfig): LithiaConfig;
204
+
205
+ /**
206
+ * Base error type for Lithia-specific failures.
207
+ */
208
+ declare class LithiaError extends Error {
209
+ readonly isLithiaError = true;
210
+ constructor(message?: string);
211
+ }
212
+ /**
213
+ * HTTP-oriented application error with a status code and optional details.
214
+ *
215
+ * Throw this from routes when you want Lithia to return a structured client
216
+ * error response.
217
+ */
218
+ declare class LithiaClientError extends LithiaError {
219
+ readonly statusCode: number;
220
+ readonly details?: any | undefined;
221
+ readonly timestamp: Date;
222
+ constructor(message: string, statusCode: number, details?: any | undefined);
223
+ }
224
+ /**
225
+ * Event-oriented error that captures the event name and optional details.
226
+ *
227
+ * Used when socket event handling needs to surface a structured failure.
228
+ */
229
+ declare class LithiaEventError extends LithiaError {
230
+ readonly eventName: string;
231
+ readonly details?: any | undefined;
232
+ readonly timestamp: Date;
233
+ constructor(message: string, eventName: string, details?: any | undefined);
234
+ }
235
+
236
+ /**
237
+ * Indicates that the client sent an invalid request.
238
+ */
239
+ declare class BadRequestError extends LithiaClientError {
240
+ constructor(m: string, d?: any);
241
+ }
242
+ /**
243
+ * Indicates that authentication is required or invalid.
244
+ */
245
+ declare class UnauthorizedError extends LithiaClientError {
246
+ constructor(m: string, d?: any);
247
+ }
248
+ /**
249
+ * Indicates that the authenticated client is not allowed to perform the action.
250
+ */
251
+ declare class ForbiddenError extends LithiaClientError {
252
+ constructor(m: string, d?: any);
253
+ }
254
+ /**
255
+ * Indicates that no matching route was found for the current request.
256
+ */
257
+ declare class RouteNotFoundError extends LithiaClientError {
258
+ constructor(m: string, d?: any);
259
+ }
260
+ /**
261
+ * Indicates that a requested resource does not exist.
262
+ */
263
+ declare class NotFoundError extends LithiaClientError {
264
+ constructor(m: string, d?: any);
265
+ }
266
+ /**
267
+ * Indicates that the request conflicts with the current server state.
268
+ */
269
+ declare class ConflictError extends LithiaClientError {
270
+ constructor(m: string, d?: any);
271
+ }
272
+
273
+ /**
274
+ * Runtime manifest entry describing one discovered socket event handler.
275
+ */
276
+ interface Event {
277
+ /**
278
+ * Event name resolved from the file path under the events directory.
279
+ */
280
+ name: string;
281
+ /**
282
+ * Compiled module path loaded by the socket runtime.
283
+ */
284
+ filePath: string;
285
+ /**
286
+ * Top-level namespace extracted from colon-delimited event names, or `null`
287
+ * when the event has no namespace segment.
288
+ */
289
+ namespace: string | null;
290
+ }
291
+
292
+ /**
293
+ * Runtime manifest entry describing one discovered HTTP route handler.
294
+ */
295
+ interface Route {
296
+ /**
297
+ * HTTP method associated with the route, if the filename encodes one.
298
+ */
299
+ method?: string;
300
+ /**
301
+ * Canonical public route path used by the request matcher.
302
+ */
303
+ path: string;
304
+ /**
305
+ * Whether the route path contains dynamic or catch-all segments.
306
+ */
307
+ dynamic: boolean;
308
+ /**
309
+ * Compiled module path loaded by the HTTP runtime.
310
+ */
311
+ filePath: string;
312
+ /**
313
+ * Regular expression source used to match the route path at runtime.
314
+ */
315
+ regex: string;
316
+ }
317
+
318
+ /**
319
+ * Global key used to expose the resolved production config inside the runtime.
320
+ *
321
+ * This is primarily used by Lithia internals and advanced tooling.
322
+ */
323
+ declare const CFG_GLOBAL_KEY: "__lithia_host_config_v1";
324
+ /**
325
+ * Identifies how a task execution was triggered.
326
+ *
327
+ * `ON_DEMAND` represents explicit runtime invocation. `CRON` represents a
328
+ * scheduled invocation emitted by the app worker scheduler.
329
+ */
330
+ type TaskInvocationSource = "ON_DEMAND" | "CRON";
331
+
332
+ export { BadRequestError as B, CFG_GLOBAL_KEY as C, type Event as E, ForbiddenError as F, LithiaError as L, NotFoundError as N, type Route as R, type TaskInvocationSource as T, UnauthorizedError as U, type LithiaOptions as a, RouteNotFoundError as b, LithiaClientError as c, ConflictError as d, type LithiaConfig as e, LithiaEventError as f, defineConfig as g };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Execution model assigned to a discovered Lithia task.
3
+ */
4
+ type TaskTrigger = "CRON" | "ON_DEMAND";
5
+ /**
6
+ * Runtime manifest entry describing one discovered async task.
7
+ */
8
+ interface TaskCore {
9
+ /**
10
+ * Stable task identifier derived from the file path under `src/app/tasks`.
11
+ */
12
+ id: string;
13
+ /**
14
+ * Execution model assigned to the task.
15
+ */
16
+ trigger: TaskTrigger;
17
+ /**
18
+ * Compiled module path loaded by the task runtime.
19
+ */
20
+ filePath: string;
21
+ /**
22
+ * Cron expression required for CRON-triggered tasks.
23
+ */
24
+ schedule?: string;
25
+ /**
26
+ * Maximum retry count allowed for CRON-triggered tasks.
27
+ */
28
+ retries?: number;
29
+ }
30
+
31
+ export type { TaskCore as T };
@@ -0,0 +1,2 @@
1
+
2
+ export { }