@geekmidas/constructs 10.0.0-alpha.14 → 10.0.0-alpha.141
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 +222 -158
- package/dist/Construct-127M7yrl.d.cts +231 -0
- package/dist/Construct-127M7yrl.d.cts.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/Construct-DySlwh8o.d.mts +231 -0
- package/dist/Construct-DySlwh8o.d.mts.map +1 -0
- package/dist/{Cron-DKqnnTdH.d.cts → Cron-CFkpEys6.d.cts} +14 -7
- package/dist/Cron-CFkpEys6.d.cts.map +1 -0
- package/dist/{Cron-SyqS5oWJ.d.mts → Cron-CQoDSu-n.d.mts} +14 -7
- package/dist/Cron-CQoDSu-n.d.mts.map +1 -0
- package/dist/CronBuilder-1W-G_i15.d.mts +47 -0
- package/dist/CronBuilder-1W-G_i15.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-OaCRRFVk.d.cts +47 -0
- package/dist/CronBuilder-OaCRRFVk.d.cts.map +1 -0
- package/dist/{Endpoint-C6yyHpRS.d.cts → Endpoint-BEh-jW-f.d.cts} +122 -41
- package/dist/Endpoint-BEh-jW-f.d.cts.map +1 -0
- package/dist/Endpoint-BcUorcBa.cjs +576 -0
- package/dist/Endpoint-BcUorcBa.cjs.map +1 -0
- package/dist/Endpoint-BgvG36NO.mjs +547 -0
- package/dist/Endpoint-BgvG36NO.mjs.map +1 -0
- package/dist/{Endpoint-DuT4TEEq.d.mts → Endpoint-DTXDggNl.d.mts} +124 -43
- package/dist/Endpoint-DTXDggNl.d.mts.map +1 -0
- package/dist/{index-BPSZ_Lp_.d.cts → EndpointFactory-B2dCS9dy.d.cts} +187 -104
- package/dist/EndpointFactory-B2dCS9dy.d.cts.map +1 -0
- package/dist/{EndpointFactory-Bm3aKRdV.mjs → EndpointFactory-C1NlpCAS.mjs} +269 -53
- package/dist/EndpointFactory-C1NlpCAS.mjs.map +1 -0
- package/dist/{index-BoZ-iisU.d.mts → EndpointFactory-D2HXcUrJ.d.mts} +188 -105
- package/dist/EndpointFactory-D2HXcUrJ.d.mts.map +1 -0
- package/dist/{EndpointFactory-CLvWuHyt.cjs → EndpointFactory-gqmIRVWg.cjs} +309 -51
- package/dist/EndpointFactory-gqmIRVWg.cjs.map +1 -0
- package/dist/Function-BIEsY0Hm.d.cts +76 -0
- package/dist/Function-BIEsY0Hm.d.cts.map +1 -0
- package/dist/Function-DfMzTGS4.d.mts +76 -0
- package/dist/Function-DfMzTGS4.d.mts.map +1 -0
- package/dist/{HonoEndpointAdaptor-92zavCsV.cjs → HonoEndpointAdaptor-BJlj20fQ.cjs} +79 -31
- package/dist/HonoEndpointAdaptor-BJlj20fQ.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-yYaU7jVJ.mjs → HonoEndpointAdaptor-BlbkUDNo.mjs} +76 -28
- package/dist/HonoEndpointAdaptor-BlbkUDNo.mjs.map +1 -0
- package/dist/ObjectSubscriberBuilder-BuuaYcrm.d.cts +129 -0
- package/dist/ObjectSubscriberBuilder-BuuaYcrm.d.cts.map +1 -0
- package/dist/ObjectSubscriberBuilder-CzgYmOUH.d.mts +129 -0
- package/dist/ObjectSubscriberBuilder-CzgYmOUH.d.mts.map +1 -0
- package/dist/ProcessorBuilder-B2_stA8f.d.mts +216 -0
- package/dist/ProcessorBuilder-B2_stA8f.d.mts.map +1 -0
- package/dist/ProcessorBuilder-C62bIOwj.d.cts +216 -0
- package/dist/ProcessorBuilder-C62bIOwj.d.cts.map +1 -0
- package/dist/{Queue-D9X6OoON.d.mts → Queue-BnK3UH8r.d.mts} +42 -41
- package/dist/Queue-BnK3UH8r.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-D4Iaidrs.cjs +109 -0
- package/dist/Queue-D4Iaidrs.cjs.map +1 -0
- package/dist/Queue-u8w8_HpE.mjs +104 -0
- package/dist/Queue-u8w8_HpE.mjs.map +1 -0
- package/dist/QueueBuilder-2wP5lEC8.mjs +118 -0
- package/dist/QueueBuilder-2wP5lEC8.mjs.map +1 -0
- package/dist/QueueBuilder-B3vL1ED2.d.mts +75 -0
- package/dist/QueueBuilder-B3vL1ED2.d.mts.map +1 -0
- package/dist/QueueBuilder-BcPBQSSX.d.cts +75 -0
- package/dist/QueueBuilder-BcPBQSSX.d.cts.map +1 -0
- package/dist/QueueBuilder-BxsZ9o5z.cjs +135 -0
- package/dist/QueueBuilder-BxsZ9o5z.cjs.map +1 -0
- package/dist/Subscriber-5rCX1Nph.d.cts +83 -0
- package/dist/Subscriber-5rCX1Nph.d.cts.map +1 -0
- package/dist/Subscriber-CW_Dl-YR.d.mts +83 -0
- package/dist/Subscriber-CW_Dl-YR.d.mts.map +1 -0
- package/dist/SubscriberBuilder-BL_GTcwh.mjs +237 -0
- package/dist/SubscriberBuilder-BL_GTcwh.mjs.map +1 -0
- package/dist/SubscriberBuilder-CWzKwX1p.cjs +260 -0
- package/dist/SubscriberBuilder-CWzKwX1p.cjs.map +1 -0
- package/dist/Topic-DN2gYJ-p.mjs +99 -0
- package/dist/Topic-DN2gYJ-p.mjs.map +1 -0
- package/dist/Topic-Dp9Q7Lj2.cjs +104 -0
- package/dist/Topic-Dp9Q7Lj2.cjs.map +1 -0
- package/dist/adaptors/aws.cjs +134 -160
- 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 +130 -157
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +1 -1
- package/dist/adaptors/hono.d.cts +5 -6
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +6 -7
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +1 -1
- package/dist/adaptors/testing.cjs +955 -38
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +437 -39
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +436 -38
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +929 -34
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-BMCJN30Y.d.cts +268 -0
- package/dist/auth-BMCJN30Y.d.cts.map +1 -0
- package/dist/auth-D_0788uW.d.mts +268 -0
- package/dist/auth-D_0788uW.d.mts.map +1 -0
- package/dist/auth.cjs +290 -46
- 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 +286 -48
- package/dist/auth.mjs.map +1 -1
- package/dist/cache-5QZzh5Er.d.mts +44 -0
- package/dist/cache-5QZzh5Er.d.mts.map +1 -0
- package/dist/cache-DnGDGly3.d.cts +44 -0
- package/dist/cache-DnGDGly3.d.cts.map +1 -0
- package/dist/cache.d.cts +2 -43
- package/dist/cache.d.mts +2 -43
- 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-B1AfqRl4.d.cts} +42 -8
- package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
- package/dist/{construct-interface-DgXTJcOD.d.cts → construct-interface-ZvYQbivO.d.mts} +42 -8
- package/dist/construct-interface-ZvYQbivO.d.mts.map +1 -0
- package/dist/construct-interface.cjs +30 -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 +30 -5
- package/dist/construct-interface.mjs.map +1 -1
- package/dist/credential-DYymbp_7.cjs +257 -0
- package/dist/credential-DYymbp_7.cjs.map +1 -0
- package/dist/credential-DfSAOOdY.mjs +222 -0
- package/dist/credential-DfSAOOdY.mjs.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 +126 -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 +125 -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.d.cts +1 -1
- package/dist/email.d.cts.map +1 -1
- package/dist/email.d.mts +2 -2
- package/dist/email.d.mts.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-BUgcX2Dk.d.cts +201 -0
- package/dist/fake-BUgcX2Dk.d.cts.map +1 -0
- package/dist/fake-D472nkKb.d.mts +201 -0
- package/dist/fake-D472nkKb.d.mts.map +1 -0
- package/dist/file-server.cjs +123 -30
- package/dist/file-server.cjs.map +1 -1
- package/dist/file-server.d.cts +115 -1
- package/dist/file-server.d.cts.map +1 -1
- package/dist/file-server.d.mts +115 -1
- package/dist/file-server.d.mts.map +1 -1
- package/dist/file-server.mjs +122 -32
- 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-DZdICa8F.d.mts +195 -0
- package/dist/inbox-DZdICa8F.d.mts.map +1 -0
- package/dist/inbox-DqaxrpEk.d.cts +195 -0
- package/dist/inbox-DqaxrpEk.d.cts.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-BtzMzhMA.d.cts +115 -0
- package/dist/index-BtzMzhMA.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-DuriFjYD.d.mts +115 -0
- package/dist/index-DuriFjYD.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-BHYV-WC-.d.cts +216 -0
- package/dist/kysely-BHYV-WC-.d.cts.map +1 -0
- package/dist/kysely-CAW3QSqp.d.mts +216 -0
- package/dist/kysely-CAW3QSqp.d.mts.map +1 -0
- package/dist/kysely-Cs4uPO8k.mjs +371 -0
- package/dist/kysely-Cs4uPO8k.mjs.map +1 -0
- package/dist/kysely-CukArHJ0.cjs +384 -0
- package/dist/kysely-CukArHJ0.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 +74 -0
- package/dist/mobile-app.cjs.map +1 -0
- package/dist/mobile-app.d.cts +73 -0
- package/dist/mobile-app.d.cts.map +1 -0
- package/dist/mobile-app.d.mts +73 -0
- package/dist/mobile-app.d.mts.map +1 -0
- package/dist/mobile-app.mjs +73 -0
- package/dist/mobile-app.mjs.map +1 -0
- package/dist/object-storage.cjs +8 -1
- package/dist/object-storage.cjs.map +1 -1
- package/dist/object-storage.d.cts +10 -1
- package/dist/object-storage.d.cts.map +1 -1
- package/dist/object-storage.d.mts +10 -1
- package/dist/object-storage.d.mts.map +1 -1
- package/dist/object-storage.mjs +7 -2
- package/dist/object-storage.mjs.map +1 -1
- 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/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/{lazyAccessors-BHtcqgz2.mjs → readRequestBody-BTIl3k-D.mjs} +99 -39
- package/dist/readRequestBody-BTIl3k-D.mjs.map +1 -0
- package/dist/{lazyAccessors-Dx9NLwJZ.cjs → readRequestBody-Dej_L3c4.cjs} +118 -46
- package/dist/readRequestBody-Dej_L3c4.cjs.map +1 -0
- package/dist/requestLogger-BZcXwdBs.cjs +207 -0
- package/dist/requestLogger-BZcXwdBs.cjs.map +1 -0
- package/dist/requestLogger-pA4gi3E1.mjs +178 -0
- package/dist/requestLogger-pA4gi3E1.mjs.map +1 -0
- package/dist/rest-api.cjs +74 -70
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +69 -58
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +69 -58
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +74 -70
- package/dist/rest-api.mjs.map +1 -1
- package/dist/runSubscriber-CC_2C9F2.cjs +133 -0
- package/dist/runSubscriber-CC_2C9F2.cjs.map +1 -0
- package/dist/runSubscriber-DyHWp_Lf.mjs +116 -0
- package/dist/runSubscriber-DyHWp_Lf.mjs.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 +64 -4
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +90 -1
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +90 -1
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +62 -6
- 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-B48RLjyk.d.cts +40 -0
- package/dist/telemetry-B48RLjyk.d.cts.map +1 -0
- package/dist/telemetry-BEoBn6GO.d.mts +40 -0
- package/dist/telemetry-BEoBn6GO.d.mts.map +1 -0
- package/dist/telemetry.cjs +56 -0
- package/dist/telemetry.cjs.map +1 -0
- package/dist/telemetry.d.cts +2 -0
- package/dist/telemetry.d.mts +2 -0
- package/dist/telemetry.mjs +55 -0
- package/dist/telemetry.mjs.map +1 -0
- package/dist/topic/index.cjs +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.cjs +762 -0
- package/dist/websocket-api.cjs.map +1 -0
- package/dist/websocket-api.d.cts +443 -0
- package/dist/websocket-api.d.cts.map +1 -0
- package/dist/websocket-api.d.mts +443 -0
- package/dist/websocket-api.d.mts.map +1 -0
- package/dist/websocket-api.mjs +748 -0
- package/dist/websocket-api.mjs.map +1 -0
- package/dist/worker.cjs +140 -32
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +139 -47
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +139 -47
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +141 -33
- package/dist/worker.mjs.map +1 -1
- package/package.json +155 -44
- 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-DKqnnTdH.d.cts.map +0 -1
- package/dist/Cron-SyqS5oWJ.d.mts.map +0 -1
- package/dist/CronBuilder-BdnI6lxF.cjs.map +0 -1
- package/dist/CronBuilder-CRGnDfTq.d.mts +0 -41
- package/dist/CronBuilder-CRGnDfTq.d.mts.map +0 -1
- package/dist/CronBuilder-D_0HNBTr.mjs.map +0 -1
- package/dist/CronBuilder-Df1q9PNy.d.cts +0 -41
- package/dist/CronBuilder-Df1q9PNy.d.cts.map +0 -1
- package/dist/Endpoint-BpZHtJ2W.cjs +0 -1689
- package/dist/Endpoint-BpZHtJ2W.cjs.map +0 -1
- package/dist/Endpoint-C6yyHpRS.d.cts.map +0 -1
- package/dist/Endpoint-DuT4TEEq.d.mts.map +0 -1
- package/dist/Endpoint-ONsly_dq.mjs +0 -1671
- package/dist/Endpoint-ONsly_dq.mjs.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-BPSZ_Lp_.d.cts.map +0 -1
- package/dist/index-BoZ-iisU.d.mts.map +0 -1
- package/dist/index-CdaU--_B.d.cts +0 -165
- package/dist/index-CdaU--_B.d.cts.map +0 -1
- package/dist/index-DMCDvnsM.d.mts +0 -26
- package/dist/index-DMCDvnsM.d.mts.map +0 -1
- package/dist/index-PQRWOQj4.d.mts +0 -165
- package/dist/index-PQRWOQj4.d.mts.map +0 -1
- package/dist/lazyAccessors-BHtcqgz2.mjs.map +0 -1
- package/dist/lazyAccessors-Dx9NLwJZ.cjs.map +0 -1
- package/dist/processAudits-BpRlPQMW.mjs +0 -77
- package/dist/processAudits-BpRlPQMW.mjs.map +0 -1
- package/dist/processAudits-D_2W5x8k.cjs +0 -88
- 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-BMCJN30Y.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-D_0788uW.mjs";
|
|
2
|
+
export { AuthClient, AuthServer, AuthServerUnreachable, AuthSession, BetterAuth, BetterAuthConfig, BetterAuthOptions, BetterAuthOptionsContext, ExpoPluginRequired, SessionCheckFailed, deviceLink, idempotent, withTrustedClientIp };
|
package/dist/auth.mjs
CHANGED
|
@@ -1,37 +1,22 @@
|
|
|
1
1
|
import { edgeTo } from "./construct-interface.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { n as injectTraceContext } from "./tracing-Bbj1uoFJ.mjs";
|
|
3
|
+
import { CLIENT_IP_HEADER, canonicalId, environmentCase, isWebOrigin, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
4
4
|
//#region src/auth.ts
|
|
5
|
-
/**
|
|
6
|
-
* `BetterAuth` — a declared auth server.
|
|
7
|
-
*
|
|
8
|
-
* It is three things at once, which is what makes it the construct that
|
|
9
|
-
* exercises most of the model: a consumer of a database, a producer of an
|
|
10
|
-
* authorizer, and a set of endpoints. This lands the first two.
|
|
11
|
-
*
|
|
12
|
-
* Its tables live in a schema tenant it is *given* — `orders.schema('AuthDb')`
|
|
13
|
-
* — rather than one it invents. The tenant declares the schema and the role;
|
|
14
|
-
* this declares the one thing left, the signing secret, and reads back the keys
|
|
15
|
-
* it needs.
|
|
16
|
-
*
|
|
17
|
-
* :::caution
|
|
18
|
-
* The isolation that arrangement is *for* — the application's own role holding
|
|
19
|
-
* no grant on these tables, so a compromised handler cannot read sessions — does
|
|
20
|
-
* **not hold yet**. No target creates the per-schema role: both connect as the
|
|
21
|
-
* database owner, so today the tenant is a `search_path`, which is a namespace
|
|
22
|
-
* and not a privilege boundary. See "Roles are declared and never created" in
|
|
23
|
-
* `docs/design/constructs-outstanding.md`.
|
|
24
|
-
* :::
|
|
25
|
-
*
|
|
26
|
-
* It declares its own surface, so where it answers, who may call it, and the
|
|
27
|
-
* domain its cookies are scoped to all arrive as environment resolved by the
|
|
28
|
-
* target — none of them guessed from a port, and none of them listed by hand in
|
|
29
|
-
* application config.
|
|
30
|
-
*/
|
|
31
5
|
const DEFAULT_BASE_PATH = "/api/auth";
|
|
32
6
|
var BetterAuth = class {
|
|
33
7
|
config;
|
|
34
8
|
id;
|
|
9
|
+
/**
|
|
10
|
+
* What `.dependsOn([auth])` injects: an {@link AuthClient}, never the server.
|
|
11
|
+
*
|
|
12
|
+
* Which of the two a process holds is decided by how it reaches the
|
|
13
|
+
* construct, not by asking where it is running. The auth app's process is
|
|
14
|
+
* its generated entry, which calls {@link server} and nothing else — a
|
|
15
|
+
* self-serving surface has no endpoints of its own for a `dependsOn` to sit
|
|
16
|
+
* on. Every other process reaches it through this. So the API, a worker, a
|
|
17
|
+
* test's in-process endpoints all get the client, and none of them needs
|
|
18
|
+
* the signing secret, the auth tenant's URL or the mailer to start.
|
|
19
|
+
*/
|
|
35
20
|
service;
|
|
36
21
|
basePath;
|
|
37
22
|
/**
|
|
@@ -54,7 +39,7 @@ var BetterAuth = class {
|
|
|
54
39
|
};
|
|
55
40
|
this.service = {
|
|
56
41
|
serviceName: serviceKey(canonical),
|
|
57
|
-
register: (options) => this.
|
|
42
|
+
register: (options) => this.client(options.envParser)
|
|
58
43
|
};
|
|
59
44
|
}
|
|
60
45
|
/**
|
|
@@ -80,32 +65,76 @@ var BetterAuth = class {
|
|
|
80
65
|
kind: "rest-api",
|
|
81
66
|
id: this.id,
|
|
82
67
|
path: this.config.path,
|
|
68
|
+
...this.config.subdomain ? { subdomain: this.config.subdomain } : {},
|
|
69
|
+
...this.config.telemetry ? { telemetry: this.config.telemetry.id } : {},
|
|
83
70
|
provides: [
|
|
84
71
|
this.keys.url,
|
|
85
72
|
this.keys.trustedOrigins,
|
|
86
73
|
this.keys.cookieDomain
|
|
87
74
|
],
|
|
75
|
+
servesItself: true,
|
|
88
76
|
endpoints: [{
|
|
89
77
|
id: `${this.id}Handler`,
|
|
90
78
|
handler: `${this.id}.handler`,
|
|
91
79
|
method: "ANY",
|
|
92
80
|
path: `${this.basePath}/*`,
|
|
93
|
-
dependencies: [edgeTo(this.config.database)],
|
|
81
|
+
dependencies: [edgeTo(this.config.database), ...(this.config.dependsOn ?? []).map(edgeTo)],
|
|
94
82
|
requires: [this.keys.secret]
|
|
95
83
|
}]
|
|
96
84
|
}];
|
|
97
85
|
}
|
|
98
86
|
/**
|
|
99
|
-
*
|
|
87
|
+
* Whose request this is: the session for these headers, or `null`.
|
|
88
|
+
*
|
|
89
|
+
* Asked of the auth server over HTTP, at the URL the `.auth()` edge injects —
|
|
90
|
+
* so it is the same call whether the server runs in this process, beside
|
|
91
|
+
* it, or behind MSW in a test. The same call {@link AuthClient} makes.
|
|
92
|
+
*/
|
|
93
|
+
async verify(headers, envParser) {
|
|
94
|
+
return this.client(envParser).api.getSession({ headers });
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The client a caller of this server holds: its URL and nothing else.
|
|
100
98
|
*
|
|
101
|
-
*
|
|
102
|
-
* the
|
|
99
|
+
* `<ID>_URL` is the one key a consumer is given for an edge to a surface —
|
|
100
|
+
* the compose network's address between containers, the public one where
|
|
101
|
+
* that is all there is — so this is everything it can know.
|
|
102
|
+
*/
|
|
103
|
+
client(envParser) {
|
|
104
|
+
const { url } = envParser.create((get) => ({ url: get(this.keys.url).string() })).parse();
|
|
105
|
+
const endpoint = `${url.replace(/\/$/, "")}${this.basePath}`;
|
|
106
|
+
return { api: { getSession: ({ headers }) => fetchSession(this.id, endpoint, new Headers(headers)) } };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The tenant this server keeps its tables in — whose migrations folder,
|
|
110
|
+
* `db/<tenant>/`, Better Auth's schema is written into.
|
|
103
111
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
get databaseId() {
|
|
113
|
+
return this.config.database.id;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The SQL that brings the tenant up to Better Auth's schema, or `undefined`
|
|
117
|
+
* when it already matches.
|
|
118
|
+
*
|
|
119
|
+
* What `gkm migration` writes as the tenant's next migration, so Better
|
|
120
|
+
* Auth's tables are committed, reviewed and applied like any other — rather
|
|
121
|
+
* than diffed against the database at runtime, where a change nobody wrote
|
|
122
|
+
* down happens on whichever machine migrates first.
|
|
123
|
+
*
|
|
124
|
+
* Compared as the owner, against the tenant `gkm migrate` has already brought
|
|
125
|
+
* up to date: what comes back is only what the committed files are missing.
|
|
126
|
+
*/
|
|
127
|
+
async pendingMigration(options) {
|
|
128
|
+
const resolved = await this.optionsFor(options, { owner: true });
|
|
129
|
+
const db = resolved.database.db;
|
|
130
|
+
try {
|
|
131
|
+
const { getMigrations } = await import("better-auth/db/migration");
|
|
132
|
+
const { toBeCreated, toBeAdded, toBeAddedIndexes, compileMigrations } = await getMigrations(resolved);
|
|
133
|
+
if (toBeCreated.length === 0 && toBeAdded.length === 0 && toBeAddedIndexes.length === 0) return;
|
|
134
|
+
return idempotent(await compileMigrations());
|
|
135
|
+
} finally {
|
|
136
|
+
await db.destroy();
|
|
137
|
+
}
|
|
109
138
|
}
|
|
110
139
|
/**
|
|
111
140
|
* The server this surface runs as, built from its own declaration.
|
|
@@ -125,6 +154,11 @@ var BetterAuth = class {
|
|
|
125
154
|
* import { auth } from '@acme/constructs/auth.js';
|
|
126
155
|
* export const { app } = await auth.server({ envParser });
|
|
127
156
|
* ```
|
|
157
|
+
*
|
|
158
|
+
* The only way to the server: it is what reads the signing secret, opens
|
|
159
|
+
* the tenant and builds the mailer, so it is built here, in the auth app's
|
|
160
|
+
* own process, and `.dependsOn([auth])` everywhere else gets
|
|
161
|
+
* {@link AuthClient}. `auth` is the better-auth instance behind the app.
|
|
128
162
|
*/
|
|
129
163
|
async server(options) {
|
|
130
164
|
const { Hono } = await import("hono");
|
|
@@ -147,22 +181,60 @@ var BetterAuth = class {
|
|
|
147
181
|
"DELETE",
|
|
148
182
|
"OPTIONS"
|
|
149
183
|
] : [endpoint.method];
|
|
150
|
-
app.on([...methods], endpoint.path, (c) => server.handler(c.req.raw));
|
|
184
|
+
app.on([...methods], endpoint.path, (c) => server.handler(withTrustedClientIp(c.req.raw, remoteAddressOf(c))));
|
|
151
185
|
}
|
|
152
|
-
return {
|
|
186
|
+
return {
|
|
187
|
+
app,
|
|
188
|
+
auth: server
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* The ids of the better-auth plugins this server runs — what a client has
|
|
193
|
+
* to pair its own plugins with (`magic-link` with `magicLinkClient`).
|
|
194
|
+
* Resolved the way the server resolves them, options callback included.
|
|
195
|
+
*/
|
|
196
|
+
async pluginIds(options) {
|
|
197
|
+
const { plugins = [] } = await this.configured(options);
|
|
198
|
+
return plugins.map(({ id }) => id);
|
|
199
|
+
}
|
|
200
|
+
/** Better-auth's options as given — a value, or a callback of the environment. */
|
|
201
|
+
async configured(options) {
|
|
202
|
+
const configure = this.config.options;
|
|
203
|
+
if (typeof configure !== "function") return configure ?? {};
|
|
204
|
+
const services = {};
|
|
205
|
+
for (const construct of this.config.dependsOn ?? []) services[construct.service.serviceName] = await construct.service.register(options);
|
|
206
|
+
return configure({
|
|
207
|
+
...options,
|
|
208
|
+
services
|
|
209
|
+
});
|
|
153
210
|
}
|
|
154
211
|
async connect(options, as = {}) {
|
|
155
|
-
const {
|
|
212
|
+
const { betterAuth } = await import("better-auth");
|
|
213
|
+
return betterAuth(await this.optionsFor(options, as));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Everything better-auth is given: the app's options, and what the construct
|
|
217
|
+
* owns — its secret, its URL, its tenant's connection, the origins and cookie
|
|
218
|
+
* domain its graph derives. One place, so the server and its migrations are
|
|
219
|
+
* built from the same options.
|
|
220
|
+
*/
|
|
221
|
+
async optionsFor(options, as = {}) {
|
|
222
|
+
const { secret, baseUrl, trustedOrigins, cookieDomain, deviceUrl } = options.envParser.create((get) => ({
|
|
156
223
|
secret: get(this.keys.secret).string(),
|
|
157
224
|
baseUrl: get(this.keys.url).string(),
|
|
158
225
|
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()
|
|
226
|
+
cookieDomain: get(this.keys.cookieDomain).string().optional(),
|
|
227
|
+
deviceUrl: get(provideKey(this.id, "deviceUrl")).string().optional()
|
|
160
228
|
})).parse();
|
|
161
229
|
const tenant = this.config.database;
|
|
162
230
|
const db = await (as.owner && tenant.owner ? tenant.owner : tenant.service).register(options);
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
|
|
231
|
+
const configured = await this.configured(options);
|
|
232
|
+
const origins = [...trustedOrigins, ...configured.trustedOrigins && Array.isArray(configured.trustedOrigins) ? configured.trustedOrigins : []];
|
|
233
|
+
const plugins = [...configured.plugins ?? []];
|
|
234
|
+
const mobile = trustedOrigins.filter((origin) => !isWebOrigin(origin));
|
|
235
|
+
if (mobile.length > 0 && !plugins.some((plugin) => plugin.id === "expo")) throw new ExpoPluginRequired(this.id, mobile);
|
|
236
|
+
if (deviceUrl) for (const plugin of plugins) reachableFromDevice(plugin, deviceUrl);
|
|
237
|
+
return {
|
|
166
238
|
...configured,
|
|
167
239
|
secret,
|
|
168
240
|
baseURL: baseUrl,
|
|
@@ -171,19 +243,185 @@ var BetterAuth = class {
|
|
|
171
243
|
db,
|
|
172
244
|
type: "postgres"
|
|
173
245
|
},
|
|
174
|
-
|
|
246
|
+
plugins,
|
|
247
|
+
trustedOrigins: origins,
|
|
175
248
|
advanced: {
|
|
176
249
|
...configured.advanced,
|
|
250
|
+
ipAddress: {
|
|
251
|
+
...configured.advanced?.ipAddress,
|
|
252
|
+
ipAddressHeaders: [CLIENT_IP_HEADER, ...(configured.advanced?.ipAddress?.ipAddressHeaders ?? ["x-forwarded-for"]).filter((name) => name.toLowerCase() !== CLIENT_IP_HEADER)]
|
|
253
|
+
},
|
|
177
254
|
...cookieDomain ? { crossSubDomainCookies: {
|
|
178
255
|
enabled: true,
|
|
179
256
|
domain: cookieDomain,
|
|
180
257
|
...configured.advanced?.crossSubDomainCookies
|
|
181
258
|
} } : {}
|
|
182
259
|
}
|
|
183
|
-
}
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
/** Links already rewritten — an `options` object is reused across builds. */
|
|
264
|
+
const rewritten = /* @__PURE__ */ new WeakSet();
|
|
265
|
+
/**
|
|
266
|
+
* Build the magic links an app asked for on the address a phone reaches.
|
|
267
|
+
*
|
|
268
|
+
* An app's link carries its scheme as the `callbackURL` (`shop://…`)
|
|
269
|
+
* where a browser's carries a path or an `http(s)` URL — which is how the two
|
|
270
|
+
* are told apart. A browser's link is left alone: it is opened on this
|
|
271
|
+
* machine, where the server's own hostname resolves.
|
|
272
|
+
*
|
|
273
|
+
* Better Auth's magic-link plugin calls `sendMagicLink` through the options
|
|
274
|
+
* object it returns, so wrapping it there is wrapping the call.
|
|
275
|
+
*/
|
|
276
|
+
function reachableFromDevice(plugin, deviceUrl) {
|
|
277
|
+
if (plugin.id !== "magic-link") return;
|
|
278
|
+
const options = plugin.options;
|
|
279
|
+
if (!options?.sendMagicLink || rewritten.has(options)) return;
|
|
280
|
+
rewritten.add(options);
|
|
281
|
+
const send = options.sendMagicLink;
|
|
282
|
+
options.sendMagicLink = (data, ...rest) => send({
|
|
283
|
+
...data,
|
|
284
|
+
url: deviceLink(data.url, deviceUrl)
|
|
285
|
+
}, ...rest);
|
|
286
|
+
}
|
|
287
|
+
/** A magic link moved to the device address when an app is its destination. */
|
|
288
|
+
function deviceLink(url, deviceUrl) {
|
|
289
|
+
try {
|
|
290
|
+
const link = new URL(url);
|
|
291
|
+
const callback = link.searchParams.get("callbackURL") ?? "/";
|
|
292
|
+
if (callback.startsWith("/") || isWebOrigin(callback)) return url;
|
|
293
|
+
return new URL(`${link.pathname}${link.search}`, deviceUrl).toString();
|
|
294
|
+
} catch {
|
|
295
|
+
return url;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/** A mobile app depends on this auth server, which has no Expo plugin. */
|
|
299
|
+
var ExpoPluginRequired = class extends Error {
|
|
300
|
+
server;
|
|
301
|
+
origins;
|
|
302
|
+
constructor(server, origins) {
|
|
303
|
+
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.`);
|
|
304
|
+
this.server = server;
|
|
305
|
+
this.origins = origins;
|
|
306
|
+
this.name = "ExpoPluginRequired";
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
/** What is forwarded to the auth server: the headers a session travels in. */
|
|
310
|
+
const SESSION_HEADERS = ["cookie", "authorization"];
|
|
311
|
+
/**
|
|
312
|
+
* `GET <basePath>/get-session`, read the way Better Auth answers it.
|
|
313
|
+
*
|
|
314
|
+
* Whose request it is travels in {@link CLIENT_IP_HEADER} — the server
|
|
315
|
+
* rate-limits `/get-session` by the client's address, so without it every
|
|
316
|
+
* caller shares the API's one bucket — and never as `X-Forwarded-For`. A
|
|
317
|
+
* forwarding header is what marks a request as outside traffic, so the auth
|
|
318
|
+
* server would start its span in a trace of its own rather than continue the
|
|
319
|
+
* API's. Without one, this is an internal caller's request, and the trace
|
|
320
|
+
* context it carries is continued.
|
|
321
|
+
*/
|
|
322
|
+
async function fetchSession(authenticator, endpoint, given) {
|
|
323
|
+
const headers = new Headers();
|
|
324
|
+
for (const name of SESSION_HEADERS) {
|
|
325
|
+
const value = given.get(name);
|
|
326
|
+
if (value) headers.set(name, value);
|
|
327
|
+
}
|
|
328
|
+
const client = given.get("x-forwarded-for");
|
|
329
|
+
if (client) headers.set(CLIENT_IP_HEADER, client);
|
|
330
|
+
injectTraceContext(headers);
|
|
331
|
+
const url = `${endpoint}/get-session`;
|
|
332
|
+
let response;
|
|
333
|
+
try {
|
|
334
|
+
response = await fetch(url, { headers });
|
|
335
|
+
} catch (cause) {
|
|
336
|
+
throw new AuthServerUnreachable(authenticator, url, cause);
|
|
337
|
+
}
|
|
338
|
+
if (response.status === 401) return null;
|
|
339
|
+
if (!response.ok) throw new SessionCheckFailed(authenticator, response.status);
|
|
340
|
+
return await response.json();
|
|
341
|
+
}
|
|
342
|
+
/** The auth server answered a session check with a failure. */
|
|
343
|
+
var SessionCheckFailed = class extends Error {
|
|
344
|
+
authenticator;
|
|
345
|
+
status;
|
|
346
|
+
constructor(authenticator, status) {
|
|
347
|
+
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.`);
|
|
348
|
+
this.authenticator = authenticator;
|
|
349
|
+
this.status = status;
|
|
350
|
+
this.name = "SessionCheckFailed";
|
|
184
351
|
}
|
|
185
352
|
};
|
|
353
|
+
/** A session check never reached the auth server. */
|
|
354
|
+
var AuthServerUnreachable = class extends Error {
|
|
355
|
+
authenticator;
|
|
356
|
+
url;
|
|
357
|
+
constructor(authenticator, url, cause) {
|
|
358
|
+
super(`'${authenticator}' could not be reached at ${url} to check a session. Check that the auth app is running and that this app's ${provideKey(authenticator, "url")} points at it.`, { cause });
|
|
359
|
+
this.authenticator = authenticator;
|
|
360
|
+
this.url = url;
|
|
361
|
+
this.name = "AuthServerUnreachable";
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* Better Auth's DDL, safe to run where its tables already exist.
|
|
366
|
+
*
|
|
367
|
+
* Its SQL is Kysely's, so its shape is known: `create table "…"`, `create index
|
|
368
|
+
* "…"`, `alter table "…" add column "…"`. A database that has been running
|
|
369
|
+
* already has those — Better Auth used to create them at runtime — and the
|
|
370
|
+
* first committed migration would fail on them rather than recording that they
|
|
371
|
+
* are there.
|
|
372
|
+
*/
|
|
373
|
+
function idempotent(statements) {
|
|
374
|
+
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 \"");
|
|
375
|
+
}
|
|
376
|
+
/** Headers a reverse proxy or CDN adds on the way in. */
|
|
377
|
+
const FORWARDING_HEADERS = [
|
|
378
|
+
"forwarded",
|
|
379
|
+
"x-forwarded-for",
|
|
380
|
+
"x-forwarded-host",
|
|
381
|
+
"x-real-ip",
|
|
382
|
+
"cf-connecting-ip",
|
|
383
|
+
"true-client-ip",
|
|
384
|
+
"fastly-client-ip",
|
|
385
|
+
"x-client-ip"
|
|
386
|
+
];
|
|
387
|
+
/**
|
|
388
|
+
* `request`, without {@link CLIENT_IP_HEADER} unless an internal caller sent
|
|
389
|
+
* it — no `Origin`, no forwarding header, a loopback or private peer: the
|
|
390
|
+
* rule a request's span continues a trace by (`@geekmidas/telescope`'s
|
|
391
|
+
* `isInternalCaller`).
|
|
392
|
+
*
|
|
393
|
+
* The stack's own edges strip the header already. This holds wherever one
|
|
394
|
+
* does not — a platform's proxy, a port published straight to the internet —
|
|
395
|
+
* so a stranger cannot pick the address Better Auth rate-limits them by.
|
|
396
|
+
*/
|
|
397
|
+
function withTrustedClientIp(request, remoteAddress) {
|
|
398
|
+
if (!request.headers.has(CLIENT_IP_HEADER)) return request;
|
|
399
|
+
if (!request.headers.has("origin") && !FORWARDING_HEADERS.some((name) => request.headers.has(name)) && isPrivateAddress(remoteAddress)) return request;
|
|
400
|
+
const headers = new Headers(request.headers);
|
|
401
|
+
headers.delete(CLIENT_IP_HEADER);
|
|
402
|
+
return new Request(request, { headers });
|
|
403
|
+
}
|
|
404
|
+
/** The TCP peer of a request served by `@hono/node-server`, when there is one. */
|
|
405
|
+
function remoteAddressOf(c) {
|
|
406
|
+
return c.env?.incoming?.socket?.remoteAddress;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Whether `address` is loopback or private: 127/8, 10/8, 172.16/12,
|
|
410
|
+
* 192.168/16, 169.254/16, `::1`, `fc00::/7`, `fe80::/10`, and an IPv4 one
|
|
411
|
+
* mapped into IPv6.
|
|
412
|
+
*/
|
|
413
|
+
function isPrivateAddress(address) {
|
|
414
|
+
if (!address) return false;
|
|
415
|
+
const ip = address.toLowerCase().replace(/^::ffff:/, "");
|
|
416
|
+
const v4 = ip.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
417
|
+
if (v4) {
|
|
418
|
+
const [a, b] = [Number(v4[1]), Number(v4[2])];
|
|
419
|
+
return a === 127 || a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 169 && b === 254;
|
|
420
|
+
}
|
|
421
|
+
if (ip === "::1") return true;
|
|
422
|
+
return /^f[cd][0-9a-f]{2}:/.test(ip) || /^fe[89ab][0-9a-f]:/.test(ip);
|
|
423
|
+
}
|
|
186
424
|
//#endregion
|
|
187
|
-
export { BetterAuth };
|
|
425
|
+
export { AuthServerUnreachable, BetterAuth, ExpoPluginRequired, SessionCheckFailed, deviceLink, idempotent, withTrustedClientIp };
|
|
188
426
|
|
|
189
427
|
//# sourceMappingURL=auth.mjs.map
|