@geekmidas/constructs 10.0.0-alpha.6 → 10.0.0-alpha.60
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 +223 -158
- package/dist/{Construct-BD5neF7w.mjs → Construct-BO1X-kt9.mjs} +32 -33
- package/dist/Construct-BO1X-kt9.mjs.map +1 -0
- package/dist/Construct-BQALFCh2.d.cts +230 -0
- package/dist/Construct-BQALFCh2.d.cts.map +1 -0
- package/dist/{Construct-CyS3RpTL.cjs → Construct-DmvXceVY.cjs} +52 -47
- package/dist/Construct-DmvXceVY.cjs.map +1 -0
- package/dist/Construct-QXnl3VqT.d.mts +230 -0
- package/dist/Construct-QXnl3VqT.d.mts.map +1 -0
- package/dist/{Cron-DmQ8vQ4b.d.cts → Cron-DI3nKoic.d.cts} +15 -9
- package/dist/Cron-DI3nKoic.d.cts.map +1 -0
- package/dist/{Cron-dh4rUgib.d.mts → Cron-uYAHPnp7.d.mts} +15 -9
- package/dist/Cron-uYAHPnp7.d.mts.map +1 -0
- package/dist/{CronBuilder-Da0C0edR.cjs → CronBuilder-BoHzlWU_.cjs} +47 -31
- package/dist/CronBuilder-BoHzlWU_.cjs.map +1 -0
- package/dist/{CronBuilder-CYKT5RiO.mjs → CronBuilder-CCgt0wCE.mjs} +37 -21
- package/dist/CronBuilder-CCgt0wCE.mjs.map +1 -0
- package/dist/CronBuilder-DaSUm2Na.d.mts +47 -0
- package/dist/CronBuilder-DaSUm2Na.d.mts.map +1 -0
- package/dist/CronBuilder-g1lZLWyG.d.cts +47 -0
- package/dist/CronBuilder-g1lZLWyG.d.cts.map +1 -0
- package/dist/{Endpoint-BjWKinFA.d.mts → Endpoint-Bm9HjTPc.d.cts} +70 -93
- package/dist/Endpoint-Bm9HjTPc.d.cts.map +1 -0
- package/dist/{Endpoint-DCQPMdUX.mjs → Endpoint-CQ9RJ7p2.mjs} +130 -109
- package/dist/Endpoint-CQ9RJ7p2.mjs.map +1 -0
- package/dist/{Endpoint-DcWXE-SZ.cjs → Endpoint-DOi8c_Gy.cjs} +158 -131
- package/dist/Endpoint-DOi8c_Gy.cjs.map +1 -0
- package/dist/{Endpoint-dav89W6-.d.cts → Endpoint-KyMeR-B-.d.mts} +71 -94
- package/dist/Endpoint-KyMeR-B-.d.mts.map +1 -0
- package/dist/{index-Bd5FqCoe.d.cts → EndpointFactory-B6eZ3RDd.d.cts} +62 -132
- package/dist/EndpointFactory-B6eZ3RDd.d.cts.map +1 -0
- package/dist/{EndpointFactory-CdWB7wPw.cjs → EndpointFactory-Bo9lkMqB.cjs} +75 -110
- package/dist/EndpointFactory-Bo9lkMqB.cjs.map +1 -0
- package/dist/{EndpointFactory-CjV8F_lJ.mjs → EndpointFactory-DR1rebok.mjs} +39 -74
- package/dist/EndpointFactory-DR1rebok.mjs.map +1 -0
- package/dist/{index-lAO9egTb.d.mts → EndpointFactory-GYkAuG3u.d.mts} +63 -133
- package/dist/EndpointFactory-GYkAuG3u.d.mts.map +1 -0
- package/dist/Function-DuqGcbOI.d.mts +76 -0
- package/dist/Function-DuqGcbOI.d.mts.map +1 -0
- package/dist/Function-Pu-1kKZz.d.cts +76 -0
- package/dist/Function-Pu-1kKZz.d.cts.map +1 -0
- package/dist/{HonoEndpointAdaptor-DtL9j19R.cjs → HonoEndpointAdaptor-XyxwoFnE.cjs} +52 -54
- package/dist/HonoEndpointAdaptor-XyxwoFnE.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-P1ahhZHu.mjs → HonoEndpointAdaptor-ja49poBI.mjs} +42 -47
- package/dist/HonoEndpointAdaptor-ja49poBI.mjs.map +1 -0
- package/dist/Queue-D5jcw0mu.cjs +109 -0
- package/dist/Queue-D5jcw0mu.cjs.map +1 -0
- package/dist/{Queue-D7ZuwBhy.d.cts → Queue-DlsHRzUp.d.mts} +48 -48
- package/dist/Queue-DlsHRzUp.d.mts.map +1 -0
- package/dist/{Queue-gVGfi2Yk.d.mts → Queue-HPyi0e1i.d.cts} +49 -49
- package/dist/Queue-HPyi0e1i.d.cts.map +1 -0
- package/dist/Queue-hwPN-t31.mjs +104 -0
- package/dist/Queue-hwPN-t31.mjs.map +1 -0
- package/dist/QueueBuilder-BFQn3OzZ.cjs +135 -0
- package/dist/QueueBuilder-BFQn3OzZ.cjs.map +1 -0
- package/dist/QueueBuilder-DCuYdjMw.mjs +118 -0
- package/dist/QueueBuilder-DCuYdjMw.mjs.map +1 -0
- package/dist/QueueBuilder-OSi6LkV9.d.cts +75 -0
- package/dist/QueueBuilder-OSi6LkV9.d.cts.map +1 -0
- package/dist/QueueBuilder-QHsnVt1P.d.mts +75 -0
- package/dist/QueueBuilder-QHsnVt1P.d.mts.map +1 -0
- package/dist/{Subscriber-2mEi0ImH.d.cts → Subscriber-Bpp02cGr.d.cts} +29 -20
- package/dist/Subscriber-Bpp02cGr.d.cts.map +1 -0
- package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-CtN9R48-.d.mts} +29 -20
- package/dist/Subscriber-CtN9R48-.d.mts.map +1 -0
- package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-C2PwqwIl.cjs} +61 -36
- package/dist/SubscriberBuilder-C2PwqwIl.cjs.map +1 -0
- package/dist/SubscriberBuilder-CuCMFpYW.d.mts +67 -0
- package/dist/SubscriberBuilder-CuCMFpYW.d.mts.map +1 -0
- package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-DMFk_Ap1.mjs} +50 -24
- package/dist/SubscriberBuilder-DMFk_Ap1.mjs.map +1 -0
- package/dist/SubscriberBuilder-g3fAVWgs.d.cts +67 -0
- package/dist/SubscriberBuilder-g3fAVWgs.d.cts.map +1 -0
- package/dist/Topic-CkxOTrMv.cjs +104 -0
- package/dist/Topic-CkxOTrMv.cjs.map +1 -0
- package/dist/Topic-hPffOsot.mjs +99 -0
- package/dist/Topic-hPffOsot.mjs.map +1 -0
- package/dist/adaptors/aws.cjs +118 -216
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +34 -53
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +35 -54
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +91 -191
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +3 -10
- package/dist/adaptors/hono.d.cts +7 -16
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +8 -17
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +2 -10
- package/dist/adaptors/testing.cjs +711 -89
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +325 -54
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +325 -54
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +676 -70
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-CIFXNuDk.d.cts +194 -0
- package/dist/auth-CIFXNuDk.d.cts.map +1 -0
- package/dist/auth-CJ9Ff6Lu.d.mts +194 -0
- package/dist/auth-CJ9Ff6Lu.d.mts.map +1 -0
- package/dist/auth.cjs +172 -31
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +2 -108
- package/dist/auth.d.mts +2 -108
- package/dist/auth.mjs +161 -24
- package/dist/auth.mjs.map +1 -1
- package/dist/{cache-BrRz3fEB.d.mts → cache-CXh6GIgb.d.mts} +3 -6
- package/dist/cache-CXh6GIgb.d.mts.map +1 -0
- package/dist/{cache-BtZY_tHe.d.cts → cache-DnGDGly3.d.cts} +3 -6
- package/dist/cache-DnGDGly3.d.cts.map +1 -0
- package/dist/cache.cjs +68 -2
- package/dist/cache.cjs.map +1 -0
- package/dist/cache.d.cts +1 -2
- package/dist/cache.d.mts +1 -2
- package/dist/cache.mjs +67 -2
- package/dist/cache.mjs.map +1 -0
- package/dist/cipher-C1lEFX63.mjs +225 -0
- package/dist/cipher-C1lEFX63.mjs.map +1 -0
- package/dist/cipher-CVxfwLjk.cjs +332 -0
- package/dist/cipher-CVxfwLjk.cjs.map +1 -0
- package/dist/{clone-DblgEZZa.mjs → clone-EKNovYHu.mjs} +3 -3
- package/dist/clone-EKNovYHu.mjs.map +1 -0
- package/dist/{clone-Dy0cR2SZ.cjs → clone-UGJpvQnL.cjs} +7 -8
- package/dist/clone-UGJpvQnL.cjs.map +1 -0
- package/dist/{construct-interface-D9d4Gm4p.d.cts → construct-interface-B1AfqRl4.d.cts} +42 -11
- package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
- package/dist/{construct-interface-g5GM5pwR.d.mts → construct-interface-DluK3_da.d.mts} +42 -11
- package/dist/construct-interface-DluK3_da.d.mts.map +1 -0
- package/dist/construct-interface.cjs +113 -7
- package/dist/construct-interface.cjs.map +1 -0
- package/dist/construct-interface.d.cts +2 -2
- package/dist/construct-interface.d.mts +2 -2
- package/dist/construct-interface.mjs +106 -2
- package/dist/construct-interface.mjs.map +1 -0
- package/dist/credential.cjs +63 -16
- package/dist/credential.cjs.map +1 -1
- package/dist/credential.d.cts +16 -9
- package/dist/credential.d.cts.map +1 -1
- package/dist/credential.d.mts +16 -9
- package/dist/credential.d.mts.map +1 -1
- package/dist/credential.mjs +58 -12
- package/dist/credential.mjs.map +1 -1
- package/dist/crons/index.cjs +105 -7
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +40 -11
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +40 -11
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +103 -8
- package/dist/crons/index.mjs.map +1 -1
- package/dist/database/kysely.cjs +4 -181
- package/dist/database/kysely.d.cts +2 -152
- package/dist/database/kysely.d.mts +2 -152
- package/dist/database/kysely.mjs +2 -180
- package/dist/email.cjs +25 -12
- package/dist/email.cjs.map +1 -1
- package/dist/email.d.cts +3 -7
- package/dist/email.d.cts.map +1 -1
- package/dist/email.d.mts +3 -7
- package/dist/email.d.mts.map +1 -1
- package/dist/email.mjs +16 -3
- package/dist/email.mjs.map +1 -1
- package/dist/encryption.cjs +96 -0
- package/dist/encryption.cjs.map +1 -0
- package/dist/encryption.d.cts +117 -0
- package/dist/encryption.d.cts.map +1 -0
- package/dist/encryption.d.mts +117 -0
- package/dist/encryption.d.mts.map +1 -0
- package/dist/encryption.mjs +83 -0
- package/dist/encryption.mjs.map +1 -0
- package/dist/endpoints/index.cjs +8 -10
- package/dist/endpoints/index.d.cts +51 -7
- package/dist/endpoints/index.d.cts.map +1 -0
- package/dist/endpoints/index.d.mts +51 -7
- package/dist/endpoints/index.d.mts.map +1 -0
- package/dist/endpoints/index.mjs +6 -10
- package/dist/external-api-CWY9orcO.d.mts +86 -0
- package/dist/external-api-CWY9orcO.d.mts.map +1 -0
- package/dist/external-api-D-5WB-sr.d.cts +86 -0
- package/dist/external-api-D-5WB-sr.d.cts.map +1 -0
- package/dist/external-api.cjs +124 -0
- package/dist/external-api.cjs.map +1 -0
- package/dist/external-api.d.cts +2 -0
- package/dist/external-api.d.mts +2 -0
- package/dist/external-api.mjs +121 -0
- package/dist/external-api.mjs.map +1 -0
- package/dist/file-server.cjs +42 -10
- package/dist/file-server.cjs.map +1 -1
- package/dist/file-server.d.cts +6 -10
- package/dist/file-server.d.cts.map +1 -1
- package/dist/file-server.d.mts +6 -10
- package/dist/file-server.d.mts.map +1 -1
- package/dist/file-server.mjs +34 -2
- package/dist/file-server.mjs.map +1 -1
- package/dist/functions/index.cjs +3 -6
- package/dist/functions/index.d.cts +3 -4
- package/dist/functions/index.d.mts +3 -4
- package/dist/functions/index.mjs +2 -6
- package/dist/{functions-i_la-N5r.cjs → functions-CbP5ZKma.cjs} +414 -264
- package/dist/functions-CbP5ZKma.cjs.map +1 -0
- package/dist/{functions-14lpEFL4.mjs → functions-Di6n5ltG.mjs} +376 -238
- package/dist/{functions-14lpEFL4.mjs.map → functions-Di6n5ltG.mjs.map} +1 -1
- package/dist/index-BuzRvKOQ.d.cts +115 -0
- package/dist/index-BuzRvKOQ.d.cts.map +1 -0
- package/dist/index-CTkKOer4.d.mts +115 -0
- package/dist/index-CTkKOer4.d.mts.map +1 -0
- package/dist/index-CeEtxDmK.d.cts +79 -0
- package/dist/index-CeEtxDmK.d.cts.map +1 -0
- package/dist/index-CeEtxDmK.d.mts +79 -0
- package/dist/index-CeEtxDmK.d.mts.map +1 -0
- package/dist/index.cjs +6 -3
- package/dist/index.d.cts +26 -4
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +26 -4
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -3
- package/dist/kms-B-Hm3d5r.cjs +85 -0
- package/dist/kms-B-Hm3d5r.cjs.map +1 -0
- package/dist/kms-BdUlMJEZ.mjs +85 -0
- package/dist/kms-BdUlMJEZ.mjs.map +1 -0
- package/dist/kysely-BEm5sDlU.d.cts +173 -0
- package/dist/kysely-BEm5sDlU.d.cts.map +1 -0
- package/dist/kysely-BRzzawr2.cjs +301 -0
- package/dist/kysely-BRzzawr2.cjs.map +1 -0
- package/dist/kysely-BYfM6Zby.mjs +288 -0
- package/dist/kysely-BYfM6Zby.mjs.map +1 -0
- package/dist/kysely-CjuvdXEV.d.mts +173 -0
- package/dist/kysely-CjuvdXEV.d.mts.map +1 -0
- package/dist/{lazyAccessors-BoJN3SMd.mjs → lazyAccessors-CFanua0O.mjs} +20 -60
- package/dist/lazyAccessors-CFanua0O.mjs.map +1 -0
- package/dist/{lazyAccessors-e3j2oE2m.cjs → lazyAccessors-hJKGv8Ay.cjs} +60 -113
- package/dist/lazyAccessors-hJKGv8Ay.cjs.map +1 -0
- package/dist/mobile-app.cjs +73 -0
- package/dist/mobile-app.cjs.map +1 -0
- package/dist/mobile-app.d.cts +61 -0
- package/dist/mobile-app.d.cts.map +1 -0
- package/dist/mobile-app.d.mts +61 -0
- package/dist/mobile-app.d.mts.map +1 -0
- package/dist/mobile-app.mjs +72 -0
- package/dist/mobile-app.mjs.map +1 -0
- package/dist/object-storage.cjs +18 -10
- package/dist/object-storage.cjs.map +1 -1
- package/dist/object-storage.d.cts +3 -7
- package/dist/object-storage.d.cts.map +1 -1
- package/dist/object-storage.d.mts +3 -7
- package/dist/object-storage.d.mts.map +1 -1
- package/dist/object-storage.mjs +11 -3
- package/dist/object-storage.mjs.map +1 -1
- package/dist/{processAudits-Dmts9H_b.mjs → processAudits-BpRlPQMW.mjs} +16 -19
- package/dist/processAudits-BpRlPQMW.mjs.map +1 -0
- package/dist/{processAudits-CGqttuXm.cjs → processAudits-D_2W5x8k.cjs} +26 -30
- package/dist/processAudits-D_2W5x8k.cjs.map +1 -0
- package/dist/queue/index.cjs +6 -189
- package/dist/queue/index.d.cts +3 -60
- package/dist/queue/index.d.mts +3 -60
- package/dist/queue/index.mjs +3 -186
- package/dist/rest-api.cjs +88 -63
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +68 -61
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +68 -61
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +80 -55
- package/dist/rest-api.mjs.map +1 -1
- package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
- package/dist/runSubscriber-BRp9a_qi.cjs +126 -0
- package/dist/runSubscriber-BRp9a_qi.cjs.map +1 -0
- package/dist/runSubscriber-BYEY_bfA.mjs +109 -0
- package/dist/runSubscriber-BYEY_bfA.mjs.map +1 -0
- package/dist/shutdown-BMJmAhSt.cjs +38 -0
- package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
- package/dist/shutdown-C7xa8x9S.mjs +27 -0
- package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
- package/dist/site.cjs +34 -9
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +17 -22
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +17 -22
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +30 -5
- package/dist/site.mjs.map +1 -1
- package/dist/subscribers/index.cjs +111 -6
- package/dist/subscribers/index.cjs.map +1 -0
- package/dist/subscribers/index.d.cts +50 -6
- package/dist/subscribers/index.d.cts.map +1 -0
- package/dist/subscribers/index.d.mts +50 -6
- package/dist/subscribers/index.d.mts.map +1 -0
- package/dist/subscribers/index.mjs +108 -5
- package/dist/subscribers/index.mjs.map +1 -0
- package/dist/surfaceEnv-CNimK76p.cjs +56 -0
- package/dist/surfaceEnv-CNimK76p.cjs.map +1 -0
- package/dist/surfaceEnv-wMT5QzgZ.mjs +45 -0
- package/dist/surfaceEnv-wMT5QzgZ.mjs.map +1 -0
- package/dist/{telemetry-C3L0iS28.d.cts → telemetry-DGcFlVpB.d.cts} +2 -5
- package/dist/telemetry-DGcFlVpB.d.cts.map +1 -0
- package/dist/{telemetry-D7bVFLGi.d.mts → telemetry-DGcFlVpB.d.mts} +2 -5
- package/dist/telemetry-DGcFlVpB.d.mts.map +1 -0
- package/dist/topic/index.cjs +3 -137
- package/dist/topic/index.d.cts +2 -4
- package/dist/topic/index.d.mts +2 -4
- package/dist/topic/index.mjs +2 -134
- package/dist/{types-BlAkSuGI.d.cts → types-DMuSQeLL.d.cts} +3 -5
- package/dist/types-DMuSQeLL.d.cts.map +1 -0
- package/dist/{types-aKksMEWL.d.mts → types-DMuSQeLL.d.mts} +3 -5
- package/dist/types-DMuSQeLL.d.mts.map +1 -0
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.mjs +1 -0
- package/dist/worker.cjs +58 -34
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +63 -45
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +63 -44
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +53 -29
- package/dist/worker.mjs.map +1 -1
- package/package.json +82 -41
- package/dist/Construct-BD5neF7w.mjs.map +0 -1
- package/dist/Construct-C0ijr2qp.d.cts +0 -117
- package/dist/Construct-C0ijr2qp.d.cts.map +0 -1
- package/dist/Construct-Ct8nalEi.d.mts +0 -117
- package/dist/Construct-Ct8nalEi.d.mts.map +0 -1
- package/dist/Construct-CyS3RpTL.cjs.map +0 -1
- package/dist/Cron-DmQ8vQ4b.d.cts.map +0 -1
- package/dist/Cron-dh4rUgib.d.mts.map +0 -1
- package/dist/CronBuilder-BquXDbDI.d.cts +0 -44
- package/dist/CronBuilder-BquXDbDI.d.cts.map +0 -1
- package/dist/CronBuilder-CGgY2080.d.mts +0 -44
- package/dist/CronBuilder-CGgY2080.d.mts.map +0 -1
- package/dist/CronBuilder-CYKT5RiO.mjs.map +0 -1
- package/dist/CronBuilder-Da0C0edR.cjs.map +0 -1
- package/dist/Endpoint-BjWKinFA.d.mts.map +0 -1
- package/dist/Endpoint-DCQPMdUX.mjs.map +0 -1
- package/dist/Endpoint-DcWXE-SZ.cjs.map +0 -1
- package/dist/Endpoint-dav89W6-.d.cts.map +0 -1
- package/dist/EndpointFactory-CdWB7wPw.cjs.map +0 -1
- package/dist/EndpointFactory-CjV8F_lJ.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-DtL9j19R.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-P1ahhZHu.mjs.map +0 -1
- package/dist/Queue-D7ZuwBhy.d.cts.map +0 -1
- package/dist/Queue-gVGfi2Yk.d.mts.map +0 -1
- package/dist/Subscriber-2mEi0ImH.d.cts.map +0 -1
- package/dist/Subscriber-xTJ9ayPN.d.mts.map +0 -1
- package/dist/SubscriberBuilder-4OPehf2R.cjs.map +0 -1
- package/dist/SubscriberBuilder-BjkbeT9l.mjs.map +0 -1
- package/dist/SubscriberBuilder-Dptmo-1A.d.mts +0 -62
- package/dist/SubscriberBuilder-Dptmo-1A.d.mts.map +0 -1
- package/dist/SubscriberBuilder-waNhzjSM.d.cts +0 -62
- package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +0 -1
- package/dist/Topic-19QeHBIR.d.cts +0 -91
- package/dist/Topic-19QeHBIR.d.cts.map +0 -1
- package/dist/Topic-DuFeqkBh.d.mts +0 -91
- package/dist/Topic-DuFeqkBh.d.mts.map +0 -1
- package/dist/auth.d.cts.map +0 -1
- package/dist/auth.d.mts.map +0 -1
- package/dist/cache-0ANvRQnD.mjs +0 -51
- package/dist/cache-0ANvRQnD.mjs.map +0 -1
- package/dist/cache-3WSvAulx.cjs +0 -57
- package/dist/cache-3WSvAulx.cjs.map +0 -1
- package/dist/cache-BrRz3fEB.d.mts.map +0 -1
- package/dist/cache-BtZY_tHe.d.cts.map +0 -1
- package/dist/clone-DblgEZZa.mjs.map +0 -1
- package/dist/clone-Dy0cR2SZ.cjs.map +0 -1
- package/dist/construct-interface-BfjcOD_E.cjs +0 -117
- package/dist/construct-interface-BfjcOD_E.cjs.map +0 -1
- package/dist/construct-interface-D9d4Gm4p.d.cts.map +0 -1
- package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
- package/dist/construct-interface-Z4CpS8tK.mjs.map +0 -1
- package/dist/construct-interface-g5GM5pwR.d.mts.map +0 -1
- package/dist/database/kysely.cjs.map +0 -1
- package/dist/database/kysely.d.cts.map +0 -1
- package/dist/database/kysely.d.mts.map +0 -1
- package/dist/database/kysely.mjs.map +0 -1
- package/dist/functions-i_la-N5r.cjs.map +0 -1
- package/dist/index-Bd5FqCoe.d.cts.map +0 -1
- package/dist/index-BknhM6Ux.d.mts +0 -31
- package/dist/index-BknhM6Ux.d.mts.map +0 -1
- package/dist/index-CBSfrowv.d.cts +0 -31
- package/dist/index-CBSfrowv.d.cts.map +0 -1
- package/dist/index-D24Xm79M.d.cts +0 -171
- package/dist/index-D24Xm79M.d.cts.map +0 -1
- package/dist/index-_ajboYxK.d.mts +0 -171
- package/dist/index-_ajboYxK.d.mts.map +0 -1
- package/dist/index-lAO9egTb.d.mts.map +0 -1
- package/dist/lazyAccessors-BoJN3SMd.mjs.map +0 -1
- package/dist/lazyAccessors-e3j2oE2m.cjs.map +0 -1
- package/dist/processAudits-CGqttuXm.cjs.map +0 -1
- package/dist/processAudits-Dmts9H_b.mjs.map +0 -1
- package/dist/queue/index.cjs.map +0 -1
- package/dist/queue/index.d.cts.map +0 -1
- package/dist/queue/index.d.mts.map +0 -1
- package/dist/queue/index.mjs.map +0 -1
- package/dist/surfaceEnv-BFXEms2f.cjs +0 -39
- package/dist/surfaceEnv-BFXEms2f.cjs.map +0 -1
- package/dist/surfaceEnv-C3Ktahea.mjs +0 -27
- package/dist/surfaceEnv-C3Ktahea.mjs.map +0 -1
- package/dist/telemetry-C3L0iS28.d.cts.map +0 -1
- package/dist/telemetry-D7bVFLGi.d.mts.map +0 -1
- package/dist/topic/index.cjs.map +0 -1
- package/dist/topic/index.mjs.map +0 -1
- package/dist/types-BlAkSuGI.d.cts.map +0 -1
- package/dist/types-aKksMEWL.d.mts.map +0 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { n as Construct } from "./construct-interface-DluK3_da.mjs";
|
|
2
|
+
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
3
|
+
import { Service } from "@geekmidas/services";
|
|
4
|
+
//#region src/encryption/cipher.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The cipher behind an `Encryption` construct, and the format it writes.
|
|
7
|
+
*
|
|
8
|
+
* Every ciphertext names the key that wrote it — `gkm1.<keyId>.<payload>` — so
|
|
9
|
+
* `decrypt` never has to guess, a rotated key still opens what it wrote, and
|
|
10
|
+
* retiring a key is a decision made against data rather than a hope. The
|
|
11
|
+
* format version leads, so the day it has to change, both can be read.
|
|
12
|
+
*
|
|
13
|
+
* Two backends, picked by the scheme of the construct's URL, the way a queue's
|
|
14
|
+
* connection string picks its broker:
|
|
15
|
+
*
|
|
16
|
+
* - `aes256gcm://` — a keyring this process holds: AES-256-GCM with the newest
|
|
17
|
+
* key, HMAC-SHA256 for the blind index. Local, test and server stages.
|
|
18
|
+
* - `kms://` — envelope encryption under an AWS KMS key, and a KMS HMAC key for
|
|
19
|
+
* the index. The key material never leaves KMS. See `./kms`.
|
|
20
|
+
*/
|
|
21
|
+
/** What a handler is given: `services.pii.encrypt(…)` and the rest. */
|
|
22
|
+
interface Cipher {
|
|
23
|
+
/** Plaintext in, a self-describing ciphertext string out. */
|
|
24
|
+
encrypt(plaintext: string): Promise<string>;
|
|
25
|
+
/** Opens any ciphertext this construct wrote, under whichever key wrote it. */
|
|
26
|
+
decrypt(ciphertext: string): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* A blind index: the same value always gives the same string, so an
|
|
29
|
+
* encrypted column can still be looked up by an indexed column beside it.
|
|
30
|
+
*
|
|
31
|
+
* Deterministic on purpose, which is also why its key never rotates — a
|
|
32
|
+
* rotated index key would make every stored index miss.
|
|
33
|
+
*/
|
|
34
|
+
index(value: string): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* The same plaintext under the current key — what a sweep runs over a
|
|
37
|
+
* column before an old key is retired. Unchanged when it is already current.
|
|
38
|
+
*/
|
|
39
|
+
reencrypt(ciphertext: string): Promise<string>;
|
|
40
|
+
}
|
|
41
|
+
export declare class EncryptionUrlInvalid extends Error {
|
|
42
|
+
readonly construct: string;
|
|
43
|
+
readonly reason: string;
|
|
44
|
+
constructor(construct: string, reason: string);
|
|
45
|
+
}
|
|
46
|
+
export declare class UnknownEncryptionScheme extends Error {
|
|
47
|
+
readonly construct: string;
|
|
48
|
+
readonly scheme: string;
|
|
49
|
+
constructor(construct: string, scheme: string);
|
|
50
|
+
}
|
|
51
|
+
export declare class CiphertextMalformed extends Error {
|
|
52
|
+
readonly construct: string;
|
|
53
|
+
constructor(construct: string);
|
|
54
|
+
}
|
|
55
|
+
export declare class EncryptionKeyRetired extends Error {
|
|
56
|
+
readonly construct: string;
|
|
57
|
+
readonly keyId: string;
|
|
58
|
+
constructor(construct: string, keyId: string);
|
|
59
|
+
}
|
|
60
|
+
export declare class CiphertextNotAuthentic extends Error {
|
|
61
|
+
readonly construct: string;
|
|
62
|
+
constructor(construct: string);
|
|
63
|
+
}
|
|
64
|
+
export declare class CurrentKeyCannotRetire extends Error {
|
|
65
|
+
readonly construct: string;
|
|
66
|
+
readonly keyId: string;
|
|
67
|
+
constructor(construct: string, keyId: string);
|
|
68
|
+
}
|
|
69
|
+
/** A local keyring: newest key first, and the index key that never rotates. */
|
|
70
|
+
interface Keyring {
|
|
71
|
+
keys: {
|
|
72
|
+
id: string;
|
|
73
|
+
key: Buffer;
|
|
74
|
+
}[];
|
|
75
|
+
index: Buffer;
|
|
76
|
+
}
|
|
77
|
+
/** Parse `aes256gcm://local?keys=k2.<key>,k1.<key>&index=<key>`. */
|
|
78
|
+
export declare function parseKeyring(construct: string, url: string): Keyring;
|
|
79
|
+
export declare function formatKeyring(keyring: Keyring): string;
|
|
80
|
+
/** A keyring with one fresh key, `k1`, and a fresh index key. */
|
|
81
|
+
export declare function generateKeyring(): string;
|
|
82
|
+
/**
|
|
83
|
+
* The keyring with a new current key in front, and every older one kept.
|
|
84
|
+
*
|
|
85
|
+
* Nothing is dropped: what the old keys wrote still has to open until a sweep
|
|
86
|
+
* has re-encrypted it — see {@link retireKey}.
|
|
87
|
+
*/
|
|
88
|
+
export declare function rotateKeyring(construct: string, url: string): string;
|
|
89
|
+
/** The keyring without `keyId`, which must not be the current key. */
|
|
90
|
+
export declare function retireKey(construct: string, url: string, keyId: string): string;
|
|
91
|
+
/** Says, once per key per process, that a value is still under an old key. */
|
|
92
|
+
type StaleKeyReporter = (keyId: string, current: string) => void;
|
|
93
|
+
/** The `aes256gcm://` cipher: a keyring held in process. */
|
|
94
|
+
export declare function keyringCipher(construct: string, url: string, onStaleKey?: StaleKeyReporter): Cipher;
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/encryption.d.ts
|
|
97
|
+
export declare class Encryption<TName extends string = string> implements Construct<TName, Cipher> {
|
|
98
|
+
readonly id: TName;
|
|
99
|
+
readonly service: Service<Uncapitalize<TName>, Cipher>;
|
|
100
|
+
/**
|
|
101
|
+
* Declared once and read by both `declare()` and `connect()`, so the key the
|
|
102
|
+
* target publishes and the key the client reads cannot drift.
|
|
103
|
+
*/
|
|
104
|
+
private readonly key;
|
|
105
|
+
/**
|
|
106
|
+
* One cipher per process, held as the promise: a keyring is parsed once and
|
|
107
|
+
* a KMS client is built once, however many handlers register it at once.
|
|
108
|
+
*/
|
|
109
|
+
private cipher?;
|
|
110
|
+
constructor(id: ConstructName<TName>);
|
|
111
|
+
declare(): Declaration[];
|
|
112
|
+
private connect;
|
|
113
|
+
private open;
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export type { Cipher, Keyring };
|
|
117
|
+
//# sourceMappingURL=encryption.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.d.mts","names":[],"sources":["../src/encryption/cipher.ts","../src/encryption.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAyBiB;;EAEhB,QAAQ,oBAAoB;;EAE5B,QAAQ,qBAAqB;;;;;;;;EAQ7B,MAAM,gBAAgB;;;;;EAKtB,UAAU,qBAAqB;;qBAanB,6BAA6B;WAE/B;WACA;EAFV,YACU,mBACA;;qBASE,gCAAgC;WAElC;WACA;EAFV,YACU,mBACA;;qBASE,4BAA4B;WACnB;EAArB,YAAqB;;qBAQT,6BAA6B;WAE/B;WACA;EAFV,YACU,mBACA;;qBASE,+BAA+B;WACtB;EAArB,YAAqB;;qBAQT,+BAA+B;WAEjC;WACA;EAFV,YACU,mBACA;;;UAuEM;EAChB;IAAQ;IAAY,KAAK;;EACzB,OAAO;;;wBAIQ,aAAa,mBAAmB,cAAc;wBAqC9C,cAAc,SAAS;;wBAQvB;;;;;;;wBAaA,cAAc,mBAAmB;;wBAYjC,UACf,mBACA,aACA;;KAiBW,oBAAoB,eAAe;;wBAG/B,cACf,mBACA,aACA,aAAY,mBACV;;;qBC3NU,WAAW,0CACZ,UAAU,OAAO;WAEnB,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;;;;mBAM9B;;;;;UAMT;EAER,YAAY,IAAI,cAAc;EAa9B,WAAW;UAIH;UAKM"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { _ as rotateKeyring, a as EncryptionUrlInvalid, d as generateKeyring, f as keyringCipher, g as retireKey, h as parseKeyring, i as EncryptionKeyRetired, n as CiphertextNotAuthentic, r as CurrentKeyCannotRetire, s as UnknownEncryptionScheme, t as CiphertextMalformed, u as formatKeyring } from "./cipher-C1lEFX63.mjs";
|
|
2
|
+
import { KMS_SCHEME, canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
3
|
+
//#region src/encryption.ts
|
|
4
|
+
/**
|
|
5
|
+
* `Encryption` — a key that encrypts what the application stores.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* export const pii = new Encryption('Pii');
|
|
9
|
+
*
|
|
10
|
+
* // an endpoint that `.dependsOn([pii])`
|
|
11
|
+
* const email = await services.pii.encrypt(body.email);
|
|
12
|
+
* const emailIndex = await services.pii.index(body.email);
|
|
13
|
+
* await db.insertInto('users').values({ email, emailIndex }).execute();
|
|
14
|
+
*
|
|
15
|
+
* // and to find them again, without decrypting a column
|
|
16
|
+
* db.selectFrom('users').where('emailIndex', '=', await services.pii.index(q));
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* The app names no cipher and holds no key. The construct provides one URL,
|
|
20
|
+
* `<ID>_URL`, and its scheme picks the backend the way a queue's connection
|
|
21
|
+
* string picks its broker:
|
|
22
|
+
*
|
|
23
|
+
* - **AWS** — `kms://`: envelope encryption under a KMS key that rotates
|
|
24
|
+
* yearly, and a KMS HMAC key for the index. Only a function that depends on
|
|
25
|
+
* the construct is granted either key.
|
|
26
|
+
* - **Server, local, tests** — `aes256gcm://`: a keyring the process holds.
|
|
27
|
+
* Derived locally, so `gkm dev` and `gkm test` need nothing set; generated
|
|
28
|
+
* into a server stage's secrets on its first deploy, and rotated there with
|
|
29
|
+
* `gkm encryption:rotate`.
|
|
30
|
+
*
|
|
31
|
+
* Every ciphertext names the key that wrote it, so a rotated key still opens
|
|
32
|
+
* what it wrote. Retiring one is explicit — `reencrypt` the column, then
|
|
33
|
+
* `gkm encryption:retire` — and a value still under an old key says so when it
|
|
34
|
+
* is decrypted, once per key per process.
|
|
35
|
+
*/
|
|
36
|
+
var Encryption = class {
|
|
37
|
+
id;
|
|
38
|
+
service;
|
|
39
|
+
/**
|
|
40
|
+
* Declared once and read by both `declare()` and `connect()`, so the key the
|
|
41
|
+
* target publishes and the key the client reads cannot drift.
|
|
42
|
+
*/
|
|
43
|
+
key;
|
|
44
|
+
/**
|
|
45
|
+
* One cipher per process, held as the promise: a keyring is parsed once and
|
|
46
|
+
* a KMS client is built once, however many handlers register it at once.
|
|
47
|
+
*/
|
|
48
|
+
cipher;
|
|
49
|
+
constructor(id) {
|
|
50
|
+
const canonical = canonicalId(id);
|
|
51
|
+
this.id = canonical;
|
|
52
|
+
this.key = provideKey(canonical, "url");
|
|
53
|
+
this.service = {
|
|
54
|
+
serviceName: serviceKey(canonical),
|
|
55
|
+
register: (options) => this.connect(options)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
declare() {
|
|
59
|
+
return [{
|
|
60
|
+
kind: "encryption",
|
|
61
|
+
id: this.id,
|
|
62
|
+
provides: [this.key]
|
|
63
|
+
}];
|
|
64
|
+
}
|
|
65
|
+
connect(options) {
|
|
66
|
+
this.cipher ??= this.open(options);
|
|
67
|
+
return this.cipher;
|
|
68
|
+
}
|
|
69
|
+
async open(options) {
|
|
70
|
+
const { url } = options.envParser.create((get) => ({ url: get(this.key).string() })).parse();
|
|
71
|
+
const scheme = url.slice(0, url.indexOf(":") + 1);
|
|
72
|
+
if (scheme === "aes256gcm:") return keyringCipher(this.id, url, (stale, current) => console.warn(`${this.id} decrypted a value still under '${stale}' (current: '${current}'). reencrypt it, and retire '${stale}' once nothing is left under it.`));
|
|
73
|
+
if (scheme === KMS_SCHEME) {
|
|
74
|
+
const { kmsCipher } = await import("./kms-BdUlMJEZ.mjs");
|
|
75
|
+
return kmsCipher(this.id, url);
|
|
76
|
+
}
|
|
77
|
+
throw new UnknownEncryptionScheme(this.id, scheme);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
export { CiphertextMalformed, CiphertextNotAuthentic, CurrentKeyCannotRetire, Encryption, EncryptionKeyRetired, EncryptionUrlInvalid, UnknownEncryptionScheme, formatKeyring, generateKeyring, keyringCipher, parseKeyring, retireKey, rotateKeyring };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=encryption.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.mjs","names":[],"sources":["../src/encryption.ts"],"sourcesContent":["/**\n * `Encryption` — a key that encrypts what the application stores.\n *\n * ```ts\n * export const pii = new Encryption('Pii');\n *\n * // an endpoint that `.dependsOn([pii])`\n * const email = await services.pii.encrypt(body.email);\n * const emailIndex = await services.pii.index(body.email);\n * await db.insertInto('users').values({ email, emailIndex }).execute();\n *\n * // and to find them again, without decrypting a column\n * db.selectFrom('users').where('emailIndex', '=', await services.pii.index(q));\n * ```\n *\n * The app names no cipher and holds no key. The construct provides one URL,\n * `<ID>_URL`, and its scheme picks the backend the way a queue's connection\n * string picks its broker:\n *\n * - **AWS** — `kms://`: envelope encryption under a KMS key that rotates\n * yearly, and a KMS HMAC key for the index. Only a function that depends on\n * the construct is granted either key.\n * - **Server, local, tests** — `aes256gcm://`: a keyring the process holds.\n * Derived locally, so `gkm dev` and `gkm test` need nothing set; generated\n * into a server stage's secrets on its first deploy, and rotated there with\n * `gkm encryption:rotate`.\n *\n * Every ciphertext names the key that wrote it, so a rotated key still opens\n * what it wrote. Retiring one is explicit — `reencrypt` the column, then\n * `gkm encryption:retire` — and a value still under an old key says so when it\n * is decrypted, once per key per process.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tKMS_SCHEME,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\nimport {\n\ttype Cipher,\n\tkeyringCipher,\n\tLOCAL_SCHEME,\n\tUnknownEncryptionScheme,\n} from './encryption/cipher';\n\nexport type { Cipher } from './encryption/cipher';\nexport {\n\tCiphertextMalformed,\n\tCiphertextNotAuthentic,\n\tCurrentKeyCannotRetire,\n\tEncryptionKeyRetired,\n\tEncryptionUrlInvalid,\n\tformatKeyring,\n\tgenerateKeyring,\n\ttype Keyring,\n\tkeyringCipher,\n\tparseKeyring,\n\tretireKey,\n\trotateKeyring,\n\tUnknownEncryptionScheme,\n} from './encryption/cipher';\n\nexport class Encryption<TName extends string = string>\n\timplements Construct<TName, Cipher>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, Cipher>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * target publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly key: string;\n\n\t/**\n\t * One cipher per process, held as the promise: a keyring is parsed once and\n\t * a KMS client is built once, however many handlers register it at once.\n\t */\n\tprivate cipher?: Promise<Cipher>;\n\n\tconstructor(id: ConstructName<TName>) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.key = provideKey(canonical, 'url');\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [{ kind: 'encryption', id: this.id, provides: [this.key] }];\n\t}\n\n\tprivate connect(options: ServiceRegisterOptions): Promise<Cipher> {\n\t\tthis.cipher ??= this.open(options);\n\t\treturn this.cipher;\n\t}\n\n\tprivate async open(options: ServiceRegisterOptions): Promise<Cipher> {\n\t\tconst { url } = options.envParser\n\t\t\t.create((get) => ({ url: get(this.key).string() }))\n\t\t\t.parse();\n\t\tconst scheme = url.slice(0, url.indexOf(':') + 1);\n\n\t\tif (scheme === LOCAL_SCHEME) {\n\t\t\treturn keyringCipher(this.id, url, (stale, current) =>\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`${this.id} decrypted a value still under '${stale}' (current: '${current}'). reencrypt it, and retire '${stale}' once nothing is left under it.`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tif (scheme === KMS_SCHEME) {\n\t\t\t// Loaded only here, so a project that never deploys to AWS never\n\t\t\t// needs `@aws-sdk/client-kms` installed.\n\t\t\tconst { kmsCipher } = await import('./encryption/kms');\n\t\t\treturn kmsCipher(this.id, url);\n\t\t}\n\n\t\tthrow new UnknownEncryptionScheme(this.id, scheme);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,IAAa,aAAb,MAEA;CACC;CACA;;;;;CAMA;;;;;CAMA;CAEA,YAAY,IAA0B;EACrC,MAAM,YAAY,YAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,MAAM,WAAW,WAAW,KAAK;EAGtC,KAAK,UAAU;GACd,aAAa,WAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CAAC;GAAE,MAAM;GAAc,IAAI,KAAK;GAAI,UAAU,CAAC,KAAK,GAAG;EAAE,CAAC;CAClE;CAEA,QAAgB,SAAkD;EACjE,KAAK,WAAW,KAAK,KAAK,OAAO;EACjC,OAAO,KAAK;CACb;CAEA,MAAc,KAAK,SAAkD;EACpE,MAAM,EAAE,QAAQ,QAAQ,UACtB,QAAQ,SAAS,EAAE,KAAK,IAAI,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAClD,MAAM;EACR,MAAM,SAAS,IAAI,MAAM,GAAG,IAAI,QAAQ,GAAG,IAAI,CAAC;EAEhD,IAAI,WAAA,cACH,OAAO,cAAc,KAAK,IAAI,MAAM,OAAO,YAC1C,QAAQ,KACP,GAAG,KAAK,GAAG,kCAAkC,MAAM,eAAe,QAAQ,gCAAgC,MAAM,iCACjH,CACD;EAGD,IAAI,WAAW,YAAY;GAG1B,MAAM,EAAE,cAAc,MAAM,OAAO;GACnC,OAAO,UAAU,KAAK,IAAI,GAAG;EAC9B;EAEA,MAAM,IAAI,wBAAwB,KAAK,IAAI,MAAM;CAClD;AACD"}
|
package/dist/endpoints/index.cjs
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
require(
|
|
3
|
-
require(
|
|
4
|
-
const
|
|
5
|
-
require(
|
|
6
|
-
const
|
|
7
|
-
const require_surfaceEnv = require('../surfaceEnv-BFXEms2f.cjs');
|
|
8
|
-
const require_lazyAccessors = require('../lazyAccessors-e3j2oE2m.cjs');
|
|
9
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_EndpointFactory = require("../EndpointFactory-Bo9lkMqB.cjs");
|
|
3
|
+
const require_functions = require("../functions-CbP5ZKma.cjs");
|
|
4
|
+
const require_Endpoint = require("../Endpoint-DOi8c_Gy.cjs");
|
|
5
|
+
const require_surfaceEnv = require("../surfaceEnv-CNimK76p.cjs");
|
|
6
|
+
const require_lazyAccessors = require("../lazyAccessors-hJKGv8Ay.cjs");
|
|
10
7
|
exports.BUILT_IN_SECURITY_SCHEMES = require_EndpointFactory.BUILT_IN_SECURITY_SCHEMES;
|
|
11
8
|
exports.Endpoint = require_Endpoint.Endpoint;
|
|
12
9
|
exports.EndpointBuilder = require_EndpointFactory.EndpointBuilder;
|
|
13
10
|
exports.EndpointFactory = require_EndpointFactory.EndpointFactory;
|
|
11
|
+
exports.NoAuthenticator = require_Endpoint.NoAuthenticator;
|
|
14
12
|
exports.RLS_BYPASS = require_EndpointFactory.RLS_BYPASS;
|
|
15
13
|
exports.ResponseBuilder = require_Endpoint.ResponseBuilder;
|
|
16
14
|
exports.createApiGatewayCookies = require_lazyAccessors.createApiGatewayCookies;
|
|
@@ -24,4 +22,4 @@ exports.defaultEnvParser = require_surfaceEnv.defaultEnvParser;
|
|
|
24
22
|
exports.envParserFor = require_surfaceEnv.envParserFor;
|
|
25
23
|
exports.getSecurityScheme = require_EndpointFactory.getSecurityScheme;
|
|
26
24
|
exports.isBuiltInSecurityScheme = require_EndpointFactory.isBuiltInSecurityScheme;
|
|
27
|
-
exports.publishConstructEvents =
|
|
25
|
+
exports.publishConstructEvents = require_functions.publishConstructEvents;
|
|
@@ -1,7 +1,51 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { s as publishConstructEvents } from "../Construct-BQALFCh2.cjs";
|
|
2
|
+
import { A as getSecurityScheme, C as Authorizer, D as OAuthFlows, E as OAuthFlow, O as SecurityScheme, S as MappedAudit, T as BuiltInSecuritySchemeId, _ as RlsBypass, a as EndpointContext, b as RlsContextExtractor, c as EndpointSchemas, d as ResponseBuilder, g as RLS_BYPASS, h as SessionAuth, i as Endpoint, j as isBuiltInSecurityScheme, k as createAuthorizer, l as EndpointSurface, m as NoAuthenticator, n as ConvertRouteParams, o as EndpointHandler, r as CookieFn, s as EndpointOutput, u as HeaderFn, v as RlsConfig, w as BUILT_IN_SECURITY_SCHEMES, x as ActorExtractor, y as RlsContext } from "../Endpoint-Bm9HjTPc.cjs";
|
|
3
|
+
import { n as EndpointBuilder, t as EndpointFactory } from "../EndpointFactory-B6eZ3RDd.cjs";
|
|
4
|
+
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
5
|
+
import { Context } from "hono";
|
|
6
|
+
//#region src/endpoints/lazyAccessors.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Create a lazy header accessor for Hono.
|
|
9
|
+
* Uses `c.req.header(name)` for single lookups (native, case-insensitive).
|
|
10
|
+
* Only calls `c.req.header()` to get all headers when needed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createHonoHeaders(c: Context): HeaderFn;
|
|
13
|
+
/**
|
|
14
|
+
* Create a lazy cookie accessor for Hono.
|
|
15
|
+
* Uses `getCookie(c, name)` for single lookups (native).
|
|
16
|
+
* Only parses the cookie header when all cookies are requested.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createHonoCookies(c: Context): CookieFn;
|
|
19
|
+
/**
|
|
20
|
+
* Create a lazy header accessor for API Gateway events.
|
|
21
|
+
* Handles case-insensitive lookups.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createApiGatewayHeaders(headers: Record<string, string | undefined> | null | undefined): HeaderFn;
|
|
24
|
+
/**
|
|
25
|
+
* Create a lazy cookie accessor for API Gateway events.
|
|
26
|
+
* Decodes URL-encoded values to match browser behavior.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createApiGatewayCookies(cookies: string[] | undefined, cookieHeader: string | undefined): CookieFn;
|
|
29
|
+
/**
|
|
30
|
+
* Create a no-op header accessor (for minimal endpoints that don't use headers).
|
|
31
|
+
*/
|
|
32
|
+
export declare function createNoopHeaders(): HeaderFn;
|
|
33
|
+
/**
|
|
34
|
+
* Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
|
|
35
|
+
*/
|
|
36
|
+
export declare function createNoopCookies(): CookieFn;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/endpoints/surfaceEnv.d.ts
|
|
39
|
+
/**
|
|
40
|
+
* The default parser, built once.
|
|
41
|
+
*
|
|
42
|
+
* Once because `Credentials` resolves through `globalThis` and decryption is
|
|
43
|
+
* not free, and because two parsers over the same environment are two caches of
|
|
44
|
+
* the same answer.
|
|
45
|
+
*/
|
|
46
|
+
export declare function defaultEnvParser(): EnvironmentParser<{}>;
|
|
47
|
+
/** The parser for an endpoint, from its surface or the default. */
|
|
48
|
+
export declare function envParserFor(surface: EndpointSurface | undefined): EnvironmentParser<{}>;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { type ActorExtractor, type Authorizer, BUILT_IN_SECURITY_SCHEMES, type BuiltInSecuritySchemeId, type ConvertRouteParams, Endpoint, EndpointBuilder, type EndpointContext, EndpointFactory, type EndpointHandler, type EndpointOutput, type EndpointSchemas, type MappedAudit, NoAuthenticator, type OAuthFlow, type OAuthFlows, RLS_BYPASS, ResponseBuilder, type RlsBypass, type RlsConfig, type RlsContext, type RlsContextExtractor, type SecurityScheme, type SessionAuth, createAuthorizer, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
|
|
51
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/endpoints/lazyAccessors.ts","../../src/endpoints/surfaceEnv.ts"],"mappings":";;;;;;;;;;;wBAgBgB,kBAAkB,GAAG,UAAU;;;;;;wBAqB/B,kBAAkB,GAAG,UAAU;;;;;wBAgC/B,wBACf,SAAS,wDACP;;;;;wBAoCa,wBACf,+BACA,mCACE;;;;wBAmHa,qBAAqB;;;;wBAUrB,qBAAqB;;;;;;;;;;wBC1MrB,oBAAoB;;wBASpB,aACf,SAAS,8BACP"}
|
|
@@ -1,7 +1,51 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { s as publishConstructEvents } from "../Construct-QXnl3VqT.mjs";
|
|
2
|
+
import { A as getSecurityScheme, C as Authorizer, D as OAuthFlows, E as OAuthFlow, O as SecurityScheme, S as MappedAudit, T as BuiltInSecuritySchemeId, _ as RlsBypass, a as EndpointContext, b as RlsContextExtractor, c as EndpointSchemas, d as ResponseBuilder, g as RLS_BYPASS, h as SessionAuth, i as Endpoint, j as isBuiltInSecurityScheme, k as createAuthorizer, l as EndpointSurface, m as NoAuthenticator, n as ConvertRouteParams, o as EndpointHandler, r as CookieFn, s as EndpointOutput, u as HeaderFn, v as RlsConfig, w as BUILT_IN_SECURITY_SCHEMES, x as ActorExtractor, y as RlsContext } from "../Endpoint-KyMeR-B-.mjs";
|
|
3
|
+
import { n as EndpointBuilder, t as EndpointFactory } from "../EndpointFactory-GYkAuG3u.mjs";
|
|
4
|
+
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
5
|
+
import { Context } from "hono";
|
|
6
|
+
//#region src/endpoints/lazyAccessors.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Create a lazy header accessor for Hono.
|
|
9
|
+
* Uses `c.req.header(name)` for single lookups (native, case-insensitive).
|
|
10
|
+
* Only calls `c.req.header()` to get all headers when needed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createHonoHeaders(c: Context): HeaderFn;
|
|
13
|
+
/**
|
|
14
|
+
* Create a lazy cookie accessor for Hono.
|
|
15
|
+
* Uses `getCookie(c, name)` for single lookups (native).
|
|
16
|
+
* Only parses the cookie header when all cookies are requested.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createHonoCookies(c: Context): CookieFn;
|
|
19
|
+
/**
|
|
20
|
+
* Create a lazy header accessor for API Gateway events.
|
|
21
|
+
* Handles case-insensitive lookups.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createApiGatewayHeaders(headers: Record<string, string | undefined> | null | undefined): HeaderFn;
|
|
24
|
+
/**
|
|
25
|
+
* Create a lazy cookie accessor for API Gateway events.
|
|
26
|
+
* Decodes URL-encoded values to match browser behavior.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createApiGatewayCookies(cookies: string[] | undefined, cookieHeader: string | undefined): CookieFn;
|
|
29
|
+
/**
|
|
30
|
+
* Create a no-op header accessor (for minimal endpoints that don't use headers).
|
|
31
|
+
*/
|
|
32
|
+
export declare function createNoopHeaders(): HeaderFn;
|
|
33
|
+
/**
|
|
34
|
+
* Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
|
|
35
|
+
*/
|
|
36
|
+
export declare function createNoopCookies(): CookieFn;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/endpoints/surfaceEnv.d.ts
|
|
39
|
+
/**
|
|
40
|
+
* The default parser, built once.
|
|
41
|
+
*
|
|
42
|
+
* Once because `Credentials` resolves through `globalThis` and decryption is
|
|
43
|
+
* not free, and because two parsers over the same environment are two caches of
|
|
44
|
+
* the same answer.
|
|
45
|
+
*/
|
|
46
|
+
export declare function defaultEnvParser(): EnvironmentParser<{}>;
|
|
47
|
+
/** The parser for an endpoint, from its surface or the default. */
|
|
48
|
+
export declare function envParserFor(surface: EndpointSurface | undefined): EnvironmentParser<{}>;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { type ActorExtractor, type Authorizer, BUILT_IN_SECURITY_SCHEMES, type BuiltInSecuritySchemeId, type ConvertRouteParams, Endpoint, EndpointBuilder, type EndpointContext, EndpointFactory, type EndpointHandler, type EndpointOutput, type EndpointSchemas, type MappedAudit, NoAuthenticator, type OAuthFlow, type OAuthFlows, RLS_BYPASS, ResponseBuilder, type RlsBypass, type RlsConfig, type RlsContext, type RlsContextExtractor, type SecurityScheme, type SessionAuth, createAuthorizer, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
|
|
51
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/endpoints/lazyAccessors.ts","../../src/endpoints/surfaceEnv.ts"],"mappings":";;;;;;;;;;;wBAgBgB,kBAAkB,GAAG,UAAU;;;;;;wBAqB/B,kBAAkB,GAAG,UAAU;;;;;wBAgC/B,wBACf,SAAS,wDACP;;;;;wBAoCa,wBACf,+BACA,mCACE;;;;wBAmHa,qBAAqB;;;;wBAUrB,qBAAqB;;;;;;;;;;wBC1MrB,oBAAoB;;wBASpB,aACf,SAAS,8BACP"}
|
package/dist/endpoints/index.mjs
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
4
|
-
import {
|
|
5
|
-
import "../
|
|
6
|
-
|
|
7
|
-
import { defaultEnvParser, envParserFor } from "../surfaceEnv-C3Ktahea.mjs";
|
|
8
|
-
import { createApiGatewayCookies, createApiGatewayHeaders, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, publishConstructEvents } from "../lazyAccessors-BoJN3SMd.mjs";
|
|
9
|
-
|
|
10
|
-
export { BUILT_IN_SECURITY_SCHEMES, Endpoint, EndpointBuilder, EndpointFactory, RLS_BYPASS, ResponseBuilder, createApiGatewayCookies, createApiGatewayHeaders, createAuthorizer, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, defaultEnvParser, envParserFor, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
|
|
1
|
+
import { a as createAuthorizer, i as BUILT_IN_SECURITY_SCHEMES, n as EndpointBuilder, o as getSecurityScheme, r as RLS_BYPASS, s as isBuiltInSecurityScheme, t as EndpointFactory } from "../EndpointFactory-DR1rebok.mjs";
|
|
2
|
+
import { i as publishConstructEvents } from "../functions-Di6n5ltG.mjs";
|
|
3
|
+
import { n as ResponseBuilder, r as NoAuthenticator, t as Endpoint } from "../Endpoint-CQ9RJ7p2.mjs";
|
|
4
|
+
import { n as envParserFor, t as defaultEnvParser } from "../surfaceEnv-wMT5QzgZ.mjs";
|
|
5
|
+
import { a as createHonoHeaders, i as createHonoCookies, n as createApiGatewayHeaders, o as createNoopCookies, s as createNoopHeaders, t as createApiGatewayCookies } from "../lazyAccessors-CFanua0O.mjs";
|
|
6
|
+
export { BUILT_IN_SECURITY_SCHEMES, Endpoint, EndpointBuilder, EndpointFactory, NoAuthenticator, RLS_BYPASS, ResponseBuilder, createApiGatewayCookies, createApiGatewayHeaders, createAuthorizer, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, defaultEnvParser, envParserFor, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
|
|
2
|
+
import { r as Consumable } from "./construct-interface-DluK3_da.mjs";
|
|
3
|
+
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
4
|
+
import { Service } from "@geekmidas/services";
|
|
5
|
+
//#region src/external-api.d.ts
|
|
6
|
+
/** What a credentials schema yields. */
|
|
7
|
+
type Value<TSchema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<TSchema>;
|
|
8
|
+
interface ExternalApiOptions<TSchema extends StandardSchemaV1, TClient> {
|
|
9
|
+
/**
|
|
10
|
+
* Where it answers deployed: one URL for every stage, or one per stage
|
|
11
|
+
* name, with `default` for any stage not listed.
|
|
12
|
+
*/
|
|
13
|
+
url: string | Readonly<Record<string, string>>;
|
|
14
|
+
/** What the stage's `<ID>_CREDENTIALS` must look like. */
|
|
15
|
+
credentials: TSchema;
|
|
16
|
+
/** What a handler is handed, built from where it answers and the credentials. */
|
|
17
|
+
client: (connection: {
|
|
18
|
+
url: string;
|
|
19
|
+
credentials: Value<TSchema>;
|
|
20
|
+
}) => TClient | Promise<TClient>;
|
|
21
|
+
}
|
|
22
|
+
declare class ExternalApi<TName extends string = string, TSchema extends StandardSchemaV1 = StandardSchemaV1, TClient = unknown> implements Consumable<TName, TClient> {
|
|
23
|
+
private readonly options;
|
|
24
|
+
readonly id: TName;
|
|
25
|
+
readonly service: Service<Uncapitalize<TName>, TClient>;
|
|
26
|
+
/** Read by both `declare()` and `connect()`, so the two cannot drift. */
|
|
27
|
+
private readonly keys;
|
|
28
|
+
/** The promise, so concurrent registrations share one client. */
|
|
29
|
+
private connected?;
|
|
30
|
+
constructor(id: ConstructName<TName>, options: ExternalApiOptions<TSchema, TClient>);
|
|
31
|
+
declare(): Declaration[];
|
|
32
|
+
private connect;
|
|
33
|
+
}
|
|
34
|
+
/** Anything that answers a request — a Hono app, or a bare `{ fetch }`. */
|
|
35
|
+
interface FetchHandler {
|
|
36
|
+
fetch(request: Request): Response | Promise<Response>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Marks a fake. A registered symbol, so a fake built by a second copy of this
|
|
40
|
+
* package — a linked workspace, two versions in a lockfile — is still one.
|
|
41
|
+
*/
|
|
42
|
+
declare const FAKE: unique symbol;
|
|
43
|
+
/** What an external API's credentials look like going in, for a fake to supply. */
|
|
44
|
+
type CredentialsOf<TApi> = TApi extends ExternalApi<string, infer TSchema, unknown> ? StandardSchemaV1.InferInput<TSchema> : unknown;
|
|
45
|
+
/**
|
|
46
|
+
* An external API's stand-in, as `test/fakes/<id>.ts` default-exports it.
|
|
47
|
+
*
|
|
48
|
+
* `credentials` are what the fake accepts, and what a local or test stage is
|
|
49
|
+
* handed as `<ID>_CREDENTIALS` in place of the stage's own.
|
|
50
|
+
*/
|
|
51
|
+
type Fake = {
|
|
52
|
+
readonly [FAKE]: true;
|
|
53
|
+
readonly credentials: unknown;
|
|
54
|
+
} & ({
|
|
55
|
+
readonly kind: 'app';
|
|
56
|
+
/** Served by gkm: in-process in a test, on its own port in `gkm dev`. */
|
|
57
|
+
readonly handler: FetchHandler;
|
|
58
|
+
} | {
|
|
59
|
+
readonly kind: 'image';
|
|
60
|
+
/** The provider's own local server, run as a container. */
|
|
61
|
+
readonly image: string;
|
|
62
|
+
/** The port it listens on inside the container. */
|
|
63
|
+
readonly port: number;
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* Build the fake `test/fakes/<id>.ts` default-exports.
|
|
67
|
+
*
|
|
68
|
+
* Pass the API's type to have the credentials checked against its schema —
|
|
69
|
+
* `fake.app<typeof polar>(…)`.
|
|
70
|
+
*/
|
|
71
|
+
declare const fake: {
|
|
72
|
+
/** A working implementation of the API, kept beside the tests that use it. */
|
|
73
|
+
app<TApi = unknown>(handler: FetchHandler, options: {
|
|
74
|
+
credentials: CredentialsOf<TApi>;
|
|
75
|
+
}): Fake;
|
|
76
|
+
/** A local server the provider publishes — `stripe/stripe-mock`. */
|
|
77
|
+
image<TApi = unknown>(image: string, options: {
|
|
78
|
+
port: number;
|
|
79
|
+
credentials: CredentialsOf<TApi>;
|
|
80
|
+
}): Fake;
|
|
81
|
+
};
|
|
82
|
+
/** Whether a value is a fake — what gkm asks of a `test/fakes` default export. */
|
|
83
|
+
declare function isFake(value: unknown): value is Fake;
|
|
84
|
+
//#endregion
|
|
85
|
+
export { fake as a, FetchHandler as i, ExternalApiOptions as n, isFake as o, Fake as r, ExternalApi as t };
|
|
86
|
+
//# sourceMappingURL=external-api-CWY9orcO.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-api-CWY9orcO.d.mts","names":[],"sources":["../src/external-api.ts"],"mappings":";;;;;;KAmDK,MAAM,gBAAgB,oBAC1B,iBAAiB,YAAY;UAEb,mBAAmB,gBAAgB,kBAAkB;;;;;EAKrE,cAAc,SAAS;;EAEvB,aAAa;;EAEb,SAAS;IACR;IACA,aAAa,MAAM;QACd,UAAU,QAAQ;;cAGZ,YACZ,+BACA,gBAAgB,mBAAmB,kBACnC,8BACY,WAAW,OAAO;mBAeZ;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;mBAG9B;;UAGT;EAER,YACC,IAAI,cAAc,QACD,SAAS,mBAAmB,SAAS;EAoBvD,WAAW;UAWG;;;UAgBE;EAChB,MAAM,SAAS,UAAU,WAAW,QAAQ;;;;;;cAOvC;;KAGD,cAAc,QAClB,aAAa,0BAA0B,oBACpC,iBAAiB,WAAW;;;;;;;KASpB;YACD;WACD;;WAGE;;WAEA,SAAS;;WAGT;;WAEA;;WAEA;;;;;;;;cAUC;;EAEZ,IAAI,gBAAc,SACR,cAAY;IACV,aAAa,cAAc;MACpC;;EAUH,MAAM,gBAAc,eACN;IACF;IAAc,aAAa,cAAc;MAClD;;;iBAYY,OAAO,iBAAiB,SAAS"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
|
|
2
|
+
import { r as Consumable } from "./construct-interface-B1AfqRl4.cjs";
|
|
3
|
+
import { Service } from "@geekmidas/services";
|
|
4
|
+
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
5
|
+
//#region src/external-api.d.ts
|
|
6
|
+
/** What a credentials schema yields. */
|
|
7
|
+
type Value<TSchema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<TSchema>;
|
|
8
|
+
interface ExternalApiOptions<TSchema extends StandardSchemaV1, TClient> {
|
|
9
|
+
/**
|
|
10
|
+
* Where it answers deployed: one URL for every stage, or one per stage
|
|
11
|
+
* name, with `default` for any stage not listed.
|
|
12
|
+
*/
|
|
13
|
+
url: string | Readonly<Record<string, string>>;
|
|
14
|
+
/** What the stage's `<ID>_CREDENTIALS` must look like. */
|
|
15
|
+
credentials: TSchema;
|
|
16
|
+
/** What a handler is handed, built from where it answers and the credentials. */
|
|
17
|
+
client: (connection: {
|
|
18
|
+
url: string;
|
|
19
|
+
credentials: Value<TSchema>;
|
|
20
|
+
}) => TClient | Promise<TClient>;
|
|
21
|
+
}
|
|
22
|
+
declare class ExternalApi<TName extends string = string, TSchema extends StandardSchemaV1 = StandardSchemaV1, TClient = unknown> implements Consumable<TName, TClient> {
|
|
23
|
+
private readonly options;
|
|
24
|
+
readonly id: TName;
|
|
25
|
+
readonly service: Service<Uncapitalize<TName>, TClient>;
|
|
26
|
+
/** Read by both `declare()` and `connect()`, so the two cannot drift. */
|
|
27
|
+
private readonly keys;
|
|
28
|
+
/** The promise, so concurrent registrations share one client. */
|
|
29
|
+
private connected?;
|
|
30
|
+
constructor(id: ConstructName<TName>, options: ExternalApiOptions<TSchema, TClient>);
|
|
31
|
+
declare(): Declaration[];
|
|
32
|
+
private connect;
|
|
33
|
+
}
|
|
34
|
+
/** Anything that answers a request — a Hono app, or a bare `{ fetch }`. */
|
|
35
|
+
interface FetchHandler {
|
|
36
|
+
fetch(request: Request): Response | Promise<Response>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Marks a fake. A registered symbol, so a fake built by a second copy of this
|
|
40
|
+
* package — a linked workspace, two versions in a lockfile — is still one.
|
|
41
|
+
*/
|
|
42
|
+
declare const FAKE: unique symbol;
|
|
43
|
+
/** What an external API's credentials look like going in, for a fake to supply. */
|
|
44
|
+
type CredentialsOf<TApi> = TApi extends ExternalApi<string, infer TSchema, unknown> ? StandardSchemaV1.InferInput<TSchema> : unknown;
|
|
45
|
+
/**
|
|
46
|
+
* An external API's stand-in, as `test/fakes/<id>.ts` default-exports it.
|
|
47
|
+
*
|
|
48
|
+
* `credentials` are what the fake accepts, and what a local or test stage is
|
|
49
|
+
* handed as `<ID>_CREDENTIALS` in place of the stage's own.
|
|
50
|
+
*/
|
|
51
|
+
type Fake = {
|
|
52
|
+
readonly [FAKE]: true;
|
|
53
|
+
readonly credentials: unknown;
|
|
54
|
+
} & ({
|
|
55
|
+
readonly kind: 'app';
|
|
56
|
+
/** Served by gkm: in-process in a test, on its own port in `gkm dev`. */
|
|
57
|
+
readonly handler: FetchHandler;
|
|
58
|
+
} | {
|
|
59
|
+
readonly kind: 'image';
|
|
60
|
+
/** The provider's own local server, run as a container. */
|
|
61
|
+
readonly image: string;
|
|
62
|
+
/** The port it listens on inside the container. */
|
|
63
|
+
readonly port: number;
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* Build the fake `test/fakes/<id>.ts` default-exports.
|
|
67
|
+
*
|
|
68
|
+
* Pass the API's type to have the credentials checked against its schema —
|
|
69
|
+
* `fake.app<typeof polar>(…)`.
|
|
70
|
+
*/
|
|
71
|
+
declare const fake: {
|
|
72
|
+
/** A working implementation of the API, kept beside the tests that use it. */
|
|
73
|
+
app<TApi = unknown>(handler: FetchHandler, options: {
|
|
74
|
+
credentials: CredentialsOf<TApi>;
|
|
75
|
+
}): Fake;
|
|
76
|
+
/** A local server the provider publishes — `stripe/stripe-mock`. */
|
|
77
|
+
image<TApi = unknown>(image: string, options: {
|
|
78
|
+
port: number;
|
|
79
|
+
credentials: CredentialsOf<TApi>;
|
|
80
|
+
}): Fake;
|
|
81
|
+
};
|
|
82
|
+
/** Whether a value is a fake — what gkm asks of a `test/fakes` default export. */
|
|
83
|
+
declare function isFake(value: unknown): value is Fake;
|
|
84
|
+
//#endregion
|
|
85
|
+
export { fake as a, FetchHandler as i, ExternalApiOptions as n, isFake as o, Fake as r, ExternalApi as t };
|
|
86
|
+
//# sourceMappingURL=external-api-D-5WB-sr.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-api-D-5WB-sr.d.cts","names":[],"sources":["../src/external-api.ts"],"mappings":";;;;;;KAmDK,MAAM,gBAAgB,oBAC1B,iBAAiB,YAAY;UAEb,mBAAmB,gBAAgB,kBAAkB;;;;;EAKrE,cAAc,SAAS;;EAEvB,aAAa;;EAEb,SAAS;IACR;IACA,aAAa,MAAM;QACd,UAAU,QAAQ;;cAGZ,YACZ,+BACA,gBAAgB,mBAAmB,kBACnC,8BACY,WAAW,OAAO;mBAeZ;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;mBAG9B;;UAGT;EAER,YACC,IAAI,cAAc,QACD,SAAS,mBAAmB,SAAS;EAoBvD,WAAW;UAWG;;;UAgBE;EAChB,MAAM,SAAS,UAAU,WAAW,QAAQ;;;;;;cAOvC;;KAGD,cAAc,QAClB,aAAa,0BAA0B,oBACpC,iBAAiB,WAAW;;;;;;;KASpB;YACD;WACD;;WAGE;;WAEA,SAAS;;WAGT;;WAEA;;WAEA;;;;;;;;cAUC;;EAEZ,IAAI,gBAAc,SACR,cAAY;IACV,aAAa,cAAc;MACpC;;EAUH,MAAM,gBAAc,eACN;IACF;IAAc,aAAa,cAAc;MAClD;;;iBAYY,OAAO,iBAAiB,SAAS"}
|