@geekmidas/constructs 10.0.0-alpha.17 → 10.0.0-alpha.170
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -158
- package/dist/Construct-127M7yrl.d.cts +231 -0
- package/dist/Construct-127M7yrl.d.cts.map +1 -0
- package/dist/Construct-BMk_CRSD.d.mts +231 -0
- package/dist/Construct-BMk_CRSD.d.mts.map +1 -0
- package/dist/{Construct-BeYVu_QF.mjs → Construct-CGuc_Ijk.mjs} +8 -9
- package/dist/Construct-CGuc_Ijk.mjs.map +1 -0
- package/dist/{Construct-DqdlARxq.cjs → Construct-DorKS0Ua.cjs} +8 -9
- package/dist/Construct-DorKS0Ua.cjs.map +1 -0
- package/dist/{Cron-l4Wlz6G9.d.mts → Cron-Ca_qHQu2.d.cts} +16 -9
- package/dist/Cron-Ca_qHQu2.d.cts.map +1 -0
- package/dist/{Cron-zsoSAwZo.d.cts → Cron-DPJiR7Lt.d.mts} +15 -8
- package/dist/Cron-DPJiR7Lt.d.mts.map +1 -0
- package/dist/CronBuilder-BC4za5Bx.d.mts +47 -0
- package/dist/CronBuilder-BC4za5Bx.d.mts.map +1 -0
- package/dist/{CronBuilder-D_0HNBTr.mjs → CronBuilder-BJ5LoadF.mjs} +28 -11
- package/dist/CronBuilder-BJ5LoadF.mjs.map +1 -0
- package/dist/{CronBuilder-BdnI6lxF.cjs → CronBuilder-B_NSP-Y5.cjs} +27 -10
- package/dist/CronBuilder-B_NSP-Y5.cjs.map +1 -0
- package/dist/CronBuilder-C3RrAF1-.d.cts +47 -0
- package/dist/CronBuilder-C3RrAF1-.d.cts.map +1 -0
- package/dist/Endpoint-52z1P0Ue.cjs +581 -0
- package/dist/Endpoint-52z1P0Ue.cjs.map +1 -0
- package/dist/{Endpoint-DBflWAe4.d.cts → Endpoint-BlIZLsBQ.d.cts} +101 -20
- package/dist/Endpoint-BlIZLsBQ.d.cts.map +1 -0
- package/dist/{Endpoint-oS-Fe3d_.d.mts → Endpoint-DC7mreOr.d.mts} +104 -23
- package/dist/Endpoint-DC7mreOr.d.mts.map +1 -0
- package/dist/Endpoint-sUOU7uLx.mjs +552 -0
- package/dist/Endpoint-sUOU7uLx.mjs.map +1 -0
- package/dist/{EndpointFactory-Bm3aKRdV.mjs → EndpointFactory-Bzi9Sl7r.mjs} +269 -53
- package/dist/EndpointFactory-Bzi9Sl7r.mjs.map +1 -0
- package/dist/{EndpointFactory-CLvWuHyt.cjs → EndpointFactory-Cf_Cs1ym.cjs} +309 -51
- package/dist/EndpointFactory-Cf_Cs1ym.cjs.map +1 -0
- package/dist/{index-Cc4kKPag.d.mts → EndpointFactory-DCmnCmkX.d.mts} +189 -106
- package/dist/EndpointFactory-DCmnCmkX.d.mts.map +1 -0
- package/dist/{index-C1ZwNOOk.d.cts → EndpointFactory-cVTb8kCc.d.cts} +187 -104
- package/dist/EndpointFactory-cVTb8kCc.d.cts.map +1 -0
- package/dist/Function-BIEsY0Hm.d.cts +76 -0
- package/dist/Function-BIEsY0Hm.d.cts.map +1 -0
- package/dist/Function-BKReud5p.d.mts +76 -0
- package/dist/Function-BKReud5p.d.mts.map +1 -0
- package/dist/{HonoEndpointAdaptor-92zavCsV.cjs → HonoEndpointAdaptor-BTbqfSaa.cjs} +115 -41
- package/dist/HonoEndpointAdaptor-BTbqfSaa.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-yYaU7jVJ.mjs → HonoEndpointAdaptor-CBVey2cY.mjs} +112 -38
- package/dist/HonoEndpointAdaptor-CBVey2cY.mjs.map +1 -0
- package/dist/ObjectSubscriberBuilder-AwGKoUKy.d.mts +129 -0
- package/dist/ObjectSubscriberBuilder-AwGKoUKy.d.mts.map +1 -0
- package/dist/ObjectSubscriberBuilder-CB6imsX4.d.cts +129 -0
- package/dist/ObjectSubscriberBuilder-CB6imsX4.d.cts.map +1 -0
- package/dist/ProcessorBuilder-CeEZ2vCx.d.cts +216 -0
- package/dist/ProcessorBuilder-CeEZ2vCx.d.cts.map +1 -0
- package/dist/ProcessorBuilder-CwIlm75W.d.mts +216 -0
- package/dist/ProcessorBuilder-CwIlm75W.d.mts.map +1 -0
- package/dist/Queue-9Hh20ZCk.mjs +104 -0
- package/dist/Queue-9Hh20ZCk.mjs.map +1 -0
- package/dist/{Queue-D9X6OoON.d.mts → Queue-B8HGg439.d.mts} +42 -41
- package/dist/Queue-B8HGg439.d.mts.map +1 -0
- package/dist/{Queue-DYPB2KWL.d.cts → Queue-C4rijiM7.d.cts} +43 -42
- package/dist/Queue-C4rijiM7.d.cts.map +1 -0
- package/dist/Queue-W1wueijP.cjs +109 -0
- package/dist/Queue-W1wueijP.cjs.map +1 -0
- package/dist/QueueBuilder-BDcv9B71.cjs +135 -0
- package/dist/QueueBuilder-BDcv9B71.cjs.map +1 -0
- package/dist/QueueBuilder-CUERv8jt.d.mts +75 -0
- package/dist/QueueBuilder-CUERv8jt.d.mts.map +1 -0
- package/dist/QueueBuilder-CmB1vOgn.d.cts +75 -0
- package/dist/QueueBuilder-CmB1vOgn.d.cts.map +1 -0
- package/dist/QueueBuilder-CrZL8HHs.mjs +118 -0
- package/dist/QueueBuilder-CrZL8HHs.mjs.map +1 -0
- package/dist/Subscriber-5rCX1Nph.d.cts +83 -0
- package/dist/Subscriber-5rCX1Nph.d.cts.map +1 -0
- package/dist/Subscriber-CtQXhcL7.d.mts +83 -0
- package/dist/Subscriber-CtQXhcL7.d.mts.map +1 -0
- package/dist/SubscriberBuilder-CpFhShTJ.mjs +238 -0
- package/dist/SubscriberBuilder-CpFhShTJ.mjs.map +1 -0
- package/dist/SubscriberBuilder-DJEvNRdD.cjs +261 -0
- package/dist/SubscriberBuilder-DJEvNRdD.cjs.map +1 -0
- package/dist/Topic-BGoOeCT6.mjs +99 -0
- package/dist/Topic-BGoOeCT6.mjs.map +1 -0
- package/dist/Topic-DLCZBNwK.cjs +104 -0
- package/dist/Topic-DLCZBNwK.cjs.map +1 -0
- package/dist/adaptors/aws.cjs +147 -168
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +57 -48
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +58 -49
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +142 -164
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/awsWebsocket.cjs +354 -0
- package/dist/adaptors/awsWebsocket.cjs.map +1 -0
- package/dist/adaptors/awsWebsocket.d.cts +156 -0
- package/dist/adaptors/awsWebsocket.d.cts.map +1 -0
- package/dist/adaptors/awsWebsocket.d.mts +156 -0
- package/dist/adaptors/awsWebsocket.d.mts.map +1 -0
- package/dist/adaptors/awsWebsocket.mjs +347 -0
- package/dist/adaptors/awsWebsocket.mjs.map +1 -0
- package/dist/adaptors/hono.cjs +1 -1
- package/dist/adaptors/hono.d.cts +8 -7
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +10 -9
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +1 -1
- package/dist/adaptors/testing.cjs +1174 -41
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +517 -40
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +517 -40
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +1140 -36
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-1yI2wR-4.d.cts +274 -0
- package/dist/auth-1yI2wR-4.d.cts.map +1 -0
- package/dist/auth-D4NMXgLt.d.mts +274 -0
- package/dist/auth-D4NMXgLt.d.mts.map +1 -0
- package/dist/auth.cjs +311 -26
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +2 -104
- package/dist/auth.d.mts +2 -104
- package/dist/auth.mjs +307 -28
- package/dist/auth.mjs.map +1 -1
- package/dist/cache-0VoeOTF9.d.mts +44 -0
- package/dist/cache-0VoeOTF9.d.mts.map +1 -0
- package/dist/cache-CW-sArzS.d.cts +44 -0
- package/dist/cache-CW-sArzS.d.cts.map +1 -0
- package/dist/cache.cjs +4 -20
- package/dist/cache.cjs.map +1 -1
- package/dist/cache.d.cts +2 -43
- package/dist/cache.d.mts +2 -43
- package/dist/cache.mjs +4 -20
- package/dist/cache.mjs.map +1 -1
- package/dist/cipher-C1lEFX63.mjs +225 -0
- package/dist/cipher-C1lEFX63.mjs.map +1 -0
- package/dist/cipher-CVxfwLjk.cjs +332 -0
- package/dist/cipher-CVxfwLjk.cjs.map +1 -0
- package/dist/cipher-DSDxPRIp.d.cts +106 -0
- package/dist/cipher-DSDxPRIp.d.cts.map +1 -0
- package/dist/cipher-DSDxPRIp.d.mts +106 -0
- package/dist/cipher-DSDxPRIp.d.mts.map +1 -0
- package/dist/{construct-interface-DPlxfpoS.d.mts → construct-interface-DhbaONW2.d.cts} +63 -8
- package/dist/construct-interface-DhbaONW2.d.cts.map +1 -0
- package/dist/{construct-interface-DgXTJcOD.d.cts → construct-interface-DxfkFxkl.d.mts} +63 -8
- package/dist/construct-interface-DxfkFxkl.d.mts.map +1 -0
- package/dist/construct-interface.cjs +47 -4
- package/dist/construct-interface.cjs.map +1 -1
- package/dist/construct-interface.d.cts +2 -2
- package/dist/construct-interface.d.mts +2 -2
- package/dist/construct-interface.mjs +45 -5
- package/dist/construct-interface.mjs.map +1 -1
- package/dist/credential-B80mOxwT.mjs +222 -0
- package/dist/credential-B80mOxwT.mjs.map +1 -0
- package/dist/credential-RlgbzZAc.cjs +257 -0
- package/dist/credential-RlgbzZAc.cjs.map +1 -0
- package/dist/credential.cjs +7 -129
- package/dist/credential.d.cts +2 -58
- package/dist/credential.d.mts +2 -58
- package/dist/credential.mjs +2 -128
- package/dist/crons/index.cjs +127 -1
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +43 -3
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +43 -3
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +126 -2
- package/dist/crons/index.mjs.map +1 -1
- package/dist/database/kysely.cjs +3 -194
- package/dist/database/kysely.d.cts +2 -149
- package/dist/database/kysely.d.mts +2 -149
- package/dist/database/kysely.mjs +2 -192
- package/dist/email.cjs +24 -17
- package/dist/email.cjs.map +1 -1
- package/dist/email.d.cts +15 -5
- package/dist/email.d.cts.map +1 -1
- package/dist/email.d.mts +16 -6
- package/dist/email.d.mts.map +1 -1
- package/dist/email.mjs +23 -17
- package/dist/email.mjs.map +1 -1
- package/dist/encryption/kms.cjs +95 -0
- package/dist/encryption/kms.cjs.map +1 -0
- package/dist/encryption/kms.d.cts +7 -0
- package/dist/encryption/kms.d.cts.map +1 -0
- package/dist/encryption/kms.d.mts +7 -0
- package/dist/encryption/kms.d.mts.map +1 -0
- package/dist/encryption/kms.mjs +93 -0
- package/dist/encryption/kms.mjs.map +1 -0
- package/dist/encryption.cjs +116 -0
- package/dist/encryption.cjs.map +1 -0
- package/dist/encryption.d.cts +37 -0
- package/dist/encryption.d.cts.map +1 -0
- package/dist/encryption.d.mts +37 -0
- package/dist/encryption.d.mts.map +1 -0
- package/dist/encryption.mjs +101 -0
- package/dist/encryption.mjs.map +1 -0
- package/dist/endpoints/index.cjs +32 -10
- package/dist/endpoints/index.d.cts +106 -3
- package/dist/endpoints/index.d.cts.map +1 -0
- package/dist/endpoints/index.d.mts +106 -3
- package/dist/endpoints/index.d.mts.map +1 -0
- package/dist/endpoints/index.mjs +6 -4
- package/dist/expire-C586zznE.d.cts +38 -0
- package/dist/expire-C586zznE.d.cts.map +1 -0
- package/dist/expire-C586zznE.d.mts +38 -0
- package/dist/expire-C586zznE.d.mts.map +1 -0
- package/dist/expire-CieftS01.cjs +67 -0
- package/dist/expire-CieftS01.cjs.map +1 -0
- package/dist/expire-CpzUAfr9.mjs +50 -0
- package/dist/expire-CpzUAfr9.mjs.map +1 -0
- package/dist/external-api.cjs +106 -0
- package/dist/external-api.cjs.map +1 -0
- package/dist/external-api.d.cts +2 -0
- package/dist/external-api.d.mts +2 -0
- package/dist/external-api.mjs +103 -0
- package/dist/external-api.mjs.map +1 -0
- package/dist/fake-BvOXkZmj.d.mts +201 -0
- package/dist/fake-BvOXkZmj.d.mts.map +1 -0
- package/dist/fake-Djx8E0o1.d.cts +201 -0
- package/dist/fake-Djx8E0o1.d.cts.map +1 -0
- package/dist/file-server.cjs +200 -48
- package/dist/file-server.cjs.map +1 -1
- package/dist/file-server.d.cts +147 -15
- package/dist/file-server.d.cts.map +1 -1
- package/dist/file-server.d.mts +147 -15
- package/dist/file-server.d.mts.map +1 -1
- package/dist/file-server.mjs +198 -50
- package/dist/file-server.mjs.map +1 -1
- package/dist/functions/index.cjs +1 -1
- package/dist/functions/index.d.cts +2 -1
- package/dist/functions/index.d.mts +2 -1
- package/dist/functions/index.mjs +1 -1
- package/dist/{functions-C53GW2eQ.mjs → functions-BvIDQKAA.mjs} +117 -22
- package/dist/functions-BvIDQKAA.mjs.map +1 -0
- package/dist/{functions-B6qCvfmy.cjs → functions-DLF6-IK8.cjs} +122 -18
- package/dist/functions-DLF6-IK8.cjs.map +1 -0
- package/dist/inbox-BjvMs7EJ.d.cts +195 -0
- package/dist/inbox-BjvMs7EJ.d.cts.map +1 -0
- package/dist/inbox-C8bOR9UL.d.mts +195 -0
- package/dist/inbox-C8bOR9UL.d.mts.map +1 -0
- package/dist/inbox.cjs +291 -0
- package/dist/inbox.cjs.map +1 -0
- package/dist/inbox.d.cts +2 -0
- package/dist/inbox.d.mts +2 -0
- package/dist/inbox.mjs +283 -0
- package/dist/inbox.mjs.map +1 -0
- package/dist/index-DaK-C7N3.d.cts +115 -0
- package/dist/index-DaK-C7N3.d.cts.map +1 -0
- package/dist/{index-CeEtxDmK.d.cts → index-DdRjYhiJ.d.cts} +42 -2
- package/dist/{index-CeEtxDmK.d.cts.map → index-DdRjYhiJ.d.cts.map} +1 -1
- package/dist/{index-CeEtxDmK.d.mts → index-DdRjYhiJ.d.mts} +42 -2
- package/dist/{index-CeEtxDmK.d.mts.map → index-DdRjYhiJ.d.mts.map} +1 -1
- package/dist/index-vCS4HBEG.d.mts +115 -0
- package/dist/index-vCS4HBEG.d.mts.map +1 -0
- package/dist/index.cjs +4 -1
- package/dist/index.d.cts +26 -3
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +26 -3
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -2
- package/dist/kysely-2HqIQ2fC.d.cts +216 -0
- package/dist/kysely-2HqIQ2fC.d.cts.map +1 -0
- package/dist/kysely-BGvpd_ZH.d.mts +216 -0
- package/dist/kysely-BGvpd_ZH.d.mts.map +1 -0
- package/dist/kysely-Bc9xzaik.mjs +371 -0
- package/dist/kysely-Bc9xzaik.mjs.map +1 -0
- package/dist/kysely-D7f6J2lh.cjs +384 -0
- package/dist/kysely-D7f6J2lh.cjs.map +1 -0
- package/dist/{telemetry-DGcFlVpB.d.cts → lambdaTelemetry-8vnmVZQ5.d.cts} +2 -2
- package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +1 -0
- package/dist/{telemetry-DGcFlVpB.d.mts → lambdaTelemetry-8vnmVZQ5.d.mts} +2 -2
- package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +1 -0
- package/dist/mobile-app.cjs +78 -0
- package/dist/mobile-app.cjs.map +1 -0
- package/dist/mobile-app.d.cts +77 -0
- package/dist/mobile-app.d.cts.map +1 -0
- package/dist/mobile-app.d.mts +77 -0
- package/dist/mobile-app.d.mts.map +1 -0
- package/dist/mobile-app.mjs +77 -0
- package/dist/mobile-app.mjs.map +1 -0
- package/dist/object-storage.cjs +14 -7
- package/dist/object-storage.cjs.map +1 -1
- package/dist/object-storage.d.cts +12 -3
- package/dist/object-storage.d.cts.map +1 -1
- package/dist/object-storage.d.mts +12 -3
- package/dist/object-storage.d.mts.map +1 -1
- package/dist/object-storage.mjs +14 -9
- package/dist/object-storage.mjs.map +1 -1
- package/dist/optionalPeers-D7Wt6dnF.mjs +140 -0
- package/dist/optionalPeers-D7Wt6dnF.mjs.map +1 -0
- package/dist/optionalPeers-DuNQXXe1.cjs +223 -0
- package/dist/optionalPeers-DuNQXXe1.cjs.map +1 -0
- package/dist/origins-BjxYht13.cjs +96 -0
- package/dist/origins-BjxYht13.cjs.map +1 -0
- package/dist/origins-Boc9qbo-.mjs +73 -0
- package/dist/origins-Boc9qbo-.mjs.map +1 -0
- package/dist/pattern-C1CEcglD.mjs +241 -0
- package/dist/pattern-C1CEcglD.mjs.map +1 -0
- package/dist/pattern-QFaUIr77.cjs +288 -0
- package/dist/pattern-QFaUIr77.cjs.map +1 -0
- package/dist/privateAddress-Bg5fUsbp.mjs +21 -0
- package/dist/privateAddress-Bg5fUsbp.mjs.map +1 -0
- package/dist/privateAddress-CqGyuFHn.cjs +26 -0
- package/dist/privateAddress-CqGyuFHn.cjs.map +1 -0
- package/dist/processors/index.cjs +214 -0
- package/dist/processors/index.cjs.map +1 -0
- package/dist/processors/index.d.cts +78 -0
- package/dist/processors/index.d.cts.map +1 -0
- package/dist/processors/index.d.mts +78 -0
- package/dist/processors/index.d.mts.map +1 -0
- package/dist/processors/index.mjs +193 -0
- package/dist/processors/index.mjs.map +1 -0
- package/dist/queue/index.cjs +5 -192
- package/dist/queue/index.d.cts +3 -53
- package/dist/queue/index.d.mts +3 -53
- package/dist/queue/index.mjs +3 -190
- package/dist/random-password.cjs +86 -0
- package/dist/random-password.cjs.map +1 -0
- package/dist/random-password.d.cts +30 -0
- package/dist/random-password.d.cts.map +1 -0
- package/dist/random-password.d.mts +30 -0
- package/dist/random-password.d.mts.map +1 -0
- package/dist/random-password.mjs +84 -0
- package/dist/random-password.mjs.map +1 -0
- package/dist/readRequestBody-BmKnPl0a.mjs +293 -0
- package/dist/readRequestBody-BmKnPl0a.mjs.map +1 -0
- package/dist/{lazyAccessors-Dx9NLwJZ.cjs → readRequestBody-CN9GVdeE.cjs} +141 -47
- package/dist/readRequestBody-CN9GVdeE.cjs.map +1 -0
- package/dist/{processAudits-D_2W5x8k.cjs → requestLogger-CnoYd-Ah.cjs} +63 -3
- package/dist/requestLogger-CnoYd-Ah.cjs.map +1 -0
- package/dist/{processAudits-BpRlPQMW.mjs → requestLogger-D2JS7pPM.mjs} +51 -3
- package/dist/requestLogger-D2JS7pPM.mjs.map +1 -0
- package/dist/rest-api.cjs +100 -73
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +83 -59
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +83 -59
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +97 -76
- package/dist/rest-api.mjs.map +1 -1
- package/dist/runSubscriber-HEqXkin1.mjs +117 -0
- package/dist/runSubscriber-HEqXkin1.mjs.map +1 -0
- package/dist/runSubscriber-sVJfLA0-.cjs +134 -0
- package/dist/runSubscriber-sVJfLA0-.cjs.map +1 -0
- package/dist/shutdown-BMJmAhSt.cjs +38 -0
- package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
- package/dist/shutdown-C7xa8x9S.mjs +27 -0
- package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
- package/dist/site.cjs +137 -10
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +153 -3
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +153 -3
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +117 -13
- package/dist/site.mjs.map +1 -1
- package/dist/stages-DaTaoQei.d.cts +73 -0
- package/dist/stages-DaTaoQei.d.cts.map +1 -0
- package/dist/stages-DaTaoQei.d.mts +73 -0
- package/dist/stages-DaTaoQei.d.mts.map +1 -0
- package/dist/subscribers/index.cjs +134 -1
- package/dist/subscribers/index.cjs.map +1 -0
- package/dist/subscribers/index.d.cts +74 -3
- package/dist/subscribers/index.d.cts.map +1 -0
- package/dist/subscribers/index.d.mts +74 -3
- package/dist/subscribers/index.d.mts.map +1 -0
- package/dist/subscribers/index.mjs +132 -2
- package/dist/subscribers/index.mjs.map +1 -0
- package/dist/telemetry-BirKau0X.d.mts +40 -0
- package/dist/telemetry-BirKau0X.d.mts.map +1 -0
- package/dist/telemetry-DjJgtQ_N.d.cts +40 -0
- package/dist/telemetry-DjJgtQ_N.d.cts.map +1 -0
- package/dist/telemetry.cjs +56 -0
- package/dist/telemetry.cjs.map +1 -0
- package/dist/telemetry.d.cts +2 -0
- package/dist/telemetry.d.mts +2 -0
- package/dist/telemetry.mjs +55 -0
- package/dist/telemetry.mjs.map +1 -0
- package/dist/topic/index.cjs +2 -134
- package/dist/topic/index.d.cts +2 -3
- package/dist/topic/index.d.mts +2 -3
- package/dist/topic/index.mjs +2 -132
- package/dist/tracing-Bbj1uoFJ.mjs +127 -0
- package/dist/tracing-Bbj1uoFJ.mjs.map +1 -0
- package/dist/tracing-C0ooU0V2.cjs +150 -0
- package/dist/tracing-C0ooU0V2.cjs.map +1 -0
- package/dist/websocket-api-C6LGg9-D.mjs +1716 -0
- package/dist/websocket-api-C6LGg9-D.mjs.map +1 -0
- package/dist/websocket-api-CD-E5Ogr.d.cts +1207 -0
- package/dist/websocket-api-CD-E5Ogr.d.cts.map +1 -0
- package/dist/websocket-api-CoKPJJRl.cjs +1895 -0
- package/dist/websocket-api-CoKPJJRl.cjs.map +1 -0
- package/dist/websocket-api-pJJfeTcm.d.mts +1207 -0
- package/dist/websocket-api-pJJfeTcm.d.mts.map +1 -0
- package/dist/websocket-api.cjs +42 -0
- package/dist/websocket-api.d.cts +2 -0
- package/dist/websocket-api.d.mts +2 -0
- package/dist/websocket-api.mjs +3 -0
- package/dist/worker.cjs +174 -32
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +147 -47
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +147 -47
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +175 -33
- package/dist/worker.mjs.map +1 -1
- package/package.json +180 -43
- package/dist/Construct-BeYVu_QF.mjs.map +0 -1
- package/dist/Construct-DfbwIntp.d.cts +0 -115
- package/dist/Construct-DfbwIntp.d.cts.map +0 -1
- package/dist/Construct-DqdlARxq.cjs.map +0 -1
- package/dist/Construct-l5aOn_jv.d.mts +0 -115
- package/dist/Construct-l5aOn_jv.d.mts.map +0 -1
- package/dist/Cron-l4Wlz6G9.d.mts.map +0 -1
- package/dist/Cron-zsoSAwZo.d.cts.map +0 -1
- package/dist/CronBuilder-BdnI6lxF.cjs.map +0 -1
- package/dist/CronBuilder-CyT71Nzg.d.cts +0 -41
- package/dist/CronBuilder-CyT71Nzg.d.cts.map +0 -1
- package/dist/CronBuilder-D_0HNBTr.mjs.map +0 -1
- package/dist/CronBuilder-UoNgFe8S.d.mts +0 -41
- package/dist/CronBuilder-UoNgFe8S.d.mts.map +0 -1
- package/dist/Endpoint-BpZHtJ2W.cjs +0 -1689
- package/dist/Endpoint-BpZHtJ2W.cjs.map +0 -1
- package/dist/Endpoint-DBflWAe4.d.cts.map +0 -1
- package/dist/Endpoint-ONsly_dq.mjs +0 -1671
- package/dist/Endpoint-ONsly_dq.mjs.map +0 -1
- package/dist/Endpoint-oS-Fe3d_.d.mts.map +0 -1
- package/dist/EndpointFactory-Bm3aKRdV.mjs.map +0 -1
- package/dist/EndpointFactory-CLvWuHyt.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-92zavCsV.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-yYaU7jVJ.mjs.map +0 -1
- package/dist/Queue-D9X6OoON.d.mts.map +0 -1
- package/dist/Queue-DYPB2KWL.d.cts.map +0 -1
- package/dist/Subscriber-C4heaAyO.d.mts +0 -51
- package/dist/Subscriber-C4heaAyO.d.mts.map +0 -1
- package/dist/Subscriber-CotDUELC.d.cts +0 -51
- package/dist/Subscriber-CotDUELC.d.cts.map +0 -1
- package/dist/SubscriberBuilder-BEv0eoHy.d.cts +0 -59
- package/dist/SubscriberBuilder-BEv0eoHy.d.cts.map +0 -1
- package/dist/SubscriberBuilder-C0ZEtGDI.cjs +0 -125
- package/dist/SubscriberBuilder-C0ZEtGDI.cjs.map +0 -1
- package/dist/SubscriberBuilder-h7B_cHMr.mjs +0 -114
- package/dist/SubscriberBuilder-h7B_cHMr.mjs.map +0 -1
- package/dist/SubscriberBuilder-tyH5yTk5.d.mts +0 -59
- package/dist/SubscriberBuilder-tyH5yTk5.d.mts.map +0 -1
- package/dist/Topic-DEVGo0Dm.d.cts +0 -89
- package/dist/Topic-DEVGo0Dm.d.cts.map +0 -1
- package/dist/Topic-zk_6Gthr.d.mts +0 -89
- package/dist/Topic-zk_6Gthr.d.mts.map +0 -1
- package/dist/auth.d.cts.map +0 -1
- package/dist/auth.d.mts.map +0 -1
- package/dist/cache.d.cts.map +0 -1
- package/dist/cache.d.mts.map +0 -1
- package/dist/construct-interface-DPlxfpoS.d.mts.map +0 -1
- package/dist/construct-interface-DgXTJcOD.d.cts.map +0 -1
- package/dist/credential.cjs.map +0 -1
- package/dist/credential.d.cts.map +0 -1
- package/dist/credential.d.mts.map +0 -1
- package/dist/credential.mjs.map +0 -1
- package/dist/database/kysely.cjs.map +0 -1
- package/dist/database/kysely.d.cts.map +0 -1
- package/dist/database/kysely.d.mts.map +0 -1
- package/dist/database/kysely.mjs.map +0 -1
- package/dist/functions-B6qCvfmy.cjs.map +0 -1
- package/dist/functions-C53GW2eQ.mjs.map +0 -1
- package/dist/index-B2urf3YI.d.cts +0 -26
- package/dist/index-B2urf3YI.d.cts.map +0 -1
- package/dist/index-C1ZwNOOk.d.cts.map +0 -1
- package/dist/index-Cc4kKPag.d.mts.map +0 -1
- package/dist/index-DMCDvnsM.d.mts +0 -26
- package/dist/index-DMCDvnsM.d.mts.map +0 -1
- package/dist/index-D_frT6MP.d.cts +0 -165
- package/dist/index-D_frT6MP.d.cts.map +0 -1
- package/dist/index-DcyIYbDS.d.mts +0 -165
- package/dist/index-DcyIYbDS.d.mts.map +0 -1
- package/dist/lazyAccessors-BHtcqgz2.mjs +0 -211
- package/dist/lazyAccessors-BHtcqgz2.mjs.map +0 -1
- package/dist/lazyAccessors-Dx9NLwJZ.cjs.map +0 -1
- package/dist/processAudits-BpRlPQMW.mjs.map +0 -1
- package/dist/processAudits-D_2W5x8k.cjs.map +0 -1
- package/dist/queue/index.cjs.map +0 -1
- package/dist/queue/index.d.cts.map +0 -1
- package/dist/queue/index.d.mts.map +0 -1
- package/dist/queue/index.mjs.map +0 -1
- package/dist/telemetry-DGcFlVpB.d.cts.map +0 -1
- package/dist/telemetry-DGcFlVpB.d.mts.map +0 -1
- package/dist/topic/index.cjs.map +0 -1
- package/dist/topic/index.mjs.map +0 -1
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
require("./Construct-DorKS0Ua.cjs");
|
|
2
|
+
const require_tracing = require("./tracing-C0ooU0V2.cjs");
|
|
3
|
+
const require_functions = require("./functions-DLF6-IK8.cjs");
|
|
4
|
+
let _geekmidas_schema_conversion = require("@geekmidas/schema/conversion");
|
|
5
|
+
let _geekmidas_schema_openapi = require("@geekmidas/schema/openapi");
|
|
6
|
+
//#region src/endpoints/sessionAuth.ts
|
|
7
|
+
/**
|
|
8
|
+
* What is forwarded to the auth server: the headers a session travels in,
|
|
9
|
+
* whose request it is, and the origin it came from — nothing else.
|
|
10
|
+
*
|
|
11
|
+
* The client's address goes with the session because the auth server
|
|
12
|
+
* rate-limits by it, `/get-session` included. Without it every user's session
|
|
13
|
+
* check arrived from the surface itself — one shared bucket, so enough
|
|
14
|
+
* traffic from anyone turned every session check into a 429 — and in tests,
|
|
15
|
+
* concurrent tests queued on the same rate-limit row.
|
|
16
|
+
*
|
|
17
|
+
* The origin, because the surface calls the auth server at its public
|
|
18
|
+
* address, through the edge: it is what lets the auth server continue this
|
|
19
|
+
* request's trace for a site both trust.
|
|
20
|
+
*/
|
|
21
|
+
const SESSION_HEADERS = [
|
|
22
|
+
"cookie",
|
|
23
|
+
"authorization",
|
|
24
|
+
"x-forwarded-for",
|
|
25
|
+
"origin"
|
|
26
|
+
];
|
|
27
|
+
/** `auth` for one request on one surface. */
|
|
28
|
+
function sessionAuth(surface, header) {
|
|
29
|
+
return { async getSession() {
|
|
30
|
+
const authenticator = surface?.auth;
|
|
31
|
+
if (!surface || !authenticator) throw new NoAuthenticator(surface?.id);
|
|
32
|
+
const headers = new Headers();
|
|
33
|
+
for (const name of SESSION_HEADERS) {
|
|
34
|
+
const value = header(name);
|
|
35
|
+
if (value) headers.set(name, value);
|
|
36
|
+
}
|
|
37
|
+
const session = await authenticator.verify(headers, surface.envParser);
|
|
38
|
+
const identity = session;
|
|
39
|
+
if (typeof identity?.user?.id === "string") require_tracing.identifyUser({
|
|
40
|
+
id: identity.user.id,
|
|
41
|
+
...typeof identity.session?.id === "string" ? { sessionId: identity.session.id } : {}
|
|
42
|
+
});
|
|
43
|
+
return session;
|
|
44
|
+
} };
|
|
45
|
+
}
|
|
46
|
+
/** `auth.getSession()` was called on a surface that names no authenticator. */
|
|
47
|
+
var NoAuthenticator = class extends Error {
|
|
48
|
+
surface;
|
|
49
|
+
constructor(surface) {
|
|
50
|
+
super(`auth.getSession() needs an authenticator, and ${surface ? `the surface '${surface}'` : "this endpoint"} declares none: declare one on the surface with .auth(construct).`);
|
|
51
|
+
this.surface = surface;
|
|
52
|
+
this.name = "NoAuthenticator";
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/endpoints/Endpoint.ts
|
|
57
|
+
/**
|
|
58
|
+
* Represents an HTTP endpoint that can handle requests with type-safe input/output validation,
|
|
59
|
+
* dependency injection, session management, and authorization.
|
|
60
|
+
*
|
|
61
|
+
* @template TRoute - The route path string with parameter placeholders (e.g., '/users/:id')
|
|
62
|
+
* @template TMethod - The HTTP method (GET, POST, PUT, DELETE, PATCH)
|
|
63
|
+
* @template TInput - The input schema definition for body, query, and path parameters
|
|
64
|
+
* @template OutSchema - The output schema for response validation
|
|
65
|
+
* @template TServices - Array of service dependencies to inject
|
|
66
|
+
* @template TLogger - The logger instance type
|
|
67
|
+
* @template TSession - The session data type
|
|
68
|
+
*
|
|
69
|
+
* @extends Function - Base function construct for handler execution
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const endpoint = new Endpoint({
|
|
74
|
+
* route: '/users/:id',
|
|
75
|
+
* method: 'GET',
|
|
76
|
+
* input: { params: userIdSchema },
|
|
77
|
+
* output: userSchema,
|
|
78
|
+
* fn: async ({ params }) => getUserById(params.id)
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
var Endpoint = class Endpoint extends require_functions.Function {
|
|
83
|
+
operationId;
|
|
84
|
+
/** The route path pattern with parameter placeholders */
|
|
85
|
+
route;
|
|
86
|
+
/** The HTTP method for this endpoint */
|
|
87
|
+
method;
|
|
88
|
+
/**
|
|
89
|
+
* The surface that serves it, when it was built from one.
|
|
90
|
+
*
|
|
91
|
+
* Carries the env parser the adaptors need, so a generated handler needs no
|
|
92
|
+
* import written for it — and the surface's id, so the build attributes the
|
|
93
|
+
* route to the API that serves it rather than inferring it by exclusion.
|
|
94
|
+
*/
|
|
95
|
+
surface;
|
|
96
|
+
/** Optional description for OpenAPI documentation */
|
|
97
|
+
description;
|
|
98
|
+
/** Optional tags for OpenAPI documentation */
|
|
99
|
+
tags;
|
|
100
|
+
/** The HTTP status code to return (default: 200) */
|
|
101
|
+
status;
|
|
102
|
+
/**
|
|
103
|
+
* Response content type for this endpoint. Defaults to `'application/json'`.
|
|
104
|
+
* Non-JSON types cause adaptors to emit the body as-is with the declared
|
|
105
|
+
* Content-Type header instead of JSON-serializing.
|
|
106
|
+
*/
|
|
107
|
+
responseType;
|
|
108
|
+
/**
|
|
109
|
+
* This route's telemetry — `.telemetry({ ignore, attributes })` — read by
|
|
110
|
+
* the build, which hands it to the request middleware.
|
|
111
|
+
*/
|
|
112
|
+
telemetry;
|
|
113
|
+
/** Default headers to apply to all responses */
|
|
114
|
+
defaultHeaders = {};
|
|
115
|
+
/** Function to extract session data from the request context */
|
|
116
|
+
getSession = () => ({});
|
|
117
|
+
/**
|
|
118
|
+
* Whether a session callback was given — `.session()` on the factory it was
|
|
119
|
+
* built from. A generated handler reads the session only when it is, so
|
|
120
|
+
* an endpoint with a session and no authorizer must say so: it used to be
|
|
121
|
+
* handed `undefined` in a production build and its session in `gkm dev`.
|
|
122
|
+
*/
|
|
123
|
+
hasSession = false;
|
|
124
|
+
/** Function to determine if the request is authorized */
|
|
125
|
+
authorize = () => true;
|
|
126
|
+
/** Optional rate limiting configuration */
|
|
127
|
+
rateLimit;
|
|
128
|
+
/** Optional authorizer for this endpoint */
|
|
129
|
+
authorizer;
|
|
130
|
+
/** Optional actor extractor for audit records */
|
|
131
|
+
actorExtractor;
|
|
132
|
+
/** Declarative audit definitions */
|
|
133
|
+
audits = [];
|
|
134
|
+
/** RLS configuration for this endpoint */
|
|
135
|
+
rlsConfig;
|
|
136
|
+
/** Whether to bypass RLS for this endpoint */
|
|
137
|
+
rlsBypass;
|
|
138
|
+
/** The endpoint handler function */
|
|
139
|
+
endpointFn;
|
|
140
|
+
/**
|
|
141
|
+
* Builds a complete OpenAPI 3.1 schema from an array of endpoints.
|
|
142
|
+
*
|
|
143
|
+
* @param endpoints - Array of endpoint instances to document
|
|
144
|
+
* @param options - Optional configuration for OpenAPI generation
|
|
145
|
+
* @returns OpenAPI 3.1 specification object
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const schema = await Endpoint.buildOpenApiSchema([
|
|
150
|
+
* getUserEndpoint,
|
|
151
|
+
* createUserEndpoint
|
|
152
|
+
* ], {
|
|
153
|
+
* title: 'User API',
|
|
154
|
+
* version: '1.0.0'
|
|
155
|
+
* });
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
static async buildOpenApiSchema(endpoints, options) {
|
|
159
|
+
return (0, _geekmidas_schema_openapi.buildOpenApiSchema)(endpoints, options);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Gets the full path including HTTP method and route.
|
|
163
|
+
* @returns Formatted string like 'GET /users/{id}'
|
|
164
|
+
*/
|
|
165
|
+
get fullPath() {
|
|
166
|
+
return `${this.method} ${this._path}`;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Parses and validates input data for a specific input type (body, query, params).
|
|
170
|
+
*
|
|
171
|
+
* @param input - The raw input data to validate
|
|
172
|
+
* @param key - The input type key ('body', 'query', or 'params')
|
|
173
|
+
* @returns The validated input data for the specified key
|
|
174
|
+
* @throws {UnprocessableEntityError} When validation fails
|
|
175
|
+
*/
|
|
176
|
+
async parseInput(input, key) {
|
|
177
|
+
const schema = this.input?.[key];
|
|
178
|
+
return Endpoint.parseSchema(schema, input);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Parses and validates the request body against the body schema.
|
|
182
|
+
*
|
|
183
|
+
* @param body - The raw request body to validate
|
|
184
|
+
* @returns The validated body data
|
|
185
|
+
* @throws {UnprocessableEntityError} When body validation fails
|
|
186
|
+
*/
|
|
187
|
+
async parseBody(body) {
|
|
188
|
+
return this.parseInput(body, "body");
|
|
189
|
+
}
|
|
190
|
+
static isSuccessStatus(status) {
|
|
191
|
+
return status >= 200 && status < 300;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Whether `status` sends the client elsewhere. A redirect has no body, so
|
|
195
|
+
* its response is not checked against the output schema, and what is
|
|
196
|
+
* derived from the output — declared events and audits — is not sent.
|
|
197
|
+
*/
|
|
198
|
+
static isRedirectStatus(status) {
|
|
199
|
+
return status !== void 0 && status >= 300 && status < 400;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Creates a case-insensitive header lookup function from a headers object.
|
|
203
|
+
*
|
|
204
|
+
* @param headers - Object containing header key-value pairs
|
|
205
|
+
* @returns Function to retrieve header values by case-insensitive key, or all headers
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const headerFn = Endpoint.createHeaders({ 'Content-Type': 'application/json' });
|
|
210
|
+
* headerFn('content-type'); // Returns 'application/json'
|
|
211
|
+
* headerFn(); // Returns { 'content-type': 'application/json' }
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
static createHeaders(headers) {
|
|
215
|
+
const headerMap = /* @__PURE__ */ new Map();
|
|
216
|
+
for (const [k, v] of Object.entries(headers)) {
|
|
217
|
+
const key = k.toLowerCase();
|
|
218
|
+
headerMap.set(key, v);
|
|
219
|
+
}
|
|
220
|
+
function get(key) {
|
|
221
|
+
if (key === void 0) return Object.fromEntries(headerMap.entries());
|
|
222
|
+
return headerMap.get(key.toLowerCase());
|
|
223
|
+
}
|
|
224
|
+
return get;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Parses cookie string and creates a cookie lookup function.
|
|
228
|
+
*
|
|
229
|
+
* @param cookieHeader - The Cookie header value
|
|
230
|
+
* @returns Function to retrieve cookie values by name, or all cookies
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```typescript
|
|
234
|
+
* const cookieFn = Endpoint.createCookies('session=abc123; theme=dark');
|
|
235
|
+
* cookieFn('session'); // Returns 'abc123'
|
|
236
|
+
* cookieFn(); // Returns { session: 'abc123', theme: 'dark' }
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
static createCookies(cookieHeader) {
|
|
240
|
+
const cookieMap = /* @__PURE__ */ new Map();
|
|
241
|
+
if (cookieHeader) {
|
|
242
|
+
const cookies = cookieHeader.split(";");
|
|
243
|
+
for (const cookie of cookies) {
|
|
244
|
+
const [name, ...valueParts] = cookie.trim().split("=");
|
|
245
|
+
if (name) {
|
|
246
|
+
const value = valueParts.join("=");
|
|
247
|
+
cookieMap.set(name, decodeURIComponent(value));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function get(name) {
|
|
252
|
+
if (name === void 0) return Object.fromEntries(cookieMap.entries());
|
|
253
|
+
return cookieMap.get(name);
|
|
254
|
+
}
|
|
255
|
+
return get;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Formats a cookie as a Set-Cookie header string.
|
|
259
|
+
*
|
|
260
|
+
* @param name - Cookie name
|
|
261
|
+
* @param value - Cookie value
|
|
262
|
+
* @param options - Cookie options (httpOnly, secure, sameSite, etc.)
|
|
263
|
+
* @returns Formatted Set-Cookie header string
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```typescript
|
|
267
|
+
* const header = Endpoint.formatCookieHeader('session', 'abc123', {
|
|
268
|
+
* httpOnly: true,
|
|
269
|
+
* secure: true,
|
|
270
|
+
* sameSite: 'strict',
|
|
271
|
+
* maxAge: 3600
|
|
272
|
+
* });
|
|
273
|
+
* // Returns: "session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=Strict"
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
static formatCookieHeader(name, value, options) {
|
|
277
|
+
let cookie = `${name}=${value}`;
|
|
278
|
+
if (options) {
|
|
279
|
+
if (options.domain) cookie += `; Domain=${options.domain}`;
|
|
280
|
+
if (options.path) cookie += `; Path=${options.path}`;
|
|
281
|
+
if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
282
|
+
if (options.maxAge !== void 0) cookie += `; Max-Age=${options.maxAge}`;
|
|
283
|
+
if (options.httpOnly) cookie += "; HttpOnly";
|
|
284
|
+
if (options.secure) cookie += "; Secure";
|
|
285
|
+
if (options.sameSite) cookie += `; SameSite=${options.sameSite.charAt(0).toUpperCase() + options.sameSite.slice(1)}`;
|
|
286
|
+
}
|
|
287
|
+
return cookie;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Extracts and refines input data from the endpoint context.
|
|
291
|
+
*
|
|
292
|
+
* @param ctx - The endpoint execution context
|
|
293
|
+
* @returns Object containing only the input data (body, query, params)
|
|
294
|
+
* @internal
|
|
295
|
+
*/
|
|
296
|
+
refineInput(ctx) {
|
|
297
|
+
const input = {};
|
|
298
|
+
for (const key of [
|
|
299
|
+
"body",
|
|
300
|
+
"query",
|
|
301
|
+
"params"
|
|
302
|
+
]) if (key in ctx) input[key] = ctx[key];
|
|
303
|
+
return input;
|
|
304
|
+
}
|
|
305
|
+
handler = (ctx, response) => {
|
|
306
|
+
for (const [key, value] of Object.entries(this.defaultHeaders)) response.header(key, value);
|
|
307
|
+
const handlerCtx = {
|
|
308
|
+
...this.refineInput(ctx),
|
|
309
|
+
services: ctx.services,
|
|
310
|
+
logger: ctx.logger,
|
|
311
|
+
header: ctx.header,
|
|
312
|
+
cookie: ctx.cookie,
|
|
313
|
+
session: ctx.session,
|
|
314
|
+
..."auditor" in ctx && { auditor: ctx.auditor },
|
|
315
|
+
..."db" in ctx && { db: ctx.db }
|
|
316
|
+
};
|
|
317
|
+
return this.endpointFn(handlerCtx, response);
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Type guard to check if an object is an Endpoint instance.
|
|
321
|
+
*
|
|
322
|
+
* @param obj - The object to check
|
|
323
|
+
* @returns True if the object is an Endpoint
|
|
324
|
+
*/
|
|
325
|
+
static isEndpoint(obj) {
|
|
326
|
+
return Boolean(obj && obj.__IS_FUNCTION__ === true && obj.type === "dev.geekmidas.function.endpoint");
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Helper to check if response has metadata
|
|
330
|
+
*/
|
|
331
|
+
static hasMetadata(response) {
|
|
332
|
+
return response !== null && typeof response === "object" && "data" in response && "metadata" in response;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Converts Express-style route params to OpenAPI format.
|
|
336
|
+
* @returns Route with ':param' converted to '{param}'
|
|
337
|
+
* @internal
|
|
338
|
+
*/
|
|
339
|
+
get _path() {
|
|
340
|
+
return this.route.replace(/:(\w+)/g, "{$1}");
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Generates OpenAPI 3.1 schema for this endpoint.
|
|
344
|
+
*
|
|
345
|
+
* @returns OpenAPI route definition with operation details
|
|
346
|
+
*/
|
|
347
|
+
async toOpenApi3Route(componentCollector) {
|
|
348
|
+
const status = String(this.status);
|
|
349
|
+
const operation = {
|
|
350
|
+
operationId: this.operationId,
|
|
351
|
+
...this.description && { description: this.description },
|
|
352
|
+
...this.tags && this.tags.length > 0 && { tags: this.tags },
|
|
353
|
+
responses: { [status]: { description: "Successful response" } }
|
|
354
|
+
};
|
|
355
|
+
const scheme = this.authorizer?.securityScheme;
|
|
356
|
+
if (this.authorizer && scheme && componentCollector) {
|
|
357
|
+
componentCollector.addSecurityScheme(this.authorizer.name, scheme);
|
|
358
|
+
operation.security = [{ [this.authorizer.name]: [] }];
|
|
359
|
+
}
|
|
360
|
+
if (this.outputSchema) {
|
|
361
|
+
const responseSchema = await (0, _geekmidas_schema_conversion.convertSchemaWithComponents)(this.outputSchema, componentCollector);
|
|
362
|
+
if (responseSchema) operation.responses[status].content = { [this.responseType]: { schema: responseSchema } };
|
|
363
|
+
}
|
|
364
|
+
const pathParameters = [];
|
|
365
|
+
const queryParameters = [];
|
|
366
|
+
if (this.input && typeof this.input === "object") {
|
|
367
|
+
if ([
|
|
368
|
+
"POST",
|
|
369
|
+
"PUT",
|
|
370
|
+
"PATCH"
|
|
371
|
+
].includes(this.method) && "body" in this.input && this.input.body) {
|
|
372
|
+
const bodySchema = await (0, _geekmidas_schema_conversion.convertSchemaWithComponents)(this.input.body, componentCollector);
|
|
373
|
+
if (bodySchema) operation.requestBody = {
|
|
374
|
+
required: true,
|
|
375
|
+
content: { "application/json": { schema: bodySchema } }
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
if ("params" in this.input && this.input.params) {
|
|
379
|
+
const paramsSchema = await (0, _geekmidas_schema_conversion.convertStandardSchemaToJsonSchema)(this.input.params);
|
|
380
|
+
if (paramsSchema && paramsSchema.type === "object" && paramsSchema.properties) for (const [name, schema] of Object.entries(paramsSchema.properties)) pathParameters.push({
|
|
381
|
+
name,
|
|
382
|
+
in: "path",
|
|
383
|
+
required: paramsSchema.required?.includes(name) ?? true,
|
|
384
|
+
schema
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
if ("query" in this.input && this.input.query) {
|
|
388
|
+
const querySchema = await (0, _geekmidas_schema_conversion.convertStandardSchemaToJsonSchema)(this.input.query);
|
|
389
|
+
if (querySchema && querySchema.type === "object" && querySchema.properties) for (const [name, schema] of Object.entries(querySchema.properties)) queryParameters.push({
|
|
390
|
+
name,
|
|
391
|
+
in: "query",
|
|
392
|
+
required: querySchema.required?.includes(name) ?? false,
|
|
393
|
+
schema
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (queryParameters.length > 0) operation.parameters = queryParameters;
|
|
398
|
+
const routeObject = {};
|
|
399
|
+
if (pathParameters.length > 0) routeObject.parameters = pathParameters;
|
|
400
|
+
routeObject[this.method.toLowerCase()] = operation;
|
|
401
|
+
return { [this._path]: routeObject };
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Creates a new Endpoint instance.
|
|
405
|
+
*
|
|
406
|
+
* @param options - Configuration options for the endpoint
|
|
407
|
+
* @param options.fn - The handler function to execute
|
|
408
|
+
* @param options.method - HTTP method
|
|
409
|
+
* @param options.route - Route path with parameter placeholders
|
|
410
|
+
* @param options.description - Optional description for documentation
|
|
411
|
+
* @param options.input - Input schemas for validation
|
|
412
|
+
* @param options.logger - Logger instance
|
|
413
|
+
* @param options.output - Output schema for response validation
|
|
414
|
+
* @param options.services - Service dependencies
|
|
415
|
+
* @param options.timeout - Execution timeout in milliseconds
|
|
416
|
+
* @param options.getSession - Session extraction function
|
|
417
|
+
* @param options.authorize - Authorization check function
|
|
418
|
+
* @param options.status - Success HTTP status code (default: 200)
|
|
419
|
+
* @param options.authorizer - Optional authorizer configuration
|
|
420
|
+
*/
|
|
421
|
+
constructor({ fn, method, route, description, tags, input, logger, output: outputSchema, services, constructs, timeout, memorySize, getSession, authorize, rateLimit, status = 200, events, authorizer, surface, auditorStorageService, actorExtractor, audits, databaseService, rlsConfig, rlsBypass, responseType, telemetry }) {
|
|
422
|
+
super(fn, timeout, "dev.geekmidas.function.endpoint", input, outputSchema, services, logger, events, memorySize, auditorStorageService, void 0, constructs);
|
|
423
|
+
this.route = route;
|
|
424
|
+
this.method = method;
|
|
425
|
+
this.description = description;
|
|
426
|
+
this.tags = tags;
|
|
427
|
+
this.status = status;
|
|
428
|
+
this.responseType = responseType ?? "application/json";
|
|
429
|
+
this.endpointFn = fn;
|
|
430
|
+
if (telemetry) this.telemetry = telemetry;
|
|
431
|
+
if (getSession) {
|
|
432
|
+
this.hasSession = true;
|
|
433
|
+
this.getSession = (ctx) => getSession({
|
|
434
|
+
...ctx,
|
|
435
|
+
auth: sessionAuth(surface, ctx.header)
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
if (authorize) this.authorize = authorize;
|
|
439
|
+
if (rateLimit) this.rateLimit = rateLimit;
|
|
440
|
+
if (authorizer) this.authorizer = authorizer;
|
|
441
|
+
this.surface = surface;
|
|
442
|
+
if (actorExtractor) this.actorExtractor = actorExtractor;
|
|
443
|
+
if (audits) this.audits = audits;
|
|
444
|
+
if (databaseService) this.databaseService = databaseService;
|
|
445
|
+
if (rlsConfig) this.rlsConfig = rlsConfig;
|
|
446
|
+
if (rlsBypass) this.rlsBypass = rlsBypass;
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
/**
|
|
450
|
+
* Response builder for fluent API in handlers
|
|
451
|
+
*/
|
|
452
|
+
var ResponseBuilder = class {
|
|
453
|
+
metadata = {
|
|
454
|
+
headers: {},
|
|
455
|
+
cookies: /* @__PURE__ */ new Map()
|
|
456
|
+
};
|
|
457
|
+
header(key, value) {
|
|
458
|
+
this.metadata.headers[key] = value;
|
|
459
|
+
return this;
|
|
460
|
+
}
|
|
461
|
+
cookie(name, value, options) {
|
|
462
|
+
this.metadata.cookies?.set(name, {
|
|
463
|
+
value,
|
|
464
|
+
options
|
|
465
|
+
});
|
|
466
|
+
return this;
|
|
467
|
+
}
|
|
468
|
+
deleteCookie(name, options) {
|
|
469
|
+
this.metadata.cookies?.set(name, {
|
|
470
|
+
value: "",
|
|
471
|
+
options: {
|
|
472
|
+
...options,
|
|
473
|
+
maxAge: 0,
|
|
474
|
+
expires: /* @__PURE__ */ new Date(0)
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
return this;
|
|
478
|
+
}
|
|
479
|
+
status(code) {
|
|
480
|
+
this.metadata.status = code;
|
|
481
|
+
return this;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Send the client to `url` — `Location` and a 3xx, with no body. 303 by
|
|
485
|
+
* default: after a form post, the browser follows it with a GET, so a
|
|
486
|
+
* reload does not post the form again.
|
|
487
|
+
*
|
|
488
|
+
* A redirect is not checked against the endpoint's `.output()` schema, so
|
|
489
|
+
* an endpoint that renders a page can redirect instead.
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* ```typescript
|
|
493
|
+
* return response.cookie('session', token).redirect('/dashboard');
|
|
494
|
+
* ```
|
|
495
|
+
*/
|
|
496
|
+
redirect(url, status = 303) {
|
|
497
|
+
this.metadata.headers.location = url;
|
|
498
|
+
this.metadata.status = status;
|
|
499
|
+
return {
|
|
500
|
+
data: void 0,
|
|
501
|
+
metadata: this.metadata
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
send(data) {
|
|
505
|
+
return {
|
|
506
|
+
data,
|
|
507
|
+
metadata: this.metadata
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
getMetadata() {
|
|
511
|
+
return this.metadata;
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
/**
|
|
515
|
+
* HTTP success status codes that can be returned by endpoints.
|
|
516
|
+
*/
|
|
517
|
+
let SuccessStatus = /* @__PURE__ */ function(SuccessStatus) {
|
|
518
|
+
/** Standard response for successful HTTP requests */
|
|
519
|
+
SuccessStatus[SuccessStatus["OK"] = 200] = "OK";
|
|
520
|
+
/** Request has been fulfilled and resulted in a new resource being created */
|
|
521
|
+
SuccessStatus[SuccessStatus["Created"] = 201] = "Created";
|
|
522
|
+
/** Request has been accepted for processing, but processing is not complete */
|
|
523
|
+
SuccessStatus[SuccessStatus["Accepted"] = 202] = "Accepted";
|
|
524
|
+
/** Server successfully processed the request but is not returning any content */
|
|
525
|
+
SuccessStatus[SuccessStatus["NoContent"] = 204] = "NoContent";
|
|
526
|
+
/** Server successfully processed the request and is not returning any content, client should reset the document view */
|
|
527
|
+
SuccessStatus[SuccessStatus["ResetContent"] = 205] = "ResetContent";
|
|
528
|
+
/** Server is delivering only part of the resource due to a range header */
|
|
529
|
+
SuccessStatus[SuccessStatus["PartialContent"] = 206] = "PartialContent";
|
|
530
|
+
return SuccessStatus;
|
|
531
|
+
}({});
|
|
532
|
+
/**
|
|
533
|
+
* HTTP redirect status codes an endpoint can answer with —
|
|
534
|
+
* `response.redirect(url, status)`, or `.status()` with a `Location` header.
|
|
535
|
+
*/
|
|
536
|
+
let RedirectStatus = /* @__PURE__ */ function(RedirectStatus) {
|
|
537
|
+
/** The resource has moved for good; a POST may become a GET */
|
|
538
|
+
RedirectStatus[RedirectStatus["MovedPermanently"] = 301] = "MovedPermanently";
|
|
539
|
+
/** The resource is elsewhere for now; a POST may become a GET */
|
|
540
|
+
RedirectStatus[RedirectStatus["Found"] = 302] = "Found";
|
|
541
|
+
/** See the resource elsewhere, with a GET — the answer to a form post */
|
|
542
|
+
RedirectStatus[RedirectStatus["SeeOther"] = 303] = "SeeOther";
|
|
543
|
+
/** The resource is elsewhere for now; the method and body are kept */
|
|
544
|
+
RedirectStatus[RedirectStatus["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
545
|
+
/** The resource has moved for good; the method and body are kept */
|
|
546
|
+
RedirectStatus[RedirectStatus["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
547
|
+
return RedirectStatus;
|
|
548
|
+
}({});
|
|
549
|
+
//#endregion
|
|
550
|
+
Object.defineProperty(exports, "Endpoint", {
|
|
551
|
+
enumerable: true,
|
|
552
|
+
get: function() {
|
|
553
|
+
return Endpoint;
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
Object.defineProperty(exports, "NoAuthenticator", {
|
|
557
|
+
enumerable: true,
|
|
558
|
+
get: function() {
|
|
559
|
+
return NoAuthenticator;
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
Object.defineProperty(exports, "RedirectStatus", {
|
|
563
|
+
enumerable: true,
|
|
564
|
+
get: function() {
|
|
565
|
+
return RedirectStatus;
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
Object.defineProperty(exports, "ResponseBuilder", {
|
|
569
|
+
enumerable: true,
|
|
570
|
+
get: function() {
|
|
571
|
+
return ResponseBuilder;
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
Object.defineProperty(exports, "SuccessStatus", {
|
|
575
|
+
enumerable: true,
|
|
576
|
+
get: function() {
|
|
577
|
+
return SuccessStatus;
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
//# sourceMappingURL=Endpoint-52z1P0Ue.cjs.map
|