@geekmidas/constructs 10.0.0-alpha.13 → 10.0.0-alpha.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +222 -158
- package/dist/Construct-127M7yrl.d.cts +231 -0
- package/dist/Construct-127M7yrl.d.cts.map +1 -0
- package/dist/{Construct-BeYVu_QF.mjs → Construct-CGuc_Ijk.mjs} +8 -9
- package/dist/Construct-CGuc_Ijk.mjs.map +1 -0
- package/dist/{Construct-DqdlARxq.cjs → Construct-DorKS0Ua.cjs} +8 -9
- package/dist/Construct-DorKS0Ua.cjs.map +1 -0
- package/dist/Construct-DySlwh8o.d.mts +231 -0
- package/dist/Construct-DySlwh8o.d.mts.map +1 -0
- package/dist/{Cron-DKqnnTdH.d.cts → Cron-CFkpEys6.d.cts} +14 -7
- package/dist/Cron-CFkpEys6.d.cts.map +1 -0
- package/dist/{Cron-SyqS5oWJ.d.mts → Cron-CQoDSu-n.d.mts} +14 -7
- package/dist/Cron-CQoDSu-n.d.mts.map +1 -0
- package/dist/CronBuilder-1W-G_i15.d.mts +47 -0
- package/dist/CronBuilder-1W-G_i15.d.mts.map +1 -0
- package/dist/{CronBuilder-D_0HNBTr.mjs → CronBuilder-BJ5LoadF.mjs} +28 -11
- package/dist/CronBuilder-BJ5LoadF.mjs.map +1 -0
- package/dist/{CronBuilder-BdnI6lxF.cjs → CronBuilder-B_NSP-Y5.cjs} +27 -10
- package/dist/CronBuilder-B_NSP-Y5.cjs.map +1 -0
- package/dist/CronBuilder-OaCRRFVk.d.cts +47 -0
- package/dist/CronBuilder-OaCRRFVk.d.cts.map +1 -0
- package/dist/{Endpoint-C6yyHpRS.d.cts → Endpoint-BEh-jW-f.d.cts} +122 -41
- package/dist/Endpoint-BEh-jW-f.d.cts.map +1 -0
- package/dist/Endpoint-BcUorcBa.cjs +576 -0
- package/dist/Endpoint-BcUorcBa.cjs.map +1 -0
- package/dist/Endpoint-BgvG36NO.mjs +547 -0
- package/dist/Endpoint-BgvG36NO.mjs.map +1 -0
- package/dist/{Endpoint-DuT4TEEq.d.mts → Endpoint-DTXDggNl.d.mts} +124 -43
- package/dist/Endpoint-DTXDggNl.d.mts.map +1 -0
- package/dist/{index-BPSZ_Lp_.d.cts → EndpointFactory-B2dCS9dy.d.cts} +187 -104
- package/dist/EndpointFactory-B2dCS9dy.d.cts.map +1 -0
- package/dist/{EndpointFactory-ptPR1cXw.mjs → EndpointFactory-C1NlpCAS.mjs} +270 -54
- package/dist/EndpointFactory-C1NlpCAS.mjs.map +1 -0
- package/dist/{index-BoZ-iisU.d.mts → EndpointFactory-D2HXcUrJ.d.mts} +188 -105
- package/dist/EndpointFactory-D2HXcUrJ.d.mts.map +1 -0
- package/dist/{EndpointFactory-M8OQKZRY.cjs → EndpointFactory-gqmIRVWg.cjs} +310 -52
- package/dist/EndpointFactory-gqmIRVWg.cjs.map +1 -0
- package/dist/Function-BIEsY0Hm.d.cts +76 -0
- package/dist/Function-BIEsY0Hm.d.cts.map +1 -0
- package/dist/Function-DfMzTGS4.d.mts +76 -0
- package/dist/Function-DfMzTGS4.d.mts.map +1 -0
- package/dist/{HonoEndpointAdaptor-7QagYKdP.cjs → HonoEndpointAdaptor-BJlj20fQ.cjs} +79 -31
- package/dist/HonoEndpointAdaptor-BJlj20fQ.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-CYHA0WAt.mjs → HonoEndpointAdaptor-BlbkUDNo.mjs} +76 -28
- package/dist/HonoEndpointAdaptor-BlbkUDNo.mjs.map +1 -0
- package/dist/ObjectSubscriberBuilder-HmBwFn2o.d.mts +129 -0
- package/dist/ObjectSubscriberBuilder-HmBwFn2o.d.mts.map +1 -0
- package/dist/ObjectSubscriberBuilder-l-64yUiF.d.cts +129 -0
- package/dist/ObjectSubscriberBuilder-l-64yUiF.d.cts.map +1 -0
- package/dist/ProcessorBuilder-B2_stA8f.d.mts +216 -0
- package/dist/ProcessorBuilder-B2_stA8f.d.mts.map +1 -0
- package/dist/ProcessorBuilder-C62bIOwj.d.cts +216 -0
- package/dist/ProcessorBuilder-C62bIOwj.d.cts.map +1 -0
- package/dist/{Queue-D9X6OoON.d.mts → Queue-BnK3UH8r.d.mts} +42 -41
- package/dist/Queue-BnK3UH8r.d.mts.map +1 -0
- package/dist/{Queue-DYPB2KWL.d.cts → Queue-C4rijiM7.d.cts} +43 -42
- package/dist/Queue-C4rijiM7.d.cts.map +1 -0
- package/dist/Queue-D4Iaidrs.cjs +109 -0
- package/dist/Queue-D4Iaidrs.cjs.map +1 -0
- package/dist/Queue-u8w8_HpE.mjs +104 -0
- package/dist/Queue-u8w8_HpE.mjs.map +1 -0
- package/dist/QueueBuilder-2wP5lEC8.mjs +118 -0
- package/dist/QueueBuilder-2wP5lEC8.mjs.map +1 -0
- package/dist/QueueBuilder-B3vL1ED2.d.mts +75 -0
- package/dist/QueueBuilder-B3vL1ED2.d.mts.map +1 -0
- package/dist/QueueBuilder-BcPBQSSX.d.cts +75 -0
- package/dist/QueueBuilder-BcPBQSSX.d.cts.map +1 -0
- package/dist/QueueBuilder-BxsZ9o5z.cjs +135 -0
- package/dist/QueueBuilder-BxsZ9o5z.cjs.map +1 -0
- package/dist/Subscriber-BdCtfFXL.d.cts +73 -0
- package/dist/Subscriber-BdCtfFXL.d.cts.map +1 -0
- package/dist/Subscriber-DDo4HFNn.d.mts +73 -0
- package/dist/Subscriber-DDo4HFNn.d.mts.map +1 -0
- package/dist/SubscriberBuilder-3msj1U2w.mjs +230 -0
- package/dist/SubscriberBuilder-3msj1U2w.mjs.map +1 -0
- package/dist/SubscriberBuilder-CQst6Iz3.cjs +253 -0
- package/dist/SubscriberBuilder-CQst6Iz3.cjs.map +1 -0
- package/dist/Topic-DN2gYJ-p.mjs +99 -0
- package/dist/Topic-DN2gYJ-p.mjs.map +1 -0
- package/dist/Topic-Dp9Q7Lj2.cjs +104 -0
- package/dist/Topic-Dp9Q7Lj2.cjs.map +1 -0
- package/dist/adaptors/aws.cjs +134 -160
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +57 -48
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +58 -49
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +130 -157
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +1 -1
- package/dist/adaptors/hono.d.cts +5 -6
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +6 -7
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +1 -1
- package/dist/adaptors/testing.cjs +824 -38
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +368 -39
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +367 -38
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +802 -34
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-BMCJN30Y.d.cts +268 -0
- package/dist/auth-BMCJN30Y.d.cts.map +1 -0
- package/dist/auth-D_0788uW.d.mts +268 -0
- package/dist/auth-D_0788uW.d.mts.map +1 -0
- package/dist/auth.cjs +289 -46
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +2 -104
- package/dist/auth.d.mts +2 -104
- package/dist/auth.mjs +285 -48
- package/dist/auth.mjs.map +1 -1
- package/dist/cache-5QZzh5Er.d.mts +44 -0
- package/dist/cache-5QZzh5Er.d.mts.map +1 -0
- package/dist/cache-DnGDGly3.d.cts +44 -0
- package/dist/cache-DnGDGly3.d.cts.map +1 -0
- package/dist/cache.d.cts +2 -43
- package/dist/cache.d.mts +2 -43
- package/dist/cipher-C1lEFX63.mjs +225 -0
- package/dist/cipher-C1lEFX63.mjs.map +1 -0
- package/dist/cipher-CVxfwLjk.cjs +332 -0
- package/dist/cipher-CVxfwLjk.cjs.map +1 -0
- package/dist/cipher-DSDxPRIp.d.cts +106 -0
- package/dist/cipher-DSDxPRIp.d.cts.map +1 -0
- package/dist/cipher-DSDxPRIp.d.mts +106 -0
- package/dist/cipher-DSDxPRIp.d.mts.map +1 -0
- package/dist/{construct-interface-DPlxfpoS.d.mts → construct-interface-B1AfqRl4.d.cts} +42 -8
- package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
- package/dist/{construct-interface-DgXTJcOD.d.cts → construct-interface-ZvYQbivO.d.mts} +42 -8
- package/dist/construct-interface-ZvYQbivO.d.mts.map +1 -0
- package/dist/construct-interface.cjs +30 -4
- package/dist/construct-interface.cjs.map +1 -1
- package/dist/construct-interface.d.cts +2 -2
- package/dist/construct-interface.d.mts +2 -2
- package/dist/construct-interface.mjs +30 -5
- package/dist/construct-interface.mjs.map +1 -1
- package/dist/credential-DYymbp_7.cjs +257 -0
- package/dist/credential-DYymbp_7.cjs.map +1 -0
- package/dist/credential-DfSAOOdY.mjs +222 -0
- package/dist/credential-DfSAOOdY.mjs.map +1 -0
- package/dist/credential.cjs +7 -129
- package/dist/credential.d.cts +2 -58
- package/dist/credential.d.mts +2 -58
- package/dist/credential.mjs +2 -128
- package/dist/crons/index.cjs +126 -1
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +43 -3
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +43 -3
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +125 -2
- package/dist/crons/index.mjs.map +1 -1
- package/dist/database/kysely.cjs +3 -194
- package/dist/database/kysely.d.cts +2 -149
- package/dist/database/kysely.d.mts +2 -149
- package/dist/database/kysely.mjs +2 -192
- package/dist/email.d.cts +1 -1
- package/dist/email.d.cts.map +1 -1
- package/dist/email.d.mts +2 -2
- package/dist/email.d.mts.map +1 -1
- package/dist/encryption/kms.cjs +95 -0
- package/dist/encryption/kms.cjs.map +1 -0
- package/dist/encryption/kms.d.cts +7 -0
- package/dist/encryption/kms.d.cts.map +1 -0
- package/dist/encryption/kms.d.mts +7 -0
- package/dist/encryption/kms.d.mts.map +1 -0
- package/dist/encryption/kms.mjs +93 -0
- package/dist/encryption/kms.mjs.map +1 -0
- package/dist/encryption.cjs +116 -0
- package/dist/encryption.cjs.map +1 -0
- package/dist/encryption.d.cts +37 -0
- package/dist/encryption.d.cts.map +1 -0
- package/dist/encryption.d.mts +37 -0
- package/dist/encryption.d.mts.map +1 -0
- package/dist/encryption.mjs +101 -0
- package/dist/encryption.mjs.map +1 -0
- package/dist/endpoints/index.cjs +25 -10
- package/dist/endpoints/index.d.cts +105 -3
- package/dist/endpoints/index.d.cts.map +1 -0
- package/dist/endpoints/index.d.mts +105 -3
- package/dist/endpoints/index.d.mts.map +1 -0
- package/dist/endpoints/index.mjs +5 -4
- package/dist/expire-C586zznE.d.cts +38 -0
- package/dist/expire-C586zznE.d.cts.map +1 -0
- package/dist/expire-C586zznE.d.mts +38 -0
- package/dist/expire-C586zznE.d.mts.map +1 -0
- package/dist/expire-CieftS01.cjs +67 -0
- package/dist/expire-CieftS01.cjs.map +1 -0
- package/dist/expire-CpzUAfr9.mjs +50 -0
- package/dist/expire-CpzUAfr9.mjs.map +1 -0
- package/dist/external-api.cjs +106 -0
- package/dist/external-api.cjs.map +1 -0
- package/dist/external-api.d.cts +2 -0
- package/dist/external-api.d.mts +2 -0
- package/dist/external-api.mjs +103 -0
- package/dist/external-api.mjs.map +1 -0
- package/dist/fake-BUgcX2Dk.d.cts +201 -0
- package/dist/fake-BUgcX2Dk.d.cts.map +1 -0
- package/dist/fake-D472nkKb.d.mts +201 -0
- package/dist/fake-D472nkKb.d.mts.map +1 -0
- package/dist/file-server.cjs +123 -30
- package/dist/file-server.cjs.map +1 -1
- package/dist/file-server.d.cts +115 -1
- package/dist/file-server.d.cts.map +1 -1
- package/dist/file-server.d.mts +115 -1
- package/dist/file-server.d.mts.map +1 -1
- package/dist/file-server.mjs +122 -32
- package/dist/file-server.mjs.map +1 -1
- package/dist/functions/index.cjs +1 -1
- package/dist/functions/index.d.cts +2 -1
- package/dist/functions/index.d.mts +2 -1
- package/dist/functions/index.mjs +1 -1
- package/dist/{functions-C53GW2eQ.mjs → functions-BvIDQKAA.mjs} +117 -22
- package/dist/functions-BvIDQKAA.mjs.map +1 -0
- package/dist/{functions-B6qCvfmy.cjs → functions-DLF6-IK8.cjs} +122 -18
- package/dist/functions-DLF6-IK8.cjs.map +1 -0
- package/dist/index-BtzMzhMA.d.cts +115 -0
- package/dist/index-BtzMzhMA.d.cts.map +1 -0
- package/dist/{index-CeEtxDmK.d.cts → index-DdRjYhiJ.d.cts} +42 -2
- package/dist/{index-CeEtxDmK.d.cts.map → index-DdRjYhiJ.d.cts.map} +1 -1
- package/dist/{index-CeEtxDmK.d.mts → index-DdRjYhiJ.d.mts} +42 -2
- package/dist/{index-CeEtxDmK.d.mts.map → index-DdRjYhiJ.d.mts.map} +1 -1
- package/dist/index-DuriFjYD.d.mts +115 -0
- package/dist/index-DuriFjYD.d.mts.map +1 -0
- package/dist/index.cjs +4 -1
- package/dist/index.d.cts +26 -3
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +26 -3
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -2
- package/dist/kysely-BHYV-WC-.d.cts +216 -0
- package/dist/kysely-BHYV-WC-.d.cts.map +1 -0
- package/dist/kysely-CAW3QSqp.d.mts +216 -0
- package/dist/kysely-CAW3QSqp.d.mts.map +1 -0
- package/dist/kysely-Cs4uPO8k.mjs +371 -0
- package/dist/kysely-Cs4uPO8k.mjs.map +1 -0
- package/dist/kysely-CukArHJ0.cjs +384 -0
- package/dist/kysely-CukArHJ0.cjs.map +1 -0
- package/dist/{telemetry-DGcFlVpB.d.cts → lambdaTelemetry-8vnmVZQ5.d.cts} +2 -2
- package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +1 -0
- package/dist/{telemetry-DGcFlVpB.d.mts → lambdaTelemetry-8vnmVZQ5.d.mts} +2 -2
- package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +1 -0
- package/dist/mobile-app.cjs +74 -0
- package/dist/mobile-app.cjs.map +1 -0
- package/dist/mobile-app.d.cts +73 -0
- package/dist/mobile-app.d.cts.map +1 -0
- package/dist/mobile-app.d.mts +73 -0
- package/dist/mobile-app.d.mts.map +1 -0
- package/dist/mobile-app.mjs +73 -0
- package/dist/mobile-app.mjs.map +1 -0
- package/dist/object-storage.cjs +8 -1
- package/dist/object-storage.cjs.map +1 -1
- package/dist/object-storage.d.cts +10 -1
- package/dist/object-storage.d.cts.map +1 -1
- package/dist/object-storage.d.mts +10 -1
- package/dist/object-storage.d.mts.map +1 -1
- package/dist/object-storage.mjs +7 -2
- package/dist/object-storage.mjs.map +1 -1
- package/dist/pattern-C1CEcglD.mjs +241 -0
- package/dist/pattern-C1CEcglD.mjs.map +1 -0
- package/dist/pattern-QFaUIr77.cjs +288 -0
- package/dist/pattern-QFaUIr77.cjs.map +1 -0
- package/dist/processors/index.cjs +214 -0
- package/dist/processors/index.cjs.map +1 -0
- package/dist/processors/index.d.cts +78 -0
- package/dist/processors/index.d.cts.map +1 -0
- package/dist/processors/index.d.mts +78 -0
- package/dist/processors/index.d.mts.map +1 -0
- package/dist/processors/index.mjs +193 -0
- package/dist/processors/index.mjs.map +1 -0
- package/dist/queue/index.cjs +5 -192
- package/dist/queue/index.d.cts +3 -53
- package/dist/queue/index.d.mts +3 -53
- package/dist/queue/index.mjs +3 -190
- package/dist/random-password.cjs +86 -0
- package/dist/random-password.cjs.map +1 -0
- package/dist/random-password.d.cts +30 -0
- package/dist/random-password.d.cts.map +1 -0
- package/dist/random-password.d.mts +30 -0
- package/dist/random-password.d.mts.map +1 -0
- package/dist/random-password.mjs +84 -0
- package/dist/random-password.mjs.map +1 -0
- package/dist/{lazyAccessors-BHtcqgz2.mjs → readRequestBody-BTIl3k-D.mjs} +99 -39
- package/dist/readRequestBody-BTIl3k-D.mjs.map +1 -0
- package/dist/{lazyAccessors-Dx9NLwJZ.cjs → readRequestBody-Dej_L3c4.cjs} +118 -46
- package/dist/readRequestBody-Dej_L3c4.cjs.map +1 -0
- package/dist/requestLogger-BZcXwdBs.cjs +207 -0
- package/dist/requestLogger-BZcXwdBs.cjs.map +1 -0
- package/dist/requestLogger-pA4gi3E1.mjs +178 -0
- package/dist/requestLogger-pA4gi3E1.mjs.map +1 -0
- package/dist/rest-api.cjs +76 -43
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +64 -31
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +64 -31
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +76 -43
- package/dist/rest-api.mjs.map +1 -1
- package/dist/runSubscriber-B1Yg4dID.cjs +128 -0
- package/dist/runSubscriber-B1Yg4dID.cjs.map +1 -0
- package/dist/runSubscriber-JCgkeYbE.mjs +111 -0
- package/dist/runSubscriber-JCgkeYbE.mjs.map +1 -0
- package/dist/shutdown-BMJmAhSt.cjs +38 -0
- package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
- package/dist/shutdown-C7xa8x9S.mjs +27 -0
- package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
- package/dist/site.cjs +9 -3
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +44 -1
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +44 -1
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +9 -3
- package/dist/site.mjs.map +1 -1
- package/dist/stages-DaTaoQei.d.cts +73 -0
- package/dist/stages-DaTaoQei.d.cts.map +1 -0
- package/dist/stages-DaTaoQei.d.mts +73 -0
- package/dist/stages-DaTaoQei.d.mts.map +1 -0
- package/dist/subscribers/index.cjs +134 -1
- package/dist/subscribers/index.cjs.map +1 -0
- package/dist/subscribers/index.d.cts +74 -3
- package/dist/subscribers/index.d.cts.map +1 -0
- package/dist/subscribers/index.d.mts +74 -3
- package/dist/subscribers/index.d.mts.map +1 -0
- package/dist/subscribers/index.mjs +132 -2
- package/dist/subscribers/index.mjs.map +1 -0
- package/dist/telemetry-B48RLjyk.d.cts +40 -0
- package/dist/telemetry-B48RLjyk.d.cts.map +1 -0
- package/dist/telemetry-BEoBn6GO.d.mts +40 -0
- package/dist/telemetry-BEoBn6GO.d.mts.map +1 -0
- package/dist/telemetry.cjs +56 -0
- package/dist/telemetry.cjs.map +1 -0
- package/dist/telemetry.d.cts +2 -0
- package/dist/telemetry.d.mts +2 -0
- package/dist/telemetry.mjs +55 -0
- package/dist/telemetry.mjs.map +1 -0
- package/dist/topic/index.cjs +2 -134
- package/dist/topic/index.d.cts +2 -3
- package/dist/topic/index.d.mts +2 -3
- package/dist/topic/index.mjs +2 -132
- package/dist/tracing-Bbj1uoFJ.mjs +127 -0
- package/dist/tracing-Bbj1uoFJ.mjs.map +1 -0
- package/dist/tracing-C0ooU0V2.cjs +150 -0
- package/dist/tracing-C0ooU0V2.cjs.map +1 -0
- package/dist/websocket-api.cjs +769 -0
- package/dist/websocket-api.cjs.map +1 -0
- package/dist/websocket-api.d.cts +449 -0
- package/dist/websocket-api.d.cts.map +1 -0
- package/dist/websocket-api.d.mts +449 -0
- package/dist/websocket-api.d.mts.map +1 -0
- package/dist/websocket-api.mjs +755 -0
- package/dist/websocket-api.mjs.map +1 -0
- package/dist/worker.cjs +70 -23
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +86 -36
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +87 -37
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +70 -23
- package/dist/worker.mjs.map +1 -1
- package/package.json +145 -44
- package/dist/Construct-BeYVu_QF.mjs.map +0 -1
- package/dist/Construct-DfbwIntp.d.cts +0 -115
- package/dist/Construct-DfbwIntp.d.cts.map +0 -1
- package/dist/Construct-DqdlARxq.cjs.map +0 -1
- package/dist/Construct-l5aOn_jv.d.mts +0 -115
- package/dist/Construct-l5aOn_jv.d.mts.map +0 -1
- package/dist/Cron-DKqnnTdH.d.cts.map +0 -1
- package/dist/Cron-SyqS5oWJ.d.mts.map +0 -1
- package/dist/CronBuilder-BdnI6lxF.cjs.map +0 -1
- package/dist/CronBuilder-CRGnDfTq.d.mts +0 -41
- package/dist/CronBuilder-CRGnDfTq.d.mts.map +0 -1
- package/dist/CronBuilder-D_0HNBTr.mjs.map +0 -1
- package/dist/CronBuilder-Df1q9PNy.d.cts +0 -41
- package/dist/CronBuilder-Df1q9PNy.d.cts.map +0 -1
- package/dist/Endpoint-BCiCYvx2.mjs +0 -1665
- package/dist/Endpoint-BCiCYvx2.mjs.map +0 -1
- package/dist/Endpoint-C6yyHpRS.d.cts.map +0 -1
- package/dist/Endpoint-DuT4TEEq.d.mts.map +0 -1
- package/dist/Endpoint-s0AyrQGC.cjs +0 -1683
- package/dist/Endpoint-s0AyrQGC.cjs.map +0 -1
- package/dist/EndpointFactory-M8OQKZRY.cjs.map +0 -1
- package/dist/EndpointFactory-ptPR1cXw.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-7QagYKdP.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-CYHA0WAt.mjs.map +0 -1
- package/dist/Queue-D9X6OoON.d.mts.map +0 -1
- package/dist/Queue-DYPB2KWL.d.cts.map +0 -1
- package/dist/Subscriber-C4heaAyO.d.mts +0 -51
- package/dist/Subscriber-C4heaAyO.d.mts.map +0 -1
- package/dist/Subscriber-CotDUELC.d.cts +0 -51
- package/dist/Subscriber-CotDUELC.d.cts.map +0 -1
- package/dist/SubscriberBuilder-BEv0eoHy.d.cts +0 -59
- package/dist/SubscriberBuilder-BEv0eoHy.d.cts.map +0 -1
- package/dist/SubscriberBuilder-C0ZEtGDI.cjs +0 -125
- package/dist/SubscriberBuilder-C0ZEtGDI.cjs.map +0 -1
- package/dist/SubscriberBuilder-h7B_cHMr.mjs +0 -114
- package/dist/SubscriberBuilder-h7B_cHMr.mjs.map +0 -1
- package/dist/SubscriberBuilder-tyH5yTk5.d.mts +0 -59
- package/dist/SubscriberBuilder-tyH5yTk5.d.mts.map +0 -1
- package/dist/Topic-DEVGo0Dm.d.cts +0 -89
- package/dist/Topic-DEVGo0Dm.d.cts.map +0 -1
- package/dist/Topic-zk_6Gthr.d.mts +0 -89
- package/dist/Topic-zk_6Gthr.d.mts.map +0 -1
- package/dist/auth.d.cts.map +0 -1
- package/dist/auth.d.mts.map +0 -1
- package/dist/cache.d.cts.map +0 -1
- package/dist/cache.d.mts.map +0 -1
- package/dist/construct-interface-DPlxfpoS.d.mts.map +0 -1
- package/dist/construct-interface-DgXTJcOD.d.cts.map +0 -1
- package/dist/credential.cjs.map +0 -1
- package/dist/credential.d.cts.map +0 -1
- package/dist/credential.d.mts.map +0 -1
- package/dist/credential.mjs.map +0 -1
- package/dist/database/kysely.cjs.map +0 -1
- package/dist/database/kysely.d.cts.map +0 -1
- package/dist/database/kysely.d.mts.map +0 -1
- package/dist/database/kysely.mjs.map +0 -1
- package/dist/functions-B6qCvfmy.cjs.map +0 -1
- package/dist/functions-C53GW2eQ.mjs.map +0 -1
- package/dist/index-B2urf3YI.d.cts +0 -26
- package/dist/index-B2urf3YI.d.cts.map +0 -1
- package/dist/index-BPSZ_Lp_.d.cts.map +0 -1
- package/dist/index-BoZ-iisU.d.mts.map +0 -1
- package/dist/index-CdaU--_B.d.cts +0 -165
- package/dist/index-CdaU--_B.d.cts.map +0 -1
- package/dist/index-DMCDvnsM.d.mts +0 -26
- package/dist/index-DMCDvnsM.d.mts.map +0 -1
- package/dist/index-PQRWOQj4.d.mts +0 -165
- package/dist/index-PQRWOQj4.d.mts.map +0 -1
- package/dist/lazyAccessors-BHtcqgz2.mjs.map +0 -1
- package/dist/lazyAccessors-Dx9NLwJZ.cjs.map +0 -1
- package/dist/processAudits-BpRlPQMW.mjs +0 -77
- package/dist/processAudits-BpRlPQMW.mjs.map +0 -1
- package/dist/processAudits-D_2W5x8k.cjs +0 -88
- package/dist/processAudits-D_2W5x8k.cjs.map +0 -1
- package/dist/queue/index.cjs.map +0 -1
- package/dist/queue/index.d.cts.map +0 -1
- package/dist/queue/index.d.mts.map +0 -1
- package/dist/queue/index.mjs.map +0 -1
- package/dist/telemetry-DGcFlVpB.d.cts.map +0 -1
- package/dist/telemetry-DGcFlVpB.d.mts.map +0 -1
- package/dist/topic/index.cjs.map +0 -1
- package/dist/topic/index.mjs.map +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { i as Declarable } from "./construct-interface-ZvYQbivO.mjs";
|
|
2
|
+
import { ConstructName, Declaration, Dependency, MobileAppDeclaration, MobileAppStage } from "@geekmidas/manifest";
|
|
3
|
+
//#region src/mobile-app.d.ts
|
|
4
|
+
export interface MobileAppConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Where its source lives, relative to the workspace root — `'apps/app'`.
|
|
7
|
+
* Required, the same field a site and a surface take.
|
|
8
|
+
*/
|
|
9
|
+
path: string;
|
|
10
|
+
/**
|
|
11
|
+
* The port Metro serves it on locally.
|
|
12
|
+
*
|
|
13
|
+
* Normally omitted: ports are assigned in a stable order, as a site's are,
|
|
14
|
+
* and `gkm exec` hands it to Expo as `RCT_METRO_PORT`.
|
|
15
|
+
*/
|
|
16
|
+
port?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Modules to import when sniffing which env vars the app reads — its
|
|
19
|
+
* values are inlined at build time, as a site's are.
|
|
20
|
+
*/
|
|
21
|
+
config?: {
|
|
22
|
+
client?: string;
|
|
23
|
+
server?: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Which toolchain builds it — the same field a site names its framework
|
|
27
|
+
* by. Expo is the one that ships, and the default.
|
|
28
|
+
*/
|
|
29
|
+
variant?: MobileAppDeclaration['variant'];
|
|
30
|
+
/**
|
|
31
|
+
* Its URL scheme.
|
|
32
|
+
*
|
|
33
|
+
* Normally omitted: it is the project's name — `shop` — on every stage.
|
|
34
|
+
* Give one only when the app is known by another name.
|
|
35
|
+
*/
|
|
36
|
+
scheme?: string;
|
|
37
|
+
/**
|
|
38
|
+
* How a deployed stage ships it, where that differs from the defaults: the
|
|
39
|
+
* protected stage reads EAS's `production` environment and submits to
|
|
40
|
+
* Play's `production` track, every other deployed stage `preview` and
|
|
41
|
+
* `internal`, and every Android release is a `draft` until someone
|
|
42
|
+
* releases it in Play Console.
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* stages: { beta: { environment: 'preview', android: { track: 'alpha' } } }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
stages?: Readonly<Record<string, MobileAppStage>>;
|
|
49
|
+
}
|
|
50
|
+
export declare class MobileApp<TName extends string = string> implements Declarable<TName> {
|
|
51
|
+
private readonly config;
|
|
52
|
+
/** Internal: how `.dependsOn()` carries edges into the copy it returns. */
|
|
53
|
+
private readonly dependencies;
|
|
54
|
+
readonly id: TName;
|
|
55
|
+
/** The key its scheme arrives under — what its `app.config.ts` reads. */
|
|
56
|
+
readonly keys: {
|
|
57
|
+
scheme: string;
|
|
58
|
+
};
|
|
59
|
+
constructor(id: ConstructName<TName>, config: MobileAppConfig,
|
|
60
|
+
/** Internal: how `.dependsOn()` carries edges into the copy it returns. */
|
|
61
|
+
dependencies?: readonly Dependency[]);
|
|
62
|
+
/**
|
|
63
|
+
* What this app calls — the surfaces it is built with the URLs of, and the
|
|
64
|
+
* ones that come to trust its scheme.
|
|
65
|
+
*
|
|
66
|
+
* Immutable, like every other builder: it returns a new app rather than
|
|
67
|
+
* changing this one.
|
|
68
|
+
*/
|
|
69
|
+
dependsOn(constructs: readonly Declarable[]): MobileApp<TName>;
|
|
70
|
+
declare(): Declaration[];
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//# sourceMappingURL=mobile-app.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile-app.d.mts","names":[],"sources":["../src/mobile-app.ts"],"mappings":";;;iBAuCiB;;;;;EAKhB;;;;;;;EAOA;;;;;EAKA;IAAW;IAAiB;;;;;;EAK5B,UAAU;;;;;;;EAOV;;;;;;;;;;;;EAYA,SAAS,SAAS,eAAe;;qBAGrB,UAAU,0CACX,WAAW;mBAQJ;;mBAEA;WART,IAAI;;WAEJ;IAAQ;;EAEjB,YACC,IAAI,cAAc,QACD,QAAQ,iBAER;;EAAA,wBAAuB;;;;;;;;EAazC,UAAU,qBAAqB,eAAe,UAAU;EAOxD,WAAW"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { edgeTo } from "./construct-interface.mjs";
|
|
2
|
+
import { canonicalId, provideKey } from "@geekmidas/manifest";
|
|
3
|
+
//#region src/mobile-app.ts
|
|
4
|
+
/**
|
|
5
|
+
* `MobileApp` — an Expo app, declared like a site.
|
|
6
|
+
*
|
|
7
|
+
* Its edges are the point, as a site's are. One `.dependsOn([api, auth])` is
|
|
8
|
+
* the fact behind everything a mobile app otherwise has written down by hand:
|
|
9
|
+
*
|
|
10
|
+
* - its `EXPO_PUBLIC_API_URL` and `EXPO_PUBLIC_AUTH_URL`, which locally are
|
|
11
|
+
* the servers' own ports — reachable once the app swaps `localhost` for the
|
|
12
|
+
* address Metro is served from, which is what makes a phone on the LAN work;
|
|
13
|
+
* - with an `Email` among them, Mailpit's inbox on a local stage
|
|
14
|
+
* (`EXPO_PUBLIC_<ID>_INBOX_URL`), so a sign-in link can be opened from the
|
|
15
|
+
* app — unset deployed, where there is no inbox;
|
|
16
|
+
* - its URL scheme (`shop`), the same on every stage;
|
|
17
|
+
* - the scheme in the auth server's and the API's trusted origins — and, on a
|
|
18
|
+
* local stage, the `exp://` origins Expo Go sends from;
|
|
19
|
+
* - Better Auth's Expo plugin on the auth server, and sign-in links an app asks
|
|
20
|
+
* for built on an address the phone can open.
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* export const app = new MobileApp('App', { path: 'apps/app' })
|
|
24
|
+
* .dependsOn([api, auth]);
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Like a site it has no `.service`: it is built by its own toolchain, and
|
|
28
|
+
* consumes addresses rather than connections. Nothing deploys it — EAS and the
|
|
29
|
+
* stores do — so the targets derive *for* it and never run it.
|
|
30
|
+
*/
|
|
31
|
+
var MobileApp = class MobileApp {
|
|
32
|
+
config;
|
|
33
|
+
dependencies;
|
|
34
|
+
id;
|
|
35
|
+
/** The key its scheme arrives under — what its `app.config.ts` reads. */
|
|
36
|
+
keys;
|
|
37
|
+
constructor(id, config, dependencies = []) {
|
|
38
|
+
this.config = config;
|
|
39
|
+
this.dependencies = dependencies;
|
|
40
|
+
this.id = canonicalId(id);
|
|
41
|
+
this.keys = { scheme: provideKey(this.id, "scheme") };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* What this app calls — the surfaces it is built with the URLs of, and the
|
|
45
|
+
* ones that come to trust its scheme.
|
|
46
|
+
*
|
|
47
|
+
* Immutable, like every other builder: it returns a new app rather than
|
|
48
|
+
* changing this one.
|
|
49
|
+
*/
|
|
50
|
+
dependsOn(constructs) {
|
|
51
|
+
return new MobileApp(this.id, this.config, [...this.dependencies, ...constructs.map(edgeTo)]);
|
|
52
|
+
}
|
|
53
|
+
declare() {
|
|
54
|
+
return [{
|
|
55
|
+
kind: "mobile-app",
|
|
56
|
+
id: this.id,
|
|
57
|
+
variant: this.config.variant ?? "expo",
|
|
58
|
+
app: {
|
|
59
|
+
path: this.config.path,
|
|
60
|
+
...this.config.port ? { port: this.config.port } : {},
|
|
61
|
+
...this.config.config ? { config: this.config.config } : {}
|
|
62
|
+
},
|
|
63
|
+
...this.config.scheme ? { scheme: this.config.scheme } : {},
|
|
64
|
+
...this.config.stages ? { stages: this.config.stages } : {},
|
|
65
|
+
dependencies: this.dependencies,
|
|
66
|
+
provides: [this.keys.scheme]
|
|
67
|
+
}];
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
//#endregion
|
|
71
|
+
export { MobileApp };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=mobile-app.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile-app.mjs","names":[],"sources":["../src/mobile-app.ts"],"sourcesContent":["/**\n * `MobileApp` — an Expo app, declared like a site.\n *\n * Its edges are the point, as a site's are. One `.dependsOn([api, auth])` is\n * the fact behind everything a mobile app otherwise has written down by hand:\n *\n * - its `EXPO_PUBLIC_API_URL` and `EXPO_PUBLIC_AUTH_URL`, which locally are\n * the servers' own ports — reachable once the app swaps `localhost` for the\n * address Metro is served from, which is what makes a phone on the LAN work;\n * - with an `Email` among them, Mailpit's inbox on a local stage\n * (`EXPO_PUBLIC_<ID>_INBOX_URL`), so a sign-in link can be opened from the\n * app — unset deployed, where there is no inbox;\n * - its URL scheme (`shop`), the same on every stage;\n * - the scheme in the auth server's and the API's trusted origins — and, on a\n * local stage, the `exp://` origins Expo Go sends from;\n * - Better Auth's Expo plugin on the auth server, and sign-in links an app asks\n * for built on an address the phone can open.\n *\n * ```ts\n * export const app = new MobileApp('App', { path: 'apps/app' })\n * .dependsOn([api, auth]);\n * ```\n *\n * Like a site it has no `.service`: it is built by its own toolchain, and\n * consumes addresses rather than connections. Nothing deploys it — EAS and the\n * stores do — so the targets derive *for* it and never run it.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n\ttype MobileAppDeclaration,\n\ttype MobileAppStage,\n\tprovideKey,\n} from '@geekmidas/manifest';\nimport { type Declarable, edgeTo } from './construct-interface';\n\nexport interface MobileAppConfig {\n\t/**\n\t * Where its source lives, relative to the workspace root — `'apps/app'`.\n\t * Required, the same field a site and a surface take.\n\t */\n\tpath: string;\n\t/**\n\t * The port Metro serves it on locally.\n\t *\n\t * Normally omitted: ports are assigned in a stable order, as a site's are,\n\t * and `gkm exec` hands it to Expo as `RCT_METRO_PORT`.\n\t */\n\tport?: number;\n\t/**\n\t * Modules to import when sniffing which env vars the app reads — its\n\t * values are inlined at build time, as a site's are.\n\t */\n\tconfig?: { client?: string; server?: string };\n\t/**\n\t * Which toolchain builds it — the same field a site names its framework\n\t * by. Expo is the one that ships, and the default.\n\t */\n\tvariant?: MobileAppDeclaration['variant'];\n\t/**\n\t * Its URL scheme.\n\t *\n\t * Normally omitted: it is the project's name — `shop` — on every stage.\n\t * Give one only when the app is known by another name.\n\t */\n\tscheme?: string;\n\t/**\n\t * How a deployed stage ships it, where that differs from the defaults: the\n\t * protected stage reads EAS's `production` environment and submits to\n\t * Play's `production` track, every other deployed stage `preview` and\n\t * `internal`, and every Android release is a `draft` until someone\n\t * releases it in Play Console.\n\t *\n\t * ```ts\n\t * stages: { beta: { environment: 'preview', android: { track: 'alpha' } } }\n\t * ```\n\t */\n\tstages?: Readonly<Record<string, MobileAppStage>>;\n}\n\nexport class MobileApp<TName extends string = string>\n\timplements Declarable<TName>\n{\n\treadonly id: TName;\n\t/** The key its scheme arrives under — what its `app.config.ts` reads. */\n\treadonly keys: { scheme: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly config: MobileAppConfig,\n\t\t/** Internal: how `.dependsOn()` carries edges into the copy it returns. */\n\t\tprivate readonly dependencies: readonly Dependency[] = [],\n\t) {\n\t\tthis.id = canonicalId(id as string) as TName;\n\t\tthis.keys = { scheme: provideKey(this.id, 'scheme') };\n\t}\n\n\t/**\n\t * What this app calls — the surfaces it is built with the URLs of, and the\n\t * ones that come to trust its scheme.\n\t *\n\t * Immutable, like every other builder: it returns a new app rather than\n\t * changing this one.\n\t */\n\tdependsOn(constructs: readonly Declarable[]): MobileApp<TName> {\n\t\treturn new MobileApp<TName>(this.id as ConstructName<TName>, this.config, [\n\t\t\t...this.dependencies,\n\t\t\t...constructs.map(edgeTo),\n\t\t]);\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'mobile-app',\n\t\t\t\tid: this.id,\n\t\t\t\tvariant: this.config.variant ?? 'expo',\n\t\t\t\tapp: {\n\t\t\t\t\tpath: this.config.path,\n\t\t\t\t\t...(this.config.port ? { port: this.config.port } : {}),\n\t\t\t\t\t...(this.config.config ? { config: this.config.config } : {}),\n\t\t\t\t},\n\t\t\t\t...(this.config.scheme ? { scheme: this.config.scheme } : {}),\n\t\t\t\t...(this.config.stages ? { stages: this.config.stages } : {}),\n\t\t\t\tdependencies: this.dependencies,\n\t\t\t\tprovides: [this.keys.scheme],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,IAAa,YAAb,MAAa,UAEb;CAOmB;CAEA;CARlB;;CAEA;CAEA,YACC,IACA,QAEA,eAAuD,CAAC,GACvD;EAHgB,KAAA,SAAA;EAEA,KAAA,eAAA;EAEjB,KAAK,KAAK,YAAY,EAAY;EAClC,KAAK,OAAO,EAAE,QAAQ,WAAW,KAAK,IAAI,QAAQ,EAAE;CACrD;;;;;;;;CASA,UAAU,YAAqD;EAC9D,OAAO,IAAI,UAAiB,KAAK,IAA4B,KAAK,QAAQ,CACzE,GAAG,KAAK,cACR,GAAG,WAAW,IAAI,MAAM,CACzB,CAAC;CACF;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,SAAS,KAAK,OAAO,WAAW;GAChC,KAAK;IACJ,MAAM,KAAK,OAAO;IAClB,GAAI,KAAK,OAAO,OAAO,EAAE,MAAM,KAAK,OAAO,KAAK,IAAI,CAAC;IACrD,GAAI,KAAK,OAAO,SAAS,EAAE,QAAQ,KAAK,OAAO,OAAO,IAAI,CAAC;GAC5D;GACA,GAAI,KAAK,OAAO,SAAS,EAAE,QAAQ,KAAK,OAAO,OAAO,IAAI,CAAC;GAC3D,GAAI,KAAK,OAAO,SAAS,EAAE,QAAQ,KAAK,OAAO,OAAO,IAAI,CAAC;GAC3D,cAAc,KAAK;GACnB,UAAU,CAAC,KAAK,KAAK,MAAM;EAC5B,CACD;CACD;AACD"}
|
package/dist/object-storage.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_expire = require("./expire-CieftS01.cjs");
|
|
2
3
|
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
3
4
|
let _geekmidas_storage = require("@geekmidas/storage");
|
|
4
5
|
//#region src/object-storage.ts
|
|
@@ -20,11 +21,14 @@ var ObjectStorage = class {
|
|
|
20
21
|
* of the construct owning both faces.
|
|
21
22
|
*/
|
|
22
23
|
keys;
|
|
24
|
+
/** Checked once, at declaration: prefix → days. */
|
|
25
|
+
expire;
|
|
23
26
|
constructor(id, options = {}) {
|
|
24
27
|
this.options = options;
|
|
25
28
|
const canonical = (0, _geekmidas_manifest.canonicalId)(id);
|
|
26
29
|
this.id = canonical;
|
|
27
30
|
this.keys = { url: (0, _geekmidas_manifest.provideKey)(canonical, "url") };
|
|
31
|
+
this.expire = require_expire.expiryDays(canonical, options.expire);
|
|
28
32
|
this.service = {
|
|
29
33
|
serviceName: (0, _geekmidas_manifest.serviceKey)(canonical),
|
|
30
34
|
register: (options) => this.connect(options)
|
|
@@ -35,7 +39,8 @@ var ObjectStorage = class {
|
|
|
35
39
|
kind: "objects",
|
|
36
40
|
id: this.id,
|
|
37
41
|
provides: [this.keys.url],
|
|
38
|
-
...this.options.versioned ? { versioned: true } : {}
|
|
42
|
+
...this.options.versioned ? { versioned: true } : {},
|
|
43
|
+
...this.expire ? { expire: this.expire } : {}
|
|
39
44
|
}];
|
|
40
45
|
}
|
|
41
46
|
/**
|
|
@@ -51,6 +56,8 @@ var ObjectStorage = class {
|
|
|
51
56
|
}
|
|
52
57
|
};
|
|
53
58
|
//#endregion
|
|
59
|
+
exports.ExpiryDaysInvalid = require_expire.ExpiryDaysInvalid;
|
|
60
|
+
exports.ExpiryPrefixInvalid = require_expire.ExpiryPrefixInvalid;
|
|
54
61
|
exports.ObjectStorage = ObjectStorage;
|
|
55
62
|
|
|
56
63
|
//# sourceMappingURL=object-storage.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-storage.cjs","names":["canonicalId","provideKey","serviceKey","createStorageClient"],"sources":["../src/object-storage.ts"],"sourcesContent":["/**\n * `ObjectStorage` — a declared bucket.\n *\n * Where the three packages meet: it implements the construct contract, derives\n * its env key through `@geekmidas/manifest`, and hands back a\n * `@geekmidas/storage` client. It names no cloud — `--target=aws` fills the\n * injected URL with S3's values, local dev with MinIO's.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport { createStorageClient, type StorageClient } from '@geekmidas/storage';\nimport type { Construct } from './construct-interface';\n\nexport interface ObjectStorageOptions {\n\t/** Keep previous versions of an object. */\n\tversioned?: boolean;\n}\n\nexport class ObjectStorage<TName extends string = string>\n\timplements Construct<TName, StorageClient>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, StorageClient>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift — the whole point\n\t * of the construct owning both faces.\n\t */\n\tprivate readonly keys: { url: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: ObjectStorageOptions = {},\n\t) {\n\t\t// Canonicalises, so `uploads` and `Uploads` are one construct rather than\n\t\t// two that collide. Throws on anything that cannot become a valid id.\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = { url: provideKey(canonical, 'url') };\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'objects',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url],\n\t\t\t\t...(this.options.versioned ? { versioned: true } : {}),\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the single URL the adapter supplied.\n\t *\n\t * The URL's scheme selects the driver, so this construct imports no provider\n\t * and an app that never touches S3 never resolves the AWS SDK. Whoever\n\t * assembles the application registers the drivers its target needs.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<StorageClient> {\n\t\tconst { url } = envParser\n\t\t\t.create((get) => ({ url: get(this.keys.url).string() }))\n\t\t\t.parse();\n\n\t\treturn createStorageClient(url);\n\t}\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"object-storage.cjs","names":["canonicalId","provideKey","expiryDays","serviceKey","createStorageClient"],"sources":["../src/object-storage.ts"],"sourcesContent":["/**\n * `ObjectStorage` — a declared bucket.\n *\n * Where the three packages meet: it implements the construct contract, derives\n * its env key through `@geekmidas/manifest`, and hands back a\n * `@geekmidas/storage` client. It names no cloud — `--target=aws` fills the\n * injected URL with S3's values, local dev with MinIO's.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport { createStorageClient, type StorageClient } from '@geekmidas/storage';\nimport type { Construct } from './construct-interface';\nimport { expiryDays, type ObjectExpiry } from './expire';\n\nexport {\n\tExpiryDaysInvalid,\n\tExpiryPrefixInvalid,\n\ttype ObjectExpiry,\n} from './expire';\n\nexport interface ObjectStorageOptions {\n\t/** Keep previous versions of an object. */\n\tversioned?: boolean;\n\t/**\n\t * Delete the objects under each prefix this many days after they were\n\t * written — `{ 'quotes/': { days: 30 } }`.\n\t */\n\texpire?: ObjectExpiry;\n}\n\nexport class ObjectStorage<TName extends string = string>\n\timplements Construct<TName, StorageClient>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, StorageClient>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift — the whole point\n\t * of the construct owning both faces.\n\t */\n\tprivate readonly keys: { url: string };\n\n\t/** Checked once, at declaration: prefix → days. */\n\tprivate readonly expire: Record<string, number> | undefined;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: ObjectStorageOptions = {},\n\t) {\n\t\t// Canonicalises, so `uploads` and `Uploads` are one construct rather than\n\t\t// two that collide. Throws on anything that cannot become a valid id.\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = { url: provideKey(canonical, 'url') };\n\t\tthis.expire = expiryDays(canonical, options.expire);\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'objects',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url],\n\t\t\t\t...(this.options.versioned ? { versioned: true } : {}),\n\t\t\t\t...(this.expire ? { expire: this.expire } : {}),\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the single URL the adapter supplied.\n\t *\n\t * The URL's scheme selects the driver, so this construct imports no provider\n\t * and an app that never touches S3 never resolves the AWS SDK. Whoever\n\t * assembles the application registers the drivers its target needs.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<StorageClient> {\n\t\tconst { url } = envParser\n\t\t\t.create((get) => ({ url: get(this.keys.url).string() }))\n\t\t\t.parse();\n\n\t\treturn createStorageClient(url);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAqCA,IAAa,gBAAb,MAEA;CAgBmB;CAflB;CACA;;;;;;CAOA;;CAGA;CAEA,YACC,IACA,UAAiD,CAAC,GACjD;EADgB,KAAA,UAAA;EAIjB,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO,EAAE,MAAA,GAAKC,oBAAAA,WAAAA,CAAW,WAAW,KAAK,EAAE;EAChD,KAAK,SAASC,eAAAA,WAAW,WAAW,QAAQ,MAAM;EAGlD,KAAK,UAAU;GACd,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,GAAG;GACxB,GAAI,KAAK,QAAQ,YAAY,EAAE,WAAW,KAAK,IAAI,CAAC;GACpD,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,OAAO,IAAI,CAAC;EAC9C,CACD;CACD;;;;;;;;CASA,MAAc,QAAQ,EACrB,aACkD;EAClD,MAAM,EAAE,QAAQ,UACd,QAAQ,SAAS,EAAE,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACvD,MAAM;EAER,QAAA,GAAOC,mBAAAA,oBAAAA,CAAoB,GAAG;CAC/B;AACD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as Construct } from "./construct-interface-B1AfqRl4.cjs";
|
|
2
|
+
import { n as ExpiryPrefixInvalid, r as ObjectExpiry, t as ExpiryDaysInvalid } from "./expire-C586zznE.cjs";
|
|
2
3
|
import { Service } from "@geekmidas/services";
|
|
3
4
|
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
4
5
|
import { StorageClient } from "@geekmidas/storage";
|
|
@@ -6,6 +7,11 @@ import { StorageClient } from "@geekmidas/storage";
|
|
|
6
7
|
export interface ObjectStorageOptions {
|
|
7
8
|
/** Keep previous versions of an object. */
|
|
8
9
|
versioned?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Delete the objects under each prefix this many days after they were
|
|
12
|
+
* written — `{ 'quotes/': { days: 30 } }`.
|
|
13
|
+
*/
|
|
14
|
+
expire?: ObjectExpiry;
|
|
9
15
|
}
|
|
10
16
|
export declare class ObjectStorage<TName extends string = string> implements Construct<TName, StorageClient> {
|
|
11
17
|
private readonly options;
|
|
@@ -17,6 +23,8 @@ export declare class ObjectStorage<TName extends string = string> implements Con
|
|
|
17
23
|
* of the construct owning both faces.
|
|
18
24
|
*/
|
|
19
25
|
private readonly keys;
|
|
26
|
+
/** Checked once, at declaration: prefix → days. */
|
|
27
|
+
private readonly expire;
|
|
20
28
|
constructor(id: ConstructName<TName>, options?: ObjectStorageOptions);
|
|
21
29
|
declare(): Declaration[];
|
|
22
30
|
/**
|
|
@@ -29,4 +37,5 @@ export declare class ObjectStorage<TName extends string = string> implements Con
|
|
|
29
37
|
private connect;
|
|
30
38
|
}
|
|
31
39
|
//#endregion
|
|
40
|
+
export { ExpiryDaysInvalid, ExpiryPrefixInvalid, type ObjectExpiry };
|
|
32
41
|
//# sourceMappingURL=object-storage.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-storage.d.cts","names":[],"sources":["../src/object-storage.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"object-storage.d.cts","names":[],"sources":["../src/object-storage.ts"],"mappings":";;;;;;iBA2BiB;;EAEhB;;;;;EAKA,SAAS;;qBAGG,cAAc,0CACf,UAAU,OAAO;mBAiBV;WAfT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;;;;;mBAO9B;;mBAGA;EAEjB,YACC,IAAI,cAAc,QACD,UAAS;EAiB3B,WAAW;;;;;;;;UAmBG"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as Construct } from "./construct-interface-ZvYQbivO.mjs";
|
|
2
|
+
import { n as ExpiryPrefixInvalid, r as ObjectExpiry, t as ExpiryDaysInvalid } from "./expire-C586zznE.mjs";
|
|
2
3
|
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
3
4
|
import { StorageClient } from "@geekmidas/storage";
|
|
4
5
|
import { Service } from "@geekmidas/services";
|
|
@@ -6,6 +7,11 @@ import { Service } from "@geekmidas/services";
|
|
|
6
7
|
export interface ObjectStorageOptions {
|
|
7
8
|
/** Keep previous versions of an object. */
|
|
8
9
|
versioned?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Delete the objects under each prefix this many days after they were
|
|
12
|
+
* written — `{ 'quotes/': { days: 30 } }`.
|
|
13
|
+
*/
|
|
14
|
+
expire?: ObjectExpiry;
|
|
9
15
|
}
|
|
10
16
|
export declare class ObjectStorage<TName extends string = string> implements Construct<TName, StorageClient> {
|
|
11
17
|
private readonly options;
|
|
@@ -17,6 +23,8 @@ export declare class ObjectStorage<TName extends string = string> implements Con
|
|
|
17
23
|
* of the construct owning both faces.
|
|
18
24
|
*/
|
|
19
25
|
private readonly keys;
|
|
26
|
+
/** Checked once, at declaration: prefix → days. */
|
|
27
|
+
private readonly expire;
|
|
20
28
|
constructor(id: ConstructName<TName>, options?: ObjectStorageOptions);
|
|
21
29
|
declare(): Declaration[];
|
|
22
30
|
/**
|
|
@@ -29,4 +37,5 @@ export declare class ObjectStorage<TName extends string = string> implements Con
|
|
|
29
37
|
private connect;
|
|
30
38
|
}
|
|
31
39
|
//#endregion
|
|
40
|
+
export { ExpiryDaysInvalid, ExpiryPrefixInvalid, type ObjectExpiry };
|
|
32
41
|
//# sourceMappingURL=object-storage.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-storage.d.mts","names":[],"sources":["../src/object-storage.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"object-storage.d.mts","names":[],"sources":["../src/object-storage.ts"],"mappings":";;;;;;iBA2BiB;;EAEhB;;;;;EAKA,SAAS;;qBAGG,cAAc,0CACf,UAAU,OAAO;mBAiBV;WAfT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;;;;;mBAO9B;;mBAGA;EAEjB,YACC,IAAI,cAAc,QACD,UAAS;EAiB3B,WAAW;;;;;;;;UAmBG"}
|
package/dist/object-storage.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as ExpiryPrefixInvalid, r as expiryDays, t as ExpiryDaysInvalid } from "./expire-CpzUAfr9.mjs";
|
|
1
2
|
import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
2
3
|
import { createStorageClient } from "@geekmidas/storage";
|
|
3
4
|
//#region src/object-storage.ts
|
|
@@ -19,11 +20,14 @@ var ObjectStorage = class {
|
|
|
19
20
|
* of the construct owning both faces.
|
|
20
21
|
*/
|
|
21
22
|
keys;
|
|
23
|
+
/** Checked once, at declaration: prefix → days. */
|
|
24
|
+
expire;
|
|
22
25
|
constructor(id, options = {}) {
|
|
23
26
|
this.options = options;
|
|
24
27
|
const canonical = canonicalId(id);
|
|
25
28
|
this.id = canonical;
|
|
26
29
|
this.keys = { url: provideKey(canonical, "url") };
|
|
30
|
+
this.expire = expiryDays(canonical, options.expire);
|
|
27
31
|
this.service = {
|
|
28
32
|
serviceName: serviceKey(canonical),
|
|
29
33
|
register: (options) => this.connect(options)
|
|
@@ -34,7 +38,8 @@ var ObjectStorage = class {
|
|
|
34
38
|
kind: "objects",
|
|
35
39
|
id: this.id,
|
|
36
40
|
provides: [this.keys.url],
|
|
37
|
-
...this.options.versioned ? { versioned: true } : {}
|
|
41
|
+
...this.options.versioned ? { versioned: true } : {},
|
|
42
|
+
...this.expire ? { expire: this.expire } : {}
|
|
38
43
|
}];
|
|
39
44
|
}
|
|
40
45
|
/**
|
|
@@ -50,6 +55,6 @@ var ObjectStorage = class {
|
|
|
50
55
|
}
|
|
51
56
|
};
|
|
52
57
|
//#endregion
|
|
53
|
-
export { ObjectStorage };
|
|
58
|
+
export { ExpiryDaysInvalid, ExpiryPrefixInvalid, ObjectStorage };
|
|
54
59
|
|
|
55
60
|
//# sourceMappingURL=object-storage.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-storage.mjs","names":[],"sources":["../src/object-storage.ts"],"sourcesContent":["/**\n * `ObjectStorage` — a declared bucket.\n *\n * Where the three packages meet: it implements the construct contract, derives\n * its env key through `@geekmidas/manifest`, and hands back a\n * `@geekmidas/storage` client. It names no cloud — `--target=aws` fills the\n * injected URL with S3's values, local dev with MinIO's.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport { createStorageClient, type StorageClient } from '@geekmidas/storage';\nimport type { Construct } from './construct-interface';\n\nexport interface ObjectStorageOptions {\n\t/** Keep previous versions of an object. */\n\tversioned?: boolean;\n}\n\nexport class ObjectStorage<TName extends string = string>\n\timplements Construct<TName, StorageClient>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, StorageClient>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift — the whole point\n\t * of the construct owning both faces.\n\t */\n\tprivate readonly keys: { url: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: ObjectStorageOptions = {},\n\t) {\n\t\t// Canonicalises, so `uploads` and `Uploads` are one construct rather than\n\t\t// two that collide. Throws on anything that cannot become a valid id.\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = { url: provideKey(canonical, 'url') };\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'objects',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url],\n\t\t\t\t...(this.options.versioned ? { versioned: true } : {}),\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the single URL the adapter supplied.\n\t *\n\t * The URL's scheme selects the driver, so this construct imports no provider\n\t * and an app that never touches S3 never resolves the AWS SDK. Whoever\n\t * assembles the application registers the drivers its target needs.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<StorageClient> {\n\t\tconst { url } = envParser\n\t\t\t.create((get) => ({ url: get(this.keys.url).string() }))\n\t\t\t.parse();\n\n\t\treturn createStorageClient(url);\n\t}\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"object-storage.mjs","names":[],"sources":["../src/object-storage.ts"],"sourcesContent":["/**\n * `ObjectStorage` — a declared bucket.\n *\n * Where the three packages meet: it implements the construct contract, derives\n * its env key through `@geekmidas/manifest`, and hands back a\n * `@geekmidas/storage` client. It names no cloud — `--target=aws` fills the\n * injected URL with S3's values, local dev with MinIO's.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport { createStorageClient, type StorageClient } from '@geekmidas/storage';\nimport type { Construct } from './construct-interface';\nimport { expiryDays, type ObjectExpiry } from './expire';\n\nexport {\n\tExpiryDaysInvalid,\n\tExpiryPrefixInvalid,\n\ttype ObjectExpiry,\n} from './expire';\n\nexport interface ObjectStorageOptions {\n\t/** Keep previous versions of an object. */\n\tversioned?: boolean;\n\t/**\n\t * Delete the objects under each prefix this many days after they were\n\t * written — `{ 'quotes/': { days: 30 } }`.\n\t */\n\texpire?: ObjectExpiry;\n}\n\nexport class ObjectStorage<TName extends string = string>\n\timplements Construct<TName, StorageClient>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, StorageClient>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift — the whole point\n\t * of the construct owning both faces.\n\t */\n\tprivate readonly keys: { url: string };\n\n\t/** Checked once, at declaration: prefix → days. */\n\tprivate readonly expire: Record<string, number> | undefined;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: ObjectStorageOptions = {},\n\t) {\n\t\t// Canonicalises, so `uploads` and `Uploads` are one construct rather than\n\t\t// two that collide. Throws on anything that cannot become a valid id.\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = { url: provideKey(canonical, 'url') };\n\t\tthis.expire = expiryDays(canonical, options.expire);\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'objects',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url],\n\t\t\t\t...(this.options.versioned ? { versioned: true } : {}),\n\t\t\t\t...(this.expire ? { expire: this.expire } : {}),\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the single URL the adapter supplied.\n\t *\n\t * The URL's scheme selects the driver, so this construct imports no provider\n\t * and an app that never touches S3 never resolves the AWS SDK. Whoever\n\t * assembles the application registers the drivers its target needs.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<StorageClient> {\n\t\tconst { url } = envParser\n\t\t\t.create((get) => ({ url: get(this.keys.url).string() }))\n\t\t\t.parse();\n\n\t\treturn createStorageClient(url);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAqCA,IAAa,gBAAb,MAEA;CAgBmB;CAflB;CACA;;;;;;CAOA;;CAGA;CAEA,YACC,IACA,UAAiD,CAAC,GACjD;EADgB,KAAA,UAAA;EAIjB,MAAM,YAAY,YAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO,EAAE,KAAK,WAAW,WAAW,KAAK,EAAE;EAChD,KAAK,SAAS,WAAW,WAAW,QAAQ,MAAM;EAGlD,KAAK,UAAU;GACd,aAAa,WAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,GAAG;GACxB,GAAI,KAAK,QAAQ,YAAY,EAAE,WAAW,KAAK,IAAI,CAAC;GACpD,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,OAAO,IAAI,CAAC;EAC9C,CACD;CACD;;;;;;;;CASA,MAAc,QAAQ,EACrB,aACkD;EAClD,MAAM,EAAE,QAAQ,UACd,QAAQ,SAAS,EAAE,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACvD,MAAM;EAER,OAAO,oBAAoB,GAAG;CAC/B;AACD"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { t as Construct } from "./Construct-CGuc_Ijk.mjs";
|
|
2
|
+
import { idsOf, servicesOf } from "./construct-interface.mjs";
|
|
3
|
+
import { DERIVED_PREFIX as DERIVED_PREFIX$1 } from "@geekmidas/manifest";
|
|
4
|
+
//#region src/processors/Processor.ts
|
|
5
|
+
/**
|
|
6
|
+
* A processor — a handler behind one path pattern of a file server, which
|
|
7
|
+
* makes a derivative of an open object on read: a thumbnail, a page of a PDF.
|
|
8
|
+
*
|
|
9
|
+
* Built from the file server (`assets.process('/i/:width/*')`), so it carries
|
|
10
|
+
* the bucket it reads and the open paths it may serve. Its parameters' schema
|
|
11
|
+
* is the allowlist: a request outside it is refused before anything runs, so
|
|
12
|
+
* nobody can mint new work — or new cache entries — by varying a number.
|
|
13
|
+
*/
|
|
14
|
+
var Processor = class extends Construct {
|
|
15
|
+
parsed;
|
|
16
|
+
handler;
|
|
17
|
+
options;
|
|
18
|
+
__IS_PROCESSOR__ = true;
|
|
19
|
+
static isProcessor(obj) {
|
|
20
|
+
return Boolean(obj && obj.__IS_PROCESSOR__ === true && obj.type === "dev.geekmidas.function.processor");
|
|
21
|
+
}
|
|
22
|
+
constructor(parsed, handler, options) {
|
|
23
|
+
super("dev.geekmidas.function.processor", options.logger, [options.origin, ...options.services], [], void 0, options.timeout, options.memorySize, void 0, [.../* @__PURE__ */ new Set([options.bucketId, ...options.constructs])]);
|
|
24
|
+
this.parsed = parsed;
|
|
25
|
+
this.handler = handler;
|
|
26
|
+
this.options = options;
|
|
27
|
+
this.owner = options.surfaceId;
|
|
28
|
+
}
|
|
29
|
+
/** The pattern it answers, as written. */
|
|
30
|
+
get pattern() {
|
|
31
|
+
return this.parsed.pattern;
|
|
32
|
+
}
|
|
33
|
+
/** The literal path the edge routes to it — `/i/`. */
|
|
34
|
+
get prefix() {
|
|
35
|
+
return this.parsed.prefix;
|
|
36
|
+
}
|
|
37
|
+
get native() {
|
|
38
|
+
return this.options.native;
|
|
39
|
+
}
|
|
40
|
+
get surfaceId() {
|
|
41
|
+
return this.options.surfaceId;
|
|
42
|
+
}
|
|
43
|
+
get bucketId() {
|
|
44
|
+
return this.options.bucketId;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/processors/ProcessorBuilder.ts
|
|
49
|
+
/** A native package named in a way no installer could resolve. */
|
|
50
|
+
var ProcessorNativeInvalid = class extends Error {
|
|
51
|
+
packageName;
|
|
52
|
+
constructor(packageName) {
|
|
53
|
+
super(`'${packageName}' is not a package name. Name the package with native code as it is installed — 'sharp', '@napi-rs/canvas' — and its version is taken from the app's package.json.`);
|
|
54
|
+
this.packageName = packageName;
|
|
55
|
+
this.name = "ProcessorNativeInvalid";
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* What `fileServer.process(pattern)` returns: a processor, built up one
|
|
60
|
+
* immutable step at a time and finished by `.handle()`.
|
|
61
|
+
*/
|
|
62
|
+
var ProcessorBuilder = class ProcessorBuilder {
|
|
63
|
+
state;
|
|
64
|
+
constructor(state) {
|
|
65
|
+
this.state = state;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The parameters' schema — the allowlist. Every request is parsed by it
|
|
69
|
+
* before anything runs, and one it refuses is answered 400.
|
|
70
|
+
*/
|
|
71
|
+
params(schema) {
|
|
72
|
+
return new ProcessorBuilder({
|
|
73
|
+
...this.state,
|
|
74
|
+
paramsSchema: schema
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/** Constructs its handler reaches, as `services.<id>`. */
|
|
78
|
+
dependsOn(constructs) {
|
|
79
|
+
const services = servicesOf(constructs);
|
|
80
|
+
return new ProcessorBuilder({
|
|
81
|
+
...this.state,
|
|
82
|
+
services: [...this.state.services.filter((service) => !services.some((s) => s.serviceName === service.serviceName)), ...services],
|
|
83
|
+
constructs: idsOf(constructs, this.state.constructs)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Packages with native code — `sharp` — installed for the target the
|
|
88
|
+
* processor runs on rather than bundled: linux in its image, arm64 on
|
|
89
|
+
* Lambda.
|
|
90
|
+
*/
|
|
91
|
+
native(packages) {
|
|
92
|
+
for (const name of packages) if (!/^(@[a-z0-9._~-]+\/)?[a-z0-9._~-]+$/.test(name)) throw new ProcessorNativeInvalid(name);
|
|
93
|
+
return new ProcessorBuilder({
|
|
94
|
+
...this.state,
|
|
95
|
+
native: [.../* @__PURE__ */ new Set([...this.state.native, ...packages])]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** Milliseconds a request may take, where the target bounds it. */
|
|
99
|
+
timeout(ms) {
|
|
100
|
+
return new ProcessorBuilder({
|
|
101
|
+
...this.state,
|
|
102
|
+
timeout: ms
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/** Megabytes of memory, where the target sets it. */
|
|
106
|
+
memorySize(mb) {
|
|
107
|
+
return new ProcessorBuilder({
|
|
108
|
+
...this.state,
|
|
109
|
+
memorySize: mb
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
handle(fn) {
|
|
113
|
+
const { state } = this;
|
|
114
|
+
return new Processor(state.parsed, fn, {
|
|
115
|
+
surfaceId: state.surfaceId,
|
|
116
|
+
bucketId: state.bucketId,
|
|
117
|
+
origin: state.origin,
|
|
118
|
+
serves: state.serves,
|
|
119
|
+
...state.paramsSchema ? { paramsSchema: state.paramsSchema } : {},
|
|
120
|
+
native: state.native,
|
|
121
|
+
logger: state.logger,
|
|
122
|
+
services: state.services,
|
|
123
|
+
constructs: state.constructs,
|
|
124
|
+
...state.timeout !== void 0 ? { timeout: state.timeout } : {},
|
|
125
|
+
...state.memorySize !== void 0 ? { memorySize: state.memorySize } : {}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/processors/pattern.ts
|
|
131
|
+
/** A pattern a processor cannot be served on. */
|
|
132
|
+
var ProcessorPatternInvalid = class extends Error {
|
|
133
|
+
pattern;
|
|
134
|
+
reason;
|
|
135
|
+
constructor(pattern, reason) {
|
|
136
|
+
super(`'${pattern}' is not a processor pattern: ${reason}. A pattern is a literal first segment, then any \`:name\` parameters, then \`*\` for the object's key — '/i/:width/*'.`);
|
|
137
|
+
this.pattern = pattern;
|
|
138
|
+
this.reason = reason;
|
|
139
|
+
this.name = "ProcessorPatternInvalid";
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
/** @throws {ProcessorPatternInvalid} */
|
|
143
|
+
function parsePattern(pattern) {
|
|
144
|
+
if (!pattern.startsWith("/")) throw new ProcessorPatternInvalid(pattern, "it does not start with /");
|
|
145
|
+
if (!pattern.endsWith("/*")) throw new ProcessorPatternInvalid(pattern, "it does not end with /* — the key");
|
|
146
|
+
const parts = pattern.slice(1, -2).split("/");
|
|
147
|
+
const segments = [];
|
|
148
|
+
const params = [];
|
|
149
|
+
for (const part of parts) {
|
|
150
|
+
if (part === "") throw new ProcessorPatternInvalid(pattern, "it has an empty segment");
|
|
151
|
+
if (part.includes("*")) throw new ProcessorPatternInvalid(pattern, "only its last segment may be *");
|
|
152
|
+
if (part.startsWith(":")) {
|
|
153
|
+
const name = part.slice(1);
|
|
154
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) throw new ProcessorPatternInvalid(pattern, `'${part}' is not a parameter name`);
|
|
155
|
+
if (params.includes(name)) throw new ProcessorPatternInvalid(pattern, `'${name}' appears twice`);
|
|
156
|
+
params.push(name);
|
|
157
|
+
segments.push({
|
|
158
|
+
kind: "param",
|
|
159
|
+
name
|
|
160
|
+
});
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (!/^[A-Za-z0-9._~-]+$/.test(part)) throw new ProcessorPatternInvalid(pattern, `'${part}' has characters a path segment would escape`);
|
|
164
|
+
segments.push({
|
|
165
|
+
kind: "literal",
|
|
166
|
+
value: part
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
const first = segments[0];
|
|
170
|
+
if (!first || first.kind !== "literal") throw new ProcessorPatternInvalid(pattern, "its first segment is a parameter, which would claim every path");
|
|
171
|
+
const literals = [];
|
|
172
|
+
for (const segment of segments) {
|
|
173
|
+
if (segment.kind !== "literal") break;
|
|
174
|
+
literals.push(segment.value);
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
pattern,
|
|
178
|
+
segments,
|
|
179
|
+
params,
|
|
180
|
+
prefix: `/${literals.join("/")}/`
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Match a request path, decoding each parameter and each key segment. A path
|
|
185
|
+
* with an empty key, or one that decodes to a `..` segment, matches nothing.
|
|
186
|
+
*/
|
|
187
|
+
function matchPattern(parsed, path) {
|
|
188
|
+
const parts = path.replace(/^\/+/, "").split("/");
|
|
189
|
+
if (parts.length <= parsed.segments.length) return void 0;
|
|
190
|
+
const params = {};
|
|
191
|
+
for (const [index, segment] of parsed.segments.entries()) {
|
|
192
|
+
const part = decode(parts[index] ?? "");
|
|
193
|
+
if (part === void 0 || part === "") return void 0;
|
|
194
|
+
if (segment.kind === "literal") {
|
|
195
|
+
if (part !== segment.value) return void 0;
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
params[segment.name] = part;
|
|
199
|
+
}
|
|
200
|
+
const keyParts = parts.slice(parsed.segments.length).map(decode);
|
|
201
|
+
if (keyParts.some((part) => part === void 0 || part === "..")) return;
|
|
202
|
+
const key = keyParts.join("/");
|
|
203
|
+
if (key === "" || keyParts.includes("")) return void 0;
|
|
204
|
+
return {
|
|
205
|
+
params,
|
|
206
|
+
key
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/** The path that addresses `key` through the pattern with these parameters. */
|
|
210
|
+
function fillPattern(parsed, params, key) {
|
|
211
|
+
const head = parsed.segments.map((segment) => {
|
|
212
|
+
if (segment.kind === "literal") return segment.value;
|
|
213
|
+
const value = params[segment.name];
|
|
214
|
+
if (value === void 0 || `${value}` === "") throw new ProcessorParamMissing(parsed.pattern, segment.name);
|
|
215
|
+
return encodeURIComponent(`${value}`);
|
|
216
|
+
});
|
|
217
|
+
const tail = key.replace(/^\/+/, "").split("/").map((part) => encodeURIComponent(part));
|
|
218
|
+
return `/${[...head, ...tail].join("/")}`;
|
|
219
|
+
}
|
|
220
|
+
/** A processed URL was asked for without one of the pattern's parameters. */
|
|
221
|
+
var ProcessorParamMissing = class extends Error {
|
|
222
|
+
pattern;
|
|
223
|
+
param;
|
|
224
|
+
constructor(pattern, param) {
|
|
225
|
+
super(`'${pattern}' needs '${param}' to address an object, and it was not given.`);
|
|
226
|
+
this.pattern = pattern;
|
|
227
|
+
this.param = param;
|
|
228
|
+
this.name = "ProcessorParamMissing";
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
function decode(part) {
|
|
232
|
+
try {
|
|
233
|
+
return decodeURIComponent(part);
|
|
234
|
+
} catch {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
//#endregion
|
|
239
|
+
export { parsePattern as a, DERIVED_PREFIX$1 as c, matchPattern as i, Processor as l, ProcessorPatternInvalid as n, ProcessorBuilder as o, fillPattern as r, ProcessorNativeInvalid as s, ProcessorParamMissing as t };
|
|
240
|
+
|
|
241
|
+
//# sourceMappingURL=pattern-C1CEcglD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern-C1CEcglD.mjs","names":[],"sources":["../src/processors/Processor.ts","../src/processors/ProcessorBuilder.ts","../src/processors/pattern.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service, ServiceRecord } from '@geekmidas/services';\nimport type { StorageClient } from '@geekmidas/storage';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { Construct, ConstructType } from '../Construct';\nimport type { ParsedPattern, PatternParams } from './pattern';\n\n/**\n * Where a processor's results are kept, under its file server's bucket.\n *\n * Written through on every result marked `immutable` and read before the\n * handler runs, so a derivative is made once. Exported so the bucket's expiry\n * can name it.\n */\nexport { DERIVED_PREFIX } from '@geekmidas/manifest';\n\n/** How long a response may be kept, by a browser and by the edge. */\nexport type ProcessorCache =\n\t/** Never changes for these parameters and this key: kept for a year. */\n\t| 'immutable'\n\t/** Kept this many seconds. */\n\t| { maxAge: number }\n\t/** Not kept. */\n\t| 'none';\n\n/** What a processor handler returns. */\nexport interface ProcessorResult {\n\tbody: Uint8Array | string;\n\tcontentType: string;\n\t/**\n\t * `immutable` results are also kept in the bucket, so the next request\n\t * for them never runs the handler. Defaults to an hour, kept nowhere.\n\t */\n\tcache?: ProcessorCache;\n}\n\n/** The object a request addresses, read from the bucket on first use. */\nexport interface SourceObject {\n\treadonly key: string;\n\tbytes(): Promise<Uint8Array>;\n\tstream(): Promise<ReadableStream<Uint8Array>>;\n\t/** The type it was stored with. */\n\tcontentType(): Promise<string | undefined>;\n}\n\nexport interface ProcessorContext<\n\tTParams,\n\tTServices extends Service[],\n\tTLogger extends Logger,\n> {\n\tparams: TParams;\n\tkey: string;\n\tobject: SourceObject;\n\tlogger: TLogger;\n\tservices: ServiceRecord<TServices>;\n}\n\nexport type ProcessorHandler<\n\tTParams,\n\tTServices extends Service[],\n\tTLogger extends Logger,\n> = (\n\tcontext: ProcessorContext<TParams, TServices, TLogger>,\n) => Promise<ProcessorResult> | ProcessorResult;\n\n/** What a processor's parameters parse to: its schema's output, or the raw strings. */\nexport type ProcessorParams<\n\tTPattern extends string,\n\tTSchema extends StandardSchemaV1 | undefined,\n> = TSchema extends StandardSchemaV1\n\t? InferStandardSchema<TSchema>\n\t: PatternParams<TPattern>;\n\n/**\n * A processor — a handler behind one path pattern of a file server, which\n * makes a derivative of an open object on read: a thumbnail, a page of a PDF.\n *\n * Built from the file server (`assets.process('/i/:width/*')`), so it carries\n * the bucket it reads and the open paths it may serve. Its parameters' schema\n * is the allowlist: a request outside it is refused before anything runs, so\n * nobody can mint new work — or new cache entries — by varying a number.\n */\nexport class Processor<\n\tTPattern extends string = string,\n\tTSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n> extends Construct<TLogger, undefined, TServices> {\n\t__IS_PROCESSOR__ = true;\n\n\tstatic isProcessor(obj: unknown): obj is Processor<string, any, any, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as { __IS_PROCESSOR__?: boolean }).__IS_PROCESSOR__ === true &&\n\t\t\t\t(obj as Construct).type === ConstructType.Processor,\n\t\t);\n\t}\n\n\tconstructor(\n\t\treadonly parsed: ParsedPattern,\n\t\treadonly handler: ProcessorHandler<\n\t\t\tProcessorParams<TPattern, TSchema>,\n\t\t\tTServices,\n\t\t\tTLogger\n\t\t>,\n\t\treadonly options: {\n\t\t\t/** The file server's surface id — the unit that runs it. */\n\t\t\tsurfaceId: string;\n\t\t\t/** The bucket it reads from and keeps derivatives in. */\n\t\t\tbucketId: string;\n\t\t\t/** How it reaches that bucket. */\n\t\t\torigin: Service<string, StorageClient>;\n\t\t\t/** Whether a key is one of the file server's open paths. */\n\t\t\tserves: (key: string) => boolean;\n\t\t\tparamsSchema?: TSchema;\n\t\t\t/** Packages with native code, installed for the target. */\n\t\t\tnative: readonly string[];\n\t\t\tlogger: TLogger;\n\t\t\tservices: TServices;\n\t\t\tconstructs: string[];\n\t\t\ttimeout?: number;\n\t\t\tmemorySize?: number;\n\t\t},\n\t) {\n\t\tsuper(\n\t\t\tConstructType.Processor,\n\t\t\toptions.logger,\n\t\t\t// The bucket is reached like any service — which is also how its URL\n\t\t\t// is found by the environment sniffer.\n\t\t\t[options.origin, ...options.services] as unknown as TServices,\n\t\t\t[],\n\t\t\tundefined,\n\t\t\toptions.timeout,\n\t\t\toptions.memorySize,\n\t\t\tundefined,\n\t\t\t// The bucket is an edge of its process, so the unit running it is\n\t\t\t// handed the bucket's address.\n\t\t\t[...new Set([options.bucketId, ...options.constructs])],\n\t\t);\n\t\tthis.owner = options.surfaceId;\n\t}\n\n\t/** The pattern it answers, as written. */\n\tget pattern(): TPattern {\n\t\treturn this.parsed.pattern as TPattern;\n\t}\n\n\t/** The literal path the edge routes to it — `/i/`. */\n\tget prefix(): string {\n\t\treturn this.parsed.prefix;\n\t}\n\n\tget native(): readonly string[] {\n\t\treturn this.options.native;\n\t}\n\n\tget surfaceId(): string {\n\t\treturn this.options.surfaceId;\n\t}\n\n\tget bucketId(): string {\n\t\treturn this.options.bucketId;\n\t}\n}\n","import type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StorageClient } from '@geekmidas/storage';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport {\n\ttype Consumable,\n\tidsOf,\n\ttype ServicesOf,\n\tservicesOf,\n} from '../construct-interface';\nimport {\n\tProcessor,\n\ttype ProcessorHandler,\n\ttype ProcessorParams,\n} from './Processor';\nimport type { ParsedPattern } from './pattern';\n\n/** A native package named in a way no installer could resolve. */\nexport class ProcessorNativeInvalid extends Error {\n\tconstructor(readonly packageName: string) {\n\t\tsuper(\n\t\t\t`'${packageName}' is not a package name. Name the package with native code ` +\n\t\t\t\t`as it is installed — 'sharp', '@napi-rs/canvas' — and its version ` +\n\t\t\t\t`is taken from the app's package.json.`,\n\t\t);\n\t\tthis.name = 'ProcessorNativeInvalid';\n\t}\n}\n\ninterface ProcessorBuilderState<TLogger extends Logger> {\n\tparsed: ParsedPattern;\n\tsurfaceId: string;\n\tbucketId: string;\n\torigin: Service<string, StorageClient>;\n\tserves: (key: string) => boolean;\n\tlogger: TLogger;\n\tparamsSchema?: StandardSchemaV1;\n\tnative: string[];\n\tservices: Service[];\n\tconstructs: string[];\n\ttimeout?: number;\n\tmemorySize?: number;\n}\n\n/**\n * What `fileServer.process(pattern)` returns: a processor, built up one\n * immutable step at a time and finished by `.handle()`.\n */\nexport class ProcessorBuilder<\n\tTPattern extends string,\n\tTSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n> {\n\tconstructor(private readonly state: ProcessorBuilderState<TLogger>) {}\n\n\t/**\n\t * The parameters' schema — the allowlist. Every request is parsed by it\n\t * before anything runs, and one it refuses is answered 400.\n\t */\n\tparams<T extends StandardSchemaV1>(\n\t\tschema: T,\n\t): ProcessorBuilder<TPattern, T, TServices, TLogger> {\n\t\treturn new ProcessorBuilder({ ...this.state, paramsSchema: schema });\n\t}\n\n\t/** Constructs its handler reaches, as `services.<id>`. */\n\tdependsOn<const T extends readonly Consumable[]>(\n\t\tconstructs: T,\n\t): ProcessorBuilder<\n\t\tTPattern,\n\t\tTSchema,\n\t\t[...TServices, ...ServicesOf<T>],\n\t\tTLogger\n\t> {\n\t\tconst services = servicesOf(constructs) as unknown as Service[];\n\t\treturn new ProcessorBuilder({\n\t\t\t...this.state,\n\t\t\tservices: [\n\t\t\t\t...this.state.services.filter(\n\t\t\t\t\t(service) =>\n\t\t\t\t\t\t!services.some((s) => s.serviceName === service.serviceName),\n\t\t\t\t),\n\t\t\t\t...services,\n\t\t\t],\n\t\t\tconstructs: idsOf(constructs, this.state.constructs),\n\t\t});\n\t}\n\n\t/**\n\t * Packages with native code — `sharp` — installed for the target the\n\t * processor runs on rather than bundled: linux in its image, arm64 on\n\t * Lambda.\n\t */\n\tnative(packages: readonly string[]): this {\n\t\tfor (const name of packages) {\n\t\t\tif (!/^(@[a-z0-9._~-]+\\/)?[a-z0-9._~-]+$/.test(name)) {\n\t\t\t\tthrow new ProcessorNativeInvalid(name);\n\t\t\t}\n\t\t}\n\t\treturn new ProcessorBuilder({\n\t\t\t...this.state,\n\t\t\tnative: [...new Set([...this.state.native, ...packages])],\n\t\t}) as this;\n\t}\n\n\t/** Milliseconds a request may take, where the target bounds it. */\n\ttimeout(ms: number): this {\n\t\treturn new ProcessorBuilder({ ...this.state, timeout: ms }) as this;\n\t}\n\n\t/** Megabytes of memory, where the target sets it. */\n\tmemorySize(mb: number): this {\n\t\treturn new ProcessorBuilder({ ...this.state, memorySize: mb }) as this;\n\t}\n\n\thandle(\n\t\tfn: ProcessorHandler<\n\t\t\tProcessorParams<TPattern, TSchema>,\n\t\t\tTServices,\n\t\t\tTLogger\n\t\t>,\n\t): Processor<TPattern, TSchema, TServices, TLogger> {\n\t\tconst { state } = this;\n\t\treturn new Processor<TPattern, TSchema, TServices, TLogger>(\n\t\t\tstate.parsed,\n\t\t\tfn,\n\t\t\t{\n\t\t\t\tsurfaceId: state.surfaceId,\n\t\t\t\tbucketId: state.bucketId,\n\t\t\t\torigin: state.origin,\n\t\t\t\tserves: state.serves,\n\t\t\t\t...(state.paramsSchema\n\t\t\t\t\t? { paramsSchema: state.paramsSchema as TSchema }\n\t\t\t\t\t: {}),\n\t\t\t\tnative: state.native,\n\t\t\t\tlogger: state.logger,\n\t\t\t\tservices: state.services as TServices,\n\t\t\t\tconstructs: state.constructs,\n\t\t\t\t...(state.timeout !== undefined ? { timeout: state.timeout } : {}),\n\t\t\t\t...(state.memorySize !== undefined\n\t\t\t\t\t? { memorySize: state.memorySize }\n\t\t\t\t\t: {}),\n\t\t\t},\n\t\t);\n\t}\n}\n","/**\n * A processor's path pattern: literal segments, `:name` parameters, and a\n * final `*` that is the object's key.\n *\n * ```\n * /i/:width/* → /i/256/avatars/7.png { width: '256' }, 'avatars/7.png'\n * /pdf/:page/:dpi/* → /pdf/1/150/doc.pdf { page: '1', dpi: '150' }, 'doc.pdf'\n * ```\n *\n * It starts with a literal segment because the edge routes on that prefix: a\n * pattern beginning with a parameter would claim every path on the file\n * server, objects included.\n */\n\n/** The parameter names a pattern declares, as a union. */\nexport type PatternParamNames<P extends string> =\n\tP extends `${string}/:${infer Name}/${infer Rest}`\n\t\t? Name | PatternParamNames<`/${Rest}`>\n\t\t: never;\n\n/** The raw parameters a pattern matches, before its schema parses them. */\nexport type PatternParams<P extends string> = {\n\t[K in PatternParamNames<P>]: string;\n};\n\n/** A pattern a processor cannot be served on. */\nexport class ProcessorPatternInvalid extends Error {\n\tconstructor(\n\t\treadonly pattern: string,\n\t\treadonly reason: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${pattern}' is not a processor pattern: ${reason}. A pattern is a ` +\n\t\t\t\t`literal first segment, then any \\`:name\\` parameters, then \\`*\\` ` +\n\t\t\t\t`for the object's key — '/i/:width/*'.`,\n\t\t);\n\t\tthis.name = 'ProcessorPatternInvalid';\n\t}\n}\n\n/** A pattern, parsed once. */\nexport interface ParsedPattern {\n\treadonly pattern: string;\n\t/** Each segment before the key: a literal, or a parameter's name. */\n\treadonly segments: readonly (\n\t\t| { kind: 'literal'; value: string }\n\t\t| { kind: 'param'; name: string }\n\t)[];\n\t/** The parameter names, in the order they appear. */\n\treadonly params: readonly string[];\n\t/** The literal path the edge routes on — `/i/`. */\n\treadonly prefix: string;\n}\n\n/** @throws {ProcessorPatternInvalid} */\nexport function parsePattern(pattern: string): ParsedPattern {\n\tif (!pattern.startsWith('/')) {\n\t\tthrow new ProcessorPatternInvalid(pattern, 'it does not start with /');\n\t}\n\tif (!pattern.endsWith('/*')) {\n\t\tthrow new ProcessorPatternInvalid(\n\t\t\tpattern,\n\t\t\t'it does not end with /* — the key',\n\t\t);\n\t}\n\n\tconst parts = pattern.slice(1, -2).split('/');\n\tconst segments: ParsedPattern['segments'][number][] = [];\n\tconst params: string[] = [];\n\tfor (const part of parts) {\n\t\tif (part === '') {\n\t\t\tthrow new ProcessorPatternInvalid(pattern, 'it has an empty segment');\n\t\t}\n\t\tif (part.includes('*')) {\n\t\t\tthrow new ProcessorPatternInvalid(\n\t\t\t\tpattern,\n\t\t\t\t'only its last segment may be *',\n\t\t\t);\n\t\t}\n\t\tif (part.startsWith(':')) {\n\t\t\tconst name = part.slice(1);\n\t\t\tif (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {\n\t\t\t\tthrow new ProcessorPatternInvalid(\n\t\t\t\t\tpattern,\n\t\t\t\t\t`'${part}' is not a parameter name`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (params.includes(name)) {\n\t\t\t\tthrow new ProcessorPatternInvalid(pattern, `'${name}' appears twice`);\n\t\t\t}\n\t\t\tparams.push(name);\n\t\t\tsegments.push({ kind: 'param', name });\n\t\t\tcontinue;\n\t\t}\n\t\tif (!/^[A-Za-z0-9._~-]+$/.test(part)) {\n\t\t\tthrow new ProcessorPatternInvalid(\n\t\t\t\tpattern,\n\t\t\t\t`'${part}' has characters a path segment would escape`,\n\t\t\t);\n\t\t}\n\t\tsegments.push({ kind: 'literal', value: part });\n\t}\n\n\tconst first = segments[0];\n\tif (!first || first.kind !== 'literal') {\n\t\tthrow new ProcessorPatternInvalid(\n\t\t\tpattern,\n\t\t\t'its first segment is a parameter, which would claim every path',\n\t\t);\n\t}\n\n\tconst literals: string[] = [];\n\tfor (const segment of segments) {\n\t\tif (segment.kind !== 'literal') break;\n\t\tliterals.push(segment.value);\n\t}\n\n\treturn { pattern, segments, params, prefix: `/${literals.join('/')}/` };\n}\n\n/** A path the pattern matched: its raw parameters and the key. */\nexport interface PatternMatch {\n\tparams: Record<string, string>;\n\tkey: string;\n}\n\n/**\n * Match a request path, decoding each parameter and each key segment. A path\n * with an empty key, or one that decodes to a `..` segment, matches nothing.\n */\nexport function matchPattern(\n\tparsed: ParsedPattern,\n\tpath: string,\n): PatternMatch | undefined {\n\tconst parts = path.replace(/^\\/+/, '').split('/');\n\tif (parts.length <= parsed.segments.length) return undefined;\n\n\tconst params: Record<string, string> = {};\n\tfor (const [index, segment] of parsed.segments.entries()) {\n\t\tconst part = decode(parts[index] ?? '');\n\t\tif (part === undefined || part === '') return undefined;\n\t\tif (segment.kind === 'literal') {\n\t\t\tif (part !== segment.value) return undefined;\n\t\t\tcontinue;\n\t\t}\n\t\tparams[segment.name] = part;\n\t}\n\n\tconst keyParts = parts.slice(parsed.segments.length).map(decode);\n\tif (keyParts.some((part) => part === undefined || part === '..')) {\n\t\treturn undefined;\n\t}\n\tconst key = keyParts.join('/');\n\tif (key === '' || keyParts.includes('')) return undefined;\n\n\treturn { params, key };\n}\n\n/** The path that addresses `key` through the pattern with these parameters. */\nexport function fillPattern(\n\tparsed: ParsedPattern,\n\tparams: Readonly<Record<string, string | number>>,\n\tkey: string,\n): string {\n\tconst head = parsed.segments.map((segment) => {\n\t\tif (segment.kind === 'literal') return segment.value;\n\t\tconst value = params[segment.name];\n\t\tif (value === undefined || `${value}` === '') {\n\t\t\tthrow new ProcessorParamMissing(parsed.pattern, segment.name);\n\t\t}\n\t\treturn encodeURIComponent(`${value}`);\n\t});\n\tconst tail = key\n\t\t.replace(/^\\/+/, '')\n\t\t.split('/')\n\t\t.map((part) => encodeURIComponent(part));\n\n\treturn `/${[...head, ...tail].join('/')}`;\n}\n\n/** A processed URL was asked for without one of the pattern's parameters. */\nexport class ProcessorParamMissing extends Error {\n\tconstructor(\n\t\treadonly pattern: string,\n\t\treadonly param: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${pattern}' needs '${param}' to address an object, and it was not given.`,\n\t\t);\n\t\tthis.name = 'ProcessorParamMissing';\n\t}\n}\n\nfunction decode(part: string): string | undefined {\n\ttry {\n\t\treturn decodeURIComponent(part);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n"],"mappings":"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"}
|