@geekmidas/constructs 9.0.2 → 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-Bn99MceY.d.cts → AWSScheduledFunction-BvFvBsBN.d.cts} +8 -3
- package/dist/{AWSScheduledFunction-ysaCsdWx.d.mts.map → AWSScheduledFunction-BvFvBsBN.d.cts.map} +1 -1
- package/dist/{AWSScheduledFunction-ysaCsdWx.d.mts → AWSScheduledFunction-CVccZO-L.d.mts} +9 -4
- package/dist/{AWSScheduledFunction-Bn99MceY.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-DgfRslct.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-BVs9DvIj.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 -396
- 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-CLPSIl6S.d.mts.map +0 -1
- package/dist/Endpoint-DgfRslct.d.cts.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-BVs9DvIj.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
|
@@ -1,530 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck - Experimental benchmark strategy file
|
|
2
|
-
/**
|
|
3
|
-
* Strategy C: Middleware Composition Pattern
|
|
4
|
-
*
|
|
5
|
-
* Key optimizations:
|
|
6
|
-
* 1. Break monolithic handler into composable middleware
|
|
7
|
-
* 2. Only add middleware for features the endpoint uses
|
|
8
|
-
* 3. Early exit on failures (auth, validation, etc.)
|
|
9
|
-
* 4. Typed context instead of magic strings
|
|
10
|
-
*/
|
|
11
|
-
import type { Logger } from '@geekmidas/logger';
|
|
12
|
-
import type {
|
|
13
|
-
Service,
|
|
14
|
-
ServiceDiscovery,
|
|
15
|
-
ServiceRecord,
|
|
16
|
-
} from '@geekmidas/services';
|
|
17
|
-
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
18
|
-
import type { Context, Hono, Next } from 'hono';
|
|
19
|
-
import { validator } from 'hono/validator';
|
|
20
|
-
import {
|
|
21
|
-
Endpoint,
|
|
22
|
-
type EndpointSchemas,
|
|
23
|
-
ResponseBuilder,
|
|
24
|
-
} from '../../endpoints/Endpoint';
|
|
25
|
-
import { parseHonoQuery } from '../../endpoints/parseHonoQuery';
|
|
26
|
-
import type { HttpMethod, LowerHttpMethod } from '../../types';
|
|
27
|
-
|
|
28
|
-
// ============================================================================
|
|
29
|
-
// Typed Context
|
|
30
|
-
// ============================================================================
|
|
31
|
-
|
|
32
|
-
interface EndpointContext {
|
|
33
|
-
services: Record<string, any>;
|
|
34
|
-
session: unknown;
|
|
35
|
-
logger: Logger;
|
|
36
|
-
db?: any;
|
|
37
|
-
header: ReturnType<typeof Endpoint.createHeaders>;
|
|
38
|
-
cookie: ReturnType<typeof Endpoint.createCookies>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
declare module 'hono' {
|
|
42
|
-
interface ContextVariableMap {
|
|
43
|
-
ctx: EndpointContext;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// ============================================================================
|
|
48
|
-
// Middleware Factories
|
|
49
|
-
// ============================================================================
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Creates middleware that initializes the endpoint context
|
|
53
|
-
*/
|
|
54
|
-
function createContextMiddleware<
|
|
55
|
-
TServices extends Service[],
|
|
56
|
-
TLogger extends Logger,
|
|
57
|
-
>(
|
|
58
|
-
endpoint: Endpoint<
|
|
59
|
-
any,
|
|
60
|
-
any,
|
|
61
|
-
any,
|
|
62
|
-
any,
|
|
63
|
-
TServices,
|
|
64
|
-
TLogger,
|
|
65
|
-
any,
|
|
66
|
-
any,
|
|
67
|
-
any,
|
|
68
|
-
any,
|
|
69
|
-
any,
|
|
70
|
-
any,
|
|
71
|
-
any,
|
|
72
|
-
any
|
|
73
|
-
>,
|
|
74
|
-
serviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>, TLogger>,
|
|
75
|
-
): (c: Context, next: Next) => Promise<Response | undefined> {
|
|
76
|
-
// Pre-resolve service registration promise at setup time
|
|
77
|
-
const servicesPromise =
|
|
78
|
-
endpoint.services.length > 0
|
|
79
|
-
? serviceDiscovery.register(endpoint.services)
|
|
80
|
-
: Promise.resolve({} as ServiceRecord<TServices>);
|
|
81
|
-
|
|
82
|
-
// Pre-resolve database service if configured
|
|
83
|
-
const dbPromise = endpoint.databaseService
|
|
84
|
-
? serviceDiscovery
|
|
85
|
-
.register([endpoint.databaseService])
|
|
86
|
-
.then((s) => s[endpoint.databaseService?.serviceName as keyof typeof s])
|
|
87
|
-
: Promise.resolve(undefined);
|
|
88
|
-
|
|
89
|
-
return async (c, next) => {
|
|
90
|
-
const [services, db] = await Promise.all([servicesPromise, dbPromise]);
|
|
91
|
-
|
|
92
|
-
const headerValues = c.req.header();
|
|
93
|
-
|
|
94
|
-
const ctx: EndpointContext = {
|
|
95
|
-
services: services as Record<string, any>,
|
|
96
|
-
session: null,
|
|
97
|
-
logger: endpoint.logger,
|
|
98
|
-
db,
|
|
99
|
-
header: Endpoint.createHeaders(headerValues),
|
|
100
|
-
cookie: Endpoint.createCookies(headerValues.cookie),
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
c.set('ctx', ctx);
|
|
104
|
-
await next();
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Creates auth middleware (only if endpoint has authorization)
|
|
110
|
-
*/
|
|
111
|
-
function createAuthMiddleware<
|
|
112
|
-
TServices extends Service[],
|
|
113
|
-
TLogger extends Logger,
|
|
114
|
-
>(
|
|
115
|
-
endpoint: Endpoint<
|
|
116
|
-
any,
|
|
117
|
-
any,
|
|
118
|
-
any,
|
|
119
|
-
any,
|
|
120
|
-
TServices,
|
|
121
|
-
TLogger,
|
|
122
|
-
any,
|
|
123
|
-
any,
|
|
124
|
-
any,
|
|
125
|
-
any,
|
|
126
|
-
any,
|
|
127
|
-
any,
|
|
128
|
-
any,
|
|
129
|
-
any
|
|
130
|
-
>,
|
|
131
|
-
): ((c: Context, next: Next) => Promise<Response | undefined>) | null {
|
|
132
|
-
if (endpoint.authorizer === 'none') {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return async (c, next) => {
|
|
137
|
-
const ctx = c.get('ctx');
|
|
138
|
-
|
|
139
|
-
const session = await endpoint.getSession({
|
|
140
|
-
services: ctx.services,
|
|
141
|
-
logger: ctx.logger,
|
|
142
|
-
header: ctx.header,
|
|
143
|
-
cookie: ctx.cookie,
|
|
144
|
-
...(ctx.db !== undefined && { db: ctx.db }),
|
|
145
|
-
} as any);
|
|
146
|
-
|
|
147
|
-
const isAuthorized = await endpoint.authorize({
|
|
148
|
-
header: ctx.header,
|
|
149
|
-
cookie: ctx.cookie,
|
|
150
|
-
services: ctx.services,
|
|
151
|
-
logger: ctx.logger,
|
|
152
|
-
session,
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
if (!isAuthorized) {
|
|
156
|
-
return c.json({ error: 'Unauthorized' }, 401);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Update context with session
|
|
160
|
-
ctx.session = session;
|
|
161
|
-
await next();
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Creates the core handler middleware
|
|
167
|
-
*/
|
|
168
|
-
function createHandlerMiddleware<
|
|
169
|
-
TServices extends Service[],
|
|
170
|
-
TLogger extends Logger,
|
|
171
|
-
>(
|
|
172
|
-
endpoint: Endpoint<
|
|
173
|
-
any,
|
|
174
|
-
any,
|
|
175
|
-
any,
|
|
176
|
-
any,
|
|
177
|
-
TServices,
|
|
178
|
-
TLogger,
|
|
179
|
-
any,
|
|
180
|
-
any,
|
|
181
|
-
any,
|
|
182
|
-
any,
|
|
183
|
-
any,
|
|
184
|
-
any,
|
|
185
|
-
any,
|
|
186
|
-
any
|
|
187
|
-
>,
|
|
188
|
-
): (c: Context) => Promise<Response> {
|
|
189
|
-
return async (c) => {
|
|
190
|
-
const ctx = c.get('ctx');
|
|
191
|
-
|
|
192
|
-
try {
|
|
193
|
-
const responseBuilder = new ResponseBuilder();
|
|
194
|
-
const response = await endpoint.handler(
|
|
195
|
-
{
|
|
196
|
-
services: ctx.services,
|
|
197
|
-
logger: ctx.logger,
|
|
198
|
-
body: c.req.valid('json'),
|
|
199
|
-
query: c.req.valid('query'),
|
|
200
|
-
params: c.req.valid('param'),
|
|
201
|
-
session: ctx.session,
|
|
202
|
-
header: ctx.header,
|
|
203
|
-
cookie: ctx.cookie,
|
|
204
|
-
auditor: undefined,
|
|
205
|
-
db: ctx.db,
|
|
206
|
-
} as any,
|
|
207
|
-
responseBuilder,
|
|
208
|
-
);
|
|
209
|
-
|
|
210
|
-
// Process response
|
|
211
|
-
let data = response;
|
|
212
|
-
let metadata = responseBuilder.getMetadata();
|
|
213
|
-
|
|
214
|
-
if (Endpoint.hasMetadata(response)) {
|
|
215
|
-
data = response.data;
|
|
216
|
-
metadata = response.metadata;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
const output = endpoint.outputSchema
|
|
220
|
-
? await endpoint.parseOutput(data)
|
|
221
|
-
: data;
|
|
222
|
-
|
|
223
|
-
const status = (metadata.status ?? endpoint.status) as any;
|
|
224
|
-
return c.json(output, status);
|
|
225
|
-
} catch (_error) {
|
|
226
|
-
return c.json({ error: 'Internal Server Error' }, 500);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// ============================================================================
|
|
232
|
-
// Validator Factories
|
|
233
|
-
// ============================================================================
|
|
234
|
-
|
|
235
|
-
function createBodyValidator(
|
|
236
|
-
endpoint: Endpoint<
|
|
237
|
-
any,
|
|
238
|
-
any,
|
|
239
|
-
any,
|
|
240
|
-
any,
|
|
241
|
-
any,
|
|
242
|
-
any,
|
|
243
|
-
any,
|
|
244
|
-
any,
|
|
245
|
-
any,
|
|
246
|
-
any,
|
|
247
|
-
any,
|
|
248
|
-
any,
|
|
249
|
-
any,
|
|
250
|
-
any
|
|
251
|
-
>,
|
|
252
|
-
) {
|
|
253
|
-
return validator('json', async (value, c) => {
|
|
254
|
-
if (!endpoint.input?.body) return undefined;
|
|
255
|
-
const parsed = await Endpoint.validate(endpoint.input.body, value);
|
|
256
|
-
if (parsed.issues) return c.json(parsed.issues, 422);
|
|
257
|
-
return parsed.value;
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
function createQueryValidator(
|
|
262
|
-
endpoint: Endpoint<
|
|
263
|
-
any,
|
|
264
|
-
any,
|
|
265
|
-
any,
|
|
266
|
-
any,
|
|
267
|
-
any,
|
|
268
|
-
any,
|
|
269
|
-
any,
|
|
270
|
-
any,
|
|
271
|
-
any,
|
|
272
|
-
any,
|
|
273
|
-
any,
|
|
274
|
-
any,
|
|
275
|
-
any,
|
|
276
|
-
any
|
|
277
|
-
>,
|
|
278
|
-
) {
|
|
279
|
-
return validator('query', async (_, c) => {
|
|
280
|
-
if (!endpoint.input?.query) return undefined;
|
|
281
|
-
const parsedQuery = parseHonoQuery(c);
|
|
282
|
-
const parsed = await Endpoint.validate(endpoint.input.query, parsedQuery);
|
|
283
|
-
if (parsed.issues) return c.json(parsed.issues, 422);
|
|
284
|
-
return parsed.value;
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
function createParamValidator(
|
|
289
|
-
endpoint: Endpoint<
|
|
290
|
-
any,
|
|
291
|
-
any,
|
|
292
|
-
any,
|
|
293
|
-
any,
|
|
294
|
-
any,
|
|
295
|
-
any,
|
|
296
|
-
any,
|
|
297
|
-
any,
|
|
298
|
-
any,
|
|
299
|
-
any,
|
|
300
|
-
any,
|
|
301
|
-
any,
|
|
302
|
-
any,
|
|
303
|
-
any
|
|
304
|
-
>,
|
|
305
|
-
) {
|
|
306
|
-
return validator('param', async (params, c) => {
|
|
307
|
-
if (!endpoint.input?.params) return undefined;
|
|
308
|
-
const parsed = await Endpoint.validate(endpoint.input.params, params);
|
|
309
|
-
if (parsed.issues) return c.json(parsed.issues, 422);
|
|
310
|
-
return parsed.value;
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// ============================================================================
|
|
315
|
-
// Main Adaptor
|
|
316
|
-
// ============================================================================
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Middleware-based HonoEndpoint adaptor
|
|
320
|
-
*/
|
|
321
|
-
export class MiddlewareHonoEndpoint {
|
|
322
|
-
/**
|
|
323
|
-
* Add routes using middleware composition
|
|
324
|
-
*/
|
|
325
|
-
static addRoutes<
|
|
326
|
-
TServices extends Service[] = [],
|
|
327
|
-
TLogger extends Logger = Logger,
|
|
328
|
-
>(
|
|
329
|
-
endpoints: Endpoint<string, HttpMethod, any, any, TServices, TLogger>[],
|
|
330
|
-
serviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>, TLogger>,
|
|
331
|
-
app: Hono,
|
|
332
|
-
): void {
|
|
333
|
-
// Sort endpoints (static routes before dynamic)
|
|
334
|
-
const sortedEndpoints = [...endpoints].sort((a, b) => {
|
|
335
|
-
const aHasDynamic = a.route.includes(':');
|
|
336
|
-
const bHasDynamic = b.route.includes(':');
|
|
337
|
-
if (!aHasDynamic && bHasDynamic) return -1;
|
|
338
|
-
if (aHasDynamic && !bHasDynamic) return 1;
|
|
339
|
-
return a.route.localeCompare(b.route);
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
for (const endpoint of sortedEndpoints) {
|
|
343
|
-
MiddlewareHonoEndpoint.addRoute(endpoint, serviceDiscovery, app);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* Add a single route with composed middleware
|
|
349
|
-
*/
|
|
350
|
-
static addRoute<
|
|
351
|
-
TRoute extends string,
|
|
352
|
-
TMethod extends HttpMethod,
|
|
353
|
-
TInput extends EndpointSchemas = {},
|
|
354
|
-
TOutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
355
|
-
TServices extends Service[] = [],
|
|
356
|
-
TLogger extends Logger = Logger,
|
|
357
|
-
>(
|
|
358
|
-
endpoint: Endpoint<
|
|
359
|
-
TRoute,
|
|
360
|
-
TMethod,
|
|
361
|
-
TInput,
|
|
362
|
-
TOutSchema,
|
|
363
|
-
TServices,
|
|
364
|
-
TLogger,
|
|
365
|
-
any,
|
|
366
|
-
any,
|
|
367
|
-
any,
|
|
368
|
-
any,
|
|
369
|
-
any,
|
|
370
|
-
any,
|
|
371
|
-
any,
|
|
372
|
-
any
|
|
373
|
-
>,
|
|
374
|
-
serviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>, TLogger>,
|
|
375
|
-
app: Hono,
|
|
376
|
-
): void {
|
|
377
|
-
const { route } = endpoint;
|
|
378
|
-
const method = endpoint.method.toLowerCase() as LowerHttpMethod<TMethod>;
|
|
379
|
-
|
|
380
|
-
// Build middleware chain
|
|
381
|
-
const middlewares: ((
|
|
382
|
-
c: Context,
|
|
383
|
-
next: Next,
|
|
384
|
-
) => Promise<Response | undefined>)[] = [];
|
|
385
|
-
|
|
386
|
-
// 1. Context initialization (always needed)
|
|
387
|
-
middlewares.push(createContextMiddleware(endpoint, serviceDiscovery));
|
|
388
|
-
|
|
389
|
-
// 2. Auth middleware (only if endpoint has authorization)
|
|
390
|
-
const authMiddleware = createAuthMiddleware(endpoint);
|
|
391
|
-
if (authMiddleware) {
|
|
392
|
-
middlewares.push(authMiddleware);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// 3. Validators
|
|
396
|
-
const validators = [
|
|
397
|
-
createBodyValidator(endpoint),
|
|
398
|
-
createQueryValidator(endpoint),
|
|
399
|
-
createParamValidator(endpoint),
|
|
400
|
-
];
|
|
401
|
-
|
|
402
|
-
// 4. Core handler
|
|
403
|
-
const handler = createHandlerMiddleware(endpoint);
|
|
404
|
-
|
|
405
|
-
// Register route with all middleware
|
|
406
|
-
app[method](route, ...validators, ...middlewares, handler);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// ============================================================================
|
|
411
|
-
// Minimal Adaptor (No middleware, just handler)
|
|
412
|
-
// ============================================================================
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* Ultra-minimal adaptor for comparison
|
|
416
|
-
* No middleware composition, just inline handler
|
|
417
|
-
*/
|
|
418
|
-
export class MinimalHonoEndpoint {
|
|
419
|
-
static addRoutes<
|
|
420
|
-
TServices extends Service[] = [],
|
|
421
|
-
TLogger extends Logger = Logger,
|
|
422
|
-
>(
|
|
423
|
-
endpoints: Endpoint<string, HttpMethod, any, any, TServices, TLogger>[],
|
|
424
|
-
serviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>, TLogger>,
|
|
425
|
-
app: Hono,
|
|
426
|
-
): void {
|
|
427
|
-
for (const endpoint of endpoints) {
|
|
428
|
-
MinimalHonoEndpoint.addRoute(endpoint, serviceDiscovery, app);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
static addRoute<
|
|
433
|
-
TRoute extends string,
|
|
434
|
-
TMethod extends HttpMethod,
|
|
435
|
-
TServices extends Service[] = [],
|
|
436
|
-
TLogger extends Logger = Logger,
|
|
437
|
-
>(
|
|
438
|
-
endpoint: Endpoint<
|
|
439
|
-
TRoute,
|
|
440
|
-
TMethod,
|
|
441
|
-
any,
|
|
442
|
-
any,
|
|
443
|
-
TServices,
|
|
444
|
-
TLogger,
|
|
445
|
-
any,
|
|
446
|
-
any,
|
|
447
|
-
any,
|
|
448
|
-
any,
|
|
449
|
-
any,
|
|
450
|
-
any,
|
|
451
|
-
any,
|
|
452
|
-
any
|
|
453
|
-
>,
|
|
454
|
-
serviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>, TLogger>,
|
|
455
|
-
app: Hono,
|
|
456
|
-
): void {
|
|
457
|
-
const { route } = endpoint;
|
|
458
|
-
const method = endpoint.method.toLowerCase() as LowerHttpMethod<any>;
|
|
459
|
-
|
|
460
|
-
// Pre-resolve services at setup time
|
|
461
|
-
const servicesPromise =
|
|
462
|
-
endpoint.services.length > 0
|
|
463
|
-
? serviceDiscovery.register(endpoint.services)
|
|
464
|
-
: Promise.resolve({});
|
|
465
|
-
|
|
466
|
-
// Single inline handler - no middleware
|
|
467
|
-
app[method](route, async (c) => {
|
|
468
|
-
try {
|
|
469
|
-
const services = await servicesPromise;
|
|
470
|
-
|
|
471
|
-
// Inline validation
|
|
472
|
-
let body: any;
|
|
473
|
-
if (endpoint.input?.body) {
|
|
474
|
-
const rawBody = await c.req.json().catch(() => ({}));
|
|
475
|
-
const parsed = await Endpoint.validate(endpoint.input.body, rawBody);
|
|
476
|
-
if (parsed.issues) return c.json(parsed.issues, 422);
|
|
477
|
-
body = parsed.value;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
let query: any;
|
|
481
|
-
if (endpoint.input?.query) {
|
|
482
|
-
const parsedQuery = parseHonoQuery(c);
|
|
483
|
-
const parsed = await Endpoint.validate(
|
|
484
|
-
endpoint.input.query,
|
|
485
|
-
parsedQuery,
|
|
486
|
-
);
|
|
487
|
-
if (parsed.issues) return c.json(parsed.issues, 422);
|
|
488
|
-
query = parsed.value;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
let params: any;
|
|
492
|
-
if (endpoint.input?.params) {
|
|
493
|
-
const parsed = await Endpoint.validate(
|
|
494
|
-
endpoint.input.params,
|
|
495
|
-
c.req.param(),
|
|
496
|
-
);
|
|
497
|
-
if (parsed.issues) return c.json(parsed.issues, 422);
|
|
498
|
-
params = parsed.value;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
// Execute handler
|
|
502
|
-
const responseBuilder = new ResponseBuilder();
|
|
503
|
-
const response = await endpoint.handler(
|
|
504
|
-
{
|
|
505
|
-
services,
|
|
506
|
-
logger: endpoint.logger,
|
|
507
|
-
body,
|
|
508
|
-
query,
|
|
509
|
-
params,
|
|
510
|
-
session: undefined,
|
|
511
|
-
header: Endpoint.createHeaders(c.req.header()),
|
|
512
|
-
cookie: Endpoint.createCookies(c.req.header().cookie),
|
|
513
|
-
auditor: undefined,
|
|
514
|
-
db: undefined,
|
|
515
|
-
} as any,
|
|
516
|
-
responseBuilder,
|
|
517
|
-
);
|
|
518
|
-
|
|
519
|
-
// Process response
|
|
520
|
-
const output = endpoint.outputSchema
|
|
521
|
-
? await endpoint.parseOutput(response)
|
|
522
|
-
: response;
|
|
523
|
-
|
|
524
|
-
return c.json(output, endpoint.status as any);
|
|
525
|
-
} catch (_error) {
|
|
526
|
-
return c.json({ error: 'Internal Server Error' }, 500);
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
}
|