@geekmidas/constructs 10.0.0-alpha.98 → 10.0.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/CHANGELOG.md +437 -0
- package/README.md +193 -285
- package/dist/AWSScheduledFunction-BzGCUbkk.d.mts +117 -0
- package/dist/AWSScheduledFunction-BzGCUbkk.d.mts.map +1 -0
- package/dist/AWSScheduledFunction-C42adp8A.cjs +266 -0
- package/dist/AWSScheduledFunction-C42adp8A.cjs.map +1 -0
- package/dist/AWSScheduledFunction-CsNJhXQj.d.cts +117 -0
- package/dist/AWSScheduledFunction-CsNJhXQj.d.cts.map +1 -0
- package/dist/AWSScheduledFunction-KP6lqbsW.mjs +254 -0
- package/dist/AWSScheduledFunction-KP6lqbsW.mjs.map +1 -0
- package/dist/{Construct-B1vGBPme.mjs → Construct-BWF5HxaM.mjs} +37 -47
- package/dist/Construct-BWF5HxaM.mjs.map +1 -0
- package/dist/Construct-JlyQkBkv.d.cts +117 -0
- package/dist/Construct-JlyQkBkv.d.cts.map +1 -0
- package/dist/{Construct-DUSXuTHP.cjs → Construct-TGIM_E4o.cjs} +88 -67
- package/dist/Construct-TGIM_E4o.cjs.map +1 -0
- package/dist/Construct-pxwC6fDD.d.mts +117 -0
- package/dist/Construct-pxwC6fDD.d.mts.map +1 -0
- package/dist/{Endpoint-Du-NwPX2.d.mts → Endpoint-B0P_pEMr.d.mts} +85 -126
- package/dist/Endpoint-B0P_pEMr.d.mts.map +1 -0
- package/dist/{Endpoint-aCvBMPoH.d.cts → Endpoint-BLZ7r67m.d.cts} +84 -125
- package/dist/Endpoint-BLZ7r67m.d.cts.map +1 -0
- package/dist/{HonoEndpointAdaptor-PtPlbeKY.mjs → HonoEndpointAdaptor-BMVwx2cz.mjs} +69 -81
- package/dist/HonoEndpointAdaptor-BMVwx2cz.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-zVzVLJEO.cjs → HonoEndpointAdaptor-DPDsDi-D.cjs} +77 -92
- package/dist/HonoEndpointAdaptor-DPDsDi-D.cjs.map +1 -0
- package/dist/Queue-BL68oDJ-.d.mts +66 -0
- package/dist/Queue-BL68oDJ-.d.mts.map +1 -0
- package/dist/Queue-DxJ6btRE.d.cts +66 -0
- package/dist/Queue-DxJ6btRE.d.cts.map +1 -0
- package/dist/Subscriber-BpVhcGhX.d.cts +47 -0
- package/dist/Subscriber-BpVhcGhX.d.cts.map +1 -0
- package/dist/Subscriber-DF6xsBAJ.d.mts +47 -0
- package/dist/Subscriber-DF6xsBAJ.d.mts.map +1 -0
- package/dist/Topic-DJXoDeMP.d.cts +60 -0
- package/dist/Topic-DJXoDeMP.d.cts.map +1 -0
- package/dist/Topic-DxWQBgMN.d.mts +60 -0
- package/dist/Topic-DxWQBgMN.d.mts.map +1 -0
- package/dist/adaptors/aws.cjs +205 -355
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +48 -126
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +49 -127
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +178 -325
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +9 -3
- package/dist/adaptors/hono.d.cts +15 -7
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +17 -9
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +9 -2
- package/dist/adaptors/testing.cjs +209 -831
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +55 -351
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +53 -349
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +195 -798
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/{clone-UGJpvQnL.cjs → clone-I_WIpiFf.cjs} +8 -7
- package/dist/clone-I_WIpiFf.cjs.map +1 -0
- package/dist/{clone-EKNovYHu.mjs → clone-pdXxc0t3.mjs} +3 -3
- package/dist/clone-pdXxc0t3.mjs.map +1 -0
- package/dist/crons/index.cjs +66 -190
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +35 -70
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +32 -70
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +63 -184
- package/dist/crons/index.mjs.map +1 -1
- package/dist/endpoints/index.cjs +761 -19
- package/dist/endpoints/index.cjs.map +1 -0
- package/dist/endpoints/index.d.cts +322 -22
- package/dist/endpoints/index.d.cts.map +1 -1
- package/dist/endpoints/index.d.mts +321 -22
- package/dist/endpoints/index.d.mts.map +1 -1
- package/dist/endpoints/index.mjs +751 -6
- package/dist/endpoints/index.mjs.map +1 -0
- package/dist/functions/index.cjs +5 -2
- package/dist/functions/index.d.cts +3 -3
- package/dist/functions/index.d.mts +3 -3
- package/dist/functions/index.mjs +5 -2
- package/dist/{functions-BFizikJU.mjs → functions-EqTloHjo.mjs} +331 -425
- package/dist/functions-EqTloHjo.mjs.map +1 -0
- package/dist/{functions-CfzJG9hK.cjs → functions-SqtCDc9c.cjs} +370 -459
- package/dist/functions-SqtCDc9c.cjs.map +1 -0
- package/dist/index-C7iynzLI.d.mts +139 -0
- package/dist/index-C7iynzLI.d.mts.map +1 -0
- package/dist/index-D4dM_WDY.d.cts +142 -0
- package/dist/index-D4dM_WDY.d.cts.map +1 -0
- package/dist/index.cjs +3 -6
- package/dist/index.d.cts +4 -27
- package/dist/index.d.mts +4 -27
- package/dist/index.mjs +3 -3
- package/dist/{Endpoint-BG4UJ9oA.mjs → lazyAccessors-CCTK19xj.mjs} +1040 -914
- package/dist/lazyAccessors-CCTK19xj.mjs.map +1 -0
- package/dist/{Endpoint-BoUg8ocM.cjs → lazyAccessors-D04oftGw.cjs} +1127 -960
- package/dist/lazyAccessors-D04oftGw.cjs.map +1 -0
- package/dist/monitors/index.cjs +49 -0
- package/dist/monitors/index.cjs.map +1 -0
- package/dist/monitors/index.d.cts +45 -0
- package/dist/monitors/index.d.cts.map +1 -0
- package/dist/monitors/index.d.mts +45 -0
- package/dist/monitors/index.d.mts.map +1 -0
- package/dist/monitors/index.mjs +48 -0
- package/dist/monitors/index.mjs.map +1 -0
- package/dist/processAudits-BJZT5gmy.cjs +92 -0
- package/dist/processAudits-BJZT5gmy.cjs.map +1 -0
- package/dist/processAudits-CwyaaSQc.mjs +80 -0
- package/dist/processAudits-CwyaaSQc.mjs.map +1 -0
- package/dist/publisher-BZgcrVPy.cjs +53 -0
- package/dist/publisher-BZgcrVPy.cjs.map +1 -0
- package/dist/publisher-CnpeMv-r.mjs +41 -0
- package/dist/publisher-CnpeMv-r.mjs.map +1 -0
- package/dist/queue/index.cjs +114 -6
- package/dist/queue/index.cjs.map +1 -0
- package/dist/queue/index.d.cts +45 -3
- package/dist/queue/index.d.cts.map +1 -0
- package/dist/queue/index.d.mts +44 -3
- package/dist/queue/index.d.mts.map +1 -0
- package/dist/queue/index.mjs +112 -3
- package/dist/queue/index.mjs.map +1 -0
- package/dist/subscribers/index.cjs +80 -111
- package/dist/subscribers/index.cjs.map +1 -1
- package/dist/subscribers/index.d.cts +43 -46
- package/dist/subscribers/index.d.cts.map +1 -1
- package/dist/subscribers/index.d.mts +42 -46
- package/dist/subscribers/index.d.mts.map +1 -1
- package/dist/subscribers/index.mjs +78 -108
- package/dist/subscribers/index.mjs.map +1 -1
- package/dist/{lambdaTelemetry-8vnmVZQ5.d.cts → telemetry-C--EgYVr.d.mts} +7 -4
- package/dist/telemetry-C--EgYVr.d.mts.map +1 -0
- package/dist/{lambdaTelemetry-8vnmVZQ5.d.mts → telemetry-Dqx-D3F7.d.cts} +7 -4
- package/dist/telemetry-Dqx-D3F7.d.cts.map +1 -0
- package/dist/topic/index.cjs +91 -3
- package/dist/topic/index.cjs.map +1 -0
- package/dist/topic/index.d.cts +32 -2
- package/dist/topic/index.d.cts.map +1 -0
- package/dist/topic/index.d.mts +32 -2
- package/dist/topic/index.d.mts.map +1 -0
- package/dist/topic/index.mjs +89 -2
- package/dist/topic/index.mjs.map +1 -0
- package/dist/{types-DMuSQeLL.d.cts → types-BdAaYDvd.d.cts} +5 -3
- package/dist/types-BdAaYDvd.d.cts.map +1 -0
- package/dist/{types-DMuSQeLL.d.mts → types-DNngH0fX.d.mts} +5 -3
- package/dist/types-DNngH0fX.d.mts.map +1 -0
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.mjs +0 -1
- package/package.json +55 -223
- package/src/Construct.ts +209 -0
- package/src/__benchmarks__/build-time-optimization.bench.ts +274 -0
- package/src/__benchmarks__/endpoint.bench.ts +494 -0
- package/src/__benchmarks__/fixtures.ts +241 -0
- package/src/__benchmarks__/hono-adaptor.bench.ts +533 -0
- package/src/__benchmarks__/hono-server.bench.ts +249 -0
- package/src/__benchmarks__/response-builder.bench.ts +428 -0
- package/src/__benchmarks__/strategies/strategy-a-lazy-services.ts +319 -0
- package/src/__benchmarks__/strategies/strategy-c-middleware.ts +530 -0
- package/src/__benchmarks__/strategies/strategy-d-opt-in-events.ts +567 -0
- package/src/__tests__/Construct.environment.spec.ts +704 -0
- package/src/__tests__/builder-reuse.spec.ts +587 -0
- package/src/__tests__/monitor.spec.ts +636 -0
- package/src/__tests__/publisher.setting.spec.ts +508 -0
- package/src/__tests__/publisher.spec.ts +452 -0
- package/src/adaptors/aws.ts +6 -0
- package/src/adaptors/hono.ts +1 -0
- package/src/adaptors/testing.ts +11 -0
- package/src/clone.ts +38 -0
- package/src/crons/AWSScheduledFunction.ts +73 -0
- package/src/crons/Cron.ts +149 -0
- package/src/crons/CronBuilder.ts +261 -0
- package/src/crons/__tests__/AWSScheduledFunction.spec.ts +152 -0
- package/src/crons/__tests__/Cron.spec.ts +472 -0
- package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +273 -0
- package/src/crons/index.ts +12 -0
- package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +698 -0
- package/src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts +105 -0
- package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +97 -0
- package/src/endpoints/Authorizer.ts +152 -0
- package/src/endpoints/Endpoint.ts +1287 -0
- package/src/endpoints/EndpointBuilder.ts +749 -0
- package/src/endpoints/EndpointFactory.ts +1179 -0
- package/src/endpoints/HonoEndpointAdaptor.ts +692 -0
- package/src/endpoints/MswEndpointAdaptor.ts +226 -0
- package/src/endpoints/TestEndpointAdaptor.ts +466 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.audits.spec.ts +499 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +560 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +1304 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.audits.spec.ts +626 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +732 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.factory-publisher.spec.ts +296 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.kysely-audit.integration.spec.ts +951 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.responseType.spec.ts +111 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.rls.spec.ts +307 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +629 -0
- package/src/endpoints/__tests__/Authorizer.spec.ts +286 -0
- package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +207 -0
- package/src/endpoints/__tests__/Endpoint.headers.spec.ts +187 -0
- package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +175 -0
- package/src/endpoints/__tests__/Endpoint.spec.ts +857 -0
- package/src/endpoints/__tests__/EndpointBuilder.audit.spec.ts +451 -0
- package/src/endpoints/__tests__/EndpointBuilder.responseType.spec.ts +50 -0
- package/src/endpoints/__tests__/EndpointBuilder.spec.ts +531 -0
- package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +492 -0
- package/src/endpoints/__tests__/EndpointFactory.database-auditor.spec.ts +509 -0
- package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +190 -0
- package/src/endpoints/__tests__/EndpointFactory.spec.ts +479 -0
- package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +155 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.audit-transactions.spec.ts +703 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.audits.spec.ts +632 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +577 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.kysely-audit.integration.spec.ts +1067 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +317 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.pgboss-publisher.spec.ts +289 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.responseType.spec.ts +128 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +1207 -0
- package/src/endpoints/__tests__/MswEndpointAdaptor.spec.ts +211 -0
- package/src/endpoints/__tests__/ResponseBuilder.spec.ts +235 -0
- package/src/endpoints/__tests__/TestEndpointAdaptor.audits.spec.ts +602 -0
- package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +1044 -0
- package/src/endpoints/__tests__/__snapshots__/HonoEndpointAdaptor.spec.ts.snap +54 -0
- package/src/endpoints/__tests__/endpoint-types.test.ts +88 -0
- package/src/endpoints/__tests__/helpers.spec.ts +37 -0
- package/src/endpoints/__tests__/lazyAccessors.spec.ts +330 -0
- package/src/endpoints/__tests__/processAudits.spec.ts +631 -0
- package/src/endpoints/audit.ts +87 -0
- package/src/endpoints/helpers.ts +98 -0
- package/src/endpoints/index.ts +42 -0
- package/src/endpoints/lazyAccessors.ts +241 -0
- package/src/endpoints/parseHonoQuery.ts +16 -0
- package/src/endpoints/parseQueryParams.ts +32 -0
- package/src/endpoints/processAudits.ts +371 -0
- package/src/endpoints/rls.ts +67 -0
- package/src/functions/AWSLambdaFunction.ts +374 -0
- package/src/functions/BaseFunctionBuilder.ts +212 -0
- package/src/functions/Function.ts +238 -0
- package/src/functions/FunctionBuilder.ts +381 -0
- package/src/functions/FunctionExecutionWrapper.ts +216 -0
- package/src/functions/TestFunctionAdaptor.ts +252 -0
- package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +513 -0
- package/src/functions/__tests__/Function.audits.spec.ts +393 -0
- package/src/functions/__tests__/Function.spec.ts +477 -0
- package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +250 -0
- package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +480 -0
- package/src/functions/index.ts +12 -0
- package/src/index.ts +29 -0
- package/src/monitor.ts +145 -0
- package/src/monitors/heartbeat.ts +86 -0
- package/src/monitors/index.ts +6 -0
- package/src/publisher.ts +93 -0
- package/src/queue/AWSLambdaQueueAdaptor.ts +162 -0
- package/src/queue/Queue.ts +128 -0
- package/src/queue/QueueBuilder.ts +115 -0
- package/src/queue/TestQueueAdaptor.ts +63 -0
- package/src/queue/__tests__/QueueBuilder.spec.ts +137 -0
- package/src/queue/index.ts +12 -0
- package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +342 -0
- package/src/subscribers/Subscriber.ts +117 -0
- package/src/subscribers/SubscriberBuilder.ts +183 -0
- package/src/subscribers/TestSubscriberAdaptor.ts +133 -0
- package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +1018 -0
- package/src/subscribers/__tests__/Subscriber.spec.ts +430 -0
- package/src/subscribers/__tests__/TestSubscriberAdaptor.spec.ts +652 -0
- package/src/subscribers/index.ts +6 -0
- package/src/telemetry.ts +103 -0
- package/src/topic/Topic.ts +103 -0
- package/src/topic/TopicBuilder.ts +53 -0
- package/src/topic/__tests__/TopicBuilder.spec.ts +82 -0
- package/src/topic/index.ts +11 -0
- package/src/types.ts +13 -0
- package/test.ts +91 -0
- package/tsconfig.json +9 -0
- package/tsdown.config.ts +35 -0
- package/dist/Construct-B1vGBPme.mjs.map +0 -1
- package/dist/Construct-BQALFCh2.d.cts +0 -230
- package/dist/Construct-BQALFCh2.d.cts.map +0 -1
- package/dist/Construct-DUSXuTHP.cjs.map +0 -1
- package/dist/Construct-QXnl3VqT.d.mts +0 -230
- package/dist/Construct-QXnl3VqT.d.mts.map +0 -1
- package/dist/Cron-DI3nKoic.d.cts +0 -45
- package/dist/Cron-DI3nKoic.d.cts.map +0 -1
- package/dist/Cron-uYAHPnp7.d.mts +0 -45
- package/dist/Cron-uYAHPnp7.d.mts.map +0 -1
- package/dist/CronBuilder-C0Ek1-RA.cjs +0 -121
- package/dist/CronBuilder-C0Ek1-RA.cjs.map +0 -1
- package/dist/CronBuilder-DaSUm2Na.d.mts +0 -47
- package/dist/CronBuilder-DaSUm2Na.d.mts.map +0 -1
- package/dist/CronBuilder-Dmix_Pen.mjs +0 -109
- package/dist/CronBuilder-Dmix_Pen.mjs.map +0 -1
- package/dist/CronBuilder-g1lZLWyG.d.cts +0 -47
- package/dist/CronBuilder-g1lZLWyG.d.cts.map +0 -1
- package/dist/Endpoint-BG4UJ9oA.mjs.map +0 -1
- package/dist/Endpoint-BoUg8ocM.cjs.map +0 -1
- package/dist/Endpoint-Du-NwPX2.d.mts.map +0 -1
- package/dist/Endpoint-aCvBMPoH.d.cts.map +0 -1
- package/dist/EndpointFactory-BDtsrEvJ.mjs +0 -791
- package/dist/EndpointFactory-BDtsrEvJ.mjs.map +0 -1
- package/dist/EndpointFactory-DJ7gXLpR.cjs +0 -833
- package/dist/EndpointFactory-DJ7gXLpR.cjs.map +0 -1
- package/dist/EndpointFactory-DMYdJCOj.d.mts +0 -363
- package/dist/EndpointFactory-DMYdJCOj.d.mts.map +0 -1
- package/dist/EndpointFactory-I7s1co3Y.d.cts +0 -363
- package/dist/EndpointFactory-I7s1co3Y.d.cts.map +0 -1
- package/dist/Function-DuqGcbOI.d.mts +0 -76
- package/dist/Function-DuqGcbOI.d.mts.map +0 -1
- package/dist/Function-Pu-1kKZz.d.cts +0 -76
- package/dist/Function-Pu-1kKZz.d.cts.map +0 -1
- package/dist/HonoEndpointAdaptor-PtPlbeKY.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-zVzVLJEO.cjs.map +0 -1
- package/dist/Queue-A3wfD0it.cjs +0 -109
- package/dist/Queue-A3wfD0it.cjs.map +0 -1
- package/dist/Queue-D6USGS4q.mjs +0 -104
- package/dist/Queue-D6USGS4q.mjs.map +0 -1
- package/dist/Queue-DlsHRzUp.d.mts +0 -105
- package/dist/Queue-DlsHRzUp.d.mts.map +0 -1
- package/dist/Queue-HPyi0e1i.d.cts +0 -105
- package/dist/Queue-HPyi0e1i.d.cts.map +0 -1
- package/dist/QueueBuilder-BjuF0UBl.cjs +0 -135
- package/dist/QueueBuilder-BjuF0UBl.cjs.map +0 -1
- package/dist/QueueBuilder-Cue73M4t.mjs +0 -118
- package/dist/QueueBuilder-Cue73M4t.mjs.map +0 -1
- package/dist/QueueBuilder-OSi6LkV9.d.cts +0 -75
- package/dist/QueueBuilder-OSi6LkV9.d.cts.map +0 -1
- package/dist/QueueBuilder-QHsnVt1P.d.mts +0 -75
- package/dist/QueueBuilder-QHsnVt1P.d.mts.map +0 -1
- package/dist/Subscriber-Bpp02cGr.d.cts +0 -61
- package/dist/Subscriber-Bpp02cGr.d.cts.map +0 -1
- package/dist/Subscriber-CtN9R48-.d.mts +0 -61
- package/dist/Subscriber-CtN9R48-.d.mts.map +0 -1
- package/dist/SubscriberBuilder-CDy4nHCz.mjs +0 -134
- package/dist/SubscriberBuilder-CDy4nHCz.mjs.map +0 -1
- package/dist/SubscriberBuilder-CuCMFpYW.d.mts +0 -67
- package/dist/SubscriberBuilder-CuCMFpYW.d.mts.map +0 -1
- package/dist/SubscriberBuilder-D_owVoHo.cjs +0 -145
- package/dist/SubscriberBuilder-D_owVoHo.cjs.map +0 -1
- package/dist/SubscriberBuilder-g3fAVWgs.d.cts +0 -67
- package/dist/SubscriberBuilder-g3fAVWgs.d.cts.map +0 -1
- package/dist/Topic-D74b5cgs.mjs +0 -99
- package/dist/Topic-D74b5cgs.mjs.map +0 -1
- package/dist/Topic-GHxcU8AG.cjs +0 -104
- package/dist/Topic-GHxcU8AG.cjs.map +0 -1
- package/dist/auth-BMCJN30Y.d.cts +0 -268
- package/dist/auth-BMCJN30Y.d.cts.map +0 -1
- package/dist/auth-CcuceLYo.d.mts +0 -268
- package/dist/auth-CcuceLYo.d.mts.map +0 -1
- package/dist/auth.cjs +0 -433
- package/dist/auth.cjs.map +0 -1
- package/dist/auth.d.cts +0 -2
- package/dist/auth.d.mts +0 -2
- package/dist/auth.mjs +0 -426
- package/dist/auth.mjs.map +0 -1
- package/dist/cache-CXh6GIgb.d.mts +0 -44
- package/dist/cache-CXh6GIgb.d.mts.map +0 -1
- package/dist/cache-DnGDGly3.d.cts +0 -44
- package/dist/cache-DnGDGly3.d.cts.map +0 -1
- package/dist/cache.cjs +0 -69
- package/dist/cache.cjs.map +0 -1
- package/dist/cache.d.cts +0 -2
- package/dist/cache.d.mts +0 -2
- package/dist/cache.mjs +0 -68
- package/dist/cache.mjs.map +0 -1
- package/dist/cipher-C1lEFX63.mjs +0 -225
- package/dist/cipher-C1lEFX63.mjs.map +0 -1
- package/dist/cipher-CVxfwLjk.cjs +0 -332
- package/dist/cipher-CVxfwLjk.cjs.map +0 -1
- package/dist/clone-EKNovYHu.mjs.map +0 -1
- package/dist/clone-UGJpvQnL.cjs.map +0 -1
- package/dist/construct-interface-B1AfqRl4.d.cts +0 -162
- package/dist/construct-interface-B1AfqRl4.d.cts.map +0 -1
- package/dist/construct-interface-DluK3_da.d.mts +0 -162
- package/dist/construct-interface-DluK3_da.d.mts.map +0 -1
- package/dist/construct-interface.cjs +0 -114
- package/dist/construct-interface.cjs.map +0 -1
- package/dist/construct-interface.d.cts +0 -2
- package/dist/construct-interface.d.mts +0 -2
- package/dist/construct-interface.mjs +0 -107
- package/dist/construct-interface.mjs.map +0 -1
- package/dist/credential.cjs +0 -156
- package/dist/credential.cjs.map +0 -1
- package/dist/credential.d.cts +0 -86
- package/dist/credential.d.cts.map +0 -1
- package/dist/credential.d.mts +0 -86
- package/dist/credential.d.mts.map +0 -1
- package/dist/credential.mjs +0 -152
- package/dist/credential.mjs.map +0 -1
- package/dist/database/kysely.cjs +0 -4
- package/dist/database/kysely.d.cts +0 -2
- package/dist/database/kysely.d.mts +0 -2
- package/dist/database/kysely.mjs +0 -2
- package/dist/email.cjs +0 -72
- package/dist/email.cjs.map +0 -1
- package/dist/email.d.cts +0 -46
- package/dist/email.d.cts.map +0 -1
- package/dist/email.d.mts +0 -46
- package/dist/email.d.mts.map +0 -1
- package/dist/email.mjs +0 -71
- package/dist/email.mjs.map +0 -1
- package/dist/encryption.cjs +0 -96
- package/dist/encryption.cjs.map +0 -1
- package/dist/encryption.d.cts +0 -117
- package/dist/encryption.d.cts.map +0 -1
- package/dist/encryption.d.mts +0 -117
- package/dist/encryption.d.mts.map +0 -1
- package/dist/encryption.mjs +0 -83
- package/dist/encryption.mjs.map +0 -1
- package/dist/external-api-MJ8id87V.d.mts +0 -105
- package/dist/external-api-MJ8id87V.d.mts.map +0 -1
- package/dist/external-api-O107yzZJ.d.cts +0 -105
- package/dist/external-api-O107yzZJ.d.cts.map +0 -1
- package/dist/external-api.cjs +0 -142
- package/dist/external-api.cjs.map +0 -1
- package/dist/external-api.d.cts +0 -2
- package/dist/external-api.d.mts +0 -2
- package/dist/external-api.mjs +0 -139
- package/dist/external-api.mjs.map +0 -1
- package/dist/file-server.cjs +0 -186
- package/dist/file-server.cjs.map +0 -1
- package/dist/file-server.d.cts +0 -152
- package/dist/file-server.d.cts.map +0 -1
- package/dist/file-server.d.mts +0 -152
- package/dist/file-server.d.mts.map +0 -1
- package/dist/file-server.mjs +0 -184
- package/dist/file-server.mjs.map +0 -1
- package/dist/functions-BFizikJU.mjs.map +0 -1
- package/dist/functions-CfzJG9hK.cjs.map +0 -1
- package/dist/index-BuzRvKOQ.d.cts +0 -115
- package/dist/index-BuzRvKOQ.d.cts.map +0 -1
- package/dist/index-CTkKOer4.d.mts +0 -115
- package/dist/index-CTkKOer4.d.mts.map +0 -1
- package/dist/index-CeEtxDmK.d.cts +0 -79
- package/dist/index-CeEtxDmK.d.cts.map +0 -1
- package/dist/index-CeEtxDmK.d.mts +0 -79
- package/dist/index-CeEtxDmK.d.mts.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/kms-B-Hm3d5r.cjs +0 -85
- package/dist/kms-B-Hm3d5r.cjs.map +0 -1
- package/dist/kms-BdUlMJEZ.mjs +0 -85
- package/dist/kms-BdUlMJEZ.mjs.map +0 -1
- package/dist/kysely-Bii4l6eP.mjs +0 -370
- package/dist/kysely-Bii4l6eP.mjs.map +0 -1
- package/dist/kysely-CO_Dk43W.cjs +0 -383
- package/dist/kysely-CO_Dk43W.cjs.map +0 -1
- package/dist/kysely-D0bpzgPs.d.cts +0 -175
- package/dist/kysely-D0bpzgPs.d.cts.map +0 -1
- package/dist/kysely-DUqC3Ie0.d.mts +0 -175
- package/dist/kysely-DUqC3Ie0.d.mts.map +0 -1
- package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +0 -1
- package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +0 -1
- package/dist/lazyAccessors-CFanua0O.mjs +0 -174
- package/dist/lazyAccessors-CFanua0O.mjs.map +0 -1
- package/dist/lazyAccessors-hJKGv8Ay.cjs +0 -221
- package/dist/lazyAccessors-hJKGv8Ay.cjs.map +0 -1
- package/dist/mobile-app.cjs +0 -73
- package/dist/mobile-app.cjs.map +0 -1
- package/dist/mobile-app.d.cts +0 -61
- package/dist/mobile-app.d.cts.map +0 -1
- package/dist/mobile-app.d.mts +0 -61
- package/dist/mobile-app.d.mts.map +0 -1
- package/dist/mobile-app.mjs +0 -72
- package/dist/mobile-app.mjs.map +0 -1
- package/dist/object-storage.cjs +0 -56
- package/dist/object-storage.cjs.map +0 -1
- package/dist/object-storage.d.cts +0 -32
- package/dist/object-storage.d.cts.map +0 -1
- package/dist/object-storage.d.mts +0 -32
- package/dist/object-storage.d.mts.map +0 -1
- package/dist/object-storage.mjs +0 -55
- package/dist/object-storage.mjs.map +0 -1
- package/dist/processAudits-BRRVVHUB.mjs +0 -131
- package/dist/processAudits-BRRVVHUB.mjs.map +0 -1
- package/dist/processAudits-DasOZjPl.cjs +0 -154
- package/dist/processAudits-DasOZjPl.cjs.map +0 -1
- package/dist/rest-api.cjs +0 -216
- package/dist/rest-api.cjs.map +0 -1
- package/dist/rest-api.d.cts +0 -241
- package/dist/rest-api.d.cts.map +0 -1
- package/dist/rest-api.d.mts +0 -241
- package/dist/rest-api.d.mts.map +0 -1
- package/dist/rest-api.mjs +0 -215
- package/dist/rest-api.mjs.map +0 -1
- package/dist/rolldown-runtime-y5ARvAq5.cjs +0 -35
- package/dist/runSubscriber-BHvJ8POr.mjs +0 -109
- package/dist/runSubscriber-BHvJ8POr.mjs.map +0 -1
- package/dist/runSubscriber-D8nLXIv1.cjs +0 -126
- package/dist/runSubscriber-D8nLXIv1.cjs.map +0 -1
- package/dist/shutdown-BMJmAhSt.cjs +0 -38
- package/dist/shutdown-BMJmAhSt.cjs.map +0 -1
- package/dist/shutdown-C7xa8x9S.mjs +0 -27
- package/dist/shutdown-C7xa8x9S.mjs.map +0 -1
- package/dist/site.cjs +0 -74
- package/dist/site.cjs.map +0 -1
- package/dist/site.d.cts +0 -104
- package/dist/site.d.cts.map +0 -1
- package/dist/site.d.mts +0 -104
- package/dist/site.d.mts.map +0 -1
- package/dist/site.mjs +0 -73
- package/dist/site.mjs.map +0 -1
- package/dist/stages-BSCF19o2.d.cts +0 -56
- package/dist/stages-BSCF19o2.d.cts.map +0 -1
- package/dist/stages-BSCF19o2.d.mts +0 -56
- package/dist/stages-BSCF19o2.d.mts.map +0 -1
- package/dist/surfaceEnv-CNimK76p.cjs +0 -56
- package/dist/surfaceEnv-CNimK76p.cjs.map +0 -1
- package/dist/surfaceEnv-wMT5QzgZ.mjs +0 -45
- package/dist/surfaceEnv-wMT5QzgZ.mjs.map +0 -1
- package/dist/telemetry-B48RLjyk.d.cts +0 -40
- package/dist/telemetry-B48RLjyk.d.cts.map +0 -1
- package/dist/telemetry-DRtT1_0A.d.mts +0 -40
- package/dist/telemetry-DRtT1_0A.d.mts.map +0 -1
- package/dist/telemetry.cjs +0 -56
- package/dist/telemetry.cjs.map +0 -1
- package/dist/telemetry.d.cts +0 -2
- package/dist/telemetry.d.mts +0 -2
- package/dist/telemetry.mjs +0 -55
- package/dist/telemetry.mjs.map +0 -1
- package/dist/tracing-CxaZ98IB.mjs +0 -110
- package/dist/tracing-CxaZ98IB.mjs.map +0 -1
- package/dist/tracing-DPMidF_r.cjs +0 -127
- package/dist/tracing-DPMidF_r.cjs.map +0 -1
- package/dist/types-DMuSQeLL.d.cts.map +0 -1
- package/dist/types-DMuSQeLL.d.mts.map +0 -1
- package/dist/worker.cjs +0 -191
- package/dist/worker.cjs.map +0 -1
- package/dist/worker.d.cts +0 -171
- package/dist/worker.d.cts.map +0 -1
- package/dist/worker.d.mts +0 -171
- package/dist/worker.d.mts.map +0 -1
- package/dist/worker.mjs +0 -190
- package/dist/worker.mjs.map +0 -1
package/dist/rest-api.d.cts
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { i as Declarable, t as Authenticator } from "./construct-interface-B1AfqRl4.cjs";
|
|
2
|
-
import { n as Telemetry } from "./telemetry-B48RLjyk.cjs";
|
|
3
|
-
import { T as BuiltInSecuritySchemeId } from "./Endpoint-aCvBMPoH.cjs";
|
|
4
|
-
import { t as EndpointFactory } from "./EndpointFactory-I7s1co3Y.cjs";
|
|
5
|
-
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
6
|
-
import { Logger } from "@geekmidas/logger";
|
|
7
|
-
import { ConstructName, Declaration, Dependency } from "@geekmidas/manifest";
|
|
8
|
-
import { Telescope } from "@geekmidas/telescope";
|
|
9
|
-
//#region src/rest-api.d.ts
|
|
10
|
-
/** The factory a surface builds its endpoints from. */
|
|
11
|
-
type Endpoints = EndpointFactory<[], '', Logger>;
|
|
12
|
-
export interface RestApiConfig<TAuthorizers extends readonly string[] = readonly []> {
|
|
13
|
-
/**
|
|
14
|
-
* The app that serves this surface, relative to the workspace root —
|
|
15
|
-
* `'apps/api'`, or `'.'` in a single-app project.
|
|
16
|
-
*
|
|
17
|
-
* Required. It was inferred from the id (`apps/<kebab-id>`, or the root
|
|
18
|
-
* when no such directory existed), which meant a surface's home was
|
|
19
|
-
* whatever happened to be on disk. It is where the app's `package.json`
|
|
20
|
-
* and base `tsconfig.json` are, and which build serves this surface. It
|
|
21
|
-
* does not change discovery: constructs still load from the workspace's
|
|
22
|
-
* `constructs` glob.
|
|
23
|
-
*/
|
|
24
|
-
path: string;
|
|
25
|
-
/**
|
|
26
|
-
* The label it answers on under a stage's domain — `api` for
|
|
27
|
-
* `api.myapp.com`, from `domains` — and under the project locally,
|
|
28
|
-
* `api.myapp.localhost`. Absent, its id kebab-cased.
|
|
29
|
-
*/
|
|
30
|
-
subdomain?: string;
|
|
31
|
-
/**
|
|
32
|
-
* CORS tunables. The *origins* are never here — they are read off the
|
|
33
|
-
* constructs that declared an edge to this surface, which is the whole point
|
|
34
|
-
* of declaring one. These are the parts a graph cannot answer.
|
|
35
|
-
*/
|
|
36
|
-
cors?: {
|
|
37
|
-
maxAge?: number;
|
|
38
|
-
credentials?: boolean;
|
|
39
|
-
allowHeaders?: readonly string[];
|
|
40
|
-
exposeHeaders?: readonly string[];
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* The authorizer names this surface exposes. Names only — what verifies a
|
|
44
|
-
* request legitimately differs between local and deployed, so the mechanism
|
|
45
|
-
* belongs to the target and never to portable code.
|
|
46
|
-
*/
|
|
47
|
-
authorizers?: TAuthorizers;
|
|
48
|
-
/**
|
|
49
|
-
* The authorizer applied to an endpoint that names none.
|
|
50
|
-
*
|
|
51
|
-
* Required, and `'none'` is a valid answer that has to be typed out. The
|
|
52
|
-
* alternative is an API that ships open because a field was left off, which
|
|
53
|
-
* is the one default worth refusing to have.
|
|
54
|
-
*
|
|
55
|
-
* It was called `default`, which said what it was to the type and nothing
|
|
56
|
-
* to the reader: next to `authorizers: ['iam']`, a bare `default: 'none'`
|
|
57
|
-
* could be defaulting the runtime or the target. The manifest has always
|
|
58
|
-
* called it `defaultAuthorizer` and the factory `defaultAuthorizerName`;
|
|
59
|
-
* this is the same fact under the same name.
|
|
60
|
-
*
|
|
61
|
-
* Typed from `authorizers`, so it can only name one this surface exposes —
|
|
62
|
-
* plus a built-in scheme, and `'none'`. It was a bare `string`, which let
|
|
63
|
-
* `defaultAuthorizer: 'jwtt'` compile and every endpoint on the surface
|
|
64
|
-
* default to an authorizer that does not exist.
|
|
65
|
-
*/
|
|
66
|
-
defaultAuthorizer: TAuthorizers[number] | BuiltInSecuritySchemeId | 'none';
|
|
67
|
-
/**
|
|
68
|
-
* The logger every endpoint on this surface runs with.
|
|
69
|
-
*
|
|
70
|
-
* The actual logger, not a path to one. It used to be named in config as
|
|
71
|
-
* `logger: './config/logger'`, because the build wrote an import into each
|
|
72
|
-
* generated handler and a generator can print a specifier but not an object.
|
|
73
|
-
* Endpoints built from the surface carry it, so there is nothing to print
|
|
74
|
-
* and nothing to keep in step with a moved file.
|
|
75
|
-
*/
|
|
76
|
-
logger?: Logger;
|
|
77
|
-
/**
|
|
78
|
-
* The environment parser every endpoint on this surface runs with.
|
|
79
|
-
*
|
|
80
|
-
* Same reason as `logger`, and the same field it replaces —
|
|
81
|
-
* `envParser: './config/env#envParser'`, a module path with an export name
|
|
82
|
-
* appended, parsed by us, checked by nothing.
|
|
83
|
-
*/
|
|
84
|
-
envParser?: EnvironmentParser<{}>;
|
|
85
|
-
/**
|
|
86
|
-
* The Telescope instance this surface's entry mounts.
|
|
87
|
-
*
|
|
88
|
-
* The actual instance, for the reason `logger` is: it used to be named as
|
|
89
|
-
* `telescope: './config/telescope#telescope'`, a module path the build
|
|
90
|
-
* printed an import for. The entry already imports the surface.
|
|
91
|
-
*/
|
|
92
|
-
telescope?: Telescope;
|
|
93
|
-
/**
|
|
94
|
-
* What this surface's process emits — the `Telemetry` construct, passed
|
|
95
|
-
* like the logger: a fact about the process, not a grant to a route.
|
|
96
|
-
*
|
|
97
|
-
* An edge to the node, so the deploy hands this process the `OTEL_*` keys
|
|
98
|
-
* its stage resolves, and the build fails without the OpenTelemetry
|
|
99
|
-
* packages. Where the telemetry goes is never here: it is the deploy's,
|
|
100
|
-
* per stage.
|
|
101
|
-
*/
|
|
102
|
-
telemetry?: Telemetry;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* What is *not* here, and why.
|
|
106
|
-
*
|
|
107
|
-
* `dependsOn`, `database`, `auditor` and `.event(topic, …)` all inject a capability
|
|
108
|
-
* into a handler. Putting one on the surface hands it to every route the
|
|
109
|
-
* surface serves — a health check gets the database because a report needed it
|
|
110
|
-
* — which is the thing least privilege forbids and the reason `.calls()` is not
|
|
111
|
-
* spelled `dependsOn`. They belong to the endpoint, or to a branch —
|
|
112
|
-
* `api.database(db)` — for a group of endpoints that genuinely share them. A
|
|
113
|
-
* branch is a new factory; the surface config stays free of grants.
|
|
114
|
-
*
|
|
115
|
-
* `auth` is not here either: `.auth(construct)` already declares it, and a
|
|
116
|
-
* second way to say the same thing is the duplication this whole model removes.
|
|
117
|
-
*
|
|
118
|
-
* What is left is what the *process* is rather than what a route may reach.
|
|
119
|
-
*/
|
|
120
|
-
export declare class RestApi<TName extends string = string, const TAuthorizers extends readonly string[] = readonly []> implements Declarable<TName> {
|
|
121
|
-
#private;
|
|
122
|
-
private readonly config;
|
|
123
|
-
/** Internal: how `.calls()` carries edges into the copy it returns. */
|
|
124
|
-
private readonly dependencies;
|
|
125
|
-
/** Internal: how `.auth()` carries the authenticator into its copy. */
|
|
126
|
-
private readonly authenticator?;
|
|
127
|
-
readonly id: TName;
|
|
128
|
-
/**
|
|
129
|
-
* Declared once and read by both `declare()` and anything that consumes this
|
|
130
|
-
* surface, so what the target publishes and what a consumer reads cannot
|
|
131
|
-
* drift.
|
|
132
|
-
*/
|
|
133
|
-
readonly keys: {
|
|
134
|
-
url: string;
|
|
135
|
-
trustedOrigins: string;
|
|
136
|
-
cookieDomain: string;
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* The logger every endpoint on this surface runs with.
|
|
140
|
-
*
|
|
141
|
-
* Always defined — the surface's own if it was given one, the console
|
|
142
|
-
* logger otherwise — so nothing downstream has to decide what to do about a
|
|
143
|
-
* missing one. The generated entry reads it from here.
|
|
144
|
-
*/
|
|
145
|
-
readonly logger: Logger;
|
|
146
|
-
/**
|
|
147
|
-
* The environment parser every endpoint on this surface runs with.
|
|
148
|
-
*
|
|
149
|
-
* Always defined, and normally the default: `process.env` merged with the
|
|
150
|
-
* credentials `gkm dev`/`gkm exec` injected. That is what every
|
|
151
|
-
* application's own `config/env.ts` was — boilerplate identical in every
|
|
152
|
-
* project, and mandatory, which is a poor combination.
|
|
153
|
-
*/
|
|
154
|
-
readonly envParser: EnvironmentParser<{}>;
|
|
155
|
-
/** The Telescope instance, when this surface was given one. */
|
|
156
|
-
readonly telescope?: Telescope;
|
|
157
|
-
/** What this surface's process emits, when it was given a `Telemetry`. */
|
|
158
|
-
readonly telemetry?: Telemetry;
|
|
159
|
-
constructor(id: ConstructName<TName>, config: RestApiConfig<TAuthorizers>,
|
|
160
|
-
/** Internal: how `.calls()` carries edges into the copy it returns. */
|
|
161
|
-
dependencies?: readonly Dependency[],
|
|
162
|
-
/** Internal: how `.auth()` carries the authenticator into its copy. */
|
|
163
|
-
authenticator?: Authenticator | undefined);
|
|
164
|
-
/** `api.get('/users')` — one route on this surface. */
|
|
165
|
-
readonly get: Endpoints['get'];
|
|
166
|
-
readonly post: Endpoints['post'];
|
|
167
|
-
readonly put: Endpoints['put'];
|
|
168
|
-
readonly patch: Endpoints['patch'];
|
|
169
|
-
readonly delete: Endpoints['delete'];
|
|
170
|
-
readonly options: Endpoints['options'];
|
|
171
|
-
/**
|
|
172
|
-
* A branch for a *group* of endpoints that shares what a single route would
|
|
173
|
-
* otherwise repeat — a database, an auditor, a publisher, a session:
|
|
174
|
-
*
|
|
175
|
-
* ```ts
|
|
176
|
-
* export const router = api.database(database);
|
|
177
|
-
* export const createUser = router.post('/users').handle(({ db }) => …);
|
|
178
|
-
* ```
|
|
179
|
-
*
|
|
180
|
-
* Each returns a new factory and leaves the surface as it was. That is the
|
|
181
|
-
* whole difference from putting the same thing in the surface's config: a
|
|
182
|
-
* group opts in, where the surface would grant it to every route it serves —
|
|
183
|
-
* a health check handed the database because a profile endpoint needed it.
|
|
184
|
-
*
|
|
185
|
-
* `dependsOn` is deliberately not here. It is per endpoint, and on the
|
|
186
|
-
* surface it would read as the API depending on something, which is what
|
|
187
|
-
* `.calls()` and `.auth()` say instead.
|
|
188
|
-
*/
|
|
189
|
-
readonly database: Endpoints['database'];
|
|
190
|
-
readonly session: Endpoints['session'];
|
|
191
|
-
readonly auditor: Endpoints['auditor'];
|
|
192
|
-
readonly actor: Endpoints['actor'];
|
|
193
|
-
readonly authorizer: Endpoints['authorizer'];
|
|
194
|
-
readonly authorize: Endpoints['authorize'];
|
|
195
|
-
readonly rls: Endpoints['rls'];
|
|
196
|
-
readonly route: Endpoints['route'];
|
|
197
|
-
/**
|
|
198
|
-
* What authenticates this surface.
|
|
199
|
-
*
|
|
200
|
-
* An edge like `.calls()` — the auth server learns this origin, and the two
|
|
201
|
-
* share a cookie domain — but a named one, because *who authenticates me* is
|
|
202
|
-
* a different fact from *who I happen to call*, and only one of them decides
|
|
203
|
-
* what a request is allowed to be. A surface with two of the first is a
|
|
204
|
-
* mistake; two of the second is Tuesday.
|
|
205
|
-
*
|
|
206
|
-
* It declares the id, and keeps the construct: a session callback reads from
|
|
207
|
-
* it as `auth` — `session(async ({ auth }) => auth.getSession())` — which
|
|
208
|
-
* calls the construct's `verify(headers)`. That is the one thing every
|
|
209
|
-
* provider shares, whether the server is mounted in this process, deployed
|
|
210
|
-
* beside it, or an OIDC issuer somebody else runs.
|
|
211
|
-
*/
|
|
212
|
-
auth(construct: Authenticator): RestApi<TName, TAuthorizers>;
|
|
213
|
-
/**
|
|
214
|
-
* Other surfaces this one calls.
|
|
215
|
-
*
|
|
216
|
-
* **Not `.dependsOn()`, and the difference matters.** An endpoint's
|
|
217
|
-
* `.dependsOn()` injects a client into that handler and grants it exactly
|
|
218
|
-
* what it named. This grants nothing and injects nothing: it records that
|
|
219
|
-
* this API calls another surface, which is what puts this API's origin on
|
|
220
|
-
* that surface's trusted-origin list.
|
|
221
|
-
*
|
|
222
|
-
* Spelling it `dependsOn` would invite the thing least privilege forbids —
|
|
223
|
-
* every route on the surface receiving whatever the surface named.
|
|
224
|
-
*
|
|
225
|
-
* Immutable, like every other builder here.
|
|
226
|
-
*/
|
|
227
|
-
calls(constructs: readonly Declarable[]): RestApi<TName, TAuthorizers>;
|
|
228
|
-
/**
|
|
229
|
-
* One surface node, with its endpoints left to the build.
|
|
230
|
-
*
|
|
231
|
-
* The three provided keys are one fact about this surface and two about its
|
|
232
|
-
* callers. Declaring the caller-derived pair here rather than having the
|
|
233
|
-
* target invent them is what makes the contract checkable: a target that
|
|
234
|
-
* resolves no origins is caught against this list instead of being noticed
|
|
235
|
-
* when a browser is refused in production.
|
|
236
|
-
*/
|
|
237
|
-
declare(): Declaration[];
|
|
238
|
-
}
|
|
239
|
-
//#endregion
|
|
240
|
-
export type { Authenticator };
|
|
241
|
-
//# sourceMappingURL=rest-api.d.cts.map
|
package/dist/rest-api.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rest-api.d.cts","names":[],"sources":["../src/rest-api.ts"],"mappings":";;;;;;;;;;KAmDK,YAAY,wBAAwB;iBAExB,cAIhB;;;;;;;;;;;;EAaA;;;;;;EAMA;;;;;;EAMA;IACC;IACA;IACA;IACA;;;;;;;EAOD,cAAc;;;;;;;;;;;;;;;;;;;EAmBd,mBAAmB,uBAAuB;;;;;;;;;;EAU1C,SAAS;;;;;;;;EAQT,YAAY;;;;;;;;EAQZ,YAAY;;;;;;;;;;EAUZ,YAAY;;;;;;;;;;;;;;;;;;qBAoBA,QACZ,qCACM,iEACM,WAAW;;mBA0CL;;mBAEA;;mBAEA;WA5CT,IAAI;;;;;;WAOJ;IACR;IACA;IACA;;;;;;;;;WAUQ,QAAQ;;;;;;;;;WAUR,WAAW;;WAGX,YAAY;;WAGZ,YAAY;EAErB,YACC,IAAI,cAAc,QACD,QAAQ,cAAc,eAEtB;;EAAA,wBAAuB,cAEvB;;EAAA,gBAAgB;;WAyEzB,KAAK;WACL,MAAM;WACN,KAAK;WACL,OAAO;WACP,QAAQ;WACR,SAAS;;;;;;;;;;;;;;;;;;;WAoBT,UAAU;WACV,SAAS;WACT,SAAS;WACT,OAAO;WACP,YAAY;WACZ,WAAW;WACX,KAAK;WACL,OAAO;;;;;;;;;;;;;;;;EAiBhB,KAAK,WAAW,gBAAgB,QAAQ,OAAO;;;;;;;;;;;;;;;EAuB/C,MAAM,qBAAqB,eAAe,QAAQ,OAAO;;;;;;;;;;EAkBzD,WAAW"}
|
package/dist/rest-api.d.mts
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { i as Declarable, t as Authenticator } from "./construct-interface-DluK3_da.mjs";
|
|
2
|
-
import { n as Telemetry } from "./telemetry-DRtT1_0A.mjs";
|
|
3
|
-
import { T as BuiltInSecuritySchemeId } from "./Endpoint-Du-NwPX2.mjs";
|
|
4
|
-
import { t as EndpointFactory } from "./EndpointFactory-DMYdJCOj.mjs";
|
|
5
|
-
import { ConstructName, Declaration, Dependency } from "@geekmidas/manifest";
|
|
6
|
-
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
7
|
-
import { Logger } from "@geekmidas/logger";
|
|
8
|
-
import { Telescope } from "@geekmidas/telescope";
|
|
9
|
-
//#region src/rest-api.d.ts
|
|
10
|
-
/** The factory a surface builds its endpoints from. */
|
|
11
|
-
type Endpoints = EndpointFactory<[], '', Logger>;
|
|
12
|
-
export interface RestApiConfig<TAuthorizers extends readonly string[] = readonly []> {
|
|
13
|
-
/**
|
|
14
|
-
* The app that serves this surface, relative to the workspace root —
|
|
15
|
-
* `'apps/api'`, or `'.'` in a single-app project.
|
|
16
|
-
*
|
|
17
|
-
* Required. It was inferred from the id (`apps/<kebab-id>`, or the root
|
|
18
|
-
* when no such directory existed), which meant a surface's home was
|
|
19
|
-
* whatever happened to be on disk. It is where the app's `package.json`
|
|
20
|
-
* and base `tsconfig.json` are, and which build serves this surface. It
|
|
21
|
-
* does not change discovery: constructs still load from the workspace's
|
|
22
|
-
* `constructs` glob.
|
|
23
|
-
*/
|
|
24
|
-
path: string;
|
|
25
|
-
/**
|
|
26
|
-
* The label it answers on under a stage's domain — `api` for
|
|
27
|
-
* `api.myapp.com`, from `domains` — and under the project locally,
|
|
28
|
-
* `api.myapp.localhost`. Absent, its id kebab-cased.
|
|
29
|
-
*/
|
|
30
|
-
subdomain?: string;
|
|
31
|
-
/**
|
|
32
|
-
* CORS tunables. The *origins* are never here — they are read off the
|
|
33
|
-
* constructs that declared an edge to this surface, which is the whole point
|
|
34
|
-
* of declaring one. These are the parts a graph cannot answer.
|
|
35
|
-
*/
|
|
36
|
-
cors?: {
|
|
37
|
-
maxAge?: number;
|
|
38
|
-
credentials?: boolean;
|
|
39
|
-
allowHeaders?: readonly string[];
|
|
40
|
-
exposeHeaders?: readonly string[];
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* The authorizer names this surface exposes. Names only — what verifies a
|
|
44
|
-
* request legitimately differs between local and deployed, so the mechanism
|
|
45
|
-
* belongs to the target and never to portable code.
|
|
46
|
-
*/
|
|
47
|
-
authorizers?: TAuthorizers;
|
|
48
|
-
/**
|
|
49
|
-
* The authorizer applied to an endpoint that names none.
|
|
50
|
-
*
|
|
51
|
-
* Required, and `'none'` is a valid answer that has to be typed out. The
|
|
52
|
-
* alternative is an API that ships open because a field was left off, which
|
|
53
|
-
* is the one default worth refusing to have.
|
|
54
|
-
*
|
|
55
|
-
* It was called `default`, which said what it was to the type and nothing
|
|
56
|
-
* to the reader: next to `authorizers: ['iam']`, a bare `default: 'none'`
|
|
57
|
-
* could be defaulting the runtime or the target. The manifest has always
|
|
58
|
-
* called it `defaultAuthorizer` and the factory `defaultAuthorizerName`;
|
|
59
|
-
* this is the same fact under the same name.
|
|
60
|
-
*
|
|
61
|
-
* Typed from `authorizers`, so it can only name one this surface exposes —
|
|
62
|
-
* plus a built-in scheme, and `'none'`. It was a bare `string`, which let
|
|
63
|
-
* `defaultAuthorizer: 'jwtt'` compile and every endpoint on the surface
|
|
64
|
-
* default to an authorizer that does not exist.
|
|
65
|
-
*/
|
|
66
|
-
defaultAuthorizer: TAuthorizers[number] | BuiltInSecuritySchemeId | 'none';
|
|
67
|
-
/**
|
|
68
|
-
* The logger every endpoint on this surface runs with.
|
|
69
|
-
*
|
|
70
|
-
* The actual logger, not a path to one. It used to be named in config as
|
|
71
|
-
* `logger: './config/logger'`, because the build wrote an import into each
|
|
72
|
-
* generated handler and a generator can print a specifier but not an object.
|
|
73
|
-
* Endpoints built from the surface carry it, so there is nothing to print
|
|
74
|
-
* and nothing to keep in step with a moved file.
|
|
75
|
-
*/
|
|
76
|
-
logger?: Logger;
|
|
77
|
-
/**
|
|
78
|
-
* The environment parser every endpoint on this surface runs with.
|
|
79
|
-
*
|
|
80
|
-
* Same reason as `logger`, and the same field it replaces —
|
|
81
|
-
* `envParser: './config/env#envParser'`, a module path with an export name
|
|
82
|
-
* appended, parsed by us, checked by nothing.
|
|
83
|
-
*/
|
|
84
|
-
envParser?: EnvironmentParser<{}>;
|
|
85
|
-
/**
|
|
86
|
-
* The Telescope instance this surface's entry mounts.
|
|
87
|
-
*
|
|
88
|
-
* The actual instance, for the reason `logger` is: it used to be named as
|
|
89
|
-
* `telescope: './config/telescope#telescope'`, a module path the build
|
|
90
|
-
* printed an import for. The entry already imports the surface.
|
|
91
|
-
*/
|
|
92
|
-
telescope?: Telescope;
|
|
93
|
-
/**
|
|
94
|
-
* What this surface's process emits — the `Telemetry` construct, passed
|
|
95
|
-
* like the logger: a fact about the process, not a grant to a route.
|
|
96
|
-
*
|
|
97
|
-
* An edge to the node, so the deploy hands this process the `OTEL_*` keys
|
|
98
|
-
* its stage resolves, and the build fails without the OpenTelemetry
|
|
99
|
-
* packages. Where the telemetry goes is never here: it is the deploy's,
|
|
100
|
-
* per stage.
|
|
101
|
-
*/
|
|
102
|
-
telemetry?: Telemetry;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* What is *not* here, and why.
|
|
106
|
-
*
|
|
107
|
-
* `dependsOn`, `database`, `auditor` and `.event(topic, …)` all inject a capability
|
|
108
|
-
* into a handler. Putting one on the surface hands it to every route the
|
|
109
|
-
* surface serves — a health check gets the database because a report needed it
|
|
110
|
-
* — which is the thing least privilege forbids and the reason `.calls()` is not
|
|
111
|
-
* spelled `dependsOn`. They belong to the endpoint, or to a branch —
|
|
112
|
-
* `api.database(db)` — for a group of endpoints that genuinely share them. A
|
|
113
|
-
* branch is a new factory; the surface config stays free of grants.
|
|
114
|
-
*
|
|
115
|
-
* `auth` is not here either: `.auth(construct)` already declares it, and a
|
|
116
|
-
* second way to say the same thing is the duplication this whole model removes.
|
|
117
|
-
*
|
|
118
|
-
* What is left is what the *process* is rather than what a route may reach.
|
|
119
|
-
*/
|
|
120
|
-
export declare class RestApi<TName extends string = string, const TAuthorizers extends readonly string[] = readonly []> implements Declarable<TName> {
|
|
121
|
-
#private;
|
|
122
|
-
private readonly config;
|
|
123
|
-
/** Internal: how `.calls()` carries edges into the copy it returns. */
|
|
124
|
-
private readonly dependencies;
|
|
125
|
-
/** Internal: how `.auth()` carries the authenticator into its copy. */
|
|
126
|
-
private readonly authenticator?;
|
|
127
|
-
readonly id: TName;
|
|
128
|
-
/**
|
|
129
|
-
* Declared once and read by both `declare()` and anything that consumes this
|
|
130
|
-
* surface, so what the target publishes and what a consumer reads cannot
|
|
131
|
-
* drift.
|
|
132
|
-
*/
|
|
133
|
-
readonly keys: {
|
|
134
|
-
url: string;
|
|
135
|
-
trustedOrigins: string;
|
|
136
|
-
cookieDomain: string;
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* The logger every endpoint on this surface runs with.
|
|
140
|
-
*
|
|
141
|
-
* Always defined — the surface's own if it was given one, the console
|
|
142
|
-
* logger otherwise — so nothing downstream has to decide what to do about a
|
|
143
|
-
* missing one. The generated entry reads it from here.
|
|
144
|
-
*/
|
|
145
|
-
readonly logger: Logger;
|
|
146
|
-
/**
|
|
147
|
-
* The environment parser every endpoint on this surface runs with.
|
|
148
|
-
*
|
|
149
|
-
* Always defined, and normally the default: `process.env` merged with the
|
|
150
|
-
* credentials `gkm dev`/`gkm exec` injected. That is what every
|
|
151
|
-
* application's own `config/env.ts` was — boilerplate identical in every
|
|
152
|
-
* project, and mandatory, which is a poor combination.
|
|
153
|
-
*/
|
|
154
|
-
readonly envParser: EnvironmentParser<{}>;
|
|
155
|
-
/** The Telescope instance, when this surface was given one. */
|
|
156
|
-
readonly telescope?: Telescope;
|
|
157
|
-
/** What this surface's process emits, when it was given a `Telemetry`. */
|
|
158
|
-
readonly telemetry?: Telemetry;
|
|
159
|
-
constructor(id: ConstructName<TName>, config: RestApiConfig<TAuthorizers>,
|
|
160
|
-
/** Internal: how `.calls()` carries edges into the copy it returns. */
|
|
161
|
-
dependencies?: readonly Dependency[],
|
|
162
|
-
/** Internal: how `.auth()` carries the authenticator into its copy. */
|
|
163
|
-
authenticator?: Authenticator | undefined);
|
|
164
|
-
/** `api.get('/users')` — one route on this surface. */
|
|
165
|
-
readonly get: Endpoints['get'];
|
|
166
|
-
readonly post: Endpoints['post'];
|
|
167
|
-
readonly put: Endpoints['put'];
|
|
168
|
-
readonly patch: Endpoints['patch'];
|
|
169
|
-
readonly delete: Endpoints['delete'];
|
|
170
|
-
readonly options: Endpoints['options'];
|
|
171
|
-
/**
|
|
172
|
-
* A branch for a *group* of endpoints that shares what a single route would
|
|
173
|
-
* otherwise repeat — a database, an auditor, a publisher, a session:
|
|
174
|
-
*
|
|
175
|
-
* ```ts
|
|
176
|
-
* export const router = api.database(database);
|
|
177
|
-
* export const createUser = router.post('/users').handle(({ db }) => …);
|
|
178
|
-
* ```
|
|
179
|
-
*
|
|
180
|
-
* Each returns a new factory and leaves the surface as it was. That is the
|
|
181
|
-
* whole difference from putting the same thing in the surface's config: a
|
|
182
|
-
* group opts in, where the surface would grant it to every route it serves —
|
|
183
|
-
* a health check handed the database because a profile endpoint needed it.
|
|
184
|
-
*
|
|
185
|
-
* `dependsOn` is deliberately not here. It is per endpoint, and on the
|
|
186
|
-
* surface it would read as the API depending on something, which is what
|
|
187
|
-
* `.calls()` and `.auth()` say instead.
|
|
188
|
-
*/
|
|
189
|
-
readonly database: Endpoints['database'];
|
|
190
|
-
readonly session: Endpoints['session'];
|
|
191
|
-
readonly auditor: Endpoints['auditor'];
|
|
192
|
-
readonly actor: Endpoints['actor'];
|
|
193
|
-
readonly authorizer: Endpoints['authorizer'];
|
|
194
|
-
readonly authorize: Endpoints['authorize'];
|
|
195
|
-
readonly rls: Endpoints['rls'];
|
|
196
|
-
readonly route: Endpoints['route'];
|
|
197
|
-
/**
|
|
198
|
-
* What authenticates this surface.
|
|
199
|
-
*
|
|
200
|
-
* An edge like `.calls()` — the auth server learns this origin, and the two
|
|
201
|
-
* share a cookie domain — but a named one, because *who authenticates me* is
|
|
202
|
-
* a different fact from *who I happen to call*, and only one of them decides
|
|
203
|
-
* what a request is allowed to be. A surface with two of the first is a
|
|
204
|
-
* mistake; two of the second is Tuesday.
|
|
205
|
-
*
|
|
206
|
-
* It declares the id, and keeps the construct: a session callback reads from
|
|
207
|
-
* it as `auth` — `session(async ({ auth }) => auth.getSession())` — which
|
|
208
|
-
* calls the construct's `verify(headers)`. That is the one thing every
|
|
209
|
-
* provider shares, whether the server is mounted in this process, deployed
|
|
210
|
-
* beside it, or an OIDC issuer somebody else runs.
|
|
211
|
-
*/
|
|
212
|
-
auth(construct: Authenticator): RestApi<TName, TAuthorizers>;
|
|
213
|
-
/**
|
|
214
|
-
* Other surfaces this one calls.
|
|
215
|
-
*
|
|
216
|
-
* **Not `.dependsOn()`, and the difference matters.** An endpoint's
|
|
217
|
-
* `.dependsOn()` injects a client into that handler and grants it exactly
|
|
218
|
-
* what it named. This grants nothing and injects nothing: it records that
|
|
219
|
-
* this API calls another surface, which is what puts this API's origin on
|
|
220
|
-
* that surface's trusted-origin list.
|
|
221
|
-
*
|
|
222
|
-
* Spelling it `dependsOn` would invite the thing least privilege forbids —
|
|
223
|
-
* every route on the surface receiving whatever the surface named.
|
|
224
|
-
*
|
|
225
|
-
* Immutable, like every other builder here.
|
|
226
|
-
*/
|
|
227
|
-
calls(constructs: readonly Declarable[]): RestApi<TName, TAuthorizers>;
|
|
228
|
-
/**
|
|
229
|
-
* One surface node, with its endpoints left to the build.
|
|
230
|
-
*
|
|
231
|
-
* The three provided keys are one fact about this surface and two about its
|
|
232
|
-
* callers. Declaring the caller-derived pair here rather than having the
|
|
233
|
-
* target invent them is what makes the contract checkable: a target that
|
|
234
|
-
* resolves no origins is caught against this list instead of being noticed
|
|
235
|
-
* when a browser is refused in production.
|
|
236
|
-
*/
|
|
237
|
-
declare(): Declaration[];
|
|
238
|
-
}
|
|
239
|
-
//#endregion
|
|
240
|
-
export type { Authenticator };
|
|
241
|
-
//# sourceMappingURL=rest-api.d.mts.map
|
package/dist/rest-api.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rest-api.d.mts","names":[],"sources":["../src/rest-api.ts"],"mappings":";;;;;;;;;;KAmDK,YAAY,wBAAwB;iBAExB,cAIhB;;;;;;;;;;;;EAaA;;;;;;EAMA;;;;;;EAMA;IACC;IACA;IACA;IACA;;;;;;;EAOD,cAAc;;;;;;;;;;;;;;;;;;;EAmBd,mBAAmB,uBAAuB;;;;;;;;;;EAU1C,SAAS;;;;;;;;EAQT,YAAY;;;;;;;;EAQZ,YAAY;;;;;;;;;;EAUZ,YAAY;;;;;;;;;;;;;;;;;;qBAoBA,QACZ,qCACM,iEACM,WAAW;;mBA0CL;;mBAEA;;mBAEA;WA5CT,IAAI;;;;;;WAOJ;IACR;IACA;IACA;;;;;;;;;WAUQ,QAAQ;;;;;;;;;WAUR,WAAW;;WAGX,YAAY;;WAGZ,YAAY;EAErB,YACC,IAAI,cAAc,QACD,QAAQ,cAAc,eAEtB;;EAAA,wBAAuB,cAEvB;;EAAA,gBAAgB;;WAyEzB,KAAK;WACL,MAAM;WACN,KAAK;WACL,OAAO;WACP,QAAQ;WACR,SAAS;;;;;;;;;;;;;;;;;;;WAoBT,UAAU;WACV,SAAS;WACT,SAAS;WACT,OAAO;WACP,YAAY;WACZ,WAAW;WACX,KAAK;WACL,OAAO;;;;;;;;;;;;;;;;EAiBhB,KAAK,WAAW,gBAAgB,QAAQ,OAAO;;;;;;;;;;;;;;;EAuB/C,MAAM,qBAAqB,eAAe,QAAQ,OAAO;;;;;;;;;;EAkBzD,WAAW"}
|