@geekmidas/constructs 7.0.1 → 10.0.0-alpha.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/README.md +71 -44
- package/dist/{AWSScheduledFunction-ysaCsdWx.d.mts → AWSScheduledFunction-BvFvBsBN.d.cts} +10 -5
- package/dist/{AWSScheduledFunction-ysaCsdWx.d.mts.map → AWSScheduledFunction-BvFvBsBN.d.cts.map} +1 -1
- package/dist/{AWSScheduledFunction-CTIa90EH.d.cts → AWSScheduledFunction-CVccZO-L.d.mts} +10 -5
- package/dist/{AWSScheduledFunction-CTIa90EH.d.cts.map → AWSScheduledFunction-CVccZO-L.d.mts.map} +1 -1
- package/dist/{AWSScheduledFunction-CufMMhGB.mjs → AWSScheduledFunction-Db1lttJH.mjs} +3 -3
- package/dist/{AWSScheduledFunction-CufMMhGB.mjs.map → AWSScheduledFunction-Db1lttJH.mjs.map} +1 -1
- package/dist/{AWSScheduledFunction-DbkDr8CA.cjs → AWSScheduledFunction-qu4ieRZR.cjs} +9 -9
- package/dist/{AWSScheduledFunction-DbkDr8CA.cjs.map → AWSScheduledFunction-qu4ieRZR.cjs.map} +1 -1
- package/dist/{Construct-_1wX7p_Y.d.cts → Construct-B-xc0SE9.d.mts} +27 -5
- package/dist/Construct-B-xc0SE9.d.mts.map +1 -0
- package/dist/{Construct-r0U2zBwW.mjs → Construct-HmWM6YYu.mjs} +4 -3
- package/dist/Construct-HmWM6YYu.mjs.map +1 -0
- package/dist/{Construct-DCMuYOox.d.mts → Construct-WhCXIOPV.d.cts} +29 -7
- package/dist/Construct-WhCXIOPV.d.cts.map +1 -0
- package/dist/{Construct-vXMZJgRp.cjs → Construct-roId57cU.cjs} +7 -43
- package/dist/Construct-roId57cU.cjs.map +1 -0
- package/dist/{lazyAccessors-DmTG8sQH.cjs → Endpoint-BBkV6l0k.cjs} +869 -1079
- package/dist/Endpoint-BBkV6l0k.cjs.map +1 -0
- package/dist/{lazyAccessors-DfqZR6C4.mjs → Endpoint-BGwpNEX4.mjs} +840 -1003
- package/dist/Endpoint-BGwpNEX4.mjs.map +1 -0
- package/dist/{Endpoint-CAzNbDEt.d.cts → Endpoint-BnxZqIX-.d.cts} +53 -4
- package/dist/Endpoint-BnxZqIX-.d.cts.map +1 -0
- package/dist/{Endpoint-CLPSIl6S.d.mts → Endpoint-ROcXU-eH.d.mts} +55 -6
- package/dist/Endpoint-ROcXU-eH.d.mts.map +1 -0
- package/dist/EndpointFactory-DYoGLaIT.cjs +850 -0
- package/dist/EndpointFactory-DYoGLaIT.cjs.map +1 -0
- package/dist/EndpointFactory-Di0X9AWp.mjs +808 -0
- package/dist/EndpointFactory-Di0X9AWp.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-DJDT3PMx.mjs → HonoEndpointAdaptor-DFKIIG2o.mjs} +5 -4
- package/dist/HonoEndpointAdaptor-DFKIIG2o.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-CkJENANP.cjs → HonoEndpointAdaptor-wMsCyMgt.cjs} +24 -23
- package/dist/HonoEndpointAdaptor-wMsCyMgt.cjs.map +1 -0
- package/dist/{Queue-DaxjwmOQ.d.cts → Queue-D6WeziRD.d.cts} +43 -4
- package/dist/Queue-D6WeziRD.d.cts.map +1 -0
- package/dist/{Queue-HBDf0fqz.d.mts → Queue-DpUeqdC8.d.mts} +43 -4
- package/dist/Queue-DpUeqdC8.d.mts.map +1 -0
- package/dist/{Subscriber-B69ngPwl.d.cts → Subscriber-4rBJgDKI.d.mts} +9 -4
- package/dist/{Subscriber-B69ngPwl.d.cts.map → Subscriber-4rBJgDKI.d.mts.map} +1 -1
- package/dist/{Subscriber-D8Xm-86W.d.mts → Subscriber-DVQowdyj.d.cts} +11 -6
- package/dist/Subscriber-DVQowdyj.d.cts.map +1 -0
- package/dist/{Topic-C5ZMfveW.d.cts → Topic-Ohx9dvWr.d.cts} +33 -2
- package/dist/Topic-Ohx9dvWr.d.cts.map +1 -0
- package/dist/{Topic-DT10AqHk.d.mts → Topic-cmy2jOUy.d.mts} +33 -2
- package/dist/Topic-cmy2jOUy.d.mts.map +1 -0
- package/dist/adaptors/aws.cjs +39 -26
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +24 -16
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +25 -17
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +26 -14
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +9 -6
- package/dist/adaptors/hono.d.cts +7 -6
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +8 -7
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +9 -6
- package/dist/adaptors/testing.cjs +18 -14
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +7 -6
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +11 -10
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +10 -7
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth.cjs +165 -0
- package/dist/auth.cjs.map +1 -0
- package/dist/auth.d.cts +108 -0
- package/dist/auth.d.cts.map +1 -0
- package/dist/auth.d.mts +108 -0
- package/dist/auth.d.mts.map +1 -0
- package/dist/auth.mjs +164 -0
- package/dist/auth.mjs.map +1 -0
- package/dist/cache-0ANvRQnD.mjs +51 -0
- package/dist/cache-0ANvRQnD.mjs.map +1 -0
- package/dist/cache-3WSvAulx.cjs +57 -0
- package/dist/cache-3WSvAulx.cjs.map +1 -0
- package/dist/cache-CdQ7OLpR.d.cts +47 -0
- package/dist/cache-CdQ7OLpR.d.cts.map +1 -0
- package/dist/cache-DYoJFcfd.d.mts +47 -0
- package/dist/cache-DYoJFcfd.d.mts.map +1 -0
- package/dist/cache.cjs +3 -0
- package/dist/cache.d.cts +3 -0
- package/dist/cache.d.mts +3 -0
- package/dist/cache.mjs +3 -0
- package/dist/chunk-DWy1uDak.cjs +39 -0
- package/dist/clone-DblgEZZa.mjs +39 -0
- package/dist/clone-DblgEZZa.mjs.map +1 -0
- package/dist/clone-Dy0cR2SZ.cjs +45 -0
- package/dist/clone-Dy0cR2SZ.cjs.map +1 -0
- package/dist/construct-interface-BfjcOD_E.cjs +117 -0
- package/dist/construct-interface-BfjcOD_E.cjs.map +1 -0
- package/dist/construct-interface-BqwRNYA2.d.mts +131 -0
- package/dist/construct-interface-BqwRNYA2.d.mts.map +1 -0
- package/dist/construct-interface-D2nNkHUN.d.cts +131 -0
- package/dist/construct-interface-D2nNkHUN.d.cts.map +1 -0
- package/dist/construct-interface-Z4CpS8tK.mjs +81 -0
- package/dist/construct-interface-Z4CpS8tK.mjs.map +1 -0
- package/dist/construct-interface.cjs +8 -0
- package/dist/construct-interface.d.cts +2 -0
- package/dist/construct-interface.d.mts +2 -0
- package/dist/construct-interface.mjs +3 -0
- package/dist/credential.cjs +96 -0
- package/dist/credential.cjs.map +1 -0
- package/dist/credential.d.cts +61 -0
- package/dist/credential.d.cts.map +1 -0
- package/dist/credential.d.mts +61 -0
- package/dist/credential.d.mts.map +1 -0
- package/dist/credential.mjs +94 -0
- package/dist/credential.mjs.map +1 -0
- package/dist/crons/index.cjs +39 -37
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +21 -8
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +29 -13
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +37 -36
- package/dist/crons/index.mjs.map +1 -1
- package/dist/database/kysely.cjs +181 -0
- package/dist/database/kysely.cjs.map +1 -0
- package/dist/database/kysely.d.cts +152 -0
- package/dist/database/kysely.d.cts.map +1 -0
- package/dist/database/kysely.d.mts +152 -0
- package/dist/database/kysely.d.mts.map +1 -0
- package/dist/database/kysely.mjs +180 -0
- package/dist/database/kysely.mjs.map +1 -0
- package/dist/email.cjs +59 -0
- package/dist/email.cjs.map +1 -0
- package/dist/email.d.cts +50 -0
- package/dist/email.d.cts.map +1 -0
- package/dist/email.d.mts +50 -0
- package/dist/email.d.mts.map +1 -0
- package/dist/email.mjs +58 -0
- package/dist/email.mjs.map +1 -0
- package/dist/endpoints/index.cjs +21 -747
- package/dist/endpoints/index.d.cts +7 -343
- package/dist/endpoints/index.d.mts +7 -342
- package/dist/endpoints/index.mjs +11 -738
- package/dist/file-server.cjs +154 -0
- package/dist/file-server.cjs.map +1 -0
- package/dist/file-server.d.cts +156 -0
- package/dist/file-server.d.cts.map +1 -0
- package/dist/file-server.d.mts +156 -0
- package/dist/file-server.d.mts.map +1 -0
- package/dist/file-server.mjs +152 -0
- package/dist/file-server.mjs.map +1 -0
- package/dist/functions/index.cjs +4 -2
- package/dist/functions/index.d.cts +3 -2
- package/dist/functions/index.d.mts +3 -2
- package/dist/functions/index.mjs +4 -2
- package/dist/{functions-B-qt91O7.mjs → functions-CvT_q7Y4.mjs} +55 -51
- package/dist/functions-CvT_q7Y4.mjs.map +1 -0
- package/dist/{functions-C8i1kCMM.cjs → functions-DukjG8ov.cjs} +62 -57
- package/dist/functions-DukjG8ov.cjs.map +1 -0
- package/dist/index-7OcOWe75.d.cts +419 -0
- package/dist/index-7OcOWe75.d.cts.map +1 -0
- package/dist/index-Bt-F7u8L.d.mts +419 -0
- package/dist/index-Bt-F7u8L.d.mts.map +1 -0
- package/dist/{index-DP6fqv0I.d.mts → index-CPeqtKgq.d.mts} +48 -19
- package/dist/index-CPeqtKgq.d.mts.map +1 -0
- package/dist/{index-BGeTScmi.d.cts → index-Dadljnh_.d.cts} +36 -9
- package/dist/index-Dadljnh_.d.cts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/lazyAccessors-DM6HcXQk.mjs +175 -0
- package/dist/lazyAccessors-DM6HcXQk.mjs.map +1 -0
- package/dist/lazyAccessors-DrJj8NpA.cjs +223 -0
- package/dist/lazyAccessors-DrJj8NpA.cjs.map +1 -0
- package/dist/object-storage.cjs +48 -0
- package/dist/object-storage.cjs.map +1 -0
- package/dist/object-storage.d.cts +36 -0
- package/dist/object-storage.d.cts.map +1 -0
- package/dist/object-storage.d.mts +36 -0
- package/dist/object-storage.d.mts.map +1 -0
- package/dist/object-storage.mjs +47 -0
- package/dist/object-storage.mjs.map +1 -0
- package/dist/{processAudits-CKjjivyz.cjs → processAudits-Bc8rz6Ev.cjs} +3 -3
- package/dist/{processAudits-CKjjivyz.cjs.map → processAudits-Bc8rz6Ev.cjs.map} +1 -1
- package/dist/{processAudits-ySnizdMG.mjs → processAudits-D89tICM4.mjs} +1 -1
- package/dist/{processAudits-ySnizdMG.mjs.map → processAudits-D89tICM4.mjs.map} +1 -1
- package/dist/{publisher-BrFOF847.mjs → publisher-CGEo8UKD.mjs} +1 -1
- package/dist/{publisher-BrFOF847.mjs.map → publisher-CGEo8UKD.mjs.map} +1 -1
- package/dist/{publisher-lFQleddL.cjs → publisher-CqGsXB2X.cjs} +1 -1
- package/dist/{publisher-lFQleddL.cjs.map → publisher-CqGsXB2X.cjs.map} +1 -1
- package/dist/queue/index.cjs +92 -30
- package/dist/queue/index.cjs.map +1 -1
- package/dist/queue/index.d.cts +19 -4
- package/dist/queue/index.d.cts.map +1 -1
- package/dist/queue/index.d.mts +22 -6
- package/dist/queue/index.d.mts.map +1 -1
- package/dist/queue/index.mjs +90 -29
- package/dist/queue/index.mjs.map +1 -1
- package/dist/rest-api.cjs +187 -0
- package/dist/rest-api.cjs.map +1 -0
- package/dist/rest-api.d.cts +221 -0
- package/dist/rest-api.d.cts.map +1 -0
- package/dist/rest-api.d.mts +221 -0
- package/dist/rest-api.d.mts.map +1 -0
- package/dist/rest-api.mjs +186 -0
- package/dist/rest-api.mjs.map +1 -0
- package/dist/site.cjs +48 -0
- package/dist/site.cjs.map +1 -0
- package/dist/site.d.cts +101 -0
- package/dist/site.d.cts.map +1 -0
- package/dist/site.d.mts +101 -0
- package/dist/site.d.mts.map +1 -0
- package/dist/site.mjs +47 -0
- package/dist/site.mjs.map +1 -0
- package/dist/subscribers/index.cjs +35 -27
- package/dist/subscribers/index.cjs.map +1 -1
- package/dist/subscribers/index.d.cts +20 -5
- package/dist/subscribers/index.d.cts.map +1 -1
- package/dist/subscribers/index.d.mts +23 -7
- package/dist/subscribers/index.d.mts.map +1 -1
- package/dist/subscribers/index.mjs +34 -27
- package/dist/subscribers/index.mjs.map +1 -1
- package/dist/surfaceEnv-BFXEms2f.cjs +39 -0
- package/dist/surfaceEnv-BFXEms2f.cjs.map +1 -0
- package/dist/surfaceEnv-C3Ktahea.mjs +27 -0
- package/dist/surfaceEnv-C3Ktahea.mjs.map +1 -0
- package/dist/{telemetry-3vdxGn4q.d.mts → telemetry-C3L0iS28.d.cts} +2 -2
- package/dist/{telemetry-3vdxGn4q.d.mts.map → telemetry-C3L0iS28.d.cts.map} +1 -1
- package/dist/{telemetry-Dqx-D3F7.d.cts → telemetry-D7bVFLGi.d.mts} +2 -2
- package/dist/{telemetry-Dqx-D3F7.d.cts.map → telemetry-D7bVFLGi.d.mts.map} +1 -1
- package/dist/topic/index.cjs +56 -13
- package/dist/topic/index.cjs.map +1 -1
- package/dist/topic/index.d.cts +2 -2
- package/dist/topic/index.d.cts.map +1 -1
- package/dist/topic/index.d.mts +2 -2
- package/dist/topic/index.d.mts.map +1 -1
- package/dist/topic/index.mjs +54 -12
- package/dist/topic/index.mjs.map +1 -1
- package/dist/{types-BDNGr7pv.d.mts → types-BlAkSuGI.d.cts} +1 -1
- package/dist/{types-BDNGr7pv.d.mts.map → types-BlAkSuGI.d.cts.map} +1 -1
- package/dist/{types-BdAaYDvd.d.cts → types-aKksMEWL.d.mts} +1 -1
- package/dist/{types-BdAaYDvd.d.cts.map → types-aKksMEWL.d.mts.map} +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +155 -23
- package/CHANGELOG.md +0 -366
- package/dist/Construct-DCMuYOox.d.mts.map +0 -1
- package/dist/Construct-_1wX7p_Y.d.cts.map +0 -1
- package/dist/Construct-r0U2zBwW.mjs.map +0 -1
- package/dist/Construct-vXMZJgRp.cjs.map +0 -1
- package/dist/Endpoint-CAzNbDEt.d.cts.map +0 -1
- package/dist/Endpoint-CLPSIl6S.d.mts.map +0 -1
- package/dist/HonoEndpointAdaptor-CkJENANP.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-DJDT3PMx.mjs.map +0 -1
- package/dist/Queue-DaxjwmOQ.d.cts.map +0 -1
- package/dist/Queue-HBDf0fqz.d.mts.map +0 -1
- package/dist/Subscriber-D8Xm-86W.d.mts.map +0 -1
- package/dist/Topic-C5ZMfveW.d.cts.map +0 -1
- package/dist/Topic-DT10AqHk.d.mts.map +0 -1
- package/dist/endpoints/index.cjs.map +0 -1
- package/dist/endpoints/index.d.cts.map +0 -1
- package/dist/endpoints/index.d.mts.map +0 -1
- package/dist/endpoints/index.mjs.map +0 -1
- package/dist/functions-B-qt91O7.mjs.map +0 -1
- package/dist/functions-C8i1kCMM.cjs.map +0 -1
- package/dist/index-BGeTScmi.d.cts.map +0 -1
- package/dist/index-DP6fqv0I.d.mts.map +0 -1
- package/dist/lazyAccessors-DfqZR6C4.mjs.map +0 -1
- package/dist/lazyAccessors-DmTG8sQH.cjs.map +0 -1
- package/src/Construct.ts +0 -204
- package/src/__benchmarks__/build-time-optimization.bench.ts +0 -274
- package/src/__benchmarks__/endpoint.bench.ts +0 -494
- package/src/__benchmarks__/fixtures.ts +0 -241
- package/src/__benchmarks__/hono-adaptor.bench.ts +0 -533
- package/src/__benchmarks__/hono-server.bench.ts +0 -249
- package/src/__benchmarks__/response-builder.bench.ts +0 -428
- package/src/__benchmarks__/strategies/strategy-a-lazy-services.ts +0 -319
- package/src/__benchmarks__/strategies/strategy-c-middleware.ts +0 -530
- package/src/__benchmarks__/strategies/strategy-d-opt-in-events.ts +0 -567
- package/src/__tests__/Construct.environment.spec.ts +0 -704
- package/src/__tests__/publisher.setting.spec.ts +0 -508
- package/src/__tests__/publisher.spec.ts +0 -452
- package/src/adaptors/aws.ts +0 -6
- package/src/adaptors/hono.ts +0 -1
- package/src/adaptors/testing.ts +0 -11
- package/src/crons/AWSScheduledFunction.ts +0 -73
- package/src/crons/Cron.ts +0 -149
- package/src/crons/CronBuilder.ts +0 -271
- package/src/crons/__tests__/AWSScheduledFunction.spec.ts +0 -152
- package/src/crons/__tests__/Cron.spec.ts +0 -464
- package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +0 -227
- package/src/crons/index.ts +0 -12
- package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +0 -677
- package/src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts +0 -105
- package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +0 -97
- package/src/endpoints/Authorizer.ts +0 -152
- package/src/endpoints/Endpoint.ts +0 -1287
- package/src/endpoints/EndpointBuilder.ts +0 -758
- package/src/endpoints/EndpointFactory.ts +0 -1148
- package/src/endpoints/HonoEndpointAdaptor.ts +0 -677
- package/src/endpoints/MswEndpointAdaptor.ts +0 -226
- package/src/endpoints/TestEndpointAdaptor.ts +0 -422
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.audits.spec.ts +0 -499
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +0 -560
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +0 -1304
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.audits.spec.ts +0 -626
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +0 -732
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.factory-publisher.spec.ts +0 -296
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.kysely-audit.integration.spec.ts +0 -951
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.responseType.spec.ts +0 -111
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.rls.spec.ts +0 -307
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +0 -629
- package/src/endpoints/__tests__/Authorizer.spec.ts +0 -286
- package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +0 -207
- package/src/endpoints/__tests__/Endpoint.headers.spec.ts +0 -187
- package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +0 -175
- package/src/endpoints/__tests__/Endpoint.spec.ts +0 -857
- package/src/endpoints/__tests__/EndpointBuilder.audit.spec.ts +0 -448
- package/src/endpoints/__tests__/EndpointBuilder.responseType.spec.ts +0 -47
- package/src/endpoints/__tests__/EndpointBuilder.spec.ts +0 -523
- package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +0 -492
- package/src/endpoints/__tests__/EndpointFactory.database-auditor.spec.ts +0 -509
- package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +0 -190
- package/src/endpoints/__tests__/EndpointFactory.spec.ts +0 -479
- package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +0 -155
- package/src/endpoints/__tests__/HonoEndpointAdaptor.audit-transactions.spec.ts +0 -703
- package/src/endpoints/__tests__/HonoEndpointAdaptor.audits.spec.ts +0 -632
- package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +0 -577
- package/src/endpoints/__tests__/HonoEndpointAdaptor.kysely-audit.integration.spec.ts +0 -1067
- package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +0 -317
- package/src/endpoints/__tests__/HonoEndpointAdaptor.pgboss-publisher.spec.ts +0 -289
- package/src/endpoints/__tests__/HonoEndpointAdaptor.responseType.spec.ts +0 -128
- package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +0 -1207
- package/src/endpoints/__tests__/MswEndpointAdaptor.spec.ts +0 -211
- package/src/endpoints/__tests__/ResponseBuilder.spec.ts +0 -235
- package/src/endpoints/__tests__/TestEndpointAdaptor.audits.spec.ts +0 -602
- package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +0 -1044
- package/src/endpoints/__tests__/__snapshots__/HonoEndpointAdaptor.spec.ts.snap +0 -54
- package/src/endpoints/__tests__/endpoint-types.test.ts +0 -88
- package/src/endpoints/__tests__/helpers.spec.ts +0 -37
- package/src/endpoints/__tests__/lazyAccessors.spec.ts +0 -330
- package/src/endpoints/__tests__/processAudits.spec.ts +0 -631
- package/src/endpoints/audit.ts +0 -87
- package/src/endpoints/helpers.ts +0 -98
- package/src/endpoints/index.ts +0 -42
- package/src/endpoints/lazyAccessors.ts +0 -241
- package/src/endpoints/parseHonoQuery.ts +0 -16
- package/src/endpoints/parseQueryParams.ts +0 -32
- package/src/endpoints/processAudits.ts +0 -371
- package/src/endpoints/rls.ts +0 -67
- package/src/functions/AWSLambdaFunction.ts +0 -348
- package/src/functions/BaseFunctionBuilder.ts +0 -201
- package/src/functions/Function.ts +0 -238
- package/src/functions/FunctionBuilder.ts +0 -391
- package/src/functions/FunctionExecutionWrapper.ts +0 -216
- package/src/functions/TestFunctionAdaptor.ts +0 -217
- package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +0 -513
- package/src/functions/__tests__/Function.audits.spec.ts +0 -393
- package/src/functions/__tests__/Function.spec.ts +0 -477
- package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +0 -207
- package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +0 -480
- package/src/functions/index.ts +0 -12
- package/src/index.ts +0 -23
- package/src/publisher.ts +0 -93
- package/src/queue/AWSLambdaQueueAdaptor.ts +0 -162
- package/src/queue/Queue.ts +0 -128
- package/src/queue/QueueBuilder.ts +0 -115
- package/src/queue/TestQueueAdaptor.ts +0 -63
- package/src/queue/__tests__/QueueBuilder.spec.ts +0 -137
- package/src/queue/index.ts +0 -12
- package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +0 -342
- package/src/subscribers/Subscriber.ts +0 -117
- package/src/subscribers/SubscriberBuilder.ts +0 -186
- package/src/subscribers/TestSubscriberAdaptor.ts +0 -133
- package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +0 -1018
- package/src/subscribers/__tests__/Subscriber.spec.ts +0 -430
- package/src/subscribers/__tests__/TestSubscriberAdaptor.spec.ts +0 -652
- package/src/subscribers/index.ts +0 -6
- package/src/telemetry.ts +0 -103
- package/src/topic/Topic.ts +0 -103
- package/src/topic/TopicBuilder.ts +0 -51
- package/src/topic/__tests__/TopicBuilder.spec.ts +0 -82
- package/src/topic/index.ts +0 -11
- package/src/types.ts +0 -13
- package/test.ts +0 -91
- package/tsconfig.json +0 -9
- package/tsdown.config.ts +0 -34
package/src/endpoints/helpers.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import type { Service } from '@geekmidas/services';
|
|
3
|
-
import fg from 'fast-glob';
|
|
4
|
-
import type { HttpMethod } from '../types';
|
|
5
|
-
import { Endpoint } from './Endpoint';
|
|
6
|
-
|
|
7
|
-
// Re-export utility functions
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Recursively finds the project root directory by looking for lock files.
|
|
11
|
-
* Traverses up the directory tree until it finds a package manager lock file.
|
|
12
|
-
*
|
|
13
|
-
* @param cwd - The current working directory to start searching from
|
|
14
|
-
* @returns Promise resolving to the absolute path of the project root
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const projectRoot = await getProjectRoot(process.cwd());
|
|
19
|
-
* console.log(`Project root: ${projectRoot}`);
|
|
20
|
-
* // Output: Project root: /Users/user/my-project
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export async function getProjectRoot(cwd: string): Promise<string> {
|
|
24
|
-
if (cwd === '/') {
|
|
25
|
-
return cwd;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const stream = fg.stream(
|
|
29
|
-
['yarn.lock', 'pnpm-lock.yaml', 'package-lock.json', 'deno.lock'],
|
|
30
|
-
{ dot: true, cwd },
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
let isRoot = false;
|
|
34
|
-
|
|
35
|
-
for await (const _ of stream) {
|
|
36
|
-
isRoot = true;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (isRoot) {
|
|
41
|
-
return cwd;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return getProjectRoot(path.resolve(cwd, '..'));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Discovers and imports all Endpoint instances from the specified route patterns.
|
|
49
|
-
* Uses fast-glob to find files matching the patterns and extracts exported Endpoints.
|
|
50
|
-
*
|
|
51
|
-
* @template TServices - Array of service types used by the endpoints
|
|
52
|
-
* @param routes - Array of glob patterns to match route files (e.g., ['src/routes/*.ts'])
|
|
53
|
-
* @param cwd - The current working directory to resolve paths from
|
|
54
|
-
* @returns Promise resolving to an array of Endpoint instances found in the matched files
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```typescript
|
|
58
|
-
* // Find all endpoints in the routes directory
|
|
59
|
-
* const endpoints = await getEndpointsFromRoutes(
|
|
60
|
-
* ['src/routes/**\/*.ts'],
|
|
61
|
-
* process.cwd()
|
|
62
|
-
* );
|
|
63
|
-
*
|
|
64
|
-
* // Register endpoints with your server
|
|
65
|
-
* for (const endpoint of endpoints) {
|
|
66
|
-
* server.register(endpoint);
|
|
67
|
-
* }
|
|
68
|
-
* ```
|
|
69
|
-
*
|
|
70
|
-
* @remarks
|
|
71
|
-
* - Only exports that are valid Endpoint instances are included
|
|
72
|
-
* - Files are imported dynamically, so they must be valid ES modules
|
|
73
|
-
* - The function filters out non-Endpoint exports automatically
|
|
74
|
-
*/
|
|
75
|
-
export async function getEndpointsFromRoutes<TServices extends Service[]>(
|
|
76
|
-
routes: string[],
|
|
77
|
-
cwd: string,
|
|
78
|
-
): Promise<Endpoint<string, HttpMethod, any, any, TServices>[]> {
|
|
79
|
-
const stream = fg.stream(routes, { cwd });
|
|
80
|
-
|
|
81
|
-
const endpoints: Endpoint<string, HttpMethod, any, any, TServices>[] = [];
|
|
82
|
-
|
|
83
|
-
for await (const f of stream) {
|
|
84
|
-
// Resolve the absolute path for the route file
|
|
85
|
-
const routePath = path.resolve(cwd, f.toString());
|
|
86
|
-
// Dynamically import the route module
|
|
87
|
-
const route = await import(routePath);
|
|
88
|
-
|
|
89
|
-
// Filter exported values to find only Endpoint instances
|
|
90
|
-
const handlers = Object.values(route).filter((value) => {
|
|
91
|
-
return Endpoint.isEndpoint(value);
|
|
92
|
-
}) as unknown as Endpoint<string, HttpMethod, any, any, TServices>[];
|
|
93
|
-
|
|
94
|
-
endpoints.push(...handlers);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return endpoints;
|
|
98
|
-
}
|
package/src/endpoints/index.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { EndpointFactory } from './EndpointFactory';
|
|
2
|
-
|
|
3
|
-
export { publishConstructEvents } from '../publisher';
|
|
4
|
-
export {
|
|
5
|
-
type Authorizer,
|
|
6
|
-
BUILT_IN_SECURITY_SCHEMES,
|
|
7
|
-
type BuiltInSecuritySchemeId,
|
|
8
|
-
createAuthorizer,
|
|
9
|
-
getSecurityScheme,
|
|
10
|
-
isBuiltInSecurityScheme,
|
|
11
|
-
type OAuthFlow,
|
|
12
|
-
type OAuthFlows,
|
|
13
|
-
type SecurityScheme,
|
|
14
|
-
} from './Authorizer';
|
|
15
|
-
export type { ActorExtractor, MappedAudit } from './audit';
|
|
16
|
-
export {
|
|
17
|
-
Endpoint,
|
|
18
|
-
type EndpointContext,
|
|
19
|
-
type EndpointHandler,
|
|
20
|
-
type EndpointOutput,
|
|
21
|
-
type EndpointSchemas,
|
|
22
|
-
ResponseBuilder,
|
|
23
|
-
} from './Endpoint';
|
|
24
|
-
export { EndpointBuilder } from './EndpointBuilder';
|
|
25
|
-
export { EndpointFactory } from './EndpointFactory';
|
|
26
|
-
export {
|
|
27
|
-
createApiGatewayCookies,
|
|
28
|
-
createApiGatewayHeaders,
|
|
29
|
-
createHonoCookies,
|
|
30
|
-
createHonoHeaders,
|
|
31
|
-
createNoopCookies,
|
|
32
|
-
createNoopHeaders,
|
|
33
|
-
} from './lazyAccessors';
|
|
34
|
-
export {
|
|
35
|
-
RLS_BYPASS,
|
|
36
|
-
type RlsBypass,
|
|
37
|
-
type RlsConfig,
|
|
38
|
-
type RlsContext,
|
|
39
|
-
type RlsContextExtractor,
|
|
40
|
-
} from './rls';
|
|
41
|
-
|
|
42
|
-
export const e = new EndpointFactory();
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lazy header and cookie accessors for different adaptors.
|
|
3
|
-
*
|
|
4
|
-
* Instead of parsing all headers/cookies upfront, these accessors
|
|
5
|
-
* use native adaptor methods for single lookups and only parse
|
|
6
|
-
* everything when `header()` or `cookie()` is called without arguments.
|
|
7
|
-
*/
|
|
8
|
-
import type { Context } from 'hono';
|
|
9
|
-
import { getCookie } from 'hono/cookie';
|
|
10
|
-
import type { CookieFn, HeaderFn } from './Endpoint';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Create a lazy header accessor for Hono.
|
|
14
|
-
* Uses `c.req.header(name)` for single lookups (native, case-insensitive).
|
|
15
|
-
* Only calls `c.req.header()` to get all headers when needed.
|
|
16
|
-
*/
|
|
17
|
-
export function createHonoHeaders(c: Context): HeaderFn {
|
|
18
|
-
let allHeaders: Record<string, string> | null = null;
|
|
19
|
-
|
|
20
|
-
return ((key?: string) => {
|
|
21
|
-
if (key !== undefined) {
|
|
22
|
-
// Single header lookup - use native Hono method (case-insensitive)
|
|
23
|
-
return c.req.header(key);
|
|
24
|
-
}
|
|
25
|
-
// Get all headers - cache the result
|
|
26
|
-
if (!allHeaders) {
|
|
27
|
-
allHeaders = c.req.header();
|
|
28
|
-
}
|
|
29
|
-
return allHeaders;
|
|
30
|
-
}) as HeaderFn;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Create a lazy cookie accessor for Hono.
|
|
35
|
-
* Uses `getCookie(c, name)` for single lookups (native).
|
|
36
|
-
* Only parses the cookie header when all cookies are requested.
|
|
37
|
-
*/
|
|
38
|
-
export function createHonoCookies(c: Context): CookieFn {
|
|
39
|
-
let allCookies: Record<string, string> | null = null;
|
|
40
|
-
|
|
41
|
-
return ((name?: string) => {
|
|
42
|
-
if (name !== undefined) {
|
|
43
|
-
// Single cookie lookup - use native Hono method
|
|
44
|
-
return getCookie(c, name);
|
|
45
|
-
}
|
|
46
|
-
// Get all cookies - parse and cache
|
|
47
|
-
if (!allCookies) {
|
|
48
|
-
allCookies = {};
|
|
49
|
-
const cookieHeader = c.req.header('cookie');
|
|
50
|
-
if (cookieHeader) {
|
|
51
|
-
for (const part of cookieHeader.split(';')) {
|
|
52
|
-
const trimmed = part.trim();
|
|
53
|
-
const eqIndex = trimmed.indexOf('=');
|
|
54
|
-
if (eqIndex > 0) {
|
|
55
|
-
const key = trimmed.slice(0, eqIndex);
|
|
56
|
-
const value = trimmed.slice(eqIndex + 1);
|
|
57
|
-
allCookies[key] = value;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return allCookies;
|
|
63
|
-
}) as CookieFn;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Create a lazy header accessor for API Gateway events.
|
|
68
|
-
* Handles case-insensitive lookups.
|
|
69
|
-
*/
|
|
70
|
-
export function createApiGatewayHeaders(
|
|
71
|
-
headers: Record<string, string | undefined> | null | undefined,
|
|
72
|
-
): HeaderFn {
|
|
73
|
-
let normalizedHeaders: Record<string, string> | null = null;
|
|
74
|
-
|
|
75
|
-
const normalize = () => {
|
|
76
|
-
if (!normalizedHeaders) {
|
|
77
|
-
normalizedHeaders = {};
|
|
78
|
-
if (headers) {
|
|
79
|
-
for (const [k, v] of Object.entries(headers)) {
|
|
80
|
-
if (v !== undefined) {
|
|
81
|
-
normalizedHeaders[k.toLowerCase()] = v;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return normalizedHeaders;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return ((key?: string) => {
|
|
90
|
-
if (key !== undefined) {
|
|
91
|
-
// Try direct lookup first (common case: headers already lowercase)
|
|
92
|
-
if (headers) {
|
|
93
|
-
const direct = headers[key] ?? headers[key.toLowerCase()];
|
|
94
|
-
if (direct !== undefined) return direct;
|
|
95
|
-
// Fall back to normalized lookup
|
|
96
|
-
return normalize()[key.toLowerCase()];
|
|
97
|
-
}
|
|
98
|
-
return undefined;
|
|
99
|
-
}
|
|
100
|
-
return normalize();
|
|
101
|
-
}) as HeaderFn;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Create a lazy cookie accessor for API Gateway events.
|
|
106
|
-
* Decodes URL-encoded values to match browser behavior.
|
|
107
|
-
*/
|
|
108
|
-
export function createApiGatewayCookies(
|
|
109
|
-
cookies: string[] | undefined,
|
|
110
|
-
cookieHeader: string | undefined,
|
|
111
|
-
): CookieFn {
|
|
112
|
-
let parsed: Record<string, string> | null = null;
|
|
113
|
-
|
|
114
|
-
const parse = () => {
|
|
115
|
-
if (!parsed) {
|
|
116
|
-
parsed = {};
|
|
117
|
-
// API Gateway v2 provides cookies as array
|
|
118
|
-
if (cookies) {
|
|
119
|
-
for (const cookie of cookies) {
|
|
120
|
-
const eqIndex = cookie.indexOf('=');
|
|
121
|
-
if (eqIndex > 0) {
|
|
122
|
-
const key = cookie.slice(0, eqIndex);
|
|
123
|
-
const value = cookie.slice(eqIndex + 1);
|
|
124
|
-
parsed[key] = decodeURIComponent(value);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
} else if (cookieHeader) {
|
|
128
|
-
// Fall back to parsing cookie header
|
|
129
|
-
for (const part of cookieHeader.split(';')) {
|
|
130
|
-
const trimmed = part.trim();
|
|
131
|
-
const eqIndex = trimmed.indexOf('=');
|
|
132
|
-
if (eqIndex > 0) {
|
|
133
|
-
const key = trimmed.slice(0, eqIndex);
|
|
134
|
-
const value = trimmed.slice(eqIndex + 1);
|
|
135
|
-
parsed[key] = decodeURIComponent(value);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return parsed;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
return ((name?: string) => {
|
|
144
|
-
if (name !== undefined) {
|
|
145
|
-
return parse()[name];
|
|
146
|
-
}
|
|
147
|
-
return parse();
|
|
148
|
-
}) as CookieFn;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Create a lazy header accessor for plain object headers (test adaptor, etc).
|
|
153
|
-
* Headers are already available as an object, just provide lazy access.
|
|
154
|
-
*/
|
|
155
|
-
export function createObjectHeaders(
|
|
156
|
-
headers: Record<string, string> | undefined,
|
|
157
|
-
): HeaderFn {
|
|
158
|
-
let normalized: Record<string, string> | null = null;
|
|
159
|
-
|
|
160
|
-
return ((key?: string) => {
|
|
161
|
-
if (key !== undefined) {
|
|
162
|
-
// Try direct lookup first (common case)
|
|
163
|
-
if (headers) {
|
|
164
|
-
const direct = headers[key] ?? headers[key.toLowerCase()];
|
|
165
|
-
if (direct !== undefined) return direct;
|
|
166
|
-
}
|
|
167
|
-
// Fall back to normalized lookup for case-insensitivity
|
|
168
|
-
if (!normalized && headers) {
|
|
169
|
-
normalized = {};
|
|
170
|
-
for (const [k, v] of Object.entries(headers)) {
|
|
171
|
-
normalized[k.toLowerCase()] = v;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return normalized?.[key.toLowerCase()];
|
|
175
|
-
}
|
|
176
|
-
// Return all headers
|
|
177
|
-
if (!normalized && headers) {
|
|
178
|
-
normalized = {};
|
|
179
|
-
for (const [k, v] of Object.entries(headers)) {
|
|
180
|
-
normalized[k.toLowerCase()] = v;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return normalized ?? {};
|
|
184
|
-
}) as HeaderFn;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Create a lazy cookie accessor from a cookie header string.
|
|
189
|
-
* Decodes URL-encoded values to match browser behavior.
|
|
190
|
-
*/
|
|
191
|
-
export function createCookieHeaderAccessor(
|
|
192
|
-
cookieHeader: string | undefined,
|
|
193
|
-
): CookieFn {
|
|
194
|
-
let parsed: Record<string, string> | null = null;
|
|
195
|
-
|
|
196
|
-
const parse = () => {
|
|
197
|
-
if (!parsed) {
|
|
198
|
-
parsed = {};
|
|
199
|
-
if (cookieHeader) {
|
|
200
|
-
for (const part of cookieHeader.split(';')) {
|
|
201
|
-
const trimmed = part.trim();
|
|
202
|
-
const eqIndex = trimmed.indexOf('=');
|
|
203
|
-
if (eqIndex > 0) {
|
|
204
|
-
const key = trimmed.slice(0, eqIndex);
|
|
205
|
-
const value = trimmed.slice(eqIndex + 1);
|
|
206
|
-
// Decode URL-encoded values to match Endpoint.createCookies behavior
|
|
207
|
-
parsed[key] = decodeURIComponent(value);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return parsed;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
return ((name?: string) => {
|
|
216
|
-
if (name !== undefined) {
|
|
217
|
-
return parse()[name];
|
|
218
|
-
}
|
|
219
|
-
return parse();
|
|
220
|
-
}) as CookieFn;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Create a no-op header accessor (for minimal endpoints that don't use headers).
|
|
225
|
-
*/
|
|
226
|
-
export function createNoopHeaders(): HeaderFn {
|
|
227
|
-
return ((key?: string) => {
|
|
228
|
-
if (key !== undefined) return undefined;
|
|
229
|
-
return {};
|
|
230
|
-
}) as HeaderFn;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
|
|
235
|
-
*/
|
|
236
|
-
export function createNoopCookies(): CookieFn {
|
|
237
|
-
return ((name?: string) => {
|
|
238
|
-
if (name !== undefined) return undefined;
|
|
239
|
-
return {};
|
|
240
|
-
}) as CookieFn;
|
|
241
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Context } from 'hono';
|
|
2
|
-
import qs from 'qs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Parse Hono query parameters using qs bracket notation
|
|
6
|
-
* Supports nested objects, arrays, and deep nesting via standard bracket syntax
|
|
7
|
-
*/
|
|
8
|
-
export function parseHonoQuery(c: Context): Record<string, any> {
|
|
9
|
-
const url = c.req.url;
|
|
10
|
-
const queryIndex = url.indexOf('?');
|
|
11
|
-
if (queryIndex === -1) {
|
|
12
|
-
return {};
|
|
13
|
-
}
|
|
14
|
-
const queryString = url.slice(queryIndex + 1);
|
|
15
|
-
return qs.parse(queryString) as Record<string, any>;
|
|
16
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import qs from 'qs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Parse query parameters from a flat object into a nested structure
|
|
5
|
-
* Uses qs bracket notation for standard interoperability
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* parseQueryParams({ 'tags[]': ['a', 'b'], 'filter[name]': 'john' })
|
|
9
|
-
* // Returns: { tags: ['a', 'b'], filter: { name: 'john' } }
|
|
10
|
-
*/
|
|
11
|
-
export function parseQueryParams(
|
|
12
|
-
queryParams: Record<string, string | string[] | undefined> | null,
|
|
13
|
-
): Record<string, any> {
|
|
14
|
-
if (!queryParams) {
|
|
15
|
-
return {};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Reconstruct a query string from the flat object so qs can parse bracket notation
|
|
19
|
-
const parts: string[] = [];
|
|
20
|
-
for (const [key, value] of Object.entries(queryParams)) {
|
|
21
|
-
if (value === undefined) continue;
|
|
22
|
-
if (Array.isArray(value)) {
|
|
23
|
-
for (const v of value) {
|
|
24
|
-
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);
|
|
25
|
-
}
|
|
26
|
-
} else {
|
|
27
|
-
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return qs.parse(parts.join('&')) as Record<string, any>;
|
|
32
|
-
}
|