@geekmidas/constructs 3.0.1 → 3.0.3
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/CHANGELOG.md +12 -0
- package/dist/{AWSLambdaFunction-BVpc9xFN.cjs → AWSLambdaFunction-CPEAl5nZ.cjs} +2 -2
- package/dist/{AWSLambdaFunction-BVpc9xFN.cjs.map → AWSLambdaFunction-CPEAl5nZ.cjs.map} +1 -1
- package/dist/{AWSLambdaFunction-OPazEPhQ.mjs → AWSLambdaFunction-DJiCAPAf.mjs} +2 -2
- package/dist/{AWSLambdaFunction-OPazEPhQ.mjs.map → AWSLambdaFunction-DJiCAPAf.mjs.map} +1 -1
- package/dist/{AWSLambdaSubscriberAdaptor-YxZ_z3XG.mjs → AWSLambdaSubscriberAdaptor-RKwKYLl1.mjs} +1 -1
- package/dist/{AWSLambdaSubscriberAdaptor-YxZ_z3XG.mjs.map → AWSLambdaSubscriberAdaptor-RKwKYLl1.mjs.map} +1 -1
- package/dist/{AWSLambdaSubscriberAdaptor-BL7Yl1XE.cjs → AWSLambdaSubscriberAdaptor-eZ3qoKvK.cjs} +1 -1
- package/dist/{AWSLambdaSubscriberAdaptor-BL7Yl1XE.cjs.map → AWSLambdaSubscriberAdaptor-eZ3qoKvK.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayEndpointAdaptor-CQSZArI6.d.mts → AmazonApiGatewayEndpointAdaptor-B30TqZRX.d.mts} +2 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-B30TqZRX.d.mts.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-Bxvs-F0F.d.cts → AmazonApiGatewayEndpointAdaptor-D4lAuXA-.d.cts} +2 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-D4lAuXA-.d.cts.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-BPxHm8Tg.mjs → AmazonApiGatewayEndpointAdaptor-ciUHVvPX.mjs} +6 -2
- package/dist/AmazonApiGatewayEndpointAdaptor-ciUHVvPX.mjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-1XyivLJs.cjs → AmazonApiGatewayEndpointAdaptor-jDYqkgFE.cjs} +6 -2
- package/dist/AmazonApiGatewayEndpointAdaptor-jDYqkgFE.cjs.map +1 -0
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-D9zY3nHe.d.cts → AmazonApiGatewayV1EndpointAdaptor-B5xFYauV.d.cts} +2 -2
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-D9zY3nHe.d.cts.map → AmazonApiGatewayV1EndpointAdaptor-B5xFYauV.d.cts.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-xTrFYt48.d.mts → AmazonApiGatewayV1EndpointAdaptor-CG1UJoAK.d.mts} +2 -2
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-xTrFYt48.d.mts.map → AmazonApiGatewayV1EndpointAdaptor-CG1UJoAK.d.mts.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-CQ0dtx1M.mjs → AmazonApiGatewayV1EndpointAdaptor-DCfEo-Tu.mjs} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-CQ0dtx1M.mjs.map → AmazonApiGatewayV1EndpointAdaptor-DCfEo-Tu.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-Cm2wieNy.cjs → AmazonApiGatewayV1EndpointAdaptor-DwKlAfnb.cjs} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-Cm2wieNy.cjs.map → AmazonApiGatewayV1EndpointAdaptor-DwKlAfnb.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-CjPCxIb1.cjs → AmazonApiGatewayV2EndpointAdaptor-B126fL6i.cjs} +9 -8
- package/dist/AmazonApiGatewayV2EndpointAdaptor-B126fL6i.cjs.map +1 -0
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DrbEaZ2_.mjs → AmazonApiGatewayV2EndpointAdaptor-CGMF4lD4.mjs} +8 -8
- package/dist/AmazonApiGatewayV2EndpointAdaptor-CGMF4lD4.mjs.map +1 -0
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-CHi3Qe1s.d.cts → AmazonApiGatewayV2EndpointAdaptor-OkwjABOz.d.cts} +4 -3
- package/dist/AmazonApiGatewayV2EndpointAdaptor-OkwjABOz.d.cts.map +1 -0
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-BBayh2_k.d.mts → AmazonApiGatewayV2EndpointAdaptor-ofjuxcPV.d.mts} +4 -3
- package/dist/AmazonApiGatewayV2EndpointAdaptor-ofjuxcPV.d.mts.map +1 -0
- package/dist/{Authorizer-Dx57psuM.cjs → Authorizer-BXxBee2P.cjs} +1 -1
- package/dist/{Authorizer-Dx57psuM.cjs.map → Authorizer-BXxBee2P.cjs.map} +1 -1
- package/dist/{Authorizer-4unKN3Xn.mjs → Authorizer-BgjU8-z6.mjs} +1 -1
- package/dist/{Authorizer-4unKN3Xn.mjs.map → Authorizer-BgjU8-z6.mjs.map} +1 -1
- package/dist/{Cron-B3vrGuaD.mjs → Cron-BUpUS-0f.mjs} +1 -1
- package/dist/{Cron-B3vrGuaD.mjs.map → Cron-BUpUS-0f.mjs.map} +1 -1
- package/dist/{Cron-DEKZg5j4.cjs → Cron-Bp08dJ4R.cjs} +1 -1
- package/dist/{Cron-DEKZg5j4.cjs.map → Cron-Bp08dJ4R.cjs.map} +1 -1
- package/dist/{CronBuilder-BHpY6w3b.cjs → CronBuilder-CIxJQ1Ps.cjs} +2 -2
- package/dist/{CronBuilder-BHpY6w3b.cjs.map → CronBuilder-CIxJQ1Ps.cjs.map} +1 -1
- package/dist/{CronBuilder-VXpyNfp2.mjs → CronBuilder-DUggbCHc.mjs} +2 -2
- package/dist/{CronBuilder-VXpyNfp2.mjs.map → CronBuilder-DUggbCHc.mjs.map} +1 -1
- package/dist/{EndpointBuilder-D1RtrBu1.mjs → EndpointBuilder-CF-ZWtdu.mjs} +3 -3
- package/dist/{EndpointBuilder-D1RtrBu1.mjs.map → EndpointBuilder-CF-ZWtdu.mjs.map} +1 -1
- package/dist/{EndpointBuilder-fXmTxRyW.cjs → EndpointBuilder-CyszO0bs.cjs} +3 -3
- package/dist/{EndpointBuilder-fXmTxRyW.cjs.map → EndpointBuilder-CyszO0bs.cjs.map} +1 -1
- package/dist/{EndpointFactory-DBfTbSTX.cjs → EndpointFactory-B0D6d6t9.cjs} +3 -3
- package/dist/{EndpointFactory-DBfTbSTX.cjs.map → EndpointFactory-B0D6d6t9.cjs.map} +1 -1
- package/dist/{EndpointFactory-DkB8yxdQ.mjs → EndpointFactory-Do498RmG.mjs} +3 -3
- package/dist/{EndpointFactory-DkB8yxdQ.mjs.map → EndpointFactory-Do498RmG.mjs.map} +1 -1
- package/dist/{FunctionExecutionWrapper-Ba0Z-iwe.mjs → FunctionExecutionWrapper-B0ZAssiy.mjs} +1 -1
- package/dist/{FunctionExecutionWrapper-Ba0Z-iwe.mjs.map → FunctionExecutionWrapper-B0ZAssiy.mjs.map} +1 -1
- package/dist/{FunctionExecutionWrapper-7B-CufYj.cjs → FunctionExecutionWrapper-KKHP6fDY.cjs} +1 -1
- package/dist/{FunctionExecutionWrapper-7B-CufYj.cjs.map → FunctionExecutionWrapper-KKHP6fDY.cjs.map} +1 -1
- package/dist/{HonoEndpointAdaptor-BCql3gLP.d.cts → HonoEndpointAdaptor-BNHGwpvZ.d.cts} +3 -3
- package/dist/{HonoEndpointAdaptor-BCql3gLP.d.cts.map → HonoEndpointAdaptor-BNHGwpvZ.d.cts.map} +1 -1
- package/dist/{HonoEndpointAdaptor-CNlb-KGz.mjs → HonoEndpointAdaptor-BvxQreVM.mjs} +5 -5
- package/dist/{HonoEndpointAdaptor-CNlb-KGz.mjs.map → HonoEndpointAdaptor-BvxQreVM.mjs.map} +1 -1
- package/dist/{HonoEndpointAdaptor-B4NMwHkr.cjs → HonoEndpointAdaptor-CQqQPLHH.cjs} +5 -5
- package/dist/{HonoEndpointAdaptor-B4NMwHkr.cjs.map → HonoEndpointAdaptor-CQqQPLHH.cjs.map} +1 -1
- package/dist/{HonoEndpointAdaptor-C3AdQ0xS.d.mts → HonoEndpointAdaptor-DgoeqUX6.d.mts} +3 -3
- package/dist/{HonoEndpointAdaptor-C3AdQ0xS.d.mts.map → HonoEndpointAdaptor-DgoeqUX6.d.mts.map} +1 -1
- package/dist/{Subscriber-Scz7hrV6.cjs → Subscriber-ClqSPbIZ.cjs} +1 -1
- package/dist/{Subscriber-Scz7hrV6.cjs.map → Subscriber-ClqSPbIZ.cjs.map} +1 -1
- package/dist/{Subscriber-BEhOdNQi.mjs → Subscriber-DKQK5gLD.mjs} +1 -1
- package/dist/{Subscriber-BEhOdNQi.mjs.map → Subscriber-DKQK5gLD.mjs.map} +1 -1
- package/dist/{SubscriberBuilder-B82h4v-S.cjs → SubscriberBuilder-BS5B_688.cjs} +2 -2
- package/dist/{SubscriberBuilder-B82h4v-S.cjs.map → SubscriberBuilder-BS5B_688.cjs.map} +1 -1
- package/dist/{SubscriberBuilder-DlUaG0Ej.mjs → SubscriberBuilder-BswTuvUc.mjs} +2 -2
- package/dist/{SubscriberBuilder-DlUaG0Ej.mjs.map → SubscriberBuilder-BswTuvUc.mjs.map} +1 -1
- package/dist/{TestEndpointAdaptor-DJdmYxMn.mjs → TestEndpointAdaptor-CDOhCmIk.mjs} +2 -2
- package/dist/{TestEndpointAdaptor-DJdmYxMn.mjs.map → TestEndpointAdaptor-CDOhCmIk.mjs.map} +1 -1
- package/dist/{TestEndpointAdaptor-Bsqn6T0k.cjs → TestEndpointAdaptor-DjQSuxRq.cjs} +2 -2
- package/dist/{TestEndpointAdaptor-Bsqn6T0k.cjs.map → TestEndpointAdaptor-DjQSuxRq.cjs.map} +1 -1
- package/dist/adaptors/aws.cjs +8 -7
- package/dist/adaptors/aws.d.cts +4 -4
- package/dist/adaptors/aws.d.mts +4 -4
- package/dist/adaptors/aws.mjs +8 -7
- package/dist/adaptors/hono.cjs +4 -4
- package/dist/adaptors/hono.d.cts +2 -2
- package/dist/adaptors/hono.d.mts +2 -2
- package/dist/adaptors/hono.mjs +4 -4
- package/dist/adaptors/testing.cjs +2 -2
- package/dist/adaptors/testing.d.cts +1 -1
- package/dist/adaptors/testing.d.mts +1 -1
- package/dist/adaptors/testing.mjs +2 -2
- package/dist/crons/Cron.cjs +1 -1
- package/dist/crons/Cron.d.cts +1 -1
- package/dist/crons/Cron.d.mts +1 -1
- package/dist/crons/Cron.mjs +1 -1
- package/dist/crons/CronBuilder.cjs +2 -2
- package/dist/crons/CronBuilder.d.cts +1 -1
- package/dist/crons/CronBuilder.d.mts +1 -1
- package/dist/crons/CronBuilder.mjs +2 -2
- package/dist/crons/index.cjs +2 -2
- package/dist/crons/index.d.cts +5 -5
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +5 -5
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +2 -2
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +1 -1
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +2 -2
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +2 -2
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +1 -1
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +3 -3
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +3 -3
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +3 -3
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +3 -3
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +3 -3
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +3 -3
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +3 -3
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +3 -3
- package/dist/endpoints/Authorizer.cjs +1 -1
- package/dist/endpoints/Authorizer.mjs +1 -1
- package/dist/endpoints/Endpoint.d.cts +1 -1
- package/dist/endpoints/Endpoint.d.mts +1 -1
- package/dist/endpoints/EndpointBuilder.cjs +3 -3
- package/dist/endpoints/EndpointBuilder.d.cts +1 -1
- package/dist/endpoints/EndpointBuilder.d.mts +1 -1
- package/dist/endpoints/EndpointBuilder.mjs +3 -3
- package/dist/endpoints/EndpointFactory.cjs +4 -4
- package/dist/endpoints/EndpointFactory.d.cts +1 -1
- package/dist/endpoints/EndpointFactory.d.mts +1 -1
- package/dist/endpoints/EndpointFactory.mjs +4 -4
- package/dist/endpoints/HonoEndpointAdaptor.cjs +4 -4
- package/dist/endpoints/HonoEndpointAdaptor.d.cts +2 -2
- package/dist/endpoints/HonoEndpointAdaptor.d.mts +2 -2
- package/dist/endpoints/HonoEndpointAdaptor.mjs +4 -4
- package/dist/endpoints/TestEndpointAdaptor.cjs +2 -2
- package/dist/endpoints/TestEndpointAdaptor.d.cts +1 -1
- package/dist/endpoints/TestEndpointAdaptor.d.mts +1 -1
- package/dist/endpoints/TestEndpointAdaptor.mjs +2 -2
- package/dist/endpoints/audit.d.cts +1 -1
- package/dist/endpoints/audit.d.mts +1 -1
- package/dist/endpoints/helpers.cjs +1 -1
- package/dist/endpoints/helpers.d.cts +1 -1
- package/dist/endpoints/helpers.d.mts +1 -1
- package/dist/endpoints/helpers.mjs +1 -1
- package/dist/endpoints/index.cjs +5 -5
- package/dist/endpoints/index.d.cts +3 -3
- package/dist/endpoints/index.d.mts +3 -3
- package/dist/endpoints/index.mjs +5 -5
- package/dist/endpoints/lazyAccessors.cjs +1 -1
- package/dist/endpoints/lazyAccessors.d.cts +1 -1
- package/dist/endpoints/lazyAccessors.d.mts +1 -1
- package/dist/endpoints/lazyAccessors.mjs +1 -1
- package/dist/endpoints/parseHonoQuery.cjs +1 -1
- package/dist/endpoints/parseHonoQuery.d.cts +2 -2
- package/dist/endpoints/parseHonoQuery.d.cts.map +1 -1
- package/dist/endpoints/parseHonoQuery.d.mts +2 -2
- package/dist/endpoints/parseHonoQuery.d.mts.map +1 -1
- package/dist/endpoints/parseHonoQuery.mjs +1 -1
- package/dist/endpoints/parseQueryParams.cjs +1 -1
- package/dist/endpoints/parseQueryParams.d.cts +2 -2
- package/dist/endpoints/parseQueryParams.d.cts.map +1 -1
- package/dist/endpoints/parseQueryParams.d.mts +2 -2
- package/dist/endpoints/parseQueryParams.d.mts.map +1 -1
- package/dist/endpoints/parseQueryParams.mjs +1 -1
- package/dist/endpoints/processAudits.d.cts +1 -1
- package/dist/endpoints/processAudits.d.mts +1 -1
- package/dist/endpoints/rls.cjs +1 -1
- package/dist/endpoints/rls.d.cts +1 -1
- package/dist/endpoints/rls.d.mts +1 -1
- package/dist/endpoints/rls.mjs +1 -1
- package/dist/functions/AWSLambdaFunction.cjs +2 -2
- package/dist/functions/AWSLambdaFunction.mjs +2 -2
- package/dist/functions/FunctionExecutionWrapper.cjs +1 -1
- package/dist/functions/FunctionExecutionWrapper.mjs +1 -1
- package/dist/functions/index.d.cts +1 -1
- package/dist/functions/index.d.mts +1 -1
- package/dist/{helpers-Ciyi6Aap.cjs → helpers-BYyX0qTA.cjs} +1 -1
- package/dist/{helpers-Ciyi6Aap.cjs.map → helpers-BYyX0qTA.cjs.map} +1 -1
- package/dist/{helpers-C5j_GRBz.mjs → helpers-BtwC2IW8.mjs} +1 -1
- package/dist/{helpers-C5j_GRBz.mjs.map → helpers-BtwC2IW8.mjs.map} +1 -1
- package/dist/index-Br-zTYii.d.mts +12 -0
- package/dist/{index-BfeupgMl.d.cts.map → index-Br-zTYii.d.mts.map} +1 -1
- package/dist/index-dRNH0dT6.d.cts +12 -0
- package/dist/{index-_5DYCNAt.d.mts.map → index-dRNH0dT6.d.cts.map} +1 -1
- package/dist/{lazyAccessors-B8Hhras9.cjs → lazyAccessors-BVEtB9lU.cjs} +1 -1
- package/dist/{lazyAccessors-B8Hhras9.cjs.map → lazyAccessors-BVEtB9lU.cjs.map} +1 -1
- package/dist/{lazyAccessors-B-Jgkg2o.mjs → lazyAccessors-DM6HcXQk.mjs} +1 -1
- package/dist/{lazyAccessors-B-Jgkg2o.mjs.map → lazyAccessors-DM6HcXQk.mjs.map} +1 -1
- package/dist/parseHonoQuery-BBs8CX-H.cjs +24 -0
- package/dist/parseHonoQuery-BBs8CX-H.cjs.map +1 -0
- package/dist/parseHonoQuery-Cp8CII0P.mjs +18 -0
- package/dist/parseHonoQuery-Cp8CII0P.mjs.map +1 -0
- package/dist/parseQueryParams-B4RK1za3.cjs +31 -0
- package/dist/parseQueryParams-B4RK1za3.cjs.map +1 -0
- package/dist/parseQueryParams-DS3Qmrbd.mjs +25 -0
- package/dist/parseQueryParams-DS3Qmrbd.mjs.map +1 -0
- package/dist/{rls-DxFqdIA0.cjs → rls-BrywnrQb.cjs} +1 -1
- package/dist/{rls-DxFqdIA0.cjs.map → rls-BrywnrQb.cjs.map} +1 -1
- package/dist/{rls-7XXX7DvY.mjs → rls-C0cWOnk4.mjs} +1 -1
- package/dist/{rls-7XXX7DvY.mjs.map → rls-C0cWOnk4.mjs.map} +1 -1
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.cjs +1 -1
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.mjs +1 -1
- package/dist/subscribers/Subscriber.cjs +1 -1
- package/dist/subscribers/Subscriber.mjs +1 -1
- package/dist/subscribers/SubscriberBuilder.cjs +2 -2
- package/dist/subscribers/SubscriberBuilder.mjs +2 -2
- package/dist/subscribers/index.cjs +2 -2
- package/dist/subscribers/index.d.cts +2 -2
- package/dist/subscribers/index.d.cts.map +1 -1
- package/dist/subscribers/index.d.mts +2 -2
- package/dist/subscribers/index.d.mts.map +1 -1
- package/dist/subscribers/index.mjs +2 -2
- package/package.json +16 -14
- package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +6 -1
- package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +11 -19
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +7 -7
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +4 -2
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +92 -18
- package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +4 -4
- package/src/endpoints/parseHonoQuery.ts +9 -46
- package/src/endpoints/parseQueryParams.ts +12 -33
- package/dist/AmazonApiGatewayEndpointAdaptor-1XyivLJs.cjs.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-BPxHm8Tg.mjs.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-Bxvs-F0F.d.cts.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-CQSZArI6.d.mts.map +0 -1
- package/dist/AmazonApiGatewayV2EndpointAdaptor-BBayh2_k.d.mts.map +0 -1
- package/dist/AmazonApiGatewayV2EndpointAdaptor-CHi3Qe1s.d.cts.map +0 -1
- package/dist/AmazonApiGatewayV2EndpointAdaptor-CjPCxIb1.cjs.map +0 -1
- package/dist/AmazonApiGatewayV2EndpointAdaptor-DrbEaZ2_.mjs.map +0 -1
- package/dist/index-BfeupgMl.d.cts +0 -12
- package/dist/index-_5DYCNAt.d.mts +0 -12
- package/dist/parseHonoQuery-D4MhxTRc.cjs +0 -39
- package/dist/parseHonoQuery-D4MhxTRc.cjs.map +0 -1
- package/dist/parseHonoQuery-DpK3sGPc.mjs +0 -33
- package/dist/parseHonoQuery-DpK3sGPc.mjs.map +0 -1
- package/dist/parseQueryParams-BSNkjmZ9.cjs +0 -40
- package/dist/parseQueryParams-BSNkjmZ9.cjs.map +0 -1
- package/dist/parseQueryParams-UMTRnRrW.mjs +0 -34
- package/dist/parseQueryParams-UMTRnRrW.mjs.map +0 -1
|
@@ -1 +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":";;;;;;;;;AAgBA,SAAgB,kBAAkBA,GAAsB;CACvD,IAAIC,aAA4C;AAEhD,QAAQ,CAACC,QAAiB;AACzB,MAAI,eAEH,QAAO,EAAE,IAAI,OAAO,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QAAQ;AACZ,YAAS,CAAE;AACX,OAAI,aACH,MAAK,MAAM,QAAQ,aAAa,MAAM,IAAI,EAAE;IAC3C,MAAM,UAAU,KAAK,MAAM;IAC3B,MAAM,UAAU,QAAQ,QAAQ,IAAI;AACpC,QAAI,UAAU,GAAG;KAChB,MAAM,MAAM,QAAQ,MAAM,GAAG,QAAQ;KACrC,MAAM,QAAQ,QAAQ,MAAM,UAAU,EAAE;AAExC,YAAO,OAAO,mBAAmB,MAAM;IACvC;GACD;EAEF;AACD,SAAO;CACP;AAED,QAAQ,CAACL,SAAkB;AAC1B,MAAI,gBACH,QAAO,OAAO,CAAC;AAEhB,SAAO,OAAO;CACd;AACD;;;;AAKD,SAAgB,oBAA8B;AAC7C,QAAQ,CAACF,QAAiB;AACzB,MAAI,eAAmB;AACvB,SAAO,CAAE;CACT;AACD;;;;AAKD,SAAgB,oBAA8B;AAC7C,QAAQ,CAACE,SAAkB;AAC1B,MAAI,gBAAoB;AACxB,SAAO,CAAE;CACT;AACD"}
|
|
1
|
+
{"version":3,"file":"lazyAccessors-BVEtB9lU.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":";;;;;;;;;AAgBA,SAAgB,kBAAkBA,GAAsB;CACvD,IAAIC,aAA4C;AAEhD,QAAQ,CAACC,QAAiB;AACzB,MAAI,eAEH,QAAO,EAAE,IAAI,OAAO,IAAI;AAGzB,OAAK,WACJ,cAAa,EAAE,IAAI,QAAQ;AAE5B,SAAO;CACP;AACD;;;;;;AAOD,SAAgB,kBAAkBF,GAAsB;CACvD,IAAIG,aAA4C;AAEhD,QAAQ,CAACC,SAAkB;AAC1B,MAAI,gBAEH,QAAO,2BAAU,GAAG,KAAK;AAG1B,OAAK,YAAY;AAChB,gBAAa,CAAE;GACf,MAAM,eAAe,EAAE,IAAI,OAAO,SAAS;AAC3C,OAAI,aACH,MAAK,MAAM,QAAQ,aAAa,MAAM,IAAI,EAAE;IAC3C,MAAM,UAAU,KAAK,MAAM;IAC3B,MAAM,UAAU,QAAQ,QAAQ,IAAI;AACpC,QAAI,UAAU,GAAG;KAChB,MAAM,MAAM,QAAQ,MAAM,GAAG,QAAQ;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MAAI,eAAmB;AACvB,SAAO,CAAE;CACT;AACD;;;;AAKD,SAAgB,oBAA8B;AAC7C,QAAQ,CAACE,SAAkB;AAC1B,MAAI,gBAAoB;AACxB,SAAO,CAAE;CACT;AACD"}
|
|
@@ -172,4 +172,4 @@ function createNoopCookies() {
|
|
|
172
172
|
|
|
173
173
|
//#endregion
|
|
174
174
|
export { createApiGatewayCookies, createApiGatewayHeaders, createCookieHeaderAccessor, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, createObjectHeaders };
|
|
175
|
-
//# sourceMappingURL=lazyAccessors-
|
|
175
|
+
//# sourceMappingURL=lazyAccessors-DM6HcXQk.mjs.map
|
|
@@ -1 +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":";;;;;;;;AAgBA,SAAgB,kBAAkBA,GAAsB;CACvD,IAAIC,aAA4C;AAEhD,QAAQ,CAACC,QAAiB;AACzB,MAAI,eAEH,QAAO,EAAE,IAAI,OAAO,IAAI;AAGzB,OAAK,WACJ,cAAa,EAAE,IAAI,QAAQ;AAE5B,SAAO;CACP;AACD;;;;;;AAOD,SAAgB,kBAAkBF,GAAsB;CACvD,IAAIG,aAA4C;AAEhD,QAAQ,CAACC,SAAkB;AAC1B,MAAI,gBAEH,QAAO,UAAU,GAAG,KAAK;AAG1B,OAAK,YAAY;AAChB,gBAAa,CAAE;GACf,MAAM,eAAe,EAAE,IAAI,OAAO,SAAS;AAC3C,OAAI,aACH,MAAK,MAAM,QAAQ,aAAa,MAAM,IAAI,EAAE;IAC3C,MAAM,UAAU,KAAK,MAAM;IAC3B,MAAM,UAAU,QAAQ,QAAQ,IAAI;AACpC,QAAI,UAAU,GAAG;KAChB,MAAM,MAAM,QAAQ,MAAM,GAAG,QAAQ;KACrC,MAAM,QAAQ,QAAQ,MAAM,UAAU,EAAE;AACxC,gBAAW,OAAO;IAClB;GACD;EAEF;AACD,SAAO;CACP;AACD;;;;;AAMD,SAAgB,wBACfC,SACW;CACX,IAAIC,oBAAmD;CAEvD,MAAM,YAAY,MAAM;AACvB,OAAK,mBA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s","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":";;;;;;;;AAgBA,SAAgB,kBAAkBA,GAAsB;CACvD,IAAIC,aAA4C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2BACfM,cACW;CACX,IAAIC,SAAwC;CAE5C,MAAM,QAAQ,MAAM;AACnB,OAAK,QAAQ;AACZ,YAAS,CAAE;AACX,OAAI,aACH,MAAK,MAAM,QAAQ,aAAa,MAAM,IAAI,EAAE;IAC3C,MAAM,UAAU,KAAK,MAAM;IAC3B,MAAM,UAAU,QAAQ,QAAQ,IAAI;AACpC,QAAI,UAAU,GAAG;KAChB,MAAM,MAAM,QAAQ,MAAM,GAAG,QAAQ;KACrC,MAAM,QAAQ,QAAQ,MAAM,UAAU,EAAE;AAExC,YAAO,OAAO,mBAAmB,MAAM;IACvC;GACD;EAEF;AACD,SAAO;CACP;AAED,QAAQ,CAACL,SAAkB;AAC1B,MAAI,gBACH,QAAO,OAAO,CAAC;AAEhB,SAAO,OAAO;CACd;AACD;;;;AAKD,SAAgB,oBAA8B;AAC7C,QAAQ,CAACF,QAAiB;AACzB,MAAI,eAAmB;AACvB,SAAO,CAAE;CACT;AACD;;;;AAKD,SAAgB,oBAA8B;AAC7C,QAAQ,CAACE,SAAkB;AAC1B,MAAI,gBAAoB;AACxB,SAAO,CAAE;CACT;AACD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const qs = require_chunk.__toESM(require("qs"));
|
|
3
|
+
|
|
4
|
+
//#region src/endpoints/parseHonoQuery.ts
|
|
5
|
+
/**
|
|
6
|
+
* Parse Hono query parameters using qs bracket notation
|
|
7
|
+
* Supports nested objects, arrays, and deep nesting via standard bracket syntax
|
|
8
|
+
*/
|
|
9
|
+
function parseHonoQuery(c) {
|
|
10
|
+
const url = c.req.url;
|
|
11
|
+
const queryIndex = url.indexOf("?");
|
|
12
|
+
if (queryIndex === -1) return {};
|
|
13
|
+
const queryString = url.slice(queryIndex + 1);
|
|
14
|
+
return qs.default.parse(queryString);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
Object.defineProperty(exports, 'parseHonoQuery', {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return parseHonoQuery;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=parseHonoQuery-BBs8CX-H.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseHonoQuery-BBs8CX-H.cjs","names":["c: Context"],"sources":["../src/endpoints/parseHonoQuery.ts"],"sourcesContent":["import type { Context } from 'hono';\nimport qs from 'qs';\n\n/**\n * Parse Hono query parameters using qs bracket notation\n * Supports nested objects, arrays, and deep nesting via standard bracket syntax\n */\nexport function parseHonoQuery(c: Context): Record<string, any> {\n\tconst url = c.req.url;\n\tconst queryIndex = url.indexOf('?');\n\tif (queryIndex === -1) {\n\t\treturn {};\n\t}\n\tconst queryString = url.slice(queryIndex + 1);\n\treturn qs.parse(queryString) as Record<string, any>;\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,eAAeA,GAAiC;CAC/D,MAAM,MAAM,EAAE,IAAI;CAClB,MAAM,aAAa,IAAI,QAAQ,IAAI;AACnC,KAAI,eAAe,GAClB,QAAO,CAAE;CAEV,MAAM,cAAc,IAAI,MAAM,aAAa,EAAE;AAC7C,QAAO,WAAG,MAAM,YAAY;AAC5B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import qs from "qs";
|
|
2
|
+
|
|
3
|
+
//#region src/endpoints/parseHonoQuery.ts
|
|
4
|
+
/**
|
|
5
|
+
* Parse Hono query parameters using qs bracket notation
|
|
6
|
+
* Supports nested objects, arrays, and deep nesting via standard bracket syntax
|
|
7
|
+
*/
|
|
8
|
+
function parseHonoQuery(c) {
|
|
9
|
+
const url = c.req.url;
|
|
10
|
+
const queryIndex = url.indexOf("?");
|
|
11
|
+
if (queryIndex === -1) return {};
|
|
12
|
+
const queryString = url.slice(queryIndex + 1);
|
|
13
|
+
return qs.parse(queryString);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { parseHonoQuery };
|
|
18
|
+
//# sourceMappingURL=parseHonoQuery-Cp8CII0P.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseHonoQuery-Cp8CII0P.mjs","names":["c: Context"],"sources":["../src/endpoints/parseHonoQuery.ts"],"sourcesContent":["import type { Context } from 'hono';\nimport qs from 'qs';\n\n/**\n * Parse Hono query parameters using qs bracket notation\n * Supports nested objects, arrays, and deep nesting via standard bracket syntax\n */\nexport function parseHonoQuery(c: Context): Record<string, any> {\n\tconst url = c.req.url;\n\tconst queryIndex = url.indexOf('?');\n\tif (queryIndex === -1) {\n\t\treturn {};\n\t}\n\tconst queryString = url.slice(queryIndex + 1);\n\treturn qs.parse(queryString) as Record<string, any>;\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,eAAeA,GAAiC;CAC/D,MAAM,MAAM,EAAE,IAAI;CAClB,MAAM,aAAa,IAAI,QAAQ,IAAI;AACnC,KAAI,eAAe,GAClB,QAAO,CAAE;CAEV,MAAM,cAAc,IAAI,MAAM,aAAa,EAAE;AAC7C,QAAO,GAAG,MAAM,YAAY;AAC5B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const qs = require_chunk.__toESM(require("qs"));
|
|
3
|
+
|
|
4
|
+
//#region src/endpoints/parseQueryParams.ts
|
|
5
|
+
/**
|
|
6
|
+
* Parse query parameters from a flat object into a nested structure
|
|
7
|
+
* Uses qs bracket notation for standard interoperability
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* parseQueryParams({ 'tags[]': ['a', 'b'], 'filter[name]': 'john' })
|
|
11
|
+
* // Returns: { tags: ['a', 'b'], filter: { name: 'john' } }
|
|
12
|
+
*/
|
|
13
|
+
function parseQueryParams(queryParams) {
|
|
14
|
+
if (!queryParams) return {};
|
|
15
|
+
const parts = [];
|
|
16
|
+
for (const [key, value] of Object.entries(queryParams)) {
|
|
17
|
+
if (value === void 0) continue;
|
|
18
|
+
if (Array.isArray(value)) for (const v of value) parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);
|
|
19
|
+
else parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
|
|
20
|
+
}
|
|
21
|
+
return qs.default.parse(parts.join("&"));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
Object.defineProperty(exports, 'parseQueryParams', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return parseQueryParams;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=parseQueryParams-B4RK1za3.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseQueryParams-B4RK1za3.cjs","names":["queryParams: Record<string, string | string[] | undefined> | null","parts: string[]"],"sources":["../src/endpoints/parseQueryParams.ts"],"sourcesContent":["import qs from 'qs';\n\n/**\n * Parse query parameters from a flat object into a nested structure\n * Uses qs bracket notation for standard interoperability\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\t// Reconstruct a query string from the flat object so qs can parse bracket notation\n\tconst parts: string[] = [];\n\tfor (const [key, value] of Object.entries(queryParams)) {\n\t\tif (value === undefined) continue;\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (const v of value) {\n\t\t\t\tparts.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);\n\t\t\t}\n\t\t} else {\n\t\t\tparts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);\n\t\t}\n\t}\n\n\treturn qs.parse(parts.join('&')) as Record<string, any>;\n}\n"],"mappings":";;;;;;;;;;;;AAUA,SAAgB,iBACfA,aACsB;AACtB,MAAK,YACJ,QAAO,CAAE;CAIV,MAAMC,QAAkB,CAAE;AAC1B,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,EAAE;AACvD,MAAI,iBAAqB;AACzB,MAAI,MAAM,QAAQ,MAAM,CACvB,MAAK,MAAM,KAAK,MACf,OAAM,MAAM,EAAE,mBAAmB,IAAI,CAAC,GAAG,mBAAmB,EAAE,CAAC,EAAE;MAGlE,OAAM,MAAM,EAAE,mBAAmB,IAAI,CAAC,GAAG,mBAAmB,MAAM,CAAC,EAAE;CAEtE;AAED,QAAO,WAAG,MAAM,MAAM,KAAK,IAAI,CAAC;AAChC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import qs from "qs";
|
|
2
|
+
|
|
3
|
+
//#region src/endpoints/parseQueryParams.ts
|
|
4
|
+
/**
|
|
5
|
+
* Parse query parameters from a flat object into a nested structure
|
|
6
|
+
* Uses qs bracket notation for standard interoperability
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* parseQueryParams({ 'tags[]': ['a', 'b'], 'filter[name]': 'john' })
|
|
10
|
+
* // Returns: { tags: ['a', 'b'], filter: { name: 'john' } }
|
|
11
|
+
*/
|
|
12
|
+
function parseQueryParams(queryParams) {
|
|
13
|
+
if (!queryParams) return {};
|
|
14
|
+
const parts = [];
|
|
15
|
+
for (const [key, value] of Object.entries(queryParams)) {
|
|
16
|
+
if (value === void 0) continue;
|
|
17
|
+
if (Array.isArray(value)) for (const v of value) parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);
|
|
18
|
+
else parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
|
|
19
|
+
}
|
|
20
|
+
return qs.parse(parts.join("&"));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { parseQueryParams };
|
|
25
|
+
//# sourceMappingURL=parseQueryParams-DS3Qmrbd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseQueryParams-DS3Qmrbd.mjs","names":["queryParams: Record<string, string | string[] | undefined> | null","parts: string[]"],"sources":["../src/endpoints/parseQueryParams.ts"],"sourcesContent":["import qs from 'qs';\n\n/**\n * Parse query parameters from a flat object into a nested structure\n * Uses qs bracket notation for standard interoperability\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\t// Reconstruct a query string from the flat object so qs can parse bracket notation\n\tconst parts: string[] = [];\n\tfor (const [key, value] of Object.entries(queryParams)) {\n\t\tif (value === undefined) continue;\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (const v of value) {\n\t\t\t\tparts.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);\n\t\t\t}\n\t\t} else {\n\t\t\tparts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);\n\t\t}\n\t}\n\n\treturn qs.parse(parts.join('&')) as Record<string, any>;\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,iBACfA,aACsB;AACtB,MAAK,YACJ,QAAO,CAAE;CAIV,MAAMC,QAAkB,CAAE;AAC1B,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,YAAY,EAAE;AACvD,MAAI,iBAAqB;AACzB,MAAI,MAAM,QAAQ,MAAM,CACvB,MAAK,MAAM,KAAK,MACf,OAAM,MAAM,EAAE,mBAAmB,IAAI,CAAC,GAAG,mBAAmB,EAAE,CAAC,EAAE;MAGlE,OAAM,MAAM,EAAE,mBAAmB,IAAI,CAAC,GAAG,mBAAmB,MAAM,CAAC,EAAE;CAEtE;AAED,QAAO,GAAG,MAAM,MAAM,KAAK,IAAI,CAAC;AAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rls-
|
|
1
|
+
{"version":3,"file":"rls-BrywnrQb.cjs","names":[],"sources":["../src/endpoints/rls.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport type { Service, ServiceRecord } from '@geekmidas/services';\nimport type { CookieFn, HeaderFn } from './Endpoint';\n\n/**\n * RLS context - key-value pairs to set as PostgreSQL session variables.\n * Keys become `prefix.key` (e.g., `app.user_id`).\n */\nexport interface RlsContext {\n\t[key: string]: string | number | boolean | null | undefined;\n}\n\n/**\n * Function type for extracting RLS context from request context.\n *\n * @template TServices - Available service dependencies\n * @template TSession - Session data type\n * @template TLogger - Logger type\n *\n * @example\n * ```ts\n * const extractor: RlsContextExtractor<[], UserSession> = ({ session }) => ({\n * user_id: session.userId,\n * tenant_id: session.tenantId,\n * roles: session.roles.join(','),\n * });\n * ```\n */\nexport type RlsContextExtractor<\n\tTServices extends Service[] = [],\n\tTSession = unknown,\n\tTLogger extends Logger = Logger,\n> = (ctx: {\n\tservices: ServiceRecord<TServices>;\n\tsession: TSession;\n\theader: HeaderFn;\n\tcookie: CookieFn;\n\tlogger: TLogger;\n}) => RlsContext | Promise<RlsContext>;\n\n/**\n * Configuration for RLS on an endpoint or factory.\n *\n * @template TServices - Available service dependencies\n * @template TSession - Session data type\n * @template TLogger - Logger type\n */\nexport interface RlsConfig<\n\tTServices extends Service[] = [],\n\tTSession = unknown,\n\tTLogger extends Logger = Logger,\n> {\n\t/** Function to extract RLS context from request */\n\textractor: RlsContextExtractor<TServices, TSession, TLogger>;\n\t/** Prefix for PostgreSQL session variables (default: 'app') */\n\tprefix?: string;\n}\n\n/**\n * Symbol used to bypass RLS for an endpoint.\n */\nexport const RLS_BYPASS = Symbol.for('geekmidas.rls.bypass');\n\n/**\n * Type for RLS bypass marker.\n */\nexport type RlsBypass = typeof RLS_BYPASS;\n"],"mappings":";;;;;AA6DA,MAAa,aAAa,OAAO,IAAI,uBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rls-
|
|
1
|
+
{"version":3,"file":"rls-C0cWOnk4.mjs","names":[],"sources":["../src/endpoints/rls.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport type { Service, ServiceRecord } from '@geekmidas/services';\nimport type { CookieFn, HeaderFn } from './Endpoint';\n\n/**\n * RLS context - key-value pairs to set as PostgreSQL session variables.\n * Keys become `prefix.key` (e.g., `app.user_id`).\n */\nexport interface RlsContext {\n\t[key: string]: string | number | boolean | null | undefined;\n}\n\n/**\n * Function type for extracting RLS context from request context.\n *\n * @template TServices - Available service dependencies\n * @template TSession - Session data type\n * @template TLogger - Logger type\n *\n * @example\n * ```ts\n * const extractor: RlsContextExtractor<[], UserSession> = ({ session }) => ({\n * user_id: session.userId,\n * tenant_id: session.tenantId,\n * roles: session.roles.join(','),\n * });\n * ```\n */\nexport type RlsContextExtractor<\n\tTServices extends Service[] = [],\n\tTSession = unknown,\n\tTLogger extends Logger = Logger,\n> = (ctx: {\n\tservices: ServiceRecord<TServices>;\n\tsession: TSession;\n\theader: HeaderFn;\n\tcookie: CookieFn;\n\tlogger: TLogger;\n}) => RlsContext | Promise<RlsContext>;\n\n/**\n * Configuration for RLS on an endpoint or factory.\n *\n * @template TServices - Available service dependencies\n * @template TSession - Session data type\n * @template TLogger - Logger type\n */\nexport interface RlsConfig<\n\tTServices extends Service[] = [],\n\tTSession = unknown,\n\tTLogger extends Logger = Logger,\n> {\n\t/** Function to extract RLS context from request */\n\textractor: RlsContextExtractor<TServices, TSession, TLogger>;\n\t/** Prefix for PostgreSQL session variables (default: 'app') */\n\tprefix?: string;\n}\n\n/**\n * Symbol used to bypass RLS for an endpoint.\n */\nexport const RLS_BYPASS = Symbol.for('geekmidas.rls.bypass');\n\n/**\n * Type for RLS bypass marker.\n */\nexport type RlsBypass = typeof RLS_BYPASS;\n"],"mappings":";;;;AA6DA,MAAa,aAAa,OAAO,IAAI,uBAAuB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const require_AWSLambdaSubscriberAdaptor = require('../AWSLambdaSubscriberAdaptor-
|
|
1
|
+
const require_AWSLambdaSubscriberAdaptor = require('../AWSLambdaSubscriberAdaptor-eZ3qoKvK.cjs');
|
|
2
2
|
|
|
3
3
|
exports.AWSLambdaSubscriber = require_AWSLambdaSubscriberAdaptor.AWSLambdaSubscriber;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require('../Construct-BXG8cFSm.cjs');
|
|
2
|
-
require('../Subscriber-
|
|
3
|
-
const require_SubscriberBuilder = require('../SubscriberBuilder-
|
|
2
|
+
require('../Subscriber-ClqSPbIZ.cjs');
|
|
3
|
+
const require_SubscriberBuilder = require('../SubscriberBuilder-BS5B_688.cjs');
|
|
4
4
|
|
|
5
5
|
exports.SubscriberBuilder = require_SubscriberBuilder.SubscriberBuilder;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../Construct-CQ9zV58W.mjs";
|
|
2
|
-
import "../Subscriber-
|
|
3
|
-
import { SubscriberBuilder } from "../SubscriberBuilder-
|
|
2
|
+
import "../Subscriber-DKQK5gLD.mjs";
|
|
3
|
+
import { SubscriberBuilder } from "../SubscriberBuilder-BswTuvUc.mjs";
|
|
4
4
|
|
|
5
5
|
export { SubscriberBuilder };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require('../Construct-BXG8cFSm.cjs');
|
|
2
|
-
const require_Subscriber = require('../Subscriber-
|
|
3
|
-
const require_SubscriberBuilder = require('../SubscriberBuilder-
|
|
2
|
+
const require_Subscriber = require('../Subscriber-ClqSPbIZ.cjs');
|
|
3
|
+
const require_SubscriberBuilder = require('../SubscriberBuilder-BS5B_688.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/subscribers/index.ts
|
|
6
6
|
const s = new require_SubscriberBuilder.SubscriberBuilder();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../Construct-CX7HyFfT.cjs";
|
|
2
2
|
import { Subscriber } from "../Subscriber-1rDE7HuM.cjs";
|
|
3
3
|
import { SubscriberBuilder } from "../SubscriberBuilder-B9uva8fZ.cjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _geekmidas_logger7 from "@geekmidas/logger";
|
|
5
5
|
|
|
6
6
|
//#region src/subscribers/index.d.ts
|
|
7
|
-
declare const s: SubscriberBuilder<[],
|
|
7
|
+
declare const s: SubscriberBuilder<[], _geekmidas_logger7.Logger, undefined, undefined, string, []>;
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/subscribers/index.ts"],"sourcesContent":[],"mappings":";;;;;;cAKa,GAAC,sBAA0B,
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/subscribers/index.ts"],"sourcesContent":[],"mappings":";;;;;;cAKa,GAAC,sBAA0B,kBAAA,CAA1B,MAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../Construct-C2SyofdS.mjs";
|
|
2
2
|
import { Subscriber } from "../Subscriber-BgB3RRxb.mjs";
|
|
3
3
|
import { SubscriberBuilder } from "../SubscriberBuilder-DaQkh2Nt.mjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _geekmidas_logger7 from "@geekmidas/logger";
|
|
5
5
|
|
|
6
6
|
//#region src/subscribers/index.d.ts
|
|
7
|
-
declare const s: SubscriberBuilder<[],
|
|
7
|
+
declare const s: SubscriberBuilder<[], _geekmidas_logger7.Logger, undefined, undefined, string, []>;
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/subscribers/index.ts"],"sourcesContent":[],"mappings":";;;;;;cAKa,GAAC,sBAA0B,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/subscribers/index.ts"],"sourcesContent":[],"mappings":";;;;;;cAKa,GAAC,sBAA0B,kBAAA,CAA1B,MAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../Construct-CQ9zV58W.mjs";
|
|
2
|
-
import { Subscriber } from "../Subscriber-
|
|
3
|
-
import { SubscriberBuilder } from "../SubscriberBuilder-
|
|
2
|
+
import { Subscriber } from "../Subscriber-DKQK5gLD.mjs";
|
|
3
|
+
import { SubscriberBuilder } from "../SubscriberBuilder-BswTuvUc.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/subscribers/index.ts
|
|
6
6
|
const s = new SubscriberBuilder();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/constructs",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
"lodash.pick": "~4.4.0",
|
|
66
66
|
"lodash.set": "~4.3.2",
|
|
67
67
|
"lodash.uniqby": "~4.7.0",
|
|
68
|
-
"openapi-types": "~12.1.3"
|
|
68
|
+
"openapi-types": "~12.1.3",
|
|
69
|
+
"qs": "~6.15.0"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
72
|
"@types/lodash.compact": "~3.0.9",
|
|
@@ -74,36 +75,37 @@
|
|
|
74
75
|
"@types/lodash.set": "~4.3.9",
|
|
75
76
|
"@types/lodash.uniqby": "~4.7.9",
|
|
76
77
|
"@types/pg": "~8.15.6",
|
|
78
|
+
"@types/qs": "~6.15.0",
|
|
77
79
|
"better-auth": "~1.4.18",
|
|
78
80
|
"kysely": "~0.28.8",
|
|
79
81
|
"pg": "~8.16.3",
|
|
80
82
|
"zod": "~4.1.13",
|
|
81
83
|
"@geekmidas/audit": "^2.0.0",
|
|
82
84
|
"@geekmidas/cache": "^1.1.0",
|
|
83
|
-
"@geekmidas/db": "^1.0.
|
|
85
|
+
"@geekmidas/db": "^1.0.1",
|
|
86
|
+
"@geekmidas/envkit": "^1.0.4",
|
|
84
87
|
"@geekmidas/errors": "^1.0.0",
|
|
85
|
-
"@geekmidas/
|
|
86
|
-
"@geekmidas/events": "^1.1.0",
|
|
88
|
+
"@geekmidas/logger": "^1.0.0",
|
|
87
89
|
"@geekmidas/schema": "^1.0.0",
|
|
88
90
|
"@geekmidas/services": "^1.0.1",
|
|
89
|
-
"@geekmidas/
|
|
90
|
-
"@geekmidas/
|
|
91
|
-
"@geekmidas/
|
|
91
|
+
"@geekmidas/rate-limit": "^2.0.0",
|
|
92
|
+
"@geekmidas/events": "^1.1.0",
|
|
93
|
+
"@geekmidas/testkit": "^1.0.5"
|
|
92
94
|
},
|
|
93
95
|
"peerDependencies": {
|
|
94
96
|
"@middy/core": ">=6.3.1",
|
|
95
97
|
"@types/aws-lambda": ">=8.10.92",
|
|
96
98
|
"hono": ">=4.8.2",
|
|
97
99
|
"@geekmidas/audit": "^2.0.0",
|
|
98
|
-
"@geekmidas/db": "^1.0.0",
|
|
99
|
-
"@geekmidas/envkit": "^1.0.3",
|
|
100
|
-
"@geekmidas/errors": "^1.0.0",
|
|
101
100
|
"@geekmidas/cache": "^1.1.0",
|
|
102
|
-
"@geekmidas/
|
|
101
|
+
"@geekmidas/db": "^1.0.1",
|
|
102
|
+
"@geekmidas/envkit": "^1.0.4",
|
|
103
103
|
"@geekmidas/logger": "^1.0.0",
|
|
104
|
-
"@geekmidas/
|
|
104
|
+
"@geekmidas/events": "^1.1.0",
|
|
105
|
+
"@geekmidas/errors": "^1.0.0",
|
|
105
106
|
"@geekmidas/schema": "^1.0.0",
|
|
106
|
-
"@geekmidas/services": "^1.0.1"
|
|
107
|
+
"@geekmidas/services": "^1.0.1",
|
|
108
|
+
"@geekmidas/rate-limit": "^2.0.0"
|
|
107
109
|
},
|
|
108
110
|
"peerDependenciesMeta": {
|
|
109
111
|
"@geekmidas/audit": {
|
|
@@ -145,6 +145,11 @@ export abstract class AmazonApiGatewayEndpoint<
|
|
|
145
145
|
}
|
|
146
146
|
abstract getInput(e: TEvent): GetInputResponse;
|
|
147
147
|
|
|
148
|
+
protected getCookies(e: TEvent): CookieFn {
|
|
149
|
+
const headers = e.headers as Record<string, string>;
|
|
150
|
+
return Endpoint.createCookies(headers?.cookie);
|
|
151
|
+
}
|
|
152
|
+
|
|
148
153
|
private input(): Middleware<TEvent, TInput, TServices, TLogger> {
|
|
149
154
|
return {
|
|
150
155
|
before: async (req) => {
|
|
@@ -152,7 +157,7 @@ export abstract class AmazonApiGatewayEndpoint<
|
|
|
152
157
|
const { body, query, params } = this.getInput(req.event);
|
|
153
158
|
const headers = req.event.headers as Record<string, string>;
|
|
154
159
|
const header = Endpoint.createHeaders(headers);
|
|
155
|
-
const cookie =
|
|
160
|
+
const cookie = this.getCookies(req.event);
|
|
156
161
|
|
|
157
162
|
set(req.event, 'body', await this.endpoint.parseInput(body, 'body'));
|
|
158
163
|
|
|
@@ -4,6 +4,7 @@ import type { Logger } from '@geekmidas/logger';
|
|
|
4
4
|
import type { Service } from '@geekmidas/services';
|
|
5
5
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
6
6
|
import type { APIGatewayProxyEventV2, Context } from 'aws-lambda';
|
|
7
|
+
import qs from 'qs';
|
|
7
8
|
import type { HttpMethod } from '../types';
|
|
8
9
|
import {
|
|
9
10
|
AmazonApiGatewayEndpoint,
|
|
@@ -12,8 +13,8 @@ import {
|
|
|
12
13
|
type GetInputResponse,
|
|
13
14
|
type LoggerContext,
|
|
14
15
|
} from './AmazonApiGatewayEndpointAdaptor';
|
|
15
|
-
import type { Endpoint, EndpointSchemas } from './Endpoint';
|
|
16
|
-
import {
|
|
16
|
+
import type { CookieFn, Endpoint, EndpointSchemas } from './Endpoint';
|
|
17
|
+
import { createApiGatewayCookies } from './lazyAccessors';
|
|
17
18
|
|
|
18
19
|
export class AmazonApiGatewayV2Endpoint<
|
|
19
20
|
TRoute extends string,
|
|
@@ -36,26 +37,17 @@ export class AmazonApiGatewayV2Endpoint<
|
|
|
36
37
|
TSession,
|
|
37
38
|
TEventPublisher
|
|
38
39
|
> {
|
|
39
|
-
override
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (value !== undefined) {
|
|
46
|
-
// Check if value contains comma and could be an array
|
|
47
|
-
// Be careful not to split values that legitimately contain commas
|
|
48
|
-
if (value.includes(',') && !value.includes('"')) {
|
|
49
|
-
processedParams[key] = value.split(',').map((v) => v.trim());
|
|
50
|
-
} else {
|
|
51
|
-
processedParams[key] = value;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
40
|
+
override getCookies(e: APIGatewayProxyEventV2): CookieFn {
|
|
41
|
+
return createApiGatewayCookies(
|
|
42
|
+
e.cookies,
|
|
43
|
+
(e.headers as Record<string, string>)?.cookie,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
55
46
|
|
|
47
|
+
override getInput(e: APIGatewayProxyEventV2): GetInputResponse {
|
|
56
48
|
return {
|
|
57
49
|
body: e.body ? JSON.parse(e.body) : undefined,
|
|
58
|
-
query:
|
|
50
|
+
query: qs.parse(e.rawQueryString) as Record<string, any>,
|
|
59
51
|
params: e.pathParameters || {},
|
|
60
52
|
};
|
|
61
53
|
}
|
|
@@ -775,7 +775,7 @@ describe('AmazonApiGatewayV1Endpoint', () => {
|
|
|
775
775
|
});
|
|
776
776
|
|
|
777
777
|
describe('combined inputs', () => {
|
|
778
|
-
it('should handle array query parameters', async () => {
|
|
778
|
+
it('should handle array query parameters with bracket notation', async () => {
|
|
779
779
|
const querySchema = z.object({
|
|
780
780
|
tags: z.array(z.string()),
|
|
781
781
|
page: z.coerce.number().default(1),
|
|
@@ -808,9 +808,9 @@ describe('AmazonApiGatewayV1Endpoint', () => {
|
|
|
808
808
|
const handler = adapter.handler;
|
|
809
809
|
|
|
810
810
|
const event = createMockV1Event({
|
|
811
|
-
queryStringParameters: { tags: 'nodejs', page: '2' },
|
|
811
|
+
queryStringParameters: { 'tags[]': 'nodejs', page: '2' },
|
|
812
812
|
multiValueQueryStringParameters: {
|
|
813
|
-
tags: ['nodejs', 'typescript', 'javascript'],
|
|
813
|
+
'tags[]': ['nodejs', 'typescript', 'javascript'],
|
|
814
814
|
page: ['2'],
|
|
815
815
|
},
|
|
816
816
|
});
|
|
@@ -825,7 +825,7 @@ describe('AmazonApiGatewayV1Endpoint', () => {
|
|
|
825
825
|
});
|
|
826
826
|
});
|
|
827
827
|
|
|
828
|
-
it('should handle object query parameters with
|
|
828
|
+
it('should handle object query parameters with bracket notation', async () => {
|
|
829
829
|
const querySchema = z.object({
|
|
830
830
|
filter: z.object({
|
|
831
831
|
name: z.string(),
|
|
@@ -867,9 +867,9 @@ describe('AmazonApiGatewayV1Endpoint', () => {
|
|
|
867
867
|
|
|
868
868
|
const event = createMockV1Event({
|
|
869
869
|
queryStringParameters: {
|
|
870
|
-
'filter
|
|
871
|
-
'filter
|
|
872
|
-
'filter
|
|
870
|
+
'filter[name]': 'john',
|
|
871
|
+
'filter[status]': 'active',
|
|
872
|
+
'filter[priority]': '1',
|
|
873
873
|
sort: 'priority',
|
|
874
874
|
},
|
|
875
875
|
});
|
|
@@ -635,7 +635,7 @@ describe('AmazonApiGatewayV2Endpoint Events', () => {
|
|
|
635
635
|
expect(mockPublisher.publish).not.toHaveBeenCalled();
|
|
636
636
|
});
|
|
637
637
|
|
|
638
|
-
it('should handle
|
|
638
|
+
it('should handle bracket notation array query parameters', async () => {
|
|
639
639
|
const mockPublisher: EventPublisher<TestEvent> = {
|
|
640
640
|
publish: vi.fn().mockResolvedValue(undefined),
|
|
641
641
|
};
|
|
@@ -702,8 +702,10 @@ describe('AmazonApiGatewayV2Endpoint Events', () => {
|
|
|
702
702
|
},
|
|
703
703
|
},
|
|
704
704
|
pathParameters: { id: '123' },
|
|
705
|
+
rawQueryString:
|
|
706
|
+
'tags%5B%5D=javascript&tags%5B%5D=typescript&tags%5B%5D=nodejs',
|
|
705
707
|
queryStringParameters: {
|
|
706
|
-
tags: 'javascript,
|
|
708
|
+
'tags[]': 'javascript,typescript,nodejs',
|
|
707
709
|
},
|
|
708
710
|
});
|
|
709
711
|
const context = createMockContext();
|