@geekmidas/constructs 10.0.0-alpha.16 → 10.0.0-alpha.161
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 +246 -158
- package/dist/Construct-127M7yrl.d.cts +231 -0
- package/dist/Construct-127M7yrl.d.cts.map +1 -0
- package/dist/Construct-BMk_CRSD.d.mts +231 -0
- package/dist/Construct-BMk_CRSD.d.mts.map +1 -0
- package/dist/{Construct-BeYVu_QF.mjs → Construct-CGuc_Ijk.mjs} +8 -9
- package/dist/Construct-CGuc_Ijk.mjs.map +1 -0
- package/dist/{Construct-DqdlARxq.cjs → Construct-DorKS0Ua.cjs} +8 -9
- package/dist/Construct-DorKS0Ua.cjs.map +1 -0
- package/dist/{Cron-l4Wlz6G9.d.mts → Cron-D6Y7BBt3.d.mts} +15 -8
- package/dist/Cron-D6Y7BBt3.d.mts.map +1 -0
- package/dist/{Cron-zsoSAwZo.d.cts → Cron-D_sfaMGz.d.cts} +14 -7
- package/dist/Cron-D_sfaMGz.d.cts.map +1 -0
- package/dist/CronBuilder-4BZhkChG.d.mts +47 -0
- package/dist/CronBuilder-4BZhkChG.d.mts.map +1 -0
- package/dist/{CronBuilder-D_0HNBTr.mjs → CronBuilder-BJ5LoadF.mjs} +28 -11
- package/dist/CronBuilder-BJ5LoadF.mjs.map +1 -0
- package/dist/{CronBuilder-BdnI6lxF.cjs → CronBuilder-B_NSP-Y5.cjs} +27 -10
- package/dist/CronBuilder-B_NSP-Y5.cjs.map +1 -0
- package/dist/CronBuilder-C91MVLSr.d.cts +47 -0
- package/dist/CronBuilder-C91MVLSr.d.cts.map +1 -0
- package/dist/Endpoint-52z1P0Ue.cjs +581 -0
- package/dist/Endpoint-52z1P0Ue.cjs.map +1 -0
- package/dist/{Endpoint-oS-Fe3d_.d.mts → Endpoint-BUoDD96P.d.mts} +104 -23
- package/dist/Endpoint-BUoDD96P.d.mts.map +1 -0
- package/dist/{Endpoint-DBflWAe4.d.cts → Endpoint-YYwjqtS1.d.cts} +101 -20
- package/dist/Endpoint-YYwjqtS1.d.cts.map +1 -0
- package/dist/Endpoint-sUOU7uLx.mjs +552 -0
- package/dist/Endpoint-sUOU7uLx.mjs.map +1 -0
- package/dist/{index-Cc4kKPag.d.mts → EndpointFactory-BbVOeryo.d.mts} +189 -106
- package/dist/EndpointFactory-BbVOeryo.d.mts.map +1 -0
- package/dist/{EndpointFactory-Bm3aKRdV.mjs → EndpointFactory-Bzi9Sl7r.mjs} +269 -53
- package/dist/EndpointFactory-Bzi9Sl7r.mjs.map +1 -0
- package/dist/{EndpointFactory-CLvWuHyt.cjs → EndpointFactory-Cf_Cs1ym.cjs} +309 -51
- package/dist/EndpointFactory-Cf_Cs1ym.cjs.map +1 -0
- package/dist/{index-C1ZwNOOk.d.cts → EndpointFactory-Hh1r6J_C.d.cts} +187 -104
- package/dist/EndpointFactory-Hh1r6J_C.d.cts.map +1 -0
- package/dist/Function-BIEsY0Hm.d.cts +76 -0
- package/dist/Function-BIEsY0Hm.d.cts.map +1 -0
- package/dist/Function-BKReud5p.d.mts +76 -0
- package/dist/Function-BKReud5p.d.mts.map +1 -0
- package/dist/{HonoEndpointAdaptor-92zavCsV.cjs → HonoEndpointAdaptor-BTbqfSaa.cjs} +115 -41
- package/dist/HonoEndpointAdaptor-BTbqfSaa.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-yYaU7jVJ.mjs → HonoEndpointAdaptor-CBVey2cY.mjs} +112 -38
- package/dist/HonoEndpointAdaptor-CBVey2cY.mjs.map +1 -0
- package/dist/ObjectSubscriberBuilder-DfzXQEKW.d.mts +129 -0
- package/dist/ObjectSubscriberBuilder-DfzXQEKW.d.mts.map +1 -0
- package/dist/ObjectSubscriberBuilder-LWkey_oq.d.cts +129 -0
- package/dist/ObjectSubscriberBuilder-LWkey_oq.d.cts.map +1 -0
- package/dist/ProcessorBuilder-D4oYvZeG.d.mts +216 -0
- package/dist/ProcessorBuilder-D4oYvZeG.d.mts.map +1 -0
- package/dist/ProcessorBuilder-_jdZlbfW.d.cts +216 -0
- package/dist/ProcessorBuilder-_jdZlbfW.d.cts.map +1 -0
- package/dist/{Queue-D9X6OoON.d.mts → Queue-B8HGg439.d.mts} +42 -41
- package/dist/Queue-B8HGg439.d.mts.map +1 -0
- package/dist/{Queue-DYPB2KWL.d.cts → Queue-C4rijiM7.d.cts} +43 -42
- package/dist/Queue-C4rijiM7.d.cts.map +1 -0
- package/dist/Queue-D4Iaidrs.cjs +109 -0
- package/dist/Queue-D4Iaidrs.cjs.map +1 -0
- package/dist/Queue-u8w8_HpE.mjs +104 -0
- package/dist/Queue-u8w8_HpE.mjs.map +1 -0
- package/dist/QueueBuilder-2wP5lEC8.mjs +118 -0
- package/dist/QueueBuilder-2wP5lEC8.mjs.map +1 -0
- package/dist/QueueBuilder-BxsZ9o5z.cjs +135 -0
- package/dist/QueueBuilder-BxsZ9o5z.cjs.map +1 -0
- package/dist/QueueBuilder-CVS_qPuo.d.mts +75 -0
- package/dist/QueueBuilder-CVS_qPuo.d.mts.map +1 -0
- package/dist/QueueBuilder-SQli59An.d.cts +75 -0
- package/dist/QueueBuilder-SQli59An.d.cts.map +1 -0
- package/dist/Subscriber-5rCX1Nph.d.cts +83 -0
- package/dist/Subscriber-5rCX1Nph.d.cts.map +1 -0
- package/dist/Subscriber-CtQXhcL7.d.mts +83 -0
- package/dist/Subscriber-CtQXhcL7.d.mts.map +1 -0
- package/dist/SubscriberBuilder-CpFhShTJ.mjs +238 -0
- package/dist/SubscriberBuilder-CpFhShTJ.mjs.map +1 -0
- package/dist/SubscriberBuilder-DJEvNRdD.cjs +261 -0
- package/dist/SubscriberBuilder-DJEvNRdD.cjs.map +1 -0
- package/dist/Topic-DN2gYJ-p.mjs +99 -0
- package/dist/Topic-DN2gYJ-p.mjs.map +1 -0
- package/dist/Topic-Dp9Q7Lj2.cjs +104 -0
- package/dist/Topic-Dp9Q7Lj2.cjs.map +1 -0
- package/dist/adaptors/aws.cjs +147 -168
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +57 -48
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +58 -49
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +142 -164
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/awsWebsocket.cjs +354 -0
- package/dist/adaptors/awsWebsocket.cjs.map +1 -0
- package/dist/adaptors/awsWebsocket.d.cts +156 -0
- package/dist/adaptors/awsWebsocket.d.cts.map +1 -0
- package/dist/adaptors/awsWebsocket.d.mts +156 -0
- package/dist/adaptors/awsWebsocket.d.mts.map +1 -0
- package/dist/adaptors/awsWebsocket.mjs +347 -0
- package/dist/adaptors/awsWebsocket.mjs.map +1 -0
- package/dist/adaptors/hono.cjs +1 -1
- package/dist/adaptors/hono.d.cts +8 -7
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +10 -9
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +1 -1
- package/dist/adaptors/testing.cjs +1174 -41
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +517 -40
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +517 -40
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +1140 -36
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-BqWz2JxC.d.cts +274 -0
- package/dist/auth-BqWz2JxC.d.cts.map +1 -0
- package/dist/auth-DnB9H9KL.d.mts +274 -0
- package/dist/auth-DnB9H9KL.d.mts.map +1 -0
- package/dist/auth.cjs +308 -23
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +2 -104
- package/dist/auth.d.mts +2 -104
- package/dist/auth.mjs +304 -25
- package/dist/auth.mjs.map +1 -1
- package/dist/cache-CCHcO9Oo.d.mts +44 -0
- package/dist/cache-CCHcO9Oo.d.mts.map +1 -0
- package/dist/cache-CQjMNPrC.d.cts +44 -0
- package/dist/cache-CQjMNPrC.d.cts.map +1 -0
- package/dist/cache.cjs +3 -19
- package/dist/cache.cjs.map +1 -1
- package/dist/cache.d.cts +2 -43
- package/dist/cache.d.mts +2 -43
- package/dist/cache.mjs +2 -18
- package/dist/cache.mjs.map +1 -1
- 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/cipher-DSDxPRIp.d.cts +106 -0
- package/dist/cipher-DSDxPRIp.d.cts.map +1 -0
- package/dist/cipher-DSDxPRIp.d.mts +106 -0
- package/dist/cipher-DSDxPRIp.d.mts.map +1 -0
- package/dist/{construct-interface-DPlxfpoS.d.mts → construct-interface-CSA9VeWM.d.mts} +47 -8
- package/dist/construct-interface-CSA9VeWM.d.mts.map +1 -0
- package/dist/{construct-interface-DgXTJcOD.d.cts → construct-interface-DugP0E5q.d.cts} +47 -8
- package/dist/construct-interface-DugP0E5q.d.cts.map +1 -0
- package/dist/construct-interface.cjs +38 -4
- package/dist/construct-interface.cjs.map +1 -1
- package/dist/construct-interface.d.cts +2 -2
- package/dist/construct-interface.d.mts +2 -2
- package/dist/construct-interface.mjs +37 -5
- package/dist/construct-interface.mjs.map +1 -1
- package/dist/credential-DYymbp_7.cjs +257 -0
- package/dist/credential-DYymbp_7.cjs.map +1 -0
- package/dist/credential-DfSAOOdY.mjs +222 -0
- package/dist/credential-DfSAOOdY.mjs.map +1 -0
- package/dist/credential.cjs +7 -129
- package/dist/credential.d.cts +2 -58
- package/dist/credential.d.mts +2 -58
- package/dist/credential.mjs +2 -128
- package/dist/crons/index.cjs +127 -1
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +43 -3
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +43 -3
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +126 -2
- package/dist/crons/index.mjs.map +1 -1
- package/dist/database/kysely.cjs +3 -194
- package/dist/database/kysely.d.cts +2 -149
- package/dist/database/kysely.d.mts +2 -149
- package/dist/database/kysely.mjs +2 -192
- package/dist/email.cjs +4 -16
- package/dist/email.cjs.map +1 -1
- package/dist/email.d.cts +1 -1
- package/dist/email.d.cts.map +1 -1
- package/dist/email.d.mts +2 -2
- package/dist/email.d.mts.map +1 -1
- package/dist/email.mjs +2 -14
- package/dist/email.mjs.map +1 -1
- package/dist/encryption/kms.cjs +95 -0
- package/dist/encryption/kms.cjs.map +1 -0
- package/dist/encryption/kms.d.cts +7 -0
- package/dist/encryption/kms.d.cts.map +1 -0
- package/dist/encryption/kms.d.mts +7 -0
- package/dist/encryption/kms.d.mts.map +1 -0
- package/dist/encryption/kms.mjs +93 -0
- package/dist/encryption/kms.mjs.map +1 -0
- package/dist/encryption.cjs +116 -0
- package/dist/encryption.cjs.map +1 -0
- package/dist/encryption.d.cts +37 -0
- package/dist/encryption.d.cts.map +1 -0
- package/dist/encryption.d.mts +37 -0
- package/dist/encryption.d.mts.map +1 -0
- package/dist/encryption.mjs +101 -0
- package/dist/encryption.mjs.map +1 -0
- package/dist/endpoints/index.cjs +32 -10
- package/dist/endpoints/index.d.cts +106 -3
- package/dist/endpoints/index.d.cts.map +1 -0
- package/dist/endpoints/index.d.mts +106 -3
- package/dist/endpoints/index.d.mts.map +1 -0
- package/dist/endpoints/index.mjs +6 -4
- package/dist/expire-C586zznE.d.cts +38 -0
- package/dist/expire-C586zznE.d.cts.map +1 -0
- package/dist/expire-C586zznE.d.mts +38 -0
- package/dist/expire-C586zznE.d.mts.map +1 -0
- package/dist/expire-CieftS01.cjs +67 -0
- package/dist/expire-CieftS01.cjs.map +1 -0
- package/dist/expire-CpzUAfr9.mjs +50 -0
- package/dist/expire-CpzUAfr9.mjs.map +1 -0
- package/dist/external-api.cjs +106 -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 +103 -0
- package/dist/external-api.mjs.map +1 -0
- package/dist/fake-BqhP8RRQ.d.mts +201 -0
- package/dist/fake-BqhP8RRQ.d.mts.map +1 -0
- package/dist/fake-DqieDYYA.d.cts +201 -0
- package/dist/fake-DqieDYYA.d.cts.map +1 -0
- package/dist/file-server.cjs +123 -30
- package/dist/file-server.cjs.map +1 -1
- package/dist/file-server.d.cts +115 -1
- package/dist/file-server.d.cts.map +1 -1
- package/dist/file-server.d.mts +115 -1
- package/dist/file-server.d.mts.map +1 -1
- package/dist/file-server.mjs +122 -32
- package/dist/file-server.mjs.map +1 -1
- package/dist/functions/index.cjs +1 -1
- package/dist/functions/index.d.cts +2 -1
- package/dist/functions/index.d.mts +2 -1
- package/dist/functions/index.mjs +1 -1
- package/dist/{functions-C53GW2eQ.mjs → functions-BvIDQKAA.mjs} +117 -22
- package/dist/functions-BvIDQKAA.mjs.map +1 -0
- package/dist/{functions-B6qCvfmy.cjs → functions-DLF6-IK8.cjs} +122 -18
- package/dist/functions-DLF6-IK8.cjs.map +1 -0
- package/dist/inbox-CR3L1fOI.d.cts +195 -0
- package/dist/inbox-CR3L1fOI.d.cts.map +1 -0
- package/dist/inbox-YOdxlyfj.d.mts +195 -0
- package/dist/inbox-YOdxlyfj.d.mts.map +1 -0
- package/dist/inbox.cjs +291 -0
- package/dist/inbox.cjs.map +1 -0
- package/dist/inbox.d.cts +2 -0
- package/dist/inbox.d.mts +2 -0
- package/dist/inbox.mjs +283 -0
- package/dist/inbox.mjs.map +1 -0
- package/dist/index-BoQ3-M-K.d.mts +115 -0
- package/dist/index-BoQ3-M-K.d.mts.map +1 -0
- package/dist/index-DPTHa6Ud.d.cts +115 -0
- package/dist/index-DPTHa6Ud.d.cts.map +1 -0
- package/dist/{index-CeEtxDmK.d.cts → index-DdRjYhiJ.d.cts} +42 -2
- package/dist/{index-CeEtxDmK.d.cts.map → index-DdRjYhiJ.d.cts.map} +1 -1
- package/dist/{index-CeEtxDmK.d.mts → index-DdRjYhiJ.d.mts} +42 -2
- package/dist/{index-CeEtxDmK.d.mts.map → index-DdRjYhiJ.d.mts.map} +1 -1
- package/dist/index.cjs +4 -1
- package/dist/index.d.cts +26 -3
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +26 -3
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -2
- package/dist/kysely-CebjCWTl.d.cts +216 -0
- package/dist/kysely-CebjCWTl.d.cts.map +1 -0
- package/dist/kysely-Cs4uPO8k.mjs +371 -0
- package/dist/kysely-Cs4uPO8k.mjs.map +1 -0
- package/dist/kysely-CukArHJ0.cjs +384 -0
- package/dist/kysely-CukArHJ0.cjs.map +1 -0
- package/dist/kysely-De5rAC-E.d.mts +216 -0
- package/dist/kysely-De5rAC-E.d.mts.map +1 -0
- package/dist/{telemetry-DGcFlVpB.d.cts → lambdaTelemetry-8vnmVZQ5.d.cts} +2 -2
- package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +1 -0
- package/dist/{telemetry-DGcFlVpB.d.mts → lambdaTelemetry-8vnmVZQ5.d.mts} +2 -2
- package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +1 -0
- package/dist/mobile-app.cjs +74 -0
- package/dist/mobile-app.cjs.map +1 -0
- package/dist/mobile-app.d.cts +73 -0
- package/dist/mobile-app.d.cts.map +1 -0
- package/dist/mobile-app.d.mts +73 -0
- package/dist/mobile-app.d.mts.map +1 -0
- package/dist/mobile-app.mjs +73 -0
- package/dist/mobile-app.mjs.map +1 -0
- package/dist/object-storage.cjs +8 -1
- package/dist/object-storage.cjs.map +1 -1
- package/dist/object-storage.d.cts +10 -1
- package/dist/object-storage.d.cts.map +1 -1
- package/dist/object-storage.d.mts +10 -1
- package/dist/object-storage.d.mts.map +1 -1
- package/dist/object-storage.mjs +7 -2
- package/dist/object-storage.mjs.map +1 -1
- package/dist/optionalPeers-D7Wt6dnF.mjs +140 -0
- package/dist/optionalPeers-D7Wt6dnF.mjs.map +1 -0
- package/dist/optionalPeers-DuNQXXe1.cjs +223 -0
- package/dist/optionalPeers-DuNQXXe1.cjs.map +1 -0
- package/dist/origins-BjxYht13.cjs +96 -0
- package/dist/origins-BjxYht13.cjs.map +1 -0
- package/dist/origins-Boc9qbo-.mjs +73 -0
- package/dist/origins-Boc9qbo-.mjs.map +1 -0
- package/dist/pattern-C1CEcglD.mjs +241 -0
- package/dist/pattern-C1CEcglD.mjs.map +1 -0
- package/dist/pattern-QFaUIr77.cjs +288 -0
- package/dist/pattern-QFaUIr77.cjs.map +1 -0
- package/dist/privateAddress-Bg5fUsbp.mjs +21 -0
- package/dist/privateAddress-Bg5fUsbp.mjs.map +1 -0
- package/dist/privateAddress-CqGyuFHn.cjs +26 -0
- package/dist/privateAddress-CqGyuFHn.cjs.map +1 -0
- package/dist/processors/index.cjs +214 -0
- package/dist/processors/index.cjs.map +1 -0
- package/dist/processors/index.d.cts +78 -0
- package/dist/processors/index.d.cts.map +1 -0
- package/dist/processors/index.d.mts +78 -0
- package/dist/processors/index.d.mts.map +1 -0
- package/dist/processors/index.mjs +193 -0
- package/dist/processors/index.mjs.map +1 -0
- package/dist/queue/index.cjs +5 -192
- package/dist/queue/index.d.cts +3 -53
- package/dist/queue/index.d.mts +3 -53
- package/dist/queue/index.mjs +3 -190
- package/dist/random-password.cjs +86 -0
- package/dist/random-password.cjs.map +1 -0
- package/dist/random-password.d.cts +30 -0
- package/dist/random-password.d.cts.map +1 -0
- package/dist/random-password.d.mts +30 -0
- package/dist/random-password.d.mts.map +1 -0
- package/dist/random-password.mjs +84 -0
- package/dist/random-password.mjs.map +1 -0
- package/dist/readRequestBody-BmKnPl0a.mjs +293 -0
- package/dist/readRequestBody-BmKnPl0a.mjs.map +1 -0
- package/dist/{lazyAccessors-Dx9NLwJZ.cjs → readRequestBody-CN9GVdeE.cjs} +141 -47
- package/dist/readRequestBody-CN9GVdeE.cjs.map +1 -0
- package/dist/{processAudits-D_2W5x8k.cjs → requestLogger-CnoYd-Ah.cjs} +63 -3
- package/dist/requestLogger-CnoYd-Ah.cjs.map +1 -0
- package/dist/{processAudits-BpRlPQMW.mjs → requestLogger-D2JS7pPM.mjs} +51 -3
- package/dist/requestLogger-D2JS7pPM.mjs.map +1 -0
- package/dist/rest-api.cjs +85 -70
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +77 -59
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +77 -59
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +87 -72
- package/dist/rest-api.mjs.map +1 -1
- package/dist/runSubscriber-HEqXkin1.mjs +117 -0
- package/dist/runSubscriber-HEqXkin1.mjs.map +1 -0
- package/dist/runSubscriber-sVJfLA0-.cjs +134 -0
- package/dist/runSubscriber-sVJfLA0-.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 +104 -8
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +132 -2
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +132 -2
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +102 -11
- package/dist/site.mjs.map +1 -1
- package/dist/stages-DaTaoQei.d.cts +73 -0
- package/dist/stages-DaTaoQei.d.cts.map +1 -0
- package/dist/stages-DaTaoQei.d.mts +73 -0
- package/dist/stages-DaTaoQei.d.mts.map +1 -0
- package/dist/subscribers/index.cjs +134 -1
- package/dist/subscribers/index.cjs.map +1 -0
- package/dist/subscribers/index.d.cts +74 -3
- package/dist/subscribers/index.d.cts.map +1 -0
- package/dist/subscribers/index.d.mts +74 -3
- package/dist/subscribers/index.d.mts.map +1 -0
- package/dist/subscribers/index.mjs +132 -2
- package/dist/subscribers/index.mjs.map +1 -0
- package/dist/telemetry-C1oqncFY.d.cts +40 -0
- package/dist/telemetry-C1oqncFY.d.cts.map +1 -0
- package/dist/telemetry-CObow3Dn.d.mts +40 -0
- package/dist/telemetry-CObow3Dn.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 +2 -134
- package/dist/topic/index.d.cts +2 -3
- package/dist/topic/index.d.mts +2 -3
- package/dist/topic/index.mjs +2 -132
- package/dist/tracing-Bbj1uoFJ.mjs +127 -0
- package/dist/tracing-Bbj1uoFJ.mjs.map +1 -0
- package/dist/tracing-C0ooU0V2.cjs +150 -0
- package/dist/tracing-C0ooU0V2.cjs.map +1 -0
- package/dist/websocket-api-Bg9SowJ5.mjs +1710 -0
- package/dist/websocket-api-Bg9SowJ5.mjs.map +1 -0
- package/dist/websocket-api-CPEzJyDt.d.mts +1201 -0
- package/dist/websocket-api-CPEzJyDt.d.mts.map +1 -0
- package/dist/websocket-api-DkF8Hva-.d.cts +1201 -0
- package/dist/websocket-api-DkF8Hva-.d.cts.map +1 -0
- package/dist/websocket-api-czxhekGG.cjs +1889 -0
- package/dist/websocket-api-czxhekGG.cjs.map +1 -0
- package/dist/websocket-api.cjs +35 -0
- package/dist/websocket-api.d.cts +2 -0
- package/dist/websocket-api.d.mts +2 -0
- package/dist/websocket-api.mjs +3 -0
- package/dist/worker.cjs +174 -32
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +147 -47
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +147 -47
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +175 -33
- package/dist/worker.mjs.map +1 -1
- package/package.json +180 -43
- package/dist/Construct-BeYVu_QF.mjs.map +0 -1
- package/dist/Construct-DfbwIntp.d.cts +0 -115
- package/dist/Construct-DfbwIntp.d.cts.map +0 -1
- package/dist/Construct-DqdlARxq.cjs.map +0 -1
- package/dist/Construct-l5aOn_jv.d.mts +0 -115
- package/dist/Construct-l5aOn_jv.d.mts.map +0 -1
- package/dist/Cron-l4Wlz6G9.d.mts.map +0 -1
- package/dist/Cron-zsoSAwZo.d.cts.map +0 -1
- package/dist/CronBuilder-BdnI6lxF.cjs.map +0 -1
- package/dist/CronBuilder-CyT71Nzg.d.cts +0 -41
- package/dist/CronBuilder-CyT71Nzg.d.cts.map +0 -1
- package/dist/CronBuilder-D_0HNBTr.mjs.map +0 -1
- package/dist/CronBuilder-UoNgFe8S.d.mts +0 -41
- package/dist/CronBuilder-UoNgFe8S.d.mts.map +0 -1
- package/dist/Endpoint-BpZHtJ2W.cjs +0 -1689
- package/dist/Endpoint-BpZHtJ2W.cjs.map +0 -1
- package/dist/Endpoint-DBflWAe4.d.cts.map +0 -1
- package/dist/Endpoint-ONsly_dq.mjs +0 -1671
- package/dist/Endpoint-ONsly_dq.mjs.map +0 -1
- package/dist/Endpoint-oS-Fe3d_.d.mts.map +0 -1
- package/dist/EndpointFactory-Bm3aKRdV.mjs.map +0 -1
- package/dist/EndpointFactory-CLvWuHyt.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-92zavCsV.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-yYaU7jVJ.mjs.map +0 -1
- package/dist/Queue-D9X6OoON.d.mts.map +0 -1
- package/dist/Queue-DYPB2KWL.d.cts.map +0 -1
- package/dist/Subscriber-C4heaAyO.d.mts +0 -51
- package/dist/Subscriber-C4heaAyO.d.mts.map +0 -1
- package/dist/Subscriber-CotDUELC.d.cts +0 -51
- package/dist/Subscriber-CotDUELC.d.cts.map +0 -1
- package/dist/SubscriberBuilder-BEv0eoHy.d.cts +0 -59
- package/dist/SubscriberBuilder-BEv0eoHy.d.cts.map +0 -1
- package/dist/SubscriberBuilder-C0ZEtGDI.cjs +0 -125
- package/dist/SubscriberBuilder-C0ZEtGDI.cjs.map +0 -1
- package/dist/SubscriberBuilder-h7B_cHMr.mjs +0 -114
- package/dist/SubscriberBuilder-h7B_cHMr.mjs.map +0 -1
- package/dist/SubscriberBuilder-tyH5yTk5.d.mts +0 -59
- package/dist/SubscriberBuilder-tyH5yTk5.d.mts.map +0 -1
- package/dist/Topic-DEVGo0Dm.d.cts +0 -89
- package/dist/Topic-DEVGo0Dm.d.cts.map +0 -1
- package/dist/Topic-zk_6Gthr.d.mts +0 -89
- package/dist/Topic-zk_6Gthr.d.mts.map +0 -1
- package/dist/auth.d.cts.map +0 -1
- package/dist/auth.d.mts.map +0 -1
- package/dist/cache.d.cts.map +0 -1
- package/dist/cache.d.mts.map +0 -1
- package/dist/construct-interface-DPlxfpoS.d.mts.map +0 -1
- package/dist/construct-interface-DgXTJcOD.d.cts.map +0 -1
- package/dist/credential.cjs.map +0 -1
- package/dist/credential.d.cts.map +0 -1
- package/dist/credential.d.mts.map +0 -1
- package/dist/credential.mjs.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-B6qCvfmy.cjs.map +0 -1
- package/dist/functions-C53GW2eQ.mjs.map +0 -1
- package/dist/index-B2urf3YI.d.cts +0 -26
- package/dist/index-B2urf3YI.d.cts.map +0 -1
- package/dist/index-C1ZwNOOk.d.cts.map +0 -1
- package/dist/index-Cc4kKPag.d.mts.map +0 -1
- package/dist/index-DMCDvnsM.d.mts +0 -26
- package/dist/index-DMCDvnsM.d.mts.map +0 -1
- package/dist/index-D_frT6MP.d.cts +0 -165
- package/dist/index-D_frT6MP.d.cts.map +0 -1
- package/dist/index-DcyIYbDS.d.mts +0 -165
- package/dist/index-DcyIYbDS.d.mts.map +0 -1
- package/dist/lazyAccessors-BHtcqgz2.mjs +0 -211
- package/dist/lazyAccessors-BHtcqgz2.mjs.map +0 -1
- package/dist/lazyAccessors-Dx9NLwJZ.cjs.map +0 -1
- package/dist/processAudits-BpRlPQMW.mjs.map +0 -1
- package/dist/processAudits-D_2W5x8k.cjs.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/telemetry-DGcFlVpB.d.cts.map +0 -1
- package/dist/telemetry-DGcFlVpB.d.mts.map +0 -1
- package/dist/topic/index.cjs.map +0 -1
- package/dist/topic/index.mjs.map +0 -1
|
@@ -1,149 +1,2 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
|
|
3
|
-
import { ConstructName, Declaration, PostgresVersion } from "@geekmidas/manifest";
|
|
4
|
-
import { Kysely, KyselyConfig } from "kysely";
|
|
5
|
-
import { Service } from "@geekmidas/services";
|
|
6
|
-
//#region src/database/kysely.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* Everything Kysely takes, plus what this construct declares.
|
|
9
|
-
*
|
|
10
|
-
* `dialect` is omitted because the construct owns it — it is built from the one
|
|
11
|
-
* URL the adapter supplied, which is the whole point of the construct. The rest
|
|
12
|
-
* of `KyselyConfig` (`plugins`, `log`) is the app's business and passes
|
|
13
|
-
* straight through, so anything Kysely adds later arrives without being
|
|
14
|
-
* tracked here.
|
|
15
|
-
*/
|
|
16
|
-
export interface KyselyDatabaseOptions extends Omit<KyselyConfig, 'dialect'> {
|
|
17
|
-
/**
|
|
18
|
-
* The schema, pinned on both roles' `search_path`.
|
|
19
|
-
*
|
|
20
|
-
* Defaults to `app` — the role the schema plays, rather than a restatement
|
|
21
|
-
* of the database's own name, which reads correctly beside `auth` and
|
|
22
|
-
* `pgboss` and keeps the application off `public`.
|
|
23
|
-
*/
|
|
24
|
-
schema?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Provision the owner/runtime role split. Defaults to on.
|
|
27
|
-
*
|
|
28
|
-
* Off falls back to the cluster's master credential in both URLs, giving up
|
|
29
|
-
* the DDL/DML split and putting credentials that can drop a table into the
|
|
30
|
-
* function's environment. A deliberate downgrade, not a default.
|
|
31
|
-
*/
|
|
32
|
-
roles?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* The Postgres major version to provision.
|
|
35
|
-
*
|
|
36
|
-
* Declared here so one statement reaches both targets. It was previously
|
|
37
|
-
* set in two unrelated places — a container tag locally, nothing at all on
|
|
38
|
-
* AWS (so Aurora chose) — which is how local came to run 18 while deployed
|
|
39
|
-
* ran 17.7 with nothing recording the difference.
|
|
40
|
-
*
|
|
41
|
-
* Defaults to {@link DEFAULT_POSTGRES_VERSION}.
|
|
42
|
-
*/
|
|
43
|
-
version?: PostgresVersion;
|
|
44
|
-
}
|
|
45
|
-
/** What makes a construct derived rather than a database in its own right. */
|
|
46
|
-
interface DerivedFrom {
|
|
47
|
-
kind: 'database-reader' | 'database-schema';
|
|
48
|
-
of: string;
|
|
49
|
-
schema?: string;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* @typeParam DB - the database's schema.
|
|
53
|
-
* @typeParam TName - the canonical id. TypeScript has no partial
|
|
54
|
-
* type-argument inference, so `new KyselyDatabase<OrdersDB>('orders')` leaves
|
|
55
|
-
* this at its default and the service key widens to `string`. `db` still types
|
|
56
|
-
* through `.database()`, which infers from the service.
|
|
57
|
-
*/
|
|
58
|
-
export declare class KyselyDatabase<DB = unknown, TName extends string = string> implements Construct<TName, Kysely<DB>> {
|
|
59
|
-
private readonly options;
|
|
60
|
-
readonly id: TName;
|
|
61
|
-
readonly service: Service<Uncapitalize<TName>, Kysely<DB>>;
|
|
62
|
-
/**
|
|
63
|
-
* Declared once and read by both `declare()` and `connect()`, so the key the
|
|
64
|
-
* build publishes and the key the client reads cannot drift.
|
|
65
|
-
*/
|
|
66
|
-
private readonly config;
|
|
67
|
-
private readonly schemaName;
|
|
68
|
-
private readonly roles;
|
|
69
|
-
private readonly version;
|
|
70
|
-
private readonly derivedFrom?;
|
|
71
|
-
constructor(id: ConstructName<TName>, options?: KyselyDatabaseOptions, derivedFrom?: DerivedFrom);
|
|
72
|
-
declare(): Declaration[];
|
|
73
|
-
/**
|
|
74
|
-
* A read-only endpoint on this database.
|
|
75
|
-
*
|
|
76
|
-
* Read-only is enforced by the reader role's grants rather than by which
|
|
77
|
-
* endpoint it resolves to, so falling back to the writer where no replica
|
|
78
|
-
* exists is safe rather than a silently writable connection behind a name
|
|
79
|
-
* that says reader. There is no `writer()`: the database *is* the writer, so
|
|
80
|
-
* a replica can never be reached by accident.
|
|
81
|
-
*
|
|
82
|
-
* The return type is narrower than this class on purpose — see
|
|
83
|
-
* {@link ReadOnlyDatabase}.
|
|
84
|
-
*/
|
|
85
|
-
reader(): ReadOnlyDatabase<DB, `${TName}Reader`>;
|
|
86
|
-
/**
|
|
87
|
-
* A cache that lives in this database.
|
|
88
|
-
*
|
|
89
|
-
* The same strengthening `schema()` is over a second database: `new
|
|
90
|
-
* Cache('Sessions')` says the app caches and leaves where to the deployment,
|
|
91
|
-
* while this says it caches *here* — which is a fact about the application
|
|
92
|
-
* and so belongs in its code.
|
|
93
|
-
*
|
|
94
|
-
* What it buys beyond being explicit: the table's schema and the role that
|
|
95
|
-
* reaches it come from this database rather than from a second convention,
|
|
96
|
-
* and the backend no longer has to guess which database "the database" meant
|
|
97
|
-
* when an app declares two.
|
|
98
|
-
*
|
|
99
|
-
* A cache is not a `KyselyDatabase`, so this returns a `Cache` — the client
|
|
100
|
-
* is a key/value store, not a query builder, and typing it as the parent
|
|
101
|
-
* would be a convenience that lies.
|
|
102
|
-
*/
|
|
103
|
-
cache<TCache extends string = `${TName}Cache`>(id?: ConstructName<TCache>, options?: {
|
|
104
|
-
table?: string;
|
|
105
|
-
}): Cache<TCache>;
|
|
106
|
-
/**
|
|
107
|
-
* A second schema in this database, with its own role(s) and its own URL —
|
|
108
|
-
* so this database's role holds no grant on those tables at all.
|
|
109
|
-
*
|
|
110
|
-
* Typed separately because a tenant has its own tables: the point is that
|
|
111
|
-
* `auth.selectFrom('sessions')` type-checks and
|
|
112
|
-
* `orders.selectFrom('sessions')` does not.
|
|
113
|
-
*/
|
|
114
|
-
schema<TenantDB, TTenant extends string>(id: ConstructName<TTenant>, options?: KyselyDatabaseOptions): KyselyDatabase<TenantDB, TTenant>;
|
|
115
|
-
/**
|
|
116
|
-
* A connection as the *owner* role — the one that may create, alter and drop.
|
|
117
|
-
*
|
|
118
|
-
* A `Service` rather than part of the construct, and deliberately so: a
|
|
119
|
-
* construct is what `.dependsOn()` accepts, and nothing should be able to
|
|
120
|
-
* depend on this. A migrator asks for it by name; a handler cannot ask at
|
|
121
|
-
* all, which is the security property the role split exists for.
|
|
122
|
-
*
|
|
123
|
-
* Falls back to the runtime URL where no owner URL was published — the
|
|
124
|
-
* `roles: false` downgrade, where there is only one credential and it is the
|
|
125
|
-
* cluster master's.
|
|
126
|
-
*/
|
|
127
|
-
get owner(): Service<`${Uncapitalize<TName>}Owner`, Kysely<DB>>;
|
|
128
|
-
private connect;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* A database you may read through, and derive nothing from.
|
|
132
|
-
*
|
|
133
|
-
* A reader is terminal in the graph, and this is that fact in the type system.
|
|
134
|
-
* `DERIVES_FROM` gives `cache` and `database-schema` no `database-reader`
|
|
135
|
-
* parent, and there is no reader of a reader — so `orders.reader().cache(…)`
|
|
136
|
-
* has always been illegal, but it type-checked and failed later at
|
|
137
|
-
* `assertDerivations`. That is a long way round to learn that a read-only
|
|
138
|
-
* endpoint cannot own a table something writes to.
|
|
139
|
-
*
|
|
140
|
-
* Omitting the three deriving methods rather than making them throw keeps the
|
|
141
|
-
* failure where it costs least: the editor, on the line that wrote it.
|
|
142
|
-
*
|
|
143
|
-
* The result is deliberately not assignable back to `KyselyDatabase` — a
|
|
144
|
-
* reader is not one, and anything that genuinely needs the writer should say
|
|
145
|
-
* so.
|
|
146
|
-
*/
|
|
147
|
-
export type ReadOnlyDatabase<DB, TName extends string> = Omit<KyselyDatabase<DB, TName>, 'reader' | 'cache' | 'schema'>;
|
|
148
|
-
//#endregion
|
|
149
|
-
//# sourceMappingURL=kysely.d.mts.map
|
|
1
|
+
import { a as closeDatabasePools, i as ReadOnlyDatabase, n as KyselyDatabaseOptions, r as PostgresRuntime, t as KyselyDatabase } from "../kysely-De5rAC-E.mjs";
|
|
2
|
+
export { KyselyDatabase, KyselyDatabaseOptions, PostgresRuntime, ReadOnlyDatabase, closeDatabasePools };
|
package/dist/database/kysely.mjs
CHANGED
|
@@ -1,192 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Kysely, PostgresDialect } from "kysely";
|
|
4
|
-
import pg from "pg";
|
|
5
|
-
//#region src/database/kysely.ts
|
|
6
|
-
/**
|
|
7
|
-
* `KyselyDatabase` — a declared Postgres database, typed by its schema.
|
|
8
|
-
*
|
|
9
|
-
* It declares a logical database, a schema, and the roles that reach it, and
|
|
10
|
-
* hands back a Kysely client built from the one URL the adapter supplied. It
|
|
11
|
-
* names no cloud: `--target=aws` fills that URL from RDS, local dev from the
|
|
12
|
-
* Postgres container.
|
|
13
|
-
*
|
|
14
|
-
* Transactions and RLS context are the execution wrapper's job — it opens the
|
|
15
|
-
* transaction and puts it in `ctx.db`. This construct does not resolve
|
|
16
|
-
* connections per request.
|
|
17
|
-
*/
|
|
18
|
-
/** The schema a database uses when it does not say otherwise. */
|
|
19
|
-
const DEFAULT_SCHEMA = "app";
|
|
20
|
-
/**
|
|
21
|
-
* @typeParam DB - the database's schema.
|
|
22
|
-
* @typeParam TName - the canonical id. TypeScript has no partial
|
|
23
|
-
* type-argument inference, so `new KyselyDatabase<OrdersDB>('orders')` leaves
|
|
24
|
-
* this at its default and the service key widens to `string`. `db` still types
|
|
25
|
-
* through `.database()`, which infers from the service.
|
|
26
|
-
*/
|
|
27
|
-
var KyselyDatabase = class KyselyDatabase {
|
|
28
|
-
options;
|
|
29
|
-
id;
|
|
30
|
-
service;
|
|
31
|
-
/**
|
|
32
|
-
* Declared once and read by both `declare()` and `connect()`, so the key the
|
|
33
|
-
* build publishes and the key the client reads cannot drift.
|
|
34
|
-
*/
|
|
35
|
-
config;
|
|
36
|
-
schemaName;
|
|
37
|
-
roles;
|
|
38
|
-
version;
|
|
39
|
-
derivedFrom;
|
|
40
|
-
constructor(id, options = {}, derivedFrom) {
|
|
41
|
-
this.options = options;
|
|
42
|
-
const canonical = canonicalId(id);
|
|
43
|
-
this.id = canonical;
|
|
44
|
-
this.config = {
|
|
45
|
-
url: provideKey(canonical, "url"),
|
|
46
|
-
ownerUrl: provideKey(canonical, "ownerUrl")
|
|
47
|
-
};
|
|
48
|
-
this.schemaName = options.schema ?? DEFAULT_SCHEMA;
|
|
49
|
-
this.roles = options.roles ?? true;
|
|
50
|
-
this.version = options.version ?? DEFAULT_POSTGRES_VERSION;
|
|
51
|
-
this.derivedFrom = derivedFrom;
|
|
52
|
-
this.service = {
|
|
53
|
-
serviceName: serviceKey(canonical),
|
|
54
|
-
register: (registerOptions) => this.connect(registerOptions)
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
declare() {
|
|
58
|
-
if (this.derivedFrom) {
|
|
59
|
-
const { kind, of, schema } = this.derivedFrom;
|
|
60
|
-
return [kind === "database-schema" ? {
|
|
61
|
-
kind,
|
|
62
|
-
id: this.id,
|
|
63
|
-
of,
|
|
64
|
-
schema: schema ?? this.schemaName,
|
|
65
|
-
provides: [this.config.url]
|
|
66
|
-
} : {
|
|
67
|
-
kind,
|
|
68
|
-
id: this.id,
|
|
69
|
-
of,
|
|
70
|
-
provides: [this.config.url]
|
|
71
|
-
}];
|
|
72
|
-
}
|
|
73
|
-
return [{
|
|
74
|
-
kind: "database",
|
|
75
|
-
id: this.id,
|
|
76
|
-
engine: "postgres",
|
|
77
|
-
schema: this.schemaName,
|
|
78
|
-
version: this.version,
|
|
79
|
-
provides: [this.config.url],
|
|
80
|
-
...this.roles ? {} : { roles: false }
|
|
81
|
-
}];
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* A read-only endpoint on this database.
|
|
85
|
-
*
|
|
86
|
-
* Read-only is enforced by the reader role's grants rather than by which
|
|
87
|
-
* endpoint it resolves to, so falling back to the writer where no replica
|
|
88
|
-
* exists is safe rather than a silently writable connection behind a name
|
|
89
|
-
* that says reader. There is no `writer()`: the database *is* the writer, so
|
|
90
|
-
* a replica can never be reached by accident.
|
|
91
|
-
*
|
|
92
|
-
* The return type is narrower than this class on purpose — see
|
|
93
|
-
* {@link ReadOnlyDatabase}.
|
|
94
|
-
*/
|
|
95
|
-
reader() {
|
|
96
|
-
return new KyselyDatabase(`${this.id}Reader`, this.options, {
|
|
97
|
-
kind: "database-reader",
|
|
98
|
-
of: this.id
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* A cache that lives in this database.
|
|
103
|
-
*
|
|
104
|
-
* The same strengthening `schema()` is over a second database: `new
|
|
105
|
-
* Cache('Sessions')` says the app caches and leaves where to the deployment,
|
|
106
|
-
* while this says it caches *here* — which is a fact about the application
|
|
107
|
-
* and so belongs in its code.
|
|
108
|
-
*
|
|
109
|
-
* What it buys beyond being explicit: the table's schema and the role that
|
|
110
|
-
* reaches it come from this database rather than from a second convention,
|
|
111
|
-
* and the backend no longer has to guess which database "the database" meant
|
|
112
|
-
* when an app declares two.
|
|
113
|
-
*
|
|
114
|
-
* A cache is not a `KyselyDatabase`, so this returns a `Cache` — the client
|
|
115
|
-
* is a key/value store, not a query builder, and typing it as the parent
|
|
116
|
-
* would be a convenience that lies.
|
|
117
|
-
*/
|
|
118
|
-
cache(id = `${this.id}Cache`, options = {}) {
|
|
119
|
-
return new Cache(id, {
|
|
120
|
-
of: this.id,
|
|
121
|
-
...options.table ? { table: options.table } : {}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* A second schema in this database, with its own role(s) and its own URL —
|
|
126
|
-
* so this database's role holds no grant on those tables at all.
|
|
127
|
-
*
|
|
128
|
-
* Typed separately because a tenant has its own tables: the point is that
|
|
129
|
-
* `auth.selectFrom('sessions')` type-checks and
|
|
130
|
-
* `orders.selectFrom('sessions')` does not.
|
|
131
|
-
*/
|
|
132
|
-
schema(id, options = {}) {
|
|
133
|
-
return new KyselyDatabase(id, options, {
|
|
134
|
-
kind: "database-schema",
|
|
135
|
-
of: this.id,
|
|
136
|
-
schema: options.schema ?? id.toLowerCase()
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* A connection as the *owner* role — the one that may create, alter and drop.
|
|
141
|
-
*
|
|
142
|
-
* A `Service` rather than part of the construct, and deliberately so: a
|
|
143
|
-
* construct is what `.dependsOn()` accepts, and nothing should be able to
|
|
144
|
-
* depend on this. A migrator asks for it by name; a handler cannot ask at
|
|
145
|
-
* all, which is the security property the role split exists for.
|
|
146
|
-
*
|
|
147
|
-
* Falls back to the runtime URL where no owner URL was published — the
|
|
148
|
-
* `roles: false` downgrade, where there is only one credential and it is the
|
|
149
|
-
* cluster master's.
|
|
150
|
-
*/
|
|
151
|
-
get owner() {
|
|
152
|
-
return {
|
|
153
|
-
serviceName: `${serviceKey(this.id)}Owner`,
|
|
154
|
-
register: (options) => this.connect(options, { owner: true })
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
async connect(options, as = {}) {
|
|
158
|
-
const { url, ownerUrl } = options.envParser.create((get) => ({
|
|
159
|
-
url: get(this.config.url).string(),
|
|
160
|
-
ownerUrl: get(this.config.ownerUrl).string().optional()
|
|
161
|
-
})).parse();
|
|
162
|
-
const { schema: _schema, roles: _roles, ...kysely } = this.options;
|
|
163
|
-
return new Kysely({
|
|
164
|
-
...kysely,
|
|
165
|
-
dialect: new PostgresDialect({ pool: pool(as.owner ? ownerUrl ?? url : url) })
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
/**
|
|
170
|
-
* A pool for one URL, with its schema actually on the search path.
|
|
171
|
-
*
|
|
172
|
-
* `?search_path=` is not a libpq parameter — a URL carrying it connects
|
|
173
|
-
* happily and then resolves every unqualified name against `public`, which is
|
|
174
|
-
* how a schema tenant silently writes its tables into the database it was
|
|
175
|
-
* separated from. Postgres takes it as a startup option instead, so the URL
|
|
176
|
-
* keeps the readable form the target derives and this turns it into the thing
|
|
177
|
-
* the server understands.
|
|
178
|
-
*/
|
|
179
|
-
function pool(url) {
|
|
180
|
-
const parsed = new URL(url);
|
|
181
|
-
const searchPath = parsed.searchParams.get("search_path");
|
|
182
|
-
if (!searchPath) return new pg.Pool({ connectionString: url });
|
|
183
|
-
parsed.searchParams.delete("search_path");
|
|
184
|
-
return new pg.Pool({
|
|
185
|
-
connectionString: parsed.toString(),
|
|
186
|
-
options: `-c search_path=${searchPath}`
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
//#endregion
|
|
190
|
-
export { KyselyDatabase };
|
|
191
|
-
|
|
192
|
-
//# sourceMappingURL=kysely.mjs.map
|
|
1
|
+
import { n as closeDatabasePools, t as KyselyDatabase } from "../kysely-Cs4uPO8k.mjs";
|
|
2
|
+
export { KyselyDatabase, closeDatabasePools };
|
package/dist/email.cjs
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_optionalPeers = require("./optionalPeers-DuNQXXe1.cjs");
|
|
2
3
|
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
3
|
-
let _geekmidas_emailkit = require("@geekmidas/emailkit");
|
|
4
4
|
//#region src/email.ts
|
|
5
|
-
/**
|
|
6
|
-
* `Email` — declared outbound mail.
|
|
7
|
-
*
|
|
8
|
-
* The same three-package meeting point as `ObjectStorage`: it implements the
|
|
9
|
-
* construct contract, derives its env key through `@geekmidas/manifest`, and
|
|
10
|
-
* hands back an `@geekmidas/emailkit` client. It names no provider — locally the
|
|
11
|
-
* injected URL points at Mailpit, deployed it points at SES or whichever service
|
|
12
|
-
* config selected.
|
|
13
|
-
*
|
|
14
|
-
* Where object storage needs a driver per provider, this needs none: mail is
|
|
15
|
-
* delivered over SMTP whoever delivers it, so there is one client and one URL
|
|
16
|
-
* shape, and the provider survives only as a host and a credential.
|
|
17
|
-
*/
|
|
18
5
|
var Email = class {
|
|
19
6
|
options;
|
|
20
7
|
id;
|
|
@@ -56,8 +43,9 @@ var Email = class {
|
|
|
56
43
|
url: get(this.keys.url).string(),
|
|
57
44
|
from: get(this.keys.from).string()
|
|
58
45
|
})).parse();
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
const { createEmailClient, parseEmailUrl } = await require_optionalPeers.loadEmailkit();
|
|
47
|
+
return createEmailClient({
|
|
48
|
+
smtp: parseEmailUrl(url),
|
|
61
49
|
templates: this.options.templates,
|
|
62
50
|
defaults: {
|
|
63
51
|
from,
|
package/dist/email.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.cjs","names":["canonicalId","provideKey","serviceKey","
|
|
1
|
+
{"version":3,"file":"email.cjs","names":["canonicalId","provideKey","serviceKey","loadEmailkit"],"sources":["../src/email.ts"],"sourcesContent":["/**\n * `Email` — declared outbound mail.\n *\n * The same three-package meeting point as `ObjectStorage`: it implements the\n * construct contract, derives its env key through `@geekmidas/manifest`, and\n * hands back an `@geekmidas/emailkit` client. It names no provider — locally the\n * injected URL points at Mailpit, deployed it points at SES or whichever service\n * config selected.\n *\n * Where object storage needs a driver per provider, this needs none: mail is\n * delivered over SMTP whoever delivers it, so there is one client and one URL\n * shape, and the provider survives only as a host and a credential.\n */\n\nimport type { EmailClient, TemplateRecord } from '@geekmidas/emailkit';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\nimport { loadEmailkit } from './optionalPeers';\n\nexport interface EmailOptions<TTemplates extends TemplateRecord> {\n\t/**\n\t * The React templates this app can send.\n\t *\n\t * Structural — they are code, they ship with the handler, and which ones\n\t * exist cannot differ between stages. They are also what types\n\t * `sendTemplate`, so passing them here is what makes the client's call sites\n\t * checkable.\n\t */\n\ttemplates: TTemplates;\n\t/**\n\t * A reply-to address for every send.\n\t *\n\t * `from` is deliberately absent: it belongs to the verified sending domain,\n\t * which is `myapp.test` locally and the real domain deployed, so it arrives\n\t * as stage config rather than being written here.\n\t */\n\treplyTo?: string;\n}\n\nexport class Email<\n\tTName extends string = string,\n\tTTemplates extends TemplateRecord = TemplateRecord,\n> implements Construct<TName, EmailClient<TTemplates>>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, EmailClient<TTemplates>>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly keys: { url: string; from: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: EmailOptions<TTemplates>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = {\n\t\t\turl: provideKey(canonical, 'url'),\n\t\t\t// The sending identity travels with the URL rather than being a second\n\t\t\t// construct option, for the same reason the URL does: it is the one\n\t\t\t// thing about mail that differs per stage.\n\t\t\tfrom: provideKey(canonical, 'from'),\n\t\t};\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 [\n\t\t\t{\n\t\t\t\tkind: 'email',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url, this.keys.from],\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the URL the adapter supplied.\n\t *\n\t * No provider branch and no driver lookup — `parseEmailUrl` turns any of\n\t * Mailpit, SES, or Resend into the same transport config, which is the whole\n\t * reason the scheme is always `smtp://`.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<EmailClient<TTemplates>> {\n\t\tconst { url, from } = envParser\n\t\t\t.create((get) => ({\n\t\t\t\turl: get(this.keys.url).string(),\n\t\t\t\tfrom: get(this.keys.from).string(),\n\t\t\t}))\n\t\t\t.parse();\n\n\t\t// Loaded here, not at the top: the test harness names this construct in\n\t\t// every app, and an app that sends no mail does not install emailkit.\n\t\tconst { createEmailClient, parseEmailUrl } = await loadEmailkit();\n\t\treturn createEmailClient({\n\t\t\tsmtp: parseEmailUrl(url),\n\t\t\ttemplates: this.options.templates,\n\t\t\tdefaults: {\n\t\t\t\tfrom,\n\t\t\t\t...(this.options.replyTo ? { replyTo: this.options.replyTo } : {}),\n\t\t\t},\n\t\t});\n\t}\n}\n"],"mappings":";;;;AA8CA,IAAa,QAAb,MAIA;CAYmB;CAXlB;CACA;;;;;CAMA;CAEA,YACC,IACA,SACC;EADgB,KAAA,UAAA;EAEjB,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO;GACX,MAAA,GAAKC,oBAAAA,WAAAA,CAAW,WAAW,KAAK;GAIhC,OAAA,GAAMA,oBAAAA,WAAAA,CAAW,WAAW,MAAM;EACnC;EAGA,KAAK,UAAU;GACd,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI;EACzC,CACD;CACD;;;;;;;;CASA,MAAc,QAAQ,EACrB,aAC4D;EAC5D,MAAM,EAAE,KAAK,SAAS,UACpB,QAAQ,SAAS;GACjB,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO;GAC/B,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,OAAO;EAClC,EAAE,CAAC,CACF,MAAM;EAIR,MAAM,EAAE,mBAAmB,kBAAkB,MAAMC,sBAAAA,aAAa;EAChE,OAAO,kBAAkB;GACxB,MAAM,cAAc,GAAG;GACvB,WAAW,KAAK,QAAQ;GACxB,UAAU;IACT;IACA,GAAI,KAAK,QAAQ,UAAU,EAAE,SAAS,KAAK,QAAQ,QAAQ,IAAI,CAAC;GACjE;EACD,CAAC;CACF;AACD"}
|
package/dist/email.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as Construct } from "./construct-interface-DugP0E5q.cjs";
|
|
2
2
|
import { Service } from "@geekmidas/services";
|
|
3
3
|
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
4
4
|
import { EmailClient, TemplateRecord } from "@geekmidas/emailkit";
|
package/dist/email.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.cts","names":[],"sources":["../src/email.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"email.d.cts","names":[],"sources":["../src/email.ts"],"mappings":";;;;;iBA0BiB,aAAa,mBAAmB;;;;;;;;;EAShD,WAAW;;;;;;;;EAQX;;qBAGY,MACZ,+BACA,mBAAmB,iBAAiB,2BACxB,UAAU,OAAO,YAAY;mBAavB;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ,YAAY;;;;;mBAM1C;EAEjB,YACC,IAAI,cAAc,QACD,SAAS,aAAa;EAoBxC,WAAW;;;;;;;;UAiBG"}
|
package/dist/email.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as Construct } from "./construct-interface-CSA9VeWM.mjs";
|
|
2
2
|
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
3
|
-
import { EmailClient, TemplateRecord } from "@geekmidas/emailkit";
|
|
4
3
|
import { Service } from "@geekmidas/services";
|
|
4
|
+
import { EmailClient, TemplateRecord } from "@geekmidas/emailkit";
|
|
5
5
|
//#region src/email.d.ts
|
|
6
6
|
export interface EmailOptions<TTemplates extends TemplateRecord> {
|
|
7
7
|
/**
|
package/dist/email.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.mts","names":[],"sources":["../src/email.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"email.d.mts","names":[],"sources":["../src/email.ts"],"mappings":";;;;;iBA0BiB,aAAa,mBAAmB;;;;;;;;;EAShD,WAAW;;;;;;;;EAQX;;qBAGY,MACZ,+BACA,mBAAmB,iBAAiB,2BACxB,UAAU,OAAO,YAAY;mBAavB;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ,YAAY;;;;;mBAM1C;EAEjB,YACC,IAAI,cAAc,QACD,SAAS,aAAa;EAoBxC,WAAW;;;;;;;;UAiBG"}
|
package/dist/email.mjs
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
|
+
import { s as loadEmailkit } from "./optionalPeers-D7Wt6dnF.mjs";
|
|
1
2
|
import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
2
|
-
import { createEmailClient, parseEmailUrl } from "@geekmidas/emailkit";
|
|
3
3
|
//#region src/email.ts
|
|
4
|
-
/**
|
|
5
|
-
* `Email` — declared outbound mail.
|
|
6
|
-
*
|
|
7
|
-
* The same three-package meeting point as `ObjectStorage`: it implements the
|
|
8
|
-
* construct contract, derives its env key through `@geekmidas/manifest`, and
|
|
9
|
-
* hands back an `@geekmidas/emailkit` client. It names no provider — locally the
|
|
10
|
-
* injected URL points at Mailpit, deployed it points at SES or whichever service
|
|
11
|
-
* config selected.
|
|
12
|
-
*
|
|
13
|
-
* Where object storage needs a driver per provider, this needs none: mail is
|
|
14
|
-
* delivered over SMTP whoever delivers it, so there is one client and one URL
|
|
15
|
-
* shape, and the provider survives only as a host and a credential.
|
|
16
|
-
*/
|
|
17
4
|
var Email = class {
|
|
18
5
|
options;
|
|
19
6
|
id;
|
|
@@ -55,6 +42,7 @@ var Email = class {
|
|
|
55
42
|
url: get(this.keys.url).string(),
|
|
56
43
|
from: get(this.keys.from).string()
|
|
57
44
|
})).parse();
|
|
45
|
+
const { createEmailClient, parseEmailUrl } = await loadEmailkit();
|
|
58
46
|
return createEmailClient({
|
|
59
47
|
smtp: parseEmailUrl(url),
|
|
60
48
|
templates: this.options.templates,
|
package/dist/email.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.mjs","names":[],"sources":["../src/email.ts"],"sourcesContent":["/**\n * `Email` — declared outbound mail.\n *\n * The same three-package meeting point as `ObjectStorage`: it implements the\n * construct contract, derives its env key through `@geekmidas/manifest`, and\n * hands back an `@geekmidas/emailkit` client. It names no provider — locally the\n * injected URL points at Mailpit, deployed it points at SES or whichever service\n * config selected.\n *\n * Where object storage needs a driver per provider, this needs none: mail is\n * delivered over SMTP whoever delivers it, so there is one client and one URL\n * shape, and the provider survives only as a host and a credential.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"email.mjs","names":[],"sources":["../src/email.ts"],"sourcesContent":["/**\n * `Email` — declared outbound mail.\n *\n * The same three-package meeting point as `ObjectStorage`: it implements the\n * construct contract, derives its env key through `@geekmidas/manifest`, and\n * hands back an `@geekmidas/emailkit` client. It names no provider — locally the\n * injected URL points at Mailpit, deployed it points at SES or whichever service\n * config selected.\n *\n * Where object storage needs a driver per provider, this needs none: mail is\n * delivered over SMTP whoever delivers it, so there is one client and one URL\n * shape, and the provider survives only as a host and a credential.\n */\n\nimport type { EmailClient, TemplateRecord } from '@geekmidas/emailkit';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\nimport { loadEmailkit } from './optionalPeers';\n\nexport interface EmailOptions<TTemplates extends TemplateRecord> {\n\t/**\n\t * The React templates this app can send.\n\t *\n\t * Structural — they are code, they ship with the handler, and which ones\n\t * exist cannot differ between stages. They are also what types\n\t * `sendTemplate`, so passing them here is what makes the client's call sites\n\t * checkable.\n\t */\n\ttemplates: TTemplates;\n\t/**\n\t * A reply-to address for every send.\n\t *\n\t * `from` is deliberately absent: it belongs to the verified sending domain,\n\t * which is `myapp.test` locally and the real domain deployed, so it arrives\n\t * as stage config rather than being written here.\n\t */\n\treplyTo?: string;\n}\n\nexport class Email<\n\tTName extends string = string,\n\tTTemplates extends TemplateRecord = TemplateRecord,\n> implements Construct<TName, EmailClient<TTemplates>>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, EmailClient<TTemplates>>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly keys: { url: string; from: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: EmailOptions<TTemplates>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = {\n\t\t\turl: provideKey(canonical, 'url'),\n\t\t\t// The sending identity travels with the URL rather than being a second\n\t\t\t// construct option, for the same reason the URL does: it is the one\n\t\t\t// thing about mail that differs per stage.\n\t\t\tfrom: provideKey(canonical, 'from'),\n\t\t};\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 [\n\t\t\t{\n\t\t\t\tkind: 'email',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url, this.keys.from],\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the URL the adapter supplied.\n\t *\n\t * No provider branch and no driver lookup — `parseEmailUrl` turns any of\n\t * Mailpit, SES, or Resend into the same transport config, which is the whole\n\t * reason the scheme is always `smtp://`.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<EmailClient<TTemplates>> {\n\t\tconst { url, from } = envParser\n\t\t\t.create((get) => ({\n\t\t\t\turl: get(this.keys.url).string(),\n\t\t\t\tfrom: get(this.keys.from).string(),\n\t\t\t}))\n\t\t\t.parse();\n\n\t\t// Loaded here, not at the top: the test harness names this construct in\n\t\t// every app, and an app that sends no mail does not install emailkit.\n\t\tconst { createEmailClient, parseEmailUrl } = await loadEmailkit();\n\t\treturn createEmailClient({\n\t\t\tsmtp: parseEmailUrl(url),\n\t\t\ttemplates: this.options.templates,\n\t\t\tdefaults: {\n\t\t\t\tfrom,\n\t\t\t\t...(this.options.replyTo ? { replyTo: this.options.replyTo } : {}),\n\t\t\t},\n\t\t});\n\t}\n}\n"],"mappings":";;;AA8CA,IAAa,QAAb,MAIA;CAYmB;CAXlB;CACA;;;;;CAMA;CAEA,YACC,IACA,SACC;EADgB,KAAA,UAAA;EAEjB,MAAM,YAAY,YAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO;GACX,KAAK,WAAW,WAAW,KAAK;GAIhC,MAAM,WAAW,WAAW,MAAM;EACnC;EAGA,KAAK,UAAU;GACd,aAAa,WAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI;EACzC,CACD;CACD;;;;;;;;CASA,MAAc,QAAQ,EACrB,aAC4D;EAC5D,MAAM,EAAE,KAAK,SAAS,UACpB,QAAQ,SAAS;GACjB,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO;GAC/B,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,OAAO;EAClC,EAAE,CAAC,CACF,MAAM;EAIR,MAAM,EAAE,mBAAmB,kBAAkB,MAAM,aAAa;EAChE,OAAO,kBAAkB;GACxB,MAAM,cAAc,GAAG;GACvB,WAAW,KAAK,QAAQ;GACxB,UAAU;IACT;IACA,GAAI,KAAK,QAAQ,UAAU,EAAE,SAAS,KAAK,QAAQ,QAAQ,IAAI,CAAC;GACjE;EACD,CAAC;CACF;AACD"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_cipher = require("../cipher-CVxfwLjk.cjs");
|
|
3
|
+
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
4
|
+
let _aws_sdk_client_kms = require("@aws-sdk/client-kms");
|
|
5
|
+
//#region src/encryption/kms.ts
|
|
6
|
+
/**
|
|
7
|
+
* The `kms://` cipher: envelope encryption under an AWS KMS key.
|
|
8
|
+
*
|
|
9
|
+
* Each `encrypt` asks KMS for a fresh data key, seals the plaintext with it
|
|
10
|
+
* locally, and stores the data key *as KMS encrypted it* beside the data. The
|
|
11
|
+
* plaintext data key is used once and dropped, and the master key never leaves
|
|
12
|
+
* KMS — every decrypt is a KMS call IAM can refuse and CloudTrail records.
|
|
13
|
+
*
|
|
14
|
+
* Rotation is KMS's: it keeps every backing version of the key, and the
|
|
15
|
+
* encrypted data key names the one that wrapped it, so nothing here tracks a
|
|
16
|
+
* version and `reencrypt` has nothing to move. The ciphertext's key field is
|
|
17
|
+
* `kms` for that reason.
|
|
18
|
+
*
|
|
19
|
+
* The blind index is a KMS HMAC key's `GenerateMac`: deterministic, and the
|
|
20
|
+
* key is as unextractable as the encryption key.
|
|
21
|
+
*
|
|
22
|
+
* In its own entry, `@geekmidas/constructs/encryption/kms`, which only an
|
|
23
|
+
* AWS build's generated entry imports — to register {@link kmsCipherDriver}
|
|
24
|
+
* — so a project that never deploys to AWS never needs
|
|
25
|
+
* `@aws-sdk/client-kms` installed, and its bundle never mentions it.
|
|
26
|
+
*/
|
|
27
|
+
/** The ciphertext's key field: the version lives inside KMS's own blob. */
|
|
28
|
+
const KMS_KEY_ID = "kms";
|
|
29
|
+
function kmsCipher(construct, url) {
|
|
30
|
+
const parsed = new URL(url);
|
|
31
|
+
const region = parsed.hostname;
|
|
32
|
+
const keyId = parsed.searchParams.get("key");
|
|
33
|
+
const indexKeyId = parsed.searchParams.get("index");
|
|
34
|
+
if (!region || !keyId || !indexKeyId) throw new require_cipher.EncryptionUrlInvalid(construct, "a kms:// URL names a region, a key and an index key");
|
|
35
|
+
const endpoint = parsed.searchParams.get("endpoint");
|
|
36
|
+
const kms = new _aws_sdk_client_kms.KMSClient({
|
|
37
|
+
region,
|
|
38
|
+
...endpoint ? { endpoint } : {}
|
|
39
|
+
});
|
|
40
|
+
const context = { construct };
|
|
41
|
+
const aad = require_cipher.associatedData(construct, KMS_KEY_ID);
|
|
42
|
+
return {
|
|
43
|
+
async encrypt(plaintext) {
|
|
44
|
+
const dataKey = await kms.send(new _aws_sdk_client_kms.GenerateDataKeyCommand({
|
|
45
|
+
KeyId: keyId,
|
|
46
|
+
KeySpec: "AES_256",
|
|
47
|
+
EncryptionContext: context
|
|
48
|
+
}));
|
|
49
|
+
const wrapped = Buffer.from(dataKey.CiphertextBlob);
|
|
50
|
+
const sealed = require_cipher.seal(Buffer.from(dataKey.Plaintext), Buffer.from(plaintext, "utf8"), aad);
|
|
51
|
+
const length = Buffer.alloc(2);
|
|
52
|
+
length.writeUInt16BE(wrapped.length);
|
|
53
|
+
return require_cipher.formatCiphertext(KMS_KEY_ID, Buffer.concat([
|
|
54
|
+
length,
|
|
55
|
+
wrapped,
|
|
56
|
+
sealed
|
|
57
|
+
]));
|
|
58
|
+
},
|
|
59
|
+
async decrypt(ciphertext) {
|
|
60
|
+
const { payload } = require_cipher.parseCiphertext(construct, ciphertext);
|
|
61
|
+
const length = payload.length >= 2 ? payload.readUInt16BE(0) : 0;
|
|
62
|
+
const wrapped = payload.subarray(2, 2 + length);
|
|
63
|
+
if (!length || wrapped.length !== length) throw new require_cipher.CiphertextNotAuthentic(construct);
|
|
64
|
+
const dataKey = await kms.send(new _aws_sdk_client_kms.DecryptCommand({
|
|
65
|
+
CiphertextBlob: wrapped,
|
|
66
|
+
EncryptionContext: context
|
|
67
|
+
}));
|
|
68
|
+
const plaintext = require_cipher.open(Buffer.from(dataKey.Plaintext), payload.subarray(2 + length), aad);
|
|
69
|
+
if (!plaintext) throw new require_cipher.CiphertextNotAuthentic(construct);
|
|
70
|
+
return plaintext.toString("utf8");
|
|
71
|
+
},
|
|
72
|
+
async index(value) {
|
|
73
|
+
const { Mac } = await kms.send(new _aws_sdk_client_kms.GenerateMacCommand({
|
|
74
|
+
KeyId: indexKeyId,
|
|
75
|
+
MacAlgorithm: "HMAC_SHA_256",
|
|
76
|
+
Message: Buffer.from(value, "utf8")
|
|
77
|
+
}));
|
|
78
|
+
return Buffer.from(Mac).toString("base64url");
|
|
79
|
+
},
|
|
80
|
+
async reencrypt(ciphertext) {
|
|
81
|
+
require_cipher.parseCiphertext(construct, ciphertext);
|
|
82
|
+
return ciphertext;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** The `kms:` cipher, as an AWS build's entry registers it. */
|
|
87
|
+
const kmsCipherDriver = {
|
|
88
|
+
scheme: _geekmidas_manifest.KMS_SCHEME,
|
|
89
|
+
open: kmsCipher
|
|
90
|
+
};
|
|
91
|
+
//#endregion
|
|
92
|
+
exports.kmsCipher = kmsCipher;
|
|
93
|
+
exports.kmsCipherDriver = kmsCipherDriver;
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=kms.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kms.cjs","names":["EncryptionUrlInvalid","KMSClient","associatedData","GenerateDataKeyCommand","seal","formatCiphertext","parseCiphertext","CiphertextNotAuthentic","DecryptCommand","open","GenerateMacCommand","KMS_SCHEME"],"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 entry, `@geekmidas/constructs/encryption/kms`, which only an\n * AWS build's generated entry imports — to register {@link kmsCipherDriver}\n * — so a project that never deploys to AWS never needs\n * `@aws-sdk/client-kms` installed, and its bundle never mentions it.\n */\n\nimport {\n\tDecryptCommand,\n\tGenerateDataKeyCommand,\n\tGenerateMacCommand,\n\tKMSClient,\n} from '@aws-sdk/client-kms';\nimport { KMS_SCHEME } from '@geekmidas/manifest';\nimport {\n\tassociatedData,\n\ttype Cipher,\n\ttype CipherDriver,\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\n/** The `kms:` cipher, as an AWS build's entry registers it. */\nexport const kmsCipherDriver: CipherDriver = {\n\tscheme: KMS_SCHEME,\n\topen: kmsCipher,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,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;;AAGA,MAAa,kBAAgC;CAC5C,QAAQC,oBAAAA;CACR,MAAM;AACP"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { n as CipherDriver, t as Cipher } from "../cipher-DSDxPRIp.cjs";
|
|
2
|
+
//#region src/encryption/kms.d.ts
|
|
3
|
+
export declare function kmsCipher(construct: string, url: string): Cipher;
|
|
4
|
+
/** The `kms:` cipher, as an AWS build's entry registers it. */
|
|
5
|
+
export declare const kmsCipherDriver: CipherDriver;
|
|
6
|
+
//#endregion
|
|
7
|
+
//# sourceMappingURL=kms.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kms.d.cts","names":[],"sources":["../../src/encryption/kms.ts"],"mappings":";;wBA4CgB,UAAU,mBAAmB,cAAc;;qBA0F9C,iBAAiB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { n as CipherDriver, t as Cipher } from "../cipher-DSDxPRIp.mjs";
|
|
2
|
+
//#region src/encryption/kms.d.ts
|
|
3
|
+
export declare function kmsCipher(construct: string, url: string): Cipher;
|
|
4
|
+
/** The `kms:` cipher, as an AWS build's entry registers it. */
|
|
5
|
+
export declare const kmsCipherDriver: CipherDriver;
|
|
6
|
+
//#endregion
|
|
7
|
+
//# sourceMappingURL=kms.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kms.d.mts","names":[],"sources":["../../src/encryption/kms.ts"],"mappings":";;wBA4CgB,UAAU,mBAAmB,cAAc;;qBA0F9C,iBAAiB"}
|