@geekmidas/constructs 3.0.0 → 3.0.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.
Files changed (179) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/AWSLambdaFunction-BF1gJJjG.d.mts.map +1 -1
  3. package/dist/{AWSLambdaFunction-wtE9Lx_-.cjs → AWSLambdaFunction-CPEAl5nZ.cjs} +15 -3
  4. package/dist/AWSLambdaFunction-CPEAl5nZ.cjs.map +1 -0
  5. package/dist/{AWSLambdaFunction-BDL7Thi_.mjs → AWSLambdaFunction-DJiCAPAf.mjs} +15 -3
  6. package/dist/AWSLambdaFunction-DJiCAPAf.mjs.map +1 -0
  7. package/dist/AWSLambdaFunction-tzqv5XU6.d.cts.map +1 -1
  8. package/dist/{AWSLambdaSubscriberAdaptor-DsRmmGm1.mjs → AWSLambdaSubscriberAdaptor-RKwKYLl1.mjs} +14 -3
  9. package/dist/AWSLambdaSubscriberAdaptor-RKwKYLl1.mjs.map +1 -0
  10. package/dist/{AWSLambdaSubscriberAdaptor-BtBKExsh.cjs → AWSLambdaSubscriberAdaptor-eZ3qoKvK.cjs} +13 -2
  11. package/dist/AWSLambdaSubscriberAdaptor-eZ3qoKvK.cjs.map +1 -0
  12. package/dist/{AmazonApiGatewayEndpointAdaptor-CQSZArI6.d.mts → AmazonApiGatewayEndpointAdaptor-B30TqZRX.d.mts} +2 -1
  13. package/dist/AmazonApiGatewayEndpointAdaptor-B30TqZRX.d.mts.map +1 -0
  14. package/dist/{AmazonApiGatewayEndpointAdaptor-Bxvs-F0F.d.cts → AmazonApiGatewayEndpointAdaptor-D4lAuXA-.d.cts} +2 -1
  15. package/dist/AmazonApiGatewayEndpointAdaptor-D4lAuXA-.d.cts.map +1 -0
  16. package/dist/{AmazonApiGatewayEndpointAdaptor-BPxHm8Tg.mjs → AmazonApiGatewayEndpointAdaptor-ciUHVvPX.mjs} +6 -2
  17. package/dist/AmazonApiGatewayEndpointAdaptor-ciUHVvPX.mjs.map +1 -0
  18. package/dist/{AmazonApiGatewayEndpointAdaptor-1XyivLJs.cjs → AmazonApiGatewayEndpointAdaptor-jDYqkgFE.cjs} +6 -2
  19. package/dist/AmazonApiGatewayEndpointAdaptor-jDYqkgFE.cjs.map +1 -0
  20. package/dist/{AmazonApiGatewayV1EndpointAdaptor-D9zY3nHe.d.cts → AmazonApiGatewayV1EndpointAdaptor-B5xFYauV.d.cts} +2 -2
  21. package/dist/{AmazonApiGatewayV1EndpointAdaptor-D9zY3nHe.d.cts.map → AmazonApiGatewayV1EndpointAdaptor-B5xFYauV.d.cts.map} +1 -1
  22. package/dist/{AmazonApiGatewayV1EndpointAdaptor-xTrFYt48.d.mts → AmazonApiGatewayV1EndpointAdaptor-CG1UJoAK.d.mts} +2 -2
  23. package/dist/{AmazonApiGatewayV1EndpointAdaptor-xTrFYt48.d.mts.map → AmazonApiGatewayV1EndpointAdaptor-CG1UJoAK.d.mts.map} +1 -1
  24. package/dist/{AmazonApiGatewayV1EndpointAdaptor-CQ0dtx1M.mjs → AmazonApiGatewayV1EndpointAdaptor-COLHHAsd.mjs} +2 -2
  25. package/dist/{AmazonApiGatewayV1EndpointAdaptor-CQ0dtx1M.mjs.map → AmazonApiGatewayV1EndpointAdaptor-COLHHAsd.mjs.map} +1 -1
  26. package/dist/{AmazonApiGatewayV1EndpointAdaptor-Cm2wieNy.cjs → AmazonApiGatewayV1EndpointAdaptor-CW0BCUkm.cjs} +2 -2
  27. package/dist/{AmazonApiGatewayV1EndpointAdaptor-Cm2wieNy.cjs.map → AmazonApiGatewayV1EndpointAdaptor-CW0BCUkm.cjs.map} +1 -1
  28. package/dist/{AmazonApiGatewayV2EndpointAdaptor-CjPCxIb1.cjs → AmazonApiGatewayV2EndpointAdaptor-C7ZrwcTX.cjs} +6 -2
  29. package/dist/{AmazonApiGatewayV2EndpointAdaptor-CjPCxIb1.cjs.map → AmazonApiGatewayV2EndpointAdaptor-C7ZrwcTX.cjs.map} +1 -1
  30. package/dist/{AmazonApiGatewayV2EndpointAdaptor-DrbEaZ2_.mjs → AmazonApiGatewayV2EndpointAdaptor-Cl9ERGyi.mjs} +6 -2
  31. package/dist/{AmazonApiGatewayV2EndpointAdaptor-DrbEaZ2_.mjs.map → AmazonApiGatewayV2EndpointAdaptor-Cl9ERGyi.mjs.map} +1 -1
  32. package/dist/{AmazonApiGatewayV2EndpointAdaptor-CHi3Qe1s.d.cts → AmazonApiGatewayV2EndpointAdaptor-OkwjABOz.d.cts} +4 -3
  33. package/dist/AmazonApiGatewayV2EndpointAdaptor-OkwjABOz.d.cts.map +1 -0
  34. package/dist/{AmazonApiGatewayV2EndpointAdaptor-BBayh2_k.d.mts → AmazonApiGatewayV2EndpointAdaptor-ofjuxcPV.d.mts} +4 -3
  35. package/dist/AmazonApiGatewayV2EndpointAdaptor-ofjuxcPV.d.mts.map +1 -0
  36. package/dist/{FunctionExecutionWrapper-Ba0Z-iwe.mjs → FunctionExecutionWrapper-B0ZAssiy.mjs} +1 -1
  37. package/dist/{FunctionExecutionWrapper-Ba0Z-iwe.mjs.map → FunctionExecutionWrapper-B0ZAssiy.mjs.map} +1 -1
  38. package/dist/{FunctionExecutionWrapper-7B-CufYj.cjs → FunctionExecutionWrapper-KKHP6fDY.cjs} +1 -1
  39. package/dist/{FunctionExecutionWrapper-7B-CufYj.cjs.map → FunctionExecutionWrapper-KKHP6fDY.cjs.map} +1 -1
  40. package/dist/{HonoEndpointAdaptor-vI3LPiyu.d.cts → HonoEndpointAdaptor-BCql3gLP.d.cts} +3 -3
  41. package/dist/{HonoEndpointAdaptor-vI3LPiyu.d.cts.map → HonoEndpointAdaptor-BCql3gLP.d.cts.map} +1 -1
  42. package/dist/{HonoEndpointAdaptor-B4NMwHkr.cjs → HonoEndpointAdaptor-CavBd6P2.cjs} +4 -4
  43. package/dist/{HonoEndpointAdaptor-B4NMwHkr.cjs.map → HonoEndpointAdaptor-CavBd6P2.cjs.map} +1 -1
  44. package/dist/{HonoEndpointAdaptor-CNlb-KGz.mjs → HonoEndpointAdaptor-y9fCIxaz.mjs} +4 -4
  45. package/dist/{HonoEndpointAdaptor-CNlb-KGz.mjs.map → HonoEndpointAdaptor-y9fCIxaz.mjs.map} +1 -1
  46. package/dist/{TestEndpointAdaptor-DJdmYxMn.mjs → TestEndpointAdaptor-CDOhCmIk.mjs} +2 -2
  47. package/dist/{TestEndpointAdaptor-DJdmYxMn.mjs.map → TestEndpointAdaptor-CDOhCmIk.mjs.map} +1 -1
  48. package/dist/{TestEndpointAdaptor-Bsqn6T0k.cjs → TestEndpointAdaptor-DjQSuxRq.cjs} +2 -2
  49. package/dist/{TestEndpointAdaptor-Bsqn6T0k.cjs.map → TestEndpointAdaptor-DjQSuxRq.cjs.map} +1 -1
  50. package/dist/TestFunctionAdaptor-BHk2bDOV.d.cts.map +1 -1
  51. package/dist/{TestFunctionAdaptor-CK-dbKpO.mjs → TestFunctionAdaptor-C5CLuR-9.mjs} +25 -17
  52. package/dist/TestFunctionAdaptor-C5CLuR-9.mjs.map +1 -0
  53. package/dist/{TestFunctionAdaptor-CSMX7myB.cjs → TestFunctionAdaptor-CH6-gO_B.cjs} +24 -16
  54. package/dist/TestFunctionAdaptor-CH6-gO_B.cjs.map +1 -0
  55. package/dist/TestFunctionAdaptor-DzT8GRdR.d.mts.map +1 -1
  56. package/dist/TestSubscriberAdaptor-CPEiqSfE.d.mts.map +1 -1
  57. package/dist/{TestSubscriberAdaptor-CrqLkyUE.mjs → TestSubscriberAdaptor-CwP3qNJ4.mjs} +22 -14
  58. package/dist/TestSubscriberAdaptor-CwP3qNJ4.mjs.map +1 -0
  59. package/dist/TestSubscriberAdaptor-DQk5xzb0.d.cts.map +1 -1
  60. package/dist/{TestSubscriberAdaptor-1m-2bM_j.cjs → TestSubscriberAdaptor-Dgxr_0vL.cjs} +21 -13
  61. package/dist/TestSubscriberAdaptor-Dgxr_0vL.cjs.map +1 -0
  62. package/dist/adaptors/aws.cjs +7 -6
  63. package/dist/adaptors/aws.d.cts +4 -4
  64. package/dist/adaptors/aws.d.mts +4 -4
  65. package/dist/adaptors/aws.mjs +7 -6
  66. package/dist/adaptors/hono.cjs +3 -3
  67. package/dist/adaptors/hono.d.cts +2 -2
  68. package/dist/adaptors/hono.d.mts +1 -1
  69. package/dist/adaptors/hono.mjs +3 -3
  70. package/dist/adaptors/testing.cjs +4 -4
  71. package/dist/adaptors/testing.d.cts +1 -1
  72. package/dist/adaptors/testing.d.mts +1 -1
  73. package/dist/adaptors/testing.mjs +4 -4
  74. package/dist/crons/Cron.d.cts +1 -1
  75. package/dist/crons/Cron.d.mts +1 -1
  76. package/dist/crons/CronBuilder.d.cts +1 -1
  77. package/dist/crons/CronBuilder.d.mts +1 -1
  78. package/dist/crons/index.d.cts +5 -5
  79. package/dist/crons/index.d.mts +5 -5
  80. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +1 -1
  81. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +2 -2
  82. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +2 -2
  83. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +1 -1
  84. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +2 -2
  85. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +3 -3
  86. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +3 -3
  87. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +2 -2
  88. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +3 -2
  89. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +3 -3
  90. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +3 -3
  91. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +3 -2
  92. package/dist/endpoints/Endpoint.d.cts +1 -1
  93. package/dist/endpoints/Endpoint.d.mts +1 -1
  94. package/dist/endpoints/EndpointBuilder.d.cts +1 -1
  95. package/dist/endpoints/EndpointBuilder.d.mts +1 -1
  96. package/dist/endpoints/EndpointFactory.d.cts +1 -1
  97. package/dist/endpoints/EndpointFactory.d.mts +1 -1
  98. package/dist/endpoints/HonoEndpointAdaptor.cjs +3 -3
  99. package/dist/endpoints/HonoEndpointAdaptor.d.cts +2 -2
  100. package/dist/endpoints/HonoEndpointAdaptor.d.mts +1 -1
  101. package/dist/endpoints/HonoEndpointAdaptor.mjs +3 -3
  102. package/dist/endpoints/TestEndpointAdaptor.cjs +2 -2
  103. package/dist/endpoints/TestEndpointAdaptor.d.cts +1 -1
  104. package/dist/endpoints/TestEndpointAdaptor.d.mts +1 -1
  105. package/dist/endpoints/TestEndpointAdaptor.mjs +2 -2
  106. package/dist/endpoints/audit.d.cts +1 -1
  107. package/dist/endpoints/audit.d.mts +1 -1
  108. package/dist/endpoints/helpers.cjs +1 -1
  109. package/dist/endpoints/helpers.d.cts +1 -1
  110. package/dist/endpoints/helpers.d.mts +1 -1
  111. package/dist/endpoints/helpers.mjs +1 -1
  112. package/dist/endpoints/index.cjs +1 -1
  113. package/dist/endpoints/index.d.cts +3 -3
  114. package/dist/endpoints/index.d.mts +3 -3
  115. package/dist/endpoints/index.mjs +1 -1
  116. package/dist/endpoints/lazyAccessors.cjs +1 -1
  117. package/dist/endpoints/lazyAccessors.d.cts +1 -1
  118. package/dist/endpoints/lazyAccessors.d.mts +1 -1
  119. package/dist/endpoints/lazyAccessors.mjs +1 -1
  120. package/dist/endpoints/processAudits.d.cts +1 -1
  121. package/dist/endpoints/processAudits.d.mts +1 -1
  122. package/dist/endpoints/rls.d.cts +1 -1
  123. package/dist/endpoints/rls.d.mts +1 -1
  124. package/dist/functions/AWSLambdaFunction.cjs +2 -2
  125. package/dist/functions/AWSLambdaFunction.mjs +2 -2
  126. package/dist/functions/FunctionExecutionWrapper.cjs +1 -1
  127. package/dist/functions/FunctionExecutionWrapper.mjs +1 -1
  128. package/dist/functions/TestFunctionAdaptor.cjs +1 -1
  129. package/dist/functions/TestFunctionAdaptor.mjs +1 -1
  130. package/dist/functions/index.d.cts +1 -1
  131. package/dist/functions/index.d.mts +1 -1
  132. package/dist/{helpers-Ciyi6Aap.cjs → helpers-BYyX0qTA.cjs} +1 -1
  133. package/dist/{helpers-Ciyi6Aap.cjs.map → helpers-BYyX0qTA.cjs.map} +1 -1
  134. package/dist/{helpers-C5j_GRBz.mjs → helpers-BtwC2IW8.mjs} +1 -1
  135. package/dist/{helpers-C5j_GRBz.mjs.map → helpers-BtwC2IW8.mjs.map} +1 -1
  136. package/dist/index-BRoc67OX.d.cts +12 -0
  137. package/dist/{index-BnoOaBQV.d.cts.map → index-BRoc67OX.d.cts.map} +1 -1
  138. package/dist/index-_5DYCNAt.d.mts +12 -0
  139. package/dist/{index-DQo_Csy7.d.mts.map → index-_5DYCNAt.d.mts.map} +1 -1
  140. package/dist/{lazyAccessors-B8Hhras9.cjs → lazyAccessors-BVEtB9lU.cjs} +1 -1
  141. package/dist/{lazyAccessors-B8Hhras9.cjs.map → lazyAccessors-BVEtB9lU.cjs.map} +1 -1
  142. package/dist/{lazyAccessors-B-Jgkg2o.mjs → lazyAccessors-DM6HcXQk.mjs} +1 -1
  143. package/dist/{lazyAccessors-B-Jgkg2o.mjs.map → lazyAccessors-DM6HcXQk.mjs.map} +1 -1
  144. package/dist/subscribers/AWSLambdaSubscriberAdaptor.cjs +1 -1
  145. package/dist/subscribers/AWSLambdaSubscriberAdaptor.mjs +1 -1
  146. package/dist/subscribers/TestSubscriberAdaptor.cjs +1 -1
  147. package/dist/subscribers/TestSubscriberAdaptor.mjs +1 -1
  148. package/dist/subscribers/index.d.cts +2 -2
  149. package/dist/subscribers/index.d.cts.map +1 -1
  150. package/dist/subscribers/index.d.mts +2 -2
  151. package/dist/subscribers/index.d.mts.map +1 -1
  152. package/package.json +7 -7
  153. package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +6 -1
  154. package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +9 -1
  155. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +83 -11
  156. package/src/functions/AWSLambdaFunction.ts +16 -2
  157. package/src/functions/TestFunctionAdaptor.ts +38 -31
  158. package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +55 -0
  159. package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +82 -0
  160. package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +17 -2
  161. package/src/subscribers/TestSubscriberAdaptor.ts +35 -29
  162. package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +64 -0
  163. package/src/subscribers/__tests__/TestSubscriberAdaptor.spec.ts +94 -0
  164. package/dist/AWSLambdaFunction-BDL7Thi_.mjs.map +0 -1
  165. package/dist/AWSLambdaFunction-wtE9Lx_-.cjs.map +0 -1
  166. package/dist/AWSLambdaSubscriberAdaptor-BtBKExsh.cjs.map +0 -1
  167. package/dist/AWSLambdaSubscriberAdaptor-DsRmmGm1.mjs.map +0 -1
  168. package/dist/AmazonApiGatewayEndpointAdaptor-1XyivLJs.cjs.map +0 -1
  169. package/dist/AmazonApiGatewayEndpointAdaptor-BPxHm8Tg.mjs.map +0 -1
  170. package/dist/AmazonApiGatewayEndpointAdaptor-Bxvs-F0F.d.cts.map +0 -1
  171. package/dist/AmazonApiGatewayEndpointAdaptor-CQSZArI6.d.mts.map +0 -1
  172. package/dist/AmazonApiGatewayV2EndpointAdaptor-BBayh2_k.d.mts.map +0 -1
  173. package/dist/AmazonApiGatewayV2EndpointAdaptor-CHi3Qe1s.d.cts.map +0 -1
  174. package/dist/TestFunctionAdaptor-CK-dbKpO.mjs.map +0 -1
  175. package/dist/TestFunctionAdaptor-CSMX7myB.cjs.map +0 -1
  176. package/dist/TestSubscriberAdaptor-1m-2bM_j.cjs.map +0 -1
  177. package/dist/TestSubscriberAdaptor-CrqLkyUE.mjs.map +0 -1
  178. package/dist/index-BnoOaBQV.d.cts +0 -12
  179. package/dist/index-DQo_Csy7.d.mts +0 -12
@@ -1 +1 @@
1
- {"version":3,"file":"AmazonApiGatewayV1EndpointAdaptor-CQ0dtx1M.mjs","names":["e: APIGatewayProxyEvent","mergedParams: Record<string, string | string[]>","data: APIGatewayProxyEvent","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEvent, Context } from 'aws-lambda';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV1EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { Endpoint, EndpointSchemas } from './Endpoint';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV1Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV1EndpointHandler,\n\tAPIGatewayProxyEvent,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getInput(e: APIGatewayProxyEvent): GetInputResponse {\n\t\t// For arrays, AWS API Gateway V1 provides multiValueQueryStringParameters\n\t\tconst multiValueParams = e.multiValueQueryStringParameters || {};\n\t\tconst singleValueParams = e.queryStringParameters || {};\n\n\t\t// Merge single and multi-value parameters\n\t\tconst mergedParams: Record<string, string | string[]> = {};\n\n\t\t// Add single value parameters\n\t\tfor (const [key, value] of Object.entries(singleValueParams)) {\n\t\t\tif (value !== undefined) {\n\t\t\t\tmergedParams[key] = value;\n\t\t\t}\n\t\t}\n\n\t\t// Override with multi-value parameters where applicable\n\t\tfor (const [key, values] of Object.entries(multiValueParams)) {\n\t\t\tif (values && values.length > 1) {\n\t\t\t\tmergedParams[key] = values;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tbody: e.body ? JSON.parse(e.body) : undefined,\n\t\t\tquery: parseQueryParams(mergedParams),\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tdata: APIGatewayProxyEvent,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: data.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: data.requestContext.identity.sourceIp,\n\t\t\t\tuserAgent: data.requestContext.identity.userAgent || undefined,\n\t\t\t\tpath: data.requestContext.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n"],"mappings":";;;;AAiBA,IAAa,6BAAb,cASU,yBAWR;CACD,AAAS,SAASA,GAA2C;EAE5D,MAAM,mBAAmB,EAAE,mCAAmC,CAAE;EAChE,MAAM,oBAAoB,EAAE,yBAAyB,CAAE;EAGvD,MAAMC,eAAkD,CAAE;AAG1D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,kBAAkB,CAC3D,KAAI,iBACH,cAAa,OAAO;AAKtB,OAAK,MAAM,CAAC,KAAK,OAAO,IAAI,OAAO,QAAQ,iBAAiB,CAC3D,KAAI,UAAU,OAAO,SAAS,EAC7B,cAAa,OAAO;AAItB,SAAO;GACN,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,KAAK;GACjC,OAAO,iBAAiB,aAAa;GACrC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,MACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,KAAK,eAAe;IACxB,cAAc,QAAQ;IACtB,IAAI,KAAK,eAAe,SAAS;IACjC,WAAW,KAAK,eAAe,SAAS;IACxC,MAAM,KAAK,eAAe;GAC1B;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
1
+ {"version":3,"file":"AmazonApiGatewayV1EndpointAdaptor-COLHHAsd.mjs","names":["e: APIGatewayProxyEvent","mergedParams: Record<string, string | string[]>","data: APIGatewayProxyEvent","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEvent, Context } from 'aws-lambda';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV1EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { Endpoint, EndpointSchemas } from './Endpoint';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV1Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV1EndpointHandler,\n\tAPIGatewayProxyEvent,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getInput(e: APIGatewayProxyEvent): GetInputResponse {\n\t\t// For arrays, AWS API Gateway V1 provides multiValueQueryStringParameters\n\t\tconst multiValueParams = e.multiValueQueryStringParameters || {};\n\t\tconst singleValueParams = e.queryStringParameters || {};\n\n\t\t// Merge single and multi-value parameters\n\t\tconst mergedParams: Record<string, string | string[]> = {};\n\n\t\t// Add single value parameters\n\t\tfor (const [key, value] of Object.entries(singleValueParams)) {\n\t\t\tif (value !== undefined) {\n\t\t\t\tmergedParams[key] = value;\n\t\t\t}\n\t\t}\n\n\t\t// Override with multi-value parameters where applicable\n\t\tfor (const [key, values] of Object.entries(multiValueParams)) {\n\t\t\tif (values && values.length > 1) {\n\t\t\t\tmergedParams[key] = values;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tbody: e.body ? JSON.parse(e.body) : undefined,\n\t\t\tquery: parseQueryParams(mergedParams),\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tdata: APIGatewayProxyEvent,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: data.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: data.requestContext.identity.sourceIp,\n\t\t\t\tuserAgent: data.requestContext.identity.userAgent || undefined,\n\t\t\t\tpath: data.requestContext.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n"],"mappings":";;;;AAiBA,IAAa,6BAAb,cASU,yBAWR;CACD,AAAS,SAASA,GAA2C;EAE5D,MAAM,mBAAmB,EAAE,mCAAmC,CAAE;EAChE,MAAM,oBAAoB,EAAE,yBAAyB,CAAE;EAGvD,MAAMC,eAAkD,CAAE;AAG1D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,kBAAkB,CAC3D,KAAI,iBACH,cAAa,OAAO;AAKtB,OAAK,MAAM,CAAC,KAAK,OAAO,IAAI,OAAO,QAAQ,iBAAiB,CAC3D,KAAI,UAAU,OAAO,SAAS,EAC7B,cAAa,OAAO;AAItB,SAAO;GACN,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,KAAK;GACjC,OAAO,iBAAiB,aAAa;GACrC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,MACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,KAAK,eAAe;IACxB,cAAc,QAAQ;IACtB,IAAI,KAAK,eAAe,SAAS;IACjC,WAAW,KAAK,eAAe,SAAS;IACxC,MAAM,KAAK,eAAe;GAC1B;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
@@ -1,4 +1,4 @@
1
- const require_AmazonApiGatewayEndpointAdaptor = require('./AmazonApiGatewayEndpointAdaptor-1XyivLJs.cjs');
1
+ const require_AmazonApiGatewayEndpointAdaptor = require('./AmazonApiGatewayEndpointAdaptor-jDYqkgFE.cjs');
2
2
  const require_parseQueryParams = require('./parseQueryParams-BSNkjmZ9.cjs');
3
3
 
4
4
  //#region src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts
@@ -44,4 +44,4 @@ Object.defineProperty(exports, 'AmazonApiGatewayV1Endpoint', {
44
44
  return AmazonApiGatewayV1Endpoint;
45
45
  }
46
46
  });
47
- //# sourceMappingURL=AmazonApiGatewayV1EndpointAdaptor-Cm2wieNy.cjs.map
47
+ //# sourceMappingURL=AmazonApiGatewayV1EndpointAdaptor-CW0BCUkm.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"AmazonApiGatewayV1EndpointAdaptor-Cm2wieNy.cjs","names":["AmazonApiGatewayEndpoint","e: APIGatewayProxyEvent","mergedParams: Record<string, string | string[]>","data: APIGatewayProxyEvent","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEvent, Context } from 'aws-lambda';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV1EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { Endpoint, EndpointSchemas } from './Endpoint';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV1Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV1EndpointHandler,\n\tAPIGatewayProxyEvent,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getInput(e: APIGatewayProxyEvent): GetInputResponse {\n\t\t// For arrays, AWS API Gateway V1 provides multiValueQueryStringParameters\n\t\tconst multiValueParams = e.multiValueQueryStringParameters || {};\n\t\tconst singleValueParams = e.queryStringParameters || {};\n\n\t\t// Merge single and multi-value parameters\n\t\tconst mergedParams: Record<string, string | string[]> = {};\n\n\t\t// Add single value parameters\n\t\tfor (const [key, value] of Object.entries(singleValueParams)) {\n\t\t\tif (value !== undefined) {\n\t\t\t\tmergedParams[key] = value;\n\t\t\t}\n\t\t}\n\n\t\t// Override with multi-value parameters where applicable\n\t\tfor (const [key, values] of Object.entries(multiValueParams)) {\n\t\t\tif (values && values.length > 1) {\n\t\t\t\tmergedParams[key] = values;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tbody: e.body ? JSON.parse(e.body) : undefined,\n\t\t\tquery: parseQueryParams(mergedParams),\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tdata: APIGatewayProxyEvent,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: data.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: data.requestContext.identity.sourceIp,\n\t\t\t\tuserAgent: data.requestContext.identity.userAgent || undefined,\n\t\t\t\tpath: data.requestContext.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n"],"mappings":";;;;AAiBA,IAAa,6BAAb,cASUA,iEAWR;CACD,AAAS,SAASC,GAA2C;EAE5D,MAAM,mBAAmB,EAAE,mCAAmC,CAAE;EAChE,MAAM,oBAAoB,EAAE,yBAAyB,CAAE;EAGvD,MAAMC,eAAkD,CAAE;AAG1D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,kBAAkB,CAC3D,KAAI,iBACH,cAAa,OAAO;AAKtB,OAAK,MAAM,CAAC,KAAK,OAAO,IAAI,OAAO,QAAQ,iBAAiB,CAC3D,KAAI,UAAU,OAAO,SAAS,EAC7B,cAAa,OAAO;AAItB,SAAO;GACN,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,KAAK;GACjC,OAAO,0CAAiB,aAAa;GACrC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,MACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,KAAK,eAAe;IACxB,cAAc,QAAQ;IACtB,IAAI,KAAK,eAAe,SAAS;IACjC,WAAW,KAAK,eAAe,SAAS;IACxC,MAAM,KAAK,eAAe;GAC1B;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
1
+ {"version":3,"file":"AmazonApiGatewayV1EndpointAdaptor-CW0BCUkm.cjs","names":["AmazonApiGatewayEndpoint","e: APIGatewayProxyEvent","mergedParams: Record<string, string | string[]>","data: APIGatewayProxyEvent","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEvent, Context } from 'aws-lambda';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV1EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { Endpoint, EndpointSchemas } from './Endpoint';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV1Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV1EndpointHandler,\n\tAPIGatewayProxyEvent,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getInput(e: APIGatewayProxyEvent): GetInputResponse {\n\t\t// For arrays, AWS API Gateway V1 provides multiValueQueryStringParameters\n\t\tconst multiValueParams = e.multiValueQueryStringParameters || {};\n\t\tconst singleValueParams = e.queryStringParameters || {};\n\n\t\t// Merge single and multi-value parameters\n\t\tconst mergedParams: Record<string, string | string[]> = {};\n\n\t\t// Add single value parameters\n\t\tfor (const [key, value] of Object.entries(singleValueParams)) {\n\t\t\tif (value !== undefined) {\n\t\t\t\tmergedParams[key] = value;\n\t\t\t}\n\t\t}\n\n\t\t// Override with multi-value parameters where applicable\n\t\tfor (const [key, values] of Object.entries(multiValueParams)) {\n\t\t\tif (values && values.length > 1) {\n\t\t\t\tmergedParams[key] = values;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tbody: e.body ? JSON.parse(e.body) : undefined,\n\t\t\tquery: parseQueryParams(mergedParams),\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tdata: APIGatewayProxyEvent,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: data.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: data.requestContext.identity.sourceIp,\n\t\t\t\tuserAgent: data.requestContext.identity.userAgent || undefined,\n\t\t\t\tpath: data.requestContext.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n"],"mappings":";;;;AAiBA,IAAa,6BAAb,cASUA,iEAWR;CACD,AAAS,SAASC,GAA2C;EAE5D,MAAM,mBAAmB,EAAE,mCAAmC,CAAE;EAChE,MAAM,oBAAoB,EAAE,yBAAyB,CAAE;EAGvD,MAAMC,eAAkD,CAAE;AAG1D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,kBAAkB,CAC3D,KAAI,iBACH,cAAa,OAAO;AAKtB,OAAK,MAAM,CAAC,KAAK,OAAO,IAAI,OAAO,QAAQ,iBAAiB,CAC3D,KAAI,UAAU,OAAO,SAAS,EAC7B,cAAa,OAAO;AAItB,SAAO;GACN,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,KAAK;GACjC,OAAO,0CAAiB,aAAa;GACrC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,MACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,KAAK,eAAe;IACxB,cAAc,QAAQ;IACtB,IAAI,KAAK,eAAe,SAAS;IACjC,WAAW,KAAK,eAAe,SAAS;IACxC,MAAM,KAAK,eAAe;GAC1B;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
@@ -1,8 +1,12 @@
1
- const require_AmazonApiGatewayEndpointAdaptor = require('./AmazonApiGatewayEndpointAdaptor-1XyivLJs.cjs');
1
+ const require_AmazonApiGatewayEndpointAdaptor = require('./AmazonApiGatewayEndpointAdaptor-jDYqkgFE.cjs');
2
2
  const require_parseQueryParams = require('./parseQueryParams-BSNkjmZ9.cjs');
3
+ const require_lazyAccessors = require('./lazyAccessors-BVEtB9lU.cjs');
3
4
 
4
5
  //#region src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts
5
6
  var AmazonApiGatewayV2Endpoint = class extends require_AmazonApiGatewayEndpointAdaptor.AmazonApiGatewayEndpoint {
7
+ getCookies(e) {
8
+ return require_lazyAccessors.createApiGatewayCookies(e.cookies, e.headers?.cookie);
9
+ }
6
10
  getInput(e) {
7
11
  const queryParams = e.queryStringParameters || {};
8
12
  const processedParams = {};
@@ -43,4 +47,4 @@ Object.defineProperty(exports, 'AmazonApiGatewayV2Endpoint', {
43
47
  return AmazonApiGatewayV2Endpoint;
44
48
  }
45
49
  });
46
- //# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-CjPCxIb1.cjs.map
50
+ //# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-C7ZrwcTX.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-CjPCxIb1.cjs","names":["AmazonApiGatewayEndpoint","e: APIGatewayProxyEventV2","processedParams: Record<string, string | string[]>","event: APIGatewayProxyEventV2","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEventV2, Context } from 'aws-lambda';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV2EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { Endpoint, EndpointSchemas } from './Endpoint';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV2Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV2EndpointHandler,\n\tAPIGatewayProxyEventV2,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getInput(e: APIGatewayProxyEventV2): GetInputResponse {\n\t\t// API Gateway V2 handles arrays as comma-separated values\n\t\tconst queryParams = e.queryStringParameters || {};\n\t\tconst processedParams: Record<string, string | string[]> = {};\n\n\t\tfor (const [key, value] of Object.entries(queryParams)) {\n\t\t\tif (value !== undefined) {\n\t\t\t\t// Check if value contains comma and could be an array\n\t\t\t\t// Be careful not to split values that legitimately contain commas\n\t\t\t\tif (value.includes(',') && !value.includes('\"')) {\n\t\t\t\t\tprocessedParams[key] = value.split(',').map((v) => v.trim());\n\t\t\t\t} else {\n\t\t\t\t\tprocessedParams[key] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tbody: e.body ? JSON.parse(e.body) : undefined,\n\t\t\tquery: parseQueryParams(processedParams),\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tevent: APIGatewayProxyEventV2,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: event.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: event.requestContext.http.sourceIp,\n\t\t\t\tuserAgent: event.requestContext.http.userAgent || undefined,\n\t\t\t\tpath: event.requestContext.http.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n\n// Re-export options type for convenience\nexport type { AmazonApiGatewayEndpointOptions };\n"],"mappings":";;;;AAiBA,IAAa,6BAAb,cASUA,iEAWR;CACD,AAAS,SAASC,GAA6C;EAE9D,MAAM,cAAc,EAAE,yBAAyB,CAAE;EACjD,MAAMC,kBAAqD,CAAE;AAE7D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,CACrD,KAAI,iBAGH,KAAI,MAAM,SAAS,IAAI,KAAK,MAAM,SAAS,KAAI,CAC9C,iBAAgB,OAAO,MAAM,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;MAE5D,iBAAgB,OAAO;AAK1B,SAAO;GACN,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,KAAK;GACjC,OAAO,0CAAiB,gBAAgB;GACxC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,OACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,MAAM,eAAe;IACzB,cAAc,QAAQ;IACtB,IAAI,MAAM,eAAe,KAAK;IAC9B,WAAW,MAAM,eAAe,KAAK;IACrC,MAAM,MAAM,eAAe,KAAK;GAChC;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
1
+ {"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-C7ZrwcTX.cjs","names":["AmazonApiGatewayEndpoint","e: APIGatewayProxyEventV2","processedParams: Record<string, string | string[]>","event: APIGatewayProxyEventV2","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEventV2, Context } from 'aws-lambda';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV2EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { CookieFn, Endpoint, EndpointSchemas } from './Endpoint';\nimport { createApiGatewayCookies } from './lazyAccessors';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV2Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV2EndpointHandler,\n\tAPIGatewayProxyEventV2,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getCookies(e: APIGatewayProxyEventV2): CookieFn {\n\t\treturn createApiGatewayCookies(\n\t\t\te.cookies,\n\t\t\t(e.headers as Record<string, string>)?.cookie,\n\t\t);\n\t}\n\n\toverride getInput(e: APIGatewayProxyEventV2): GetInputResponse {\n\t\t// API Gateway V2 handles arrays as comma-separated values\n\t\tconst queryParams = e.queryStringParameters || {};\n\t\tconst processedParams: Record<string, string | string[]> = {};\n\n\t\tfor (const [key, value] of Object.entries(queryParams)) {\n\t\t\tif (value !== undefined) {\n\t\t\t\t// Check if value contains comma and could be an array\n\t\t\t\t// Be careful not to split values that legitimately contain commas\n\t\t\t\tif (value.includes(',') && !value.includes('\"')) {\n\t\t\t\t\tprocessedParams[key] = value.split(',').map((v) => v.trim());\n\t\t\t\t} else {\n\t\t\t\t\tprocessedParams[key] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tbody: e.body ? JSON.parse(e.body) : undefined,\n\t\t\tquery: parseQueryParams(processedParams),\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tevent: APIGatewayProxyEventV2,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: event.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: event.requestContext.http.sourceIp,\n\t\t\t\tuserAgent: event.requestContext.http.userAgent || undefined,\n\t\t\t\tpath: event.requestContext.http.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n\n// Re-export options type for convenience\nexport type { AmazonApiGatewayEndpointOptions };\n"],"mappings":";;;;;AAkBA,IAAa,6BAAb,cASUA,iEAWR;CACD,AAAS,WAAWC,GAAqC;AACxD,SAAO,8CACN,EAAE,SACD,EAAE,SAAoC,OACvC;CACD;CAED,AAAS,SAASA,GAA6C;EAE9D,MAAM,cAAc,EAAE,yBAAyB,CAAE;EACjD,MAAMC,kBAAqD,CAAE;AAE7D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,CACrD,KAAI,iBAGH,KAAI,MAAM,SAAS,IAAI,KAAK,MAAM,SAAS,KAAI,CAC9C,iBAAgB,OAAO,MAAM,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;MAE5D,iBAAgB,OAAO;AAK1B,SAAO;GACN,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,KAAK;GACjC,OAAO,0CAAiB,gBAAgB;GACxC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,OACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,MAAM,eAAe;IACzB,cAAc,QAAQ;IACtB,IAAI,MAAM,eAAe,KAAK;IAC9B,WAAW,MAAM,eAAe,KAAK;IACrC,MAAM,MAAM,eAAe,KAAK;GAChC;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
@@ -1,8 +1,12 @@
1
- import { AmazonApiGatewayEndpoint } from "./AmazonApiGatewayEndpointAdaptor-BPxHm8Tg.mjs";
1
+ import { AmazonApiGatewayEndpoint } from "./AmazonApiGatewayEndpointAdaptor-ciUHVvPX.mjs";
2
2
  import { parseQueryParams } from "./parseQueryParams-UMTRnRrW.mjs";
3
+ import { createApiGatewayCookies } from "./lazyAccessors-DM6HcXQk.mjs";
3
4
 
4
5
  //#region src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts
5
6
  var AmazonApiGatewayV2Endpoint = class extends AmazonApiGatewayEndpoint {
7
+ getCookies(e) {
8
+ return createApiGatewayCookies(e.cookies, e.headers?.cookie);
9
+ }
6
10
  getInput(e) {
7
11
  const queryParams = e.queryStringParameters || {};
8
12
  const processedParams = {};
@@ -38,4 +42,4 @@ var AmazonApiGatewayV2Endpoint = class extends AmazonApiGatewayEndpoint {
38
42
 
39
43
  //#endregion
40
44
  export { AmazonApiGatewayV2Endpoint };
41
- //# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-DrbEaZ2_.mjs.map
45
+ //# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-Cl9ERGyi.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-DrbEaZ2_.mjs","names":["e: APIGatewayProxyEventV2","processedParams: Record<string, string | string[]>","event: APIGatewayProxyEventV2","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEventV2, Context } from 'aws-lambda';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV2EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { Endpoint, EndpointSchemas } from './Endpoint';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV2Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV2EndpointHandler,\n\tAPIGatewayProxyEventV2,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getInput(e: APIGatewayProxyEventV2): GetInputResponse {\n\t\t// API Gateway V2 handles arrays as comma-separated values\n\t\tconst queryParams = e.queryStringParameters || {};\n\t\tconst processedParams: Record<string, string | string[]> = {};\n\n\t\tfor (const [key, value] of Object.entries(queryParams)) {\n\t\t\tif (value !== undefined) {\n\t\t\t\t// Check if value contains comma and could be an array\n\t\t\t\t// Be careful not to split values that legitimately contain commas\n\t\t\t\tif (value.includes(',') && !value.includes('\"')) {\n\t\t\t\t\tprocessedParams[key] = value.split(',').map((v) => v.trim());\n\t\t\t\t} else {\n\t\t\t\t\tprocessedParams[key] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tbody: e.body ? JSON.parse(e.body) : undefined,\n\t\t\tquery: parseQueryParams(processedParams),\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tevent: APIGatewayProxyEventV2,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: event.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: event.requestContext.http.sourceIp,\n\t\t\t\tuserAgent: event.requestContext.http.userAgent || undefined,\n\t\t\t\tpath: event.requestContext.http.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n\n// Re-export options type for convenience\nexport type { AmazonApiGatewayEndpointOptions };\n"],"mappings":";;;;AAiBA,IAAa,6BAAb,cASU,yBAWR;CACD,AAAS,SAASA,GAA6C;EAE9D,MAAM,cAAc,EAAE,yBAAyB,CAAE;EACjD,MAAMC,kBAAqD,CAAE;AAE7D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,CACrD,KAAI,iBAGH,KAAI,MAAM,SAAS,IAAI,KAAK,MAAM,SAAS,KAAI,CAC9C,iBAAgB,OAAO,MAAM,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;MAE5D,iBAAgB,OAAO;AAK1B,SAAO;GACN,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,KAAK;GACjC,OAAO,iBAAiB,gBAAgB;GACxC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,OACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,MAAM,eAAe;IACzB,cAAc,QAAQ;IACtB,IAAI,MAAM,eAAe,KAAK;IAC9B,WAAW,MAAM,eAAe,KAAK;IACrC,MAAM,MAAM,eAAe,KAAK;GAChC;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
1
+ {"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-Cl9ERGyi.mjs","names":["e: APIGatewayProxyEventV2","processedParams: Record<string, string | string[]>","event: APIGatewayProxyEventV2","context: Context","envParser: EnvironmentParser<{}>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>","options: AmazonApiGatewayEndpointOptions"],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { APIGatewayProxyEventV2, Context } from 'aws-lambda';\nimport type { HttpMethod } from '../types';\nimport {\n\tAmazonApiGatewayEndpoint,\n\ttype AmazonApiGatewayEndpointOptions,\n\ttype AmazonApiGatewayV2EndpointHandler,\n\ttype GetInputResponse,\n\ttype LoggerContext,\n} from './AmazonApiGatewayEndpointAdaptor';\nimport type { CookieFn, Endpoint, EndpointSchemas } from './Endpoint';\nimport { createApiGatewayCookies } from './lazyAccessors';\nimport { parseQueryParams } from './parseQueryParams';\n\nexport class AmazonApiGatewayV2Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n> extends AmazonApiGatewayEndpoint<\n\tAmazonApiGatewayV2EndpointHandler,\n\tAPIGatewayProxyEventV2,\n\tTRoute,\n\tTMethod,\n\tTInput,\n\tTOutSchema,\n\tTServices,\n\tTLogger,\n\tTSession,\n\tTEventPublisher\n> {\n\toverride getCookies(e: APIGatewayProxyEventV2): CookieFn {\n\t\treturn createApiGatewayCookies(\n\t\t\te.cookies,\n\t\t\t(e.headers as Record<string, string>)?.cookie,\n\t\t);\n\t}\n\n\toverride getInput(e: APIGatewayProxyEventV2): GetInputResponse {\n\t\t// API Gateway V2 handles arrays as comma-separated values\n\t\tconst queryParams = e.queryStringParameters || {};\n\t\tconst processedParams: Record<string, string | string[]> = {};\n\n\t\tfor (const [key, value] of Object.entries(queryParams)) {\n\t\t\tif (value !== undefined) {\n\t\t\t\t// Check if value contains comma and could be an array\n\t\t\t\t// Be careful not to split values that legitimately contain commas\n\t\t\t\tif (value.includes(',') && !value.includes('\"')) {\n\t\t\t\t\tprocessedParams[key] = value.split(',').map((v) => v.trim());\n\t\t\t\t} else {\n\t\t\t\t\tprocessedParams[key] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tbody: e.body ? JSON.parse(e.body) : undefined,\n\t\t\tquery: parseQueryParams(processedParams),\n\t\t\tparams: e.pathParameters || {},\n\t\t};\n\t}\n\toverride getLoggerContext(\n\t\tevent: APIGatewayProxyEventV2,\n\t\tcontext: Context,\n\t): LoggerContext {\n\t\treturn {\n\t\t\tfn: {\n\t\t\t\tname: context.functionName,\n\t\t\t\tversion: context.functionVersion,\n\t\t\t},\n\t\t\treq: {\n\t\t\t\tid: event.requestContext.requestId,\n\t\t\t\tawsRequestId: context.awsRequestId,\n\t\t\t\tip: event.requestContext.http.sourceIp,\n\t\t\t\tuserAgent: event.requestContext.http.userAgent || undefined,\n\t\t\t\tpath: event.requestContext.http.path,\n\t\t\t},\n\t\t};\n\t}\n\tconstructor(\n\t\tprotected override envParser: EnvironmentParser<{}>,\n\t\tprotected override readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher\n\t\t>,\n\t\toptions: AmazonApiGatewayEndpointOptions = {},\n\t) {\n\t\tsuper(envParser, endpoint, options);\n\t}\n}\n\n// Re-export options type for convenience\nexport type { AmazonApiGatewayEndpointOptions };\n"],"mappings":";;;;;AAkBA,IAAa,6BAAb,cASU,yBAWR;CACD,AAAS,WAAWA,GAAqC;AACxD,SAAO,wBACN,EAAE,SACD,EAAE,SAAoC,OACvC;CACD;CAED,AAAS,SAASA,GAA6C;EAE9D,MAAM,cAAc,EAAE,yBAAyB,CAAE;EACjD,MAAMC,kBAAqD,CAAE;AAE7D,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,CACrD,KAAI,iBAGH,KAAI,MAAM,SAAS,IAAI,KAAK,MAAM,SAAS,KAAI,CAC9C,iBAAgB,OAAO,MAAM,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;MAE5D,iBAAgB,OAAO;AAK1B,SAAO;GACN,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,KAAK;GACjC,OAAO,iBAAiB,gBAAgB;GACxC,QAAQ,EAAE,kBAAkB,CAAE;EAC9B;CACD;CACD,AAAS,iBACRC,OACAC,SACgB;AAChB,SAAO;GACN,IAAI;IACH,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB;GACD,KAAK;IACJ,IAAI,MAAM,eAAe;IACzB,cAAc,QAAQ;IACtB,IAAI,MAAM,eAAe,KAAK;IAC9B,WAAW,MAAM,eAAe,KAAK;IACrC,MAAM,MAAM,eAAe,KAAK;GAChC;EACD;CACD;CACD,YACoBC,WACSC,UAU5BC,UAA2C,CAAE,GAC5C;AACD,QAAM,WAAW,UAAU,QAAQ;EAbhB;EACS;CAa5B;AACD"}
@@ -1,6 +1,6 @@
1
1
  import { HttpMethod } from "./types-B5H3piDg.cjs";
2
- import { Endpoint, EndpointSchemas } from "./Endpoint-C9N6CmvB.cjs";
3
- import { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV2EndpointHandler, GetInputResponse, LoggerContext } from "./AmazonApiGatewayEndpointAdaptor-Bxvs-F0F.cjs";
2
+ import { CookieFn, Endpoint, EndpointSchemas } from "./Endpoint-C9N6CmvB.cjs";
3
+ import { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV2EndpointHandler, GetInputResponse, LoggerContext } from "./AmazonApiGatewayEndpointAdaptor-D4lAuXA-.cjs";
4
4
  import { EventPublisher } from "@geekmidas/events";
5
5
  import { Logger } from "@geekmidas/logger";
6
6
  import { Service } from "@geekmidas/services";
@@ -12,10 +12,11 @@ import { APIGatewayProxyEventV2, Context } from "aws-lambda";
12
12
  declare class AmazonApiGatewayV2Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput extends EndpointSchemas = {}, TOutSchema extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TSession = unknown, TEventPublisher extends EventPublisher<any> | undefined = undefined> extends AmazonApiGatewayEndpoint<AmazonApiGatewayV2EndpointHandler, APIGatewayProxyEventV2, TRoute, TMethod, TInput, TOutSchema, TServices, TLogger, TSession, TEventPublisher> {
13
13
  protected envParser: EnvironmentParser<{}>;
14
14
  protected readonly endpoint: Endpoint<TRoute, TMethod, TInput, TOutSchema, TServices, TLogger, TSession, TEventPublisher>;
15
+ getCookies(e: APIGatewayProxyEventV2): CookieFn;
15
16
  getInput(e: APIGatewayProxyEventV2): GetInputResponse;
16
17
  getLoggerContext(event: APIGatewayProxyEventV2, context: Context): LoggerContext;
17
18
  constructor(envParser: EnvironmentParser<{}>, endpoint: Endpoint<TRoute, TMethod, TInput, TOutSchema, TServices, TLogger, TSession, TEventPublisher>, options?: AmazonApiGatewayEndpointOptions);
18
19
  }
19
20
  //#endregion
20
21
  export { AmazonApiGatewayV2Endpoint };
21
- //# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-CHi3Qe1s.d.cts.map
22
+ //# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-OkwjABOz.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-OkwjABOz.d.cts","names":[],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cAkBa,kEAEI,2BACD,yCACI,4DACD,gCACF,SAAS,oDAED,qDACf,yBACT,mCACA,wBACA,QACA,SACA,QACA,YACA,WACA,SACA,UACA;uBAmD+B;EAtEnB,mBAAA,QAAA,EAuE2B,QAvED,CAwEpC,MAxEoC,EAyEpC,OAzEoC,EA0EpC,MA1EoC,EA2EpC,UA3EoC,EA4EpC,SA5EoC,EA6EpC,OA7EoC,EA8EpC,QA9EoC,EA+EpC,eA/EoC,CAAA;EAAA,UAAA,CAAA,CAAA,EAqBf,sBArBe,CAAA,EAqBU,QArBV;EAAA,QAEtB,CAAA,CAAA,EA0BK,sBA1BL,CAAA,EA0B8B,gBA1B9B;EAAU,gBACX,CAAA,KAAA,EAiDP,sBAjDO,EAAA,OAAA,EAkDL,OAlDK,CAAA,EAmDZ,aAnDY;EAAe,WACX,CAAA,SAAA,EAkEY,iBAlEZ,CAAA,CAAA,CAAA,CAAA,EAAA,QAAA,EAmEoB,QAnEpB,CAoEjB,MApEiB,EAqEjB,OArEiB,EAsEjB,MAtEiB,EAuEjB,UAvEiB,EAwEjB,SAxEiB,EAyEjB,OAzEiB,EA0EjB,QA1EiB,EA2EjB,eA3EiB,CAAA,EAAA,OAAA,CAAA,EA6ET,+BA7ES"}
@@ -1,6 +1,6 @@
1
1
  import { HttpMethod } from "./types-aFmq5cKh.mjs";
2
- import { Endpoint, EndpointSchemas } from "./Endpoint-BiPM0glm.mjs";
3
- import { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV2EndpointHandler, GetInputResponse, LoggerContext } from "./AmazonApiGatewayEndpointAdaptor-CQSZArI6.mjs";
2
+ import { CookieFn, Endpoint, EndpointSchemas } from "./Endpoint-BiPM0glm.mjs";
3
+ import { AmazonApiGatewayEndpoint, AmazonApiGatewayEndpointOptions, AmazonApiGatewayV2EndpointHandler, GetInputResponse, LoggerContext } from "./AmazonApiGatewayEndpointAdaptor-B30TqZRX.mjs";
4
4
  import { Service } from "@geekmidas/services";
5
5
  import { EnvironmentParser } from "@geekmidas/envkit";
6
6
  import { EventPublisher } from "@geekmidas/events";
@@ -12,10 +12,11 @@ import { APIGatewayProxyEventV2, Context } from "aws-lambda";
12
12
  declare class AmazonApiGatewayV2Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput extends EndpointSchemas = {}, TOutSchema extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TSession = unknown, TEventPublisher extends EventPublisher<any> | undefined = undefined> extends AmazonApiGatewayEndpoint<AmazonApiGatewayV2EndpointHandler, APIGatewayProxyEventV2, TRoute, TMethod, TInput, TOutSchema, TServices, TLogger, TSession, TEventPublisher> {
13
13
  protected envParser: EnvironmentParser<{}>;
14
14
  protected readonly endpoint: Endpoint<TRoute, TMethod, TInput, TOutSchema, TServices, TLogger, TSession, TEventPublisher>;
15
+ getCookies(e: APIGatewayProxyEventV2): CookieFn;
15
16
  getInput(e: APIGatewayProxyEventV2): GetInputResponse;
16
17
  getLoggerContext(event: APIGatewayProxyEventV2, context: Context): LoggerContext;
17
18
  constructor(envParser: EnvironmentParser<{}>, endpoint: Endpoint<TRoute, TMethod, TInput, TOutSchema, TServices, TLogger, TSession, TEventPublisher>, options?: AmazonApiGatewayEndpointOptions);
18
19
  }
19
20
  //#endregion
20
21
  export { AmazonApiGatewayV2Endpoint };
21
- //# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-BBayh2_k.d.mts.map
22
+ //# sourceMappingURL=AmazonApiGatewayV2EndpointAdaptor-ofjuxcPV.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AmazonApiGatewayV2EndpointAdaptor-ofjuxcPV.d.mts","names":[],"sources":["../src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cAkBa,kEAEI,2BACD,yCACI,4DACD,gCACF,SAAS,oDAED,qDACf,yBACT,mCACA,wBACA,QACA,SACA,QACA,YACA,WACA,SACA,UACA;uBAmD+B;EAtEnB,mBAAA,QAAA,EAuE2B,QAvED,CAwEpC,MAxEoC,EAyEpC,OAzEoC,EA0EpC,MA1EoC,EA2EpC,UA3EoC,EA4EpC,SA5EoC,EA6EpC,OA7EoC,EA8EpC,QA9EoC,EA+EpC,eA/EoC,CAAA;EAAA,UAAA,CAAA,CAAA,EAqBf,sBArBe,CAAA,EAqBU,QArBV;EAAA,QAEtB,CAAA,CAAA,EA0BK,sBA1BL,CAAA,EA0B8B,gBA1B9B;EAAU,gBACX,CAAA,KAAA,EAiDP,sBAjDO,EAAA,OAAA,EAkDL,OAlDK,CAAA,EAmDZ,aAnDY;EAAe,WACX,CAAA,SAAA,EAkEY,iBAlEZ,CAAA,CAAA,CAAA,CAAA,EAAA,QAAA,EAmEoB,QAnEpB,CAoEjB,MApEiB,EAqEjB,OArEiB,EAsEjB,MAtEiB,EAuEjB,UAvEiB,EAwEjB,SAxEiB,EAyEjB,OAzEiB,EA0EjB,QA1EiB,EA2EjB,eA3EiB,CAAA,EAAA,OAAA,CAAA,EA6ET,+BA7ES"}
@@ -98,4 +98,4 @@ var FunctionExecutionWrapper = class {
98
98
 
99
99
  //#endregion
100
100
  export { FunctionExecutionWrapper };
101
- //# sourceMappingURL=FunctionExecutionWrapper-Ba0Z-iwe.mjs.map
101
+ //# sourceMappingURL=FunctionExecutionWrapper-B0ZAssiy.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"FunctionExecutionWrapper-Ba0Z-iwe.mjs","names":["envParser: EnvironmentParser<{}>","fn: Function<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName,\n\t\t\tTAuditAction,\n\t\t\tFunctionHandler<\n\t\t\t\tTInput,\n\t\t\t\tTServices,\n\t\t\t\tTLogger,\n\t\t\t\tTOutSchema,\n\t\t\t\tTDatabase,\n\t\t\t\tTAuditStorage,\n\t\t\t\tTAuditAction\n\t\t\t>\n\t\t>","handler: (ctx: {\n\t\t\tauditor?: Auditor<TAuditAction>;\n\t\t\tdb?: TDatabase;\n\t\t}) => Promise<T>","db","response","event: TEvent","response: InferStandardSchema<TOutSchema>","data: unknown","schema: T"],"sources":["../src/functions/FunctionExecutionWrapper.ts"],"sourcesContent":["import type { AuditableAction, Auditor, AuditStorage } from '@geekmidas/audit';\nimport { DefaultAuditor } from '@geekmidas/audit';\nimport { withAuditableTransaction } from '@geekmidas/audit/kysely';\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type {\n\tComposableStandardSchema,\n\tInferComposableStandardSchema,\n\tInferStandardSchema,\n} from '@geekmidas/schema';\nimport {\n\ttype Service,\n\tServiceDiscovery,\n\ttype ServiceRecord,\n} from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { publishEvents } from '../publisher';\nimport type { Function, FunctionHandler } from './Function';\nimport { FunctionBuilder } from './FunctionBuilder';\n\nexport abstract class FunctionExecutionWrapper<\n\tTInput extends ComposableStandardSchema | undefined = undefined,\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\tTEventPublisherServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n> {\n\tconstructor(\n\t\tprotected envParser: EnvironmentParser<{}>,\n\t\tprotected readonly fn: Function<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName,\n\t\t\tTAuditAction,\n\t\t\tFunctionHandler<\n\t\t\t\tTInput,\n\t\t\t\tTServices,\n\t\t\t\tTLogger,\n\t\t\t\tTOutSchema,\n\t\t\t\tTDatabase,\n\t\t\t\tTAuditStorage,\n\t\t\t\tTAuditAction\n\t\t\t>\n\t\t>,\n\t) {}\n\n\tprotected _logger?: TLogger;\n\n\tget logger(): TLogger {\n\t\treturn this._logger || this.fn.logger;\n\t}\n\n\tget serviceDiscovery(): ServiceDiscovery<ServiceRecord<TServices>> {\n\t\tconst serviceDiscovery = ServiceDiscovery.getInstance<\n\t\t\tServiceRecord<TServices>\n\t\t>(this.envParser);\n\n\t\treturn serviceDiscovery;\n\t}\n\n\tgetServices(): Promise<ServiceRecord<TServices>> {\n\t\treturn this.serviceDiscovery.register(this.fn.services);\n\t}\n\n\tasync getDatabase(): Promise<TDatabase | undefined> {\n\t\tif (!this.fn.databaseService) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst services = await this.serviceDiscovery.register([\n\t\t\tthis.fn.databaseService,\n\t\t]);\n\n\t\treturn services[\n\t\t\tthis.fn.databaseService.serviceName as keyof typeof services\n\t\t] as TDatabase;\n\t}\n\n\t/**\n\t * Get the audit storage service if configured.\n\t * Returns undefined if no auditor storage is configured.\n\t */\n\tasync getAuditStorage(): Promise<TAuditStorage | undefined> {\n\t\tif (!this.fn.auditorStorageService) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst services = await this.serviceDiscovery.register([\n\t\t\tthis.fn.auditorStorageService,\n\t\t]);\n\n\t\treturn services[\n\t\t\tthis.fn.auditorStorageService.serviceName as keyof typeof services\n\t\t] as TAuditStorage;\n\t}\n\n\t/**\n\t * Create an auditor instance for the function.\n\t * Returns undefined if no auditor storage is configured.\n\t */\n\tasync createAuditor(): Promise<Auditor<TAuditAction> | undefined> {\n\t\tconst storage = await this.getAuditStorage();\n\t\tif (!storage) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn new DefaultAuditor<TAuditAction>({\n\t\t\tactor: { id: 'system', type: 'system' },\n\t\t\tstorage: storage as AuditStorage,\n\t\t\tmetadata: {\n\t\t\t\tfunction: this.fn.type,\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Execute handler with audit transaction support.\n\t * If the audit storage has a database (via getDatabase()), wraps execution\n\t * in a transaction so audits are atomic with handler's database operations.\n\t *\n\t * @param handler - The handler function to execute (receives auditor and db)\n\t * @returns The handler result\n\t */\n\tasync executeWithAudit<T>(\n\t\thandler: (ctx: {\n\t\t\tauditor?: Auditor<TAuditAction>;\n\t\t\tdb?: TDatabase;\n\t\t}) => Promise<T>,\n\t): Promise<T> {\n\t\tconst auditor = await this.createAuditor();\n\t\tconst storage = await this.getAuditStorage();\n\n\t\t// No audit context - just run handler with regular db\n\t\tif (!auditor || !storage) {\n\t\t\tconst db = await this.getDatabase();\n\t\t\treturn handler({ db });\n\t\t}\n\n\t\t// Check if storage has a database and db service names match\n\t\tconst storageDb = (storage as AuditStorage).getDatabase?.();\n\t\tconst databaseServiceName = this.fn.databaseService?.serviceName;\n\t\tconst auditDbServiceName = this.fn.auditorStorageService?.serviceName;\n\n\t\t// If the audit storage has a database and we're using the same database service\n\t\t// (or the audit storage provides the database), use transactional execution\n\t\tif (storageDb && databaseServiceName && auditDbServiceName) {\n\t\t\treturn withAuditableTransaction(\n\t\t\t\tstorageDb as any,\n\t\t\t\tauditor as any,\n\t\t\t\tasync (trx) => {\n\t\t\t\t\t// Use transaction as db\n\t\t\t\t\tconst response = await handler({\n\t\t\t\t\t\tauditor,\n\t\t\t\t\t\tdb: trx as TDatabase,\n\t\t\t\t\t});\n\t\t\t\t\t// Audits are flushed by withAuditableTransaction before commit\n\t\t\t\t\treturn response;\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// No database on storage or service names don't match - run handler and flush audits after\n\t\tconst db = await this.getDatabase();\n\t\tconst response = await handler({ auditor, db });\n\n\t\t// Flush audits (no transaction)\n\t\tawait auditor.flush();\n\n\t\treturn response;\n\t}\n\n\tasync getFunctionInput<TEvent>(\n\t\tevent: TEvent,\n\t): Promise<InferComposableStandardSchema<TInput>> {\n\t\tconst parsedInput = await FunctionBuilder.parseComposableStandardSchema(\n\t\t\tevent,\n\t\t\tthis.fn.input,\n\t\t);\n\n\t\treturn parsedInput as InferComposableStandardSchema<TInput>;\n\t}\n\n\tasync publishEvents(response: InferStandardSchema<TOutSchema>) {\n\t\tawait publishEvents(\n\t\t\tthis.logger,\n\t\t\tthis.serviceDiscovery,\n\t\t\tthis.fn.events,\n\t\t\tresponse,\n\t\t\tthis.fn.publisherService,\n\t\t);\n\t}\n\n\tasync parseComposableStandardSchema<T extends ComposableStandardSchema>(\n\t\tdata: unknown,\n\t\tschema: T,\n\t): Promise<InferComposableStandardSchema<T>> {\n\t\treturn FunctionBuilder.parseComposableStandardSchema(data, schema);\n\t}\n}\n"],"mappings":";;;;;;;AAqBA,IAAsB,2BAAtB,MAeE;CACD,YACWA,WACSC,IAsBlB;EAvBS;EACS;CAsBhB;CAEJ,AAAU;CAEV,IAAI,SAAkB;AACrB,SAAO,KAAK,WAAW,KAAK,GAAG;CAC/B;CAED,IAAI,mBAA+D;EAClE,MAAM,mBAAmB,iBAAiB,YAExC,KAAK,UAAU;AAEjB,SAAO;CACP;CAED,cAAiD;AAChD,SAAO,KAAK,iBAAiB,SAAS,KAAK,GAAG,SAAS;CACvD;CAED,MAAM,cAA8C;AACnD,OAAK,KAAK,GAAG,gBACZ;EAGD,MAAM,WAAW,MAAM,KAAK,iBAAiB,SAAS,CACrD,KAAK,GAAG,eACR,EAAC;AAEF,SAAO,SACN,KAAK,GAAG,gBAAgB;CAEzB;;;;;CAMD,MAAM,kBAAsD;AAC3D,OAAK,KAAK,GAAG,sBACZ;EAGD,MAAM,WAAW,MAAM,KAAK,iBAAiB,SAAS,CACrD,KAAK,GAAG,qBACR,EAAC;AAEF,SAAO,SACN,KAAK,GAAG,sBAAsB;CAE/B;;;;;CAMD,MAAM,gBAA4D;EACjE,MAAM,UAAU,MAAM,KAAK,iBAAiB;AAC5C,OAAK,QACJ;AAGD,SAAO,IAAI,eAA6B;GACvC,OAAO;IAAE,IAAI;IAAU,MAAM;GAAU;GAC9B;GACT,UAAU,EACT,UAAU,KAAK,GAAG,KAClB;EACD;CACD;;;;;;;;;CAUD,MAAM,iBACLC,SAIa;EACb,MAAM,UAAU,MAAM,KAAK,eAAe;EAC1C,MAAM,UAAU,MAAM,KAAK,iBAAiB;AAG5C,OAAK,YAAY,SAAS;GACzB,MAAMC,OAAK,MAAM,KAAK,aAAa;AACnC,UAAO,QAAQ,EAAE,SAAI,EAAC;EACtB;EAGD,MAAM,YAAY,AAAC,QAAyB,eAAe;EAC3D,MAAM,sBAAsB,KAAK,GAAG,iBAAiB;EACrD,MAAM,qBAAqB,KAAK,GAAG,uBAAuB;AAI1D,MAAI,aAAa,uBAAuB,mBACvC,QAAO,yBACN,WACA,SACA,OAAO,QAAQ;GAEd,MAAMC,aAAW,MAAM,QAAQ;IAC9B;IACA,IAAI;GACJ,EAAC;AAEF,UAAOA;EACP,EACD;EAIF,MAAM,KAAK,MAAM,KAAK,aAAa;EACnC,MAAM,WAAW,MAAM,QAAQ;GAAE;GAAS;EAAI,EAAC;AAG/C,QAAM,QAAQ,OAAO;AAErB,SAAO;CACP;CAED,MAAM,iBACLC,OACiD;EACjD,MAAM,cAAc,MAAM,gBAAgB,8BACzC,OACA,KAAK,GAAG,MACR;AAED,SAAO;CACP;CAED,MAAM,cAAcC,UAA2C;AAC9D,QAAM,cACL,KAAK,QACL,KAAK,kBACL,KAAK,GAAG,QACR,UACA,KAAK,GAAG,iBACR;CACD;CAED,MAAM,8BACLC,MACAC,QAC4C;AAC5C,SAAO,gBAAgB,8BAA8B,MAAM,OAAO;CAClE;AACD"}
1
+ {"version":3,"file":"FunctionExecutionWrapper-B0ZAssiy.mjs","names":["envParser: EnvironmentParser<{}>","fn: Function<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName,\n\t\t\tTAuditAction,\n\t\t\tFunctionHandler<\n\t\t\t\tTInput,\n\t\t\t\tTServices,\n\t\t\t\tTLogger,\n\t\t\t\tTOutSchema,\n\t\t\t\tTDatabase,\n\t\t\t\tTAuditStorage,\n\t\t\t\tTAuditAction\n\t\t\t>\n\t\t>","handler: (ctx: {\n\t\t\tauditor?: Auditor<TAuditAction>;\n\t\t\tdb?: TDatabase;\n\t\t}) => Promise<T>","db","response","event: TEvent","response: InferStandardSchema<TOutSchema>","data: unknown","schema: T"],"sources":["../src/functions/FunctionExecutionWrapper.ts"],"sourcesContent":["import type { AuditableAction, Auditor, AuditStorage } from '@geekmidas/audit';\nimport { DefaultAuditor } from '@geekmidas/audit';\nimport { withAuditableTransaction } from '@geekmidas/audit/kysely';\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type {\n\tComposableStandardSchema,\n\tInferComposableStandardSchema,\n\tInferStandardSchema,\n} from '@geekmidas/schema';\nimport {\n\ttype Service,\n\tServiceDiscovery,\n\ttype ServiceRecord,\n} from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { publishEvents } from '../publisher';\nimport type { Function, FunctionHandler } from './Function';\nimport { FunctionBuilder } from './FunctionBuilder';\n\nexport abstract class FunctionExecutionWrapper<\n\tTInput extends ComposableStandardSchema | undefined = undefined,\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\tTEventPublisherServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n> {\n\tconstructor(\n\t\tprotected envParser: EnvironmentParser<{}>,\n\t\tprotected readonly fn: Function<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName,\n\t\t\tTAuditAction,\n\t\t\tFunctionHandler<\n\t\t\t\tTInput,\n\t\t\t\tTServices,\n\t\t\t\tTLogger,\n\t\t\t\tTOutSchema,\n\t\t\t\tTDatabase,\n\t\t\t\tTAuditStorage,\n\t\t\t\tTAuditAction\n\t\t\t>\n\t\t>,\n\t) {}\n\n\tprotected _logger?: TLogger;\n\n\tget logger(): TLogger {\n\t\treturn this._logger || this.fn.logger;\n\t}\n\n\tget serviceDiscovery(): ServiceDiscovery<ServiceRecord<TServices>> {\n\t\tconst serviceDiscovery = ServiceDiscovery.getInstance<\n\t\t\tServiceRecord<TServices>\n\t\t>(this.envParser);\n\n\t\treturn serviceDiscovery;\n\t}\n\n\tgetServices(): Promise<ServiceRecord<TServices>> {\n\t\treturn this.serviceDiscovery.register(this.fn.services);\n\t}\n\n\tasync getDatabase(): Promise<TDatabase | undefined> {\n\t\tif (!this.fn.databaseService) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst services = await this.serviceDiscovery.register([\n\t\t\tthis.fn.databaseService,\n\t\t]);\n\n\t\treturn services[\n\t\t\tthis.fn.databaseService.serviceName as keyof typeof services\n\t\t] as TDatabase;\n\t}\n\n\t/**\n\t * Get the audit storage service if configured.\n\t * Returns undefined if no auditor storage is configured.\n\t */\n\tasync getAuditStorage(): Promise<TAuditStorage | undefined> {\n\t\tif (!this.fn.auditorStorageService) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst services = await this.serviceDiscovery.register([\n\t\t\tthis.fn.auditorStorageService,\n\t\t]);\n\n\t\treturn services[\n\t\t\tthis.fn.auditorStorageService.serviceName as keyof typeof services\n\t\t] as TAuditStorage;\n\t}\n\n\t/**\n\t * Create an auditor instance for the function.\n\t * Returns undefined if no auditor storage is configured.\n\t */\n\tasync createAuditor(): Promise<Auditor<TAuditAction> | undefined> {\n\t\tconst storage = await this.getAuditStorage();\n\t\tif (!storage) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn new DefaultAuditor<TAuditAction>({\n\t\t\tactor: { id: 'system', type: 'system' },\n\t\t\tstorage: storage as AuditStorage,\n\t\t\tmetadata: {\n\t\t\t\tfunction: this.fn.type,\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Execute handler with audit transaction support.\n\t * If the audit storage has a database (via getDatabase()), wraps execution\n\t * in a transaction so audits are atomic with handler's database operations.\n\t *\n\t * @param handler - The handler function to execute (receives auditor and db)\n\t * @returns The handler result\n\t */\n\tasync executeWithAudit<T>(\n\t\thandler: (ctx: {\n\t\t\tauditor?: Auditor<TAuditAction>;\n\t\t\tdb?: TDatabase;\n\t\t}) => Promise<T>,\n\t): Promise<T> {\n\t\tconst auditor = await this.createAuditor();\n\t\tconst storage = await this.getAuditStorage();\n\n\t\t// No audit context - just run handler with regular db\n\t\tif (!auditor || !storage) {\n\t\t\tconst db = await this.getDatabase();\n\t\t\treturn handler({ db });\n\t\t}\n\n\t\t// Check if storage has a database and db service names match\n\t\tconst storageDb = (storage as AuditStorage).getDatabase?.();\n\t\tconst databaseServiceName = this.fn.databaseService?.serviceName;\n\t\tconst auditDbServiceName = this.fn.auditorStorageService?.serviceName;\n\n\t\t// If the audit storage has a database and we're using the same database service\n\t\t// (or the audit storage provides the database), use transactional execution\n\t\tif (storageDb && databaseServiceName && auditDbServiceName) {\n\t\t\treturn withAuditableTransaction(\n\t\t\t\tstorageDb as any,\n\t\t\t\tauditor as any,\n\t\t\t\tasync (trx) => {\n\t\t\t\t\t// Use transaction as db\n\t\t\t\t\tconst response = await handler({\n\t\t\t\t\t\tauditor,\n\t\t\t\t\t\tdb: trx as TDatabase,\n\t\t\t\t\t});\n\t\t\t\t\t// Audits are flushed by withAuditableTransaction before commit\n\t\t\t\t\treturn response;\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// No database on storage or service names don't match - run handler and flush audits after\n\t\tconst db = await this.getDatabase();\n\t\tconst response = await handler({ auditor, db });\n\n\t\t// Flush audits (no transaction)\n\t\tawait auditor.flush();\n\n\t\treturn response;\n\t}\n\n\tasync getFunctionInput<TEvent>(\n\t\tevent: TEvent,\n\t): Promise<InferComposableStandardSchema<TInput>> {\n\t\tconst parsedInput = await FunctionBuilder.parseComposableStandardSchema(\n\t\t\tevent,\n\t\t\tthis.fn.input,\n\t\t);\n\n\t\treturn parsedInput as InferComposableStandardSchema<TInput>;\n\t}\n\n\tasync publishEvents(response: InferStandardSchema<TOutSchema>) {\n\t\tawait publishEvents(\n\t\t\tthis.logger,\n\t\t\tthis.serviceDiscovery,\n\t\t\tthis.fn.events,\n\t\t\tresponse,\n\t\t\tthis.fn.publisherService,\n\t\t);\n\t}\n\n\tasync parseComposableStandardSchema<T extends ComposableStandardSchema>(\n\t\tdata: unknown,\n\t\tschema: T,\n\t): Promise<InferComposableStandardSchema<T>> {\n\t\treturn FunctionBuilder.parseComposableStandardSchema(data, schema);\n\t}\n}\n"],"mappings":";;;;;;;AAqBA,IAAsB,2BAAtB,MAeE;CACD,YACWA,WACSC,IAsBlB;EAvBS;EACS;CAsBhB;CAEJ,AAAU;CAEV,IAAI,SAAkB;AACrB,SAAO,KAAK,WAAW,KAAK,GAAG;CAC/B;CAED,IAAI,mBAA+D;EAClE,MAAM,mBAAmB,iBAAiB,YAExC,KAAK,UAAU;AAEjB,SAAO;CACP;CAED,cAAiD;AAChD,SAAO,KAAK,iBAAiB,SAAS,KAAK,GAAG,SAAS;CACvD;CAED,MAAM,cAA8C;AACnD,OAAK,KAAK,GAAG,gBACZ;EAGD,MAAM,WAAW,MAAM,KAAK,iBAAiB,SAAS,C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QACL,KAAK,kBACL,KAAK,GAAG,QACR,UACA,KAAK,GAAG,iBACR;CACD;CAED,MAAM,8BACLC,MACAC,QAC4C;AAC5C,SAAO,gBAAgB,8BAA8B,MAAM,OAAO;CAClE;AACD"}
@@ -104,4 +104,4 @@ Object.defineProperty(exports, 'FunctionExecutionWrapper', {
104
104
  return FunctionExecutionWrapper;
105
105
  }
106
106
  });
107
- //# sourceMappingURL=FunctionExecutionWrapper-7B-CufYj.cjs.map
107
+ //# sourceMappingURL=FunctionExecutionWrapper-KKHP6fDY.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"FunctionExecutionWrapper-7B-CufYj.cjs","names":["envParser: EnvironmentParser<{}>","fn: Function<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName,\n\t\t\tTAuditAction,\n\t\t\tFunctionHandler<\n\t\t\t\tTInput,\n\t\t\t\tTServices,\n\t\t\t\tTLogger,\n\t\t\t\tTOutSchema,\n\t\t\t\tTDatabase,\n\t\t\t\tTAuditStorage,\n\t\t\t\tTAuditAction\n\t\t\t>\n\t\t>","DefaultAuditor","handler: (ctx: {\n\t\t\tauditor?: Auditor<TAuditAction>;\n\t\t\tdb?: TDatabase;\n\t\t}) => Promise<T>","db","response","event: TEvent","response: InferStandardSchema<TOutSchema>","data: unknown","schema: T"],"sources":["../src/functions/FunctionExecutionWrapper.ts"],"sourcesContent":["import type { AuditableAction, Auditor, AuditStorage } from '@geekmidas/audit';\nimport { DefaultAuditor } from '@geekmidas/audit';\nimport { withAuditableTransaction } from '@geekmidas/audit/kysely';\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type {\n\tComposableStandardSchema,\n\tInferComposableStandardSchema,\n\tInferStandardSchema,\n} from '@geekmidas/schema';\nimport {\n\ttype Service,\n\tServiceDiscovery,\n\ttype ServiceRecord,\n} from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { publishEvents } from '../publisher';\nimport type { Function, FunctionHandler } from './Function';\nimport { FunctionBuilder } from './FunctionBuilder';\n\nexport abstract class FunctionExecutionWrapper<\n\tTInput extends ComposableStandardSchema | undefined = undefined,\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\tTEventPublisherServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n> {\n\tconstructor(\n\t\tprotected envParser: EnvironmentParser<{}>,\n\t\tprotected readonly fn: Function<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName,\n\t\t\tTAuditAction,\n\t\t\tFunctionHandler<\n\t\t\t\tTInput,\n\t\t\t\tTServices,\n\t\t\t\tTLogger,\n\t\t\t\tTOutSchema,\n\t\t\t\tTDatabase,\n\t\t\t\tTAuditStorage,\n\t\t\t\tTAuditAction\n\t\t\t>\n\t\t>,\n\t) {}\n\n\tprotected _logger?: TLogger;\n\n\tget logger(): TLogger {\n\t\treturn this._logger || this.fn.logger;\n\t}\n\n\tget serviceDiscovery(): ServiceDiscovery<ServiceRecord<TServices>> {\n\t\tconst serviceDiscovery = ServiceDiscovery.getInstance<\n\t\t\tServiceRecord<TServices>\n\t\t>(this.envParser);\n\n\t\treturn serviceDiscovery;\n\t}\n\n\tgetServices(): Promise<ServiceRecord<TServices>> {\n\t\treturn this.serviceDiscovery.register(this.fn.services);\n\t}\n\n\tasync getDatabase(): Promise<TDatabase | undefined> {\n\t\tif (!this.fn.databaseService) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst services = await this.serviceDiscovery.register([\n\t\t\tthis.fn.databaseService,\n\t\t]);\n\n\t\treturn services[\n\t\t\tthis.fn.databaseService.serviceName as keyof typeof services\n\t\t] as TDatabase;\n\t}\n\n\t/**\n\t * Get the audit storage service if configured.\n\t * Returns undefined if no auditor storage is configured.\n\t */\n\tasync getAuditStorage(): Promise<TAuditStorage | undefined> {\n\t\tif (!this.fn.auditorStorageService) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst services = await this.serviceDiscovery.register([\n\t\t\tthis.fn.auditorStorageService,\n\t\t]);\n\n\t\treturn services[\n\t\t\tthis.fn.auditorStorageService.serviceName as keyof typeof services\n\t\t] as TAuditStorage;\n\t}\n\n\t/**\n\t * Create an auditor instance for the function.\n\t * Returns undefined if no auditor storage is configured.\n\t */\n\tasync createAuditor(): Promise<Auditor<TAuditAction> | undefined> {\n\t\tconst storage = await this.getAuditStorage();\n\t\tif (!storage) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn new DefaultAuditor<TAuditAction>({\n\t\t\tactor: { id: 'system', type: 'system' },\n\t\t\tstorage: storage as AuditStorage,\n\t\t\tmetadata: {\n\t\t\t\tfunction: this.fn.type,\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Execute handler with audit transaction support.\n\t * If the audit storage has a database (via getDatabase()), wraps execution\n\t * in a transaction so audits are atomic with handler's database operations.\n\t *\n\t * @param handler - The handler function to execute (receives auditor and db)\n\t * @returns The handler result\n\t */\n\tasync executeWithAudit<T>(\n\t\thandler: (ctx: {\n\t\t\tauditor?: Auditor<TAuditAction>;\n\t\t\tdb?: TDatabase;\n\t\t}) => Promise<T>,\n\t): Promise<T> {\n\t\tconst auditor = await this.createAuditor();\n\t\tconst storage = await this.getAuditStorage();\n\n\t\t// No audit context - just run handler with regular db\n\t\tif (!auditor || !storage) {\n\t\t\tconst db = await this.getDatabase();\n\t\t\treturn handler({ db });\n\t\t}\n\n\t\t// Check if storage has a database and db service names match\n\t\tconst storageDb = (storage as AuditStorage).getDatabase?.();\n\t\tconst databaseServiceName = this.fn.databaseService?.serviceName;\n\t\tconst auditDbServiceName = this.fn.auditorStorageService?.serviceName;\n\n\t\t// If the audit storage has a database and we're using the same database service\n\t\t// (or the audit storage provides the database), use transactional execution\n\t\tif (storageDb && databaseServiceName && auditDbServiceName) {\n\t\t\treturn withAuditableTransaction(\n\t\t\t\tstorageDb as any,\n\t\t\t\tauditor as any,\n\t\t\t\tasync (trx) => {\n\t\t\t\t\t// Use transaction as db\n\t\t\t\t\tconst response = await handler({\n\t\t\t\t\t\tauditor,\n\t\t\t\t\t\tdb: trx as TDatabase,\n\t\t\t\t\t});\n\t\t\t\t\t// Audits are flushed by withAuditableTransaction before commit\n\t\t\t\t\treturn response;\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// No database on storage or service names don't match - run handler and flush audits after\n\t\tconst db = await this.getDatabase();\n\t\tconst response = await handler({ auditor, db });\n\n\t\t// Flush audits (no transaction)\n\t\tawait auditor.flush();\n\n\t\treturn response;\n\t}\n\n\tasync getFunctionInput<TEvent>(\n\t\tevent: TEvent,\n\t): Promise<InferComposableStandardSchema<TInput>> {\n\t\tconst parsedInput = await FunctionBuilder.parseComposableStandardSchema(\n\t\t\tevent,\n\t\t\tthis.fn.input,\n\t\t);\n\n\t\treturn parsedInput as InferComposableStandardSchema<TInput>;\n\t}\n\n\tasync publishEvents(response: InferStandardSchema<TOutSchema>) {\n\t\tawait publishEvents(\n\t\t\tthis.logger,\n\t\t\tthis.serviceDiscovery,\n\t\t\tthis.fn.events,\n\t\t\tresponse,\n\t\t\tthis.fn.publisherService,\n\t\t);\n\t}\n\n\tasync parseComposableStandardSchema<T extends ComposableStandardSchema>(\n\t\tdata: unknown,\n\t\tschema: T,\n\t): Promise<InferComposableStandardSchema<T>> {\n\t\treturn FunctionBuilder.parseComposableStandardSchema(data, schema);\n\t}\n}\n"],"mappings":";;;;;;;;AAqBA,IAAsB,2BAAtB,MAeE;CACD,YACWA,WACSC,IAsBlB;EAvBS;EACS;CAsBhB;CAEJ,AAAU;CAEV,IAAI,SAAkB;AACrB,SAAO,KAAK,WAAW,KAAK,GAAG;CAC/B;CAED,IAAI,mBAA+D;EAClE,MAAM,mBAAmB,sCAAiB,YAExC,KAAK,UAAU;AAEjB,SAAO;CACP;CAED,cAAiD;AAChD,SAAO,KAAK,iBAAiB,SAAS,KAAK,GAAG,SAAS;CACvD;CAED,MAAM,cAA8C;AACnD,OAAK,KAAK,GAAG,gBACZ;EAGD,MAAM,WAAW,MAAM,KAAK,iBAAiB,SAAS,CACrD,KAAK,GAAG,eACR,EAAC;AAEF,SAAO,SACN,KAAK,GAAG,gBAAgB;CAEzB;;;;;CAMD,MAAM,kBAAsD;AAC3D,OAAK,KAAK,GAAG,sBACZ;EAGD,MAAM,WAAW,MAAM,KAAK,iBAAiB,SAAS,CACrD,KAAK,GAAG,qBACR,EAAC;AAEF,SAAO,SACN,KAAK,GAAG,sBAAsB;CAE/B;;;;;CAMD,MAAM,gBAA4D;EACjE,MAAM,UAAU,MAAM,KAAK,iBAAiB;AAC5C,OAAK,QACJ;AAGD,SAAO,IAAIC,iCAA6B;GACvC,OAAO;IAAE,IAAI;IAAU,MAAM;GAAU;GAC9B;GACT,UAAU,EACT,UAAU,KAAK,GAAG,KAClB;EACD;CACD;;;;;;;;;CAUD,MAAM,iBACLC,SAIa;EACb,MAAM,UAAU,MAAM,KAAK,eAAe;EAC1C,MAAM,UAAU,MAAM,KAAK,iBAAiB;AAG5C,OAAK,YAAY,SAAS;GACzB,MAAMC,OAAK,MAAM,KAAK,aAAa;AACnC,UAAO,QAAQ,EAAE,SAAI,EAAC;EACtB;EAGD,MAAM,YAAY,AAAC,QAAyB,eAAe;EAC3D,MAAM,sBAAsB,KAAK,GAAG,iBAAiB;EACrD,MAAM,qBAAqB,KAAK,GAAG,uBAAuB;AAI1D,MAAI,aAAa,uBAAuB,mBACvC,QAAO,uDACN,WACA,SACA,OAAO,QAAQ;GAEd,MAAMC,aAAW,MAAM,QAAQ;IAC9B;IACA,IAAI;GACJ,EAAC;AAEF,UAAOA;EACP,EACD;EAIF,MAAM,KAAK,MAAM,KAAK,aAAa;EACnC,MAAM,WAAW,MAAM,QAAQ;GAAE;GAAS;EAAI,EAAC;AAG/C,QAAM,QAAQ,OAAO;AAErB,SAAO;CACP;CAED,MAAM,iBACLC,OACiD;EACjD,MAAM,cAAc,MAAM,wCAAgB,8BACzC,OACA,KAAK,GAAG,MACR;AAED,SAAO;CACP;CAED,MAAM,cAAcC,UAA2C;AAC9D,QAAM,gCACL,KAAK,QACL,KAAK,kBACL,KAAK,GAAG,QACR,UACA,KAAK,GAAG,iBACR;CACD;CAED,MAAM,8BACLC,MACAC,QAC4C;AAC5C,SAAO,wCAAgB,8BAA8B,MAAM,OAAO;CAClE;AACD"}
1
+ {"version":3,"file":"FunctionExecutionWrapper-KKHP6fDY.cjs","names":["envParser: EnvironmentParser<{}>","fn: Function<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName,\n\t\t\tTAuditAction,\n\t\t\tFunctionHandler<\n\t\t\t\tTInput,\n\t\t\t\tTServices,\n\t\t\t\tTLogger,\n\t\t\t\tTOutSchema,\n\t\t\t\tTDatabase,\n\t\t\t\tTAuditStorage,\n\t\t\t\tTAuditAction\n\t\t\t>\n\t\t>","DefaultAuditor","handler: (ctx: {\n\t\t\tauditor?: Auditor<TAuditAction>;\n\t\t\tdb?: TDatabase;\n\t\t}) => Promise<T>","db","response","event: TEvent","response: InferStandardSchema<TOutSchema>","data: unknown","schema: T"],"sources":["../src/functions/FunctionExecutionWrapper.ts"],"sourcesContent":["import type { AuditableAction, Auditor, AuditStorage } from '@geekmidas/audit';\nimport { DefaultAuditor } from '@geekmidas/audit';\nimport { withAuditableTransaction } from '@geekmidas/audit/kysely';\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type {\n\tComposableStandardSchema,\n\tInferComposableStandardSchema,\n\tInferStandardSchema,\n} from '@geekmidas/schema';\nimport {\n\ttype Service,\n\tServiceDiscovery,\n\ttype ServiceRecord,\n} from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { publishEvents } from '../publisher';\nimport type { Function, FunctionHandler } from './Function';\nimport { FunctionBuilder } from './FunctionBuilder';\n\nexport abstract class FunctionExecutionWrapper<\n\tTInput extends ComposableStandardSchema | undefined = undefined,\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\tTEventPublisherServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n> {\n\tconstructor(\n\t\tprotected envParser: EnvironmentParser<{}>,\n\t\tprotected readonly fn: Function<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName,\n\t\t\tTAuditAction,\n\t\t\tFunctionHandler<\n\t\t\t\tTInput,\n\t\t\t\tTServices,\n\t\t\t\tTLogger,\n\t\t\t\tTOutSchema,\n\t\t\t\tTDatabase,\n\t\t\t\tTAuditStorage,\n\t\t\t\tTAuditAction\n\t\t\t>\n\t\t>,\n\t) {}\n\n\tprotected _logger?: TLogger;\n\n\tget logger(): TLogger {\n\t\treturn this._logger || this.fn.logger;\n\t}\n\n\tget serviceDiscovery(): ServiceDiscovery<ServiceRecord<TServices>> {\n\t\tconst serviceDiscovery = ServiceDiscovery.getInstance<\n\t\t\tServiceRecord<TServices>\n\t\t>(this.envParser);\n\n\t\treturn serviceDiscovery;\n\t}\n\n\tgetServices(): Promise<ServiceRecord<TServices>> {\n\t\treturn this.serviceDiscovery.register(this.fn.services);\n\t}\n\n\tasync getDatabase(): Promise<TDatabase | undefined> {\n\t\tif (!this.fn.databaseService) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst services = await this.serviceDiscovery.register([\n\t\t\tthis.fn.databaseService,\n\t\t]);\n\n\t\treturn services[\n\t\t\tthis.fn.databaseService.serviceName as keyof typeof services\n\t\t] as TDatabase;\n\t}\n\n\t/**\n\t * Get the audit storage service if configured.\n\t * Returns undefined if no auditor storage is configured.\n\t */\n\tasync getAuditStorage(): Promise<TAuditStorage | undefined> {\n\t\tif (!this.fn.auditorStorageService) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst services = await this.serviceDiscovery.register([\n\t\t\tthis.fn.auditorStorageService,\n\t\t]);\n\n\t\treturn services[\n\t\t\tthis.fn.auditorStorageService.serviceName as keyof typeof services\n\t\t] as TAuditStorage;\n\t}\n\n\t/**\n\t * Create an auditor instance for the function.\n\t * Returns undefined if no auditor storage is configured.\n\t */\n\tasync createAuditor(): Promise<Auditor<TAuditAction> | undefined> {\n\t\tconst storage = await this.getAuditStorage();\n\t\tif (!storage) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn new DefaultAuditor<TAuditAction>({\n\t\t\tactor: { id: 'system', type: 'system' },\n\t\t\tstorage: storage as AuditStorage,\n\t\t\tmetadata: {\n\t\t\t\tfunction: this.fn.type,\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Execute handler with audit transaction support.\n\t * If the audit storage has a database (via getDatabase()), wraps execution\n\t * in a transaction so audits are atomic with handler's database operations.\n\t *\n\t * @param handler - The handler function to execute (receives auditor and db)\n\t * @returns The handler result\n\t */\n\tasync executeWithAudit<T>(\n\t\thandler: (ctx: {\n\t\t\tauditor?: Auditor<TAuditAction>;\n\t\t\tdb?: TDatabase;\n\t\t}) => Promise<T>,\n\t): Promise<T> {\n\t\tconst auditor = await this.createAuditor();\n\t\tconst storage = await this.getAuditStorage();\n\n\t\t// No audit context - just run handler with regular db\n\t\tif (!auditor || !storage) {\n\t\t\tconst db = await this.getDatabase();\n\t\t\treturn handler({ db });\n\t\t}\n\n\t\t// Check if storage has a database and db service names match\n\t\tconst storageDb = (storage as AuditStorage).getDatabase?.();\n\t\tconst databaseServiceName = this.fn.databaseService?.serviceName;\n\t\tconst auditDbServiceName = this.fn.auditorStorageService?.serviceName;\n\n\t\t// If the audit storage has a database and we're using the same database service\n\t\t// (or the audit storage provides the database), use transactional execution\n\t\tif (storageDb && databaseServiceName && auditDbServiceName) {\n\t\t\treturn withAuditableTransaction(\n\t\t\t\tstorageDb as any,\n\t\t\t\tauditor as any,\n\t\t\t\tasync (trx) => {\n\t\t\t\t\t// Use transaction as db\n\t\t\t\t\tconst response = await handler({\n\t\t\t\t\t\tauditor,\n\t\t\t\t\t\tdb: trx as TDatabase,\n\t\t\t\t\t});\n\t\t\t\t\t// Audits are flushed by withAuditableTransaction before commit\n\t\t\t\t\treturn response;\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// No database on storage or service names don't match - run handler and flush audits after\n\t\tconst db = await this.getDatabase();\n\t\tconst response = await handler({ auditor, db });\n\n\t\t// Flush audits (no transaction)\n\t\tawait auditor.flush();\n\n\t\treturn response;\n\t}\n\n\tasync getFunctionInput<TEvent>(\n\t\tevent: TEvent,\n\t): Promise<InferComposableStandardSchema<TInput>> {\n\t\tconst parsedInput = await FunctionBuilder.parseComposableStandardSchema(\n\t\t\tevent,\n\t\t\tthis.fn.input,\n\t\t);\n\n\t\treturn parsedInput as InferComposableStandardSchema<TInput>;\n\t}\n\n\tasync publishEvents(response: InferStandardSchema<TOutSchema>) {\n\t\tawait publishEvents(\n\t\t\tthis.logger,\n\t\t\tthis.serviceDiscovery,\n\t\t\tthis.fn.events,\n\t\t\tresponse,\n\t\t\tthis.fn.publisherService,\n\t\t);\n\t}\n\n\tasync parseComposableStandardSchema<T extends ComposableStandardSchema>(\n\t\tdata: unknown,\n\t\tschema: T,\n\t): Promise<InferComposableStandardSchema<T>> {\n\t\treturn FunctionBuilder.parseComposableStandardSchema(data, schema);\n\t}\n}\n"],"mappings":";;;;;;;;AAqBA,IAAsB,2BAAtB,MAeE;CACD,YACWA,WACSC,IAsBlB;EAvBS;EACS;CAsBhB;CAEJ,AAAU;CAEV,IAAI,SAAkB;AACrB,SAAO,KAAK,WAAW,KAAK,GAAG;CAC/B;CAED,IAAI,mBAA+D;EAClE,MAAM,mBAAmB,sCAAiB,YAExC,KAAK,UAAU;AAEjB,SAAO;CACP;CAED,cAAiD;AAChD,SAAO,KAAK,iBAAiB,SAAS,KAAK,GAAG,SAAS;CACvD;CAED,MAAM,cAA8C;AACnD,OAAK,KAAK,GAAG,gBACZ;EAGD,MAAM,WAAW,MAAM,KAAK,iBAAiB,SAAS,CACrD,KAAK,GAAG,eACR,EAAC;AAEF,SAAO,SACN,KAAK,GAAG,gBAAgB;CAEzB;;;;;CAMD,MAAM,kBAAsD;AAC3D,OAAK,KAAK,GAAG,sBACZ;EAGD,MAAM,WAAW,MAAM,KAAK,iBAAiB,SAAS,CACrD,KAAK,GAAG,qBACR,EAAC;AAEF,SAAO,SACN,KAAK,GAAG,sBAAsB;CAE/B;;;;;CAMD,MAAM,gBAA4D;EACjE,MAAM,UAAU,MAAM,KAAK,iBAAiB;AAC5C,OAAK,QACJ;AAGD,SAAO,IAAIC,iCAA6B;GACvC,OAAO;IAAE,IAAI;IAAU,MAAM;GAAU;GAC9B;GACT,UAAU,EACT,UAAU,KAAK,GAAG,KAClB;EACD;CACD;;;;;;;;;CAUD,MAAM,iBACLC,SAIa;EACb,MAAM,UAAU,MAAM,KAAK,eAAe;EAC1C,MAAM,UAAU,MAAM,KAAK,iBAAiB;AAG5C,OAAK,YAAY,SAAS;GACzB,MAAMC,OAAK,MAAM,KAAK,aAAa;AACnC,UAAO,QAAQ,EAAE,SAAI,EAAC;EACtB;EAGD,MAAM,YAAY,AAAC,QAAyB,eAAe;EAC3D,MAAM,sBAAsB,KAAK,GAAG,iBAAiB;EACrD,MAAM,qBAAqB,KAAK,GAAG,uBAAuB;AAI1D,MAAI,aAAa,uBAAuB,mBACvC,QAAO,uDACN,WACA,SACA,OAAO,QAAQ;GAEd,MAAMC,aAAW,MAAM,QAAQ;IAC9B;IACA,IAAI;GACJ,EAAC;AAEF,UAAOA;EACP,EACD;EAIF,MAAM,KAAK,MAAM,KAAK,aAAa;EACnC,MAAM,WAAW,MAAM,QAAQ;GAAE;GAAS;EAAI,EAAC;AAG/C,QAAM,QAAQ,OAAO;AAErB,SAAO;CACP;CAED,MAAM,iBACLC,OACiD;EACjD,MAAM,cAAc,MAAM,wCAAgB,8BACzC,OACA,KAAK,GAAG,MACR;AAED,SAAO;CACP;CAED,MAAM,cAAcC,UAA2C;AAC9D,QAAM,gCACL,KAAK,QACL,KAAK,kBACL,KAAK,GAAG,QACR,UACA,KAAK,GAAG,iBACR;CACD;CAED,MAAM,8BACLC,MACAC,QAC4C;AAC5C,SAAO,wCAAgB,8BAA8B,MAAM,OAAO;CAClE;AACD"}
@@ -6,7 +6,7 @@ import { Logger } from "@geekmidas/logger";
6
6
  import { Service, ServiceDiscovery, ServiceRecord } from "@geekmidas/services";
7
7
  import { StandardSchemaV1 } from "@standard-schema/spec";
8
8
  import { EnvironmentParser } from "@geekmidas/envkit";
9
- import * as hono_types3 from "hono/types";
9
+ import * as hono_types6 from "hono/types";
10
10
  import { Context, Hono } from "hono";
11
11
 
12
12
  //#region src/endpoints/HonoEndpointAdaptor.d.ts
@@ -38,7 +38,7 @@ declare class HonoEndpoint<TRoute extends string, TMethod extends HttpMethod, TI
38
38
  * This method is kept for backward compatibility but does nothing.
39
39
  */
40
40
  static applyEventMiddleware(_app: Hono, _serviceDiscovery: ServiceDiscovery<any>): void;
41
- static fromRoutes<TLogger extends Logger, TServices extends Service[]>(routes: string[], envParser: EnvironmentParser<{}>, app: Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/"> | undefined, _logger: TLogger, cwd?: string, options?: HonoEndpointOptions): Promise<Hono>;
41
+ static fromRoutes<TLogger extends Logger, TServices extends Service[]>(routes: string[], envParser: EnvironmentParser<{}>, app: Hono<hono_types6.BlankEnv, hono_types6.BlankSchema, "/"> | undefined, _logger: TLogger, cwd?: string, options?: HonoEndpointOptions): Promise<Hono>;
42
42
  static addRoutes<TServices extends Service[] = [], TLogger extends Logger = Logger>(endpoints: Endpoint<string, HttpMethod, any, any, TServices, TLogger>[], serviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>>, app: Hono, options?: HonoEndpointOptions): void;
43
43
  static addRoute<TRoute extends string, TMethod extends HttpMethod, TInput extends EndpointSchemas = {}, TOutSchema extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TSession = unknown, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string, TAuditStorage extends AuditStorage | undefined = undefined, TAuditStorageServiceName extends string = string, TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>, TDatabase = undefined, TDatabaseServiceName extends string = string>(endpoint: Endpoint<TRoute, TMethod, TInput, TOutSchema, TServices, TLogger, TSession, TEventPublisher, TEventPublisherServiceName, TAuditStorage, TAuditStorageServiceName, TAuditAction, TDatabase, TDatabaseServiceName>, serviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>>, app: Hono): void;
44
44
  static addDocsRoute<TServices extends Service[] = [], TLogger extends Logger = Logger>(endpoints: Endpoint<string, HttpMethod, any, any, TServices, TLogger>[], app: Hono, docsPath: string, openApiOptions?: HonoEndpointOptions['openApiOptions']): void;
@@ -47,4 +47,4 @@ declare class HonoEndpoint<TRoute extends string, TMethod extends HttpMethod, TI
47
47
 
48
48
  //#endregion
49
49
  export { HonoEndpoint, HonoEndpointOptions };
50
- //# sourceMappingURL=HonoEndpointAdaptor-vI3LPiyu.d.cts.map
50
+ //# sourceMappingURL=HonoEndpointAdaptor-BCql3gLP.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HonoEndpointAdaptor-vI3LPiyu.d.cts","names":[],"sources":["../src/endpoints/HonoEndpointAdaptor.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;UAqCiB,mBAAA;;;AAAjB;AAqEA;;EAAyB,QAER,CAAA,EAAA,MAAA,GAAA,KAAA;EAAU;;;EAGD,cACT,CAAA,EAAA;IAAS,KAAA,CAAA,EAAA,MAAA;IAED,OAAA,CAAA,EAAA,MAAA;IAEF,WAAA,CAAA,EAAA,MAAA;EAAY,CAAA;;AAWhC,cArBU,YAqBV,CAAA,eAAA,MAAA,EAAA,gBAnBc,UAmBd,EAAA,eAlBa,eAkBb,GAAA,CAAA,CAAA,EAAA,mBAjBiB,gBAiBjB,GAAA,SAAA,GAAA,SAAA,EAAA,kBAhBgB,OAgBhB,EAAA,GAAA,EAAA,EAAA,gBAfc,MAed,GAfuB,MAevB,EAAA,WAAA,OAAA,EAAA,wBAbsB,cAatB,CAAA,GAAA,CAAA,GAAA,SAAA,GAAA,SAAA,EAAA,mCAAA,MAAA,GAAA,MAAA,EAAA,sBAXoB,YAWpB,GAAA,SAAA,GAAA,SAAA,EAAA,iCAAA,MAAA,GAAA,MAAA,EAAA,qBATmB,eASnB,CAAA,MAAA,EAAA,OAAA,CA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A,EA4KT,gBA5KS,CA4KQ,aA5KR,CA4KsB,SA5KtB,CAAA,CAAA,EAAA,GAAA,EA6KtB,IA7KsB,CAAA,EAAA,IAAA;EAAQ,OAoBJ,YAAA,CAAA,kBA0db,OA1da,EAAA,GAAA,EAAA,EAAA,gBA2df,MA3de,GA2dN,MA3dM,CAAA,CAAA,SAAA,EA6dpB,QA7doB,CAAA,MAAA,EA6dH,UA7dG,EAAA,GAAA,EAAA,GAAA,EA6dmB,SA7dnB,EA6d8B,OA7d9B,CAAA,EAAA,EAAA,GAAA,EA8d1B,IA9d0B,EAAA,QAAA,EAAA,MAAA,EAAA,cAAA,CAAA,EAged,mBAhec,CAAA,gBAAA,CAAA,CAAA,EAAA,IAAA"}
@@ -2,15 +2,15 @@ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
2
  const require_publisher = require('./publisher-lFQleddL.cjs');
3
3
  const require_Endpoint = require('./Endpoint-BcxvF4F3.cjs');
4
4
  const require_processAudits = require('./processAudits-CzHkPokQ.cjs');
5
- const require_helpers = require('./helpers-Ciyi6Aap.cjs');
6
- const require_lazyAccessors = require('./lazyAccessors-B8Hhras9.cjs');
5
+ const require_lazyAccessors = require('./lazyAccessors-BVEtB9lU.cjs');
6
+ const require_helpers = require('./helpers-BYyX0qTA.cjs');
7
7
  const require_parseHonoQuery = require('./parseHonoQuery-D4MhxTRc.cjs');
8
8
  const __geekmidas_db_rls = require_chunk.__toESM(require("@geekmidas/db/rls"));
9
9
  const __geekmidas_errors = require_chunk.__toESM(require("@geekmidas/errors"));
10
10
  const __geekmidas_services = require_chunk.__toESM(require("@geekmidas/services"));
11
+ const hono_cookie = require_chunk.__toESM(require("hono/cookie"));
11
12
  const __geekmidas_rate_limit = require_chunk.__toESM(require("@geekmidas/rate-limit"));
12
13
  const hono = require_chunk.__toESM(require("hono"));
13
- const hono_cookie = require_chunk.__toESM(require("hono/cookie"));
14
14
  const hono_logger = require_chunk.__toESM(require("hono/logger"));
15
15
  const hono_timing = require_chunk.__toESM(require("hono/timing"));
16
16
  const hono_validator = require_chunk.__toESM(require("hono/validator"));
@@ -254,4 +254,4 @@ Object.defineProperty(exports, 'HonoEndpoint', {
254
254
  return HonoEndpoint;
255
255
  }
256
256
  });
257
- //# sourceMappingURL=HonoEndpointAdaptor-B4NMwHkr.cjs.map
257
+ //# sourceMappingURL=HonoEndpointAdaptor-CavBd6P2.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"HonoEndpointAdaptor-B4NMwHkr.cjs","names":["endpoint: Endpoint<\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany\n\t>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditAction,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>","c: Context<any, string, {}>","data: unknown","schema?: T","serviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>>","app: Hono","_app: Hono","_serviceDiscovery: ServiceDiscovery<any>","routes: string[]","envParser: EnvironmentParser<{}>","Hono","_logger: TLogger","options?: HonoEndpointOptions","endpoints: Endpoint<string, HttpMethod, any, any, TServices, TLogger>[]","validators: any[]","c: Context","db: TDatabase | undefined","ResponseBuilder","metadata","output","result","validationError: any","e: any","docsPath: string","openApiOptions?: HonoEndpointOptions['openApiOptions']"],"sources":["../src/endpoints/HonoEndpointAdaptor.ts"],"sourcesContent":["import type { AuditableAction, AuditStorage } from '@geekmidas/audit';\nimport { withRlsContext } from '@geekmidas/db/rls';\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport { wrapError } from '@geekmidas/errors';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { checkRateLimit, getRateLimitHeaders } from '@geekmidas/rate-limit';\nimport {\n\trunWithRequestContext,\n\ttype Service,\n\tServiceDiscovery,\n\ttype ServiceRecord,\n} from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { type Context, Hono } from 'hono';\nimport { setCookie } from 'hono/cookie';\nimport { logger as honoLogger } from 'hono/logger';\nimport { timing } from 'hono/timing';\nimport type { ContentfulStatusCode } from 'hono/utils/http-status';\nimport { validator } from 'hono/validator';\nimport { publishConstructEvents } from '../publisher';\nimport type { HttpMethod, LowerHttpMethod } from '../types';\nimport type { MappedAudit } from './audit';\nimport {\n\tEndpoint,\n\ttype EndpointContext,\n\ttype EndpointSchemas,\n\tResponseBuilder,\n} from './Endpoint';\nimport { getEndpointsFromRoutes } from './helpers';\nimport { createHonoCookies, createHonoHeaders } from './lazyAccessors';\nimport { parseHonoQuery } from './parseHonoQuery';\nimport {\n\tcreateAuditContext,\n\texecuteWithAuditTransaction,\n} from './processAudits';\n\nexport interface HonoEndpointOptions {\n\t/**\n\t * Path where OpenAPI documentation will be served.\n\t * Set to false to disable docs route.\n\t * @default '/docs'\n\t */\n\tdocsPath?: string | false;\n\t/**\n\t * OpenAPI schema options\n\t */\n\topenApiOptions?: {\n\t\ttitle?: string;\n\t\tversion?: string;\n\t\tdescription?: string;\n\t};\n}\n\n/**\n * Feature flags for an endpoint, analyzed once at route registration time.\n * This avoids per-request feature detection overhead.\n */\ninterface EndpointFeatures {\n\thasServices: boolean;\n\thasDatabase: boolean;\n\thasBodyValidation: boolean;\n\thasQueryValidation: boolean;\n\thasParamValidation: boolean;\n\thasAudits: boolean;\n\thasEvents: boolean;\n\thasRateLimit: boolean;\n\thasRls: boolean;\n}\n\n/**\n * Analyze endpoint features at registration time (not per-request)\n */\nfunction analyzeEndpointFeatures(\n\tendpoint: Endpoint<\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany\n\t>,\n): EndpointFeatures {\n\treturn {\n\t\thasServices: endpoint.services.length > 0,\n\t\thasDatabase: !!endpoint.databaseService,\n\t\thasBodyValidation: !!endpoint.input?.body,\n\t\thasQueryValidation: !!endpoint.input?.query,\n\t\thasParamValidation: !!endpoint.input?.params,\n\t\t// Audit context needed if declarative audits OR auditor storage service configured (for manual audits)\n\t\thasAudits:\n\t\t\t(endpoint.audits?.length ?? 0) > 0 || !!endpoint.auditorStorageService,\n\t\thasEvents: (endpoint.events?.length ?? 0) > 0,\n\t\thasRateLimit: !!endpoint.rateLimit,\n\t\thasRls: !!endpoint.rlsConfig && !endpoint.rlsBypass,\n\t};\n}\n\nexport class HonoEndpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\tTEventPublisherServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> {\n\tconstructor(\n\t\tprivate readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditAction,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>,\n\t) {}\n\n\tstatic isDev = process.env.NODE_ENV === 'development';\n\n\tstatic async validate<T extends StandardSchemaV1>(\n\t\tc: Context<any, string, {}>,\n\t\tdata: unknown,\n\t\tschema?: T,\n\t) {\n\t\tif (!schema) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst parsed = await Endpoint.validate(schema, data);\n\n\t\tif (parsed.issues) {\n\t\t\treturn c.json(parsed.issues, 422);\n\t\t}\n\n\t\treturn parsed.value;\n\t}\n\taddRoute(\n\t\tserviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>>,\n\t\tapp: Hono,\n\t): void {\n\t\tHonoEndpoint.addRoute(this.endpoint, serviceDiscovery, app);\n\t}\n\n\t/**\n\t * @deprecated Global event middleware is no longer used.\n\t * Events are now published per-route only for endpoints that have events configured.\n\t * This method is kept for backward compatibility but does nothing.\n\t */\n\tstatic applyEventMiddleware(\n\t\t_app: Hono,\n\t\t_serviceDiscovery: ServiceDiscovery<any>,\n\t) {\n\t\t// No-op: Event publishing is now handled per-route in addRoute\n\t\t// This avoids running middleware on every request including 404s\n\t}\n\n\tstatic async fromRoutes<TLogger extends Logger, TServices extends Service[]>(\n\t\troutes: string[],\n\t\tenvParser: EnvironmentParser<{}>,\n\t\tapp = new Hono(),\n\t\t_logger: TLogger,\n\t\tcwd = process.cwd(),\n\t\toptions?: HonoEndpointOptions,\n\t): Promise<Hono> {\n\t\tconst endpoints = await getEndpointsFromRoutes<TServices>(routes, cwd);\n\t\tconst serviceDiscovery =\n\t\t\tServiceDiscovery.getInstance<ServiceRecord<TServices>>(envParser);\n\n\t\tHonoEndpoint.addRoutes(endpoints, serviceDiscovery, app, options);\n\n\t\treturn app;\n\t}\n\n\tstatic addRoutes<\n\t\tTServices extends Service[] = [],\n\t\tTLogger extends Logger = Logger,\n\t>(\n\t\tendpoints: Endpoint<string, HttpMethod, any, any, TServices, TLogger>[],\n\t\tserviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>>,\n\t\tapp: Hono,\n\t\toptions?: HonoEndpointOptions,\n\t): void {\n\t\t// Add timing middleware (always enabled)\n\t\tapp.use('*', timing());\n\n\t\t// Add logger middleware in development mode\n\n\t\tif (HonoEndpoint.isDev) {\n\t\t\tapp.use('*', honoLogger());\n\t\t}\n\n\t\t// Add docs route if not disabled\n\t\tconst docsPath =\n\t\t\toptions?.docsPath !== false ? options?.docsPath || '/docs' : null;\n\t\tif (docsPath) {\n\t\t\tHonoEndpoint.addDocsRoute(\n\t\t\t\tendpoints,\n\t\t\t\tapp,\n\t\t\t\tdocsPath,\n\t\t\t\toptions?.openApiOptions,\n\t\t\t);\n\t\t}\n\n\t\t// Sort endpoints to ensure static routes come before dynamic ones\n\t\tconst sortedEndpoints = endpoints.sort((a, b) => {\n\t\t\tconst aSegments = a.route.split('/');\n\t\t\tconst bSegments = b.route.split('/');\n\n\t\t\t// Compare each segment\n\t\t\tfor (let i = 0; i < Math.max(aSegments.length, bSegments.length); i++) {\n\t\t\t\tconst aSegment = aSegments[i] || '';\n\t\t\t\tconst bSegment = bSegments[i] || '';\n\n\t\t\t\t// If one is dynamic and the other is not, static comes first\n\t\t\t\tconst aIsDynamic = aSegment.startsWith(':');\n\t\t\t\tconst bIsDynamic = bSegment.startsWith(':');\n\n\t\t\t\tif (!aIsDynamic && bIsDynamic) return -1;\n\t\t\t\tif (aIsDynamic && !bIsDynamic) return 1;\n\n\t\t\t\t// If both are the same type, compare alphabetically\n\t\t\t\tif (aSegment !== bSegment) {\n\t\t\t\t\treturn aSegment.localeCompare(bSegment);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn 0;\n\t\t});\n\n\t\t// Note: Global event middleware removed for performance\n\t\t// Events are now published per-route only for endpoints with events configured\n\t\tfor (const endpoint of sortedEndpoints) {\n\t\t\tHonoEndpoint.addRoute(endpoint, serviceDiscovery, app);\n\t\t}\n\t}\n\n\tstatic addRoute<\n\t\tTRoute extends string,\n\t\tTMethod extends HttpMethod,\n\t\tTInput extends EndpointSchemas = {},\n\t\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\t\tTServices extends Service[] = [],\n\t\tTLogger extends Logger = Logger,\n\t\tTSession = unknown,\n\t\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\t\tTEventPublisherServiceName extends string = string,\n\t\tTAuditStorage extends AuditStorage | undefined = undefined,\n\t\tTAuditStorageServiceName extends string = string,\n\t\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\t\tstring,\n\t\t\tunknown\n\t\t>,\n\t\tTDatabase = undefined,\n\t\tTDatabaseServiceName extends string = string,\n\t>(\n\t\tendpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditAction,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>,\n\t\tserviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>>,\n\t\tapp: Hono,\n\t): void {\n\t\tconst { route } = endpoint;\n\t\tconst method = endpoint.method.toLowerCase() as LowerHttpMethod<TMethod>;\n\n\t\t// Analyze endpoint features once at registration time (not per-request)\n\t\tconst features = analyzeEndpointFeatures(endpoint);\n\n\t\t// Build validators array - only add validators for schemas that exist\n\t\tconst validators: any[] = [];\n\n\t\tif (features.hasBodyValidation) {\n\t\t\tvalidators.push(\n\t\t\t\tvalidator('json', (value, c) =>\n\t\t\t\t\tHonoEndpoint.validate(c, value, endpoint.input?.body),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tif (features.hasQueryValidation) {\n\t\t\tvalidators.push(\n\t\t\t\tvalidator('query', (_, c) => {\n\t\t\t\t\tconst parsedQuery = parseHonoQuery(c);\n\t\t\t\t\treturn HonoEndpoint.validate(c, parsedQuery, endpoint.input?.query);\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\tif (features.hasParamValidation) {\n\t\t\tvalidators.push(\n\t\t\t\tvalidator('param', (params, c) =>\n\t\t\t\t\tHonoEndpoint.validate(c, params, endpoint.input?.params),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\t// Main handler\n\t\tconst handler = async (c: Context) => {\n\t\t\t// Request context setup\n\t\t\tconst startTime = Date.now();\n\t\t\tconst requestId = c.req.header('X-Request-ID') ?? crypto.randomUUID();\n\n\t\t\tconst logger = endpoint.logger.child({\n\t\t\t\trequestId,\n\t\t\t\tendpoint: endpoint.fullPath,\n\t\t\t\troute: endpoint.route,\n\t\t\t\thost: c.req.header('host'),\n\t\t\t\tmethod: endpoint.method,\n\t\t\t\tpath: c.req.path,\n\t\t\t}) as TLogger;\n\n\t\t\t// Set response header\n\t\t\tc.header('X-Request-ID', requestId);\n\n\t\t\t// Wrap entire handler in request context for services to access\n\t\t\treturn runWithRequestContext(\n\t\t\t\t{ logger, requestId, startTime },\n\t\t\t\tasync () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Lazy accessors - no upfront parsing, use native Hono methods\n\t\t\t\t\t\tconst header = createHonoHeaders(c);\n\t\t\t\t\t\tconst cookie = createHonoCookies(c);\n\n\t\t\t\t\t\t// Only register services if endpoint has any\n\t\t\t\t\t\tconst services = features.hasServices\n\t\t\t\t\t\t\t? await serviceDiscovery.register(endpoint.services)\n\t\t\t\t\t\t\t: ({} as ServiceRecord<TServices>);\n\n\t\t\t\t\t\t// Resolve database service only if configured\n\t\t\t\t\t\tconst rawDb = features.hasDatabase\n\t\t\t\t\t\t\t? await serviceDiscovery\n\t\t\t\t\t\t\t\t\t.register([endpoint.databaseService!])\n\t\t\t\t\t\t\t\t\t.then(\n\t\t\t\t\t\t\t\t\t\t(s) =>\n\t\t\t\t\t\t\t\t\t\t\ts[\n\t\t\t\t\t\t\t\t\t\t\t\tendpoint.databaseService?.serviceName as keyof typeof s\n\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\t// Extract session (defaults to empty object)\n\t\t\t\t\t\tconst session = await endpoint.getSession({\n\t\t\t\t\t\t\tservices,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\theader,\n\t\t\t\t\t\t\tcookie,\n\t\t\t\t\t\t\t...(rawDb !== undefined && { db: rawDb }),\n\t\t\t\t\t\t} as any);\n\n\t\t\t\t\t\t// Check authorization (defaults to true)\n\t\t\t\t\t\tconst isAuthorized = await endpoint.authorize({\n\t\t\t\t\t\t\theader,\n\t\t\t\t\t\t\tcookie,\n\t\t\t\t\t\t\tservices,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\tsession,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (!isAuthorized) {\n\t\t\t\t\t\t\tlogger.warn('Unauthorized access attempt');\n\t\t\t\t\t\t\treturn c.json({ error: 'Unauthorized' }, 401);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Check rate limit only if configured\n\t\t\t\t\t\tif (features.hasRateLimit) {\n\t\t\t\t\t\t\tconst rateLimitInfo = await checkRateLimit(endpoint.rateLimit!, {\n\t\t\t\t\t\t\t\theader,\n\t\t\t\t\t\t\t\tservices,\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\tsession,\n\t\t\t\t\t\t\t\tpath: c.req.path,\n\t\t\t\t\t\t\t\tmethod: endpoint.method,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst rateLimitHeaders = getRateLimitHeaders(\n\t\t\t\t\t\t\t\trateLimitInfo,\n\t\t\t\t\t\t\t\tendpoint.rateLimit!,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tfor (const [key, value] of Object.entries(rateLimitHeaders)) {\n\t\t\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\t\t\tc.header(key, value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Create audit context only if audits are configured\n\t\t\t\t\t\tconst auditContext = features.hasAudits\n\t\t\t\t\t\t\t? await createAuditContext(\n\t\t\t\t\t\t\t\t\tendpoint as any,\n\t\t\t\t\t\t\t\t\tserviceDiscovery,\n\t\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tsession,\n\t\t\t\t\t\t\t\t\t\theader,\n\t\t\t\t\t\t\t\t\t\tcookie,\n\t\t\t\t\t\t\t\t\t\tservices: services as Record<string, unknown>,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\tconst audits = features.hasAudits\n\t\t\t\t\t\t\t? (endpoint.audits as MappedAudit<TAuditAction, TOutSchema>[])\n\t\t\t\t\t\t\t: [];\n\n\t\t\t\t\t\t// Warn if declarative audits are configured but no audit storage\n\t\t\t\t\t\tif (features.hasAudits && !auditContext) {\n\t\t\t\t\t\t\tlogger.warn('No auditor storage service available');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Extract RLS context only if configured and not bypassed\n\t\t\t\t\t\tconst rlsContext =\n\t\t\t\t\t\t\tfeatures.hasRls && rawDb !== undefined\n\t\t\t\t\t\t\t\t? await endpoint.rlsConfig?.extractor({\n\t\t\t\t\t\t\t\t\t\tservices,\n\t\t\t\t\t\t\t\t\t\tsession: session as TSession,\n\t\t\t\t\t\t\t\t\t\theader,\n\t\t\t\t\t\t\t\t\t\tcookie,\n\t\t\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\t// Execute handler with automatic audit transaction support\n\t\t\t\t\t\tconst result = await executeWithAuditTransaction(\n\t\t\t\t\t\t\tauditContext,\n\t\t\t\t\t\t\tasync (auditor) => {\n\t\t\t\t\t\t\t\tconst sameDatabase =\n\t\t\t\t\t\t\t\t\tauditContext?.storage?.databaseServiceName &&\n\t\t\t\t\t\t\t\t\tauditContext.storage.databaseServiceName ===\n\t\t\t\t\t\t\t\t\t\tendpoint.databaseService?.serviceName;\n\t\t\t\t\t\t\t\tconst baseDb = sameDatabase\n\t\t\t\t\t\t\t\t\t? (auditor?.getTransaction?.() ?? rawDb)\n\t\t\t\t\t\t\t\t\t: rawDb;\n\n\t\t\t\t\t\t\t\tconst executeHandler = async (db: TDatabase | undefined) => {\n\t\t\t\t\t\t\t\t\tconst responseBuilder = new ResponseBuilder();\n\t\t\t\t\t\t\t\t\tconst response = await endpoint.handler(\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tservices,\n\t\t\t\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\t\t\t\tbody: features.hasBodyValidation\n\t\t\t\t\t\t\t\t\t\t\t\t? (c.req.valid as any)('json')\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t\t\t\tquery: features.hasQueryValidation\n\t\t\t\t\t\t\t\t\t\t\t\t? (c.req.valid as any)('query')\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t\t\t\tparams: features.hasParamValidation\n\t\t\t\t\t\t\t\t\t\t\t\t? (c.req.valid as any)('param')\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t\t\t\tsession,\n\t\t\t\t\t\t\t\t\t\t\theader,\n\t\t\t\t\t\t\t\t\t\t\tcookie,\n\t\t\t\t\t\t\t\t\t\t\tauditor,\n\t\t\t\t\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\t\t\t\t} as unknown as EndpointContext<\n\t\t\t\t\t\t\t\t\t\t\tTInput,\n\t\t\t\t\t\t\t\t\t\t\tTServices,\n\t\t\t\t\t\t\t\t\t\t\tTLogger,\n\t\t\t\t\t\t\t\t\t\t\tTSession,\n\t\t\t\t\t\t\t\t\t\t\tTAuditAction,\n\t\t\t\t\t\t\t\t\t\t\tTDatabase,\n\t\t\t\t\t\t\t\t\t\t\tTAuditStorage\n\t\t\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\t\t\tresponseBuilder,\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\tlet data = response;\n\t\t\t\t\t\t\t\t\tlet metadata = responseBuilder.getMetadata();\n\n\t\t\t\t\t\t\t\t\tif (Endpoint.hasMetadata(response)) {\n\t\t\t\t\t\t\t\t\t\tdata = response.data;\n\t\t\t\t\t\t\t\t\t\tmetadata = response.metadata;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tconst output = endpoint.outputSchema\n\t\t\t\t\t\t\t\t\t\t? await endpoint.parseOutput(data)\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\t\t\t\treturn { output, metadata, responseBuilder };\n\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\tif (features.hasRls && rlsContext && baseDb) {\n\t\t\t\t\t\t\t\t\treturn withRlsContext(\n\t\t\t\t\t\t\t\t\t\tbaseDb as any,\n\t\t\t\t\t\t\t\t\t\trlsContext,\n\t\t\t\t\t\t\t\t\t\tasync (trx) => executeHandler(trx as TDatabase),\n\t\t\t\t\t\t\t\t\t\t{ prefix: endpoint.rlsConfig?.prefix },\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn executeHandler(baseDb as TDatabase | undefined);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tasync (result, auditor) => {\n\t\t\t\t\t\t\t\tif (!audits?.length) return;\n\n\t\t\t\t\t\t\t\tfor (const audit of audits) {\n\t\t\t\t\t\t\t\t\tif (audit.when && !audit.when(result.output as any)) {\n\t\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tconst payload = audit.payload(result.output as any);\n\t\t\t\t\t\t\t\t\tconst entityId = audit.entityId?.(result.output as any);\n\t\t\t\t\t\t\t\t\tauditor.audit(audit.type as any, payload as any, {\n\t\t\t\t\t\t\t\t\t\ttable: audit.table,\n\t\t\t\t\t\t\t\t\t\tentityId,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ db: rawDb },\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst { output, metadata } = result;\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlet status = endpoint.status as ContentfulStatusCode;\n\n\t\t\t\t\t\t\tif (metadata.status) {\n\t\t\t\t\t\t\t\tstatus = metadata.status as ContentfulStatusCode;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (metadata.headers) {\n\t\t\t\t\t\t\t\tfor (const [key, value] of Object.entries(metadata.headers)) {\n\t\t\t\t\t\t\t\t\tc.header(key, value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (metadata.cookies) {\n\t\t\t\t\t\t\t\tfor (const [name, { value, options }] of metadata.cookies) {\n\t\t\t\t\t\t\t\t\tsetCookie(c, name, value, options);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Only publish events if configured (no global middleware overhead)\n\t\t\t\t\t\t\tif (features.hasEvents && Endpoint.isSuccessStatus(status)) {\n\t\t\t\t\t\t\t\tawait publishConstructEvents<any, any>(\n\t\t\t\t\t\t\t\t\tendpoint as any,\n\t\t\t\t\t\t\t\t\toutput,\n\t\t\t\t\t\t\t\t\tserviceDiscovery,\n\t\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (HonoEndpoint.isDev) {\n\t\t\t\t\t\t\t\tlogger.info({ status, body: output }, 'Outgoing response');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\treturn c.json(output, status);\n\t\t\t\t\t\t} catch (validationError: any) {\n\t\t\t\t\t\t\tlogger.error(validationError, 'Output validation failed');\n\t\t\t\t\t\t\tconst error = wrapError(\n\t\t\t\t\t\t\t\tvalidationError,\n\t\t\t\t\t\t\t\t422,\n\t\t\t\t\t\t\t\t'Response validation failed',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (HonoEndpoint.isDev) {\n\t\t\t\t\t\t\t\tlogger.info(\n\t\t\t\t\t\t\t\t\t{ status: error.statusCode, body: error },\n\t\t\t\t\t\t\t\t\t'Outgoing response',\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn c.json(error, error.statusCode as ContentfulStatusCode);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\tlogger.error(e, 'Error processing endpoint request');\n\t\t\t\t\t\tconst error = wrapError(e, 500, 'Internal Server Error');\n\t\t\t\t\t\tif (HonoEndpoint.isDev) {\n\t\t\t\t\t\t\tlogger.info(\n\t\t\t\t\t\t\t\t{ status: error.statusCode, body: error },\n\t\t\t\t\t\t\t\t'Outgoing response',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn c.json(error, error.statusCode as ContentfulStatusCode);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t);\n\t\t};\n\n\t\t// Register route with conditional validators\n\t\tapp[method](route, ...validators, handler);\n\t}\n\n\tstatic addDocsRoute<\n\t\tTServices extends Service[] = [],\n\t\tTLogger extends Logger = Logger,\n\t>(\n\t\tendpoints: Endpoint<string, HttpMethod, any, any, TServices, TLogger>[],\n\t\tapp: Hono,\n\t\tdocsPath: string,\n\t\topenApiOptions?: HonoEndpointOptions['openApiOptions'],\n\t): void {\n\t\tapp.get(docsPath, async (c) => {\n\t\t\ttry {\n\t\t\t\tconst openApiSchema = await Endpoint.buildOpenApiSchema(\n\t\t\t\t\tendpoints,\n\t\t\t\t\topenApiOptions,\n\t\t\t\t);\n\n\t\t\t\treturn c.json(openApiSchema);\n\t\t\t} catch {\n\t\t\t\treturn c.json(\n\t\t\t\t\t{ error: 'Failed to generate OpenAPI documentation' },\n\t\t\t\t\t500,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyEA,SAAS,wBACRA,UAgBmB;AACnB,QAAO;EACN,aAAa,SAAS,SAAS,SAAS;EACxC,eAAe,SAAS;EACxB,qBAAqB,SAAS,OAAO;EACrC,sBAAsB,SAAS,OAAO;EACtC,sBAAsB,SAAS,OAAO;EAEtC,YACE,SAAS,QAAQ,UAAU,KAAK,OAAO,SAAS;EAClD,YAAY,SAAS,QAAQ,UAAU,KAAK;EAC5C,gBAAgB,SAAS;EACzB,UAAU,SAAS,cAAc,SAAS;CAC1C;AACD;AAED,IAAa,eAAb,MAAa,aAkBX;CACD,YACkBC,UAgBhB;EAhBgB;CAgBd;CAEJ,OAAO,QAAQ,QAAQ,IAAI,aAAa;CAExC,aAAa,SACZC,GACAC,MACAC,QACC;AACD,OAAK,OACJ;EAGD,MAAM,SAAS,MAAM,0BAAS,SAAS,QAAQ,KAAK;AAEpD,MAAI,OAAO,OACV,QAAO,EAAE,KAAK,OAAO,QAAQ,IAAI;AAGlC,SAAO,OAAO;CACd;CACD,SACCC,kBACAC,KACO;AACP,eAAa,SAAS,KAAK,UAAU,kBAAkB,IAAI;CAC3D;;;;;;CAOD,OAAO,qBACNC,MACAC,mBACC,CAGD;CAED,aAAa,WACZC,QACAC,WACA,MAAM,IAAIC,aACVC,SACA,MAAM,QAAQ,KAAK,EACnBC,SACgB;EAChB,MAAM,YAAY,MAAM,uCAAkC,QAAQ,IAAI;EACtE,MAAM,mBACL,sCAAiB,YAAsC,UAAU;AAElE,eAAa,UAAU,WAAW,kBAAkB,KAAK,QAAQ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OAAO,MAAM,WAAmC;KAC9D;IACD,SAAQC,GAAQ;AAChB,YAAO,MAAM,GAAG,oCAAoC;KACpD,MAAM,QAAQ,kCAAU,GAAG,KAAK,wBAAwB;AACxD,SAAI,aAAa,MAChB,QAAO,KACN;MAAE,QAAQ,MAAM;MAAY,MAAM;KAAO,GACzC,oBACA;AAEF,YAAO,EAAE,KAAK,OAAO,MAAM,WAAmC;IAC9D;GACD,EACD;EACD;AAGD,MAAI,QAAQ,OAAO,GAAG,YAAY,QAAQ;CAC1C;CAED,OAAO,aAINT,WACAR,KACAkB,UACAC,gBACO;AACP,MAAI,IAAI,UAAU,OAAO,MAAM;AAC9B,OAAI;IACH,MAAM,gBAAgB,MAAM,0BAAS,mBACpC,WACA,eACA;AAED,WAAO,EAAE,KAAK,cAAc;GAC5B,QAAO;AACP,WAAO,EAAE,KACR,EAAE,OAAO,2CAA4C,GACrD,IACA;GACD;EACD,EAAC;CACF;AACD"}
1
+ {"version":3,"file":"HonoEndpointAdaptor-CavBd6P2.cjs","names":["endpoint: Endpoint<\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany\n\t>","endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditAction,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>","c: Context<any, string, {}>","data: unknown","schema?: T","serviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>>","app: Hono","_app: Hono","_serviceDiscovery: ServiceDiscovery<any>","routes: string[]","envParser: EnvironmentParser<{}>","Hono","_logger: TLogger","options?: HonoEndpointOptions","endpoints: Endpoint<string, HttpMethod, any, any, TServices, TLogger>[]","validators: any[]","c: Context","db: TDatabase | undefined","ResponseBuilder","metadata","output","result","validationError: any","e: any","docsPath: string","openApiOptions?: HonoEndpointOptions['openApiOptions']"],"sources":["../src/endpoints/HonoEndpointAdaptor.ts"],"sourcesContent":["import type { AuditableAction, AuditStorage } from '@geekmidas/audit';\nimport { withRlsContext } from '@geekmidas/db/rls';\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport { wrapError } from '@geekmidas/errors';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { checkRateLimit, getRateLimitHeaders } from '@geekmidas/rate-limit';\nimport {\n\trunWithRequestContext,\n\ttype Service,\n\tServiceDiscovery,\n\ttype ServiceRecord,\n} from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { type Context, Hono } from 'hono';\nimport { setCookie } from 'hono/cookie';\nimport { logger as honoLogger } from 'hono/logger';\nimport { timing } from 'hono/timing';\nimport type { ContentfulStatusCode } from 'hono/utils/http-status';\nimport { validator } from 'hono/validator';\nimport { publishConstructEvents } from '../publisher';\nimport type { HttpMethod, LowerHttpMethod } from '../types';\nimport type { MappedAudit } from './audit';\nimport {\n\tEndpoint,\n\ttype EndpointContext,\n\ttype EndpointSchemas,\n\tResponseBuilder,\n} from './Endpoint';\nimport { getEndpointsFromRoutes } from './helpers';\nimport { createHonoCookies, createHonoHeaders } from './lazyAccessors';\nimport { parseHonoQuery } from './parseHonoQuery';\nimport {\n\tcreateAuditContext,\n\texecuteWithAuditTransaction,\n} from './processAudits';\n\nexport interface HonoEndpointOptions {\n\t/**\n\t * Path where OpenAPI documentation will be served.\n\t * Set to false to disable docs route.\n\t * @default '/docs'\n\t */\n\tdocsPath?: string | false;\n\t/**\n\t * OpenAPI schema options\n\t */\n\topenApiOptions?: {\n\t\ttitle?: string;\n\t\tversion?: string;\n\t\tdescription?: string;\n\t};\n}\n\n/**\n * Feature flags for an endpoint, analyzed once at route registration time.\n * This avoids per-request feature detection overhead.\n */\ninterface EndpointFeatures {\n\thasServices: boolean;\n\thasDatabase: boolean;\n\thasBodyValidation: boolean;\n\thasQueryValidation: boolean;\n\thasParamValidation: boolean;\n\thasAudits: boolean;\n\thasEvents: boolean;\n\thasRateLimit: boolean;\n\thasRls: boolean;\n}\n\n/**\n * Analyze endpoint features at registration time (not per-request)\n */\nfunction analyzeEndpointFeatures(\n\tendpoint: Endpoint<\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany\n\t>,\n): EndpointFeatures {\n\treturn {\n\t\thasServices: endpoint.services.length > 0,\n\t\thasDatabase: !!endpoint.databaseService,\n\t\thasBodyValidation: !!endpoint.input?.body,\n\t\thasQueryValidation: !!endpoint.input?.query,\n\t\thasParamValidation: !!endpoint.input?.params,\n\t\t// Audit context needed if declarative audits OR auditor storage service configured (for manual audits)\n\t\thasAudits:\n\t\t\t(endpoint.audits?.length ?? 0) > 0 || !!endpoint.auditorStorageService,\n\t\thasEvents: (endpoint.events?.length ?? 0) > 0,\n\t\thasRateLimit: !!endpoint.rateLimit,\n\t\thasRls: !!endpoint.rlsConfig && !endpoint.rlsBypass,\n\t};\n}\n\nexport class HonoEndpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\tTEventPublisherServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> {\n\tconstructor(\n\t\tprivate readonly endpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditAction,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>,\n\t) {}\n\n\tstatic isDev = process.env.NODE_ENV === 'development';\n\n\tstatic async validate<T extends StandardSchemaV1>(\n\t\tc: Context<any, string, {}>,\n\t\tdata: unknown,\n\t\tschema?: T,\n\t) {\n\t\tif (!schema) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst parsed = await Endpoint.validate(schema, data);\n\n\t\tif (parsed.issues) {\n\t\t\treturn c.json(parsed.issues, 422);\n\t\t}\n\n\t\treturn parsed.value;\n\t}\n\taddRoute(\n\t\tserviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>>,\n\t\tapp: Hono,\n\t): void {\n\t\tHonoEndpoint.addRoute(this.endpoint, serviceDiscovery, app);\n\t}\n\n\t/**\n\t * @deprecated Global event middleware is no longer used.\n\t * Events are now published per-route only for endpoints that have events configured.\n\t * This method is kept for backward compatibility but does nothing.\n\t */\n\tstatic applyEventMiddleware(\n\t\t_app: Hono,\n\t\t_serviceDiscovery: ServiceDiscovery<any>,\n\t) {\n\t\t// No-op: Event publishing is now handled per-route in addRoute\n\t\t// This avoids running middleware on every request including 404s\n\t}\n\n\tstatic async fromRoutes<TLogger extends Logger, TServices extends Service[]>(\n\t\troutes: string[],\n\t\tenvParser: EnvironmentParser<{}>,\n\t\tapp = new Hono(),\n\t\t_logger: TLogger,\n\t\tcwd = process.cwd(),\n\t\toptions?: HonoEndpointOptions,\n\t): Promise<Hono> {\n\t\tconst endpoints = await getEndpointsFromRoutes<TServices>(routes, cwd);\n\t\tconst serviceDiscovery =\n\t\t\tServiceDiscovery.getInstance<ServiceRecord<TServices>>(envParser);\n\n\t\tHonoEndpoint.addRoutes(endpoints, serviceDiscovery, app, options);\n\n\t\treturn app;\n\t}\n\n\tstatic addRoutes<\n\t\tTServices extends Service[] = [],\n\t\tTLogger extends Logger = Logger,\n\t>(\n\t\tendpoints: Endpoint<string, HttpMethod, any, any, TServices, TLogger>[],\n\t\tserviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>>,\n\t\tapp: Hono,\n\t\toptions?: HonoEndpointOptions,\n\t): void {\n\t\t// Add timing middleware (always enabled)\n\t\tapp.use('*', timing());\n\n\t\t// Add logger middleware in development mode\n\n\t\tif (HonoEndpoint.isDev) {\n\t\t\tapp.use('*', honoLogger());\n\t\t}\n\n\t\t// Add docs route if not disabled\n\t\tconst docsPath =\n\t\t\toptions?.docsPath !== false ? options?.docsPath || '/docs' : null;\n\t\tif (docsPath) {\n\t\t\tHonoEndpoint.addDocsRoute(\n\t\t\t\tendpoints,\n\t\t\t\tapp,\n\t\t\t\tdocsPath,\n\t\t\t\toptions?.openApiOptions,\n\t\t\t);\n\t\t}\n\n\t\t// Sort endpoints to ensure static routes come before dynamic ones\n\t\tconst sortedEndpoints = endpoints.sort((a, b) => {\n\t\t\tconst aSegments = a.route.split('/');\n\t\t\tconst bSegments = b.route.split('/');\n\n\t\t\t// Compare each segment\n\t\t\tfor (let i = 0; i < Math.max(aSegments.length, bSegments.length); i++) {\n\t\t\t\tconst aSegment = aSegments[i] || '';\n\t\t\t\tconst bSegment = bSegments[i] || '';\n\n\t\t\t\t// If one is dynamic and the other is not, static comes first\n\t\t\t\tconst aIsDynamic = aSegment.startsWith(':');\n\t\t\t\tconst bIsDynamic = bSegment.startsWith(':');\n\n\t\t\t\tif (!aIsDynamic && bIsDynamic) return -1;\n\t\t\t\tif (aIsDynamic && !bIsDynamic) return 1;\n\n\t\t\t\t// If both are the same type, compare alphabetically\n\t\t\t\tif (aSegment !== bSegment) {\n\t\t\t\t\treturn aSegment.localeCompare(bSegment);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn 0;\n\t\t});\n\n\t\t// Note: Global event middleware removed for performance\n\t\t// Events are now published per-route only for endpoints with events configured\n\t\tfor (const endpoint of sortedEndpoints) {\n\t\t\tHonoEndpoint.addRoute(endpoint, serviceDiscovery, app);\n\t\t}\n\t}\n\n\tstatic addRoute<\n\t\tTRoute extends string,\n\t\tTMethod extends HttpMethod,\n\t\tTInput extends EndpointSchemas = {},\n\t\tTOutSchema extends StandardSchemaV1 | undefined = undefined,\n\t\tTServices extends Service[] = [],\n\t\tTLogger extends Logger = Logger,\n\t\tTSession = unknown,\n\t\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\t\tTEventPublisherServiceName extends string = string,\n\t\tTAuditStorage extends AuditStorage | undefined = undefined,\n\t\tTAuditStorageServiceName extends string = string,\n\t\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\t\tstring,\n\t\t\tunknown\n\t\t>,\n\t\tTDatabase = undefined,\n\t\tTDatabaseServiceName extends string = string,\n\t>(\n\t\tendpoint: Endpoint<\n\t\t\tTRoute,\n\t\t\tTMethod,\n\t\t\tTInput,\n\t\t\tTOutSchema,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTAuditStorage,\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditAction,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>,\n\t\tserviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>>,\n\t\tapp: Hono,\n\t): void {\n\t\tconst { route } = endpoint;\n\t\tconst method = endpoint.method.toLowerCase() as LowerHttpMethod<TMethod>;\n\n\t\t// Analyze endpoint features once at registration time (not per-request)\n\t\tconst features = analyzeEndpointFeatures(endpoint);\n\n\t\t// Build validators array - only add validators for schemas that exist\n\t\tconst validators: any[] = [];\n\n\t\tif (features.hasBodyValidation) {\n\t\t\tvalidators.push(\n\t\t\t\tvalidator('json', (value, c) =>\n\t\t\t\t\tHonoEndpoint.validate(c, value, endpoint.input?.body),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tif (features.hasQueryValidation) {\n\t\t\tvalidators.push(\n\t\t\t\tvalidator('query', (_, c) => {\n\t\t\t\t\tconst parsedQuery = parseHonoQuery(c);\n\t\t\t\t\treturn HonoEndpoint.validate(c, parsedQuery, endpoint.input?.query);\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\tif (features.hasParamValidation) {\n\t\t\tvalidators.push(\n\t\t\t\tvalidator('param', (params, c) =>\n\t\t\t\t\tHonoEndpoint.validate(c, params, endpoint.input?.params),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\t// Main handler\n\t\tconst handler = async (c: Context) => {\n\t\t\t// Request context setup\n\t\t\tconst startTime = Date.now();\n\t\t\tconst requestId = c.req.header('X-Request-ID') ?? crypto.randomUUID();\n\n\t\t\tconst logger = endpoint.logger.child({\n\t\t\t\trequestId,\n\t\t\t\tendpoint: endpoint.fullPath,\n\t\t\t\troute: endpoint.route,\n\t\t\t\thost: c.req.header('host'),\n\t\t\t\tmethod: endpoint.method,\n\t\t\t\tpath: c.req.path,\n\t\t\t}) as TLogger;\n\n\t\t\t// Set response header\n\t\t\tc.header('X-Request-ID', requestId);\n\n\t\t\t// Wrap entire handler in request context for services to access\n\t\t\treturn runWithRequestContext(\n\t\t\t\t{ logger, requestId, startTime },\n\t\t\t\tasync () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Lazy accessors - no upfront parsing, use native Hono methods\n\t\t\t\t\t\tconst header = createHonoHeaders(c);\n\t\t\t\t\t\tconst cookie = createHonoCookies(c);\n\n\t\t\t\t\t\t// Only register services if endpoint has any\n\t\t\t\t\t\tconst services = features.hasServices\n\t\t\t\t\t\t\t? await serviceDiscovery.register(endpoint.services)\n\t\t\t\t\t\t\t: ({} as ServiceRecord<TServices>);\n\n\t\t\t\t\t\t// Resolve database service only if configured\n\t\t\t\t\t\tconst rawDb = features.hasDatabase\n\t\t\t\t\t\t\t? await serviceDiscovery\n\t\t\t\t\t\t\t\t\t.register([endpoint.databaseService!])\n\t\t\t\t\t\t\t\t\t.then(\n\t\t\t\t\t\t\t\t\t\t(s) =>\n\t\t\t\t\t\t\t\t\t\t\ts[\n\t\t\t\t\t\t\t\t\t\t\t\tendpoint.databaseService?.serviceName as keyof typeof s\n\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\t// Extract session (defaults to empty object)\n\t\t\t\t\t\tconst session = await endpoint.getSession({\n\t\t\t\t\t\t\tservices,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\theader,\n\t\t\t\t\t\t\tcookie,\n\t\t\t\t\t\t\t...(rawDb !== undefined && { db: rawDb }),\n\t\t\t\t\t\t} as any);\n\n\t\t\t\t\t\t// Check authorization (defaults to true)\n\t\t\t\t\t\tconst isAuthorized = await endpoint.authorize({\n\t\t\t\t\t\t\theader,\n\t\t\t\t\t\t\tcookie,\n\t\t\t\t\t\t\tservices,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\tsession,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (!isAuthorized) {\n\t\t\t\t\t\t\tlogger.warn('Unauthorized access attempt');\n\t\t\t\t\t\t\treturn c.json({ error: 'Unauthorized' }, 401);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Check rate limit only if configured\n\t\t\t\t\t\tif (features.hasRateLimit) {\n\t\t\t\t\t\t\tconst rateLimitInfo = await checkRateLimit(endpoint.rateLimit!, {\n\t\t\t\t\t\t\t\theader,\n\t\t\t\t\t\t\t\tservices,\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\tsession,\n\t\t\t\t\t\t\t\tpath: c.req.path,\n\t\t\t\t\t\t\t\tmethod: endpoint.method,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst rateLimitHeaders = getRateLimitHeaders(\n\t\t\t\t\t\t\t\trateLimitInfo,\n\t\t\t\t\t\t\t\tendpoint.rateLimit!,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tfor (const [key, value] of Object.entries(rateLimitHeaders)) {\n\t\t\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\t\t\tc.header(key, value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Create audit context only if audits are configured\n\t\t\t\t\t\tconst auditContext = features.hasAudits\n\t\t\t\t\t\t\t? await createAuditContext(\n\t\t\t\t\t\t\t\t\tendpoint as any,\n\t\t\t\t\t\t\t\t\tserviceDiscovery,\n\t\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tsession,\n\t\t\t\t\t\t\t\t\t\theader,\n\t\t\t\t\t\t\t\t\t\tcookie,\n\t\t\t\t\t\t\t\t\t\tservices: services as Record<string, unknown>,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\tconst audits = features.hasAudits\n\t\t\t\t\t\t\t? (endpoint.audits as MappedAudit<TAuditAction, TOutSchema>[])\n\t\t\t\t\t\t\t: [];\n\n\t\t\t\t\t\t// Warn if declarative audits are configured but no audit storage\n\t\t\t\t\t\tif (features.hasAudits && !auditContext) {\n\t\t\t\t\t\t\tlogger.warn('No auditor storage service available');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Extract RLS context only if configured and not bypassed\n\t\t\t\t\t\tconst rlsContext =\n\t\t\t\t\t\t\tfeatures.hasRls && rawDb !== undefined\n\t\t\t\t\t\t\t\t? await endpoint.rlsConfig?.extractor({\n\t\t\t\t\t\t\t\t\t\tservices,\n\t\t\t\t\t\t\t\t\t\tsession: session as TSession,\n\t\t\t\t\t\t\t\t\t\theader,\n\t\t\t\t\t\t\t\t\t\tcookie,\n\t\t\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\t// Execute handler with automatic audit transaction support\n\t\t\t\t\t\tconst result = await executeWithAuditTransaction(\n\t\t\t\t\t\t\tauditContext,\n\t\t\t\t\t\t\tasync (auditor) => {\n\t\t\t\t\t\t\t\tconst sameDatabase =\n\t\t\t\t\t\t\t\t\tauditContext?.storage?.databaseServiceName &&\n\t\t\t\t\t\t\t\t\tauditContext.storage.databaseServiceName ===\n\t\t\t\t\t\t\t\t\t\tendpoint.databaseService?.serviceName;\n\t\t\t\t\t\t\t\tconst baseDb = sameDatabase\n\t\t\t\t\t\t\t\t\t? (auditor?.getTransaction?.() ?? rawDb)\n\t\t\t\t\t\t\t\t\t: rawDb;\n\n\t\t\t\t\t\t\t\tconst executeHandler = async (db: TDatabase | undefined) => {\n\t\t\t\t\t\t\t\t\tconst responseBuilder = new ResponseBuilder();\n\t\t\t\t\t\t\t\t\tconst response = await endpoint.handler(\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tservices,\n\t\t\t\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\t\t\t\tbody: features.hasBodyValidation\n\t\t\t\t\t\t\t\t\t\t\t\t? (c.req.valid as any)('json')\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t\t\t\tquery: features.hasQueryValidation\n\t\t\t\t\t\t\t\t\t\t\t\t? (c.req.valid as any)('query')\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t\t\t\tparams: features.hasParamValidation\n\t\t\t\t\t\t\t\t\t\t\t\t? (c.req.valid as any)('param')\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t\t\t\tsession,\n\t\t\t\t\t\t\t\t\t\t\theader,\n\t\t\t\t\t\t\t\t\t\t\tcookie,\n\t\t\t\t\t\t\t\t\t\t\tauditor,\n\t\t\t\t\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\t\t\t\t} as unknown as EndpointContext<\n\t\t\t\t\t\t\t\t\t\t\tTInput,\n\t\t\t\t\t\t\t\t\t\t\tTServices,\n\t\t\t\t\t\t\t\t\t\t\tTLogger,\n\t\t\t\t\t\t\t\t\t\t\tTSession,\n\t\t\t\t\t\t\t\t\t\t\tTAuditAction,\n\t\t\t\t\t\t\t\t\t\t\tTDatabase,\n\t\t\t\t\t\t\t\t\t\t\tTAuditStorage\n\t\t\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\t\t\tresponseBuilder,\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\tlet data = response;\n\t\t\t\t\t\t\t\t\tlet metadata = responseBuilder.getMetadata();\n\n\t\t\t\t\t\t\t\t\tif (Endpoint.hasMetadata(response)) {\n\t\t\t\t\t\t\t\t\t\tdata = response.data;\n\t\t\t\t\t\t\t\t\t\tmetadata = response.metadata;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tconst output = endpoint.outputSchema\n\t\t\t\t\t\t\t\t\t\t? await endpoint.parseOutput(data)\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\t\t\t\treturn { output, metadata, responseBuilder };\n\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\tif (features.hasRls && rlsContext && baseDb) {\n\t\t\t\t\t\t\t\t\treturn withRlsContext(\n\t\t\t\t\t\t\t\t\t\tbaseDb as any,\n\t\t\t\t\t\t\t\t\t\trlsContext,\n\t\t\t\t\t\t\t\t\t\tasync (trx) => executeHandler(trx as TDatabase),\n\t\t\t\t\t\t\t\t\t\t{ prefix: endpoint.rlsConfig?.prefix },\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn executeHandler(baseDb as TDatabase | undefined);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tasync (result, auditor) => {\n\t\t\t\t\t\t\t\tif (!audits?.length) return;\n\n\t\t\t\t\t\t\t\tfor (const audit of audits) {\n\t\t\t\t\t\t\t\t\tif (audit.when && !audit.when(result.output as any)) {\n\t\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tconst payload = audit.payload(result.output as any);\n\t\t\t\t\t\t\t\t\tconst entityId = audit.entityId?.(result.output as any);\n\t\t\t\t\t\t\t\t\tauditor.audit(audit.type as any, payload as any, {\n\t\t\t\t\t\t\t\t\t\ttable: audit.table,\n\t\t\t\t\t\t\t\t\t\tentityId,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ db: rawDb },\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst { output, metadata } = result;\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlet status = endpoint.status as ContentfulStatusCode;\n\n\t\t\t\t\t\t\tif (metadata.status) {\n\t\t\t\t\t\t\t\tstatus = metadata.status as ContentfulStatusCode;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (metadata.headers) {\n\t\t\t\t\t\t\t\tfor (const [key, value] of Object.entries(metadata.headers)) {\n\t\t\t\t\t\t\t\t\tc.header(key, value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (metadata.cookies) {\n\t\t\t\t\t\t\t\tfor (const [name, { value, options }] of metadata.cookies) {\n\t\t\t\t\t\t\t\t\tsetCookie(c, name, value, options);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Only publish events if configured (no global middleware overhead)\n\t\t\t\t\t\t\tif (features.hasEvents && Endpoint.isSuccessStatus(status)) {\n\t\t\t\t\t\t\t\tawait publishConstructEvents<any, any>(\n\t\t\t\t\t\t\t\t\tendpoint as any,\n\t\t\t\t\t\t\t\t\toutput,\n\t\t\t\t\t\t\t\t\tserviceDiscovery,\n\t\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (HonoEndpoint.isDev) {\n\t\t\t\t\t\t\t\tlogger.info({ status, body: output }, 'Outgoing response');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\treturn c.json(output, status);\n\t\t\t\t\t\t} catch (validationError: any) {\n\t\t\t\t\t\t\tlogger.error(validationError, 'Output validation failed');\n\t\t\t\t\t\t\tconst error = wrapError(\n\t\t\t\t\t\t\t\tvalidationError,\n\t\t\t\t\t\t\t\t422,\n\t\t\t\t\t\t\t\t'Response validation failed',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (HonoEndpoint.isDev) {\n\t\t\t\t\t\t\t\tlogger.info(\n\t\t\t\t\t\t\t\t\t{ status: error.statusCode, body: error },\n\t\t\t\t\t\t\t\t\t'Outgoing response',\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn c.json(error, error.statusCode as ContentfulStatusCode);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\tlogger.error(e, 'Error processing endpoint request');\n\t\t\t\t\t\tconst error = wrapError(e, 500, 'Internal Server Error');\n\t\t\t\t\t\tif (HonoEndpoint.isDev) {\n\t\t\t\t\t\t\tlogger.info(\n\t\t\t\t\t\t\t\t{ status: error.statusCode, body: error },\n\t\t\t\t\t\t\t\t'Outgoing response',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn c.json(error, error.statusCode as ContentfulStatusCode);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t);\n\t\t};\n\n\t\t// Register route with conditional validators\n\t\tapp[method](route, ...validators, handler);\n\t}\n\n\tstatic addDocsRoute<\n\t\tTServices extends Service[] = [],\n\t\tTLogger extends Logger = Logger,\n\t>(\n\t\tendpoints: Endpoint<string, HttpMethod, any, any, TServices, TLogger>[],\n\t\tapp: Hono,\n\t\tdocsPath: string,\n\t\topenApiOptions?: HonoEndpointOptions['openApiOptions'],\n\t): void {\n\t\tapp.get(docsPath, async (c) => {\n\t\t\ttry {\n\t\t\t\tconst openApiSchema = await Endpoint.buildOpenApiSchema(\n\t\t\t\t\tendpoints,\n\t\t\t\t\topenApiOptions,\n\t\t\t\t);\n\n\t\t\t\treturn c.json(openApiSchema);\n\t\t\t} catch {\n\t\t\t\treturn c.json(\n\t\t\t\t\t{ error: 'Failed to generate OpenAPI documentation' },\n\t\t\t\t\t500,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyEA,SAAS,wBACRA,UAgBmB;AACnB,QAAO;EACN,aAAa,SAAS,SAAS,SAAS;EACxC,eAAe,SAAS;EACxB,qBAAqB,SAAS,OAAO;EACrC,sBAAsB,SAAS,OAAO;EACtC,sBAAsB,SAAS,OAAO;EAEtC,YACE,SAAS,QAAQ,UAAU,KAAK,OAAO,SAAS;EAClD,YAAY,SAAS,QAAQ,UAAU,KAAK;EAC5C,gBAAgB,SAAS;EACzB,UAAU,SAAS,cAAc,SAAS;CAC1C;AACD;AAED,IAAa,eAAb,MAAa,aAkBX;CACD,YACkBC,UAgBhB;EAhBgB;CAgBd;CAEJ,OAAO,QAAQ,QAAQ,IAAI,aAAa;CAExC,aAAa,SACZC,GACAC,MACAC,QACC;AACD,OAAK,OACJ;EAGD,MAAM,SAAS,MAAM,0BAAS,SAAS,QAAQ,KAAK;AAEpD,MAAI,OAAO,OACV,QAAO,EAAE,KAAK,OAAO,QAAQ,IAAI;AAGlC,SAAO,OAAO;CACd;CAC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ACA;AAGF,UAAI,aAAa,MAChB,QAAO,KAAK;OAAE;OAAQ,MAAM;MAAQ,GAAE,oBAAoB;AAI3D,aAAO,EAAE,KAAK,QAAQ,OAAO;KAC7B,SAAQC,iBAAsB;AAC9B,aAAO,MAAM,iBAAiB,2BAA2B;MACzD,MAAM,QAAQ,kCACb,iBACA,KACA,6BACA;AACD,UAAI,aAAa,MAChB,QAAO,KACN;OAAE,QAAQ,MAAM;OAAY,MAAM;MAAO,GACzC,oBACA;AAEF,aAAO,EAAE,KAAK,OAAO,MAAM,WAAmC;KAC9D;IACD,SAAQC,GAAQ;AAChB,YAAO,MAAM,GAAG,oCAAoC;KACpD,MAAM,QAAQ,kCAAU,GAAG,KAAK,wBAAwB;AACxD,SAAI,aAAa,MAChB,QAAO,KACN;MAAE,QAAQ,MAAM;MAAY,MAAM;KAAO,GACzC,oBACA;AAEF,YAAO,EAAE,KAAK,OAAO,MAAM,WAAmC;IAC9D;GACD,EACD;EACD;AAGD,MAAI,QAAQ,OAAO,GAAG,YAAY,QAAQ;CAC1C;CAED,OAAO,aAINT,WACAR,KACAkB,UACAC,gBACO;AACP,MAAI,IAAI,UAAU,OAAO,MAAM;AAC9B,OAAI;IACH,MAAM,gBAAgB,MAAM,0BAAS,mBACpC,WACA,eACA;AAED,WAAO,EAAE,KAAK,cAAc;GAC5B,QAAO;AACP,WAAO,EAAE,KACR,EAAE,OAAO,2CAA4C,GACrD,IACA;GACD;EACD,EAAC;CACF;AACD"}
@@ -1,15 +1,15 @@
1
1
  import { publishConstructEvents } from "./publisher-Bw4770Hi.mjs";
2
2
  import { Endpoint, ResponseBuilder } from "./Endpoint-DvY3aqAy.mjs";
3
3
  import { createAuditContext, executeWithAuditTransaction } from "./processAudits-Dj8UGqcW.mjs";
4
- import { getEndpointsFromRoutes } from "./helpers-C5j_GRBz.mjs";
5
- import { createHonoCookies, createHonoHeaders } from "./lazyAccessors-B-Jgkg2o.mjs";
4
+ import { createHonoCookies, createHonoHeaders } from "./lazyAccessors-DM6HcXQk.mjs";
5
+ import { getEndpointsFromRoutes } from "./helpers-BtwC2IW8.mjs";
6
6
  import { parseHonoQuery } from "./parseHonoQuery-DpK3sGPc.mjs";
7
7
  import { withRlsContext } from "@geekmidas/db/rls";
8
8
  import { wrapError } from "@geekmidas/errors";
9
9
  import { ServiceDiscovery, runWithRequestContext } from "@geekmidas/services";
10
+ import { setCookie } from "hono/cookie";
10
11
  import { checkRateLimit, getRateLimitHeaders } from "@geekmidas/rate-limit";
11
12
  import { Hono } from "hono";
12
- import { setCookie } from "hono/cookie";
13
13
  import { logger } from "hono/logger";
14
14
  import { timing } from "hono/timing";
15
15
  import { validator } from "hono/validator";
@@ -248,4 +248,4 @@ var HonoEndpoint = class HonoEndpoint {
248
248
 
249
249
  //#endregion
250
250
  export { HonoEndpoint };
251
- //# sourceMappingURL=HonoEndpointAdaptor-CNlb-KGz.mjs.map
251
+ //# sourceMappingURL=HonoEndpointAdaptor-y9fCIxaz.mjs.map