@geekmidas/constructs 10.0.0-alpha.9 → 10.0.0-alpha.91
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 +222 -158
- package/dist/{Construct-BD5neF7w.mjs → Construct-B1vGBPme.mjs} +33 -34
- package/dist/Construct-B1vGBPme.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-DUSXuTHP.cjs} +53 -48
- package/dist/Construct-DUSXuTHP.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-C0Ek1-RA.cjs} +47 -31
- package/dist/CronBuilder-C0Ek1-RA.cjs.map +1 -0
- package/dist/CronBuilder-DaSUm2Na.d.mts +47 -0
- package/dist/CronBuilder-DaSUm2Na.d.mts.map +1 -0
- package/dist/{CronBuilder-CYKT5RiO.mjs → CronBuilder-Dmix_Pen.mjs} +37 -21
- package/dist/CronBuilder-Dmix_Pen.mjs.map +1 -0
- package/dist/CronBuilder-g1lZLWyG.d.cts +47 -0
- package/dist/CronBuilder-g1lZLWyG.d.cts.map +1 -0
- package/dist/{Endpoint-DCQPMdUX.mjs → Endpoint-BG4UJ9oA.mjs} +146 -109
- package/dist/Endpoint-BG4UJ9oA.mjs.map +1 -0
- package/dist/{Endpoint-DcWXE-SZ.cjs → Endpoint-BoUg8ocM.cjs} +174 -131
- package/dist/Endpoint-BoUg8ocM.cjs.map +1 -0
- package/dist/{Endpoint-BjWKinFA.d.mts → Endpoint-Du-NwPX2.d.mts} +83 -91
- package/dist/Endpoint-Du-NwPX2.d.mts.map +1 -0
- package/dist/{Endpoint-dav89W6-.d.cts → Endpoint-aCvBMPoH.d.cts} +82 -90
- package/dist/Endpoint-aCvBMPoH.d.cts.map +1 -0
- package/dist/{EndpointFactory-CjV8F_lJ.mjs → EndpointFactory-BDtsrEvJ.mjs} +57 -76
- package/dist/EndpointFactory-BDtsrEvJ.mjs.map +1 -0
- package/dist/{EndpointFactory-CdWB7wPw.cjs → EndpointFactory-DJ7gXLpR.cjs} +93 -112
- package/dist/EndpointFactory-DJ7gXLpR.cjs.map +1 -0
- package/dist/{index-Bd5FqCoe.d.cts → EndpointFactory-DMYdJCOj.d.mts} +78 -134
- package/dist/EndpointFactory-DMYdJCOj.d.mts.map +1 -0
- package/dist/{index-lAO9egTb.d.mts → EndpointFactory-I7s1co3Y.d.cts} +79 -135
- package/dist/EndpointFactory-I7s1co3Y.d.cts.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-P1ahhZHu.mjs → HonoEndpointAdaptor-PtPlbeKY.mjs} +75 -56
- package/dist/HonoEndpointAdaptor-PtPlbeKY.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-DtL9j19R.cjs → HonoEndpointAdaptor-zVzVLJEO.cjs} +83 -61
- package/dist/HonoEndpointAdaptor-zVzVLJEO.cjs.map +1 -0
- package/dist/Queue-A3wfD0it.cjs +109 -0
- package/dist/Queue-A3wfD0it.cjs.map +1 -0
- package/dist/Queue-D6USGS4q.mjs +104 -0
- package/dist/Queue-D6USGS4q.mjs.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/QueueBuilder-BjuF0UBl.cjs +135 -0
- package/dist/QueueBuilder-BjuF0UBl.cjs.map +1 -0
- package/dist/QueueBuilder-Cue73M4t.mjs +118 -0
- package/dist/QueueBuilder-Cue73M4t.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-BjkbeT9l.mjs → SubscriberBuilder-CDy4nHCz.mjs} +50 -24
- package/dist/SubscriberBuilder-CDy4nHCz.mjs.map +1 -0
- package/dist/SubscriberBuilder-CuCMFpYW.d.mts +67 -0
- package/dist/SubscriberBuilder-CuCMFpYW.d.mts.map +1 -0
- package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-D_owVoHo.cjs} +61 -36
- package/dist/SubscriberBuilder-D_owVoHo.cjs.map +1 -0
- package/dist/SubscriberBuilder-g3fAVWgs.d.cts +67 -0
- package/dist/SubscriberBuilder-g3fAVWgs.d.cts.map +1 -0
- package/dist/Topic-D74b5cgs.mjs +99 -0
- package/dist/Topic-D74b5cgs.mjs.map +1 -0
- package/dist/Topic-GHxcU8AG.cjs +104 -0
- package/dist/Topic-GHxcU8AG.cjs.map +1 -0
- package/dist/adaptors/aws.cjs +131 -220
- 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 +34 -53
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +102 -193
- 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 +743 -89
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +351 -54
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +351 -54
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +706 -70
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-BMCJN30Y.d.cts +268 -0
- package/dist/auth-BMCJN30Y.d.cts.map +1 -0
- package/dist/auth-CcuceLYo.d.mts +268 -0
- package/dist/auth-CcuceLYo.d.mts.map +1 -0
- package/dist/auth.cjs +301 -33
- 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 +289 -27
- 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 +77 -17
- package/dist/credential.cjs.map +1 -1
- package/dist/credential.d.cts +34 -9
- package/dist/credential.d.cts.map +1 -1
- package/dist/credential.d.mts +34 -9
- package/dist/credential.d.mts.map +1 -1
- package/dist/credential.mjs +71 -13
- package/dist/credential.mjs.map +1 -1
- package/dist/crons/index.cjs +129 -7
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +45 -11
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +45 -11
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +127 -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-MJ8id87V.d.mts +105 -0
- package/dist/external-api-MJ8id87V.d.mts.map +1 -0
- package/dist/external-api-O107yzZJ.d.cts +105 -0
- package/dist/external-api-O107yzZJ.d.cts.map +1 -0
- package/dist/external-api.cjs +142 -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 +139 -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-14lpEFL4.mjs → functions-BFizikJU.mjs} +376 -238
- package/dist/{functions-14lpEFL4.mjs.map → functions-BFizikJU.mjs.map} +1 -1
- package/dist/{functions-i_la-N5r.cjs → functions-CfzJG9hK.cjs} +414 -264
- package/dist/functions-CfzJG9hK.cjs.map +1 -0
- 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 +27 -4
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +27 -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-Bii4l6eP.mjs +370 -0
- package/dist/kysely-Bii4l6eP.mjs.map +1 -0
- package/dist/kysely-CO_Dk43W.cjs +383 -0
- package/dist/kysely-CO_Dk43W.cjs.map +1 -0
- package/dist/kysely-D0bpzgPs.d.cts +175 -0
- package/dist/kysely-D0bpzgPs.d.cts.map +1 -0
- package/dist/kysely-DUqC3Ie0.d.mts +175 -0
- package/dist/kysely-DUqC3Ie0.d.mts.map +1 -0
- package/dist/{telemetry-C3L0iS28.d.cts → lambdaTelemetry-8vnmVZQ5.d.cts} +3 -6
- package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +1 -0
- package/dist/{telemetry-D7bVFLGi.d.mts → lambdaTelemetry-8vnmVZQ5.d.mts} +3 -6
- package/dist/lambdaTelemetry-8vnmVZQ5.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-BRRVVHUB.mjs +131 -0
- package/dist/processAudits-BRRVVHUB.mjs.map +1 -0
- package/dist/processAudits-DasOZjPl.cjs +154 -0
- package/dist/processAudits-DasOZjPl.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 +90 -59
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +70 -42
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +70 -42
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +82 -51
- package/dist/rest-api.mjs.map +1 -1
- package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
- package/dist/runSubscriber-BHvJ8POr.mjs +109 -0
- package/dist/runSubscriber-BHvJ8POr.mjs.map +1 -0
- package/dist/runSubscriber-D8nLXIv1.cjs +126 -0
- package/dist/runSubscriber-D8nLXIv1.cjs.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 +33 -7
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +17 -7
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +17 -7
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +29 -3
- package/dist/site.mjs.map +1 -1
- package/dist/stages-BSCF19o2.d.cts +56 -0
- package/dist/stages-BSCF19o2.d.cts.map +1 -0
- package/dist/stages-BSCF19o2.d.mts +56 -0
- package/dist/stages-BSCF19o2.d.mts.map +1 -0
- package/dist/subscribers/index.cjs +118 -6
- package/dist/subscribers/index.cjs.map +1 -0
- package/dist/subscribers/index.d.cts +51 -6
- package/dist/subscribers/index.d.cts.map +1 -0
- package/dist/subscribers/index.d.mts +51 -6
- package/dist/subscribers/index.d.mts.map +1 -0
- package/dist/subscribers/index.mjs +115 -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-B48RLjyk.d.cts +40 -0
- package/dist/telemetry-B48RLjyk.d.cts.map +1 -0
- package/dist/telemetry-DRtT1_0A.d.mts +40 -0
- package/dist/telemetry-DRtT1_0A.d.mts.map +1 -0
- package/dist/telemetry.cjs +56 -0
- package/dist/telemetry.cjs.map +1 -0
- package/dist/telemetry.d.cts +2 -0
- package/dist/telemetry.d.mts +2 -0
- package/dist/telemetry.mjs +55 -0
- package/dist/telemetry.mjs.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/tracing-CxaZ98IB.mjs +110 -0
- package/dist/tracing-CxaZ98IB.mjs.map +1 -0
- package/dist/tracing-DPMidF_r.cjs +127 -0
- package/dist/tracing-DPMidF_r.cjs.map +1 -0
- 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 +59 -34
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +70 -45
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +70 -44
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +54 -29
- package/dist/worker.mjs.map +1 -1
- package/package.json +96 -42
- 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 +0 -92
- package/dist/processAudits-CGqttuXm.cjs.map +0 -1
- package/dist/processAudits-Dmts9H_b.mjs +0 -80
- 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,115 @@
|
|
|
1
|
+
import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
|
|
2
|
+
import { a as EventFor, c as Topic, n as ConstructType, o as TopicEvent } from "./Construct-QXnl3VqT.mjs";
|
|
3
|
+
import { i as FunctionHandler, n as Function } from "./Function-DuqGcbOI.mjs";
|
|
4
|
+
import { c as ServicesOf, r as Consumable } from "./construct-interface-DluK3_da.mjs";
|
|
5
|
+
import { Service } from "@geekmidas/services";
|
|
6
|
+
import { AuditStorage, AuditableAction } from "@geekmidas/audit";
|
|
7
|
+
import { Logger } from "@geekmidas/logger";
|
|
8
|
+
import { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema } from "@geekmidas/schema";
|
|
9
|
+
//#region src/functions/BaseFunctionBuilder.d.ts
|
|
10
|
+
declare abstract class BaseFunctionBuilder<TInput extends ComposableStandardSchema, OutSchema extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TAuditStorage extends AuditStorage | undefined = undefined, TAuditStorageServiceName extends string = string, TDatabase = undefined, TDatabaseServiceName extends string = string> {
|
|
11
|
+
type: ConstructType;
|
|
12
|
+
protected inputSchema?: TInput;
|
|
13
|
+
protected outputSchema?: OutSchema;
|
|
14
|
+
protected _timeout?: number;
|
|
15
|
+
_services: TServices;
|
|
16
|
+
/**
|
|
17
|
+
* The construct ids `.dependsOn()` was given.
|
|
18
|
+
*
|
|
19
|
+
* Beside the services rather than instead of them: a handler *runs* with
|
|
20
|
+
* clients and the manifest *records* which constructs it reaches, and
|
|
21
|
+
* dissolving one into the other is what lost the edges. Shared by every
|
|
22
|
+
* builder because every one of them can depend on something.
|
|
23
|
+
*/
|
|
24
|
+
_constructs: string[];
|
|
25
|
+
_logger: TLogger;
|
|
26
|
+
/**
|
|
27
|
+
* The deploy unit everything built from this builder belongs to.
|
|
28
|
+
*
|
|
29
|
+
* Seeded by the factory a `Worker` or `RestApi` hands out, so a cron knows
|
|
30
|
+
* which process runs it without a directory having to imply it.
|
|
31
|
+
*/
|
|
32
|
+
_owner?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Where a cron built from this factory keeps its schedule.
|
|
35
|
+
*
|
|
36
|
+
* Set by the worker that handed the factory out, the same way the logger
|
|
37
|
+
* and the owner are — so a cron file names a schedule and nothing else.
|
|
38
|
+
* Only a server target reads it; on AWS the schedule is an EventBridge rule.
|
|
39
|
+
*/
|
|
40
|
+
_scheduleStore?: unknown;
|
|
41
|
+
/** What the built construct publishes, each event bound to its topic. */
|
|
42
|
+
_events: TopicEvent[];
|
|
43
|
+
protected _auditorStorage?: Service<TAuditStorageServiceName, TAuditStorage>;
|
|
44
|
+
protected _databaseService?: Service<TDatabaseServiceName, TDatabase>;
|
|
45
|
+
/** The edge `.database()` added, so the next one can replace it. */
|
|
46
|
+
protected _databaseEdge?: string;
|
|
47
|
+
static isStandardSchemaV1(s: unknown): s is StandardSchemaV1;
|
|
48
|
+
static parseComposableStandardSchema<T extends ComposableStandardSchema | undefined>(data: unknown, schema: T): Promise<InferComposableStandardSchema<T>>;
|
|
49
|
+
constructor(type?: ConstructType);
|
|
50
|
+
abstract services<T extends Service[]>(services: T): any;
|
|
51
|
+
abstract logger<T extends Logger>(logger: T): any;
|
|
52
|
+
timeout(timeout: number): this;
|
|
53
|
+
abstract output<T extends StandardSchemaV1>(schema: T): any;
|
|
54
|
+
abstract input<T extends ComposableStandardSchema>(schema: T): any;
|
|
55
|
+
/**
|
|
56
|
+
* A clone that publishes `event` to `topic` once the handler succeeds, and
|
|
57
|
+
* has the topic as a dependency the way `.dependsOn([topic])` would: in
|
|
58
|
+
* `services`, and an edge in the manifest. Each builder types it as its own
|
|
59
|
+
* `event()`, since only it knows how its services widen.
|
|
60
|
+
*/
|
|
61
|
+
protected withEvent(topic: Topic<any, any>, event: EventFor<Topic<any, any>, any>): this;
|
|
62
|
+
auditor<T extends AuditStorage, TName extends string>(storage: Service<TName, T>): BaseFunctionBuilder<TInput, OutSchema, TServices, TLogger, T, TName, TDatabase, TDatabaseServiceName>;
|
|
63
|
+
/**
|
|
64
|
+
* Set the database service for this function.
|
|
65
|
+
* The database will be available in the handler context as `db`.
|
|
66
|
+
*/
|
|
67
|
+
database<T, TName extends string>(source: Consumable<TName, T> | Service<TName, T>): BaseFunctionBuilder<TInput, OutSchema, TServices, TLogger, TAuditStorage, TAuditStorageServiceName, T, TName>;
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/functions/FunctionBuilder.d.ts
|
|
71
|
+
declare class FunctionBuilder<TInput extends ComposableStandardSchema, OutSchema extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TAuditStorage extends AuditStorage | undefined = undefined, TAuditStorageServiceName extends string = string, TDatabase = undefined, TDatabaseServiceName extends string = string, TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>> extends BaseFunctionBuilder<TInput, OutSchema, TServices, TLogger, TAuditStorage, TAuditStorageServiceName, TDatabase, TDatabaseServiceName> {
|
|
72
|
+
type: ConstructType;
|
|
73
|
+
protected _memorySize?: number;
|
|
74
|
+
constructor(type?: ConstructType);
|
|
75
|
+
timeout(timeout: number): this;
|
|
76
|
+
memorySize(memorySize: number): this;
|
|
77
|
+
output<T extends StandardSchemaV1>(schema: T): FunctionBuilder<TInput, T, TServices, TLogger, TAuditStorage, TAuditStorageServiceName, TDatabase, TDatabaseServiceName, TAuditAction>;
|
|
78
|
+
input<T extends ComposableStandardSchema>(schema: T): FunctionBuilder<T, OutSchema, TServices, TLogger, TAuditStorage, TAuditStorageServiceName, TDatabase, TDatabaseServiceName, TAuditAction>;
|
|
79
|
+
/**
|
|
80
|
+
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
81
|
+
* topic.
|
|
82
|
+
*
|
|
83
|
+
* It records the edge and dissolves each construct's client into the
|
|
84
|
+
* handler's service record under the construct's own id, so
|
|
85
|
+
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
86
|
+
*
|
|
87
|
+
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
88
|
+
* env sniffing confined to `.services()` and the explicit lift.
|
|
89
|
+
*/
|
|
90
|
+
dependsOn<const T extends readonly Consumable[]>(constructs: T): FunctionBuilder<TInput, OutSchema, [...TServices, ...ServicesOf<T>], TLogger, TAuditStorage, TAuditStorageServiceName, TDatabase, TDatabaseServiceName, TAuditAction>;
|
|
91
|
+
services<T extends Service[]>(services: T): FunctionBuilder<TInput, OutSchema, [...TServices, ...T], TLogger, TAuditStorage, TAuditStorageServiceName, TDatabase, TDatabaseServiceName, TAuditAction>;
|
|
92
|
+
logger<T extends Logger>(logger: T): FunctionBuilder<TInput, OutSchema, TServices, T, TAuditStorage, TAuditStorageServiceName, TDatabase, TDatabaseServiceName, TAuditAction>;
|
|
93
|
+
/**
|
|
94
|
+
* Publish `event` to `topic` once the function has succeeded — repeatable,
|
|
95
|
+
* one call per event, to as many topics as it names. The topic becomes a
|
|
96
|
+
* dependency as with `.dependsOn([topic])`, so `services.<topic>` is there
|
|
97
|
+
* for events the handler decides on itself.
|
|
98
|
+
*/
|
|
99
|
+
event<TTopic extends Topic<any, any>>(topic: TTopic, event: EventFor<TTopic, InferStandardSchema<OutSchema>>): FunctionBuilder<TInput, OutSchema, [...TServices, TTopic['service']], TLogger, TAuditStorage, TAuditStorageServiceName, TDatabase, TDatabaseServiceName, TAuditAction>;
|
|
100
|
+
auditor<T extends AuditStorage, TName extends string>(storage: Service<TName, T>): FunctionBuilder<TInput, OutSchema, TServices, TLogger, T, TName, TDatabase, TDatabaseServiceName, TAuditAction>;
|
|
101
|
+
/**
|
|
102
|
+
* Set the audit action types for this function.
|
|
103
|
+
* This provides type-safety for the auditor in the handler context.
|
|
104
|
+
*/
|
|
105
|
+
actions<T extends AuditableAction<string, unknown>>(): FunctionBuilder<TInput, OutSchema, TServices, TLogger, TAuditStorage, TAuditStorageServiceName, TDatabase, TDatabaseServiceName, T>;
|
|
106
|
+
/**
|
|
107
|
+
* Set the database service for this function.
|
|
108
|
+
* The database will be available in the handler context as `db`.
|
|
109
|
+
*/
|
|
110
|
+
database<T, TName extends string>(source: Consumable<TName, T> | Service<TName, T>): FunctionBuilder<TInput, OutSchema, TServices, TLogger, TAuditStorage, TAuditStorageServiceName, T, TName, TAuditAction>;
|
|
111
|
+
handle(fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase, TAuditStorage, TAuditAction>): Function<TInput, TServices, TLogger, OutSchema, TAuditStorage, TAuditStorageServiceName, TDatabase, TDatabaseServiceName, TAuditAction, FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase, TAuditStorage, TAuditAction>>;
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { BaseFunctionBuilder as n, FunctionBuilder as t };
|
|
115
|
+
//# sourceMappingURL=index-CTkKOer4.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CTkKOer4.d.mts","names":[],"sources":["../src/functions/BaseFunctionBuilder.ts","../src/functions/FunctionBuilder.ts"],"mappings":";;;;;;;;;uBAsBsB,oBACrB,eAAe,0BACf,kBAAkB,0CAClB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,sBAAsB,sCACtB,kDACA,uBACA;EAoFmB,MAAI;YAlFb,cAAc;YACd,eAAe;YACf;EAEH,WAAW;;;;;;;;;EASX;EACA,SAAS;;;;;;;EAQT;;;;;;;;EASA;;EAGA,SAAS;YACN,kBAAkB,QAAQ,0BAA0B;YACpD,mBAAmB,QAAQ,sBAAsB;;YAEjD;SAEH,mBAAmB,aAAa,KAAK;SAM/B,8BACZ,UAAU,sCACT,eAAe,QAAQ,IAAI,QAAQ,8BAA8B;EAkCnE,YAAmB,OAAI;WAEd,SAAS,UAAU,WAAW,UAAU;WAExC,OAAO,UAAU,QAAQ,QAAQ;EAE1C,QAAQ;WAIC,OAAO,UAAU,kBAAkB,QAAQ;WAE3C,MAAM,UAAU,0BAA0B,QAAQ;;;;;;;YAQjD,UACT,OAAO,iBACP,OAAO,SAAS;EAcjB,QAAQ,UAAU,cAAc,sBAC/B,SAAS,QAAQ,OAAO,KACtB,oBACF,QACA,WACA,WACA,SACA,GACA,OACA,WACA;;;;;EAuBD,SAAS,GAAG,sBACX,QAAQ,WAAW,OAAO,KAAK,QAAQ,OAAO,KAC5C,oBACF,QACA,WACA,WACA,SACA,eACA,0BACA,GACA;;;;cCzKW,gBACZ,eAAe,0BACf,kBAAkB,0CAClB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,sBAAsB,sCACtB,kDACA,uBACA,8CACA,qBAAqB,mCAAmC,0CAI/C,oBACT,QACA,WACA,WACA,SACA,eACA,0BACA,WACA;EAI4B,MAAI;YAFtB;EAEV,YAA4B,OAAI;EAIvB,QAAQ;EAIjB,WAAW;EAIX,OAAO,UAAU,kBAChB,QAAQ,IACN,gBACF,QACA,GACA,WACA,SACA,eACA,0BACA,WACA,sBACA;EAiBD,MAAM,UAAU,0BACf,QAAQ,IACN,gBACF,GACA,WACA,WACA,SACA,eACA,0BACA,WACA,sBACA;;;;;;;;;;;;EA4BD,gBAAgB,mBAAmB,cAClC,YAAY,IACV,gBACF,QACA,eACI,cAAc,WAAW,KAC7B,SACA,eACA,0BACA,WACA,sBACA;EA8BD,SAAS,UAAU,WAClB,UAAU,IACR,gBACF,QACA,eACI,cAAc,IAClB,SACA,eACA,0BACA,WACA,sBACA;EAoBD,OAAO,UAAU,QAChB,QAAQ,IACN,gBACF,QACA,WACA,WACA,GACA,eACA,0BACA,WACA,sBACA;;;;;;;EAuBD,MAAM,eAAe,iBACpB,OAAO,QACP,OAAO,SAAS,QAAQ,oBAAoB,cAC1C,gBACF,QACA,eACI,WAAW,oBACf,SACA,eACA,0BACA,WACA,sBACA;EAeQ,QAAQ,UAAU,cAAc,sBACxC,SAAS,QAAQ,OAAO,KACtB,gBACF,QACA,WACA,WACA,SACA,GACA,OACA,WACA,sBACA;;;;;EAwBD,QAAQ,UAAU,qCAAqC,gBACtD,QACA,WACA,WACA,SACA,eACA,0BACA,WACA,sBACA;;;;;EAmBQ,SAAS,GAAG,sBACpB,QAAQ,WAAW,OAAO,KAAK,QAAQ,OAAO,KAC5C,gBACF,QACA,WACA,WACA,SACA,eACA,0BACA,GACA,OACA;EAkCD,OACC,IAAI,gBACH,QACA,WACA,SACA,WACA,WACA,eACA,gBAEC,SACF,QACA,WACA,SACA,WACA,eACA,0BACA,WACA,sBACA,cACA,gBACC,QACA,WACA,SACA,WACA,WACA,eACA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
2
|
+
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
3
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
4
|
+
/** The Standard properties. */
|
|
5
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
6
|
+
}
|
|
7
|
+
declare namespace StandardTypedV1 {
|
|
8
|
+
/** The Standard Typed properties interface. */
|
|
9
|
+
interface Props<Input = unknown, Output = Input> {
|
|
10
|
+
/** The version number of the standard. */
|
|
11
|
+
readonly version: 1;
|
|
12
|
+
/** The vendor name of the schema library. */
|
|
13
|
+
readonly vendor: string;
|
|
14
|
+
/** Inferred types associated with the schema. */
|
|
15
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** The Standard Typed types interface. */
|
|
18
|
+
interface Types<Input = unknown, Output = Input> {
|
|
19
|
+
/** The input type of the schema. */
|
|
20
|
+
readonly input: Input;
|
|
21
|
+
/** The output type of the schema. */
|
|
22
|
+
readonly output: Output;
|
|
23
|
+
}
|
|
24
|
+
/** Infers the input type of a Standard Typed. */
|
|
25
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
26
|
+
/** Infers the output type of a Standard Typed. */
|
|
27
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
28
|
+
}
|
|
29
|
+
/** The Standard Schema interface. */
|
|
30
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
31
|
+
/** The Standard Schema properties. */
|
|
32
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
33
|
+
}
|
|
34
|
+
declare namespace StandardSchemaV1 {
|
|
35
|
+
/** The Standard Schema properties interface. */
|
|
36
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
37
|
+
/** Validates unknown input values. */
|
|
38
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
39
|
+
}
|
|
40
|
+
/** The result interface of the validate function. */
|
|
41
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
42
|
+
/** The result interface if validation succeeds. */
|
|
43
|
+
interface SuccessResult<Output> {
|
|
44
|
+
/** The typed output value. */
|
|
45
|
+
readonly value: Output;
|
|
46
|
+
/** A falsy value for `issues` indicates success. */
|
|
47
|
+
readonly issues?: undefined;
|
|
48
|
+
}
|
|
49
|
+
interface Options {
|
|
50
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
51
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
52
|
+
}
|
|
53
|
+
/** The result interface if validation fails. */
|
|
54
|
+
interface FailureResult {
|
|
55
|
+
/** The issues of failed validation. */
|
|
56
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
57
|
+
}
|
|
58
|
+
/** The issue interface of the failure output. */
|
|
59
|
+
interface Issue {
|
|
60
|
+
/** The error message of the issue. */
|
|
61
|
+
readonly message: string;
|
|
62
|
+
/** The path of the issue, if any. */
|
|
63
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
64
|
+
}
|
|
65
|
+
/** The path segment interface of the issue. */
|
|
66
|
+
interface PathSegment {
|
|
67
|
+
/** The key representing a path segment. */
|
|
68
|
+
readonly key: PropertyKey;
|
|
69
|
+
}
|
|
70
|
+
/** The Standard types interface. */
|
|
71
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
72
|
+
/** Infers the input type of a Standard. */
|
|
73
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
74
|
+
/** Infers the output type of a Standard. */
|
|
75
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { StandardSchemaV1 as t };
|
|
79
|
+
//# sourceMappingURL=index-CeEtxDmK.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CeEtxDmK.d.cts","names":[],"sources":["../../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts"],"x_google_ignoreList":[0],"mappings":";;UACU,gBAAgB,iBAAiB,SAAS;;WAEvC,aAAa,gBAAgB,MAAM,OAAO;;kBAErC;;YAEJ,MAAM,iBAAiB,SAAS;;aAE7B;;aAEA;;aAEA,QAAQ,MAAM,OAAO;;;YAGxB,MAAM,iBAAiB,SAAS;;aAE7B,OAAO;;aAEP,QAAQ;;;OAGhB,WAAW,eAAe,mBAAmB,YAAY;;OAEzD,YAAY,eAAe,mBAAmB,YAAY;;;UAGzD,iBAAiB,iBAAiB,SAAS;;WAExC,aAAa,iBAAiB,MAAM,OAAO;;kBAEtC;;YAEJ,MAAM,iBAAiB,SAAS,eAAe,gBAAgB,MAAM,OAAO;;aAEzE,WAAW,gBAAgB,UAAU,iBAAiB,wBAAwB,OAAO,UAAU,QAAQ,OAAO;;;OAGtH,OAAO,UAAU,cAAc,UAAU;;YAEpC,cAAc;;aAEX,OAAO;;aAEP;;YAEH;;aAEG,iBAAiB;;;YAGpB;;aAEG,QAAQ,cAAc;;;YAGzB;;aAEG;;aAEA,OAAO,cAAc,cAAc;;;YAGtC;;aAEG,KAAK;;;YAGR,MAAM,iBAAiB,SAAS,eAAe,gBAAgB,MAAM,OAAO;;OAGjF,WAAW,eAAe,mBAAmB,gBAAgB,WAAW;;OAExE,YAAY,eAAe,mBAAmB,gBAAgB,YAAY"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
2
|
+
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
3
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
4
|
+
/** The Standard properties. */
|
|
5
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
6
|
+
}
|
|
7
|
+
declare namespace StandardTypedV1 {
|
|
8
|
+
/** The Standard Typed properties interface. */
|
|
9
|
+
interface Props<Input = unknown, Output = Input> {
|
|
10
|
+
/** The version number of the standard. */
|
|
11
|
+
readonly version: 1;
|
|
12
|
+
/** The vendor name of the schema library. */
|
|
13
|
+
readonly vendor: string;
|
|
14
|
+
/** Inferred types associated with the schema. */
|
|
15
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** The Standard Typed types interface. */
|
|
18
|
+
interface Types<Input = unknown, Output = Input> {
|
|
19
|
+
/** The input type of the schema. */
|
|
20
|
+
readonly input: Input;
|
|
21
|
+
/** The output type of the schema. */
|
|
22
|
+
readonly output: Output;
|
|
23
|
+
}
|
|
24
|
+
/** Infers the input type of a Standard Typed. */
|
|
25
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
26
|
+
/** Infers the output type of a Standard Typed. */
|
|
27
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
28
|
+
}
|
|
29
|
+
/** The Standard Schema interface. */
|
|
30
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
31
|
+
/** The Standard Schema properties. */
|
|
32
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
33
|
+
}
|
|
34
|
+
declare namespace StandardSchemaV1 {
|
|
35
|
+
/** The Standard Schema properties interface. */
|
|
36
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
37
|
+
/** Validates unknown input values. */
|
|
38
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
39
|
+
}
|
|
40
|
+
/** The result interface of the validate function. */
|
|
41
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
42
|
+
/** The result interface if validation succeeds. */
|
|
43
|
+
interface SuccessResult<Output> {
|
|
44
|
+
/** The typed output value. */
|
|
45
|
+
readonly value: Output;
|
|
46
|
+
/** A falsy value for `issues` indicates success. */
|
|
47
|
+
readonly issues?: undefined;
|
|
48
|
+
}
|
|
49
|
+
interface Options {
|
|
50
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
51
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
52
|
+
}
|
|
53
|
+
/** The result interface if validation fails. */
|
|
54
|
+
interface FailureResult {
|
|
55
|
+
/** The issues of failed validation. */
|
|
56
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
57
|
+
}
|
|
58
|
+
/** The issue interface of the failure output. */
|
|
59
|
+
interface Issue {
|
|
60
|
+
/** The error message of the issue. */
|
|
61
|
+
readonly message: string;
|
|
62
|
+
/** The path of the issue, if any. */
|
|
63
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
64
|
+
}
|
|
65
|
+
/** The path segment interface of the issue. */
|
|
66
|
+
interface PathSegment {
|
|
67
|
+
/** The key representing a path segment. */
|
|
68
|
+
readonly key: PropertyKey;
|
|
69
|
+
}
|
|
70
|
+
/** The Standard types interface. */
|
|
71
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
72
|
+
/** Infers the input type of a Standard. */
|
|
73
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
74
|
+
/** Infers the output type of a Standard. */
|
|
75
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { StandardSchemaV1 as t };
|
|
79
|
+
//# sourceMappingURL=index-CeEtxDmK.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CeEtxDmK.d.mts","names":[],"sources":["../../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts"],"x_google_ignoreList":[0],"mappings":";;UACU,gBAAgB,iBAAiB,SAAS;;WAEvC,aAAa,gBAAgB,MAAM,OAAO;;kBAErC;;YAEJ,MAAM,iBAAiB,SAAS;;aAE7B;;aAEA;;aAEA,QAAQ,MAAM,OAAO;;;YAGxB,MAAM,iBAAiB,SAAS;;aAE7B,OAAO;;aAEP,QAAQ;;;OAGhB,WAAW,eAAe,mBAAmB,YAAY;;OAEzD,YAAY,eAAe,mBAAmB,YAAY;;;UAGzD,iBAAiB,iBAAiB,SAAS;;WAExC,aAAa,iBAAiB,MAAM,OAAO;;kBAEtC;;YAEJ,MAAM,iBAAiB,SAAS,eAAe,gBAAgB,MAAM,OAAO;;aAEzE,WAAW,gBAAgB,UAAU,iBAAiB,wBAAwB,OAAO,UAAU,QAAQ,OAAO;;;OAGtH,OAAO,UAAU,cAAc,UAAU;;YAEpC,cAAc;;aAEX,OAAO;;aAEP;;YAEH;;aAEG,iBAAiB;;;YAGpB;;aAEG,QAAQ,cAAc;;;YAGzB;;aAEG;;aAEA,OAAO,cAAc,cAAc;;;YAGtC;;aAEG,KAAK;;;YAGR,MAAM,iBAAiB,SAAS,eAAe,gBAAgB,MAAM,OAAO;;OAGjF,WAAW,eAAe,mBAAmB,gBAAgB,WAAW;;OAExE,YAAY,eAAe,mBAAmB,gBAAgB,YAAY"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_Construct = require("./Construct-DUSXuTHP.cjs");
|
|
3
|
+
const require_shutdown = require("./shutdown-BMJmAhSt.cjs");
|
|
3
4
|
exports.Construct = require_Construct.Construct;
|
|
4
5
|
exports.ConstructType = require_Construct.ConstructType;
|
|
6
|
+
exports.onShutdown = require_shutdown.onShutdown;
|
|
7
|
+
exports.runShutdownHooks = require_shutdown.runShutdownHooks;
|
|
5
8
|
exports.sniffService = require_Construct.sniffService;
|
|
6
|
-
exports.snifferContext = require_Construct.snifferContext;
|
|
9
|
+
exports.snifferContext = require_Construct.snifferContext;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { i as snifferContext, n as ConstructType, r as sniffService, t as Construct } from "./Construct-BQALFCh2.cjs";
|
|
2
|
+
import { n as LowerHttpMethod, r as RemoveUndefined, t as HttpMethod } from "./types-DMuSQeLL.cjs";
|
|
3
|
+
import { i as TelemetryResponse, n as TelemetryContext, r as TelemetryRequest, t as Telemetry } from "./lambdaTelemetry-8vnmVZQ5.cjs";
|
|
4
|
+
import { a as Stages, i as SeedContext, n as DeployedStage, o as TestStage, r as LocalStage, t as AnyStage } from "./stages-BSCF19o2.cjs";
|
|
4
5
|
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
5
|
-
|
|
6
|
+
//#region src/shutdown.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* What a server releases when it stops: the connections constructs opened.
|
|
9
|
+
*
|
|
10
|
+
* A construct that holds something open — a database's pool — registers how to
|
|
11
|
+
* close it here, and the generated server runs every hook once it has stopped
|
|
12
|
+
* taking requests. Without that, a rolling deploy has the old task and the new
|
|
13
|
+
* one both holding connections until the old process dies.
|
|
14
|
+
*
|
|
15
|
+
* Kept free of any driver import so the server entry can always import it,
|
|
16
|
+
* whether or not the app has a database.
|
|
17
|
+
*/
|
|
18
|
+
type ShutdownHook = () => Promise<void> | void;
|
|
19
|
+
/** Run `hook` when the server shuts down. Returns a function that removes it. */
|
|
20
|
+
export declare function onShutdown(hook: ShutdownHook): () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Run every registered hook, together, and wait for them. A hook that fails is
|
|
23
|
+
* reported to `onError` and does not stop the others.
|
|
24
|
+
*/
|
|
25
|
+
export declare function runShutdownHooks(onError?: (error: unknown) => void): Promise<void>;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { type AnyStage, Construct, ConstructType, type DeployedStage, type HttpMethod, type LocalStage, type LowerHttpMethod, type RemoveUndefined, type SeedContext, type Service, type ServiceRecord, type Stages, type Telemetry, type TelemetryContext, type TelemetryRequest, type TelemetryResponse, type TestStage, sniffService, snifferContext };
|
|
28
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/shutdown.ts"],"mappings":";;;;;;;;;;;;;;;;;KAYK,qBAAqB;;wBAUV,WAAW,MAAM;;;;;wBASX,iBACrB,WAAU,0BACR"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { i as snifferContext, n as ConstructType, r as sniffService, t as Construct } from "./Construct-QXnl3VqT.mjs";
|
|
2
|
+
import { n as LowerHttpMethod, r as RemoveUndefined, t as HttpMethod } from "./types-DMuSQeLL.mjs";
|
|
3
|
+
import { i as TelemetryResponse, n as TelemetryContext, r as TelemetryRequest, t as Telemetry } from "./lambdaTelemetry-8vnmVZQ5.mjs";
|
|
4
|
+
import { a as Stages, i as SeedContext, n as DeployedStage, o as TestStage, r as LocalStage, t as AnyStage } from "./stages-BSCF19o2.mjs";
|
|
4
5
|
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
5
|
-
|
|
6
|
+
//#region src/shutdown.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* What a server releases when it stops: the connections constructs opened.
|
|
9
|
+
*
|
|
10
|
+
* A construct that holds something open — a database's pool — registers how to
|
|
11
|
+
* close it here, and the generated server runs every hook once it has stopped
|
|
12
|
+
* taking requests. Without that, a rolling deploy has the old task and the new
|
|
13
|
+
* one both holding connections until the old process dies.
|
|
14
|
+
*
|
|
15
|
+
* Kept free of any driver import so the server entry can always import it,
|
|
16
|
+
* whether or not the app has a database.
|
|
17
|
+
*/
|
|
18
|
+
type ShutdownHook = () => Promise<void> | void;
|
|
19
|
+
/** Run `hook` when the server shuts down. Returns a function that removes it. */
|
|
20
|
+
export declare function onShutdown(hook: ShutdownHook): () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Run every registered hook, together, and wait for them. A hook that fails is
|
|
23
|
+
* reported to `onError` and does not stop the others.
|
|
24
|
+
*/
|
|
25
|
+
export declare function runShutdownHooks(onError?: (error: unknown) => void): Promise<void>;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { type AnyStage, Construct, ConstructType, type DeployedStage, type HttpMethod, type LocalStage, type LowerHttpMethod, type RemoveUndefined, type SeedContext, type Service, type ServiceRecord, type Stages, type Telemetry, type TelemetryContext, type TelemetryRequest, type TelemetryResponse, type TestStage, sniffService, snifferContext };
|
|
28
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/shutdown.ts"],"mappings":";;;;;;;;;;;;;;;;;KAYK,qBAAqB;;wBAUV,WAAW,MAAM;;;;;wBASX,iBACrB,WAAU,0BACR"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export { Construct, ConstructType, sniffService, snifferContext };
|
|
1
|
+
import { i as snifferContext, n as ConstructType, r as sniffService, t as Construct } from "./Construct-B1vGBPme.mjs";
|
|
2
|
+
import { n as runShutdownHooks, t as onShutdown } from "./shutdown-C7xa8x9S.mjs";
|
|
3
|
+
export { Construct, ConstructType, onShutdown, runShutdownHooks, sniffService, snifferContext };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const require_cipher = require("./cipher-CVxfwLjk.cjs");
|
|
2
|
+
let _aws_sdk_client_kms = require("@aws-sdk/client-kms");
|
|
3
|
+
//#region src/encryption/kms.ts
|
|
4
|
+
/**
|
|
5
|
+
* The `kms://` cipher: envelope encryption under an AWS KMS key.
|
|
6
|
+
*
|
|
7
|
+
* Each `encrypt` asks KMS for a fresh data key, seals the plaintext with it
|
|
8
|
+
* locally, and stores the data key *as KMS encrypted it* beside the data. The
|
|
9
|
+
* plaintext data key is used once and dropped, and the master key never leaves
|
|
10
|
+
* KMS — every decrypt is a KMS call IAM can refuse and CloudTrail records.
|
|
11
|
+
*
|
|
12
|
+
* Rotation is KMS's: it keeps every backing version of the key, and the
|
|
13
|
+
* encrypted data key names the one that wrapped it, so nothing here tracks a
|
|
14
|
+
* version and `reencrypt` has nothing to move. The ciphertext's key field is
|
|
15
|
+
* `kms` for that reason.
|
|
16
|
+
*
|
|
17
|
+
* The blind index is a KMS HMAC key's `GenerateMac`: deterministic, and the
|
|
18
|
+
* key is as unextractable as the encryption key.
|
|
19
|
+
*
|
|
20
|
+
* In its own module, loaded only when a URL says `kms://`, so a project that
|
|
21
|
+
* never deploys to AWS never needs `@aws-sdk/client-kms` installed.
|
|
22
|
+
*/
|
|
23
|
+
/** The ciphertext's key field: the version lives inside KMS's own blob. */
|
|
24
|
+
const KMS_KEY_ID = "kms";
|
|
25
|
+
function kmsCipher(construct, url) {
|
|
26
|
+
const parsed = new URL(url);
|
|
27
|
+
const region = parsed.hostname;
|
|
28
|
+
const keyId = parsed.searchParams.get("key");
|
|
29
|
+
const indexKeyId = parsed.searchParams.get("index");
|
|
30
|
+
if (!region || !keyId || !indexKeyId) throw new require_cipher.EncryptionUrlInvalid(construct, "a kms:// URL names a region, a key and an index key");
|
|
31
|
+
const endpoint = parsed.searchParams.get("endpoint");
|
|
32
|
+
const kms = new _aws_sdk_client_kms.KMSClient({
|
|
33
|
+
region,
|
|
34
|
+
...endpoint ? { endpoint } : {}
|
|
35
|
+
});
|
|
36
|
+
const context = { construct };
|
|
37
|
+
const aad = require_cipher.associatedData(construct, KMS_KEY_ID);
|
|
38
|
+
return {
|
|
39
|
+
async encrypt(plaintext) {
|
|
40
|
+
const dataKey = await kms.send(new _aws_sdk_client_kms.GenerateDataKeyCommand({
|
|
41
|
+
KeyId: keyId,
|
|
42
|
+
KeySpec: "AES_256",
|
|
43
|
+
EncryptionContext: context
|
|
44
|
+
}));
|
|
45
|
+
const wrapped = Buffer.from(dataKey.CiphertextBlob);
|
|
46
|
+
const sealed = require_cipher.seal(Buffer.from(dataKey.Plaintext), Buffer.from(plaintext, "utf8"), aad);
|
|
47
|
+
const length = Buffer.alloc(2);
|
|
48
|
+
length.writeUInt16BE(wrapped.length);
|
|
49
|
+
return require_cipher.formatCiphertext(KMS_KEY_ID, Buffer.concat([
|
|
50
|
+
length,
|
|
51
|
+
wrapped,
|
|
52
|
+
sealed
|
|
53
|
+
]));
|
|
54
|
+
},
|
|
55
|
+
async decrypt(ciphertext) {
|
|
56
|
+
const { payload } = require_cipher.parseCiphertext(construct, ciphertext);
|
|
57
|
+
const length = payload.length >= 2 ? payload.readUInt16BE(0) : 0;
|
|
58
|
+
const wrapped = payload.subarray(2, 2 + length);
|
|
59
|
+
if (!length || wrapped.length !== length) throw new require_cipher.CiphertextNotAuthentic(construct);
|
|
60
|
+
const dataKey = await kms.send(new _aws_sdk_client_kms.DecryptCommand({
|
|
61
|
+
CiphertextBlob: wrapped,
|
|
62
|
+
EncryptionContext: context
|
|
63
|
+
}));
|
|
64
|
+
const plaintext = require_cipher.open(Buffer.from(dataKey.Plaintext), payload.subarray(2 + length), aad);
|
|
65
|
+
if (!plaintext) throw new require_cipher.CiphertextNotAuthentic(construct);
|
|
66
|
+
return plaintext.toString("utf8");
|
|
67
|
+
},
|
|
68
|
+
async index(value) {
|
|
69
|
+
const { Mac } = await kms.send(new _aws_sdk_client_kms.GenerateMacCommand({
|
|
70
|
+
KeyId: indexKeyId,
|
|
71
|
+
MacAlgorithm: "HMAC_SHA_256",
|
|
72
|
+
Message: Buffer.from(value, "utf8")
|
|
73
|
+
}));
|
|
74
|
+
return Buffer.from(Mac).toString("base64url");
|
|
75
|
+
},
|
|
76
|
+
async reencrypt(ciphertext) {
|
|
77
|
+
require_cipher.parseCiphertext(construct, ciphertext);
|
|
78
|
+
return ciphertext;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
exports.kmsCipher = kmsCipher;
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=kms-B-Hm3d5r.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kms-B-Hm3d5r.cjs","names":["EncryptionUrlInvalid","KMSClient","associatedData","GenerateDataKeyCommand","seal","formatCiphertext","parseCiphertext","CiphertextNotAuthentic","DecryptCommand","open","GenerateMacCommand"],"sources":["../src/encryption/kms.ts"],"sourcesContent":["/**\n * The `kms://` cipher: envelope encryption under an AWS KMS key.\n *\n * Each `encrypt` asks KMS for a fresh data key, seals the plaintext with it\n * locally, and stores the data key *as KMS encrypted it* beside the data. The\n * plaintext data key is used once and dropped, and the master key never leaves\n * KMS — every decrypt is a KMS call IAM can refuse and CloudTrail records.\n *\n * Rotation is KMS's: it keeps every backing version of the key, and the\n * encrypted data key names the one that wrapped it, so nothing here tracks a\n * version and `reencrypt` has nothing to move. The ciphertext's key field is\n * `kms` for that reason.\n *\n * The blind index is a KMS HMAC key's `GenerateMac`: deterministic, and the\n * key is as unextractable as the encryption key.\n *\n * In its own module, loaded only when a URL says `kms://`, so a project that\n * never deploys to AWS never needs `@aws-sdk/client-kms` installed.\n */\n\nimport {\n\tDecryptCommand,\n\tGenerateDataKeyCommand,\n\tGenerateMacCommand,\n\tKMSClient,\n} from '@aws-sdk/client-kms';\nimport {\n\tassociatedData,\n\ttype Cipher,\n\tCiphertextNotAuthentic,\n\tEncryptionUrlInvalid,\n\tformatCiphertext,\n\topen,\n\tparseCiphertext,\n\tseal,\n} from './cipher';\n\n/** The ciphertext's key field: the version lives inside KMS's own blob. */\nconst KMS_KEY_ID = 'kms';\n\nexport function kmsCipher(construct: string, url: string): Cipher {\n\tconst parsed = new URL(url);\n\tconst region = parsed.hostname;\n\tconst keyId = parsed.searchParams.get('key');\n\tconst indexKeyId = parsed.searchParams.get('index');\n\tif (!region || !keyId || !indexKeyId) {\n\t\tthrow new EncryptionUrlInvalid(\n\t\t\tconstruct,\n\t\t\t'a kms:// URL names a region, a key and an index key',\n\t\t);\n\t}\n\n\tconst endpoint = parsed.searchParams.get('endpoint');\n\t// Credentials are not part of the address: the default chain — a Lambda's\n\t// role deployed, the environment against an emulator.\n\tconst kms = new KMSClient({ region, ...(endpoint ? { endpoint } : {}) });\n\t// What KMS checks on every decrypt, and what CloudTrail shows each call was\n\t// for — a data key minted for one construct will not open for another.\n\tconst context = { construct };\n\tconst aad = associatedData(construct, KMS_KEY_ID);\n\n\treturn {\n\t\tasync encrypt(plaintext) {\n\t\t\tconst dataKey = await kms.send(\n\t\t\t\tnew GenerateDataKeyCommand({\n\t\t\t\t\tKeyId: keyId,\n\t\t\t\t\tKeySpec: 'AES_256',\n\t\t\t\t\tEncryptionContext: context,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst wrapped = Buffer.from(dataKey.CiphertextBlob!);\n\t\t\tconst sealed = seal(\n\t\t\t\tBuffer.from(dataKey.Plaintext!),\n\t\t\t\tBuffer.from(plaintext, 'utf8'),\n\t\t\t\taad,\n\t\t\t);\n\n\t\t\tconst length = Buffer.alloc(2);\n\t\t\tlength.writeUInt16BE(wrapped.length);\n\t\t\treturn formatCiphertext(\n\t\t\t\tKMS_KEY_ID,\n\t\t\t\tBuffer.concat([length, wrapped, sealed]),\n\t\t\t);\n\t\t},\n\n\t\tasync decrypt(ciphertext) {\n\t\t\tconst { payload } = parseCiphertext(construct, ciphertext);\n\t\t\tconst length = payload.length >= 2 ? payload.readUInt16BE(0) : 0;\n\t\t\tconst wrapped = payload.subarray(2, 2 + length);\n\t\t\tif (!length || wrapped.length !== length) {\n\t\t\t\tthrow new CiphertextNotAuthentic(construct);\n\t\t\t}\n\n\t\t\tconst dataKey = await kms.send(\n\t\t\t\tnew DecryptCommand({\n\t\t\t\t\tCiphertextBlob: wrapped,\n\t\t\t\t\tEncryptionContext: context,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst plaintext = open(\n\t\t\t\tBuffer.from(dataKey.Plaintext!),\n\t\t\t\tpayload.subarray(2 + length),\n\t\t\t\taad,\n\t\t\t);\n\t\t\tif (!plaintext) throw new CiphertextNotAuthentic(construct);\n\n\t\t\treturn plaintext.toString('utf8');\n\t\t},\n\n\t\tasync index(value) {\n\t\t\tconst { Mac } = await kms.send(\n\t\t\t\tnew GenerateMacCommand({\n\t\t\t\t\tKeyId: indexKeyId,\n\t\t\t\t\tMacAlgorithm: 'HMAC_SHA_256',\n\t\t\t\t\tMessage: Buffer.from(value, 'utf8'),\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn Buffer.from(Mac!).toString('base64url');\n\t\t},\n\n\t\t// KMS keeps every version it rotated through, so a value is never under\n\t\t// a key that could be retired from under it.\n\t\tasync reencrypt(ciphertext) {\n\t\t\tparseCiphertext(construct, ciphertext);\n\t\t\treturn ciphertext;\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,aAAa;AAEnB,SAAgB,UAAU,WAAmB,KAAqB;CACjE,MAAM,SAAS,IAAI,IAAI,GAAG;CAC1B,MAAM,SAAS,OAAO;CACtB,MAAM,QAAQ,OAAO,aAAa,IAAI,KAAK;CAC3C,MAAM,aAAa,OAAO,aAAa,IAAI,OAAO;CAClD,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,YACzB,MAAM,IAAIA,eAAAA,qBACT,WACA,qDACD;CAGD,MAAM,WAAW,OAAO,aAAa,IAAI,UAAU;CAGnD,MAAM,MAAM,IAAIC,oBAAAA,UAAU;EAAE;EAAQ,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;CAAG,CAAC;CAGvE,MAAM,UAAU,EAAE,UAAU;CAC5B,MAAM,MAAMC,eAAAA,eAAe,WAAW,UAAU;CAEhD,OAAO;EACN,MAAM,QAAQ,WAAW;GACxB,MAAM,UAAU,MAAM,IAAI,KACzB,IAAIC,oBAAAA,uBAAuB;IAC1B,OAAO;IACP,SAAS;IACT,mBAAmB;GACpB,CAAC,CACF;GACA,MAAM,UAAU,OAAO,KAAK,QAAQ,cAAe;GACnD,MAAM,SAASC,eAAAA,KACd,OAAO,KAAK,QAAQ,SAAU,GAC9B,OAAO,KAAK,WAAW,MAAM,GAC7B,GACD;GAEA,MAAM,SAAS,OAAO,MAAM,CAAC;GAC7B,OAAO,cAAc,QAAQ,MAAM;GACnC,OAAOC,eAAAA,iBACN,YACA,OAAO,OAAO;IAAC;IAAQ;IAAS;GAAM,CAAC,CACxC;EACD;EAEA,MAAM,QAAQ,YAAY;GACzB,MAAM,EAAE,YAAYC,eAAAA,gBAAgB,WAAW,UAAU;GACzD,MAAM,SAAS,QAAQ,UAAU,IAAI,QAAQ,aAAa,CAAC,IAAI;GAC/D,MAAM,UAAU,QAAQ,SAAS,GAAG,IAAI,MAAM;GAC9C,IAAI,CAAC,UAAU,QAAQ,WAAW,QACjC,MAAM,IAAIC,eAAAA,uBAAuB,SAAS;GAG3C,MAAM,UAAU,MAAM,IAAI,KACzB,IAAIC,oBAAAA,eAAe;IAClB,gBAAgB;IAChB,mBAAmB;GACpB,CAAC,CACF;GACA,MAAM,YAAYC,eAAAA,KACjB,OAAO,KAAK,QAAQ,SAAU,GAC9B,QAAQ,SAAS,IAAI,MAAM,GAC3B,GACD;GACA,IAAI,CAAC,WAAW,MAAM,IAAIF,eAAAA,uBAAuB,SAAS;GAE1D,OAAO,UAAU,SAAS,MAAM;EACjC;EAEA,MAAM,MAAM,OAAO;GAClB,MAAM,EAAE,QAAQ,MAAM,IAAI,KACzB,IAAIG,oBAAAA,mBAAmB;IACtB,OAAO;IACP,cAAc;IACd,SAAS,OAAO,KAAK,OAAO,MAAM;GACnC,CAAC,CACF;GACA,OAAO,OAAO,KAAK,GAAI,CAAC,CAAC,SAAS,WAAW;EAC9C;EAIA,MAAM,UAAU,YAAY;GAC3B,eAAA,gBAAgB,WAAW,UAAU;GACrC,OAAO;EACR;CACD;AACD"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { a as EncryptionUrlInvalid, c as associatedData, l as formatCiphertext, m as parseCiphertext, n as CiphertextNotAuthentic, p as open, v as seal } from "./cipher-C1lEFX63.mjs";
|
|
2
|
+
import { DecryptCommand, GenerateDataKeyCommand, GenerateMacCommand, KMSClient } from "@aws-sdk/client-kms";
|
|
3
|
+
//#region src/encryption/kms.ts
|
|
4
|
+
/**
|
|
5
|
+
* The `kms://` cipher: envelope encryption under an AWS KMS key.
|
|
6
|
+
*
|
|
7
|
+
* Each `encrypt` asks KMS for a fresh data key, seals the plaintext with it
|
|
8
|
+
* locally, and stores the data key *as KMS encrypted it* beside the data. The
|
|
9
|
+
* plaintext data key is used once and dropped, and the master key never leaves
|
|
10
|
+
* KMS — every decrypt is a KMS call IAM can refuse and CloudTrail records.
|
|
11
|
+
*
|
|
12
|
+
* Rotation is KMS's: it keeps every backing version of the key, and the
|
|
13
|
+
* encrypted data key names the one that wrapped it, so nothing here tracks a
|
|
14
|
+
* version and `reencrypt` has nothing to move. The ciphertext's key field is
|
|
15
|
+
* `kms` for that reason.
|
|
16
|
+
*
|
|
17
|
+
* The blind index is a KMS HMAC key's `GenerateMac`: deterministic, and the
|
|
18
|
+
* key is as unextractable as the encryption key.
|
|
19
|
+
*
|
|
20
|
+
* In its own module, loaded only when a URL says `kms://`, so a project that
|
|
21
|
+
* never deploys to AWS never needs `@aws-sdk/client-kms` installed.
|
|
22
|
+
*/
|
|
23
|
+
/** The ciphertext's key field: the version lives inside KMS's own blob. */
|
|
24
|
+
const KMS_KEY_ID = "kms";
|
|
25
|
+
function kmsCipher(construct, url) {
|
|
26
|
+
const parsed = new URL(url);
|
|
27
|
+
const region = parsed.hostname;
|
|
28
|
+
const keyId = parsed.searchParams.get("key");
|
|
29
|
+
const indexKeyId = parsed.searchParams.get("index");
|
|
30
|
+
if (!region || !keyId || !indexKeyId) throw new EncryptionUrlInvalid(construct, "a kms:// URL names a region, a key and an index key");
|
|
31
|
+
const endpoint = parsed.searchParams.get("endpoint");
|
|
32
|
+
const kms = new KMSClient({
|
|
33
|
+
region,
|
|
34
|
+
...endpoint ? { endpoint } : {}
|
|
35
|
+
});
|
|
36
|
+
const context = { construct };
|
|
37
|
+
const aad = associatedData(construct, KMS_KEY_ID);
|
|
38
|
+
return {
|
|
39
|
+
async encrypt(plaintext) {
|
|
40
|
+
const dataKey = await kms.send(new GenerateDataKeyCommand({
|
|
41
|
+
KeyId: keyId,
|
|
42
|
+
KeySpec: "AES_256",
|
|
43
|
+
EncryptionContext: context
|
|
44
|
+
}));
|
|
45
|
+
const wrapped = Buffer.from(dataKey.CiphertextBlob);
|
|
46
|
+
const sealed = seal(Buffer.from(dataKey.Plaintext), Buffer.from(plaintext, "utf8"), aad);
|
|
47
|
+
const length = Buffer.alloc(2);
|
|
48
|
+
length.writeUInt16BE(wrapped.length);
|
|
49
|
+
return formatCiphertext(KMS_KEY_ID, Buffer.concat([
|
|
50
|
+
length,
|
|
51
|
+
wrapped,
|
|
52
|
+
sealed
|
|
53
|
+
]));
|
|
54
|
+
},
|
|
55
|
+
async decrypt(ciphertext) {
|
|
56
|
+
const { payload } = parseCiphertext(construct, ciphertext);
|
|
57
|
+
const length = payload.length >= 2 ? payload.readUInt16BE(0) : 0;
|
|
58
|
+
const wrapped = payload.subarray(2, 2 + length);
|
|
59
|
+
if (!length || wrapped.length !== length) throw new CiphertextNotAuthentic(construct);
|
|
60
|
+
const dataKey = await kms.send(new DecryptCommand({
|
|
61
|
+
CiphertextBlob: wrapped,
|
|
62
|
+
EncryptionContext: context
|
|
63
|
+
}));
|
|
64
|
+
const plaintext = open(Buffer.from(dataKey.Plaintext), payload.subarray(2 + length), aad);
|
|
65
|
+
if (!plaintext) throw new CiphertextNotAuthentic(construct);
|
|
66
|
+
return plaintext.toString("utf8");
|
|
67
|
+
},
|
|
68
|
+
async index(value) {
|
|
69
|
+
const { Mac } = await kms.send(new GenerateMacCommand({
|
|
70
|
+
KeyId: indexKeyId,
|
|
71
|
+
MacAlgorithm: "HMAC_SHA_256",
|
|
72
|
+
Message: Buffer.from(value, "utf8")
|
|
73
|
+
}));
|
|
74
|
+
return Buffer.from(Mac).toString("base64url");
|
|
75
|
+
},
|
|
76
|
+
async reencrypt(ciphertext) {
|
|
77
|
+
parseCiphertext(construct, ciphertext);
|
|
78
|
+
return ciphertext;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { kmsCipher };
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=kms-BdUlMJEZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kms-BdUlMJEZ.mjs","names":[],"sources":["../src/encryption/kms.ts"],"sourcesContent":["/**\n * The `kms://` cipher: envelope encryption under an AWS KMS key.\n *\n * Each `encrypt` asks KMS for a fresh data key, seals the plaintext with it\n * locally, and stores the data key *as KMS encrypted it* beside the data. The\n * plaintext data key is used once and dropped, and the master key never leaves\n * KMS — every decrypt is a KMS call IAM can refuse and CloudTrail records.\n *\n * Rotation is KMS's: it keeps every backing version of the key, and the\n * encrypted data key names the one that wrapped it, so nothing here tracks a\n * version and `reencrypt` has nothing to move. The ciphertext's key field is\n * `kms` for that reason.\n *\n * The blind index is a KMS HMAC key's `GenerateMac`: deterministic, and the\n * key is as unextractable as the encryption key.\n *\n * In its own module, loaded only when a URL says `kms://`, so a project that\n * never deploys to AWS never needs `@aws-sdk/client-kms` installed.\n */\n\nimport {\n\tDecryptCommand,\n\tGenerateDataKeyCommand,\n\tGenerateMacCommand,\n\tKMSClient,\n} from '@aws-sdk/client-kms';\nimport {\n\tassociatedData,\n\ttype Cipher,\n\tCiphertextNotAuthentic,\n\tEncryptionUrlInvalid,\n\tformatCiphertext,\n\topen,\n\tparseCiphertext,\n\tseal,\n} from './cipher';\n\n/** The ciphertext's key field: the version lives inside KMS's own blob. */\nconst KMS_KEY_ID = 'kms';\n\nexport function kmsCipher(construct: string, url: string): Cipher {\n\tconst parsed = new URL(url);\n\tconst region = parsed.hostname;\n\tconst keyId = parsed.searchParams.get('key');\n\tconst indexKeyId = parsed.searchParams.get('index');\n\tif (!region || !keyId || !indexKeyId) {\n\t\tthrow new EncryptionUrlInvalid(\n\t\t\tconstruct,\n\t\t\t'a kms:// URL names a region, a key and an index key',\n\t\t);\n\t}\n\n\tconst endpoint = parsed.searchParams.get('endpoint');\n\t// Credentials are not part of the address: the default chain — a Lambda's\n\t// role deployed, the environment against an emulator.\n\tconst kms = new KMSClient({ region, ...(endpoint ? { endpoint } : {}) });\n\t// What KMS checks on every decrypt, and what CloudTrail shows each call was\n\t// for — a data key minted for one construct will not open for another.\n\tconst context = { construct };\n\tconst aad = associatedData(construct, KMS_KEY_ID);\n\n\treturn {\n\t\tasync encrypt(plaintext) {\n\t\t\tconst dataKey = await kms.send(\n\t\t\t\tnew GenerateDataKeyCommand({\n\t\t\t\t\tKeyId: keyId,\n\t\t\t\t\tKeySpec: 'AES_256',\n\t\t\t\t\tEncryptionContext: context,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst wrapped = Buffer.from(dataKey.CiphertextBlob!);\n\t\t\tconst sealed = seal(\n\t\t\t\tBuffer.from(dataKey.Plaintext!),\n\t\t\t\tBuffer.from(plaintext, 'utf8'),\n\t\t\t\taad,\n\t\t\t);\n\n\t\t\tconst length = Buffer.alloc(2);\n\t\t\tlength.writeUInt16BE(wrapped.length);\n\t\t\treturn formatCiphertext(\n\t\t\t\tKMS_KEY_ID,\n\t\t\t\tBuffer.concat([length, wrapped, sealed]),\n\t\t\t);\n\t\t},\n\n\t\tasync decrypt(ciphertext) {\n\t\t\tconst { payload } = parseCiphertext(construct, ciphertext);\n\t\t\tconst length = payload.length >= 2 ? payload.readUInt16BE(0) : 0;\n\t\t\tconst wrapped = payload.subarray(2, 2 + length);\n\t\t\tif (!length || wrapped.length !== length) {\n\t\t\t\tthrow new CiphertextNotAuthentic(construct);\n\t\t\t}\n\n\t\t\tconst dataKey = await kms.send(\n\t\t\t\tnew DecryptCommand({\n\t\t\t\t\tCiphertextBlob: wrapped,\n\t\t\t\t\tEncryptionContext: context,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst plaintext = open(\n\t\t\t\tBuffer.from(dataKey.Plaintext!),\n\t\t\t\tpayload.subarray(2 + length),\n\t\t\t\taad,\n\t\t\t);\n\t\t\tif (!plaintext) throw new CiphertextNotAuthentic(construct);\n\n\t\t\treturn plaintext.toString('utf8');\n\t\t},\n\n\t\tasync index(value) {\n\t\t\tconst { Mac } = await kms.send(\n\t\t\t\tnew GenerateMacCommand({\n\t\t\t\t\tKeyId: indexKeyId,\n\t\t\t\t\tMacAlgorithm: 'HMAC_SHA_256',\n\t\t\t\t\tMessage: Buffer.from(value, 'utf8'),\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn Buffer.from(Mac!).toString('base64url');\n\t\t},\n\n\t\t// KMS keeps every version it rotated through, so a value is never under\n\t\t// a key that could be retired from under it.\n\t\tasync reencrypt(ciphertext) {\n\t\t\tparseCiphertext(construct, ciphertext);\n\t\t\treturn ciphertext;\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,aAAa;AAEnB,SAAgB,UAAU,WAAmB,KAAqB;CACjE,MAAM,SAAS,IAAI,IAAI,GAAG;CAC1B,MAAM,SAAS,OAAO;CACtB,MAAM,QAAQ,OAAO,aAAa,IAAI,KAAK;CAC3C,MAAM,aAAa,OAAO,aAAa,IAAI,OAAO;CAClD,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,YACzB,MAAM,IAAI,qBACT,WACA,qDACD;CAGD,MAAM,WAAW,OAAO,aAAa,IAAI,UAAU;CAGnD,MAAM,MAAM,IAAI,UAAU;EAAE;EAAQ,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;CAAG,CAAC;CAGvE,MAAM,UAAU,EAAE,UAAU;CAC5B,MAAM,MAAM,eAAe,WAAW,UAAU;CAEhD,OAAO;EACN,MAAM,QAAQ,WAAW;GACxB,MAAM,UAAU,MAAM,IAAI,KACzB,IAAI,uBAAuB;IAC1B,OAAO;IACP,SAAS;IACT,mBAAmB;GACpB,CAAC,CACF;GACA,MAAM,UAAU,OAAO,KAAK,QAAQ,cAAe;GACnD,MAAM,SAAS,KACd,OAAO,KAAK,QAAQ,SAAU,GAC9B,OAAO,KAAK,WAAW,MAAM,GAC7B,GACD;GAEA,MAAM,SAAS,OAAO,MAAM,CAAC;GAC7B,OAAO,cAAc,QAAQ,MAAM;GACnC,OAAO,iBACN,YACA,OAAO,OAAO;IAAC;IAAQ;IAAS;GAAM,CAAC,CACxC;EACD;EAEA,MAAM,QAAQ,YAAY;GACzB,MAAM,EAAE,YAAY,gBAAgB,WAAW,UAAU;GACzD,MAAM,SAAS,QAAQ,UAAU,IAAI,QAAQ,aAAa,CAAC,IAAI;GAC/D,MAAM,UAAU,QAAQ,SAAS,GAAG,IAAI,MAAM;GAC9C,IAAI,CAAC,UAAU,QAAQ,WAAW,QACjC,MAAM,IAAI,uBAAuB,SAAS;GAG3C,MAAM,UAAU,MAAM,IAAI,KACzB,IAAI,eAAe;IAClB,gBAAgB;IAChB,mBAAmB;GACpB,CAAC,CACF;GACA,MAAM,YAAY,KACjB,OAAO,KAAK,QAAQ,SAAU,GAC9B,QAAQ,SAAS,IAAI,MAAM,GAC3B,GACD;GACA,IAAI,CAAC,WAAW,MAAM,IAAI,uBAAuB,SAAS;GAE1D,OAAO,UAAU,SAAS,MAAM;EACjC;EAEA,MAAM,MAAM,OAAO;GAClB,MAAM,EAAE,QAAQ,MAAM,IAAI,KACzB,IAAI,mBAAmB;IACtB,OAAO;IACP,cAAc;IACd,SAAS,OAAO,KAAK,OAAO,MAAM;GACnC,CAAC,CACF;GACA,OAAO,OAAO,KAAK,GAAI,CAAC,CAAC,SAAS,WAAW;EAC9C;EAIA,MAAM,UAAU,YAAY;GAC3B,gBAAgB,WAAW,UAAU;GACrC,OAAO;EACR;CACD;AACD"}
|