@geekmidas/constructs 0.3.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AWSLambdaFunction-EPGY4s7i.cjs → AWSLambdaFunction-Ba1DcsW2.cjs} +6 -6
- package/dist/AWSLambdaFunction-Ba1DcsW2.cjs.map +1 -0
- package/dist/{AWSLambdaFunction-BdebRMUh.d.mts → AWSLambdaFunction-CKe73Qr0.d.cts} +6 -6
- package/dist/AWSLambdaFunction-CKe73Qr0.d.cts.map +1 -0
- package/dist/{AWSLambdaFunction-D0tEOTXQ.d.cts → AWSLambdaFunction-CuG3HNZx.d.mts} +6 -6
- package/dist/AWSLambdaFunction-CuG3HNZx.d.mts.map +1 -0
- package/dist/{AWSLambdaFunction-C54a1doJ.mjs → AWSLambdaFunction-DnMm4xvz.mjs} +6 -6
- package/dist/AWSLambdaFunction-DnMm4xvz.mjs.map +1 -0
- package/dist/{AWSLambdaSubscriberAdaptor-Dx-Ks1Jp.d.cts → AWSLambdaSubscriberAdaptor-B4HH-WuQ.d.mts} +4 -4
- package/dist/AWSLambdaSubscriberAdaptor-B4HH-WuQ.d.mts.map +1 -0
- package/dist/{AWSLambdaSubscriberAdaptor-BLfO612H.mjs → AWSLambdaSubscriberAdaptor-BD3FwGUb.mjs} +3 -3
- package/dist/AWSLambdaSubscriberAdaptor-BD3FwGUb.mjs.map +1 -0
- package/dist/{AWSLambdaSubscriberAdaptor-DrFAvHOp.d.mts → AWSLambdaSubscriberAdaptor-BEqQ96VJ.d.cts} +4 -4
- package/dist/AWSLambdaSubscriberAdaptor-BEqQ96VJ.d.cts.map +1 -0
- package/dist/{AWSLambdaSubscriberAdaptor-BNcYYZ-P.cjs → AWSLambdaSubscriberAdaptor-DQDnt1Xk.cjs} +3 -3
- package/dist/AWSLambdaSubscriberAdaptor-DQDnt1Xk.cjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-BT9JXihC.mjs → AmazonApiGatewayEndpointAdaptor-Bvy-Hgjf.mjs} +56 -14
- package/dist/AmazonApiGatewayEndpointAdaptor-Bvy-Hgjf.mjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-DNFvvdmW.cjs → AmazonApiGatewayEndpointAdaptor-Cpxluhfg.cjs} +55 -13
- package/dist/AmazonApiGatewayEndpointAdaptor-Cpxluhfg.cjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-qlKXuZxy.d.mts → AmazonApiGatewayEndpointAdaptor-DTgdZ8I1.d.mts} +52 -6
- package/dist/AmazonApiGatewayEndpointAdaptor-DTgdZ8I1.d.mts.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-DLqnYQ4E.d.cts → AmazonApiGatewayEndpointAdaptor-DsWnO6x9.d.cts} +51 -5
- package/dist/AmazonApiGatewayEndpointAdaptor-DsWnO6x9.d.cts.map +1 -0
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-DyUaJIhB.d.cts → AmazonApiGatewayV1EndpointAdaptor-7ELXUBFK.d.cts} +4 -4
- package/dist/AmazonApiGatewayV1EndpointAdaptor-7ELXUBFK.d.cts.map +1 -0
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-Ccl8B8kG.cjs → AmazonApiGatewayV1EndpointAdaptor-B8vIYYNh.cjs} +4 -4
- package/dist/AmazonApiGatewayV1EndpointAdaptor-B8vIYYNh.cjs.map +1 -0
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-CShQI8Gk.mjs → AmazonApiGatewayV1EndpointAdaptor-ByXGIju8.mjs} +4 -4
- package/dist/AmazonApiGatewayV1EndpointAdaptor-ByXGIju8.mjs.map +1 -0
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-MRUxs3Xi.d.mts → AmazonApiGatewayV1EndpointAdaptor-RWRmFPrN.d.mts} +5 -5
- package/dist/AmazonApiGatewayV1EndpointAdaptor-RWRmFPrN.d.mts.map +1 -0
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-D8-0Aab4.cjs → AmazonApiGatewayV2EndpointAdaptor-DIetspUm.cjs} +4 -4
- package/dist/AmazonApiGatewayV2EndpointAdaptor-DIetspUm.cjs.map +1 -0
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-lCRzGE4q.mjs → AmazonApiGatewayV2EndpointAdaptor-DWemCZvl.mjs} +4 -4
- package/dist/AmazonApiGatewayV2EndpointAdaptor-DWemCZvl.mjs.map +1 -0
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-M1-w0U5R.d.cts → AmazonApiGatewayV2EndpointAdaptor-D_uMTmuJ.d.cts} +4 -6
- package/dist/AmazonApiGatewayV2EndpointAdaptor-D_uMTmuJ.d.cts.map +1 -0
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-fuLM6M9k.d.mts → AmazonApiGatewayV2EndpointAdaptor-wnOMDv6o.d.mts} +5 -7
- package/dist/AmazonApiGatewayV2EndpointAdaptor-wnOMDv6o.d.mts.map +1 -0
- package/dist/{Authorizer-C0ge_tc8.cjs → Authorizer-BXxBee2P.cjs} +1 -1
- package/dist/Authorizer-BXxBee2P.cjs.map +1 -0
- package/dist/{Authorizer-r9U3y_ms.mjs → Authorizer-BgjU8-z6.mjs} +1 -1
- package/dist/Authorizer-BgjU8-z6.mjs.map +1 -0
- package/dist/{Authorizer-gWxYsGEp.d.mts → Authorizer-DCcYOx3h.d.mts} +1 -1
- package/dist/Authorizer-DCcYOx3h.d.mts.map +1 -0
- package/dist/{Authorizer-B-btowNd.d.cts → Authorizer-DWtwC8we.d.cts} +1 -1
- package/dist/Authorizer-DWtwC8we.d.cts.map +1 -0
- package/dist/{BaseFunctionBuilder-Czi1Jwza.mjs → BaseFunctionBuilder-0qlenb9z.mjs} +2 -2
- package/dist/BaseFunctionBuilder-0qlenb9z.mjs.map +1 -0
- package/dist/BaseFunctionBuilder-BAtutR6q.d.cts.map +1 -1
- package/dist/{BaseFunctionBuilder-DRY419e7.d.mts → BaseFunctionBuilder-CDfDWWAQ.d.mts} +2 -2
- package/dist/BaseFunctionBuilder-CDfDWWAQ.d.mts.map +1 -0
- package/dist/{BaseFunctionBuilder-MYG3C9ug.cjs → BaseFunctionBuilder-D7o93EGv.cjs} +2 -2
- package/dist/BaseFunctionBuilder-D7o93EGv.cjs.map +1 -0
- package/dist/{Construct-Ba5cMxib.cjs → Construct-BlnyYtJC.cjs} +31 -2
- package/dist/Construct-BlnyYtJC.cjs.map +1 -0
- package/dist/Construct-C4rPE67v.d.cts.map +1 -1
- package/dist/{Construct-DdyGHuag.mjs → Construct-D5dCvxZ3.mjs} +31 -2
- package/dist/Construct-D5dCvxZ3.mjs.map +1 -0
- package/dist/{Construct-XrijZFFh.d.mts → Construct-dZiwVo0q.d.mts} +1 -1
- package/dist/Construct-dZiwVo0q.d.mts.map +1 -0
- package/dist/Construct.cjs +1 -1
- package/dist/Construct.d.mts +1 -1
- package/dist/Construct.mjs +1 -1
- package/dist/{Cron-bDLcTvV5.d.cts → Cron-B6FnTu7k.d.cts} +2 -2
- package/dist/Cron-B6FnTu7k.d.cts.map +1 -0
- package/dist/{Cron-CGF4YAfM.cjs → Cron-BAPQetlC.cjs} +3 -3
- package/dist/Cron-BAPQetlC.cjs.map +1 -0
- package/dist/{Cron-BxhGs5up.mjs → Cron-CAk_ddH8.mjs} +3 -3
- package/dist/Cron-CAk_ddH8.mjs.map +1 -0
- package/dist/{Cron-cdjlSKNp.d.mts → Cron-D3bEljxQ.d.mts} +2 -2
- package/dist/Cron-D3bEljxQ.d.mts.map +1 -0
- package/dist/{CronBuilder-DKVXyE0Q.d.cts → CronBuilder-CA8euP0z.d.cts} +4 -4
- package/dist/CronBuilder-CA8euP0z.d.cts.map +1 -0
- package/dist/{CronBuilder-BC4m5-p1.d.mts → CronBuilder-DvdiKzhq.d.mts} +4 -4
- package/dist/CronBuilder-DvdiKzhq.d.mts.map +1 -0
- package/dist/{CronBuilder-CcxKRtVP.cjs → CronBuilder-DxXA5ymv.cjs} +4 -4
- package/dist/CronBuilder-DxXA5ymv.cjs.map +1 -0
- package/dist/{CronBuilder-d2jh-IB2.mjs → CronBuilder-e8TaHPYm.mjs} +4 -4
- package/dist/CronBuilder-e8TaHPYm.mjs.map +1 -0
- package/dist/{Endpoint-BPv9_-m_.d.cts → Endpoint-BOlbY5iq.d.cts} +3 -3
- package/dist/Endpoint-BOlbY5iq.d.cts.map +1 -0
- package/dist/{Endpoint-CuOEswxJ.mjs → Endpoint-BbdNmtlM.mjs} +6 -6
- package/dist/Endpoint-BbdNmtlM.mjs.map +1 -0
- package/dist/{Endpoint-BdwG75G_.d.mts → Endpoint-Dlv7nxgj.d.mts} +4 -4
- package/dist/Endpoint-Dlv7nxgj.d.mts.map +1 -0
- package/dist/{Endpoint-BVGZXFyV.cjs → Endpoint-DxvnlfXg.cjs} +6 -6
- package/dist/Endpoint-DxvnlfXg.cjs.map +1 -0
- package/dist/{EndpointBuilder-Cgj1P_ra.cjs → EndpointBuilder-40Iz5CjY.cjs} +6 -6
- package/dist/EndpointBuilder-40Iz5CjY.cjs.map +1 -0
- package/dist/{EndpointBuilder-DnCB1h1j.mjs → EndpointBuilder-BaVvhW9m.mjs} +6 -6
- package/dist/EndpointBuilder-BaVvhW9m.mjs.map +1 -0
- package/dist/{EndpointBuilder-DIy_m1bu.d.cts → EndpointBuilder-CFfWWjUa.d.cts} +3 -3
- package/dist/EndpointBuilder-CFfWWjUa.d.cts.map +1 -0
- package/dist/{EndpointBuilder-B3az942t.d.mts → EndpointBuilder-T_K2NLWw.d.mts} +5 -5
- package/dist/EndpointBuilder-T_K2NLWw.d.mts.map +1 -0
- package/dist/{EndpointFactory-CyPbm3AD.d.cts → EndpointFactory-ChzBVEM9.d.cts} +4 -4
- package/dist/EndpointFactory-ChzBVEM9.d.cts.map +1 -0
- package/dist/{EndpointFactory-CbdxPCIH.mjs → EndpointFactory-DfNjSgVG.mjs} +7 -7
- package/dist/EndpointFactory-DfNjSgVG.mjs.map +1 -0
- package/dist/{EndpointFactory-C-0nE6Jg.d.mts → EndpointFactory-GAL_tuPf.d.mts} +4 -4
- package/dist/EndpointFactory-GAL_tuPf.d.mts.map +1 -0
- package/dist/{EndpointFactory-CYj6BYok.cjs → EndpointFactory-r6jxPvQ8.cjs} +7 -7
- package/dist/EndpointFactory-r6jxPvQ8.cjs.map +1 -0
- package/dist/{Function-BVHqIDp9.mjs → Function-D8tBamM3.mjs} +3 -3
- package/dist/Function-D8tBamM3.mjs.map +1 -0
- package/dist/{Function-DN2G6OT5.d.mts → Function-DBmU3uGI.d.mts} +3 -3
- package/dist/Function-DBmU3uGI.d.mts.map +1 -0
- package/dist/{Function-Cf7f_kCz.d.cts → Function-PNW4HdNE.d.cts} +2 -2
- package/dist/Function-PNW4HdNE.d.cts.map +1 -0
- package/dist/{Function-DDZb1525.cjs → Function-iLKrUXuw.cjs} +3 -3
- package/dist/Function-iLKrUXuw.cjs.map +1 -0
- package/dist/{FunctionBuilder-DswJ-9sD.cjs → FunctionBuilder-BEpPgeho.cjs} +4 -4
- package/dist/FunctionBuilder-BEpPgeho.cjs.map +1 -0
- package/dist/{FunctionBuilder-Cxx8D2na.d.mts → FunctionBuilder-Bv4H2I1a.d.mts} +4 -4
- package/dist/FunctionBuilder-Bv4H2I1a.d.mts.map +1 -0
- package/dist/{FunctionBuilder-CrDYgfiI.mjs → FunctionBuilder-BwNF99AB.mjs} +4 -4
- package/dist/FunctionBuilder-BwNF99AB.mjs.map +1 -0
- package/dist/{FunctionBuilder-CJBzzXL3.d.cts → FunctionBuilder-DCqXIHaq.d.cts} +2 -2
- package/dist/FunctionBuilder-DCqXIHaq.d.cts.map +1 -0
- package/dist/{FunctionExecutionWrapper-CLDh7Z2_.mjs → FunctionExecutionWrapper-B__HE_B-.mjs} +3 -3
- package/dist/FunctionExecutionWrapper-B__HE_B-.mjs.map +1 -0
- package/dist/{FunctionExecutionWrapper-DF260Aaj.d.mts → FunctionExecutionWrapper-BclgIztn.d.cts} +5 -5
- package/dist/FunctionExecutionWrapper-BclgIztn.d.cts.map +1 -0
- package/dist/{FunctionExecutionWrapper-BYI2bGTL.cjs → FunctionExecutionWrapper-BjF6t9Hb.cjs} +3 -3
- package/dist/FunctionExecutionWrapper-BjF6t9Hb.cjs.map +1 -0
- package/dist/{FunctionExecutionWrapper-Qy8bmgFR.d.cts → FunctionExecutionWrapper-Dq21c6vt.d.mts} +5 -5
- package/dist/FunctionExecutionWrapper-Dq21c6vt.d.mts.map +1 -0
- package/dist/HonoEndpointAdaptor-C_ym_Sbr.mjs +251 -0
- package/dist/HonoEndpointAdaptor-C_ym_Sbr.mjs.map +1 -0
- package/dist/HonoEndpointAdaptor-DiQH0eTb.cjs +257 -0
- package/dist/HonoEndpointAdaptor-DiQH0eTb.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-YcRHYALH.d.cts → HonoEndpointAdaptor-Dkkemmbo.d.cts} +10 -5
- package/dist/HonoEndpointAdaptor-Dkkemmbo.d.cts.map +1 -0
- package/dist/{HonoEndpointAdaptor-BaPlUhz0.d.mts → HonoEndpointAdaptor-HukjdF6M.d.mts} +11 -6
- package/dist/HonoEndpointAdaptor-HukjdF6M.d.mts.map +1 -0
- package/dist/{Subscriber-COYMSevD.d.cts → Subscriber--zUjZDR6.d.cts} +1 -1
- package/dist/Subscriber--zUjZDR6.d.cts.map +1 -0
- package/dist/{Subscriber-ikctpU3I.d.mts → Subscriber-0Ac7cXID.d.mts} +2 -2
- package/dist/Subscriber-0Ac7cXID.d.mts.map +1 -0
- package/dist/{Subscriber-BmPf9GFb.mjs → Subscriber-BgZ8T-O2.mjs} +2 -2
- package/dist/Subscriber-BgZ8T-O2.mjs.map +1 -0
- package/dist/{Subscriber-BiHjVXtM.cjs → Subscriber-CoFmHMIM.cjs} +2 -2
- package/dist/Subscriber-CoFmHMIM.cjs.map +1 -0
- package/dist/{SubscriberBuilder-D_9zzllj.d.mts → SubscriberBuilder-D8cmUHee.d.mts} +2 -2
- package/dist/SubscriberBuilder-D8cmUHee.d.mts.map +1 -0
- package/dist/{SubscriberBuilder-DJPEeYDJ.mjs → SubscriberBuilder-DWXWZBPo.mjs} +2 -2
- package/dist/SubscriberBuilder-DWXWZBPo.mjs.map +1 -0
- package/dist/{SubscriberBuilder-ivHAGIVi.d.cts → SubscriberBuilder-DciTqb-7.d.cts} +2 -2
- package/dist/SubscriberBuilder-DciTqb-7.d.cts.map +1 -0
- package/dist/{SubscriberBuilder-Cp1C-xtT.cjs → SubscriberBuilder-JlxhyqGp.cjs} +2 -2
- package/dist/SubscriberBuilder-JlxhyqGp.cjs.map +1 -0
- package/dist/{TestEndpointAdaptor-DB7bREhS.d.mts → TestEndpointAdaptor-Boijwbmz.d.mts} +4 -4
- package/dist/TestEndpointAdaptor-Boijwbmz.d.mts.map +1 -0
- package/dist/{TestEndpointAdaptor-C10xBI--.d.cts → TestEndpointAdaptor-DdwpRyNh.d.cts} +3 -3
- package/dist/TestEndpointAdaptor-DdwpRyNh.d.cts.map +1 -0
- package/dist/TestEndpointAdaptor-Dk75ExxE.cjs +176 -0
- package/dist/TestEndpointAdaptor-Dk75ExxE.cjs.map +1 -0
- package/dist/TestEndpointAdaptor-OiA2JLDp.mjs +170 -0
- package/dist/TestEndpointAdaptor-OiA2JLDp.mjs.map +1 -0
- package/dist/adaptors/aws.cjs +12 -12
- package/dist/adaptors/aws.d.cts +13 -12
- package/dist/adaptors/aws.d.mts +16 -15
- package/dist/adaptors/aws.mjs +12 -12
- package/dist/adaptors/hono.cjs +10 -9
- package/dist/adaptors/hono.d.cts +6 -6
- package/dist/adaptors/hono.d.mts +9 -9
- package/dist/adaptors/hono.mjs +10 -9
- package/dist/adaptors/testing.cjs +8 -7
- package/dist/adaptors/testing.d.cts +6 -6
- package/dist/adaptors/testing.d.mts +9 -9
- package/dist/adaptors/testing.mjs +8 -7
- package/dist/crons/Cron.cjs +6 -6
- package/dist/crons/Cron.d.cts +4 -4
- package/dist/crons/Cron.d.mts +6 -6
- package/dist/crons/Cron.mjs +6 -6
- package/dist/crons/CronBuilder.cjs +7 -7
- package/dist/crons/CronBuilder.d.cts +5 -5
- package/dist/crons/CronBuilder.d.mts +7 -7
- package/dist/crons/CronBuilder.mjs +7 -7
- package/dist/crons/index.cjs +7 -7
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +9 -9
- package/dist/crons/index.d.mts +7 -7
- package/dist/crons/index.mjs +7 -7
- package/dist/crons/index.mjs.map +1 -1
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +7 -7
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +8 -7
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +11 -10
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +7 -7
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +8 -8
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +8 -7
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +11 -10
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +8 -8
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +8 -8
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +9 -8
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +12 -11
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +8 -8
- package/dist/endpoints/Authorizer.cjs +1 -1
- package/dist/endpoints/Authorizer.d.cts +1 -1
- package/dist/endpoints/Authorizer.d.mts +1 -1
- package/dist/endpoints/Authorizer.mjs +1 -1
- package/dist/endpoints/Endpoint.cjs +6 -6
- package/dist/endpoints/Endpoint.d.cts +5 -5
- package/dist/endpoints/Endpoint.d.mts +8 -8
- package/dist/endpoints/Endpoint.mjs +6 -6
- package/dist/endpoints/EndpointBuilder.cjs +9 -9
- package/dist/endpoints/EndpointBuilder.d.cts +6 -6
- package/dist/endpoints/EndpointBuilder.d.mts +9 -9
- package/dist/endpoints/EndpointBuilder.mjs +9 -9
- package/dist/endpoints/EndpointFactory.cjs +10 -10
- package/dist/endpoints/EndpointFactory.d.cts +7 -7
- package/dist/endpoints/EndpointFactory.d.mts +10 -10
- package/dist/endpoints/EndpointFactory.mjs +10 -10
- package/dist/endpoints/HonoEndpointAdaptor.cjs +10 -9
- package/dist/endpoints/HonoEndpointAdaptor.d.cts +6 -6
- package/dist/endpoints/HonoEndpointAdaptor.d.mts +9 -9
- package/dist/endpoints/HonoEndpointAdaptor.mjs +10 -9
- package/dist/endpoints/TestEndpointAdaptor.cjs +8 -7
- package/dist/endpoints/TestEndpointAdaptor.d.cts +6 -6
- package/dist/endpoints/TestEndpointAdaptor.d.mts +9 -9
- package/dist/endpoints/TestEndpointAdaptor.mjs +8 -7
- package/dist/endpoints/audit.d.cts +5 -5
- package/dist/endpoints/audit.d.mts +8 -8
- package/dist/endpoints/helpers.cjs +7 -7
- package/dist/endpoints/helpers.d.cts +5 -5
- package/dist/endpoints/helpers.d.cts.map +1 -1
- package/dist/endpoints/helpers.d.mts +8 -8
- package/dist/endpoints/helpers.d.mts.map +1 -1
- package/dist/endpoints/helpers.mjs +7 -7
- package/dist/endpoints/index.cjs +20 -10
- package/dist/endpoints/index.cjs.map +1 -1
- package/dist/endpoints/index.d.cts +12 -10
- package/dist/endpoints/index.d.cts.map +1 -1
- package/dist/endpoints/index.d.mts +15 -13
- package/dist/endpoints/index.d.mts.map +1 -1
- package/dist/endpoints/index.mjs +13 -11
- package/dist/endpoints/index.mjs.map +1 -1
- package/dist/endpoints/lazyAccessors.cjs +10 -0
- package/dist/endpoints/lazyAccessors.d.cts +10 -0
- package/dist/endpoints/lazyAccessors.d.mts +10 -0
- package/dist/endpoints/lazyAccessors.mjs +3 -0
- package/dist/endpoints/parseHonoQuery.cjs +1 -1
- package/dist/endpoints/parseHonoQuery.mjs +1 -1
- package/dist/endpoints/parseQueryParams.d.cts.map +1 -1
- package/dist/endpoints/parseQueryParams.d.mts.map +1 -1
- package/dist/endpoints/processAudits.d.cts +5 -5
- package/dist/endpoints/processAudits.d.cts.map +1 -1
- package/dist/endpoints/processAudits.d.mts +8 -8
- package/dist/endpoints/processAudits.d.mts.map +1 -1
- package/dist/endpoints/rls.cjs +1 -1
- package/dist/endpoints/rls.d.cts +5 -5
- package/dist/endpoints/rls.d.mts +8 -8
- package/dist/endpoints/rls.mjs +1 -1
- package/dist/functions/AWSLambdaFunction.cjs +6 -6
- package/dist/functions/AWSLambdaFunction.d.cts +3 -3
- package/dist/functions/AWSLambdaFunction.d.mts +4 -4
- package/dist/functions/AWSLambdaFunction.mjs +6 -6
- package/dist/functions/BaseFunctionBuilder.cjs +2 -2
- package/dist/functions/BaseFunctionBuilder.d.mts +2 -2
- package/dist/functions/BaseFunctionBuilder.mjs +2 -2
- package/dist/functions/Function.cjs +2 -2
- package/dist/functions/Function.d.cts +1 -1
- package/dist/functions/Function.d.mts +2 -2
- package/dist/functions/Function.mjs +2 -2
- package/dist/functions/FunctionBuilder.cjs +4 -4
- package/dist/functions/FunctionBuilder.d.cts +2 -2
- package/dist/functions/FunctionBuilder.d.mts +4 -4
- package/dist/functions/FunctionBuilder.mjs +4 -4
- package/dist/functions/FunctionExecutionWrapper.cjs +5 -5
- package/dist/functions/FunctionExecutionWrapper.d.cts +2 -2
- package/dist/functions/FunctionExecutionWrapper.d.mts +3 -3
- package/dist/functions/FunctionExecutionWrapper.mjs +5 -5
- package/dist/functions/TestFunctionAdaptor.cjs +7 -7
- package/dist/functions/TestFunctionAdaptor.cjs.map +1 -1
- package/dist/functions/TestFunctionAdaptor.d.cts +2 -2
- package/dist/functions/TestFunctionAdaptor.d.cts.map +1 -1
- package/dist/functions/TestFunctionAdaptor.d.mts +3 -3
- package/dist/functions/TestFunctionAdaptor.d.mts.map +1 -1
- package/dist/functions/TestFunctionAdaptor.mjs +7 -7
- package/dist/functions/TestFunctionAdaptor.mjs.map +1 -1
- package/dist/functions/index.cjs +5 -5
- package/dist/functions/index.d.cts +3 -3
- package/dist/functions/index.d.mts +5 -5
- package/dist/functions/index.mjs +5 -5
- package/dist/{functions-fTid0RMK.cjs → functions-BkKXVeHm.cjs} +2 -2
- package/dist/functions-BkKXVeHm.cjs.map +1 -0
- package/dist/functions-C3A1vMRW.mjs +8 -0
- package/dist/functions-C3A1vMRW.mjs.map +1 -0
- package/dist/{helpers-BcP1tXAi.cjs → helpers-BelEzV4U.cjs} +2 -2
- package/dist/helpers-BelEzV4U.cjs.map +1 -0
- package/dist/{helpers-ByRTDO_m.mjs → helpers-DgsMFMUV.mjs} +2 -2
- package/dist/helpers-DgsMFMUV.mjs.map +1 -0
- package/dist/{index-BWzGIj06.d.mts → index-CgAQHr3f.d.mts} +2 -2
- package/dist/index-CgAQHr3f.d.mts.map +1 -0
- package/dist/index-D0fp_IK1.d.cts +12 -0
- package/dist/index-D0fp_IK1.d.cts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +1 -1
- package/dist/lazyAccessors-B-Jgkg2o.mjs +175 -0
- package/dist/lazyAccessors-B-Jgkg2o.mjs.map +1 -0
- package/dist/lazyAccessors-B2ILzU-j.d.mts +49 -0
- package/dist/lazyAccessors-B2ILzU-j.d.mts.map +1 -0
- package/dist/lazyAccessors-B8Hhras9.cjs +223 -0
- package/dist/lazyAccessors-B8Hhras9.cjs.map +1 -0
- package/dist/lazyAccessors-Bcpi06ed.d.cts +49 -0
- package/dist/lazyAccessors-Bcpi06ed.d.cts.map +1 -0
- package/dist/{parseHonoQuery-CZC5_97v.cjs → parseHonoQuery-D4MhxTRc.cjs} +1 -1
- package/dist/parseHonoQuery-D4MhxTRc.cjs.map +1 -0
- package/dist/{parseHonoQuery-DDgIkTO4.mjs → parseHonoQuery-DpK3sGPc.mjs} +1 -1
- package/dist/parseHonoQuery-DpK3sGPc.mjs.map +1 -0
- package/dist/parseQueryParams-BSNkjmZ9.cjs.map +1 -1
- package/dist/parseQueryParams-UMTRnRrW.mjs.map +1 -1
- package/dist/processAudits-CzHkPokQ.cjs.map +1 -1
- package/dist/processAudits-Dj8UGqcW.mjs.map +1 -1
- package/dist/publisher-Bw4770Hi.mjs.map +1 -1
- package/dist/publisher-C4BhHB5I.d.cts +16 -0
- package/dist/publisher-C4BhHB5I.d.cts.map +1 -0
- package/dist/publisher-NE-GnXL8.d.mts +16 -0
- package/dist/publisher-NE-GnXL8.d.mts.map +1 -0
- package/dist/publisher-lFQleddL.cjs.map +1 -1
- package/dist/publisher.d.cts +3 -16
- package/dist/publisher.d.mts +3 -16
- package/dist/{rls-CmJ7bRsz.cjs → rls-BrywnrQb.cjs} +1 -1
- package/dist/{rls-CmJ7bRsz.cjs.map → rls-BrywnrQb.cjs.map} +1 -1
- package/dist/{rls-Bf3FRwto.mjs → rls-C0cWOnk4.mjs} +1 -1
- package/dist/{rls-Bf3FRwto.mjs.map → rls-C0cWOnk4.mjs.map} +1 -1
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.cjs +1 -1
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.cts +2 -2
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.mts +3 -3
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.mjs +1 -1
- package/dist/subscribers/Subscriber.cjs +2 -2
- package/dist/subscribers/Subscriber.d.cts +1 -1
- package/dist/subscribers/Subscriber.d.mts +2 -2
- package/dist/subscribers/Subscriber.mjs +2 -2
- package/dist/subscribers/SubscriberBuilder.cjs +3 -3
- package/dist/subscribers/SubscriberBuilder.d.cts +2 -2
- package/dist/subscribers/SubscriberBuilder.d.mts +3 -3
- package/dist/subscribers/SubscriberBuilder.mjs +3 -3
- package/dist/subscribers/index.cjs +3 -3
- package/dist/subscribers/index.cjs.map +1 -1
- package/dist/subscribers/index.d.cts +4 -4
- package/dist/subscribers/index.d.cts.map +1 -1
- package/dist/subscribers/index.d.mts +3 -3
- package/dist/subscribers/index.d.mts.map +1 -1
- package/dist/subscribers/index.mjs +3 -3
- package/dist/subscribers/index.mjs.map +1 -1
- package/dist/telemetry-BTaiRqPo.d.cts +95 -0
- package/dist/telemetry-BTaiRqPo.d.cts.map +1 -0
- package/dist/telemetry-yAHf5yDs.d.mts +95 -0
- package/dist/telemetry-yAHf5yDs.d.mts.map +1 -0
- package/dist/telemetry.cjs +0 -0
- package/dist/telemetry.d.cts +2 -0
- package/dist/telemetry.d.mts +2 -0
- package/dist/telemetry.mjs +0 -0
- package/dist/types-B5H3piDg.d.cts.map +1 -1
- package/dist/{types-DdIlpxAd.d.mts → types-Dw-iLd3Y.d.mts} +1 -1
- package/dist/types-Dw-iLd3Y.d.mts.map +1 -0
- package/dist/types.d.mts +1 -1
- package/package.json +18 -18
- package/src/Construct.ts +117 -86
- package/src/__benchmarks__/build-time-optimization.bench.ts +274 -0
- package/src/__benchmarks__/endpoint.bench.ts +375 -375
- package/src/__benchmarks__/fixtures.ts +241 -0
- package/src/__benchmarks__/hono-adaptor.bench.ts +533 -0
- package/src/__benchmarks__/hono-server.bench.ts +206 -206
- package/src/__benchmarks__/response-builder.bench.ts +428 -0
- package/src/__benchmarks__/strategies/strategy-a-lazy-services.ts +319 -0
- package/src/__benchmarks__/strategies/strategy-c-middleware.ts +530 -0
- package/src/__benchmarks__/strategies/strategy-d-opt-in-events.ts +567 -0
- package/src/__tests__/Construct.environment.spec.ts +349 -350
- package/src/__tests__/publisher.setting.spec.ts +496 -499
- package/src/__tests__/publisher.spec.ts +440 -442
- package/src/crons/Cron.ts +117 -117
- package/src/crons/CronBuilder.ts +237 -238
- package/src/crons/__tests__/Cron.spec.ts +448 -448
- package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +214 -214
- package/src/crons/index.ts +4 -4
- package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +571 -463
- package/src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts +86 -86
- package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +85 -81
- package/src/endpoints/Authorizer.ts +100 -100
- package/src/endpoints/Endpoint.ts +921 -937
- package/src/endpoints/EndpointBuilder.ts +703 -703
- package/src/endpoints/EndpointFactory.ts +1054 -1056
- package/src/endpoints/HonoEndpointAdaptor.ts +621 -548
- package/src/endpoints/TestEndpointAdaptor.ts +372 -353
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.audits.spec.ts +499 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +541 -542
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +1172 -1174
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.audits.spec.ts +599 -599
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +710 -710
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.factory-publisher.spec.ts +280 -280
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.kysely-audit.integration.spec.ts +924 -730
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.rls.spec.ts +307 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +408 -408
- package/src/endpoints/__tests__/Authorizer.spec.ts +286 -0
- package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +162 -162
- package/src/endpoints/__tests__/Endpoint.headers.spec.ts +182 -182
- package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +158 -159
- package/src/endpoints/__tests__/Endpoint.spec.ts +819 -822
- package/src/endpoints/__tests__/EndpointBuilder.audit.spec.ts +427 -427
- package/src/endpoints/__tests__/EndpointBuilder.spec.ts +478 -478
- package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +426 -426
- package/src/endpoints/__tests__/EndpointFactory.database-auditor.spec.ts +501 -501
- package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +177 -177
- package/src/endpoints/__tests__/EndpointFactory.spec.ts +471 -471
- package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +143 -143
- package/src/endpoints/__tests__/HonoEndpointAdaptor.audit-transactions.spec.ts +663 -663
- package/src/endpoints/__tests__/HonoEndpointAdaptor.audits.spec.ts +608 -608
- package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +561 -561
- package/src/endpoints/__tests__/HonoEndpointAdaptor.kysely-audit.integration.spec.ts +1036 -1036
- package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +278 -278
- package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +1093 -1093
- package/src/endpoints/__tests__/ResponseBuilder.spec.ts +230 -230
- package/src/endpoints/__tests__/TestEndpointAdaptor.audits.spec.ts +569 -569
- package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +841 -841
- package/src/endpoints/__tests__/endpoint-types.test.ts +68 -68
- package/src/endpoints/__tests__/helpers.spec.ts +37 -0
- package/src/endpoints/__tests__/lazyAccessors.spec.ts +330 -0
- package/src/endpoints/__tests__/processAudits.spec.ts +631 -0
- package/src/endpoints/audit.ts +51 -51
- package/src/endpoints/helpers.ts +34 -35
- package/src/endpoints/index.ts +33 -23
- package/src/endpoints/lazyAccessors.ts +241 -0
- package/src/endpoints/parseHonoQuery.ts +41 -41
- package/src/endpoints/parseQueryParams.ts +36 -36
- package/src/endpoints/processAudits.ts +269 -269
- package/src/endpoints/rls.ts +16 -16
- package/src/functions/AWSLambdaFunction.ts +294 -295
- package/src/functions/BaseFunctionBuilder.ts +185 -185
- package/src/functions/Function.ts +190 -190
- package/src/functions/FunctionBuilder.ts +353 -353
- package/src/functions/FunctionExecutionWrapper.ts +199 -200
- package/src/functions/TestFunctionAdaptor.ts +191 -191
- package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +424 -424
- package/src/functions/__tests__/Function.audits.spec.ts +364 -364
- package/src/functions/__tests__/Function.spec.ts +453 -454
- package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +179 -179
- package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +369 -369
- package/src/functions/index.ts +6 -4
- package/src/index.ts +13 -9
- package/src/publisher.ts +71 -72
- package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +244 -248
- package/src/subscribers/Subscriber.ts +82 -84
- package/src/subscribers/SubscriberBuilder.ts +129 -129
- package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +589 -589
- package/src/subscribers/__tests__/Subscriber.spec.ts +402 -404
- package/src/subscribers/index.ts +1 -0
- package/src/telemetry.ts +103 -0
- package/src/types.ts +7 -7
- package/test.ts +58 -59
- package/dist/AWSLambdaFunction-BdebRMUh.d.mts.map +0 -1
- package/dist/AWSLambdaFunction-C54a1doJ.mjs.map +0 -1
- package/dist/AWSLambdaFunction-D0tEOTXQ.d.cts.map +0 -1
- package/dist/AWSLambdaFunction-EPGY4s7i.cjs.map +0 -1
- package/dist/AWSLambdaSubscriberAdaptor-BLfO612H.mjs.map +0 -1
- package/dist/AWSLambdaSubscriberAdaptor-BNcYYZ-P.cjs.map +0 -1
- package/dist/AWSLambdaSubscriberAdaptor-DrFAvHOp.d.mts.map +0 -1
- package/dist/AWSLambdaSubscriberAdaptor-Dx-Ks1Jp.d.cts.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-BT9JXihC.mjs.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-DLqnYQ4E.d.cts.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-DNFvvdmW.cjs.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-qlKXuZxy.d.mts.map +0 -1
- package/dist/AmazonApiGatewayV1EndpointAdaptor-CShQI8Gk.mjs.map +0 -1
- package/dist/AmazonApiGatewayV1EndpointAdaptor-Ccl8B8kG.cjs.map +0 -1
- package/dist/AmazonApiGatewayV1EndpointAdaptor-DyUaJIhB.d.cts.map +0 -1
- package/dist/AmazonApiGatewayV1EndpointAdaptor-MRUxs3Xi.d.mts.map +0 -1
- package/dist/AmazonApiGatewayV2EndpointAdaptor-D8-0Aab4.cjs.map +0 -1
- package/dist/AmazonApiGatewayV2EndpointAdaptor-M1-w0U5R.d.cts.map +0 -1
- package/dist/AmazonApiGatewayV2EndpointAdaptor-fuLM6M9k.d.mts.map +0 -1
- package/dist/AmazonApiGatewayV2EndpointAdaptor-lCRzGE4q.mjs.map +0 -1
- package/dist/Authorizer-B-btowNd.d.cts.map +0 -1
- package/dist/Authorizer-C0ge_tc8.cjs.map +0 -1
- package/dist/Authorizer-gWxYsGEp.d.mts.map +0 -1
- package/dist/Authorizer-r9U3y_ms.mjs.map +0 -1
- package/dist/BaseFunctionBuilder-Czi1Jwza.mjs.map +0 -1
- package/dist/BaseFunctionBuilder-DRY419e7.d.mts.map +0 -1
- package/dist/BaseFunctionBuilder-MYG3C9ug.cjs.map +0 -1
- package/dist/Construct-Ba5cMxib.cjs.map +0 -1
- package/dist/Construct-DdyGHuag.mjs.map +0 -1
- package/dist/Construct-XrijZFFh.d.mts.map +0 -1
- package/dist/Cron-BxhGs5up.mjs.map +0 -1
- package/dist/Cron-CGF4YAfM.cjs.map +0 -1
- package/dist/Cron-bDLcTvV5.d.cts.map +0 -1
- package/dist/Cron-cdjlSKNp.d.mts.map +0 -1
- package/dist/CronBuilder-BC4m5-p1.d.mts.map +0 -1
- package/dist/CronBuilder-CcxKRtVP.cjs.map +0 -1
- package/dist/CronBuilder-DKVXyE0Q.d.cts.map +0 -1
- package/dist/CronBuilder-d2jh-IB2.mjs.map +0 -1
- package/dist/Endpoint-BPv9_-m_.d.cts.map +0 -1
- package/dist/Endpoint-BVGZXFyV.cjs.map +0 -1
- package/dist/Endpoint-BdwG75G_.d.mts.map +0 -1
- package/dist/Endpoint-CuOEswxJ.mjs.map +0 -1
- package/dist/EndpointBuilder-B3az942t.d.mts.map +0 -1
- package/dist/EndpointBuilder-Cgj1P_ra.cjs.map +0 -1
- package/dist/EndpointBuilder-DIy_m1bu.d.cts.map +0 -1
- package/dist/EndpointBuilder-DnCB1h1j.mjs.map +0 -1
- package/dist/EndpointFactory-C-0nE6Jg.d.mts.map +0 -1
- package/dist/EndpointFactory-CYj6BYok.cjs.map +0 -1
- package/dist/EndpointFactory-CbdxPCIH.mjs.map +0 -1
- package/dist/EndpointFactory-CyPbm3AD.d.cts.map +0 -1
- package/dist/Function-BVHqIDp9.mjs.map +0 -1
- package/dist/Function-Cf7f_kCz.d.cts.map +0 -1
- package/dist/Function-DDZb1525.cjs.map +0 -1
- package/dist/Function-DN2G6OT5.d.mts.map +0 -1
- package/dist/FunctionBuilder-CJBzzXL3.d.cts.map +0 -1
- package/dist/FunctionBuilder-CrDYgfiI.mjs.map +0 -1
- package/dist/FunctionBuilder-Cxx8D2na.d.mts.map +0 -1
- package/dist/FunctionBuilder-DswJ-9sD.cjs.map +0 -1
- package/dist/FunctionExecutionWrapper-BYI2bGTL.cjs.map +0 -1
- package/dist/FunctionExecutionWrapper-CLDh7Z2_.mjs.map +0 -1
- package/dist/FunctionExecutionWrapper-DF260Aaj.d.mts.map +0 -1
- package/dist/FunctionExecutionWrapper-Qy8bmgFR.d.cts.map +0 -1
- package/dist/HonoEndpointAdaptor-BaPlUhz0.d.mts.map +0 -1
- package/dist/HonoEndpointAdaptor-CQe2FqMR.cjs +0 -234
- package/dist/HonoEndpointAdaptor-CQe2FqMR.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-Ce-2HBxn.mjs +0 -228
- package/dist/HonoEndpointAdaptor-Ce-2HBxn.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-YcRHYALH.d.cts.map +0 -1
- package/dist/Subscriber-BiHjVXtM.cjs.map +0 -1
- package/dist/Subscriber-BmPf9GFb.mjs.map +0 -1
- package/dist/Subscriber-COYMSevD.d.cts.map +0 -1
- package/dist/Subscriber-ikctpU3I.d.mts.map +0 -1
- package/dist/SubscriberBuilder-Cp1C-xtT.cjs.map +0 -1
- package/dist/SubscriberBuilder-DJPEeYDJ.mjs.map +0 -1
- package/dist/SubscriberBuilder-D_9zzllj.d.mts.map +0 -1
- package/dist/SubscriberBuilder-ivHAGIVi.d.cts.map +0 -1
- package/dist/TestEndpointAdaptor-C10xBI--.d.cts.map +0 -1
- package/dist/TestEndpointAdaptor-DB7bREhS.d.mts.map +0 -1
- package/dist/TestEndpointAdaptor-DJgik2Wj.mjs +0 -160
- package/dist/TestEndpointAdaptor-DJgik2Wj.mjs.map +0 -1
- package/dist/TestEndpointAdaptor-ZbtQiuHE.cjs +0 -166
- package/dist/TestEndpointAdaptor-ZbtQiuHE.cjs.map +0 -1
- package/dist/functions-C6EK1xL6.mjs +0 -8
- package/dist/functions-C6EK1xL6.mjs.map +0 -1
- package/dist/functions-fTid0RMK.cjs.map +0 -1
- package/dist/helpers-BcP1tXAi.cjs.map +0 -1
- package/dist/helpers-ByRTDO_m.mjs.map +0 -1
- package/dist/index-BWzGIj06.d.mts.map +0 -1
- package/dist/index-DmFozqLd.d.cts +0 -12
- package/dist/index-DmFozqLd.d.cts.map +0 -1
- package/dist/parseHonoQuery-CZC5_97v.cjs.map +0 -1
- package/dist/parseHonoQuery-DDgIkTO4.mjs.map +0 -1
- package/dist/publisher.d.cts.map +0 -1
- package/dist/publisher.d.mts.map +0 -1
- package/dist/types-DdIlpxAd.d.mts.map +0 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { getCookie } from "hono/cookie";
|
|
2
|
+
|
|
3
|
+
//#region src/endpoints/lazyAccessors.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create a lazy header accessor for Hono.
|
|
6
|
+
* Uses `c.req.header(name)` for single lookups (native, case-insensitive).
|
|
7
|
+
* Only calls `c.req.header()` to get all headers when needed.
|
|
8
|
+
*/
|
|
9
|
+
function createHonoHeaders(c) {
|
|
10
|
+
let allHeaders = null;
|
|
11
|
+
return (key) => {
|
|
12
|
+
if (key !== void 0) return c.req.header(key);
|
|
13
|
+
if (!allHeaders) allHeaders = c.req.header();
|
|
14
|
+
return allHeaders;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create a lazy cookie accessor for Hono.
|
|
19
|
+
* Uses `getCookie(c, name)` for single lookups (native).
|
|
20
|
+
* Only parses the cookie header when all cookies are requested.
|
|
21
|
+
*/
|
|
22
|
+
function createHonoCookies(c) {
|
|
23
|
+
let allCookies = null;
|
|
24
|
+
return (name) => {
|
|
25
|
+
if (name !== void 0) return getCookie(c, name);
|
|
26
|
+
if (!allCookies) {
|
|
27
|
+
allCookies = {};
|
|
28
|
+
const cookieHeader = c.req.header("cookie");
|
|
29
|
+
if (cookieHeader) for (const part of cookieHeader.split(";")) {
|
|
30
|
+
const trimmed = part.trim();
|
|
31
|
+
const eqIndex = trimmed.indexOf("=");
|
|
32
|
+
if (eqIndex > 0) {
|
|
33
|
+
const key = trimmed.slice(0, eqIndex);
|
|
34
|
+
const value = trimmed.slice(eqIndex + 1);
|
|
35
|
+
allCookies[key] = value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return allCookies;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a lazy header accessor for API Gateway events.
|
|
44
|
+
* Handles case-insensitive lookups.
|
|
45
|
+
*/
|
|
46
|
+
function createApiGatewayHeaders(headers) {
|
|
47
|
+
let normalizedHeaders = null;
|
|
48
|
+
const normalize = () => {
|
|
49
|
+
if (!normalizedHeaders) {
|
|
50
|
+
normalizedHeaders = {};
|
|
51
|
+
if (headers) {
|
|
52
|
+
for (const [k, v] of Object.entries(headers)) if (v !== void 0) normalizedHeaders[k.toLowerCase()] = v;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return normalizedHeaders;
|
|
56
|
+
};
|
|
57
|
+
return (key) => {
|
|
58
|
+
if (key !== void 0) {
|
|
59
|
+
if (headers) {
|
|
60
|
+
const direct = headers[key] ?? headers[key.toLowerCase()];
|
|
61
|
+
if (direct !== void 0) return direct;
|
|
62
|
+
return normalize()[key.toLowerCase()];
|
|
63
|
+
}
|
|
64
|
+
return void 0;
|
|
65
|
+
}
|
|
66
|
+
return normalize();
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create a lazy cookie accessor for API Gateway events.
|
|
71
|
+
* Decodes URL-encoded values to match browser behavior.
|
|
72
|
+
*/
|
|
73
|
+
function createApiGatewayCookies(cookies, cookieHeader) {
|
|
74
|
+
let parsed = null;
|
|
75
|
+
const parse = () => {
|
|
76
|
+
if (!parsed) {
|
|
77
|
+
parsed = {};
|
|
78
|
+
if (cookies) for (const cookie of cookies) {
|
|
79
|
+
const eqIndex = cookie.indexOf("=");
|
|
80
|
+
if (eqIndex > 0) {
|
|
81
|
+
const key = cookie.slice(0, eqIndex);
|
|
82
|
+
const value = cookie.slice(eqIndex + 1);
|
|
83
|
+
parsed[key] = decodeURIComponent(value);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else if (cookieHeader) for (const part of cookieHeader.split(";")) {
|
|
87
|
+
const trimmed = part.trim();
|
|
88
|
+
const eqIndex = trimmed.indexOf("=");
|
|
89
|
+
if (eqIndex > 0) {
|
|
90
|
+
const key = trimmed.slice(0, eqIndex);
|
|
91
|
+
const value = trimmed.slice(eqIndex + 1);
|
|
92
|
+
parsed[key] = decodeURIComponent(value);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return parsed;
|
|
97
|
+
};
|
|
98
|
+
return (name) => {
|
|
99
|
+
if (name !== void 0) return parse()[name];
|
|
100
|
+
return parse();
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create a lazy header accessor for plain object headers (test adaptor, etc).
|
|
105
|
+
* Headers are already available as an object, just provide lazy access.
|
|
106
|
+
*/
|
|
107
|
+
function createObjectHeaders(headers) {
|
|
108
|
+
let normalized = null;
|
|
109
|
+
return (key) => {
|
|
110
|
+
if (key !== void 0) {
|
|
111
|
+
if (headers) {
|
|
112
|
+
const direct = headers[key] ?? headers[key.toLowerCase()];
|
|
113
|
+
if (direct !== void 0) return direct;
|
|
114
|
+
}
|
|
115
|
+
if (!normalized && headers) {
|
|
116
|
+
normalized = {};
|
|
117
|
+
for (const [k, v] of Object.entries(headers)) normalized[k.toLowerCase()] = v;
|
|
118
|
+
}
|
|
119
|
+
return normalized?.[key.toLowerCase()];
|
|
120
|
+
}
|
|
121
|
+
if (!normalized && headers) {
|
|
122
|
+
normalized = {};
|
|
123
|
+
for (const [k, v] of Object.entries(headers)) normalized[k.toLowerCase()] = v;
|
|
124
|
+
}
|
|
125
|
+
return normalized ?? {};
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Create a lazy cookie accessor from a cookie header string.
|
|
130
|
+
* Decodes URL-encoded values to match browser behavior.
|
|
131
|
+
*/
|
|
132
|
+
function createCookieHeaderAccessor(cookieHeader) {
|
|
133
|
+
let parsed = null;
|
|
134
|
+
const parse = () => {
|
|
135
|
+
if (!parsed) {
|
|
136
|
+
parsed = {};
|
|
137
|
+
if (cookieHeader) for (const part of cookieHeader.split(";")) {
|
|
138
|
+
const trimmed = part.trim();
|
|
139
|
+
const eqIndex = trimmed.indexOf("=");
|
|
140
|
+
if (eqIndex > 0) {
|
|
141
|
+
const key = trimmed.slice(0, eqIndex);
|
|
142
|
+
const value = trimmed.slice(eqIndex + 1);
|
|
143
|
+
parsed[key] = decodeURIComponent(value);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return parsed;
|
|
148
|
+
};
|
|
149
|
+
return (name) => {
|
|
150
|
+
if (name !== void 0) return parse()[name];
|
|
151
|
+
return parse();
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Create a no-op header accessor (for minimal endpoints that don't use headers).
|
|
156
|
+
*/
|
|
157
|
+
function createNoopHeaders() {
|
|
158
|
+
return (key) => {
|
|
159
|
+
if (key !== void 0) return void 0;
|
|
160
|
+
return {};
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
|
|
165
|
+
*/
|
|
166
|
+
function createNoopCookies() {
|
|
167
|
+
return (name) => {
|
|
168
|
+
if (name !== void 0) return void 0;
|
|
169
|
+
return {};
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
//#endregion
|
|
174
|
+
export { createApiGatewayCookies, createApiGatewayHeaders, createCookieHeaderAccessor, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, createObjectHeaders };
|
|
175
|
+
//# sourceMappingURL=lazyAccessors-B-Jgkg2o.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazyAccessors-B-Jgkg2o.mjs","names":["c: Context","allHeaders: Record<string, string> | null","key?: string","allCookies: Record<string, string> | null","name?: string","headers: Record<string, string | undefined> | null | undefined","normalizedHeaders: Record<string, string> | null","cookies: string[] | undefined","cookieHeader: string | undefined","parsed: Record<string, string> | null","headers: Record<string, string> | undefined","normalized: Record<string, string> | null"],"sources":["../src/endpoints/lazyAccessors.ts"],"sourcesContent":["/**\n * Lazy header and cookie accessors for different adaptors.\n *\n * Instead of parsing all headers/cookies upfront, these accessors\n * use native adaptor methods for single lookups and only parse\n * everything when `header()` or `cookie()` is called without arguments.\n */\nimport type { Context } from 'hono';\nimport { getCookie } from 'hono/cookie';\nimport type { CookieFn, HeaderFn } from './Endpoint';\n\n/**\n * Create a lazy header accessor for Hono.\n * Uses `c.req.header(name)` for single lookups (native, case-insensitive).\n * Only calls `c.req.header()` to get all headers when needed.\n */\nexport function createHonoHeaders(c: Context): HeaderFn {\n\tlet allHeaders: Record<string, string> | null = null;\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Single header lookup - use native Hono method (case-insensitive)\n\t\t\treturn c.req.header(key);\n\t\t}\n\t\t// Get all headers - cache the result\n\t\tif (!allHeaders) {\n\t\t\tallHeaders = c.req.header();\n\t\t}\n\t\treturn allHeaders;\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor for Hono.\n * Uses `getCookie(c, name)` for single lookups (native).\n * Only parses the cookie header when all cookies are requested.\n */\nexport function createHonoCookies(c: Context): CookieFn {\n\tlet allCookies: Record<string, string> | null = null;\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\t// Single cookie lookup - use native Hono method\n\t\t\treturn getCookie(c, name);\n\t\t}\n\t\t// Get all cookies - parse and cache\n\t\tif (!allCookies) {\n\t\t\tallCookies = {};\n\t\t\tconst cookieHeader = c.req.header('cookie');\n\t\t\tif (cookieHeader) {\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\tallCookies[key] = value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn allCookies;\n\t}) as CookieFn;\n}\n\n/**\n * Create a lazy header accessor for API Gateway events.\n * Handles case-insensitive lookups.\n */\nexport function createApiGatewayHeaders(\n\theaders: Record<string, string | undefined> | null | undefined,\n): HeaderFn {\n\tlet normalizedHeaders: Record<string, string> | null = null;\n\n\tconst normalize = () => {\n\t\tif (!normalizedHeaders) {\n\t\t\tnormalizedHeaders = {};\n\t\t\tif (headers) {\n\t\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\t\tif (v !== undefined) {\n\t\t\t\t\t\tnormalizedHeaders[k.toLowerCase()] = v;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn normalizedHeaders;\n\t};\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Try direct lookup first (common case: headers already lowercase)\n\t\t\tif (headers) {\n\t\t\t\tconst direct = headers[key] ?? headers[key.toLowerCase()];\n\t\t\t\tif (direct !== undefined) return direct;\n\t\t\t\t// Fall back to normalized lookup\n\t\t\t\treturn normalize()[key.toLowerCase()];\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\treturn normalize();\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor for API Gateway events.\n * Decodes URL-encoded values to match browser behavior.\n */\nexport function createApiGatewayCookies(\n\tcookies: string[] | undefined,\n\tcookieHeader: string | undefined,\n): CookieFn {\n\tlet parsed: Record<string, string> | null = null;\n\n\tconst parse = () => {\n\t\tif (!parsed) {\n\t\t\tparsed = {};\n\t\t\t// API Gateway v2 provides cookies as array\n\t\t\tif (cookies) {\n\t\t\t\tfor (const cookie of cookies) {\n\t\t\t\t\tconst eqIndex = cookie.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = cookie.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = cookie.slice(eqIndex + 1);\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (cookieHeader) {\n\t\t\t\t// Fall back to parsing cookie header\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn parsed;\n\t};\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\treturn parse()[name];\n\t\t}\n\t\treturn parse();\n\t}) as CookieFn;\n}\n\n/**\n * Create a lazy header accessor for plain object headers (test adaptor, etc).\n * Headers are already available as an object, just provide lazy access.\n */\nexport function createObjectHeaders(\n\theaders: Record<string, string> | undefined,\n): HeaderFn {\n\tlet normalized: Record<string, string> | null = null;\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Try direct lookup first (common case)\n\t\t\tif (headers) {\n\t\t\t\tconst direct = headers[key] ?? headers[key.toLowerCase()];\n\t\t\t\tif (direct !== undefined) return direct;\n\t\t\t}\n\t\t\t// Fall back to normalized lookup for case-insensitivity\n\t\t\tif (!normalized && headers) {\n\t\t\t\tnormalized = {};\n\t\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\t\tnormalized[k.toLowerCase()] = v;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn normalized?.[key.toLowerCase()];\n\t\t}\n\t\t// Return all headers\n\t\tif (!normalized && headers) {\n\t\t\tnormalized = {};\n\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\tnormalized[k.toLowerCase()] = v;\n\t\t\t}\n\t\t}\n\t\treturn normalized ?? {};\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor from a cookie header string.\n * Decodes URL-encoded values to match browser behavior.\n */\nexport function createCookieHeaderAccessor(\n\tcookieHeader: string | undefined,\n): CookieFn {\n\tlet parsed: Record<string, string> | null = null;\n\n\tconst parse = () => {\n\t\tif (!parsed) {\n\t\t\tparsed = {};\n\t\t\tif (cookieHeader) {\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\t// Decode URL-encoded values to match Endpoint.createCookies behavior\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn parsed;\n\t};\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\treturn parse()[name];\n\t\t}\n\t\treturn parse();\n\t}) as CookieFn;\n}\n\n/**\n * Create a no-op header accessor (for minimal endpoints that don't use headers).\n */\nexport function createNoopHeaders(): HeaderFn {\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) return undefined;\n\t\treturn {};\n\t}) as HeaderFn;\n}\n\n/**\n * Create a no-op cookie accessor (for minimal endpoints that don't use cookies).\n */\nexport function createNoopCookies(): CookieFn {\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) return undefined;\n\t\treturn {};\n\t}) as CookieFn;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CookieFn, HeaderFn } from "./Endpoint-Dlv7nxgj.mjs";
|
|
2
|
+
import { Context } from "hono";
|
|
3
|
+
|
|
4
|
+
//#region src/endpoints/lazyAccessors.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a lazy header accessor for Hono.
|
|
8
|
+
* Uses `c.req.header(name)` for single lookups (native, case-insensitive).
|
|
9
|
+
* Only calls `c.req.header()` to get all headers when needed.
|
|
10
|
+
*/
|
|
11
|
+
declare function createHonoHeaders(c: Context): HeaderFn;
|
|
12
|
+
/**
|
|
13
|
+
* Create a lazy cookie accessor for Hono.
|
|
14
|
+
* Uses `getCookie(c, name)` for single lookups (native).
|
|
15
|
+
* Only parses the cookie header when all cookies are requested.
|
|
16
|
+
*/
|
|
17
|
+
declare function createHonoCookies(c: Context): CookieFn;
|
|
18
|
+
/**
|
|
19
|
+
* Create a lazy header accessor for API Gateway events.
|
|
20
|
+
* Handles case-insensitive lookups.
|
|
21
|
+
*/
|
|
22
|
+
declare function createApiGatewayHeaders(headers: Record<string, string | undefined> | null | undefined): HeaderFn;
|
|
23
|
+
/**
|
|
24
|
+
* Create a lazy cookie accessor for API Gateway events.
|
|
25
|
+
* Decodes URL-encoded values to match browser behavior.
|
|
26
|
+
*/
|
|
27
|
+
declare function createApiGatewayCookies(cookies: string[] | undefined, cookieHeader: string | undefined): CookieFn;
|
|
28
|
+
/**
|
|
29
|
+
* Create a lazy header accessor for plain object headers (test adaptor, etc).
|
|
30
|
+
* Headers are already available as an object, just provide lazy access.
|
|
31
|
+
*/
|
|
32
|
+
declare function createObjectHeaders(headers: Record<string, string> | undefined): HeaderFn;
|
|
33
|
+
/**
|
|
34
|
+
* Create a lazy cookie accessor from a cookie header string.
|
|
35
|
+
* Decodes URL-encoded values to match browser behavior.
|
|
36
|
+
*/
|
|
37
|
+
declare function createCookieHeaderAccessor(cookieHeader: string | undefined): CookieFn;
|
|
38
|
+
/**
|
|
39
|
+
* Create a no-op header accessor (for minimal endpoints that don't use headers).
|
|
40
|
+
*/
|
|
41
|
+
declare function createNoopHeaders(): HeaderFn;
|
|
42
|
+
/**
|
|
43
|
+
* Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
|
|
44
|
+
*/
|
|
45
|
+
declare function createNoopCookies(): CookieFn;
|
|
46
|
+
//# sourceMappingURL=lazyAccessors.d.ts.map
|
|
47
|
+
//#endregion
|
|
48
|
+
export { createApiGatewayCookies, createApiGatewayHeaders, createCookieHeaderAccessor, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, createObjectHeaders };
|
|
49
|
+
//# sourceMappingURL=lazyAccessors-B2ILzU-j.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazyAccessors-B2ILzU-j.d.mts","names":[],"sources":["../src/endpoints/lazyAccessors.ts"],"sourcesContent":[],"mappings":";;;;;AAqCA;;;;AAAuD;AAgCvC,iBArDA,iBAAA,CAqDuB,CAAA,EArDF,OAqDE,CAAA,EArDQ,QAqDR;;;;AAE5B;AAoCX;AA+CgB,iBArHA,iBAAA,CAqHmB,CAAA,EArHE,OAqHF,CAAA,EArHY,QAqHZ;;;;AAExB;AAkCK,iBAzHA,uBAAA,CA2Hb,OAAQ,EA1HD,MA0HC,CAAA,MAAA,EAAA,MAAA,GAAA,SAAA,CAAA,GAAA,IAAA,GAAA,SAAA,CAAA,EAzHR,QAyHQ;AAiCX;AAUA;;;iBAhIgB,uBAAA,mEAGb;;;;;iBA4Ca,mBAAA,UACN,qCACP;;;;;iBAkCa,0BAAA,oCAEb;;;;iBAiCa,iBAAA,CAAA,GAAqB;;;;iBAUrB,iBAAA,CAAA,GAAqB"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const hono_cookie = require_chunk.__toESM(require("hono/cookie"));
|
|
3
|
+
|
|
4
|
+
//#region src/endpoints/lazyAccessors.ts
|
|
5
|
+
/**
|
|
6
|
+
* Create a lazy header accessor for Hono.
|
|
7
|
+
* Uses `c.req.header(name)` for single lookups (native, case-insensitive).
|
|
8
|
+
* Only calls `c.req.header()` to get all headers when needed.
|
|
9
|
+
*/
|
|
10
|
+
function createHonoHeaders(c) {
|
|
11
|
+
let allHeaders = null;
|
|
12
|
+
return (key) => {
|
|
13
|
+
if (key !== void 0) return c.req.header(key);
|
|
14
|
+
if (!allHeaders) allHeaders = c.req.header();
|
|
15
|
+
return allHeaders;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a lazy cookie accessor for Hono.
|
|
20
|
+
* Uses `getCookie(c, name)` for single lookups (native).
|
|
21
|
+
* Only parses the cookie header when all cookies are requested.
|
|
22
|
+
*/
|
|
23
|
+
function createHonoCookies(c) {
|
|
24
|
+
let allCookies = null;
|
|
25
|
+
return (name) => {
|
|
26
|
+
if (name !== void 0) return (0, hono_cookie.getCookie)(c, name);
|
|
27
|
+
if (!allCookies) {
|
|
28
|
+
allCookies = {};
|
|
29
|
+
const cookieHeader = c.req.header("cookie");
|
|
30
|
+
if (cookieHeader) for (const part of cookieHeader.split(";")) {
|
|
31
|
+
const trimmed = part.trim();
|
|
32
|
+
const eqIndex = trimmed.indexOf("=");
|
|
33
|
+
if (eqIndex > 0) {
|
|
34
|
+
const key = trimmed.slice(0, eqIndex);
|
|
35
|
+
const value = trimmed.slice(eqIndex + 1);
|
|
36
|
+
allCookies[key] = value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return allCookies;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create a lazy header accessor for API Gateway events.
|
|
45
|
+
* Handles case-insensitive lookups.
|
|
46
|
+
*/
|
|
47
|
+
function createApiGatewayHeaders(headers) {
|
|
48
|
+
let normalizedHeaders = null;
|
|
49
|
+
const normalize = () => {
|
|
50
|
+
if (!normalizedHeaders) {
|
|
51
|
+
normalizedHeaders = {};
|
|
52
|
+
if (headers) {
|
|
53
|
+
for (const [k, v] of Object.entries(headers)) if (v !== void 0) normalizedHeaders[k.toLowerCase()] = v;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return normalizedHeaders;
|
|
57
|
+
};
|
|
58
|
+
return (key) => {
|
|
59
|
+
if (key !== void 0) {
|
|
60
|
+
if (headers) {
|
|
61
|
+
const direct = headers[key] ?? headers[key.toLowerCase()];
|
|
62
|
+
if (direct !== void 0) return direct;
|
|
63
|
+
return normalize()[key.toLowerCase()];
|
|
64
|
+
}
|
|
65
|
+
return void 0;
|
|
66
|
+
}
|
|
67
|
+
return normalize();
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Create a lazy cookie accessor for API Gateway events.
|
|
72
|
+
* Decodes URL-encoded values to match browser behavior.
|
|
73
|
+
*/
|
|
74
|
+
function createApiGatewayCookies(cookies, cookieHeader) {
|
|
75
|
+
let parsed = null;
|
|
76
|
+
const parse = () => {
|
|
77
|
+
if (!parsed) {
|
|
78
|
+
parsed = {};
|
|
79
|
+
if (cookies) for (const cookie of cookies) {
|
|
80
|
+
const eqIndex = cookie.indexOf("=");
|
|
81
|
+
if (eqIndex > 0) {
|
|
82
|
+
const key = cookie.slice(0, eqIndex);
|
|
83
|
+
const value = cookie.slice(eqIndex + 1);
|
|
84
|
+
parsed[key] = decodeURIComponent(value);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (cookieHeader) for (const part of cookieHeader.split(";")) {
|
|
88
|
+
const trimmed = part.trim();
|
|
89
|
+
const eqIndex = trimmed.indexOf("=");
|
|
90
|
+
if (eqIndex > 0) {
|
|
91
|
+
const key = trimmed.slice(0, eqIndex);
|
|
92
|
+
const value = trimmed.slice(eqIndex + 1);
|
|
93
|
+
parsed[key] = decodeURIComponent(value);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return parsed;
|
|
98
|
+
};
|
|
99
|
+
return (name) => {
|
|
100
|
+
if (name !== void 0) return parse()[name];
|
|
101
|
+
return parse();
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Create a lazy header accessor for plain object headers (test adaptor, etc).
|
|
106
|
+
* Headers are already available as an object, just provide lazy access.
|
|
107
|
+
*/
|
|
108
|
+
function createObjectHeaders(headers) {
|
|
109
|
+
let normalized = null;
|
|
110
|
+
return (key) => {
|
|
111
|
+
if (key !== void 0) {
|
|
112
|
+
if (headers) {
|
|
113
|
+
const direct = headers[key] ?? headers[key.toLowerCase()];
|
|
114
|
+
if (direct !== void 0) return direct;
|
|
115
|
+
}
|
|
116
|
+
if (!normalized && headers) {
|
|
117
|
+
normalized = {};
|
|
118
|
+
for (const [k, v] of Object.entries(headers)) normalized[k.toLowerCase()] = v;
|
|
119
|
+
}
|
|
120
|
+
return normalized?.[key.toLowerCase()];
|
|
121
|
+
}
|
|
122
|
+
if (!normalized && headers) {
|
|
123
|
+
normalized = {};
|
|
124
|
+
for (const [k, v] of Object.entries(headers)) normalized[k.toLowerCase()] = v;
|
|
125
|
+
}
|
|
126
|
+
return normalized ?? {};
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create a lazy cookie accessor from a cookie header string.
|
|
131
|
+
* Decodes URL-encoded values to match browser behavior.
|
|
132
|
+
*/
|
|
133
|
+
function createCookieHeaderAccessor(cookieHeader) {
|
|
134
|
+
let parsed = null;
|
|
135
|
+
const parse = () => {
|
|
136
|
+
if (!parsed) {
|
|
137
|
+
parsed = {};
|
|
138
|
+
if (cookieHeader) for (const part of cookieHeader.split(";")) {
|
|
139
|
+
const trimmed = part.trim();
|
|
140
|
+
const eqIndex = trimmed.indexOf("=");
|
|
141
|
+
if (eqIndex > 0) {
|
|
142
|
+
const key = trimmed.slice(0, eqIndex);
|
|
143
|
+
const value = trimmed.slice(eqIndex + 1);
|
|
144
|
+
parsed[key] = decodeURIComponent(value);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return parsed;
|
|
149
|
+
};
|
|
150
|
+
return (name) => {
|
|
151
|
+
if (name !== void 0) return parse()[name];
|
|
152
|
+
return parse();
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Create a no-op header accessor (for minimal endpoints that don't use headers).
|
|
157
|
+
*/
|
|
158
|
+
function createNoopHeaders() {
|
|
159
|
+
return (key) => {
|
|
160
|
+
if (key !== void 0) return void 0;
|
|
161
|
+
return {};
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
|
|
166
|
+
*/
|
|
167
|
+
function createNoopCookies() {
|
|
168
|
+
return (name) => {
|
|
169
|
+
if (name !== void 0) return void 0;
|
|
170
|
+
return {};
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
//#endregion
|
|
175
|
+
Object.defineProperty(exports, 'createApiGatewayCookies', {
|
|
176
|
+
enumerable: true,
|
|
177
|
+
get: function () {
|
|
178
|
+
return createApiGatewayCookies;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
Object.defineProperty(exports, 'createApiGatewayHeaders', {
|
|
182
|
+
enumerable: true,
|
|
183
|
+
get: function () {
|
|
184
|
+
return createApiGatewayHeaders;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
Object.defineProperty(exports, 'createCookieHeaderAccessor', {
|
|
188
|
+
enumerable: true,
|
|
189
|
+
get: function () {
|
|
190
|
+
return createCookieHeaderAccessor;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
Object.defineProperty(exports, 'createHonoCookies', {
|
|
194
|
+
enumerable: true,
|
|
195
|
+
get: function () {
|
|
196
|
+
return createHonoCookies;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
Object.defineProperty(exports, 'createHonoHeaders', {
|
|
200
|
+
enumerable: true,
|
|
201
|
+
get: function () {
|
|
202
|
+
return createHonoHeaders;
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
Object.defineProperty(exports, 'createNoopCookies', {
|
|
206
|
+
enumerable: true,
|
|
207
|
+
get: function () {
|
|
208
|
+
return createNoopCookies;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
Object.defineProperty(exports, 'createNoopHeaders', {
|
|
212
|
+
enumerable: true,
|
|
213
|
+
get: function () {
|
|
214
|
+
return createNoopHeaders;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
Object.defineProperty(exports, 'createObjectHeaders', {
|
|
218
|
+
enumerable: true,
|
|
219
|
+
get: function () {
|
|
220
|
+
return createObjectHeaders;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
//# sourceMappingURL=lazyAccessors-B8Hhras9.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazyAccessors-B8Hhras9.cjs","names":["c: Context","allHeaders: Record<string, string> | null","key?: string","allCookies: Record<string, string> | null","name?: string","headers: Record<string, string | undefined> | null | undefined","normalizedHeaders: Record<string, string> | null","cookies: string[] | undefined","cookieHeader: string | undefined","parsed: Record<string, string> | null","headers: Record<string, string> | undefined","normalized: Record<string, string> | null"],"sources":["../src/endpoints/lazyAccessors.ts"],"sourcesContent":["/**\n * Lazy header and cookie accessors for different adaptors.\n *\n * Instead of parsing all headers/cookies upfront, these accessors\n * use native adaptor methods for single lookups and only parse\n * everything when `header()` or `cookie()` is called without arguments.\n */\nimport type { Context } from 'hono';\nimport { getCookie } from 'hono/cookie';\nimport type { CookieFn, HeaderFn } from './Endpoint';\n\n/**\n * Create a lazy header accessor for Hono.\n * Uses `c.req.header(name)` for single lookups (native, case-insensitive).\n * Only calls `c.req.header()` to get all headers when needed.\n */\nexport function createHonoHeaders(c: Context): HeaderFn {\n\tlet allHeaders: Record<string, string> | null = null;\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Single header lookup - use native Hono method (case-insensitive)\n\t\t\treturn c.req.header(key);\n\t\t}\n\t\t// Get all headers - cache the result\n\t\tif (!allHeaders) {\n\t\t\tallHeaders = c.req.header();\n\t\t}\n\t\treturn allHeaders;\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor for Hono.\n * Uses `getCookie(c, name)` for single lookups (native).\n * Only parses the cookie header when all cookies are requested.\n */\nexport function createHonoCookies(c: Context): CookieFn {\n\tlet allCookies: Record<string, string> | null = null;\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\t// Single cookie lookup - use native Hono method\n\t\t\treturn getCookie(c, name);\n\t\t}\n\t\t// Get all cookies - parse and cache\n\t\tif (!allCookies) {\n\t\t\tallCookies = {};\n\t\t\tconst cookieHeader = c.req.header('cookie');\n\t\t\tif (cookieHeader) {\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\tallCookies[key] = value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn allCookies;\n\t}) as CookieFn;\n}\n\n/**\n * Create a lazy header accessor for API Gateway events.\n * Handles case-insensitive lookups.\n */\nexport function createApiGatewayHeaders(\n\theaders: Record<string, string | undefined> | null | undefined,\n): HeaderFn {\n\tlet normalizedHeaders: Record<string, string> | null = null;\n\n\tconst normalize = () => {\n\t\tif (!normalizedHeaders) {\n\t\t\tnormalizedHeaders = {};\n\t\t\tif (headers) {\n\t\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\t\tif (v !== undefined) {\n\t\t\t\t\t\tnormalizedHeaders[k.toLowerCase()] = v;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn normalizedHeaders;\n\t};\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Try direct lookup first (common case: headers already lowercase)\n\t\t\tif (headers) {\n\t\t\t\tconst direct = headers[key] ?? headers[key.toLowerCase()];\n\t\t\t\tif (direct !== undefined) return direct;\n\t\t\t\t// Fall back to normalized lookup\n\t\t\t\treturn normalize()[key.toLowerCase()];\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\treturn normalize();\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor for API Gateway events.\n * Decodes URL-encoded values to match browser behavior.\n */\nexport function createApiGatewayCookies(\n\tcookies: string[] | undefined,\n\tcookieHeader: string | undefined,\n): CookieFn {\n\tlet parsed: Record<string, string> | null = null;\n\n\tconst parse = () => {\n\t\tif (!parsed) {\n\t\t\tparsed = {};\n\t\t\t// API Gateway v2 provides cookies as array\n\t\t\tif (cookies) {\n\t\t\t\tfor (const cookie of cookies) {\n\t\t\t\t\tconst eqIndex = cookie.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = cookie.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = cookie.slice(eqIndex + 1);\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (cookieHeader) {\n\t\t\t\t// Fall back to parsing cookie header\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn parsed;\n\t};\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\treturn parse()[name];\n\t\t}\n\t\treturn parse();\n\t}) as CookieFn;\n}\n\n/**\n * Create a lazy header accessor for plain object headers (test adaptor, etc).\n * Headers are already available as an object, just provide lazy access.\n */\nexport function createObjectHeaders(\n\theaders: Record<string, string> | undefined,\n): HeaderFn {\n\tlet normalized: Record<string, string> | null = null;\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Try direct lookup first (common case)\n\t\t\tif (headers) {\n\t\t\t\tconst direct = headers[key] ?? headers[key.toLowerCase()];\n\t\t\t\tif (direct !== undefined) return direct;\n\t\t\t}\n\t\t\t// Fall back to normalized lookup for case-insensitivity\n\t\t\tif (!normalized && headers) {\n\t\t\t\tnormalized = {};\n\t\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\t\tnormalized[k.toLowerCase()] = v;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn normalized?.[key.toLowerCase()];\n\t\t}\n\t\t// Return all headers\n\t\tif (!normalized && headers) {\n\t\t\tnormalized = {};\n\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\tnormalized[k.toLowerCase()] = v;\n\t\t\t}\n\t\t}\n\t\treturn normalized ?? {};\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor from a cookie header string.\n * Decodes URL-encoded values to match browser behavior.\n */\nexport function createCookieHeaderAccessor(\n\tcookieHeader: string | undefined,\n): CookieFn {\n\tlet parsed: Record<string, string> | null = null;\n\n\tconst parse = () => {\n\t\tif (!parsed) {\n\t\t\tparsed = {};\n\t\t\tif (cookieHeader) {\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\t// Decode URL-encoded values to match Endpoint.createCookies behavior\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn parsed;\n\t};\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\treturn parse()[name];\n\t\t}\n\t\treturn parse();\n\t}) as CookieFn;\n}\n\n/**\n * Create a no-op header accessor (for minimal endpoints that don't use headers).\n */\nexport function createNoopHeaders(): HeaderFn {\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) return undefined;\n\t\treturn {};\n\t}) as HeaderFn;\n}\n\n/**\n * Create a no-op cookie accessor (for minimal endpoints that don't use cookies).\n */\nexport function createNoopCookies(): CookieFn {\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) return undefined;\n\t\treturn {};\n\t}) as CookieFn;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CookieFn, HeaderFn } from "./Endpoint-BOlbY5iq.cjs";
|
|
2
|
+
import { Context } from "hono";
|
|
3
|
+
|
|
4
|
+
//#region src/endpoints/lazyAccessors.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a lazy header accessor for Hono.
|
|
8
|
+
* Uses `c.req.header(name)` for single lookups (native, case-insensitive).
|
|
9
|
+
* Only calls `c.req.header()` to get all headers when needed.
|
|
10
|
+
*/
|
|
11
|
+
declare function createHonoHeaders(c: Context): HeaderFn;
|
|
12
|
+
/**
|
|
13
|
+
* Create a lazy cookie accessor for Hono.
|
|
14
|
+
* Uses `getCookie(c, name)` for single lookups (native).
|
|
15
|
+
* Only parses the cookie header when all cookies are requested.
|
|
16
|
+
*/
|
|
17
|
+
declare function createHonoCookies(c: Context): CookieFn;
|
|
18
|
+
/**
|
|
19
|
+
* Create a lazy header accessor for API Gateway events.
|
|
20
|
+
* Handles case-insensitive lookups.
|
|
21
|
+
*/
|
|
22
|
+
declare function createApiGatewayHeaders(headers: Record<string, string | undefined> | null | undefined): HeaderFn;
|
|
23
|
+
/**
|
|
24
|
+
* Create a lazy cookie accessor for API Gateway events.
|
|
25
|
+
* Decodes URL-encoded values to match browser behavior.
|
|
26
|
+
*/
|
|
27
|
+
declare function createApiGatewayCookies(cookies: string[] | undefined, cookieHeader: string | undefined): CookieFn;
|
|
28
|
+
/**
|
|
29
|
+
* Create a lazy header accessor for plain object headers (test adaptor, etc).
|
|
30
|
+
* Headers are already available as an object, just provide lazy access.
|
|
31
|
+
*/
|
|
32
|
+
declare function createObjectHeaders(headers: Record<string, string> | undefined): HeaderFn;
|
|
33
|
+
/**
|
|
34
|
+
* Create a lazy cookie accessor from a cookie header string.
|
|
35
|
+
* Decodes URL-encoded values to match browser behavior.
|
|
36
|
+
*/
|
|
37
|
+
declare function createCookieHeaderAccessor(cookieHeader: string | undefined): CookieFn;
|
|
38
|
+
/**
|
|
39
|
+
* Create a no-op header accessor (for minimal endpoints that don't use headers).
|
|
40
|
+
*/
|
|
41
|
+
declare function createNoopHeaders(): HeaderFn;
|
|
42
|
+
/**
|
|
43
|
+
* Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
|
|
44
|
+
*/
|
|
45
|
+
declare function createNoopCookies(): CookieFn;
|
|
46
|
+
//# sourceMappingURL=lazyAccessors.d.ts.map
|
|
47
|
+
//#endregion
|
|
48
|
+
export { createApiGatewayCookies, createApiGatewayHeaders, createCookieHeaderAccessor, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, createObjectHeaders };
|
|
49
|
+
//# sourceMappingURL=lazyAccessors-Bcpi06ed.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazyAccessors-Bcpi06ed.d.cts","names":[],"sources":["../src/endpoints/lazyAccessors.ts"],"sourcesContent":[],"mappings":";;;;;AAqCA;;;;AAAuD;AAgCvC,iBArDA,iBAAA,CAqDuB,CAAA,EArDF,OAqDE,CAAA,EArDQ,QAqDR;;;;AAE5B;AAoCX;AA+CgB,iBArHA,iBAAA,CAqHmB,CAAA,EArHE,OAqHF,CAAA,EArHY,QAqHZ;;;;AAExB;AAkCK,iBAzHA,uBAAA,CA2Hb,OAAQ,EA1HD,MA0HC,CAAA,MAAA,EAAA,MAAA,GAAA,SAAA,CAAA,GAAA,IAAA,GAAA,SAAA,CAAA,EAzHR,QAyHQ;AAiCX;AAUA;;;iBAhIgB,uBAAA,mEAGb;;;;;iBA4Ca,mBAAA,UACN,qCACP;;;;;iBAkCa,0BAAA,oCAEb;;;;iBAiCa,iBAAA,CAAA,GAAqB;;;;iBAUrB,iBAAA,CAAA,GAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseHonoQuery-D4MhxTRc.cjs","names":["c: Context","result: Record<string, any>"],"sources":["../src/endpoints/parseHonoQuery.ts"],"sourcesContent":["import type { Context } from 'hono';\n\n/**\n * Parse Hono query parameters to handle arrays and nested objects\n * Hono provides c.req.queries() for arrays, but we need to handle dot notation for objects\n */\nexport function parseHonoQuery(c: Context): Record<string, any> {\n\tconst allParams = c.req.query();\n\tconst result: Record<string, any> = {};\n\n\t// First, handle all query parameters\n\tfor (const [key, value] of Object.entries(allParams)) {\n\t\tif (key.includes('.')) {\n\t\t\t// Handle dot notation for objects\n\t\t\tconst parts = key.split('.');\n\t\t\tlet current = result;\n\n\t\t\t// Navigate/create the nested structure\n\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\tconst part = parts[i];\n\t\t\t\tif (!part) continue;\n\t\t\t\tif (\n\t\t\t\t\t!current[part] ||\n\t\t\t\t\ttypeof current[part] !== 'object' ||\n\t\t\t\t\tArray.isArray(current[part])\n\t\t\t\t) {\n\t\t\t\t\tcurrent[part] = {};\n\t\t\t\t}\n\t\t\t\tcurrent = current[part];\n\t\t\t}\n\n\t\t\t// Set the final value, checking for arrays in nested keys\n\t\t\tconst lastPart = parts[parts.length - 1];\n\t\t\tif (!lastPart) continue;\n\t\t\tconst multipleValues = c.req.queries(key);\n\t\t\tif (multipleValues && multipleValues.length > 1) {\n\t\t\t\tcurrent[lastPart] = multipleValues;\n\t\t\t} else {\n\t\t\t\tcurrent[lastPart] = value;\n\t\t\t}\n\t\t} else {\n\t\t\t// For regular keys, check if there are multiple values\n\t\t\tconst multipleValues = c.req.queries(key);\n\t\t\tif (multipleValues && multipleValues.length > 1) {\n\t\t\t\tresult[key] = multipleValues;\n\t\t\t} else {\n\t\t\t\tresult[key] = value;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;;AAMA,SAAgB,eAAeA,GAAiC;CAC/D,MAAM,YAAY,EAAE,IAAI,OAAO;CAC/B,MAAMC,SAA8B,CAAE;AAGtC,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,UAAU,CACnD,KAAI,IAAI,SAAS,IAAI,EAAE;EAEtB,MAAM,QAAQ,IAAI,MAAM,IAAI;EAC5B,IAAI,UAAU;AAGd,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,SAAS,GAAG,KAAK;GAC1C,MAAM,OAAO,MAAM;AACnB,QAAK,KAAM;AACX,QACE,QAAQ,gBACF,QAAQ,UAAU,YACzB,MAAM,QAAQ,QAAQ,MAAM,CAE5B,SAAQ,QAAQ,CAAE;AAEnB,aAAU,QAAQ;EAClB;EAGD,MAAM,WAAW,MAAM,MAAM,SAAS;AACtC,OAAK,SAAU;EACf,MAAM,iBAAiB,EAAE,IAAI,QAAQ,IAAI;AACzC,MAAI,kBAAkB,eAAe,SAAS,EAC7C,SAAQ,YAAY;MAEpB,SAAQ,YAAY;CAErB,OAAM;EAEN,MAAM,iBAAiB,EAAE,IAAI,QAAQ,IAAI;AACzC,MAAI,kBAAkB,eAAe,SAAS,EAC7C,QAAO,OAAO;MAEd,QAAO,OAAO;CAEf;AAGF,QAAO;AACP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseHonoQuery-DpK3sGPc.mjs","names":["c: Context","result: Record<string, any>"],"sources":["../src/endpoints/parseHonoQuery.ts"],"sourcesContent":["import type { Context } from 'hono';\n\n/**\n * Parse Hono query parameters to handle arrays and nested objects\n * Hono provides c.req.queries() for arrays, but we need to handle dot notation for objects\n */\nexport function parseHonoQuery(c: Context): Record<string, any> {\n\tconst allParams = c.req.query();\n\tconst result: Record<string, any> = {};\n\n\t// First, handle all query parameters\n\tfor (const [key, value] of Object.entries(allParams)) {\n\t\tif (key.includes('.')) {\n\t\t\t// Handle dot notation for objects\n\t\t\tconst parts = key.split('.');\n\t\t\tlet current = result;\n\n\t\t\t// Navigate/create the nested structure\n\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\tconst part = parts[i];\n\t\t\t\tif (!part) continue;\n\t\t\t\tif (\n\t\t\t\t\t!current[part] ||\n\t\t\t\t\ttypeof current[part] !== 'object' ||\n\t\t\t\t\tArray.isArray(current[part])\n\t\t\t\t) {\n\t\t\t\t\tcurrent[part] = {};\n\t\t\t\t}\n\t\t\t\tcurrent = current[part];\n\t\t\t}\n\n\t\t\t// Set the final value, checking for arrays in nested keys\n\t\t\tconst lastPart = parts[parts.length - 1];\n\t\t\tif (!lastPart) continue;\n\t\t\tconst multipleValues = c.req.queries(key);\n\t\t\tif (multipleValues && multipleValues.length > 1) {\n\t\t\t\tcurrent[lastPart] = multipleValues;\n\t\t\t} else {\n\t\t\t\tcurrent[lastPart] = value;\n\t\t\t}\n\t\t} else {\n\t\t\t// For regular keys, check if there are multiple values\n\t\t\tconst multipleValues = c.req.queries(key);\n\t\t\tif (multipleValues && multipleValues.length > 1) {\n\t\t\t\tresult[key] = multipleValues;\n\t\t\t} else {\n\t\t\t\tresult[key] = value;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;AAMA,SAAgB,eAAeA,GAAiC;CAC/D,MAAM,YAAY,EAAE,IAAI,OAAO;CAC/B,MAAMC,SAA8B,CAAE;AAGtC,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,UAAU,CACnD,KAAI,IAAI,SAAS,IAAI,EAAE;EAEtB,MAAM,QAAQ,IAAI,MAAM,IAAI;EAC5B,IAAI,UAAU;AAGd,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,SAAS,GAAG,KAAK;GAC1C,MAAM,OAAO,MAAM;AACnB,QAAK,KAAM;AACX,QACE,QAAQ,gBACF,QAAQ,UAAU,YACzB,MAAM,QAAQ,QAAQ,MAAM,CAE5B,SAAQ,QAAQ,CAAE;AAEnB,aAAU,QAAQ;EAClB;EAGD,MAAM,WAAW,MAAM,MAAM,SAAS;AACtC,OAAK,SAAU;EACf,MAAM,iBAAiB,EAAE,IAAI,QAAQ,IAAI;AACzC,MAAI,kBAAkB,eAAe,SAAS,EAC7C,SAAQ,YAAY;MAEpB,SAAQ,YAAY;CAErB,OAAM;EAEN,MAAM,iBAAiB,EAAE,IAAI,QAAQ,IAAI;AACzC,MAAI,kBAAkB,eAAe,SAAS,EAC7C,QAAO,OAAO;MAEd,QAAO,OAAO;CAEf;AAGF,QAAO;AACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseQueryParams-BSNkjmZ9.cjs","names":["queryParams: Record<string, string | string[] | undefined> | null","result: Record<string, any>"],"sources":["../src/endpoints/parseQueryParams.ts"],"sourcesContent":["/**\n * Parse query parameters from a flat object into a nested structure\n * Handles arrays (multiple values with same key) and objects (dot notation)\n *\n * @example\n * parseQueryParams({ 'tags': ['a', 'b'], 'filter.name': 'john' })\n * // Returns: { tags: ['a', 'b'], filter: { name: 'john' } }\n */\nexport function parseQueryParams(\n
|
|
1
|
+
{"version":3,"file":"parseQueryParams-BSNkjmZ9.cjs","names":["queryParams: Record<string, string | string[] | undefined> | null","result: Record<string, any>"],"sources":["../src/endpoints/parseQueryParams.ts"],"sourcesContent":["/**\n * Parse query parameters from a flat object into a nested structure\n * Handles arrays (multiple values with same key) and objects (dot notation)\n *\n * @example\n * parseQueryParams({ 'tags': ['a', 'b'], 'filter.name': 'john' })\n * // Returns: { tags: ['a', 'b'], filter: { name: 'john' } }\n */\nexport function parseQueryParams(\n\tqueryParams: Record<string, string | string[] | undefined> | null,\n): Record<string, any> {\n\tif (!queryParams) {\n\t\treturn {};\n\t}\n\n\tconst result: Record<string, any> = {};\n\n\tfor (const [key, value] of Object.entries(queryParams)) {\n\t\tif (value === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Check if the key contains dot notation\n\t\tif (key.includes('.')) {\n\t\t\tconst parts = key.split('.');\n\t\t\tlet current = result;\n\n\t\t\t// Navigate/create the nested structure\n\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\tconst part = parts[i];\n\t\t\t\tif (!part) continue;\n\t\t\t\tif (\n\t\t\t\t\t!current[part] ||\n\t\t\t\t\ttypeof current[part] !== 'object' ||\n\t\t\t\t\tArray.isArray(current[part])\n\t\t\t\t) {\n\t\t\t\t\tcurrent[part] = {};\n\t\t\t\t}\n\t\t\t\tcurrent = current[part];\n\t\t\t}\n\n\t\t\t// Set the final value\n\t\t\tconst lastPart = parts[parts.length - 1];\n\t\t\tif (!lastPart) continue;\n\t\t\tcurrent[lastPart] = value;\n\t\t} else {\n\t\t\t// Simple key, just assign the value\n\t\t\tresult[key] = value;\n\t\t}\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;;;;;;AAQA,SAAgB,iBACfA,aACsB;AACtB,MAAK,YACJ,QAAO,CAAE;CAGV,MAAMC,SAA8B,CAAE;AAEtC,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,EAAE;AACvD,MAAI,iBACH;AAID,MAAI,IAAI,SAAS,IAAI,EAAE;GACtB,MAAM,QAAQ,IAAI,MAAM,IAAI;GAC5B,IAAI,UAAU;AAGd,QAAK,IAAI,IAAI,GAAG,IAAI,MAAM,SAAS,GAAG,KAAK;IAC1C,MAAM,OAAO,MAAM;AACnB,SAAK,KAAM;AACX,SACE,QAAQ,gBACF,QAAQ,UAAU,YACzB,MAAM,QAAQ,QAAQ,MAAM,CAE5B,SAAQ,QAAQ,CAAE;AAEnB,cAAU,QAAQ;GAClB;GAGD,MAAM,WAAW,MAAM,MAAM,SAAS;AACtC,QAAK,SAAU;AACf,WAAQ,YAAY;EACpB,MAEA,QAAO,OAAO;CAEf;AAED,QAAO;AACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseQueryParams-UMTRnRrW.mjs","names":["queryParams: Record<string, string | string[] | undefined> | null","result: Record<string, any>"],"sources":["../src/endpoints/parseQueryParams.ts"],"sourcesContent":["/**\n * Parse query parameters from a flat object into a nested structure\n * Handles arrays (multiple values with same key) and objects (dot notation)\n *\n * @example\n * parseQueryParams({ 'tags': ['a', 'b'], 'filter.name': 'john' })\n * // Returns: { tags: ['a', 'b'], filter: { name: 'john' } }\n */\nexport function parseQueryParams(\n
|
|
1
|
+
{"version":3,"file":"parseQueryParams-UMTRnRrW.mjs","names":["queryParams: Record<string, string | string[] | undefined> | null","result: Record<string, any>"],"sources":["../src/endpoints/parseQueryParams.ts"],"sourcesContent":["/**\n * Parse query parameters from a flat object into a nested structure\n * Handles arrays (multiple values with same key) and objects (dot notation)\n *\n * @example\n * parseQueryParams({ 'tags': ['a', 'b'], 'filter.name': 'john' })\n * // Returns: { tags: ['a', 'b'], filter: { name: 'john' } }\n */\nexport function parseQueryParams(\n\tqueryParams: Record<string, string | string[] | undefined> | null,\n): Record<string, any> {\n\tif (!queryParams) {\n\t\treturn {};\n\t}\n\n\tconst result: Record<string, any> = {};\n\n\tfor (const [key, value] of Object.entries(queryParams)) {\n\t\tif (value === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Check if the key contains dot notation\n\t\tif (key.includes('.')) {\n\t\t\tconst parts = key.split('.');\n\t\t\tlet current = result;\n\n\t\t\t// Navigate/create the nested structure\n\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\tconst part = parts[i];\n\t\t\t\tif (!part) continue;\n\t\t\t\tif (\n\t\t\t\t\t!current[part] ||\n\t\t\t\t\ttypeof current[part] !== 'object' ||\n\t\t\t\t\tArray.isArray(current[part])\n\t\t\t\t) {\n\t\t\t\t\tcurrent[part] = {};\n\t\t\t\t}\n\t\t\t\tcurrent = current[part];\n\t\t\t}\n\n\t\t\t// Set the final value\n\t\t\tconst lastPart = parts[parts.length - 1];\n\t\t\tif (!lastPart) continue;\n\t\t\tcurrent[lastPart] = value;\n\t\t} else {\n\t\t\t// Simple key, just assign the value\n\t\t\tresult[key] = value;\n\t\t}\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,iBACfA,aACsB;AACtB,MAAK,YACJ,QAAO,CAAE;CAGV,MAAMC,SAA8B,CAAE;AAEtC,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,EAAE;AACvD,MAAI,iBACH;AAID,MAAI,IAAI,SAAS,IAAI,EAAE;GACtB,MAAM,QAAQ,IAAI,MAAM,IAAI;GAC5B,IAAI,UAAU;AAGd,QAAK,IAAI,IAAI,GAAG,IAAI,MAAM,SAAS,GAAG,KAAK;IAC1C,MAAM,OAAO,MAAM;AACnB,SAAK,KAAM;AACX,SACE,QAAQ,gBACF,QAAQ,UAAU,YACzB,MAAM,QAAQ,QAAQ,MAAM,CAE5B,SAAQ,QAAQ,CAAE;AAEnB,cAAU,QAAQ;GAClB;GAGD,MAAM,WAAW,MAAM,MAAM,SAAS;AACtC,QAAK,SAAU;AACf,WAAQ,YAAY;EACpB,MAEA,QAAO,OAAO;CAEf;AAED,QAAO;AACP"}
|