@geekmidas/constructs 10.0.0-alpha.18 → 10.0.0-alpha.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -158
- package/dist/Construct-127M7yrl.d.cts +231 -0
- package/dist/Construct-127M7yrl.d.cts.map +1 -0
- package/dist/Construct-BMk_CRSD.d.mts +231 -0
- package/dist/Construct-BMk_CRSD.d.mts.map +1 -0
- package/dist/{Construct-BeYVu_QF.mjs → Construct-CGuc_Ijk.mjs} +8 -9
- package/dist/Construct-CGuc_Ijk.mjs.map +1 -0
- package/dist/{Construct-DqdlARxq.cjs → Construct-DorKS0Ua.cjs} +8 -9
- package/dist/Construct-DorKS0Ua.cjs.map +1 -0
- package/dist/{Cron-l4Wlz6G9.d.mts → Cron-BcA8F0S-.d.cts} +16 -9
- package/dist/Cron-BcA8F0S-.d.cts.map +1 -0
- package/dist/{Cron-zsoSAwZo.d.cts → Cron-z2CiuQT_.d.mts} +15 -8
- package/dist/Cron-z2CiuQT_.d.mts.map +1 -0
- package/dist/{CronBuilder-D_0HNBTr.mjs → CronBuilder-BJ5LoadF.mjs} +28 -11
- package/dist/CronBuilder-BJ5LoadF.mjs.map +1 -0
- package/dist/CronBuilder-BZvo34X2.d.cts +47 -0
- package/dist/CronBuilder-BZvo34X2.d.cts.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-BbgKo8OI.d.mts +47 -0
- package/dist/CronBuilder-BbgKo8OI.d.mts.map +1 -0
- package/dist/Endpoint-52z1P0Ue.cjs +581 -0
- package/dist/Endpoint-52z1P0Ue.cjs.map +1 -0
- package/dist/{Endpoint-oS-Fe3d_.d.mts → Endpoint-CIDUreMW.d.mts} +104 -23
- package/dist/Endpoint-CIDUreMW.d.mts.map +1 -0
- package/dist/{Endpoint-DBflWAe4.d.cts → Endpoint-COisi9jw.d.cts} +101 -20
- package/dist/Endpoint-COisi9jw.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/{index-Cc4kKPag.d.mts → EndpointFactory-CIM80WIK.d.mts} +189 -106
- package/dist/EndpointFactory-CIM80WIK.d.mts.map +1 -0
- package/dist/{index-C1ZwNOOk.d.cts → EndpointFactory-CfBg6jJE.d.cts} +187 -104
- package/dist/EndpointFactory-CfBg6jJE.d.cts.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/Function-BIEsY0Hm.d.cts +76 -0
- package/dist/Function-BIEsY0Hm.d.cts.map +1 -0
- package/dist/Function-BKReud5p.d.mts +76 -0
- package/dist/Function-BKReud5p.d.mts.map +1 -0
- package/dist/{HonoEndpointAdaptor-92zavCsV.cjs → HonoEndpointAdaptor-BTbqfSaa.cjs} +115 -41
- package/dist/HonoEndpointAdaptor-BTbqfSaa.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-yYaU7jVJ.mjs → HonoEndpointAdaptor-CBVey2cY.mjs} +112 -38
- package/dist/HonoEndpointAdaptor-CBVey2cY.mjs.map +1 -0
- package/dist/ObjectSubscriberBuilder-Ci_Cc-WZ.d.mts +129 -0
- package/dist/ObjectSubscriberBuilder-Ci_Cc-WZ.d.mts.map +1 -0
- package/dist/ObjectSubscriberBuilder-DWtLxfAJ.d.cts +129 -0
- package/dist/ObjectSubscriberBuilder-DWtLxfAJ.d.cts.map +1 -0
- package/dist/ProcessorBuilder-CdLwJK4k.d.mts +216 -0
- package/dist/ProcessorBuilder-CdLwJK4k.d.mts.map +1 -0
- package/dist/ProcessorBuilder-ClD7tmEe.d.cts +216 -0
- package/dist/ProcessorBuilder-ClD7tmEe.d.cts.map +1 -0
- package/dist/Queue-9Hh20ZCk.mjs +104 -0
- package/dist/Queue-9Hh20ZCk.mjs.map +1 -0
- package/dist/{Queue-D9X6OoON.d.mts → Queue-B8HGg439.d.mts} +42 -41
- package/dist/Queue-B8HGg439.d.mts.map +1 -0
- package/dist/{Queue-DYPB2KWL.d.cts → Queue-C4rijiM7.d.cts} +43 -42
- package/dist/Queue-C4rijiM7.d.cts.map +1 -0
- package/dist/Queue-W1wueijP.cjs +109 -0
- package/dist/Queue-W1wueijP.cjs.map +1 -0
- package/dist/QueueBuilder-BDcv9B71.cjs +135 -0
- package/dist/QueueBuilder-BDcv9B71.cjs.map +1 -0
- package/dist/QueueBuilder-CjULiiDN.d.mts +75 -0
- package/dist/QueueBuilder-CjULiiDN.d.mts.map +1 -0
- package/dist/QueueBuilder-CrZL8HHs.mjs +118 -0
- package/dist/QueueBuilder-CrZL8HHs.mjs.map +1 -0
- package/dist/QueueBuilder-Dacm9qAv.d.cts +75 -0
- package/dist/QueueBuilder-Dacm9qAv.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-CtQXhcL7.d.mts +83 -0
- package/dist/Subscriber-CtQXhcL7.d.mts.map +1 -0
- package/dist/SubscriberBuilder-CpFhShTJ.mjs +238 -0
- package/dist/SubscriberBuilder-CpFhShTJ.mjs.map +1 -0
- package/dist/SubscriberBuilder-DJEvNRdD.cjs +261 -0
- package/dist/SubscriberBuilder-DJEvNRdD.cjs.map +1 -0
- package/dist/Topic-BGoOeCT6.mjs +99 -0
- package/dist/Topic-BGoOeCT6.mjs.map +1 -0
- package/dist/Topic-DLCZBNwK.cjs +104 -0
- package/dist/Topic-DLCZBNwK.cjs.map +1 -0
- package/dist/adaptors/aws.cjs +147 -168
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +57 -48
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +58 -49
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +142 -164
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/awsWebsocket.cjs +354 -0
- package/dist/adaptors/awsWebsocket.cjs.map +1 -0
- package/dist/adaptors/awsWebsocket.d.cts +156 -0
- package/dist/adaptors/awsWebsocket.d.cts.map +1 -0
- package/dist/adaptors/awsWebsocket.d.mts +156 -0
- package/dist/adaptors/awsWebsocket.d.mts.map +1 -0
- package/dist/adaptors/awsWebsocket.mjs +347 -0
- package/dist/adaptors/awsWebsocket.mjs.map +1 -0
- package/dist/adaptors/hono.cjs +1 -1
- package/dist/adaptors/hono.d.cts +8 -7
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +10 -9
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +1 -1
- package/dist/adaptors/testing.cjs +1174 -41
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +517 -40
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +517 -40
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +1140 -36
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-CutSfNlr.d.mts +274 -0
- package/dist/auth-CutSfNlr.d.mts.map +1 -0
- package/dist/auth-b9ADezz9.d.cts +274 -0
- package/dist/auth-b9ADezz9.d.cts.map +1 -0
- package/dist/auth.cjs +311 -26
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +2 -104
- package/dist/auth.d.mts +2 -104
- package/dist/auth.mjs +307 -28
- package/dist/auth.mjs.map +1 -1
- package/dist/cache-9wLNSy3O.d.cts +44 -0
- package/dist/cache-9wLNSy3O.d.cts.map +1 -0
- package/dist/cache-BFPs_CGs.d.mts +44 -0
- package/dist/cache-BFPs_CGs.d.mts.map +1 -0
- package/dist/cache.cjs +4 -20
- package/dist/cache.cjs.map +1 -1
- package/dist/cache.d.cts +2 -43
- package/dist/cache.d.mts +2 -43
- package/dist/cache.mjs +4 -20
- package/dist/cache.mjs.map +1 -1
- package/dist/cipher-C1lEFX63.mjs +225 -0
- package/dist/cipher-C1lEFX63.mjs.map +1 -0
- package/dist/cipher-CVxfwLjk.cjs +332 -0
- package/dist/cipher-CVxfwLjk.cjs.map +1 -0
- package/dist/cipher-DSDxPRIp.d.cts +106 -0
- package/dist/cipher-DSDxPRIp.d.cts.map +1 -0
- package/dist/cipher-DSDxPRIp.d.mts +106 -0
- package/dist/cipher-DSDxPRIp.d.mts.map +1 -0
- package/dist/{construct-interface-DPlxfpoS.d.mts → construct-interface-CVoejIpo.d.cts} +79 -8
- package/dist/construct-interface-CVoejIpo.d.cts.map +1 -0
- package/dist/{construct-interface-DgXTJcOD.d.cts → construct-interface-Nw5Dt9AC.d.mts} +79 -8
- package/dist/construct-interface-Nw5Dt9AC.d.mts.map +1 -0
- package/dist/construct-interface.cjs +62 -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 +59 -5
- package/dist/construct-interface.mjs.map +1 -1
- package/dist/credential-B80mOxwT.mjs +222 -0
- package/dist/credential-B80mOxwT.mjs.map +1 -0
- package/dist/credential-RlgbzZAc.cjs +257 -0
- package/dist/credential-RlgbzZAc.cjs.map +1 -0
- package/dist/credential.cjs +7 -129
- package/dist/credential.d.cts +2 -58
- package/dist/credential.d.mts +2 -58
- package/dist/credential.mjs +2 -128
- package/dist/crons/index.cjs +127 -1
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +43 -3
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +43 -3
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +126 -2
- package/dist/crons/index.mjs.map +1 -1
- package/dist/database/kysely.cjs +3 -194
- package/dist/database/kysely.d.cts +2 -149
- package/dist/database/kysely.d.mts +2 -149
- package/dist/database/kysely.mjs +2 -192
- package/dist/email.cjs +24 -17
- package/dist/email.cjs.map +1 -1
- package/dist/email.d.cts +15 -5
- package/dist/email.d.cts.map +1 -1
- package/dist/email.d.mts +16 -6
- package/dist/email.d.mts.map +1 -1
- package/dist/email.mjs +23 -17
- package/dist/email.mjs.map +1 -1
- package/dist/encryption/kms.cjs +95 -0
- package/dist/encryption/kms.cjs.map +1 -0
- package/dist/encryption/kms.d.cts +7 -0
- package/dist/encryption/kms.d.cts.map +1 -0
- package/dist/encryption/kms.d.mts +7 -0
- package/dist/encryption/kms.d.mts.map +1 -0
- package/dist/encryption/kms.mjs +93 -0
- package/dist/encryption/kms.mjs.map +1 -0
- package/dist/encryption.cjs +116 -0
- package/dist/encryption.cjs.map +1 -0
- package/dist/encryption.d.cts +37 -0
- package/dist/encryption.d.cts.map +1 -0
- package/dist/encryption.d.mts +37 -0
- package/dist/encryption.d.mts.map +1 -0
- package/dist/encryption.mjs +101 -0
- package/dist/encryption.mjs.map +1 -0
- package/dist/endpoints/index.cjs +32 -10
- package/dist/endpoints/index.d.cts +106 -3
- package/dist/endpoints/index.d.cts.map +1 -0
- package/dist/endpoints/index.d.mts +106 -3
- package/dist/endpoints/index.d.mts.map +1 -0
- package/dist/endpoints/index.mjs +6 -4
- package/dist/expire-C586zznE.d.cts +38 -0
- package/dist/expire-C586zznE.d.cts.map +1 -0
- package/dist/expire-C586zznE.d.mts +38 -0
- package/dist/expire-C586zznE.d.mts.map +1 -0
- package/dist/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-JI5uN1SF.d.cts +201 -0
- package/dist/fake-JI5uN1SF.d.cts.map +1 -0
- package/dist/fake-zpuXpBmY.d.mts +201 -0
- package/dist/fake-zpuXpBmY.d.mts.map +1 -0
- package/dist/file-server.cjs +170 -49
- package/dist/file-server.cjs.map +1 -1
- package/dist/file-server.d.cts +148 -16
- package/dist/file-server.d.cts.map +1 -1
- package/dist/file-server.d.mts +148 -16
- package/dist/file-server.d.mts.map +1 -1
- package/dist/file-server.mjs +168 -51
- 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-CXLU7h_8.d.cts +195 -0
- package/dist/inbox-CXLU7h_8.d.cts.map +1 -0
- package/dist/inbox-DYFsLd9A.d.mts +195 -0
- package/dist/inbox-DYFsLd9A.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-BpE9_6l5.d.mts +115 -0
- package/dist/index-BpE9_6l5.d.mts.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-zRChehJ9.d.cts +115 -0
- package/dist/index-zRChehJ9.d.cts.map +1 -0
- package/dist/index.cjs +4 -1
- package/dist/index.d.cts +26 -3
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +26 -3
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -2
- package/dist/kysely-5PAqFBzo.d.mts +216 -0
- package/dist/kysely-5PAqFBzo.d.mts.map +1 -0
- package/dist/kysely-Bc9xzaik.mjs +371 -0
- package/dist/kysely-Bc9xzaik.mjs.map +1 -0
- package/dist/kysely-D7f6J2lh.cjs +384 -0
- package/dist/kysely-D7f6J2lh.cjs.map +1 -0
- package/dist/kysely-lxNUBSTP.d.cts +216 -0
- package/dist/kysely-lxNUBSTP.d.cts.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 +79 -0
- package/dist/mobile-app.cjs.map +1 -0
- package/dist/mobile-app.d.cts +78 -0
- package/dist/mobile-app.d.cts.map +1 -0
- package/dist/mobile-app.d.mts +78 -0
- package/dist/mobile-app.d.mts.map +1 -0
- package/dist/mobile-app.mjs +78 -0
- package/dist/mobile-app.mjs.map +1 -0
- package/dist/object-storage.cjs +50 -7
- package/dist/object-storage.cjs.map +1 -1
- package/dist/object-storage.d.cts +37 -3
- package/dist/object-storage.d.cts.map +1 -1
- package/dist/object-storage.d.mts +37 -3
- package/dist/object-storage.d.mts.map +1 -1
- package/dist/object-storage.mjs +49 -9
- package/dist/object-storage.mjs.map +1 -1
- package/dist/optionalPeers-D7Wt6dnF.mjs +140 -0
- package/dist/optionalPeers-D7Wt6dnF.mjs.map +1 -0
- package/dist/optionalPeers-DuNQXXe1.cjs +223 -0
- package/dist/optionalPeers-DuNQXXe1.cjs.map +1 -0
- package/dist/origins-BjxYht13.cjs +96 -0
- package/dist/origins-BjxYht13.cjs.map +1 -0
- package/dist/origins-Boc9qbo-.mjs +73 -0
- package/dist/origins-Boc9qbo-.mjs.map +1 -0
- package/dist/pattern-C1CEcglD.mjs +241 -0
- package/dist/pattern-C1CEcglD.mjs.map +1 -0
- package/dist/pattern-QFaUIr77.cjs +288 -0
- package/dist/pattern-QFaUIr77.cjs.map +1 -0
- package/dist/privateAddress-Bg5fUsbp.mjs +21 -0
- package/dist/privateAddress-Bg5fUsbp.mjs.map +1 -0
- package/dist/privateAddress-CqGyuFHn.cjs +26 -0
- package/dist/privateAddress-CqGyuFHn.cjs.map +1 -0
- package/dist/processors/index.cjs +214 -0
- package/dist/processors/index.cjs.map +1 -0
- package/dist/processors/index.d.cts +78 -0
- package/dist/processors/index.d.cts.map +1 -0
- package/dist/processors/index.d.mts +78 -0
- package/dist/processors/index.d.mts.map +1 -0
- package/dist/processors/index.mjs +193 -0
- package/dist/processors/index.mjs.map +1 -0
- package/dist/queue/index.cjs +5 -192
- package/dist/queue/index.d.cts +3 -53
- package/dist/queue/index.d.mts +3 -53
- package/dist/queue/index.mjs +3 -190
- package/dist/random-password.cjs +86 -0
- package/dist/random-password.cjs.map +1 -0
- package/dist/random-password.d.cts +30 -0
- package/dist/random-password.d.cts.map +1 -0
- package/dist/random-password.d.mts +30 -0
- package/dist/random-password.d.mts.map +1 -0
- package/dist/random-password.mjs +84 -0
- package/dist/random-password.mjs.map +1 -0
- package/dist/readOnlyStorage-C7bCe-z5.cjs +101 -0
- package/dist/readOnlyStorage-C7bCe-z5.cjs.map +1 -0
- package/dist/readOnlyStorage-DMCeLuS2.mjs +78 -0
- package/dist/readOnlyStorage-DMCeLuS2.mjs.map +1 -0
- package/dist/readRequestBody-BmKnPl0a.mjs +293 -0
- package/dist/readRequestBody-BmKnPl0a.mjs.map +1 -0
- package/dist/{lazyAccessors-Dx9NLwJZ.cjs → readRequestBody-CN9GVdeE.cjs} +141 -47
- package/dist/readRequestBody-CN9GVdeE.cjs.map +1 -0
- package/dist/{processAudits-D_2W5x8k.cjs → requestLogger-CnoYd-Ah.cjs} +63 -3
- package/dist/requestLogger-CnoYd-Ah.cjs.map +1 -0
- package/dist/{processAudits-BpRlPQMW.mjs → requestLogger-D2JS7pPM.mjs} +51 -3
- package/dist/requestLogger-D2JS7pPM.mjs.map +1 -0
- package/dist/rest-api.cjs +100 -73
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +83 -59
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +83 -59
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +97 -76
- package/dist/rest-api.mjs.map +1 -1
- package/dist/runSubscriber-HEqXkin1.mjs +117 -0
- package/dist/runSubscriber-HEqXkin1.mjs.map +1 -0
- package/dist/runSubscriber-sVJfLA0-.cjs +134 -0
- package/dist/runSubscriber-sVJfLA0-.cjs.map +1 -0
- package/dist/shutdown-BMJmAhSt.cjs +38 -0
- package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
- package/dist/shutdown-C7xa8x9S.mjs +27 -0
- package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
- package/dist/site.cjs +140 -10
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +156 -3
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +156 -3
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +120 -13
- package/dist/site.mjs.map +1 -1
- package/dist/stages-DaTaoQei.d.cts +73 -0
- package/dist/stages-DaTaoQei.d.cts.map +1 -0
- package/dist/stages-DaTaoQei.d.mts +73 -0
- package/dist/stages-DaTaoQei.d.mts.map +1 -0
- package/dist/subscribers/index.cjs +134 -1
- package/dist/subscribers/index.cjs.map +1 -0
- package/dist/subscribers/index.d.cts +74 -3
- package/dist/subscribers/index.d.cts.map +1 -0
- package/dist/subscribers/index.d.mts +74 -3
- package/dist/subscribers/index.d.mts.map +1 -0
- package/dist/subscribers/index.mjs +132 -2
- package/dist/subscribers/index.mjs.map +1 -0
- package/dist/telemetry-BbLyS7ln.d.cts +57 -0
- package/dist/telemetry-BbLyS7ln.d.cts.map +1 -0
- package/dist/telemetry-DWX-qKUh.d.mts +57 -0
- package/dist/telemetry-DWX-qKUh.d.mts.map +1 -0
- package/dist/telemetry.cjs +64 -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 +63 -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-9ndLBolx.d.cts +1207 -0
- package/dist/websocket-api-9ndLBolx.d.cts.map +1 -0
- package/dist/websocket-api-BPPXF79i.d.mts +1207 -0
- package/dist/websocket-api-BPPXF79i.d.mts.map +1 -0
- package/dist/websocket-api-C6LGg9-D.mjs +1716 -0
- package/dist/websocket-api-C6LGg9-D.mjs.map +1 -0
- package/dist/websocket-api-CoKPJJRl.cjs +1895 -0
- package/dist/websocket-api-CoKPJJRl.cjs.map +1 -0
- package/dist/websocket-api.cjs +42 -0
- package/dist/websocket-api.d.cts +2 -0
- package/dist/websocket-api.d.mts +2 -0
- package/dist/websocket-api.mjs +3 -0
- package/dist/worker.cjs +174 -32
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +147 -47
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +147 -47
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +175 -33
- package/dist/worker.mjs.map +1 -1
- package/package.json +180 -43
- package/dist/Construct-BeYVu_QF.mjs.map +0 -1
- package/dist/Construct-DfbwIntp.d.cts +0 -115
- package/dist/Construct-DfbwIntp.d.cts.map +0 -1
- package/dist/Construct-DqdlARxq.cjs.map +0 -1
- package/dist/Construct-l5aOn_jv.d.mts +0 -115
- package/dist/Construct-l5aOn_jv.d.mts.map +0 -1
- package/dist/Cron-l4Wlz6G9.d.mts.map +0 -1
- package/dist/Cron-zsoSAwZo.d.cts.map +0 -1
- package/dist/CronBuilder-BdnI6lxF.cjs.map +0 -1
- package/dist/CronBuilder-CyT71Nzg.d.cts +0 -41
- package/dist/CronBuilder-CyT71Nzg.d.cts.map +0 -1
- package/dist/CronBuilder-D_0HNBTr.mjs.map +0 -1
- package/dist/CronBuilder-UoNgFe8S.d.mts +0 -41
- package/dist/CronBuilder-UoNgFe8S.d.mts.map +0 -1
- package/dist/Endpoint-BpZHtJ2W.cjs +0 -1689
- package/dist/Endpoint-BpZHtJ2W.cjs.map +0 -1
- package/dist/Endpoint-DBflWAe4.d.cts.map +0 -1
- package/dist/Endpoint-ONsly_dq.mjs +0 -1671
- package/dist/Endpoint-ONsly_dq.mjs.map +0 -1
- package/dist/Endpoint-oS-Fe3d_.d.mts.map +0 -1
- package/dist/EndpointFactory-Bm3aKRdV.mjs.map +0 -1
- package/dist/EndpointFactory-CLvWuHyt.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-92zavCsV.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-yYaU7jVJ.mjs.map +0 -1
- package/dist/Queue-D9X6OoON.d.mts.map +0 -1
- package/dist/Queue-DYPB2KWL.d.cts.map +0 -1
- package/dist/Subscriber-C4heaAyO.d.mts +0 -51
- package/dist/Subscriber-C4heaAyO.d.mts.map +0 -1
- package/dist/Subscriber-CotDUELC.d.cts +0 -51
- package/dist/Subscriber-CotDUELC.d.cts.map +0 -1
- package/dist/SubscriberBuilder-BEv0eoHy.d.cts +0 -59
- package/dist/SubscriberBuilder-BEv0eoHy.d.cts.map +0 -1
- package/dist/SubscriberBuilder-C0ZEtGDI.cjs +0 -125
- package/dist/SubscriberBuilder-C0ZEtGDI.cjs.map +0 -1
- package/dist/SubscriberBuilder-h7B_cHMr.mjs +0 -114
- package/dist/SubscriberBuilder-h7B_cHMr.mjs.map +0 -1
- package/dist/SubscriberBuilder-tyH5yTk5.d.mts +0 -59
- package/dist/SubscriberBuilder-tyH5yTk5.d.mts.map +0 -1
- package/dist/Topic-DEVGo0Dm.d.cts +0 -89
- package/dist/Topic-DEVGo0Dm.d.cts.map +0 -1
- package/dist/Topic-zk_6Gthr.d.mts +0 -89
- package/dist/Topic-zk_6Gthr.d.mts.map +0 -1
- package/dist/auth.d.cts.map +0 -1
- package/dist/auth.d.mts.map +0 -1
- package/dist/cache.d.cts.map +0 -1
- package/dist/cache.d.mts.map +0 -1
- package/dist/construct-interface-DPlxfpoS.d.mts.map +0 -1
- package/dist/construct-interface-DgXTJcOD.d.cts.map +0 -1
- package/dist/credential.cjs.map +0 -1
- package/dist/credential.d.cts.map +0 -1
- package/dist/credential.d.mts.map +0 -1
- package/dist/credential.mjs.map +0 -1
- package/dist/database/kysely.cjs.map +0 -1
- package/dist/database/kysely.d.cts.map +0 -1
- package/dist/database/kysely.d.mts.map +0 -1
- package/dist/database/kysely.mjs.map +0 -1
- package/dist/functions-B6qCvfmy.cjs.map +0 -1
- package/dist/functions-C53GW2eQ.mjs.map +0 -1
- package/dist/index-B2urf3YI.d.cts +0 -26
- package/dist/index-B2urf3YI.d.cts.map +0 -1
- package/dist/index-C1ZwNOOk.d.cts.map +0 -1
- package/dist/index-Cc4kKPag.d.mts.map +0 -1
- package/dist/index-DMCDvnsM.d.mts +0 -26
- package/dist/index-DMCDvnsM.d.mts.map +0 -1
- package/dist/index-D_frT6MP.d.cts +0 -165
- package/dist/index-D_frT6MP.d.cts.map +0 -1
- package/dist/index-DcyIYbDS.d.mts +0 -165
- package/dist/index-DcyIYbDS.d.mts.map +0 -1
- package/dist/lazyAccessors-BHtcqgz2.mjs +0 -211
- package/dist/lazyAccessors-BHtcqgz2.mjs.map +0 -1
- package/dist/lazyAccessors-Dx9NLwJZ.cjs.map +0 -1
- package/dist/processAudits-BpRlPQMW.mjs.map +0 -1
- package/dist/processAudits-D_2W5x8k.cjs.map +0 -1
- package/dist/queue/index.cjs.map +0 -1
- package/dist/queue/index.d.cts.map +0 -1
- package/dist/queue/index.d.mts.map +0 -1
- package/dist/queue/index.mjs.map +0 -1
- package/dist/telemetry-DGcFlVpB.d.cts.map +0 -1
- package/dist/telemetry-DGcFlVpB.d.mts.map +0 -1
- package/dist/topic/index.cjs.map +0 -1
- package/dist/topic/index.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Endpoint-52z1P0Ue.cjs","names":["Function","buildOpenApiSchema","convertSchemaWithComponents","convertStandardSchemaToJsonSchema"],"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":";;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,kBAAkB;CACvB;CACA;CACA;CACA;AACD;;AAGA,SAAgB,YACf,SACA,QACc;CACd,OAAO,EACN,MAAM,aAAa;EAClB,MAAM,gBAAgB,SAAS;EAC/B,IAAI,CAAC,WAAW,CAAC,eAChB,MAAM,IAAI,gBAAgB,SAAS,EAAE;EAGtC,MAAM,UAAU,IAAI,QAAQ;EAC5B,KAAK,MAAM,QAAQ,iBAAiB;GACnC,MAAM,QAAQ,OAAO,IAAI;GACzB,IAAI,OAAO,QAAQ,IAAI,MAAM,KAAK;EACnC;EAEA,MAAM,UAAW,MAAM,cAAc,OACpC,SACA,QAAQ,SACT;EAMA,MAAM,WAAW;EAIjB,IAAI,OAAO,UAAU,MAAM,OAAO,UACjC,gBAAA,aAAa;GACZ,IAAI,SAAS,KAAK;GAClB,GAAI,OAAO,SAAS,SAAS,OAAO,WACjC,EAAE,WAAW,SAAS,QAAQ,GAAG,IACjC,CAAC;EACL,CAAC;EAGF,OAAO;CACR,EACD;AACD;;AAGA,IAAa,kBAAb,cAAqC,MAAM;CACrB;CAArB,YAAY,SAAsC;EACjD,MACC,iDACC,UAAU,gBAAgB,QAAQ,KAAK,gBACvC,kEACF;EALoB,KAAA,UAAA;EAMpB,KAAK,OAAO;CACb;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClCA,IAAa,WAAb,MAAa,iBAgBHA,kBAAAA,SAmBR;CACD;;CAEA;;CAEA;;;;;;;;CAQA;;CAEA;;CAEA;;CAEA;;;;;;CAMA;;;;;CAMA;;CAEA,iBAAyD,CAAC;;CAE1D,oBACE,CAAC;;;;;;;CAOH,aAAsC;;CAEtC,kBAMU;;CAEV;;CAEA;;CAEA;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,UAAU,KAAK;EAAS;CAC5D;CAEA,KAAQ,MAAkC;EACzC,OAAO;GAAE;GAAM,UAAU,KAAK;EAAS;CACxC;CAEA,cAAgC;EAC/B,OAAO,KAAK;CACb;AACD;;;;AAiKA,IAAY,gBAAL,yBAAA,eAAA;;CAEN,cAAA,cAAA,QAAA,OAAA;;CAEA,cAAA,cAAA,aAAA,OAAA;;CAEA,cAAA,cAAA,cAAA,OAAA;;CAEA,cAAA,cAAA,eAAA,OAAA;;CAEA,cAAA,cAAA,kBAAA,OAAA;;CAEA,cAAA,cAAA,oBAAA,OAAA;;AACD,EAAA,CAAA,CAAA;;;;;AAMA,IAAY,iBAAL,yBAAA,gBAAA;;CAEN,eAAA,eAAA,sBAAA,OAAA;;CAEA,eAAA,eAAA,WAAA,OAAA;;CAEA,eAAA,eAAA,cAAA,OAAA;;CAEA,eAAA,eAAA,uBAAA,OAAA;;CAEA,eAAA,eAAA,uBAAA,OAAA;;AACD,EAAA,CAAA,CAAA"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as StandardSchemaV1 } from "./index-DdRjYhiJ.mjs";
|
|
2
|
+
import { o as TopicEvent } from "./Construct-BMk_CRSD.mjs";
|
|
3
|
+
import { i as FunctionHandler, n as Function } from "./Function-BKReud5p.mjs";
|
|
4
|
+
import { t as Authenticator } from "./construct-interface-Nw5Dt9AC.mjs";
|
|
5
|
+
import "./index-BpE9_6l5.mjs";
|
|
3
6
|
import { n as LowerHttpMethod, t as HttpMethod } from "./types-DMuSQeLL.mjs";
|
|
7
|
+
import { t as EndpointTelemetry } from "./telemetry-DWX-qKUh.mjs";
|
|
8
|
+
import { i as AuthSession } from "./auth-CutSfNlr.mjs";
|
|
9
|
+
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
4
10
|
import { ComponentCollector, OpenApiSchemaOptions } from "@geekmidas/schema/openapi";
|
|
5
11
|
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
6
|
-
import { EventPublisher, ExtractPublisherMessage, MappedEvent } from "@geekmidas/events";
|
|
7
|
-
import { RateLimitConfig } from "@geekmidas/rate-limit";
|
|
8
|
-
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
9
|
-
import { AuditActor, AuditStorage, AuditableAction, Auditor, ExtractAuditPayload, ExtractAuditType } from "@geekmidas/audit";
|
|
10
12
|
import { Logger } from "@geekmidas/logger";
|
|
11
13
|
import { InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput } from "@geekmidas/schema";
|
|
14
|
+
import { AuditActor, AuditStorage, AuditableAction, Auditor, ExtractAuditPayload, ExtractAuditType } from "@geekmidas/audit";
|
|
15
|
+
import { RateLimitConfig } from "@geekmidas/rate-limit";
|
|
12
16
|
import { OpenAPIV3_1 } from "openapi-types";
|
|
13
17
|
//#region src/endpoints/Authorizer.d.ts
|
|
14
18
|
/**
|
|
@@ -221,6 +225,23 @@ declare const RLS_BYPASS: unique symbol;
|
|
|
221
225
|
*/
|
|
222
226
|
type RlsBypass = typeof RLS_BYPASS;
|
|
223
227
|
//#endregion
|
|
228
|
+
//#region src/endpoints/sessionAuth.d.ts
|
|
229
|
+
/**
|
|
230
|
+
* The surface's authenticator, as a session callback sees it.
|
|
231
|
+
*
|
|
232
|
+
* Bound to the request being handled, so reading the session takes no
|
|
233
|
+
* argument: `session(async ({ auth }) => auth.getSession())`.
|
|
234
|
+
*/
|
|
235
|
+
interface SessionAuth {
|
|
236
|
+
/** This request's session, verified by the `.auth()` construct — or `null`. */
|
|
237
|
+
getSession(): Promise<AuthSession | null>;
|
|
238
|
+
}
|
|
239
|
+
/** `auth.getSession()` was called on a surface that names no authenticator. */
|
|
240
|
+
declare class NoAuthenticator extends Error {
|
|
241
|
+
readonly surface: string | undefined;
|
|
242
|
+
constructor(surface: string | undefined);
|
|
243
|
+
}
|
|
244
|
+
//#endregion
|
|
224
245
|
//#region src/endpoints/Endpoint.d.ts
|
|
225
246
|
/**
|
|
226
247
|
* Represents an HTTP endpoint that can handle requests with type-safe input/output validation,
|
|
@@ -247,7 +268,7 @@ type RlsBypass = typeof RLS_BYPASS;
|
|
|
247
268
|
* });
|
|
248
269
|
* ```
|
|
249
270
|
*/
|
|
250
|
-
declare class Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput extends EndpointSchemas = {}, OutSchema extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TSession = unknown,
|
|
271
|
+
declare class Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput extends EndpointSchemas = {}, OutSchema extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TSession = unknown, TAuditStorage extends AuditStorage | undefined = undefined, TAuditStorageServiceName extends string = string, TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Function<TInput, TServices, TLogger, OutSchema, TAuditStorage, TAuditStorageServiceName, TDatabase, TDatabaseServiceName, TAuditAction, FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase, TAuditStorage, TAuditAction>> {
|
|
251
272
|
operationId?: string;
|
|
252
273
|
/** The route path pattern with parameter placeholders */
|
|
253
274
|
route: TRoute;
|
|
@@ -265,18 +286,30 @@ declare class Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput
|
|
|
265
286
|
description?: string;
|
|
266
287
|
/** Optional tags for OpenAPI documentation */
|
|
267
288
|
tags?: string[];
|
|
268
|
-
/** The HTTP
|
|
269
|
-
readonly status:
|
|
289
|
+
/** The HTTP status code to return (default: 200) */
|
|
290
|
+
readonly status: EndpointStatus;
|
|
270
291
|
/**
|
|
271
292
|
* Response content type for this endpoint. Defaults to `'application/json'`.
|
|
272
293
|
* Non-JSON types cause adaptors to emit the body as-is with the declared
|
|
273
294
|
* Content-Type header instead of JSON-serializing.
|
|
274
295
|
*/
|
|
275
296
|
readonly responseType: string;
|
|
297
|
+
/**
|
|
298
|
+
* This route's telemetry — `.telemetry({ ignore, attributes })` — read by
|
|
299
|
+
* the build, which hands it to the request middleware.
|
|
300
|
+
*/
|
|
301
|
+
telemetry?: EndpointTelemetry;
|
|
276
302
|
/** Default headers to apply to all responses */
|
|
277
303
|
readonly defaultHeaders: Record<string, string>;
|
|
278
304
|
/** Function to extract session data from the request context */
|
|
279
305
|
getSession: SessionFn<TServices, TLogger, TSession, TDatabase>;
|
|
306
|
+
/**
|
|
307
|
+
* Whether a session callback was given — `.session()` on the factory it was
|
|
308
|
+
* built from. A generated handler reads the session only when it is, so
|
|
309
|
+
* an endpoint with a session and no authorizer must say so: it used to be
|
|
310
|
+
* handed `undefined` in a production build and its session in `gkm dev`.
|
|
311
|
+
*/
|
|
312
|
+
readonly hasSession: boolean;
|
|
280
313
|
/** Function to determine if the request is authorized */
|
|
281
314
|
authorize: AuthorizeFn<TServices, TLogger, TSession, TInput, TDatabase>;
|
|
282
315
|
/** Optional rate limiting configuration */
|
|
@@ -337,6 +370,12 @@ declare class Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput
|
|
|
337
370
|
*/
|
|
338
371
|
parseBody(body: unknown): Promise<InferStandardSchema<TInput['body']>>;
|
|
339
372
|
static isSuccessStatus(status: number): boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Whether `status` sends the client elsewhere. A redirect has no body, so
|
|
375
|
+
* its response is not checked against the output schema, and what is
|
|
376
|
+
* derived from the output — declared events and audits — is not sent.
|
|
377
|
+
*/
|
|
378
|
+
static isRedirectStatus(status: number | undefined): boolean;
|
|
340
379
|
/**
|
|
341
380
|
* Creates a case-insensitive header lookup function from a headers object.
|
|
342
381
|
*
|
|
@@ -393,7 +432,7 @@ declare class Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput
|
|
|
393
432
|
* @internal
|
|
394
433
|
*/
|
|
395
434
|
refineInput(ctx: EndpointContext<TInput, TServices, TLogger, TSession>): InferComposableStandardSchema<TInput>;
|
|
396
|
-
handler: (ctx: EndpointContext<TInput, TServices, TLogger, TSession, TAuditAction, TDatabase, TAuditStorage>, response: ResponseBuilder) => OutSchema extends StandardSchemaV1 ? InferStandardSchemaInput<OutSchema> | ResponseWithMetadata<InferStandardSchemaInput<OutSchema>> | Promise<InferStandardSchemaInput<OutSchema
|
|
435
|
+
handler: (ctx: EndpointContext<TInput, TServices, TLogger, TSession, TAuditAction, TDatabase, TAuditStorage>, response: ResponseBuilder) => OutSchema extends StandardSchemaV1 ? InferStandardSchemaInput<OutSchema> | ResponseWithMetadata<InferStandardSchemaInput<OutSchema>> | Promise<InferStandardSchemaInput<OutSchema> | ResponseWithMetadata<InferStandardSchemaInput<OutSchema>>> : any | ResponseWithMetadata<any> | Promise<any> | Promise<ResponseWithMetadata<any>>;
|
|
397
436
|
/**
|
|
398
437
|
* Type guard to check if an object is an Endpoint instance.
|
|
399
438
|
*
|
|
@@ -435,7 +474,7 @@ declare class Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput
|
|
|
435
474
|
* @param options.status - Success HTTP status code (default: 200)
|
|
436
475
|
* @param options.authorizer - Optional authorizer configuration
|
|
437
476
|
*/
|
|
438
|
-
constructor({ fn, method, route, description, tags, input, logger, output: outputSchema, services, constructs, timeout, memorySize, getSession, authorize, rateLimit, status,
|
|
477
|
+
constructor({ fn, method, route, description, tags, input, logger, output: outputSchema, services, constructs, timeout, memorySize, getSession, authorize, rateLimit, status, events, authorizer, surface, auditorStorageService, actorExtractor, audits, databaseService, rlsConfig, rlsBypass, responseType, telemetry }: EndpointOptions<TRoute, TMethod, TInput, OutSchema, TServices, TLogger, TSession, OutSchema, TAuditStorage, TAuditStorageServiceName, TAuditAction, TDatabase, TDatabaseServiceName>);
|
|
439
478
|
}
|
|
440
479
|
/**
|
|
441
480
|
* The surface an endpoint was built from.
|
|
@@ -465,6 +504,11 @@ interface EndpointSurface {
|
|
|
465
504
|
* file or throws on a missing variable would do it at build time.
|
|
466
505
|
*/
|
|
467
506
|
envParser: EnvironmentParser<{}>;
|
|
507
|
+
/**
|
|
508
|
+
* What authenticates requests to this surface — the construct named in
|
|
509
|
+
* `RestApi.auth()`, which session callbacks read from as `auth`.
|
|
510
|
+
*/
|
|
511
|
+
auth?: Authenticator;
|
|
468
512
|
}
|
|
469
513
|
/**
|
|
470
514
|
* Configuration options for creating an Endpoint instance.
|
|
@@ -477,7 +521,7 @@ interface EndpointSurface {
|
|
|
477
521
|
* @template TLogger - Logger type
|
|
478
522
|
* @template TSession - Session data type
|
|
479
523
|
*/
|
|
480
|
-
interface EndpointOptions<TRoute extends string, TMethod extends HttpMethod, TInput extends EndpointSchemas = {}, TOutput extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TSession = unknown, OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
524
|
+
interface EndpointOptions<TRoute extends string, TMethod extends HttpMethod, TInput extends EndpointSchemas = {}, TOutput extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, TSession = unknown, OutSchema extends StandardSchemaV1 | undefined = undefined, TAuditStorage extends AuditStorage | undefined = undefined, TAuditStorageServiceName extends string = string, TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>, TDatabase = undefined, TDatabaseServiceName extends string = string> {
|
|
481
525
|
/** The route path with parameter placeholders */
|
|
482
526
|
route: TRoute;
|
|
483
527
|
/** The HTTP method for this endpoint */
|
|
@@ -514,12 +558,9 @@ interface EndpointOptions<TRoute extends string, TMethod extends HttpMethod, TIn
|
|
|
514
558
|
/** Optional rate limiting configuration */
|
|
515
559
|
rateLimit?: RateLimitConfig;
|
|
516
560
|
/** Success HTTP status code */
|
|
517
|
-
status:
|
|
518
|
-
/**
|
|
519
|
-
|
|
520
|
-
*/
|
|
521
|
-
publisherService?: Service<TEventPublisherServiceName, TEventPublisher>;
|
|
522
|
-
events?: MappedEvent<TEventPublisher, OutSchema>[];
|
|
561
|
+
status: EndpointStatus | undefined;
|
|
562
|
+
/** What it publishes once its handler succeeds, each to its own topic. */
|
|
563
|
+
events?: TopicEvent[];
|
|
523
564
|
/** Optional authorizer configuration */
|
|
524
565
|
authorizer?: Authorizer;
|
|
525
566
|
/** The surface this endpoint was built from. Every endpoint has one. */
|
|
@@ -543,6 +584,8 @@ interface EndpointOptions<TRoute extends string, TMethod extends HttpMethod, TIn
|
|
|
543
584
|
* Defaults to `'application/json'` when omitted.
|
|
544
585
|
*/
|
|
545
586
|
responseType?: string;
|
|
587
|
+
/** This route's telemetry — `.telemetry({ ignore, attributes })`. */
|
|
588
|
+
telemetry?: EndpointTelemetry;
|
|
546
589
|
}
|
|
547
590
|
/**
|
|
548
591
|
* Defines the possible input schema types for an endpoint.
|
|
@@ -589,6 +632,12 @@ type BaseSessionContext<TServices extends Service[] = [], TLogger extends Logger
|
|
|
589
632
|
logger: TLogger;
|
|
590
633
|
header: HeaderFn;
|
|
591
634
|
cookie: CookieFn;
|
|
635
|
+
/**
|
|
636
|
+
* The surface's authenticator — the construct named in `.auth()` — bound to
|
|
637
|
+
* this request: `await auth.getSession()` is this request's session, or
|
|
638
|
+
* `null`.
|
|
639
|
+
*/
|
|
640
|
+
auth: SessionAuth;
|
|
592
641
|
};
|
|
593
642
|
/**
|
|
594
643
|
* Conditional database context for session - only present when database service is configured
|
|
@@ -719,7 +768,7 @@ interface ResponseMetadata {
|
|
|
719
768
|
value: string;
|
|
720
769
|
options?: CookieOptions;
|
|
721
770
|
}>;
|
|
722
|
-
status?:
|
|
771
|
+
status?: EndpointStatus;
|
|
723
772
|
}
|
|
724
773
|
/**
|
|
725
774
|
* Return type for handlers that want to set response metadata
|
|
@@ -736,7 +785,21 @@ declare class ResponseBuilder {
|
|
|
736
785
|
header(key: string, value: string): this;
|
|
737
786
|
cookie(name: string, value: string, options?: CookieOptions): this;
|
|
738
787
|
deleteCookie(name: string, options?: Pick<CookieOptions, 'domain' | 'path'>): this;
|
|
739
|
-
status(code:
|
|
788
|
+
status(code: EndpointStatus): this;
|
|
789
|
+
/**
|
|
790
|
+
* Send the client to `url` — `Location` and a 3xx, with no body. 303 by
|
|
791
|
+
* default: after a form post, the browser follows it with a GET, so a
|
|
792
|
+
* reload does not post the form again.
|
|
793
|
+
*
|
|
794
|
+
* A redirect is not checked against the endpoint's `.output()` schema, so
|
|
795
|
+
* an endpoint that renders a page can redirect instead.
|
|
796
|
+
*
|
|
797
|
+
* @example
|
|
798
|
+
* ```typescript
|
|
799
|
+
* return response.cookie('session', token).redirect('/dashboard');
|
|
800
|
+
* ```
|
|
801
|
+
*/
|
|
802
|
+
redirect(url: string, status?: RedirectStatus): ResponseWithMetadata<never>;
|
|
740
803
|
send<T>(data: T): ResponseWithMetadata<T>;
|
|
741
804
|
getMetadata(): ResponseMetadata;
|
|
742
805
|
}
|
|
@@ -821,7 +884,7 @@ type EndpointContext<Input extends EndpointSchemas | undefined = undefined, TSer
|
|
|
821
884
|
* };
|
|
822
885
|
* ```
|
|
823
886
|
*/
|
|
824
|
-
type EndpointHandler<TInput extends EndpointSchemas | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TSession = unknown, TDatabase = undefined, TAuditStorage = undefined, TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>> = (ctx: EndpointContext<TInput, TServices, TLogger, TSession, TAuditAction, TDatabase, TAuditStorage>, response: ResponseBuilder) => OutSchema extends StandardSchemaV1 ? InferStandardSchemaInput<OutSchema> | ResponseWithMetadata<InferStandardSchemaInput<OutSchema>> | Promise<InferStandardSchemaInput<OutSchema
|
|
887
|
+
type EndpointHandler<TInput extends EndpointSchemas | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TSession = unknown, TDatabase = undefined, TAuditStorage = undefined, TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>> = (ctx: EndpointContext<TInput, TServices, TLogger, TSession, TAuditAction, TDatabase, TAuditStorage>, response: ResponseBuilder) => OutSchema extends StandardSchemaV1 ? InferStandardSchemaInput<OutSchema> | ResponseWithMetadata<InferStandardSchemaInput<OutSchema>> | Promise<InferStandardSchemaInput<OutSchema> | ResponseWithMetadata<InferStandardSchemaInput<OutSchema>>> : unknown | ResponseWithMetadata<unknown> | Promise<unknown> | Promise<ResponseWithMetadata<unknown>>;
|
|
825
888
|
/**
|
|
826
889
|
* HTTP success status codes that can be returned by endpoints.
|
|
827
890
|
*/
|
|
@@ -839,7 +902,25 @@ declare enum SuccessStatus {
|
|
|
839
902
|
/** Server is delivering only part of the resource due to a range header */
|
|
840
903
|
PartialContent = 206
|
|
841
904
|
}
|
|
905
|
+
/**
|
|
906
|
+
* HTTP redirect status codes an endpoint can answer with —
|
|
907
|
+
* `response.redirect(url, status)`, or `.status()` with a `Location` header.
|
|
908
|
+
*/
|
|
909
|
+
declare enum RedirectStatus {
|
|
910
|
+
/** The resource has moved for good; a POST may become a GET */
|
|
911
|
+
MovedPermanently = 301,
|
|
912
|
+
/** The resource is elsewhere for now; a POST may become a GET */
|
|
913
|
+
Found = 302,
|
|
914
|
+
/** See the resource elsewhere, with a GET — the answer to a form post */
|
|
915
|
+
SeeOther = 303,
|
|
916
|
+
/** The resource is elsewhere for now; the method and body are kept */
|
|
917
|
+
TemporaryRedirect = 307,
|
|
918
|
+
/** The resource has moved for good; the method and body are kept */
|
|
919
|
+
PermanentRedirect = 308
|
|
920
|
+
}
|
|
921
|
+
/** A status an endpoint answers with when its handler succeeds. */
|
|
922
|
+
type EndpointStatus = SuccessStatus | RedirectStatus;
|
|
842
923
|
type EndpointOutput<T> = T extends Endpoint<any, any, any, infer OutSchema, any, any, any, any> ? InferStandardSchema<OutSchema> : never;
|
|
843
924
|
//#endregion
|
|
844
|
-
export {
|
|
845
|
-
//# sourceMappingURL=Endpoint-
|
|
925
|
+
export { SecurityScheme as A, ActorExtractor as C, BuiltInSecuritySchemeId as D, BUILT_IN_SECURITY_SCHEMES as E, getSecurityScheme as M, isBuiltInSecurityScheme as N, OAuthFlow as O, RlsContextExtractor as S, Authorizer as T, SessionAuth as _, EndpointContext as a, RlsConfig as b, EndpointSchemas as c, HeaderFn as d, RedirectStatus as f, NoAuthenticator as g, SuccessStatus as h, Endpoint as i, createAuthorizer as j, OAuthFlows as k, EndpointStatus as l, SessionFn as m, ConvertRouteParams as n, EndpointHandler as o, ResponseBuilder as p, CookieFn as r, EndpointOutput as s, AuthorizeFn as t, EndpointSurface as u, RLS_BYPASS as v, MappedAudit as w, RlsContext as x, RlsBypass as y };
|
|
926
|
+
//# sourceMappingURL=Endpoint-CIDUreMW.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Endpoint-CIDUreMW.d.mts","names":[],"sources":["../src/endpoints/Authorizer.ts","../src/endpoints/audit.ts","../src/endpoints/rls.ts","../src/endpoints/sessionAuth.ts","../src/endpoints/Endpoint.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAIiB;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,QAAQ;;EAER;;GAEC;;;;;UAMe;EAChB,WAAW;EACX,WAAW;EACX,oBAAoB;EACpB,oBAAoB;;UAGJ;EAChB;EACA;EACA;EACA,QAAQ;;;;;;cAOI;;aAEX;aACA;aACA;aACA;;;aAGA;aACA;aACA;;;aAGA;aACA;aACA;aACA;;;aAGA;aACA;aACA;;;aAGA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;;;;KAKU,uCAAuC;;;;UAKlC;;;;EAIhB;;;;EAIA,iBAAiB;;;;;EAKjB;;;;;EAKA;;;;;EAKA,WAAW;;;;;iBAMI,iBACf,cACA,UAAU,KAAK,sBACb;;;;iBAUa,wBACf,eACE,QAAQ;;;;iBAOK,kBACf,cACA,gBAAgB,eAAe,kBAC7B;;;;;;;;;;UC3Hc,YAChB,qBAAqB,kCACrB,gBAAgB,8BAChB,cAAc,iBAAiB,gBAAgB,iBAAiB;;EAGhE,MAAM;;EAEN,UACC,UAAU,gBAAgB,mBACvB,oBAAoB,uBAEnB,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