@geekmidas/constructs 10.0.0-alpha.11 → 10.0.0-alpha.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +222 -158
- package/dist/Construct-BQALFCh2.d.cts +230 -0
- package/dist/Construct-BQALFCh2.d.cts.map +1 -0
- package/dist/{Construct-BD5neF7w.mjs → Construct-CKUA-CTA.mjs} +35 -35
- package/dist/Construct-CKUA-CTA.mjs.map +1 -0
- package/dist/{Construct-CyS3RpTL.cjs → Construct-DEOVauyA.cjs} +55 -49
- package/dist/Construct-DEOVauyA.cjs.map +1 -0
- package/dist/Construct-QXnl3VqT.d.mts +230 -0
- package/dist/Construct-QXnl3VqT.d.mts.map +1 -0
- package/dist/{Cron-DmQ8vQ4b.d.cts → Cron-CQJqqkhY.d.mts} +17 -11
- package/dist/Cron-CQJqqkhY.d.mts.map +1 -0
- package/dist/{Cron-dh4rUgib.d.mts → Cron-DI3nKoic.d.cts} +17 -11
- package/dist/Cron-DI3nKoic.d.cts.map +1 -0
- package/dist/{CronBuilder-Da0C0edR.cjs → CronBuilder-BXTG10u5.cjs} +47 -31
- package/dist/CronBuilder-BXTG10u5.cjs.map +1 -0
- package/dist/{CronBuilder-CYKT5RiO.mjs → CronBuilder-D3sF9tS_.mjs} +37 -21
- package/dist/CronBuilder-D3sF9tS_.mjs.map +1 -0
- package/dist/CronBuilder-Xx_zakuc.d.mts +47 -0
- package/dist/CronBuilder-Xx_zakuc.d.mts.map +1 -0
- package/dist/CronBuilder-g1lZLWyG.d.cts +47 -0
- package/dist/CronBuilder-g1lZLWyG.d.cts.map +1 -0
- package/dist/{Endpoint-BjWKinFA.d.mts → Endpoint-BWyKCa2x.d.cts} +130 -100
- package/dist/Endpoint-BWyKCa2x.d.cts.map +1 -0
- package/dist/{Endpoint-dav89W6-.d.cts → Endpoint-CrE9Ppdk.d.mts} +130 -100
- package/dist/Endpoint-CrE9Ppdk.d.mts.map +1 -0
- package/dist/{Endpoint-DCQPMdUX.mjs → Endpoint-gPXhHKhJ.mjs} +208 -100
- package/dist/Endpoint-gPXhHKhJ.mjs.map +1 -0
- package/dist/{Endpoint-DcWXE-SZ.cjs → Endpoint-yhR2T2Wt.cjs} +248 -122
- package/dist/Endpoint-yhR2T2Wt.cjs.map +1 -0
- package/dist/{index-lAO9egTb.d.mts → EndpointFactory-BV-nfnaP.d.mts} +85 -136
- package/dist/EndpointFactory-BV-nfnaP.d.mts.map +1 -0
- package/dist/{EndpointFactory-CdWB7wPw.cjs → EndpointFactory-BVv6EIDu.cjs} +98 -112
- package/dist/EndpointFactory-BVv6EIDu.cjs.map +1 -0
- package/dist/{index-Bd5FqCoe.d.cts → EndpointFactory-C1-IBwm4.d.cts} +84 -135
- package/dist/EndpointFactory-C1-IBwm4.d.cts.map +1 -0
- package/dist/{EndpointFactory-CjV8F_lJ.mjs → EndpointFactory-Cs8IHvwF.mjs} +62 -76
- package/dist/EndpointFactory-Cs8IHvwF.mjs.map +1 -0
- package/dist/Function-DuqGcbOI.d.mts +76 -0
- package/dist/Function-DuqGcbOI.d.mts.map +1 -0
- package/dist/Function-Pu-1kKZz.d.cts +76 -0
- package/dist/Function-Pu-1kKZz.d.cts.map +1 -0
- package/dist/{HonoEndpointAdaptor-DtL9j19R.cjs → HonoEndpointAdaptor-CN1jjUBJ.cjs} +115 -71
- package/dist/HonoEndpointAdaptor-CN1jjUBJ.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-P1ahhZHu.mjs → HonoEndpointAdaptor-euH1oSdY.mjs} +105 -64
- package/dist/HonoEndpointAdaptor-euH1oSdY.mjs.map +1 -0
- package/dist/Queue-BhuofM3k.cjs +109 -0
- package/dist/Queue-BhuofM3k.cjs.map +1 -0
- package/dist/{Queue-D7ZuwBhy.d.cts → Queue-DlsHRzUp.d.mts} +48 -48
- package/dist/Queue-DlsHRzUp.d.mts.map +1 -0
- package/dist/{Queue-gVGfi2Yk.d.mts → Queue-HPyi0e1i.d.cts} +49 -49
- package/dist/Queue-HPyi0e1i.d.cts.map +1 -0
- package/dist/Queue-cmhqEBOB.mjs +104 -0
- package/dist/Queue-cmhqEBOB.mjs.map +1 -0
- package/dist/QueueBuilder-Cx9lKC5d.d.mts +75 -0
- package/dist/QueueBuilder-Cx9lKC5d.d.mts.map +1 -0
- package/dist/QueueBuilder-DXu1qxT1.mjs +118 -0
- package/dist/QueueBuilder-DXu1qxT1.mjs.map +1 -0
- package/dist/QueueBuilder-DdU2klPu.cjs +135 -0
- package/dist/QueueBuilder-DdU2klPu.cjs.map +1 -0
- package/dist/QueueBuilder-OSi6LkV9.d.cts +75 -0
- package/dist/QueueBuilder-OSi6LkV9.d.cts.map +1 -0
- package/dist/{Subscriber-2mEi0ImH.d.cts → Subscriber-Bpp02cGr.d.cts} +29 -20
- package/dist/Subscriber-Bpp02cGr.d.cts.map +1 -0
- package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-CtN9R48-.d.mts} +29 -20
- package/dist/Subscriber-CtN9R48-.d.mts.map +1 -0
- package/dist/SubscriberBuilder-4DWe9feX.d.mts +67 -0
- package/dist/SubscriberBuilder-4DWe9feX.d.mts.map +1 -0
- package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-DRXfxWn_.mjs} +50 -24
- package/dist/SubscriberBuilder-DRXfxWn_.mjs.map +1 -0
- package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-M2EAgQhC.cjs} +61 -36
- package/dist/SubscriberBuilder-M2EAgQhC.cjs.map +1 -0
- package/dist/SubscriberBuilder-g3fAVWgs.d.cts +67 -0
- package/dist/SubscriberBuilder-g3fAVWgs.d.cts.map +1 -0
- package/dist/Topic-D2R0r24C.mjs +99 -0
- package/dist/Topic-D2R0r24C.mjs.map +1 -0
- package/dist/Topic-DwS3QO0m.cjs +104 -0
- package/dist/Topic-DwS3QO0m.cjs.map +1 -0
- package/dist/adaptors/aws.cjs +200 -246
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +58 -62
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +59 -63
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +171 -219
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +3 -10
- package/dist/adaptors/hono.d.cts +7 -16
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +9 -18
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +2 -10
- package/dist/adaptors/testing.cjs +765 -99
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +351 -54
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +351 -54
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +726 -78
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-BMCJN30Y.d.cts +268 -0
- package/dist/auth-BMCJN30Y.d.cts.map +1 -0
- package/dist/auth-D_0788uW.d.mts +268 -0
- package/dist/auth-D_0788uW.d.mts.map +1 -0
- package/dist/auth.cjs +301 -33
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +2 -108
- package/dist/auth.d.mts +2 -108
- package/dist/auth.mjs +289 -27
- package/dist/auth.mjs.map +1 -1
- package/dist/{cache-BrRz3fEB.d.mts → cache-5QZzh5Er.d.mts} +3 -6
- package/dist/cache-5QZzh5Er.d.mts.map +1 -0
- package/dist/{cache-BtZY_tHe.d.cts → cache-DnGDGly3.d.cts} +3 -6
- package/dist/cache-DnGDGly3.d.cts.map +1 -0
- package/dist/cache.cjs +68 -2
- package/dist/cache.cjs.map +1 -0
- package/dist/cache.d.cts +1 -2
- package/dist/cache.d.mts +1 -2
- package/dist/cache.mjs +67 -2
- package/dist/cache.mjs.map +1 -0
- package/dist/cipher-C1lEFX63.mjs +225 -0
- package/dist/cipher-C1lEFX63.mjs.map +1 -0
- package/dist/cipher-CVxfwLjk.cjs +332 -0
- package/dist/cipher-CVxfwLjk.cjs.map +1 -0
- package/dist/{clone-DblgEZZa.mjs → clone-EKNovYHu.mjs} +3 -3
- package/dist/clone-EKNovYHu.mjs.map +1 -0
- package/dist/{clone-Dy0cR2SZ.cjs → clone-UGJpvQnL.cjs} +7 -8
- package/dist/clone-UGJpvQnL.cjs.map +1 -0
- package/dist/{construct-interface-D9d4Gm4p.d.cts → construct-interface-B1AfqRl4.d.cts} +42 -11
- package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
- package/dist/{construct-interface-g5GM5pwR.d.mts → construct-interface-ZvYQbivO.d.mts} +42 -11
- package/dist/construct-interface-ZvYQbivO.d.mts.map +1 -0
- package/dist/construct-interface.cjs +113 -7
- package/dist/construct-interface.cjs.map +1 -0
- package/dist/construct-interface.d.cts +2 -2
- package/dist/construct-interface.d.mts +2 -2
- package/dist/construct-interface.mjs +106 -2
- package/dist/construct-interface.mjs.map +1 -0
- package/dist/credential-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 +8 -96
- package/dist/credential.d.cts +2 -61
- package/dist/credential.d.mts +2 -61
- package/dist/credential.mjs +2 -94
- package/dist/crons/index.cjs +129 -7
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +45 -11
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +45 -11
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +127 -8
- package/dist/crons/index.mjs.map +1 -1
- package/dist/database/kysely.cjs +4 -181
- package/dist/database/kysely.d.cts +2 -152
- package/dist/database/kysely.d.mts +2 -152
- package/dist/database/kysely.mjs +2 -180
- package/dist/email.cjs +25 -12
- package/dist/email.cjs.map +1 -1
- package/dist/email.d.cts +3 -7
- package/dist/email.d.cts.map +1 -1
- package/dist/email.d.mts +4 -8
- package/dist/email.d.mts.map +1 -1
- package/dist/email.mjs +16 -3
- package/dist/email.mjs.map +1 -1
- package/dist/encryption.cjs +96 -0
- package/dist/encryption.cjs.map +1 -0
- package/dist/encryption.d.cts +117 -0
- package/dist/encryption.d.cts.map +1 -0
- package/dist/encryption.d.mts +117 -0
- package/dist/encryption.d.mts.map +1 -0
- package/dist/encryption.mjs +83 -0
- package/dist/encryption.mjs.map +1 -0
- package/dist/endpoints/index.cjs +20 -16
- package/dist/endpoints/index.d.cts +105 -7
- package/dist/endpoints/index.d.cts.map +1 -0
- package/dist/endpoints/index.d.mts +105 -7
- package/dist/endpoints/index.d.mts.map +1 -0
- package/dist/endpoints/index.mjs +6 -10
- 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-DqKo8INJ.d.mts +201 -0
- package/dist/fake-DqKo8INJ.d.mts.map +1 -0
- package/dist/fake-Dvion_Fh.d.cts +201 -0
- package/dist/fake-Dvion_Fh.d.cts.map +1 -0
- package/dist/file-server.cjs +42 -10
- package/dist/file-server.cjs.map +1 -1
- package/dist/file-server.d.cts +6 -10
- package/dist/file-server.d.cts.map +1 -1
- package/dist/file-server.d.mts +6 -10
- package/dist/file-server.d.mts.map +1 -1
- package/dist/file-server.mjs +34 -2
- package/dist/file-server.mjs.map +1 -1
- package/dist/functions/index.cjs +3 -6
- package/dist/functions/index.d.cts +3 -4
- package/dist/functions/index.d.mts +3 -4
- package/dist/functions/index.mjs +2 -6
- package/dist/{functions-14lpEFL4.mjs → functions-CTI-hDem.mjs} +376 -238
- package/dist/{functions-14lpEFL4.mjs.map → functions-CTI-hDem.mjs.map} +1 -1
- package/dist/{functions-i_la-N5r.cjs → functions-D7O5SGVc.cjs} +414 -264
- package/dist/functions-D7O5SGVc.cjs.map +1 -0
- package/dist/index-B13kQB_U.d.mts +115 -0
- package/dist/index-B13kQB_U.d.mts.map +1 -0
- package/dist/index-BuzRvKOQ.d.cts +115 -0
- package/dist/index-BuzRvKOQ.d.cts.map +1 -0
- package/dist/index-CeEtxDmK.d.cts +79 -0
- package/dist/index-CeEtxDmK.d.cts.map +1 -0
- package/dist/index-CeEtxDmK.d.mts +79 -0
- package/dist/index-CeEtxDmK.d.mts.map +1 -0
- package/dist/index.cjs +6 -3
- package/dist/index.d.cts +27 -4
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +27 -4
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -3
- package/dist/kms-B-Hm3d5r.cjs +85 -0
- package/dist/kms-B-Hm3d5r.cjs.map +1 -0
- package/dist/kms-BdUlMJEZ.mjs +85 -0
- package/dist/kms-BdUlMJEZ.mjs.map +1 -0
- package/dist/kysely-B3zfg9ti.cjs +383 -0
- package/dist/kysely-B3zfg9ti.cjs.map +1 -0
- package/dist/kysely-B_0BAr0T.mjs +370 -0
- package/dist/kysely-B_0BAr0T.mjs.map +1 -0
- package/dist/kysely-D0bpzgPs.d.cts +175 -0
- package/dist/kysely-D0bpzgPs.d.cts.map +1 -0
- package/dist/kysely-DKwnl0nf.d.mts +175 -0
- package/dist/kysely-DKwnl0nf.d.mts.map +1 -0
- package/dist/{telemetry-C3L0iS28.d.cts → lambdaTelemetry-8vnmVZQ5.d.cts} +3 -6
- package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +1 -0
- package/dist/{telemetry-D7bVFLGi.d.mts → lambdaTelemetry-8vnmVZQ5.d.mts} +3 -6
- package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +1 -0
- package/dist/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 +18 -10
- package/dist/object-storage.cjs.map +1 -1
- package/dist/object-storage.d.cts +3 -7
- package/dist/object-storage.d.cts.map +1 -1
- package/dist/object-storage.d.mts +3 -7
- package/dist/object-storage.d.mts.map +1 -1
- package/dist/object-storage.mjs +11 -3
- package/dist/object-storage.mjs.map +1 -1
- package/dist/queue/index.cjs +6 -189
- package/dist/queue/index.d.cts +3 -60
- package/dist/queue/index.d.mts +3 -60
- package/dist/queue/index.mjs +3 -186
- package/dist/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/{lazyAccessors-BoJN3SMd.mjs → readRequestBody-BTIl3k-D.mjs} +117 -60
- package/dist/readRequestBody-BTIl3k-D.mjs.map +1 -0
- package/dist/readRequestBody-Dej_L3c4.cjs +342 -0
- package/dist/readRequestBody-Dej_L3c4.cjs.map +1 -0
- package/dist/requestLogger-BZcXwdBs.cjs +207 -0
- package/dist/requestLogger-BZcXwdBs.cjs.map +1 -0
- package/dist/requestLogger-pA4gi3E1.mjs +178 -0
- package/dist/requestLogger-pA4gi3E1.mjs.map +1 -0
- package/dist/rest-api.cjs +90 -59
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +70 -42
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +70 -42
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +82 -51
- package/dist/rest-api.mjs.map +1 -1
- package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
- package/dist/runSubscriber-BHvJ8POr.mjs +109 -0
- package/dist/runSubscriber-BHvJ8POr.mjs.map +1 -0
- package/dist/runSubscriber-D8nLXIv1.cjs +126 -0
- package/dist/runSubscriber-D8nLXIv1.cjs.map +1 -0
- package/dist/shutdown-BMJmAhSt.cjs +38 -0
- package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
- package/dist/shutdown-C7xa8x9S.mjs +27 -0
- package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
- package/dist/site.cjs +33 -7
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +17 -7
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +17 -7
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +29 -3
- package/dist/site.mjs.map +1 -1
- package/dist/stages-BSCF19o2.d.cts +56 -0
- package/dist/stages-BSCF19o2.d.cts.map +1 -0
- package/dist/stages-BSCF19o2.d.mts +56 -0
- package/dist/stages-BSCF19o2.d.mts.map +1 -0
- package/dist/subscribers/index.cjs +118 -6
- package/dist/subscribers/index.cjs.map +1 -0
- package/dist/subscribers/index.d.cts +51 -6
- package/dist/subscribers/index.d.cts.map +1 -0
- package/dist/subscribers/index.d.mts +51 -6
- package/dist/subscribers/index.d.mts.map +1 -0
- package/dist/subscribers/index.mjs +115 -5
- package/dist/subscribers/index.mjs.map +1 -0
- package/dist/surfaceEnv-CNimK76p.cjs +56 -0
- package/dist/surfaceEnv-CNimK76p.cjs.map +1 -0
- package/dist/surfaceEnv-wMT5QzgZ.mjs +45 -0
- package/dist/surfaceEnv-wMT5QzgZ.mjs.map +1 -0
- package/dist/telemetry-B48RLjyk.d.cts +40 -0
- package/dist/telemetry-B48RLjyk.d.cts.map +1 -0
- package/dist/telemetry-BEoBn6GO.d.mts +40 -0
- package/dist/telemetry-BEoBn6GO.d.mts.map +1 -0
- package/dist/telemetry.cjs +56 -0
- package/dist/telemetry.cjs.map +1 -0
- package/dist/telemetry.d.cts +2 -0
- package/dist/telemetry.d.mts +2 -0
- package/dist/telemetry.mjs +55 -0
- package/dist/telemetry.mjs.map +1 -0
- package/dist/topic/index.cjs +3 -137
- package/dist/topic/index.d.cts +2 -4
- package/dist/topic/index.d.mts +2 -4
- package/dist/topic/index.mjs +2 -134
- package/dist/tracing-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/{types-BlAkSuGI.d.cts → types-DMuSQeLL.d.cts} +3 -5
- package/dist/types-DMuSQeLL.d.cts.map +1 -0
- package/dist/{types-aKksMEWL.d.mts → types-DMuSQeLL.d.mts} +3 -5
- package/dist/types-DMuSQeLL.d.mts.map +1 -0
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.mjs +1 -0
- package/dist/worker.cjs +59 -34
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +70 -45
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +71 -46
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +54 -29
- package/dist/worker.mjs.map +1 -1
- package/package.json +106 -42
- package/dist/Construct-BD5neF7w.mjs.map +0 -1
- package/dist/Construct-C0ijr2qp.d.cts +0 -117
- package/dist/Construct-C0ijr2qp.d.cts.map +0 -1
- package/dist/Construct-Ct8nalEi.d.mts +0 -117
- package/dist/Construct-Ct8nalEi.d.mts.map +0 -1
- package/dist/Construct-CyS3RpTL.cjs.map +0 -1
- package/dist/Cron-DmQ8vQ4b.d.cts.map +0 -1
- package/dist/Cron-dh4rUgib.d.mts.map +0 -1
- package/dist/CronBuilder-BquXDbDI.d.cts +0 -44
- package/dist/CronBuilder-BquXDbDI.d.cts.map +0 -1
- package/dist/CronBuilder-CGgY2080.d.mts +0 -44
- package/dist/CronBuilder-CGgY2080.d.mts.map +0 -1
- package/dist/CronBuilder-CYKT5RiO.mjs.map +0 -1
- package/dist/CronBuilder-Da0C0edR.cjs.map +0 -1
- package/dist/Endpoint-BjWKinFA.d.mts.map +0 -1
- package/dist/Endpoint-DCQPMdUX.mjs.map +0 -1
- package/dist/Endpoint-DcWXE-SZ.cjs.map +0 -1
- package/dist/Endpoint-dav89W6-.d.cts.map +0 -1
- package/dist/EndpointFactory-CdWB7wPw.cjs.map +0 -1
- package/dist/EndpointFactory-CjV8F_lJ.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-DtL9j19R.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-P1ahhZHu.mjs.map +0 -1
- package/dist/Queue-D7ZuwBhy.d.cts.map +0 -1
- package/dist/Queue-gVGfi2Yk.d.mts.map +0 -1
- package/dist/Subscriber-2mEi0ImH.d.cts.map +0 -1
- package/dist/Subscriber-xTJ9ayPN.d.mts.map +0 -1
- package/dist/SubscriberBuilder-4OPehf2R.cjs.map +0 -1
- package/dist/SubscriberBuilder-BjkbeT9l.mjs.map +0 -1
- package/dist/SubscriberBuilder-Dptmo-1A.d.mts +0 -62
- package/dist/SubscriberBuilder-Dptmo-1A.d.mts.map +0 -1
- package/dist/SubscriberBuilder-waNhzjSM.d.cts +0 -62
- package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +0 -1
- package/dist/Topic-19QeHBIR.d.cts +0 -91
- package/dist/Topic-19QeHBIR.d.cts.map +0 -1
- package/dist/Topic-DuFeqkBh.d.mts +0 -91
- package/dist/Topic-DuFeqkBh.d.mts.map +0 -1
- package/dist/auth.d.cts.map +0 -1
- package/dist/auth.d.mts.map +0 -1
- package/dist/cache-0ANvRQnD.mjs +0 -51
- package/dist/cache-0ANvRQnD.mjs.map +0 -1
- package/dist/cache-3WSvAulx.cjs +0 -57
- package/dist/cache-3WSvAulx.cjs.map +0 -1
- package/dist/cache-BrRz3fEB.d.mts.map +0 -1
- package/dist/cache-BtZY_tHe.d.cts.map +0 -1
- package/dist/clone-DblgEZZa.mjs.map +0 -1
- package/dist/clone-Dy0cR2SZ.cjs.map +0 -1
- package/dist/construct-interface-BfjcOD_E.cjs +0 -117
- package/dist/construct-interface-BfjcOD_E.cjs.map +0 -1
- package/dist/construct-interface-D9d4Gm4p.d.cts.map +0 -1
- package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
- package/dist/construct-interface-Z4CpS8tK.mjs.map +0 -1
- package/dist/construct-interface-g5GM5pwR.d.mts.map +0 -1
- package/dist/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-i_la-N5r.cjs.map +0 -1
- package/dist/index-Bd5FqCoe.d.cts.map +0 -1
- package/dist/index-BknhM6Ux.d.mts +0 -31
- package/dist/index-BknhM6Ux.d.mts.map +0 -1
- package/dist/index-CBSfrowv.d.cts +0 -31
- package/dist/index-CBSfrowv.d.cts.map +0 -1
- package/dist/index-D24Xm79M.d.cts +0 -171
- package/dist/index-D24Xm79M.d.cts.map +0 -1
- package/dist/index-_ajboYxK.d.mts +0 -171
- package/dist/index-_ajboYxK.d.mts.map +0 -1
- package/dist/index-lAO9egTb.d.mts.map +0 -1
- package/dist/lazyAccessors-BoJN3SMd.mjs.map +0 -1
- package/dist/lazyAccessors-e3j2oE2m.cjs +0 -274
- package/dist/lazyAccessors-e3j2oE2m.cjs.map +0 -1
- package/dist/processAudits-CGqttuXm.cjs +0 -92
- package/dist/processAudits-CGqttuXm.cjs.map +0 -1
- package/dist/processAudits-Dmts9H_b.mjs +0 -80
- package/dist/processAudits-Dmts9H_b.mjs.map +0 -1
- package/dist/queue/index.cjs.map +0 -1
- package/dist/queue/index.d.cts.map +0 -1
- package/dist/queue/index.d.mts.map +0 -1
- package/dist/queue/index.mjs.map +0 -1
- package/dist/surfaceEnv-BFXEms2f.cjs +0 -39
- package/dist/surfaceEnv-BFXEms2f.cjs.map +0 -1
- package/dist/surfaceEnv-C3Ktahea.mjs +0 -27
- package/dist/surfaceEnv-C3Ktahea.mjs.map +0 -1
- package/dist/telemetry-C3L0iS28.d.cts.map +0 -1
- package/dist/telemetry-D7bVFLGi.d.mts.map +0 -1
- package/dist/topic/index.cjs.map +0 -1
- package/dist/topic/index.mjs.map +0 -1
- package/dist/types-BlAkSuGI.d.cts.map +0 -1
- package/dist/types-aKksMEWL.d.mts.map +0 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
|
|
2
|
+
import { t as Construct } from "./Construct-QXnl3VqT.mjs";
|
|
3
|
+
import { t as DatabaseContext } from "./Function-DuqGcbOI.mjs";
|
|
4
|
+
import { Declaration } from "@geekmidas/manifest";
|
|
2
5
|
import { EventPublisher, PublishableMessage } from "@geekmidas/events";
|
|
6
|
+
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
3
7
|
import { Logger } from "@geekmidas/logger";
|
|
4
8
|
import { InferStandardSchema } from "@geekmidas/schema";
|
|
5
|
-
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
6
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
7
|
-
import { Declaration } from "@geekmidas/manifest";
|
|
8
|
-
|
|
9
9
|
//#region src/queue/Queue.d.ts
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* The wire message a queue carries: `{ type: <queue name>, payload: <message> }`.
|
|
13
12
|
* The producer publishes this shape and the worker receives the `payload`s as
|
|
@@ -18,15 +17,19 @@ type QueueMessage<TName extends string, TMessage extends StandardSchemaV1> = Pub
|
|
|
18
17
|
/**
|
|
19
18
|
* A queue worker — a point-to-point SQS-style queue and its single consumer.
|
|
20
19
|
* Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
|
|
21
|
-
* drains every message of its one `message` type. Build one
|
|
22
|
-
*
|
|
20
|
+
* drains every message of its one `message` type. Build one from the worker
|
|
21
|
+
* that runs it — `worker.queue('Emails').message(schema).handle(…)` — and
|
|
22
|
+
* `gkm build` discovers it into the manifest's `queues` field.
|
|
23
|
+
*
|
|
24
|
+
* Producers send to it by depending on it: `.dependsOn([emails])` makes
|
|
25
|
+
* `services.emails` the publisher.
|
|
23
26
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
27
|
+
* Its handler gets `db` when it has a database: the worker's, declared once
|
|
28
|
+
* with `worker.database(db)`, or its own with `.database(other)`.
|
|
26
29
|
*/
|
|
27
|
-
declare class Queue<TName extends string = string, TMessage extends StandardSchemaV1 = StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> extends Construct<TLogger, string, undefined,
|
|
30
|
+
declare class Queue<TName extends string = string, TMessage extends StandardSchemaV1 = StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Construct<TLogger, undefined, TServices, string, undefined, TDatabaseServiceName, TDatabase> {
|
|
28
31
|
readonly name: TName;
|
|
29
|
-
readonly handler: QueueHandler<TMessage, TServices, TLogger>;
|
|
32
|
+
readonly handler: QueueHandler<TMessage, TServices, TLogger, TDatabase>;
|
|
30
33
|
readonly messageSchema: TMessage;
|
|
31
34
|
readonly timeout: number;
|
|
32
35
|
readonly services: TServices;
|
|
@@ -36,7 +39,7 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
|
|
|
36
39
|
/** Whether the queue is FIFO (deployed). */
|
|
37
40
|
readonly fifo?: boolean | undefined;
|
|
38
41
|
__IS_QUEUE__: boolean;
|
|
39
|
-
static isQueue(obj: unknown): obj is Queue<string, StandardSchemaV1, Service[], Logger>;
|
|
42
|
+
static isQueue(obj: unknown): obj is Queue<string, StandardSchemaV1, Service[], Logger, any>;
|
|
40
43
|
/**
|
|
41
44
|
* The canonical id this queue is declared under.
|
|
42
45
|
*
|
|
@@ -47,19 +50,36 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
|
|
|
47
50
|
*/
|
|
48
51
|
readonly id: string;
|
|
49
52
|
/**
|
|
50
|
-
* The
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
+
* The queue as a dependency — what `.dependsOn([emails])` dissolves into,
|
|
54
|
+
* reachable as `services.emails`.
|
|
55
|
+
*
|
|
56
|
+
* The producer: the queue's one consumer is the handler it was built with,
|
|
57
|
+
* so the only thing another construct can want from a queue is to send to
|
|
58
|
+
* it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport
|
|
59
|
+
* from its protocol — `pgboss://` locally, `sqs://` deployed. A field
|
|
60
|
+
* assigned once, not a getter: services are cached by object identity.
|
|
61
|
+
*/
|
|
62
|
+
readonly service: Service<Uncapitalize<TName>, EventPublisher<QueueMessage<TName, TMessage>>>;
|
|
63
|
+
/**
|
|
64
|
+
* The producer's env key. Read by both {@link declare} and the service, so
|
|
65
|
+
* what the target publishes and what the producer looks up cannot drift.
|
|
53
66
|
*/
|
|
54
67
|
private readonly connectionKey;
|
|
55
|
-
constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
|
|
56
|
-
|
|
68
|
+
constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger, TDatabase>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
|
|
69
|
+
/** SQS event-source batch size (deployed). */
|
|
70
|
+
batchSize?: number | undefined,
|
|
71
|
+
/** Whether the queue is FIFO (deployed). */
|
|
57
72
|
fifo?: boolean | undefined,
|
|
58
73
|
/**
|
|
59
74
|
* The construct ids the *worker* `.dependsOn()` named — last, so no
|
|
60
75
|
* existing positional argument moves.
|
|
61
76
|
*/
|
|
62
|
-
constructs?: string[]
|
|
77
|
+
constructs?: string[],
|
|
78
|
+
/**
|
|
79
|
+
* What the handler's `db` is registered from — after `constructs`, for
|
|
80
|
+
* the same reason.
|
|
81
|
+
*/
|
|
82
|
+
databaseService?: Service<TDatabaseServiceName, TDatabase>);
|
|
63
83
|
/**
|
|
64
84
|
* What this queue is in the manifest.
|
|
65
85
|
*
|
|
@@ -69,37 +89,17 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
|
|
|
69
89
|
* running and what connection string to inject.
|
|
70
90
|
*/
|
|
71
91
|
declare(): Declaration[];
|
|
72
|
-
/**
|
|
73
|
-
* The producer side — a `Service` exposing an `EventPublisher` typed to this
|
|
74
|
-
* queue's message. Inject it via `.services([queue.publisher])`; the handler
|
|
75
|
-
* then calls `services.<name>Publisher.publish([{ type, payload }])`.
|
|
76
|
-
*
|
|
77
|
-
* It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and builds the transport from
|
|
78
|
-
* the URL protocol — `pgboss://` locally, `sqs://` deployed — so the same
|
|
79
|
-
* code publishes to Postgres in dev and SQS in prod. Because it's a `Service`,
|
|
80
|
-
* `Construct.getEnvironment()` sniffs it, so the env requirement flows into
|
|
81
|
-
* the manifest and infra links exactly this queue with least privilege.
|
|
82
|
-
*/
|
|
83
|
-
/**
|
|
84
|
-
* The queue as a dependency — what `.dependsOn([emailsQueue])` dissolves
|
|
85
|
-
* into, reachable as `services.emails`.
|
|
86
|
-
*
|
|
87
|
-
* It is the producer: a consumer is the worker written right here, so the
|
|
88
|
-
* only thing another construct can want from a queue is the ability to send
|
|
89
|
-
* to it. {@link publisher} is the same service under its older
|
|
90
|
-
* `<name>Publisher` key, kept for `.services([queue.publisher])`.
|
|
91
|
-
*/
|
|
92
|
-
get service(): Service<Uncapitalize<TName>, EventPublisher<QueueMessage<TName, TMessage>>>;
|
|
93
|
-
get publisher(): Service<`${TName}Publisher`, EventPublisher<QueueMessage<TName, TMessage>>>;
|
|
94
92
|
}
|
|
95
|
-
/**
|
|
96
|
-
|
|
93
|
+
/**
|
|
94
|
+
* The context a queue handler receives — a batch of typed messages, and `db`
|
|
95
|
+
* when the queue has a database.
|
|
96
|
+
*/
|
|
97
|
+
type QueueContext<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined> = {
|
|
97
98
|
messages: InferStandardSchema<TMessage>[];
|
|
98
99
|
services: ServiceRecord<TServices>;
|
|
99
100
|
logger: TLogger;
|
|
100
|
-
}
|
|
101
|
-
type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> = (ctx: QueueContext<TMessage, TServices, TLogger>) => unknown | Promise<unknown>;
|
|
102
|
-
//# sourceMappingURL=Queue.d.ts.map
|
|
101
|
+
} & DatabaseContext<TDatabase>;
|
|
102
|
+
type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined> = (ctx: QueueContext<TMessage, TServices, TLogger, TDatabase>) => unknown | Promise<unknown>;
|
|
103
103
|
//#endregion
|
|
104
|
-
export {
|
|
105
|
-
//# sourceMappingURL=Queue-
|
|
104
|
+
export { QueueMessage as i, QueueContext as n, QueueHandler as r, Queue as t };
|
|
105
|
+
//# sourceMappingURL=Queue-DlsHRzUp.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue-DlsHRzUp.d.mts","names":[],"sources":["../src/queue/Queue.ts"],"mappings":";;;;;;;;;;;;;;;KA0BY,aACX,sBACA,iBAAiB,oBACd,mBAAmB,OAAO,oBAAoB;;;;;;;;;;;;;;cAerC,MACZ,+BACA,iBAAiB,mBAAmB,kBACpC,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,uBACA,sDACS,UACT,oBAEA,8BAGA,sBACA;WA8CiB,MAAM;WACN,SAAS,aACxB,UACA,WACA,SACA;WAEe,eAAe;WACN;WACA,UAAU;WACV,QAAQ;;WAEjB;;WAEA;EA1DjB;SAEO,QACN,eACE,OAAO,cAAc,kBAAkB,WAAW;;;;;;;;;WAgB5C;;;;;;;;;;;WAYA,SAAS,QACjB,aAAa,QACb,eAAe,aAAa,OAAO;;;;;mBAOnB;EAEjB,YACiB,MAAM,OACN,SAAS,aACxB,UACA,WACA,SACA,YAEe,eAAe,UACN,kBACA,WAAU,WACV,SAAQ,SAEjB;;EAAA,gCAEA;;EAAA,4BAKhB;;;;;EAAA,uBAKA;;;;;EAAA,kBAAkB,QAAQ,sBAAsB;;;;;;;;;EAyCjD,WAAW;;;;;;KA8BA,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB;EAEA,UAAU,oBAAoB;EAC9B,UAAU,cAAc;EACxB,QAAQ;IACL,gBAAgB;KAER,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,0BAEA,KAAK,aAAa,UAAU,WAAW,SAAS,yBAClC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { EventPublisher, PublishableMessage } from "@geekmidas/events";
|
|
1
|
+
import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
|
|
2
|
+
import { t as Construct } from "./Construct-BQALFCh2.cjs";
|
|
3
|
+
import { t as DatabaseContext } from "./Function-Pu-1kKZz.cjs";
|
|
5
4
|
import { Logger } from "@geekmidas/logger";
|
|
6
5
|
import { InferStandardSchema } from "@geekmidas/schema";
|
|
7
|
-
import {
|
|
8
|
-
|
|
6
|
+
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
7
|
+
import { EventPublisher, PublishableMessage } from "@geekmidas/events";
|
|
8
|
+
import { Declaration } from "@geekmidas/manifest";
|
|
9
9
|
//#region src/queue/Queue.d.ts
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* The wire message a queue carries: `{ type: <queue name>, payload: <message> }`.
|
|
13
12
|
* The producer publishes this shape and the worker receives the `payload`s as
|
|
@@ -18,15 +17,19 @@ type QueueMessage<TName extends string, TMessage extends StandardSchemaV1> = Pub
|
|
|
18
17
|
/**
|
|
19
18
|
* A queue worker — a point-to-point SQS-style queue and its single consumer.
|
|
20
19
|
* Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
|
|
21
|
-
* drains every message of its one `message` type. Build one
|
|
22
|
-
*
|
|
20
|
+
* drains every message of its one `message` type. Build one from the worker
|
|
21
|
+
* that runs it — `worker.queue('Emails').message(schema).handle(…)` — and
|
|
22
|
+
* `gkm build` discovers it into the manifest's `queues` field.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* Producers send to it by depending on it: `.dependsOn([emails])` makes
|
|
25
|
+
* `services.emails` the publisher.
|
|
26
|
+
*
|
|
27
|
+
* Its handler gets `db` when it has a database: the worker's, declared once
|
|
28
|
+
* with `worker.database(db)`, or its own with `.database(other)`.
|
|
26
29
|
*/
|
|
27
|
-
declare class Queue<TName extends string = string, TMessage extends StandardSchemaV1 = StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> extends Construct<TLogger, string, undefined,
|
|
30
|
+
declare class Queue<TName extends string = string, TMessage extends StandardSchemaV1 = StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Construct<TLogger, undefined, TServices, string, undefined, TDatabaseServiceName, TDatabase> {
|
|
28
31
|
readonly name: TName;
|
|
29
|
-
readonly handler: QueueHandler<TMessage, TServices, TLogger>;
|
|
32
|
+
readonly handler: QueueHandler<TMessage, TServices, TLogger, TDatabase>;
|
|
30
33
|
readonly messageSchema: TMessage;
|
|
31
34
|
readonly timeout: number;
|
|
32
35
|
readonly services: TServices;
|
|
@@ -36,7 +39,7 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
|
|
|
36
39
|
/** Whether the queue is FIFO (deployed). */
|
|
37
40
|
readonly fifo?: boolean | undefined;
|
|
38
41
|
__IS_QUEUE__: boolean;
|
|
39
|
-
static isQueue(obj: unknown): obj is Queue<string, StandardSchemaV1, Service[], Logger>;
|
|
42
|
+
static isQueue(obj: unknown): obj is Queue<string, StandardSchemaV1, Service[], Logger, any>;
|
|
40
43
|
/**
|
|
41
44
|
* The canonical id this queue is declared under.
|
|
42
45
|
*
|
|
@@ -47,19 +50,36 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
|
|
|
47
50
|
*/
|
|
48
51
|
readonly id: string;
|
|
49
52
|
/**
|
|
50
|
-
* The
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
+
* The queue as a dependency — what `.dependsOn([emails])` dissolves into,
|
|
54
|
+
* reachable as `services.emails`.
|
|
55
|
+
*
|
|
56
|
+
* The producer: the queue's one consumer is the handler it was built with,
|
|
57
|
+
* so the only thing another construct can want from a queue is to send to
|
|
58
|
+
* it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport
|
|
59
|
+
* from its protocol — `pgboss://` locally, `sqs://` deployed. A field
|
|
60
|
+
* assigned once, not a getter: services are cached by object identity.
|
|
61
|
+
*/
|
|
62
|
+
readonly service: Service<Uncapitalize<TName>, EventPublisher<QueueMessage<TName, TMessage>>>;
|
|
63
|
+
/**
|
|
64
|
+
* The producer's env key. Read by both {@link declare} and the service, so
|
|
65
|
+
* what the target publishes and what the producer looks up cannot drift.
|
|
53
66
|
*/
|
|
54
67
|
private readonly connectionKey;
|
|
55
|
-
constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
|
|
56
|
-
|
|
68
|
+
constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger, TDatabase>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
|
|
69
|
+
/** SQS event-source batch size (deployed). */
|
|
70
|
+
batchSize?: number | undefined,
|
|
71
|
+
/** Whether the queue is FIFO (deployed). */
|
|
57
72
|
fifo?: boolean | undefined,
|
|
58
73
|
/**
|
|
59
74
|
* The construct ids the *worker* `.dependsOn()` named — last, so no
|
|
60
75
|
* existing positional argument moves.
|
|
61
76
|
*/
|
|
62
|
-
constructs?: string[]
|
|
77
|
+
constructs?: string[],
|
|
78
|
+
/**
|
|
79
|
+
* What the handler's `db` is registered from — after `constructs`, for
|
|
80
|
+
* the same reason.
|
|
81
|
+
*/
|
|
82
|
+
databaseService?: Service<TDatabaseServiceName, TDatabase>);
|
|
63
83
|
/**
|
|
64
84
|
* What this queue is in the manifest.
|
|
65
85
|
*
|
|
@@ -69,37 +89,17 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
|
|
|
69
89
|
* running and what connection string to inject.
|
|
70
90
|
*/
|
|
71
91
|
declare(): Declaration[];
|
|
72
|
-
/**
|
|
73
|
-
* The producer side — a `Service` exposing an `EventPublisher` typed to this
|
|
74
|
-
* queue's message. Inject it via `.services([queue.publisher])`; the handler
|
|
75
|
-
* then calls `services.<name>Publisher.publish([{ type, payload }])`.
|
|
76
|
-
*
|
|
77
|
-
* It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and builds the transport from
|
|
78
|
-
* the URL protocol — `pgboss://` locally, `sqs://` deployed — so the same
|
|
79
|
-
* code publishes to Postgres in dev and SQS in prod. Because it's a `Service`,
|
|
80
|
-
* `Construct.getEnvironment()` sniffs it, so the env requirement flows into
|
|
81
|
-
* the manifest and infra links exactly this queue with least privilege.
|
|
82
|
-
*/
|
|
83
|
-
/**
|
|
84
|
-
* The queue as a dependency — what `.dependsOn([emailsQueue])` dissolves
|
|
85
|
-
* into, reachable as `services.emails`.
|
|
86
|
-
*
|
|
87
|
-
* It is the producer: a consumer is the worker written right here, so the
|
|
88
|
-
* only thing another construct can want from a queue is the ability to send
|
|
89
|
-
* to it. {@link publisher} is the same service under its older
|
|
90
|
-
* `<name>Publisher` key, kept for `.services([queue.publisher])`.
|
|
91
|
-
*/
|
|
92
|
-
get service(): Service<Uncapitalize<TName>, EventPublisher<QueueMessage<TName, TMessage>>>;
|
|
93
|
-
get publisher(): Service<`${TName}Publisher`, EventPublisher<QueueMessage<TName, TMessage>>>;
|
|
94
92
|
}
|
|
95
|
-
/**
|
|
96
|
-
|
|
93
|
+
/**
|
|
94
|
+
* The context a queue handler receives — a batch of typed messages, and `db`
|
|
95
|
+
* when the queue has a database.
|
|
96
|
+
*/
|
|
97
|
+
type QueueContext<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined> = {
|
|
97
98
|
messages: InferStandardSchema<TMessage>[];
|
|
98
99
|
services: ServiceRecord<TServices>;
|
|
99
100
|
logger: TLogger;
|
|
100
|
-
}
|
|
101
|
-
type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> = (ctx: QueueContext<TMessage, TServices, TLogger>) => unknown | Promise<unknown>;
|
|
102
|
-
//# sourceMappingURL=Queue.d.ts.map
|
|
101
|
+
} & DatabaseContext<TDatabase>;
|
|
102
|
+
type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined> = (ctx: QueueContext<TMessage, TServices, TLogger, TDatabase>) => unknown | Promise<unknown>;
|
|
103
103
|
//#endregion
|
|
104
|
-
export {
|
|
105
|
-
//# sourceMappingURL=Queue-
|
|
104
|
+
export { QueueMessage as i, QueueContext as n, QueueHandler as r, Queue as t };
|
|
105
|
+
//# sourceMappingURL=Queue-HPyi0e1i.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue-HPyi0e1i.d.cts","names":[],"sources":["../src/queue/Queue.ts"],"mappings":";;;;;;;;;;;;;;;KA0BY,aACX,sBACA,iBAAiB,oBACd,mBAAmB,OAAO,oBAAoB;;;;;;;;;;;;;;cAerC,MACZ,+BACA,iBAAiB,mBAAmB,kBACpC,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,uBACA,sDACS,UACT,oBAEA,8BAGA,sBACA;WA8CiB,MAAM;WACN,SAAS,aACxB,UACA,WACA,SACA;WAEe,eAAe;WACN;WACA,UAAU;WACV,QAAQ;;WAEjB;;WAEA;EA1DjB;SAEO,QACN,eACE,OAAO,cAAc,kBAAkB,WAAW;;;;;;;;;WAgB5C;;;;;;;;;;;WAYA,SAAS,QACjB,aAAa,QACb,eAAe,aAAa,OAAO;;;;;mBAOnB;EAEjB,YACiB,MAAM,OACN,SAAS,aACxB,UACA,WACA,SACA,YAEe,eAAe,UACN,kBACA,WAAU,WACV,SAAQ,SAEjB;;EAAA,gCAEA;;EAAA,4BAKhB;;;;;EAAA,uBAKA;;;;;EAAA,kBAAkB,QAAQ,sBAAsB;;;;;;;;;EAyCjD,WAAW;;;;;;KA8BA,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB;EAEA,UAAU,oBAAoB;EAC9B,UAAU,cAAc;EACxB,QAAQ;IACL,gBAAgB;KAER,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,0BAEA,KAAK,aAAa,UAAU,WAAW,SAAS,yBAClC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { t as Construct } from "./Construct-CKUA-CTA.mjs";
|
|
2
|
+
import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
3
|
+
import { Publisher } from "@geekmidas/events";
|
|
4
|
+
import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
|
|
5
|
+
//#region src/queue/Queue.ts
|
|
6
|
+
/**
|
|
7
|
+
* A queue worker — a point-to-point SQS-style queue and its single consumer.
|
|
8
|
+
* Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
|
|
9
|
+
* drains every message of its one `message` type. Build one from the worker
|
|
10
|
+
* that runs it — `worker.queue('Emails').message(schema).handle(…)` — and
|
|
11
|
+
* `gkm build` discovers it into the manifest's `queues` field.
|
|
12
|
+
*
|
|
13
|
+
* Producers send to it by depending on it: `.dependsOn([emails])` makes
|
|
14
|
+
* `services.emails` the publisher.
|
|
15
|
+
*
|
|
16
|
+
* Its handler gets `db` when it has a database: the worker's, declared once
|
|
17
|
+
* with `worker.database(db)`, or its own with `.database(other)`.
|
|
18
|
+
*/
|
|
19
|
+
var Queue = class extends Construct {
|
|
20
|
+
name;
|
|
21
|
+
handler;
|
|
22
|
+
messageSchema;
|
|
23
|
+
timeout;
|
|
24
|
+
services;
|
|
25
|
+
logger;
|
|
26
|
+
batchSize;
|
|
27
|
+
fifo;
|
|
28
|
+
__IS_QUEUE__ = true;
|
|
29
|
+
static isQueue(obj) {
|
|
30
|
+
return Boolean(obj && obj.__IS_QUEUE__ === true && obj.type === "dev.geekmidas.function.queue");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The canonical id this queue is declared under.
|
|
34
|
+
*
|
|
35
|
+
* Derived from the name rather than given separately, so `emails` and
|
|
36
|
+
* `Emails` are one queue. The name stays what it was: it is the wire `type`
|
|
37
|
+
* a producer sends and the worker subscribes to, and changing that would
|
|
38
|
+
* silently orphan in-flight messages.
|
|
39
|
+
*/
|
|
40
|
+
id;
|
|
41
|
+
/**
|
|
42
|
+
* The queue as a dependency — what `.dependsOn([emails])` dissolves into,
|
|
43
|
+
* reachable as `services.emails`.
|
|
44
|
+
*
|
|
45
|
+
* The producer: the queue's one consumer is the handler it was built with,
|
|
46
|
+
* so the only thing another construct can want from a queue is to send to
|
|
47
|
+
* it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport
|
|
48
|
+
* from its protocol — `pgboss://` locally, `sqs://` deployed. A field
|
|
49
|
+
* assigned once, not a getter: services are cached by object identity.
|
|
50
|
+
*/
|
|
51
|
+
service;
|
|
52
|
+
/**
|
|
53
|
+
* The producer's env key. Read by both {@link declare} and the service, so
|
|
54
|
+
* what the target publishes and what the producer looks up cannot drift.
|
|
55
|
+
*/
|
|
56
|
+
connectionKey;
|
|
57
|
+
constructor(name, handler, messageSchema, timeout = 3e4, services = [], logger = DEFAULT_LOGGER, batchSize, fifo, constructs = [], databaseService) {
|
|
58
|
+
super("dev.geekmidas.function.queue", logger, services, [], void 0, timeout, void 0, void 0, constructs);
|
|
59
|
+
this.name = name;
|
|
60
|
+
this.handler = handler;
|
|
61
|
+
this.messageSchema = messageSchema;
|
|
62
|
+
this.timeout = timeout;
|
|
63
|
+
this.services = services;
|
|
64
|
+
this.logger = logger;
|
|
65
|
+
this.batchSize = batchSize;
|
|
66
|
+
this.fifo = fifo;
|
|
67
|
+
this.databaseService = databaseService;
|
|
68
|
+
this.id = canonicalId(name);
|
|
69
|
+
this.connectionKey = provideKey(this.id, "publisherConnectionString");
|
|
70
|
+
const envVar = this.connectionKey;
|
|
71
|
+
this.service = {
|
|
72
|
+
serviceName: serviceKey(this.id),
|
|
73
|
+
async register({ envParser }) {
|
|
74
|
+
const { connectionString } = envParser.create((get) => ({ connectionString: get(envVar).string() })).parse();
|
|
75
|
+
return Publisher.fromConnectionString(connectionString);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* What this queue is in the manifest.
|
|
81
|
+
*
|
|
82
|
+
* A queue is a resource, not a handler: the worker is reached *through* it,
|
|
83
|
+
* so the declaration carries the producer's key and nothing about the code
|
|
84
|
+
* that drains it. The local target reads this to know which broker has to be
|
|
85
|
+
* running and what connection string to inject.
|
|
86
|
+
*/
|
|
87
|
+
declare() {
|
|
88
|
+
return [{
|
|
89
|
+
kind: "queue",
|
|
90
|
+
id: this.id,
|
|
91
|
+
provides: [this.connectionKey],
|
|
92
|
+
...this.fifo ? { fifo: true } : {},
|
|
93
|
+
worker: {
|
|
94
|
+
id: `${this.id}Worker`,
|
|
95
|
+
handler: `${this.id}.handler`,
|
|
96
|
+
dependencies: []
|
|
97
|
+
}
|
|
98
|
+
}];
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
//#endregion
|
|
102
|
+
export { Queue as t };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=Queue-cmhqEBOB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue-cmhqEBOB.mjs","names":[],"sources":["../src/queue/Queue.ts"],"sourcesContent":["import {\n\ttype EventPublisher,\n\ttype EventPublisherConnectionString,\n\ttype PublishableMessage,\n\tPublisher,\n} from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service, ServiceRecord } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { Construct, ConstructType } from '../Construct';\nimport type { DatabaseContext } from '../functions/Function';\n\n/**\n * The wire message a queue carries: `{ type: <queue name>, payload: <message> }`.\n * The producer publishes this shape and the worker receives the `payload`s as\n * its `messages`. Typing `type` to the queue name keeps the publisher fully\n * typed and lets pg-boss (local) / SQS (deployed) route by name.\n */\nexport type QueueMessage<\n\tTName extends string,\n\tTMessage extends StandardSchemaV1,\n> = PublishableMessage<TName, InferStandardSchema<TMessage>>;\n\n/**\n * A queue worker — a point-to-point SQS-style queue and its single consumer.\n * Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue\n * drains every message of its one `message` type. Build one from the worker\n * that runs it — `worker.queue('Emails').message(schema).handle(…)` — and\n * `gkm build` discovers it into the manifest's `queues` field.\n *\n * Producers send to it by depending on it: `.dependsOn([emails])` makes\n * `services.emails` the publisher.\n *\n * Its handler gets `db` when it has a database: the worker's, declared once\n * with `worker.database(db)`, or its own with `.database(other)`.\n */\nexport class Queue<\n\tTName extends string = string,\n\tTMessage extends StandardSchemaV1 = StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends Construct<\n\tTLogger,\n\tundefined,\n\tTServices,\n\tstring,\n\tundefined,\n\tTDatabaseServiceName,\n\tTDatabase\n> {\n\t__IS_QUEUE__ = true;\n\n\tstatic isQueue(\n\t\tobj: unknown,\n\t): obj is Queue<string, StandardSchemaV1, Service[], Logger, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as { __IS_QUEUE__?: boolean }).__IS_QUEUE__ === true &&\n\t\t\t\t(obj as Construct).type === ConstructType.Queue,\n\t\t);\n\t}\n\n\t/**\n\t * The canonical id this queue is declared under.\n\t *\n\t * Derived from the name rather than given separately, so `emails` and\n\t * `Emails` are one queue. The name stays what it was: it is the wire `type`\n\t * a producer sends and the worker subscribes to, and changing that would\n\t * silently orphan in-flight messages.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The queue as a dependency — what `.dependsOn([emails])` dissolves into,\n\t * reachable as `services.emails`.\n\t *\n\t * The producer: the queue's one consumer is the handler it was built with,\n\t * so the only thing another construct can want from a queue is to send to\n\t * it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport\n\t * from its protocol — `pgboss://` locally, `sqs://` deployed. A field\n\t * assigned once, not a getter: services are cached by object identity.\n\t */\n\treadonly service: Service<\n\t\tUncapitalize<TName>,\n\t\tEventPublisher<QueueMessage<TName, TMessage>>\n\t>;\n\n\t/**\n\t * The producer's env key. Read by both {@link declare} and the service, so\n\t * what the target publishes and what the producer looks up cannot drift.\n\t */\n\tprivate readonly connectionKey: string;\n\n\tconstructor(\n\t\tpublic readonly name: TName,\n\t\tpublic readonly handler: QueueHandler<\n\t\t\tTMessage,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTDatabase\n\t\t>,\n\t\tpublic readonly messageSchema: TMessage,\n\t\tpublic override readonly timeout: number = 30000,\n\t\tpublic override readonly services: TServices = [] as unknown as TServices,\n\t\tpublic override readonly logger: TLogger = DEFAULT_LOGGER as TLogger,\n\t\t/** SQS event-source batch size (deployed). */\n\t\tpublic readonly batchSize?: number,\n\t\t/** Whether the queue is FIFO (deployed). */\n\t\tpublic readonly fifo?: boolean,\n\t\t/**\n\t\t * The construct ids the *worker* `.dependsOn()` named — last, so no\n\t\t * existing positional argument moves.\n\t\t */\n\t\tconstructs: string[] = [],\n\t\t/**\n\t\t * What the handler's `db` is registered from — after `constructs`, for\n\t\t * the same reason.\n\t\t */\n\t\tdatabaseService?: Service<TDatabaseServiceName, TDatabase>,\n\t) {\n\t\tsuper(\n\t\t\tConstructType.Queue,\n\t\t\tlogger,\n\t\t\tservices,\n\t\t\t[],\n\t\t\tundefined,\n\t\t\ttimeout,\n\t\t\tundefined, // memorySize\n\t\t\tundefined, // auditorStorageService\n\t\t\tconstructs,\n\t\t);\n\n\t\tthis.databaseService = databaseService;\n\t\tthis.id = canonicalId(name);\n\t\tthis.connectionKey = provideKey(this.id, 'publisherConnectionString');\n\n\t\tconst envVar = this.connectionKey;\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(this.id) as Uncapitalize<TName>,\n\t\t\tasync register({ envParser }) {\n\t\t\t\tconst { connectionString } = envParser\n\t\t\t\t\t.create((get) => ({ connectionString: get(envVar).string() }))\n\t\t\t\t\t.parse();\n\n\t\t\t\treturn Publisher.fromConnectionString<QueueMessage<TName, TMessage>>(\n\t\t\t\t\tconnectionString as EventPublisherConnectionString,\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * What this queue is in the manifest.\n\t *\n\t * A queue is a resource, not a handler: the worker is reached *through* it,\n\t * so the declaration carries the producer's key and nothing about the code\n\t * that drains it. The local target reads this to know which broker has to be\n\t * running and what connection string to inject.\n\t */\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'queue',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.connectionKey],\n\t\t\t\t...(this.fifo ? { fifo: true } : {}),\n\t\t\t\t// Nested rather than a sibling node, because position carries the\n\t\t\t\t// trigger: this handler is reached by messages on this queue and\n\t\t\t\t// by nothing else, so there is no `trigger` field to keep in step.\n\t\t\t\t//\n\t\t\t\t// `handler` is the export name; which directory the build wrote it\n\t\t\t\t// to is the target's business, and a path with a cloud in it does\n\t\t\t\t// not belong in a neutral declaration.\n\t\t\t\tworker: {\n\t\t\t\t\tid: `${this.id}Worker`,\n\t\t\t\t\thandler: `${this.id}.handler`,\n\t\t\t\t\t// Filled by the build from what the worker declared. Empty is a\n\t\t\t\t\t// stated gap, not a claim that it reaches nothing.\n\t\t\t\t\tdependencies: [],\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n}\n\n/**\n * The context a queue handler receives — a batch of typed messages, and `db`\n * when the queue has a database.\n */\nexport type QueueContext<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n> = {\n\tmessages: InferStandardSchema<TMessage>[];\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n} & DatabaseContext<TDatabase>;\n\nexport type QueueHandler<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n> = (\n\tctx: QueueContext<TMessage, TServices, TLogger, TDatabase>,\n) => unknown | Promise<unknown>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4CA,IAAa,QAAb,cAOU,UAQR;CA6CgB;CACA;CAMA;CACS;CACA;CACA;CAET;CAEA;CA1DjB,eAAe;CAEf,OAAO,QACN,KACiE;EACjE,OAAO,QACN,OACE,IAAmC,iBAAiB,QACpD,IAAkB,SAAA,8BACrB;CACD;;;;;;;;;CAUA;;;;;;;;;;;CAYA;;;;;CASA;CAEA,YACC,MACA,SAMA,eACA,UAA2C,KAC3C,WAA+C,CAAC,GAChD,SAA2C,gBAE3C,WAEA,MAKA,aAAuB,CAAC,GAKxB,iBACC;EACD,MAAA,gCAEC,QACA,UACA,CAAC,GACD,KAAA,GACA,SACA,KAAA,GACA,KAAA,GACA,UACD;EApCgB,KAAA,OAAA;EACA,KAAA,UAAA;EAMA,KAAA,gBAAA;EACS,KAAA,UAAA;EACA,KAAA,WAAA;EACA,KAAA,SAAA;EAET,KAAA,YAAA;EAEA,KAAA,OAAA;EAwBhB,KAAK,kBAAkB;EACvB,KAAK,KAAK,YAAY,IAAI;EAC1B,KAAK,gBAAgB,WAAW,KAAK,IAAI,2BAA2B;EAEpE,MAAM,SAAS,KAAK;EACpB,KAAK,UAAU;GACd,aAAa,WAAW,KAAK,EAAE;GAC/B,MAAM,SAAS,EAAE,aAAa;IAC7B,MAAM,EAAE,qBAAqB,UAC3B,QAAQ,SAAS,EAAE,kBAAkB,IAAI,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAC7D,MAAM;IAER,OAAO,UAAU,qBAChB,gBACD;GACD;EACD;CACD;;;;;;;;;CAUA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,aAAa;GAC7B,GAAI,KAAK,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;GAQlC,QAAQ;IACP,IAAI,GAAG,KAAK,GAAG;IACf,SAAS,GAAG,KAAK,GAAG;IAGpB,cAAc,CAAC;GAChB;EACD,CACD;CACD;AACD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
|
|
2
|
+
import { c as ServicesOf, r as Consumable } from "./construct-interface-ZvYQbivO.mjs";
|
|
3
|
+
import { r as QueueHandler, t as Queue } from "./Queue-DlsHRzUp.mjs";
|
|
4
|
+
import { Service } from "@geekmidas/services";
|
|
5
|
+
import { Logger } from "@geekmidas/logger";
|
|
6
|
+
//#region src/queue/QueueBuilder.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Builds a {@link Queue} and its one consumer. Reached through
|
|
9
|
+
* `worker.queue('orders')`, never constructed by hand: the worker stamps itself
|
|
10
|
+
* as the owner. `message` is the typed job payload and `handle` the consumer.
|
|
11
|
+
* The queue name is captured as a literal so `queue.service` publishes
|
|
12
|
+
* `{ type: '<name>', payload }`. The handler's `db` is the worker's database
|
|
13
|
+
* unless `.database(other)` names another.
|
|
14
|
+
*/
|
|
15
|
+
declare class QueueBuilder<TName extends string = string, TMessage extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined, TDatabaseServiceName extends string = string> {
|
|
16
|
+
private _name?;
|
|
17
|
+
private _messageSchema?;
|
|
18
|
+
private _timeout;
|
|
19
|
+
private _batchSize?;
|
|
20
|
+
private _fifo?;
|
|
21
|
+
private _services;
|
|
22
|
+
/** The construct ids `.dependsOn()` named — what the manifest records. */
|
|
23
|
+
_constructs: string[];
|
|
24
|
+
private _logger;
|
|
25
|
+
/** The worker that runs this queue's consumer — stamped by `worker.queue()`. */
|
|
26
|
+
_owner?: string;
|
|
27
|
+
/** What the handler's `db` comes from — the worker's, unless overridden. */
|
|
28
|
+
private _databaseService?;
|
|
29
|
+
/** The edge `.database()` added, so the next one can replace it. */
|
|
30
|
+
private _databaseEdge?;
|
|
31
|
+
/** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
|
|
32
|
+
queue<T extends string>(name: T): QueueBuilder<T, TMessage, TServices, TLogger, TDatabase, TDatabaseServiceName>;
|
|
33
|
+
timeout(timeout: number): this;
|
|
34
|
+
/** SQS event-source batch size (deployed). */
|
|
35
|
+
batchSize(batchSize: number): this;
|
|
36
|
+
/** Mark the queue as FIFO (deployed). */
|
|
37
|
+
fifo(fifo?: boolean): this;
|
|
38
|
+
/**
|
|
39
|
+
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
40
|
+
* topic.
|
|
41
|
+
*
|
|
42
|
+
* It records the edge and dissolves each construct's client into the
|
|
43
|
+
* handler's service record under the construct's own id, so
|
|
44
|
+
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
45
|
+
*
|
|
46
|
+
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
47
|
+
* env sniffing confined to `.services()` and the explicit lift.
|
|
48
|
+
*/
|
|
49
|
+
dependsOn<const T extends readonly Consumable[]>(constructs: T): QueueBuilder<TName, TMessage, [...TServices, ...ServicesOf<T>], TLogger, TDatabase, TDatabaseServiceName>;
|
|
50
|
+
services<T extends Service[]>(services: T): QueueBuilder<TName, TMessage, [...TServices, ...T], TLogger, TDatabase, TDatabaseServiceName>;
|
|
51
|
+
logger<T extends Logger>(logger: T): QueueBuilder<TName, TMessage, TServices, T, TDatabase, TDatabaseServiceName>;
|
|
52
|
+
/**
|
|
53
|
+
* The database the handler receives as `db`.
|
|
54
|
+
*
|
|
55
|
+
* A queue built from a worker already has the worker's, when the worker
|
|
56
|
+
* named one with `.database(db)`; this replaces it — the edge as well as
|
|
57
|
+
* the client — for a consumer that works against a different database.
|
|
58
|
+
*/
|
|
59
|
+
database<T, TDbName extends string>(source: Consumable<TDbName, T> | Service<TDbName, T>): QueueBuilder<TName, TMessage, TServices, TLogger, T, TDbName>;
|
|
60
|
+
/** The typed message (job) payload the queue carries. */
|
|
61
|
+
message<T extends StandardSchemaV1>(schema: T): QueueBuilder<TName, T, TServices, TLogger, TDatabase, TDatabaseServiceName>;
|
|
62
|
+
handle(fn: QueueHandler<NonNullable<TMessage>, TServices, TLogger, TDatabase>): Queue<TName, NonNullable<TMessage>, TServices, TLogger, TDatabase, TDatabaseServiceName>;
|
|
63
|
+
}
|
|
64
|
+
/** A queue built without a name — only reachable by building one by hand. */
|
|
65
|
+
declare class QueueNeedsName extends Error {
|
|
66
|
+
constructor();
|
|
67
|
+
}
|
|
68
|
+
/** A queue whose message was never described. */
|
|
69
|
+
declare class QueueNeedsMessage extends Error {
|
|
70
|
+
readonly queue: string;
|
|
71
|
+
constructor(queue: string);
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { QueueNeedsMessage as n, QueueNeedsName as r, QueueBuilder as t };
|
|
75
|
+
//# sourceMappingURL=QueueBuilder-Cx9lKC5d.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueueBuilder-Cx9lKC5d.d.mts","names":[],"sources":["../src/queue/QueueBuilder.ts"],"mappings":";;;;;;;;;;;;;;cAuBa,aACZ,+BACA,iBAAiB,0CACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,uBACA;UAEQ;UACA;UACA;UACA;UACA;UACA;;EAED;UACC;;EAED;;UAEC;;UAEA;;EAGR,MAAM,kBACL,MAAM,IACJ,aACF,GACA,UACA,WACA,SACA,WACA;EAYD,QAAQ;;EAKR,UAAU;;EAKV,KAAK;;;;;;;;;;;;EAeL,gBAAgB,mBAAmB,cAClC,YAAY,IACV,aACF,OACA,cACI,cAAc,WAAW,KAC7B,SACA,WACA;EAwBD,SAAS,UAAU,WAClB,UAAU,IACR,aACF,OACA,cACI,cAAc,IAClB,SACA,WACA;EAcD,OAAO,UAAU,QAChB,QAAQ,IACN,aACF,OACA,UACA,WACA,GACA,WACA;;;;;;;;EAqBD,SAAS,GAAG,wBACX,QAAQ,WAAW,SAAS,KAAK,QAAQ,SAAS,KAChD,aAAa,OAAO,UAAU,WAAW,SAAS,GAAG;;EAuBxD,QAAQ,UAAU,kBACjB,QAAQ,IACN,aACF,OACA,GACA,WACA,SACA,WACA;EAcD,OACC,IAAI,aAAa,YAAY,WAAW,WAAW,SAAS,aAC1D,MACF,OACA,YAAY,WACZ,WACA,SACA,WACA;;;cAsCW,uBAAuB;EACnC;;;cASY,0BAA0B;WACjB;EAArB,YAAqB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { databaseEdges, idsOf, serviceOf, servicesOf } from "./construct-interface.mjs";
|
|
2
|
+
import { t as cloneWith } from "./clone-EKNovYHu.mjs";
|
|
3
|
+
import { t as Queue } from "./Queue-cmhqEBOB.mjs";
|
|
4
|
+
import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
|
|
5
|
+
//#region src/queue/QueueBuilder.ts
|
|
6
|
+
/**
|
|
7
|
+
* Builds a {@link Queue} and its one consumer. Reached through
|
|
8
|
+
* `worker.queue('orders')`, never constructed by hand: the worker stamps itself
|
|
9
|
+
* as the owner. `message` is the typed job payload and `handle` the consumer.
|
|
10
|
+
* The queue name is captured as a literal so `queue.service` publishes
|
|
11
|
+
* `{ type: '<name>', payload }`. The handler's `db` is the worker's database
|
|
12
|
+
* unless `.database(other)` names another.
|
|
13
|
+
*/
|
|
14
|
+
var QueueBuilder = class {
|
|
15
|
+
_name;
|
|
16
|
+
_messageSchema;
|
|
17
|
+
_timeout = 3e4;
|
|
18
|
+
_batchSize;
|
|
19
|
+
_fifo;
|
|
20
|
+
_services = [];
|
|
21
|
+
/** The construct ids `.dependsOn()` named — what the manifest records. */
|
|
22
|
+
_constructs = [];
|
|
23
|
+
_logger = DEFAULT_LOGGER;
|
|
24
|
+
/** The worker that runs this queue's consumer — stamped by `worker.queue()`. */
|
|
25
|
+
_owner;
|
|
26
|
+
/** What the handler's `db` comes from — the worker's, unless overridden. */
|
|
27
|
+
_databaseService;
|
|
28
|
+
/** The edge `.database()` added, so the next one can replace it. */
|
|
29
|
+
_databaseEdge;
|
|
30
|
+
/** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
|
|
31
|
+
queue(name) {
|
|
32
|
+
return cloneWith(this, { _name: name });
|
|
33
|
+
}
|
|
34
|
+
timeout(timeout) {
|
|
35
|
+
return cloneWith(this, { _timeout: timeout });
|
|
36
|
+
}
|
|
37
|
+
/** SQS event-source batch size (deployed). */
|
|
38
|
+
batchSize(batchSize) {
|
|
39
|
+
return cloneWith(this, { _batchSize: batchSize });
|
|
40
|
+
}
|
|
41
|
+
/** Mark the queue as FIFO (deployed). */
|
|
42
|
+
fifo(fifo = true) {
|
|
43
|
+
return cloneWith(this, { _fifo: fifo });
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
47
|
+
* topic.
|
|
48
|
+
*
|
|
49
|
+
* It records the edge and dissolves each construct's client into the
|
|
50
|
+
* handler's service record under the construct's own id, so
|
|
51
|
+
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
52
|
+
*
|
|
53
|
+
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
54
|
+
* env sniffing confined to `.services()` and the explicit lift.
|
|
55
|
+
*/
|
|
56
|
+
dependsOn(constructs) {
|
|
57
|
+
const services = servicesOf(constructs);
|
|
58
|
+
return cloneWith(this, {
|
|
59
|
+
_services: [...this._services, ...services],
|
|
60
|
+
_constructs: idsOf(constructs, this._constructs)
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
services(services) {
|
|
64
|
+
return cloneWith(this, { _services: [...this._services, ...services] });
|
|
65
|
+
}
|
|
66
|
+
logger(logger) {
|
|
67
|
+
return cloneWith(this, { _logger: logger });
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The database the handler receives as `db`.
|
|
71
|
+
*
|
|
72
|
+
* A queue built from a worker already has the worker's, when the worker
|
|
73
|
+
* named one with `.database(db)`; this replaces it — the edge as well as
|
|
74
|
+
* the client — for a consumer that works against a different database.
|
|
75
|
+
*/
|
|
76
|
+
database(source) {
|
|
77
|
+
return cloneWith(this, {
|
|
78
|
+
_databaseService: serviceOf(source),
|
|
79
|
+
...databaseEdges({
|
|
80
|
+
constructs: this._constructs,
|
|
81
|
+
edge: this._databaseEdge,
|
|
82
|
+
service: this._databaseService,
|
|
83
|
+
services: this._services
|
|
84
|
+
}, source)
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/** The typed message (job) payload the queue carries. */
|
|
88
|
+
message(schema) {
|
|
89
|
+
return cloneWith(this, { _messageSchema: schema });
|
|
90
|
+
}
|
|
91
|
+
handle(fn) {
|
|
92
|
+
if (!this._name) throw new QueueNeedsName();
|
|
93
|
+
if (!this._messageSchema) throw new QueueNeedsMessage(this._name);
|
|
94
|
+
const queue = new Queue(this._name, fn, this._messageSchema, this._timeout, this._services, this._logger, this._batchSize, this._fifo, this._constructs, this._databaseService);
|
|
95
|
+
queue.owner = this._owner;
|
|
96
|
+
return queue;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
/** A queue built without a name — only reachable by building one by hand. */
|
|
100
|
+
var QueueNeedsName = class extends Error {
|
|
101
|
+
constructor() {
|
|
102
|
+
super("A queue needs a name: build it from a worker, worker.queue('Emails').");
|
|
103
|
+
this.name = "QueueNeedsName";
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/** A queue whose message was never described. */
|
|
107
|
+
var QueueNeedsMessage = class extends Error {
|
|
108
|
+
queue;
|
|
109
|
+
constructor(queue) {
|
|
110
|
+
super(`Queue '${queue}' has no message: call .message(schema) before .handle(), so its producers and its consumer agree on what it carries.`);
|
|
111
|
+
this.queue = queue;
|
|
112
|
+
this.name = "QueueNeedsMessage";
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
//#endregion
|
|
116
|
+
export { QueueNeedsMessage as n, QueueNeedsName as r, QueueBuilder as t };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=QueueBuilder-DXu1qxT1.mjs.map
|