@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
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { n as StandardSchemaV1 } from "./index-DdRjYhiJ.mjs";
|
|
2
|
+
import { r as Consumable } from "./construct-interface-CSA9VeWM.mjs";
|
|
3
|
+
import { n as DeployedStage, r as LocalStage } from "./stages-DaTaoQei.mjs";
|
|
4
|
+
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
5
|
+
import { Service, ServiceRegisterOptions } from "@geekmidas/services";
|
|
6
|
+
//#region src/credential.d.ts
|
|
7
|
+
/** What a credential's schema yields. */
|
|
8
|
+
type Value$1<TSchema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<TSchema>;
|
|
9
|
+
interface CredentialOptions<TSchema extends StandardSchemaV1> {
|
|
10
|
+
/**
|
|
11
|
+
* What the credential must look like.
|
|
12
|
+
*
|
|
13
|
+
* Validated at registration, so a malformed or half-set credential fails
|
|
14
|
+
* when the process starts rather than on the first request that needs the
|
|
15
|
+
* one field somebody forgot.
|
|
16
|
+
*/
|
|
17
|
+
schema: TSchema;
|
|
18
|
+
/**
|
|
19
|
+
* Re-resolve on every registration instead of once per process.
|
|
20
|
+
*
|
|
21
|
+
* Off by default: a credential is resolved once and reused, because the
|
|
22
|
+
* alternative is a fetch on every request. The cost of that default is that
|
|
23
|
+
* a rotated credential needs a restart, which is the right trade for a value
|
|
24
|
+
* that changes a few times a year — and this is the escape hatch for when it
|
|
25
|
+
* is not.
|
|
26
|
+
*/
|
|
27
|
+
refresh?: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare class Credential<TName extends string = string, TSchema extends StandardSchemaV1 = StandardSchemaV1> implements Consumable<TName, Value$1<TSchema>> {
|
|
30
|
+
private readonly options;
|
|
31
|
+
readonly id: TName;
|
|
32
|
+
readonly service: Service<Uncapitalize<TName>, Value$1<TSchema>>;
|
|
33
|
+
/**
|
|
34
|
+
* Declared once and read by both `declare()` and `connect()`, so the key the
|
|
35
|
+
* target publishes and the key the client reads cannot drift.
|
|
36
|
+
*/
|
|
37
|
+
private readonly keys;
|
|
38
|
+
/**
|
|
39
|
+
* The resolved value, held as the *promise* rather than the value.
|
|
40
|
+
*
|
|
41
|
+
* Caching the promise is what makes two concurrent registrations share one
|
|
42
|
+
* resolution: caching the value would let both start before either finished,
|
|
43
|
+
* which is a duplicated fetch every cold start rather than never.
|
|
44
|
+
*/
|
|
45
|
+
private resolved?;
|
|
46
|
+
constructor(id: ConstructName<TName>, options: CredentialOptions<TSchema>);
|
|
47
|
+
/**
|
|
48
|
+
* What the stage's `<ID>_CREDENTIALS` must look like — the schema the value
|
|
49
|
+
* is validated against where it is read. Public so a tool setting the value
|
|
50
|
+
* (`gkm secrets:add`) can check it, and describe its fields, before it is
|
|
51
|
+
* stored rather than at the first request.
|
|
52
|
+
*/
|
|
53
|
+
get credentialsSchema(): TSchema;
|
|
54
|
+
declare(): Declaration[];
|
|
55
|
+
private connect;
|
|
56
|
+
private resolve;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A credentials key, read and validated against its schema.
|
|
60
|
+
*
|
|
61
|
+
* Shared with every construct that holds a third party's credentials — an
|
|
62
|
+
* `ExternalApi` reads its own the same way — so the shape a stage stores and
|
|
63
|
+
* the error a bad value raises are the same everywhere.
|
|
64
|
+
*
|
|
65
|
+
* @throws {MalformedCredential} when the value is not what the schema says.
|
|
66
|
+
*/
|
|
67
|
+
declare function readCredentials<TSchema extends StandardSchemaV1>(id: string, key: string, schema: TSchema, envParser: ServiceRegisterOptions['envParser']): Promise<Value$1<TSchema>>;
|
|
68
|
+
/**
|
|
69
|
+
* The raw environment value as the thing the schema should see.
|
|
70
|
+
*
|
|
71
|
+
* JSON when it is JSON, and the string itself when it is not — a credential
|
|
72
|
+
* with a single opaque field is ordinary, and requiring `"…"` around it would
|
|
73
|
+
* be ceremony that every operator setting one by hand would get wrong once.
|
|
74
|
+
*
|
|
75
|
+
* Exported so a tool checking a value before it is stored reads it exactly as
|
|
76
|
+
* the process that uses it will.
|
|
77
|
+
*/
|
|
78
|
+
declare function decodeCredentials(raw: string): unknown;
|
|
79
|
+
/** A credential was set, and is not what its schema says it should be. */
|
|
80
|
+
declare class MalformedCredential extends Error {
|
|
81
|
+
readonly id: string;
|
|
82
|
+
readonly key: string;
|
|
83
|
+
readonly issues: unknown;
|
|
84
|
+
constructor(id: string, key: string, issues: unknown);
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/external-api.d.ts
|
|
88
|
+
/** What a credentials schema yields. */
|
|
89
|
+
type Value<TSchema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<TSchema>;
|
|
90
|
+
/**
|
|
91
|
+
* Where an external API answers: one URL for every stage, or one per stage
|
|
92
|
+
* name with `default` for any stage not listed.
|
|
93
|
+
*
|
|
94
|
+
* Keyed by the stages `gkm.config.ts` declares once `.gkm/stages.d.ts` exists,
|
|
95
|
+
* so a key that names no stage — `prodution` — is a type error rather than a
|
|
96
|
+
* URL nothing reads. Without the file any key goes, as before.
|
|
97
|
+
*/
|
|
98
|
+
type ExternalApiUrl = string | (string extends LocalStage | DeployedStage ? Readonly<Record<string, string>> : { readonly [S in LocalStage | DeployedStage]?: string; } & {
|
|
99
|
+
readonly default?: string;
|
|
100
|
+
});
|
|
101
|
+
interface ExternalApiOptions<TSchema extends StandardSchemaV1, TClient> {
|
|
102
|
+
/**
|
|
103
|
+
* Where it answers deployed: one URL for every stage, or one per stage
|
|
104
|
+
* name, with `default` for any stage not listed.
|
|
105
|
+
*/
|
|
106
|
+
url: ExternalApiUrl;
|
|
107
|
+
/** What the stage's `<ID>_CREDENTIALS` must look like. */
|
|
108
|
+
credentials: TSchema;
|
|
109
|
+
/** What a handler is handed, built from where it answers and the credentials. */
|
|
110
|
+
client: (connection: {
|
|
111
|
+
url: string;
|
|
112
|
+
credentials: Value<TSchema>;
|
|
113
|
+
}) => TClient | Promise<TClient>;
|
|
114
|
+
}
|
|
115
|
+
declare class ExternalApi<TName extends string = string, TSchema extends StandardSchemaV1 = StandardSchemaV1, TClient = unknown> implements Consumable<TName, TClient> {
|
|
116
|
+
private readonly options;
|
|
117
|
+
readonly id: TName;
|
|
118
|
+
readonly service: Service<Uncapitalize<TName>, TClient>;
|
|
119
|
+
/** Read by both `declare()` and `connect()`, so the two cannot drift. */
|
|
120
|
+
private readonly keys;
|
|
121
|
+
/** The promise, so concurrent registrations share one client. */
|
|
122
|
+
private connected?;
|
|
123
|
+
constructor(id: ConstructName<TName>, options: ExternalApiOptions<TSchema, TClient>);
|
|
124
|
+
/**
|
|
125
|
+
* What the stage's `<ID>_CREDENTIALS` must look like — the schema the value
|
|
126
|
+
* is validated against where it is read. Public so a tool setting the value
|
|
127
|
+
* (`gkm secrets:add`) can check it, and describe its fields, before it is
|
|
128
|
+
* stored rather than at the first request.
|
|
129
|
+
*/
|
|
130
|
+
get credentialsSchema(): TSchema;
|
|
131
|
+
declare(): Declaration[];
|
|
132
|
+
private connect;
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/fake.d.ts
|
|
136
|
+
/**
|
|
137
|
+
* Marks a fake. A registered symbol, so a fake built by a second copy of this
|
|
138
|
+
* package — a linked workspace, two versions in a lockfile — is still one.
|
|
139
|
+
*/
|
|
140
|
+
declare const FAKE: unique symbol;
|
|
141
|
+
/** Anything that answers a request — a Hono app, or a bare `{ fetch }`. */
|
|
142
|
+
interface FetchHandler {
|
|
143
|
+
fetch(request: Request): Response | Promise<Response>;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* What a construct's credentials look like going in, for a fake to supply —
|
|
147
|
+
* an external API's `credentials` schema, or a credential's `schema`.
|
|
148
|
+
*/
|
|
149
|
+
type CredentialsOf<TConstruct> = TConstruct extends ExternalApi<string, infer TSchema, unknown> ? StandardSchemaV1.InferInput<TSchema> : TConstruct extends Credential<string, infer TSchema> ? StandardSchemaV1.InferInput<TSchema> : unknown;
|
|
150
|
+
/**
|
|
151
|
+
* A third party's stand-in, as `test/fakes/<id>.ts` default-exports it.
|
|
152
|
+
*
|
|
153
|
+
* `credentials` are what a local or test stage is handed as `<ID>_CREDENTIALS`
|
|
154
|
+
* in place of the stage's own: what an external API's fake accepts, or a
|
|
155
|
+
* credential's test value.
|
|
156
|
+
*/
|
|
157
|
+
type Fake = {
|
|
158
|
+
readonly [FAKE]: true;
|
|
159
|
+
readonly credentials: unknown;
|
|
160
|
+
} & ({
|
|
161
|
+
readonly kind: 'app';
|
|
162
|
+
/** Served by gkm: in-process in a test, on its own port in `gkm dev`. */
|
|
163
|
+
readonly handler: FetchHandler;
|
|
164
|
+
} | {
|
|
165
|
+
readonly kind: 'image';
|
|
166
|
+
/** The provider's own local server, run as a container. */
|
|
167
|
+
readonly image: string;
|
|
168
|
+
/** The port it listens on inside the container. */
|
|
169
|
+
readonly port: number;
|
|
170
|
+
} | {
|
|
171
|
+
/** A `Credential`'s test value — nothing to serve. */
|
|
172
|
+
readonly kind: 'credential';
|
|
173
|
+
});
|
|
174
|
+
/**
|
|
175
|
+
* Build the fake `test/fakes/<id>.ts` default-exports.
|
|
176
|
+
*
|
|
177
|
+
* Pass the construct's type to have the value checked against its schema —
|
|
178
|
+
* `fake.app<typeof polar>(…)`, `fake.credential<typeof stripe>(…)`.
|
|
179
|
+
*/
|
|
180
|
+
declare const fake: {
|
|
181
|
+
/** A working implementation of an external API, kept beside the tests that use it. */
|
|
182
|
+
app<TApi = unknown>(handler: FetchHandler, options: {
|
|
183
|
+
credentials: CredentialsOf<TApi>;
|
|
184
|
+
}): Fake;
|
|
185
|
+
/** A local server an external API's provider publishes — `stripe/stripe-mock`. */
|
|
186
|
+
image<TApi = unknown>(image: string, options: {
|
|
187
|
+
port: number;
|
|
188
|
+
credentials: CredentialsOf<TApi>;
|
|
189
|
+
}): Fake;
|
|
190
|
+
/**
|
|
191
|
+
* A `Credential`'s value on the test stage and under `gkm dev --fake`, as
|
|
192
|
+
* its schema takes it — a string, or the object a JSON credential holds.
|
|
193
|
+
* It is validated where it is read, like the real one.
|
|
194
|
+
*/
|
|
195
|
+
credential<TCredential = unknown>(credentials: CredentialsOf<TCredential>): Fake;
|
|
196
|
+
};
|
|
197
|
+
/** Whether a value is a fake — what gkm asks of a `test/fakes` default export. */
|
|
198
|
+
declare function isFake(value: unknown): value is Fake;
|
|
199
|
+
//#endregion
|
|
200
|
+
export { ExternalApi as a, Credential as c, decodeCredentials as d, readCredentials as f, isFake as i, CredentialOptions as l, FetchHandler as n, ExternalApiOptions as o, fake as r, ExternalApiUrl as s, Fake as t, MalformedCredential as u };
|
|
201
|
+
//# sourceMappingURL=fake-BqhP8RRQ.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-BqhP8RRQ.d.mts","names":["Value"],"sources":["../src/credential.ts","../src/external-api.ts","../src/fake.ts"],"mappings":";;;;;;;KAiEKA,QAAM,gBAAgB,oBAC1B,iBAAiB,YAAY;UAEb,kBAAkB,gBAAgB;;;;;;;;EAQlD,QAAQ;;;;;;;;;;EAUR;;cAGY,WACZ,+BACA,gBAAgB,mBAAmB,6BACvB,WAAW,OAAOA,QAAM;mBA6BlB;WApBT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQA,QAAM;;;;;mBAMpC;;;;;;;;UAST;EAER,YACC,IAAI,cAAc,QACD,SAAS,kBAAkB;;;;;;;MAoBzC,qBAAqB;EAIzB,WAAW;UAUH;UAQA;;;;;;;;;;;iBAmBa,gBAAgB,gBAAgB,kBACrD,YACA,aACA,QAAQ,SACR,WAAW,sCACT,QAAQA,QAAM;;;;;;;;;;;iBAsBD,kBAAkB;;cAoBrB,4BAA4B;WAE9B;WACA;WACA;EAHV,YACU,YACA,aACA;;;;;KCpLN,MAAM,gBAAgB,oBAC1B,iBAAiB,YAAY;;;;;;;;;KAUlB,0CAEO,aAAa,gBAC3B,SAAS,sCACG,KAAK,aAAa;WACrB;;UAGG,mBAAmB,gBAAgB,kBAAkB;;;;;EAKrE,KAAK;;EAEL,aAAa;;EAEb,SAAS;IACR;IACA,aAAa,MAAM;QACd,UAAU,QAAQ;;cAGZ,YACZ,+BACA,gBAAgB,mBAAmB,kBACnC,8BACY,WAAW,OAAO;mBAeZ;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;mBAG9B;;UAGT;EAER,YACC,IAAI,cAAc,QACD,SAAS,mBAAmB,SAAS;;;;;;;MA0BnD,qBAAqB;EAIzB,WAAW;UAaG;;;;;;;;cCjHT;;UAGW;EAChB,MAAM,SAAS,UAAU,WAAW,QAAQ;;;;;;KAOxC,cAAc,cAClB,mBAAmB,0BAA0B,oBAC1C,iBAAiB,WAAW,WAC5B,mBAAmB,yBAAyB,WAC3C,iBAAiB,WAAW;;;;;;;;KAUrB;YACD;WACD;;WAGE;;WAEA,SAAS;;WAGT;;WAEA;;WAEA;;;WAIA;;;;;;;;cAUC;;EAEZ,IAAI,gBAAc,SACR,cAAY;IACV,aAAa,cAAc;MACpC;;EAUH,MAAM,gBAAc,eACN;IACF;IAAc,aAAa,cAAc;MAClD;;;;;;EAeH,WAAW,uBAAqB,aAClB,cAAc,eACzB;;;iBAMY,OAAO,iBAAiB,SAAS"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { n as StandardSchemaV1 } from "./index-DdRjYhiJ.cjs";
|
|
2
|
+
import { r as Consumable } from "./construct-interface-DugP0E5q.cjs";
|
|
3
|
+
import { n as DeployedStage, r as LocalStage } from "./stages-DaTaoQei.cjs";
|
|
4
|
+
import { Service, ServiceRegisterOptions } from "@geekmidas/services";
|
|
5
|
+
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
6
|
+
//#region src/credential.d.ts
|
|
7
|
+
/** What a credential's schema yields. */
|
|
8
|
+
type Value$1<TSchema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<TSchema>;
|
|
9
|
+
interface CredentialOptions<TSchema extends StandardSchemaV1> {
|
|
10
|
+
/**
|
|
11
|
+
* What the credential must look like.
|
|
12
|
+
*
|
|
13
|
+
* Validated at registration, so a malformed or half-set credential fails
|
|
14
|
+
* when the process starts rather than on the first request that needs the
|
|
15
|
+
* one field somebody forgot.
|
|
16
|
+
*/
|
|
17
|
+
schema: TSchema;
|
|
18
|
+
/**
|
|
19
|
+
* Re-resolve on every registration instead of once per process.
|
|
20
|
+
*
|
|
21
|
+
* Off by default: a credential is resolved once and reused, because the
|
|
22
|
+
* alternative is a fetch on every request. The cost of that default is that
|
|
23
|
+
* a rotated credential needs a restart, which is the right trade for a value
|
|
24
|
+
* that changes a few times a year — and this is the escape hatch for when it
|
|
25
|
+
* is not.
|
|
26
|
+
*/
|
|
27
|
+
refresh?: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare class Credential<TName extends string = string, TSchema extends StandardSchemaV1 = StandardSchemaV1> implements Consumable<TName, Value$1<TSchema>> {
|
|
30
|
+
private readonly options;
|
|
31
|
+
readonly id: TName;
|
|
32
|
+
readonly service: Service<Uncapitalize<TName>, Value$1<TSchema>>;
|
|
33
|
+
/**
|
|
34
|
+
* Declared once and read by both `declare()` and `connect()`, so the key the
|
|
35
|
+
* target publishes and the key the client reads cannot drift.
|
|
36
|
+
*/
|
|
37
|
+
private readonly keys;
|
|
38
|
+
/**
|
|
39
|
+
* The resolved value, held as the *promise* rather than the value.
|
|
40
|
+
*
|
|
41
|
+
* Caching the promise is what makes two concurrent registrations share one
|
|
42
|
+
* resolution: caching the value would let both start before either finished,
|
|
43
|
+
* which is a duplicated fetch every cold start rather than never.
|
|
44
|
+
*/
|
|
45
|
+
private resolved?;
|
|
46
|
+
constructor(id: ConstructName<TName>, options: CredentialOptions<TSchema>);
|
|
47
|
+
/**
|
|
48
|
+
* What the stage's `<ID>_CREDENTIALS` must look like — the schema the value
|
|
49
|
+
* is validated against where it is read. Public so a tool setting the value
|
|
50
|
+
* (`gkm secrets:add`) can check it, and describe its fields, before it is
|
|
51
|
+
* stored rather than at the first request.
|
|
52
|
+
*/
|
|
53
|
+
get credentialsSchema(): TSchema;
|
|
54
|
+
declare(): Declaration[];
|
|
55
|
+
private connect;
|
|
56
|
+
private resolve;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A credentials key, read and validated against its schema.
|
|
60
|
+
*
|
|
61
|
+
* Shared with every construct that holds a third party's credentials — an
|
|
62
|
+
* `ExternalApi` reads its own the same way — so the shape a stage stores and
|
|
63
|
+
* the error a bad value raises are the same everywhere.
|
|
64
|
+
*
|
|
65
|
+
* @throws {MalformedCredential} when the value is not what the schema says.
|
|
66
|
+
*/
|
|
67
|
+
declare function readCredentials<TSchema extends StandardSchemaV1>(id: string, key: string, schema: TSchema, envParser: ServiceRegisterOptions['envParser']): Promise<Value$1<TSchema>>;
|
|
68
|
+
/**
|
|
69
|
+
* The raw environment value as the thing the schema should see.
|
|
70
|
+
*
|
|
71
|
+
* JSON when it is JSON, and the string itself when it is not — a credential
|
|
72
|
+
* with a single opaque field is ordinary, and requiring `"…"` around it would
|
|
73
|
+
* be ceremony that every operator setting one by hand would get wrong once.
|
|
74
|
+
*
|
|
75
|
+
* Exported so a tool checking a value before it is stored reads it exactly as
|
|
76
|
+
* the process that uses it will.
|
|
77
|
+
*/
|
|
78
|
+
declare function decodeCredentials(raw: string): unknown;
|
|
79
|
+
/** A credential was set, and is not what its schema says it should be. */
|
|
80
|
+
declare class MalformedCredential extends Error {
|
|
81
|
+
readonly id: string;
|
|
82
|
+
readonly key: string;
|
|
83
|
+
readonly issues: unknown;
|
|
84
|
+
constructor(id: string, key: string, issues: unknown);
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/external-api.d.ts
|
|
88
|
+
/** What a credentials schema yields. */
|
|
89
|
+
type Value<TSchema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<TSchema>;
|
|
90
|
+
/**
|
|
91
|
+
* Where an external API answers: one URL for every stage, or one per stage
|
|
92
|
+
* name with `default` for any stage not listed.
|
|
93
|
+
*
|
|
94
|
+
* Keyed by the stages `gkm.config.ts` declares once `.gkm/stages.d.ts` exists,
|
|
95
|
+
* so a key that names no stage — `prodution` — is a type error rather than a
|
|
96
|
+
* URL nothing reads. Without the file any key goes, as before.
|
|
97
|
+
*/
|
|
98
|
+
type ExternalApiUrl = string | (string extends LocalStage | DeployedStage ? Readonly<Record<string, string>> : { readonly [S in LocalStage | DeployedStage]?: string; } & {
|
|
99
|
+
readonly default?: string;
|
|
100
|
+
});
|
|
101
|
+
interface ExternalApiOptions<TSchema extends StandardSchemaV1, TClient> {
|
|
102
|
+
/**
|
|
103
|
+
* Where it answers deployed: one URL for every stage, or one per stage
|
|
104
|
+
* name, with `default` for any stage not listed.
|
|
105
|
+
*/
|
|
106
|
+
url: ExternalApiUrl;
|
|
107
|
+
/** What the stage's `<ID>_CREDENTIALS` must look like. */
|
|
108
|
+
credentials: TSchema;
|
|
109
|
+
/** What a handler is handed, built from where it answers and the credentials. */
|
|
110
|
+
client: (connection: {
|
|
111
|
+
url: string;
|
|
112
|
+
credentials: Value<TSchema>;
|
|
113
|
+
}) => TClient | Promise<TClient>;
|
|
114
|
+
}
|
|
115
|
+
declare class ExternalApi<TName extends string = string, TSchema extends StandardSchemaV1 = StandardSchemaV1, TClient = unknown> implements Consumable<TName, TClient> {
|
|
116
|
+
private readonly options;
|
|
117
|
+
readonly id: TName;
|
|
118
|
+
readonly service: Service<Uncapitalize<TName>, TClient>;
|
|
119
|
+
/** Read by both `declare()` and `connect()`, so the two cannot drift. */
|
|
120
|
+
private readonly keys;
|
|
121
|
+
/** The promise, so concurrent registrations share one client. */
|
|
122
|
+
private connected?;
|
|
123
|
+
constructor(id: ConstructName<TName>, options: ExternalApiOptions<TSchema, TClient>);
|
|
124
|
+
/**
|
|
125
|
+
* What the stage's `<ID>_CREDENTIALS` must look like — the schema the value
|
|
126
|
+
* is validated against where it is read. Public so a tool setting the value
|
|
127
|
+
* (`gkm secrets:add`) can check it, and describe its fields, before it is
|
|
128
|
+
* stored rather than at the first request.
|
|
129
|
+
*/
|
|
130
|
+
get credentialsSchema(): TSchema;
|
|
131
|
+
declare(): Declaration[];
|
|
132
|
+
private connect;
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/fake.d.ts
|
|
136
|
+
/**
|
|
137
|
+
* Marks a fake. A registered symbol, so a fake built by a second copy of this
|
|
138
|
+
* package — a linked workspace, two versions in a lockfile — is still one.
|
|
139
|
+
*/
|
|
140
|
+
declare const FAKE: unique symbol;
|
|
141
|
+
/** Anything that answers a request — a Hono app, or a bare `{ fetch }`. */
|
|
142
|
+
interface FetchHandler {
|
|
143
|
+
fetch(request: Request): Response | Promise<Response>;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* What a construct's credentials look like going in, for a fake to supply —
|
|
147
|
+
* an external API's `credentials` schema, or a credential's `schema`.
|
|
148
|
+
*/
|
|
149
|
+
type CredentialsOf<TConstruct> = TConstruct extends ExternalApi<string, infer TSchema, unknown> ? StandardSchemaV1.InferInput<TSchema> : TConstruct extends Credential<string, infer TSchema> ? StandardSchemaV1.InferInput<TSchema> : unknown;
|
|
150
|
+
/**
|
|
151
|
+
* A third party's stand-in, as `test/fakes/<id>.ts` default-exports it.
|
|
152
|
+
*
|
|
153
|
+
* `credentials` are what a local or test stage is handed as `<ID>_CREDENTIALS`
|
|
154
|
+
* in place of the stage's own: what an external API's fake accepts, or a
|
|
155
|
+
* credential's test value.
|
|
156
|
+
*/
|
|
157
|
+
type Fake = {
|
|
158
|
+
readonly [FAKE]: true;
|
|
159
|
+
readonly credentials: unknown;
|
|
160
|
+
} & ({
|
|
161
|
+
readonly kind: 'app';
|
|
162
|
+
/** Served by gkm: in-process in a test, on its own port in `gkm dev`. */
|
|
163
|
+
readonly handler: FetchHandler;
|
|
164
|
+
} | {
|
|
165
|
+
readonly kind: 'image';
|
|
166
|
+
/** The provider's own local server, run as a container. */
|
|
167
|
+
readonly image: string;
|
|
168
|
+
/** The port it listens on inside the container. */
|
|
169
|
+
readonly port: number;
|
|
170
|
+
} | {
|
|
171
|
+
/** A `Credential`'s test value — nothing to serve. */
|
|
172
|
+
readonly kind: 'credential';
|
|
173
|
+
});
|
|
174
|
+
/**
|
|
175
|
+
* Build the fake `test/fakes/<id>.ts` default-exports.
|
|
176
|
+
*
|
|
177
|
+
* Pass the construct's type to have the value checked against its schema —
|
|
178
|
+
* `fake.app<typeof polar>(…)`, `fake.credential<typeof stripe>(…)`.
|
|
179
|
+
*/
|
|
180
|
+
declare const fake: {
|
|
181
|
+
/** A working implementation of an external API, kept beside the tests that use it. */
|
|
182
|
+
app<TApi = unknown>(handler: FetchHandler, options: {
|
|
183
|
+
credentials: CredentialsOf<TApi>;
|
|
184
|
+
}): Fake;
|
|
185
|
+
/** A local server an external API's provider publishes — `stripe/stripe-mock`. */
|
|
186
|
+
image<TApi = unknown>(image: string, options: {
|
|
187
|
+
port: number;
|
|
188
|
+
credentials: CredentialsOf<TApi>;
|
|
189
|
+
}): Fake;
|
|
190
|
+
/**
|
|
191
|
+
* A `Credential`'s value on the test stage and under `gkm dev --fake`, as
|
|
192
|
+
* its schema takes it — a string, or the object a JSON credential holds.
|
|
193
|
+
* It is validated where it is read, like the real one.
|
|
194
|
+
*/
|
|
195
|
+
credential<TCredential = unknown>(credentials: CredentialsOf<TCredential>): Fake;
|
|
196
|
+
};
|
|
197
|
+
/** Whether a value is a fake — what gkm asks of a `test/fakes` default export. */
|
|
198
|
+
declare function isFake(value: unknown): value is Fake;
|
|
199
|
+
//#endregion
|
|
200
|
+
export { ExternalApi as a, Credential as c, decodeCredentials as d, readCredentials as f, isFake as i, CredentialOptions as l, FetchHandler as n, ExternalApiOptions as o, fake as r, ExternalApiUrl as s, Fake as t, MalformedCredential as u };
|
|
201
|
+
//# sourceMappingURL=fake-DqieDYYA.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-DqieDYYA.d.cts","names":["Value"],"sources":["../src/credential.ts","../src/external-api.ts","../src/fake.ts"],"mappings":";;;;;;;KAiEKA,QAAM,gBAAgB,oBAC1B,iBAAiB,YAAY;UAEb,kBAAkB,gBAAgB;;;;;;;;EAQlD,QAAQ;;;;;;;;;;EAUR;;cAGY,WACZ,+BACA,gBAAgB,mBAAmB,6BACvB,WAAW,OAAOA,QAAM;mBA6BlB;WApBT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQA,QAAM;;;;;mBAMpC;;;;;;;;UAST;EAER,YACC,IAAI,cAAc,QACD,SAAS,kBAAkB;;;;;;;MAoBzC,qBAAqB;EAIzB,WAAW;UAUH;UAQA;;;;;;;;;;;iBAmBa,gBAAgB,gBAAgB,kBACrD,YACA,aACA,QAAQ,SACR,WAAW,sCACT,QAAQA,QAAM;;;;;;;;;;;iBAsBD,kBAAkB;;cAoBrB,4BAA4B;WAE9B;WACA;WACA;EAHV,YACU,YACA,aACA;;;;;KCpLN,MAAM,gBAAgB,oBAC1B,iBAAiB,YAAY;;;;;;;;;KAUlB,0CAEO,aAAa,gBAC3B,SAAS,sCACG,KAAK,aAAa;WACrB;;UAGG,mBAAmB,gBAAgB,kBAAkB;;;;;EAKrE,KAAK;;EAEL,aAAa;;EAEb,SAAS;IACR;IACA,aAAa,MAAM;QACd,UAAU,QAAQ;;cAGZ,YACZ,+BACA,gBAAgB,mBAAmB,kBACnC,8BACY,WAAW,OAAO;mBAeZ;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;mBAG9B;;UAGT;EAER,YACC,IAAI,cAAc,QACD,SAAS,mBAAmB,SAAS;;;;;;;MA0BnD,qBAAqB;EAIzB,WAAW;UAaG;;;;;;;;cCjHT;;UAGW;EAChB,MAAM,SAAS,UAAU,WAAW,QAAQ;;;;;;KAOxC,cAAc,cAClB,mBAAmB,0BAA0B,oBAC1C,iBAAiB,WAAW,WAC5B,mBAAmB,yBAAyB,WAC3C,iBAAiB,WAAW;;;;;;;;KAUrB;YACD;WACD;;WAGE;;WAEA,SAAS;;WAGT;;WAEA;;WAEA;;;WAIA;;;;;;;;cAUC;;EAEZ,IAAI,gBAAc,SACR,cAAY;IACV,aAAa,cAAc;MACpC;;EAUH,MAAM,gBAAc,eACN;IACF;IAAc,aAAa,cAAc;MAClD;;;;;;EAeH,WAAW,uBAAqB,aAClB,cAAc,eACzB;;;iBAMY,OAAO,iBAAiB,SAAS"}
|
package/dist/file-server.cjs
CHANGED
|
@@ -1,37 +1,52 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_expire = require("./expire-CieftS01.cjs");
|
|
3
|
+
const require_pattern = require("./pattern-QFaUIr77.cjs");
|
|
2
4
|
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
3
5
|
let _geekmidas_storage = require("@geekmidas/storage");
|
|
6
|
+
let _geekmidas_logger_console = require("@geekmidas/logger/console");
|
|
4
7
|
//#region src/file-server.ts
|
|
8
|
+
/** A processed URL was asked of a file server the processor is not on. */
|
|
9
|
+
var ProcessorNotOnThisServer = class extends Error {
|
|
10
|
+
pattern;
|
|
11
|
+
server;
|
|
12
|
+
expected;
|
|
13
|
+
constructor(pattern, server, expected) {
|
|
14
|
+
super(`The processor at '${pattern}' belongs to '${server}', not '${expected}'. Ask its own file server for the URL: services.<its id>.processedUrl(…).`);
|
|
15
|
+
this.pattern = pattern;
|
|
16
|
+
this.server = server;
|
|
17
|
+
this.expected = expected;
|
|
18
|
+
this.name = "ProcessorNotOnThisServer";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
/** An immutable pattern that no open pattern admits. */
|
|
22
|
+
var ImmutableNotOpen = class extends Error {
|
|
23
|
+
id;
|
|
24
|
+
pattern;
|
|
25
|
+
open;
|
|
26
|
+
constructor(id, pattern, open) {
|
|
27
|
+
super(`'${id}' says '${pattern}' is immutable, and no open path admits it` + (open.length ? ` (open: ${open.join(", ")})` : " — it opens none") + ". Only an open path is served by the edge, so only one can be cached there: add it to `open`, or narrow it to one that is.");
|
|
28
|
+
this.id = id;
|
|
29
|
+
this.pattern = pattern;
|
|
30
|
+
this.open = open;
|
|
31
|
+
this.name = "ImmutableNotOpen";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
5
34
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `ObjectStorage` is the bucket: it writes, it presigns, and its URL is never
|
|
9
|
-
* public. Serving those objects on a domain is a different thing, and it is a
|
|
10
|
-
* construct of its own rather than a flag on the bucket — see
|
|
11
|
-
* `docs/design/constructs-paradigm.md`, "Why a separate construct, and what it
|
|
12
|
-
* costs", for the comparison that rules the other two shapes out.
|
|
13
|
-
*
|
|
14
|
-
* ```ts
|
|
15
|
-
* export const uploads = new FileServer('Uploads', { open: ['brand/**'] });
|
|
16
|
-
*
|
|
17
|
-
* uploads.getUploadURL({ path, contentType }) // an S3 presign at the bucket
|
|
18
|
-
* uploads.url('brand/logo.png') // open path — no signature
|
|
19
|
-
* uploads.signedUrl('invoices/7.pdf') // one object, one recipient
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* **One construct, one client, both halves.** How a file lands in the bucket is
|
|
23
|
-
* the same whether or not it is served, so splitting the upload half from the
|
|
24
|
-
* serving half would be ceremony rather than safety. The client is a *superset*
|
|
25
|
-
* of `StorageClient`, made literal in the type, so anything taking
|
|
26
|
-
* `services.uploads` keeps compiling when the construct behind it grows a
|
|
27
|
-
* serving half.
|
|
28
|
-
*
|
|
29
|
-
* **The id names the bucket, not the surface.** This is the detail that has to
|
|
30
|
-
* be right before anything ships, because getting it backwards is destructive:
|
|
31
|
-
* the migration people actually perform is serving a bucket they already have,
|
|
32
|
-
* and naming the bucket after the construct makes that edit *add* a node rather
|
|
33
|
-
* than rename the one holding the data.
|
|
35
|
+
* A bucket setting given to a file server that fronts a bucket declared
|
|
36
|
+
* elsewhere — where the bucket's own construct is the one that says it.
|
|
34
37
|
*/
|
|
38
|
+
var BucketOptionOnOrigin = class extends Error {
|
|
39
|
+
server;
|
|
40
|
+
origin;
|
|
41
|
+
option;
|
|
42
|
+
constructor(server, origin, option) {
|
|
43
|
+
super(`'${server}' fronts '${origin}', which declares itself, so '${option}' belongs on the construct that declares '${origin}', not on the file server.`);
|
|
44
|
+
this.server = server;
|
|
45
|
+
this.origin = origin;
|
|
46
|
+
this.option = option;
|
|
47
|
+
this.name = "BucketOptionOnOrigin";
|
|
48
|
+
}
|
|
49
|
+
};
|
|
35
50
|
/** A key was asked to be served unsigned, and no open pattern admits it. */
|
|
36
51
|
var NotOpen = class extends Error {
|
|
37
52
|
key;
|
|
@@ -50,17 +65,33 @@ var FileServer = class {
|
|
|
50
65
|
/** The id of the surface node, as opposed to the bucket's. */
|
|
51
66
|
surfaceId;
|
|
52
67
|
open;
|
|
68
|
+
immutable;
|
|
69
|
+
/** The vended bucket's expiry, checked once: prefix → days. */
|
|
70
|
+
expire;
|
|
71
|
+
/** Days its processors' derivatives are kept, when it says. */
|
|
72
|
+
derivedDays;
|
|
53
73
|
/**
|
|
54
74
|
* Declared once and read by both `declare()` and `connect()`, so the keys the
|
|
55
75
|
* target publishes and the keys the client reads cannot drift.
|
|
56
76
|
*/
|
|
57
77
|
keys;
|
|
78
|
+
/**
|
|
79
|
+
* How a processor reaches the bucket: the bucket's own URL and nothing of
|
|
80
|
+
* the serving half, which a processor never needs. A field, not a getter:
|
|
81
|
+
* services are cached by object identity.
|
|
82
|
+
*/
|
|
83
|
+
origin;
|
|
58
84
|
constructor(id, options = {}) {
|
|
59
85
|
this.options = options;
|
|
60
86
|
const canonical = (0, _geekmidas_manifest.canonicalId)(id);
|
|
61
87
|
this.id = canonical;
|
|
62
88
|
this.open = options.open ?? [];
|
|
89
|
+
this.immutable = options.immutable ?? [];
|
|
90
|
+
for (const pattern of this.immutable) if (!this.covers(pattern)) throw new ImmutableNotOpen(canonical, pattern, this.open);
|
|
63
91
|
const originId = options.origin?.id ?? canonical;
|
|
92
|
+
if (options.origin && options.expire) throw new BucketOptionOnOrigin(canonical, originId, "expire");
|
|
93
|
+
this.expire = require_expire.expiryDays(canonical, options.expire);
|
|
94
|
+
this.derivedDays = options.derived ? require_expire.expiryDays(canonical, { [_geekmidas_manifest.DERIVED_PREFIX]: options.derived })?.[_geekmidas_manifest.DERIVED_PREFIX] : void 0;
|
|
64
95
|
this.surfaceId = `${canonical}Server`;
|
|
65
96
|
this.keys = {
|
|
66
97
|
origin: (0, _geekmidas_manifest.provideKey)(originId, "url"),
|
|
@@ -70,6 +101,48 @@ var FileServer = class {
|
|
|
70
101
|
serviceName: (0, _geekmidas_manifest.serviceKey)(canonical),
|
|
71
102
|
register: (registerOptions) => this.connect(registerOptions)
|
|
72
103
|
};
|
|
104
|
+
const originKey = this.keys.origin;
|
|
105
|
+
this.origin = {
|
|
106
|
+
serviceName: `${(0, _geekmidas_manifest.serviceKey)(originId)}ProcessorOrigin`,
|
|
107
|
+
register: ({ envParser }) => {
|
|
108
|
+
const { url } = envParser.create((get) => ({ url: get(originKey).string() })).parse();
|
|
109
|
+
return (0, _geekmidas_storage.createStorageClient)(url);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A processor behind one path pattern of this server: a handler that makes
|
|
115
|
+
* a derivative of an open object on read.
|
|
116
|
+
*
|
|
117
|
+
* ```ts
|
|
118
|
+
* export const thumbnails = assets
|
|
119
|
+
* .process('/i/:width/*')
|
|
120
|
+
* .params(z.object({ width: z.enum(['64', '256', '1024']) }))
|
|
121
|
+
* .native(['sharp'])
|
|
122
|
+
* .handle(async ({ params, object }) => ({
|
|
123
|
+
* body: await sharp(await object.bytes()).resize(Number(params.width)).webp().toBuffer(),
|
|
124
|
+
* contentType: 'image/webp',
|
|
125
|
+
* cache: 'immutable',
|
|
126
|
+
* }));
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* Open paths only: a key no `open` pattern admits is answered 404, as an
|
|
130
|
+
* unsigned read of it would be.
|
|
131
|
+
*
|
|
132
|
+
* @throws {ProcessorPatternInvalid} for a pattern the edge cannot route.
|
|
133
|
+
*/
|
|
134
|
+
process(pattern, options = {}) {
|
|
135
|
+
return new require_pattern.ProcessorBuilder({
|
|
136
|
+
parsed: require_pattern.parsePattern(pattern),
|
|
137
|
+
surfaceId: this.surfaceId,
|
|
138
|
+
bucketId: this.options.origin?.id ?? this.id,
|
|
139
|
+
origin: this.origin,
|
|
140
|
+
serves: (key) => this.serves(key),
|
|
141
|
+
logger: options.logger ?? _geekmidas_logger_console.DEFAULT_LOGGER,
|
|
142
|
+
native: [],
|
|
143
|
+
services: [],
|
|
144
|
+
constructs: []
|
|
145
|
+
});
|
|
73
146
|
}
|
|
74
147
|
/**
|
|
75
148
|
* The served surface, as something an edge can point at.
|
|
@@ -108,6 +181,9 @@ var FileServer = class {
|
|
|
108
181
|
id: this.surfaceId,
|
|
109
182
|
of: origin?.id ?? this.id,
|
|
110
183
|
...this.open.length ? { open: this.open } : {},
|
|
184
|
+
...this.immutable.length ? { immutable: this.immutable } : {},
|
|
185
|
+
...this.derivedDays !== void 0 ? { derivedDays: this.derivedDays } : {},
|
|
186
|
+
...this.options.telemetry ? { telemetry: this.options.telemetry.id } : {},
|
|
111
187
|
provides: [this.keys.server]
|
|
112
188
|
};
|
|
113
189
|
if (origin) return [surface];
|
|
@@ -115,7 +191,8 @@ var FileServer = class {
|
|
|
115
191
|
kind: "objects",
|
|
116
192
|
id: this.id,
|
|
117
193
|
provides: [this.keys.origin],
|
|
118
|
-
...this.options.versioned ? { versioned: true } : {}
|
|
194
|
+
...this.options.versioned ? { versioned: true } : {},
|
|
195
|
+
...this.expire ? { expire: this.expire } : {}
|
|
119
196
|
}, surface];
|
|
120
197
|
}
|
|
121
198
|
/**
|
|
@@ -140,7 +217,12 @@ var FileServer = class {
|
|
|
140
217
|
return Object.assign(Object.create(storage), {
|
|
141
218
|
url: serve,
|
|
142
219
|
openUrl: serve,
|
|
143
|
-
signedUrl: (key, expiresIn) => storage.getDownloadURL({ path: key }, expiresIn)
|
|
220
|
+
signedUrl: (key, expiresIn) => storage.getDownloadURL({ path: key }, expiresIn),
|
|
221
|
+
processedUrl: (processor, params, key) => {
|
|
222
|
+
if (processor.surfaceId !== this.surfaceId) throw new ProcessorNotOnThisServer(processor.pattern, processor.surfaceId, this.surfaceId);
|
|
223
|
+
if (!this.serves(key)) throw new NotOpen(key, this.open);
|
|
224
|
+
return `${base}${require_pattern.fillPattern(processor.parsed, params, key)}`;
|
|
225
|
+
}
|
|
144
226
|
});
|
|
145
227
|
}
|
|
146
228
|
/**
|
|
@@ -154,6 +236,14 @@ var FileServer = class {
|
|
|
154
236
|
serves(key) {
|
|
155
237
|
return this.open.some((pattern) => globToRegExp(pattern).test(key));
|
|
156
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* Whether every key a pattern admits is open: the pattern itself, each of
|
|
241
|
+
* its wildcards taken as a segment of its own, is a key an open pattern
|
|
242
|
+
* serves — `brand/logos/*` under `brand/**`, but not `**` under `brand/**`.
|
|
243
|
+
*/
|
|
244
|
+
covers(pattern) {
|
|
245
|
+
return this.serves(pattern.replace(/\*\*/g, "x/x").replace(/\*/g, "x"));
|
|
246
|
+
}
|
|
157
247
|
};
|
|
158
248
|
/**
|
|
159
249
|
* One open pattern as an anchored expression.
|
|
@@ -180,7 +270,10 @@ function globToRegExp(pattern) {
|
|
|
180
270
|
return new RegExp(`^${source}$`);
|
|
181
271
|
}
|
|
182
272
|
//#endregion
|
|
273
|
+
exports.BucketOptionOnOrigin = BucketOptionOnOrigin;
|
|
183
274
|
exports.FileServer = FileServer;
|
|
275
|
+
exports.ImmutableNotOpen = ImmutableNotOpen;
|
|
184
276
|
exports.NotOpen = NotOpen;
|
|
277
|
+
exports.ProcessorNotOnThisServer = ProcessorNotOnThisServer;
|
|
185
278
|
|
|
186
279
|
//# sourceMappingURL=file-server.cjs.map
|