@geekmidas/constructs 10.0.0-alpha.17 → 10.0.0-alpha.171
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-BcA8F0S-.d.cts} +16 -9
- package/dist/Cron-BcA8F0S-.d.cts.map +1 -0
- package/dist/{Cron-zsoSAwZo.d.cts → Cron-z2CiuQT_.d.mts} +15 -8
- package/dist/Cron-z2CiuQT_.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-BZvo34X2.d.cts +47 -0
- package/dist/CronBuilder-BZvo34X2.d.cts.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-BbgKo8OI.d.mts +47 -0
- package/dist/CronBuilder-BbgKo8OI.d.mts.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-CIDUreMW.d.mts} +104 -23
- package/dist/Endpoint-CIDUreMW.d.mts.map +1 -0
- package/dist/{Endpoint-DBflWAe4.d.cts → Endpoint-COisi9jw.d.cts} +101 -20
- package/dist/Endpoint-COisi9jw.d.cts.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/{index-Cc4kKPag.d.mts → EndpointFactory-CIM80WIK.d.mts} +189 -106
- package/dist/EndpointFactory-CIM80WIK.d.mts.map +1 -0
- package/dist/{index-C1ZwNOOk.d.cts → EndpointFactory-CfBg6jJE.d.cts} +187 -104
- package/dist/EndpointFactory-CfBg6jJE.d.cts.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/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-Ci_Cc-WZ.d.mts +129 -0
- package/dist/ObjectSubscriberBuilder-Ci_Cc-WZ.d.mts.map +1 -0
- package/dist/ObjectSubscriberBuilder-DWtLxfAJ.d.cts +129 -0
- package/dist/ObjectSubscriberBuilder-DWtLxfAJ.d.cts.map +1 -0
- package/dist/ProcessorBuilder-CdLwJK4k.d.mts +216 -0
- package/dist/ProcessorBuilder-CdLwJK4k.d.mts.map +1 -0
- package/dist/ProcessorBuilder-ClD7tmEe.d.cts +216 -0
- package/dist/ProcessorBuilder-ClD7tmEe.d.cts.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-CjULiiDN.d.mts +75 -0
- package/dist/QueueBuilder-CjULiiDN.d.mts.map +1 -0
- package/dist/QueueBuilder-CrZL8HHs.mjs +118 -0
- package/dist/QueueBuilder-CrZL8HHs.mjs.map +1 -0
- package/dist/QueueBuilder-Dacm9qAv.d.cts +75 -0
- package/dist/QueueBuilder-Dacm9qAv.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-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-CutSfNlr.d.mts +274 -0
- package/dist/auth-CutSfNlr.d.mts.map +1 -0
- package/dist/auth-b9ADezz9.d.cts +274 -0
- package/dist/auth-b9ADezz9.d.cts.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-9wLNSy3O.d.cts +44 -0
- package/dist/cache-9wLNSy3O.d.cts.map +1 -0
- package/dist/cache-BFPs_CGs.d.mts +44 -0
- package/dist/cache-BFPs_CGs.d.mts.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-CVoejIpo.d.cts} +79 -8
- package/dist/construct-interface-CVoejIpo.d.cts.map +1 -0
- package/dist/{construct-interface-DgXTJcOD.d.cts → construct-interface-Nw5Dt9AC.d.mts} +79 -8
- package/dist/construct-interface-Nw5Dt9AC.d.mts.map +1 -0
- package/dist/construct-interface.cjs +62 -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 +59 -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/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-JI5uN1SF.d.cts +201 -0
- package/dist/fake-JI5uN1SF.d.cts.map +1 -0
- package/dist/fake-zpuXpBmY.d.mts +201 -0
- package/dist/fake-zpuXpBmY.d.mts.map +1 -0
- package/dist/file-server.cjs +170 -49
- package/dist/file-server.cjs.map +1 -1
- package/dist/file-server.d.cts +148 -16
- package/dist/file-server.d.cts.map +1 -1
- package/dist/file-server.d.mts +148 -16
- package/dist/file-server.d.mts.map +1 -1
- package/dist/file-server.mjs +168 -51
- 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-CXLU7h_8.d.cts +195 -0
- package/dist/inbox-CXLU7h_8.d.cts.map +1 -0
- package/dist/inbox-DYFsLd9A.d.mts +195 -0
- package/dist/inbox-DYFsLd9A.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-BpE9_6l5.d.mts +115 -0
- package/dist/index-BpE9_6l5.d.mts.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-zRChehJ9.d.cts +115 -0
- package/dist/index-zRChehJ9.d.cts.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-5PAqFBzo.d.mts +216 -0
- package/dist/kysely-5PAqFBzo.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/kysely-lxNUBSTP.d.cts +216 -0
- package/dist/kysely-lxNUBSTP.d.cts.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 +79 -0
- package/dist/mobile-app.cjs.map +1 -0
- package/dist/mobile-app.d.cts +78 -0
- package/dist/mobile-app.d.cts.map +1 -0
- package/dist/mobile-app.d.mts +78 -0
- package/dist/mobile-app.d.mts.map +1 -0
- package/dist/mobile-app.mjs +78 -0
- package/dist/mobile-app.mjs.map +1 -0
- package/dist/object-storage.cjs +50 -7
- package/dist/object-storage.cjs.map +1 -1
- package/dist/object-storage.d.cts +37 -3
- package/dist/object-storage.d.cts.map +1 -1
- package/dist/object-storage.d.mts +37 -3
- package/dist/object-storage.d.mts.map +1 -1
- package/dist/object-storage.mjs +49 -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/readOnlyStorage-C7bCe-z5.cjs +101 -0
- package/dist/readOnlyStorage-C7bCe-z5.cjs.map +1 -0
- package/dist/readOnlyStorage-DMCeLuS2.mjs +78 -0
- package/dist/readOnlyStorage-DMCeLuS2.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 +140 -10
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +156 -3
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +156 -3
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +120 -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-BbLyS7ln.d.cts +57 -0
- package/dist/telemetry-BbLyS7ln.d.cts.map +1 -0
- package/dist/telemetry-DWX-qKUh.d.mts +57 -0
- package/dist/telemetry-DWX-qKUh.d.mts.map +1 -0
- package/dist/telemetry.cjs +64 -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 +63 -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-9ndLBolx.d.cts +1207 -0
- package/dist/websocket-api-9ndLBolx.d.cts.map +1 -0
- package/dist/websocket-api-BPPXF79i.d.mts +1207 -0
- package/dist/websocket-api-BPPXF79i.d.mts.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-CoKPJJRl.cjs +1895 -0
- package/dist/websocket-api-CoKPJJRl.cjs.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
package/dist/queue/index.d.mts
CHANGED
|
@@ -1,53 +1,3 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { n as
|
|
3
|
-
|
|
4
|
-
import { Service } from "@geekmidas/services";
|
|
5
|
-
import { Logger as Logger$1 } from "@geekmidas/logger";
|
|
6
|
-
//#region src/queue/QueueBuilder.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* Builds a {@link Queue} worker — `q.queue('orders').services([db]).message(schema).handle(fn)`.
|
|
9
|
-
* Services are an array (sniffed for required env vars); `message` is the typed
|
|
10
|
-
* job payload; `handle` is the single consumer. The queue name is captured as a
|
|
11
|
-
* literal so `queue.publisher` is typed to `{ type: '<name>', payload }`.
|
|
12
|
-
*/
|
|
13
|
-
export declare class QueueBuilder<TName extends string = string, TMessage extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger$1 = Logger$1> {
|
|
14
|
-
private _name?;
|
|
15
|
-
private _messageSchema?;
|
|
16
|
-
private _timeout;
|
|
17
|
-
private _batchSize?;
|
|
18
|
-
private _fifo?;
|
|
19
|
-
private _services;
|
|
20
|
-
/** The construct ids `.dependsOn()` named — what the manifest records. */
|
|
21
|
-
_constructs: string[];
|
|
22
|
-
private _logger;
|
|
23
|
-
/** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
|
|
24
|
-
queue<T extends string>(name: T): QueueBuilder<T, TMessage, TServices, TLogger>;
|
|
25
|
-
timeout(timeout: number): this;
|
|
26
|
-
/** SQS event-source batch size (deployed). */
|
|
27
|
-
batchSize(batchSize: number): this;
|
|
28
|
-
/** Mark the queue as FIFO (deployed). */
|
|
29
|
-
fifo(fifo?: boolean): this;
|
|
30
|
-
/**
|
|
31
|
-
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
32
|
-
* topic.
|
|
33
|
-
*
|
|
34
|
-
* It records the edge and dissolves each construct's client into the
|
|
35
|
-
* handler's service record under the construct's own id, so
|
|
36
|
-
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
37
|
-
*
|
|
38
|
-
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
39
|
-
* env sniffing confined to `.services()` and the explicit lift.
|
|
40
|
-
*/
|
|
41
|
-
dependsOn<const T extends readonly Consumable[]>(constructs: T): QueueBuilder<TName, TMessage, [...TServices, ...ServicesOf<T>], TLogger>;
|
|
42
|
-
services<T extends Service[]>(services: T): QueueBuilder<TName, TMessage, [...TServices, ...T], TLogger>;
|
|
43
|
-
logger<T extends Logger$1>(logger: T): QueueBuilder<TName, TMessage, TServices, T>;
|
|
44
|
-
/** The typed message (job) payload the queue carries. */
|
|
45
|
-
message<T extends StandardSchemaV1>(schema: T): QueueBuilder<TName, T, TServices, TLogger>;
|
|
46
|
-
handle(fn: QueueHandler<NonNullable<TMessage>, TServices, TLogger>): Queue<TName, NonNullable<TMessage>, TServices, TLogger>;
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/queue/index.d.ts
|
|
50
|
-
export declare const q: QueueBuilder<string, undefined, [], Logger>;
|
|
51
|
-
//#endregion
|
|
52
|
-
export { Queue, type QueueContext, type QueueHandler, type QueueMessage };
|
|
53
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
import { i as QueueMessage, n as QueueContext, r as QueueHandler, t as Queue } from "../Queue-B8HGg439.mjs";
|
|
2
|
+
import { n as QueueNeedsMessage, r as QueueNeedsName } from "../QueueBuilder-CjULiiDN.mjs";
|
|
3
|
+
export { Queue, type QueueContext, type QueueHandler, type QueueMessage, QueueNeedsMessage, QueueNeedsName };
|
package/dist/queue/index.mjs
CHANGED
|
@@ -1,190 +1,3 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
5
|
-
import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
|
|
6
|
-
import { Publisher } from "@geekmidas/events";
|
|
7
|
-
//#region src/queue/Queue.ts
|
|
8
|
-
/**
|
|
9
|
-
* A queue worker — a point-to-point SQS-style queue and its single consumer.
|
|
10
|
-
* Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
|
|
11
|
-
* drains every message of its one `message` type. Build one with `q` (see
|
|
12
|
-
* `QueueBuilder`); `gkm build` discovers it into the manifest's `queues` field.
|
|
13
|
-
*
|
|
14
|
-
* The producer side is {@link Queue.publisher} — a ready-to-inject `Service`
|
|
15
|
-
* that any endpoint/function drops into `.services([...])` to send messages.
|
|
16
|
-
*/
|
|
17
|
-
var Queue = class extends Construct {
|
|
18
|
-
name;
|
|
19
|
-
handler;
|
|
20
|
-
messageSchema;
|
|
21
|
-
timeout;
|
|
22
|
-
services;
|
|
23
|
-
logger;
|
|
24
|
-
batchSize;
|
|
25
|
-
fifo;
|
|
26
|
-
__IS_QUEUE__ = true;
|
|
27
|
-
static isQueue(obj) {
|
|
28
|
-
return Boolean(obj && obj.__IS_QUEUE__ === true && obj.type === "dev.geekmidas.function.queue");
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The canonical id this queue is declared under.
|
|
32
|
-
*
|
|
33
|
-
* Derived from the name rather than given separately, so `emails` and
|
|
34
|
-
* `Emails` are one queue. The name stays what it was: it is the wire `type`
|
|
35
|
-
* a producer sends and the worker subscribes to, and changing that would
|
|
36
|
-
* silently orphan in-flight messages.
|
|
37
|
-
*/
|
|
38
|
-
id;
|
|
39
|
-
/**
|
|
40
|
-
* The producer's env key. Read by both {@link declare} and
|
|
41
|
-
* {@link publisher}, so what the target publishes and what the producer
|
|
42
|
-
* looks up cannot drift.
|
|
43
|
-
*/
|
|
44
|
-
connectionKey;
|
|
45
|
-
constructor(name, handler, messageSchema, timeout = 3e4, services = [], logger = DEFAULT_LOGGER, batchSize, fifo, constructs = []) {
|
|
46
|
-
super("dev.geekmidas.function.queue", logger, services, [], void 0, void 0, timeout, void 0, void 0, constructs);
|
|
47
|
-
this.name = name;
|
|
48
|
-
this.handler = handler;
|
|
49
|
-
this.messageSchema = messageSchema;
|
|
50
|
-
this.timeout = timeout;
|
|
51
|
-
this.services = services;
|
|
52
|
-
this.logger = logger;
|
|
53
|
-
this.batchSize = batchSize;
|
|
54
|
-
this.fifo = fifo;
|
|
55
|
-
this.id = canonicalId(name);
|
|
56
|
-
this.connectionKey = provideKey(this.id, "publisherConnectionString");
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* What this queue is in the manifest.
|
|
60
|
-
*
|
|
61
|
-
* A queue is a resource, not a handler: the worker is reached *through* it,
|
|
62
|
-
* so the declaration carries the producer's key and nothing about the code
|
|
63
|
-
* that drains it. The local target reads this to know which broker has to be
|
|
64
|
-
* running and what connection string to inject.
|
|
65
|
-
*/
|
|
66
|
-
declare() {
|
|
67
|
-
return [{
|
|
68
|
-
kind: "queue",
|
|
69
|
-
id: this.id,
|
|
70
|
-
provides: [this.connectionKey],
|
|
71
|
-
...this.fifo ? { fifo: true } : {},
|
|
72
|
-
worker: {
|
|
73
|
-
id: `${this.id}Worker`,
|
|
74
|
-
handler: `${this.id}.handler`,
|
|
75
|
-
dependencies: []
|
|
76
|
-
}
|
|
77
|
-
}];
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* The producer side — a `Service` exposing an `EventPublisher` typed to this
|
|
81
|
-
* queue's message. Inject it via `.services([queue.publisher])`; the handler
|
|
82
|
-
* then calls `services.<name>Publisher.publish([{ type, payload }])`.
|
|
83
|
-
*
|
|
84
|
-
* It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and builds the transport from
|
|
85
|
-
* the URL protocol — `pgboss://` locally, `sqs://` deployed — so the same
|
|
86
|
-
* code publishes to Postgres in dev and SQS in prod. Because it's a `Service`,
|
|
87
|
-
* `Construct.getEnvironment()` sniffs it, so the env requirement flows into
|
|
88
|
-
* the manifest and infra links exactly this queue with least privilege.
|
|
89
|
-
*/
|
|
90
|
-
/**
|
|
91
|
-
* The queue as a dependency — what `.dependsOn([emailsQueue])` dissolves
|
|
92
|
-
* into, reachable as `services.emails`.
|
|
93
|
-
*
|
|
94
|
-
* It is the producer: a consumer is the worker written right here, so the
|
|
95
|
-
* only thing another construct can want from a queue is the ability to send
|
|
96
|
-
* to it. {@link publisher} is the same service under its older
|
|
97
|
-
* `<name>Publisher` key, kept for `.services([queue.publisher])`.
|
|
98
|
-
*/
|
|
99
|
-
get service() {
|
|
100
|
-
const { register } = this.publisher;
|
|
101
|
-
return {
|
|
102
|
-
serviceName: serviceKey(this.id),
|
|
103
|
-
register
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
get publisher() {
|
|
107
|
-
const envVar = this.connectionKey;
|
|
108
|
-
return {
|
|
109
|
-
serviceName: `${this.name}Publisher`,
|
|
110
|
-
async register({ envParser }) {
|
|
111
|
-
const { connectionString } = envParser.create((get) => ({ connectionString: get(envVar).string() })).parse();
|
|
112
|
-
return Publisher.fromConnectionString(connectionString);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/queue/QueueBuilder.ts
|
|
119
|
-
/**
|
|
120
|
-
* Builds a {@link Queue} worker — `q.queue('orders').services([db]).message(schema).handle(fn)`.
|
|
121
|
-
* Services are an array (sniffed for required env vars); `message` is the typed
|
|
122
|
-
* job payload; `handle` is the single consumer. The queue name is captured as a
|
|
123
|
-
* literal so `queue.publisher` is typed to `{ type: '<name>', payload }`.
|
|
124
|
-
*/
|
|
125
|
-
var QueueBuilder = class {
|
|
126
|
-
_name;
|
|
127
|
-
_messageSchema;
|
|
128
|
-
_timeout = 3e4;
|
|
129
|
-
_batchSize;
|
|
130
|
-
_fifo;
|
|
131
|
-
_services = [];
|
|
132
|
-
/** The construct ids `.dependsOn()` named — what the manifest records. */
|
|
133
|
-
_constructs = [];
|
|
134
|
-
_logger = DEFAULT_LOGGER;
|
|
135
|
-
/** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
|
|
136
|
-
queue(name) {
|
|
137
|
-
return cloneWith(this, { _name: name });
|
|
138
|
-
}
|
|
139
|
-
timeout(timeout) {
|
|
140
|
-
return cloneWith(this, { _timeout: timeout });
|
|
141
|
-
}
|
|
142
|
-
/** SQS event-source batch size (deployed). */
|
|
143
|
-
batchSize(batchSize) {
|
|
144
|
-
return cloneWith(this, { _batchSize: batchSize });
|
|
145
|
-
}
|
|
146
|
-
/** Mark the queue as FIFO (deployed). */
|
|
147
|
-
fifo(fifo = true) {
|
|
148
|
-
return cloneWith(this, { _fifo: fifo });
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
152
|
-
* topic.
|
|
153
|
-
*
|
|
154
|
-
* It records the edge and dissolves each construct's client into the
|
|
155
|
-
* handler's service record under the construct's own id, so
|
|
156
|
-
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
157
|
-
*
|
|
158
|
-
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
159
|
-
* env sniffing confined to `.services()` and the explicit lift.
|
|
160
|
-
*/
|
|
161
|
-
dependsOn(constructs) {
|
|
162
|
-
const services = servicesOf(constructs);
|
|
163
|
-
return cloneWith(this, {
|
|
164
|
-
_services: [...this._services, ...services],
|
|
165
|
-
_constructs: idsOf(constructs, this._constructs)
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
services(services) {
|
|
169
|
-
return cloneWith(this, { _services: [...this._services, ...services] });
|
|
170
|
-
}
|
|
171
|
-
logger(logger) {
|
|
172
|
-
return cloneWith(this, { _logger: logger });
|
|
173
|
-
}
|
|
174
|
-
/** The typed message (job) payload the queue carries. */
|
|
175
|
-
message(schema) {
|
|
176
|
-
return cloneWith(this, { _messageSchema: schema });
|
|
177
|
-
}
|
|
178
|
-
handle(fn) {
|
|
179
|
-
if (!this._name) throw new Error("Queue requires a name — call .queue(name) before .handle().");
|
|
180
|
-
if (!this._messageSchema) throw new Error("Queue requires a message schema — call .message(schema) before .handle().");
|
|
181
|
-
return new Queue(this._name, fn, this._messageSchema, this._timeout, this._services, this._logger, this._batchSize, this._fifo, this._constructs);
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
//#endregion
|
|
185
|
-
//#region src/queue/index.ts
|
|
186
|
-
const q = new QueueBuilder();
|
|
187
|
-
//#endregion
|
|
188
|
-
export { Queue, QueueBuilder, q };
|
|
189
|
-
|
|
190
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
import { t as Queue } from "../Queue-9Hh20ZCk.mjs";
|
|
2
|
+
import { n as QueueNeedsMessage, r as QueueNeedsName } from "../QueueBuilder-CrZL8HHs.mjs";
|
|
3
|
+
export { Queue, QueueNeedsMessage, QueueNeedsName };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
3
|
+
//#region src/random-password.ts
|
|
4
|
+
/**
|
|
5
|
+
* `RandomPassword` — a password the platform generates, once per stage.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* export const adminPassword = new RandomPassword('AdminPassword');
|
|
9
|
+
*
|
|
10
|
+
* // an endpoint that `.dependsOn([adminPassword])`
|
|
11
|
+
* services.adminPassword // 'k3J…' — a string, no await
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The app's own `secret`: the kind an auth server's signing key already is,
|
|
15
|
+
* with nothing else attached. Nobody issues it and nobody sets it, which is
|
|
16
|
+
* the line between it and a `Credential`:
|
|
17
|
+
*
|
|
18
|
+
* - **A deployed stage** generates it on the first deploy that needs it and
|
|
19
|
+
* keeps it — a server stage in its secrets store, an AWS stage in its
|
|
20
|
+
* state — so every later deploy reads the same value back. One set by hand
|
|
21
|
+
* (`gkm secrets:set`, `sst secret set`) is kept, never replaced.
|
|
22
|
+
* - **`gkm dev` and `gkm test`** derive it from the project, the stage and the
|
|
23
|
+
* id, so nothing has to be set and it is the same on every run.
|
|
24
|
+
*
|
|
25
|
+
* Its key is its name, as a secret's is: `AdminPassword` is `ADMIN_PASSWORD`.
|
|
26
|
+
*
|
|
27
|
+
* 43 letters, digits, `-` and `_` unless told otherwise — for a system with
|
|
28
|
+
* rules of its own:
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* new RandomPassword('RouterPassword', { length: 24, symbols: '!@#$%' });
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* The format is read when the password is generated, so changing it later
|
|
35
|
+
* leaves a deployed stage's existing password as it is.
|
|
36
|
+
*/
|
|
37
|
+
var RandomPassword = class {
|
|
38
|
+
format;
|
|
39
|
+
id;
|
|
40
|
+
service;
|
|
41
|
+
/**
|
|
42
|
+
* Declared once and read by both `declare()` and `connect()`, so the key the
|
|
43
|
+
* target publishes and the key the client reads cannot drift.
|
|
44
|
+
*/
|
|
45
|
+
key;
|
|
46
|
+
constructor(id, format = {}) {
|
|
47
|
+
this.format = format;
|
|
48
|
+
const canonical = (0, _geekmidas_manifest.canonicalId)(id);
|
|
49
|
+
const { length } = format;
|
|
50
|
+
if (length !== void 0 && !(Number.isInteger(length) && length > 0)) throw new InvalidPasswordLength(canonical, length);
|
|
51
|
+
this.id = canonical;
|
|
52
|
+
this.key = (0, _geekmidas_manifest.environmentCase)(canonical);
|
|
53
|
+
this.service = {
|
|
54
|
+
serviceName: (0, _geekmidas_manifest.serviceKey)(canonical),
|
|
55
|
+
register: (options) => this.connect(options)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
declare() {
|
|
59
|
+
return [{
|
|
60
|
+
kind: "secret",
|
|
61
|
+
id: this.id,
|
|
62
|
+
provides: [this.key],
|
|
63
|
+
...this.format.length !== void 0 ? { length: this.format.length } : {},
|
|
64
|
+
...this.format.symbols !== void 0 ? { symbols: this.format.symbols } : {}
|
|
65
|
+
}];
|
|
66
|
+
}
|
|
67
|
+
connect(options) {
|
|
68
|
+
return options.envParser.create((get) => ({ password: get(this.key).string() })).parse().password;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
/** A `RandomPassword` given a length no password can have. */
|
|
72
|
+
var InvalidPasswordLength = class extends Error {
|
|
73
|
+
id;
|
|
74
|
+
length;
|
|
75
|
+
constructor(id, length) {
|
|
76
|
+
super(`${id} asks for a password ${length} characters long. Give it a whole number of characters, at least 1 — or leave length out for 43.`);
|
|
77
|
+
this.id = id;
|
|
78
|
+
this.length = length;
|
|
79
|
+
this.name = "InvalidPasswordLength";
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
83
|
+
exports.InvalidPasswordLength = InvalidPasswordLength;
|
|
84
|
+
exports.RandomPassword = RandomPassword;
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=random-password.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random-password.cjs","names":["canonicalId","environmentCase","serviceKey"],"sources":["../src/random-password.ts"],"sourcesContent":["/**\n * `RandomPassword` — a password the platform generates, once per stage.\n *\n * ```ts\n * export const adminPassword = new RandomPassword('AdminPassword');\n *\n * // an endpoint that `.dependsOn([adminPassword])`\n * services.adminPassword // 'k3J…' — a string, no await\n * ```\n *\n * The app's own `secret`: the kind an auth server's signing key already is,\n * with nothing else attached. Nobody issues it and nobody sets it, which is\n * the line between it and a `Credential`:\n *\n * - **A deployed stage** generates it on the first deploy that needs it and\n * keeps it — a server stage in its secrets store, an AWS stage in its\n * state — so every later deploy reads the same value back. One set by hand\n * (`gkm secrets:set`, `sst secret set`) is kept, never replaced.\n * - **`gkm dev` and `gkm test`** derive it from the project, the stage and the\n * id, so nothing has to be set and it is the same on every run.\n *\n * Its key is its name, as a secret's is: `AdminPassword` is `ADMIN_PASSWORD`.\n *\n * 43 letters, digits, `-` and `_` unless told otherwise — for a system with\n * rules of its own:\n *\n * ```ts\n * new RandomPassword('RouterPassword', { length: 24, symbols: '!@#$%' });\n * ```\n *\n * The format is read when the password is generated, so changing it later\n * leaves a deployed stage's existing password as it is.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tenvironmentCase,\n\ttype SecretFormat,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\n\nexport class RandomPassword<TName extends string = string>\n\timplements Construct<TName, string>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, string>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * target publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly key: string;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly format: RandomPasswordOptions = {},\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\t\tconst { length } = format;\n\n\t\tif (length !== undefined && !(Number.isInteger(length) && length > 0)) {\n\t\t\tthrow new InvalidPasswordLength(canonical, length);\n\t\t}\n\n\t\tthis.id = canonical as TName;\n\t\tthis.key = environmentCase(canonical);\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'secret',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.key],\n\t\t\t\t...(this.format.length !== undefined\n\t\t\t\t\t? { length: this.format.length }\n\t\t\t\t\t: {}),\n\t\t\t\t...(this.format.symbols !== undefined\n\t\t\t\t\t? { symbols: this.format.symbols }\n\t\t\t\t\t: {}),\n\t\t\t},\n\t\t];\n\t}\n\n\tprivate connect(options: ServiceRegisterOptions): string {\n\t\treturn options.envParser\n\t\t\t.create((get) => ({ password: get(this.key).string() }))\n\t\t\t.parse().password;\n\t}\n}\n\n/**\n * What a password is drawn as. Letters and digits always; `symbols` beside\n * them, one of which is always present.\n */\nexport type RandomPasswordOptions = SecretFormat;\n\n/** A `RandomPassword` given a length no password can have. */\nexport class InvalidPasswordLength extends Error {\n\tconstructor(\n\t\treadonly id: string,\n\t\treadonly length: number,\n\t) {\n\t\tsuper(\n\t\t\t`${id} asks for a password ${length} characters long. ` +\n\t\t\t\t'Give it a whole number of characters, at least 1 — or leave length out for 43.',\n\t\t);\n\t\tthis.name = 'InvalidPasswordLength';\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,IAAa,iBAAb,MAEA;CAYmB;CAXlB;CACA;;;;;CAMA;CAEA,YACC,IACA,SAAiD,CAAC,GACjD;EADgB,KAAA,SAAA;EAEjB,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAC1C,MAAM,EAAE,WAAW;EAEnB,IAAI,WAAW,KAAA,KAAa,EAAE,OAAO,UAAU,MAAM,KAAK,SAAS,IAClE,MAAM,IAAI,sBAAsB,WAAW,MAAM;EAGlD,KAAK,KAAK;EACV,KAAK,OAAA,GAAMC,oBAAAA,gBAAAA,CAAgB,SAAS;EAGpC,KAAK,UAAU;GACd,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,GAAG;GACnB,GAAI,KAAK,OAAO,WAAW,KAAA,IACxB,EAAE,QAAQ,KAAK,OAAO,OAAO,IAC7B,CAAC;GACJ,GAAI,KAAK,OAAO,YAAY,KAAA,IACzB,EAAE,SAAS,KAAK,OAAO,QAAQ,IAC/B,CAAC;EACL,CACD;CACD;CAEA,QAAgB,SAAyC;EACxD,OAAO,QAAQ,UACb,QAAQ,SAAS,EAAE,UAAU,IAAI,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACvD,MAAM,CAAC,CAAC;CACX;AACD;;AASA,IAAa,wBAAb,cAA2C,MAAM;CAEtC;CACA;CAFV,YACC,IACA,QACC;EACD,MACC,GAAG,GAAG,uBAAuB,OAAO,iGAErC;EANS,KAAA,KAAA;EACA,KAAA,SAAA;EAMT,KAAK,OAAO;CACb;AACD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { n as Construct } from "./construct-interface-CVoejIpo.cjs";
|
|
2
|
+
import { Service } from "@geekmidas/services";
|
|
3
|
+
import { ConstructName, Declaration, SecretFormat } from "@geekmidas/manifest";
|
|
4
|
+
//#region src/random-password.d.ts
|
|
5
|
+
export declare class RandomPassword<TName extends string = string> implements Construct<TName, string> {
|
|
6
|
+
private readonly format;
|
|
7
|
+
readonly id: TName;
|
|
8
|
+
readonly service: Service<Uncapitalize<TName>, string>;
|
|
9
|
+
/**
|
|
10
|
+
* Declared once and read by both `declare()` and `connect()`, so the key the
|
|
11
|
+
* target publishes and the key the client reads cannot drift.
|
|
12
|
+
*/
|
|
13
|
+
private readonly key;
|
|
14
|
+
constructor(id: ConstructName<TName>, format?: RandomPasswordOptions);
|
|
15
|
+
declare(): Declaration[];
|
|
16
|
+
private connect;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* What a password is drawn as. Letters and digits always; `symbols` beside
|
|
20
|
+
* them, one of which is always present.
|
|
21
|
+
*/
|
|
22
|
+
export type RandomPasswordOptions = SecretFormat;
|
|
23
|
+
/** A `RandomPassword` given a length no password can have. */
|
|
24
|
+
export declare class InvalidPasswordLength extends Error {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly length: number;
|
|
27
|
+
constructor(id: string, length: number);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//# sourceMappingURL=random-password.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random-password.d.cts","names":[],"sources":["../src/random-password.ts"],"mappings":";;;;qBA6Ca,eAAe,0CAChB,UAAU;mBAaH;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa;;;;;mBAMtB;EAEjB,YACC,IAAI,cAAc,QACD,SAAQ;EAmB1B,WAAW;UAgBH;;;;;;YAWG,wBAAwB;;qBAGvB,8BAA8B;WAEhC;WACA;EAFV,YACU,YACA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { n as Construct } from "./construct-interface-Nw5Dt9AC.mjs";
|
|
2
|
+
import { ConstructName, Declaration, SecretFormat } from "@geekmidas/manifest";
|
|
3
|
+
import { Service } from "@geekmidas/services";
|
|
4
|
+
//#region src/random-password.d.ts
|
|
5
|
+
export declare class RandomPassword<TName extends string = string> implements Construct<TName, string> {
|
|
6
|
+
private readonly format;
|
|
7
|
+
readonly id: TName;
|
|
8
|
+
readonly service: Service<Uncapitalize<TName>, string>;
|
|
9
|
+
/**
|
|
10
|
+
* Declared once and read by both `declare()` and `connect()`, so the key the
|
|
11
|
+
* target publishes and the key the client reads cannot drift.
|
|
12
|
+
*/
|
|
13
|
+
private readonly key;
|
|
14
|
+
constructor(id: ConstructName<TName>, format?: RandomPasswordOptions);
|
|
15
|
+
declare(): Declaration[];
|
|
16
|
+
private connect;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* What a password is drawn as. Letters and digits always; `symbols` beside
|
|
20
|
+
* them, one of which is always present.
|
|
21
|
+
*/
|
|
22
|
+
export type RandomPasswordOptions = SecretFormat;
|
|
23
|
+
/** A `RandomPassword` given a length no password can have. */
|
|
24
|
+
export declare class InvalidPasswordLength extends Error {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly length: number;
|
|
27
|
+
constructor(id: string, length: number);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//# sourceMappingURL=random-password.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random-password.d.mts","names":[],"sources":["../src/random-password.ts"],"mappings":";;;;qBA6Ca,eAAe,0CAChB,UAAU;mBAaH;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa;;;;;mBAMtB;EAEjB,YACC,IAAI,cAAc,QACD,SAAQ;EAmB1B,WAAW;UAgBH;;;;;;YAWG,wBAAwB;;qBAGvB,8BAA8B;WAEhC;WACA;EAFV,YACU,YACA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { canonicalId, environmentCase, serviceKey } from "@geekmidas/manifest";
|
|
2
|
+
//#region src/random-password.ts
|
|
3
|
+
/**
|
|
4
|
+
* `RandomPassword` — a password the platform generates, once per stage.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* export const adminPassword = new RandomPassword('AdminPassword');
|
|
8
|
+
*
|
|
9
|
+
* // an endpoint that `.dependsOn([adminPassword])`
|
|
10
|
+
* services.adminPassword // 'k3J…' — a string, no await
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* The app's own `secret`: the kind an auth server's signing key already is,
|
|
14
|
+
* with nothing else attached. Nobody issues it and nobody sets it, which is
|
|
15
|
+
* the line between it and a `Credential`:
|
|
16
|
+
*
|
|
17
|
+
* - **A deployed stage** generates it on the first deploy that needs it and
|
|
18
|
+
* keeps it — a server stage in its secrets store, an AWS stage in its
|
|
19
|
+
* state — so every later deploy reads the same value back. One set by hand
|
|
20
|
+
* (`gkm secrets:set`, `sst secret set`) is kept, never replaced.
|
|
21
|
+
* - **`gkm dev` and `gkm test`** derive it from the project, the stage and the
|
|
22
|
+
* id, so nothing has to be set and it is the same on every run.
|
|
23
|
+
*
|
|
24
|
+
* Its key is its name, as a secret's is: `AdminPassword` is `ADMIN_PASSWORD`.
|
|
25
|
+
*
|
|
26
|
+
* 43 letters, digits, `-` and `_` unless told otherwise — for a system with
|
|
27
|
+
* rules of its own:
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
30
|
+
* new RandomPassword('RouterPassword', { length: 24, symbols: '!@#$%' });
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* The format is read when the password is generated, so changing it later
|
|
34
|
+
* leaves a deployed stage's existing password as it is.
|
|
35
|
+
*/
|
|
36
|
+
var RandomPassword = class {
|
|
37
|
+
format;
|
|
38
|
+
id;
|
|
39
|
+
service;
|
|
40
|
+
/**
|
|
41
|
+
* Declared once and read by both `declare()` and `connect()`, so the key the
|
|
42
|
+
* target publishes and the key the client reads cannot drift.
|
|
43
|
+
*/
|
|
44
|
+
key;
|
|
45
|
+
constructor(id, format = {}) {
|
|
46
|
+
this.format = format;
|
|
47
|
+
const canonical = canonicalId(id);
|
|
48
|
+
const { length } = format;
|
|
49
|
+
if (length !== void 0 && !(Number.isInteger(length) && length > 0)) throw new InvalidPasswordLength(canonical, length);
|
|
50
|
+
this.id = canonical;
|
|
51
|
+
this.key = environmentCase(canonical);
|
|
52
|
+
this.service = {
|
|
53
|
+
serviceName: serviceKey(canonical),
|
|
54
|
+
register: (options) => this.connect(options)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
declare() {
|
|
58
|
+
return [{
|
|
59
|
+
kind: "secret",
|
|
60
|
+
id: this.id,
|
|
61
|
+
provides: [this.key],
|
|
62
|
+
...this.format.length !== void 0 ? { length: this.format.length } : {},
|
|
63
|
+
...this.format.symbols !== void 0 ? { symbols: this.format.symbols } : {}
|
|
64
|
+
}];
|
|
65
|
+
}
|
|
66
|
+
connect(options) {
|
|
67
|
+
return options.envParser.create((get) => ({ password: get(this.key).string() })).parse().password;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
/** A `RandomPassword` given a length no password can have. */
|
|
71
|
+
var InvalidPasswordLength = class extends Error {
|
|
72
|
+
id;
|
|
73
|
+
length;
|
|
74
|
+
constructor(id, length) {
|
|
75
|
+
super(`${id} asks for a password ${length} characters long. Give it a whole number of characters, at least 1 — or leave length out for 43.`);
|
|
76
|
+
this.id = id;
|
|
77
|
+
this.length = length;
|
|
78
|
+
this.name = "InvalidPasswordLength";
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
export { InvalidPasswordLength, RandomPassword };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=random-password.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random-password.mjs","names":[],"sources":["../src/random-password.ts"],"sourcesContent":["/**\n * `RandomPassword` — a password the platform generates, once per stage.\n *\n * ```ts\n * export const adminPassword = new RandomPassword('AdminPassword');\n *\n * // an endpoint that `.dependsOn([adminPassword])`\n * services.adminPassword // 'k3J…' — a string, no await\n * ```\n *\n * The app's own `secret`: the kind an auth server's signing key already is,\n * with nothing else attached. Nobody issues it and nobody sets it, which is\n * the line between it and a `Credential`:\n *\n * - **A deployed stage** generates it on the first deploy that needs it and\n * keeps it — a server stage in its secrets store, an AWS stage in its\n * state — so every later deploy reads the same value back. One set by hand\n * (`gkm secrets:set`, `sst secret set`) is kept, never replaced.\n * - **`gkm dev` and `gkm test`** derive it from the project, the stage and the\n * id, so nothing has to be set and it is the same on every run.\n *\n * Its key is its name, as a secret's is: `AdminPassword` is `ADMIN_PASSWORD`.\n *\n * 43 letters, digits, `-` and `_` unless told otherwise — for a system with\n * rules of its own:\n *\n * ```ts\n * new RandomPassword('RouterPassword', { length: 24, symbols: '!@#$%' });\n * ```\n *\n * The format is read when the password is generated, so changing it later\n * leaves a deployed stage's existing password as it is.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tenvironmentCase,\n\ttype SecretFormat,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\n\nexport class RandomPassword<TName extends string = string>\n\timplements Construct<TName, string>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, string>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * target publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly key: string;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly format: RandomPasswordOptions = {},\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\t\tconst { length } = format;\n\n\t\tif (length !== undefined && !(Number.isInteger(length) && length > 0)) {\n\t\t\tthrow new InvalidPasswordLength(canonical, length);\n\t\t}\n\n\t\tthis.id = canonical as TName;\n\t\tthis.key = environmentCase(canonical);\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'secret',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.key],\n\t\t\t\t...(this.format.length !== undefined\n\t\t\t\t\t? { length: this.format.length }\n\t\t\t\t\t: {}),\n\t\t\t\t...(this.format.symbols !== undefined\n\t\t\t\t\t? { symbols: this.format.symbols }\n\t\t\t\t\t: {}),\n\t\t\t},\n\t\t];\n\t}\n\n\tprivate connect(options: ServiceRegisterOptions): string {\n\t\treturn options.envParser\n\t\t\t.create((get) => ({ password: get(this.key).string() }))\n\t\t\t.parse().password;\n\t}\n}\n\n/**\n * What a password is drawn as. Letters and digits always; `symbols` beside\n * them, one of which is always present.\n */\nexport type RandomPasswordOptions = SecretFormat;\n\n/** A `RandomPassword` given a length no password can have. */\nexport class InvalidPasswordLength extends Error {\n\tconstructor(\n\t\treadonly id: string,\n\t\treadonly length: number,\n\t) {\n\t\tsuper(\n\t\t\t`${id} asks for a password ${length} characters long. ` +\n\t\t\t\t'Give it a whole number of characters, at least 1 — or leave length out for 43.',\n\t\t);\n\t\tthis.name = 'InvalidPasswordLength';\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,IAAa,iBAAb,MAEA;CAYmB;CAXlB;CACA;;;;;CAMA;CAEA,YACC,IACA,SAAiD,CAAC,GACjD;EADgB,KAAA,SAAA;EAEjB,MAAM,YAAY,YAAY,EAAY;EAC1C,MAAM,EAAE,WAAW;EAEnB,IAAI,WAAW,KAAA,KAAa,EAAE,OAAO,UAAU,MAAM,KAAK,SAAS,IAClE,MAAM,IAAI,sBAAsB,WAAW,MAAM;EAGlD,KAAK,KAAK;EACV,KAAK,MAAM,gBAAgB,SAAS;EAGpC,KAAK,UAAU;GACd,aAAa,WAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,GAAG;GACnB,GAAI,KAAK,OAAO,WAAW,KAAA,IACxB,EAAE,QAAQ,KAAK,OAAO,OAAO,IAC7B,CAAC;GACJ,GAAI,KAAK,OAAO,YAAY,KAAA,IACzB,EAAE,SAAS,KAAK,OAAO,QAAQ,IAC/B,CAAC;EACL,CACD;CACD;CAEA,QAAgB,SAAyC;EACxD,OAAO,QAAQ,UACb,QAAQ,SAAS,EAAE,UAAU,IAAI,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACvD,MAAM,CAAC,CAAC;CACX;AACD;;AASA,IAAa,wBAAb,cAA2C,MAAM;CAEtC;CACA;CAFV,YACC,IACA,QACC;EACD,MACC,GAAG,GAAG,uBAAuB,OAAO,iGAErC;EANS,KAAA,KAAA;EACA,KAAA,SAAA;EAMT,KAAK,OAAO;CACb;AACD"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
//#region src/expire.ts
|
|
2
|
+
/** An expiry prefix the bucket could not match the way it reads. */
|
|
3
|
+
var ExpiryPrefixInvalid = class extends Error {
|
|
4
|
+
bucket;
|
|
5
|
+
prefix;
|
|
6
|
+
reason;
|
|
7
|
+
constructor(bucket, prefix, reason) {
|
|
8
|
+
super(`'${bucket}' expires objects under '${prefix}', which ${reason}. Name the start of the keys as they are stored, e.g. 'quotes/'.`);
|
|
9
|
+
this.bucket = bucket;
|
|
10
|
+
this.prefix = prefix;
|
|
11
|
+
this.reason = reason;
|
|
12
|
+
this.name = "ExpiryPrefixInvalid";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/** An expiry that is not a whole number of days, one or more. */
|
|
16
|
+
var ExpiryDaysInvalid = class extends Error {
|
|
17
|
+
bucket;
|
|
18
|
+
prefix;
|
|
19
|
+
days;
|
|
20
|
+
constructor(bucket, prefix, days) {
|
|
21
|
+
super(`'${bucket}' expires '${prefix}' after ${String(days)} days. A bucket counts lifecycle in whole days, so give an integer of 1 or more.`);
|
|
22
|
+
this.bucket = bucket;
|
|
23
|
+
this.prefix = prefix;
|
|
24
|
+
this.days = days;
|
|
25
|
+
this.name = "ExpiryDaysInvalid";
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The expiry as the manifest records it — prefix → days — after checking
|
|
30
|
+
* each entry, or nothing when there is none.
|
|
31
|
+
*
|
|
32
|
+
* @throws {ExpiryPrefixInvalid} for an empty, rooted or globbed prefix
|
|
33
|
+
* @throws {ExpiryDaysInvalid} for anything but a positive integer of days
|
|
34
|
+
*/
|
|
35
|
+
function expiryDays(bucket, expire) {
|
|
36
|
+
if (!expire) return void 0;
|
|
37
|
+
const days = {};
|
|
38
|
+
for (const [prefix, { days: count }] of Object.entries(expire)) {
|
|
39
|
+
if (prefix.length === 0) throw new ExpiryPrefixInvalid(bucket, prefix, "is empty");
|
|
40
|
+
if (prefix.startsWith("/")) throw new ExpiryPrefixInvalid(bucket, prefix, "starts with '/', which no stored key does");
|
|
41
|
+
if (/[*?]/.test(prefix)) throw new ExpiryPrefixInvalid(bucket, prefix, "is a pattern, and a lifecycle prefix is matched literally");
|
|
42
|
+
if (!Number.isInteger(count) || count < 1) throw new ExpiryDaysInvalid(bucket, prefix, count);
|
|
43
|
+
days[prefix] = count;
|
|
44
|
+
}
|
|
45
|
+
return Object.keys(days).length > 0 ? days : void 0;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/readOnlyStorage.ts
|
|
49
|
+
/** Names asked of any object, which a read-only client must not answer. */
|
|
50
|
+
const INTROSPECTED = /* @__PURE__ */ new Set([
|
|
51
|
+
"then",
|
|
52
|
+
"toJSON",
|
|
53
|
+
"constructor",
|
|
54
|
+
"asymmetricMatch",
|
|
55
|
+
"$$typeof",
|
|
56
|
+
"nodeType",
|
|
57
|
+
"inspect"
|
|
58
|
+
]);
|
|
59
|
+
/**
|
|
60
|
+
* A client whose every method throws what `refuse` makes of its name.
|
|
61
|
+
*
|
|
62
|
+
* A proxy rather than a list of stubs, so a method the storage client grows
|
|
63
|
+
* later refuses the same way. What a runtime asks of any object is left
|
|
64
|
+
* alone: `then`, because a client is resolved from a promise, and the names a
|
|
65
|
+
* serialiser or a test's printer looks for.
|
|
66
|
+
*/
|
|
67
|
+
function readOnlyStorage(refuse) {
|
|
68
|
+
return new Proxy({}, { get(_target, property) {
|
|
69
|
+
if (typeof property !== "string" || INTROSPECTED.has(property)) return;
|
|
70
|
+
return () => {
|
|
71
|
+
throw refuse(property);
|
|
72
|
+
};
|
|
73
|
+
} });
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
Object.defineProperty(exports, "ExpiryDaysInvalid", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function() {
|
|
79
|
+
return ExpiryDaysInvalid;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(exports, "ExpiryPrefixInvalid", {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function() {
|
|
85
|
+
return ExpiryPrefixInvalid;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(exports, "expiryDays", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function() {
|
|
91
|
+
return expiryDays;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
Object.defineProperty(exports, "readOnlyStorage", {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function() {
|
|
97
|
+
return readOnlyStorage;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=readOnlyStorage-C7bCe-z5.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readOnlyStorage-C7bCe-z5.cjs","names":[],"sources":["../src/expire.ts","../src/readOnlyStorage.ts"],"sourcesContent":["/**\n * How long a bucket keeps the objects under a prefix.\n *\n * Shared by `ObjectStorage` and the bucket a `FileServer` vends, because it is\n * a fact about the bucket rather than about who serves it: a prefix of\n * generated files that nobody reads back grows for ever unless the bucket\n * itself is told to drop them.\n *\n * ```ts\n * new ObjectStorage('Private', { expire: { 'quotes/': { days: 30 } } });\n * ```\n *\n * Whole days, because that is the unit S3's lifecycle — and MinIO's — counts\n * in. Prefixes are literal: a lifecycle rule matches the start of a key and\n * has no globs, so a pattern that looks like one is refused rather than\n * silently matching nothing.\n */\nexport type ObjectExpiry = Readonly<Record<string, { readonly days: number }>>;\n\n/** An expiry prefix the bucket could not match the way it reads. */\nexport class ExpiryPrefixInvalid extends Error {\n\tconstructor(\n\t\treadonly bucket: string,\n\t\treadonly prefix: string,\n\t\treadonly reason: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${bucket}' expires objects under '${prefix}', which ${reason}. ` +\n\t\t\t\t`Name the start of the keys as they are stored, e.g. 'quotes/'.`,\n\t\t);\n\t\tthis.name = 'ExpiryPrefixInvalid';\n\t}\n}\n\n/** An expiry that is not a whole number of days, one or more. */\nexport class ExpiryDaysInvalid extends Error {\n\tconstructor(\n\t\treadonly bucket: string,\n\t\treadonly prefix: string,\n\t\treadonly days: unknown,\n\t) {\n\t\tsuper(\n\t\t\t`'${bucket}' expires '${prefix}' after ${String(days)} days. A bucket ` +\n\t\t\t\t`counts lifecycle in whole days, so give an integer of 1 or more.`,\n\t\t);\n\t\tthis.name = 'ExpiryDaysInvalid';\n\t}\n}\n\n/**\n * The expiry as the manifest records it — prefix → days — after checking\n * each entry, or nothing when there is none.\n *\n * @throws {ExpiryPrefixInvalid} for an empty, rooted or globbed prefix\n * @throws {ExpiryDaysInvalid} for anything but a positive integer of days\n */\nexport function expiryDays(\n\tbucket: string,\n\texpire: ObjectExpiry | undefined,\n): Record<string, number> | undefined {\n\tif (!expire) return undefined;\n\n\tconst days: Record<string, number> = {};\n\tfor (const [prefix, { days: count }] of Object.entries(expire)) {\n\t\tif (prefix.length === 0) {\n\t\t\tthrow new ExpiryPrefixInvalid(bucket, prefix, 'is empty');\n\t\t}\n\t\tif (prefix.startsWith('/')) {\n\t\t\tthrow new ExpiryPrefixInvalid(\n\t\t\t\tbucket,\n\t\t\t\tprefix,\n\t\t\t\t\"starts with '/', which no stored key does\",\n\t\t\t);\n\t\t}\n\t\tif (/[*?]/.test(prefix)) {\n\t\t\tthrow new ExpiryPrefixInvalid(\n\t\t\t\tbucket,\n\t\t\t\tprefix,\n\t\t\t\t'is a pattern, and a lifecycle prefix is matched literally',\n\t\t\t);\n\t\t}\n\t\tif (!Number.isInteger(count) || count < 1) {\n\t\t\tthrow new ExpiryDaysInvalid(bucket, prefix, count);\n\t\t}\n\t\tdays[prefix] = count;\n\t}\n\n\treturn Object.keys(days).length > 0 ? days : undefined;\n}\n","/**\n * A storage client with no bucket behind it: what a frontend's plain edge to\n * a bucket registers, as it holds where the bucket's links are signed and\n * nothing that writes to it.\n */\n\nimport type { StorageClient } from '@geekmidas/storage';\n\n/** Names asked of any object, which a read-only client must not answer. */\nconst INTROSPECTED = new Set([\n\t'then',\n\t'toJSON',\n\t'constructor',\n\t'asymmetricMatch',\n\t'$$typeof',\n\t'nodeType',\n\t'inspect',\n]);\n\n/**\n * A client whose every method throws what `refuse` makes of its name.\n *\n * A proxy rather than a list of stubs, so a method the storage client grows\n * later refuses the same way. What a runtime asks of any object is left\n * alone: `then`, because a client is resolved from a promise, and the names a\n * serialiser or a test's printer looks for.\n */\nexport function readOnlyStorage(\n\trefuse: (method: string) => Error,\n): StorageClient {\n\treturn new Proxy({} as StorageClient, {\n\t\tget(_target, property) {\n\t\t\tif (typeof property !== 'string' || INTROSPECTED.has(property)) return;\n\t\t\treturn () => {\n\t\t\t\tthrow refuse(property);\n\t\t\t};\n\t\t},\n\t});\n}\n"],"mappings":";;AAoBA,IAAa,sBAAb,cAAyC,MAAM;CAEpC;CACA;CACA;CAHV,YACC,QACA,QACA,QACC;EACD,MACC,IAAI,OAAO,2BAA2B,OAAO,WAAW,OAAO,iEAEhE;EAPS,KAAA,SAAA;EACA,KAAA,SAAA;EACA,KAAA,SAAA;EAMT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,oBAAb,cAAuC,MAAM;CAElC;CACA;CACA;CAHV,YACC,QACA,QACA,MACC;EACD,MACC,IAAI,OAAO,aAAa,OAAO,UAAU,OAAO,IAAI,EAAE,iFAEvD;EAPS,KAAA,SAAA;EACA,KAAA,SAAA;EACA,KAAA,OAAA;EAMT,KAAK,OAAO;CACb;AACD;;;;;;;;AASA,SAAgB,WACf,QACA,QACqC;CACrC,IAAI,CAAC,QAAQ,OAAO,KAAA;CAEpB,MAAM,OAA+B,CAAC;CACtC,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,YAAY,OAAO,QAAQ,MAAM,GAAG;EAC/D,IAAI,OAAO,WAAW,GACrB,MAAM,IAAI,oBAAoB,QAAQ,QAAQ,UAAU;EAEzD,IAAI,OAAO,WAAW,GAAG,GACxB,MAAM,IAAI,oBACT,QACA,QACA,2CACD;EAED,IAAI,OAAO,KAAK,MAAM,GACrB,MAAM,IAAI,oBACT,QACA,QACA,2DACD;EAED,IAAI,CAAC,OAAO,UAAU,KAAK,KAAK,QAAQ,GACvC,MAAM,IAAI,kBAAkB,QAAQ,QAAQ,KAAK;EAElD,KAAK,UAAU;CAChB;CAEA,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,SAAS,IAAI,OAAO,KAAA;AAC9C;;;;AC/EA,MAAM,+BAAe,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;AAUD,SAAgB,gBACf,QACgB;CAChB,OAAO,IAAI,MAAM,CAAC,GAAoB,EACrC,IAAI,SAAS,UAAU;EACtB,IAAI,OAAO,aAAa,YAAY,aAAa,IAAI,QAAQ,GAAG;EAChE,aAAa;GACZ,MAAM,OAAO,QAAQ;EACtB;CACD,EACD,CAAC;AACF"}
|