@geekmidas/constructs 10.0.0-alpha.1 → 10.0.0-alpha.100
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 +223 -158
- package/dist/{Construct-CdhThxDI.mjs → Construct-B1vGBPme.mjs} +45 -33
- package/dist/Construct-B1vGBPme.mjs.map +1 -0
- package/dist/Construct-BQALFCh2.d.cts +230 -0
- package/dist/Construct-BQALFCh2.d.cts.map +1 -0
- package/dist/{Construct-roId57cU.cjs → Construct-DUSXuTHP.cjs} +65 -47
- package/dist/Construct-DUSXuTHP.cjs.map +1 -0
- package/dist/Construct-QXnl3VqT.d.mts +230 -0
- package/dist/Construct-QXnl3VqT.d.mts.map +1 -0
- package/dist/Cron-DI3nKoic.d.cts +45 -0
- package/dist/Cron-DI3nKoic.d.cts.map +1 -0
- package/dist/Cron-uYAHPnp7.d.mts +45 -0
- package/dist/Cron-uYAHPnp7.d.mts.map +1 -0
- package/dist/CronBuilder-C0Ek1-RA.cjs +121 -0
- package/dist/CronBuilder-C0Ek1-RA.cjs.map +1 -0
- package/dist/CronBuilder-DaSUm2Na.d.mts +47 -0
- package/dist/CronBuilder-DaSUm2Na.d.mts.map +1 -0
- package/dist/CronBuilder-Dmix_Pen.mjs +109 -0
- package/dist/CronBuilder-Dmix_Pen.mjs.map +1 -0
- package/dist/CronBuilder-g1lZLWyG.d.cts +47 -0
- package/dist/CronBuilder-g1lZLWyG.d.cts.map +1 -0
- package/dist/{Endpoint-BTj58Gob.mjs → Endpoint-BG4UJ9oA.mjs} +146 -109
- package/dist/Endpoint-BG4UJ9oA.mjs.map +1 -0
- package/dist/{Endpoint-BBkV6l0k.cjs → Endpoint-BoUg8ocM.cjs} +174 -131
- package/dist/Endpoint-BoUg8ocM.cjs.map +1 -0
- package/dist/{Endpoint-BKR5QH6O.d.mts → Endpoint-Du-NwPX2.d.mts} +83 -91
- package/dist/Endpoint-Du-NwPX2.d.mts.map +1 -0
- package/dist/{Endpoint-BQ9O0P1w.d.cts → Endpoint-aCvBMPoH.d.cts} +82 -90
- package/dist/Endpoint-aCvBMPoH.d.cts.map +1 -0
- package/dist/{EndpointFactory-BejSTzbB.mjs → EndpointFactory-BDtsrEvJ.mjs} +60 -77
- package/dist/EndpointFactory-BDtsrEvJ.mjs.map +1 -0
- package/dist/{EndpointFactory-DYoGLaIT.cjs → EndpointFactory-DJ7gXLpR.cjs} +96 -113
- package/dist/EndpointFactory-DJ7gXLpR.cjs.map +1 -0
- package/dist/{index-D5zqAJ2e.d.cts → EndpointFactory-DMYdJCOj.d.mts} +78 -134
- package/dist/EndpointFactory-DMYdJCOj.d.mts.map +1 -0
- package/dist/{index-Cvz551AO.d.mts → EndpointFactory-I7s1co3Y.d.cts} +79 -135
- package/dist/EndpointFactory-I7s1co3Y.d.cts.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-7aYNdqJq.mjs → HonoEndpointAdaptor-PtPlbeKY.mjs} +75 -57
- package/dist/HonoEndpointAdaptor-PtPlbeKY.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-wMsCyMgt.cjs → HonoEndpointAdaptor-zVzVLJEO.cjs} +83 -62
- package/dist/HonoEndpointAdaptor-zVzVLJEO.cjs.map +1 -0
- package/dist/Queue-A3wfD0it.cjs +109 -0
- package/dist/Queue-A3wfD0it.cjs.map +1 -0
- package/dist/Queue-D6USGS4q.mjs +104 -0
- package/dist/Queue-D6USGS4q.mjs.map +1 -0
- package/dist/{Queue-D6WeziRD.d.cts → Queue-DlsHRzUp.d.mts} +48 -48
- package/dist/Queue-DlsHRzUp.d.mts.map +1 -0
- package/dist/{Queue-DpUeqdC8.d.mts → Queue-HPyi0e1i.d.cts} +49 -49
- package/dist/Queue-HPyi0e1i.d.cts.map +1 -0
- package/dist/QueueBuilder-BjuF0UBl.cjs +135 -0
- package/dist/QueueBuilder-BjuF0UBl.cjs.map +1 -0
- package/dist/QueueBuilder-Cue73M4t.mjs +118 -0
- package/dist/QueueBuilder-Cue73M4t.mjs.map +1 -0
- package/dist/QueueBuilder-OSi6LkV9.d.cts +75 -0
- package/dist/QueueBuilder-OSi6LkV9.d.cts.map +1 -0
- package/dist/QueueBuilder-QHsnVt1P.d.mts +75 -0
- package/dist/QueueBuilder-QHsnVt1P.d.mts.map +1 -0
- package/dist/{Subscriber-4rBJgDKI.d.mts → Subscriber-Bpp02cGr.d.cts} +30 -21
- package/dist/Subscriber-Bpp02cGr.d.cts.map +1 -0
- package/dist/{Subscriber-DVQowdyj.d.cts → Subscriber-CtN9R48-.d.mts} +29 -20
- package/dist/Subscriber-CtN9R48-.d.mts.map +1 -0
- package/dist/SubscriberBuilder-CDy4nHCz.mjs +134 -0
- package/dist/SubscriberBuilder-CDy4nHCz.mjs.map +1 -0
- package/dist/SubscriberBuilder-CuCMFpYW.d.mts +67 -0
- package/dist/SubscriberBuilder-CuCMFpYW.d.mts.map +1 -0
- package/dist/SubscriberBuilder-D_owVoHo.cjs +145 -0
- package/dist/SubscriberBuilder-D_owVoHo.cjs.map +1 -0
- package/dist/SubscriberBuilder-g3fAVWgs.d.cts +67 -0
- package/dist/SubscriberBuilder-g3fAVWgs.d.cts.map +1 -0
- package/dist/Topic-D74b5cgs.mjs +99 -0
- package/dist/Topic-D74b5cgs.mjs.map +1 -0
- package/dist/Topic-GHxcU8AG.cjs +104 -0
- package/dist/Topic-GHxcU8AG.cjs.map +1 -0
- package/dist/adaptors/aws.cjs +332 -188
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +114 -44
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +114 -44
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +308 -166
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +3 -11
- package/dist/adaptors/hono.d.cts +7 -16
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +8 -17
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +2 -11
- package/dist/adaptors/testing.cjs +743 -90
- 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 +706 -71
- 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-CcuceLYo.d.mts +268 -0
- package/dist/auth-CcuceLYo.d.mts.map +1 -0
- package/dist/auth.cjs +302 -34
- 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 +290 -28
- package/dist/auth.mjs.map +1 -1
- package/dist/{cache-CdQ7OLpR.d.cts → cache-CXh6GIgb.d.mts} +4 -7
- package/dist/cache-CXh6GIgb.d.mts.map +1 -0
- package/dist/{cache-DYoJFcfd.d.mts → cache-DnGDGly3.d.cts} +4 -7
- 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-BqwRNYA2.d.mts → construct-interface-B1AfqRl4.d.cts} +43 -12
- package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
- package/dist/{construct-interface-D2nNkHUN.d.cts → construct-interface-DluK3_da.d.mts} +43 -12
- package/dist/construct-interface-DluK3_da.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.cjs +77 -17
- package/dist/credential.cjs.map +1 -1
- package/dist/credential.d.cts +34 -9
- package/dist/credential.d.cts.map +1 -1
- package/dist/credential.d.mts +34 -9
- package/dist/credential.d.mts.map +1 -1
- package/dist/credential.mjs +71 -13
- package/dist/credential.mjs.map +1 -1
- package/dist/crons/index.cjs +189 -85
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +70 -48
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +70 -48
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +183 -81
- 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 +3 -7
- 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 +8 -11
- package/dist/endpoints/index.d.cts +51 -7
- package/dist/endpoints/index.d.cts.map +1 -0
- package/dist/endpoints/index.d.mts +51 -7
- package/dist/endpoints/index.d.mts.map +1 -0
- package/dist/endpoints/index.mjs +6 -11
- package/dist/external-api-MJ8id87V.d.mts +105 -0
- package/dist/external-api-MJ8id87V.d.mts.map +1 -0
- package/dist/external-api-O107yzZJ.d.cts +105 -0
- package/dist/external-api-O107yzZJ.d.cts.map +1 -0
- package/dist/external-api.cjs +142 -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 +139 -0
- package/dist/external-api.mjs.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 +2 -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-Cpff1uZH.mjs → functions-BFizikJU.mjs} +394 -243
- package/dist/functions-BFizikJU.mjs.map +1 -0
- package/dist/{functions-DukjG8ov.cjs → functions-CfzJG9hK.cjs} +432 -275
- package/dist/functions-CfzJG9hK.cjs.map +1 -0
- package/dist/index-BuzRvKOQ.d.cts +115 -0
- package/dist/index-BuzRvKOQ.d.cts.map +1 -0
- package/dist/index-CTkKOer4.d.mts +115 -0
- package/dist/index-CTkKOer4.d.mts.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-Bii4l6eP.mjs +370 -0
- package/dist/kysely-Bii4l6eP.mjs.map +1 -0
- package/dist/kysely-CO_Dk43W.cjs +383 -0
- package/dist/kysely-CO_Dk43W.cjs.map +1 -0
- package/dist/kysely-D0bpzgPs.d.cts +175 -0
- package/dist/kysely-D0bpzgPs.d.cts.map +1 -0
- package/dist/kysely-DUqC3Ie0.d.mts +175 -0
- package/dist/kysely-DUqC3Ie0.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/{lazyAccessors-DM6HcXQk.mjs → lazyAccessors-CFanua0O.mjs} +20 -21
- package/dist/lazyAccessors-CFanua0O.mjs.map +1 -0
- package/dist/{lazyAccessors-DrJj8NpA.cjs → lazyAccessors-hJKGv8Ay.cjs} +60 -62
- package/dist/lazyAccessors-hJKGv8Ay.cjs.map +1 -0
- package/dist/mobile-app.cjs +73 -0
- package/dist/mobile-app.cjs.map +1 -0
- package/dist/mobile-app.d.cts +61 -0
- package/dist/mobile-app.d.cts.map +1 -0
- package/dist/mobile-app.d.mts +61 -0
- package/dist/mobile-app.d.mts.map +1 -0
- package/dist/mobile-app.mjs +72 -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/processAudits-BRRVVHUB.mjs +131 -0
- package/dist/processAudits-BRRVVHUB.mjs.map +1 -0
- package/dist/processAudits-DasOZjPl.cjs +154 -0
- package/dist/processAudits-DasOZjPl.cjs.map +1 -0
- 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/rest-api.cjs +92 -63
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +81 -61
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +81 -61
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +84 -55
- 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 +35 -9
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +25 -22
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +25 -22
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +31 -5
- 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 +111 -101
- package/dist/subscribers/index.cjs.map +1 -1
- package/dist/subscribers/index.d.cts +44 -56
- package/dist/subscribers/index.d.cts.map +1 -1
- package/dist/subscribers/index.d.mts +44 -56
- package/dist/subscribers/index.d.mts.map +1 -1
- package/dist/subscribers/index.mjs +108 -98
- package/dist/subscribers/index.mjs.map +1 -1
- 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-DRtT1_0A.d.mts +40 -0
- package/dist/telemetry-DRtT1_0A.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 -32
- package/dist/topic/index.d.mts +2 -32
- package/dist/topic/index.mjs +2 -134
- package/dist/tracing-CxaZ98IB.mjs +110 -0
- package/dist/tracing-CxaZ98IB.mjs.map +1 -0
- package/dist/tracing-DPMidF_r.cjs +127 -0
- package/dist/tracing-DPMidF_r.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 +191 -0
- package/dist/worker.cjs.map +1 -0
- package/dist/worker.d.cts +171 -0
- package/dist/worker.d.cts.map +1 -0
- package/dist/worker.d.mts +171 -0
- package/dist/worker.d.mts.map +1 -0
- package/dist/worker.mjs +190 -0
- package/dist/worker.mjs.map +1 -0
- package/package.json +116 -70
- package/dist/AWSScheduledFunction-9bJS4WdJ.d.cts +0 -122
- package/dist/AWSScheduledFunction-9bJS4WdJ.d.cts.map +0 -1
- package/dist/AWSScheduledFunction-BJjj8B5V.mjs +0 -243
- package/dist/AWSScheduledFunction-BJjj8B5V.mjs.map +0 -1
- package/dist/AWSScheduledFunction-BO5iEMSh.d.mts +0 -122
- package/dist/AWSScheduledFunction-BO5iEMSh.d.mts.map +0 -1
- package/dist/AWSScheduledFunction-qu4ieRZR.cjs +0 -255
- package/dist/AWSScheduledFunction-qu4ieRZR.cjs.map +0 -1
- package/dist/Construct-B-xc0SE9.d.mts +0 -104
- package/dist/Construct-B-xc0SE9.d.mts.map +0 -1
- package/dist/Construct-CdhThxDI.mjs.map +0 -1
- package/dist/Construct-WhCXIOPV.d.cts +0 -104
- package/dist/Construct-WhCXIOPV.d.cts.map +0 -1
- package/dist/Construct-roId57cU.cjs.map +0 -1
- package/dist/Endpoint-BBkV6l0k.cjs.map +0 -1
- package/dist/Endpoint-BKR5QH6O.d.mts.map +0 -1
- package/dist/Endpoint-BQ9O0P1w.d.cts.map +0 -1
- package/dist/Endpoint-BTj58Gob.mjs.map +0 -1
- package/dist/EndpointFactory-BejSTzbB.mjs.map +0 -1
- package/dist/EndpointFactory-DYoGLaIT.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-7aYNdqJq.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-wMsCyMgt.cjs.map +0 -1
- package/dist/Queue-D6WeziRD.d.cts.map +0 -1
- package/dist/Queue-DpUeqdC8.d.mts.map +0 -1
- package/dist/Subscriber-4rBJgDKI.d.mts.map +0 -1
- package/dist/Subscriber-DVQowdyj.d.cts.map +0 -1
- package/dist/Topic-Ohx9dvWr.d.cts +0 -91
- package/dist/Topic-Ohx9dvWr.d.cts.map +0 -1
- package/dist/Topic-cmy2jOUy.d.mts +0 -91
- package/dist/Topic-cmy2jOUy.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-CdQ7OLpR.d.cts.map +0 -1
- package/dist/cache-DYoJFcfd.d.mts.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-BqwRNYA2.d.mts.map +0 -1
- package/dist/construct-interface-D2nNkHUN.d.cts.map +0 -1
- package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
- package/dist/construct-interface-Z4CpS8tK.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-Cpff1uZH.mjs.map +0 -1
- package/dist/functions-DukjG8ov.cjs.map +0 -1
- package/dist/index-BTvozlUD.d.cts +0 -163
- package/dist/index-BTvozlUD.d.cts.map +0 -1
- package/dist/index-Cvz551AO.d.mts.map +0 -1
- package/dist/index-D5zqAJ2e.d.cts.map +0 -1
- package/dist/index-L7pz0R0T.d.mts +0 -162
- package/dist/index-L7pz0R0T.d.mts.map +0 -1
- package/dist/lazyAccessors-DM6HcXQk.mjs.map +0 -1
- package/dist/lazyAccessors-DrJj8NpA.cjs.map +0 -1
- package/dist/processAudits-Bc8rz6Ev.cjs +0 -92
- package/dist/processAudits-Bc8rz6Ev.cjs.map +0 -1
- package/dist/processAudits-D89tICM4.mjs +0 -80
- package/dist/processAudits-D89tICM4.mjs.map +0 -1
- package/dist/publisher-CGEo8UKD.mjs +0 -41
- package/dist/publisher-CGEo8UKD.mjs.map +0 -1
- package/dist/publisher-CqGsXB2X.cjs +0 -53
- package/dist/publisher-CqGsXB2X.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/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.d.cts.map +0 -1
- package/dist/topic/index.d.mts.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
package/dist/crons/index.d.cts
CHANGED
|
@@ -1,52 +1,74 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import * as _geekmidas_schema16 from "@geekmidas/schema";
|
|
9
|
-
import { ComposableStandardSchema } from "@geekmidas/schema";
|
|
10
|
-
import * as _geekmidas_services17 from "@geekmidas/services";
|
|
11
|
-
import { Service } from "@geekmidas/services";
|
|
12
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
13
|
-
|
|
14
|
-
//#region src/crons/CronBuilder.d.ts
|
|
15
|
-
declare class CronBuilder<TInput extends ComposableStandardSchema, TServices extends Service[], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string, TDatabase = undefined, TDatabaseServiceName extends string = string> extends FunctionBuilder<TInput, OutSchema, TServices, TLogger, TEventPublisher, TEventPublisherServiceName, undefined, string, TDatabase, TDatabaseServiceName> {
|
|
16
|
-
private _schedule?;
|
|
17
|
-
constructor();
|
|
18
|
-
memorySize(memorySize: number): this;
|
|
19
|
-
schedule(_expression: ScheduleExpression): CronBuilder<TInput, TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
20
|
-
input<T extends ComposableStandardSchema>(schema: T): CronBuilder<T, TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
21
|
-
output<T extends StandardSchemaV1>(schema: T): CronBuilder<TInput, TServices, TLogger, T, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
22
|
-
/**
|
|
23
|
-
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
24
|
-
* topic.
|
|
25
|
-
*
|
|
26
|
-
* It records the edge and dissolves each construct's client into the
|
|
27
|
-
* handler's service record under the construct's own id, so
|
|
28
|
-
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
29
|
-
*
|
|
30
|
-
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
31
|
-
* env sniffing confined to `.services()` and the explicit lift.
|
|
32
|
-
*/
|
|
33
|
-
dependsOn<const T extends readonly Consumable[]>(constructs: T): CronBuilder<TInput, [...TServices, ...ServicesOf<T>], TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
34
|
-
services<T extends Service[]>(services: T): CronBuilder<TInput, [...TServices, ...T], TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
35
|
-
logger<T extends Logger>(logger: T): CronBuilder<TInput, TServices, T, OutSchema, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
36
|
-
publisher<T extends EventPublisher<any>, TName extends string>(publisher: Service<TName, T>): CronBuilder<TInput, TServices, TLogger, OutSchema, T, TName, TDatabase, TDatabaseServiceName>;
|
|
37
|
-
/**
|
|
38
|
-
* Set the database service for this cron job.
|
|
39
|
-
* The database will be available in the handler context as `db`.
|
|
40
|
-
*/
|
|
41
|
-
database<T, TName extends string>(source: Consumable<TName, T> | Service<TName, T>): CronBuilder<TInput, TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, T, TName>;
|
|
42
|
-
handle(fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>): Cron<TInput, TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
1
|
+
import { i as ScheduleExpression, n as CronExpression, r as RateExpression, t as Cron } from "../Cron-DI3nKoic.cjs";
|
|
2
|
+
import { t as CronBuilder } from "../CronBuilder-g1lZLWyG.cjs";
|
|
3
|
+
import { ServiceDiscovery } from "@geekmidas/services";
|
|
4
|
+
//#region src/crons/inProcess.d.ts
|
|
5
|
+
/** A schedule that is running, and the way to stop it. */
|
|
6
|
+
interface InProcessSchedule {
|
|
7
|
+
stop(): void;
|
|
43
8
|
}
|
|
44
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Run `fire` on a cron expression, in this process, by timer.
|
|
11
|
+
*
|
|
12
|
+
* For the one process that has no broker to keep a schedule: `gkm dev` on a
|
|
13
|
+
* target whose crons are infrastructure once deployed — an EventBridge rule on
|
|
14
|
+
* AWS. Deployed, a timer is the wrong tool: each replica would fire every job
|
|
15
|
+
* once, and nothing would say so. That is why a server schedules through
|
|
16
|
+
* pg-boss, and why this is never what a deployed process does.
|
|
17
|
+
*
|
|
18
|
+
* In UTC, as the deployed schedule is. The next firing is worked out from the
|
|
19
|
+
* clock after each run rather than read off a sequence, so a run that outlasts
|
|
20
|
+
* its interval skips what it overran instead of firing them back to back.
|
|
21
|
+
*/
|
|
22
|
+
export declare function scheduleInProcess(expression: string, fire: () => Promise<unknown> | unknown): InProcessSchedule;
|
|
45
23
|
//#endregion
|
|
46
|
-
//#region src/crons/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
24
|
+
//#region src/crons/runCron.d.ts
|
|
25
|
+
/**
|
|
26
|
+
* Run a cron once, in this process: what an EventBridge rule's invocation does
|
|
27
|
+
* on Lambda, for a server that schedules its own.
|
|
28
|
+
*
|
|
29
|
+
* The same steps as the Lambda adaptor — its services, its worker's database
|
|
30
|
+
* as `db`, an auditor when it declared one, its output parsed, its events
|
|
31
|
+
* published — because a cron that ran differently on a server than deployed
|
|
32
|
+
* would pass locally and fail where it matters. Services come through the
|
|
33
|
+
* discovery, which keeps one instance of each, so running every minute does not
|
|
34
|
+
* reconnect a database every minute.
|
|
35
|
+
*
|
|
36
|
+
* Each run is a trace of its own: a root span, `cron <name>`, whatever was
|
|
37
|
+
* active when the timer or the broker fired it.
|
|
38
|
+
*/
|
|
39
|
+
export declare function runCron(cron: Cron<any, any, any, any, any, any>, serviceDiscovery: ServiceDiscovery<any>,
|
|
40
|
+
/** The cron's export name, for its span. */
|
|
41
|
+
name?: string): Promise<unknown>;
|
|
50
42
|
//#endregion
|
|
51
|
-
|
|
43
|
+
//#region src/crons/schedule.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* A schedule a cron runner can take, as standard five-field cron.
|
|
46
|
+
*
|
|
47
|
+
* `ScheduleExpression` has two spellings. `cron(m h dom mon dow)` is already
|
|
48
|
+
* five-field cron and unwraps; `rate(n unit)` is an interval, and an interval
|
|
49
|
+
* is not a schedule — it says how often, where cron says when.
|
|
50
|
+
*
|
|
51
|
+
* Most intervals still have an exact cron equivalent, because they divide their
|
|
52
|
+
* unit evenly: `rate(5 minutes)` is every fifth minute of every hour, and that
|
|
53
|
+
* is `*/5 * * * *` precisely. `rate(7 hours)` has none. There is no cron field
|
|
54
|
+
* that means "every seven hours" — `*/7` in the hour field fires at 0, 7, 14
|
|
55
|
+
* and 21 and then starts over at midnight, so the gap between the last firing
|
|
56
|
+
* of one day and the first of the next is three hours rather than seven.
|
|
57
|
+
*
|
|
58
|
+
* Those are refused rather than rounded. A job that runs at the wrong hour is
|
|
59
|
+
* far harder to notice than one that refused to build, and a schedule quietly
|
|
60
|
+
* adjusted by the framework is a bug nobody goes looking for.
|
|
61
|
+
*/
|
|
62
|
+
export declare class UnrepresentableSchedule extends Error {
|
|
63
|
+
readonly schedule: string;
|
|
64
|
+
constructor(schedule: string, reason: string);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Standard five-field cron for a schedule expression.
|
|
68
|
+
*
|
|
69
|
+
* @throws {UnrepresentableSchedule} when a `rate(…)` has no exact equivalent.
|
|
70
|
+
*/
|
|
71
|
+
export declare function toCronExpression(schedule: ScheduleExpression): string;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { Cron, CronBuilder, type CronExpression, type InProcessSchedule, type RateExpression, type ScheduleExpression };
|
|
52
74
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/crons/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/crons/inProcess.ts","../../src/crons/runCron.ts","../../src/crons/schedule.ts"],"mappings":";;;;;UASiB;EAChB;;;;;;;;;;;;;;;wBAgBe,kBACf,oBACA,YAAY,6BACV;;;;;;;;;;;;;;;;;wBCAmB,QACrB,MAAM,oCACN,kBAAkB,uBAElB;;AAAA,gBACE;;;;;;;;;;;;;;;;;;;;;qBCdU,gCAAgC;WAElC;EADV,YACU,kBACT;;;;;;;wBAuBc,iBAAiB,UAAU"}
|
package/dist/crons/index.d.mts
CHANGED
|
@@ -1,52 +1,74 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import * as _geekmidas_logger2 from "@geekmidas/logger";
|
|
9
|
-
import { Logger } from "@geekmidas/logger";
|
|
10
|
-
import * as _geekmidas_schema0 from "@geekmidas/schema";
|
|
11
|
-
import { ComposableStandardSchema } from "@geekmidas/schema";
|
|
12
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
13
|
-
|
|
14
|
-
//#region src/crons/CronBuilder.d.ts
|
|
15
|
-
declare class CronBuilder<TInput extends ComposableStandardSchema, TServices extends Service[], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string, TDatabase = undefined, TDatabaseServiceName extends string = string> extends FunctionBuilder<TInput, OutSchema, TServices, TLogger, TEventPublisher, TEventPublisherServiceName, undefined, string, TDatabase, TDatabaseServiceName> {
|
|
16
|
-
private _schedule?;
|
|
17
|
-
constructor();
|
|
18
|
-
memorySize(memorySize: number): this;
|
|
19
|
-
schedule(_expression: ScheduleExpression): CronBuilder<TInput, TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
20
|
-
input<T extends ComposableStandardSchema>(schema: T): CronBuilder<T, TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
21
|
-
output<T extends StandardSchemaV1>(schema: T): CronBuilder<TInput, TServices, TLogger, T, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
22
|
-
/**
|
|
23
|
-
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
24
|
-
* topic.
|
|
25
|
-
*
|
|
26
|
-
* It records the edge and dissolves each construct's client into the
|
|
27
|
-
* handler's service record under the construct's own id, so
|
|
28
|
-
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
29
|
-
*
|
|
30
|
-
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
31
|
-
* env sniffing confined to `.services()` and the explicit lift.
|
|
32
|
-
*/
|
|
33
|
-
dependsOn<const T extends readonly Consumable[]>(constructs: T): CronBuilder<TInput, [...TServices, ...ServicesOf<T>], TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
34
|
-
services<T extends Service[]>(services: T): CronBuilder<TInput, [...TServices, ...T], TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
35
|
-
logger<T extends Logger>(logger: T): CronBuilder<TInput, TServices, T, OutSchema, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
36
|
-
publisher<T extends EventPublisher<any>, TName extends string>(publisher: Service<TName, T>): CronBuilder<TInput, TServices, TLogger, OutSchema, T, TName, TDatabase, TDatabaseServiceName>;
|
|
37
|
-
/**
|
|
38
|
-
* Set the database service for this cron job.
|
|
39
|
-
* The database will be available in the handler context as `db`.
|
|
40
|
-
*/
|
|
41
|
-
database<T, TName extends string>(source: Consumable<TName, T> | Service<TName, T>): CronBuilder<TInput, TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, T, TName>;
|
|
42
|
-
handle(fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>): Cron<TInput, TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TDatabase, TDatabaseServiceName>;
|
|
1
|
+
import { i as ScheduleExpression, n as CronExpression, r as RateExpression, t as Cron } from "../Cron-uYAHPnp7.mjs";
|
|
2
|
+
import { t as CronBuilder } from "../CronBuilder-DaSUm2Na.mjs";
|
|
3
|
+
import { ServiceDiscovery } from "@geekmidas/services";
|
|
4
|
+
//#region src/crons/inProcess.d.ts
|
|
5
|
+
/** A schedule that is running, and the way to stop it. */
|
|
6
|
+
interface InProcessSchedule {
|
|
7
|
+
stop(): void;
|
|
43
8
|
}
|
|
44
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Run `fire` on a cron expression, in this process, by timer.
|
|
11
|
+
*
|
|
12
|
+
* For the one process that has no broker to keep a schedule: `gkm dev` on a
|
|
13
|
+
* target whose crons are infrastructure once deployed — an EventBridge rule on
|
|
14
|
+
* AWS. Deployed, a timer is the wrong tool: each replica would fire every job
|
|
15
|
+
* once, and nothing would say so. That is why a server schedules through
|
|
16
|
+
* pg-boss, and why this is never what a deployed process does.
|
|
17
|
+
*
|
|
18
|
+
* In UTC, as the deployed schedule is. The next firing is worked out from the
|
|
19
|
+
* clock after each run rather than read off a sequence, so a run that outlasts
|
|
20
|
+
* its interval skips what it overran instead of firing them back to back.
|
|
21
|
+
*/
|
|
22
|
+
export declare function scheduleInProcess(expression: string, fire: () => Promise<unknown> | unknown): InProcessSchedule;
|
|
45
23
|
//#endregion
|
|
46
|
-
//#region src/crons/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
24
|
+
//#region src/crons/runCron.d.ts
|
|
25
|
+
/**
|
|
26
|
+
* Run a cron once, in this process: what an EventBridge rule's invocation does
|
|
27
|
+
* on Lambda, for a server that schedules its own.
|
|
28
|
+
*
|
|
29
|
+
* The same steps as the Lambda adaptor — its services, its worker's database
|
|
30
|
+
* as `db`, an auditor when it declared one, its output parsed, its events
|
|
31
|
+
* published — because a cron that ran differently on a server than deployed
|
|
32
|
+
* would pass locally and fail where it matters. Services come through the
|
|
33
|
+
* discovery, which keeps one instance of each, so running every minute does not
|
|
34
|
+
* reconnect a database every minute.
|
|
35
|
+
*
|
|
36
|
+
* Each run is a trace of its own: a root span, `cron <name>`, whatever was
|
|
37
|
+
* active when the timer or the broker fired it.
|
|
38
|
+
*/
|
|
39
|
+
export declare function runCron(cron: Cron<any, any, any, any, any, any>, serviceDiscovery: ServiceDiscovery<any>,
|
|
40
|
+
/** The cron's export name, for its span. */
|
|
41
|
+
name?: string): Promise<unknown>;
|
|
50
42
|
//#endregion
|
|
51
|
-
|
|
43
|
+
//#region src/crons/schedule.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* A schedule a cron runner can take, as standard five-field cron.
|
|
46
|
+
*
|
|
47
|
+
* `ScheduleExpression` has two spellings. `cron(m h dom mon dow)` is already
|
|
48
|
+
* five-field cron and unwraps; `rate(n unit)` is an interval, and an interval
|
|
49
|
+
* is not a schedule — it says how often, where cron says when.
|
|
50
|
+
*
|
|
51
|
+
* Most intervals still have an exact cron equivalent, because they divide their
|
|
52
|
+
* unit evenly: `rate(5 minutes)` is every fifth minute of every hour, and that
|
|
53
|
+
* is `*/5 * * * *` precisely. `rate(7 hours)` has none. There is no cron field
|
|
54
|
+
* that means "every seven hours" — `*/7` in the hour field fires at 0, 7, 14
|
|
55
|
+
* and 21 and then starts over at midnight, so the gap between the last firing
|
|
56
|
+
* of one day and the first of the next is three hours rather than seven.
|
|
57
|
+
*
|
|
58
|
+
* Those are refused rather than rounded. A job that runs at the wrong hour is
|
|
59
|
+
* far harder to notice than one that refused to build, and a schedule quietly
|
|
60
|
+
* adjusted by the framework is a bug nobody goes looking for.
|
|
61
|
+
*/
|
|
62
|
+
export declare class UnrepresentableSchedule extends Error {
|
|
63
|
+
readonly schedule: string;
|
|
64
|
+
constructor(schedule: string, reason: string);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Standard five-field cron for a schedule expression.
|
|
68
|
+
*
|
|
69
|
+
* @throws {UnrepresentableSchedule} when a `rate(…)` has no exact equivalent.
|
|
70
|
+
*/
|
|
71
|
+
export declare function toCronExpression(schedule: ScheduleExpression): string;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { Cron, CronBuilder, type CronExpression, type InProcessSchedule, type RateExpression, type ScheduleExpression };
|
|
52
74
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/crons/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/crons/inProcess.ts","../../src/crons/runCron.ts","../../src/crons/schedule.ts"],"mappings":";;;;;UASiB;EAChB;;;;;;;;;;;;;;;wBAgBe,kBACf,oBACA,YAAY,6BACV;;;;;;;;;;;;;;;;;wBCAmB,QACrB,MAAM,oCACN,kBAAkB,uBAElB;;AAAA,gBACE;;;;;;;;;;;;;;;;;;;;;qBCdU,gCAAgC;WAElC;EADV,YACU,kBACT;;;;;;;wBAuBc,iBAAiB,UAAU"}
|
package/dist/crons/index.mjs
CHANGED
|
@@ -1,89 +1,191 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { a as publishEvents } from "../functions-BFizikJU.mjs";
|
|
2
|
+
import { n as Cron, t as CronBuilder } from "../CronBuilder-Dmix_Pen.mjs";
|
|
3
|
+
import { ROOT_CONTEXT, SpanKind, SpanStatusCode, context, trace } from "@opentelemetry/api";
|
|
4
|
+
import { runWithRequestContext } from "@geekmidas/services";
|
|
5
|
+
import { CronExpressionParser } from "cron-parser";
|
|
6
|
+
//#region src/crons/inProcess.ts
|
|
7
|
+
/**
|
|
8
|
+
* The longest delay a timer takes. Node clamps anything longer to 1ms, so a
|
|
9
|
+
* monthly cron would fire at once and then every millisecond.
|
|
10
|
+
*/
|
|
11
|
+
const MAX_DELAY = 2 ** 31 - 1;
|
|
12
|
+
/**
|
|
13
|
+
* Run `fire` on a cron expression, in this process, by timer.
|
|
14
|
+
*
|
|
15
|
+
* For the one process that has no broker to keep a schedule: `gkm dev` on a
|
|
16
|
+
* target whose crons are infrastructure once deployed — an EventBridge rule on
|
|
17
|
+
* AWS. Deployed, a timer is the wrong tool: each replica would fire every job
|
|
18
|
+
* once, and nothing would say so. That is why a server schedules through
|
|
19
|
+
* pg-boss, and why this is never what a deployed process does.
|
|
20
|
+
*
|
|
21
|
+
* In UTC, as the deployed schedule is. The next firing is worked out from the
|
|
22
|
+
* clock after each run rather than read off a sequence, so a run that outlasts
|
|
23
|
+
* its interval skips what it overran instead of firing them back to back.
|
|
24
|
+
*/
|
|
25
|
+
function scheduleInProcess(expression, fire) {
|
|
26
|
+
CronExpressionParser.parse(expression, { tz: "UTC" });
|
|
27
|
+
let timer;
|
|
28
|
+
let stopped = false;
|
|
29
|
+
const arm = (at) => {
|
|
30
|
+
if (stopped) return;
|
|
31
|
+
const delay = at - Date.now();
|
|
32
|
+
timer = setTimeout(async () => {
|
|
33
|
+
if (Date.now() < at) return arm(at);
|
|
34
|
+
await fire();
|
|
35
|
+
arm(nextAfter(expression, /* @__PURE__ */ new Date()));
|
|
36
|
+
}, Math.min(Math.max(delay, 0), MAX_DELAY));
|
|
37
|
+
timer.unref?.();
|
|
38
|
+
};
|
|
39
|
+
arm(nextAfter(expression, /* @__PURE__ */ new Date()));
|
|
40
|
+
return { stop() {
|
|
41
|
+
stopped = true;
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
} };
|
|
44
|
+
}
|
|
45
|
+
function nextAfter(expression, from) {
|
|
46
|
+
return CronExpressionParser.parse(expression, {
|
|
47
|
+
tz: "UTC",
|
|
48
|
+
currentDate: from
|
|
49
|
+
}).next().getTime();
|
|
50
|
+
}
|
|
22
51
|
//#endregion
|
|
23
|
-
//#region src/crons/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
//#region src/crons/runCron.ts
|
|
53
|
+
/**
|
|
54
|
+
* Run a cron once, in this process: what an EventBridge rule's invocation does
|
|
55
|
+
* on Lambda, for a server that schedules its own.
|
|
56
|
+
*
|
|
57
|
+
* The same steps as the Lambda adaptor — its services, its worker's database
|
|
58
|
+
* as `db`, an auditor when it declared one, its output parsed, its events
|
|
59
|
+
* published — because a cron that ran differently on a server than deployed
|
|
60
|
+
* would pass locally and fail where it matters. Services come through the
|
|
61
|
+
* discovery, which keeps one instance of each, so running every minute does not
|
|
62
|
+
* reconnect a database every minute.
|
|
63
|
+
*
|
|
64
|
+
* Each run is a trace of its own: a root span, `cron <name>`, whatever was
|
|
65
|
+
* active when the timer or the broker fired it.
|
|
66
|
+
*/
|
|
67
|
+
async function runCron(cron, serviceDiscovery, name) {
|
|
68
|
+
const span = trace.getTracer("@geekmidas/constructs").startSpan(`cron ${name ?? cron.schedule ?? "manual"}`, {
|
|
69
|
+
kind: SpanKind.INTERNAL,
|
|
70
|
+
attributes: {
|
|
71
|
+
...name && { "gkm.cron.name": name },
|
|
72
|
+
...cron.schedule && { "gkm.cron.schedule": cron.schedule }
|
|
73
|
+
}
|
|
74
|
+
}, ROOT_CONTEXT);
|
|
75
|
+
return context.with(trace.setSpan(ROOT_CONTEXT, span), async () => {
|
|
76
|
+
try {
|
|
77
|
+
return await run(cron, serviceDiscovery);
|
|
78
|
+
} catch (error) {
|
|
79
|
+
if (error instanceof Error) span.recordException(error);
|
|
80
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
81
|
+
throw error;
|
|
82
|
+
} finally {
|
|
83
|
+
span.end();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async function run(cron, serviceDiscovery) {
|
|
88
|
+
const services = cron.services.length > 0 ? await serviceDiscovery.register(cron.services) : {};
|
|
89
|
+
const db = cron.databaseService ? (await serviceDiscovery.register([cron.databaseService]))[cron.databaseService.serviceName] : void 0;
|
|
90
|
+
let auditor;
|
|
91
|
+
if (cron.auditorStorageService) {
|
|
92
|
+
const { DefaultAuditor } = await import("@geekmidas/audit");
|
|
93
|
+
const storage = (await serviceDiscovery.register([cron.auditorStorageService]))[cron.auditorStorageService.serviceName];
|
|
94
|
+
auditor = new DefaultAuditor({
|
|
95
|
+
actor: {
|
|
96
|
+
id: "system",
|
|
97
|
+
type: "system"
|
|
98
|
+
},
|
|
99
|
+
storage,
|
|
100
|
+
metadata: { function: cron.type }
|
|
58
101
|
});
|
|
59
102
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
103
|
+
const logger = cron.logger;
|
|
104
|
+
const requestId = `cron-${Date.now()}`;
|
|
105
|
+
return runWithRequestContext({
|
|
106
|
+
logger,
|
|
107
|
+
requestId,
|
|
108
|
+
startTime: Date.now(),
|
|
109
|
+
operation: `cron ${cron.schedule ?? "manual"}`
|
|
110
|
+
}, async () => {
|
|
111
|
+
const response = await cron.fn({
|
|
112
|
+
input: void 0,
|
|
113
|
+
services,
|
|
114
|
+
logger,
|
|
115
|
+
db,
|
|
116
|
+
auditor
|
|
117
|
+
});
|
|
118
|
+
const output = await cron.parseOutput(response);
|
|
119
|
+
await auditor?.flush();
|
|
120
|
+
await publishEvents(logger, serviceDiscovery, cron.events, output);
|
|
121
|
+
return output;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/crons/schedule.ts
|
|
126
|
+
/**
|
|
127
|
+
* A schedule a cron runner can take, as standard five-field cron.
|
|
128
|
+
*
|
|
129
|
+
* `ScheduleExpression` has two spellings. `cron(m h dom mon dow)` is already
|
|
130
|
+
* five-field cron and unwraps; `rate(n unit)` is an interval, and an interval
|
|
131
|
+
* is not a schedule — it says how often, where cron says when.
|
|
132
|
+
*
|
|
133
|
+
* Most intervals still have an exact cron equivalent, because they divide their
|
|
134
|
+
* unit evenly: `rate(5 minutes)` is every fifth minute of every hour, and that
|
|
135
|
+
* is `*/5 * * * *` precisely. `rate(7 hours)` has none. There is no cron field
|
|
136
|
+
* that means "every seven hours" — `*/7` in the hour field fires at 0, 7, 14
|
|
137
|
+
* and 21 and then starts over at midnight, so the gap between the last firing
|
|
138
|
+
* of one day and the first of the next is three hours rather than seven.
|
|
139
|
+
*
|
|
140
|
+
* Those are refused rather than rounded. A job that runs at the wrong hour is
|
|
141
|
+
* far harder to notice than one that refused to build, and a schedule quietly
|
|
142
|
+
* adjusted by the framework is a bug nobody goes looking for.
|
|
143
|
+
*/
|
|
144
|
+
var UnrepresentableSchedule = class extends Error {
|
|
145
|
+
schedule;
|
|
146
|
+
constructor(schedule, reason) {
|
|
147
|
+
super(`\`${schedule}\` has no exact cron equivalent: ${reason}.\n\nCron says *when*, not *how often*, so an interval is only exact when it divides its unit evenly.
|
|
148
|
+
Write the schedule you mean instead — \`cron(0 */6 * * *)\` for every sixth hour, say — or pick an interval that divides: minutes into 60, hours into 24.`);
|
|
149
|
+
this.schedule = schedule;
|
|
150
|
+
this.name = "UnrepresentableSchedule";
|
|
80
151
|
}
|
|
81
152
|
};
|
|
82
|
-
|
|
153
|
+
/** Units `rate(…)` accepts, singular or plural. */
|
|
154
|
+
const UNITS = [
|
|
155
|
+
"minute",
|
|
156
|
+
"hour",
|
|
157
|
+
"day"
|
|
158
|
+
];
|
|
159
|
+
/**
|
|
160
|
+
* Standard five-field cron for a schedule expression.
|
|
161
|
+
*
|
|
162
|
+
* @throws {UnrepresentableSchedule} when a `rate(…)` has no exact equivalent.
|
|
163
|
+
*/
|
|
164
|
+
function toCronExpression(schedule) {
|
|
165
|
+
const cron = /^cron\((.+)\)$/.exec(schedule);
|
|
166
|
+
if (cron?.[1]) return cron[1].trim();
|
|
167
|
+
const rate = /^rate\(\s*(\d+)\s+(\w+?)s?\s*\)$/.exec(schedule);
|
|
168
|
+
if (!rate) throw new UnrepresentableSchedule(schedule, "it is neither `cron(…)` nor `rate(n unit)`");
|
|
169
|
+
const every = Number(rate[1]);
|
|
170
|
+
const unit = rate[2];
|
|
171
|
+
/* c8 ignore next */ if (!unit) throw new UnrepresentableSchedule(schedule, "no unit");
|
|
172
|
+
if (!UNITS.includes(unit)) throw new UnrepresentableSchedule(schedule, `\`${unit}\` is not one of ${UNITS.join(", ")}`);
|
|
173
|
+
if (every < 1) throw new UnrepresentableSchedule(schedule, "an interval must be at least 1");
|
|
174
|
+
switch (unit) {
|
|
175
|
+
case "minute":
|
|
176
|
+
if (every === 1) return "* * * * *";
|
|
177
|
+
if (60 % every !== 0) throw new UnrepresentableSchedule(schedule, `${every} does not divide 60, so the interval would reset at the top of each hour`);
|
|
178
|
+
return `*/${every} * * * *`;
|
|
179
|
+
case "hour":
|
|
180
|
+
if (every === 1) return "0 * * * *";
|
|
181
|
+
if (24 % every !== 0) throw new UnrepresentableSchedule(schedule, `${every} does not divide 24, so the interval would reset at midnight`);
|
|
182
|
+
return `0 */${every} * * *`;
|
|
183
|
+
case "day":
|
|
184
|
+
if (every === 1) return "0 0 * * *";
|
|
185
|
+
throw new UnrepresentableSchedule(schedule, "day-of-month restarts every month, so no multi-day interval is even");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
83
188
|
//#endregion
|
|
84
|
-
|
|
85
|
-
const c = new CronBuilder();
|
|
189
|
+
export { Cron, CronBuilder, UnrepresentableSchedule, runCron, scheduleInProcess, toCronExpression };
|
|
86
190
|
|
|
87
|
-
//#endregion
|
|
88
|
-
export { AWSScheduledFunction, Cron, CronBuilder, c };
|
|
89
191
|
//# sourceMappingURL=index.mjs.map
|
package/dist/crons/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["obj: any","fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>","timeout?: number","_schedule?: ScheduleExpression","input?: TInput","outputSchema?: OutSchema","services: TServices","logger?: TLogger","publisherService?: Service<TEventPublisherServiceName, TEventPublisher>","events: any[]","memorySize?: number","databaseService?: Service<TDatabaseServiceName, TDatabase>","constructs: string[]","memorySize: number","_expression: ScheduleExpression","schema: T","constructs: T","s: Service","services: T","logger: T","publisher: Service<TName, T>","source: Consumable<TName, T> | Service<TName, T>","fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>"],"sources":["../../src/crons/Cron.ts","../../src/crons/CronBuilder.ts","../../src/crons/index.ts"],"sourcesContent":["import type { AuditableAction } from '@geekmidas/audit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { ComposableStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\n\nimport { ConstructType } from '../Construct';\nimport { Function, type FunctionHandler } from '../functions';\n\nexport class Cron<\n\tTInput extends ComposableStandardSchema | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\tTEventPublisherServiceName extends string = string,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends Function<\n\tTInput,\n\tTServices,\n\tTLogger,\n\tOutSchema,\n\tTEventPublisher,\n\tTEventPublisherServiceName,\n\tundefined,\n\tstring,\n\tTDatabase,\n\tTDatabaseServiceName,\n\tAuditableAction<string, unknown>,\n\tFunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>\n> {\n\tstatic isCron(obj: any): obj is Cron<any, any, any, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as Function).__IS_FUNCTION__ === true &&\n\t\t\t\tobj.type === ConstructType.Cron,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tfn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>,\n\t\ttimeout?: number,\n\t\tprotected _schedule?: ScheduleExpression,\n\t\tinput?: TInput,\n\t\toutputSchema?: OutSchema,\n\t\tservices: TServices = [] as unknown as TServices,\n\t\tlogger?: TLogger,\n\t\tpublisherService?: Service<TEventPublisherServiceName, TEventPublisher>,\n\t\tevents: any[] = [],\n\t\tmemorySize?: number,\n\t\tdatabaseService?: Service<TDatabaseServiceName, TDatabase>,\n\t\t/**\n\t\t * The construct ids `.dependsOn()` named — last, so no existing positional\n\t\t * argument moves.\n\t\t */\n\t\tconstructs: string[] = [],\n\t) {\n\t\tsuper(\n\t\t\tfn,\n\t\t\ttimeout,\n\t\t\tConstructType.Cron,\n\t\t\tinput,\n\t\t\toutputSchema,\n\t\t\tservices,\n\t\t\tlogger,\n\t\t\tpublisherService,\n\t\t\tevents,\n\t\t\tmemorySize,\n\t\t\tundefined, // auditorStorageService\n\t\t\tdatabaseService,\n\t\t\tconstructs,\n\t\t);\n\t}\n\n\tget schedule(): ScheduleExpression | undefined {\n\t\treturn this._schedule;\n\t}\n}\n\nexport type RateExpression = `rate(${string})`;\n\ntype CronMinute =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronHour =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronDay =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| `${number},${number}`\n\t| string; // Allow more complex patterns\n\ntype CronMonth =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| 'JAN'\n\t| 'FEB'\n\t| 'MAR'\n\t| 'APR'\n\t| 'MAY'\n\t| 'JUN'\n\t| 'JUL'\n\t| 'AUG'\n\t| 'SEP'\n\t| 'OCT'\n\t| 'NOV'\n\t| 'DEC'\n\t| string; // Allow more complex patterns\n\ntype CronWeekday =\n\t| '*'\n\t| number\n\t| `${number}`\n\t| `${number}-${number}`\n\t| `${number}/${number}`\n\t| `*/${number}`\n\t| 'SUN'\n\t| 'MON'\n\t| 'TUE'\n\t| 'WED'\n\t| 'THU'\n\t| 'FRI'\n\t| 'SAT'\n\t| `${string}-${string}` // Allow patterns like MON-FRI\n\t| string; // Allow more complex patterns\n\nexport type CronExpression =\n\t`cron(${CronMinute} ${CronHour} ${CronDay} ${CronMonth} ${CronWeekday})`;\n\nexport type ScheduleExpression = RateExpression | CronExpression;\n","import type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { ComposableStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport uniqBy from 'lodash.uniqby';\nimport { ConstructType } from '../Construct';\nimport { cloneWith } from '../clone';\nimport {\n\ttype Consumable,\n\tidsOf,\n\ttype ServicesOf,\n\tserviceOf,\n\tservicesOf,\n} from '../construct-interface';\nimport { FunctionBuilder, type FunctionHandler } from '../functions';\nimport { Cron, type ScheduleExpression } from './Cron';\n\nexport class CronBuilder<\n\tTInput extends ComposableStandardSchema,\n\tTServices extends Service[],\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\tTEventPublisherServiceName extends string = string,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends FunctionBuilder<\n\tTInput,\n\tOutSchema,\n\tTServices,\n\tTLogger,\n\tTEventPublisher,\n\tTEventPublisherServiceName,\n\tundefined,\n\tstring,\n\tTDatabase,\n\tTDatabaseServiceName\n> {\n\tprivate _schedule?: ScheduleExpression;\n\n\tconstructor() {\n\t\tsuper(ConstructType.Cron);\n\t}\n\n\toverride memorySize(memorySize: number): this {\n\t\treturn cloneWith(this, { _memorySize: memorySize });\n\t}\n\n\tschedule(\n\t\t_expression: ScheduleExpression,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTEventPublisher,\n\t\tTEventPublisherServiceName,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, { _schedule: _expression });\n\t}\n\n\toverride input<T extends ComposableStandardSchema>(\n\t\tschema: T,\n\t): CronBuilder<\n\t\tT,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTEventPublisher,\n\t\tTEventPublisherServiceName,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\tinputSchema: schema as unknown as TInput,\n\t\t}) as unknown as CronBuilder<\n\t\t\tT,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride output<T extends StandardSchemaV1>(\n\t\tschema: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tT,\n\t\tTEventPublisher,\n\t\tTEventPublisherServiceName,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\toutputSchema: schema as unknown as OutSchema,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tT,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Depend on constructs — a database, a bucket, a mail sender, a queue, a\n\t * topic.\n\t *\n\t * It records the edge and dissolves each construct's client into the\n\t * handler's service record under the construct's own id, so\n\t * `.dependsOn([uploads])` is what makes `services.uploads` exist and type.\n\t *\n\t * Constructs only. A `Service` does not match the shape, which is what keeps\n\t * env sniffing confined to `.services()` and the explicit lift.\n\t */\n\toverride dependsOn<const T extends readonly Consumable[]>(\n\t\tconstructs: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, ...ServicesOf<T>],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTEventPublisher,\n\t\tTEventPublisherServiceName,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\t// Both halves of the edge, from one call and one clone: the services the\n\t\t// handler runs with, and the ids the manifest records. Recording them\n\t\t// separately is what let them drift apart.\n\t\t//\n\t\t// `servicesOf` is the half that validates, so it runs first — recording\n\t\t// ids ahead of it left a caught `NotAConstruct` with `undefined` already\n\t\t// on a `string[]`.\n\t\tconst services = servicesOf(constructs) as unknown as Service[];\n\n\t\treturn cloneWith(this, {\n\t\t\t_services: uniqBy(\n\t\t\t\t[...this._services, ...services],\n\t\t\t\t(s: Service) => s.serviceName,\n\t\t\t),\n\t\t\t_constructs: idsOf(constructs, this._constructs),\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, ...ServicesOf<T>],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride services<T extends Service[]>(\n\t\tservices: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\t[...TServices, ...T],\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTEventPublisher,\n\t\tTEventPublisherServiceName,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\t_services: uniqBy(\n\t\t\t\t[...this._services, ...services],\n\t\t\t\t(s) => s.serviceName,\n\t\t\t) as TServices,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\t[...TServices, ...T],\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride logger<T extends Logger>(\n\t\tlogger: T,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tT,\n\t\tOutSchema,\n\t\tTEventPublisher,\n\t\tTEventPublisherServiceName,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\t_logger: logger as unknown as TLogger,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tT,\n\t\t\tOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\toverride publisher<T extends EventPublisher<any>, TName extends string>(\n\t\tpublisher: Service<TName, T>,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tT,\n\t\tTName,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\treturn cloneWith(this, {\n\t\t\t_publisher: publisher as unknown as Service<\n\t\t\t\tTEventPublisherServiceName,\n\t\t\t\tTEventPublisher\n\t\t\t>,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tT,\n\t\t\tTName,\n\t\t\tTDatabase,\n\t\t\tTDatabaseServiceName\n\t\t>;\n\t}\n\n\t/**\n\t * Set the database service for this cron job.\n\t * The database will be available in the handler context as `db`.\n\t */\n\toverride database<T, TName extends string>(\n\t\tsource: Consumable<TName, T> | Service<TName, T>,\n\t): CronBuilder<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTEventPublisher,\n\t\tTEventPublisherServiceName,\n\t\tT,\n\t\tTName\n\t> {\n\t\tconst service = serviceOf(source);\n\n\t\treturn cloneWith(this, {\n\t\t\t_databaseService: service as unknown as Service<\n\t\t\t\tTDatabaseServiceName,\n\t\t\t\tTDatabase\n\t\t\t>,\n\t\t}) as unknown as CronBuilder<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tOutSchema,\n\t\t\tTEventPublisher,\n\t\t\tTEventPublisherServiceName,\n\t\t\tT,\n\t\t\tTName\n\t\t>;\n\t}\n\n\toverride handle(\n\t\tfn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>,\n\t): Cron<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTEventPublisher,\n\t\tTEventPublisherServiceName,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t> {\n\t\tconst cron = new Cron(\n\t\t\tfn,\n\t\t\tthis._timeout,\n\t\t\tthis._schedule,\n\t\t\tthis.inputSchema,\n\t\t\tthis.outputSchema,\n\t\t\tthis._services,\n\t\t\tthis._logger,\n\t\t\tthis._publisher,\n\t\t\tthis._events,\n\t\t\tthis._memorySize,\n\t\t\tthis._databaseService,\n\t\t\tthis._constructs,\n\t\t);\n\n\t\t// No reset. `.handle()` reads this builder and leaves it alone, so a\n\t\t// configured base — `const fn = f.logger(log).timeout(60_000)` — keeps\n\t\t// its configuration for every construct built from it. The reset that\n\t\t// used to be here wiped the base on first use, which made a base usable\n\t\t// exactly once, and quietly reverted the logger to the default.\n\n\t\treturn cron;\n\t}\n}\n","export { AWSScheduledFunction } from './AWSScheduledFunction';\nexport {\n\tCron,\n\ttype CronExpression,\n\ttype RateExpression,\n\ttype ScheduleExpression,\n} from './Cron';\nexport { CronBuilder } from './CronBuilder';\n\nimport { CronBuilder } from './CronBuilder';\n\nexport const c = new CronBuilder();\n"],"mappings":";;;;;;;;AAUA,IAAa,OAAb,cASU,SAaR;CACD,OAAO,OAAOA,KAA2C;AACxD,SAAO,QACN,OACE,IAAiB,oBAAoB,QACtC,IAAI,SAAS,cAAc,KAC5B;CACD;CAED,YACCC,IACAC,SACUC,WACVC,OACAC,cACAC,WAAsB,CAAE,GACxBC,QACAC,kBACAC,SAAgB,CAAE,GAClBC,YACAC,iBAKAC,aAAuB,CAAE,GACxB;AACD,QACC,IACA,SACA,cAAc,MACd,OACA,cACA,UACA,QACA,kBACA,QACA,oBAEA,iBACA,WACA;EA7BS;CA8BV;CAED,IAAI,WAA2C;AAC9C,SAAO,KAAK;CACZ;AACD;;;;;AC7DD,IAAa,cAAb,cASU,gBAWR;CACD,AAAQ;CAER,cAAc;AACb,QAAM,cAAc,KAAK;CACzB;CAED,AAAS,WAAWC,YAA0B;AAC7C,SAAO,UAAU,MAAM,EAAE,aAAa,WAAY,EAAC;CACnD;CAED,SACCC,aAUC;AACD,SAAO,UAAU,MAAM,EAAE,WAAW,YAAa,EAAC;CAClD;CAED,AAAS,MACRC,QAUC;AACD,SAAO,UAAU,MAAM,EACtB,aAAa,OACb,EAAC;CAUF;CAED,AAAS,OACRA,QAUC;AACD,SAAO,UAAU,MAAM,EACtB,cAAc,OACd,EAAC;CAUF;;;;;;;;;;;;CAaD,AAAS,UACRC,YAUC;EAQD,MAAM,WAAW,WAAW,WAAW;AAEvC,SAAO,UAAU,MAAM;GACtB,WAAW,2BACV,CAAC,GAAG,KAAK,WAAW,GAAG,QAAS,GAChC,CAACC,MAAe,EAAE,YAClB;GACD,aAAa,MAAM,YAAY,KAAK,YAAY;EAChD,EAAC;CAUF;CAED,AAAS,SACRC,UAUC;AACD,SAAO,UAAU,MAAM,EACtB,WAAW,2BACV,CAAC,GAAG,KAAK,WAAW,GAAG,QAAS,GAChC,CAAC,MAAM,EAAE,YACT,CACD,EAAC;CAUF;CAED,AAAS,OACRC,QAUC;AACD,SAAO,UAAU,MAAM,EACtB,SAAS,OACT,EAAC;CAUF;CAED,AAAS,UACRC,WAUC;AACD,SAAO,UAAU,MAAM,EACtB,YAAY,UAIZ,EAAC;CAUF;;;;;CAMD,AAAS,SACRC,QAUC;EACD,MAAM,UAAU,UAAU,OAAO;AAEjC,SAAO,UAAU,MAAM,EACtB,kBAAkB,QAIlB,EAAC;CAUF;CAED,AAAS,OACRC,IAUC;EACD,MAAM,OAAO,IAAI,KAChB,IACA,KAAK,UACL,KAAK,WACL,KAAK,aACL,KAAK,cACL,KAAK,WACL,KAAK,SACL,KAAK,YACL,KAAK,SACL,KAAK,aACL,KAAK,kBACL,KAAK;AASN,SAAO;CACP;AACD;;;;ACrTD,MAAa,IAAI,IAAI"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/crons/inProcess.ts","../../src/crons/runCron.ts","../../src/crons/schedule.ts"],"sourcesContent":["import { CronExpressionParser } from 'cron-parser';\n\n/**\n * The longest delay a timer takes. Node clamps anything longer to 1ms, so a\n * monthly cron would fire at once and then every millisecond.\n */\nconst MAX_DELAY = 2 ** 31 - 1;\n\n/** A schedule that is running, and the way to stop it. */\nexport interface InProcessSchedule {\n\tstop(): void;\n}\n\n/**\n * Run `fire` on a cron expression, in this process, by timer.\n *\n * For the one process that has no broker to keep a schedule: `gkm dev` on a\n * target whose crons are infrastructure once deployed — an EventBridge rule on\n * AWS. Deployed, a timer is the wrong tool: each replica would fire every job\n * once, and nothing would say so. That is why a server schedules through\n * pg-boss, and why this is never what a deployed process does.\n *\n * In UTC, as the deployed schedule is. The next firing is worked out from the\n * clock after each run rather than read off a sequence, so a run that outlasts\n * its interval skips what it overran instead of firing them back to back.\n */\nexport function scheduleInProcess(\n\texpression: string,\n\tfire: () => Promise<unknown> | unknown,\n): InProcessSchedule {\n\t// Parsed once up front, so a bad expression throws here — to the caller\n\t// scheduling it — rather than inside a timer.\n\tCronExpressionParser.parse(expression, { tz: 'UTC' });\n\n\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\tlet stopped = false;\n\n\tconst arm = (at: number) => {\n\t\tif (stopped) return;\n\t\tconst delay = at - Date.now();\n\t\ttimer = setTimeout(\n\t\t\tasync () => {\n\t\t\t\tif (Date.now() < at) return arm(at);\n\t\t\t\tawait fire();\n\t\t\t\tarm(nextAfter(expression, new Date()));\n\t\t\t},\n\t\t\tMath.min(Math.max(delay, 0), MAX_DELAY),\n\t\t);\n\t\t// The server keeps the process alive; a schedule alone should not.\n\t\ttimer.unref?.();\n\t};\n\n\tarm(nextAfter(expression, new Date()));\n\n\treturn {\n\t\tstop() {\n\t\t\tstopped = true;\n\t\t\tclearTimeout(timer);\n\t\t},\n\t};\n}\n\nfunction nextAfter(expression: string, from: Date): number {\n\treturn CronExpressionParser.parse(expression, {\n\t\ttz: 'UTC',\n\t\tcurrentDate: from,\n\t})\n\t\t.next()\n\t\t.getTime();\n}\n","import type { AuditStorage } from '@geekmidas/audit';\nimport {\n\trunWithRequestContext,\n\ttype ServiceDiscovery,\n} from '@geekmidas/services';\nimport {\n\tcontext,\n\tROOT_CONTEXT,\n\tSpanKind,\n\tSpanStatusCode,\n\ttrace,\n} from '@opentelemetry/api';\nimport { publishEvents } from '../publisher';\nimport type { Cron } from './Cron';\n\n/**\n * Run a cron once, in this process: what an EventBridge rule's invocation does\n * on Lambda, for a server that schedules its own.\n *\n * The same steps as the Lambda adaptor — its services, its worker's database\n * as `db`, an auditor when it declared one, its output parsed, its events\n * published — because a cron that ran differently on a server than deployed\n * would pass locally and fail where it matters. Services come through the\n * discovery, which keeps one instance of each, so running every minute does not\n * reconnect a database every minute.\n *\n * Each run is a trace of its own: a root span, `cron <name>`, whatever was\n * active when the timer or the broker fired it.\n */\nexport async function runCron(\n\tcron: Cron<any, any, any, any, any, any>,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\t/** The cron's export name, for its span. */\n\tname?: string,\n): Promise<unknown> {\n\tconst span = trace.getTracer('@geekmidas/constructs').startSpan(\n\t\t`cron ${name ?? cron.schedule ?? 'manual'}`,\n\t\t{\n\t\t\tkind: SpanKind.INTERNAL,\n\t\t\tattributes: {\n\t\t\t\t...(name && { 'gkm.cron.name': name }),\n\t\t\t\t...(cron.schedule && { 'gkm.cron.schedule': cron.schedule }),\n\t\t\t},\n\t\t},\n\t\tROOT_CONTEXT,\n\t);\n\n\treturn context.with(trace.setSpan(ROOT_CONTEXT, span), async () => {\n\t\ttry {\n\t\t\treturn await run(cron, serviceDiscovery);\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error) span.recordException(error);\n\t\t\tspan.setStatus({ code: SpanStatusCode.ERROR });\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tspan.end();\n\t\t}\n\t});\n}\n\nasync function run(\n\tcron: Cron<any, any, any, any, any, any>,\n\tserviceDiscovery: ServiceDiscovery<any>,\n): Promise<unknown> {\n\tconst services =\n\t\tcron.services.length > 0\n\t\t\t? await serviceDiscovery.register(cron.services)\n\t\t\t: {};\n\n\tconst db = cron.databaseService\n\t\t? (await serviceDiscovery.register([cron.databaseService]))[\n\t\t\t\tcron.databaseService.serviceName\n\t\t\t]\n\t\t: undefined;\n\n\t// Only imported for a cron that audits: `@geekmidas/audit` is optional.\n\tlet auditor: { flush(): Promise<void> } | undefined;\n\tif (cron.auditorStorageService) {\n\t\tconst { DefaultAuditor } = await import('@geekmidas/audit');\n\t\tconst registered: Record<string, unknown> = await serviceDiscovery.register(\n\t\t\t[cron.auditorStorageService],\n\t\t);\n\t\tconst storage = registered[\n\t\t\tcron.auditorStorageService.serviceName\n\t\t] as AuditStorage;\n\t\tauditor = new DefaultAuditor({\n\t\t\tactor: { id: 'system', type: 'system' },\n\t\t\tstorage,\n\t\t\tmetadata: { function: cron.type },\n\t\t});\n\t}\n\n\tconst logger = cron.logger;\n\tconst requestId = `cron-${Date.now()}`;\n\n\treturn runWithRequestContext(\n\t\t{\n\t\t\tlogger,\n\t\t\trequestId,\n\t\t\tstartTime: Date.now(),\n\t\t\toperation: `cron ${cron.schedule ?? 'manual'}`,\n\t\t},\n\t\tasync () => {\n\t\t\tconst response = await cron.fn({\n\t\t\t\tinput: undefined,\n\t\t\t\tservices,\n\t\t\t\tlogger,\n\t\t\t\tdb,\n\t\t\t\tauditor,\n\t\t\t} as any);\n\t\t\tconst output = await cron.parseOutput(response);\n\n\t\t\tawait auditor?.flush();\n\t\t\t// The cron's output schema is erased by the `any` it is typed with here.\n\t\t\tawait publishEvents(\n\t\t\t\tlogger,\n\t\t\t\tserviceDiscovery,\n\t\t\t\tcron.events,\n\t\t\t\toutput as never,\n\t\t\t);\n\n\t\t\treturn output;\n\t\t},\n\t);\n}\n","import type { ScheduleExpression } from './Cron';\n\n/**\n * A schedule a cron runner can take, as standard five-field cron.\n *\n * `ScheduleExpression` has two spellings. `cron(m h dom mon dow)` is already\n * five-field cron and unwraps; `rate(n unit)` is an interval, and an interval\n * is not a schedule — it says how often, where cron says when.\n *\n * Most intervals still have an exact cron equivalent, because they divide their\n * unit evenly: `rate(5 minutes)` is every fifth minute of every hour, and that\n * is `*/5 * * * *` precisely. `rate(7 hours)` has none. There is no cron field\n * that means \"every seven hours\" — `*/7` in the hour field fires at 0, 7, 14\n * and 21 and then starts over at midnight, so the gap between the last firing\n * of one day and the first of the next is three hours rather than seven.\n *\n * Those are refused rather than rounded. A job that runs at the wrong hour is\n * far harder to notice than one that refused to build, and a schedule quietly\n * adjusted by the framework is a bug nobody goes looking for.\n */\nexport class UnrepresentableSchedule extends Error {\n\tconstructor(\n\t\treadonly schedule: string,\n\t\treason: string,\n\t) {\n\t\tsuper(\n\t\t\t`\\`${schedule}\\` has no exact cron equivalent: ${reason}.\\n\\n` +\n\t\t\t\t'Cron says *when*, not *how often*, so an interval is only exact when ' +\n\t\t\t\t'it divides its unit evenly.\\n' +\n\t\t\t\t'Write the schedule you mean instead — `cron(0 */6 * * *)` for every ' +\n\t\t\t\t'sixth hour, say — or pick an interval that divides: minutes into 60, ' +\n\t\t\t\t'hours into 24.',\n\t\t);\n\t\tthis.name = 'UnrepresentableSchedule';\n\t}\n}\n\n/** Units `rate(…)` accepts, singular or plural. */\nconst UNITS = ['minute', 'hour', 'day'] as const;\ntype Unit = (typeof UNITS)[number];\n\n/**\n * Standard five-field cron for a schedule expression.\n *\n * @throws {UnrepresentableSchedule} when a `rate(…)` has no exact equivalent.\n */\nexport function toCronExpression(schedule: ScheduleExpression): string {\n\tconst cron = /^cron\\((.+)\\)$/.exec(schedule);\n\tif (cron?.[1]) return cron[1].trim();\n\n\tconst rate = /^rate\\(\\s*(\\d+)\\s+(\\w+?)s?\\s*\\)$/.exec(schedule);\n\tif (!rate) {\n\t\tthrow new UnrepresentableSchedule(\n\t\t\tschedule,\n\t\t\t'it is neither `cron(…)` nor `rate(n unit)`',\n\t\t);\n\t}\n\n\tconst every = Number(rate[1]);\n\tconst unit = rate[2] as Unit;\n\t/* c8 ignore next */ if (!unit)\n\t\tthrow new UnrepresentableSchedule(schedule, 'no unit');\n\n\tif (!UNITS.includes(unit)) {\n\t\tthrow new UnrepresentableSchedule(\n\t\t\tschedule,\n\t\t\t`\\`${unit}\\` is not one of ${UNITS.join(', ')}`,\n\t\t);\n\t}\n\n\tif (every < 1) {\n\t\tthrow new UnrepresentableSchedule(\n\t\t\tschedule,\n\t\t\t'an interval must be at least 1',\n\t\t);\n\t}\n\n\tswitch (unit) {\n\t\tcase 'minute':\n\t\t\tif (every === 1) return '* * * * *';\n\t\t\tif (60 % every !== 0) {\n\t\t\t\tthrow new UnrepresentableSchedule(\n\t\t\t\t\tschedule,\n\t\t\t\t\t`${every} does not divide 60, so the interval would reset at the top of each hour`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn `*/${every} * * * *`;\n\n\t\tcase 'hour':\n\t\t\tif (every === 1) return '0 * * * *';\n\t\t\tif (24 % every !== 0) {\n\t\t\t\tthrow new UnrepresentableSchedule(\n\t\t\t\t\tschedule,\n\t\t\t\t\t`${every} does not divide 24, so the interval would reset at midnight`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn `0 */${every} * * *`;\n\n\t\tcase 'day':\n\t\t\tif (every === 1) return '0 0 * * *';\n\t\t\t// `*/n` in day-of-month restarts on the 1st, so a 2-day interval fires\n\t\t\t// on the 1st and 3rd of a 31-day month and then again on the 1st — one\n\t\t\t// day later, not two. No month length makes that come out even.\n\t\t\tthrow new UnrepresentableSchedule(\n\t\t\t\tschedule,\n\t\t\t\t'day-of-month restarts every month, so no multi-day interval is even',\n\t\t\t);\n\t}\n}\n"],"mappings":";;;;;;;;;;AAMA,MAAM,YAAY,KAAK,KAAK;;;;;;;;;;;;;;AAoB5B,SAAgB,kBACf,YACA,MACoB;CAGpB,qBAAqB,MAAM,YAAY,EAAE,IAAI,MAAM,CAAC;CAEpD,IAAI;CACJ,IAAI,UAAU;CAEd,MAAM,OAAO,OAAe;EAC3B,IAAI,SAAS;EACb,MAAM,QAAQ,KAAK,KAAK,IAAI;EAC5B,QAAQ,WACP,YAAY;GACX,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,IAAI,EAAE;GAClC,MAAM,KAAK;GACX,IAAI,UAAU,4BAAY,IAAI,KAAK,CAAC,CAAC;EACtC,GACA,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,SAAS,CACvC;EAEA,MAAM,QAAQ;CACf;CAEA,IAAI,UAAU,4BAAY,IAAI,KAAK,CAAC,CAAC;CAErC,OAAO,EACN,OAAO;EACN,UAAU;EACV,aAAa,KAAK;CACnB,EACD;AACD;AAEA,SAAS,UAAU,YAAoB,MAAoB;CAC1D,OAAO,qBAAqB,MAAM,YAAY;EAC7C,IAAI;EACJ,aAAa;CACd,CAAC,CAAC,CACA,KAAK,CAAC,CACN,QAAQ;AACX;;;;;;;;;;;;;;;;;ACxCA,eAAsB,QACrB,MACA,kBAEA,MACmB;CACnB,MAAM,OAAO,MAAM,UAAU,uBAAuB,CAAC,CAAC,UACrD,QAAQ,QAAQ,KAAK,YAAY,YACjC;EACC,MAAM,SAAS;EACf,YAAY;GACX,GAAI,QAAQ,EAAE,iBAAiB,KAAK;GACpC,GAAI,KAAK,YAAY,EAAE,qBAAqB,KAAK,SAAS;EAC3D;CACD,GACA,YACD;CAEA,OAAO,QAAQ,KAAK,MAAM,QAAQ,cAAc,IAAI,GAAG,YAAY;EAClE,IAAI;GACH,OAAO,MAAM,IAAI,MAAM,gBAAgB;EACxC,SAAS,OAAO;GACf,IAAI,iBAAiB,OAAO,KAAK,gBAAgB,KAAK;GACtD,KAAK,UAAU,EAAE,MAAM,eAAe,MAAM,CAAC;GAC7C,MAAM;EACP,UAAU;GACT,KAAK,IAAI;EACV;CACD,CAAC;AACF;AAEA,eAAe,IACd,MACA,kBACmB;CACnB,MAAM,WACL,KAAK,SAAS,SAAS,IACpB,MAAM,iBAAiB,SAAS,KAAK,QAAQ,IAC7C,CAAC;CAEL,MAAM,KAAK,KAAK,mBACZ,MAAM,iBAAiB,SAAS,CAAC,KAAK,eAAe,CAAC,EAAA,CACvD,KAAK,gBAAgB,eAErB,KAAA;CAGH,IAAI;CACJ,IAAI,KAAK,uBAAuB;EAC/B,MAAM,EAAE,mBAAmB,MAAM,OAAO;EAIxC,MAAM,WAAU,MAHkC,iBAAiB,SAClE,CAAC,KAAK,qBAAqB,CAC5B,EAAA,CAEC,KAAK,sBAAsB;EAE5B,UAAU,IAAI,eAAe;GAC5B,OAAO;IAAE,IAAI;IAAU,MAAM;GAAS;GACtC;GACA,UAAU,EAAE,UAAU,KAAK,KAAK;EACjC,CAAC;CACF;CAEA,MAAM,SAAS,KAAK;CACpB,MAAM,YAAY,QAAQ,KAAK,IAAI;CAEnC,OAAO,sBACN;EACC;EACA;EACA,WAAW,KAAK,IAAI;EACpB,WAAW,QAAQ,KAAK,YAAY;CACrC,GACA,YAAY;EACX,MAAM,WAAW,MAAM,KAAK,GAAG;GAC9B,OAAO,KAAA;GACP;GACA;GACA;GACA;EACD,CAAQ;EACR,MAAM,SAAS,MAAM,KAAK,YAAY,QAAQ;EAE9C,MAAM,SAAS,MAAM;EAErB,MAAM,cACL,QACA,kBACA,KAAK,QACL,MACD;EAEA,OAAO;CACR,CACD;AACD;;;;;;;;;;;;;;;;;;;;;ACxGA,IAAa,0BAAb,cAA6C,MAAM;CAExC;CADV,YACC,UACA,QACC;EACD,MACC,KAAK,SAAS,mCAAmC,OAAO;0JAMzD;EAVS,KAAA,WAAA;EAWT,KAAK,OAAO;CACb;AACD;;AAGA,MAAM,QAAQ;CAAC;CAAU;CAAQ;AAAK;;;;;;AAQtC,SAAgB,iBAAiB,UAAsC;CACtE,MAAM,OAAO,iBAAiB,KAAK,QAAQ;CAC3C,IAAI,OAAO,IAAI,OAAO,KAAK,EAAE,CAAC,KAAK;CAEnC,MAAM,OAAO,mCAAmC,KAAK,QAAQ;CAC7D,IAAI,CAAC,MACJ,MAAM,IAAI,wBACT,UACA,4CACD;CAGD,MAAM,QAAQ,OAAO,KAAK,EAAE;CAC5B,MAAM,OAAO,KAAK;sBACG,IAAI,CAAC,MACzB,MAAM,IAAI,wBAAwB,UAAU,SAAS;CAEtD,IAAI,CAAC,MAAM,SAAS,IAAI,GACvB,MAAM,IAAI,wBACT,UACA,KAAK,KAAK,mBAAmB,MAAM,KAAK,IAAI,GAC7C;CAGD,IAAI,QAAQ,GACX,MAAM,IAAI,wBACT,UACA,gCACD;CAGD,QAAQ,MAAR;EACC,KAAK;GACJ,IAAI,UAAU,GAAG,OAAO;GACxB,IAAI,KAAK,UAAU,GAClB,MAAM,IAAI,wBACT,UACA,GAAG,MAAM,yEACV;GAED,OAAO,KAAK,MAAM;EAEnB,KAAK;GACJ,IAAI,UAAU,GAAG,OAAO;GACxB,IAAI,KAAK,UAAU,GAClB,MAAM,IAAI,wBACT,UACA,GAAG,MAAM,6DACV;GAED,OAAO,OAAO,MAAM;EAErB,KAAK;GACJ,IAAI,UAAU,GAAG,OAAO;GAIxB,MAAM,IAAI,wBACT,UACA,qEACD;CACF;AACD"}
|