@geekmidas/constructs 10.0.0-alpha.15 → 10.0.0-alpha.151
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-D8mB_cPX.d.mts} +16 -9
- package/dist/Cron-D8mB_cPX.d.mts.map +1 -0
- package/dist/{Cron-SyqS5oWJ.d.mts → Cron-D_sfaMGz.d.cts} +16 -9
- package/dist/Cron-D_sfaMGz.d.cts.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-C91MVLSr.d.cts +47 -0
- package/dist/CronBuilder-C91MVLSr.d.cts.map +1 -0
- package/dist/CronBuilder-Cmajva3g.d.mts +47 -0
- package/dist/CronBuilder-Cmajva3g.d.mts.map +1 -0
- package/dist/Endpoint-52z1P0Ue.cjs +581 -0
- package/dist/Endpoint-52z1P0Ue.cjs.map +1 -0
- package/dist/{Endpoint-DuT4TEEq.d.mts → Endpoint-BbHh3Qoc.d.mts} +124 -43
- package/dist/Endpoint-BbHh3Qoc.d.mts.map +1 -0
- package/dist/{Endpoint-C6yyHpRS.d.cts → Endpoint-YYwjqtS1.d.cts} +122 -41
- package/dist/Endpoint-YYwjqtS1.d.cts.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-BPSZ_Lp_.d.cts → EndpointFactory-Hh1r6J_C.d.cts} +187 -104
- package/dist/EndpointFactory-Hh1r6J_C.d.cts.map +1 -0
- package/dist/{index-BoZ-iisU.d.mts → EndpointFactory-qcLzi4f-.d.mts} +188 -105
- package/dist/EndpointFactory-qcLzi4f-.d.mts.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-BXBdb2Bt.cjs} +79 -31
- package/dist/HonoEndpointAdaptor-BXBdb2Bt.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-yYaU7jVJ.mjs → HonoEndpointAdaptor-DR3j7S35.mjs} +76 -28
- package/dist/HonoEndpointAdaptor-DR3j7S35.mjs.map +1 -0
- package/dist/ObjectSubscriberBuilder-Cv8C7yS1.d.mts +129 -0
- package/dist/ObjectSubscriberBuilder-Cv8C7yS1.d.mts.map +1 -0
- package/dist/ObjectSubscriberBuilder-LWkey_oq.d.cts +129 -0
- package/dist/ObjectSubscriberBuilder-LWkey_oq.d.cts.map +1 -0
- package/dist/ProcessorBuilder-CwfP-M33.d.mts +216 -0
- package/dist/ProcessorBuilder-CwfP-M33.d.mts.map +1 -0
- package/dist/ProcessorBuilder-_jdZlbfW.d.cts +216 -0
- package/dist/ProcessorBuilder-_jdZlbfW.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-BxsZ9o5z.cjs +135 -0
- package/dist/QueueBuilder-BxsZ9o5z.cjs.map +1 -0
- package/dist/QueueBuilder-DmwFtLzQ.d.mts +75 -0
- package/dist/QueueBuilder-DmwFtLzQ.d.mts.map +1 -0
- package/dist/QueueBuilder-SQli59An.d.cts +75 -0
- package/dist/QueueBuilder-SQli59An.d.cts.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-BqWz2JxC.d.cts +274 -0
- package/dist/auth-BqWz2JxC.d.cts.map +1 -0
- package/dist/auth-DnB9H9KL.d.mts +274 -0
- package/dist/auth-DnB9H9KL.d.mts.map +1 -0
- package/dist/auth.cjs +320 -21
- 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 +316 -23
- package/dist/auth.mjs.map +1 -1
- package/dist/cache-CQjMNPrC.d.cts +44 -0
- package/dist/cache-CQjMNPrC.d.cts.map +1 -0
- package/dist/cache-e3tfMQ9g.d.mts +44 -0
- package/dist/cache-e3tfMQ9g.d.mts.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-CSA9VeWM.d.mts} +47 -8
- package/dist/construct-interface-CSA9VeWM.d.mts.map +1 -0
- package/dist/{construct-interface-DgXTJcOD.d.cts → construct-interface-DugP0E5q.d.cts} +47 -8
- package/dist/construct-interface-DugP0E5q.d.cts.map +1 -0
- package/dist/construct-interface.cjs +38 -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 +37 -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-BqhP8RRQ.d.mts +201 -0
- package/dist/fake-BqhP8RRQ.d.mts.map +1 -0
- package/dist/fake-DqieDYYA.d.cts +201 -0
- package/dist/fake-DqieDYYA.d.cts.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-CR3L1fOI.d.cts +195 -0
- package/dist/inbox-CR3L1fOI.d.cts.map +1 -0
- package/dist/inbox-CjxpLVkH.d.mts +195 -0
- package/dist/inbox-CjxpLVkH.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-DCkDQkwj.d.mts +115 -0
- package/dist/index-DCkDQkwj.d.mts.map +1 -0
- package/dist/index-DPTHa6Ud.d.cts +115 -0
- package/dist/index-DPTHa6Ud.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.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-CebjCWTl.d.cts +216 -0
- package/dist/kysely-CebjCWTl.d.cts.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/kysely-DE4kADWD.d.mts +216 -0
- package/dist/kysely-DE4kADWD.d.mts.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 +85 -70
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +77 -59
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +77 -59
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +87 -72
- 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 +85 -8
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +98 -2
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +98 -2
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +84 -11
- 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-C1oqncFY.d.cts +40 -0
- package/dist/telemetry-C1oqncFY.d.cts.map +1 -0
- package/dist/telemetry-CObow3Dn.d.mts +40 -0
- package/dist/telemetry-CObow3Dn.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 +951 -0
- package/dist/websocket-api.cjs.map +1 -0
- package/dist/websocket-api.d.cts +556 -0
- package/dist/websocket-api.d.cts.map +1 -0
- package/dist/websocket-api.d.mts +556 -0
- package/dist/websocket-api.d.mts.map +1 -0
- package/dist/websocket-api.mjs +933 -0
- package/dist/websocket-api.mjs.map +1 -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 +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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Endpoint-sUOU7uLx.mjs","names":[],"sources":["../src/endpoints/sessionAuth.ts","../src/endpoints/Endpoint.ts"],"sourcesContent":["import type { AuthSession } from '../auth';\nimport { identifyUser } from '../tracing';\nimport type { EndpointSurface, HeaderFn } from './Endpoint';\n\n/**\n * The surface's authenticator, as a session callback sees it.\n *\n * Bound to the request being handled, so reading the session takes no\n * argument: `session(async ({ auth }) => auth.getSession())`.\n */\nexport interface SessionAuth {\n\t/** This request's session, verified by the `.auth()` construct — or `null`. */\n\tgetSession(): Promise<AuthSession | null>;\n}\n\n/**\n * What is forwarded to the auth server: the headers a session travels in,\n * whose request it is, and the origin it came from — nothing else.\n *\n * The client's address goes with the session because the auth server\n * rate-limits by it, `/get-session` included. Without it every user's session\n * check arrived from the surface itself — one shared bucket, so enough\n * traffic from anyone turned every session check into a 429 — and in tests,\n * concurrent tests queued on the same rate-limit row.\n *\n * The origin, because the surface calls the auth server at its public\n * address, through the edge: it is what lets the auth server continue this\n * request's trace for a site both trust.\n */\nconst SESSION_HEADERS = [\n\t'cookie',\n\t'authorization',\n\t'x-forwarded-for',\n\t'origin',\n] as const;\n\n/** `auth` for one request on one surface. */\nexport function sessionAuth(\n\tsurface: EndpointSurface | undefined,\n\theader: HeaderFn,\n): SessionAuth {\n\treturn {\n\t\tasync getSession() {\n\t\t\tconst authenticator = surface?.auth;\n\t\t\tif (!surface || !authenticator) {\n\t\t\t\tthrow new NoAuthenticator(surface?.id);\n\t\t\t}\n\n\t\t\tconst headers = new Headers();\n\t\t\tfor (const name of SESSION_HEADERS) {\n\t\t\t\tconst value = header(name);\n\t\t\t\tif (value) headers.set(name, value);\n\t\t\t}\n\n\t\t\tconst session = (await authenticator.verify(\n\t\t\t\theaders,\n\t\t\t\tsurface.envParser,\n\t\t\t)) as AuthSession | null;\n\n\t\t\t// Whose request this is, from here on: its logger, its services and\n\t\t\t// its trace all say so. Read defensively: an authenticator other than\n\t\t\t// Better Auth answers in its own shape, and one without a user id\n\t\t\t// identifies no one.\n\t\t\tconst identity = session as {\n\t\t\t\tuser?: { id?: unknown };\n\t\t\t\tsession?: { id?: unknown };\n\t\t\t} | null;\n\t\t\tif (typeof identity?.user?.id === 'string') {\n\t\t\t\tidentifyUser({\n\t\t\t\t\tid: identity.user.id,\n\t\t\t\t\t...(typeof identity.session?.id === 'string'\n\t\t\t\t\t\t? { sessionId: identity.session.id }\n\t\t\t\t\t\t: {}),\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn session;\n\t\t},\n\t};\n}\n\n/** `auth.getSession()` was called on a surface that names no authenticator. */\nexport class NoAuthenticator extends Error {\n\tconstructor(readonly surface: string | undefined) {\n\t\tsuper(\n\t\t\t`auth.getSession() needs an authenticator, and ${\n\t\t\t\tsurface ? `the surface '${surface}'` : 'this endpoint'\n\t\t\t} declares none: declare one on the surface with .auth(construct).`,\n\t\t);\n\t\tthis.name = 'NoAuthenticator';\n\t}\n}\n","import type { AuditableAction, Auditor, AuditStorage } from '@geekmidas/audit';\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { Logger } from '@geekmidas/logger';\nimport type { RateLimitConfig } from '@geekmidas/rate-limit';\nimport type {\n\tInferComposableStandardSchema,\n\tInferStandardSchema,\n\tInferStandardSchemaInput,\n} from '@geekmidas/schema';\nimport {\n\tconvertSchemaWithComponents,\n\tconvertStandardSchemaToJsonSchema,\n} from '@geekmidas/schema/conversion';\nimport {\n\tbuildOpenApiSchema,\n\ttype ComponentCollector,\n\ttype OpenApiSchemaOptions,\n} from '@geekmidas/schema/openapi';\nimport type { Service, ServiceRecord } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { OpenAPIV3_1 } from 'openapi-types';\nimport { ConstructType } from '../Construct';\nimport type { Authenticator } from '../construct-interface';\nimport { Function, type FunctionHandler } from '../functions';\nimport type { TopicEvent } from '../publisher';\nimport type { EndpointTelemetry } from '../telemetry';\nimport type { HttpMethod, LowerHttpMethod, RemoveUndefined } from '../types';\nimport type { Authorizer } from './Authorizer';\nimport type { ActorExtractor, MappedAudit } from './audit';\nimport type { RlsConfig } from './rls';\nimport { type SessionAuth, sessionAuth } from './sessionAuth';\n\n/**\n * Represents an HTTP endpoint that can handle requests with type-safe input/output validation,\n * dependency injection, session management, and authorization.\n *\n * @template TRoute - The route path string with parameter placeholders (e.g., '/users/:id')\n * @template TMethod - The HTTP method (GET, POST, PUT, DELETE, PATCH)\n * @template TInput - The input schema definition for body, query, and path parameters\n * @template OutSchema - The output schema for response validation\n * @template TServices - Array of service dependencies to inject\n * @template TLogger - The logger instance type\n * @template TSession - The session data type\n *\n * @extends Function - Base function construct for handler execution\n *\n * @example\n * ```typescript\n * const endpoint = new Endpoint({\n * route: '/users/:id',\n * method: 'GET',\n * input: { params: userIdSchema },\n * output: userSchema,\n * fn: async ({ params }) => getUserById(params.id)\n * });\n * ```\n */\nexport class Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends Function<\n\tTInput,\n\tTServices,\n\tTLogger,\n\tOutSchema,\n\tTAuditStorage,\n\tTAuditStorageServiceName,\n\tTDatabase,\n\tTDatabaseServiceName,\n\tTAuditAction,\n\tFunctionHandler<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTAuditStorage,\n\t\tTAuditAction\n\t>\n> {\n\toperationId?: string;\n\t/** The route path pattern with parameter placeholders */\n\troute: TRoute;\n\t/** The HTTP method for this endpoint */\n\tmethod: TMethod;\n\t/**\n\t * The surface that serves it, when it was built from one.\n\t *\n\t * Carries the env parser the adaptors need, so a generated handler needs no\n\t * import written for it — and the surface's id, so the build attributes the\n\t * route to the API that serves it rather than inferring it by exclusion.\n\t */\n\tsurface: EndpointSurface;\n\t/** Optional description for OpenAPI documentation */\n\tdescription?: string;\n\t/** Optional tags for OpenAPI documentation */\n\ttags?: string[];\n\t/** The HTTP status code to return (default: 200) */\n\tpublic readonly status: EndpointStatus;\n\t/**\n\t * Response content type for this endpoint. Defaults to `'application/json'`.\n\t * Non-JSON types cause adaptors to emit the body as-is with the declared\n\t * Content-Type header instead of JSON-serializing.\n\t */\n\tpublic readonly responseType: string;\n\n\t/**\n\t * This route's telemetry — `.telemetry({ ignore, attributes })` — read by\n\t * the build, which hands it to the request middleware.\n\t */\n\tpublic telemetry?: EndpointTelemetry;\n\t/** Default headers to apply to all responses */\n\tpublic readonly defaultHeaders: Record<string, string> = {};\n\t/** Function to extract session data from the request context */\n\tpublic getSession: SessionFn<TServices, TLogger, TSession, TDatabase> = () =>\n\t\t({}) as TSession;\n\t/**\n\t * Whether a session callback was given — `.session()` on the factory it was\n\t * built from. A generated handler reads the session only when it is, so\n\t * an endpoint with a session and no authorizer must say so: it used to be\n\t * handed `undefined` in a production build and its session in `gkm dev`.\n\t */\n\tpublic readonly hasSession: boolean = false;\n\t/** Function to determine if the request is authorized */\n\tpublic authorize: AuthorizeFn<\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tTInput,\n\t\tTDatabase\n\t> = () => true;\n\t/** Optional rate limiting configuration */\n\tpublic rateLimit?: RateLimitConfig;\n\t/** Optional authorizer for this endpoint */\n\tpublic authorizer?: Authorizer;\n\t/** Optional actor extractor for audit records */\n\tpublic actorExtractor?: ActorExtractor<TServices, TSession, TLogger>;\n\t/** Declarative audit definitions */\n\tpublic audits: MappedAudit<TAuditAction, OutSchema>[] = [];\n\t/** Database service for this endpoint */\n\tpublic declare databaseService?: Service<TDatabaseServiceName, TDatabase>;\n\t/** RLS configuration for this endpoint */\n\tpublic rlsConfig?: RlsConfig<TServices, TSession, TLogger>;\n\t/** Whether to bypass RLS for this endpoint */\n\tpublic rlsBypass?: boolean;\n\t/** The endpoint handler function */\n\tprivate endpointFn!: EndpointHandler<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTSession,\n\t\tTDatabase,\n\t\tTAuditStorage,\n\t\tTAuditAction\n\t>;\n\n\t/**\n\t * Builds a complete OpenAPI 3.1 schema from an array of endpoints.\n\t *\n\t * @param endpoints - Array of endpoint instances to document\n\t * @param options - Optional configuration for OpenAPI generation\n\t * @returns OpenAPI 3.1 specification object\n\t *\n\t * @example\n\t * ```typescript\n\t * const schema = await Endpoint.buildOpenApiSchema([\n\t * getUserEndpoint,\n\t * createUserEndpoint\n\t * ], {\n\t * title: 'User API',\n\t * version: '1.0.0'\n\t * });\n\t * ```\n\t */\n\tstatic async buildOpenApiSchema(\n\t\tendpoints: Endpoint<any, any, any, any, any, any>[],\n\t\toptions?: OpenApiSchemaOptions,\n\t) {\n\t\treturn buildOpenApiSchema(endpoints, options);\n\t}\n\n\t/**\n\t * Gets the full path including HTTP method and route.\n\t * @returns Formatted string like 'GET /users/{id}'\n\t */\n\tget fullPath() {\n\t\treturn `${this.method} ${this._path}` as const;\n\t}\n\n\t/**\n\t * Parses and validates input data for a specific input type (body, query, params).\n\t *\n\t * @param input - The raw input data to validate\n\t * @param key - The input type key ('body', 'query', or 'params')\n\t * @returns The validated input data for the specified key\n\t * @throws {UnprocessableEntityError} When validation fails\n\t */\n\tasync parseInput<K extends keyof TInput>(\n\t\tinput: unknown,\n\t\tkey: K,\n\t): Promise<InferComposableStandardSchema<TInput[K]>> {\n\t\tconst schema = this.input?.[key];\n\t\treturn Endpoint.parseSchema(schema as StandardSchemaV1, input) as Promise<\n\t\t\tInferComposableStandardSchema<TInput[K]>\n\t\t>;\n\t}\n\n\t/**\n\t * Parses and validates the request body against the body schema.\n\t *\n\t * @param body - The raw request body to validate\n\t * @returns The validated body data\n\t * @throws {UnprocessableEntityError} When body validation fails\n\t */\n\tasync parseBody(body: unknown): Promise<InferStandardSchema<TInput['body']>> {\n\t\treturn this.parseInput(body, 'body') as Promise<\n\t\t\tInferStandardSchema<TInput['body']>\n\t\t>;\n\t}\n\n\tstatic isSuccessStatus(status: number): boolean {\n\t\treturn status >= 200 && status < 300;\n\t}\n\n\t/**\n\t * Whether `status` sends the client elsewhere. A redirect has no body, so\n\t * its response is not checked against the output schema, and what is\n\t * derived from the output — declared events and audits — is not sent.\n\t */\n\tstatic isRedirectStatus(status: number | undefined): boolean {\n\t\treturn status !== undefined && status >= 300 && status < 400;\n\t}\n\n\t/**\n\t * Creates a case-insensitive header lookup function from a headers object.\n\t *\n\t * @param headers - Object containing header key-value pairs\n\t * @returns Function to retrieve header values by case-insensitive key, or all headers\n\t *\n\t * @example\n\t * ```typescript\n\t * const headerFn = Endpoint.createHeaders({ 'Content-Type': 'application/json' });\n\t * headerFn('content-type'); // Returns 'application/json'\n\t * headerFn(); // Returns { 'content-type': 'application/json' }\n\t * ```\n\t */\n\tstatic createHeaders(headers: Record<string, string>): HeaderFn {\n\t\tconst headerMap = new Map<string, string>();\n\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\tconst key = k.toLowerCase();\n\t\t\theaderMap.set(key, v);\n\t\t}\n\n\t\tfunction get(): Record<string, string>;\n\t\tfunction get(key: string): string | undefined;\n\t\tfunction get(key?: string): string | undefined | Record<string, string> {\n\t\t\tif (key === undefined) {\n\t\t\t\t// Return all headers as plain object\n\t\t\t\treturn Object.fromEntries(headerMap.entries());\n\t\t\t}\n\t\t\treturn headerMap.get(key.toLowerCase());\n\t\t}\n\n\t\treturn get;\n\t}\n\n\t/**\n\t * Parses cookie string and creates a cookie lookup function.\n\t *\n\t * @param cookieHeader - The Cookie header value\n\t * @returns Function to retrieve cookie values by name, or all cookies\n\t *\n\t * @example\n\t * ```typescript\n\t * const cookieFn = Endpoint.createCookies('session=abc123; theme=dark');\n\t * cookieFn('session'); // Returns 'abc123'\n\t * cookieFn(); // Returns { session: 'abc123', theme: 'dark' }\n\t * ```\n\t */\n\tstatic createCookies(cookieHeader: string | undefined): CookieFn {\n\t\tconst cookieMap = new Map<string, string>();\n\n\t\tif (cookieHeader) {\n\t\t\t// Parse cookie string: \"name1=value1; name2=value2\"\n\t\t\tconst cookies = cookieHeader.split(';');\n\t\t\tfor (const cookie of cookies) {\n\t\t\t\tconst [name, ...valueParts] = cookie.trim().split('=');\n\t\t\t\tif (name) {\n\t\t\t\t\tconst value = valueParts.join('='); // Handle values with = in them\n\t\t\t\t\tcookieMap.set(name, decodeURIComponent(value));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction get(): Record<string, string>;\n\t\tfunction get(name: string): string | undefined;\n\t\tfunction get(name?: string): string | undefined | Record<string, string> {\n\t\t\tif (name === undefined) {\n\t\t\t\t// Return all cookies as plain object\n\t\t\t\treturn Object.fromEntries(cookieMap.entries());\n\t\t\t}\n\t\t\treturn cookieMap.get(name);\n\t\t}\n\n\t\treturn get;\n\t}\n\n\t/**\n\t * Formats a cookie as a Set-Cookie header string.\n\t *\n\t * @param name - Cookie name\n\t * @param value - Cookie value\n\t * @param options - Cookie options (httpOnly, secure, sameSite, etc.)\n\t * @returns Formatted Set-Cookie header string\n\t *\n\t * @example\n\t * ```typescript\n\t * const header = Endpoint.formatCookieHeader('session', 'abc123', {\n\t * httpOnly: true,\n\t * secure: true,\n\t * sameSite: 'strict',\n\t * maxAge: 3600\n\t * });\n\t * // Returns: \"session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=Strict\"\n\t * ```\n\t */\n\tstatic formatCookieHeader(\n\t\tname: string,\n\t\tvalue: string,\n\t\toptions?: CookieOptions,\n\t): string {\n\t\tlet cookie = `${name}=${value}`;\n\n\t\tif (options) {\n\t\t\tif (options.domain) cookie += `; Domain=${options.domain}`;\n\t\t\tif (options.path) cookie += `; Path=${options.path}`;\n\t\t\tif (options.expires)\n\t\t\t\tcookie += `; Expires=${options.expires.toUTCString()}`;\n\t\t\tif (options.maxAge !== undefined) cookie += `; Max-Age=${options.maxAge}`;\n\t\t\tif (options.httpOnly) cookie += '; HttpOnly';\n\t\t\tif (options.secure) cookie += '; Secure';\n\t\t\tif (options.sameSite) {\n\t\t\t\tcookie += `; SameSite=${options.sameSite.charAt(0).toUpperCase() + options.sameSite.slice(1)}`;\n\t\t\t}\n\t\t}\n\n\t\treturn cookie;\n\t}\n\n\t/**\n\t * Extracts and refines input data from the endpoint context.\n\t *\n\t * @param ctx - The endpoint execution context\n\t * @returns Object containing only the input data (body, query, params)\n\t * @internal\n\t */\n\trefineInput(\n\t\tctx: EndpointContext<TInput, TServices, TLogger, TSession>,\n\t): InferComposableStandardSchema<TInput> {\n\t\tconst input: Record<string, unknown> = {};\n\t\tfor (const key of ['body', 'query', 'params'] as const) {\n\t\t\tif (key in ctx) {\n\t\t\t\tinput[key] = (ctx as Record<string, unknown>)[key];\n\t\t\t}\n\t\t}\n\n\t\treturn input as InferComposableStandardSchema<TInput>;\n\t}\n\n\thandler = (\n\t\tctx: EndpointContext<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTAuditAction,\n\t\t\tTDatabase,\n\t\t\tTAuditStorage\n\t\t>,\n\t\tresponse: ResponseBuilder,\n\t): OutSchema extends StandardSchemaV1\n\t\t? // Handler produces the output schema's INPUT type (the schema\n\t\t\t// may coerce it on the way out — see EndpointHandler).\n\t\t\t\t| InferStandardSchemaInput<OutSchema>\n\t\t\t\t| ResponseWithMetadata<InferStandardSchemaInput<OutSchema>>\n\t\t\t\t| Promise<\n\t\t\t\t\t\t| InferStandardSchemaInput<OutSchema>\n\t\t\t\t\t\t| ResponseWithMetadata<InferStandardSchemaInput<OutSchema>>\n\t\t\t\t >\n\t\t:\n\t\t\t\t| any\n\t\t\t\t| ResponseWithMetadata<any>\n\t\t\t\t| Promise<any>\n\t\t\t\t| Promise<ResponseWithMetadata<any>> => {\n\t\t// Apply default headers to response builder\n\t\tfor (const [key, value] of Object.entries(this.defaultHeaders)) {\n\t\t\tresponse.header(key, value);\n\t\t}\n\n\t\t// Build context object, conditionally including auditor and db\n\t\tconst handlerCtx = {\n\t\t\t...this.refineInput(ctx),\n\t\t\tservices: ctx.services,\n\t\t\tlogger: ctx.logger,\n\t\t\theader: ctx.header,\n\t\t\tcookie: ctx.cookie,\n\t\t\tsession: ctx.session,\n\t\t\t// These are conditionally present based on configuration\n\t\t\t...('auditor' in ctx && { auditor: ctx.auditor }),\n\t\t\t...('db' in ctx && { db: ctx.db }),\n\t\t} as EndpointContext<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTAuditAction,\n\t\t\tTDatabase,\n\t\t\tTAuditStorage\n\t\t>;\n\n\t\treturn this.endpointFn(handlerCtx, response);\n\t};\n\n\t/**\n\t * Type guard to check if an object is an Endpoint instance.\n\t *\n\t * @param obj - The object to check\n\t * @returns True if the object is an Endpoint\n\t */\n\tstatic isEndpoint(obj: any): obj is Endpoint<any, any, any, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as Function).__IS_FUNCTION__ === true &&\n\t\t\t\tobj.type === ConstructType.Endpoint,\n\t\t);\n\t}\n\n\t/**\n\t * Helper to check if response has metadata\n\t */\n\tstatic hasMetadata<T>(\n\t\tresponse: T | ResponseWithMetadata<T>,\n\t): response is ResponseWithMetadata<T> {\n\t\treturn (\n\t\t\tresponse !== null &&\n\t\t\ttypeof response === 'object' &&\n\t\t\t'data' in response &&\n\t\t\t'metadata' in response\n\t\t);\n\t}\n\n\t/**\n\t * Converts Express-style route params to OpenAPI format.\n\t * @returns Route with ':param' converted to '{param}'\n\t * @internal\n\t */\n\tget _path() {\n\t\treturn this.route.replace(/:(\\w+)/g, '{$1}') as ConvertRouteParams<TRoute>;\n\t}\n\n\t/**\n\t * Generates OpenAPI 3.1 schema for this endpoint.\n\t *\n\t * @returns OpenAPI route definition with operation details\n\t */\n\tasync toOpenApi3Route(\n\t\tcomponentCollector?: ComponentCollector,\n\t): Promise<EndpointOpenApiSchema<TRoute, TMethod>> {\n\t\t// The status the handler answers with — `.status(201)` is documented as\n\t\t// 201, not as the 200 every endpoint used to claim.\n\t\tconst status = String(this.status);\n\t\tconst operation: OpenAPIV3_1.OperationObject = {\n\t\t\toperationId: this.operationId,\n\t\t\t...(this.description && { description: this.description }),\n\t\t\t...(this.tags && this.tags.length > 0 && { tags: this.tags }),\n\t\t\tresponses: {\n\t\t\t\t[status]: {\n\t\t\t\t\tdescription: 'Successful response',\n\t\t\t\t} as OpenAPIV3_1.ResponseObject,\n\t\t\t},\n\t\t};\n\n\t\t// What protects it. Without this every endpoint read as public in the\n\t\t// document, including the ones an authorizer guards.\n\t\tconst scheme = this.authorizer?.securityScheme;\n\t\tif (this.authorizer && scheme && componentCollector) {\n\t\t\tcomponentCollector.addSecurityScheme(\n\t\t\t\tthis.authorizer.name,\n\t\t\t\tscheme as OpenAPIV3_1.SecuritySchemeObject,\n\t\t\t);\n\t\t\toperation.security = [{ [this.authorizer.name]: [] }];\n\t\t}\n\n\t\t// Add response schema\n\t\tif (this.outputSchema) {\n\t\t\tconst responseSchema = await convertSchemaWithComponents(\n\t\t\t\tthis.outputSchema,\n\t\t\t\tcomponentCollector,\n\t\t\t);\n\t\t\tif (responseSchema) {\n\t\t\t\t(operation.responses![status] as OpenAPIV3_1.ResponseObject).content = {\n\t\t\t\t\t[this.responseType]: { schema: responseSchema },\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Separate path and query parameters\n\t\tconst pathParameters: OpenAPIV3_1.ParameterObject[] = [];\n\t\tconst queryParameters: OpenAPIV3_1.ParameterObject[] = [];\n\n\t\t// Since the EndpointBuilder doesn't have body/search/params methods yet,\n\t\t// and the input is a composite type, we need to check if input exists\n\t\t// and has the expected shape\n\t\tif (this.input && typeof this.input === 'object') {\n\t\t\t// Add request body for methods that support it\n\t\t\tif (\n\t\t\t\t['POST', 'PUT', 'PATCH'].includes(this.method) &&\n\t\t\t\t'body' in this.input &&\n\t\t\t\tthis.input.body\n\t\t\t) {\n\t\t\t\tconst bodySchema = await convertSchemaWithComponents(\n\t\t\t\t\tthis.input.body as StandardSchemaV1,\n\t\t\t\t\tcomponentCollector,\n\t\t\t\t);\n\t\t\t\tif (bodySchema) {\n\t\t\t\t\toperation.requestBody = {\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\t\tschema: bodySchema,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add path parameters\n\t\t\tif ('params' in this.input && this.input.params) {\n\t\t\t\tconst paramsSchema = await convertStandardSchemaToJsonSchema(\n\t\t\t\t\tthis.input.params as StandardSchemaV1,\n\t\t\t\t);\n\t\t\t\tif (\n\t\t\t\t\tparamsSchema &&\n\t\t\t\t\tparamsSchema.type === 'object' &&\n\t\t\t\t\tparamsSchema.properties\n\t\t\t\t) {\n\t\t\t\t\tfor (const [name, schema] of Object.entries(\n\t\t\t\t\t\tparamsSchema.properties,\n\t\t\t\t\t)) {\n\t\t\t\t\t\tpathParameters.push({\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tin: 'path',\n\t\t\t\t\t\t\trequired: paramsSchema.required?.includes(name) ?? true,\n\t\t\t\t\t\t\tschema: schema as any,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add query parameters\n\t\t\tif ('query' in this.input && this.input.query) {\n\t\t\t\tconst querySchema = await convertStandardSchemaToJsonSchema(\n\t\t\t\t\tthis.input.query,\n\t\t\t\t);\n\t\t\t\tif (\n\t\t\t\t\tquerySchema &&\n\t\t\t\t\tquerySchema.type === 'object' &&\n\t\t\t\t\tquerySchema.properties\n\t\t\t\t) {\n\t\t\t\t\tfor (const [name, schema] of Object.entries(querySchema.properties)) {\n\t\t\t\t\t\tqueryParameters.push({\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tin: 'query',\n\t\t\t\t\t\t\trequired: querySchema.required?.includes(name) ?? false,\n\t\t\t\t\t\t\tschema: schema as any,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Only add query parameters to the operation\n\t\tif (queryParameters.length > 0) {\n\t\t\toperation.parameters = queryParameters;\n\t\t}\n\n\t\t// Build the route object with path parameters at the route level\n\t\tconst routeObject: any = {};\n\t\tif (pathParameters.length > 0) {\n\t\t\trouteObject.parameters = pathParameters;\n\t\t}\n\t\trouteObject[this.method.toLowerCase()] = operation;\n\n\t\treturn {\n\t\t\t[this._path]: routeObject,\n\t\t} as EndpointOpenApiSchema<TRoute, TMethod>;\n\t}\n\n\t/**\n\t * Creates a new Endpoint instance.\n\t *\n\t * @param options - Configuration options for the endpoint\n\t * @param options.fn - The handler function to execute\n\t * @param options.method - HTTP method\n\t * @param options.route - Route path with parameter placeholders\n\t * @param options.description - Optional description for documentation\n\t * @param options.input - Input schemas for validation\n\t * @param options.logger - Logger instance\n\t * @param options.output - Output schema for response validation\n\t * @param options.services - Service dependencies\n\t * @param options.timeout - Execution timeout in milliseconds\n\t * @param options.getSession - Session extraction function\n\t * @param options.authorize - Authorization check function\n\t * @param options.status - Success HTTP status code (default: 200)\n\t * @param options.authorizer - Optional authorizer configuration\n\t */\n\tconstructor({\n\t\tfn,\n\t\tmethod,\n\t\troute,\n\t\tdescription,\n\t\ttags,\n\t\tinput,\n\t\tlogger,\n\t\toutput: outputSchema,\n\t\tservices,\n\t\tconstructs,\n\t\ttimeout,\n\t\tmemorySize,\n\t\tgetSession,\n\t\tauthorize,\n\t\trateLimit,\n\t\tstatus = SuccessStatus.OK,\n\t\tevents,\n\t\tauthorizer,\n\t\tsurface,\n\t\tauditorStorageService,\n\t\tactorExtractor,\n\t\taudits,\n\t\tdatabaseService,\n\t\trlsConfig,\n\t\trlsBypass,\n\t\tresponseType,\n\t\ttelemetry,\n\t}: EndpointOptions<\n\t\tTRoute,\n\t\tTMethod,\n\t\tTInput,\n\t\tOutSchema,\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tOutSchema,\n\t\tTAuditStorage,\n\t\tTAuditStorageServiceName,\n\t\tTAuditAction,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t>) {\n\t\tsuper(\n\t\t\tfn as unknown as FunctionHandler<TInput, TServices, TLogger, OutSchema>,\n\t\t\ttimeout,\n\t\t\tConstructType.Endpoint,\n\t\t\tinput,\n\t\t\toutputSchema,\n\t\t\tservices,\n\t\t\tlogger,\n\t\t\tevents,\n\t\t\tmemorySize,\n\t\t\tauditorStorageService,\n\t\t\tundefined, // databaseService — assigned below, after the RLS wiring\n\t\t\tconstructs,\n\t\t);\n\n\t\tthis.route = route;\n\t\tthis.method = method;\n\t\tthis.description = description;\n\t\tthis.tags = tags;\n\t\tthis.status = status;\n\t\tthis.responseType = responseType ?? 'application/json';\n\t\tthis.endpointFn = fn;\n\t\tif (telemetry) this.telemetry = telemetry;\n\n\t\tif (getSession) {\n\t\t\tthis.hasSession = true;\n\t\t\t// `auth` is added here, once, rather than by each adaptor: every\n\t\t\t// adaptor calls this, so every one of them hands a session callback\n\t\t\t// the surface's authenticator bound to the request it is handling.\n\t\t\tthis.getSession = (ctx) =>\n\t\t\t\tgetSession({ ...ctx, auth: sessionAuth(surface, ctx.header) });\n\t\t}\n\n\t\tif (authorize) {\n\t\t\tthis.authorize = authorize;\n\t\t}\n\n\t\tif (rateLimit) {\n\t\t\tthis.rateLimit = rateLimit;\n\t\t}\n\n\t\tif (authorizer) {\n\t\t\tthis.authorizer = authorizer;\n\t\t}\n\n\t\tthis.surface = surface;\n\n\t\tif (actorExtractor) {\n\t\t\tthis.actorExtractor = actorExtractor;\n\t\t}\n\n\t\tif (audits) {\n\t\t\tthis.audits = audits;\n\t\t}\n\n\t\tif (databaseService) {\n\t\t\tthis.databaseService = databaseService;\n\t\t}\n\n\t\tif (rlsConfig) {\n\t\t\tthis.rlsConfig = rlsConfig;\n\t\t}\n\n\t\tif (rlsBypass) {\n\t\t\tthis.rlsBypass = rlsBypass;\n\t\t}\n\t}\n}\n\n/**\n * Defines the input schema structure for an endpoint.\n *\n * @template TBody - Schema for request body validation\n * @template TSearch - Schema for query string validation\n * @template TParams - Schema for URL path parameters validation\n *\n * @example\n * ```typescript\n * type UserInput = EndpointInput<\n * typeof createUserBodySchema,\n * typeof userQuerySchema,\n * typeof userParamsSchema\n * >;\n * ```\n */\nexport type EndpointInput<\n\tTBody extends StandardSchemaV1 | undefined = undefined,\n\tTSearch extends StandardSchemaV1 | undefined = undefined,\n\tTParams extends StandardSchemaV1 | undefined = undefined,\n> = RemoveUndefined<{\n\tbody: TBody;\n\tsearch: TSearch;\n\tparams: TParams;\n}>;\n\n/**\n * The surface an endpoint was built from.\n *\n * An endpoint created with `api.get('/users')` knows which API serves it, and\n * through that, the two things every handler needs and no handler should have\n * to name: the process's logger and its environment parser.\n *\n * This is what makes the generated code smaller than the thing it replaced. A\n * handler used to be wired by an import the build wrote for it —\n * `import { envParser } from '../../config/env'` — which meant the parser had\n * to be named in config as a module path, because a generator can print a\n * specifier and cannot print an object. Built from the surface, the endpoint\n * already carries it, so there is nothing to name and nothing to print.\n *\n * `id` is the surface's construct id, which is how the build attributes a route\n * to the API that serves it rather than guessing by exclusion.\n */\nexport interface EndpointSurface {\n\t/** The surface's construct id — `Api`, `Auth`. */\n\tid: string;\n\t/**\n\t * The environment parser every handler on this surface runs with.\n\t *\n\t * A value the surface holds, never a place to do work: constructs are\n\t * imported by discovery before any URL exists, so a parser that reads a\n\t * file or throws on a missing variable would do it at build time.\n\t */\n\tenvParser: EnvironmentParser<{}>;\n\t/**\n\t * What authenticates requests to this surface — the construct named in\n\t * `RestApi.auth()`, which session callbacks read from as `auth`.\n\t */\n\tauth?: Authenticator;\n}\n\n/**\n * Configuration options for creating an Endpoint instance.\n *\n * @template TRoute - The route path string\n * @template TMethod - The HTTP method\n * @template TInput - Input schema definitions\n * @template TOutput - Output schema definition\n * @template TServices - Service dependencies array\n * @template TLogger - Logger type\n * @template TSession - Session data type\n */\nexport interface EndpointOptions<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutput extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> {\n\t/** The route path with parameter placeholders */\n\troute: TRoute;\n\t/** The HTTP method for this endpoint */\n\tmethod: TMethod;\n\t/** The handler function that implements the endpoint logic */\n\tfn: EndpointHandler<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tTOutput,\n\t\tTSession,\n\t\tTDatabase,\n\t\tTAuditStorage,\n\t\tTAuditAction\n\t>;\n\t/** Optional authorization check function */\n\tauthorize:\n\t\t| AuthorizeFn<TServices, TLogger, TSession, TInput, TDatabase>\n\t\t| undefined;\n\t/** Optional description for documentation */\n\tdescription: string | undefined;\n\t/** Optional tags for OpenAPI documentation */\n\ttags?: string[];\n\t/** Optional execution timeout in milliseconds */\n\ttimeout: number | undefined;\n\t/** Optional memory size in MB for serverless deployments */\n\tmemorySize: number | undefined;\n\t/** Input validation schemas */\n\tinput: TInput | undefined;\n\t/** Output validation schema */\n\toutput: TOutput | undefined;\n\t/** Service dependencies to inject */\n\tservices: TServices;\n\t/**\n\t * The ids of the constructs `.dependsOn()` named.\n\t *\n\t * The same edges as `services`, kept in the form the manifest records rather\n\t * than the form the handler runs with.\n\t */\n\tconstructs?: string[];\n\t/** Logger instance */\n\tlogger: TLogger;\n\t/** Optional session extraction function */\n\tgetSession: SessionFn<TServices, TLogger, TSession, TDatabase> | undefined;\n\t/** Optional rate limiting configuration */\n\trateLimit?: RateLimitConfig;\n\t/** Success HTTP status code */\n\tstatus: EndpointStatus | undefined;\n\t/** What it publishes once its handler succeeds, each to its own topic. */\n\tevents?: TopicEvent[];\n\t/** Optional authorizer configuration */\n\tauthorizer?: Authorizer;\n\t/** The surface this endpoint was built from. Every endpoint has one. */\n\tsurface: EndpointSurface;\n\t/**\n\t * Auditor storage service for persisting audit records from this endpoint\n\t */\n\tauditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>;\n\t/** Optional actor extractor function for audit records */\n\tactorExtractor?: ActorExtractor<TServices, TSession, TLogger>;\n\t/** Declarative audit definitions */\n\taudits?: MappedAudit<TAuditAction, OutSchema>[];\n\t/** Database service for this endpoint */\n\tdatabaseService?: Service<TDatabaseServiceName, TDatabase>;\n\t/** RLS configuration for this endpoint */\n\trlsConfig?: RlsConfig<TServices, TSession, TLogger>;\n\t/** Whether to bypass RLS for this endpoint */\n\trlsBypass?: boolean;\n\t/**\n\t * Response content type (e.g. `'application/json'`, `'text/html'`).\n\t * Defaults to `'application/json'` when omitted.\n\t */\n\tresponseType?: string;\n\t/** This route's telemetry — `.telemetry({ ignore, attributes })`. */\n\ttelemetry?: EndpointTelemetry;\n}\n\n/**\n * Defines the possible input schema types for an endpoint.\n * Each property represents a different part of the HTTP request.\n */\nexport type EndpointSchemas = Partial<{\n\t/** Schema for URL path parameters (e.g., /users/:id) */\n\tparams: StandardSchemaV1;\n\t/** Schema for query string parameters */\n\tquery: StandardSchemaV1;\n\t/** Schema for request body (POST, PUT, PATCH) */\n\tbody: StandardSchemaV1;\n}>;\n\nexport type AuthorizeContext<\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTInput extends EndpointSchemas | undefined = undefined,\n\tTDatabase = undefined,\n> = {\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n\theader: HeaderFn;\n\tcookie: CookieFn;\n\tsession: TSession;\n} & InferComposableStandardSchema<TInput> &\n\tSessionDatabaseContext<TDatabase>;\n/**\n * Function type for endpoint authorization checks.\n *\n * @template TServices - Available service dependencies\n * @template TLogger - Logger type\n * @template TSession - Session data type\n *\n * @param ctx - Context containing services, logger, headers, and session\n * @returns Boolean indicating if the request is authorized\n *\n * @example\n * ```typescript\n * const authorize: AuthorizeFn = ({ session }) => {\n * return session.userId !== undefined;\n * };\n * ```\n */\nexport type AuthorizeFn<\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTInput extends EndpointSchemas | undefined = undefined,\n\tTDatabase = undefined,\n> = (\n\tctx: AuthorizeContext<TServices, TLogger, TSession, TInput, TDatabase>,\n) => Promise<boolean> | boolean;\n\n/**\n * Base session context without database\n */\ntype BaseSessionContext<\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n> = {\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n\theader: HeaderFn;\n\tcookie: CookieFn;\n\t/**\n\t * The surface's authenticator — the construct named in `.auth()` — bound to\n\t * this request: `await auth.getSession()` is this request's session, or\n\t * `null`.\n\t */\n\tauth: SessionAuth;\n};\n\n/**\n * Conditional database context for session - only present when database service is configured\n */\ntype SessionDatabaseContext<TDatabase = undefined> = TDatabase extends undefined\n\t? {}\n\t: {\n\t\t\t/**\n\t\t\t * Database instance for session extraction.\n\t\t\t * Available when a database service is configured via `.database()`.\n\t\t\t * Useful for looking up user data from the database based on auth tokens.\n\t\t\t */\n\t\t\tdb: TDatabase;\n\t\t};\n\nexport type SessionContext<\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n> = BaseSessionContext<TServices, TLogger> & SessionDatabaseContext<TDatabase>;\n/**\n * Function type for extracting session data from a request.\n *\n * @template TServices - Available service dependencies\n * @template TLogger - Logger type\n * @template TSession - Session data type to extract\n * @template TDatabase - Database type (when database service is configured)\n *\n * @param ctx - Context containing services, logger, headers, and optionally database\n * @returns The extracted session data\n *\n * @example\n * ```typescript\n * // Without database\n * const getSession: SessionFn<Services, Logger, UserSession> = async ({ header, services }) => {\n * const token = header('authorization');\n * return await services.auth.verifyToken(token);\n * };\n *\n * // With database\n * const getSession: SessionFn<Services, Logger, UserSession, Database> = async ({ header, db }) => {\n * const token = header('authorization');\n * const user = await db.selectFrom('users').where('token', '=', token).executeTakeFirst();\n * return { userId: user?.id };\n * };\n * ```\n */\nexport type SessionFn<\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTDatabase = undefined,\n> = (\n\tctx: SessionContext<TServices, TLogger, TDatabase>,\n) => Promise<TSession> | TSession;\n\n/**\n * Utility type that converts Express-style route parameters to OpenAPI format.\n * Transforms ':param' syntax to '{param}' syntax.\n *\n * @template T - The route string to convert\n *\n * @example\n * ```typescript\n * type Route1 = ConvertRouteParams<'/users/:id'>; // '/users/{id}'\n * type Route2 = ConvertRouteParams<'/users/:userId/posts/:postId'>; // '/users/{userId}/posts/{postId}'\n * ```\n */\nexport type ConvertRouteParams<T extends string> =\n\tT extends `${infer Start}:${infer Param}/${infer Rest}`\n\t\t? `${Start}{${Param}}/${ConvertRouteParams<Rest>}`\n\t\t: T extends `${infer Start}:${infer Param}`\n\t\t\t? `${Start}{${Param}}`\n\t\t\t: T;\n\n/**\n * Type representing the OpenAPI schema structure for an endpoint.\n *\n * @template TRoute - The route path\n * @template TMethod - The HTTP method\n *\n * @example\n * ```typescript\n * type Schema = EndpointOpenApiSchema<'/users/:id', 'GET'>;\n * // Results in: { '/users/{id}': { get: OperationObject, parameters?: ParameterObject[] } }\n * ```\n */\nexport type EndpointOpenApiSchema<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n> = {\n\t[key in ConvertRouteParams<TRoute>]: {\n\t\t[key in LowerHttpMethod<TMethod>]: OpenAPIV3_1.OperationObject<{}>;\n\t} & {\n\t\tparameters?: OpenAPIV3_1.ParameterObject[];\n\t};\n};\n\nexport type SingleHeaderFn = (key: string) => string | undefined;\nexport type MultiHeaderFn = () => EndpointHeaders;\n/**\n * Type representing HTTP headers as a Map.\n */\nexport type EndpointHeaders = Map<string, string>;\n\n/**\n * Function type for retrieving HTTP header values.\n * Supports two calling patterns:\n * - `header(key)` - Get a single header value (case-insensitive)\n * - `header()` - Get all headers as a plain object\n *\n * @example\n * ```typescript\n * // Get single header\n * const contentType = header('content-type');\n *\n * // Get all headers\n * const allHeaders = header();\n * // { 'content-type': 'application/json', 'host': 'example.com', ... }\n * ```\n */\nexport interface HeaderFn {\n\t(): Record<string, string>;\n\t(key: string): string | undefined;\n}\n\n/**\n * Function type for retrieving cookie values.\n * Supports two calling patterns:\n * - `cookie(name)` - Get a single cookie value\n * - `cookie()` - Get all cookies as a plain object\n *\n * @example\n * ```typescript\n * // Get single cookie\n * const sessionId = cookie('session');\n *\n * // Get all cookies\n * const allCookies = cookie();\n * // { session: 'abc123', theme: 'dark', ... }\n * ```\n */\nexport interface CookieFn {\n\t(): Record<string, string>;\n\t(name: string): string | undefined;\n}\n\n/**\n * Cookie options matching standard Set-Cookie attributes\n */\nexport interface CookieOptions {\n\tdomain?: string;\n\tpath?: string;\n\texpires?: Date;\n\tmaxAge?: number;\n\thttpOnly?: boolean;\n\tsecure?: boolean;\n\tsameSite?: 'strict' | 'lax' | 'none';\n}\n\n/**\n * Response metadata that handlers can set\n */\nexport interface ResponseMetadata {\n\theaders?: Record<string, string>;\n\tcookies?: Map<string, { value: string; options?: CookieOptions }>;\n\tstatus?: EndpointStatus;\n}\n\n/**\n * Return type for handlers that want to set response metadata\n */\nexport interface ResponseWithMetadata<T> {\n\tdata: T;\n\tmetadata: ResponseMetadata;\n}\n\n/**\n * Response builder for fluent API in handlers\n */\nexport class ResponseBuilder {\n\tprivate metadata: ResponseMetadata = {\n\t\theaders: {},\n\t\tcookies: new Map(),\n\t};\n\n\theader(key: string, value: string): this {\n\t\tthis.metadata.headers![key] = value;\n\t\treturn this;\n\t}\n\n\tcookie(name: string, value: string, options?: CookieOptions): this {\n\t\tthis.metadata.cookies?.set(name, { value, options });\n\t\treturn this;\n\t}\n\n\tdeleteCookie(\n\t\tname: string,\n\t\toptions?: Pick<CookieOptions, 'domain' | 'path'>,\n\t): this {\n\t\tthis.metadata.cookies?.set(name, {\n\t\t\tvalue: '',\n\t\t\toptions: { ...options, maxAge: 0, expires: new Date(0) },\n\t\t});\n\t\treturn this;\n\t}\n\n\tstatus(code: EndpointStatus): this {\n\t\tthis.metadata.status = code;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Send the client to `url` — `Location` and a 3xx, with no body. 303 by\n\t * default: after a form post, the browser follows it with a GET, so a\n\t * reload does not post the form again.\n\t *\n\t * A redirect is not checked against the endpoint's `.output()` schema, so\n\t * an endpoint that renders a page can redirect instead.\n\t *\n\t * @example\n\t * ```typescript\n\t * return response.cookie('session', token).redirect('/dashboard');\n\t * ```\n\t */\n\tredirect(\n\t\turl: string,\n\t\tstatus: RedirectStatus = RedirectStatus.SeeOther,\n\t): ResponseWithMetadata<never> {\n\t\tthis.metadata.headers!.location = url;\n\t\tthis.metadata.status = status;\n\t\treturn { data: undefined as never, metadata: this.metadata };\n\t}\n\n\tsend<T>(data: T): ResponseWithMetadata<T> {\n\t\treturn { data, metadata: this.metadata };\n\t}\n\n\tgetMetadata(): ResponseMetadata {\n\t\treturn this.metadata;\n\t}\n}\n\n/**\n * Base context properties that are always available\n */\ntype BaseEndpointContext<\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n> = {\n\t/** Injected service instances */\n\tservices: ServiceRecord<TServices>;\n\t/** Logger instance for this request */\n\tlogger: TLogger;\n\t/** Function to retrieve request headers */\n\theader: HeaderFn;\n\t/** Function to retrieve request cookies */\n\tcookie: CookieFn;\n\t/** Session data extracted by getSession */\n\tsession: TSession;\n};\n\n/**\n * Conditional auditor context - only present when audit storage is configured\n */\ntype AuditorContext<\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTAuditStorage = undefined,\n> = TAuditStorage extends undefined\n\t? {}\n\t: {\n\t\t\t/**\n\t\t\t * Auditor instance for recording audit events.\n\t\t\t * Only present when audit storage is configured on the endpoint.\n\t\t\t * When a transactional database is used for audit storage,\n\t\t\t * the auditor is pre-configured with the transaction context.\n\t\t\t */\n\t\t\tauditor: Auditor<TAuditAction>;\n\t\t};\n\n/**\n * Conditional database context - only present when database service is configured\n */\ntype DatabaseContext<TDatabase = undefined> = TDatabase extends undefined\n\t? {}\n\t: {\n\t\t\t/**\n\t\t\t * Database instance for this request.\n\t\t\t * When audit storage is configured and uses the same database,\n\t\t\t * this will be the transaction for ACID compliance.\n\t\t\t * Otherwise, it's the raw database connection.\n\t\t\t */\n\t\t\tdb: TDatabase;\n\t\t};\n\n/**\n * The execution context provided to endpoint handlers.\n * Contains all parsed input data, services, logger, headers, cookies, and session.\n *\n * @template Input - The input schemas (body, query, params)\n * @template TServices - Available service dependencies\n * @template TLogger - Logger type\n * @template TSession - Session data type\n * @template TAuditAction - Audit action types (when auditor is configured)\n * @template TDatabase - Database type (when database service is configured)\n * @template TAuditStorage - Audit storage type (determines if auditor is present)\n */\nexport type EndpointContext<\n\tInput extends EndpointSchemas | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTDatabase = undefined,\n\tTAuditStorage = undefined,\n> = BaseEndpointContext<TServices, TLogger, TSession> &\n\tInferComposableStandardSchema<Input> &\n\tAuditorContext<TAuditAction, TAuditStorage> &\n\tDatabaseContext<TDatabase>;\n\n/**\n * Handler function type for endpoint implementations.\n *\n * @template TInput - Input schemas for validation\n * @template TServices - Available service dependencies\n * @template TLogger - Logger type\n * @template OutSchema - Output schema for response validation\n * @template TSession - Session data type\n *\n * @param ctx - The endpoint execution context\n * @param response - Response builder for setting cookies, headers, and status\n * @returns The response data (validated if OutSchema is provided) or ResponseWithMetadata\n *\n * @example\n * ```typescript\n * // Simple response\n * const handler: EndpointHandler<Input, [UserService], Logger, UserSchema> =\n * async ({ params, services }) => {\n * return await services.users.findById(params.id);\n * };\n *\n * // With response builder\n * const handler: EndpointHandler<Input, [UserService], Logger, UserSchema> =\n * async ({ params, services }, response) => {\n * const user = await services.users.findById(params.id);\n * return response.header('X-User-Id', user.id).send(user);\n * };\n * ```\n */\nexport type EndpointHandler<\n\tTInput extends EndpointSchemas | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTSession = unknown,\n\tTDatabase = undefined,\n\tTAuditStorage = undefined,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n> = (\n\tctx: EndpointContext<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tTAuditAction,\n\t\tTDatabase,\n\t\tTAuditStorage\n\t>,\n\tresponse: ResponseBuilder,\n) => OutSchema extends StandardSchemaV1\n\t? // The handler must produce the schema's INPUT type — the output\n\t\t// schema is allowed to coerce it (e.g. a `Date` → ISO `string`),\n\t\t// so the handler may return the looser input while consumers\n\t\t// (EndpointOutput / the generated client) still see the parsed\n\t\t// output type.\n\t\t// A handler that sometimes redirects returns either from one\n\t\t// promise, so the promise may hold either.\n\t\t\t| InferStandardSchemaInput<OutSchema>\n\t\t\t| ResponseWithMetadata<InferStandardSchemaInput<OutSchema>>\n\t\t\t| Promise<\n\t\t\t\t\t| InferStandardSchemaInput<OutSchema>\n\t\t\t\t\t| ResponseWithMetadata<InferStandardSchemaInput<OutSchema>>\n\t\t\t >\n\t:\n\t\t\t| unknown\n\t\t\t| ResponseWithMetadata<unknown>\n\t\t\t| Promise<unknown>\n\t\t\t| Promise<ResponseWithMetadata<unknown>>;\n\n/**\n * HTTP success status codes that can be returned by endpoints.\n */\nexport enum SuccessStatus {\n\t/** Standard response for successful HTTP requests */\n\tOK = 200,\n\t/** Request has been fulfilled and resulted in a new resource being created */\n\tCreated = 201,\n\t/** Request has been accepted for processing, but processing is not complete */\n\tAccepted = 202,\n\t/** Server successfully processed the request but is not returning any content */\n\tNoContent = 204,\n\t/** Server successfully processed the request and is not returning any content, client should reset the document view */\n\tResetContent = 205,\n\t/** Server is delivering only part of the resource due to a range header */\n\tPartialContent = 206,\n}\n\n/**\n * HTTP redirect status codes an endpoint can answer with —\n * `response.redirect(url, status)`, or `.status()` with a `Location` header.\n */\nexport enum RedirectStatus {\n\t/** The resource has moved for good; a POST may become a GET */\n\tMovedPermanently = 301,\n\t/** The resource is elsewhere for now; a POST may become a GET */\n\tFound = 302,\n\t/** See the resource elsewhere, with a GET — the answer to a form post */\n\tSeeOther = 303,\n\t/** The resource is elsewhere for now; the method and body are kept */\n\tTemporaryRedirect = 307,\n\t/** The resource has moved for good; the method and body are kept */\n\tPermanentRedirect = 308,\n}\n\n/** A status an endpoint answers with when its handler succeeds. */\nexport type EndpointStatus = SuccessStatus | RedirectStatus;\n\nexport type EndpointOutput<T> =\n\tT extends Endpoint<any, any, any, infer OutSchema, any, any, any, any>\n\t\t? InferStandardSchema<OutSchema>\n\t\t: never;\n"],"mappings":"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"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { o as __toESM } from "./Construct-
|
|
2
|
-
import { idsOf, serviceOf, servicesOf } from "./construct-interface.mjs";
|
|
3
|
-
import {
|
|
1
|
+
import { o as __toESM } from "./Construct-CGuc_Ijk.mjs";
|
|
2
|
+
import { idsOf, isConsumable, serviceOf, servicesOf } from "./construct-interface.mjs";
|
|
3
|
+
import { o as require_lodash_uniqby, r as BaseFunctionBuilder } from "./functions-BvIDQKAA.mjs";
|
|
4
4
|
import { t as cloneWith } from "./clone-EKNovYHu.mjs";
|
|
5
|
-
import { t as Endpoint } from "./Endpoint-
|
|
5
|
+
import { t as Endpoint } from "./Endpoint-sUOU7uLx.mjs";
|
|
6
6
|
import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
|
|
7
|
+
import { HttpError } from "@geekmidas/errors";
|
|
7
8
|
//#region src/endpoints/Authorizer.ts
|
|
8
9
|
/**
|
|
9
10
|
* Built-in security schemes available by default.
|
|
@@ -75,6 +76,165 @@ var import_lodash_uniqby = /* @__PURE__ */ __toESM(require_lodash_uniqby(), 1);
|
|
|
75
76
|
*/
|
|
76
77
|
const RLS_BYPASS = Symbol.for("geekmidas.rls.bypass");
|
|
77
78
|
//#endregion
|
|
79
|
+
//#region src/endpoints/upload.ts
|
|
80
|
+
/**
|
|
81
|
+
* Direct uploads: an endpoint that hands the browser a signed form, so the
|
|
82
|
+
* file goes straight to the bucket and never through the server.
|
|
83
|
+
*
|
|
84
|
+
* The endpoint decides *where* — the key, from the session and the body — and
|
|
85
|
+
* the form's policy decides *what*: the storage itself refuses a file larger
|
|
86
|
+
* than `maxSize`, or of a type `accept` does not allow. Nothing the client
|
|
87
|
+
* sends after this request is trusted to the server that issued it. That the
|
|
88
|
+
* upload finished arrives as the bucket's `object.created` event.
|
|
89
|
+
*/
|
|
90
|
+
/** The longest a signature may be valid for: S3's limit, seven days. */
|
|
91
|
+
const MAX_EXPIRES_IN = 604800;
|
|
92
|
+
/** A media type, or a whole top-level type: `image/png`, `image/*`. */
|
|
93
|
+
const MEDIA_TYPE = /^[a-z0-9][a-z0-9!#$&^_.+-]*\/(\*|[a-z0-9][a-z0-9!#$&^_.+-]*)$/i;
|
|
94
|
+
/** An upload's `maxSize` that is not a positive whole number of bytes. */
|
|
95
|
+
var UploadMaxSizeInvalid = class extends Error {
|
|
96
|
+
maxSize;
|
|
97
|
+
constructor(maxSize) {
|
|
98
|
+
super(`An upload's maxSize is ${maxSize}, and it has to be a positive whole number of bytes — 5 * 1024 * 1024 for 5 MiB.`);
|
|
99
|
+
this.maxSize = maxSize;
|
|
100
|
+
this.name = "UploadMaxSizeInvalid";
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
/** An upload's `expiresIn` outside what a signature can be valid for. */
|
|
104
|
+
var UploadExpiryInvalid = class extends Error {
|
|
105
|
+
expiresIn;
|
|
106
|
+
constructor(expiresIn) {
|
|
107
|
+
super(`An upload's expiresIn is ${expiresIn}, and it has to be a whole number of seconds from 1 to ${MAX_EXPIRES_IN} (seven days, the longest S3 signs for). The default, 300, is usually right.`);
|
|
108
|
+
this.expiresIn = expiresIn;
|
|
109
|
+
this.name = "UploadExpiryInvalid";
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
/** An entry in `accept` that is not a media type. */
|
|
113
|
+
var UploadAcceptInvalid = class extends Error {
|
|
114
|
+
entry;
|
|
115
|
+
constructor(entry) {
|
|
116
|
+
super(`'${entry}' in an upload's accept is not a media type. Name one ('image/png') or a whole type ('image/*').`);
|
|
117
|
+
this.entry = entry;
|
|
118
|
+
this.name = "UploadAcceptInvalid";
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
/** Several accepted types, and nothing saying which one an upload is. */
|
|
122
|
+
var UploadContentTypeUnresolved = class extends Error {
|
|
123
|
+
accept;
|
|
124
|
+
constructor(accept) {
|
|
125
|
+
super(`An upload accepts ${accept.join(", ")}, and a signed form can fix only one type. Add contentType: ({ body }) => body.contentType, with the body naming which of them this file is.`);
|
|
126
|
+
this.accept = accept;
|
|
127
|
+
this.name = "UploadContentTypeUnresolved";
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
/** A request for an upload of a type the endpoint does not accept. */
|
|
131
|
+
var UploadContentTypeRefused = class extends HttpError {
|
|
132
|
+
contentType;
|
|
133
|
+
accept;
|
|
134
|
+
constructor(contentType, accept) {
|
|
135
|
+
super(415, `'${contentType}' is not accepted here. Upload one of: ${accept.join(", ")}.`, { details: {
|
|
136
|
+
contentType,
|
|
137
|
+
accept
|
|
138
|
+
} });
|
|
139
|
+
this.contentType = contentType;
|
|
140
|
+
this.accept = accept;
|
|
141
|
+
this.name = "UploadContentTypeRefused";
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Check an upload's options when the endpoint is built, so a mistake fails at
|
|
146
|
+
* startup rather than on the first request.
|
|
147
|
+
*/
|
|
148
|
+
function checkUploadOptions(options) {
|
|
149
|
+
if (!Number.isInteger(options.maxSize) || options.maxSize <= 0) throw new UploadMaxSizeInvalid(options.maxSize);
|
|
150
|
+
const { expiresIn } = options;
|
|
151
|
+
if (expiresIn !== void 0 && (!Number.isInteger(expiresIn) || expiresIn < 1 || expiresIn > MAX_EXPIRES_IN)) throw new UploadExpiryInvalid(expiresIn);
|
|
152
|
+
for (const entry of options.accept ?? []) if (!MEDIA_TYPE.test(entry)) throw new UploadAcceptInvalid(entry);
|
|
153
|
+
if ((options.accept?.length ?? 0) > 1 && !options.contentType) throw new UploadContentTypeUnresolved(options.accept);
|
|
154
|
+
}
|
|
155
|
+
/** Whether `type` is one `accept` allows — exactly, or under a `type/*`. */
|
|
156
|
+
function accepts(accept, type) {
|
|
157
|
+
const wanted = type.toLowerCase();
|
|
158
|
+
return accept.some((entry) => {
|
|
159
|
+
const allowed = entry.toLowerCase();
|
|
160
|
+
return allowed.endsWith("/*") ? wanted.startsWith(allowed.slice(0, -1)) : allowed === wanted;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The signed form for one request: the key and type resolved from the
|
|
165
|
+
* handler's context, and the policy the storage enforces.
|
|
166
|
+
*
|
|
167
|
+
* @throws {UploadContentTypeRefused} when the resolved type is not accepted
|
|
168
|
+
*/
|
|
169
|
+
async function issueUpload(storage, ctx, options) {
|
|
170
|
+
const key = await options.key(ctx);
|
|
171
|
+
const accept = options.accept ?? [];
|
|
172
|
+
const resolved = options.contentType ? await options.contentType(ctx) : void 0;
|
|
173
|
+
let contentType;
|
|
174
|
+
if (resolved !== void 0) {
|
|
175
|
+
if (accept.length > 0 && !accepts(accept, resolved)) throw new UploadContentTypeRefused(resolved, accept);
|
|
176
|
+
contentType = resolved;
|
|
177
|
+
} else if (accept.length === 1) {
|
|
178
|
+
const only = accept[0];
|
|
179
|
+
contentType = only.endsWith("/*") ? { startsWith: only.slice(0, -1) } : only;
|
|
180
|
+
}
|
|
181
|
+
return storage.getUploadPost({
|
|
182
|
+
key,
|
|
183
|
+
maxSize: options.maxSize,
|
|
184
|
+
...contentType ? { contentType } : {},
|
|
185
|
+
...options.expiresIn !== void 0 ? { expiresIn: options.expiresIn } : {}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/** The JSON Schema of an {@link UploadPost}, for the endpoint's OpenAPI. */
|
|
189
|
+
const UPLOAD_POST_JSON_SCHEMA = {
|
|
190
|
+
type: "object",
|
|
191
|
+
properties: {
|
|
192
|
+
url: {
|
|
193
|
+
type: "string",
|
|
194
|
+
format: "uri"
|
|
195
|
+
},
|
|
196
|
+
fields: {
|
|
197
|
+
type: "object",
|
|
198
|
+
additionalProperties: { type: "string" }
|
|
199
|
+
},
|
|
200
|
+
key: { type: "string" },
|
|
201
|
+
expiresAt: {
|
|
202
|
+
type: "string",
|
|
203
|
+
format: "date-time"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
required: [
|
|
207
|
+
"url",
|
|
208
|
+
"fields",
|
|
209
|
+
"key",
|
|
210
|
+
"expiresAt"
|
|
211
|
+
],
|
|
212
|
+
additionalProperties: false
|
|
213
|
+
};
|
|
214
|
+
/** Whether `value` is an {@link UploadPost}. */
|
|
215
|
+
function isUploadPost(value) {
|
|
216
|
+
if (!value || typeof value !== "object") return false;
|
|
217
|
+
const { url, fields, key, expiresAt } = value;
|
|
218
|
+
return typeof url === "string" && typeof key === "string" && typeof expiresAt === "string" && !!fields && typeof fields === "object" && Object.values(fields).every((field) => typeof field === "string");
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* An upload endpoint's output, when it declares none of its own: the signed
|
|
222
|
+
* form, as the handler is given it.
|
|
223
|
+
*
|
|
224
|
+
* Written by hand rather than with a schema library, so the endpoint runtime
|
|
225
|
+
* imports none — the Standard Schema and Standard JSON Schema interfaces are
|
|
226
|
+
* the whole of what validation and OpenAPI need.
|
|
227
|
+
*/
|
|
228
|
+
const UPLOAD_POST_SCHEMA = { "~standard": {
|
|
229
|
+
version: 1,
|
|
230
|
+
vendor: "geekmidas",
|
|
231
|
+
validate: (value) => isUploadPost(value) ? { value } : { issues: [{ message: "Expected an upload form" }] },
|
|
232
|
+
jsonSchema: {
|
|
233
|
+
input: () => structuredClone(UPLOAD_POST_JSON_SCHEMA),
|
|
234
|
+
output: () => structuredClone(UPLOAD_POST_JSON_SCHEMA)
|
|
235
|
+
}
|
|
236
|
+
} };
|
|
237
|
+
//#endregion
|
|
78
238
|
//#region src/endpoints/EndpointBuilder.ts
|
|
79
239
|
var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
80
240
|
route;
|
|
@@ -85,7 +245,8 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
85
245
|
_tags;
|
|
86
246
|
_memorySize;
|
|
87
247
|
_responseType = "application/json";
|
|
88
|
-
|
|
248
|
+
/** Set by a factory's `.session()`; absent, the endpoint reads none. */
|
|
249
|
+
_getSession;
|
|
89
250
|
_authorize = () => true;
|
|
90
251
|
_rateLimit;
|
|
91
252
|
_availableAuthorizers = [];
|
|
@@ -102,14 +263,12 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
102
263
|
_customSecuritySchemes = {};
|
|
103
264
|
_rlsConfig;
|
|
104
265
|
_rlsBypass;
|
|
266
|
+
_telemetry;
|
|
105
267
|
constructor(route, method) {
|
|
106
268
|
super("dev.geekmidas.function.endpoint");
|
|
107
269
|
this.route = route;
|
|
108
270
|
this.method = method;
|
|
109
271
|
}
|
|
110
|
-
_setPublisher(publisher) {
|
|
111
|
-
this._publisher = publisher;
|
|
112
|
-
}
|
|
113
272
|
_setAuditorStorage(storage) {
|
|
114
273
|
this._auditorStorage = storage;
|
|
115
274
|
}
|
|
@@ -119,11 +278,31 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
119
278
|
description(description) {
|
|
120
279
|
return cloneWith(this, { _description: description });
|
|
121
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* The status a successful request is answered with — a 2xx, or a 3xx for
|
|
283
|
+
* an endpoint that always redirects (with a `Location` header). One that
|
|
284
|
+
* sometimes redirects returns `response.redirect(url)` instead.
|
|
285
|
+
*/
|
|
122
286
|
status(status) {
|
|
123
287
|
return cloneWith(this, { _status: status });
|
|
124
288
|
}
|
|
125
|
-
|
|
126
|
-
|
|
289
|
+
/**
|
|
290
|
+
* Publish `event` to `topic` once the handler has succeeded — repeatable,
|
|
291
|
+
* one call per event, to as many topics as the endpoint names. The topic
|
|
292
|
+
* becomes a dependency as with `.dependsOn([topic])`, so `services.<topic>`
|
|
293
|
+
* is there for events the handler decides on itself.
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```ts
|
|
297
|
+
* router.post('/users')
|
|
298
|
+
* .event(users, {
|
|
299
|
+
* type: 'user.created',
|
|
300
|
+
* payload: (user) => ({ userId: user.id, email: user.email }),
|
|
301
|
+
* })
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
event(topic, event) {
|
|
305
|
+
return this.withEvent(topic, event);
|
|
127
306
|
}
|
|
128
307
|
tags(tags) {
|
|
129
308
|
return cloneWith(this, { _tags: tags });
|
|
@@ -132,6 +311,19 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
132
311
|
return cloneWith(this, { _memorySize: memorySize });
|
|
133
312
|
}
|
|
134
313
|
/**
|
|
314
|
+
* This route's telemetry, beside what its surface's `Telemetry` says for
|
|
315
|
+
* every route: `{ ignore: true }` records no span for it — a health check,
|
|
316
|
+
* a probe — and `attributes` are set on its request span.
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* ```ts
|
|
320
|
+
* router.get('/health').telemetry({ ignore: true }).handle(() => 'ok');
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
telemetry(options) {
|
|
324
|
+
return cloneWith(this, { _telemetry: { ...options } });
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
135
327
|
* Set the response content type for this endpoint.
|
|
136
328
|
*
|
|
137
329
|
* Defaults to `'application/json'`. When set to any other value
|
|
@@ -152,9 +344,6 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
152
344
|
responseType(type) {
|
|
153
345
|
return cloneWith(this, { _responseType: type });
|
|
154
346
|
}
|
|
155
|
-
publisher(publisher) {
|
|
156
|
-
return cloneWith(this, { _publisher: publisher });
|
|
157
|
-
}
|
|
158
347
|
body(schema) {
|
|
159
348
|
this.schemas.body = schema;
|
|
160
349
|
return this;
|
|
@@ -202,6 +391,46 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
202
391
|
_constructs: idsOf(constructs, this._constructs)
|
|
203
392
|
});
|
|
204
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Hand the browser a signed form that uploads one file straight to
|
|
396
|
+
* `bucket` — the file never passes through this server.
|
|
397
|
+
*
|
|
398
|
+
* The endpoint decides where (`key`, from what the handler is given) and
|
|
399
|
+
* the form's policy decides what: the storage refuses a file over
|
|
400
|
+
* `maxSize`, or of a type `accept` does not allow. The handler receives
|
|
401
|
+
* the form as `upload`, and returns it unless it has more to say — it is
|
|
402
|
+
* the endpoint's output when no `.output()` came first. The bucket
|
|
403
|
+
* becomes a dependency, as with `.dependsOn([bucket])`.
|
|
404
|
+
*
|
|
405
|
+
* The last step before `.handle()`: the key is resolved from the body,
|
|
406
|
+
* params and session, so they are declared first.
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```ts
|
|
410
|
+
* router
|
|
411
|
+
* .post('/me/avatar')
|
|
412
|
+
* .upload(uploads, {
|
|
413
|
+
* key: ({ session }) => `avatars/${session.userId}.png`,
|
|
414
|
+
* maxSize: 5 * 1024 * 1024,
|
|
415
|
+
* accept: ['image/png'],
|
|
416
|
+
* })
|
|
417
|
+
* .handle(async ({ upload }) => upload);
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
upload(bucket, options) {
|
|
421
|
+
checkUploadOptions(options);
|
|
422
|
+
const [service] = servicesOf([bucket]);
|
|
423
|
+
const next = Object.create(UploadEndpointBuilder.prototype);
|
|
424
|
+
return Object.assign(next, this, {
|
|
425
|
+
_services: (0, import_lodash_uniqby.default)([...this._services, service], (s) => s.serviceName),
|
|
426
|
+
_constructs: idsOf([bucket], this._constructs),
|
|
427
|
+
outputSchema: this.outputSchema ?? UPLOAD_POST_SCHEMA,
|
|
428
|
+
_upload: {
|
|
429
|
+
serviceName: service.serviceName,
|
|
430
|
+
options
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
}
|
|
205
434
|
services(services) {
|
|
206
435
|
return cloneWith(this, { _services: (0, import_lodash_uniqby.default)([...this._services, ...services], (s) => s.serviceName) });
|
|
207
436
|
}
|
|
@@ -346,7 +575,6 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
346
575
|
status: this._status,
|
|
347
576
|
getSession: this._getSession,
|
|
348
577
|
rateLimit: this._rateLimit,
|
|
349
|
-
publisherService: this._publisher,
|
|
350
578
|
events: this._events,
|
|
351
579
|
authorizer,
|
|
352
580
|
surface: this._surface,
|
|
@@ -356,12 +584,34 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
356
584
|
databaseService: this._databaseService,
|
|
357
585
|
rlsConfig: this._rlsConfig,
|
|
358
586
|
rlsBypass: this._rlsBypass,
|
|
359
|
-
responseType: this._responseType
|
|
587
|
+
responseType: this._responseType,
|
|
588
|
+
...this._telemetry ? { telemetry: this._telemetry } : {}
|
|
360
589
|
});
|
|
361
590
|
endpoint.owner = this._surface?.id;
|
|
362
591
|
return endpoint;
|
|
363
592
|
}
|
|
364
593
|
};
|
|
594
|
+
/**
|
|
595
|
+
* What `.upload(bucket, …)` returns: the same builder, whose handler is also
|
|
596
|
+
* given the signed form.
|
|
597
|
+
*/
|
|
598
|
+
var UploadEndpointBuilder = class extends EndpointBuilder {
|
|
599
|
+
/** The bucket's service, and what an upload to it allows. */
|
|
600
|
+
_upload;
|
|
601
|
+
handle(fn) {
|
|
602
|
+
const { serviceName, options } = this._upload;
|
|
603
|
+
const handler = (async (ctx, response) => {
|
|
604
|
+
const storage = ctx.services[serviceName];
|
|
605
|
+
const upload = await issueUpload(storage, ctx, options);
|
|
606
|
+
Object.defineProperty(ctx, "upload", {
|
|
607
|
+
value: upload,
|
|
608
|
+
enumerable: true
|
|
609
|
+
});
|
|
610
|
+
return fn(ctx, response);
|
|
611
|
+
});
|
|
612
|
+
return super.handle(handler);
|
|
613
|
+
}
|
|
614
|
+
};
|
|
365
615
|
//#endregion
|
|
366
616
|
//#region src/endpoints/EndpointFactory.ts
|
|
367
617
|
var EndpointFactory = class EndpointFactory {
|
|
@@ -379,7 +629,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
379
629
|
defaultConstructs = [];
|
|
380
630
|
basePath = "";
|
|
381
631
|
defaultAuthorizeFn;
|
|
382
|
-
defaultEventPublisher;
|
|
383
632
|
defaultSessionExtractor;
|
|
384
633
|
defaultLogger;
|
|
385
634
|
/**
|
|
@@ -397,14 +646,13 @@ var EndpointFactory = class EndpointFactory {
|
|
|
397
646
|
defaultActorExtractor;
|
|
398
647
|
customSecuritySchemes;
|
|
399
648
|
defaultRlsConfig;
|
|
400
|
-
constructor({ basePath, defaultAuthorizeFn, defaultLogger = DEFAULT_LOGGER, defaultSessionExtractor, defaultServices = [], defaultConstructs = [],
|
|
649
|
+
constructor({ basePath, defaultAuthorizeFn, defaultLogger = DEFAULT_LOGGER, defaultSessionExtractor, defaultServices = [], defaultConstructs = [], availableAuthorizers = [], defaultAuthorizerName, defaultAuditorStorage, defaultDatabaseService, defaultActorExtractor, customSecuritySchemes = {}, defaultRlsConfig, surface }) {
|
|
401
650
|
this.defaultConstructs = [...new Set(defaultConstructs)];
|
|
402
651
|
this.defaultServices = (0, import_lodash_uniqby.default)(defaultServices, (s) => s.serviceName);
|
|
403
652
|
this.basePath = basePath || "";
|
|
404
653
|
this.defaultAuthorizeFn = defaultAuthorizeFn;
|
|
405
654
|
this.defaultLogger = defaultLogger;
|
|
406
655
|
this.defaultSessionExtractor = defaultSessionExtractor;
|
|
407
|
-
this.defaultEventPublisher = defaultEventPublisher;
|
|
408
656
|
this.availableAuthorizers = availableAuthorizers;
|
|
409
657
|
this.defaultAuthorizerName = defaultAuthorizerName;
|
|
410
658
|
this.defaultAuditorStorage = defaultAuditorStorage;
|
|
@@ -436,7 +684,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
436
684
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
437
685
|
defaultLogger: this.defaultLogger,
|
|
438
686
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
439
|
-
defaultEventPublisher: this.defaultEventPublisher,
|
|
440
687
|
availableAuthorizers: authorizerConfigs,
|
|
441
688
|
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
442
689
|
defaultAuditorStorage: this.defaultAuditorStorage,
|
|
@@ -471,7 +718,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
471
718
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
472
719
|
defaultLogger: this.defaultLogger,
|
|
473
720
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
474
|
-
defaultEventPublisher: this.defaultEventPublisher,
|
|
475
721
|
availableAuthorizers: this.availableAuthorizers,
|
|
476
722
|
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
477
723
|
defaultAuditorStorage: this.defaultAuditorStorage,
|
|
@@ -509,7 +755,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
509
755
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
510
756
|
defaultLogger: this.defaultLogger,
|
|
511
757
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
512
|
-
defaultEventPublisher: this.defaultEventPublisher,
|
|
513
758
|
availableAuthorizers: this.availableAuthorizers,
|
|
514
759
|
defaultAuthorizerName: name === "none" ? void 0 : name,
|
|
515
760
|
defaultAuditorStorage: this.defaultAuditorStorage,
|
|
@@ -529,7 +774,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
529
774
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
530
775
|
defaultLogger: this.defaultLogger,
|
|
531
776
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
532
|
-
defaultEventPublisher: this.defaultEventPublisher,
|
|
533
777
|
availableAuthorizers: this.availableAuthorizers,
|
|
534
778
|
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
535
779
|
defaultAuditorStorage: this.defaultAuditorStorage,
|
|
@@ -548,7 +792,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
548
792
|
defaultAuthorizeFn: fn,
|
|
549
793
|
defaultLogger: this.defaultLogger,
|
|
550
794
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
551
|
-
defaultEventPublisher: this.defaultEventPublisher,
|
|
552
795
|
availableAuthorizers: this.availableAuthorizers,
|
|
553
796
|
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
554
797
|
defaultAuditorStorage: this.defaultAuditorStorage,
|
|
@@ -583,7 +826,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
583
826
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
584
827
|
defaultLogger: this.defaultLogger,
|
|
585
828
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
586
|
-
defaultEventPublisher: this.defaultEventPublisher,
|
|
587
829
|
availableAuthorizers: this.availableAuthorizers,
|
|
588
830
|
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
589
831
|
defaultAuditorStorage: this.defaultAuditorStorage,
|
|
@@ -602,26 +844,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
602
844
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
603
845
|
defaultLogger: logger,
|
|
604
846
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
605
|
-
defaultEventPublisher: this.defaultEventPublisher,
|
|
606
|
-
availableAuthorizers: this.availableAuthorizers,
|
|
607
|
-
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
608
|
-
defaultAuditorStorage: this.defaultAuditorStorage,
|
|
609
|
-
defaultDatabaseService: this.defaultDatabaseService,
|
|
610
|
-
defaultActorExtractor: this.defaultActorExtractor,
|
|
611
|
-
customSecuritySchemes: this.customSecuritySchemes,
|
|
612
|
-
surface: this.surface,
|
|
613
|
-
defaultRlsConfig: this.defaultRlsConfig
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
publisher(publisher) {
|
|
617
|
-
return new EndpointFactory({
|
|
618
|
-
defaultServices: this.defaultServices,
|
|
619
|
-
defaultConstructs: this.defaultConstructs,
|
|
620
|
-
basePath: this.basePath,
|
|
621
|
-
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
622
|
-
defaultLogger: this.defaultLogger,
|
|
623
|
-
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
624
|
-
defaultEventPublisher: publisher,
|
|
625
847
|
availableAuthorizers: this.availableAuthorizers,
|
|
626
848
|
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
627
849
|
defaultAuditorStorage: this.defaultAuditorStorage,
|
|
@@ -640,7 +862,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
640
862
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
641
863
|
defaultLogger: this.defaultLogger,
|
|
642
864
|
defaultSessionExtractor: session,
|
|
643
|
-
defaultEventPublisher: this.defaultEventPublisher,
|
|
644
865
|
availableAuthorizers: this.availableAuthorizers,
|
|
645
866
|
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
646
867
|
defaultAuditorStorage: this.defaultAuditorStorage,
|
|
@@ -659,12 +880,11 @@ var EndpointFactory = class EndpointFactory {
|
|
|
659
880
|
const service = serviceOf(source);
|
|
660
881
|
return new EndpointFactory({
|
|
661
882
|
defaultServices: this.defaultServices,
|
|
662
|
-
defaultConstructs: this.defaultConstructs,
|
|
883
|
+
defaultConstructs: isConsumable(source) ? idsOf([source], this.defaultConstructs) : this.defaultConstructs,
|
|
663
884
|
basePath: this.basePath,
|
|
664
885
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
665
886
|
defaultLogger: this.defaultLogger,
|
|
666
887
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
667
|
-
defaultEventPublisher: this.defaultEventPublisher,
|
|
668
888
|
availableAuthorizers: this.availableAuthorizers,
|
|
669
889
|
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
670
890
|
defaultAuditorStorage: this.defaultAuditorStorage,
|
|
@@ -687,7 +907,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
687
907
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
688
908
|
defaultLogger: this.defaultLogger,
|
|
689
909
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
690
|
-
defaultEventPublisher: this.defaultEventPublisher,
|
|
691
910
|
availableAuthorizers: this.availableAuthorizers,
|
|
692
911
|
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
693
912
|
defaultAuditorStorage: storage,
|
|
@@ -710,7 +929,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
710
929
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
711
930
|
defaultLogger: this.defaultLogger,
|
|
712
931
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
713
|
-
defaultEventPublisher: this.defaultEventPublisher,
|
|
714
932
|
availableAuthorizers: this.availableAuthorizers,
|
|
715
933
|
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
716
934
|
defaultAuditorStorage: this.defaultAuditorStorage,
|
|
@@ -747,7 +965,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
747
965
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
748
966
|
defaultLogger: this.defaultLogger,
|
|
749
967
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
750
|
-
defaultEventPublisher: this.defaultEventPublisher,
|
|
751
968
|
availableAuthorizers: this.availableAuthorizers,
|
|
752
969
|
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
753
970
|
defaultAuditorStorage: this.defaultAuditorStorage,
|
|
@@ -766,7 +983,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
766
983
|
if (this.defaultLogger) builder._logger = this.defaultLogger;
|
|
767
984
|
builder._surface = this.surface;
|
|
768
985
|
if (this.defaultSessionExtractor) builder._getSession = this.defaultSessionExtractor;
|
|
769
|
-
if (this.defaultEventPublisher) builder._setPublisher(this.defaultEventPublisher);
|
|
770
986
|
builder._availableAuthorizers = this.availableAuthorizers;
|
|
771
987
|
if (this.defaultAuthorizerName) builder._authorizerName = this.defaultAuthorizerName;
|
|
772
988
|
if (this.defaultAuditorStorage) builder._setAuditorStorage(this.defaultAuditorStorage);
|
|
@@ -796,6 +1012,6 @@ var EndpointFactory = class EndpointFactory {
|
|
|
796
1012
|
}
|
|
797
1013
|
};
|
|
798
1014
|
//#endregion
|
|
799
|
-
export {
|
|
1015
|
+
export { UploadAcceptInvalid as a, UploadExpiryInvalid as c, BUILT_IN_SECURITY_SCHEMES as d, createAuthorizer as f, UPLOAD_POST_SCHEMA as i, UploadMaxSizeInvalid as l, isBuiltInSecurityScheme as m, EndpointBuilder as n, UploadContentTypeRefused as o, getSecurityScheme as p, UploadEndpointBuilder as r, UploadContentTypeUnresolved as s, EndpointFactory as t, RLS_BYPASS as u };
|
|
800
1016
|
|
|
801
|
-
//# sourceMappingURL=EndpointFactory-
|
|
1017
|
+
//# sourceMappingURL=EndpointFactory-Bzi9Sl7r.mjs.map
|