@geekmidas/constructs 10.0.0-alpha.2 → 10.0.0-alpha.21
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 +46 -3
- package/dist/{Construct-Ct8nalEi.d.mts → Construct-DTqYvkPG.d.cts} +11 -13
- package/dist/Construct-DTqYvkPG.d.cts.map +1 -0
- package/dist/{Construct-BD5neF7w.mjs → Construct-Detz65RA.mjs} +31 -29
- package/dist/Construct-Detz65RA.mjs.map +1 -0
- package/dist/{Construct-C0ijr2qp.d.cts → Construct-pVadmURD.d.mts} +10 -12
- package/dist/Construct-pVadmURD.d.mts.map +1 -0
- package/dist/{Construct-CyS3RpTL.cjs → Construct-yG9Sw-5p.cjs} +51 -43
- package/dist/Construct-yG9Sw-5p.cjs.map +1 -0
- package/dist/{Cron-ByxdOfpE.d.mts → Cron-AYpQq725.d.mts} +13 -6
- package/dist/Cron-AYpQq725.d.mts.map +1 -0
- package/dist/{Cron-Wqh464aO.d.cts → Cron-Bdcg9OAL.d.cts} +12 -5
- package/dist/Cron-Bdcg9OAL.d.cts.map +1 -0
- package/dist/{CronBuilder-BL0AP6fs.d.mts → CronBuilder-DR21m9h2.d.cts} +7 -10
- package/dist/CronBuilder-DR21m9h2.d.cts.map +1 -0
- package/dist/{CronBuilder-BqpEzMPQ.d.cts → CronBuilder-DeBnPVIT.d.mts} +7 -10
- package/dist/CronBuilder-DeBnPVIT.d.mts.map +1 -0
- package/dist/{CronBuilder-BmABazzH.mjs → CronBuilder-vkjuo1UP.mjs} +23 -15
- package/dist/CronBuilder-vkjuo1UP.mjs.map +1 -0
- package/dist/{CronBuilder-CkXPJiGO.cjs → CronBuilder-zdTdaT-e.cjs} +33 -25
- package/dist/CronBuilder-zdTdaT-e.cjs.map +1 -0
- package/dist/{Endpoint-2Wg7T7Cq.d.mts → Endpoint-BxkRWQ8G.d.mts} +63 -84
- package/dist/Endpoint-BxkRWQ8G.d.mts.map +1 -0
- package/dist/{Endpoint-BiaaMEn_.cjs → Endpoint-CtiPUpRX.cjs} +145 -131
- package/dist/Endpoint-CtiPUpRX.cjs.map +1 -0
- package/dist/{Endpoint-VIOpSo0S.mjs → Endpoint-DCr5tlbJ.mjs} +117 -109
- package/dist/Endpoint-DCr5tlbJ.mjs.map +1 -0
- package/dist/{Endpoint-CH9Fn1AD.d.cts → Endpoint-DbYQJgb-.d.cts} +61 -82
- package/dist/Endpoint-DbYQJgb-.d.cts.map +1 -0
- package/dist/{EndpointFactory-DTTCkGEL.mjs → EndpointFactory-Bs8pu-yY.mjs} +20 -29
- package/dist/EndpointFactory-Bs8pu-yY.mjs.map +1 -0
- package/dist/{index-BxHDdy6a.d.mts → EndpointFactory-DE6nKtFZ.d.cts} +12 -92
- package/dist/EndpointFactory-DE6nKtFZ.d.cts.map +1 -0
- package/dist/{index-V2nksZIJ.d.cts → EndpointFactory-T06kTFHg.d.mts} +12 -92
- package/dist/EndpointFactory-T06kTFHg.d.mts.map +1 -0
- package/dist/{EndpointFactory-ChxLZllA.cjs → EndpointFactory-vE2C1NG1.cjs} +57 -66
- package/dist/EndpointFactory-vE2C1NG1.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-NKQQQbBY.mjs → HonoEndpointAdaptor-Be6UdK0r.mjs} +40 -47
- package/dist/{HonoEndpointAdaptor-D233Jvpk.cjs.map → HonoEndpointAdaptor-Be6UdK0r.mjs.map} +1 -1
- package/dist/{HonoEndpointAdaptor-D233Jvpk.cjs → HonoEndpointAdaptor-C9aivwKl.cjs} +48 -52
- package/dist/HonoEndpointAdaptor-C9aivwKl.cjs.map +1 -0
- package/dist/{Queue-D7ZuwBhy.d.cts → Queue-Bhzi2WQC.d.cts} +8 -9
- package/dist/Queue-Bhzi2WQC.d.cts.map +1 -0
- package/dist/{Queue-gVGfi2Yk.d.mts → Queue-BoUA-e83.d.mts} +9 -10
- package/dist/Queue-BoUA-e83.d.mts.map +1 -0
- package/dist/{Subscriber-2mEi0ImH.d.cts → Subscriber-CIO3pwji.d.mts} +7 -8
- package/dist/Subscriber-CIO3pwji.d.mts.map +1 -0
- package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-DQCaiOXF.d.cts} +7 -8
- package/dist/Subscriber-DQCaiOXF.d.cts.map +1 -0
- package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-B4YRTBng.mjs} +16 -10
- package/dist/SubscriberBuilder-B4YRTBng.mjs.map +1 -0
- package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-C2bCOuPT.cjs} +28 -23
- package/dist/SubscriberBuilder-C2bCOuPT.cjs.map +1 -0
- package/dist/{SubscriberBuilder-Dptmo-1A.d.mts → SubscriberBuilder-ChX5v948.d.cts} +8 -11
- package/dist/SubscriberBuilder-ChX5v948.d.cts.map +1 -0
- package/dist/{SubscriberBuilder-waNhzjSM.d.cts → SubscriberBuilder-Dbiaskfi.d.mts} +8 -11
- package/dist/SubscriberBuilder-Dbiaskfi.d.mts.map +1 -0
- package/dist/{Topic-19QeHBIR.d.cts → Topic-D6blllEn.d.cts} +5 -7
- package/dist/Topic-D6blllEn.d.cts.map +1 -0
- package/dist/{Topic-DuFeqkBh.d.mts → Topic-DVvheJ_-.d.mts} +6 -8
- package/dist/Topic-DVvheJ_-.d.mts.map +1 -0
- package/dist/adaptors/aws.cjs +87 -106
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +14 -27
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +16 -29
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +60 -81
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +3 -10
- package/dist/adaptors/hono.d.cts +5 -13
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +7 -15
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +2 -10
- package/dist/adaptors/testing.cjs +271 -82
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +62 -33
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +63 -34
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +249 -63
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-BlO8MUkR.d.cts +123 -0
- package/dist/auth-BlO8MUkR.d.cts.map +1 -0
- package/dist/auth-CHWIdcQO.d.mts +123 -0
- package/dist/auth-CHWIdcQO.d.mts.map +1 -0
- package/dist/auth.cjs +41 -16
- 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 +32 -8
- package/dist/auth.mjs.map +1 -1
- package/dist/{cache-BrRz3fEB.d.mts → cache-AgQUMma6.d.mts} +3 -6
- package/dist/cache-AgQUMma6.d.mts.map +1 -0
- package/dist/{cache-BtZY_tHe.d.cts → cache-obq0fOIM.d.cts} +3 -6
- package/dist/cache-obq0fOIM.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/{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-g5GM5pwR.d.mts → construct-interface-Clz7_BwB.d.mts} +15 -6
- package/dist/construct-interface-Clz7_BwB.d.mts.map +1 -0
- package/dist/{construct-interface-D9d4Gm4p.d.cts → construct-interface-DIaTNKax.d.cts} +15 -6
- package/dist/construct-interface-DIaTNKax.d.cts.map +1 -0
- package/dist/construct-interface.cjs +87 -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 +81 -2
- package/dist/construct-interface.mjs.map +1 -0
- package/dist/credential.cjs +43 -9
- package/dist/credential.cjs.map +1 -1
- package/dist/credential.d.cts +5 -8
- package/dist/credential.d.cts.map +1 -1
- package/dist/credential.d.mts +5 -8
- package/dist/credential.d.mts.map +1 -1
- package/dist/credential.mjs +36 -2
- package/dist/credential.mjs.map +1 -1
- package/dist/crons/index.cjs +68 -10
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +32 -14
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +32 -14
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +66 -10
- package/dist/crons/index.mjs.map +1 -1
- package/dist/database/kysely.cjs +28 -14
- package/dist/database/kysely.cjs.map +1 -1
- package/dist/database/kysely.d.cts +2 -152
- package/dist/database/kysely.d.mts +2 -152
- package/dist/database/kysely.mjs +16 -4
- package/dist/database/kysely.mjs.map +1 -1
- 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/endpoints/index.cjs +7 -10
- package/dist/endpoints/index.d.cts +60 -7
- package/dist/endpoints/index.d.cts.map +1 -0
- package/dist/endpoints/index.d.mts +60 -7
- package/dist/endpoints/index.d.mts.map +1 -0
- package/dist/endpoints/index.mjs +5 -10
- 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 +2 -4
- package/dist/functions/index.d.mts +2 -4
- package/dist/functions/index.mjs +2 -6
- package/dist/{functions-Bd3TPxid.cjs → functions-VnOTEp74.cjs} +309 -264
- package/dist/functions-VnOTEp74.cjs.map +1 -0
- package/dist/{functions-Cxbo-pEd.mjs → functions-faoJOUmr.mjs} +282 -234
- package/dist/functions-faoJOUmr.mjs.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-JSf9xNIJ.d.cts → index-DU3Twmwh.d.mts} +19 -24
- package/dist/index-DU3Twmwh.d.mts.map +1 -0
- package/dist/index-fnpjXiA-.d.mts +26 -0
- package/dist/index-fnpjXiA-.d.mts.map +1 -0
- package/dist/{index-CubPzHd9.d.mts → index-nBQT1tAh.d.cts} +19 -24
- package/dist/index-nBQT1tAh.d.cts.map +1 -0
- package/dist/index-tE_119SX.d.cts +26 -0
- package/dist/index-tE_119SX.d.cts.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +2 -3
- package/dist/kysely-CXi49zc2.d.cts +150 -0
- package/dist/kysely-CXi49zc2.d.cts.map +1 -0
- package/dist/kysely-D3-G5b0j.d.mts +150 -0
- package/dist/kysely-D3-G5b0j.d.mts.map +1 -0
- package/dist/{lazyAccessors-BoJN3SMd.mjs → lazyAccessors-BHtcqgz2.mjs} +22 -25
- package/dist/lazyAccessors-BHtcqgz2.mjs.map +1 -0
- package/dist/{lazyAccessors-e3j2oE2m.cjs → lazyAccessors-Dx9NLwJZ.cjs} +72 -76
- package/dist/lazyAccessors-Dx9NLwJZ.cjs.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-Dmts9H_b.mjs → processAudits-BpRlPQMW.mjs} +16 -19
- package/dist/processAudits-BpRlPQMW.mjs.map +1 -0
- package/dist/{processAudits-CGqttuXm.cjs → processAudits-D_2W5x8k.cjs} +26 -30
- package/dist/processAudits-D_2W5x8k.cjs.map +1 -0
- package/dist/queue/index.cjs +25 -21
- package/dist/queue/index.cjs.map +1 -1
- package/dist/queue/index.d.cts +8 -15
- package/dist/queue/index.d.cts.map +1 -1
- package/dist/queue/index.d.mts +8 -15
- package/dist/queue/index.d.mts.map +1 -1
- package/dist/queue/index.mjs +15 -11
- package/dist/queue/index.mjs.map +1 -1
- package/dist/rest-api.cjs +88 -62
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +62 -60
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +62 -60
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +80 -54
- package/dist/rest-api.mjs.map +1 -1
- package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
- package/dist/site.cjs +33 -9
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +11 -22
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +11 -22
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +29 -5
- package/dist/site.mjs.map +1 -1
- package/dist/subscribers/index.cjs +2 -11
- package/dist/subscribers/index.d.cts +3 -14
- package/dist/subscribers/index.d.mts +3 -14
- package/dist/subscribers/index.mjs +2 -11
- 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-C3L0iS28.d.cts → telemetry-DGcFlVpB.d.cts} +2 -5
- package/dist/telemetry-DGcFlVpB.d.cts.map +1 -0
- package/dist/{telemetry-D7bVFLGi.d.mts → telemetry-DGcFlVpB.d.mts} +2 -5
- package/dist/telemetry-DGcFlVpB.d.mts.map +1 -0
- package/dist/topic/index.cjs +18 -20
- package/dist/topic/index.cjs.map +1 -1
- package/dist/topic/index.d.cts +3 -32
- package/dist/topic/index.d.mts +3 -32
- package/dist/topic/index.mjs +8 -10
- package/dist/topic/index.mjs.map +1 -1
- 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 +109 -35
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +87 -42
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +87 -42
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +104 -30
- package/dist/worker.mjs.map +1 -1
- package/package.json +59 -55
- package/dist/Construct-BD5neF7w.mjs.map +0 -1
- package/dist/Construct-C0ijr2qp.d.cts.map +0 -1
- package/dist/Construct-Ct8nalEi.d.mts.map +0 -1
- package/dist/Construct-CyS3RpTL.cjs.map +0 -1
- package/dist/Cron-ByxdOfpE.d.mts.map +0 -1
- package/dist/Cron-Wqh464aO.d.cts.map +0 -1
- package/dist/CronBuilder-BL0AP6fs.d.mts.map +0 -1
- package/dist/CronBuilder-BmABazzH.mjs.map +0 -1
- package/dist/CronBuilder-BqpEzMPQ.d.cts.map +0 -1
- package/dist/CronBuilder-CkXPJiGO.cjs.map +0 -1
- package/dist/Endpoint-2Wg7T7Cq.d.mts.map +0 -1
- package/dist/Endpoint-BiaaMEn_.cjs.map +0 -1
- package/dist/Endpoint-CH9Fn1AD.d.cts.map +0 -1
- package/dist/Endpoint-VIOpSo0S.mjs.map +0 -1
- package/dist/EndpointFactory-ChxLZllA.cjs.map +0 -1
- package/dist/EndpointFactory-DTTCkGEL.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-NKQQQbBY.mjs.map +0 -1
- package/dist/Queue-D7ZuwBhy.d.cts.map +0 -1
- package/dist/Queue-gVGfi2Yk.d.mts.map +0 -1
- package/dist/Subscriber-2mEi0ImH.d.cts.map +0 -1
- package/dist/Subscriber-xTJ9ayPN.d.mts.map +0 -1
- package/dist/SubscriberBuilder-4OPehf2R.cjs.map +0 -1
- package/dist/SubscriberBuilder-BjkbeT9l.mjs.map +0 -1
- package/dist/SubscriberBuilder-Dptmo-1A.d.mts.map +0 -1
- package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +0 -1
- package/dist/Topic-19QeHBIR.d.cts.map +0 -1
- package/dist/Topic-DuFeqkBh.d.mts.map +0 -1
- package/dist/auth.d.cts.map +0 -1
- package/dist/auth.d.mts.map +0 -1
- package/dist/cache-0ANvRQnD.mjs +0 -51
- package/dist/cache-0ANvRQnD.mjs.map +0 -1
- package/dist/cache-3WSvAulx.cjs +0 -57
- package/dist/cache-3WSvAulx.cjs.map +0 -1
- package/dist/cache-BrRz3fEB.d.mts.map +0 -1
- package/dist/cache-BtZY_tHe.d.cts.map +0 -1
- package/dist/clone-DblgEZZa.mjs.map +0 -1
- package/dist/clone-Dy0cR2SZ.cjs.map +0 -1
- package/dist/construct-interface-BfjcOD_E.cjs +0 -117
- package/dist/construct-interface-BfjcOD_E.cjs.map +0 -1
- package/dist/construct-interface-D9d4Gm4p.d.cts.map +0 -1
- package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
- package/dist/construct-interface-Z4CpS8tK.mjs.map +0 -1
- package/dist/construct-interface-g5GM5pwR.d.mts.map +0 -1
- package/dist/database/kysely.d.cts.map +0 -1
- package/dist/database/kysely.d.mts.map +0 -1
- package/dist/functions-Bd3TPxid.cjs.map +0 -1
- package/dist/functions-Cxbo-pEd.mjs.map +0 -1
- package/dist/index-BxHDdy6a.d.mts.map +0 -1
- package/dist/index-CubPzHd9.d.mts.map +0 -1
- package/dist/index-JSf9xNIJ.d.cts.map +0 -1
- package/dist/index-V2nksZIJ.d.cts.map +0 -1
- package/dist/lazyAccessors-BoJN3SMd.mjs.map +0 -1
- package/dist/lazyAccessors-e3j2oE2m.cjs.map +0 -1
- package/dist/processAudits-CGqttuXm.cjs.map +0 -1
- package/dist/processAudits-Dmts9H_b.mjs.map +0 -1
- package/dist/subscribers/index.cjs.map +0 -1
- package/dist/subscribers/index.d.cts.map +0 -1
- package/dist/subscribers/index.d.mts.map +0 -1
- package/dist/subscribers/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.d.cts.map +0 -1
- package/dist/topic/index.d.mts.map +0 -1
- package/dist/types-BlAkSuGI.d.cts.map +0 -1
- package/dist/types-aKksMEWL.d.mts.map +0 -1
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../
|
|
3
|
-
import {
|
|
4
|
-
import "../
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { BetterAuth } from "../auth.mjs";
|
|
2
|
+
import { t as FunctionBuilder } from "../functions-faoJOUmr.mjs";
|
|
3
|
+
import { n as ResponseBuilder, t as Endpoint } from "../Endpoint-DCr5tlbJ.mjs";
|
|
4
|
+
import { Email } from "../email.mjs";
|
|
5
|
+
import { KyselyDatabase } from "../database/kysely.mjs";
|
|
6
|
+
import { c as createObjectHeaders, l as publishConstructEvents, r as createCookieHeaderAccessor, u as publishEvents } from "../lazyAccessors-BHtcqgz2.mjs";
|
|
7
|
+
import { t as HonoEndpoint } from "../HonoEndpointAdaptor-Be6UdK0r.mjs";
|
|
8
|
+
import { n as executeWithAuditTransaction } from "../processAudits-BpRlPQMW.mjs";
|
|
9
|
+
import { provideKey } from "@geekmidas/manifest";
|
|
9
10
|
import { ForbiddenError } from "@geekmidas/errors";
|
|
10
11
|
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
11
|
-
import { ServiceDiscovery, runWithRequestContext } from "@geekmidas/services";
|
|
12
|
-
import { DefaultAuditor } from "@geekmidas/audit";
|
|
12
|
+
import { ServiceDiscovery, runWithRequestContext, serviceContext } from "@geekmidas/services";
|
|
13
13
|
import { Hono } from "hono";
|
|
14
|
+
import { DefaultAuditor } from "@geekmidas/audit";
|
|
15
|
+
import { TEST_CONTEXT_HEADER, currentTestContext, installContextFetch, runAsServer, runInTestContext, testContextOf } from "@geekmidas/testkit/context";
|
|
14
16
|
import { http } from "msw";
|
|
15
|
-
|
|
17
|
+
import { randomUUID } from "node:crypto";
|
|
18
|
+
import { Browser } from "@geekmidas/testkit/browser";
|
|
19
|
+
import { createMailbox } from "@geekmidas/testkit/mailbox";
|
|
20
|
+
import { TransactionRegistry } from "@geekmidas/testkit/transactions";
|
|
21
|
+
import { setupServer } from "msw/node";
|
|
22
|
+
import { afterAll, beforeAll, test } from "vitest";
|
|
16
23
|
//#region src/endpoints/MswEndpointAdaptor.ts
|
|
17
|
-
/**
|
|
18
|
-
* Header used to identify which test context a request belongs to.
|
|
19
|
-
* Each concurrent test registers its own context (services, db transaction, etc.)
|
|
20
|
-
* and the MSW handler looks it up by this header value.
|
|
21
|
-
*/
|
|
22
|
-
const TEST_CONTEXT_HEADER = "x-test-context-id";
|
|
23
24
|
const MSW_HTTP_METHODS = [
|
|
24
25
|
"get",
|
|
25
26
|
"post",
|
|
@@ -111,7 +112,6 @@ function createMswHandlers(endpoints, options) {
|
|
|
111
112
|
registerContext
|
|
112
113
|
};
|
|
113
114
|
}
|
|
114
|
-
|
|
115
115
|
//#endregion
|
|
116
116
|
//#region src/endpoints/TestEndpointAdaptor.ts
|
|
117
117
|
/**
|
|
@@ -131,6 +131,8 @@ function serializeCookie(name, value, options) {
|
|
|
131
131
|
return cookieString;
|
|
132
132
|
}
|
|
133
133
|
var TestEndpointAdaptor = class TestEndpointAdaptor {
|
|
134
|
+
endpoint;
|
|
135
|
+
serviceDiscovery;
|
|
134
136
|
static getDefaultServiceDiscover(_endpoint) {
|
|
135
137
|
return ServiceDiscovery.getInstance(new EnvironmentParser({}));
|
|
136
138
|
}
|
|
@@ -165,7 +167,7 @@ var TestEndpointAdaptor = class TestEndpointAdaptor {
|
|
|
165
167
|
cookie,
|
|
166
168
|
...rawDb !== void 0 && { db: rawDb }
|
|
167
169
|
});
|
|
168
|
-
|
|
170
|
+
if (!await this.endpoint.authorize({
|
|
169
171
|
header,
|
|
170
172
|
cookie,
|
|
171
173
|
services: ctx.services,
|
|
@@ -175,8 +177,7 @@ var TestEndpointAdaptor = class TestEndpointAdaptor {
|
|
|
175
177
|
body,
|
|
176
178
|
query,
|
|
177
179
|
params
|
|
178
|
-
})
|
|
179
|
-
if (!isAuthorized) {
|
|
180
|
+
})) {
|
|
180
181
|
logger.warn("Forbidden access attempt");
|
|
181
182
|
throw new ForbiddenError("Forbidden access to the endpoint", "You do not have permission to access this resource.");
|
|
182
183
|
}
|
|
@@ -198,24 +199,22 @@ var TestEndpointAdaptor = class TestEndpointAdaptor {
|
|
|
198
199
|
} catch (error) {
|
|
199
200
|
logger.error(error, "Failed to extract actor for audits");
|
|
200
201
|
}
|
|
201
|
-
const auditor = new DefaultAuditor({
|
|
202
|
-
actor,
|
|
203
|
-
storage: auditorStorage,
|
|
204
|
-
metadata: {
|
|
205
|
-
endpoint: this.endpoint.route,
|
|
206
|
-
method: this.endpoint.method
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
202
|
auditContext = {
|
|
210
|
-
auditor
|
|
203
|
+
auditor: new DefaultAuditor({
|
|
204
|
+
actor,
|
|
205
|
+
storage: auditorStorage,
|
|
206
|
+
metadata: {
|
|
207
|
+
endpoint: this.endpoint.route,
|
|
208
|
+
method: this.endpoint.method
|
|
209
|
+
}
|
|
210
|
+
}),
|
|
211
211
|
storage: auditorStorage
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
const audits = this.endpoint.audits;
|
|
215
215
|
if (!auditContext && audits?.length) logger.warn("No auditor storage service available");
|
|
216
|
-
const
|
|
217
|
-
const
|
|
218
|
-
const db = trx ?? rawDb;
|
|
216
|
+
const { output, metadata } = await executeWithAuditTransaction(auditContext, async (auditor) => {
|
|
217
|
+
const db = auditor?.getTransaction?.() ?? rawDb;
|
|
219
218
|
const responseBuilder = new ResponseBuilder();
|
|
220
219
|
const response = await this.endpoint.handler({
|
|
221
220
|
body,
|
|
@@ -230,36 +229,34 @@ var TestEndpointAdaptor = class TestEndpointAdaptor {
|
|
|
230
229
|
db
|
|
231
230
|
}, responseBuilder);
|
|
232
231
|
let data = response;
|
|
233
|
-
let metadata
|
|
232
|
+
let metadata = responseBuilder.getMetadata();
|
|
234
233
|
if (Endpoint.hasMetadata(response)) {
|
|
235
234
|
data = response.data;
|
|
236
|
-
metadata
|
|
235
|
+
metadata = response.metadata;
|
|
237
236
|
}
|
|
238
|
-
const output$1 = await this.endpoint.parseOutput(data);
|
|
239
237
|
return {
|
|
240
|
-
output:
|
|
241
|
-
metadata
|
|
238
|
+
output: await this.endpoint.parseOutput(data),
|
|
239
|
+
metadata,
|
|
242
240
|
responseBuilder
|
|
243
241
|
};
|
|
244
|
-
}, async (result
|
|
242
|
+
}, async (result, auditor) => {
|
|
245
243
|
if (!audits?.length) return;
|
|
246
244
|
for (const audit of audits) {
|
|
247
|
-
if (audit.when && !audit.when(result
|
|
248
|
-
const payload = audit.payload(result
|
|
249
|
-
const entityId = audit.entityId?.(result
|
|
245
|
+
if (audit.when && !audit.when(result.output)) continue;
|
|
246
|
+
const payload = audit.payload(result.output);
|
|
247
|
+
const entityId = audit.entityId?.(result.output);
|
|
250
248
|
auditor.audit(audit.type, payload, {
|
|
251
249
|
table: audit.table,
|
|
252
250
|
entityId
|
|
253
251
|
});
|
|
254
252
|
}
|
|
255
253
|
}, { db: rawDb });
|
|
256
|
-
const { output, metadata } = result;
|
|
257
254
|
ctx.publisher && await this.serviceDiscovery.register([ctx.publisher]);
|
|
258
255
|
await publishConstructEvents(this.endpoint, output, this.serviceDiscovery);
|
|
259
256
|
const headers = { ...metadata.headers || {} };
|
|
260
257
|
if (metadata.cookies && metadata.cookies.size > 0) {
|
|
261
258
|
const setCookieValues = [];
|
|
262
|
-
for (const [name, cookie
|
|
259
|
+
for (const [name, cookie] of metadata.cookies.entries()) setCookieValues.push(serializeCookie(name, cookie.value, cookie.options));
|
|
263
260
|
headers["set-cookie"] = setCookieValues;
|
|
264
261
|
}
|
|
265
262
|
return {
|
|
@@ -270,14 +267,14 @@ var TestEndpointAdaptor = class TestEndpointAdaptor {
|
|
|
270
267
|
});
|
|
271
268
|
}
|
|
272
269
|
async request(ctx) {
|
|
273
|
-
|
|
274
|
-
return response.body;
|
|
270
|
+
return (await this.fullRequest(ctx)).body;
|
|
275
271
|
}
|
|
276
272
|
};
|
|
277
|
-
|
|
278
273
|
//#endregion
|
|
279
274
|
//#region src/functions/TestFunctionAdaptor.ts
|
|
280
275
|
var TestFunctionAdaptor = class TestFunctionAdaptor {
|
|
276
|
+
fn;
|
|
277
|
+
serviceDiscovery;
|
|
281
278
|
static getDefaultServiceDiscovery(_fn) {
|
|
282
279
|
return ServiceDiscovery.getInstance(new EnvironmentParser({}));
|
|
283
280
|
}
|
|
@@ -293,15 +290,11 @@ var TestFunctionAdaptor = class TestFunctionAdaptor {
|
|
|
293
290
|
else services = await this.serviceDiscovery.register(this.fn.services);
|
|
294
291
|
let db;
|
|
295
292
|
if ("db" in ctx && ctx.db !== void 0) db = ctx.db;
|
|
296
|
-
else if (this.fn.databaseService)
|
|
297
|
-
const dbServices = await this.serviceDiscovery.register([this.fn.databaseService]);
|
|
298
|
-
db = dbServices[this.fn.databaseService.serviceName];
|
|
299
|
-
}
|
|
293
|
+
else if (this.fn.databaseService) db = (await this.serviceDiscovery.register([this.fn.databaseService]))[this.fn.databaseService.serviceName];
|
|
300
294
|
let auditor;
|
|
301
295
|
if ("auditor" in ctx && ctx.auditor !== void 0) auditor = ctx.auditor;
|
|
302
296
|
else if (this.fn.auditorStorageService) {
|
|
303
|
-
const
|
|
304
|
-
const storage = auditServices[this.fn.auditorStorageService.serviceName];
|
|
297
|
+
const storage = (await this.serviceDiscovery.register([this.fn.auditorStorageService]))[this.fn.auditorStorageService.serviceName];
|
|
305
298
|
auditor = new DefaultAuditor({
|
|
306
299
|
actor: {
|
|
307
300
|
id: "system",
|
|
@@ -315,11 +308,10 @@ var TestFunctionAdaptor = class TestFunctionAdaptor {
|
|
|
315
308
|
});
|
|
316
309
|
}
|
|
317
310
|
const requestId = `test-${Date.now()}`;
|
|
318
|
-
const startTime = Date.now();
|
|
319
311
|
return runWithRequestContext({
|
|
320
312
|
logger,
|
|
321
313
|
requestId,
|
|
322
|
-
startTime
|
|
314
|
+
startTime: Date.now()
|
|
323
315
|
}, async () => {
|
|
324
316
|
const response = await this.fn.fn({
|
|
325
317
|
input: parsedInput,
|
|
@@ -341,7 +333,6 @@ var TestFunctionAdaptor = class TestFunctionAdaptor {
|
|
|
341
333
|
});
|
|
342
334
|
}
|
|
343
335
|
};
|
|
344
|
-
|
|
345
336
|
//#endregion
|
|
346
337
|
//#region src/queue/TestQueueAdaptor.ts
|
|
347
338
|
/**
|
|
@@ -354,6 +345,8 @@ var TestFunctionAdaptor = class TestFunctionAdaptor {
|
|
|
354
345
|
* await adapter.invoke({ messages: [{ orderId: '123' }] });
|
|
355
346
|
*/
|
|
356
347
|
var TestQueueAdaptor = class TestQueueAdaptor {
|
|
348
|
+
queue;
|
|
349
|
+
serviceDiscovery;
|
|
357
350
|
static getDefaultServiceDiscovery() {
|
|
358
351
|
return ServiceDiscovery.getInstance(new EnvironmentParser({}));
|
|
359
352
|
}
|
|
@@ -365,11 +358,10 @@ var TestQueueAdaptor = class TestQueueAdaptor {
|
|
|
365
358
|
const logger = this.queue.logger.child({ test: true });
|
|
366
359
|
const services = request.services ?? await this.serviceDiscovery.register(this.queue.services);
|
|
367
360
|
const requestId = `test-${Date.now()}`;
|
|
368
|
-
const startTime = Date.now();
|
|
369
361
|
return runWithRequestContext({
|
|
370
362
|
logger,
|
|
371
363
|
requestId,
|
|
372
|
-
startTime
|
|
364
|
+
startTime: Date.now()
|
|
373
365
|
}, () => this.queue.handler({
|
|
374
366
|
messages: request.messages,
|
|
375
367
|
services,
|
|
@@ -377,10 +369,11 @@ var TestQueueAdaptor = class TestQueueAdaptor {
|
|
|
377
369
|
}));
|
|
378
370
|
}
|
|
379
371
|
};
|
|
380
|
-
|
|
381
372
|
//#endregion
|
|
382
373
|
//#region src/subscribers/TestSubscriberAdaptor.ts
|
|
383
374
|
var TestSubscriberAdaptor = class TestSubscriberAdaptor {
|
|
375
|
+
subscriber;
|
|
376
|
+
serviceDiscovery;
|
|
384
377
|
static getDefaultServiceDiscovery() {
|
|
385
378
|
return ServiceDiscovery.getInstance(new EnvironmentParser({}));
|
|
386
379
|
}
|
|
@@ -396,11 +389,10 @@ var TestSubscriberAdaptor = class TestSubscriberAdaptor {
|
|
|
396
389
|
const filteredEvents = this.filterEvents(request.events);
|
|
397
390
|
if (filteredEvents.length === 0) return { batchItemFailures: [] };
|
|
398
391
|
const requestId = `test-${Date.now()}`;
|
|
399
|
-
const startTime = Date.now();
|
|
400
392
|
return runWithRequestContext({
|
|
401
393
|
logger,
|
|
402
394
|
requestId,
|
|
403
|
-
startTime
|
|
395
|
+
startTime: Date.now()
|
|
404
396
|
}, async () => {
|
|
405
397
|
const result = await this.subscriber.handler({
|
|
406
398
|
events: filteredEvents,
|
|
@@ -422,7 +414,201 @@ var TestSubscriberAdaptor = class TestSubscriberAdaptor {
|
|
|
422
414
|
return events.filter((event) => this.subscriber.subscribedEvents.includes(event.type));
|
|
423
415
|
}
|
|
424
416
|
};
|
|
425
|
-
|
|
426
417
|
//#endregion
|
|
427
|
-
|
|
418
|
+
//#region src/testing/featureTest.ts
|
|
419
|
+
/**
|
|
420
|
+
* `featureTest`: an app, driven the way it runs deployed.
|
|
421
|
+
*
|
|
422
|
+
* A browser signs in and calls the API; the API calls the auth server; each
|
|
423
|
+
* over its URL, each database in its own transaction. Nothing runs as a server:
|
|
424
|
+
* every URL an app's constructs answer on is served in-process through MSW,
|
|
425
|
+
* from the real handler, for the test that made the request. Everything else
|
|
426
|
+
* with a real local equivalent — Postgres, Mailpit, MinIO — is used directly.
|
|
427
|
+
*
|
|
428
|
+
* ```ts
|
|
429
|
+
* // test/config.ts
|
|
430
|
+
* export const it = featureTest({
|
|
431
|
+
* modules: import.meta.glob(['../../constructs/*.ts', '../src/endpoints/**\/*.ts'], { eager: true }),
|
|
432
|
+
* database,
|
|
433
|
+
* browser: Browser,
|
|
434
|
+
* });
|
|
435
|
+
*
|
|
436
|
+
* // a test
|
|
437
|
+
* it('shows the signed-in user their profile', async ({ browser, mailbox }) => {
|
|
438
|
+
* await browser.auth.signIn.magicLink({ email: 'ada@shop.test' });
|
|
439
|
+
* await browser.visit((await mailbox('ada@shop.test').last()).link!);
|
|
440
|
+
* expect(await browser.api.get('/profile')).toMatchObject({ email: 'ada@shop.test' });
|
|
441
|
+
* });
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
444
|
+
/** Every test in flight in this process, by id. */
|
|
445
|
+
const contexts = /* @__PURE__ */ new Map();
|
|
446
|
+
/** Databases already resolving to test transactions — patched once each. */
|
|
447
|
+
const bound = /* @__PURE__ */ new WeakSet();
|
|
448
|
+
function featureTest(options) {
|
|
449
|
+
const env = options.env ?? process.env;
|
|
450
|
+
const envParser = new EnvironmentParser({ ...env });
|
|
451
|
+
const found = discover(options.modules);
|
|
452
|
+
const BrowserClass = options.browser ?? Browser;
|
|
453
|
+
for (const database of found.databases) bindToTests(database);
|
|
454
|
+
const network = setupServer(...surfaceHandlers(found.endpoints, env), ...found.auths.map((auth) => authHandler(auth, env, envParser)));
|
|
455
|
+
const inbox = found.emails.map((email) => env[provideKey(email.id, "inboxUrl")]).find(Boolean);
|
|
456
|
+
const readMail = inbox ? createMailbox({ inbox }) : void 0;
|
|
457
|
+
let restoreFetch = () => {};
|
|
458
|
+
beforeAll(() => {
|
|
459
|
+
network.listen({ onUnhandledRequest(request, print) {
|
|
460
|
+
if (isLocal(new URL(request.url))) return;
|
|
461
|
+
print.error();
|
|
462
|
+
} });
|
|
463
|
+
restoreFetch = installContextFetch();
|
|
464
|
+
});
|
|
465
|
+
afterAll(() => {
|
|
466
|
+
restoreFetch();
|
|
467
|
+
network.close();
|
|
468
|
+
});
|
|
469
|
+
const run = (fn) => async () => {
|
|
470
|
+
const id = randomUUID();
|
|
471
|
+
const state = {
|
|
472
|
+
transactions: new TransactionRegistry(),
|
|
473
|
+
discovery: new ServiceDiscovery(envParser),
|
|
474
|
+
surfaces: /* @__PURE__ */ new Map(),
|
|
475
|
+
auth: /* @__PURE__ */ new Map(),
|
|
476
|
+
addresses: /* @__PURE__ */ new Set()
|
|
477
|
+
};
|
|
478
|
+
contexts.set(id, state);
|
|
479
|
+
try {
|
|
480
|
+
await runInTestContext(id, async () => {
|
|
481
|
+
const browser = new BrowserClass();
|
|
482
|
+
const restore = browser.install();
|
|
483
|
+
try {
|
|
484
|
+
await fn({
|
|
485
|
+
browser,
|
|
486
|
+
db: options.database ? await state.transactions.get(options.database.id, urlOf(options.database, envParser)) : void 0,
|
|
487
|
+
mailbox: (address) => {
|
|
488
|
+
if (!readMail) throw new NoInbox();
|
|
489
|
+
state.addresses.add(address);
|
|
490
|
+
return readMail(address);
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
} finally {
|
|
494
|
+
restore();
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
} finally {
|
|
498
|
+
contexts.delete(id);
|
|
499
|
+
await Promise.all([state.transactions.rollbackAll(), ...[...state.addresses].map((address) => readMail?.(address).clear())]);
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
const it = ((name, fn, timeout) => test(name, run(fn), timeout));
|
|
503
|
+
it.only = (name, fn, timeout) => test.only(name, run(fn), timeout);
|
|
504
|
+
it.skip = (name, fn, timeout) => test.skip(name, run(fn), timeout);
|
|
505
|
+
return it;
|
|
506
|
+
}
|
|
507
|
+
/** What an app's modules export, sorted by what a test does with it. */
|
|
508
|
+
function discover(modules) {
|
|
509
|
+
const values = (Array.isArray(modules) ? modules : Object.values(modules)).flatMap((module) => module && typeof module === "object" ? Object.values(module) : []);
|
|
510
|
+
return {
|
|
511
|
+
endpoints: values.filter((value) => Endpoint.isEndpoint(value)),
|
|
512
|
+
databases: values.filter((value) => value instanceof KyselyDatabase),
|
|
513
|
+
auths: values.filter((value) => value instanceof BetterAuth),
|
|
514
|
+
emails: values.filter((value) => value instanceof Email)
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Make a database resolve, inside a test, to that test's transaction.
|
|
519
|
+
*
|
|
520
|
+
* Everything reaches a database through its service — an endpoint through
|
|
521
|
+
* service discovery, the auth server through its tenant directly — so this is
|
|
522
|
+
* the one place a test's connection can be handed over. Outside a test it is
|
|
523
|
+
* the database it always was.
|
|
524
|
+
*/
|
|
525
|
+
function bindToTests(database) {
|
|
526
|
+
if (bound.has(database)) return;
|
|
527
|
+
bound.add(database);
|
|
528
|
+
const service = database.service;
|
|
529
|
+
const register = service.register;
|
|
530
|
+
service.register = (options) => {
|
|
531
|
+
const context = currentTestContext();
|
|
532
|
+
const state = context && contexts.get(context.id);
|
|
533
|
+
if (!state) return register(options);
|
|
534
|
+
return state.transactions.get(database.id, urlOf(database, options.envParser));
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
function urlOf(database, envParser) {
|
|
538
|
+
return envParser.create((get) => ({ url: get(provideKey(database.id, "url")).string() })).parse().url;
|
|
539
|
+
}
|
|
540
|
+
/** Each surface's endpoints, served at its URL for the test that asked. */
|
|
541
|
+
function surfaceHandlers(endpoints, env) {
|
|
542
|
+
const bySurface = /* @__PURE__ */ new Map();
|
|
543
|
+
for (const endpoint of endpoints) {
|
|
544
|
+
const surface = endpoint.surface?.id;
|
|
545
|
+
if (!surface) continue;
|
|
546
|
+
bySurface.set(surface, [...bySurface.get(surface) ?? [], endpoint]);
|
|
547
|
+
}
|
|
548
|
+
return [...bySurface].flatMap(([surface, served]) => {
|
|
549
|
+
const base = env[provideKey(surface, "url")];
|
|
550
|
+
if (!base) return [];
|
|
551
|
+
return http.all(`${trim(base)}/*`, ({ request }) => serve(request, async (state) => {
|
|
552
|
+
let app = state.surfaces.get(surface);
|
|
553
|
+
if (!app) {
|
|
554
|
+
app = Promise.resolve().then(() => {
|
|
555
|
+
const hono = new Hono();
|
|
556
|
+
HonoEndpoint.addRoutes(served, state.discovery, hono);
|
|
557
|
+
return hono;
|
|
558
|
+
});
|
|
559
|
+
state.surfaces.set(surface, app);
|
|
560
|
+
}
|
|
561
|
+
return (await app).fetch(request);
|
|
562
|
+
}));
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
/** An auth server, served at its URL, on the transaction of the test that asked. */
|
|
566
|
+
function authHandler(auth, env, envParser) {
|
|
567
|
+
const base = trim(env[provideKey(auth.id, "url")] ?? "");
|
|
568
|
+
return http.all(`${base}${auth.basePath}/*`, ({ request }) => serve(request, async (state) => {
|
|
569
|
+
let app = state.auth.get(auth);
|
|
570
|
+
if (!app) {
|
|
571
|
+
app = auth.server({
|
|
572
|
+
envParser,
|
|
573
|
+
context: serviceContext
|
|
574
|
+
}).then(({ app }) => app);
|
|
575
|
+
state.auth.set(auth, app);
|
|
576
|
+
}
|
|
577
|
+
return (await app).fetch(request);
|
|
578
|
+
}));
|
|
579
|
+
}
|
|
580
|
+
/** Handle a request as the server side of the test it was made for. */
|
|
581
|
+
async function serve(request, handle) {
|
|
582
|
+
const id = testContextOf(request);
|
|
583
|
+
const state = id ? contexts.get(id) : void 0;
|
|
584
|
+
if (!id || !state) throw new UnknownTestContext(request.url, id);
|
|
585
|
+
return runAsServer(id, () => handle(state));
|
|
586
|
+
}
|
|
587
|
+
function trim(url) {
|
|
588
|
+
return url.replace(/\/$/, "");
|
|
589
|
+
}
|
|
590
|
+
function isLocal(url) {
|
|
591
|
+
return url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname.endsWith(".localhost");
|
|
592
|
+
}
|
|
593
|
+
/** A request reached an in-process server without a test to belong to. */
|
|
594
|
+
var UnknownTestContext = class extends Error {
|
|
595
|
+
url;
|
|
596
|
+
id;
|
|
597
|
+
constructor(url, id) {
|
|
598
|
+
super(id ? `${url} was requested for test ${id}, which is not running. A request that outlives its test — an un-awaited call — lands here.` : `${url} was requested outside any test. Make the request inside a featureTest, so it reaches that test's transactions.`);
|
|
599
|
+
this.url = url;
|
|
600
|
+
this.id = id;
|
|
601
|
+
this.name = "UnknownTestContext";
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
/** `mailbox` was used in an app that declares no Email construct. */
|
|
605
|
+
var NoInbox = class extends Error {
|
|
606
|
+
constructor() {
|
|
607
|
+
super("mailbox() reads the inbox of the app's Email construct, and none was found in featureTest's modules — or `gkm test` did not inject its <ID>_INBOX_URL.");
|
|
608
|
+
this.name = "NoInbox";
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
//#endregion
|
|
612
|
+
export { NoInbox, TEST_CONTEXT_HEADER, TestEndpointAdaptor, TestFunctionAdaptor, TestQueueAdaptor, TestSubscriberAdaptor, UnknownTestContext, createMswHandlers, featureTest };
|
|
613
|
+
|
|
428
614
|
//# sourceMappingURL=testing.mjs.map
|