@geekmidas/constructs 10.0.0-alpha.17 → 10.0.0-alpha.170
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-Ca_qHQu2.d.cts} +16 -9
- package/dist/Cron-Ca_qHQu2.d.cts.map +1 -0
- package/dist/{Cron-zsoSAwZo.d.cts → Cron-DPJiR7Lt.d.mts} +15 -8
- package/dist/Cron-DPJiR7Lt.d.mts.map +1 -0
- package/dist/CronBuilder-BC4za5Bx.d.mts +47 -0
- package/dist/CronBuilder-BC4za5Bx.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-C3RrAF1-.d.cts +47 -0
- package/dist/CronBuilder-C3RrAF1-.d.cts.map +1 -0
- package/dist/Endpoint-52z1P0Ue.cjs +581 -0
- package/dist/Endpoint-52z1P0Ue.cjs.map +1 -0
- package/dist/{Endpoint-DBflWAe4.d.cts → Endpoint-BlIZLsBQ.d.cts} +101 -20
- package/dist/Endpoint-BlIZLsBQ.d.cts.map +1 -0
- package/dist/{Endpoint-oS-Fe3d_.d.mts → Endpoint-DC7mreOr.d.mts} +104 -23
- package/dist/Endpoint-DC7mreOr.d.mts.map +1 -0
- package/dist/Endpoint-sUOU7uLx.mjs +552 -0
- package/dist/Endpoint-sUOU7uLx.mjs.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-Cc4kKPag.d.mts → EndpointFactory-DCmnCmkX.d.mts} +189 -106
- package/dist/EndpointFactory-DCmnCmkX.d.mts.map +1 -0
- package/dist/{index-C1ZwNOOk.d.cts → EndpointFactory-cVTb8kCc.d.cts} +187 -104
- package/dist/EndpointFactory-cVTb8kCc.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-AwGKoUKy.d.mts +129 -0
- package/dist/ObjectSubscriberBuilder-AwGKoUKy.d.mts.map +1 -0
- package/dist/ObjectSubscriberBuilder-CB6imsX4.d.cts +129 -0
- package/dist/ObjectSubscriberBuilder-CB6imsX4.d.cts.map +1 -0
- package/dist/ProcessorBuilder-CeEZ2vCx.d.cts +216 -0
- package/dist/ProcessorBuilder-CeEZ2vCx.d.cts.map +1 -0
- package/dist/ProcessorBuilder-CwIlm75W.d.mts +216 -0
- package/dist/ProcessorBuilder-CwIlm75W.d.mts.map +1 -0
- package/dist/Queue-9Hh20ZCk.mjs +104 -0
- package/dist/Queue-9Hh20ZCk.mjs.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-W1wueijP.cjs +109 -0
- package/dist/Queue-W1wueijP.cjs.map +1 -0
- package/dist/QueueBuilder-BDcv9B71.cjs +135 -0
- package/dist/QueueBuilder-BDcv9B71.cjs.map +1 -0
- package/dist/QueueBuilder-CUERv8jt.d.mts +75 -0
- package/dist/QueueBuilder-CUERv8jt.d.mts.map +1 -0
- package/dist/QueueBuilder-CmB1vOgn.d.cts +75 -0
- package/dist/QueueBuilder-CmB1vOgn.d.cts.map +1 -0
- package/dist/QueueBuilder-CrZL8HHs.mjs +118 -0
- package/dist/QueueBuilder-CrZL8HHs.mjs.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-BGoOeCT6.mjs +99 -0
- package/dist/Topic-BGoOeCT6.mjs.map +1 -0
- package/dist/Topic-DLCZBNwK.cjs +104 -0
- package/dist/Topic-DLCZBNwK.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-1yI2wR-4.d.cts +274 -0
- package/dist/auth-1yI2wR-4.d.cts.map +1 -0
- package/dist/auth-D4NMXgLt.d.mts +274 -0
- package/dist/auth-D4NMXgLt.d.mts.map +1 -0
- package/dist/auth.cjs +311 -26
- 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 +307 -28
- package/dist/auth.mjs.map +1 -1
- package/dist/cache-0VoeOTF9.d.mts +44 -0
- package/dist/cache-0VoeOTF9.d.mts.map +1 -0
- package/dist/cache-CW-sArzS.d.cts +44 -0
- package/dist/cache-CW-sArzS.d.cts.map +1 -0
- package/dist/cache.cjs +4 -20
- 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 +4 -20
- 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-DhbaONW2.d.cts} +63 -8
- package/dist/construct-interface-DhbaONW2.d.cts.map +1 -0
- package/dist/{construct-interface-DgXTJcOD.d.cts → construct-interface-DxfkFxkl.d.mts} +63 -8
- package/dist/construct-interface-DxfkFxkl.d.mts.map +1 -0
- package/dist/construct-interface.cjs +47 -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 +45 -5
- package/dist/construct-interface.mjs.map +1 -1
- package/dist/credential-B80mOxwT.mjs +222 -0
- package/dist/credential-B80mOxwT.mjs.map +1 -0
- package/dist/credential-RlgbzZAc.cjs +257 -0
- package/dist/credential-RlgbzZAc.cjs.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 +24 -17
- package/dist/email.cjs.map +1 -1
- package/dist/email.d.cts +15 -5
- package/dist/email.d.cts.map +1 -1
- package/dist/email.d.mts +16 -6
- package/dist/email.d.mts.map +1 -1
- package/dist/email.mjs +23 -17
- 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-BvOXkZmj.d.mts +201 -0
- package/dist/fake-BvOXkZmj.d.mts.map +1 -0
- package/dist/fake-Djx8E0o1.d.cts +201 -0
- package/dist/fake-Djx8E0o1.d.cts.map +1 -0
- package/dist/file-server.cjs +200 -48
- package/dist/file-server.cjs.map +1 -1
- package/dist/file-server.d.cts +147 -15
- package/dist/file-server.d.cts.map +1 -1
- package/dist/file-server.d.mts +147 -15
- package/dist/file-server.d.mts.map +1 -1
- package/dist/file-server.mjs +198 -50
- 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-BjvMs7EJ.d.cts +195 -0
- package/dist/inbox-BjvMs7EJ.d.cts.map +1 -0
- package/dist/inbox-C8bOR9UL.d.mts +195 -0
- package/dist/inbox-C8bOR9UL.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-DaK-C7N3.d.cts +115 -0
- package/dist/index-DaK-C7N3.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-vCS4HBEG.d.mts +115 -0
- package/dist/index-vCS4HBEG.d.mts.map +1 -0
- 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-2HqIQ2fC.d.cts +216 -0
- package/dist/kysely-2HqIQ2fC.d.cts.map +1 -0
- package/dist/kysely-BGvpd_ZH.d.mts +216 -0
- package/dist/kysely-BGvpd_ZH.d.mts.map +1 -0
- package/dist/kysely-Bc9xzaik.mjs +371 -0
- package/dist/kysely-Bc9xzaik.mjs.map +1 -0
- package/dist/kysely-D7f6J2lh.cjs +384 -0
- package/dist/kysely-D7f6J2lh.cjs.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 +78 -0
- package/dist/mobile-app.cjs.map +1 -0
- package/dist/mobile-app.d.cts +77 -0
- package/dist/mobile-app.d.cts.map +1 -0
- package/dist/mobile-app.d.mts +77 -0
- package/dist/mobile-app.d.mts.map +1 -0
- package/dist/mobile-app.mjs +77 -0
- package/dist/mobile-app.mjs.map +1 -0
- package/dist/object-storage.cjs +14 -7
- package/dist/object-storage.cjs.map +1 -1
- package/dist/object-storage.d.cts +12 -3
- package/dist/object-storage.d.cts.map +1 -1
- package/dist/object-storage.d.mts +12 -3
- package/dist/object-storage.d.mts.map +1 -1
- package/dist/object-storage.mjs +14 -9
- 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 +100 -73
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +83 -59
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +83 -59
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +97 -76
- 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 +137 -10
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +153 -3
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +153 -3
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +117 -13
- 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-BirKau0X.d.mts +40 -0
- package/dist/telemetry-BirKau0X.d.mts.map +1 -0
- package/dist/telemetry-DjJgtQ_N.d.cts +40 -0
- package/dist/telemetry-DjJgtQ_N.d.cts.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-C6LGg9-D.mjs +1716 -0
- package/dist/websocket-api-C6LGg9-D.mjs.map +1 -0
- package/dist/websocket-api-CD-E5Ogr.d.cts +1207 -0
- package/dist/websocket-api-CD-E5Ogr.d.cts.map +1 -0
- package/dist/websocket-api-CoKPJJRl.cjs +1895 -0
- package/dist/websocket-api-CoKPJJRl.cjs.map +1 -0
- package/dist/websocket-api-pJJfeTcm.d.mts +1207 -0
- package/dist/websocket-api-pJJfeTcm.d.mts.map +1 -0
- package/dist/websocket-api.cjs +42 -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
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
//#region src/optionalPeers.ts
|
|
2
|
+
/**
|
|
3
|
+
* The optional peers a construct needs only for a feature it opted into.
|
|
4
|
+
*
|
|
5
|
+
* `@geekmidas/audit`, `@geekmidas/rate-limit`, `@geekmidas/db`,
|
|
6
|
+
* `@geekmidas/cache`, `@geekmidas/emailkit`, `@geekmidas/storage`, `hono`,
|
|
7
|
+
* `ws`, `ioredis` and `better-auth` are optional peers of this package: an app
|
|
8
|
+
* that audits nothing, limits nothing, sends no mail and serves no WebSocket
|
|
9
|
+
* need not install them. Entries that every app loads (`./endpoints`,
|
|
10
|
+
* `./crons`, `./worker`, `./testing`, the CLI's discovery) used to import them
|
|
11
|
+
* at the top, so loading any of them needed them all — and a production bundle
|
|
12
|
+
* of an app without them failed to build. They are loaded here instead, when
|
|
13
|
+
* the construct that uses one runs, which is also when the app declaring that
|
|
14
|
+
* construct has installed it.
|
|
15
|
+
*
|
|
16
|
+
* The `try` around each `import()` is load-bearing beyond the error it names:
|
|
17
|
+
* a bundler leaves an import it cannot resolve to run time when the import is
|
|
18
|
+
* guarded, and fails the build when it is not. `scripts/check-optional-peers.mjs`
|
|
19
|
+
* holds every entry to that: an optional peer is reached from its own adaptor
|
|
20
|
+
* subpath, or through a guarded `import()` like these.
|
|
21
|
+
*/
|
|
22
|
+
/** A construct uses a feature whose optional peer is not installed. */
|
|
23
|
+
var OptionalPeerMissing = class extends Error {
|
|
24
|
+
packageName;
|
|
25
|
+
feature;
|
|
26
|
+
constructor(packageName, feature, cause) {
|
|
27
|
+
super(`${feature} needs '${packageName}', which could not be loaded. Add it to the dependencies of the app that declares it.`, { cause });
|
|
28
|
+
this.packageName = packageName;
|
|
29
|
+
this.feature = feature;
|
|
30
|
+
this.name = "OptionalPeerMissing";
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
/** `@geekmidas/audit`, for an endpoint, function or cron with an auditor. */
|
|
34
|
+
async function loadAudit() {
|
|
35
|
+
try {
|
|
36
|
+
return await import("@geekmidas/audit");
|
|
37
|
+
} catch (cause) {
|
|
38
|
+
throw new OptionalPeerMissing("@geekmidas/audit", "An auditor", cause);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** `@geekmidas/audit/kysely`, for audits written in the handler's transaction. */
|
|
42
|
+
async function loadAuditKysely() {
|
|
43
|
+
try {
|
|
44
|
+
return await import("@geekmidas/audit/kysely");
|
|
45
|
+
} catch (cause) {
|
|
46
|
+
throw new OptionalPeerMissing("@geekmidas/audit", "An auditor that stores in the database", cause);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** `@geekmidas/rate-limit`, for an endpoint with a rate limit. */
|
|
50
|
+
async function loadRateLimit() {
|
|
51
|
+
try {
|
|
52
|
+
return await import("@geekmidas/rate-limit");
|
|
53
|
+
} catch (cause) {
|
|
54
|
+
throw new OptionalPeerMissing("@geekmidas/rate-limit", "An endpoint with a rate limit", cause);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** `@geekmidas/db/rls`, for an endpoint with row-level security. */
|
|
58
|
+
async function loadRls() {
|
|
59
|
+
try {
|
|
60
|
+
return await import("@geekmidas/db/rls");
|
|
61
|
+
} catch (cause) {
|
|
62
|
+
throw new OptionalPeerMissing("@geekmidas/db", "An endpoint with row-level security", cause);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** `@geekmidas/cache`, for a `Cache` construct's client. */
|
|
66
|
+
async function loadCache() {
|
|
67
|
+
try {
|
|
68
|
+
return await import("@geekmidas/cache");
|
|
69
|
+
} catch (cause) {
|
|
70
|
+
throw new OptionalPeerMissing("@geekmidas/cache", "A Cache", cause);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** `@geekmidas/emailkit`, for an `Email` construct's client. */
|
|
74
|
+
async function loadEmailkit() {
|
|
75
|
+
try {
|
|
76
|
+
return await import("@geekmidas/emailkit");
|
|
77
|
+
} catch (cause) {
|
|
78
|
+
throw new OptionalPeerMissing("@geekmidas/emailkit", "An Email", cause);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** `@geekmidas/storage/events`, for a subscriber to a bucket's objects. */
|
|
82
|
+
async function loadStorageEvents() {
|
|
83
|
+
try {
|
|
84
|
+
return await import("@geekmidas/storage/events");
|
|
85
|
+
} catch (cause) {
|
|
86
|
+
throw new OptionalPeerMissing("@geekmidas/storage", "A subscriber to a bucket's objects", cause);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** `hono`, for a surface that serves HTTP itself. */
|
|
90
|
+
async function loadHono(feature) {
|
|
91
|
+
try {
|
|
92
|
+
return await import("hono");
|
|
93
|
+
} catch (cause) {
|
|
94
|
+
throw new OptionalPeerMissing("hono", feature, cause);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/** `hono/cors`, beside {@link loadHono}. */
|
|
98
|
+
async function loadHonoCors(feature) {
|
|
99
|
+
try {
|
|
100
|
+
return await import("hono/cors");
|
|
101
|
+
} catch (cause) {
|
|
102
|
+
throw new OptionalPeerMissing("hono", feature, cause);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** `ws`, for a `WebSocketApi`'s server. */
|
|
106
|
+
async function loadWs() {
|
|
107
|
+
try {
|
|
108
|
+
return await import("ws");
|
|
109
|
+
} catch (cause) {
|
|
110
|
+
throw new OptionalPeerMissing("ws", "A WebSocketApi", cause);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** `ioredis`, for a `WebSocketApi` that fans out through Redis. */
|
|
114
|
+
async function loadIoredis() {
|
|
115
|
+
try {
|
|
116
|
+
return await import("ioredis");
|
|
117
|
+
} catch (cause) {
|
|
118
|
+
throw new OptionalPeerMissing("ioredis", "A WebSocketApi with a redis:// transport", cause);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/** `better-auth`, for an `Auth` construct's server. */
|
|
122
|
+
async function loadBetterAuth() {
|
|
123
|
+
try {
|
|
124
|
+
return await import("better-auth");
|
|
125
|
+
} catch (cause) {
|
|
126
|
+
throw new OptionalPeerMissing("better-auth", "An Auth", cause);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** `better-auth/db/migration`, for migrating an `Auth` construct's tables. */
|
|
130
|
+
async function loadBetterAuthMigration() {
|
|
131
|
+
try {
|
|
132
|
+
return await import("better-auth/db/migration");
|
|
133
|
+
} catch (cause) {
|
|
134
|
+
throw new OptionalPeerMissing("better-auth", "An Auth", cause);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
Object.defineProperty(exports, "OptionalPeerMissing", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function() {
|
|
141
|
+
return OptionalPeerMissing;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "loadAudit", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function() {
|
|
147
|
+
return loadAudit;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "loadAuditKysely", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function() {
|
|
153
|
+
return loadAuditKysely;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "loadBetterAuth", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function() {
|
|
159
|
+
return loadBetterAuth;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "loadBetterAuthMigration", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function() {
|
|
165
|
+
return loadBetterAuthMigration;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, "loadCache", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function() {
|
|
171
|
+
return loadCache;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "loadEmailkit", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function() {
|
|
177
|
+
return loadEmailkit;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
Object.defineProperty(exports, "loadHono", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function() {
|
|
183
|
+
return loadHono;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
Object.defineProperty(exports, "loadHonoCors", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function() {
|
|
189
|
+
return loadHonoCors;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
Object.defineProperty(exports, "loadIoredis", {
|
|
193
|
+
enumerable: true,
|
|
194
|
+
get: function() {
|
|
195
|
+
return loadIoredis;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
Object.defineProperty(exports, "loadRateLimit", {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
get: function() {
|
|
201
|
+
return loadRateLimit;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
Object.defineProperty(exports, "loadRls", {
|
|
205
|
+
enumerable: true,
|
|
206
|
+
get: function() {
|
|
207
|
+
return loadRls;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
Object.defineProperty(exports, "loadStorageEvents", {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
get: function() {
|
|
213
|
+
return loadStorageEvents;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
Object.defineProperty(exports, "loadWs", {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
get: function() {
|
|
219
|
+
return loadWs;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
//# sourceMappingURL=optionalPeers-DuNQXXe1.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionalPeers-DuNQXXe1.cjs","names":[],"sources":["../src/optionalPeers.ts"],"sourcesContent":["/**\n * The optional peers a construct needs only for a feature it opted into.\n *\n * `@geekmidas/audit`, `@geekmidas/rate-limit`, `@geekmidas/db`,\n * `@geekmidas/cache`, `@geekmidas/emailkit`, `@geekmidas/storage`, `hono`,\n * `ws`, `ioredis` and `better-auth` are optional peers of this package: an app\n * that audits nothing, limits nothing, sends no mail and serves no WebSocket\n * need not install them. Entries that every app loads (`./endpoints`,\n * `./crons`, `./worker`, `./testing`, the CLI's discovery) used to import them\n * at the top, so loading any of them needed them all — and a production bundle\n * of an app without them failed to build. They are loaded here instead, when\n * the construct that uses one runs, which is also when the app declaring that\n * construct has installed it.\n *\n * The `try` around each `import()` is load-bearing beyond the error it names:\n * a bundler leaves an import it cannot resolve to run time when the import is\n * guarded, and fails the build when it is not. `scripts/check-optional-peers.mjs`\n * holds every entry to that: an optional peer is reached from its own adaptor\n * subpath, or through a guarded `import()` like these.\n */\n\n/** A construct uses a feature whose optional peer is not installed. */\nexport class OptionalPeerMissing extends Error {\n\tconstructor(\n\t\treadonly packageName: string,\n\t\treadonly feature: string,\n\t\tcause: unknown,\n\t) {\n\t\tsuper(\n\t\t\t`${feature} needs '${packageName}', which could not be loaded. ` +\n\t\t\t\t`Add it to the dependencies of the app that declares it.`,\n\t\t\t{ cause },\n\t\t);\n\t\tthis.name = 'OptionalPeerMissing';\n\t}\n}\n\n/** `@geekmidas/audit`, for an endpoint, function or cron with an auditor. */\nexport async function loadAudit(): Promise<typeof import('@geekmidas/audit')> {\n\ttry {\n\t\treturn await import('@geekmidas/audit');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing('@geekmidas/audit', 'An auditor', cause);\n\t}\n}\n\n/** `@geekmidas/audit/kysely`, for audits written in the handler's transaction. */\nexport async function loadAuditKysely(): Promise<\n\ttypeof import('@geekmidas/audit/kysely')\n> {\n\ttry {\n\t\treturn await import('@geekmidas/audit/kysely');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing(\n\t\t\t'@geekmidas/audit',\n\t\t\t'An auditor that stores in the database',\n\t\t\tcause,\n\t\t);\n\t}\n}\n\n/** `@geekmidas/rate-limit`, for an endpoint with a rate limit. */\nexport async function loadRateLimit(): Promise<\n\ttypeof import('@geekmidas/rate-limit')\n> {\n\ttry {\n\t\treturn await import('@geekmidas/rate-limit');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing(\n\t\t\t'@geekmidas/rate-limit',\n\t\t\t'An endpoint with a rate limit',\n\t\t\tcause,\n\t\t);\n\t}\n}\n\n/** `@geekmidas/db/rls`, for an endpoint with row-level security. */\nexport async function loadRls(): Promise<typeof import('@geekmidas/db/rls')> {\n\ttry {\n\t\treturn await import('@geekmidas/db/rls');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing(\n\t\t\t'@geekmidas/db',\n\t\t\t'An endpoint with row-level security',\n\t\t\tcause,\n\t\t);\n\t}\n}\n\n/** `@geekmidas/cache`, for a `Cache` construct's client. */\nexport async function loadCache(): Promise<typeof import('@geekmidas/cache')> {\n\ttry {\n\t\treturn await import('@geekmidas/cache');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing('@geekmidas/cache', 'A Cache', cause);\n\t}\n}\n\n/** `@geekmidas/emailkit`, for an `Email` construct's client. */\nexport async function loadEmailkit(): Promise<\n\ttypeof import('@geekmidas/emailkit')\n> {\n\ttry {\n\t\treturn await import('@geekmidas/emailkit');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing('@geekmidas/emailkit', 'An Email', cause);\n\t}\n}\n\n/** `@geekmidas/emailkit/autoSubmitted`, for a subscriber to an `Inbox`. */\nexport async function loadAutoSubmitted(): Promise<\n\ttypeof import('@geekmidas/emailkit/autoSubmitted')\n> {\n\ttry {\n\t\treturn await import('@geekmidas/emailkit/autoSubmitted');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing(\n\t\t\t'@geekmidas/emailkit',\n\t\t\t'A subscriber to an Inbox',\n\t\t\tcause,\n\t\t);\n\t}\n}\n\n/** `@geekmidas/storage/events`, for a subscriber to a bucket's objects. */\nexport async function loadStorageEvents(): Promise<\n\ttypeof import('@geekmidas/storage/events')\n> {\n\ttry {\n\t\treturn await import('@geekmidas/storage/events');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing(\n\t\t\t'@geekmidas/storage',\n\t\t\t\"A subscriber to a bucket's objects\",\n\t\t\tcause,\n\t\t);\n\t}\n}\n\n/** `hono`, for a surface that serves HTTP itself. */\nexport async function loadHono(\n\tfeature: string,\n): Promise<typeof import('hono')> {\n\ttry {\n\t\treturn await import('hono');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing('hono', feature, cause);\n\t}\n}\n\n/** `hono/cors`, beside {@link loadHono}. */\nexport async function loadHonoCors(\n\tfeature: string,\n): Promise<typeof import('hono/cors')> {\n\ttry {\n\t\treturn await import('hono/cors');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing('hono', feature, cause);\n\t}\n}\n\n/** `ws`, for a `WebSocketApi`'s server. */\nexport async function loadWs(): Promise<typeof import('ws')> {\n\ttry {\n\t\treturn await import('ws');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing('ws', 'A WebSocketApi', cause);\n\t}\n}\n\n/** `ioredis`, for a `WebSocketApi` that fans out through Redis. */\nexport async function loadIoredis(): Promise<typeof import('ioredis')> {\n\ttry {\n\t\treturn await import('ioredis');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing(\n\t\t\t'ioredis',\n\t\t\t'A WebSocketApi with a redis:// transport',\n\t\t\tcause,\n\t\t);\n\t}\n}\n\n/** `better-auth`, for an `Auth` construct's server. */\nexport async function loadBetterAuth(): Promise<typeof import('better-auth')> {\n\ttry {\n\t\treturn await import('better-auth');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing('better-auth', 'An Auth', cause);\n\t}\n}\n\n/** `better-auth/db/migration`, for migrating an `Auth` construct's tables. */\nexport async function loadBetterAuthMigration(): Promise<\n\ttypeof import('better-auth/db/migration')\n> {\n\ttry {\n\t\treturn await import('better-auth/db/migration');\n\t} catch (cause) {\n\t\tthrow new OptionalPeerMissing('better-auth', 'An Auth', cause);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,sBAAb,cAAyC,MAAM;CAEpC;CACA;CAFV,YACC,aACA,SACA,OACC;EACD,MACC,GAAG,QAAQ,UAAU,YAAY,wFAEjC,EAAE,MAAM,CACT;EARS,KAAA,cAAA;EACA,KAAA,UAAA;EAQT,KAAK,OAAO;CACb;AACD;;AAGA,eAAsB,YAAwD;CAC7E,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBAAoB,oBAAoB,cAAc,KAAK;CACtE;AACD;;AAGA,eAAsB,kBAEpB;CACD,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBACT,oBACA,0CACA,KACD;CACD;AACD;;AAGA,eAAsB,gBAEpB;CACD,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBACT,yBACA,iCACA,KACD;CACD;AACD;;AAGA,eAAsB,UAAuD;CAC5E,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBACT,iBACA,uCACA,KACD;CACD;AACD;;AAGA,eAAsB,YAAwD;CAC7E,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBAAoB,oBAAoB,WAAW,KAAK;CACnE;AACD;;AAGA,eAAsB,eAEpB;CACD,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBAAoB,uBAAuB,YAAY,KAAK;CACvE;AACD;;AAkBA,eAAsB,oBAEpB;CACD,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBACT,sBACA,sCACA,KACD;CACD;AACD;;AAGA,eAAsB,SACrB,SACiC;CACjC,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBAAoB,QAAQ,SAAS,KAAK;CACrD;AACD;;AAGA,eAAsB,aACrB,SACsC;CACtC,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBAAoB,QAAQ,SAAS,KAAK;CACrD;AACD;;AAGA,eAAsB,SAAuC;CAC5D,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBAAoB,MAAM,kBAAkB,KAAK;CAC5D;AACD;;AAGA,eAAsB,cAAiD;CACtE,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBACT,WACA,4CACA,KACD;CACD;AACD;;AAGA,eAAsB,iBAAwD;CAC7E,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBAAoB,eAAe,WAAW,KAAK;CAC9D;AACD;;AAGA,eAAsB,0BAEpB;CACD,IAAI;EACH,OAAO,MAAM,OAAO;CACrB,SAAS,OAAO;EACf,MAAM,IAAI,oBAAoB,eAAe,WAAW,KAAK;CAC9D;AACD"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
2
|
+
//#region src/websocket/drivers.ts
|
|
3
|
+
/**
|
|
4
|
+
* WebSocket sink drivers, keyed by publisher-string scheme.
|
|
5
|
+
*
|
|
6
|
+
* The shape `@geekmidas/events` and `Encryption` use, for the same reason: a
|
|
7
|
+
* surface's `<ID>_PUBLISHER_CONNECTION_STRING` names where its sockets are, and
|
|
8
|
+
* the scheme picks what reaches them. `redis://` and `memory://` are the
|
|
9
|
+
* process transport, built in. Any other scheme is a driver the entry point
|
|
10
|
+
* registers — `apigateway:` on an AWS build, from
|
|
11
|
+
* `@geekmidas/constructs/aws-websocket` — so a process that never publishes
|
|
12
|
+
* to API Gateway never imports its SDK.
|
|
13
|
+
*
|
|
14
|
+
* Registration is an explicit call rather than an import side effect, because
|
|
15
|
+
* a side-effecting module is exactly what a bundler is entitled to drop.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The registry lives on `globalThis`, so one registration is seen by every
|
|
19
|
+
* copy of this module — the ESM and the CJS build of one install.
|
|
20
|
+
*/
|
|
21
|
+
const REGISTRY = Symbol.for("@geekmidas/constructs/websocket-sinks");
|
|
22
|
+
function drivers() {
|
|
23
|
+
const global = globalThis;
|
|
24
|
+
global[REGISTRY] ??= /* @__PURE__ */ new Map();
|
|
25
|
+
return global[REGISTRY];
|
|
26
|
+
}
|
|
27
|
+
/** Make a sink available for its scheme. Idempotent. */
|
|
28
|
+
function registerWebSocketSinkDriver(driver) {
|
|
29
|
+
drivers().set(driver.scheme, driver);
|
|
30
|
+
}
|
|
31
|
+
/** The driver registered for a publisher string's scheme, if any. */
|
|
32
|
+
function webSocketSinkDriverFor(connectionString) {
|
|
33
|
+
return drivers().get(schemeOf(connectionString));
|
|
34
|
+
}
|
|
35
|
+
/** `apigateway:` from `apigateway://…`. */
|
|
36
|
+
function schemeOf(connectionString) {
|
|
37
|
+
const separator = connectionString.indexOf(":");
|
|
38
|
+
return separator === -1 ? connectionString : connectionString.slice(0, separator + 1);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A surface's publisher string names a scheme this process registered no
|
|
42
|
+
* sink for — `apigateway:` in an entry not built for AWS.
|
|
43
|
+
*/
|
|
44
|
+
var UnregisteredWebSocketScheme = class extends Error {
|
|
45
|
+
surface;
|
|
46
|
+
scheme;
|
|
47
|
+
constructor(surface, scheme) {
|
|
48
|
+
super(`${surface}'s publisher string is a '${scheme}' URL, and this build registered no sink for it. ` + (scheme === _geekmidas_manifest.API_GATEWAY_WEBSOCKET_SCHEME ? "An API Gateway surface is an AWS target's: build for it (gkm build --provider aws), which registers the API Gateway sink and needs @aws-sdk/client-apigatewaymanagementapi, @aws-sdk/client-dynamodb and electrodb installed." : "Register its driver with registerWebSocketSinkDriver before the first publish."));
|
|
49
|
+
this.surface = surface;
|
|
50
|
+
this.scheme = scheme;
|
|
51
|
+
this.name = "UnregisteredWebSocketScheme";
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/websocket/origins.ts
|
|
56
|
+
/**
|
|
57
|
+
* The origins a client of the surface's own address sends: the `https://`
|
|
58
|
+
* one a native socket derives from `wss://`, and the address's own.
|
|
59
|
+
*
|
|
60
|
+
* Shared by every adaptor that checks a handshake's `Origin` — the Node
|
|
61
|
+
* server and the API Gateway `$connect` handler — so the two trust the same
|
|
62
|
+
* origins for the same address.
|
|
63
|
+
*/
|
|
64
|
+
function ownOrigins(url) {
|
|
65
|
+
if (!url || !URL.canParse(url)) return [];
|
|
66
|
+
const own = new URL(url);
|
|
67
|
+
const web = new URL(url.replace(/^ws(s?):/i, "http$1:"));
|
|
68
|
+
return [.../* @__PURE__ */ new Set([`${own.protocol}//${own.host}`, web.origin])];
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
Object.defineProperty(exports, "UnregisteredWebSocketScheme", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
get: function() {
|
|
74
|
+
return UnregisteredWebSocketScheme;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(exports, "ownOrigins", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function() {
|
|
80
|
+
return ownOrigins;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(exports, "registerWebSocketSinkDriver", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function() {
|
|
86
|
+
return registerWebSocketSinkDriver;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
Object.defineProperty(exports, "webSocketSinkDriverFor", {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: function() {
|
|
92
|
+
return webSocketSinkDriverFor;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=origins-BjxYht13.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origins-BjxYht13.cjs","names":["API_GATEWAY_WEBSOCKET_SCHEME"],"sources":["../src/websocket/drivers.ts","../src/websocket/origins.ts"],"sourcesContent":["/**\n * WebSocket sink drivers, keyed by publisher-string scheme.\n *\n * The shape `@geekmidas/events` and `Encryption` use, for the same reason: a\n * surface's `<ID>_PUBLISHER_CONNECTION_STRING` names where its sockets are, and\n * the scheme picks what reaches them. `redis://` and `memory://` are the\n * process transport, built in. Any other scheme is a driver the entry point\n * registers — `apigateway:` on an AWS build, from\n * `@geekmidas/constructs/aws-websocket` — so a process that never publishes\n * to API Gateway never imports its SDK.\n *\n * Registration is an explicit call rather than an import side effect, because\n * a side-effecting module is exactly what a bundler is entitled to drop.\n */\n\nimport { API_GATEWAY_WEBSOCKET_SCHEME } from '@geekmidas/manifest';\nimport type { WebSocketSink } from './publisher';\n\n/** What reaches a surface's sockets for one publisher-string scheme. */\nexport interface WebSocketSinkDriver {\n\t/** The scheme it handles, with its colon: `'apigateway:'`. */\n\treadonly scheme: string;\n\t/** The sink for a publisher string of that scheme. */\n\tsink(connectionString: string): WebSocketSink;\n}\n\n/**\n * The registry lives on `globalThis`, so one registration is seen by every\n * copy of this module — the ESM and the CJS build of one install.\n */\nconst REGISTRY = Symbol.for('@geekmidas/constructs/websocket-sinks');\n\nfunction drivers(): Map<string, WebSocketSinkDriver> {\n\tconst global = globalThis as {\n\t\t[REGISTRY]?: Map<string, WebSocketSinkDriver>;\n\t};\n\tglobal[REGISTRY] ??= new Map();\n\treturn global[REGISTRY];\n}\n\n/** Make a sink available for its scheme. Idempotent. */\nexport function registerWebSocketSinkDriver(driver: WebSocketSinkDriver): void {\n\tdrivers().set(driver.scheme, driver);\n}\n\n/** The driver registered for a publisher string's scheme, if any. */\nexport function webSocketSinkDriverFor(\n\tconnectionString: string,\n): WebSocketSinkDriver | undefined {\n\treturn drivers().get(schemeOf(connectionString));\n}\n\n/** `apigateway:` from `apigateway://…`. */\nexport function schemeOf(connectionString: string): string {\n\tconst separator = connectionString.indexOf(':');\n\treturn separator === -1\n\t\t? connectionString\n\t\t: connectionString.slice(0, separator + 1);\n}\n\n/**\n * A surface's publisher string names a scheme this process registered no\n * sink for — `apigateway:` in an entry not built for AWS.\n */\nexport class UnregisteredWebSocketScheme extends Error {\n\tconstructor(\n\t\treadonly surface: string,\n\t\treadonly scheme: string,\n\t) {\n\t\tsuper(\n\t\t\t`${surface}'s publisher string is a '${scheme}' URL, and this build registered no sink for it. ` +\n\t\t\t\t(scheme === API_GATEWAY_WEBSOCKET_SCHEME\n\t\t\t\t\t? \"An API Gateway surface is an AWS target's: build for it (gkm build --provider aws), which registers the API Gateway sink and needs @aws-sdk/client-apigatewaymanagementapi, @aws-sdk/client-dynamodb and electrodb installed.\"\n\t\t\t\t\t: 'Register its driver with registerWebSocketSinkDriver before the first publish.'),\n\t\t);\n\t\tthis.name = 'UnregisteredWebSocketScheme';\n\t}\n}\n","/**\n * The origins a client of the surface's own address sends: the `https://`\n * one a native socket derives from `wss://`, and the address's own.\n *\n * Shared by every adaptor that checks a handshake's `Origin` — the Node\n * server and the API Gateway `$connect` handler — so the two trust the same\n * origins for the same address.\n */\nexport function ownOrigins(url: string | undefined): string[] {\n\tif (!url || !URL.canParse(url)) return [];\n\tconst own = new URL(url);\n\tconst web = new URL(url.replace(/^ws(s?):/i, 'http$1:'));\n\treturn [...new Set([`${own.protocol}//${own.host}`, web.origin])];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,WAAW,OAAO,IAAI,uCAAuC;AAEnE,SAAS,UAA4C;CACpD,MAAM,SAAS;CAGf,OAAO,8BAAc,IAAI,IAAI;CAC7B,OAAO,OAAO;AACf;;AAGA,SAAgB,4BAA4B,QAAmC;CAC9E,QAAQ,CAAC,CAAC,IAAI,OAAO,QAAQ,MAAM;AACpC;;AAGA,SAAgB,uBACf,kBACkC;CAClC,OAAO,QAAQ,CAAC,CAAC,IAAI,SAAS,gBAAgB,CAAC;AAChD;;AAGA,SAAgB,SAAS,kBAAkC;CAC1D,MAAM,YAAY,iBAAiB,QAAQ,GAAG;CAC9C,OAAO,cAAc,KAClB,mBACA,iBAAiB,MAAM,GAAG,YAAY,CAAC;AAC3C;;;;;AAMA,IAAa,8BAAb,cAAiD,MAAM;CAE5C;CACA;CAFV,YACC,SACA,QACC;EACD,MACC,GAAG,QAAQ,4BAA4B,OAAO,sDAC5C,WAAWA,oBAAAA,+BACT,kOACA,iFACL;EARS,KAAA,UAAA;EACA,KAAA,SAAA;EAQT,KAAK,OAAO;CACb;AACD;;;;;;;;;;;ACrEA,SAAgB,WAAW,KAAmC;CAC7D,IAAI,CAAC,OAAO,CAAC,IAAI,SAAS,GAAG,GAAG,OAAO,CAAC;CACxC,MAAM,MAAM,IAAI,IAAI,GAAG;CACvB,MAAM,MAAM,IAAI,IAAI,IAAI,QAAQ,aAAa,SAAS,CAAC;CACvD,OAAO,CAAC,mBAAG,IAAI,IAAI,CAAC,GAAG,IAAI,SAAS,IAAI,IAAI,QAAQ,IAAI,MAAM,CAAC,CAAC;AACjE"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { API_GATEWAY_WEBSOCKET_SCHEME } from "@geekmidas/manifest";
|
|
2
|
+
//#region src/websocket/drivers.ts
|
|
3
|
+
/**
|
|
4
|
+
* WebSocket sink drivers, keyed by publisher-string scheme.
|
|
5
|
+
*
|
|
6
|
+
* The shape `@geekmidas/events` and `Encryption` use, for the same reason: a
|
|
7
|
+
* surface's `<ID>_PUBLISHER_CONNECTION_STRING` names where its sockets are, and
|
|
8
|
+
* the scheme picks what reaches them. `redis://` and `memory://` are the
|
|
9
|
+
* process transport, built in. Any other scheme is a driver the entry point
|
|
10
|
+
* registers — `apigateway:` on an AWS build, from
|
|
11
|
+
* `@geekmidas/constructs/aws-websocket` — so a process that never publishes
|
|
12
|
+
* to API Gateway never imports its SDK.
|
|
13
|
+
*
|
|
14
|
+
* Registration is an explicit call rather than an import side effect, because
|
|
15
|
+
* a side-effecting module is exactly what a bundler is entitled to drop.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The registry lives on `globalThis`, so one registration is seen by every
|
|
19
|
+
* copy of this module — the ESM and the CJS build of one install.
|
|
20
|
+
*/
|
|
21
|
+
const REGISTRY = Symbol.for("@geekmidas/constructs/websocket-sinks");
|
|
22
|
+
function drivers() {
|
|
23
|
+
const global = globalThis;
|
|
24
|
+
global[REGISTRY] ??= /* @__PURE__ */ new Map();
|
|
25
|
+
return global[REGISTRY];
|
|
26
|
+
}
|
|
27
|
+
/** Make a sink available for its scheme. Idempotent. */
|
|
28
|
+
function registerWebSocketSinkDriver(driver) {
|
|
29
|
+
drivers().set(driver.scheme, driver);
|
|
30
|
+
}
|
|
31
|
+
/** The driver registered for a publisher string's scheme, if any. */
|
|
32
|
+
function webSocketSinkDriverFor(connectionString) {
|
|
33
|
+
return drivers().get(schemeOf(connectionString));
|
|
34
|
+
}
|
|
35
|
+
/** `apigateway:` from `apigateway://…`. */
|
|
36
|
+
function schemeOf(connectionString) {
|
|
37
|
+
const separator = connectionString.indexOf(":");
|
|
38
|
+
return separator === -1 ? connectionString : connectionString.slice(0, separator + 1);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A surface's publisher string names a scheme this process registered no
|
|
42
|
+
* sink for — `apigateway:` in an entry not built for AWS.
|
|
43
|
+
*/
|
|
44
|
+
var UnregisteredWebSocketScheme = class extends Error {
|
|
45
|
+
surface;
|
|
46
|
+
scheme;
|
|
47
|
+
constructor(surface, scheme) {
|
|
48
|
+
super(`${surface}'s publisher string is a '${scheme}' URL, and this build registered no sink for it. ` + (scheme === API_GATEWAY_WEBSOCKET_SCHEME ? "An API Gateway surface is an AWS target's: build for it (gkm build --provider aws), which registers the API Gateway sink and needs @aws-sdk/client-apigatewaymanagementapi, @aws-sdk/client-dynamodb and electrodb installed." : "Register its driver with registerWebSocketSinkDriver before the first publish."));
|
|
49
|
+
this.surface = surface;
|
|
50
|
+
this.scheme = scheme;
|
|
51
|
+
this.name = "UnregisteredWebSocketScheme";
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/websocket/origins.ts
|
|
56
|
+
/**
|
|
57
|
+
* The origins a client of the surface's own address sends: the `https://`
|
|
58
|
+
* one a native socket derives from `wss://`, and the address's own.
|
|
59
|
+
*
|
|
60
|
+
* Shared by every adaptor that checks a handshake's `Origin` — the Node
|
|
61
|
+
* server and the API Gateway `$connect` handler — so the two trust the same
|
|
62
|
+
* origins for the same address.
|
|
63
|
+
*/
|
|
64
|
+
function ownOrigins(url) {
|
|
65
|
+
if (!url || !URL.canParse(url)) return [];
|
|
66
|
+
const own = new URL(url);
|
|
67
|
+
const web = new URL(url.replace(/^ws(s?):/i, "http$1:"));
|
|
68
|
+
return [.../* @__PURE__ */ new Set([`${own.protocol}//${own.host}`, web.origin])];
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { webSocketSinkDriverFor as i, UnregisteredWebSocketScheme as n, registerWebSocketSinkDriver as r, ownOrigins as t };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=origins-Boc9qbo-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origins-Boc9qbo-.mjs","names":[],"sources":["../src/websocket/drivers.ts","../src/websocket/origins.ts"],"sourcesContent":["/**\n * WebSocket sink drivers, keyed by publisher-string scheme.\n *\n * The shape `@geekmidas/events` and `Encryption` use, for the same reason: a\n * surface's `<ID>_PUBLISHER_CONNECTION_STRING` names where its sockets are, and\n * the scheme picks what reaches them. `redis://` and `memory://` are the\n * process transport, built in. Any other scheme is a driver the entry point\n * registers — `apigateway:` on an AWS build, from\n * `@geekmidas/constructs/aws-websocket` — so a process that never publishes\n * to API Gateway never imports its SDK.\n *\n * Registration is an explicit call rather than an import side effect, because\n * a side-effecting module is exactly what a bundler is entitled to drop.\n */\n\nimport { API_GATEWAY_WEBSOCKET_SCHEME } from '@geekmidas/manifest';\nimport type { WebSocketSink } from './publisher';\n\n/** What reaches a surface's sockets for one publisher-string scheme. */\nexport interface WebSocketSinkDriver {\n\t/** The scheme it handles, with its colon: `'apigateway:'`. */\n\treadonly scheme: string;\n\t/** The sink for a publisher string of that scheme. */\n\tsink(connectionString: string): WebSocketSink;\n}\n\n/**\n * The registry lives on `globalThis`, so one registration is seen by every\n * copy of this module — the ESM and the CJS build of one install.\n */\nconst REGISTRY = Symbol.for('@geekmidas/constructs/websocket-sinks');\n\nfunction drivers(): Map<string, WebSocketSinkDriver> {\n\tconst global = globalThis as {\n\t\t[REGISTRY]?: Map<string, WebSocketSinkDriver>;\n\t};\n\tglobal[REGISTRY] ??= new Map();\n\treturn global[REGISTRY];\n}\n\n/** Make a sink available for its scheme. Idempotent. */\nexport function registerWebSocketSinkDriver(driver: WebSocketSinkDriver): void {\n\tdrivers().set(driver.scheme, driver);\n}\n\n/** The driver registered for a publisher string's scheme, if any. */\nexport function webSocketSinkDriverFor(\n\tconnectionString: string,\n): WebSocketSinkDriver | undefined {\n\treturn drivers().get(schemeOf(connectionString));\n}\n\n/** `apigateway:` from `apigateway://…`. */\nexport function schemeOf(connectionString: string): string {\n\tconst separator = connectionString.indexOf(':');\n\treturn separator === -1\n\t\t? connectionString\n\t\t: connectionString.slice(0, separator + 1);\n}\n\n/**\n * A surface's publisher string names a scheme this process registered no\n * sink for — `apigateway:` in an entry not built for AWS.\n */\nexport class UnregisteredWebSocketScheme extends Error {\n\tconstructor(\n\t\treadonly surface: string,\n\t\treadonly scheme: string,\n\t) {\n\t\tsuper(\n\t\t\t`${surface}'s publisher string is a '${scheme}' URL, and this build registered no sink for it. ` +\n\t\t\t\t(scheme === API_GATEWAY_WEBSOCKET_SCHEME\n\t\t\t\t\t? \"An API Gateway surface is an AWS target's: build for it (gkm build --provider aws), which registers the API Gateway sink and needs @aws-sdk/client-apigatewaymanagementapi, @aws-sdk/client-dynamodb and electrodb installed.\"\n\t\t\t\t\t: 'Register its driver with registerWebSocketSinkDriver before the first publish.'),\n\t\t);\n\t\tthis.name = 'UnregisteredWebSocketScheme';\n\t}\n}\n","/**\n * The origins a client of the surface's own address sends: the `https://`\n * one a native socket derives from `wss://`, and the address's own.\n *\n * Shared by every adaptor that checks a handshake's `Origin` — the Node\n * server and the API Gateway `$connect` handler — so the two trust the same\n * origins for the same address.\n */\nexport function ownOrigins(url: string | undefined): string[] {\n\tif (!url || !URL.canParse(url)) return [];\n\tconst own = new URL(url);\n\tconst web = new URL(url.replace(/^ws(s?):/i, 'http$1:'));\n\treturn [...new Set([`${own.protocol}//${own.host}`, web.origin])];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,WAAW,OAAO,IAAI,uCAAuC;AAEnE,SAAS,UAA4C;CACpD,MAAM,SAAS;CAGf,OAAO,8BAAc,IAAI,IAAI;CAC7B,OAAO,OAAO;AACf;;AAGA,SAAgB,4BAA4B,QAAmC;CAC9E,QAAQ,CAAC,CAAC,IAAI,OAAO,QAAQ,MAAM;AACpC;;AAGA,SAAgB,uBACf,kBACkC;CAClC,OAAO,QAAQ,CAAC,CAAC,IAAI,SAAS,gBAAgB,CAAC;AAChD;;AAGA,SAAgB,SAAS,kBAAkC;CAC1D,MAAM,YAAY,iBAAiB,QAAQ,GAAG;CAC9C,OAAO,cAAc,KAClB,mBACA,iBAAiB,MAAM,GAAG,YAAY,CAAC;AAC3C;;;;;AAMA,IAAa,8BAAb,cAAiD,MAAM;CAE5C;CACA;CAFV,YACC,SACA,QACC;EACD,MACC,GAAG,QAAQ,4BAA4B,OAAO,sDAC5C,WAAW,+BACT,kOACA,iFACL;EARS,KAAA,UAAA;EACA,KAAA,SAAA;EAQT,KAAK,OAAO;CACb;AACD;;;;;;;;;;;ACrEA,SAAgB,WAAW,KAAmC;CAC7D,IAAI,CAAC,OAAO,CAAC,IAAI,SAAS,GAAG,GAAG,OAAO,CAAC;CACxC,MAAM,MAAM,IAAI,IAAI,GAAG;CACvB,MAAM,MAAM,IAAI,IAAI,IAAI,QAAQ,aAAa,SAAS,CAAC;CACvD,OAAO,CAAC,mBAAG,IAAI,IAAI,CAAC,GAAG,IAAI,SAAS,IAAI,IAAI,QAAQ,IAAI,MAAM,CAAC,CAAC;AACjE"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { t as Construct } from "./Construct-CGuc_Ijk.mjs";
|
|
2
|
+
import { idsOf, servicesOf } from "./construct-interface.mjs";
|
|
3
|
+
import { DERIVED_PREFIX as DERIVED_PREFIX$1 } from "@geekmidas/manifest";
|
|
4
|
+
//#region src/processors/Processor.ts
|
|
5
|
+
/**
|
|
6
|
+
* A processor — a handler behind one path pattern of a file server, which
|
|
7
|
+
* makes a derivative of an open object on read: a thumbnail, a page of a PDF.
|
|
8
|
+
*
|
|
9
|
+
* Built from the file server (`assets.process('/i/:width/*')`), so it carries
|
|
10
|
+
* the bucket it reads and the open paths it may serve. Its parameters' schema
|
|
11
|
+
* is the allowlist: a request outside it is refused before anything runs, so
|
|
12
|
+
* nobody can mint new work — or new cache entries — by varying a number.
|
|
13
|
+
*/
|
|
14
|
+
var Processor = class extends Construct {
|
|
15
|
+
parsed;
|
|
16
|
+
handler;
|
|
17
|
+
options;
|
|
18
|
+
__IS_PROCESSOR__ = true;
|
|
19
|
+
static isProcessor(obj) {
|
|
20
|
+
return Boolean(obj && obj.__IS_PROCESSOR__ === true && obj.type === "dev.geekmidas.function.processor");
|
|
21
|
+
}
|
|
22
|
+
constructor(parsed, handler, options) {
|
|
23
|
+
super("dev.geekmidas.function.processor", options.logger, [options.origin, ...options.services], [], void 0, options.timeout, options.memorySize, void 0, [.../* @__PURE__ */ new Set([options.bucketId, ...options.constructs])]);
|
|
24
|
+
this.parsed = parsed;
|
|
25
|
+
this.handler = handler;
|
|
26
|
+
this.options = options;
|
|
27
|
+
this.owner = options.surfaceId;
|
|
28
|
+
}
|
|
29
|
+
/** The pattern it answers, as written. */
|
|
30
|
+
get pattern() {
|
|
31
|
+
return this.parsed.pattern;
|
|
32
|
+
}
|
|
33
|
+
/** The literal path the edge routes to it — `/i/`. */
|
|
34
|
+
get prefix() {
|
|
35
|
+
return this.parsed.prefix;
|
|
36
|
+
}
|
|
37
|
+
get native() {
|
|
38
|
+
return this.options.native;
|
|
39
|
+
}
|
|
40
|
+
get surfaceId() {
|
|
41
|
+
return this.options.surfaceId;
|
|
42
|
+
}
|
|
43
|
+
get bucketId() {
|
|
44
|
+
return this.options.bucketId;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/processors/ProcessorBuilder.ts
|
|
49
|
+
/** A native package named in a way no installer could resolve. */
|
|
50
|
+
var ProcessorNativeInvalid = class extends Error {
|
|
51
|
+
packageName;
|
|
52
|
+
constructor(packageName) {
|
|
53
|
+
super(`'${packageName}' is not a package name. Name the package with native code as it is installed — 'sharp', '@napi-rs/canvas' — and its version is taken from the app's package.json.`);
|
|
54
|
+
this.packageName = packageName;
|
|
55
|
+
this.name = "ProcessorNativeInvalid";
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* What `fileServer.process(pattern)` returns: a processor, built up one
|
|
60
|
+
* immutable step at a time and finished by `.handle()`.
|
|
61
|
+
*/
|
|
62
|
+
var ProcessorBuilder = class ProcessorBuilder {
|
|
63
|
+
state;
|
|
64
|
+
constructor(state) {
|
|
65
|
+
this.state = state;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The parameters' schema — the allowlist. Every request is parsed by it
|
|
69
|
+
* before anything runs, and one it refuses is answered 400.
|
|
70
|
+
*/
|
|
71
|
+
params(schema) {
|
|
72
|
+
return new ProcessorBuilder({
|
|
73
|
+
...this.state,
|
|
74
|
+
paramsSchema: schema
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/** Constructs its handler reaches, as `services.<id>`. */
|
|
78
|
+
dependsOn(constructs) {
|
|
79
|
+
const services = servicesOf(constructs);
|
|
80
|
+
return new ProcessorBuilder({
|
|
81
|
+
...this.state,
|
|
82
|
+
services: [...this.state.services.filter((service) => !services.some((s) => s.serviceName === service.serviceName)), ...services],
|
|
83
|
+
constructs: idsOf(constructs, this.state.constructs)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Packages with native code — `sharp` — installed for the target the
|
|
88
|
+
* processor runs on rather than bundled: linux in its image, arm64 on
|
|
89
|
+
* Lambda.
|
|
90
|
+
*/
|
|
91
|
+
native(packages) {
|
|
92
|
+
for (const name of packages) if (!/^(@[a-z0-9._~-]+\/)?[a-z0-9._~-]+$/.test(name)) throw new ProcessorNativeInvalid(name);
|
|
93
|
+
return new ProcessorBuilder({
|
|
94
|
+
...this.state,
|
|
95
|
+
native: [.../* @__PURE__ */ new Set([...this.state.native, ...packages])]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** Milliseconds a request may take, where the target bounds it. */
|
|
99
|
+
timeout(ms) {
|
|
100
|
+
return new ProcessorBuilder({
|
|
101
|
+
...this.state,
|
|
102
|
+
timeout: ms
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/** Megabytes of memory, where the target sets it. */
|
|
106
|
+
memorySize(mb) {
|
|
107
|
+
return new ProcessorBuilder({
|
|
108
|
+
...this.state,
|
|
109
|
+
memorySize: mb
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
handle(fn) {
|
|
113
|
+
const { state } = this;
|
|
114
|
+
return new Processor(state.parsed, fn, {
|
|
115
|
+
surfaceId: state.surfaceId,
|
|
116
|
+
bucketId: state.bucketId,
|
|
117
|
+
origin: state.origin,
|
|
118
|
+
serves: state.serves,
|
|
119
|
+
...state.paramsSchema ? { paramsSchema: state.paramsSchema } : {},
|
|
120
|
+
native: state.native,
|
|
121
|
+
logger: state.logger,
|
|
122
|
+
services: state.services,
|
|
123
|
+
constructs: state.constructs,
|
|
124
|
+
...state.timeout !== void 0 ? { timeout: state.timeout } : {},
|
|
125
|
+
...state.memorySize !== void 0 ? { memorySize: state.memorySize } : {}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/processors/pattern.ts
|
|
131
|
+
/** A pattern a processor cannot be served on. */
|
|
132
|
+
var ProcessorPatternInvalid = class extends Error {
|
|
133
|
+
pattern;
|
|
134
|
+
reason;
|
|
135
|
+
constructor(pattern, reason) {
|
|
136
|
+
super(`'${pattern}' is not a processor pattern: ${reason}. A pattern is a literal first segment, then any \`:name\` parameters, then \`*\` for the object's key — '/i/:width/*'.`);
|
|
137
|
+
this.pattern = pattern;
|
|
138
|
+
this.reason = reason;
|
|
139
|
+
this.name = "ProcessorPatternInvalid";
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
/** @throws {ProcessorPatternInvalid} */
|
|
143
|
+
function parsePattern(pattern) {
|
|
144
|
+
if (!pattern.startsWith("/")) throw new ProcessorPatternInvalid(pattern, "it does not start with /");
|
|
145
|
+
if (!pattern.endsWith("/*")) throw new ProcessorPatternInvalid(pattern, "it does not end with /* — the key");
|
|
146
|
+
const parts = pattern.slice(1, -2).split("/");
|
|
147
|
+
const segments = [];
|
|
148
|
+
const params = [];
|
|
149
|
+
for (const part of parts) {
|
|
150
|
+
if (part === "") throw new ProcessorPatternInvalid(pattern, "it has an empty segment");
|
|
151
|
+
if (part.includes("*")) throw new ProcessorPatternInvalid(pattern, "only its last segment may be *");
|
|
152
|
+
if (part.startsWith(":")) {
|
|
153
|
+
const name = part.slice(1);
|
|
154
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) throw new ProcessorPatternInvalid(pattern, `'${part}' is not a parameter name`);
|
|
155
|
+
if (params.includes(name)) throw new ProcessorPatternInvalid(pattern, `'${name}' appears twice`);
|
|
156
|
+
params.push(name);
|
|
157
|
+
segments.push({
|
|
158
|
+
kind: "param",
|
|
159
|
+
name
|
|
160
|
+
});
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (!/^[A-Za-z0-9._~-]+$/.test(part)) throw new ProcessorPatternInvalid(pattern, `'${part}' has characters a path segment would escape`);
|
|
164
|
+
segments.push({
|
|
165
|
+
kind: "literal",
|
|
166
|
+
value: part
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
const first = segments[0];
|
|
170
|
+
if (!first || first.kind !== "literal") throw new ProcessorPatternInvalid(pattern, "its first segment is a parameter, which would claim every path");
|
|
171
|
+
const literals = [];
|
|
172
|
+
for (const segment of segments) {
|
|
173
|
+
if (segment.kind !== "literal") break;
|
|
174
|
+
literals.push(segment.value);
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
pattern,
|
|
178
|
+
segments,
|
|
179
|
+
params,
|
|
180
|
+
prefix: `/${literals.join("/")}/`
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Match a request path, decoding each parameter and each key segment. A path
|
|
185
|
+
* with an empty key, or one that decodes to a `..` segment, matches nothing.
|
|
186
|
+
*/
|
|
187
|
+
function matchPattern(parsed, path) {
|
|
188
|
+
const parts = path.replace(/^\/+/, "").split("/");
|
|
189
|
+
if (parts.length <= parsed.segments.length) return void 0;
|
|
190
|
+
const params = {};
|
|
191
|
+
for (const [index, segment] of parsed.segments.entries()) {
|
|
192
|
+
const part = decode(parts[index] ?? "");
|
|
193
|
+
if (part === void 0 || part === "") return void 0;
|
|
194
|
+
if (segment.kind === "literal") {
|
|
195
|
+
if (part !== segment.value) return void 0;
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
params[segment.name] = part;
|
|
199
|
+
}
|
|
200
|
+
const keyParts = parts.slice(parsed.segments.length).map(decode);
|
|
201
|
+
if (keyParts.some((part) => part === void 0 || part === "..")) return;
|
|
202
|
+
const key = keyParts.join("/");
|
|
203
|
+
if (key === "" || keyParts.includes("")) return void 0;
|
|
204
|
+
return {
|
|
205
|
+
params,
|
|
206
|
+
key
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/** The path that addresses `key` through the pattern with these parameters. */
|
|
210
|
+
function fillPattern(parsed, params, key) {
|
|
211
|
+
const head = parsed.segments.map((segment) => {
|
|
212
|
+
if (segment.kind === "literal") return segment.value;
|
|
213
|
+
const value = params[segment.name];
|
|
214
|
+
if (value === void 0 || `${value}` === "") throw new ProcessorParamMissing(parsed.pattern, segment.name);
|
|
215
|
+
return encodeURIComponent(`${value}`);
|
|
216
|
+
});
|
|
217
|
+
const tail = key.replace(/^\/+/, "").split("/").map((part) => encodeURIComponent(part));
|
|
218
|
+
return `/${[...head, ...tail].join("/")}`;
|
|
219
|
+
}
|
|
220
|
+
/** A processed URL was asked for without one of the pattern's parameters. */
|
|
221
|
+
var ProcessorParamMissing = class extends Error {
|
|
222
|
+
pattern;
|
|
223
|
+
param;
|
|
224
|
+
constructor(pattern, param) {
|
|
225
|
+
super(`'${pattern}' needs '${param}' to address an object, and it was not given.`);
|
|
226
|
+
this.pattern = pattern;
|
|
227
|
+
this.param = param;
|
|
228
|
+
this.name = "ProcessorParamMissing";
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
function decode(part) {
|
|
232
|
+
try {
|
|
233
|
+
return decodeURIComponent(part);
|
|
234
|
+
} catch {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
//#endregion
|
|
239
|
+
export { parsePattern as a, DERIVED_PREFIX$1 as c, matchPattern as i, Processor as l, ProcessorPatternInvalid as n, ProcessorBuilder as o, fillPattern as r, ProcessorNativeInvalid as s, ProcessorParamMissing as t };
|
|
240
|
+
|
|
241
|
+
//# sourceMappingURL=pattern-C1CEcglD.mjs.map
|