@geekmidas/constructs 10.0.0-alpha.4 → 10.0.0-alpha.40
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-BD5neF7w.mjs → Construct-BO1X-kt9.mjs} +32 -33
- package/dist/Construct-BO1X-kt9.mjs.map +1 -0
- package/dist/Construct-BQALFCh2.d.cts +230 -0
- package/dist/Construct-BQALFCh2.d.cts.map +1 -0
- package/dist/{Construct-CyS3RpTL.cjs → Construct-DmvXceVY.cjs} +52 -47
- package/dist/Construct-DmvXceVY.cjs.map +1 -0
- package/dist/Construct-QXnl3VqT.d.mts +230 -0
- package/dist/Construct-QXnl3VqT.d.mts.map +1 -0
- package/dist/{Cron-B2OFsfDM.d.cts → Cron-CMEGfRs8.d.cts} +21 -8
- package/dist/Cron-CMEGfRs8.d.cts.map +1 -0
- package/dist/{Cron-ByxdOfpE.d.mts → Cron-D6X4-xjB.d.mts} +21 -8
- package/dist/Cron-D6X4-xjB.d.mts.map +1 -0
- package/dist/CronBuilder-CEK7aOqD.d.cts +46 -0
- package/dist/CronBuilder-CEK7aOqD.d.cts.map +1 -0
- package/dist/CronBuilder-DB35T5dL.cjs +116 -0
- package/dist/CronBuilder-DB35T5dL.cjs.map +1 -0
- package/dist/CronBuilder-Dv0IlZs0.mjs +104 -0
- package/dist/CronBuilder-Dv0IlZs0.mjs.map +1 -0
- package/dist/CronBuilder-O_gvButp.d.mts +46 -0
- package/dist/CronBuilder-O_gvButp.d.mts.map +1 -0
- package/dist/{Endpoint-Dij_wOcc.mjs → Endpoint-CQAeh1Rh.mjs} +117 -109
- package/dist/Endpoint-CQAeh1Rh.mjs.map +1 -0
- package/dist/{Endpoint-DODn1RhN.cjs → Endpoint-D1L9qu5C.cjs} +145 -131
- package/dist/Endpoint-D1L9qu5C.cjs.map +1 -0
- package/dist/{Endpoint-2Wg7T7Cq.d.mts → Endpoint-Dp5AKIXl.d.cts} +69 -93
- package/dist/Endpoint-Dp5AKIXl.d.cts.map +1 -0
- package/dist/{Endpoint-DrD8a1yH.d.cts → Endpoint-DtI7heFm.d.mts} +70 -94
- package/dist/Endpoint-DtI7heFm.d.mts.map +1 -0
- package/dist/{EndpointFactory-b4ituq-s.mjs → EndpointFactory-BBdNeaGJ.mjs} +39 -74
- package/dist/EndpointFactory-BBdNeaGJ.mjs.map +1 -0
- package/dist/{EndpointFactory-BHFMmFkV.cjs → EndpointFactory-BZOCOaK6.cjs} +75 -110
- package/dist/EndpointFactory-BZOCOaK6.cjs.map +1 -0
- package/dist/{index-BxHDdy6a.d.mts → EndpointFactory-CgMDvERK.d.mts} +63 -133
- package/dist/EndpointFactory-CgMDvERK.d.mts.map +1 -0
- package/dist/{index-B8g8POkr.d.cts → EndpointFactory-FeFRmlDZ.d.cts} +62 -132
- package/dist/EndpointFactory-FeFRmlDZ.d.cts.map +1 -0
- package/dist/{HonoEndpointAdaptor-BM2jbWht.mjs → HonoEndpointAdaptor-Aui-x9Lg.mjs} +41 -47
- package/dist/HonoEndpointAdaptor-Aui-x9Lg.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-De6IlBZe.cjs → HonoEndpointAdaptor-Cq99r9H7.cjs} +50 -53
- package/dist/HonoEndpointAdaptor-Cq99r9H7.cjs.map +1 -0
- package/dist/Queue-C1uDgjxt.mjs +100 -0
- package/dist/Queue-C1uDgjxt.mjs.map +1 -0
- package/dist/Queue-Ckmudcm8.cjs +105 -0
- package/dist/Queue-Ckmudcm8.cjs.map +1 -0
- package/dist/{Queue-D7ZuwBhy.d.cts → Queue-CpQIGB_2.d.cts} +28 -40
- package/dist/Queue-CpQIGB_2.d.cts.map +1 -0
- package/dist/{Queue-gVGfi2Yk.d.mts → Queue-YmvN2vEP.d.mts} +28 -40
- package/dist/Queue-YmvN2vEP.d.mts.map +1 -0
- package/dist/QueueBuilder-CJNcv4dy.cjs +112 -0
- package/dist/QueueBuilder-CJNcv4dy.cjs.map +1 -0
- package/dist/QueueBuilder-CM0WUxfw.d.mts +62 -0
- package/dist/QueueBuilder-CM0WUxfw.d.mts.map +1 -0
- package/dist/QueueBuilder-XEnnOWGe.d.cts +62 -0
- package/dist/QueueBuilder-XEnnOWGe.d.cts.map +1 -0
- package/dist/QueueBuilder-XuPKZwKH.mjs +95 -0
- package/dist/QueueBuilder-XuPKZwKH.mjs.map +1 -0
- package/dist/{Subscriber-2mEi0ImH.d.cts → Subscriber-B91YSkZt.d.cts} +14 -16
- package/dist/Subscriber-B91YSkZt.d.cts.map +1 -0
- package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-BjHYe5hK.d.mts} +14 -16
- package/dist/Subscriber-BjHYe5hK.d.mts.map +1 -0
- package/dist/SubscriberBuilder-BSpQX1JT.d.cts +55 -0
- package/dist/SubscriberBuilder-BSpQX1JT.d.cts.map +1 -0
- package/dist/SubscriberBuilder-BhMphk4z.d.mts +55 -0
- package/dist/SubscriberBuilder-BhMphk4z.d.mts.map +1 -0
- package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-Duk028pD.cjs} +34 -37
- package/dist/SubscriberBuilder-Duk028pD.cjs.map +1 -0
- package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-DzQUWE08.mjs} +23 -25
- package/dist/SubscriberBuilder-DzQUWE08.mjs.map +1 -0
- package/dist/Topic-CkxOTrMv.cjs +104 -0
- package/dist/Topic-CkxOTrMv.cjs.map +1 -0
- package/dist/Topic-hPffOsot.mjs +99 -0
- package/dist/Topic-hPffOsot.mjs.map +1 -0
- package/dist/adaptors/aws.cjs +171 -108
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +75 -43
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +76 -44
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +143 -83
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +3 -10
- package/dist/adaptors/hono.d.cts +7 -16
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +8 -17
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +2 -10
- package/dist/adaptors/testing.cjs +515 -87
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +250 -48
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +250 -48
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +484 -68
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-CMwml9QN.d.mts +188 -0
- package/dist/auth-CMwml9QN.d.mts.map +1 -0
- package/dist/auth-rVRDjIw_.d.cts +188 -0
- package/dist/auth-rVRDjIw_.d.cts.map +1 -0
- package/dist/auth.cjs +171 -31
- 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 +160 -24
- package/dist/auth.mjs.map +1 -1
- package/dist/{cache-BrRz3fEB.d.mts → cache-C9a_hVCc.d.cts} +4 -7
- package/dist/cache-C9a_hVCc.d.cts.map +1 -0
- package/dist/{cache-BtZY_tHe.d.cts → cache-CeTMI8LR.d.mts} +4 -7
- package/dist/cache-CeTMI8LR.d.mts.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-_3zgxzXl.d.mts} +20 -11
- package/dist/construct-interface-_3zgxzXl.d.mts.map +1 -0
- package/dist/{construct-interface-D9d4Gm4p.d.cts → construct-interface-_xi4BPN8.d.cts} +20 -11
- package/dist/construct-interface-_xi4BPN8.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 +63 -16
- package/dist/credential.cjs.map +1 -1
- package/dist/credential.d.cts +16 -9
- package/dist/credential.d.cts.map +1 -1
- package/dist/credential.d.mts +16 -9
- package/dist/credential.d.mts.map +1 -1
- package/dist/credential.mjs +58 -12
- 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 +40 -15
- 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 +28 -5
- 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 +8 -10
- 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 -10
- package/dist/external-api-DS3mujT5.d.mts +86 -0
- package/dist/external-api-DS3mujT5.d.mts.map +1 -0
- package/dist/external-api-LBfE-q3g.d.cts +86 -0
- package/dist/external-api-LBfE-q3g.d.cts.map +1 -0
- package/dist/external-api.cjs +124 -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 +121 -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 +2 -4
- package/dist/functions/index.d.mts +2 -4
- package/dist/functions/index.mjs +2 -6
- package/dist/{functions-Ck21Uyq0.mjs → functions-DCIfCRR-.mjs} +371 -241
- package/dist/functions-DCIfCRR-.mjs.map +1 -0
- package/dist/{functions-DJJA7VGc.cjs → functions-ZH60FE7H.cjs} +409 -273
- package/dist/functions-ZH60FE7H.cjs.map +1 -0
- package/dist/{index-AIfVzkhi.d.cts → index-B0kxstwf.d.cts} +49 -42
- package/dist/index-B0kxstwf.d.cts.map +1 -0
- package/dist/index-CeEtxDmK.d.cts +79 -0
- package/dist/index-CeEtxDmK.d.cts.map +1 -0
- package/dist/index-CeEtxDmK.d.mts +79 -0
- package/dist/index-CeEtxDmK.d.mts.map +1 -0
- package/dist/{index-CubPzHd9.d.mts → index-CjVEjOw0.d.mts} +49 -42
- package/dist/index-CjVEjOw0.d.mts.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-BJ8IQ_1P.d.mts +159 -0
- package/dist/kysely-BJ8IQ_1P.d.mts.map +1 -0
- package/dist/kysely-DVF8wOT4.d.cts +159 -0
- package/dist/kysely-DVF8wOT4.d.cts.map +1 -0
- package/dist/{lazyAccessors-BoJN3SMd.mjs → lazyAccessors-CFanua0O.mjs} +20 -60
- package/dist/lazyAccessors-CFanua0O.mjs.map +1 -0
- package/dist/{lazyAccessors-e3j2oE2m.cjs → lazyAccessors-hJKGv8Ay.cjs} +60 -113
- package/dist/lazyAccessors-hJKGv8Ay.cjs.map +1 -0
- package/dist/mobile-app.cjs +70 -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 +69 -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-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 +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 +87 -63
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +62 -61
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +62 -61
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +79 -55
- 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 +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/{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 +118 -35
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +95 -42
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +95 -42
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +113 -30
- package/dist/worker.mjs.map +1 -1
- package/package.json +66 -41
- package/dist/Construct-BD5neF7w.mjs.map +0 -1
- package/dist/Construct-C0ijr2qp.d.cts +0 -117
- package/dist/Construct-C0ijr2qp.d.cts.map +0 -1
- package/dist/Construct-Ct8nalEi.d.mts +0 -117
- package/dist/Construct-Ct8nalEi.d.mts.map +0 -1
- package/dist/Construct-CyS3RpTL.cjs.map +0 -1
- package/dist/Cron-B2OFsfDM.d.cts.map +0 -1
- package/dist/Cron-ByxdOfpE.d.mts.map +0 -1
- package/dist/CronBuilder-BL0AP6fs.d.mts +0 -44
- package/dist/CronBuilder-BL0AP6fs.d.mts.map +0 -1
- package/dist/CronBuilder-CdibiHNB.mjs +0 -84
- package/dist/CronBuilder-CdibiHNB.mjs.map +0 -1
- package/dist/CronBuilder-DyUr6nYz.cjs +0 -96
- package/dist/CronBuilder-DyUr6nYz.cjs.map +0 -1
- package/dist/CronBuilder-LSJMfqnq.d.cts +0 -44
- package/dist/CronBuilder-LSJMfqnq.d.cts.map +0 -1
- package/dist/Endpoint-2Wg7T7Cq.d.mts.map +0 -1
- package/dist/Endpoint-DODn1RhN.cjs.map +0 -1
- package/dist/Endpoint-Dij_wOcc.mjs.map +0 -1
- package/dist/Endpoint-DrD8a1yH.d.cts.map +0 -1
- package/dist/EndpointFactory-BHFMmFkV.cjs.map +0 -1
- package/dist/EndpointFactory-b4ituq-s.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-BM2jbWht.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-De6IlBZe.cjs.map +0 -1
- package/dist/Queue-D7ZuwBhy.d.cts.map +0 -1
- package/dist/Queue-gVGfi2Yk.d.mts.map +0 -1
- package/dist/Subscriber-2mEi0ImH.d.cts.map +0 -1
- package/dist/Subscriber-xTJ9ayPN.d.mts.map +0 -1
- package/dist/SubscriberBuilder-4OPehf2R.cjs.map +0 -1
- package/dist/SubscriberBuilder-BjkbeT9l.mjs.map +0 -1
- package/dist/SubscriberBuilder-Dptmo-1A.d.mts +0 -62
- package/dist/SubscriberBuilder-Dptmo-1A.d.mts.map +0 -1
- package/dist/SubscriberBuilder-waNhzjSM.d.cts +0 -62
- package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +0 -1
- package/dist/Topic-19QeHBIR.d.cts +0 -91
- package/dist/Topic-19QeHBIR.d.cts.map +0 -1
- package/dist/Topic-DuFeqkBh.d.mts +0 -91
- package/dist/Topic-DuFeqkBh.d.mts.map +0 -1
- package/dist/auth.d.cts.map +0 -1
- package/dist/auth.d.mts.map +0 -1
- package/dist/cache-0ANvRQnD.mjs +0 -51
- package/dist/cache-0ANvRQnD.mjs.map +0 -1
- package/dist/cache-3WSvAulx.cjs +0 -57
- package/dist/cache-3WSvAulx.cjs.map +0 -1
- package/dist/cache-BrRz3fEB.d.mts.map +0 -1
- package/dist/cache-BtZY_tHe.d.cts.map +0 -1
- package/dist/clone-DblgEZZa.mjs.map +0 -1
- package/dist/clone-Dy0cR2SZ.cjs.map +0 -1
- package/dist/construct-interface-BfjcOD_E.cjs +0 -117
- package/dist/construct-interface-BfjcOD_E.cjs.map +0 -1
- package/dist/construct-interface-D9d4Gm4p.d.cts.map +0 -1
- package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
- package/dist/construct-interface-Z4CpS8tK.mjs.map +0 -1
- package/dist/construct-interface-g5GM5pwR.d.mts.map +0 -1
- package/dist/database/kysely.d.cts.map +0 -1
- package/dist/database/kysely.d.mts.map +0 -1
- package/dist/functions-Ck21Uyq0.mjs.map +0 -1
- package/dist/functions-DJJA7VGc.cjs.map +0 -1
- package/dist/index-AIfVzkhi.d.cts.map +0 -1
- package/dist/index-B8g8POkr.d.cts.map +0 -1
- package/dist/index-BxHDdy6a.d.mts.map +0 -1
- package/dist/index-CubPzHd9.d.mts.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/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/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.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/database/kysely.mjs
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import { Cache } from "../cache
|
|
1
|
+
import { Cache } from "../cache.mjs";
|
|
2
2
|
import { DEFAULT_POSTGRES_VERSION, canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
3
3
|
import { Kysely, PostgresDialect } from "kysely";
|
|
4
4
|
import pg from "pg";
|
|
5
|
-
|
|
6
5
|
//#region src/database/kysely.ts
|
|
6
|
+
/**
|
|
7
|
+
* `KyselyDatabase` — a declared Postgres database, typed by its schema.
|
|
8
|
+
*
|
|
9
|
+
* It declares a logical database, a schema, and the roles that reach it, and
|
|
10
|
+
* hands back a Kysely client built from the one URL the adapter supplied. It
|
|
11
|
+
* names no cloud: `--target=aws` fills that URL from RDS, local dev from the
|
|
12
|
+
* Postgres container.
|
|
13
|
+
*
|
|
14
|
+
* Transactions and RLS context are the execution wrapper's job — it opens the
|
|
15
|
+
* transaction and puts it in `ctx.db`. This construct does not resolve
|
|
16
|
+
* connections per request.
|
|
17
|
+
*/
|
|
7
18
|
/** The schema a database uses when it does not say otherwise. */
|
|
8
19
|
const DEFAULT_SCHEMA = "app";
|
|
9
20
|
/**
|
|
@@ -14,6 +25,7 @@ const DEFAULT_SCHEMA = "app";
|
|
|
14
25
|
* through `.database()`, which infers from the service.
|
|
15
26
|
*/
|
|
16
27
|
var KyselyDatabase = class KyselyDatabase {
|
|
28
|
+
options;
|
|
17
29
|
id;
|
|
18
30
|
service;
|
|
19
31
|
/**
|
|
@@ -142,14 +154,25 @@ var KyselyDatabase = class KyselyDatabase {
|
|
|
142
154
|
register: (options) => this.connect(options, { owner: true })
|
|
143
155
|
};
|
|
144
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* What this database's clients are built with besides a dialect — the
|
|
159
|
+
* plugins and logging it was declared with.
|
|
160
|
+
*
|
|
161
|
+
* Public so that whatever opens a connection to it outside \`connect()\` —
|
|
162
|
+
* a test's transaction — builds the same client. A test that dropped the
|
|
163
|
+
* plugins would write \`createdAt\` where production writes \`created_at\`.
|
|
164
|
+
*/
|
|
165
|
+
get clientConfig() {
|
|
166
|
+
const { schema: _schema, roles: _roles, version: _version, ...kysely } = this.options;
|
|
167
|
+
return kysely;
|
|
168
|
+
}
|
|
145
169
|
async connect(options, as = {}) {
|
|
146
170
|
const { url, ownerUrl } = options.envParser.create((get) => ({
|
|
147
171
|
url: get(this.config.url).string(),
|
|
148
172
|
ownerUrl: get(this.config.ownerUrl).string().optional()
|
|
149
173
|
})).parse();
|
|
150
|
-
const { schema: _schema, roles: _roles,...kysely } = this.options;
|
|
151
174
|
return new Kysely({
|
|
152
|
-
...
|
|
175
|
+
...this.clientConfig,
|
|
153
176
|
dialect: new PostgresDialect({ pool: pool(as.owner ? ownerUrl ?? url : url) })
|
|
154
177
|
});
|
|
155
178
|
}
|
|
@@ -174,7 +197,7 @@ function pool(url) {
|
|
|
174
197
|
options: `-c search_path=${searchPath}`
|
|
175
198
|
});
|
|
176
199
|
}
|
|
177
|
-
|
|
178
200
|
//#endregion
|
|
179
201
|
export { KyselyDatabase };
|
|
202
|
+
|
|
180
203
|
//# sourceMappingURL=kysely.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kysely.mjs","names":["id: ConstructName<TName>","options: KyselyDatabaseOptions","derivedFrom?: DerivedFrom","id: ConstructName<TCache>","options: { table?: string }","id: ConstructName<TTenant>","options: ServiceRegisterOptions","as: { owner?: boolean }","url: string"],"sources":["../../src/database/kysely.ts"],"sourcesContent":["/**\n * `KyselyDatabase` — a declared Postgres database, typed by its schema.\n *\n * It declares a logical database, a schema, and the roles that reach it, and\n * hands back a Kysely client built from the one URL the adapter supplied. It\n * names no cloud: `--target=aws` fills that URL from RDS, local dev from the\n * Postgres container.\n *\n * Transactions and RLS context are the execution wrapper's job — it opens the\n * transaction and puts it in `ctx.db`. This construct does not resolve\n * connections per request.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\tDEFAULT_POSTGRES_VERSION,\n\ttype Declaration,\n\ttype PostgresVersion,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport { Kysely, type KyselyConfig, PostgresDialect } from 'kysely';\nimport pg from 'pg';\nimport { Cache } from '../cache';\nimport type { Construct } from '../construct-interface';\n\n/** The schema a database uses when it does not say otherwise. */\nconst DEFAULT_SCHEMA = 'app';\n\n/**\n * Everything Kysely takes, plus what this construct declares.\n *\n * `dialect` is omitted because the construct owns it — it is built from the one\n * URL the adapter supplied, which is the whole point of the construct. The rest\n * of `KyselyConfig` (`plugins`, `log`) is the app's business and passes\n * straight through, so anything Kysely adds later arrives without being\n * tracked here.\n */\nexport interface KyselyDatabaseOptions extends Omit<KyselyConfig, 'dialect'> {\n\t/**\n\t * The schema, pinned on both roles' `search_path`.\n\t *\n\t * Defaults to `app` — the role the schema plays, rather than a restatement\n\t * of the database's own name, which reads correctly beside `auth` and\n\t * `pgboss` and keeps the application off `public`.\n\t */\n\tschema?: string;\n\t/**\n\t * Provision the owner/runtime role split. Defaults to on.\n\t *\n\t * Off falls back to the cluster's master credential in both URLs, giving up\n\t * the DDL/DML split and putting credentials that can drop a table into the\n\t * function's environment. A deliberate downgrade, not a default.\n\t */\n\troles?: boolean;\n\t/**\n\t * The Postgres major version to provision.\n\t *\n\t * Declared here so one statement reaches both targets. It was previously\n\t * set in two unrelated places — a container tag locally, nothing at all on\n\t * AWS (so Aurora chose) — which is how local came to run 18 while deployed\n\t * ran 17.7 with nothing recording the difference.\n\t *\n\t * Defaults to {@link DEFAULT_POSTGRES_VERSION}.\n\t */\n\tversion?: PostgresVersion;\n}\n\n/** What makes a construct derived rather than a database in its own right. */\ninterface DerivedFrom {\n\tkind: 'database-reader' | 'database-schema';\n\tof: string;\n\tschema?: string;\n}\n\n/**\n * @typeParam DB - the database's schema.\n * @typeParam TName - the canonical id. TypeScript has no partial\n * type-argument inference, so `new KyselyDatabase<OrdersDB>('orders')` leaves\n * this at its default and the service key widens to `string`. `db` still types\n * through `.database()`, which infers from the service.\n */\nexport class KyselyDatabase<DB = unknown, TName extends string = string>\n\timplements Construct<TName, Kysely<DB>>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, Kysely<DB>>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly config: { url: string; ownerUrl: string };\n\tprivate readonly schemaName: string;\n\tprivate readonly roles: boolean;\n\tprivate readonly version: PostgresVersion;\n\tprivate readonly derivedFrom?: DerivedFrom;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: KyselyDatabaseOptions = {},\n\t\tderivedFrom?: DerivedFrom,\n\t) {\n\t\t// Canonicalises, so `orders` and `Orders` are one construct rather than\n\t\t// two that collide. Throws on anything that cannot become a valid id.\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.config = {\n\t\t\turl: provideKey(canonical, 'url'),\n\t\t\townerUrl: provideKey(canonical, 'ownerUrl'),\n\t\t};\n\t\tthis.schemaName = options.schema ?? DEFAULT_SCHEMA;\n\t\tthis.roles = options.roles ?? true;\n\t\tthis.version = options.version ?? DEFAULT_POSTGRES_VERSION;\n\t\tthis.derivedFrom = derivedFrom;\n\n\t\t// A field, not a getter: service discovery caches by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\t// Forwards the whole options object — cherry-picking `envParser` strips\n\t\t\t// `context` and with it the request-scoped logger.\n\t\t\tregister: (registerOptions) => this.connect(registerOptions),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\tif (this.derivedFrom) {\n\t\t\tconst { kind, of, schema } = this.derivedFrom;\n\n\t\t\treturn [\n\t\t\t\tkind === 'database-schema'\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tid: this.id,\n\t\t\t\t\t\t\tof,\n\t\t\t\t\t\t\tschema: schema ?? this.schemaName,\n\t\t\t\t\t\t\t// The runtime key alone — see the note below on the parent.\n\t\t\t\t\t\t\tprovides: [this.config.url],\n\t\t\t\t\t\t}\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tid: this.id,\n\t\t\t\t\t\t\tof,\n\t\t\t\t\t\t\t// A reader has no owner URL of its own — nothing migrates\n\t\t\t\t\t\t\t// through a read-only endpoint — so this is the one key.\n\t\t\t\t\t\t\tprovides: [this.config.url],\n\t\t\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'database',\n\t\t\t\tid: this.id,\n\t\t\t\tengine: 'postgres',\n\t\t\t\tschema: this.schemaName,\n\t\t\t\tversion: this.version,\n\t\t\t\t// One key, the runtime role's. `config` also holds the owner key and\n\t\t\t\t// it is deliberately absent here: a key in `provides` is a key an\n\t\t\t\t// edge can name, and nothing should be able to depend on DDL rights.\n\t\t\t\tprovides: [this.config.url],\n\t\t\t\t...(this.roles ? {} : { roles: false }),\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * A read-only endpoint on this database.\n\t *\n\t * Read-only is enforced by the reader role's grants rather than by which\n\t * endpoint it resolves to, so falling back to the writer where no replica\n\t * exists is safe rather than a silently writable connection behind a name\n\t * that says reader. There is no `writer()`: the database *is* the writer, so\n\t * a replica can never be reached by accident.\n\t *\n\t * The return type is narrower than this class on purpose — see\n\t * {@link ReadOnlyDatabase}.\n\t */\n\treader(): ReadOnlyDatabase<DB, `${TName}Reader`> {\n\t\treturn new KyselyDatabase<DB, `${TName}Reader`>(\n\t\t\t`${this.id}Reader` as ConstructName<`${TName}Reader`>,\n\t\t\tthis.options,\n\t\t\t{ kind: 'database-reader', of: this.id },\n\t\t);\n\t}\n\n\t/**\n\t * A cache that lives in this database.\n\t *\n\t * The same strengthening `schema()` is over a second database: `new\n\t * Cache('Sessions')` says the app caches and leaves where to the deployment,\n\t * while this says it caches *here* — which is a fact about the application\n\t * and so belongs in its code.\n\t *\n\t * What it buys beyond being explicit: the table's schema and the role that\n\t * reaches it come from this database rather than from a second convention,\n\t * and the backend no longer has to guess which database \"the database\" meant\n\t * when an app declares two.\n\t *\n\t * A cache is not a `KyselyDatabase`, so this returns a `Cache` — the client\n\t * is a key/value store, not a query builder, and typing it as the parent\n\t * would be a convenience that lies.\n\t */\n\tcache<TCache extends string = `${TName}Cache`>(\n\t\tid: ConstructName<TCache> = `${this.id}Cache` as ConstructName<TCache>,\n\t\toptions: { table?: string } = {},\n\t): Cache<TCache> {\n\t\treturn new Cache<TCache>(id, {\n\t\t\tof: this.id,\n\t\t\t...(options.table ? { table: options.table } : {}),\n\t\t});\n\t}\n\n\t/**\n\t * A second schema in this database, with its own role(s) and its own URL —\n\t * so this database's role holds no grant on those tables at all.\n\t *\n\t * Typed separately because a tenant has its own tables: the point is that\n\t * `auth.selectFrom('sessions')` type-checks and\n\t * `orders.selectFrom('sessions')` does not.\n\t */\n\tschema<TenantDB, TTenant extends string>(\n\t\tid: ConstructName<TTenant>,\n\t\toptions: KyselyDatabaseOptions = {},\n\t): KyselyDatabase<TenantDB, TTenant> {\n\t\treturn new KyselyDatabase<TenantDB, TTenant>(id, options, {\n\t\t\tkind: 'database-schema',\n\t\t\tof: this.id,\n\t\t\tschema: options.schema ?? (id as string).toLowerCase(),\n\t\t});\n\t}\n\n\t/**\n\t * A connection as the *owner* role — the one that may create, alter and drop.\n\t *\n\t * A `Service` rather than part of the construct, and deliberately so: a\n\t * construct is what `.dependsOn()` accepts, and nothing should be able to\n\t * depend on this. A migrator asks for it by name; a handler cannot ask at\n\t * all, which is the security property the role split exists for.\n\t *\n\t * Falls back to the runtime URL where no owner URL was published — the\n\t * `roles: false` downgrade, where there is only one credential and it is the\n\t * cluster master's.\n\t */\n\tget owner(): Service<`${Uncapitalize<TName>}Owner`, Kysely<DB>> {\n\t\treturn {\n\t\t\tserviceName:\n\t\t\t\t`${serviceKey(this.id)}Owner` as `${Uncapitalize<TName>}Owner`,\n\t\t\tregister: (options) => this.connect(options, { owner: true }),\n\t\t};\n\t}\n\n\tprivate async connect(\n\t\toptions: ServiceRegisterOptions,\n\t\tas: { owner?: boolean } = {},\n\t): Promise<Kysely<DB>> {\n\t\tconst { url, ownerUrl } = options.envParser\n\t\t\t.create((get) => ({\n\t\t\t\turl: get(this.config.url).string(),\n\t\t\t\townerUrl: get(this.config.ownerUrl).string().optional(),\n\t\t\t}))\n\t\t\t.parse();\n\n\t\t// Split what the manifest declared from what Kysely takes, so neither\n\t\t// leaks into the other: `schema` and `roles` describe infrastructure and\n\t\t// mean nothing to a client.\n\t\tconst { schema: _schema, roles: _roles, ...kysely } = this.options;\n\n\t\treturn new Kysely<DB>({\n\t\t\t...kysely,\n\t\t\tdialect: new PostgresDialect({\n\t\t\t\tpool: pool(as.owner ? (ownerUrl ?? url) : url),\n\t\t\t}),\n\t\t});\n\t}\n}\n\n/**\n * A pool for one URL, with its schema actually on the search path.\n *\n * `?search_path=` is not a libpq parameter — a URL carrying it connects\n * happily and then resolves every unqualified name against `public`, which is\n * how a schema tenant silently writes its tables into the database it was\n * separated from. Postgres takes it as a startup option instead, so the URL\n * keeps the readable form the target derives and this turns it into the thing\n * the server understands.\n */\nfunction pool(url: string): pg.Pool {\n\tconst parsed = new URL(url);\n\tconst searchPath = parsed.searchParams.get('search_path');\n\n\tif (!searchPath) return new pg.Pool({ connectionString: url });\n\n\tparsed.searchParams.delete('search_path');\n\n\treturn new pg.Pool({\n\t\tconnectionString: parsed.toString(),\n\t\toptions: `-c search_path=${searchPath}`,\n\t});\n}\n\n/**\n * A database you may read through, and derive nothing from.\n *\n * A reader is terminal in the graph, and this is that fact in the type system.\n * `DERIVES_FROM` gives `cache` and `database-schema` no `database-reader`\n * parent, and there is no reader of a reader — so `orders.reader().cache(…)`\n * has always been illegal, but it type-checked and failed later at\n * `assertDerivations`. That is a long way round to learn that a read-only\n * endpoint cannot own a table something writes to.\n *\n * Omitting the three deriving methods rather than making them throw keeps the\n * failure where it costs least: the editor, on the line that wrote it.\n *\n * The result is deliberately not assignable back to `KyselyDatabase` — a\n * reader is not one, and anything that genuinely needs the writer should say\n * so.\n */\nexport type ReadOnlyDatabase<DB, TName extends string> = Omit<\n\tKyselyDatabase<DB, TName>,\n\t'reader' | 'cache' | 'schema'\n>;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"kysely.mjs","names":[],"sources":["../../src/database/kysely.ts"],"sourcesContent":["/**\n * `KyselyDatabase` — a declared Postgres database, typed by its schema.\n *\n * It declares a logical database, a schema, and the roles that reach it, and\n * hands back a Kysely client built from the one URL the adapter supplied. It\n * names no cloud: `--target=aws` fills that URL from RDS, local dev from the\n * Postgres container.\n *\n * Transactions and RLS context are the execution wrapper's job — it opens the\n * transaction and puts it in `ctx.db`. This construct does not resolve\n * connections per request.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\tDEFAULT_POSTGRES_VERSION,\n\ttype Declaration,\n\ttype PostgresVersion,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport { Kysely, type KyselyConfig, PostgresDialect } from 'kysely';\nimport pg from 'pg';\nimport { Cache } from '../cache';\nimport type { Construct } from '../construct-interface';\n\n/** The schema a database uses when it does not say otherwise. */\nconst DEFAULT_SCHEMA = 'app';\n\n/**\n * Everything Kysely takes, plus what this construct declares.\n *\n * `dialect` is omitted because the construct owns it — it is built from the one\n * URL the adapter supplied, which is the whole point of the construct. The rest\n * of `KyselyConfig` (`plugins`, `log`) is the app's business and passes\n * straight through, so anything Kysely adds later arrives without being\n * tracked here.\n */\nexport interface KyselyDatabaseOptions extends Omit<KyselyConfig, 'dialect'> {\n\t/**\n\t * The schema, pinned on both roles' `search_path`.\n\t *\n\t * Defaults to `app` — the role the schema plays, rather than a restatement\n\t * of the database's own name, which reads correctly beside `auth` and\n\t * `pgboss` and keeps the application off `public`.\n\t */\n\tschema?: string;\n\t/**\n\t * Provision the owner/runtime role split. Defaults to on.\n\t *\n\t * Off falls back to the cluster's master credential in both URLs, giving up\n\t * the DDL/DML split and putting credentials that can drop a table into the\n\t * function's environment. A deliberate downgrade, not a default.\n\t */\n\troles?: boolean;\n\t/**\n\t * The Postgres major version to provision.\n\t *\n\t * Declared here so one statement reaches both targets. It was previously\n\t * set in two unrelated places — a container tag locally, nothing at all on\n\t * AWS (so Aurora chose) — which is how local came to run 18 while deployed\n\t * ran 17.7 with nothing recording the difference.\n\t *\n\t * Defaults to {@link DEFAULT_POSTGRES_VERSION}.\n\t */\n\tversion?: PostgresVersion;\n}\n\n/** What makes a construct derived rather than a database in its own right. */\ninterface DerivedFrom {\n\tkind: 'database-reader' | 'database-schema';\n\tof: string;\n\tschema?: string;\n}\n\n/**\n * @typeParam DB - the database's schema.\n * @typeParam TName - the canonical id. TypeScript has no partial\n * type-argument inference, so `new KyselyDatabase<OrdersDB>('orders')` leaves\n * this at its default and the service key widens to `string`. `db` still types\n * through `.database()`, which infers from the service.\n */\nexport class KyselyDatabase<DB = unknown, TName extends string = string>\n\timplements Construct<TName, Kysely<DB>>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, Kysely<DB>>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly config: { url: string; ownerUrl: string };\n\tprivate readonly schemaName: string;\n\tprivate readonly roles: boolean;\n\tprivate readonly version: PostgresVersion;\n\tprivate readonly derivedFrom?: DerivedFrom;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: KyselyDatabaseOptions = {},\n\t\tderivedFrom?: DerivedFrom,\n\t) {\n\t\t// Canonicalises, so `orders` and `Orders` are one construct rather than\n\t\t// two that collide. Throws on anything that cannot become a valid id.\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.config = {\n\t\t\turl: provideKey(canonical, 'url'),\n\t\t\townerUrl: provideKey(canonical, 'ownerUrl'),\n\t\t};\n\t\tthis.schemaName = options.schema ?? DEFAULT_SCHEMA;\n\t\tthis.roles = options.roles ?? true;\n\t\tthis.version = options.version ?? DEFAULT_POSTGRES_VERSION;\n\t\tthis.derivedFrom = derivedFrom;\n\n\t\t// A field, not a getter: service discovery caches by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\t// Forwards the whole options object — cherry-picking `envParser` strips\n\t\t\t// `context` and with it the request-scoped logger.\n\t\t\tregister: (registerOptions) => this.connect(registerOptions),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\tif (this.derivedFrom) {\n\t\t\tconst { kind, of, schema } = this.derivedFrom;\n\n\t\t\treturn [\n\t\t\t\tkind === 'database-schema'\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tid: this.id,\n\t\t\t\t\t\t\tof,\n\t\t\t\t\t\t\tschema: schema ?? this.schemaName,\n\t\t\t\t\t\t\t// The runtime key alone — see the note below on the parent.\n\t\t\t\t\t\t\tprovides: [this.config.url],\n\t\t\t\t\t\t}\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tid: this.id,\n\t\t\t\t\t\t\tof,\n\t\t\t\t\t\t\t// A reader has no owner URL of its own — nothing migrates\n\t\t\t\t\t\t\t// through a read-only endpoint — so this is the one key.\n\t\t\t\t\t\t\tprovides: [this.config.url],\n\t\t\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'database',\n\t\t\t\tid: this.id,\n\t\t\t\tengine: 'postgres',\n\t\t\t\tschema: this.schemaName,\n\t\t\t\tversion: this.version,\n\t\t\t\t// One key, the runtime role's. `config` also holds the owner key and\n\t\t\t\t// it is deliberately absent here: a key in `provides` is a key an\n\t\t\t\t// edge can name, and nothing should be able to depend on DDL rights.\n\t\t\t\tprovides: [this.config.url],\n\t\t\t\t...(this.roles ? {} : { roles: false }),\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * A read-only endpoint on this database.\n\t *\n\t * Read-only is enforced by the reader role's grants rather than by which\n\t * endpoint it resolves to, so falling back to the writer where no replica\n\t * exists is safe rather than a silently writable connection behind a name\n\t * that says reader. There is no `writer()`: the database *is* the writer, so\n\t * a replica can never be reached by accident.\n\t *\n\t * The return type is narrower than this class on purpose — see\n\t * {@link ReadOnlyDatabase}.\n\t */\n\treader(): ReadOnlyDatabase<DB, `${TName}Reader`> {\n\t\treturn new KyselyDatabase<DB, `${TName}Reader`>(\n\t\t\t`${this.id}Reader` as ConstructName<`${TName}Reader`>,\n\t\t\tthis.options,\n\t\t\t{ kind: 'database-reader', of: this.id },\n\t\t);\n\t}\n\n\t/**\n\t * A cache that lives in this database.\n\t *\n\t * The same strengthening `schema()` is over a second database: `new\n\t * Cache('Sessions')` says the app caches and leaves where to the deployment,\n\t * while this says it caches *here* — which is a fact about the application\n\t * and so belongs in its code.\n\t *\n\t * What it buys beyond being explicit: the table's schema and the role that\n\t * reaches it come from this database rather than from a second convention,\n\t * and the backend no longer has to guess which database \"the database\" meant\n\t * when an app declares two.\n\t *\n\t * A cache is not a `KyselyDatabase`, so this returns a `Cache` — the client\n\t * is a key/value store, not a query builder, and typing it as the parent\n\t * would be a convenience that lies.\n\t */\n\tcache<TCache extends string = `${TName}Cache`>(\n\t\tid: ConstructName<TCache> = `${this.id}Cache` as ConstructName<TCache>,\n\t\toptions: { table?: string } = {},\n\t): Cache<TCache> {\n\t\treturn new Cache<TCache>(id, {\n\t\t\tof: this.id,\n\t\t\t...(options.table ? { table: options.table } : {}),\n\t\t});\n\t}\n\n\t/**\n\t * A second schema in this database, with its own role(s) and its own URL —\n\t * so this database's role holds no grant on those tables at all.\n\t *\n\t * Typed separately because a tenant has its own tables: the point is that\n\t * `auth.selectFrom('sessions')` type-checks and\n\t * `orders.selectFrom('sessions')` does not.\n\t */\n\tschema<TenantDB, TTenant extends string>(\n\t\tid: ConstructName<TTenant>,\n\t\toptions: KyselyDatabaseOptions = {},\n\t): KyselyDatabase<TenantDB, TTenant> {\n\t\treturn new KyselyDatabase<TenantDB, TTenant>(id, options, {\n\t\t\tkind: 'database-schema',\n\t\t\tof: this.id,\n\t\t\tschema: options.schema ?? (id as string).toLowerCase(),\n\t\t});\n\t}\n\n\t/**\n\t * A connection as the *owner* role — the one that may create, alter and drop.\n\t *\n\t * A `Service` rather than part of the construct, and deliberately so: a\n\t * construct is what `.dependsOn()` accepts, and nothing should be able to\n\t * depend on this. A migrator asks for it by name; a handler cannot ask at\n\t * all, which is the security property the role split exists for.\n\t *\n\t * Falls back to the runtime URL where no owner URL was published — the\n\t * `roles: false` downgrade, where there is only one credential and it is the\n\t * cluster master's.\n\t */\n\tget owner(): Service<`${Uncapitalize<TName>}Owner`, Kysely<DB>> {\n\t\treturn {\n\t\t\tserviceName:\n\t\t\t\t`${serviceKey(this.id)}Owner` as `${Uncapitalize<TName>}Owner`,\n\t\t\tregister: (options) => this.connect(options, { owner: true }),\n\t\t};\n\t}\n\n\t/**\n\t * What this database's clients are built with besides a dialect — the\n\t * plugins and logging it was declared with.\n\t *\n\t * Public so that whatever opens a connection to it outside \\`connect()\\` —\n\t * a test's transaction — builds the same client. A test that dropped the\n\t * plugins would write \\`createdAt\\` where production writes \\`created_at\\`.\n\t */\n\tget clientConfig(): Omit<KyselyConfig, 'dialect'> {\n\t\t// Split what the manifest declared from what Kysely takes, so neither\n\t\t// leaks into the other: \\`schema\\`, \\`roles\\` and \\`version\\` describe\n\t\t// infrastructure and mean nothing to a client.\n\t\tconst {\n\t\t\tschema: _schema,\n\t\t\troles: _roles,\n\t\t\tversion: _version,\n\t\t\t...kysely\n\t\t} = this.options;\n\t\treturn kysely;\n\t}\n\n\tprivate async connect(\n\t\toptions: ServiceRegisterOptions,\n\t\tas: { owner?: boolean } = {},\n\t): Promise<Kysely<DB>> {\n\t\tconst { url, ownerUrl } = options.envParser\n\t\t\t.create((get) => ({\n\t\t\t\turl: get(this.config.url).string(),\n\t\t\t\townerUrl: get(this.config.ownerUrl).string().optional(),\n\t\t\t}))\n\t\t\t.parse();\n\n\t\treturn new Kysely<DB>({\n\t\t\t...this.clientConfig,\n\t\t\tdialect: new PostgresDialect({\n\t\t\t\tpool: pool(as.owner ? (ownerUrl ?? url) : url),\n\t\t\t}),\n\t\t});\n\t}\n}\n\n/**\n * A pool for one URL, with its schema actually on the search path.\n *\n * `?search_path=` is not a libpq parameter — a URL carrying it connects\n * happily and then resolves every unqualified name against `public`, which is\n * how a schema tenant silently writes its tables into the database it was\n * separated from. Postgres takes it as a startup option instead, so the URL\n * keeps the readable form the target derives and this turns it into the thing\n * the server understands.\n */\nfunction pool(url: string): pg.Pool {\n\tconst parsed = new URL(url);\n\tconst searchPath = parsed.searchParams.get('search_path');\n\n\tif (!searchPath) return new pg.Pool({ connectionString: url });\n\n\tparsed.searchParams.delete('search_path');\n\n\treturn new pg.Pool({\n\t\tconnectionString: parsed.toString(),\n\t\toptions: `-c search_path=${searchPath}`,\n\t});\n}\n\n/**\n * A database you may read through, and derive nothing from.\n *\n * A reader is terminal in the graph, and this is that fact in the type system.\n * `DERIVES_FROM` gives `cache` and `database-schema` no `database-reader`\n * parent, and there is no reader of a reader — so `orders.reader().cache(…)`\n * has always been illegal, but it type-checked and failed later at\n * `assertDerivations`. That is a long way round to learn that a read-only\n * endpoint cannot own a table something writes to.\n *\n * Omitting the three deriving methods rather than making them throw keeps the\n * failure where it costs least: the editor, on the line that wrote it.\n *\n * The result is deliberately not assignable back to `KyselyDatabase` — a\n * reader is not one, and anything that genuinely needs the writer should say\n * so.\n */\nexport type ReadOnlyDatabase<DB, TName extends string> = Omit<\n\tKyselyDatabase<DB, TName>,\n\t'reader' | 'cache' | 'schema'\n>;\n"],"mappings":"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"}
|
package/dist/email.cjs
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
3
|
+
let _geekmidas_emailkit = require("@geekmidas/emailkit");
|
|
5
4
|
//#region src/email.ts
|
|
5
|
+
/**
|
|
6
|
+
* `Email` — declared outbound mail.
|
|
7
|
+
*
|
|
8
|
+
* The same three-package meeting point as `ObjectStorage`: it implements the
|
|
9
|
+
* construct contract, derives its env key through `@geekmidas/manifest`, and
|
|
10
|
+
* hands back an `@geekmidas/emailkit` client. It names no provider — locally the
|
|
11
|
+
* injected URL points at Mailpit, deployed it points at SES or whichever service
|
|
12
|
+
* config selected.
|
|
13
|
+
*
|
|
14
|
+
* Where object storage needs a driver per provider, this needs none: mail is
|
|
15
|
+
* delivered over SMTP whoever delivers it, so there is one client and one URL
|
|
16
|
+
* shape, and the provider survives only as a host and a credential.
|
|
17
|
+
*/
|
|
6
18
|
var Email = class {
|
|
19
|
+
options;
|
|
7
20
|
id;
|
|
8
21
|
service;
|
|
9
22
|
/**
|
|
@@ -13,15 +26,15 @@ var Email = class {
|
|
|
13
26
|
keys;
|
|
14
27
|
constructor(id, options) {
|
|
15
28
|
this.options = options;
|
|
16
|
-
const canonical = (0,
|
|
29
|
+
const canonical = (0, _geekmidas_manifest.canonicalId)(id);
|
|
17
30
|
this.id = canonical;
|
|
18
31
|
this.keys = {
|
|
19
|
-
url: (0,
|
|
20
|
-
from: (0,
|
|
32
|
+
url: (0, _geekmidas_manifest.provideKey)(canonical, "url"),
|
|
33
|
+
from: (0, _geekmidas_manifest.provideKey)(canonical, "from")
|
|
21
34
|
};
|
|
22
35
|
this.service = {
|
|
23
|
-
serviceName: (0,
|
|
24
|
-
register: (options
|
|
36
|
+
serviceName: (0, _geekmidas_manifest.serviceKey)(canonical),
|
|
37
|
+
register: (options) => this.connect(options)
|
|
25
38
|
};
|
|
26
39
|
}
|
|
27
40
|
declare() {
|
|
@@ -43,8 +56,8 @@ var Email = class {
|
|
|
43
56
|
url: get(this.keys.url).string(),
|
|
44
57
|
from: get(this.keys.from).string()
|
|
45
58
|
})).parse();
|
|
46
|
-
return (0,
|
|
47
|
-
smtp: (0,
|
|
59
|
+
return (0, _geekmidas_emailkit.createEmailClient)({
|
|
60
|
+
smtp: (0, _geekmidas_emailkit.parseEmailUrl)(url),
|
|
48
61
|
templates: this.options.templates,
|
|
49
62
|
defaults: {
|
|
50
63
|
from,
|
|
@@ -53,7 +66,7 @@ var Email = class {
|
|
|
53
66
|
});
|
|
54
67
|
}
|
|
55
68
|
};
|
|
56
|
-
|
|
57
69
|
//#endregion
|
|
58
70
|
exports.Email = Email;
|
|
71
|
+
|
|
59
72
|
//# sourceMappingURL=email.cjs.map
|
package/dist/email.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.cjs","names":["
|
|
1
|
+
{"version":3,"file":"email.cjs","names":["canonicalId","provideKey","serviceKey","createEmailClient","parseEmailUrl"],"sources":["../src/email.ts"],"sourcesContent":["/**\n * `Email` — declared outbound mail.\n *\n * The same three-package meeting point as `ObjectStorage`: it implements the\n * construct contract, derives its env key through `@geekmidas/manifest`, and\n * hands back an `@geekmidas/emailkit` client. It names no provider — locally the\n * injected URL points at Mailpit, deployed it points at SES or whichever service\n * config selected.\n *\n * Where object storage needs a driver per provider, this needs none: mail is\n * delivered over SMTP whoever delivers it, so there is one client and one URL\n * shape, and the provider survives only as a host and a credential.\n */\n\nimport {\n\tcreateEmailClient,\n\ttype EmailClient,\n\tparseEmailUrl,\n\ttype TemplateRecord,\n} from '@geekmidas/emailkit';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\n\nexport interface EmailOptions<TTemplates extends TemplateRecord> {\n\t/**\n\t * The React templates this app can send.\n\t *\n\t * Structural — they are code, they ship with the handler, and which ones\n\t * exist cannot differ between stages. They are also what types\n\t * `sendTemplate`, so passing them here is what makes the client's call sites\n\t * checkable.\n\t */\n\ttemplates: TTemplates;\n\t/**\n\t * A reply-to address for every send.\n\t *\n\t * `from` is deliberately absent: it belongs to the verified sending domain,\n\t * which is `myapp.test` locally and the real domain deployed, so it arrives\n\t * as stage config rather than being written here.\n\t */\n\treplyTo?: string;\n}\n\nexport class Email<\n\tTName extends string = string,\n\tTTemplates extends TemplateRecord = TemplateRecord,\n> implements Construct<TName, EmailClient<TTemplates>>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, EmailClient<TTemplates>>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly keys: { url: string; from: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: EmailOptions<TTemplates>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = {\n\t\t\turl: provideKey(canonical, 'url'),\n\t\t\t// The sending identity travels with the URL rather than being a second\n\t\t\t// construct option, for the same reason the URL does: it is the one\n\t\t\t// thing about mail that differs per stage.\n\t\t\tfrom: provideKey(canonical, 'from'),\n\t\t};\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'email',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url, this.keys.from],\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the URL the adapter supplied.\n\t *\n\t * No provider branch and no driver lookup — `parseEmailUrl` turns any of\n\t * Mailpit, SES, or Resend into the same transport config, which is the whole\n\t * reason the scheme is always `smtp://`.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<EmailClient<TTemplates>> {\n\t\tconst { url, from } = envParser\n\t\t\t.create((get) => ({\n\t\t\t\turl: get(this.keys.url).string(),\n\t\t\t\tfrom: get(this.keys.from).string(),\n\t\t\t}))\n\t\t\t.parse();\n\n\t\treturn createEmailClient({\n\t\t\tsmtp: parseEmailUrl(url),\n\t\t\ttemplates: this.options.templates,\n\t\t\tdefaults: {\n\t\t\t\tfrom,\n\t\t\t\t...(this.options.replyTo ? { replyTo: this.options.replyTo } : {}),\n\t\t\t},\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkDA,IAAa,QAAb,MAIA;CAYmB;CAXlB;CACA;;;;;CAMA;CAEA,YACC,IACA,SACC;EADgB,KAAA,UAAA;EAEjB,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO;GACX,MAAA,GAAKC,oBAAAA,WAAAA,CAAW,WAAW,KAAK;GAIhC,OAAA,GAAMA,oBAAAA,WAAAA,CAAW,WAAW,MAAM;EACnC;EAGA,KAAK,UAAU;GACd,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI;EACzC,CACD;CACD;;;;;;;;CASA,MAAc,QAAQ,EACrB,aAC4D;EAC5D,MAAM,EAAE,KAAK,SAAS,UACpB,QAAQ,SAAS;GACjB,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO;GAC/B,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,OAAO;EAClC,EAAE,CAAC,CACF,MAAM;EAER,QAAA,GAAOC,oBAAAA,kBAAAA,CAAkB;GACxB,OAAA,GAAMC,oBAAAA,cAAAA,CAAc,GAAG;GACvB,WAAW,KAAK,QAAQ;GACxB,UAAU;IACT;IACA,GAAI,KAAK,QAAQ,UAAU,EAAE,SAAS,KAAK,QAAQ,QAAQ,IAAI,CAAC;GACjE;EACD,CAAC;CACF;AACD"}
|
package/dist/email.d.cts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { Construct } from "./construct-interface-
|
|
1
|
+
import { n as Construct } from "./construct-interface-_xi4BPN8.cjs";
|
|
2
2
|
import { Service } from "@geekmidas/services";
|
|
3
3
|
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
4
4
|
import { EmailClient, TemplateRecord } from "@geekmidas/emailkit";
|
|
5
|
-
|
|
6
5
|
//#region src/email.d.ts
|
|
7
|
-
|
|
8
|
-
interface EmailOptions<TTemplates extends TemplateRecord> {
|
|
6
|
+
export interface EmailOptions<TTemplates extends TemplateRecord> {
|
|
9
7
|
/**
|
|
10
8
|
* The React templates this app can send.
|
|
11
9
|
*
|
|
@@ -24,7 +22,7 @@ interface EmailOptions<TTemplates extends TemplateRecord> {
|
|
|
24
22
|
*/
|
|
25
23
|
replyTo?: string;
|
|
26
24
|
}
|
|
27
|
-
declare class Email<TName extends string = string, TTemplates extends TemplateRecord = TemplateRecord> implements Construct<TName, EmailClient<TTemplates>> {
|
|
25
|
+
export declare class Email<TName extends string = string, TTemplates extends TemplateRecord = TemplateRecord> implements Construct<TName, EmailClient<TTemplates>> {
|
|
28
26
|
private readonly options;
|
|
29
27
|
readonly id: TName;
|
|
30
28
|
readonly service: Service<Uncapitalize<TName>, EmailClient<TTemplates>>;
|
|
@@ -44,7 +42,5 @@ declare class Email<TName extends string = string, TTemplates extends TemplateRe
|
|
|
44
42
|
*/
|
|
45
43
|
private connect;
|
|
46
44
|
}
|
|
47
|
-
//# sourceMappingURL=email.d.ts.map
|
|
48
45
|
//#endregion
|
|
49
|
-
export { Email, EmailOptions };
|
|
50
46
|
//# sourceMappingURL=email.d.cts.map
|
package/dist/email.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.cts","names":[],"sources":["../src/email.ts"],"
|
|
1
|
+
{"version":3,"file":"email.d.cts","names":[],"sources":["../src/email.ts"],"mappings":";;;;;iBA8BiB,aAAa,mBAAmB;;;;;;;;;EAShD,WAAW;;;;;;;;EAQX;;qBAGY,MACZ,+BACA,mBAAmB,iBAAiB,2BACxB,UAAU,OAAO,YAAY;mBAavB;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ,YAAY;;;;;mBAM1C;EAEjB,YACC,IAAI,cAAc,QACD,SAAS,aAAa;EAoBxC,WAAW;;;;;;;;UAiBG"}
|
package/dist/email.d.mts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { Construct } from "./construct-interface-
|
|
1
|
+
import { n as Construct } from "./construct-interface-_3zgxzXl.mjs";
|
|
2
2
|
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
3
3
|
import { EmailClient, TemplateRecord } from "@geekmidas/emailkit";
|
|
4
4
|
import { Service } from "@geekmidas/services";
|
|
5
|
-
|
|
6
5
|
//#region src/email.d.ts
|
|
7
|
-
|
|
8
|
-
interface EmailOptions<TTemplates extends TemplateRecord> {
|
|
6
|
+
export interface EmailOptions<TTemplates extends TemplateRecord> {
|
|
9
7
|
/**
|
|
10
8
|
* The React templates this app can send.
|
|
11
9
|
*
|
|
@@ -24,7 +22,7 @@ interface EmailOptions<TTemplates extends TemplateRecord> {
|
|
|
24
22
|
*/
|
|
25
23
|
replyTo?: string;
|
|
26
24
|
}
|
|
27
|
-
declare class Email<TName extends string = string, TTemplates extends TemplateRecord = TemplateRecord> implements Construct<TName, EmailClient<TTemplates>> {
|
|
25
|
+
export declare class Email<TName extends string = string, TTemplates extends TemplateRecord = TemplateRecord> implements Construct<TName, EmailClient<TTemplates>> {
|
|
28
26
|
private readonly options;
|
|
29
27
|
readonly id: TName;
|
|
30
28
|
readonly service: Service<Uncapitalize<TName>, EmailClient<TTemplates>>;
|
|
@@ -44,7 +42,5 @@ declare class Email<TName extends string = string, TTemplates extends TemplateRe
|
|
|
44
42
|
*/
|
|
45
43
|
private connect;
|
|
46
44
|
}
|
|
47
|
-
//# sourceMappingURL=email.d.ts.map
|
|
48
45
|
//#endregion
|
|
49
|
-
export { Email, EmailOptions };
|
|
50
46
|
//# sourceMappingURL=email.d.mts.map
|
package/dist/email.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.mts","names":[],"sources":["../src/email.ts"],"
|
|
1
|
+
{"version":3,"file":"email.d.mts","names":[],"sources":["../src/email.ts"],"mappings":";;;;;iBA8BiB,aAAa,mBAAmB;;;;;;;;;EAShD,WAAW;;;;;;;;EAQX;;qBAGY,MACZ,+BACA,mBAAmB,iBAAiB,2BACxB,UAAU,OAAO,YAAY;mBAavB;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ,YAAY;;;;;mBAM1C;EAEjB,YACC,IAAI,cAAc,QACD,SAAS,aAAa;EAoBxC,WAAW;;;;;;;;UAiBG"}
|
package/dist/email.mjs
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
2
2
|
import { createEmailClient, parseEmailUrl } from "@geekmidas/emailkit";
|
|
3
|
-
|
|
4
3
|
//#region src/email.ts
|
|
4
|
+
/**
|
|
5
|
+
* `Email` — declared outbound mail.
|
|
6
|
+
*
|
|
7
|
+
* The same three-package meeting point as `ObjectStorage`: it implements the
|
|
8
|
+
* construct contract, derives its env key through `@geekmidas/manifest`, and
|
|
9
|
+
* hands back an `@geekmidas/emailkit` client. It names no provider — locally the
|
|
10
|
+
* injected URL points at Mailpit, deployed it points at SES or whichever service
|
|
11
|
+
* config selected.
|
|
12
|
+
*
|
|
13
|
+
* Where object storage needs a driver per provider, this needs none: mail is
|
|
14
|
+
* delivered over SMTP whoever delivers it, so there is one client and one URL
|
|
15
|
+
* shape, and the provider survives only as a host and a credential.
|
|
16
|
+
*/
|
|
5
17
|
var Email = class {
|
|
18
|
+
options;
|
|
6
19
|
id;
|
|
7
20
|
service;
|
|
8
21
|
/**
|
|
@@ -20,7 +33,7 @@ var Email = class {
|
|
|
20
33
|
};
|
|
21
34
|
this.service = {
|
|
22
35
|
serviceName: serviceKey(canonical),
|
|
23
|
-
register: (options
|
|
36
|
+
register: (options) => this.connect(options)
|
|
24
37
|
};
|
|
25
38
|
}
|
|
26
39
|
declare() {
|
|
@@ -52,7 +65,7 @@ var Email = class {
|
|
|
52
65
|
});
|
|
53
66
|
}
|
|
54
67
|
};
|
|
55
|
-
|
|
56
68
|
//#endregion
|
|
57
69
|
export { Email };
|
|
70
|
+
|
|
58
71
|
//# sourceMappingURL=email.mjs.map
|
package/dist/email.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.mjs","names":[
|
|
1
|
+
{"version":3,"file":"email.mjs","names":[],"sources":["../src/email.ts"],"sourcesContent":["/**\n * `Email` — declared outbound mail.\n *\n * The same three-package meeting point as `ObjectStorage`: it implements the\n * construct contract, derives its env key through `@geekmidas/manifest`, and\n * hands back an `@geekmidas/emailkit` client. It names no provider — locally the\n * injected URL points at Mailpit, deployed it points at SES or whichever service\n * config selected.\n *\n * Where object storage needs a driver per provider, this needs none: mail is\n * delivered over SMTP whoever delivers it, so there is one client and one URL\n * shape, and the provider survives only as a host and a credential.\n */\n\nimport {\n\tcreateEmailClient,\n\ttype EmailClient,\n\tparseEmailUrl,\n\ttype TemplateRecord,\n} from '@geekmidas/emailkit';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\n\nexport interface EmailOptions<TTemplates extends TemplateRecord> {\n\t/**\n\t * The React templates this app can send.\n\t *\n\t * Structural — they are code, they ship with the handler, and which ones\n\t * exist cannot differ between stages. They are also what types\n\t * `sendTemplate`, so passing them here is what makes the client's call sites\n\t * checkable.\n\t */\n\ttemplates: TTemplates;\n\t/**\n\t * A reply-to address for every send.\n\t *\n\t * `from` is deliberately absent: it belongs to the verified sending domain,\n\t * which is `myapp.test` locally and the real domain deployed, so it arrives\n\t * as stage config rather than being written here.\n\t */\n\treplyTo?: string;\n}\n\nexport class Email<\n\tTName extends string = string,\n\tTTemplates extends TemplateRecord = TemplateRecord,\n> implements Construct<TName, EmailClient<TTemplates>>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, EmailClient<TTemplates>>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly keys: { url: string; from: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: EmailOptions<TTemplates>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = {\n\t\t\turl: provideKey(canonical, 'url'),\n\t\t\t// The sending identity travels with the URL rather than being a second\n\t\t\t// construct option, for the same reason the URL does: it is the one\n\t\t\t// thing about mail that differs per stage.\n\t\t\tfrom: provideKey(canonical, 'from'),\n\t\t};\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'email',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url, this.keys.from],\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the URL the adapter supplied.\n\t *\n\t * No provider branch and no driver lookup — `parseEmailUrl` turns any of\n\t * Mailpit, SES, or Resend into the same transport config, which is the whole\n\t * reason the scheme is always `smtp://`.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<EmailClient<TTemplates>> {\n\t\tconst { url, from } = envParser\n\t\t\t.create((get) => ({\n\t\t\t\turl: get(this.keys.url).string(),\n\t\t\t\tfrom: get(this.keys.from).string(),\n\t\t\t}))\n\t\t\t.parse();\n\n\t\treturn createEmailClient({\n\t\t\tsmtp: parseEmailUrl(url),\n\t\t\ttemplates: this.options.templates,\n\t\t\tdefaults: {\n\t\t\t\tfrom,\n\t\t\t\t...(this.options.replyTo ? { replyTo: this.options.replyTo } : {}),\n\t\t\t},\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkDA,IAAa,QAAb,MAIA;CAYmB;CAXlB;CACA;;;;;CAMA;CAEA,YACC,IACA,SACC;EADgB,KAAA,UAAA;EAEjB,MAAM,YAAY,YAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO;GACX,KAAK,WAAW,WAAW,KAAK;GAIhC,MAAM,WAAW,WAAW,MAAM;EACnC;EAGA,KAAK,UAAU;GACd,aAAa,WAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI;EACzC,CACD;CACD;;;;;;;;CASA,MAAc,QAAQ,EACrB,aAC4D;EAC5D,MAAM,EAAE,KAAK,SAAS,UACpB,QAAQ,SAAS;GACjB,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO;GAC/B,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,OAAO;EAClC,EAAE,CAAC,CACF,MAAM;EAER,OAAO,kBAAkB;GACxB,MAAM,cAAc,GAAG;GACvB,WAAW,KAAK,QAAQ;GACxB,UAAU;IACT;IACA,GAAI,KAAK,QAAQ,UAAU,EAAE,SAAS,KAAK,QAAQ,QAAQ,IAAI,CAAC;GACjE;EACD,CAAC;CACF;AACD"}
|
package/dist/endpoints/index.cjs
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
require(
|
|
3
|
-
require(
|
|
4
|
-
const
|
|
5
|
-
require(
|
|
6
|
-
const
|
|
7
|
-
const require_surfaceEnv = require('../surfaceEnv-BFXEms2f.cjs');
|
|
8
|
-
const require_lazyAccessors = require('../lazyAccessors-e3j2oE2m.cjs');
|
|
9
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_EndpointFactory = require("../EndpointFactory-BZOCOaK6.cjs");
|
|
3
|
+
const require_functions = require("../functions-ZH60FE7H.cjs");
|
|
4
|
+
const require_Endpoint = require("../Endpoint-D1L9qu5C.cjs");
|
|
5
|
+
const require_surfaceEnv = require("../surfaceEnv-CNimK76p.cjs");
|
|
6
|
+
const require_lazyAccessors = require("../lazyAccessors-hJKGv8Ay.cjs");
|
|
10
7
|
exports.BUILT_IN_SECURITY_SCHEMES = require_EndpointFactory.BUILT_IN_SECURITY_SCHEMES;
|
|
11
8
|
exports.Endpoint = require_Endpoint.Endpoint;
|
|
12
9
|
exports.EndpointBuilder = require_EndpointFactory.EndpointBuilder;
|
|
13
10
|
exports.EndpointFactory = require_EndpointFactory.EndpointFactory;
|
|
11
|
+
exports.NoAuthenticator = require_Endpoint.NoAuthenticator;
|
|
14
12
|
exports.RLS_BYPASS = require_EndpointFactory.RLS_BYPASS;
|
|
15
13
|
exports.ResponseBuilder = require_Endpoint.ResponseBuilder;
|
|
16
14
|
exports.createApiGatewayCookies = require_lazyAccessors.createApiGatewayCookies;
|
|
@@ -24,4 +22,4 @@ exports.defaultEnvParser = require_surfaceEnv.defaultEnvParser;
|
|
|
24
22
|
exports.envParserFor = require_surfaceEnv.envParserFor;
|
|
25
23
|
exports.getSecurityScheme = require_EndpointFactory.getSecurityScheme;
|
|
26
24
|
exports.isBuiltInSecurityScheme = require_EndpointFactory.isBuiltInSecurityScheme;
|
|
27
|
-
exports.publishConstructEvents =
|
|
25
|
+
exports.publishConstructEvents = require_functions.publishConstructEvents;
|
|
@@ -1,7 +1,51 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { s as publishConstructEvents } from "../Construct-BQALFCh2.cjs";
|
|
2
|
+
import { A as getSecurityScheme, C as Authorizer, D as OAuthFlows, E as OAuthFlow, O as SecurityScheme, S as MappedAudit, T as BuiltInSecuritySchemeId, _ as RlsBypass, a as EndpointContext, b as RlsContextExtractor, c as EndpointSchemas, d as ResponseBuilder, g as RLS_BYPASS, h as SessionAuth, i as Endpoint, j as isBuiltInSecurityScheme, k as createAuthorizer, l as EndpointSurface, m as NoAuthenticator, n as ConvertRouteParams, o as EndpointHandler, r as CookieFn, s as EndpointOutput, u as HeaderFn, v as RlsConfig, w as BUILT_IN_SECURITY_SCHEMES, x as ActorExtractor, y as RlsContext } from "../Endpoint-Dp5AKIXl.cjs";
|
|
3
|
+
import { n as EndpointBuilder, t as EndpointFactory } from "../EndpointFactory-FeFRmlDZ.cjs";
|
|
4
|
+
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
5
|
+
import { Context } from "hono";
|
|
6
|
+
//#region src/endpoints/lazyAccessors.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Create a lazy header accessor for Hono.
|
|
9
|
+
* Uses `c.req.header(name)` for single lookups (native, case-insensitive).
|
|
10
|
+
* Only calls `c.req.header()` to get all headers when needed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createHonoHeaders(c: Context): HeaderFn;
|
|
13
|
+
/**
|
|
14
|
+
* Create a lazy cookie accessor for Hono.
|
|
15
|
+
* Uses `getCookie(c, name)` for single lookups (native).
|
|
16
|
+
* Only parses the cookie header when all cookies are requested.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createHonoCookies(c: Context): CookieFn;
|
|
19
|
+
/**
|
|
20
|
+
* Create a lazy header accessor for API Gateway events.
|
|
21
|
+
* Handles case-insensitive lookups.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createApiGatewayHeaders(headers: Record<string, string | undefined> | null | undefined): HeaderFn;
|
|
24
|
+
/**
|
|
25
|
+
* Create a lazy cookie accessor for API Gateway events.
|
|
26
|
+
* Decodes URL-encoded values to match browser behavior.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createApiGatewayCookies(cookies: string[] | undefined, cookieHeader: string | undefined): CookieFn;
|
|
29
|
+
/**
|
|
30
|
+
* Create a no-op header accessor (for minimal endpoints that don't use headers).
|
|
31
|
+
*/
|
|
32
|
+
export declare function createNoopHeaders(): HeaderFn;
|
|
33
|
+
/**
|
|
34
|
+
* Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
|
|
35
|
+
*/
|
|
36
|
+
export declare function createNoopCookies(): CookieFn;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/endpoints/surfaceEnv.d.ts
|
|
39
|
+
/**
|
|
40
|
+
* The default parser, built once.
|
|
41
|
+
*
|
|
42
|
+
* Once because `Credentials` resolves through `globalThis` and decryption is
|
|
43
|
+
* not free, and because two parsers over the same environment are two caches of
|
|
44
|
+
* the same answer.
|
|
45
|
+
*/
|
|
46
|
+
export declare function defaultEnvParser(): EnvironmentParser<{}>;
|
|
47
|
+
/** The parser for an endpoint, from its surface or the default. */
|
|
48
|
+
export declare function envParserFor(surface: EndpointSurface | undefined): EnvironmentParser<{}>;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { type ActorExtractor, type Authorizer, BUILT_IN_SECURITY_SCHEMES, type BuiltInSecuritySchemeId, type ConvertRouteParams, Endpoint, EndpointBuilder, type EndpointContext, EndpointFactory, type EndpointHandler, type EndpointOutput, type EndpointSchemas, type MappedAudit, NoAuthenticator, type OAuthFlow, type OAuthFlows, RLS_BYPASS, ResponseBuilder, type RlsBypass, type RlsConfig, type RlsContext, type RlsContextExtractor, type SecurityScheme, type SessionAuth, createAuthorizer, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
|
|
51
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/endpoints/lazyAccessors.ts","../../src/endpoints/surfaceEnv.ts"],"mappings":";;;;;;;;;;;wBAgBgB,kBAAkB,GAAG,UAAU;;;;;;wBAqB/B,kBAAkB,GAAG,UAAU;;;;;wBAgC/B,wBACf,SAAS,wDACP;;;;;wBAoCa,wBACf,+BACA,mCACE;;;;wBAmHa,qBAAqB;;;;wBAUrB,qBAAqB;;;;;;;;;;wBC1MrB,oBAAoB;;wBASpB,aACf,SAAS,8BACP"}
|
|
@@ -1,7 +1,51 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { s as publishConstructEvents } from "../Construct-QXnl3VqT.mjs";
|
|
2
|
+
import { A as getSecurityScheme, C as Authorizer, D as OAuthFlows, E as OAuthFlow, O as SecurityScheme, S as MappedAudit, T as BuiltInSecuritySchemeId, _ as RlsBypass, a as EndpointContext, b as RlsContextExtractor, c as EndpointSchemas, d as ResponseBuilder, g as RLS_BYPASS, h as SessionAuth, i as Endpoint, j as isBuiltInSecurityScheme, k as createAuthorizer, l as EndpointSurface, m as NoAuthenticator, n as ConvertRouteParams, o as EndpointHandler, r as CookieFn, s as EndpointOutput, u as HeaderFn, v as RlsConfig, w as BUILT_IN_SECURITY_SCHEMES, x as ActorExtractor, y as RlsContext } from "../Endpoint-DtI7heFm.mjs";
|
|
3
|
+
import { n as EndpointBuilder, t as EndpointFactory } from "../EndpointFactory-CgMDvERK.mjs";
|
|
4
|
+
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
5
|
+
import { Context } from "hono";
|
|
6
|
+
//#region src/endpoints/lazyAccessors.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Create a lazy header accessor for Hono.
|
|
9
|
+
* Uses `c.req.header(name)` for single lookups (native, case-insensitive).
|
|
10
|
+
* Only calls `c.req.header()` to get all headers when needed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createHonoHeaders(c: Context): HeaderFn;
|
|
13
|
+
/**
|
|
14
|
+
* Create a lazy cookie accessor for Hono.
|
|
15
|
+
* Uses `getCookie(c, name)` for single lookups (native).
|
|
16
|
+
* Only parses the cookie header when all cookies are requested.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createHonoCookies(c: Context): CookieFn;
|
|
19
|
+
/**
|
|
20
|
+
* Create a lazy header accessor for API Gateway events.
|
|
21
|
+
* Handles case-insensitive lookups.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createApiGatewayHeaders(headers: Record<string, string | undefined> | null | undefined): HeaderFn;
|
|
24
|
+
/**
|
|
25
|
+
* Create a lazy cookie accessor for API Gateway events.
|
|
26
|
+
* Decodes URL-encoded values to match browser behavior.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createApiGatewayCookies(cookies: string[] | undefined, cookieHeader: string | undefined): CookieFn;
|
|
29
|
+
/**
|
|
30
|
+
* Create a no-op header accessor (for minimal endpoints that don't use headers).
|
|
31
|
+
*/
|
|
32
|
+
export declare function createNoopHeaders(): HeaderFn;
|
|
33
|
+
/**
|
|
34
|
+
* Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
|
|
35
|
+
*/
|
|
36
|
+
export declare function createNoopCookies(): CookieFn;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/endpoints/surfaceEnv.d.ts
|
|
39
|
+
/**
|
|
40
|
+
* The default parser, built once.
|
|
41
|
+
*
|
|
42
|
+
* Once because `Credentials` resolves through `globalThis` and decryption is
|
|
43
|
+
* not free, and because two parsers over the same environment are two caches of
|
|
44
|
+
* the same answer.
|
|
45
|
+
*/
|
|
46
|
+
export declare function defaultEnvParser(): EnvironmentParser<{}>;
|
|
47
|
+
/** The parser for an endpoint, from its surface or the default. */
|
|
48
|
+
export declare function envParserFor(surface: EndpointSurface | undefined): EnvironmentParser<{}>;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { type ActorExtractor, type Authorizer, BUILT_IN_SECURITY_SCHEMES, type BuiltInSecuritySchemeId, type ConvertRouteParams, Endpoint, EndpointBuilder, type EndpointContext, EndpointFactory, type EndpointHandler, type EndpointOutput, type EndpointSchemas, type MappedAudit, NoAuthenticator, type OAuthFlow, type OAuthFlows, RLS_BYPASS, ResponseBuilder, type RlsBypass, type RlsConfig, type RlsContext, type RlsContextExtractor, type SecurityScheme, type SessionAuth, createAuthorizer, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
|
|
51
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/endpoints/lazyAccessors.ts","../../src/endpoints/surfaceEnv.ts"],"mappings":";;;;;;;;;;;wBAgBgB,kBAAkB,GAAG,UAAU;;;;;;wBAqB/B,kBAAkB,GAAG,UAAU;;;;;wBAgC/B,wBACf,SAAS,wDACP;;;;;wBAoCa,wBACf,+BACA,mCACE;;;;wBAmHa,qBAAqB;;;;wBAUrB,qBAAqB;;;;;;;;;;wBC1MrB,oBAAoB;;wBASpB,aACf,SAAS,8BACP"}
|
package/dist/endpoints/index.mjs
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
4
|
-
import {
|
|
5
|
-
import "../
|
|
6
|
-
|
|
7
|
-
import { defaultEnvParser, envParserFor } from "../surfaceEnv-C3Ktahea.mjs";
|
|
8
|
-
import { createApiGatewayCookies, createApiGatewayHeaders, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, publishConstructEvents } from "../lazyAccessors-BoJN3SMd.mjs";
|
|
9
|
-
|
|
10
|
-
export { BUILT_IN_SECURITY_SCHEMES, Endpoint, EndpointBuilder, EndpointFactory, RLS_BYPASS, ResponseBuilder, createApiGatewayCookies, createApiGatewayHeaders, createAuthorizer, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, defaultEnvParser, envParserFor, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
|
|
1
|
+
import { a as createAuthorizer, i as BUILT_IN_SECURITY_SCHEMES, n as EndpointBuilder, o as getSecurityScheme, r as RLS_BYPASS, s as isBuiltInSecurityScheme, t as EndpointFactory } from "../EndpointFactory-BBdNeaGJ.mjs";
|
|
2
|
+
import { i as publishConstructEvents } from "../functions-DCIfCRR-.mjs";
|
|
3
|
+
import { n as ResponseBuilder, r as NoAuthenticator, t as Endpoint } from "../Endpoint-CQAeh1Rh.mjs";
|
|
4
|
+
import { n as envParserFor, t as defaultEnvParser } from "../surfaceEnv-wMT5QzgZ.mjs";
|
|
5
|
+
import { a as createHonoHeaders, i as createHonoCookies, n as createApiGatewayHeaders, o as createNoopCookies, s as createNoopHeaders, t as createApiGatewayCookies } from "../lazyAccessors-CFanua0O.mjs";
|
|
6
|
+
export { BUILT_IN_SECURITY_SCHEMES, Endpoint, EndpointBuilder, EndpointFactory, NoAuthenticator, RLS_BYPASS, ResponseBuilder, createApiGatewayCookies, createApiGatewayHeaders, createAuthorizer, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, defaultEnvParser, envParserFor, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
|