@kyro-cms/core 0.12.44 → 0.12.45
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/dist/{WebhookService-C19xR8qE.d.ts → WebhookService-CZf_na-J.d.ts} +1 -1
- package/dist/{WebhookService-BBcCHBo8.d.cts → WebhookService-DgIx21X-.d.cts} +1 -1
- package/dist/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +2 -1
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +2 -1
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.js +1 -1
- package/dist/{base-yXdYZxFK.d.ts → base-7vJMzr4V.d.ts} +1 -1
- package/dist/{base-C2iwjdJQ.d.cts → base-DDEmdRqV.d.cts} +1 -1
- package/dist/bcryptjs-AZA6WEN2.js +2 -0
- package/dist/bcryptjs-WIQSWJGK.cjs +1 -0
- package/dist/better-sqlite3-42Q3FG3E.js +2 -0
- package/dist/better-sqlite3-5IISPX34.cjs +1 -0
- package/dist/bootstrap-7CI3NVSY.js +1 -0
- package/dist/bootstrap-DOOM2CNQ.cjs +1 -0
- package/dist/bowser-FI5JQGKZ.js +11 -0
- package/dist/bowser-VX6B6ZSE.cjs +10 -0
- package/dist/chokidar-24HVS6XD.cjs +5 -0
- package/dist/chokidar-43DT7CVN.js +6 -0
- package/dist/chunk-26Q7JXM4.cjs +3 -0
- package/dist/chunk-2BUODBE2.js +2 -0
- package/dist/chunk-2WFTETFB.js +2 -0
- package/dist/chunk-35PGCW3S.cjs +1 -0
- package/dist/chunk-3VXEK5ZW.cjs +1 -0
- package/dist/chunk-45TJAB5X.js +301 -0
- package/dist/chunk-5DWYVUQR.cjs +1 -0
- package/dist/chunk-5LPNEYK5.cjs +1 -0
- package/dist/chunk-66BJXVFJ.js +2 -0
- package/dist/chunk-6KRR7YHA.js +2 -0
- package/dist/chunk-6KUL2BSA.cjs +133 -0
- package/dist/chunk-6MSS5X77.js +2 -0
- package/dist/chunk-6QWLXJ7L.js +2 -0
- package/dist/chunk-6V3AP7HR.cjs +269 -0
- package/dist/chunk-73D2PNHD.cjs +7 -0
- package/dist/chunk-7ACHOBWY.cjs +13 -0
- package/dist/chunk-7AQSH3KR.js +2 -0
- package/dist/chunk-7GGZA5YU.cjs +2 -0
- package/dist/chunk-7I6URA6F.js +4 -0
- package/dist/chunk-7JWQ2PZP.cjs +1 -0
- package/dist/chunk-7SSFHJTR.js +57 -0
- package/dist/chunk-7T35572E.js +75 -0
- package/dist/chunk-7V67ONUD.js +4 -0
- package/dist/chunk-7WMMKGEO.cjs +1 -0
- package/dist/chunk-A73AVVFR.js +11 -0
- package/dist/chunk-AK754S3T.cjs +2 -0
- package/dist/chunk-AMGJ5AFH.cjs +1 -0
- package/dist/chunk-ATBH763U.js +2 -0
- package/dist/chunk-B3GDQ7UI.cjs +114 -0
- package/dist/chunk-BAVN7VDR.cjs +1 -0
- package/dist/chunk-BCEE4NBZ.cjs +2 -0
- package/dist/{chunk-J4252I5B.cjs → chunk-BHR7OAU4.cjs} +4 -4
- package/dist/chunk-BLH2MRK4.js +2 -0
- package/dist/chunk-BPMA2ECA.js +10 -0
- package/dist/chunk-BUNLC3II.cjs +1 -0
- package/dist/chunk-C2PXMVR5.js +2 -0
- package/dist/chunk-CGPAS4U5.js +4 -0
- package/dist/chunk-DS5DE5BU.js +2 -0
- package/dist/chunk-DUO523BH.cjs +1 -0
- package/dist/chunk-DVWYO3KK.cjs +1 -0
- package/dist/chunk-E27KEZPT.js +2 -0
- package/dist/chunk-EHWUALGH.cjs +1 -0
- package/dist/chunk-EN65ZEK2.cjs +2 -0
- package/dist/chunk-EOOZDOL7.js +3 -0
- package/dist/chunk-EZIDQBXI.cjs +1 -0
- package/dist/chunk-F4ITQ6XQ.cjs +3 -0
- package/dist/chunk-FLM37UVD.js +2 -0
- package/dist/chunk-GIS6X43A.cjs +3 -0
- package/dist/chunk-GNEVCEJU.cjs +3 -0
- package/dist/chunk-GNOSG3PK.cjs +1 -0
- package/dist/chunk-HLAEJB5R.js +384 -0
- package/dist/chunk-HPYH7GTS.cjs +1 -0
- package/dist/chunk-HT44I66C.js +24 -0
- package/dist/chunk-HTYVI2HK.cjs +9 -0
- package/dist/chunk-ICVQWR2A.js +2 -0
- package/dist/chunk-IP6JUEH3.js +3 -0
- package/dist/chunk-IPXOY4RI.js +2 -0
- package/dist/chunk-J6U5LWZ7.js +11 -0
- package/dist/{chunk-UHFDH3PG.js → chunk-JT36FTHY.cjs} +4 -4
- package/dist/chunk-JUJZOG6P.js +2 -0
- package/dist/{chunk-2BTRHVT3.cjs → chunk-K7YNEKVE.js} +5 -4
- package/dist/chunk-KCHPADCH.cjs +7 -0
- package/dist/chunk-KH7LM52S.js +3 -0
- package/dist/chunk-LEBM6ZSZ.cjs +10 -0
- package/dist/chunk-LQ3YZTPU.cjs +15 -0
- package/dist/chunk-LY7N3UHH.cjs +23 -0
- package/dist/chunk-M6ESQ5TE.cjs +56 -0
- package/dist/chunk-MCZ3YZ2L.js +2 -0
- package/dist/chunk-MP5VC5ER.cjs +1 -0
- package/dist/chunk-MVX2PYJJ.cjs +1 -0
- package/dist/chunk-MY42EWZP.js +2 -0
- package/dist/chunk-MZOWPV4D.js +20 -0
- package/dist/chunk-NGNJSUGL.cjs +1 -0
- package/dist/chunk-NWCREF47.js +3 -0
- package/dist/chunk-OMWQVPV7.js +14 -0
- package/dist/chunk-ORG67NXX.js +3 -0
- package/dist/chunk-OSAVAYJZ.js +16 -0
- package/dist/chunk-P7XYIKL6.cjs +300 -0
- package/dist/chunk-PBOZJOKN.js +2 -0
- package/dist/chunk-PITMDQYN.cjs +18 -0
- package/dist/chunk-PL5AIE6F.js +2 -0
- package/dist/chunk-QC4YXUBT.cjs +383 -0
- package/dist/chunk-QDHP5E4P.cjs +2 -0
- package/dist/chunk-QYI3GOHF.cjs +1 -0
- package/dist/chunk-R3NEPC4I.js +3 -0
- package/dist/chunk-R4LXRAMX.js +2 -0
- package/dist/chunk-S5HTTLN7.cjs +2 -0
- package/dist/chunk-STX5V7HG.cjs +20 -0
- package/dist/chunk-SVYUTQVE.js +115 -0
- package/dist/chunk-SYEP5QLG.js +19 -0
- package/dist/chunk-TR3ZS3T3.js +3 -0
- package/dist/chunk-UB5TJHQR.js +2 -0
- package/dist/chunk-UD6ZPO7T.js +2 -0
- package/dist/chunk-UK43ADRO.js +270 -0
- package/dist/chunk-UNYXWPLZ.cjs +2 -0
- package/dist/chunk-VBPAAQEF.js +2 -0
- package/dist/chunk-VIUU4D5I.js +2 -0
- package/dist/chunk-VJ2WMKPK.js +21 -0
- package/dist/chunk-VOQUO2EZ.cjs +74 -0
- package/dist/chunk-VQ53TFYA.cjs +1 -0
- package/dist/chunk-VRZC4TTF.cjs +1 -0
- package/dist/chunk-W46LZ4MY.js +2 -0
- package/dist/chunk-WCFHS7EZ.cjs +1 -0
- package/dist/chunk-WGESLAWV.js +8 -0
- package/dist/chunk-WSP7PSXC.js +8 -0
- package/dist/chunk-X54XZACS.cjs +10 -0
- package/dist/{chunk-Q2UYCYKV.js → chunk-XBH4YMC7.js} +5 -4
- package/dist/chunk-XDE7CFV6.cjs +19 -0
- package/dist/chunk-XOACKBG7.js +4 -0
- package/dist/chunk-XPPVX4GQ.cjs +1 -0
- package/dist/chunk-ZJE3VAAW.js +134 -0
- package/dist/chunk-ZO3YB5DK.cjs +1 -0
- package/dist/chunk-ZOVH6QT5.cjs +1 -0
- package/dist/chunk-ZYDOF65Q.cjs +1 -0
- package/dist/cli/index.cjs +197 -78
- package/dist/cli/index.js +198 -78
- package/dist/client.cjs +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +2 -1
- package/dist/d1-5ZQJOFDX.cjs +1 -0
- package/dist/d1-VPH75GI2.js +2 -0
- package/dist/dist-es-3SSNUZST.cjs +1 -0
- package/dist/dist-es-6SVFVYN3.js +1 -0
- package/dist/dist-es-6TQTDPE7.js +2 -0
- package/dist/dist-es-A5OF2STN.cjs +2 -0
- package/dist/dist-es-BOW5V247.cjs +6 -0
- package/dist/dist-es-CRIMATLL.cjs +2 -0
- package/dist/dist-es-DL3VLVP6.cjs +1 -0
- package/dist/dist-es-EMUQ6ZNZ.js +3 -0
- package/dist/dist-es-MNIQZC4U.js +2 -0
- package/dist/dist-es-P25IKLBI.cjs +1 -0
- package/dist/dist-es-SJ76GYCI.js +2 -0
- package/dist/dist-es-SRPWSAF4.cjs +1 -0
- package/dist/dist-es-T2H2W5BX.cjs +3 -0
- package/dist/dist-es-TX4DBXEW.js +3 -0
- package/dist/dist-es-U4ZB3ZDA.js +7 -0
- package/dist/dist-es-XZBHIIKY.js +4 -0
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.d.cts +2 -2
- package/dist/drizzle/index.d.ts +2 -2
- package/dist/drizzle/index.js +1 -1
- package/dist/drizzle-orm-47ELDEM6.cjs +1 -0
- package/dist/drizzle-orm-7YTX5NTT.js +1 -0
- package/dist/event-streams-25YJ2Z6R.js +1 -0
- package/dist/event-streams-JBMWCI2O.cjs +1 -0
- package/dist/fields/index.cjs +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/fs-DGKZLRM6.cjs +1 -0
- package/dist/fs-YZJ5FM6J.js +2 -0
- package/dist/graphql/index.cjs +1 -1
- package/dist/graphql/index.d.cts +2 -2
- package/dist/graphql/index.d.ts +2 -2
- package/dist/graphql/index.js +1 -1
- package/dist/{index-DTz6u7w9.d.cts → index-BJ1rwHxk.d.cts} +1 -1
- package/dist/{index-BeQtbl3z.d.ts → index-BTjlptCL.d.ts} +1 -1
- package/dist/index.cjs +28 -46
- package/dist/index.d.cts +23 -9
- package/dist/index.d.ts +23 -9
- package/dist/index.js +29 -46
- package/dist/integration.cjs +1 -1
- package/dist/integration.js +1 -1
- package/dist/jsonwebtoken-DFB6ZBZA.cjs +8 -0
- package/dist/jsonwebtoken-S7BG2YWK.js +9 -0
- package/dist/lib-5QYYN6ML.cjs +12 -0
- package/dist/lib-IYW32OER.js +13 -0
- package/dist/loadSso-JY4WDQPS.cjs +2 -0
- package/dist/loadSso-YTG2GQGW.js +3 -0
- package/dist/local-VDCSEMC2.js +1 -0
- package/dist/local-YCWBUF3R.cjs +1 -0
- package/dist/media-3Z6YW5J4.cjs +1 -0
- package/dist/media-HK2IZMUZ.js +1 -0
- package/dist/mongo-auth-adapter-7K64Y2QM.cjs +1 -0
- package/dist/mongo-auth-adapter-BUKINEZL.js +1 -0
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.d.cts +2 -2
- package/dist/mongodb/index.d.ts +2 -2
- package/dist/mongodb/index.js +1 -1
- package/dist/nodemailer-AXROO37D.js +54 -0
- package/dist/nodemailer-IDML4L6W.cjs +53 -0
- package/dist/postgres-auth-adapter-2M4RNEY3.cjs +1 -0
- package/dist/postgres-auth-adapter-MKSHIJDL.js +1 -0
- package/dist/postgres-js-3Y54EXVQ.cjs +1 -0
- package/dist/postgres-js-INQPBHJP.js +1 -0
- package/dist/redis-adapter-EGMUN65D.cjs +1 -0
- package/dist/redis-adapter-SXOXLHNH.js +1 -0
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.d.cts +5 -5
- package/dist/rest/index.d.ts +5 -5
- package/dist/rest/index.js +1 -1
- package/dist/schema-RT6WSUYC.cjs +1 -0
- package/dist/schema-XC5ISGNR.js +2 -0
- package/dist/signin-KZBIAHGS.js +3 -0
- package/dist/signin-VFBLX7EL.cjs +2 -0
- package/dist/sqlite-adapter-DV7ZX2EJ.js +1 -0
- package/dist/sqlite-adapter-ZTABLT2X.cjs +1 -0
- package/dist/src-6LAUXXDM.cjs +1 -0
- package/dist/src-GZRZ4VAO.js +1 -0
- package/dist/sso-oidc-54BIRYR6.cjs +2 -0
- package/dist/sso-oidc-SX5OIQGG.js +3 -0
- package/dist/sts-HVGDJYIF.js +3 -0
- package/dist/sts-YLXXIB3X.cjs +2 -0
- package/dist/templates/index.cjs +1 -1
- package/dist/templates/index.d.cts +1 -1
- package/dist/templates/index.d.ts +1 -1
- package/dist/templates/index.js +1 -1
- package/dist/trpc/index.cjs +1 -1
- package/dist/trpc/index.d.cts +7 -7
- package/dist/trpc/index.d.ts +7 -7
- package/dist/trpc/index.js +1 -1
- package/dist/{types-CaXXmV9h.d.ts → types-CYGXsNcJ.d.ts} +5 -5
- package/dist/{types-BjivdGbU.d.cts → types-DOKMyC3y.d.cts} +5 -5
- package/dist/ws/index.cjs +1 -1
- package/dist/ws/index.js +1 -1
- package/package.json +2 -2
- package/dist/bootstrap-ROSTPMVL.js +0 -1
- package/dist/bootstrap-WW5NJ6EB.cjs +0 -1
- package/dist/chunk-3CVLI5C5.cjs +0 -3
- package/dist/chunk-3Q2WUG63.cjs +0 -2
- package/dist/chunk-3RSMK4DA.cjs +0 -2
- package/dist/chunk-4IGWJMBY.cjs +0 -2
- package/dist/chunk-4ORJMSJU.cjs +0 -1
- package/dist/chunk-4RMFCTWH.js +0 -1
- package/dist/chunk-5B6X2GBJ.js +0 -2
- package/dist/chunk-5J6HXUF6.js +0 -1
- package/dist/chunk-5KOQYQEE.js +0 -1
- package/dist/chunk-5SEHX7ON.js +0 -1
- package/dist/chunk-6ROHVUXF.js +0 -1
- package/dist/chunk-6SPPR5JZ.js +0 -3
- package/dist/chunk-7IVN6TTY.js +0 -133
- package/dist/chunk-AHSFSERC.cjs +0 -1
- package/dist/chunk-B5XWYVWK.js +0 -1
- package/dist/chunk-BGX27ZRG.cjs +0 -300
- package/dist/chunk-C2W5PSHC.js +0 -300
- package/dist/chunk-CCUQZ66T.cjs +0 -133
- package/dist/chunk-D5P2IPGX.cjs +0 -3
- package/dist/chunk-EPMGPNBE.js +0 -1
- package/dist/chunk-FHJJKFAU.cjs +0 -1
- package/dist/chunk-FVZ5RFLO.js +0 -2
- package/dist/chunk-FZ6Q2EBJ.cjs +0 -20
- package/dist/chunk-G3J2EU5D.cjs +0 -1
- package/dist/chunk-G7SSHELM.cjs +0 -1
- package/dist/chunk-GKYEJ2UF.js +0 -1
- package/dist/chunk-GO34AOBZ.cjs +0 -1
- package/dist/chunk-GYQMNXXW.cjs +0 -114
- package/dist/chunk-HLSB2MCK.js +0 -1
- package/dist/chunk-HQP2Y7QQ.js +0 -251
- package/dist/chunk-HS2KNFAB.cjs +0 -2
- package/dist/chunk-HVXO3OFB.cjs +0 -1
- package/dist/chunk-IETGL7WJ.js +0 -1
- package/dist/chunk-IFJ73O3A.cjs +0 -1
- package/dist/chunk-ILEZ3NYX.cjs +0 -2
- package/dist/chunk-INB4LNA6.js +0 -90
- package/dist/chunk-K6WUOU6P.js +0 -1
- package/dist/chunk-KD7LUCFY.cjs +0 -1
- package/dist/chunk-KDNYHLD2.js +0 -1
- package/dist/chunk-LHW4R367.js +0 -1
- package/dist/chunk-MIOMMB23.cjs +0 -1
- package/dist/chunk-N5VNHUJS.cjs +0 -4
- package/dist/chunk-NRLIGDYF.js +0 -1
- package/dist/chunk-NY47CFVP.cjs +0 -1
- package/dist/chunk-NZJAGASC.cjs +0 -251
- package/dist/chunk-OG7CNQGU.js +0 -1
- package/dist/chunk-PP5S2UBV.js +0 -0
- package/dist/chunk-PP7W5UKL.js +0 -2
- package/dist/chunk-Q3Q7BJVQ.cjs +0 -1
- package/dist/chunk-QCA3AP3M.cjs +0 -1
- package/dist/chunk-QOCHBPMK.js +0 -2
- package/dist/chunk-QYFU5Y7S.js +0 -3
- package/dist/chunk-RHCWCG3O.js +0 -114
- package/dist/chunk-SK2Q4PRV.cjs +0 -90
- package/dist/chunk-TFBHE5FF.cjs +0 -1
- package/dist/chunk-UBRYJP2G.js +0 -1
- package/dist/chunk-V65NPSR5.cjs +0 -1
- package/dist/chunk-VGQ4VUG6.js +0 -2
- package/dist/chunk-W7C6SJXZ.js +0 -20
- package/dist/chunk-WIZ6C5QZ.cjs +0 -1
- package/dist/chunk-ZIWJJRWQ.js +0 -4
- package/dist/chunk-ZUVP4UK7.cjs +0 -1
- package/dist/media-L5XDD47D.js +0 -1
- package/dist/media-OUBQTIQP.cjs +0 -1
- package/dist/mongo-auth-adapter-5TJO5J5U.js +0 -1
- package/dist/mongo-auth-adapter-JVE5M3S4.cjs +0 -1
- package/dist/postgres-auth-adapter-33QOIRXT.js +0 -1
- package/dist/postgres-auth-adapter-JKDYYULH.cjs +0 -1
- package/dist/redis-adapter-NN3H4GRX.js +0 -1
- package/dist/redis-adapter-OUKQGYCH.cjs +0 -1
- package/dist/schema-HIUSHSUI.cjs +0 -1
- package/dist/schema-KFYUM674.js +0 -1
- package/dist/sqlite-adapter-GTTVSXRV.cjs +0 -1
- package/dist/sqlite-adapter-UPANATIW.js +0 -1
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
'use strict';var chunkHPYH7GTS_cjs=require('./chunk-HPYH7GTS.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();function g(i){let{title:e,previewText:t=e,badgeText:r="Security Notification",badgeType:s="info",bodyHtml:o,ctaText:a,ctaUrl:n,secondaryCtaText:l,secondaryCtaUrl:p}=i,f="#eff6ff",m="#bfdbfe",u="#1d4ed8";return s==="success"?(f="#ecfdf5",m="#a7f3d0",u="#047857"):s==="warning"?(f="#fffbeb",m="#fde68a",u="#b45309"):s==="error"&&(f="#fef2f2",m="#fecaca",u="#b91c1c"),`<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<meta name="color-scheme" content="light dark">
|
|
7
|
+
<meta name="supported-color-schemes" content="light dark">
|
|
8
|
+
<title>${e}</title>
|
|
9
|
+
<style>
|
|
10
|
+
:root {
|
|
11
|
+
color-scheme: light dark;
|
|
12
|
+
supported-color-schemes: light dark;
|
|
13
|
+
}
|
|
14
|
+
@media (prefers-color-scheme: dark) {
|
|
15
|
+
.email-body { background-color: #09090b !important; color: #f4f4f5 !important; }
|
|
16
|
+
.email-card { background-color: #121215 !important; border-color: #27272a !important; box-shadow: none !important; }
|
|
17
|
+
.email-header { background-color: #18181b !important; border-color: #27272a !important; }
|
|
18
|
+
.email-brand-text { color: #ffffff !important; }
|
|
19
|
+
.email-title { color: #ffffff !important; }
|
|
20
|
+
.email-text { color: #a1a1aa !important; }
|
|
21
|
+
.email-strong { color: #ffffff !important; }
|
|
22
|
+
.email-table { background-color: #18181b !important; border-color: #27272a !important; }
|
|
23
|
+
.email-td-border { border-color: #27272a !important; }
|
|
24
|
+
.email-label { color: #a1a1aa !important; }
|
|
25
|
+
.email-value { color: #f4f4f5 !important; }
|
|
26
|
+
.email-code-box { background-color: #18181b !important; border-color: #27272a !important; color: #ffffff !important; }
|
|
27
|
+
.email-btn-primary { background-color: #ffffff !important; color: #09090b !important; }
|
|
28
|
+
.email-btn-secondary { background-color: #18181b !important; border-color: #27272a !important; color: #f4f4f5 !important; }
|
|
29
|
+
.email-footer { background-color: #09090b !important; border-color: #27272a !important; }
|
|
30
|
+
.email-footer-text { color: #71717a !important; }
|
|
31
|
+
.email-footer-link { color: #a1a1aa !important; }
|
|
32
|
+
.logo-light { display: none !important; }
|
|
33
|
+
.logo-dark { display: inline-block !important; }
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
36
|
+
</head>
|
|
37
|
+
<body class="email-body" style="margin: 0; padding: 36px 16px; background-color: #f4f4f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; color: #09090b; -webkit-font-smoothing: antialiased;">
|
|
38
|
+
<!-- Preview Text -->
|
|
39
|
+
<div style="display: none; max-height: 0; overflow: hidden;">${t}</div>
|
|
40
|
+
|
|
41
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-card" style="max-width: 540px; margin: 0 auto; background-color: #ffffff; border: 1px solid #e4e4e7; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);">
|
|
42
|
+
<!-- Header Bar -->
|
|
43
|
+
<tr>
|
|
44
|
+
<td class="email-header" style="padding: 22px 28px; border-bottom: 1px solid #f4f4f5; background-color: #ffffff;">
|
|
45
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
46
|
+
<tr>
|
|
47
|
+
<td align="left" valign="middle">
|
|
48
|
+
<a href="https://kyro-cms.com" target="_blank" style="text-decoration: none; display: inline-flex; align-items: center; gap: 10px;">
|
|
49
|
+
<!-- Light Mode Logo -->
|
|
50
|
+
<img src="https://kyro-cms.com/logo.svg" alt="Kyro Logo" class="logo-light" height="24" style="display: inline-block; border: 0; max-height: 24px; vertical-align: middle;" />
|
|
51
|
+
<!-- Dark Mode Logo -->
|
|
52
|
+
<img src="https://kyro-cms.com/logo-white.svg" alt="Kyro Logo" class="logo-dark" height="24" style="display: none; border: 0; max-height: 24px; vertical-align: middle;" />
|
|
53
|
+
<span class="email-brand-text" style="font-size: 16px; font-weight: 700; color: #09090b; letter-spacing: -0.3px; vertical-align: middle;">Kyro CMS</span>
|
|
54
|
+
</a>
|
|
55
|
+
</td>
|
|
56
|
+
<td align="right" valign="middle">
|
|
57
|
+
<span class="badge-status" style="display: inline-block; padding: 4px 10px; background-color: ${f}; border: 1px solid ${m}; border-radius: 9999px; font-size: 11px; font-weight: 500; color: ${u};">
|
|
58
|
+
${r}
|
|
59
|
+
</span>
|
|
60
|
+
</td>
|
|
61
|
+
</tr>
|
|
62
|
+
</table>
|
|
63
|
+
</td>
|
|
64
|
+
</tr>
|
|
65
|
+
|
|
66
|
+
<!-- Body Section -->
|
|
67
|
+
<tr>
|
|
68
|
+
<td style="padding: 28px;">
|
|
69
|
+
<h1 class="email-title" style="margin: 0 0 12px; font-size: 20px; font-weight: 600; color: #09090b; letter-spacing: -0.3px;">
|
|
70
|
+
${e}
|
|
71
|
+
</h1>
|
|
72
|
+
|
|
73
|
+
${o}
|
|
74
|
+
|
|
75
|
+
${a&&n?`
|
|
76
|
+
<!-- Action Buttons -->
|
|
77
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top: 24px;">
|
|
78
|
+
<tr>
|
|
79
|
+
<td align="left">
|
|
80
|
+
<a href="${n}" target="_blank" class="email-btn-primary" style="display: inline-block; padding: 11px 20px; background-color: #09090b; color: #ffffff; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 6px;">
|
|
81
|
+
${a} \u2192
|
|
82
|
+
</a>
|
|
83
|
+
${l&&p?`<a href="${p}" target="_blank" class="email-btn-secondary" style="display: inline-block; padding: 11px 16px; margin-left: 8px; background-color: #ffffff; border: 1px solid #e4e4e7; color: #09090b; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 6px;">
|
|
84
|
+
${l}
|
|
85
|
+
</a>`:""}
|
|
86
|
+
</td>
|
|
87
|
+
</tr>
|
|
88
|
+
</table>`:""}
|
|
89
|
+
</td>
|
|
90
|
+
</tr>
|
|
91
|
+
|
|
92
|
+
<!-- Footer -->
|
|
93
|
+
<tr>
|
|
94
|
+
<td class="email-footer" style="padding: 18px 28px; border-top: 1px solid #f4f4f5; background-color: #fafafa; text-align: center;">
|
|
95
|
+
<p class="email-footer-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
|
|
96
|
+
Sent securely via <strong>Kyro CMS Authentication Engine</strong>.
|
|
97
|
+
</p>
|
|
98
|
+
<p style="margin: 0; font-size: 12px; color: #71717a;">
|
|
99
|
+
<a href="https://kyro-cms.com" target="_blank" class="email-footer-link" style="color: #09090b; text-decoration: none; font-weight: 500;">kyro-cms.com</a> \u2022
|
|
100
|
+
<a href="https://kyro-cms.com/docs" target="_blank" class="email-footer-link" style="color: #09090b; text-decoration: none; font-weight: 500;">Docs</a> \u2022
|
|
101
|
+
<a href="https://github.com/danielDozie/kyro-cms" target="_blank" class="email-footer-link" style="color: #09090b; text-decoration: none; font-weight: 500;">GitHub</a>
|
|
102
|
+
</p>
|
|
103
|
+
</td>
|
|
104
|
+
</tr>
|
|
105
|
+
</table>
|
|
106
|
+
</body>
|
|
107
|
+
</html>`}chunkBUNLC3II_cjs.h();function b(i,e="User"){let t="Confirm your email address \u2014 Kyro CMS",r=`
|
|
108
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
109
|
+
Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
|
|
110
|
+
</p>
|
|
111
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
112
|
+
Thank you for registering. Please confirm your email address by clicking the verification button below to activate your account.
|
|
113
|
+
</p>
|
|
114
|
+
|
|
115
|
+
<!-- Verification Token Link Card -->
|
|
116
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
|
|
117
|
+
<tr>
|
|
118
|
+
<td style="font-size: 12px; color: #71717a; line-height: 1.5; word-break: break-all;">
|
|
119
|
+
<strong>Direct link:</strong><br />
|
|
120
|
+
<a href="${i}" style="color: #09090b; text-decoration: underline;" class="email-value">${i}</a>
|
|
121
|
+
</td>
|
|
122
|
+
</tr>
|
|
123
|
+
</table>
|
|
124
|
+
|
|
125
|
+
<p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
|
|
126
|
+
This verification link will expire in 24 hours. If you did not create an account, you can safely ignore this email.
|
|
127
|
+
</p>
|
|
128
|
+
`,s=g({title:"Confirm Your Email Address",previewText:"Please confirm your email address to activate your Kyro CMS account.",badgeText:"Action Required",badgeType:"warning",bodyHtml:r,ctaText:"Confirm Email Address",ctaUrl:i,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),o=`Welcome, ${e}!
|
|
129
|
+
|
|
130
|
+
Please verify your email address by visiting:
|
|
131
|
+
${i}
|
|
132
|
+
|
|
133
|
+
This link expires in 24 hours.
|
|
134
|
+
|
|
135
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:t,html:s,text:o}}chunkBUNLC3II_cjs.h();function x(i,e="User"){let t="Reset your password \u2014 Kyro CMS",r=`
|
|
136
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
137
|
+
Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
|
|
138
|
+
</p>
|
|
139
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
140
|
+
We received a request to reset the password for your account. Click the button below to choose a new password.
|
|
141
|
+
</p>
|
|
142
|
+
|
|
143
|
+
<!-- Reset Link Box -->
|
|
144
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
|
|
145
|
+
<tr>
|
|
146
|
+
<td style="font-size: 12px; color: #71717a; line-height: 1.5; word-break: break-all;">
|
|
147
|
+
<strong>Reset URL:</strong><br />
|
|
148
|
+
<a href="${i}" style="color: #09090b; text-decoration: underline;" class="email-value">${i}</a>
|
|
149
|
+
</td>
|
|
150
|
+
</tr>
|
|
151
|
+
</table>
|
|
152
|
+
|
|
153
|
+
<p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
|
|
154
|
+
For security reasons, this link will expire in 1 hour. If you did not request a password reset, no further action is required.
|
|
155
|
+
</p>
|
|
156
|
+
`,s=g({title:"Reset Your Password",previewText:"Use this secure link to reset your Kyro CMS password.",badgeText:"Security Action",badgeType:"warning",bodyHtml:r,ctaText:"Reset Password",ctaUrl:i}),o=`Hello ${e},
|
|
157
|
+
|
|
158
|
+
Reset your password using the following link:
|
|
159
|
+
${i}
|
|
160
|
+
|
|
161
|
+
This link will expire in 1 hour.
|
|
162
|
+
|
|
163
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:t,html:s,text:o}}chunkBUNLC3II_cjs.h();function _(i="User",e="https://kyro-cms.com"){let t="Welcome to Kyro CMS!",r=`
|
|
164
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
165
|
+
Welcome <strong class="email-strong" style="color: #09090b;">${i}</strong>,
|
|
166
|
+
</p>
|
|
167
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
168
|
+
Your Kyro CMS account is now set up and ready to go. You can access your admin dashboard, build content collections, and manage schema endpoints.
|
|
169
|
+
</p>
|
|
170
|
+
|
|
171
|
+
<!-- Key Capabilities List -->
|
|
172
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 24px; padding: 16px; border-collapse: separate;">
|
|
173
|
+
<tr>
|
|
174
|
+
<td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
|
|
175
|
+
\u{1F680} <strong>What you can do next:</strong>
|
|
176
|
+
<ul style="margin: 8px 0 0; padding-left: 20px; color: #52525b;">
|
|
177
|
+
<li>Define collections & custom field schemas in <code style="font-family: monospace;">kyro.config.ts</code></li>
|
|
178
|
+
<li>Explore auto-generated REST, GraphQL, tRPC & WebSocket endpoints</li>
|
|
179
|
+
<li>Customize your visual Admin dashboard & branding settings</li>
|
|
180
|
+
</ul>
|
|
181
|
+
</td>
|
|
182
|
+
</tr>
|
|
183
|
+
</table>
|
|
184
|
+
`,s=g({title:"Welcome to Kyro CMS",previewText:"Your account is verified and ready. Start building content applications.",badgeText:"Account Ready",badgeType:"success",bodyHtml:r,ctaText:"Open Dashboard",ctaUrl:e,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),o=`Welcome to Kyro CMS, ${i}!
|
|
185
|
+
|
|
186
|
+
Your account is active. Log in at ${e} to start building.
|
|
187
|
+
|
|
188
|
+
Documentation: https://kyro-cms.com/docs`;return {subject:t,html:s,text:o}}chunkBUNLC3II_cjs.h();function S(i="User"){let e="Security Alert: Password Changed \u2014 Kyro CMS",t=new Date().toUTCString(),r=`
|
|
189
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
190
|
+
Hello <strong class="email-strong" style="color: #09090b;">${i}</strong>,
|
|
191
|
+
</p>
|
|
192
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
193
|
+
This email confirms that the password for your Kyro CMS account was successfully updated on <strong>${t}</strong>.
|
|
194
|
+
</p>
|
|
195
|
+
|
|
196
|
+
<!-- Security Warning Card -->
|
|
197
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
|
|
198
|
+
<tr>
|
|
199
|
+
<td style="font-size: 13px; color: #991b1b; line-height: 1.5;">
|
|
200
|
+
\u26A0\uFE0F <strong>Did not request this change?</strong><br />
|
|
201
|
+
If you did not initiate this change, your account may be compromised. Reset your password immediately and contact an administrator.
|
|
202
|
+
</td>
|
|
203
|
+
</tr>
|
|
204
|
+
</table>
|
|
205
|
+
`,s=g({title:"Password Updated",previewText:"Your Kyro CMS account password was updated.",badgeText:"Security Alert",badgeType:"warning",bodyHtml:r,ctaText:"Account Security",ctaUrl:"https://kyro-cms.com"}),o=`Security Alert: Your Kyro CMS password was updated at ${t}.
|
|
206
|
+
|
|
207
|
+
If you did not make this change, please reset your password immediately.
|
|
208
|
+
|
|
209
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:e,html:s,text:o}}chunkBUNLC3II_cjs.h();function T(i,e,t="User"){let r="Your one-time login link \u2014 Kyro CMS",s=`
|
|
210
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
211
|
+
Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
|
|
212
|
+
</p>
|
|
213
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
214
|
+
Click the button below to sign in to your Kyro CMS account without entering a password.
|
|
215
|
+
</p>
|
|
216
|
+
|
|
217
|
+
${e?`
|
|
218
|
+
<!-- One-Time Passcode Box -->
|
|
219
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 16px; text-align: center;">
|
|
220
|
+
<tr>
|
|
221
|
+
<td style="font-size: 12px; color: #71717a; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;">
|
|
222
|
+
One-Time Passcode
|
|
223
|
+
</td>
|
|
224
|
+
</tr>
|
|
225
|
+
<tr>
|
|
226
|
+
<td style="font-size: 28px; font-weight: 800; font-family: monospace; color: #09090b; letter-spacing: 4px;" class="email-code-box">
|
|
227
|
+
${e}
|
|
228
|
+
</td>
|
|
229
|
+
</tr>
|
|
230
|
+
</table>`:""}
|
|
231
|
+
|
|
232
|
+
<p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
|
|
233
|
+
This single-use link will expire in 10 minutes. Never share authentication links with anyone.
|
|
234
|
+
</p>
|
|
235
|
+
`,o=g({title:"Sign in to Kyro CMS",previewText:"Your secure magic login link for Kyro CMS.",badgeText:"Instant Login",badgeType:"info",bodyHtml:s,ctaText:"Sign In Now",ctaUrl:i}),a=`Hello ${t},
|
|
236
|
+
|
|
237
|
+
Sign in to Kyro CMS using the link below:
|
|
238
|
+
${i}${e?`
|
|
239
|
+
|
|
240
|
+
Or enter code: ${e}`:""}
|
|
241
|
+
|
|
242
|
+
This link expires in 10 minutes.
|
|
243
|
+
|
|
244
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:o,text:a}}chunkBUNLC3II_cjs.h();function w(i,e,t="User"){let r="Security Alert: Account Temporarily Locked \u2014 Kyro CMS",s=`
|
|
245
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
246
|
+
Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
|
|
247
|
+
</p>
|
|
248
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
249
|
+
Your Kyro CMS account was temporarily locked after <strong>${i} failed login attempts</strong>.
|
|
250
|
+
</p>
|
|
251
|
+
|
|
252
|
+
<!-- Lockout Notice Card -->
|
|
253
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
|
|
254
|
+
<tr>
|
|
255
|
+
<td style="font-size: 13px; color: #b45309; line-height: 1.5;">
|
|
256
|
+
\u{1F512} <strong>Lockout duration:</strong> ${e} minutes.<br />
|
|
257
|
+
You may try logging in again after the cooling-off period expires.
|
|
258
|
+
</td>
|
|
259
|
+
</tr>
|
|
260
|
+
</table>
|
|
261
|
+
`,o=g({title:"Account Temporarily Locked",previewText:"Your Kyro CMS account was locked due to multiple failed login attempts.",badgeText:"Security Lockout",badgeType:"warning",bodyHtml:s,ctaText:"Unlock Instructions",ctaUrl:"https://kyro-cms.com/docs"}),a=`Security Alert: Account temporarily locked for ${t} after ${i} failed login attempts. Unlocks in ${e} minutes.
|
|
262
|
+
|
|
263
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:o,text:a}}chunkBUNLC3II_cjs.h();function C(i,e="Editor",t="An Administrator"){let r="You're invited to join Kyro CMS",s=`
|
|
264
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
265
|
+
Hello,
|
|
266
|
+
</p>
|
|
267
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
268
|
+
<strong class="email-strong" style="color: #09090b;">${t}</strong> has invited you to join their team workspace as an <strong>${e}</strong> in Kyro CMS.
|
|
269
|
+
</p>
|
|
270
|
+
|
|
271
|
+
<!-- Invite Details Card -->
|
|
272
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
|
|
273
|
+
<tr>
|
|
274
|
+
<td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
|
|
275
|
+
<strong>Assigned Role:</strong> ${e}<br />
|
|
276
|
+
<strong>Invited By:</strong> ${t}
|
|
277
|
+
</td>
|
|
278
|
+
</tr>
|
|
279
|
+
</table>
|
|
280
|
+
`,o=g({title:"Workspace Invitation",previewText:`You have been invited to join Kyro CMS as an ${e}.`,badgeText:"Team Invite",badgeType:"info",bodyHtml:s,ctaText:"Accept Invitation",ctaUrl:i,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),a=`You're invited to join Kyro CMS as an ${e} by ${t}.
|
|
281
|
+
|
|
282
|
+
Accept your invitation here:
|
|
283
|
+
${i}
|
|
284
|
+
|
|
285
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:o,text:a}}chunkBUNLC3II_cjs.h();function E(){return {verifyEmail:(i,e)=>b(i,e),resetPassword:(i,e)=>x(i,e),welcome:(i,e)=>_(i,e),passwordChanged:i=>S(i),magicLink:(i,e,t)=>T(i,e,t),accountLocked:(i,e,t)=>w(i,e,t),newLogin:(i,e,t="User")=>{let r="Security Alert: New Sign-in to Kyro CMS",s=`New login detected for ${t} at ${e} from ${i}.`,o=`<p>${s}</p>`;return {subject:r,html:o,text:s}},userInvite:(i,e,t)=>C(i,e,t)}}chunkBUNLC3II_cjs.h();var k=false,y=class i{db;cache={};loaded=false;static SENSITIVE_KEYS=["storage.s3.secret_access_key","storage.r2.secret_access_key","storage.gcs.private_key","storage.backblaze.application_key","storage.wasabi.secret_access_key","storage.ftp.password","storage.bunny.api_key","storage.cloudinary.api_secret","storage.imgix.sign_key","email.smtp.pass","auth.jwt_secret","auth.github_secret","auth.google_secret","auth.app_secret","database.url","redis.url","auth.admin_password"];constructor(e){this.db=e;}async load(){if(!this.loaded){await this.ensureSettingsTable();try{if(typeof this.db?.select=="function"){let e=await this.db.select().from(chunkHPYH7GTS_cjs.a);this.cache=e.reduce((t,r)=>(t[r.key]=r.value,t),{});}await this.loadFromGlobals();}catch{console.warn("ConfigService: Could not load settings from database, using environment fallbacks.");}this.loaded=true;}}async ensureSettingsTable(){if(!k)try{if(typeof this.db?.execute=="function"){let{sql:e}=await import('./drizzle-orm-47ELDEM6.cjs');await this.db.execute(e`
|
|
286
|
+
CREATE TABLE IF NOT EXISTS "settings" (
|
|
287
|
+
"key" VARCHAR(255) PRIMARY KEY,
|
|
288
|
+
"value" TEXT NOT NULL,
|
|
289
|
+
"description" TEXT,
|
|
290
|
+
"updated_at" TIMESTAMP DEFAULT NOW()
|
|
291
|
+
)
|
|
292
|
+
`),k=!0;}else typeof this.db?.exec=="function"&&(this.db.exec(`
|
|
293
|
+
CREATE TABLE IF NOT EXISTS settings (
|
|
294
|
+
key TEXT PRIMARY KEY,
|
|
295
|
+
value TEXT NOT NULL,
|
|
296
|
+
description TEXT,
|
|
297
|
+
updated_at TEXT
|
|
298
|
+
)
|
|
299
|
+
`),k=!0);}catch{}}async loadFromGlobals(){try{let e=null;if(typeof this.db?.findOne=="function")try{let s=await this.db.findOne({collection:"_globals_storage-settings",where:{},draft:!0});s&&(e=s);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:s}=await import('./drizzle-orm-47ELDEM6.cjs'),o=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let a of o)try{let n=await this.db.execute(s`SELECT * FROM ${s.raw(a)} LIMIT 1`);if(e=Array.isArray(n)?n[0]:n?.rows?n.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let s=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let o of s)try{if(e=this.db.prepare(`SELECT * FROM ${o} LIMIT 1`).get(),e)break}catch{}}if(!e)return;let t=s=>{if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return s},r=e.provider||"local";if(this.cache["storage.type"]=r,r==="local"){let s=t(e.local);this.cache["storage.local.dir"]=s?.uploadDir||"./public/uploads",this.cache["storage.local.url"]=s?.baseUrl||"/uploads";}if(r==="aws"){let s=t(e.aws);this.cache["storage.s3.bucket"]=s?.bucket||"",this.cache["storage.s3.region"]=s?.region||"us-east-1",this.cache["storage.s3.access_key_id"]=s?.accessKeyId||"",this.cache["storage.s3.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.s3.endpoint"]=s?.endpoint||"",this.cache["storage.s3.cdn_url"]=s?.cdnUrl||"",this.cache["storage.s3.prefix"]=s?.prefix||"";}if(r==="r2"){let s=t(e.r2);this.cache["storage.r2.account_id"]=s?.accountId||"",this.cache["storage.r2.access_key_id"]=s?.accessKeyId||"",this.cache["storage.r2.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.r2.bucket"]=s?.bucket||"",this.cache["storage.r2.cdn_url"]=s?.cdnUrl||"",this.cache["storage.r2.prefix"]=s?.prefix||"";}if(r==="cloudinary"){let s=t(e.cloudinary);this.cache["storage.cloudinary.cloud_name"]=s?.cloudName||"",this.cache["storage.cloudinary.api_key"]=s?.apiKey||"",this.cache["storage.cloudinary.api_secret"]=s?.apiSecret||"",this.cache["storage.cloudinary.folder"]=s?.folder||"";}if(r==="ftp"){let s=t(e.ftp);this.cache["storage.ftp.host"]=s?.host||"",this.cache["storage.ftp.port"]=String(s?.port||"21"),this.cache["storage.ftp.user"]=s?.user||"",this.cache["storage.ftp.password"]=s?.password||"",this.cache["storage.ftp.secure"]=s?.secure?"true":"false",this.cache["storage.ftp.base_url"]=s?.baseUrl||"",this.cache["storage.ftp.prefix"]=s?.prefix||"";}}catch(e){console.warn("ConfigService: Could not load storage settings from globals table:",e);}try{let e=null;if(typeof this.db?.findOne=="function")try{let t=await this.db.findOne({collection:"_globals_email-settings",where:{},draft:!0});t&&(e=t);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:t}=await import('./drizzle-orm-47ELDEM6.cjs'),r=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let s of r)try{let o=await this.db.execute(t`SELECT * FROM ${t.raw(s)} LIMIT 1`);if(e=Array.isArray(o)?o[0]:o?.rows?o.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let t=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let r of t)try{if(e=this.db.prepare(`SELECT * FROM ${r} LIMIT 1`).get(),e)break}catch{}}if(e){let t=r=>{if(!r)return null;if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r};if(this.cache["email.provider"]=e.provider||"smtp",this.cache["email.smtp.from"]=e.fromEmail||"",this.cache["email.smtp.from_name"]=e.fromName||"",this.cache["email.smtp.reply_to"]=e.replyTo||"",e.provider==="smtp"){let r=t(e.smtp);this.cache["email.smtp.host"]=r?.host||"",this.cache["email.smtp.port"]=String(r?.port||"587"),this.cache["email.smtp.user"]=r?.username||"",this.cache["email.smtp.pass"]=r?.password||"",this.cache["email.smtp.secure"]=r?.secure?"true":"false";}else if(e.provider==="resend"){let r=t(e.resend);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="sendgrid"){let r=t(e.sendgrid);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="mailgun"){let r=t(e.mailgun);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="ses"){let r=t(e.ses);this.cache["email.smtp.user"]=r?.accessKeyId||"",this.cache["email.smtp.pass"]=r?.secretAccessKey||"";}}}catch(e){console.warn("ConfigService: Could not load email settings from globals table:",e);}}get(e,t,r){return this.cache[e]?this.cache[e]:t&&process.env[t]?process.env[t]:r}getStorageConfig(){let e="local";return typeof globalThis.STORAGE_BUCKET<"u"&&(e="cloudflare_r2"),{type:this.get("storage.type","STORAGE_TYPE",e),s3:{bucket:this.get("storage.s3.bucket","STORAGE_BUCKET"),region:this.get("storage.s3.region","STORAGE_REGION","us-east-1"),accessKeyId:this.get("storage.s3.access_key_id","STORAGE_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.s3.secret_access_key","STORAGE_SECRET_ACCESS_KEY"),endpoint:this.get("storage.s3.endpoint","STORAGE_ENDPOINT"),cdnUrl:this.get("storage.s3.cdn_url","STORAGE_CDN_URL"),prefix:this.get("storage.s3.prefix","STORAGE_PREFIX")},r2:{accountId:this.get("storage.r2.account_id","R2_ACCOUNT_ID"),accessKeyId:this.get("storage.r2.access_key_id","R2_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.r2.secret_access_key","R2_SECRET_ACCESS_KEY"),bucket:this.get("storage.r2.bucket","R2_BUCKET"),cdnUrl:this.get("storage.r2.cdn_url","R2_CDN_URL"),prefix:this.get("storage.r2.prefix","R2_PREFIX")},gcs:{bucket:this.get("storage.gcs.bucket","GCS_BUCKET"),projectId:this.get("storage.gcs.project_id","GCS_PROJECT_ID"),clientEmail:this.get("storage.gcs.client_email","GCS_CLIENT_EMAIL"),privateKey:this.get("storage.gcs.private_key","GCS_PRIVATE_KEY"),cdnUrl:this.get("storage.gcs.cdn_url","GCS_CDN_URL"),prefix:this.get("storage.gcs.prefix","GCS_PREFIX")},digitalocean:{bucket:this.get("storage.digitalocean.bucket","DO_BUCKET"),region:this.get("storage.digitalocean.region","DO_REGION","nyc3"),accessKeyId:this.get("storage.digitalocean.access_key_id","DO_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.digitalocean.secret_access_key","DO_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.digitalocean.cdn_url","DO_CDN_URL"),prefix:this.get("storage.digitalocean.prefix","DO_PREFIX")},backblaze:{bucket:this.get("storage.backblaze.bucket","BB_BUCKET"),accountId:this.get("storage.backblaze.account_id","BB_ACCOUNT_ID"),applicationKeyId:this.get("storage.backblaze.application_key_id","BB_APPLICATION_KEY_ID"),applicationKey:this.get("storage.backblaze.application_key","BB_APPLICATION_KEY"),cdnUrl:this.get("storage.backblaze.cdn_url","BB_CDN_URL"),prefix:this.get("storage.backblaze.prefix","BB_PREFIX")},wasabi:{bucket:this.get("storage.wasabi.bucket","WASABI_BUCKET"),region:this.get("storage.wasabi.region","WASABI_REGION","us-east-1"),accessKeyId:this.get("storage.wasabi.access_key_id","WASABI_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.wasabi.secret_access_key","WASABI_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.wasabi.cdn_url","WASABI_CDN_URL"),prefix:this.get("storage.wasabi.prefix","WASABI_PREFIX")},bunny:{storageZone:this.get("storage.bunny.storage_zone","BUNNY_STORAGE_ZONE"),apiKey:this.get("storage.bunny.api_key","BUNNY_API_KEY"),cdnUrl:this.get("storage.bunny.cdn_url","BUNNY_CDN_URL"),prefix:this.get("storage.bunny.prefix","BUNNY_PREFIX")},ftp:{host:this.get("storage.ftp.host","FTP_HOST"),port:parseInt(this.get("storage.ftp.port","FTP_PORT","21"),10),user:this.get("storage.ftp.user","FTP_USER"),password:this.get("storage.ftp.password","FTP_PASSWORD"),secure:this.get("storage.ftp.secure","FTP_SECURE")==="true",baseUrl:this.get("storage.ftp.base_url","FTP_BASE_URL"),prefix:this.get("storage.ftp.prefix","FTP_PREFIX")},cloudinary:{cloudName:this.get("storage.cloudinary.cloud_name","CLOUDINARY_CLOUD_NAME"),apiKey:this.get("storage.cloudinary.api_key","CLOUDINARY_API_KEY"),apiSecret:this.get("storage.cloudinary.api_secret","CLOUDINARY_API_SECRET"),folder:this.get("storage.cloudinary.folder","CLOUDINARY_FOLDER")},imgix:{domain:this.get("storage.imgix.domain","IMGIX_DOMAIN"),signKey:this.get("storage.imgix.sign_key","IMGIX_SIGN_KEY")},local:{uploadDir:this.get("storage.local.dir","STORAGE_LOCAL_DIR","./public/uploads"),baseUrl:this.get("storage.local.url","STORAGE_LOCAL_URL","/uploads")}}}getEmailConfig(){return {provider:this.get("email.provider","EMAIL_PROVIDER","smtp"),host:this.get("email.smtp.host","SMTP_HOST"),port:parseInt(this.get("email.smtp.port","SMTP_PORT","587"),10),secure:this.get("email.smtp.secure","SMTP_SECURE")==="true",user:this.get("email.smtp.user","SMTP_USER"),pass:this.get("email.smtp.pass","SMTP_PASS"),from:this.get("email.smtp.from","SMTP_FROM","noreply@example.com"),fromName:this.get("email.smtp.from_name","SMTP_FROM_NAME","Kyro CMS"),replyTo:this.get("email.smtp.reply_to","SMTP_REPLY_TO")}}maskSensitive(e,t){return t&&(i.SENSITIVE_KEYS.includes(e)?"********":t)}async set(e,t,r){await this.db.insert(chunkHPYH7GTS_cjs.a).values({key:e,value:t,description:r,updatedAt:new Date}).onConflictDoUpdate({target:[chunkHPYH7GTS_cjs.a.key],set:{value:t,description:r,updatedAt:new Date}}),this.cache[e]=t;}};chunkBUNLC3II_cjs.h();var v=class i{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...E(),...t};}async ensureTransporter(){if(this.transporterInitialized)return this.transporter;let{default:e}=await import('./nodemailer-IDML4L6W.cjs');return this.config.provider==="smtp"&&this.config.smtp?this.transporter=e.createTransport({host:this.config.smtp.host,port:this.config.smtp.port,secure:this.config.smtp.secure,auth:this.config.smtp.auth}):this.config.provider==="ses"&&this.config.ses&&(this.transporter=e.createTransport({host:`email-smtp.${this.config.ses.region}.amazonaws.com`,port:587,secure:false,auth:{user:this.config.ses.accessKeyId,pass:this.config.ses.secretAccessKey}})),this.transporterInitialized=true,this.transporter}async send(e){let{provider:t,from:r,fromName:s,replyTo:o}=this.config,a=`"${s||"Kyro CMS"}" <${r}>`,n=e.replyTo||o;try{let l;switch(t){case "smtp":case "ses":{let p=await this.ensureTransporter();if(!p)throw new Error(`${t} transporter not initialized`);l=await p.sendMail({from:a,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:n});}break;case "resend":l=await this.sendViaResend(a,e,n);break;case "sendgrid":l=await this.sendViaSendGrid(a,e,n);break;case "mailgun":l=await this.sendViaMailgun(a,e,n);break;default:throw new Error(`Unsupported email provider: ${t}`)}return l}catch(l){throw console.error("[EmailTransport] FAILED to send email:",l.message),l.response&&console.error("[EmailTransport] Provider Error Detail:",JSON.stringify(l.response,null,2)),l}}async sendViaResend(e,t,r){let s=this.config.resend?.apiKey;if(!s)throw new Error("Resend API Key missing");let o={from:e,to:t.to,subject:t.subject,html:t.html,text:t.text,reply_to:r},a=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok){let n=await a.json();throw new Error(`Resend Error: ${JSON.stringify(n)}`)}return a.json()}async sendViaSendGrid(e,t,r){let s=this.config.sendgrid?.apiKey;if(!s)throw new Error("SendGrid API Key missing");let o={personalizations:[{to:Array.isArray(t.to)?t.to.map(n=>({email:n})):[{email:t.to}]}],from:{email:e.match(/<(.+)>/)?.[1]||e,name:e.match(/"(.+)"/)?.[1]},subject:t.subject,content:[{type:"text/plain",value:t.text||""},{type:"text/html",value:t.html}],reply_to:r?{email:r}:void 0},a=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok){let n=await a.json();throw new Error(`SendGrid Error: ${JSON.stringify(n)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:o,region:a}=this.config.mailgun||{};if(!s||!o)throw new Error("Mailgun config missing");let n=a==="eu"?"api.eu.mailgun.net":"api.mailgun.net",l=btoa(`api:${s}`),p=new URLSearchParams;p.append("from",e);let f=Array.isArray(t.to)?t.to.join(", "):t.to;p.append("to",f),p.append("subject",t.subject),p.append("html",t.html),t.text&&p.append("text",t.text),r&&p.append("h:Reply-To",r);let m=await fetch(`https://${n}/v3/${o}/messages`,{method:"POST",headers:{Authorization:`Basic ${l}`,"Content-Type":"application/x-www-form-urlencoded"},body:p});if(!m.ok){let u=await m.json();throw new Error(`Mailgun Error: ${JSON.stringify(u)}`)}return m.json()}getTemplates(){return this.templates}async verifyConnection(){if(this.config.provider==="smtp"||this.config.provider==="ses")try{let e=await this.ensureTransporter();if(e)return await e.verify(),!0}catch{return false}return !!(this.config.resend?.apiKey||this.config.sendgrid?.apiKey||this.config.mailgun?.apiKey)}static async fromConfig(e){let t=new y(e);await t.load();let r=t.getEmailConfig();if(!r.provider)return this.fromEnv();let s={provider:r.provider||"smtp",from:r.from||"noreply@example.com",fromName:r.fromName,replyTo:r.replyTo,smtp:r.provider==="smtp"?{host:r.host||"",port:r.port||587,secure:r.secure||false,auth:{user:r.user||"",pass:r.pass||""}}:void 0,resend:r.provider==="resend"?{apiKey:r.pass||""}:void 0,sendgrid:r.provider==="sendgrid"?{apiKey:r.pass||""}:void 0,mailgun:r.provider==="mailgun"?{apiKey:r.pass||"",domain:r.host||"",region:r.secure?"eu":"us"}:void 0,ses:r.provider==="ses"?{accessKeyId:r.user||"",secretAccessKey:r.pass||"",region:r.host||"us-east-1"}:void 0};return new i(s)}static fromEnv(){let e=process.env.EMAIL_PROVIDER||"smtp",t=process.env.SMTP_FROM||process.env.DEFAULT_FROM||"noreply@example.com",r=process.env.SMTP_FROM_NAME||"Kyro CMS",s=process.env.SMTP_REPLY_TO;if(e==="smtp"){let o=process.env.SMTP_HOST,a=process.env.SMTP_USER,n=process.env.SMTP_PASS;return !o||!a||!n?null:new i({provider:"smtp",from:t,fromName:r,replyTo:s,smtp:{host:o,port:parseInt(process.env.SMTP_PORT||"587",10),secure:process.env.SMTP_SECURE==="true",auth:{user:a,pass:n}}})}if(e==="resend"){let o=process.env.RESEND_API_KEY||process.env.SMTP_PASS;return o?new i({provider:"resend",from:t,fromName:r,replyTo:s,resend:{apiKey:o}}):null}if(e==="sendgrid"){let o=process.env.SENDGRID_API_KEY||process.env.SMTP_PASS;return o?new i({provider:"sendgrid",from:t,fromName:r,replyTo:s,sendgrid:{apiKey:o}}):null}if(e==="mailgun"){let o=process.env.MAILGUN_API_KEY||process.env.SMTP_PASS,a=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !o||!a?null:new i({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:o,domain:a,region:process.env.MAILGUN_REGION||(process.env.SMTP_SECURE==="true"?"eu":"us")}})}if(e==="ses"){let o=process.env.AWS_ACCESS_KEY_ID||process.env.SMTP_USER,a=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,n=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !o||!a?null:new i({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:o,secretAccessKey:a,region:n}})}return null}};chunkBUNLC3II_cjs.h();var P={minLength:12,requireUppercase:true,requireLowercase:true,requireNumbers:true,requireSpecialChars:true,preventReuse:5,maxLength:128},A=class{config;constructor(e={}){this.config={...P,...e};}validate(e){let t=[];return this.config.maxLength&&e.length>this.config.maxLength&&t.push(`Password must not exceed ${this.config.maxLength} characters`),e.length<this.config.minLength&&t.push(`Password must be at least ${this.config.minLength} characters`),this.config.requireUppercase&&!/[A-Z]/.test(e)&&t.push("Password must contain at least one uppercase letter"),this.config.requireLowercase&&!/[a-z]/.test(e)&&t.push("Password must contain at least one lowercase letter"),this.config.requireNumbers&&!/[0-9]/.test(e)&&t.push("Password must contain at least one number"),this.config.requireSpecialChars&&!/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(e)&&t.push("Password must contain at least one special character"),["password","123456","12345678","qwerty","abc123","monkey","1234567","letmein","trustno1","dragon","baseball","iloveyou","master","sunshine","ashley","football","password1","shadow","123123","654321"].includes(e.toLowerCase())&&t.push("This password is too common. Please choose a more secure password"),(/^[a-zA-Z]+$/.test(e)||/^[0-9]+$/.test(e))&&t.push("Password must contain a mix of letters, numbers, and/or special characters"),/(.)\1{2,}/.test(e)&&t.push("Password must not contain more than 2 consecutive identical characters"),/^(012|123|234|345|456|567|678|789|890|098|987|876|765|654|543|432|321|210)+$/i.test(e)&&t.push("Password must not contain sequential numbers or letters"),{valid:t.length===0,errors:t}}async checkReuse(e,t,r){return {valid:true,errors:[]}}async isInHistory(e,t,r){for(let s of t)if(await r(e,s))return true;return false}generatePassword(e=16){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r="abcdefghijklmnopqrstuvwxyz",s="0123456789",o="!@#$%^&*()_+-=[]{}|;:,.<>?",a="";a+=t[Math.floor(Math.random()*t.length)],a+=r[Math.floor(Math.random()*r.length)],a+=s[Math.floor(Math.random()*s.length)],a+=o[Math.floor(Math.random()*o.length)];let n=t+r+s+o;for(let l=a.length;l<e;l++)a+=n[Math.floor(Math.random()*n.length)];return a.split("").sort(()=>Math.random()-.5).join("")}getStrength(e){let t=0,r=[];e.length>=8&&(t+=1),e.length>=12&&(t+=1),e.length>=16&&(t+=1),/[a-z]/.test(e)&&(t+=1),/[A-Z]/.test(e)&&(t+=1),/[0-9]/.test(e)&&(t+=1),/[!@#$%^&*()_+\-=\[\]{}|;:,.<>?]/.test(e)&&(t+=1),e.length>8&&(t+=1),e.length>12&&(t+=1);let s=new Set(e).size;s>6&&(t+=1),s>10&&(t+=1);let o;return t<=3?(o="Weak",r.push("Add more characters"),r.push("Include uppercase and lowercase letters")):t<=5?(o="Fair",r.push("Add special characters"),r.push("Consider making it longer")):t<=7?(o="Good",r.push("Consider making it longer for extra security")):o="Strong",{score:t,label:o,feedback:r}}setConfig(e){this.config={...this.config,...e};}getConfig(){return {...this.config}}};
|
|
300
|
+
exports.a=g;exports.b=b;exports.c=x;exports.d=_;exports.e=S;exports.f=T;exports.g=w;exports.h=C;exports.i=E;exports.j=y;exports.k=v;exports.l=A;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {createRequire}from'module';import {d,g as g$2,h,f}from'./chunk-OMWQVPV7.js';import {c,a as a$1,d as d$1,e}from'./chunk-VBPAAQEF.js';import {i,k,j as j$1,l as l$1,Z}from'./chunk-IP6JUEH3.js';import {U as U$1,a,R,X,c as c$1,A as A$1,i as i$1,N,l,t,S,j,J as J$1,V as V$1,T as T$1,H as H$1,n}from'./chunk-7AQSH3KR.js';import {g as g$1}from'./chunk-C2PXMVR5.js';createRequire(import.meta.url);
|
|
2
|
+
g$1();g$1();g$1();function g(o){return c$1(o,d)?[`${o[t.Symbol.BaseName]}`]:c$1(o,i$1)?o._.usedTables??[]:c$1(o,A$1)?o.usedTables??[]:[]}var T=class extends i{constructor(e,t,i,s){super(),this.table=e,this.session=t,this.dialect=i,this.config={table:e,withList:s};}static[a]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]=="function"){let t$1=e[0](new Proxy(this.config.table[t.Symbol.Columns],new a$1({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t$1)?t$1:[t$1];this.config.orderBy=i;}else {let t=e;this.config.orderBy=t;}return this}limit(e){return this.config.limit=e,this}returning(e=this.table[d.Symbol.Columns]){return this.config.returning=R(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=true){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",true,void 0,{type:"delete",tables:g(this.config.table)})}prepare(){return this._prepare(false)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}};g$1();g$1();g$1();var y=class{static[a]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct;}from(e){let t=!!this.fields,i;return this.fields?i=this.fields:c$1(e,i$1)?i=Object.fromEntries(Object.keys(e._.selectedFields).map(s=>[s,e[s]])):c$1(e,f)?i=e[l].selectedFields:c$1(e,A$1)?i={}:i=V$1(e),new P({table:e,fields:i,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}},U=class extends c{static[a]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:e,fields:t,isPartialSelect:i,session:s,dialect:r,withList:n,distinct:f}){super(),this.config={withList:n,table:e,fields:{...t},distinct:f,setOperators:[]},this.isPartialSelect=i,this.session=s,this.dialect=r,this._={selectedFields:t,config:this.config},this.tableName=X(e),this.joinsNotNullableMap=typeof this.tableName=="string"?{[this.tableName]:true}:{};for(let d of g(e))this.usedTables.add(d);}getUsedTables(){return [...this.usedTables]}createJoin(e){return (t$1,i)=>{let s=this.tableName,r=X(t$1);for(let n of g(t$1))this.usedTables.add(n);if(typeof r=="string"&&this.config.joins?.some(n=>n.alias===r))throw new Error(`Alias "${r}" is already used in this query`);if(!this.isPartialSelect&&(Object.keys(this.joinsNotNullableMap).length===1&&typeof s=="string"&&(this.config.fields={[s]:this.config.fields}),typeof r=="string"&&!c$1(t$1,A$1))){let n=c$1(t$1,i$1)?t$1._.selectedFields:c$1(t$1,N)?t$1[l].selectedFields:t$1[t.Symbol.Columns];this.config.fields[r]=n;}if(typeof i=="function"&&(i=i(new Proxy(this.config.fields,new a$1({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:i,table:t$1,joinType:e,alias:r}),typeof r=="string")switch(e){case "left":{this.joinsNotNullableMap[r]=false;break}case "right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([n])=>[n,false])),this.joinsNotNullableMap[r]=true;break}case "cross":case "inner":{this.joinsNotNullableMap[r]=true;break}case "full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([n])=>[n,false])),this.joinsNotNullableMap[r]=false;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(e,t){return i=>{let s=typeof i=="function"?i(ce()):i;if(!S(this.getSelectedFields(),s.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:s}),this}}union=this.createSetOperator("union",false);unionAll=this.createSetOperator("union",true);intersect=this.createSetOperator("intersect",false);except=this.createSetOperator("except",false);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new a$1({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new a$1({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.fields,new a$1({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t];}else this.config.groupBy=e;return this}orderBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.fields,new a$1({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i;}else {let t=e;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=t:this.config.orderBy=t;}return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){let t=[];if(t.push(...g(this.config.table)),this.config.joins)for(let i of this.config.joins)t.push(...g(i.table));return new Proxy(new i$1(this.getSQL(),this.config.fields,e,false,[...new Set(t)]),new a$1({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new a$1({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}},P=class extends U{static[a]="SQLiteSelect";_prepare(e=true){if(!this.session)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");let t=R(this.config.fields),i=this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),t,"all",true,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return i.joinsNotNullableMap=this.joinsNotNullableMap,i}$withCache(e){return this.cacheConfig=e===void 0?{config:{},enable:true,autoInvalidate:true}:e===false?{enable:false}:{enable:true,autoInvalidate:true,...e},this}prepare(){return this._prepare(false)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.all()}};U$1(P,[i]);function F(o,e){return (t,i,...s)=>{let r=[i,...s].map(n=>({type:o,isAll:e,rightSelect:n}));for(let n of r)if(!S(t.getSelectedFields(),n.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return t.addSetOperators(r)}}var ce=()=>({union:ue,unionAll:fe,intersect:de,except:pe}),ue=F("union",false),fe=F("union",true),de=F("intersect",false),pe=F("except",false);var q=class{static[a]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=c$1(e,g$2)?e:void 0,this.dialectConfig=c$1(e,g$2)?void 0:e;}$with=(e,t)=>{let i=this;return {as:r=>(typeof r=="function"&&(r=r(i)),new Proxy(new j(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,true),new a$1({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};with(...e){let t=this;function i(r){return new y({fields:r??void 0,session:void 0,dialect:t.getDialect(),withList:e})}function s(r){return new y({fields:r??void 0,session:void 0,dialect:t.getDialect(),withList:e,distinct:true})}return {select:i,selectDistinct:s}}select(e){return new y({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new y({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:true})}getDialect(){return this.dialect||(this.dialect=new h(this.dialectConfig)),this.dialect}};var A=class{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s;}static[a]="SQLiteInsertBuilder";values(e){if(e=Array.isArray(e)?e:[e],e.length===0)throw new Error("values() must be called with at least one value");let t$1=e.map(i=>{let s={},r=this.table[t.Symbol.Columns];for(let n of Object.keys(i)){let f=i[n];s[n]=c$1(f,A$1)?f:new H$1(f,r[n]);}return s});return new E(this.table,t$1,this.session,this.dialect,this.withList)}select(e){let t=typeof e=="function"?e(new q):e;if(!c$1(t,A$1)&&!S(this.table[n],t._.selectedFields))throw new Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new E(this.table,t,this.session,this.dialect,this.withList,true)}},E=class extends i{constructor(e,t,i,s,r,n){super(),this.session=i,this.dialect=s,this.config={table:e,values:t,withList:r,select:n};}static[a]="SQLiteInsert";config;returning(e=this.config.table[d.Symbol.Columns]){return this.config.returning=R(e),this}onConflictDoNothing(e={}){if(this.config.onConflict||(this.config.onConflict=[]),e.target===void 0)this.config.onConflict.push(J$1` on conflict do nothing`);else {let t=Array.isArray(e.target)?J$1`${e.target}`:J$1`${[e.target]}`,i=e.where?J$1` where ${e.where}`:J$1``;this.config.onConflict.push(J$1` on conflict ${t} do nothing${i}`);}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw new Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');this.config.onConflict||(this.config.onConflict=[]);let t=e.where?J$1` where ${e.where}`:void 0,i=e.targetWhere?J$1` where ${e.targetWhere}`:void 0,s=e.setWhere?J$1` where ${e.setWhere}`:void 0,r=Array.isArray(e.target)?J$1`${e.target}`:J$1`${[e.target]}`,n=this.dialect.buildUpdateSet(this.config.table,T$1(this.config.table,e.set));return this.config.onConflict.push(J$1` on conflict ${r}${i} do update set ${n}${t}${s}`),this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=true){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",true,void 0,{type:"insert",tables:g(this.config.table)})}prepare(){return this._prepare(false)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}};g$1();var M=class{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s;}static[a]="SQLiteUpdateBuilder";set(e){return new I(this.table,T$1(this.table,e),this.session,this.dialect,this.withList)}},I=class extends i{constructor(e,t,i,s,r){super(),this.session=i,this.dialect=s,this.config={set:t,table:e,withList:r,joins:[]};}static[a]="SQLiteUpdate";config;from(e){return this.config.from=e,this}createJoin(e){return (t$1,i)=>{let s=X(t$1);if(typeof s=="string"&&this.config.joins.some(r=>r.alias===s))throw new Error(`Alias "${s}" is already used in this query`);if(typeof i=="function"){let r=this.config.from?c$1(t$1,d)?t$1[t.Symbol.Columns]:c$1(t$1,i$1)?t$1._.selectedFields:c$1(t$1,f)?t$1[l].selectedFields:void 0:void 0;i=i(new Proxy(this.config.table[t.Symbol.Columns],new a$1({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),r&&new Proxy(r,new a$1({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));}return this.config.joins.push({on:i,table:t$1,joinType:e,alias:s}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]=="function"){let t$1=e[0](new Proxy(this.config.table[t.Symbol.Columns],new a$1({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t$1)?t$1:[t$1];this.config.orderBy=i;}else {let t=e;this.config.orderBy=t;}return this}limit(e){return this.config.limit=e,this}returning(e=this.config.table[d.Symbol.Columns]){return this.config.returning=R(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=true){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",true,void 0,{type:"insert",tables:g(this.config.table)})}prepare(){return this._prepare(false)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}};g$1();var K=class o extends A$1{constructor(e){super(o.buildEmbeddedCount(e.source,e.filters).queryChunks),this.params=e,this.session=e.session,this.sql=o.buildCount(e.source,e.filters);}sql;static[a]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(e,t){return J$1`(select count(*) from ${e}${J$1.raw(" where ").if(t)}${t})`}static buildCount(e,t){return J$1`select count(*) from ${e}${J$1.raw(" where ").if(t)}${t}`}then(e,t){return Promise.resolve(this.session.count(this.sql)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}};g$1();var D=class{constructor(e,t,i,s,r,n,f,d){this.mode=e,this.fullSchema=t,this.schema=i,this.tableNamesMap=s,this.table=r,this.tableConfig=n,this.dialect=f,this.session=d;}static[a]="SQLiteAsyncRelationalQueryBuilder";findMany(e){return this.mode==="sync"?new J(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many"):new O(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many")}findFirst(e){return this.mode==="sync"?new J(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first"):new O(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}},O=class extends i{constructor(e,t,i,s,r,n,f,d,he){super(),this.fullSchema=e,this.schema=t,this.tableNamesMap=i,this.table=s,this.tableConfig=r,this.dialect=n,this.session=f,this.config=d,this.mode=he;}static[a]="SQLiteAsyncRelationalQuery";mode;getSQL(){return this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(e=false){let{query:t,builtQuery:i}=this._toSQL();return this.session[e?"prepareOneTimeQuery":"prepareQuery"](i,void 0,this.mode==="first"?"get":"all",true,(s,r)=>{let n=s.map(f=>Z(this.schema,this.tableConfig,f,t.selection,r));return this.mode==="first"?n[0]:n})}prepare(){return this._prepare(false)}_toSQL(){let e=this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}),t=this.dialect.sqlToQuery(e.sql);return {query:e,builtQuery:t}}toSQL(){return this._toSQL().builtQuery}executeRaw(){return this.mode==="first"?this._prepare(false).get():this._prepare(false).all()}async execute(){return this.executeRaw()}},J=class extends O{static[a]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}};g$1();var C=class extends i{constructor(e,t,i,s,r){super(),this.execute=e,this.getSQL=t,this.dialect=s,this.mapBatchResult=r,this.config={action:i};}static[a]="SQLiteRaw";config;getQuery(){return {...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return false}};var V=class{constructor(e,t,i,s){this.resultKind=e,this.dialect=t,this.session=i,this._=s?{schema:s.schema,fullSchema:s.fullSchema,tableNamesMap:s.tableNamesMap}:{schema:void 0,fullSchema:{},tableNamesMap:{}},this.query={};let r=this.query;if(this._.schema)for(let[n,f]of Object.entries(this._.schema))r[n]=new D(e,s.fullSchema,this._.schema,this._.tableNamesMap,s.fullSchema[n],f,t,i);this.$cache={invalidate:async n=>{}};}static[a]="BaseSQLiteDatabase";query;$with=(e,t)=>{let i=this;return {as:r=>(typeof r=="function"&&(r=r(new q(i.dialect))),new Proxy(new j(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,true),new a$1({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};$count(e,t){return new K({source:e,filters:t,session:this.session})}with(...e){let t=this;function i(d){return new y({fields:d??void 0,session:t.session,dialect:t.dialect,withList:e})}function s(d){return new y({fields:d??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:true})}function r(d){return new M(d,t.session,t.dialect,e)}function n(d){return new A(d,t.session,t.dialect,e)}function f(d){return new T(d,t.session,t.dialect,e)}return {select:i,selectDistinct:s,update:r,insert:n,delete:f}}select(e){return new y({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new y({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:true})}update(e){return new M(e,this.session,this.dialect)}$cache;insert(e){return new A(e,this.session,this.dialect)}delete(e){return new T(e,this.session,this.dialect)}run(e){let t=typeof e=="string"?J$1.raw(e):e.getSQL();return this.resultKind==="async"?new C(async()=>this.session.run(t),()=>t,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session)):this.session.run(t)}all(e){let t=typeof e=="string"?J$1.raw(e):e.getSQL();return this.resultKind==="async"?new C(async()=>this.session.all(t),()=>t,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session)):this.session.all(t)}get(e){let t=typeof e=="string"?J$1.raw(e):e.getSQL();return this.resultKind==="async"?new C(async()=>this.session.get(t),()=>t,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session)):this.session.get(t)}values(e){let t=typeof e=="string"?J$1.raw(e):e.getSQL();return this.resultKind==="async"?new C(async()=>this.session.values(t),()=>t,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session)):this.session.values(t)}transaction(e,t){return this.session.transaction(e,t)}};g$1();var H=class extends i{constructor(e){super(),this.resultCb=e;}static[a]="ExecuteResultSync";async execute(){return this.resultCb()}sync(){return this.resultCb()}},oe=class{constructor(e,t,i,s,r,n){this.mode=e,this.executeMethod=t,this.query=i,this.cache=s,this.queryMetadata=r,this.cacheConfig=n,s&&s.strategy()==="all"&&n===void 0&&(this.cacheConfig={enable:true,autoInvalidate:true}),this.cacheConfig?.enable||(this.cacheConfig=void 0);}static[a]="PreparedQuery";joinsNotNullableMap;async queryWithCache(e$1,t,i){if(this.cache===void 0||c$1(this.cache,d$1)||this.queryMetadata===void 0)try{return await i()}catch(s){throw new k(e$1,t,s)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await i()}catch(s){throw new k(e$1,t,s)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[s]=await Promise.all([i(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return s}catch(s){throw new k(e$1,t,s)}if(!this.cacheConfig)try{return await i()}catch(s){throw new k(e$1,t,s)}if(this.queryMetadata.type==="select"){let s=await this.cache.get(this.cacheConfig.tag??await e(e$1,t),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(s===void 0){let r;try{r=await i();}catch(n){throw new k(e$1,t,n)}return await this.cache.put(this.cacheConfig.tag??await e(e$1,t),r,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),r}return s}try{return await i()}catch(s){throw new k(e$1,t,s)}}getQuery(){return this.query}mapRunResult(e,t){return e}mapAllResult(e,t){throw new Error("Not implemented")}mapGetResult(e,t){throw new Error("Not implemented")}execute(e){return this.mode==="async"?this[this.executeMethod](e):new H(()=>this[this.executeMethod](e))}mapResult(e,t){switch(this.executeMethod){case "run":return this.mapRunResult(e,t);case "all":return this.mapAllResult(e,t);case "get":return this.mapGetResult(e,t)}}},ae=class{constructor(e){this.dialect=e;}static[a]="SQLiteSession";prepareOneTimeQuery(e,t,i,s,r,n,f){return this.prepareQuery(e,t,i,s,r,n,f)}run(e){let t=this.dialect.sqlToQuery(e);try{return this.prepareOneTimeQuery(t,void 0,"run",!1).run()}catch(i){throw new j$1({cause:i,message:`Failed to run the query '${t.sql}'`})}}extractRawRunValueFromBatchResult(e){return e}all(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",false).all()}extractRawAllValueFromBatchResult(e){throw new Error("Not implemented")}get(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",false).get()}extractRawGetValueFromBatchResult(e){throw new Error("Not implemented")}values(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",false).values()}async count(e){return (await this.values(e))[0][0]}extractRawValuesValueFromBatchResult(e){throw new Error("Not implemented")}},le=class extends V{constructor(e,t,i,s,r=0){super(e,t,i,s),this.schema=s,this.nestedIndex=r;}static[a]="SQLiteTransaction";rollback(){throw new l$1}};export{V as a,oe as b,ae as c,le as d};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';var chunkLEBM6ZSZ_cjs=require('./chunk-LEBM6ZSZ.cjs'),chunkGNEVCEJU_cjs=require('./chunk-GNEVCEJU.cjs'),chunkLQ3YZTPU_cjs=require('./chunk-LQ3YZTPU.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var re=i=>chunkGNEVCEJU_cjs.f.isInstance(i)?i.headers?.date??i.headers?.Date:void 0;chunkBUNLC3II_cjs.h();var $=i=>new Date(Date.now()+i);chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var rt=(i,e)=>Math.abs($(e).getTime()-i)>=3e5;var se=(i,e)=>{let t=Date.parse(i);return rt(t,e)?t-Date.now():e};var Q=(i,e)=>{if(!e)throw new Error(`Property \`${i}\` is not resolved for AWS SDK SigV4Auth`);return e},q=async i=>{let e=Q("context",i.context),t=Q("config",i.config),r=e.endpointV2?.properties?.authSchemes?.[0],o=await Q("signer",t.signer)(r),n=i?.signingRegion,a=i?.signingRegionSet,m=i?.signingName;return {config:t,signer:o,signingRegion:n,signingRegionSet:a,signingName:m}},B=class{async sign(e,t,r){if(!chunkGNEVCEJU_cjs.e.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let s=await q(r),{config:o,signer:n}=s,{signingRegion:a,signingName:m}=s,c=r.context;if(c?.authSchemes?.length??false){let[l,h]=c.authSchemes;l?.name==="sigv4a"&&h?.name==="sigv4"&&(a=h?.signingRegion??a,m=h?.signingName??m);}return r._preRequestSystemClockOffset=o.systemClockOffset,await n.sign(e,{signingDate:$(o.systemClockOffset),signingRegion:a,signingService:m})}errorHandler(e){return t=>{let r=t,s=r.ServerTime??re(r.$response);if(s){let o=Q("config",e.config),n=e._preRequestSystemClockOffset,a=se(s,o.systemClockOffset);(a!==o.systemClockOffset||n!==void 0&&n!==a)&&r.$metadata&&(o.systemClockOffset=a,r.$metadata.clockSkewCorrected=true);}throw t}}successHandler(e,t){let r=re(e);if(r){let s=Q("config",t.config);s.systemClockOffset=se(r,s.systemClockOffset);}}};chunkBUNLC3II_cjs.h();var ie=class extends B{async sign(e,t,r){if(!chunkGNEVCEJU_cjs.e.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let{config:s,signer:o,signingRegion:n,signingRegionSet:a,signingName:m}=await q(r),f=(await s.sigv4aSigningRegionSet?.()??a??[n]).join(",");return r._preRequestSystemClockOffset=s.systemClockOffset,await o.sign(e,{signingDate:$(s.systemClockOffset),signingRegion:f,signingService:m})}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var Ce=i=>typeof i=="string"&&i.length>0?i.split(",").map(e=>e.trim()):[];chunkBUNLC3II_cjs.h();var st=i=>`AWS_BEARER_TOKEN_${i.replace(/[\s-]/g,"_").toUpperCase()}`;var it="AWS_AUTH_SCHEME_PREFERENCE",ot="auth_scheme_preference",nt={environmentVariableSelector:(i,e)=>{if(e?.signingName&&st(e.signingName)in i)return ["httpBearerAuth"];if(it in i)return Ce(i[it])},configFileSelector:i=>{if(ot in i)return Ce(i[ot])},default:[]};chunkBUNLC3II_cjs.h();var at=i=>(i.sigv4aSigningRegionSet=chunkLEBM6ZSZ_cjs.H(i.sigv4aSigningRegionSet),i),ct={environmentVariableSelector(i){if(i.AWS_SIGV4A_SIGNING_REGION_SET)return i.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map(e=>e.trim());throw new chunkGNEVCEJU_cjs.o("AWS_SIGV4A_SIGNING_REGION_SET not set in env.",{tryNextLink:true})},configFileSelector(i){if(i.sigv4a_signing_region_set)return (i.sigv4a_signing_region_set??"").split(",").map(e=>e.trim());throw new chunkGNEVCEJU_cjs.o("sigv4a_signing_region_set not set in profile.",{tryNextLink:true})},default:void 0};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var oe=class{format(e){let t=[];for(let o of Object.keys(e)){let n=chunkLQ3YZTPU_cjs.c(o);t.push(Uint8Array.from([n.byteLength]),n,this.formatHeaderValue(e[o]));}let r=new Uint8Array(t.reduce((o,n)=>o+n.byteLength,0)),s=0;for(let o of t)r.set(o,s),s+=o.byteLength;return r}formatHeaderValue(e){switch(e.type){case "boolean":return Uint8Array.from([e.value?R.boolTrue:R.boolFalse]);case "byte":return Uint8Array.from([R.byte,e.value]);case "short":let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,R.short),t.setInt16(1,e.value,false),new Uint8Array(t.buffer);case "integer":let r=new DataView(new ArrayBuffer(5));return r.setUint8(0,R.integer),r.setInt32(1,e.value,false),new Uint8Array(r.buffer);case "long":let s=new Uint8Array(9);return s[0]=R.long,s.set(e.value.bytes,1),s;case "binary":let o=new DataView(new ArrayBuffer(3+e.value.byteLength));o.setUint8(0,R.byteArray),o.setUint16(1,e.value.byteLength,false);let n=new Uint8Array(o.buffer);return n.set(e.value,3),n;case "string":let a=chunkLQ3YZTPU_cjs.c(e.value),m=new DataView(new ArrayBuffer(3+a.byteLength));m.setUint8(0,R.string),m.setUint16(1,a.byteLength,false);let c=new Uint8Array(m.buffer);return c.set(a,3),c;case "timestamp":let f=new Uint8Array(9);return f[0]=R.timestamp,f.set(be.fromNumber(e.value.valueOf()).bytes,1),f;case "uuid":if(!Kt.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let l=new Uint8Array(17);return l[0]=R.uuid,l.set(chunkLQ3YZTPU_cjs.s(e.value.replace(/-/g,"")),1),l}}},R;(function(i){i[i.boolTrue=0]="boolTrue",i[i.boolFalse=1]="boolFalse",i[i.byte=2]="byte",i[i.short=3]="short",i[i.integer=4]="integer",i[i.long=5]="long",i[i.byteArray=6]="byteArray",i[i.string=7]="string",i[i.timestamp=8]="timestamp",i[i.uuid=9]="uuid";})(R||(R={}));var Kt=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,be=class i{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let t=new Uint8Array(8);for(let r=7,s=Math.abs(Math.round(e));r>-1&&s>0;r--,s/=256)t[r]=s;return e<0&&mt(t),new i(t)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&mt(e),parseInt(chunkLQ3YZTPU_cjs.t(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function mt(i){for(let e=0;e<8;e++)i[e]^=255;for(let e=7;e>-1&&(i[e]++,i[e]===0);e--);}chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var ft="X-Amz-Algorithm",dt="X-Amz-Credential",Re="X-Amz-Date",lt="X-Amz-SignedHeaders",ht="X-Amz-Expires",Te="X-Amz-Signature",_e="X-Amz-Security-Token";var ke="authorization",Ie=Re.toLowerCase(),Vt="date",ut=[ke,Ie,Vt],gt=Te.toLowerCase(),v="x-amz-content-sha256",pt=_e.toLowerCase();var yt={authorization:true,"cache-control":true,connection:true,expect:true,from:true,"keep-alive":true,"max-forwards":true,pragma:true,referer:true,te:true,trailer:true,"transfer-encoding":true,upgrade:true,"user-agent":true,"x-amzn-trace-id":true},St=/^proxy-/,wt=/^sec-/;var ne="AWS4-HMAC-SHA256";var Et="AWS4-HMAC-SHA256-PAYLOAD",xt="UNSIGNED-PAYLOAD",At=50,Me="aws4_request",Nt=3600*24*7;var Ct=({query:i={}})=>{let e=[],t={};for(let r of Object.keys(i)){if(r.toLowerCase()===gt)continue;let s=chunkGNEVCEJU_cjs.U(r);e.push(s);let o=i[r];typeof o=="string"?t[s]=`${s}=${chunkGNEVCEJU_cjs.U(o)}`:Array.isArray(o)&&(t[s]=o.slice(0).reduce((n,a)=>n.concat([`${s}=${chunkGNEVCEJU_cjs.U(a)}`]),[]).sort().join("&"));}return e.sort().map(r=>t[r]).filter(r=>r).join("&")};chunkBUNLC3II_cjs.h();var bt=i=>jt(i).toISOString().replace(/\.\d{3}Z$/,"Z"),jt=i=>typeof i=="number"?new Date(i*1e3):typeof i=="string"?Number(i)?new Date(Number(i)*1e3):new Date(i):i;var ae=class{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:r,service:s,sha256:o,uriEscapePath:n=true}){this.service=s,this.sha256=o,this.uriEscapePath=n,this.applyChecksum=typeof e=="boolean"?e:true,this.regionProvider=chunkGNEVCEJU_cjs.h(r),this.credentialProvider=chunkGNEVCEJU_cjs.h(t);}createCanonicalRequest(e,t,r){let s=Object.keys(t).sort();return `${e.method}
|
|
2
|
+
${this.getCanonicalPath(e)}
|
|
3
|
+
${Ct(e)}
|
|
4
|
+
${s.map(o=>`${o}:${t[o]}`).join(`
|
|
5
|
+
`)}
|
|
6
|
+
|
|
7
|
+
${s.join(";")}
|
|
8
|
+
${r}`}async createStringToSign(e,t,r,s){let o=new this.sha256;o.update(chunkLQ3YZTPU_cjs.v(r));let n=await o.digest();return `${s}
|
|
9
|
+
${e}
|
|
10
|
+
${t}
|
|
11
|
+
${chunkLQ3YZTPU_cjs.t(n)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let t=[];for(let o of e.split("/"))o?.length!==0&&o!=="."&&(o===".."?t.pop():t.push(o));let r=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return chunkGNEVCEJU_cjs.U(r).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(e){let t=bt(e).replace(/[-:]/g,"");return {longDate:t,shortDate:t.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}};chunkBUNLC3II_cjs.h();var ce={},De=[],me=(i,e,t)=>`${i}/${e}/${t}/${Me}`,Tt=async(i,e,t,r,s)=>{let o=await Rt(i,e.secretAccessKey,e.accessKeyId),n=`${t}:${r}:${s}:${chunkLQ3YZTPU_cjs.t(o)}:${e.sessionToken}`;if(n in ce)return ce[n];for(De.push(n);De.length>At;)delete ce[De.shift()];let a=`AWS4${e.secretAccessKey}`;for(let m of [t,r,s,Me])a=await Rt(i,a,m);return ce[n]=a};var Rt=(i,e,t)=>{let r=new i(e);return r.update(chunkLQ3YZTPU_cjs.v(t)),r.digest()};chunkBUNLC3II_cjs.h();var ze=({headers:i},e,t)=>{let r={};for(let s of Object.keys(i).sort()){if(i[s]==null)continue;let o=s.toLowerCase();(o in yt||e?.has(o)||St.test(o)||wt.test(o))&&(!t||t&&!t.has(o))||(r[o]=i[s].trim().replace(/\s+/g," "));}return r};chunkBUNLC3II_cjs.h();var fe=async({headers:i,body:e},t)=>{for(let r of Object.keys(i))if(r.toLowerCase()===v)return i[r];if(e==null)return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||chunkLQ3YZTPU_cjs.a(e)){let r=new t;return r.update(chunkLQ3YZTPU_cjs.v(e)),chunkLQ3YZTPU_cjs.t(await r.digest())}return xt};chunkBUNLC3II_cjs.h();var _t=(i,e)=>{i=i.toLowerCase();for(let t of Object.keys(e))if(i===t.toLowerCase())return true;return false};chunkBUNLC3II_cjs.h();var kt=(i,e={})=>{let{headers:t,query:r={}}=chunkGNEVCEJU_cjs.e.clone(i);for(let s of Object.keys(t)){let o=s.toLowerCase();(o.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(o)||e.hoistableHeaders?.has(o))&&(r[s]=t[s],delete t[s]);}return {...i,headers:t,query:r}};chunkBUNLC3II_cjs.h();var Oe=i=>{i=chunkGNEVCEJU_cjs.e.clone(i);for(let e of Object.keys(i.headers))ut.indexOf(e.toLowerCase())>-1&&delete i.headers[e];return i};var K=class extends ae{headerFormatter=new oe;constructor({applyChecksum:e,credentials:t,region:r,service:s,sha256:o,uriEscapePath:n=true}){super({applyChecksum:e,credentials:t,region:r,service:s,sha256:o,uriEscapePath:n});}async presign(e,t={}){let{signingDate:r=new Date,expiresIn:s=3600,unsignableHeaders:o,unhoistableHeaders:n,signableHeaders:a,hoistableHeaders:m,signingRegion:c,signingService:f}=t,l=await this.credentialProvider();this.validateResolvedCredentials(l);let h=c??await this.regionProvider(),{longDate:u,shortDate:p}=this.formatDate(r);if(s>Nt)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let y=me(p,h,f??this.service),S=kt(Oe(e),{unhoistableHeaders:n,hoistableHeaders:m});l.sessionToken&&(S.query[_e]=l.sessionToken),S.query[ft]=ne,S.query[dt]=`${l.accessKeyId}/${y}`,S.query[Re]=u,S.query[ht]=s.toString(10);let C=ze(S,o,a);return S.query[lt]=this.getCanonicalHeaderList(C),S.query[Te]=await this.getSignature(u,y,this.getSigningKey(l,h,p,f),this.createCanonicalRequest(S,C,await fe(e,this.sha256))),S}async sign(e,t){return typeof e=="string"?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:r=new Date,priorSignature:s,signingRegion:o,signingService:n,eventStreamCredentials:a}){let m=o??await this.regionProvider(),{shortDate:c,longDate:f}=this.formatDate(r),l=me(c,m,n??this.service),h=await fe({headers:{},body:t},this.sha256),u=new this.sha256;u.update(e);let p=chunkLQ3YZTPU_cjs.t(await u.digest()),y=[Et,f,l,s,p,h].join(`
|
|
12
|
+
`);return this.signString(y,{signingDate:r,signingRegion:m,signingService:n,eventStreamCredentials:a})}async signMessage(e,{signingDate:t=new Date,signingRegion:r,signingService:s,eventStreamCredentials:o}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:r,signingService:s,priorSignature:e.priorSignature,eventStreamCredentials:o}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:t=new Date,signingRegion:r,signingService:s,eventStreamCredentials:o}={}){let n=o??await this.credentialProvider();this.validateResolvedCredentials(n);let a=r??await this.regionProvider(),{shortDate:m}=this.formatDate(t),c=new this.sha256(await this.getSigningKey(n,a,m,s));return c.update(chunkLQ3YZTPU_cjs.v(e)),chunkLQ3YZTPU_cjs.t(await c.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:r,unsignableHeaders:s,signingRegion:o,signingService:n}={}){let a=await this.credentialProvider();this.validateResolvedCredentials(a);let m=o??await this.regionProvider(),c=Oe(e),{longDate:f,shortDate:l}=this.formatDate(t),h=me(l,m,n??this.service);c.headers[Ie]=f,a.sessionToken&&(c.headers[pt]=a.sessionToken);let u=await fe(c,this.sha256);!_t(v,c.headers)&&this.applyChecksum&&(c.headers[v]=u);let p=ze(c,s,r),y=await this.getSignature(f,h,this.getSigningKey(a,m,l,n),this.createCanonicalRequest(c,p,u));return c.headers[ke]=`${ne} Credential=${a.accessKeyId}/${h}, SignedHeaders=${this.getCanonicalHeaderList(p)}, Signature=${y}`,c}async getSignature(e,t,r,s){let o=await this.createStringToSign(e,t,s,ne),n=new this.sha256(await r);return n.update(chunkLQ3YZTPU_cjs.v(o)),chunkLQ3YZTPU_cjs.t(await n.digest())}getSigningKey(e,t,r,s){return Tt(this.sha256,e,r,t,s||this.service)}};chunkBUNLC3II_cjs.h();var Xt={SignatureV4a:null};var It=i=>{let e=i.credentials,t=!!i.credentials,r;Object.defineProperty(i,"credentials",{set(c){c&&c!==e&&c!==r&&(t=true),e=c;let f=Ft(i,{credentials:e,credentialDefaultProvider:i.credentialDefaultProvider}),l=Gt(i,f);if(t&&!l.attributed){let h=typeof e=="object"&&e!==null;r=async u=>{let y=await l(u);return h&&(!y.$source||Object.keys(y.$source).length===0)?chunkLEBM6ZSZ_cjs.b(y,"CREDENTIALS_CODE","e"):y},r.memoized=l.memoized,r.configBound=l.configBound,r.attributed=true;}else r=l;},get(){return r},enumerable:true,configurable:true}),i.credentials=e;let{signingEscapePath:s=true,systemClockOffset:o=i.systemClockOffset||0,sha256:n}=i,a;return i.signer?a=chunkLEBM6ZSZ_cjs.H(i.signer):i.regionInfoProvider?a=()=>chunkLEBM6ZSZ_cjs.H(i.region)().then(async c=>[await i.regionInfoProvider(c,{useFipsEndpoint:await i.useFipsEndpoint(),useDualstackEndpoint:await i.useDualstackEndpoint()})||{},c]).then(([c,f])=>{let{signingRegion:l,signingService:h}=c;i.signingRegion=i.signingRegion||l||f,i.signingName=i.signingName||h||i.serviceId;let u={...i,credentials:i.credentials,region:i.signingRegion,service:i.signingName,sha256:n,uriEscapePath:s},p=i.signerConstructor||K;return new p(u)}):a=async c=>{c=Object.assign({},{name:"sigv4",signingName:i.signingName||i.defaultSigningName,signingRegion:await chunkLEBM6ZSZ_cjs.H(i.region)(),properties:{}},c);let f=c.signingRegion,l=c.signingName;i.signingRegion=i.signingRegion||f,i.signingName=i.signingName||l||i.serviceId;let h={...i,credentials:i.credentials,region:i.signingRegion,service:i.signingName,sha256:n,uriEscapePath:s},u=i.signerConstructor||K;return new u(h)},Object.assign(i,{systemClockOffset:o,signingEscapePath:s,signer:a})};function Ft(i,{credentials:e,credentialDefaultProvider:t}){let r;return e?e?.memoized?r=e:r=chunkLEBM6ZSZ_cjs.M(e,chunkLEBM6ZSZ_cjs.K,chunkLEBM6ZSZ_cjs.L):t?r=chunkLEBM6ZSZ_cjs.H(t(Object.assign({},i,{parentClientConfig:i}))):r=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},r.memoized=true,r}function Gt(i,e){if(e.configBound)return e;let t=async r=>e({...r,callerClientConfig:i});return t.memoized=e.memoized,t.configBound=true,t}chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var M=class{queryCompat;errorRegistry;constructor(e=false){this.queryCompat=e;}resolveRestContentType(e,t){let r=t.getMemberSchemas(),s=Object.values(r).find(o=>!!o.getMergedTraits().httpPayload);if(s){let o=s.getMergedTraits().mediaType;return o||(s.isStringSchema()?"text/plain":s.isBlobSchema()?"application/octet-stream":e)}else if(!t.isUnitSchema()&&Object.values(r).find(n=>{let{httpQuery:a,httpQueryParams:m,httpHeader:c,httpLabel:f,httpPrefixHeaders:l}=n.getMergedTraits();return !a&&!m&&!c&&!f&&l===void 0}))return e}async getErrorSchemaOrThrowBaseException(e,t,r,s,o,n){let a=e;e.includes("#")&&([,a]=e.split("#"));let m={$metadata:o,$fault:r.statusCode<500?"client":"server"};if(!this.errorRegistry)throw new Error("@aws-sdk/core/protocols - error handler not initialized.");try{return {errorSchema:n?.(this.errorRegistry,a)??this.errorRegistry.getSchema(e),errorMetadata:m}}catch{s.message=s.message??s.Message??"UnknownError";let f=this.errorRegistry,l=f.getBaseException();if(l){let p=f.getErrorCtor(l)??Error;throw this.decorateServiceException(Object.assign(new p({name:a}),m),s)}let h=s,u=h?.message??h?.Message??h?.Error?.Message??h?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(u),{name:a},m),s)}}compose(e,t,r){let s=r;t.includes("#")&&([s]=t.split("#"));let o=chunkGNEVCEJU_cjs.n.for(s),n=chunkGNEVCEJU_cjs.n.for("smithy.ts.sdk.synthetic."+r);e.copyFrom(o),e.copyFrom(n),this.errorRegistry=e;}decorateServiceException(e,t={}){if(this.queryCompat){let r=e.Message??t.Message,s=chunkLEBM6ZSZ_cjs.g(e,t);r&&(s.message=r);let o=s.Error??{};o.Type=s.Error?.Type,o.Code=s.Error?.Code,o.Message=s.Error?.message??s.Error?.Message??r,s.Error=o;let n=s.$metadata.requestId;return n&&(s.RequestId=n),s}return chunkLEBM6ZSZ_cjs.g(e,t)}setQueryCompatError(e,t){let r=t.headers?.["x-amzn-query-error"];if(e!==void 0&&r!=null){let[s,o]=r.split(";"),n=Object.keys(e),a={Code:s,Type:o};e.Code=s,e.Type=o;for(let m=0;m<n.length;m++){let c=n[m];a[c==="message"?"Message":c]=e[c];}delete a.__type,e.Error=a;}}queryCompatOutput(e,t){e.Error&&(t.Error=e.Error),e.Type&&(t.Type=e.Type),e.Code&&(t.Code=e.Code);}findQueryCompatibleError(e,t){try{return e.getSchema(t)}catch{return e.find(s=>chunkGNEVCEJU_cjs.m.of(s).getMergedTraits().awsQueryError?.[0]===t)}}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var x=class{serdeContext;setSerdeContext(e){this.serdeContext=e;}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var V=class{from;to;keys;constructor(e,t){this.from=e,this.to=t;let r=Object.keys(this.from),s=new Set(r);s.delete("__type"),this.keys=s;}mark(e){this.keys.delete(e);}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let e=this.keys.values().next().value,t=this.from[e];this.to.$unknown=[e,t];}}};chunkBUNLC3II_cjs.h();function Mt(i,e,t){if(t?.source){let r=t.source;if(typeof e=="number"&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER||r!==String(e)))return r.includes(".")?new chunkLQ3YZTPU_cjs.r(r,"bigDecimal"):BigInt(r)}return e}chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var Dt=(i,e)=>chunkGNEVCEJU_cjs.J(i,e).then(t=>(e?.utf8Encoder??chunkLQ3YZTPU_cjs.e)(t));var Ot=(i,e)=>Dt(i,e).then(t=>{if(t.length)try{return JSON.parse(t)}catch(r){throw r?.name==="SyntaxError"&&Object.defineProperty(r,"$responseBodyText",{value:t}),r}return {}});var zt=(i,e)=>Object.keys(i).find(t=>t.toLowerCase()===e.toLowerCase()),Pe=i=>{let e=i;return typeof e=="number"&&(e=e.toString()),e.indexOf(",")>=0&&(e=e.split(",")[0]),e.indexOf(":")>=0&&(e=e.split(":")[0]),e.indexOf("#")>=0&&(e=e.split("#")[1]),e},Pt=(i,e)=>vt(i,e,["header","code","type"]);var vt=({headers:i},e,t)=>{for(;t.length>0;)switch(t.shift()){case "header":let s=zt(i??{},"x-amzn-errortype");if(s!==void 0)return Pe(i[s]);break;case "code":let o=zt(e??{},"code");if(o&&e[o]!==void 0)return Pe(e[o]);break;case "type":if(e?.__type!==void 0)return Pe(e.__type);break}};var de=class extends x{settings;constructor(e){super(),this.settings=e;}async read(e,t){return this._read(e,typeof t=="string"?JSON.parse(t,Mt):await Ot(t,this.serdeContext))}readObject(e,t){return this._read(e,t)}_read(e,t){let r=t!==null&&typeof t=="object",s=chunkGNEVCEJU_cjs.m.of(e);if(r){if(s.isStructSchema()){let n=t,a=s.isUnionSchema(),m={},c,{jsonName:f}=this.settings;f&&(c={});let l;a&&(l=new V(n,m));for(let[h,u]of s.structIterator()){let p=h;f&&(p=u.getMergedTraits().jsonName??p,c[p]=h),a&&l.mark(p),n[p]!=null&&(m[h]=this._read(u,n[p]));}if(a)l.writeUnknown();else if(typeof n.__type=="string")for(let h in n){let u=n[h],p=f?c[h]??h:h;p in m||(m[p]=u);}return m}if(Array.isArray(t)&&s.isListSchema()){let n=s.getValueSchema(),a=[];for(let m of t)a.push(this._read(n,m));return a}if(s.isMapSchema()){let n=s.getValueSchema(),a={};for(let m in t)a[m]=this._read(n,t[m]);return a}}if(s.isBlobSchema()&&typeof t=="string")return chunkLQ3YZTPU_cjs.b(t);let o=s.getMergedTraits().mediaType;if(s.isStringSchema()&&typeof t=="string"&&o)return o==="application/json"||o.endsWith("+json")?chunkLQ3YZTPU_cjs.k.from(t):t;if(s.isTimestampSchema()&&t!=null)switch(chunkGNEVCEJU_cjs.N(s,this.settings)){case 5:return chunkLQ3YZTPU_cjs.h(t);case 6:return chunkLQ3YZTPU_cjs.i(t);case 7:return chunkLQ3YZTPU_cjs.j(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}if(s.isBigIntegerSchema()&&(typeof t=="number"||typeof t=="string"))return BigInt(t);if(s.isBigDecimalSchema()&&t!=null){if(t instanceof chunkLQ3YZTPU_cjs.r)return t;let n=t;return n.type==="bigDecimal"&&"string"in n?new chunkLQ3YZTPU_cjs.r(n.string,n.type):new chunkLQ3YZTPU_cjs.r(String(t),"bigDecimal")}if(s.isNumericSchema()&&typeof t=="string"){switch(t){case "Infinity":return 1/0;case "-Infinity":return -1/0;case "NaN":return NaN}return t}if(s.isDocumentSchema())if(r){let n=Array.isArray(t)?[]:{};for(let a in t){let m=t[a];m instanceof chunkLQ3YZTPU_cjs.r?n[a]=m:n[a]=this._read(s,m);}return n}else return structuredClone(t);return t}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var Ht="\u039D",le=class{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(e,t)=>{if(t instanceof chunkLQ3YZTPU_cjs.r){let r=`${Ht+"nv"+this.counter++}_`+t.string;return this.values.set(`"${r}"`,t.string),r}if(typeof t=="bigint"){let r=t.toString(),s=`${Ht+"b"+this.counter++}_`+r;return this.values.set(`"${s}"`,r),s}return t}}replaceInJson(e){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return e;for(let[t,r]of this.values)e=e.replace(t,r);return e}};var he=class extends x{settings;buffer;useReplacer=false;rootSchema;constructor(e){super(),this.settings=e;}write(e,t){this.rootSchema=chunkGNEVCEJU_cjs.m.of(e),this.buffer=this._write(this.rootSchema,t);}flush(){let{rootSchema:e,useReplacer:t}=this;if(this.rootSchema=void 0,this.useReplacer=false,e?.isStructSchema()||e?.isDocumentSchema()){if(!t)return JSON.stringify(this.buffer);let r=new le;return r.replaceInJson(JSON.stringify(this.buffer,r.createReplacer(),0))}return this.buffer}writeDiscriminatedDocument(e,t){this.write(e,t),typeof this.buffer=="object"&&(this.buffer.__type=chunkGNEVCEJU_cjs.m.of(e).getName(true));}_write(e,t,r){let s=t!==null&&typeof t=="object",o=chunkGNEVCEJU_cjs.m.of(e);if(s){if(o.isStructSchema()){let n=t,a={},{jsonName:m}=this.settings,c;m&&(c={});let f=0;for(let[l,h]of o.structIterator()){let u=this._write(h,n[l],o);if(u!==void 0){let p=l;m&&(p=h.getMergedTraits().jsonName??l,c[l]=p),a[p]=u,f++;}}if(o.isUnionSchema()&&f===0){let{$unknown:l}=n;if(Array.isArray(l)){let[h,u]=l;a[h]=this._write(15,u);}}else if(typeof n.__type=="string")for(let l in n){let h=n[l],u=m?c[l]??l:l;u in a||(a[u]=this._write(15,h));}return a}if(Array.isArray(t)&&o.isListSchema()){let n=o.getValueSchema(),a=[],m=!!o.getMergedTraits().sparse;for(let c of t)(m||c!=null)&&a.push(this._write(n,c));return a}if(o.isMapSchema()){let n=o.getValueSchema(),a={},m=!!o.getMergedTraits().sparse;for(let c in t){let f=t[c];(m||f!=null)&&(a[c]=this._write(n,f));}return a}if(t instanceof Uint8Array&&(o.isBlobSchema()||o.isDocumentSchema()))return o===this.rootSchema?t:(this.serdeContext?.base64Encoder??chunkLQ3YZTPU_cjs.d)(t);if(t instanceof Date&&(o.isTimestampSchema()||o.isDocumentSchema()))switch(chunkGNEVCEJU_cjs.N(o,this.settings)){case 5:return t.toISOString().replace(".000Z","Z");case 6:return chunkLQ3YZTPU_cjs.f(t);case 7:return t.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",t),t.getTime()/1e3}t instanceof chunkLQ3YZTPU_cjs.r&&(this.useReplacer=true);}if(!(t===null&&r?.isStructSchema())){if(o.isStringSchema()){if(typeof t>"u"&&o.isIdempotencyToken())return chunkLQ3YZTPU_cjs.D();let n=o.getMergedTraits().mediaType;return t!=null&&n&&(n==="application/json"||n.endsWith("+json"))?chunkLQ3YZTPU_cjs.k.from(t):t}if(typeof t=="number"&&o.isNumericSchema())return Math.abs(t)===1/0||isNaN(t)?String(t):t;if(typeof t=="string"&&o.isBlobSchema())return o===this.rootSchema?t:(this.serdeContext?.base64Encoder??chunkLQ3YZTPU_cjs.d)(t);if(typeof t=="bigint"&&(this.useReplacer=true),o.isDocumentSchema())if(s){let n=Array.isArray(t)?[]:{};for(let a in t){let m=t[a];m instanceof chunkLQ3YZTPU_cjs.r?(this.useReplacer=true,n[a]=m):n[a]=this._write(o,m);}return n}else return structuredClone(t);return t}}};var ue=class extends x{settings;constructor(e){super(),this.settings=e;}createSerializer(){let e=new he(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new de(this.settings);return e.setSerdeContext(this.serdeContext),e}};var He=class extends chunkGNEVCEJU_cjs.L{serializer;deserializer;codec;mixin=new M;constructor({defaultNamespace:e,errorTypeRegistries:t}){super({defaultNamespace:e,errorTypeRegistries:t});let r={timestampFormat:{useTrait:true,default:7},httpBindings:true,jsonName:true};this.codec=new ue(r),this.serializer=new chunkGNEVCEJU_cjs.Q(this.codec.createSerializer(),r),this.deserializer=new chunkGNEVCEJU_cjs.P(this.codec.createDeserializer(),r);}getShapeId(){return "aws.protocols#restJson1"}getPayloadCodec(){return this.codec}setSerdeContext(e){this.codec.setSerdeContext(e),super.setSerdeContext(e);}async serializeRequest(e,t,r){let s=await super.serializeRequest(e,t,r),o=chunkGNEVCEJU_cjs.m.of(e.input);if(!s.headers["content-type"]){let n=this.mixin.resolveRestContentType(this.getDefaultContentType(),o);n&&(s.headers["content-type"]=n);}return s.body==null&&s.headers["content-type"]===this.getDefaultContentType()&&(s.body="{}"),s}async deserializeResponse(e,t,r){let s=await super.deserializeResponse(e,t,r),o=chunkGNEVCEJU_cjs.m.of(e.output);for(let[n,a]of o.structIterator())a.getMemberTraits().httpPayload&&!(n in s)&&(s[n]=null);return s}async handleError(e,t,r,s,o){let n=Pt(r,s)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,n,this.options.defaultNamespace);let{errorSchema:a,errorMetadata:m}=await this.mixin.getErrorSchemaOrThrowBaseException(n,this.options.defaultNamespace,r,s,o),c=chunkGNEVCEJU_cjs.m.of(a),f=s.message??s.Message??"UnknownError",l=this.compositeErrorRegistry.getErrorCtor(a)??Error,h=new l({});await this.deserializeHttpMessage(a,t,r,s);let u={},p=this.codec.createDeserializer();for(let[y,S]of c.structIterator()){let C=S.getMergedTraits().jsonName??y;u[y]=p.readObject(S,s[C]);}throw this.mixin.decorateServiceException(Object.assign(h,m,{$fault:c.getMergedTraits().error,message:f},u),s)}getDefaultContentType(){return "application/json"}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var Jt=/[&<>"]/g,Wt={"&":"&","<":"<",">":">",'"':"""};function $t(i){return i.replace(Jt,e=>Wt[e])}chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var Yt=/[&"'<>\r\n\u0085\u2028]/g,Zt={"&":"&",'"':""","'":"'","<":"<",">":">","\r":"
","\n":"
","\x85":"…","\u2028":"
"};function Ut(i){return i.replace(Yt,e=>Zt[e])}var D=class{value;constructor(e){this.value=e;}toString(){return Ut(""+this.value)}};var A=class i{name;children;attributes={};static of(e,t,r){let s=new i(e);return t!==void 0&&s.addChildNode(new D(t)),r!==void 0&&s.withName(r),s}constructor(e,t=[]){this.name=e,this.children=t;}withName(e){return this.name=e,this}addAttribute(e,t){return this.attributes[e]=t,this}addChildNode(e){return this.children.push(e),this}removeAttribute(e){return delete this.attributes[e],this}n(e){return this.name=e,this}c(e){return this.children.push(e),this}a(e,t){return t!=null&&(this.attributes[e]=t),this}cc(e,t,r=t){if(e[t]!=null){let s=i.of(t,e[t]).withName(r);this.c(s);}}l(e,t,r,s){e[t]!=null&&s().map(n=>{n.withName(r),this.c(n);});}lc(e,t,r,s){if(e[t]!=null){let o=s(),n=new i(r);o.map(a=>{n.c(a);}),this.c(n);}}toString(){let e=!!this.children.length,t=`<${this.name}`,r=this.attributes;for(let s of Object.keys(r)){let o=r[s];o!=null&&(t+=` ${s}="${$t(""+o)}"`);}return t+=e?`>${this.children.map(s=>s.toString()).join("")}</${this.name}>`:"/>"}};chunkBUNLC3II_cjs.h();function Ue(i){return new $e(i).parse()}var $e=class i{x;i=0;z;constructor(e){this.x=e,this.x=e.replace(/\r\n?/g,`
|
|
13
|
+
`),this.z=this.x.length;}parse(){let e=this,{z:t}=e;for(;e.i<t&&(e.trim(),!(e.i>=t));)if(e.isNext("<?"))e.readTo("?>"),e.trim();else if(e.isNext("<!--"))e.readTo("-->"),e.trim();else if(e.isNext("<!DOCTYPE",false))e.skipDoctype(),e.trim();else if(e.x[e.i]==="<"){let r=e.parseTag();return {[r.tag]:r.value}}else throw new Error("@aws-sdk XML parse error: unexpected content.");throw new Error("@aws-sdk XML parse error: no root element.")}isNext(e,t=true){let r=this;return t?r.x.startsWith(e,r.i):r.x.toLowerCase().startsWith(e.toLowerCase(),r.i)}readTo(e){let t=this,r=t.x.indexOf(e,t.i);if(r===-1)throw new Error(`@aws-sdk XML parse error: expected "${e}" not found.`);let s=t.x.slice(t.i,r);return t.i=r+e.length,s}trim(){let e=this;for(;e.i<e.z&&` \r
|
|
14
|
+
`.includes(e.x[e.i]);)++e.i;}readAttrValue(){let e=this,t=e.x[e.i];++e.i;let r="";for(;e.i<e.z&&e.x[e.i]!==t;)r+=e.x[e.i++];return ++e.i,e.decodeEntities(r)}parseTag(){let e=this;++e.i;let t="";for(;e.i<e.z&&!` \r
|
|
15
|
+
>/`.includes(e.x[e.i]);)t+=e.x[e.i++];let r=false,s=Object.create(null);for(;e.i<e.z&&(e.trim(),!">/".includes(e.x[e.i]));){let f="";for(;e.i<e.z&&!`= \r
|
|
16
|
+
>/?`.includes(e.x[e.i]);)f+=e.x[e.i++];if(e.trim(),e.x[e.i]!=="=")break;++e.i,e.trim(),s[f]=e.readAttrValue(),r=true;}if(e.i>=e.z)throw new Error("@aws-sdk XML parse error: unexpected end of input.");if(e.x[e.i]==="/"){if(++e.i,e.i>=e.z||e.x[e.i]!==">")throw new Error("@aws-sdk XML parse error: expected > at the end of self-closing tag.");return ++e.i,Object.setPrototypeOf(s,Object.prototype),{tag:t,value:r?s:""}}if(e.x[e.i]!==">")throw new Error("@aws-sdk XML parse error: expected > at the end of opening tag.");++e.i;let o=[],n=[],a=false;for(;e.i<e.z&&!e.isNext("</");)if(e.x[e.i]==="<")e.isNext("<!--")?e.readTo("-->"):e.isNext("<![CDATA[")?(e.i+=9,o.push(e.readTo("]]>"))):e.isNext("<?")?e.readTo("?>"):(a=true,n.push(e.parseTag()));else {let f="";for(;e.i<e.z&&e.x[e.i]!=="<";)f+=e.x[e.i++];o.push(e.decodeEntities(f));}if(!e.isNext("</"))throw new Error(`@aws-sdk XML parse error: missing closing tag </${t}>.`);e.i+=2;let m=e.readTo(">").trim();if(m!==t)throw new Error(`@aws-sdk XML parse error: mismatched tags <${t}> and </${m}>.`);if(!r&&o.length===0&&!a)return {tag:t,value:""};if(!r&&!a){let f=o.length===1?o[0]:o.join("");return f.trim()===""&&f.includes(`
|
|
17
|
+
`)?{tag:t,value:""}:{tag:t,value:f}}let c=Object.create(null);for(let f of o)f.trim()===""&&f.includes(`
|
|
18
|
+
`)||(c["#text"]="#text"in c?c["#text"]+f:f);for(let f of n)f.tag in c?Array.isArray(c[f.tag])?c[f.tag].push(f.value):c[f.tag]=[c[f.tag],f.value]:c[f.tag]=f.value;for(let[f,l]of Object.entries(s))c[f]=l;return Object.setPrototypeOf(c,Object.prototype),{tag:t,value:c}}static ENTITIES={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};skipDoctype(){let e=this;e.i+=9;let t=0;for(;e.i<e.z;){let r=e.x[e.i];if(r==="[")++t;else if(r==="]")--t;else if(r===">"&&t===0){++e.i;return}++e.i;}throw new Error("@aws-sdk XML parse error: unclosed DOCTYPE.")}decodeEntities(e){return e.replace(/&(?:#x([0-9a-fA-F]{1,6})|#(\d{1,7})|([a-zA-Z][a-zA-Z0-9]{0,30}));/g,(t,r,s,o)=>r?String.fromCharCode(parseInt(r,16)):s?String.fromCharCode(parseInt(s,10)):i.ENTITIES[o]??"")}};var j=class extends x{settings;stringDeserializer;constructor(e){super(),this.settings=e,this.stringDeserializer=new chunkGNEVCEJU_cjs.O(e);}setSerdeContext(e){this.serdeContext=e,this.stringDeserializer.setSerdeContext(e);}read(e,t,r){let s=chunkGNEVCEJU_cjs.m.of(e),o=s.getMemberSchemas();if(s.isStructSchema()&&s.isMemberSchema()&&!!Object.values(o).find(c=>!!c.getMemberTraits().eventPayload)){let c={},f=Object.keys(o)[0];return o[f].isBlobSchema()?c[f]=t:c[f]=this.read(o[f],t),c}let a=(this.serdeContext?.utf8Encoder??chunkLQ3YZTPU_cjs.e)(t),m=this.parseXml(a);return this.readSchema(e,r?m[r]:m)}readSchema(e,t){let r=chunkGNEVCEJU_cjs.m.of(e);if(r.isUnitSchema())return;let s=r.getMergedTraits();if(r.isListSchema()&&!Array.isArray(t))return this.readSchema(r,[t]);if(t==null)return t;if(typeof t=="object"){let o=!!s.xmlFlattened;if(r.isListSchema()){let a=r.getValueSchema(),m=[],c=a.getMergedTraits().xmlName??"member",f=o?t:(t[0]??t)[c];if(f==null)return m;let l=Array.isArray(f)?f:[f];for(let h of l)m.push(this.readSchema(a,h));return m}let n={};if(r.isMapSchema()){let a=r.getKeySchema(),m=r.getValueSchema(),c;o?c=Array.isArray(t)?t:[t]:c=Array.isArray(t.entry)?t.entry:[t.entry];let f=a.getMergedTraits().xmlName??"key",l=m.getMergedTraits().xmlName??"value";for(let h of c){let u=h[f],p=h[l];n[u]=this.readSchema(m,p);}return n}if(r.isStructSchema()){let a=r.isUnionSchema(),m;a&&(m=new V(t,n));for(let[c,f]of r.structIterator()){let l=f.getMergedTraits(),h=l.httpPayload?l.xmlName??f.getName():f.getMemberTraits().xmlName??c;a&&m.mark(h),t[h]!=null&&(n[c]=this.readSchema(f,t[h]));}return a&&m.writeUnknown(),n}if(r.isDocumentSchema())return t;throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${r.getName(true)}`)}return r.isListSchema()?[]:r.isMapSchema()||r.isStructSchema()?{}:this.stringDeserializer.read(r,t)}parseXml(e){if(e.length){let t;try{t=Ue(e);}catch(n){throw n&&typeof n=="object"&&Object.defineProperty(n,"$responseBodyText",{value:e}),n}let r="#text",s=Object.keys(t)[0],o=t[s];return o[r]&&(o[s]=o[r],delete o[r]),chunkLEBM6ZSZ_cjs.l(o)}return {}}};chunkBUNLC3II_cjs.h();var ge=class extends x{settings;buffer;constructor(e){super(),this.settings=e;}write(e,t,r=""){this.buffer===void 0&&(this.buffer="");let s=chunkGNEVCEJU_cjs.m.of(e);if(r&&!r.endsWith(".")&&(r+="."),s.isBlobSchema())(typeof t=="string"||t instanceof Uint8Array)&&(this.writeKey(r),this.writeValue((this.serdeContext?.base64Encoder??chunkLQ3YZTPU_cjs.d)(t)));else if(s.isBooleanSchema()||s.isNumericSchema()||s.isStringSchema())t!=null?(this.writeKey(r),this.writeValue(String(t))):s.isIdempotencyToken()&&(this.writeKey(r),this.writeValue(chunkLQ3YZTPU_cjs.D()));else if(s.isBigIntegerSchema())t!=null&&(this.writeKey(r),this.writeValue(String(t)));else if(s.isBigDecimalSchema())t!=null&&(this.writeKey(r),this.writeValue(t instanceof chunkLQ3YZTPU_cjs.r?t.string:String(t)));else if(s.isTimestampSchema()){if(t instanceof Date)switch(this.writeKey(r),chunkGNEVCEJU_cjs.N(s,this.settings)){case 5:this.writeValue(t.toISOString().replace(".000Z","Z"));break;case 6:this.writeValue(chunkLQ3YZTPU_cjs.f(t));break;case 7:this.writeValue(String(t.getTime()/1e3));break}}else if(s.isDocumentSchema())Array.isArray(t)?this.write(79,t,r):t instanceof Date?this.write(4,t,r):t instanceof Uint8Array?this.write(21,t,r):t&&typeof t=="object"?this.write(143,t,r):(this.writeKey(r),this.writeValue(String(t)));else if(s.isListSchema()){if(Array.isArray(t))if(t.length===0)this.settings.serializeEmptyLists&&(this.writeKey(r),this.writeValue(""));else {let o=s.getValueSchema(),n=this.settings.flattenLists||s.getMergedTraits().xmlFlattened,a=1;for(let m of t){if(m==null)continue;let c=o.getMergedTraits(),f=this.getKey("member",c.xmlName,c.ec2QueryName),l=n?`${r}${a}`:`${r}${f}.${a}`;this.write(o,m,l),++a;}}}else if(s.isMapSchema()){if(t&&typeof t=="object"){let o=s.getKeySchema(),n=s.getValueSchema(),a=s.getMergedTraits().xmlFlattened,m=1;for(let c in t){let f=t[c];if(f==null)continue;let l=o.getMergedTraits(),h=this.getKey("key",l.xmlName,l.ec2QueryName),u=a?`${r}${m}.${h}`:`${r}entry.${m}.${h}`,p=n.getMergedTraits(),y=this.getKey("value",p.xmlName,p.ec2QueryName),S=a?`${r}${m}.${y}`:`${r}entry.${m}.${y}`;this.write(o,c,u),this.write(n,f,S),++m;}}}else if(s.isStructSchema()){if(t&&typeof t=="object"){let o=false;for(let[n,a]of s.structIterator()){if(t[n]==null&&!a.isIdempotencyToken())continue;let m=a.getMergedTraits(),c=this.getKey(n,m.xmlName,m.ec2QueryName,"struct"),f=`${r}${c}`;this.write(a,t[n],f),o=true;}if(!o&&s.isUnionSchema()){let{$unknown:n}=t;if(Array.isArray(n)){let[a,m]=n,c=`${r}${a}`;this.write(15,m,c);}}}}else if(!s.isUnitSchema())throw new Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${s.getName(true)}`)}flush(){if(this.buffer===void 0)throw new Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.");let e=this.buffer;return delete this.buffer,e}getKey(e,t,r,s){let{ec2:o,capitalizeKeys:n}=this.settings;if(o&&r)return r;let a=t??e;return n&&s==="struct"?a[0].toUpperCase()+a.slice(1):a}writeKey(e){e.endsWith(".")&&(e=e.slice(0,e.length-1)),this.buffer+=`&${chunkGNEVCEJU_cjs.K(e)}=`;}writeValue(e){this.buffer+=chunkGNEVCEJU_cjs.K(e);}};var Le=class extends chunkGNEVCEJU_cjs.M{options;serializer;deserializer;mixin=new M;constructor(e){super({defaultNamespace:e.defaultNamespace,errorTypeRegistries:e.errorTypeRegistries}),this.options=e;let t={timestampFormat:{useTrait:true,default:5},httpBindings:false,xmlNamespace:e.xmlNamespace,serviceNamespace:e.defaultNamespace,serializeEmptyLists:true};this.serializer=new ge(t),this.deserializer=new j(t);}getShapeId(){return "aws.protocols#awsQuery"}setSerdeContext(e){this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e);}getPayloadCodec(){throw new Error("AWSQuery protocol has no payload codec.")}async serializeRequest(e,t,r){let s=await super.serializeRequest(e,t,r);s.path.endsWith("/")||(s.path+="/"),s.headers["content-type"]="application/x-www-form-urlencoded",(chunkGNEVCEJU_cjs.k(e.input)==="unit"||!s.body)&&(s.body="");let o=e.name.split("#")[1]??e.name;return s.body=`Action=${o}&Version=${this.options.version}`+s.body,s.body.endsWith("&")&&(s.body=s.body.slice(-1)),s}async deserializeResponse(e,t,r){let s=this.deserializer,o=chunkGNEVCEJU_cjs.m.of(e.output),n={};if(r.statusCode>=300){let f=await chunkGNEVCEJU_cjs.J(r.body,t);f.byteLength>0&&Object.assign(n,await s.read(15,f)),await this.handleError(e,t,r,n,this.deserializeMetadata(r));}for(let f in r.headers){let l=r.headers[f];delete r.headers[f],r.headers[f.toLowerCase()]=l;}let a=e.name.split("#")[1]??e.name,m=o.isStructSchema()&&this.useNestedResult()?a+"Result":void 0,c=await chunkGNEVCEJU_cjs.J(r.body,t);return c.byteLength>0&&Object.assign(n,await s.read(o,c,m)),n.$metadata=this.deserializeMetadata(r),n}useNestedResult(){return true}async handleError(e,t,r,s,o){let n=this.loadQueryErrorCode(r,s)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,n,this.options.defaultNamespace);let a=this.loadQueryError(s)??{},m=this.loadQueryErrorMessage(s);a.message=m,a.Error={Type:a.Type,Code:a.Code,Message:m};let{errorSchema:c,errorMetadata:f}=await this.mixin.getErrorSchemaOrThrowBaseException(n,this.options.defaultNamespace,r,a,o,this.mixin.findQueryCompatibleError),l=chunkGNEVCEJU_cjs.m.of(c),h=this.compositeErrorRegistry.getErrorCtor(c)??Error,u=new h({}),p={Type:a.Error.Type,Code:a.Error.Code,Error:a.Error};for(let[y,S]of l.structIterator()){let C=S.getMergedTraits().xmlName??y,N=a[C]??s[C];p[y]=this.deserializer.readSchema(S,N);}throw this.mixin.decorateServiceException(Object.assign(u,f,{$fault:l.getMergedTraits().error,message:m},p),s)}loadQueryErrorCode(e,t){let r=(t.Errors?.[0]?.Error??t.Errors?.Error??t.Error)?.Code;if(r!==void 0)return r;if(e.statusCode==404)return "NotFound"}loadQueryError(e){return e.Errors?.[0]?.Error??e.Errors?.Error??e.Error}loadQueryErrorMessage(e){let t=this.loadQueryError(e);return t?.message??t?.Message??e.message??e.Message??"Unknown"}getDefaultContentType(){return "application/x-www-form-urlencoded"}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var Lt=(i,e)=>{if(e?.Error?.Code!==void 0)return e.Error.Code;if(e?.Code!==void 0)return e.Code;if(i.statusCode==404)return "NotFound"};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var pe=class extends x{settings;stringBuffer;byteBuffer;buffer;constructor(e){super(),this.settings=e;}write(e,t){let r=chunkGNEVCEJU_cjs.m.of(e);if(r.isStringSchema()&&typeof t=="string")this.stringBuffer=t;else if(r.isBlobSchema())this.byteBuffer="byteLength"in t?t:(this.serdeContext?.base64Decoder??chunkLQ3YZTPU_cjs.b)(t);else {this.buffer=this.writeStruct(r,t,void 0);let s=r.getMergedTraits();s.httpPayload&&!s.xmlName&&this.buffer.withName(r.getName());}}flush(){if(this.byteBuffer!==void 0){let t=this.byteBuffer;return delete this.byteBuffer,t}if(this.stringBuffer!==void 0){let t=this.stringBuffer;return delete this.stringBuffer,t}let e=this.buffer;return this.settings.xmlNamespace&&(e?.attributes?.xmlns||e.addAttribute("xmlns",this.settings.xmlNamespace)),delete this.buffer,e.toString()}writeStruct(e,t,r){let s=e.getMergedTraits(),o=e.isMemberSchema()&&!s.httpPayload?e.getMemberTraits().xmlName??e.getMemberName():s.xmlName??e.getName();if(!o||!e.isStructSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write struct with empty name or non-struct, schema=${e.getName(true)}.`);let n=A.of(o),[a,m]=this.getXmlnsAttribute(e,r);for(let[f,l]of e.structIterator()){let h=t[f];if(h!=null||l.isIdempotencyToken()){if(l.getMergedTraits().xmlAttribute){n.addAttribute(l.getMergedTraits().xmlName??f,this.writeSimple(l,h));continue}if(l.isListSchema())this.writeList(l,h,n,m);else if(l.isMapSchema())this.writeMap(l,h,n,m);else if(l.isStructSchema())n.addChildNode(this.writeStruct(l,h,m));else {let u=A.of(l.getMergedTraits().xmlName??l.getMemberName());this.writeSimpleInto(l,h,u,m),n.addChildNode(u);}}}let{$unknown:c}=t;if(c&&e.isUnionSchema()&&Array.isArray(c)&&Object.keys(t).length===1){let[f,l]=c,h=A.of(f);if(typeof l!="string")if(t instanceof A||t instanceof D)n.addChildNode(t);else throw new Error("@aws-sdk - $unknown union member in XML requires value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.");this.writeSimpleInto(0,l,h,m),n.addChildNode(h);}return m&&n.addAttribute(a,m),n}writeList(e,t,r,s){if(!e.isMemberSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member list: ${e.getName(true)}`);let o=e.getMergedTraits(),n=e.getValueSchema(),a=n.getMergedTraits(),m=!!a.sparse,c=!!o.xmlFlattened,[f,l]=this.getXmlnsAttribute(e,s),h=(u,p)=>{if(n.isListSchema())this.writeList(n,Array.isArray(p)?p:[p],u,l);else if(n.isMapSchema())this.writeMap(n,p,u,l);else if(n.isStructSchema()){let y=this.writeStruct(n,p,l);u.addChildNode(y.withName(c?o.xmlName??e.getMemberName():a.xmlName??"member"));}else {let y=A.of(c?o.xmlName??e.getMemberName():a.xmlName??"member");this.writeSimpleInto(n,p,y,l),u.addChildNode(y);}};if(c)for(let u of t)(m||u!=null)&&h(r,u);else {let u=A.of(o.xmlName??e.getMemberName());l&&u.addAttribute(f,l);for(let p of t)(m||p!=null)&&h(u,p);r.addChildNode(u);}}writeMap(e,t,r,s,o=false){if(!e.isMemberSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member map: ${e.getName(true)}`);let n=e.getMergedTraits(),a=e.getKeySchema(),c=a.getMergedTraits().xmlName??"key",f=e.getValueSchema(),l=f.getMergedTraits(),h=l.xmlName??"value",u=!!l.sparse,p=!!n.xmlFlattened,[y,S]=this.getXmlnsAttribute(e,s),C=(N,z,T)=>{let X=A.of(c,z),[Bt,Ke]=this.getXmlnsAttribute(a,S);Ke&&X.addAttribute(Bt,Ke),N.addChildNode(X);let F=A.of(h);f.isListSchema()?this.writeList(f,T,F,S):f.isMapSchema()?this.writeMap(f,T,F,S,true):f.isStructSchema()?F=this.writeStruct(f,T,S):this.writeSimpleInto(f,T,F,S),N.addChildNode(F);};if(p)for(let N in t){let z=t[N];if(u||z!=null){let T=A.of(n.xmlName??e.getMemberName());C(T,N,z),r.addChildNode(T);}}else {let N;o||(N=A.of(n.xmlName??e.getMemberName()),S&&N.addAttribute(y,S),r.addChildNode(N));for(let z in t){let T=t[z];if(u||T!=null){let X=A.of("entry");C(X,z,T),(o?r:N).addChildNode(X);}}}}writeSimple(e,t){if(t===null)throw new Error("@aws-sdk/core/protocols - (XML serializer) cannot write null value.");let r=chunkGNEVCEJU_cjs.m.of(e),s=null;if(t&&typeof t=="object")if(r.isBlobSchema())s=(this.serdeContext?.base64Encoder??chunkLQ3YZTPU_cjs.d)(t);else if(r.isTimestampSchema()&&t instanceof Date)switch(chunkGNEVCEJU_cjs.N(r,this.settings)){case 5:s=t.toISOString().replace(".000Z","Z");break;case 6:s=chunkLQ3YZTPU_cjs.f(t);break;case 7:s=String(t.getTime()/1e3);break;default:console.warn("Missing timestamp format, using http date",t),s=chunkLQ3YZTPU_cjs.f(t);break}else {if(r.isBigDecimalSchema()&&t)return t instanceof chunkLQ3YZTPU_cjs.r?t.string:String(t);throw r.isMapSchema()||r.isListSchema()?new Error("@aws-sdk/core/protocols - xml serializer, cannot call _write() on List/Map schema, call writeList or writeMap() instead."):new Error(`@aws-sdk/core/protocols - xml serializer, unhandled schema type for object value and schema: ${r.getName(true)}`)}if((r.isBooleanSchema()||r.isNumericSchema()||r.isBigIntegerSchema()||r.isBigDecimalSchema())&&(s=String(t)),r.isStringSchema()&&(t===void 0&&r.isIdempotencyToken()?s=chunkLQ3YZTPU_cjs.D():s=String(t)),s===null)throw new Error(`Unhandled schema-value pair ${r.getName(true)}=${t}`);return s}writeSimpleInto(e,t,r,s){let o=this.writeSimple(e,t),n=chunkGNEVCEJU_cjs.m.of(e),a=new D(o),[m,c]=this.getXmlnsAttribute(n,s);c&&r.addAttribute(m,c),r.addChildNode(a);}getXmlnsAttribute(e,t){let r=e.getMergedTraits(),[s,o]=r.xmlNamespace??[];return o&&o!==t?[s?`xmlns:${s}`:"xmlns",o]:[void 0,void 0]}};var ye=class extends x{settings;constructor(e){super(),this.settings=e;}createSerializer(){let e=new pe(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new j(this.settings);return e.setSerdeContext(this.serdeContext),e}};var Be=class extends chunkGNEVCEJU_cjs.L{codec;serializer;deserializer;mixin=new M;constructor(e){super(e);let t={timestampFormat:{useTrait:true,default:5},httpBindings:true,xmlNamespace:e.xmlNamespace,serviceNamespace:e.defaultNamespace};this.codec=new ye(t),this.serializer=new chunkGNEVCEJU_cjs.Q(this.codec.createSerializer(),t),this.deserializer=new chunkGNEVCEJU_cjs.P(this.codec.createDeserializer(),t);}getPayloadCodec(){return this.codec}getShapeId(){return "aws.protocols#restXml"}async serializeRequest(e,t,r){let s=await super.serializeRequest(e,t,r),o=chunkGNEVCEJU_cjs.m.of(e.input);if(!s.headers["content-type"]){let n=this.mixin.resolveRestContentType(this.getDefaultContentType(),o);n&&(s.headers["content-type"]=n);}return typeof s.body=="string"&&s.headers["content-type"]===this.getDefaultContentType()&&!s.body.startsWith("<?xml ")&&!this.hasUnstructuredPayloadBinding(o)&&(s.body='<?xml version="1.0" encoding="UTF-8"?>'+s.body),s}async deserializeResponse(e,t,r){return super.deserializeResponse(e,t,r)}async handleError(e,t,r,s,o){let n=Lt(r,s)??"Unknown";if(this.mixin.compose(this.compositeErrorRegistry,n,this.options.defaultNamespace),s.Error&&typeof s.Error=="object")for(let y of Object.keys(s.Error))s[y]=s.Error[y],y.toLowerCase()==="message"&&(s.message=s.Error[y]);s.RequestId&&!o.requestId&&(o.requestId=s.RequestId);let{errorSchema:a,errorMetadata:m}=await this.mixin.getErrorSchemaOrThrowBaseException(n,this.options.defaultNamespace,r,s,o),c=chunkGNEVCEJU_cjs.m.of(a),f=s.Error?.message??s.Error?.Message??s.message??s.Message??"UnknownError",l=this.compositeErrorRegistry.getErrorCtor(a)??Error,h=new l({});await this.deserializeHttpMessage(a,t,r,s);let u={},p=this.codec.createDeserializer();for(let[y,S]of c.structIterator()){let C=S.getMergedTraits().xmlName??y,N=s.Error?.[C]??s[C];u[y]=p.readSchema(S,N);}throw this.mixin.decorateServiceException(Object.assign(h,m,{$fault:c.getMergedTraits().error,message:f},u),s)}getDefaultContentType(){return "application/xml"}hasUnstructuredPayloadBinding(e){for(let[,t]of e.structIterator())if(t.getMergedTraits().httpPayload)return !(t.isStructSchema()||t.isMapSchema()||t.isListSchema());return false}};exports.a=K;exports.b=Xt;exports.c=He;exports.d=Le;exports.e=Be;exports.f=B;exports.g=ie;exports.h=nt;exports.i=at;exports.j=ct;exports.k=It;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {createRequire}from'module';import {b,g}from'./chunk-C2PXMVR5.js';createRequire(import.meta.url);
|
|
2
|
+
function t(e,r,o){let n=new Error(`[unstorage] [${e}] ${r}`,o);return Error.captureStackTrace&&Error.captureStackTrace(n,t),n}function f(e,r){return Array.isArray(r)?t(e,`Missing some of the required options ${r.map(o=>"`"+o+"`").join(", ")}`):t(e,`Missing required option \`${r}\`.`)}var c=b(()=>{g();});export{t as a,f as b,c};
|