@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/topic/index.cjs
CHANGED
|
@@ -1,137 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const __geekmidas_manifest = require_chunk.__toESM(require("@geekmidas/manifest"));
|
|
5
|
-
const __geekmidas_logger_console = require_chunk.__toESM(require("@geekmidas/logger/console"));
|
|
6
|
-
const __geekmidas_events = require_chunk.__toESM(require("@geekmidas/events"));
|
|
7
|
-
|
|
8
|
-
//#region src/topic/Topic.ts
|
|
9
|
-
/**
|
|
10
|
-
* A topic — pub/sub fan-out. Unlike a `Queue` (point-to-point, one consumer), a
|
|
11
|
-
* topic is a *resource* owned by no single handler: it declares the event
|
|
12
|
-
* contract, derives a typed producer (`topic.publisher`), and any number of
|
|
13
|
-
* subscribers (`s.topic(topic)`) bind to it. `gkm build` discovers it into the
|
|
14
|
-
* manifest's `topics` field; infra provisions an SNS topic.
|
|
15
|
-
*
|
|
16
|
-
* This replaces hand-writing a publisher `Service`: the publisher is *derived*
|
|
17
|
-
* from the declared event contract, the same way `Queue` derives its publisher.
|
|
18
|
-
*/
|
|
19
|
-
var Topic = class extends require_Construct.Construct {
|
|
20
|
-
__IS_TOPIC__ = true;
|
|
21
|
-
static isTopic(obj) {
|
|
22
|
-
return Boolean(obj && obj.__IS_TOPIC__ === true && obj.type === require_Construct.ConstructType.Topic);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* The canonical id this topic is declared under.
|
|
26
|
-
*
|
|
27
|
-
* Derived from the name, so `users` and `Users` are one topic. The name is
|
|
28
|
-
* left alone: subscribers bind to it and it is what the broker routes on.
|
|
29
|
-
*/
|
|
30
|
-
id;
|
|
31
|
-
/**
|
|
32
|
-
* The producer's env key, read by both {@link declare} and
|
|
33
|
-
* {@link publisher} so the two cannot drift.
|
|
34
|
-
*/
|
|
35
|
-
connectionKey;
|
|
36
|
-
constructor(name, eventSchemas, logger = __geekmidas_logger_console.DEFAULT_LOGGER) {
|
|
37
|
-
super(require_Construct.ConstructType.Topic, logger, [], []);
|
|
38
|
-
this.name = name;
|
|
39
|
-
this.eventSchemas = eventSchemas;
|
|
40
|
-
this.id = (0, __geekmidas_manifest.canonicalId)(name);
|
|
41
|
-
this.connectionKey = (0, __geekmidas_manifest.provideKey)(this.id, "publisherConnectionString");
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* What this topic is in the manifest.
|
|
45
|
-
*
|
|
46
|
-
* Only the producer's key: a subscriber is *bound* to a topic rather than
|
|
47
|
-
* depending on it, so the binding is an edge the deploy target reads and not
|
|
48
|
-
* an env key anyone can hold. Locally both sides meet on the same broker.
|
|
49
|
-
*/
|
|
50
|
-
declare() {
|
|
51
|
-
return [{
|
|
52
|
-
kind: "topic",
|
|
53
|
-
id: this.id,
|
|
54
|
-
provides: [this.connectionKey],
|
|
55
|
-
events: this.eventTypes,
|
|
56
|
-
subscribers: []
|
|
57
|
-
}];
|
|
58
|
-
}
|
|
59
|
-
/** The event type names this topic carries. */
|
|
60
|
-
get eventTypes() {
|
|
61
|
-
return Object.keys(this.eventSchemas);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* The producer side — a `Service` exposing an `EventPublisher` typed to the
|
|
65
|
-
* union of this topic's events. Inject via `.publisher(topic.publisher)` (for
|
|
66
|
-
* declarative `.event(...)`) or `.services([topic.publisher])` (to publish
|
|
67
|
-
* imperatively). Reads `<NAME>_PUBLISHER_CONNECTION_STRING` and selects the
|
|
68
|
-
* transport from the URL protocol — `pgboss://` locally, `sns://` deployed.
|
|
69
|
-
*
|
|
70
|
-
* Because it's a `Service`, the connection-string requirement is sniffed into
|
|
71
|
-
* the manifest of whatever construct injects it (least-privilege linking).
|
|
72
|
-
*/
|
|
73
|
-
/**
|
|
74
|
-
* The topic as a dependency — what `.dependsOn([users])` dissolves into,
|
|
75
|
-
* reachable as `services.users`.
|
|
76
|
-
*
|
|
77
|
-
* It is the producer, because publishing is the only thing depending on a
|
|
78
|
-
* topic can mean: a subscriber *binds* with `s.topic(…)` instead, and is
|
|
79
|
-
* deliberately never handed this. {@link publisher} is the same service
|
|
80
|
-
* under its older `<name>Publisher` key.
|
|
81
|
-
*/
|
|
82
|
-
get service() {
|
|
83
|
-
const { register } = this.publisher;
|
|
84
|
-
return {
|
|
85
|
-
serviceName: (0, __geekmidas_manifest.serviceKey)(this.id),
|
|
86
|
-
register
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
get publisher() {
|
|
90
|
-
const envVar = this.connectionKey;
|
|
91
|
-
return {
|
|
92
|
-
serviceName: `${this.name}Publisher`,
|
|
93
|
-
async register({ envParser }) {
|
|
94
|
-
const { connectionString } = envParser.create((get) => ({ connectionString: get(envVar).string() })).parse();
|
|
95
|
-
return __geekmidas_events.Publisher.fromConnectionString(connectionString);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
//#endregion
|
|
102
|
-
//#region src/topic/TopicBuilder.ts
|
|
103
|
-
/**
|
|
104
|
-
* Builds a {@link Topic} — `t.topic('users').events({ 'user.created': schema, … })`.
|
|
105
|
-
* The event map is the topic's contract: it types the derived `topic.publisher`
|
|
106
|
-
* and the subscribers that bind via `s.topic(topic)`.
|
|
107
|
-
*/
|
|
108
|
-
var TopicBuilder = class {
|
|
109
|
-
_name;
|
|
110
|
-
_logger = __geekmidas_logger_console.DEFAULT_LOGGER;
|
|
111
|
-
/** The topic name — drives the infra topic and its `<NAME>_*` env vars. */
|
|
112
|
-
topic(name) {
|
|
113
|
-
return require_clone.cloneWith(this, { _name: name });
|
|
114
|
-
}
|
|
115
|
-
logger(logger) {
|
|
116
|
-
return require_clone.cloneWith(this, { _logger: logger });
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* The event contract — a map of event type → payload schema. Building the
|
|
120
|
-
* topic requires this; it's what types the publisher and subscribers.
|
|
121
|
-
*/
|
|
122
|
-
events(events) {
|
|
123
|
-
if (!this._name) throw new Error("Topic requires a name — call .topic(name) before .events().");
|
|
124
|
-
const topic = new Topic(this._name, events, this._logger);
|
|
125
|
-
return topic;
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region src/topic/index.ts
|
|
131
|
-
const t = new TopicBuilder();
|
|
132
|
-
|
|
133
|
-
//#endregion
|
|
134
|
-
exports.Topic = Topic;
|
|
135
|
-
exports.TopicBuilder = TopicBuilder;
|
|
136
|
-
exports.t = t;
|
|
137
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_Topic = require("../Topic-GHxcU8AG.cjs");
|
|
3
|
+
exports.Topic = require_Topic.Topic;
|
package/dist/topic/index.d.cts
CHANGED
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
|
|
3
|
-
import { Logger } from "@geekmidas/logger";
|
|
4
|
-
|
|
5
|
-
//#region src/topic/TopicBuilder.d.ts
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Builds a {@link Topic} — `t.topic('users').events({ 'user.created': schema, … })`.
|
|
9
|
-
* The event map is the topic's contract: it types the derived `topic.publisher`
|
|
10
|
-
* and the subscribers that bind via `s.topic(topic)`.
|
|
11
|
-
*/
|
|
12
|
-
declare class TopicBuilder<TName extends string = string, TEvents extends TopicEvents = TopicEvents> {
|
|
13
|
-
private _name?;
|
|
14
|
-
private _logger;
|
|
15
|
-
/** The topic name — drives the infra topic and its `<NAME>_*` env vars. */
|
|
16
|
-
topic<T extends string>(name: T): TopicBuilder<T, TEvents>;
|
|
17
|
-
logger(logger: Logger): this;
|
|
18
|
-
/**
|
|
19
|
-
* The event contract — a map of event type → payload schema. Building the
|
|
20
|
-
* topic requires this; it's what types the publisher and subscribers.
|
|
21
|
-
*/
|
|
22
|
-
events<T extends TopicEvents>(events: T): Topic<TName, T>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=TopicBuilder.d.ts.map
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/topic/index.d.ts
|
|
27
|
-
declare const t: TopicBuilder<string, TopicEvents>;
|
|
28
|
-
//# sourceMappingURL=index.d.ts.map
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
export { Topic, TopicBuilder, TopicEvents, TopicMessage, t };
|
|
32
|
-
//# sourceMappingURL=index.d.cts.map
|
|
1
|
+
import { c as Topic, d as TopicOptions, l as TopicEvents, u as TopicMessage } from "../Construct-BQALFCh2.cjs";
|
|
2
|
+
export { Topic, type TopicEvents, type TopicMessage, type TopicOptions };
|
package/dist/topic/index.d.mts
CHANGED
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
|
|
3
|
-
import { Logger } from "@geekmidas/logger";
|
|
4
|
-
|
|
5
|
-
//#region src/topic/TopicBuilder.d.ts
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Builds a {@link Topic} — `t.topic('users').events({ 'user.created': schema, … })`.
|
|
9
|
-
* The event map is the topic's contract: it types the derived `topic.publisher`
|
|
10
|
-
* and the subscribers that bind via `s.topic(topic)`.
|
|
11
|
-
*/
|
|
12
|
-
declare class TopicBuilder<TName extends string = string, TEvents extends TopicEvents = TopicEvents> {
|
|
13
|
-
private _name?;
|
|
14
|
-
private _logger;
|
|
15
|
-
/** The topic name — drives the infra topic and its `<NAME>_*` env vars. */
|
|
16
|
-
topic<T extends string>(name: T): TopicBuilder<T, TEvents>;
|
|
17
|
-
logger(logger: Logger): this;
|
|
18
|
-
/**
|
|
19
|
-
* The event contract — a map of event type → payload schema. Building the
|
|
20
|
-
* topic requires this; it's what types the publisher and subscribers.
|
|
21
|
-
*/
|
|
22
|
-
events<T extends TopicEvents>(events: T): Topic<TName, T>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=TopicBuilder.d.ts.map
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/topic/index.d.ts
|
|
27
|
-
declare const t: TopicBuilder<string, TopicEvents>;
|
|
28
|
-
//# sourceMappingURL=index.d.ts.map
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
export { Topic, TopicBuilder, TopicEvents, TopicMessage, t };
|
|
32
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
import { c as Topic, d as TopicOptions, l as TopicEvents, u as TopicMessage } from "../Construct-QXnl3VqT.mjs";
|
|
2
|
+
export { Topic, type TopicEvents, type TopicMessage, type TopicOptions };
|
package/dist/topic/index.mjs
CHANGED
|
@@ -1,134 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
4
|
-
import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
|
|
5
|
-
import { Publisher } from "@geekmidas/events";
|
|
6
|
-
|
|
7
|
-
//#region src/topic/Topic.ts
|
|
8
|
-
/**
|
|
9
|
-
* A topic — pub/sub fan-out. Unlike a `Queue` (point-to-point, one consumer), a
|
|
10
|
-
* topic is a *resource* owned by no single handler: it declares the event
|
|
11
|
-
* contract, derives a typed producer (`topic.publisher`), and any number of
|
|
12
|
-
* subscribers (`s.topic(topic)`) bind to it. `gkm build` discovers it into the
|
|
13
|
-
* manifest's `topics` field; infra provisions an SNS topic.
|
|
14
|
-
*
|
|
15
|
-
* This replaces hand-writing a publisher `Service`: the publisher is *derived*
|
|
16
|
-
* from the declared event contract, the same way `Queue` derives its publisher.
|
|
17
|
-
*/
|
|
18
|
-
var Topic = class extends Construct {
|
|
19
|
-
__IS_TOPIC__ = true;
|
|
20
|
-
static isTopic(obj) {
|
|
21
|
-
return Boolean(obj && obj.__IS_TOPIC__ === true && obj.type === ConstructType.Topic);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* The canonical id this topic is declared under.
|
|
25
|
-
*
|
|
26
|
-
* Derived from the name, so `users` and `Users` are one topic. The name is
|
|
27
|
-
* left alone: subscribers bind to it and it is what the broker routes on.
|
|
28
|
-
*/
|
|
29
|
-
id;
|
|
30
|
-
/**
|
|
31
|
-
* The producer's env key, read by both {@link declare} and
|
|
32
|
-
* {@link publisher} so the two cannot drift.
|
|
33
|
-
*/
|
|
34
|
-
connectionKey;
|
|
35
|
-
constructor(name, eventSchemas, logger = DEFAULT_LOGGER) {
|
|
36
|
-
super(ConstructType.Topic, logger, [], []);
|
|
37
|
-
this.name = name;
|
|
38
|
-
this.eventSchemas = eventSchemas;
|
|
39
|
-
this.id = canonicalId(name);
|
|
40
|
-
this.connectionKey = provideKey(this.id, "publisherConnectionString");
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* What this topic is in the manifest.
|
|
44
|
-
*
|
|
45
|
-
* Only the producer's key: a subscriber is *bound* to a topic rather than
|
|
46
|
-
* depending on it, so the binding is an edge the deploy target reads and not
|
|
47
|
-
* an env key anyone can hold. Locally both sides meet on the same broker.
|
|
48
|
-
*/
|
|
49
|
-
declare() {
|
|
50
|
-
return [{
|
|
51
|
-
kind: "topic",
|
|
52
|
-
id: this.id,
|
|
53
|
-
provides: [this.connectionKey],
|
|
54
|
-
events: this.eventTypes,
|
|
55
|
-
subscribers: []
|
|
56
|
-
}];
|
|
57
|
-
}
|
|
58
|
-
/** The event type names this topic carries. */
|
|
59
|
-
get eventTypes() {
|
|
60
|
-
return Object.keys(this.eventSchemas);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* The producer side — a `Service` exposing an `EventPublisher` typed to the
|
|
64
|
-
* union of this topic's events. Inject via `.publisher(topic.publisher)` (for
|
|
65
|
-
* declarative `.event(...)`) or `.services([topic.publisher])` (to publish
|
|
66
|
-
* imperatively). Reads `<NAME>_PUBLISHER_CONNECTION_STRING` and selects the
|
|
67
|
-
* transport from the URL protocol — `pgboss://` locally, `sns://` deployed.
|
|
68
|
-
*
|
|
69
|
-
* Because it's a `Service`, the connection-string requirement is sniffed into
|
|
70
|
-
* the manifest of whatever construct injects it (least-privilege linking).
|
|
71
|
-
*/
|
|
72
|
-
/**
|
|
73
|
-
* The topic as a dependency — what `.dependsOn([users])` dissolves into,
|
|
74
|
-
* reachable as `services.users`.
|
|
75
|
-
*
|
|
76
|
-
* It is the producer, because publishing is the only thing depending on a
|
|
77
|
-
* topic can mean: a subscriber *binds* with `s.topic(…)` instead, and is
|
|
78
|
-
* deliberately never handed this. {@link publisher} is the same service
|
|
79
|
-
* under its older `<name>Publisher` key.
|
|
80
|
-
*/
|
|
81
|
-
get service() {
|
|
82
|
-
const { register } = this.publisher;
|
|
83
|
-
return {
|
|
84
|
-
serviceName: serviceKey(this.id),
|
|
85
|
-
register
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
get publisher() {
|
|
89
|
-
const envVar = this.connectionKey;
|
|
90
|
-
return {
|
|
91
|
-
serviceName: `${this.name}Publisher`,
|
|
92
|
-
async register({ envParser }) {
|
|
93
|
-
const { connectionString } = envParser.create((get) => ({ connectionString: get(envVar).string() })).parse();
|
|
94
|
-
return Publisher.fromConnectionString(connectionString);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region src/topic/TopicBuilder.ts
|
|
102
|
-
/**
|
|
103
|
-
* Builds a {@link Topic} — `t.topic('users').events({ 'user.created': schema, … })`.
|
|
104
|
-
* The event map is the topic's contract: it types the derived `topic.publisher`
|
|
105
|
-
* and the subscribers that bind via `s.topic(topic)`.
|
|
106
|
-
*/
|
|
107
|
-
var TopicBuilder = class {
|
|
108
|
-
_name;
|
|
109
|
-
_logger = DEFAULT_LOGGER;
|
|
110
|
-
/** The topic name — drives the infra topic and its `<NAME>_*` env vars. */
|
|
111
|
-
topic(name) {
|
|
112
|
-
return cloneWith(this, { _name: name });
|
|
113
|
-
}
|
|
114
|
-
logger(logger) {
|
|
115
|
-
return cloneWith(this, { _logger: logger });
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* The event contract — a map of event type → payload schema. Building the
|
|
119
|
-
* topic requires this; it's what types the publisher and subscribers.
|
|
120
|
-
*/
|
|
121
|
-
events(events) {
|
|
122
|
-
if (!this._name) throw new Error("Topic requires a name — call .topic(name) before .events().");
|
|
123
|
-
const topic = new Topic(this._name, events, this._logger);
|
|
124
|
-
return topic;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region src/topic/index.ts
|
|
130
|
-
const t = new TopicBuilder();
|
|
131
|
-
|
|
132
|
-
//#endregion
|
|
133
|
-
export { Topic, TopicBuilder, t };
|
|
134
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
import { t as Topic } from "../Topic-D74b5cgs.mjs";
|
|
2
|
+
export { Topic };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { channel } from "node:diagnostics_channel";
|
|
2
|
+
import { carrierFromAttributes } from "@geekmidas/events";
|
|
3
|
+
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
4
|
+
//#region src/tracing.ts
|
|
5
|
+
/**
|
|
6
|
+
* Where the constructs meet OpenTelemetry, beyond the spans `@geekmidas/events`
|
|
7
|
+
* starts for the brokers: the trace context in a Lambda's records, the spans
|
|
8
|
+
* around an `ExternalApi`'s client, and the context a call to a sibling
|
|
9
|
+
* service carries.
|
|
10
|
+
*
|
|
11
|
+
* Everything goes through the global API, so without a registered provider
|
|
12
|
+
* none of it records anything.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The trace context a Lambda record carries: an SQS record's message
|
|
18
|
+
* attributes, an SNS record's, or those of the SNS envelope an SQS
|
|
19
|
+
* subscription delivers in its body.
|
|
20
|
+
*/
|
|
21
|
+
function recordCarrier(record) {
|
|
22
|
+
const r = record;
|
|
23
|
+
if (r?.Sns) return carrierFromAttributes(r.Sns.MessageAttributes);
|
|
24
|
+
const own = carrierFromAttributes(r?.messageAttributes);
|
|
25
|
+
if (own || typeof r?.body !== "string") return own;
|
|
26
|
+
try {
|
|
27
|
+
const body = JSON.parse(r.body);
|
|
28
|
+
return body?.Type === "Notification" ? carrierFromAttributes(body.MessageAttributes) : void 0;
|
|
29
|
+
} catch {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* `client`, with a span around each of its methods: `<api>.<method>`, carrying
|
|
35
|
+
* the API's name. An outbound `fetch` the method makes is traced already, and
|
|
36
|
+
* becomes this span's child, so the name is on the trace without anything
|
|
37
|
+
* knowing which URL belongs to which API.
|
|
38
|
+
*
|
|
39
|
+
* Only the client's own methods: what they return is the client's business.
|
|
40
|
+
* Methods are called on the client itself, never on the proxy, so private
|
|
41
|
+
* fields keep working.
|
|
42
|
+
*/
|
|
43
|
+
function traceClient(api, client, attributes = {}) {
|
|
44
|
+
if (!client || typeof client !== "object" && typeof client !== "function") return client;
|
|
45
|
+
const wrapped = /* @__PURE__ */ new Map();
|
|
46
|
+
return new Proxy(client, { get(target, property, receiver) {
|
|
47
|
+
const value = Reflect.get(target, property, receiver);
|
|
48
|
+
if (typeof value !== "function" || typeof property === "symbol") return value;
|
|
49
|
+
if (property === "constructor" || property === "then") return value;
|
|
50
|
+
const cached = wrapped.get(property);
|
|
51
|
+
if (cached && cached.original === value) return cached;
|
|
52
|
+
const traced = Object.assign((...args) => callTraced(api, property, attributes, () => value.apply(target, args)), { original: value });
|
|
53
|
+
wrapped.set(property, traced);
|
|
54
|
+
return traced;
|
|
55
|
+
} });
|
|
56
|
+
}
|
|
57
|
+
function callTraced(api, method, attributes, call) {
|
|
58
|
+
return trace.getTracer("@geekmidas/constructs").startActiveSpan(`${api}.${method}`, {
|
|
59
|
+
kind: SpanKind.INTERNAL,
|
|
60
|
+
attributes: {
|
|
61
|
+
"gkm.external_api.name": api,
|
|
62
|
+
"gkm.external_api.method": method,
|
|
63
|
+
...attributes
|
|
64
|
+
}
|
|
65
|
+
}, (span) => {
|
|
66
|
+
const fail = (error) => {
|
|
67
|
+
if (error instanceof Error) span.recordException(error);
|
|
68
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
69
|
+
span.end();
|
|
70
|
+
};
|
|
71
|
+
let result;
|
|
72
|
+
try {
|
|
73
|
+
result = call();
|
|
74
|
+
} catch (error) {
|
|
75
|
+
fail(error);
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
if (result instanceof Promise) {
|
|
79
|
+
result.then(() => span.end(), (error) => fail(error));
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
span.end();
|
|
83
|
+
return result;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Where an instrumentation of `fetch` hears of each request — undici's own
|
|
88
|
+
* diagnostics channel, which OpenTelemetry's undici instrumentation (and every
|
|
89
|
+
* APM built on it) subscribes to.
|
|
90
|
+
*/
|
|
91
|
+
const FETCH_REQUESTS = channel("undici:request:create");
|
|
92
|
+
/**
|
|
93
|
+
* The active trace context, written into `headers` for a call this process
|
|
94
|
+
* makes to one of its own services — the auth server's session check — so the
|
|
95
|
+
* callee's span joins the caller's trace.
|
|
96
|
+
*
|
|
97
|
+
* Through the global propagator, so it is a no-op without one. And not at all
|
|
98
|
+
* when a `fetch` instrumentation is listening: that opens the request's own
|
|
99
|
+
* CLIENT span and writes its `traceparent` by appending a header, so a second
|
|
100
|
+
* one here would reach the callee as two values joined — `a, b` — which no
|
|
101
|
+
* propagator reads, and the trace would break instead of joining.
|
|
102
|
+
*/
|
|
103
|
+
function injectTraceContext(headers) {
|
|
104
|
+
if (FETCH_REQUESTS.hasSubscribers) return;
|
|
105
|
+
propagation.inject(context.active(), headers, { set: (carrier, key, value) => carrier.set(key, value) });
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { recordCarrier as n, traceClient as r, injectTraceContext as t };
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=tracing-CxaZ98IB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracing-CxaZ98IB.mjs","names":[],"sources":["../src/tracing.ts"],"sourcesContent":["/**\n * Where the constructs meet OpenTelemetry, beyond the spans `@geekmidas/events`\n * starts for the brokers: the trace context in a Lambda's records, the spans\n * around an `ExternalApi`'s client, and the context a call to a sibling\n * service carries.\n *\n * Everything goes through the global API, so without a registered provider\n * none of it records anything.\n *\n * @module\n */\nimport { channel } from 'node:diagnostics_channel';\nimport { carrierFromAttributes, type TraceCarrier } from '@geekmidas/events';\nimport {\n\tcontext,\n\tpropagation,\n\tSpanKind,\n\tSpanStatusCode,\n\ttrace,\n} from '@opentelemetry/api';\n\n/**\n * The trace context a Lambda record carries: an SQS record's message\n * attributes, an SNS record's, or those of the SNS envelope an SQS\n * subscription delivers in its body.\n */\nexport function recordCarrier(record: unknown): TraceCarrier | undefined {\n\tconst r = record as {\n\t\tmessageAttributes?: Record<string, unknown>;\n\t\tbody?: string;\n\t\tSns?: { MessageAttributes?: Record<string, unknown> };\n\t};\n\tif (r?.Sns) return carrierFromAttributes(r.Sns.MessageAttributes);\n\n\tconst own = carrierFromAttributes(r?.messageAttributes);\n\tif (own || typeof r?.body !== 'string') return own;\n\ttry {\n\t\tconst body = JSON.parse(r.body);\n\t\treturn body?.Type === 'Notification'\n\t\t\t? carrierFromAttributes(body.MessageAttributes)\n\t\t\t: undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * `client`, with a span around each of its methods: `<api>.<method>`, carrying\n * the API's name. An outbound `fetch` the method makes is traced already, and\n * becomes this span's child, so the name is on the trace without anything\n * knowing which URL belongs to which API.\n *\n * Only the client's own methods: what they return is the client's business.\n * Methods are called on the client itself, never on the proxy, so private\n * fields keep working.\n */\nexport function traceClient<T>(\n\tapi: string,\n\tclient: T,\n\tattributes: Record<string, string> = {},\n): T {\n\tif (!client || (typeof client !== 'object' && typeof client !== 'function')) {\n\t\treturn client;\n\t}\n\tconst wrapped = new Map<PropertyKey, unknown>();\n\treturn new Proxy(client as object, {\n\t\tget(target, property, receiver) {\n\t\t\tconst value = Reflect.get(target, property, receiver);\n\t\t\tif (typeof value !== 'function' || typeof property === 'symbol') {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tif (property === 'constructor' || property === 'then') return value;\n\n\t\t\tconst cached = wrapped.get(property);\n\t\t\tif (cached && (cached as { original?: unknown }).original === value) {\n\t\t\t\treturn cached;\n\t\t\t}\n\t\t\tconst traced = Object.assign(\n\t\t\t\t(...args: unknown[]) =>\n\t\t\t\t\tcallTraced(api, property, attributes, () =>\n\t\t\t\t\t\t(value as (...a: unknown[]) => unknown).apply(target, args),\n\t\t\t\t\t),\n\t\t\t\t{ original: value },\n\t\t\t);\n\t\t\twrapped.set(property, traced);\n\t\t\treturn traced;\n\t\t},\n\t}) as T;\n}\n\nfunction callTraced(\n\tapi: string,\n\tmethod: string,\n\tattributes: Record<string, string>,\n\tcall: () => unknown,\n): unknown {\n\treturn trace.getTracer('@geekmidas/constructs').startActiveSpan(\n\t\t`${api}.${method}`,\n\t\t{\n\t\t\tkind: SpanKind.INTERNAL,\n\t\t\tattributes: {\n\t\t\t\t'gkm.external_api.name': api,\n\t\t\t\t'gkm.external_api.method': method,\n\t\t\t\t...attributes,\n\t\t\t},\n\t\t},\n\t\t(span) => {\n\t\t\tconst fail = (error: unknown) => {\n\t\t\t\tif (error instanceof Error) span.recordException(error);\n\t\t\t\tspan.setStatus({ code: SpanStatusCode.ERROR });\n\t\t\t\tspan.end();\n\t\t\t};\n\t\t\tlet result: unknown;\n\t\t\ttry {\n\t\t\t\tresult = call();\n\t\t\t} catch (error) {\n\t\t\t\tfail(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\t// Only a native promise is waited on, and the caller gets it back as\n\t\t\t// it was: a lazy thenable runs on `then`, and a promise subclass has\n\t\t\t// methods a chained promise would not.\n\t\t\tif (result instanceof Promise) {\n\t\t\t\tresult.then(\n\t\t\t\t\t() => span.end(),\n\t\t\t\t\t(error) => fail(error),\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tspan.end();\n\t\t\treturn result;\n\t\t},\n\t);\n}\n\n/**\n * Where an instrumentation of `fetch` hears of each request — undici's own\n * diagnostics channel, which OpenTelemetry's undici instrumentation (and every\n * APM built on it) subscribes to.\n */\nconst FETCH_REQUESTS = channel('undici:request:create');\n\n/**\n * The active trace context, written into `headers` for a call this process\n * makes to one of its own services — the auth server's session check — so the\n * callee's span joins the caller's trace.\n *\n * Through the global propagator, so it is a no-op without one. And not at all\n * when a `fetch` instrumentation is listening: that opens the request's own\n * CLIENT span and writes its `traceparent` by appending a header, so a second\n * one here would reach the callee as two values joined — `a, b` — which no\n * propagator reads, and the trace would break instead of joining.\n */\nexport function injectTraceContext(headers: Headers): void {\n\tif (FETCH_REQUESTS.hasSubscribers) return;\n\tpropagation.inject(context.active(), headers, {\n\t\tset: (carrier, key, value) => carrier.set(key, value),\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,cAAc,QAA2C;CACxE,MAAM,IAAI;CAKV,IAAI,GAAG,KAAK,OAAO,sBAAsB,EAAE,IAAI,iBAAiB;CAEhE,MAAM,MAAM,sBAAsB,GAAG,iBAAiB;CACtD,IAAI,OAAO,OAAO,GAAG,SAAS,UAAU,OAAO;CAC/C,IAAI;EACH,MAAM,OAAO,KAAK,MAAM,EAAE,IAAI;EAC9B,OAAO,MAAM,SAAS,iBACnB,sBAAsB,KAAK,iBAAiB,IAC5C,KAAA;CACJ,QAAQ;EACP;CACD;AACD;;;;;;;;;;;AAYA,SAAgB,YACf,KACA,QACA,aAAqC,CAAC,GAClC;CACJ,IAAI,CAAC,UAAW,OAAO,WAAW,YAAY,OAAO,WAAW,YAC/D,OAAO;CAER,MAAM,0BAAU,IAAI,IAA0B;CAC9C,OAAO,IAAI,MAAM,QAAkB,EAClC,IAAI,QAAQ,UAAU,UAAU;EAC/B,MAAM,QAAQ,QAAQ,IAAI,QAAQ,UAAU,QAAQ;EACpD,IAAI,OAAO,UAAU,cAAc,OAAO,aAAa,UACtD,OAAO;EAER,IAAI,aAAa,iBAAiB,aAAa,QAAQ,OAAO;EAE9D,MAAM,SAAS,QAAQ,IAAI,QAAQ;EACnC,IAAI,UAAW,OAAkC,aAAa,OAC7D,OAAO;EAER,MAAM,SAAS,OAAO,QACpB,GAAG,SACH,WAAW,KAAK,UAAU,kBACxB,MAAuC,MAAM,QAAQ,IAAI,CAC3D,GACD,EAAE,UAAU,MAAM,CACnB;EACA,QAAQ,IAAI,UAAU,MAAM;EAC5B,OAAO;CACR,EACD,CAAC;AACF;AAEA,SAAS,WACR,KACA,QACA,YACA,MACU;CACV,OAAO,MAAM,UAAU,uBAAuB,CAAC,CAAC,gBAC/C,GAAG,IAAI,GAAG,UACV;EACC,MAAM,SAAS;EACf,YAAY;GACX,yBAAyB;GACzB,2BAA2B;GAC3B,GAAG;EACJ;CACD,IACC,SAAS;EACT,MAAM,QAAQ,UAAmB;GAChC,IAAI,iBAAiB,OAAO,KAAK,gBAAgB,KAAK;GACtD,KAAK,UAAU,EAAE,MAAM,eAAe,MAAM,CAAC;GAC7C,KAAK,IAAI;EACV;EACA,IAAI;EACJ,IAAI;GACH,SAAS,KAAK;EACf,SAAS,OAAO;GACf,KAAK,KAAK;GACV,MAAM;EACP;EAIA,IAAI,kBAAkB,SAAS;GAC9B,OAAO,WACA,KAAK,IAAI,IACd,UAAU,KAAK,KAAK,CACtB;GACA,OAAO;EACR;EACA,KAAK,IAAI;EACT,OAAO;CACR,CACD;AACD;;;;;;AAOA,MAAM,iBAAiB,QAAQ,uBAAuB;;;;;;;;;;;;AAatD,SAAgB,mBAAmB,SAAwB;CAC1D,IAAI,eAAe,gBAAgB;CACnC,YAAY,OAAO,QAAQ,OAAO,GAAG,SAAS,EAC7C,MAAM,SAAS,KAAK,UAAU,QAAQ,IAAI,KAAK,KAAK,EACrD,CAAC;AACF"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
let node_diagnostics_channel = require("node:diagnostics_channel");
|
|
2
|
+
let _geekmidas_events = require("@geekmidas/events");
|
|
3
|
+
let _opentelemetry_api = require("@opentelemetry/api");
|
|
4
|
+
//#region src/tracing.ts
|
|
5
|
+
/**
|
|
6
|
+
* Where the constructs meet OpenTelemetry, beyond the spans `@geekmidas/events`
|
|
7
|
+
* starts for the brokers: the trace context in a Lambda's records, the spans
|
|
8
|
+
* around an `ExternalApi`'s client, and the context a call to a sibling
|
|
9
|
+
* service carries.
|
|
10
|
+
*
|
|
11
|
+
* Everything goes through the global API, so without a registered provider
|
|
12
|
+
* none of it records anything.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The trace context a Lambda record carries: an SQS record's message
|
|
18
|
+
* attributes, an SNS record's, or those of the SNS envelope an SQS
|
|
19
|
+
* subscription delivers in its body.
|
|
20
|
+
*/
|
|
21
|
+
function recordCarrier(record) {
|
|
22
|
+
const r = record;
|
|
23
|
+
if (r?.Sns) return (0, _geekmidas_events.carrierFromAttributes)(r.Sns.MessageAttributes);
|
|
24
|
+
const own = (0, _geekmidas_events.carrierFromAttributes)(r?.messageAttributes);
|
|
25
|
+
if (own || typeof r?.body !== "string") return own;
|
|
26
|
+
try {
|
|
27
|
+
const body = JSON.parse(r.body);
|
|
28
|
+
return body?.Type === "Notification" ? (0, _geekmidas_events.carrierFromAttributes)(body.MessageAttributes) : void 0;
|
|
29
|
+
} catch {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* `client`, with a span around each of its methods: `<api>.<method>`, carrying
|
|
35
|
+
* the API's name. An outbound `fetch` the method makes is traced already, and
|
|
36
|
+
* becomes this span's child, so the name is on the trace without anything
|
|
37
|
+
* knowing which URL belongs to which API.
|
|
38
|
+
*
|
|
39
|
+
* Only the client's own methods: what they return is the client's business.
|
|
40
|
+
* Methods are called on the client itself, never on the proxy, so private
|
|
41
|
+
* fields keep working.
|
|
42
|
+
*/
|
|
43
|
+
function traceClient(api, client, attributes = {}) {
|
|
44
|
+
if (!client || typeof client !== "object" && typeof client !== "function") return client;
|
|
45
|
+
const wrapped = /* @__PURE__ */ new Map();
|
|
46
|
+
return new Proxy(client, { get(target, property, receiver) {
|
|
47
|
+
const value = Reflect.get(target, property, receiver);
|
|
48
|
+
if (typeof value !== "function" || typeof property === "symbol") return value;
|
|
49
|
+
if (property === "constructor" || property === "then") return value;
|
|
50
|
+
const cached = wrapped.get(property);
|
|
51
|
+
if (cached && cached.original === value) return cached;
|
|
52
|
+
const traced = Object.assign((...args) => callTraced(api, property, attributes, () => value.apply(target, args)), { original: value });
|
|
53
|
+
wrapped.set(property, traced);
|
|
54
|
+
return traced;
|
|
55
|
+
} });
|
|
56
|
+
}
|
|
57
|
+
function callTraced(api, method, attributes, call) {
|
|
58
|
+
return _opentelemetry_api.trace.getTracer("@geekmidas/constructs").startActiveSpan(`${api}.${method}`, {
|
|
59
|
+
kind: _opentelemetry_api.SpanKind.INTERNAL,
|
|
60
|
+
attributes: {
|
|
61
|
+
"gkm.external_api.name": api,
|
|
62
|
+
"gkm.external_api.method": method,
|
|
63
|
+
...attributes
|
|
64
|
+
}
|
|
65
|
+
}, (span) => {
|
|
66
|
+
const fail = (error) => {
|
|
67
|
+
if (error instanceof Error) span.recordException(error);
|
|
68
|
+
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
69
|
+
span.end();
|
|
70
|
+
};
|
|
71
|
+
let result;
|
|
72
|
+
try {
|
|
73
|
+
result = call();
|
|
74
|
+
} catch (error) {
|
|
75
|
+
fail(error);
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
if (result instanceof Promise) {
|
|
79
|
+
result.then(() => span.end(), (error) => fail(error));
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
span.end();
|
|
83
|
+
return result;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Where an instrumentation of `fetch` hears of each request — undici's own
|
|
88
|
+
* diagnostics channel, which OpenTelemetry's undici instrumentation (and every
|
|
89
|
+
* APM built on it) subscribes to.
|
|
90
|
+
*/
|
|
91
|
+
const FETCH_REQUESTS = (0, node_diagnostics_channel.channel)("undici:request:create");
|
|
92
|
+
/**
|
|
93
|
+
* The active trace context, written into `headers` for a call this process
|
|
94
|
+
* makes to one of its own services — the auth server's session check — so the
|
|
95
|
+
* callee's span joins the caller's trace.
|
|
96
|
+
*
|
|
97
|
+
* Through the global propagator, so it is a no-op without one. And not at all
|
|
98
|
+
* when a `fetch` instrumentation is listening: that opens the request's own
|
|
99
|
+
* CLIENT span and writes its `traceparent` by appending a header, so a second
|
|
100
|
+
* one here would reach the callee as two values joined — `a, b` — which no
|
|
101
|
+
* propagator reads, and the trace would break instead of joining.
|
|
102
|
+
*/
|
|
103
|
+
function injectTraceContext(headers) {
|
|
104
|
+
if (FETCH_REQUESTS.hasSubscribers) return;
|
|
105
|
+
_opentelemetry_api.propagation.inject(_opentelemetry_api.context.active(), headers, { set: (carrier, key, value) => carrier.set(key, value) });
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
Object.defineProperty(exports, "injectTraceContext", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function() {
|
|
111
|
+
return injectTraceContext;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "recordCarrier", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function() {
|
|
117
|
+
return recordCarrier;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "traceClient", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function() {
|
|
123
|
+
return traceClient;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
//# sourceMappingURL=tracing-DPMidF_r.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracing-DPMidF_r.cjs","names":["carrierFromAttributes","trace","SpanKind","SpanStatusCode","channel","context"],"sources":["../src/tracing.ts"],"sourcesContent":["/**\n * Where the constructs meet OpenTelemetry, beyond the spans `@geekmidas/events`\n * starts for the brokers: the trace context in a Lambda's records, the spans\n * around an `ExternalApi`'s client, and the context a call to a sibling\n * service carries.\n *\n * Everything goes through the global API, so without a registered provider\n * none of it records anything.\n *\n * @module\n */\nimport { channel } from 'node:diagnostics_channel';\nimport { carrierFromAttributes, type TraceCarrier } from '@geekmidas/events';\nimport {\n\tcontext,\n\tpropagation,\n\tSpanKind,\n\tSpanStatusCode,\n\ttrace,\n} from '@opentelemetry/api';\n\n/**\n * The trace context a Lambda record carries: an SQS record's message\n * attributes, an SNS record's, or those of the SNS envelope an SQS\n * subscription delivers in its body.\n */\nexport function recordCarrier(record: unknown): TraceCarrier | undefined {\n\tconst r = record as {\n\t\tmessageAttributes?: Record<string, unknown>;\n\t\tbody?: string;\n\t\tSns?: { MessageAttributes?: Record<string, unknown> };\n\t};\n\tif (r?.Sns) return carrierFromAttributes(r.Sns.MessageAttributes);\n\n\tconst own = carrierFromAttributes(r?.messageAttributes);\n\tif (own || typeof r?.body !== 'string') return own;\n\ttry {\n\t\tconst body = JSON.parse(r.body);\n\t\treturn body?.Type === 'Notification'\n\t\t\t? carrierFromAttributes(body.MessageAttributes)\n\t\t\t: undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * `client`, with a span around each of its methods: `<api>.<method>`, carrying\n * the API's name. An outbound `fetch` the method makes is traced already, and\n * becomes this span's child, so the name is on the trace without anything\n * knowing which URL belongs to which API.\n *\n * Only the client's own methods: what they return is the client's business.\n * Methods are called on the client itself, never on the proxy, so private\n * fields keep working.\n */\nexport function traceClient<T>(\n\tapi: string,\n\tclient: T,\n\tattributes: Record<string, string> = {},\n): T {\n\tif (!client || (typeof client !== 'object' && typeof client !== 'function')) {\n\t\treturn client;\n\t}\n\tconst wrapped = new Map<PropertyKey, unknown>();\n\treturn new Proxy(client as object, {\n\t\tget(target, property, receiver) {\n\t\t\tconst value = Reflect.get(target, property, receiver);\n\t\t\tif (typeof value !== 'function' || typeof property === 'symbol') {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tif (property === 'constructor' || property === 'then') return value;\n\n\t\t\tconst cached = wrapped.get(property);\n\t\t\tif (cached && (cached as { original?: unknown }).original === value) {\n\t\t\t\treturn cached;\n\t\t\t}\n\t\t\tconst traced = Object.assign(\n\t\t\t\t(...args: unknown[]) =>\n\t\t\t\t\tcallTraced(api, property, attributes, () =>\n\t\t\t\t\t\t(value as (...a: unknown[]) => unknown).apply(target, args),\n\t\t\t\t\t),\n\t\t\t\t{ original: value },\n\t\t\t);\n\t\t\twrapped.set(property, traced);\n\t\t\treturn traced;\n\t\t},\n\t}) as T;\n}\n\nfunction callTraced(\n\tapi: string,\n\tmethod: string,\n\tattributes: Record<string, string>,\n\tcall: () => unknown,\n): unknown {\n\treturn trace.getTracer('@geekmidas/constructs').startActiveSpan(\n\t\t`${api}.${method}`,\n\t\t{\n\t\t\tkind: SpanKind.INTERNAL,\n\t\t\tattributes: {\n\t\t\t\t'gkm.external_api.name': api,\n\t\t\t\t'gkm.external_api.method': method,\n\t\t\t\t...attributes,\n\t\t\t},\n\t\t},\n\t\t(span) => {\n\t\t\tconst fail = (error: unknown) => {\n\t\t\t\tif (error instanceof Error) span.recordException(error);\n\t\t\t\tspan.setStatus({ code: SpanStatusCode.ERROR });\n\t\t\t\tspan.end();\n\t\t\t};\n\t\t\tlet result: unknown;\n\t\t\ttry {\n\t\t\t\tresult = call();\n\t\t\t} catch (error) {\n\t\t\t\tfail(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\t// Only a native promise is waited on, and the caller gets it back as\n\t\t\t// it was: a lazy thenable runs on `then`, and a promise subclass has\n\t\t\t// methods a chained promise would not.\n\t\t\tif (result instanceof Promise) {\n\t\t\t\tresult.then(\n\t\t\t\t\t() => span.end(),\n\t\t\t\t\t(error) => fail(error),\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tspan.end();\n\t\t\treturn result;\n\t\t},\n\t);\n}\n\n/**\n * Where an instrumentation of `fetch` hears of each request — undici's own\n * diagnostics channel, which OpenTelemetry's undici instrumentation (and every\n * APM built on it) subscribes to.\n */\nconst FETCH_REQUESTS = channel('undici:request:create');\n\n/**\n * The active trace context, written into `headers` for a call this process\n * makes to one of its own services — the auth server's session check — so the\n * callee's span joins the caller's trace.\n *\n * Through the global propagator, so it is a no-op without one. And not at all\n * when a `fetch` instrumentation is listening: that opens the request's own\n * CLIENT span and writes its `traceparent` by appending a header, so a second\n * one here would reach the callee as two values joined — `a, b` — which no\n * propagator reads, and the trace would break instead of joining.\n */\nexport function injectTraceContext(headers: Headers): void {\n\tif (FETCH_REQUESTS.hasSubscribers) return;\n\tpropagation.inject(context.active(), headers, {\n\t\tset: (carrier, key, value) => carrier.set(key, value),\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,cAAc,QAA2C;CACxE,MAAM,IAAI;CAKV,IAAI,GAAG,KAAK,QAAA,GAAOA,kBAAAA,sBAAAA,CAAsB,EAAE,IAAI,iBAAiB;CAEhE,MAAM,OAAA,GAAMA,kBAAAA,sBAAAA,CAAsB,GAAG,iBAAiB;CACtD,IAAI,OAAO,OAAO,GAAG,SAAS,UAAU,OAAO;CAC/C,IAAI;EACH,MAAM,OAAO,KAAK,MAAM,EAAE,IAAI;EAC9B,OAAO,MAAM,SAAS,kBAAA,GACnBA,kBAAAA,sBAAAA,CAAsB,KAAK,iBAAiB,IAC5C,KAAA;CACJ,QAAQ;EACP;CACD;AACD;;;;;;;;;;;AAYA,SAAgB,YACf,KACA,QACA,aAAqC,CAAC,GAClC;CACJ,IAAI,CAAC,UAAW,OAAO,WAAW,YAAY,OAAO,WAAW,YAC/D,OAAO;CAER,MAAM,0BAAU,IAAI,IAA0B;CAC9C,OAAO,IAAI,MAAM,QAAkB,EAClC,IAAI,QAAQ,UAAU,UAAU;EAC/B,MAAM,QAAQ,QAAQ,IAAI,QAAQ,UAAU,QAAQ;EACpD,IAAI,OAAO,UAAU,cAAc,OAAO,aAAa,UACtD,OAAO;EAER,IAAI,aAAa,iBAAiB,aAAa,QAAQ,OAAO;EAE9D,MAAM,SAAS,QAAQ,IAAI,QAAQ;EACnC,IAAI,UAAW,OAAkC,aAAa,OAC7D,OAAO;EAER,MAAM,SAAS,OAAO,QACpB,GAAG,SACH,WAAW,KAAK,UAAU,kBACxB,MAAuC,MAAM,QAAQ,IAAI,CAC3D,GACD,EAAE,UAAU,MAAM,CACnB;EACA,QAAQ,IAAI,UAAU,MAAM;EAC5B,OAAO;CACR,EACD,CAAC;AACF;AAEA,SAAS,WACR,KACA,QACA,YACA,MACU;CACV,OAAOC,mBAAAA,MAAM,UAAU,uBAAuB,CAAC,CAAC,gBAC/C,GAAG,IAAI,GAAG,UACV;EACC,MAAMC,mBAAAA,SAAS;EACf,YAAY;GACX,yBAAyB;GACzB,2BAA2B;GAC3B,GAAG;EACJ;CACD,IACC,SAAS;EACT,MAAM,QAAQ,UAAmB;GAChC,IAAI,iBAAiB,OAAO,KAAK,gBAAgB,KAAK;GACtD,KAAK,UAAU,EAAE,MAAMC,mBAAAA,eAAe,MAAM,CAAC;GAC7C,KAAK,IAAI;EACV;EACA,IAAI;EACJ,IAAI;GACH,SAAS,KAAK;EACf,SAAS,OAAO;GACf,KAAK,KAAK;GACV,MAAM;EACP;EAIA,IAAI,kBAAkB,SAAS;GAC9B,OAAO,WACA,KAAK,IAAI,IACd,UAAU,KAAK,KAAK,CACtB;GACA,OAAO;EACR;EACA,KAAK,IAAI;EACT,OAAO;CACR,CACD;AACD;;;;;;AAOA,MAAM,kBAAA,GAAiBC,yBAAAA,QAAAA,CAAQ,uBAAuB;;;;;;;;;;;;AAatD,SAAgB,mBAAmB,SAAwB;CAC1D,IAAI,eAAe,gBAAgB;CACnC,mBAAA,YAAY,OAAOC,mBAAAA,QAAQ,OAAO,GAAG,SAAS,EAC7C,MAAM,SAAS,KAAK,UAAU,QAAQ,IAAI,KAAK,KAAK,EACrD,CAAC;AACF"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
//#region src/types.d.ts
|
|
2
|
-
type RemoveUndefined<T> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K] };
|
|
2
|
+
type RemoveUndefined<T> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K]; };
|
|
3
3
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
|
|
4
4
|
type LowerHttpMethod<T extends HttpMethod> = Lowercase<T>;
|
|
5
|
-
//# sourceMappingURL=types.d.ts.map
|
|
6
|
-
|
|
7
5
|
//#endregion
|
|
8
|
-
export {
|
|
9
|
-
//# sourceMappingURL=types-
|
|
6
|
+
export { LowerHttpMethod as n, RemoveUndefined as r, HttpMethod as t };
|
|
7
|
+
//# sourceMappingURL=types-DMuSQeLL.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DMuSQeLL.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY,gBAAgB,QAC1B,WAAW,KAAK,EAAE,+BAA+B,IAAI,EAAE;KAG7C;KAQA,gBAAgB,UAAU,cAAc,UAAU"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
//#region src/types.d.ts
|
|
2
|
-
type RemoveUndefined<T> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K] };
|
|
2
|
+
type RemoveUndefined<T> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K]; };
|
|
3
3
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
|
|
4
4
|
type LowerHttpMethod<T extends HttpMethod> = Lowercase<T>;
|
|
5
|
-
//# sourceMappingURL=types.d.ts.map
|
|
6
|
-
|
|
7
5
|
//#endregion
|
|
8
|
-
export {
|
|
9
|
-
//# sourceMappingURL=types-
|
|
6
|
+
export { LowerHttpMethod as n, RemoveUndefined as r, HttpMethod as t };
|
|
7
|
+
//# sourceMappingURL=types-DMuSQeLL.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DMuSQeLL.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY,gBAAgB,QAC1B,WAAW,KAAK,EAAE,+BAA+B,IAAI,EAAE;KAG7C;KAQA,gBAAgB,UAAU,cAAc,UAAU"}
|
package/dist/types.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as LowerHttpMethod, r as RemoveUndefined, t as HttpMethod } from "./types-DMuSQeLL.cjs";
|
|
2
2
|
export { HttpMethod, LowerHttpMethod, RemoveUndefined };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as LowerHttpMethod, r as RemoveUndefined, t as HttpMethod } from "./types-DMuSQeLL.mjs";
|
|
2
2
|
export { HttpMethod, LowerHttpMethod, RemoveUndefined };
|