@geekmidas/constructs 10.0.0-alpha.17 → 10.0.0-alpha.170
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 +246 -158
- package/dist/Construct-127M7yrl.d.cts +231 -0
- package/dist/Construct-127M7yrl.d.cts.map +1 -0
- package/dist/Construct-BMk_CRSD.d.mts +231 -0
- package/dist/Construct-BMk_CRSD.d.mts.map +1 -0
- package/dist/{Construct-BeYVu_QF.mjs → Construct-CGuc_Ijk.mjs} +8 -9
- package/dist/Construct-CGuc_Ijk.mjs.map +1 -0
- package/dist/{Construct-DqdlARxq.cjs → Construct-DorKS0Ua.cjs} +8 -9
- package/dist/Construct-DorKS0Ua.cjs.map +1 -0
- package/dist/{Cron-l4Wlz6G9.d.mts → Cron-Ca_qHQu2.d.cts} +16 -9
- package/dist/Cron-Ca_qHQu2.d.cts.map +1 -0
- package/dist/{Cron-zsoSAwZo.d.cts → Cron-DPJiR7Lt.d.mts} +15 -8
- package/dist/Cron-DPJiR7Lt.d.mts.map +1 -0
- package/dist/CronBuilder-BC4za5Bx.d.mts +47 -0
- package/dist/CronBuilder-BC4za5Bx.d.mts.map +1 -0
- package/dist/{CronBuilder-D_0HNBTr.mjs → CronBuilder-BJ5LoadF.mjs} +28 -11
- package/dist/CronBuilder-BJ5LoadF.mjs.map +1 -0
- package/dist/{CronBuilder-BdnI6lxF.cjs → CronBuilder-B_NSP-Y5.cjs} +27 -10
- package/dist/CronBuilder-B_NSP-Y5.cjs.map +1 -0
- package/dist/CronBuilder-C3RrAF1-.d.cts +47 -0
- package/dist/CronBuilder-C3RrAF1-.d.cts.map +1 -0
- package/dist/Endpoint-52z1P0Ue.cjs +581 -0
- package/dist/Endpoint-52z1P0Ue.cjs.map +1 -0
- package/dist/{Endpoint-DBflWAe4.d.cts → Endpoint-BlIZLsBQ.d.cts} +101 -20
- package/dist/Endpoint-BlIZLsBQ.d.cts.map +1 -0
- package/dist/{Endpoint-oS-Fe3d_.d.mts → Endpoint-DC7mreOr.d.mts} +104 -23
- package/dist/Endpoint-DC7mreOr.d.mts.map +1 -0
- package/dist/Endpoint-sUOU7uLx.mjs +552 -0
- package/dist/Endpoint-sUOU7uLx.mjs.map +1 -0
- package/dist/{EndpointFactory-Bm3aKRdV.mjs → EndpointFactory-Bzi9Sl7r.mjs} +269 -53
- package/dist/EndpointFactory-Bzi9Sl7r.mjs.map +1 -0
- package/dist/{EndpointFactory-CLvWuHyt.cjs → EndpointFactory-Cf_Cs1ym.cjs} +309 -51
- package/dist/EndpointFactory-Cf_Cs1ym.cjs.map +1 -0
- package/dist/{index-Cc4kKPag.d.mts → EndpointFactory-DCmnCmkX.d.mts} +189 -106
- package/dist/EndpointFactory-DCmnCmkX.d.mts.map +1 -0
- package/dist/{index-C1ZwNOOk.d.cts → EndpointFactory-cVTb8kCc.d.cts} +187 -104
- package/dist/EndpointFactory-cVTb8kCc.d.cts.map +1 -0
- package/dist/Function-BIEsY0Hm.d.cts +76 -0
- package/dist/Function-BIEsY0Hm.d.cts.map +1 -0
- package/dist/Function-BKReud5p.d.mts +76 -0
- package/dist/Function-BKReud5p.d.mts.map +1 -0
- package/dist/{HonoEndpointAdaptor-92zavCsV.cjs → HonoEndpointAdaptor-BTbqfSaa.cjs} +115 -41
- package/dist/HonoEndpointAdaptor-BTbqfSaa.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-yYaU7jVJ.mjs → HonoEndpointAdaptor-CBVey2cY.mjs} +112 -38
- package/dist/HonoEndpointAdaptor-CBVey2cY.mjs.map +1 -0
- package/dist/ObjectSubscriberBuilder-AwGKoUKy.d.mts +129 -0
- package/dist/ObjectSubscriberBuilder-AwGKoUKy.d.mts.map +1 -0
- package/dist/ObjectSubscriberBuilder-CB6imsX4.d.cts +129 -0
- package/dist/ObjectSubscriberBuilder-CB6imsX4.d.cts.map +1 -0
- package/dist/ProcessorBuilder-CeEZ2vCx.d.cts +216 -0
- package/dist/ProcessorBuilder-CeEZ2vCx.d.cts.map +1 -0
- package/dist/ProcessorBuilder-CwIlm75W.d.mts +216 -0
- package/dist/ProcessorBuilder-CwIlm75W.d.mts.map +1 -0
- package/dist/Queue-9Hh20ZCk.mjs +104 -0
- package/dist/Queue-9Hh20ZCk.mjs.map +1 -0
- package/dist/{Queue-D9X6OoON.d.mts → Queue-B8HGg439.d.mts} +42 -41
- package/dist/Queue-B8HGg439.d.mts.map +1 -0
- package/dist/{Queue-DYPB2KWL.d.cts → Queue-C4rijiM7.d.cts} +43 -42
- package/dist/Queue-C4rijiM7.d.cts.map +1 -0
- package/dist/Queue-W1wueijP.cjs +109 -0
- package/dist/Queue-W1wueijP.cjs.map +1 -0
- package/dist/QueueBuilder-BDcv9B71.cjs +135 -0
- package/dist/QueueBuilder-BDcv9B71.cjs.map +1 -0
- package/dist/QueueBuilder-CUERv8jt.d.mts +75 -0
- package/dist/QueueBuilder-CUERv8jt.d.mts.map +1 -0
- package/dist/QueueBuilder-CmB1vOgn.d.cts +75 -0
- package/dist/QueueBuilder-CmB1vOgn.d.cts.map +1 -0
- package/dist/QueueBuilder-CrZL8HHs.mjs +118 -0
- package/dist/QueueBuilder-CrZL8HHs.mjs.map +1 -0
- package/dist/Subscriber-5rCX1Nph.d.cts +83 -0
- package/dist/Subscriber-5rCX1Nph.d.cts.map +1 -0
- package/dist/Subscriber-CtQXhcL7.d.mts +83 -0
- package/dist/Subscriber-CtQXhcL7.d.mts.map +1 -0
- package/dist/SubscriberBuilder-CpFhShTJ.mjs +238 -0
- package/dist/SubscriberBuilder-CpFhShTJ.mjs.map +1 -0
- package/dist/SubscriberBuilder-DJEvNRdD.cjs +261 -0
- package/dist/SubscriberBuilder-DJEvNRdD.cjs.map +1 -0
- package/dist/Topic-BGoOeCT6.mjs +99 -0
- package/dist/Topic-BGoOeCT6.mjs.map +1 -0
- package/dist/Topic-DLCZBNwK.cjs +104 -0
- package/dist/Topic-DLCZBNwK.cjs.map +1 -0
- package/dist/adaptors/aws.cjs +147 -168
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +57 -48
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +58 -49
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +142 -164
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/awsWebsocket.cjs +354 -0
- package/dist/adaptors/awsWebsocket.cjs.map +1 -0
- package/dist/adaptors/awsWebsocket.d.cts +156 -0
- package/dist/adaptors/awsWebsocket.d.cts.map +1 -0
- package/dist/adaptors/awsWebsocket.d.mts +156 -0
- package/dist/adaptors/awsWebsocket.d.mts.map +1 -0
- package/dist/adaptors/awsWebsocket.mjs +347 -0
- package/dist/adaptors/awsWebsocket.mjs.map +1 -0
- package/dist/adaptors/hono.cjs +1 -1
- package/dist/adaptors/hono.d.cts +8 -7
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +10 -9
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +1 -1
- package/dist/adaptors/testing.cjs +1174 -41
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +517 -40
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +517 -40
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +1140 -36
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-1yI2wR-4.d.cts +274 -0
- package/dist/auth-1yI2wR-4.d.cts.map +1 -0
- package/dist/auth-D4NMXgLt.d.mts +274 -0
- package/dist/auth-D4NMXgLt.d.mts.map +1 -0
- package/dist/auth.cjs +311 -26
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +2 -104
- package/dist/auth.d.mts +2 -104
- package/dist/auth.mjs +307 -28
- package/dist/auth.mjs.map +1 -1
- package/dist/cache-0VoeOTF9.d.mts +44 -0
- package/dist/cache-0VoeOTF9.d.mts.map +1 -0
- package/dist/cache-CW-sArzS.d.cts +44 -0
- package/dist/cache-CW-sArzS.d.cts.map +1 -0
- package/dist/cache.cjs +4 -20
- package/dist/cache.cjs.map +1 -1
- package/dist/cache.d.cts +2 -43
- package/dist/cache.d.mts +2 -43
- package/dist/cache.mjs +4 -20
- package/dist/cache.mjs.map +1 -1
- package/dist/cipher-C1lEFX63.mjs +225 -0
- package/dist/cipher-C1lEFX63.mjs.map +1 -0
- package/dist/cipher-CVxfwLjk.cjs +332 -0
- package/dist/cipher-CVxfwLjk.cjs.map +1 -0
- package/dist/cipher-DSDxPRIp.d.cts +106 -0
- package/dist/cipher-DSDxPRIp.d.cts.map +1 -0
- package/dist/cipher-DSDxPRIp.d.mts +106 -0
- package/dist/cipher-DSDxPRIp.d.mts.map +1 -0
- package/dist/{construct-interface-DPlxfpoS.d.mts → construct-interface-DhbaONW2.d.cts} +63 -8
- package/dist/construct-interface-DhbaONW2.d.cts.map +1 -0
- package/dist/{construct-interface-DgXTJcOD.d.cts → construct-interface-DxfkFxkl.d.mts} +63 -8
- package/dist/construct-interface-DxfkFxkl.d.mts.map +1 -0
- package/dist/construct-interface.cjs +47 -4
- package/dist/construct-interface.cjs.map +1 -1
- package/dist/construct-interface.d.cts +2 -2
- package/dist/construct-interface.d.mts +2 -2
- package/dist/construct-interface.mjs +45 -5
- package/dist/construct-interface.mjs.map +1 -1
- package/dist/credential-B80mOxwT.mjs +222 -0
- package/dist/credential-B80mOxwT.mjs.map +1 -0
- package/dist/credential-RlgbzZAc.cjs +257 -0
- package/dist/credential-RlgbzZAc.cjs.map +1 -0
- package/dist/credential.cjs +7 -129
- package/dist/credential.d.cts +2 -58
- package/dist/credential.d.mts +2 -58
- package/dist/credential.mjs +2 -128
- package/dist/crons/index.cjs +127 -1
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +43 -3
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +43 -3
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +126 -2
- package/dist/crons/index.mjs.map +1 -1
- package/dist/database/kysely.cjs +3 -194
- package/dist/database/kysely.d.cts +2 -149
- package/dist/database/kysely.d.mts +2 -149
- package/dist/database/kysely.mjs +2 -192
- package/dist/email.cjs +24 -17
- package/dist/email.cjs.map +1 -1
- package/dist/email.d.cts +15 -5
- package/dist/email.d.cts.map +1 -1
- package/dist/email.d.mts +16 -6
- package/dist/email.d.mts.map +1 -1
- package/dist/email.mjs +23 -17
- package/dist/email.mjs.map +1 -1
- package/dist/encryption/kms.cjs +95 -0
- package/dist/encryption/kms.cjs.map +1 -0
- package/dist/encryption/kms.d.cts +7 -0
- package/dist/encryption/kms.d.cts.map +1 -0
- package/dist/encryption/kms.d.mts +7 -0
- package/dist/encryption/kms.d.mts.map +1 -0
- package/dist/encryption/kms.mjs +93 -0
- package/dist/encryption/kms.mjs.map +1 -0
- package/dist/encryption.cjs +116 -0
- package/dist/encryption.cjs.map +1 -0
- package/dist/encryption.d.cts +37 -0
- package/dist/encryption.d.cts.map +1 -0
- package/dist/encryption.d.mts +37 -0
- package/dist/encryption.d.mts.map +1 -0
- package/dist/encryption.mjs +101 -0
- package/dist/encryption.mjs.map +1 -0
- package/dist/endpoints/index.cjs +32 -10
- package/dist/endpoints/index.d.cts +106 -3
- package/dist/endpoints/index.d.cts.map +1 -0
- package/dist/endpoints/index.d.mts +106 -3
- package/dist/endpoints/index.d.mts.map +1 -0
- package/dist/endpoints/index.mjs +6 -4
- package/dist/expire-C586zznE.d.cts +38 -0
- package/dist/expire-C586zznE.d.cts.map +1 -0
- package/dist/expire-C586zznE.d.mts +38 -0
- package/dist/expire-C586zznE.d.mts.map +1 -0
- package/dist/expire-CieftS01.cjs +67 -0
- package/dist/expire-CieftS01.cjs.map +1 -0
- package/dist/expire-CpzUAfr9.mjs +50 -0
- package/dist/expire-CpzUAfr9.mjs.map +1 -0
- package/dist/external-api.cjs +106 -0
- package/dist/external-api.cjs.map +1 -0
- package/dist/external-api.d.cts +2 -0
- package/dist/external-api.d.mts +2 -0
- package/dist/external-api.mjs +103 -0
- package/dist/external-api.mjs.map +1 -0
- package/dist/fake-BvOXkZmj.d.mts +201 -0
- package/dist/fake-BvOXkZmj.d.mts.map +1 -0
- package/dist/fake-Djx8E0o1.d.cts +201 -0
- package/dist/fake-Djx8E0o1.d.cts.map +1 -0
- package/dist/file-server.cjs +200 -48
- package/dist/file-server.cjs.map +1 -1
- package/dist/file-server.d.cts +147 -15
- package/dist/file-server.d.cts.map +1 -1
- package/dist/file-server.d.mts +147 -15
- package/dist/file-server.d.mts.map +1 -1
- package/dist/file-server.mjs +198 -50
- package/dist/file-server.mjs.map +1 -1
- package/dist/functions/index.cjs +1 -1
- package/dist/functions/index.d.cts +2 -1
- package/dist/functions/index.d.mts +2 -1
- package/dist/functions/index.mjs +1 -1
- package/dist/{functions-C53GW2eQ.mjs → functions-BvIDQKAA.mjs} +117 -22
- package/dist/functions-BvIDQKAA.mjs.map +1 -0
- package/dist/{functions-B6qCvfmy.cjs → functions-DLF6-IK8.cjs} +122 -18
- package/dist/functions-DLF6-IK8.cjs.map +1 -0
- package/dist/inbox-BjvMs7EJ.d.cts +195 -0
- package/dist/inbox-BjvMs7EJ.d.cts.map +1 -0
- package/dist/inbox-C8bOR9UL.d.mts +195 -0
- package/dist/inbox-C8bOR9UL.d.mts.map +1 -0
- package/dist/inbox.cjs +291 -0
- package/dist/inbox.cjs.map +1 -0
- package/dist/inbox.d.cts +2 -0
- package/dist/inbox.d.mts +2 -0
- package/dist/inbox.mjs +283 -0
- package/dist/inbox.mjs.map +1 -0
- package/dist/index-DaK-C7N3.d.cts +115 -0
- package/dist/index-DaK-C7N3.d.cts.map +1 -0
- package/dist/{index-CeEtxDmK.d.cts → index-DdRjYhiJ.d.cts} +42 -2
- package/dist/{index-CeEtxDmK.d.cts.map → index-DdRjYhiJ.d.cts.map} +1 -1
- package/dist/{index-CeEtxDmK.d.mts → index-DdRjYhiJ.d.mts} +42 -2
- package/dist/{index-CeEtxDmK.d.mts.map → index-DdRjYhiJ.d.mts.map} +1 -1
- package/dist/index-vCS4HBEG.d.mts +115 -0
- package/dist/index-vCS4HBEG.d.mts.map +1 -0
- package/dist/index.cjs +4 -1
- package/dist/index.d.cts +26 -3
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +26 -3
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -2
- package/dist/kysely-2HqIQ2fC.d.cts +216 -0
- package/dist/kysely-2HqIQ2fC.d.cts.map +1 -0
- package/dist/kysely-BGvpd_ZH.d.mts +216 -0
- package/dist/kysely-BGvpd_ZH.d.mts.map +1 -0
- package/dist/kysely-Bc9xzaik.mjs +371 -0
- package/dist/kysely-Bc9xzaik.mjs.map +1 -0
- package/dist/kysely-D7f6J2lh.cjs +384 -0
- package/dist/kysely-D7f6J2lh.cjs.map +1 -0
- package/dist/{telemetry-DGcFlVpB.d.cts → lambdaTelemetry-8vnmVZQ5.d.cts} +2 -2
- package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +1 -0
- package/dist/{telemetry-DGcFlVpB.d.mts → lambdaTelemetry-8vnmVZQ5.d.mts} +2 -2
- package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +1 -0
- package/dist/mobile-app.cjs +78 -0
- package/dist/mobile-app.cjs.map +1 -0
- package/dist/mobile-app.d.cts +77 -0
- package/dist/mobile-app.d.cts.map +1 -0
- package/dist/mobile-app.d.mts +77 -0
- package/dist/mobile-app.d.mts.map +1 -0
- package/dist/mobile-app.mjs +77 -0
- package/dist/mobile-app.mjs.map +1 -0
- package/dist/object-storage.cjs +14 -7
- package/dist/object-storage.cjs.map +1 -1
- package/dist/object-storage.d.cts +12 -3
- package/dist/object-storage.d.cts.map +1 -1
- package/dist/object-storage.d.mts +12 -3
- package/dist/object-storage.d.mts.map +1 -1
- package/dist/object-storage.mjs +14 -9
- package/dist/object-storage.mjs.map +1 -1
- package/dist/optionalPeers-D7Wt6dnF.mjs +140 -0
- package/dist/optionalPeers-D7Wt6dnF.mjs.map +1 -0
- package/dist/optionalPeers-DuNQXXe1.cjs +223 -0
- package/dist/optionalPeers-DuNQXXe1.cjs.map +1 -0
- package/dist/origins-BjxYht13.cjs +96 -0
- package/dist/origins-BjxYht13.cjs.map +1 -0
- package/dist/origins-Boc9qbo-.mjs +73 -0
- package/dist/origins-Boc9qbo-.mjs.map +1 -0
- package/dist/pattern-C1CEcglD.mjs +241 -0
- package/dist/pattern-C1CEcglD.mjs.map +1 -0
- package/dist/pattern-QFaUIr77.cjs +288 -0
- package/dist/pattern-QFaUIr77.cjs.map +1 -0
- package/dist/privateAddress-Bg5fUsbp.mjs +21 -0
- package/dist/privateAddress-Bg5fUsbp.mjs.map +1 -0
- package/dist/privateAddress-CqGyuFHn.cjs +26 -0
- package/dist/privateAddress-CqGyuFHn.cjs.map +1 -0
- package/dist/processors/index.cjs +214 -0
- package/dist/processors/index.cjs.map +1 -0
- package/dist/processors/index.d.cts +78 -0
- package/dist/processors/index.d.cts.map +1 -0
- package/dist/processors/index.d.mts +78 -0
- package/dist/processors/index.d.mts.map +1 -0
- package/dist/processors/index.mjs +193 -0
- package/dist/processors/index.mjs.map +1 -0
- package/dist/queue/index.cjs +5 -192
- package/dist/queue/index.d.cts +3 -53
- package/dist/queue/index.d.mts +3 -53
- package/dist/queue/index.mjs +3 -190
- package/dist/random-password.cjs +86 -0
- package/dist/random-password.cjs.map +1 -0
- package/dist/random-password.d.cts +30 -0
- package/dist/random-password.d.cts.map +1 -0
- package/dist/random-password.d.mts +30 -0
- package/dist/random-password.d.mts.map +1 -0
- package/dist/random-password.mjs +84 -0
- package/dist/random-password.mjs.map +1 -0
- package/dist/readRequestBody-BmKnPl0a.mjs +293 -0
- package/dist/readRequestBody-BmKnPl0a.mjs.map +1 -0
- package/dist/{lazyAccessors-Dx9NLwJZ.cjs → readRequestBody-CN9GVdeE.cjs} +141 -47
- package/dist/readRequestBody-CN9GVdeE.cjs.map +1 -0
- package/dist/{processAudits-D_2W5x8k.cjs → requestLogger-CnoYd-Ah.cjs} +63 -3
- package/dist/requestLogger-CnoYd-Ah.cjs.map +1 -0
- package/dist/{processAudits-BpRlPQMW.mjs → requestLogger-D2JS7pPM.mjs} +51 -3
- package/dist/requestLogger-D2JS7pPM.mjs.map +1 -0
- package/dist/rest-api.cjs +100 -73
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +83 -59
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +83 -59
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +97 -76
- package/dist/rest-api.mjs.map +1 -1
- package/dist/runSubscriber-HEqXkin1.mjs +117 -0
- package/dist/runSubscriber-HEqXkin1.mjs.map +1 -0
- package/dist/runSubscriber-sVJfLA0-.cjs +134 -0
- package/dist/runSubscriber-sVJfLA0-.cjs.map +1 -0
- package/dist/shutdown-BMJmAhSt.cjs +38 -0
- package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
- package/dist/shutdown-C7xa8x9S.mjs +27 -0
- package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
- package/dist/site.cjs +137 -10
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +153 -3
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +153 -3
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +117 -13
- package/dist/site.mjs.map +1 -1
- package/dist/stages-DaTaoQei.d.cts +73 -0
- package/dist/stages-DaTaoQei.d.cts.map +1 -0
- package/dist/stages-DaTaoQei.d.mts +73 -0
- package/dist/stages-DaTaoQei.d.mts.map +1 -0
- package/dist/subscribers/index.cjs +134 -1
- package/dist/subscribers/index.cjs.map +1 -0
- package/dist/subscribers/index.d.cts +74 -3
- package/dist/subscribers/index.d.cts.map +1 -0
- package/dist/subscribers/index.d.mts +74 -3
- package/dist/subscribers/index.d.mts.map +1 -0
- package/dist/subscribers/index.mjs +132 -2
- package/dist/subscribers/index.mjs.map +1 -0
- package/dist/telemetry-BirKau0X.d.mts +40 -0
- package/dist/telemetry-BirKau0X.d.mts.map +1 -0
- package/dist/telemetry-DjJgtQ_N.d.cts +40 -0
- package/dist/telemetry-DjJgtQ_N.d.cts.map +1 -0
- package/dist/telemetry.cjs +56 -0
- package/dist/telemetry.cjs.map +1 -0
- package/dist/telemetry.d.cts +2 -0
- package/dist/telemetry.d.mts +2 -0
- package/dist/telemetry.mjs +55 -0
- package/dist/telemetry.mjs.map +1 -0
- package/dist/topic/index.cjs +2 -134
- package/dist/topic/index.d.cts +2 -3
- package/dist/topic/index.d.mts +2 -3
- package/dist/topic/index.mjs +2 -132
- package/dist/tracing-Bbj1uoFJ.mjs +127 -0
- package/dist/tracing-Bbj1uoFJ.mjs.map +1 -0
- package/dist/tracing-C0ooU0V2.cjs +150 -0
- package/dist/tracing-C0ooU0V2.cjs.map +1 -0
- package/dist/websocket-api-C6LGg9-D.mjs +1716 -0
- package/dist/websocket-api-C6LGg9-D.mjs.map +1 -0
- package/dist/websocket-api-CD-E5Ogr.d.cts +1207 -0
- package/dist/websocket-api-CD-E5Ogr.d.cts.map +1 -0
- package/dist/websocket-api-CoKPJJRl.cjs +1895 -0
- package/dist/websocket-api-CoKPJJRl.cjs.map +1 -0
- package/dist/websocket-api-pJJfeTcm.d.mts +1207 -0
- package/dist/websocket-api-pJJfeTcm.d.mts.map +1 -0
- package/dist/websocket-api.cjs +42 -0
- package/dist/websocket-api.d.cts +2 -0
- package/dist/websocket-api.d.mts +2 -0
- package/dist/websocket-api.mjs +3 -0
- package/dist/worker.cjs +174 -32
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +147 -47
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +147 -47
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +175 -33
- package/dist/worker.mjs.map +1 -1
- package/package.json +180 -43
- package/dist/Construct-BeYVu_QF.mjs.map +0 -1
- package/dist/Construct-DfbwIntp.d.cts +0 -115
- package/dist/Construct-DfbwIntp.d.cts.map +0 -1
- package/dist/Construct-DqdlARxq.cjs.map +0 -1
- package/dist/Construct-l5aOn_jv.d.mts +0 -115
- package/dist/Construct-l5aOn_jv.d.mts.map +0 -1
- package/dist/Cron-l4Wlz6G9.d.mts.map +0 -1
- package/dist/Cron-zsoSAwZo.d.cts.map +0 -1
- package/dist/CronBuilder-BdnI6lxF.cjs.map +0 -1
- package/dist/CronBuilder-CyT71Nzg.d.cts +0 -41
- package/dist/CronBuilder-CyT71Nzg.d.cts.map +0 -1
- package/dist/CronBuilder-D_0HNBTr.mjs.map +0 -1
- package/dist/CronBuilder-UoNgFe8S.d.mts +0 -41
- package/dist/CronBuilder-UoNgFe8S.d.mts.map +0 -1
- package/dist/Endpoint-BpZHtJ2W.cjs +0 -1689
- package/dist/Endpoint-BpZHtJ2W.cjs.map +0 -1
- package/dist/Endpoint-DBflWAe4.d.cts.map +0 -1
- package/dist/Endpoint-ONsly_dq.mjs +0 -1671
- package/dist/Endpoint-ONsly_dq.mjs.map +0 -1
- package/dist/Endpoint-oS-Fe3d_.d.mts.map +0 -1
- package/dist/EndpointFactory-Bm3aKRdV.mjs.map +0 -1
- package/dist/EndpointFactory-CLvWuHyt.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-92zavCsV.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-yYaU7jVJ.mjs.map +0 -1
- package/dist/Queue-D9X6OoON.d.mts.map +0 -1
- package/dist/Queue-DYPB2KWL.d.cts.map +0 -1
- package/dist/Subscriber-C4heaAyO.d.mts +0 -51
- package/dist/Subscriber-C4heaAyO.d.mts.map +0 -1
- package/dist/Subscriber-CotDUELC.d.cts +0 -51
- package/dist/Subscriber-CotDUELC.d.cts.map +0 -1
- package/dist/SubscriberBuilder-BEv0eoHy.d.cts +0 -59
- package/dist/SubscriberBuilder-BEv0eoHy.d.cts.map +0 -1
- package/dist/SubscriberBuilder-C0ZEtGDI.cjs +0 -125
- package/dist/SubscriberBuilder-C0ZEtGDI.cjs.map +0 -1
- package/dist/SubscriberBuilder-h7B_cHMr.mjs +0 -114
- package/dist/SubscriberBuilder-h7B_cHMr.mjs.map +0 -1
- package/dist/SubscriberBuilder-tyH5yTk5.d.mts +0 -59
- package/dist/SubscriberBuilder-tyH5yTk5.d.mts.map +0 -1
- package/dist/Topic-DEVGo0Dm.d.cts +0 -89
- package/dist/Topic-DEVGo0Dm.d.cts.map +0 -1
- package/dist/Topic-zk_6Gthr.d.mts +0 -89
- package/dist/Topic-zk_6Gthr.d.mts.map +0 -1
- package/dist/auth.d.cts.map +0 -1
- package/dist/auth.d.mts.map +0 -1
- package/dist/cache.d.cts.map +0 -1
- package/dist/cache.d.mts.map +0 -1
- package/dist/construct-interface-DPlxfpoS.d.mts.map +0 -1
- package/dist/construct-interface-DgXTJcOD.d.cts.map +0 -1
- package/dist/credential.cjs.map +0 -1
- package/dist/credential.d.cts.map +0 -1
- package/dist/credential.d.mts.map +0 -1
- package/dist/credential.mjs.map +0 -1
- package/dist/database/kysely.cjs.map +0 -1
- package/dist/database/kysely.d.cts.map +0 -1
- package/dist/database/kysely.d.mts.map +0 -1
- package/dist/database/kysely.mjs.map +0 -1
- package/dist/functions-B6qCvfmy.cjs.map +0 -1
- package/dist/functions-C53GW2eQ.mjs.map +0 -1
- package/dist/index-B2urf3YI.d.cts +0 -26
- package/dist/index-B2urf3YI.d.cts.map +0 -1
- package/dist/index-C1ZwNOOk.d.cts.map +0 -1
- package/dist/index-Cc4kKPag.d.mts.map +0 -1
- package/dist/index-DMCDvnsM.d.mts +0 -26
- package/dist/index-DMCDvnsM.d.mts.map +0 -1
- package/dist/index-D_frT6MP.d.cts +0 -165
- package/dist/index-D_frT6MP.d.cts.map +0 -1
- package/dist/index-DcyIYbDS.d.mts +0 -165
- package/dist/index-DcyIYbDS.d.mts.map +0 -1
- package/dist/lazyAccessors-BHtcqgz2.mjs +0 -211
- package/dist/lazyAccessors-BHtcqgz2.mjs.map +0 -1
- package/dist/lazyAccessors-Dx9NLwJZ.cjs.map +0 -1
- package/dist/processAudits-BpRlPQMW.mjs.map +0 -1
- package/dist/processAudits-D_2W5x8k.cjs.map +0 -1
- package/dist/queue/index.cjs.map +0 -1
- package/dist/queue/index.d.cts.map +0 -1
- package/dist/queue/index.d.mts.map +0 -1
- package/dist/queue/index.mjs.map +0 -1
- package/dist/telemetry-DGcFlVpB.d.cts.map +0 -1
- package/dist/telemetry-DGcFlVpB.d.mts.map +0 -1
- package/dist/topic/index.cjs.map +0 -1
- package/dist/topic/index.mjs.map +0 -1
package/dist/auth.d.cts
CHANGED
|
@@ -1,104 +1,2 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
|
|
3
|
-
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
4
|
-
import { Hono } from "hono";
|
|
5
|
-
import { betterAuth } from "better-auth";
|
|
6
|
-
//#region src/auth.d.ts
|
|
7
|
-
/** The server better-auth hands back. */
|
|
8
|
-
export type AuthServer = ReturnType<typeof betterAuth>;
|
|
9
|
-
/** Everything better-auth takes, minus what the construct owns. */
|
|
10
|
-
export type BetterAuthOptions = Omit<Parameters<typeof betterAuth>[0], 'database' | 'secret' | 'basePath' | 'baseURL'>;
|
|
11
|
-
export interface BetterAuthConfig<TDatabase extends Consumable> {
|
|
12
|
-
/**
|
|
13
|
-
* The schema tenant its tables live in.
|
|
14
|
-
*
|
|
15
|
-
* A construct rather than a URL: the tenant already declares its schema and
|
|
16
|
-
* its role, and taking the declaration is what puts the edge in the graph
|
|
17
|
-
* instead of a connection string in two places.
|
|
18
|
-
*/
|
|
19
|
-
database: TDatabase;
|
|
20
|
-
/**
|
|
21
|
-
* The app that serves this auth server, relative to the workspace root —
|
|
22
|
-
* `'apps/auth'`.
|
|
23
|
-
*
|
|
24
|
-
* Required, for the reason `RestApi.path` is. Not to be confused with
|
|
25
|
-
* `basePath`, which is where its routes are mounted in a URL.
|
|
26
|
-
*/
|
|
27
|
-
path: string;
|
|
28
|
-
/**
|
|
29
|
-
* Where the auth routes are mounted, e.g. `/api/auth`.
|
|
30
|
-
*
|
|
31
|
-
* Structural — it is part of the URL every client calls, so it cannot differ
|
|
32
|
-
* between stages the way the host can.
|
|
33
|
-
*/
|
|
34
|
-
basePath?: string;
|
|
35
|
-
/**
|
|
36
|
-
* The rest of better-auth's options: providers, plugins, email settings.
|
|
37
|
-
*
|
|
38
|
-
* A function when they need another construct — a magic-link plugin has to
|
|
39
|
-
* *send* the link, and the thing that sends mail is a construct whose client
|
|
40
|
-
* has to be registered. It is handed the same `ServiceRegisterOptions` this
|
|
41
|
-
* construct was, so the env parser flows through the graph rather than being
|
|
42
|
-
* imported out of application config.
|
|
43
|
-
*/
|
|
44
|
-
options?: BetterAuthOptions | ((options: ServiceRegisterOptions) => BetterAuthOptions | Promise<BetterAuthOptions>);
|
|
45
|
-
}
|
|
46
|
-
export declare class BetterAuth<TName extends string = string, TDatabase extends Consumable = Consumable> implements Construct<TName, AuthServer> {
|
|
47
|
-
private readonly config;
|
|
48
|
-
readonly id: TName;
|
|
49
|
-
readonly service: Service<Uncapitalize<TName>, AuthServer>;
|
|
50
|
-
readonly basePath: string;
|
|
51
|
-
/**
|
|
52
|
-
* Declared once and read by both `declare()` and `connect()`, so the keys the
|
|
53
|
-
* target publishes and the keys the server reads cannot drift.
|
|
54
|
-
*/
|
|
55
|
-
private readonly keys;
|
|
56
|
-
constructor(id: ConstructName<TName>, config: BetterAuthConfig<TDatabase>);
|
|
57
|
-
/**
|
|
58
|
-
* A signing secret and a surface.
|
|
59
|
-
*
|
|
60
|
-
* The database is *not* declared here — the tenant that was passed in
|
|
61
|
-
* declares it, and declaring it twice is the duplication the whole model
|
|
62
|
-
* removes. What is declared is what this construct owns: the key it signs
|
|
63
|
-
* with, and the routes it answers on.
|
|
64
|
-
*
|
|
65
|
-
* One endpoint, wildcarded. Better Auth routes internally and the set of
|
|
66
|
-
* paths depends on which capabilities are enabled, so enumerating them here
|
|
67
|
-
* would be a copy of its router that goes stale on its next release. The
|
|
68
|
-
* surface's job is to send everything under `basePath` to one handler, which
|
|
69
|
-
* is exactly what the declaration says.
|
|
70
|
-
*/
|
|
71
|
-
declare(): Declaration[];
|
|
72
|
-
/**
|
|
73
|
-
* Better Auth's own migrations, for the app's migrate step.
|
|
74
|
-
*
|
|
75
|
-
* It brings its own schema — users, sessions, accounts, verifications — so
|
|
76
|
-
* the app never writes those tables and never gets to drift from them.
|
|
77
|
-
*/
|
|
78
|
-
migrations(options: ServiceRegisterOptions): Promise<() => Promise<void>>;
|
|
79
|
-
/**
|
|
80
|
-
* The server this surface runs as, built from its own declaration.
|
|
81
|
-
*
|
|
82
|
-
* A surface is a deploy unit, so something has to serve it, and the thing
|
|
83
|
-
* that knows how is the construct — not a generator writing a mount into
|
|
84
|
-
* somebody else's entry point. That is how the auth server came to be
|
|
85
|
-
* mounted by a hook in the application it was supposed to be separate from,
|
|
86
|
-
* and then to be served by nothing at all when the hook was deleted.
|
|
87
|
-
*
|
|
88
|
-
* The routes come from {@link declare}: one wildcard under `basePath`, read
|
|
89
|
-
* off the same declaration the manifest carries, so the surface the graph
|
|
90
|
-
* describes and the surface that answers requests cannot disagree.
|
|
91
|
-
*
|
|
92
|
-
* ```ts
|
|
93
|
-
* // .gkm/server/app.ts — the whole generated entry
|
|
94
|
-
* import { auth } from '@acme/constructs/auth.js';
|
|
95
|
-
* export const { app } = await auth.server({ envParser });
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
server(options: ServiceRegisterOptions): Promise<{
|
|
99
|
-
app: Hono;
|
|
100
|
-
}>;
|
|
101
|
-
private connect;
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
//# sourceMappingURL=auth.d.cts.map
|
|
1
|
+
import { a as BetterAuth, c as BetterAuthOptionsContext, d as deviceLink, f as idempotent, i as AuthSession, l as ExpoPluginRequired, n as AuthServer, o as BetterAuthConfig, p as withTrustedClientIp, r as AuthServerUnreachable, s as BetterAuthOptions, t as AuthClient, u as SessionCheckFailed } from "./auth-1yI2wR-4.cjs";
|
|
2
|
+
export { AuthClient, AuthServer, AuthServerUnreachable, AuthSession, BetterAuth, BetterAuthConfig, BetterAuthOptions, BetterAuthOptionsContext, ExpoPluginRequired, SessionCheckFailed, deviceLink, idempotent, withTrustedClientIp };
|
package/dist/auth.d.mts
CHANGED
|
@@ -1,104 +1,2 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
|
|
3
|
-
import { betterAuth } from "better-auth";
|
|
4
|
-
import { Service, ServiceRegisterOptions } from "@geekmidas/services";
|
|
5
|
-
import { Hono } from "hono";
|
|
6
|
-
//#region src/auth.d.ts
|
|
7
|
-
/** The server better-auth hands back. */
|
|
8
|
-
export type AuthServer = ReturnType<typeof betterAuth>;
|
|
9
|
-
/** Everything better-auth takes, minus what the construct owns. */
|
|
10
|
-
export type BetterAuthOptions = Omit<Parameters<typeof betterAuth>[0], 'database' | 'secret' | 'basePath' | 'baseURL'>;
|
|
11
|
-
export interface BetterAuthConfig<TDatabase extends Consumable> {
|
|
12
|
-
/**
|
|
13
|
-
* The schema tenant its tables live in.
|
|
14
|
-
*
|
|
15
|
-
* A construct rather than a URL: the tenant already declares its schema and
|
|
16
|
-
* its role, and taking the declaration is what puts the edge in the graph
|
|
17
|
-
* instead of a connection string in two places.
|
|
18
|
-
*/
|
|
19
|
-
database: TDatabase;
|
|
20
|
-
/**
|
|
21
|
-
* The app that serves this auth server, relative to the workspace root —
|
|
22
|
-
* `'apps/auth'`.
|
|
23
|
-
*
|
|
24
|
-
* Required, for the reason `RestApi.path` is. Not to be confused with
|
|
25
|
-
* `basePath`, which is where its routes are mounted in a URL.
|
|
26
|
-
*/
|
|
27
|
-
path: string;
|
|
28
|
-
/**
|
|
29
|
-
* Where the auth routes are mounted, e.g. `/api/auth`.
|
|
30
|
-
*
|
|
31
|
-
* Structural — it is part of the URL every client calls, so it cannot differ
|
|
32
|
-
* between stages the way the host can.
|
|
33
|
-
*/
|
|
34
|
-
basePath?: string;
|
|
35
|
-
/**
|
|
36
|
-
* The rest of better-auth's options: providers, plugins, email settings.
|
|
37
|
-
*
|
|
38
|
-
* A function when they need another construct — a magic-link plugin has to
|
|
39
|
-
* *send* the link, and the thing that sends mail is a construct whose client
|
|
40
|
-
* has to be registered. It is handed the same `ServiceRegisterOptions` this
|
|
41
|
-
* construct was, so the env parser flows through the graph rather than being
|
|
42
|
-
* imported out of application config.
|
|
43
|
-
*/
|
|
44
|
-
options?: BetterAuthOptions | ((options: ServiceRegisterOptions) => BetterAuthOptions | Promise<BetterAuthOptions>);
|
|
45
|
-
}
|
|
46
|
-
export declare class BetterAuth<TName extends string = string, TDatabase extends Consumable = Consumable> implements Construct<TName, AuthServer> {
|
|
47
|
-
private readonly config;
|
|
48
|
-
readonly id: TName;
|
|
49
|
-
readonly service: Service<Uncapitalize<TName>, AuthServer>;
|
|
50
|
-
readonly basePath: string;
|
|
51
|
-
/**
|
|
52
|
-
* Declared once and read by both `declare()` and `connect()`, so the keys the
|
|
53
|
-
* target publishes and the keys the server reads cannot drift.
|
|
54
|
-
*/
|
|
55
|
-
private readonly keys;
|
|
56
|
-
constructor(id: ConstructName<TName>, config: BetterAuthConfig<TDatabase>);
|
|
57
|
-
/**
|
|
58
|
-
* A signing secret and a surface.
|
|
59
|
-
*
|
|
60
|
-
* The database is *not* declared here — the tenant that was passed in
|
|
61
|
-
* declares it, and declaring it twice is the duplication the whole model
|
|
62
|
-
* removes. What is declared is what this construct owns: the key it signs
|
|
63
|
-
* with, and the routes it answers on.
|
|
64
|
-
*
|
|
65
|
-
* One endpoint, wildcarded. Better Auth routes internally and the set of
|
|
66
|
-
* paths depends on which capabilities are enabled, so enumerating them here
|
|
67
|
-
* would be a copy of its router that goes stale on its next release. The
|
|
68
|
-
* surface's job is to send everything under `basePath` to one handler, which
|
|
69
|
-
* is exactly what the declaration says.
|
|
70
|
-
*/
|
|
71
|
-
declare(): Declaration[];
|
|
72
|
-
/**
|
|
73
|
-
* Better Auth's own migrations, for the app's migrate step.
|
|
74
|
-
*
|
|
75
|
-
* It brings its own schema — users, sessions, accounts, verifications — so
|
|
76
|
-
* the app never writes those tables and never gets to drift from them.
|
|
77
|
-
*/
|
|
78
|
-
migrations(options: ServiceRegisterOptions): Promise<() => Promise<void>>;
|
|
79
|
-
/**
|
|
80
|
-
* The server this surface runs as, built from its own declaration.
|
|
81
|
-
*
|
|
82
|
-
* A surface is a deploy unit, so something has to serve it, and the thing
|
|
83
|
-
* that knows how is the construct — not a generator writing a mount into
|
|
84
|
-
* somebody else's entry point. That is how the auth server came to be
|
|
85
|
-
* mounted by a hook in the application it was supposed to be separate from,
|
|
86
|
-
* and then to be served by nothing at all when the hook was deleted.
|
|
87
|
-
*
|
|
88
|
-
* The routes come from {@link declare}: one wildcard under `basePath`, read
|
|
89
|
-
* off the same declaration the manifest carries, so the surface the graph
|
|
90
|
-
* describes and the surface that answers requests cannot disagree.
|
|
91
|
-
*
|
|
92
|
-
* ```ts
|
|
93
|
-
* // .gkm/server/app.ts — the whole generated entry
|
|
94
|
-
* import { auth } from '@acme/constructs/auth.js';
|
|
95
|
-
* export const { app } = await auth.server({ envParser });
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
server(options: ServiceRegisterOptions): Promise<{
|
|
99
|
-
app: Hono;
|
|
100
|
-
}>;
|
|
101
|
-
private connect;
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
//# sourceMappingURL=auth.d.mts.map
|
|
1
|
+
import { a as BetterAuth, c as BetterAuthOptionsContext, d as deviceLink, f as idempotent, i as AuthSession, l as ExpoPluginRequired, n as AuthServer, o as BetterAuthConfig, p as withTrustedClientIp, r as AuthServerUnreachable, s as BetterAuthOptions, t as AuthClient, u as SessionCheckFailed } from "./auth-D4NMXgLt.mjs";
|
|
2
|
+
export { AuthClient, AuthServer, AuthServerUnreachable, AuthSession, BetterAuth, BetterAuthConfig, BetterAuthOptions, BetterAuthOptionsContext, ExpoPluginRequired, SessionCheckFailed, deviceLink, idempotent, withTrustedClientIp };
|
package/dist/auth.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { edgeTo } from "./construct-interface.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { a as loadBetterAuthMigration, c as loadHono, i as loadBetterAuth, l as loadHonoCors } from "./optionalPeers-D7Wt6dnF.mjs";
|
|
3
|
+
import { n as injectTraceContext } from "./tracing-Bbj1uoFJ.mjs";
|
|
4
|
+
import { t as isPrivateAddress } from "./privateAddress-Bg5fUsbp.mjs";
|
|
5
|
+
import { CLIENT_IP_HEADER, EDGE_TOKEN_HEADER, EDGE_TOKEN_KEY, canonicalId, environmentCase, isWebOrigin, providedKeyFor, serviceKey } from "@geekmidas/manifest";
|
|
6
|
+
import { timingSafeEqual } from "node:crypto";
|
|
4
7
|
//#region src/auth.ts
|
|
5
8
|
/**
|
|
6
9
|
* `BetterAuth` — a declared auth server.
|
|
@@ -32,6 +35,17 @@ const DEFAULT_BASE_PATH = "/api/auth";
|
|
|
32
35
|
var BetterAuth = class {
|
|
33
36
|
config;
|
|
34
37
|
id;
|
|
38
|
+
/**
|
|
39
|
+
* What `.dependsOn([auth])` injects: an {@link AuthClient}, never the server.
|
|
40
|
+
*
|
|
41
|
+
* Which of the two a process holds is decided by how it reaches the
|
|
42
|
+
* construct, not by asking where it is running. The auth app's process is
|
|
43
|
+
* its generated entry, which calls {@link server} and nothing else — a
|
|
44
|
+
* self-serving surface has no endpoints of its own for a `dependsOn` to sit
|
|
45
|
+
* on. Every other process reaches it through this. So the API, a worker, a
|
|
46
|
+
* test's in-process endpoints all get the client, and none of them needs
|
|
47
|
+
* the signing secret, the auth tenant's URL or the mailer to start.
|
|
48
|
+
*/
|
|
35
49
|
service;
|
|
36
50
|
basePath;
|
|
37
51
|
/**
|
|
@@ -48,13 +62,13 @@ var BetterAuth = class {
|
|
|
48
62
|
this.keys = {
|
|
49
63
|
secretId,
|
|
50
64
|
secret: environmentCase(secretId),
|
|
51
|
-
url:
|
|
52
|
-
trustedOrigins:
|
|
53
|
-
cookieDomain:
|
|
65
|
+
url: providedKeyFor(canonical, "rest-api", "url"),
|
|
66
|
+
trustedOrigins: providedKeyFor(canonical, "rest-api", "trustedOrigins"),
|
|
67
|
+
cookieDomain: providedKeyFor(canonical, "rest-api", "cookieDomain")
|
|
54
68
|
};
|
|
55
69
|
this.service = {
|
|
56
70
|
serviceName: serviceKey(canonical),
|
|
57
|
-
register: (options) => this.
|
|
71
|
+
register: (options) => this.client(options.envParser)
|
|
58
72
|
};
|
|
59
73
|
}
|
|
60
74
|
/**
|
|
@@ -80,32 +94,79 @@ var BetterAuth = class {
|
|
|
80
94
|
kind: "rest-api",
|
|
81
95
|
id: this.id,
|
|
82
96
|
path: this.config.path,
|
|
97
|
+
...this.config.subdomain ? { subdomain: this.config.subdomain } : {},
|
|
98
|
+
...this.config.telemetry ? { telemetry: this.config.telemetry.id } : {},
|
|
83
99
|
provides: [
|
|
84
100
|
this.keys.url,
|
|
85
101
|
this.keys.trustedOrigins,
|
|
86
102
|
this.keys.cookieDomain
|
|
87
103
|
],
|
|
104
|
+
servesItself: true,
|
|
88
105
|
endpoints: [{
|
|
89
106
|
id: `${this.id}Handler`,
|
|
90
107
|
handler: `${this.id}.handler`,
|
|
91
108
|
method: "ANY",
|
|
92
109
|
path: `${this.basePath}/*`,
|
|
93
|
-
dependencies: [edgeTo(this.config.database)],
|
|
110
|
+
dependencies: [edgeTo(this.config.database), ...(this.config.dependsOn ?? []).map(edgeTo)],
|
|
94
111
|
requires: [this.keys.secret]
|
|
95
112
|
}]
|
|
96
113
|
}];
|
|
97
114
|
}
|
|
98
115
|
/**
|
|
99
|
-
*
|
|
116
|
+
* Whose request this is: the session for these headers, or `null`.
|
|
117
|
+
*
|
|
118
|
+
* Asked of the auth server over HTTP, at the URL the `.auth()` edge injects —
|
|
119
|
+
* so it is the same call whether the server runs in this process, beside
|
|
120
|
+
* it, or behind MSW in a test. The same call {@link AuthClient} makes.
|
|
121
|
+
*/
|
|
122
|
+
async verify(headers, envParser) {
|
|
123
|
+
return this.client(envParser).api.getSession({ headers });
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The client a caller of this server holds: its URL and nothing else.
|
|
100
127
|
*
|
|
101
|
-
*
|
|
102
|
-
* the
|
|
128
|
+
* `<ID>_URL` is the one key a consumer is given for an edge to a surface —
|
|
129
|
+
* the compose network's address between containers, the public one where
|
|
130
|
+
* that is all there is — so this is everything it can know.
|
|
103
131
|
*/
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
132
|
+
client(envParser) {
|
|
133
|
+
const { url, edgeToken } = envParser.create((get) => ({
|
|
134
|
+
url: get(this.keys.url).string(),
|
|
135
|
+
edgeToken: get(EDGE_TOKEN_KEY).string().optional()
|
|
136
|
+
})).parse();
|
|
137
|
+
const endpoint = `${url.replace(/\/$/, "")}${this.basePath}`;
|
|
138
|
+
return { api: { getSession: ({ headers }) => fetchSession(this.id, endpoint, new Headers(headers), edgeToken) } };
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The tenant this server keeps its tables in — whose migrations folder,
|
|
142
|
+
* `db/<tenant>/`, Better Auth's schema is written into.
|
|
143
|
+
*/
|
|
144
|
+
get databaseId() {
|
|
145
|
+
return this.config.database.id;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The SQL that brings the tenant up to Better Auth's schema, or `undefined`
|
|
149
|
+
* when it already matches.
|
|
150
|
+
*
|
|
151
|
+
* What `gkm migration` writes as the tenant's next migration, so Better
|
|
152
|
+
* Auth's tables are committed, reviewed and applied like any other — rather
|
|
153
|
+
* than diffed against the database at runtime, where a change nobody wrote
|
|
154
|
+
* down happens on whichever machine migrates first.
|
|
155
|
+
*
|
|
156
|
+
* Compared as the owner, against the tenant `gkm migrate` has already brought
|
|
157
|
+
* up to date: what comes back is only what the committed files are missing.
|
|
158
|
+
*/
|
|
159
|
+
async pendingMigration(options) {
|
|
160
|
+
const resolved = await this.optionsFor(options, { owner: true });
|
|
161
|
+
const db = resolved.database.db;
|
|
162
|
+
try {
|
|
163
|
+
const { getMigrations } = await loadBetterAuthMigration();
|
|
164
|
+
const { toBeCreated, toBeAdded, toBeAddedIndexes, compileMigrations } = await getMigrations(resolved);
|
|
165
|
+
if (toBeCreated.length === 0 && toBeAdded.length === 0 && toBeAddedIndexes.length === 0) return;
|
|
166
|
+
return idempotent(await compileMigrations());
|
|
167
|
+
} finally {
|
|
168
|
+
await db.destroy();
|
|
169
|
+
}
|
|
109
170
|
}
|
|
110
171
|
/**
|
|
111
172
|
* The server this surface runs as, built from its own declaration.
|
|
@@ -125,13 +186,21 @@ var BetterAuth = class {
|
|
|
125
186
|
* import { auth } from '@acme/constructs/auth.js';
|
|
126
187
|
* export const { app } = await auth.server({ envParser });
|
|
127
188
|
* ```
|
|
189
|
+
*
|
|
190
|
+
* The only way to the server: it is what reads the signing secret, opens
|
|
191
|
+
* the tenant and builds the mailer, so it is built here, in the auth app's
|
|
192
|
+
* own process, and `.dependsOn([auth])` everywhere else gets
|
|
193
|
+
* {@link AuthClient}. `auth` is the better-auth instance behind the app.
|
|
128
194
|
*/
|
|
129
195
|
async server(options) {
|
|
130
|
-
const { Hono } = await
|
|
131
|
-
const { cors } = await
|
|
196
|
+
const { Hono } = await loadHono("An Auth");
|
|
197
|
+
const { cors } = await loadHonoCors("An Auth");
|
|
132
198
|
const app = new Hono();
|
|
133
199
|
const server = await this.connect(options);
|
|
134
|
-
const { origins } = options.envParser.create((get) => ({
|
|
200
|
+
const { origins, edgeToken } = options.envParser.create((get) => ({
|
|
201
|
+
edgeToken: get(EDGE_TOKEN_KEY).string().optional(),
|
|
202
|
+
origins: get(this.keys.trustedOrigins).string().default("").transform((value) => value.split(",").map((origin) => origin.trim()).filter(Boolean))
|
|
203
|
+
})).parse();
|
|
135
204
|
app.use("*", cors({
|
|
136
205
|
origin: origins,
|
|
137
206
|
credentials: true,
|
|
@@ -147,22 +216,60 @@ var BetterAuth = class {
|
|
|
147
216
|
"DELETE",
|
|
148
217
|
"OPTIONS"
|
|
149
218
|
] : [endpoint.method];
|
|
150
|
-
app.on([...methods], endpoint.path, (c) => server.handler(c.req.raw));
|
|
219
|
+
app.on([...methods], endpoint.path, (c) => server.handler(withTrustedClientIp(c.req.raw, remoteAddressOf(c), edgeToken)));
|
|
151
220
|
}
|
|
152
|
-
return {
|
|
221
|
+
return {
|
|
222
|
+
app,
|
|
223
|
+
auth: server
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* The ids of the better-auth plugins this server runs — what a client has
|
|
228
|
+
* to pair its own plugins with (`magic-link` with `magicLinkClient`).
|
|
229
|
+
* Resolved the way the server resolves them, options callback included.
|
|
230
|
+
*/
|
|
231
|
+
async pluginIds(options) {
|
|
232
|
+
const { plugins = [] } = await this.configured(options);
|
|
233
|
+
return plugins.map(({ id }) => id);
|
|
234
|
+
}
|
|
235
|
+
/** Better-auth's options as given — a value, or a callback of the environment. */
|
|
236
|
+
async configured(options) {
|
|
237
|
+
const configure = this.config.options;
|
|
238
|
+
if (typeof configure !== "function") return configure ?? {};
|
|
239
|
+
const services = {};
|
|
240
|
+
for (const construct of this.config.dependsOn ?? []) services[construct.service.serviceName] = await construct.service.register(options);
|
|
241
|
+
return configure({
|
|
242
|
+
...options,
|
|
243
|
+
services
|
|
244
|
+
});
|
|
153
245
|
}
|
|
154
246
|
async connect(options, as = {}) {
|
|
155
|
-
const {
|
|
247
|
+
const { betterAuth } = await loadBetterAuth();
|
|
248
|
+
return betterAuth(await this.optionsFor(options, as));
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Everything better-auth is given: the app's options, and what the construct
|
|
252
|
+
* owns — its secret, its URL, its tenant's connection, the origins and cookie
|
|
253
|
+
* domain its graph derives. One place, so the server and its migrations are
|
|
254
|
+
* built from the same options.
|
|
255
|
+
*/
|
|
256
|
+
async optionsFor(options, as = {}) {
|
|
257
|
+
const { secret, baseUrl, trustedOrigins, cookieDomain, deviceUrl } = options.envParser.create((get) => ({
|
|
156
258
|
secret: get(this.keys.secret).string(),
|
|
157
259
|
baseUrl: get(this.keys.url).string(),
|
|
158
260
|
trustedOrigins: get(this.keys.trustedOrigins).string().default("").transform((value) => value.split(",").map((origin) => origin.trim()).filter(Boolean)),
|
|
159
|
-
cookieDomain: get(this.keys.cookieDomain).string().optional()
|
|
261
|
+
cookieDomain: get(this.keys.cookieDomain).string().optional(),
|
|
262
|
+
deviceUrl: get(providedKeyFor(this.id, "rest-api", "deviceUrl")).string().optional()
|
|
160
263
|
})).parse();
|
|
161
264
|
const tenant = this.config.database;
|
|
162
265
|
const db = await (as.owner && tenant.owner ? tenant.owner : tenant.service).register(options);
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
|
|
266
|
+
const configured = await this.configured(options);
|
|
267
|
+
const origins = [...trustedOrigins, ...configured.trustedOrigins && Array.isArray(configured.trustedOrigins) ? configured.trustedOrigins : []];
|
|
268
|
+
const plugins = [...configured.plugins ?? []];
|
|
269
|
+
const mobile = trustedOrigins.filter((origin) => !isWebOrigin(origin));
|
|
270
|
+
if (mobile.length > 0 && !plugins.some((plugin) => plugin.id === "expo")) throw new ExpoPluginRequired(this.id, mobile);
|
|
271
|
+
if (deviceUrl) for (const plugin of plugins) reachableFromDevice(plugin, deviceUrl);
|
|
272
|
+
return {
|
|
166
273
|
...configured,
|
|
167
274
|
secret,
|
|
168
275
|
baseURL: baseUrl,
|
|
@@ -171,19 +278,191 @@ var BetterAuth = class {
|
|
|
171
278
|
db,
|
|
172
279
|
type: "postgres"
|
|
173
280
|
},
|
|
174
|
-
|
|
281
|
+
plugins,
|
|
282
|
+
trustedOrigins: origins,
|
|
175
283
|
advanced: {
|
|
176
284
|
...configured.advanced,
|
|
285
|
+
ipAddress: {
|
|
286
|
+
...configured.advanced?.ipAddress,
|
|
287
|
+
ipAddressHeaders: [CLIENT_IP_HEADER, ...(configured.advanced?.ipAddress?.ipAddressHeaders ?? ["x-forwarded-for"]).filter((name) => name.toLowerCase() !== CLIENT_IP_HEADER)]
|
|
288
|
+
},
|
|
177
289
|
...cookieDomain ? { crossSubDomainCookies: {
|
|
178
290
|
enabled: true,
|
|
179
291
|
domain: cookieDomain,
|
|
180
292
|
...configured.advanced?.crossSubDomainCookies
|
|
181
293
|
} } : {}
|
|
182
294
|
}
|
|
183
|
-
}
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
/** Links already rewritten — an `options` object is reused across builds. */
|
|
299
|
+
const rewritten = /* @__PURE__ */ new WeakSet();
|
|
300
|
+
/**
|
|
301
|
+
* Build the magic links an app asked for on the address a phone reaches.
|
|
302
|
+
*
|
|
303
|
+
* An app's link carries its scheme as the `callbackURL` (`shop://…`)
|
|
304
|
+
* where a browser's carries a path or an `http(s)` URL — which is how the two
|
|
305
|
+
* are told apart. A browser's link is left alone: it is opened on this
|
|
306
|
+
* machine, where the server's own hostname resolves.
|
|
307
|
+
*
|
|
308
|
+
* Better Auth's magic-link plugin calls `sendMagicLink` through the options
|
|
309
|
+
* object it returns, so wrapping it there is wrapping the call.
|
|
310
|
+
*/
|
|
311
|
+
function reachableFromDevice(plugin, deviceUrl) {
|
|
312
|
+
if (plugin.id !== "magic-link") return;
|
|
313
|
+
const options = plugin.options;
|
|
314
|
+
if (!options?.sendMagicLink || rewritten.has(options)) return;
|
|
315
|
+
rewritten.add(options);
|
|
316
|
+
const send = options.sendMagicLink;
|
|
317
|
+
options.sendMagicLink = (data, ...rest) => send({
|
|
318
|
+
...data,
|
|
319
|
+
url: deviceLink(data.url, deviceUrl)
|
|
320
|
+
}, ...rest);
|
|
321
|
+
}
|
|
322
|
+
/** A magic link moved to the device address when an app is its destination. */
|
|
323
|
+
function deviceLink(url, deviceUrl) {
|
|
324
|
+
try {
|
|
325
|
+
const link = new URL(url);
|
|
326
|
+
const callback = link.searchParams.get("callbackURL") ?? "/";
|
|
327
|
+
if (callback.startsWith("/") || isWebOrigin(callback)) return url;
|
|
328
|
+
return new URL(`${link.pathname}${link.search}`, deviceUrl).toString();
|
|
329
|
+
} catch {
|
|
330
|
+
return url;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
/** A mobile app depends on this auth server, which has no Expo plugin. */
|
|
334
|
+
var ExpoPluginRequired = class extends Error {
|
|
335
|
+
server;
|
|
336
|
+
origins;
|
|
337
|
+
constructor(server, origins) {
|
|
338
|
+
super(`'${server}' is called by a mobile app (${origins[0]}), and a mobile app signs in through Better Auth's Expo plugin: add expo() from '@better-auth/expo' to this auth server's plugins.`);
|
|
339
|
+
this.server = server;
|
|
340
|
+
this.origins = origins;
|
|
341
|
+
this.name = "ExpoPluginRequired";
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* What is forwarded to the auth server: the headers a session travels in, and
|
|
346
|
+
* the origin the request came from. The API calls the auth server at its
|
|
347
|
+
* public address, through the edge, which marks the call as outside traffic;
|
|
348
|
+
* the origin is what lets the auth server continue the trace exactly when
|
|
349
|
+
* the API did — for a request from one of the sites both trust.
|
|
350
|
+
*/
|
|
351
|
+
const SESSION_HEADERS = [
|
|
352
|
+
"cookie",
|
|
353
|
+
"authorization",
|
|
354
|
+
"origin"
|
|
355
|
+
];
|
|
356
|
+
/**
|
|
357
|
+
* `GET <basePath>/get-session`, read the way Better Auth answers it.
|
|
358
|
+
*
|
|
359
|
+
* Whose request it is travels in {@link CLIENT_IP_HEADER} — the server
|
|
360
|
+
* rate-limits `/get-session` by the client's address, so without it every
|
|
361
|
+
* caller shares the API's one bucket — and never as `X-Forwarded-For`, which
|
|
362
|
+
* marks a request as outside traffic. The call goes to the auth server's
|
|
363
|
+
* public address, through the stack's edge, so the stack's token goes with
|
|
364
|
+
* it ({@link EDGE_TOKEN_HEADER}): the edge keeps gkm's header only on a
|
|
365
|
+
* request carrying it, and the auth server honours it from one. The
|
|
366
|
+
* request's `Origin` is passed on so the trace is continued for a site both
|
|
367
|
+
* trust.
|
|
368
|
+
*/
|
|
369
|
+
async function fetchSession(authenticator, endpoint, given, edgeToken) {
|
|
370
|
+
const headers = new Headers();
|
|
371
|
+
for (const name of SESSION_HEADERS) {
|
|
372
|
+
const value = given.get(name);
|
|
373
|
+
if (value) headers.set(name, value);
|
|
374
|
+
}
|
|
375
|
+
const client = given.get("x-forwarded-for");
|
|
376
|
+
if (client) {
|
|
377
|
+
headers.set(CLIENT_IP_HEADER, client);
|
|
378
|
+
if (edgeToken) headers.set(EDGE_TOKEN_HEADER, edgeToken);
|
|
379
|
+
}
|
|
380
|
+
injectTraceContext(headers);
|
|
381
|
+
const url = `${endpoint}/get-session`;
|
|
382
|
+
let response;
|
|
383
|
+
try {
|
|
384
|
+
response = await fetch(url, { headers });
|
|
385
|
+
} catch (cause) {
|
|
386
|
+
throw new AuthServerUnreachable(authenticator, url, cause);
|
|
387
|
+
}
|
|
388
|
+
if (response.status === 401) return null;
|
|
389
|
+
if (!response.ok) throw new SessionCheckFailed(authenticator, response.status);
|
|
390
|
+
return await response.json();
|
|
391
|
+
}
|
|
392
|
+
/** The auth server answered a session check with a failure. */
|
|
393
|
+
var SessionCheckFailed = class extends Error {
|
|
394
|
+
authenticator;
|
|
395
|
+
status;
|
|
396
|
+
constructor(authenticator, status) {
|
|
397
|
+
super(`'${authenticator}' answered a session check with ${status}. A request with no session gets 200 and null, or 401; this is the server failing — check its logs, and that it is running at its URL.`);
|
|
398
|
+
this.authenticator = authenticator;
|
|
399
|
+
this.status = status;
|
|
400
|
+
this.name = "SessionCheckFailed";
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
/** A session check never reached the auth server. */
|
|
404
|
+
var AuthServerUnreachable = class extends Error {
|
|
405
|
+
authenticator;
|
|
406
|
+
url;
|
|
407
|
+
constructor(authenticator, url, cause) {
|
|
408
|
+
super(`'${authenticator}' could not be reached at ${url} to check a session. Check that the auth app is running and that this app's ${providedKeyFor(authenticator, "rest-api", "url")} points at it.`, { cause });
|
|
409
|
+
this.authenticator = authenticator;
|
|
410
|
+
this.url = url;
|
|
411
|
+
this.name = "AuthServerUnreachable";
|
|
184
412
|
}
|
|
185
413
|
};
|
|
414
|
+
/**
|
|
415
|
+
* Better Auth's DDL, safe to run where its tables already exist.
|
|
416
|
+
*
|
|
417
|
+
* Its SQL is Kysely's, so its shape is known: `create table "…"`, `create index
|
|
418
|
+
* "…"`, `alter table "…" add column "…"`. A database that has been running
|
|
419
|
+
* already has those — Better Auth used to create them at runtime — and the
|
|
420
|
+
* first committed migration would fail on them rather than recording that they
|
|
421
|
+
* are there.
|
|
422
|
+
*/
|
|
423
|
+
function idempotent(statements) {
|
|
424
|
+
return statements.replace(/\bcreate table "/gi, "create table if not exists \"").replace(/\bcreate (unique )?index "/gi, (_, unique = "") => `create ${unique}index if not exists "`).replace(/\badd column "/gi, "add column if not exists \"");
|
|
425
|
+
}
|
|
426
|
+
/** Headers a reverse proxy or CDN adds on the way in. */
|
|
427
|
+
const FORWARDING_HEADERS = [
|
|
428
|
+
"forwarded",
|
|
429
|
+
"x-forwarded-for",
|
|
430
|
+
"x-forwarded-host",
|
|
431
|
+
"x-real-ip",
|
|
432
|
+
"cf-connecting-ip",
|
|
433
|
+
"true-client-ip",
|
|
434
|
+
"fastly-client-ip",
|
|
435
|
+
"x-client-ip"
|
|
436
|
+
];
|
|
437
|
+
/**
|
|
438
|
+
* `request`, without {@link CLIENT_IP_HEADER} unless an internal caller sent
|
|
439
|
+
* it — no `Origin`, no forwarding header, a loopback or private peer: the
|
|
440
|
+
* rule a request's span continues a trace by (`@geekmidas/telescope`'s
|
|
441
|
+
* `isInternalCaller`).
|
|
442
|
+
*
|
|
443
|
+
* The stack's own edges strip the header already. This holds wherever one
|
|
444
|
+
* does not — a platform's proxy, a port published straight to the internet —
|
|
445
|
+
* so a stranger cannot pick the address Better Auth rate-limits them by.
|
|
446
|
+
*/
|
|
447
|
+
function withTrustedClientIp(request, remoteAddress, edgeToken) {
|
|
448
|
+
if (!request.headers.has(CLIENT_IP_HEADER)) return request;
|
|
449
|
+
if (!request.headers.has("origin") && !FORWARDING_HEADERS.some((name) => request.headers.has(name)) && isPrivateAddress(remoteAddress) || sameToken(request.headers.get(EDGE_TOKEN_HEADER), edgeToken)) return request;
|
|
450
|
+
const headers = new Headers(request.headers);
|
|
451
|
+
headers.delete(CLIENT_IP_HEADER);
|
|
452
|
+
return new Request(request, { headers });
|
|
453
|
+
}
|
|
454
|
+
/** Whether a request's token is the stack's, compared in constant time. */
|
|
455
|
+
function sameToken(sent, expected) {
|
|
456
|
+
if (!sent || !expected) return false;
|
|
457
|
+
const a = Buffer.from(sent);
|
|
458
|
+
const b = Buffer.from(expected);
|
|
459
|
+
return a.length === b.length && timingSafeEqual(a, b);
|
|
460
|
+
}
|
|
461
|
+
/** The TCP peer of a request served by `@hono/node-server`, when there is one. */
|
|
462
|
+
function remoteAddressOf(c) {
|
|
463
|
+
return c.env?.incoming?.socket?.remoteAddress;
|
|
464
|
+
}
|
|
186
465
|
//#endregion
|
|
187
|
-
export { BetterAuth };
|
|
466
|
+
export { AuthServerUnreachable, BetterAuth, ExpoPluginRequired, SessionCheckFailed, deviceLink, idempotent, withTrustedClientIp };
|
|
188
467
|
|
|
189
468
|
//# sourceMappingURL=auth.mjs.map
|