@kyro-cms/core 0.12.44 → 0.12.46
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-227MEHYX.cjs +269 -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-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-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-CAJ4ZJO6.cjs +1 -0
- package/dist/chunk-CGPAS4U5.js +4 -0
- package/dist/chunk-DS5DE5BU.js +2 -0
- package/dist/chunk-DT3LHRQT.js +57 -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-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-IUAWDAUD.cjs +56 -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-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-PTWQQMWW.js +270 -0
- package/dist/chunk-QC4YXUBT.cjs +383 -0
- package/dist/chunk-QDHP5E4P.cjs +2 -0
- package/dist/chunk-QVDY6S4B.js +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-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/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 @@
|
|
|
1
|
+
'use strict';var chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),crypto=require('crypto');chunkBUNLC3II_cjs.h();async function f(e,r){return typeof e=="boolean"?e:typeof e=="function"?await e(r):true}function y(...e){let r={};for(let t of e)t&&typeof t=="object"&&Object.assign(r,t);return r}function h(e,r){return f(e,r).then(t=>{if(t!==true)return t===false?{_id:{$eq:null}}:t})}chunkBUNLC3II_cjs.h();var u="api_keys";function A(e){return e.substring(0,8)}function g(e,r){if(e.length!==r.length)return false;try{return crypto.timingSafeEqual(Buffer.from(e),Buffer.from(r))}catch{return false}}async function C(e,r,t){if(!e||typeof e!="string")return {valid:false,error:"No API key provided"};if(!e.startsWith("kyro_"))return {valid:false,error:"Invalid API key format"};let l=A(e);try{let s=await r.find({collection:u,where:{keyPrefix:{equals:l}},limit:100,page:1});if(!s.docs||s.docs.length===0)return {valid:!1,error:"Invalid API key"};let n=null;for(let i of s.docs){let c=i;if(g(c.key,e)){n=c;break}}if(!n)return {valid:!1,error:"Invalid API key"};if(n.expiresAt&&new Date(n.expiresAt)<new Date)return {valid:!1,error:"API key has expired"};try{await r.update({collection:u,id:n.id,data:{lastUsedAt:new Date().toISOString()}});}catch{}let o={id:n.userId,role:n.role||"author",tenantId:n.tenantId};if(t){let i=await t(n.userId);i&&Object.assign(o,i);}return {valid:!0,userId:n.userId,user:o,permissions:n.permissions||[],apiKeyId:n.id,tenantId:o.tenantId,role:o.role}}catch(s){return console.error("[ApiKey] Validation error:",s),{valid:false,error:"Failed to validate API key"}}}function P(e){let r=e.headers.get("Authorization");if(r){if(r.startsWith("ApiKey "))return r.slice(7).trim();if(r.startsWith("Bearer "))return null}let t=e.headers.get("X-API-Key");return t?t.trim():null}function K(e){return !e.valid||!e.userId?null:{userId:e.userId,user:e.user||{},permissions:e.permissions||[],apiKeyId:e.apiKeyId||"",tenantId:e.tenantId,role:e.role}}function k(e,r){if(e.length===0)return false;if(e.includes("*")||e.includes(r))return true;let[t,l]=r.split(":");return !!e.includes(`${t}:*`)}function v(){let e="abcdefghijklmnopqrstuvwxyz0123456789",r="";for(let t=0;t<32;t++)r+=e[Math.floor(Math.random()*e.length)];return `kyro_${r}`}function b(e){return e.substring(0,8)}exports.a=f;exports.b=y;exports.c=h;exports.d=u;exports.e=C;exports.f=P;exports.g=K;exports.h=k;exports.i=v;exports.j=b;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk7ACHOBWY_cjs=require('./chunk-7ACHOBWY.cjs'),chunkGNOSG3PK_cjs=require('./chunk-GNOSG3PK.cjs'),chunkBCEE4NBZ_cjs=require('./chunk-BCEE4NBZ.cjs'),chunkVRZC4TTF_cjs=require('./chunk-VRZC4TTF.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();function g(o){return chunkVRZC4TTF_cjs.c(o,chunk7ACHOBWY_cjs.d)?[`${o[chunkVRZC4TTF_cjs.t.Symbol.BaseName]}`]:chunkVRZC4TTF_cjs.c(o,chunkVRZC4TTF_cjs.i)?o._.usedTables??[]:chunkVRZC4TTF_cjs.c(o,chunkVRZC4TTF_cjs.A)?o.usedTables??[]:[]}var _=class extends chunkBCEE4NBZ_cjs.i{constructor(e,t,i,s){super(),this.table=e,this.session=t,this.dialect=i,this.config={table:e,withList:s};}static[chunkVRZC4TTF_cjs.a]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.table[chunkVRZC4TTF_cjs.t.Symbol.Columns],new chunkGNOSG3PK_cjs.a({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];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[chunk7ACHOBWY_cjs.d.Symbol.Columns]){return this.config.returning=chunkVRZC4TTF_cjs.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}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var y=class{static[chunkVRZC4TTF_cjs.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:chunkVRZC4TTF_cjs.c(e,chunkVRZC4TTF_cjs.i)?i=Object.fromEntries(Object.keys(e._.selectedFields).map(s=>[s,e[s]])):chunkVRZC4TTF_cjs.c(e,chunk7ACHOBWY_cjs.f)?i=e[chunkVRZC4TTF_cjs.l].selectedFields:chunkVRZC4TTF_cjs.c(e,chunkVRZC4TTF_cjs.A)?i={}:i=chunkVRZC4TTF_cjs.V(e),new j({table:e,fields:i,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}},k=class extends chunkGNOSG3PK_cjs.c{static[chunkVRZC4TTF_cjs.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=chunkVRZC4TTF_cjs.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,i)=>{let s=this.tableName,r=chunkVRZC4TTF_cjs.X(t);for(let n of g(t))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"&&!chunkVRZC4TTF_cjs.c(t,chunkVRZC4TTF_cjs.A))){let n=chunkVRZC4TTF_cjs.c(t,chunkVRZC4TTF_cjs.i)?t._.selectedFields:chunkVRZC4TTF_cjs.c(t,chunkVRZC4TTF_cjs.N)?t[chunkVRZC4TTF_cjs.l].selectedFields:t[chunkVRZC4TTF_cjs.t.Symbol.Columns];this.config.fields[r]=n;}if(typeof i=="function"&&(i=i(new Proxy(this.config.fields,new chunkGNOSG3PK_cjs.a({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:i,table:t,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(he()):i;if(!chunkVRZC4TTF_cjs.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 chunkGNOSG3PK_cjs.a({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new chunkGNOSG3PK_cjs.a({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 chunkGNOSG3PK_cjs.a({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 chunkGNOSG3PK_cjs.a({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 chunkVRZC4TTF_cjs.i(this.getSQL(),this.config.fields,e,false,[...new Set(t)]),new chunkGNOSG3PK_cjs.a({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new chunkGNOSG3PK_cjs.a({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}},j=class extends k{static[chunkVRZC4TTF_cjs.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=chunkVRZC4TTF_cjs.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()}};chunkVRZC4TTF_cjs.U(j,[chunkBCEE4NBZ_cjs.i]);function P(o,e){return (t,i,...s)=>{let r=[i,...s].map(n=>({type:o,isAll:e,rightSelect:n}));for(let n of r)if(!chunkVRZC4TTF_cjs.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 he=()=>({union:ce,unionAll:ue,intersect:fe,except:de}),ce=P("union",false),ue=P("union",true),fe=P("intersect",false),de=P("except",false);var C=class{static[chunkVRZC4TTF_cjs.a]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=chunkVRZC4TTF_cjs.c(e,chunk7ACHOBWY_cjs.g)?e:void 0,this.dialectConfig=chunkVRZC4TTF_cjs.c(e,chunk7ACHOBWY_cjs.g)?void 0:e;}$with=(e,t)=>{let i=this;return {as:r=>(typeof r=="function"&&(r=r(i)),new Proxy(new chunkVRZC4TTF_cjs.j(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,true),new chunkGNOSG3PK_cjs.a({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 chunk7ACHOBWY_cjs.h(this.dialectConfig)),this.dialect}};var T=class{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s;}static[chunkVRZC4TTF_cjs.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=e.map(i=>{let s={},r=this.table[chunkVRZC4TTF_cjs.t.Symbol.Columns];for(let n of Object.keys(i)){let f=i[n];s[n]=chunkVRZC4TTF_cjs.c(f,chunkVRZC4TTF_cjs.A)?f:new chunkVRZC4TTF_cjs.H(f,r[n]);}return s});return new F(this.table,t,this.session,this.dialect,this.withList)}select(e){let t=typeof e=="function"?e(new C):e;if(!chunkVRZC4TTF_cjs.c(t,chunkVRZC4TTF_cjs.A)&&!chunkVRZC4TTF_cjs.S(this.table[chunkVRZC4TTF_cjs.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 F(this.table,t,this.session,this.dialect,this.withList,true)}},F=class extends chunkBCEE4NBZ_cjs.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[chunkVRZC4TTF_cjs.a]="SQLiteInsert";config;returning(e=this.config.table[chunk7ACHOBWY_cjs.d.Symbol.Columns]){return this.config.returning=chunkVRZC4TTF_cjs.R(e),this}onConflictDoNothing(e={}){if(this.config.onConflict||(this.config.onConflict=[]),e.target===void 0)this.config.onConflict.push(chunkVRZC4TTF_cjs.J` on conflict do nothing`);else {let t=Array.isArray(e.target)?chunkVRZC4TTF_cjs.J`${e.target}`:chunkVRZC4TTF_cjs.J`${[e.target]}`,i=e.where?chunkVRZC4TTF_cjs.J` where ${e.where}`:chunkVRZC4TTF_cjs.J``;this.config.onConflict.push(chunkVRZC4TTF_cjs.J` 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?chunkVRZC4TTF_cjs.J` where ${e.where}`:void 0,i=e.targetWhere?chunkVRZC4TTF_cjs.J` where ${e.targetWhere}`:void 0,s=e.setWhere?chunkVRZC4TTF_cjs.J` where ${e.setWhere}`:void 0,r=Array.isArray(e.target)?chunkVRZC4TTF_cjs.J`${e.target}`:chunkVRZC4TTF_cjs.J`${[e.target]}`,n=this.dialect.buildUpdateSet(this.config.table,chunkVRZC4TTF_cjs.T(this.config.table,e.set));return this.config.onConflict.push(chunkVRZC4TTF_cjs.J` 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}};chunkBUNLC3II_cjs.h();var A=class{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s;}static[chunkVRZC4TTF_cjs.a]="SQLiteUpdateBuilder";set(e){return new U(this.table,chunkVRZC4TTF_cjs.T(this.table,e),this.session,this.dialect,this.withList)}},U=class extends chunkBCEE4NBZ_cjs.i{constructor(e,t,i,s,r){super(),this.session=i,this.dialect=s,this.config={set:t,table:e,withList:r,joins:[]};}static[chunkVRZC4TTF_cjs.a]="SQLiteUpdate";config;from(e){return this.config.from=e,this}createJoin(e){return (t,i)=>{let s=chunkVRZC4TTF_cjs.X(t);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?chunkVRZC4TTF_cjs.c(t,chunk7ACHOBWY_cjs.d)?t[chunkVRZC4TTF_cjs.t.Symbol.Columns]:chunkVRZC4TTF_cjs.c(t,chunkVRZC4TTF_cjs.i)?t._.selectedFields:chunkVRZC4TTF_cjs.c(t,chunk7ACHOBWY_cjs.f)?t[chunkVRZC4TTF_cjs.l].selectedFields:void 0:void 0;i=i(new Proxy(this.config.table[chunkVRZC4TTF_cjs.t.Symbol.Columns],new chunkGNOSG3PK_cjs.a({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),r&&new Proxy(r,new chunkGNOSG3PK_cjs.a({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));}return this.config.joins.push({on:i,table:t,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=e[0](new Proxy(this.config.table[chunkVRZC4TTF_cjs.t.Symbol.Columns],new chunkGNOSG3PK_cjs.a({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];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[chunk7ACHOBWY_cjs.d.Symbol.Columns]){return this.config.returning=chunkVRZC4TTF_cjs.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}};chunkBUNLC3II_cjs.h();var E=class o extends chunkVRZC4TTF_cjs.A{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[chunkVRZC4TTF_cjs.a]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(e,t){return chunkVRZC4TTF_cjs.J`(select count(*) from ${e}${chunkVRZC4TTF_cjs.J.raw(" where ").if(t)}${t})`}static buildCount(e,t){return chunkVRZC4TTF_cjs.J`select count(*) from ${e}${chunkVRZC4TTF_cjs.J.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})}};chunkBUNLC3II_cjs.h();var K=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[chunkVRZC4TTF_cjs.a]="SQLiteAsyncRelationalQueryBuilder";findMany(e){return this.mode==="sync"?new D(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many"):new M(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many")}findFirst(e){return this.mode==="sync"?new D(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first"):new M(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}},M=class extends chunkBCEE4NBZ_cjs.i{constructor(e,t,i,s,r,n,f,d,le){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=le;}static[chunkVRZC4TTF_cjs.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=>chunkBCEE4NBZ_cjs.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()}},D=class extends M{static[chunkVRZC4TTF_cjs.a]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}};chunkBUNLC3II_cjs.h();var B=class extends chunkBCEE4NBZ_cjs.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[chunkVRZC4TTF_cjs.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 J=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 K(e,s.fullSchema,this._.schema,this._.tableNamesMap,s.fullSchema[n],f,t,i);this.$cache={invalidate:async n=>{}};}static[chunkVRZC4TTF_cjs.a]="BaseSQLiteDatabase";query;$with=(e,t)=>{let i=this;return {as:r=>(typeof r=="function"&&(r=r(new C(i.dialect))),new Proxy(new chunkVRZC4TTF_cjs.j(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,true),new chunkGNOSG3PK_cjs.a({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};$count(e,t){return new E({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 A(d,t.session,t.dialect,e)}function n(d){return new T(d,t.session,t.dialect,e)}function f(d){return new _(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 A(e,this.session,this.dialect)}$cache;insert(e){return new T(e,this.session,this.dialect)}delete(e){return new _(e,this.session,this.dialect)}run(e){let t=typeof e=="string"?chunkVRZC4TTF_cjs.J.raw(e):e.getSQL();return this.resultKind==="async"?new B(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"?chunkVRZC4TTF_cjs.J.raw(e):e.getSQL();return this.resultKind==="async"?new B(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"?chunkVRZC4TTF_cjs.J.raw(e):e.getSQL();return this.resultKind==="async"?new B(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"?chunkVRZC4TTF_cjs.J.raw(e):e.getSQL();return this.resultKind==="async"?new B(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)}};chunkBUNLC3II_cjs.h();var I=class extends chunkBCEE4NBZ_cjs.i{constructor(e){super(),this.resultCb=e;}static[chunkVRZC4TTF_cjs.a]="ExecuteResultSync";async execute(){return this.resultCb()}sync(){return this.resultCb()}},ne=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[chunkVRZC4TTF_cjs.a]="PreparedQuery";joinsNotNullableMap;async queryWithCache(e,t,i){if(this.cache===void 0||chunkVRZC4TTF_cjs.c(this.cache,chunkGNOSG3PK_cjs.d)||this.queryMetadata===void 0)try{return await i()}catch(s){throw new chunkBCEE4NBZ_cjs.k(e,t,s)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await i()}catch(s){throw new chunkBCEE4NBZ_cjs.k(e,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 chunkBCEE4NBZ_cjs.k(e,t,s)}if(!this.cacheConfig)try{return await i()}catch(s){throw new chunkBCEE4NBZ_cjs.k(e,t,s)}if(this.queryMetadata.type==="select"){let s=await this.cache.get(this.cacheConfig.tag??await chunkGNOSG3PK_cjs.e(e,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 chunkBCEE4NBZ_cjs.k(e,t,n)}return await this.cache.put(this.cacheConfig.tag??await chunkGNOSG3PK_cjs.e(e,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 chunkBCEE4NBZ_cjs.k(e,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 I(()=>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)}}},oe=class{constructor(e){this.dialect=e;}static[chunkVRZC4TTF_cjs.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 chunkBCEE4NBZ_cjs.j({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")}},ae=class extends J{constructor(e,t,i,s,r=0){super(e,t,i,s),this.schema=s,this.nestedIndex=r;}static[chunkVRZC4TTF_cjs.a]="SQLiteTransaction";rollback(){throw new chunkBCEE4NBZ_cjs.l}};exports.a=J;exports.b=ne;exports.c=oe;exports.d=ae;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {createRequire}from'module';import {g as g$1}from'./chunk-C2PXMVR5.js';import {timingSafeEqual}from'crypto';createRequire(import.meta.url);
|
|
2
|
+
g$1();async function p(e,r){return typeof e=="boolean"?e:typeof e=="function"?await e(r):true}function h(...e){let r={};for(let t of e)t&&typeof t=="object"&&Object.assign(r,t);return r}function x(e,r){return p(e,r).then(t=>{if(t!==true)return t===false?{_id:{$eq:null}}:t})}g$1();var u="api_keys";function g(e){return e.substring(0,8)}function y(e,r){if(e.length!==r.length)return false;try{return timingSafeEqual(Buffer.from(e),Buffer.from(r))}catch{return false}}async function P(e,r,t){if(!e||typeof e!="string")return {valid:false,error:"No API key provided"};if(!e.startsWith("kyro_"))return {valid:false,error:"Invalid API key format"};let l=g(e);try{let s=await r.find({collection:u,where:{keyPrefix:{equals:l}},limit:100,page:1});if(!s.docs||s.docs.length===0)return {valid:!1,error:"Invalid API key"};let n=null;for(let i of s.docs){let c=i;if(y(c.key,e)){n=c;break}}if(!n)return {valid:!1,error:"Invalid API key"};if(n.expiresAt&&new Date(n.expiresAt)<new Date)return {valid:!1,error:"API key has expired"};try{await r.update({collection:u,id:n.id,data:{lastUsedAt:new Date().toISOString()}});}catch{}let o={id:n.userId,role:n.role||"author",tenantId:n.tenantId};if(t){let i=await t(n.userId);i&&Object.assign(o,i);}return {valid:!0,userId:n.userId,user:o,permissions:n.permissions||[],apiKeyId:n.id,tenantId:o.tenantId,role:o.role}}catch(s){return console.error("[ApiKey] Validation error:",s),{valid:false,error:"Failed to validate API key"}}}function K(e){let r=e.headers.get("Authorization");if(r){if(r.startsWith("ApiKey "))return r.slice(7).trim();if(r.startsWith("Bearer "))return null}let t=e.headers.get("X-API-Key");return t?t.trim():null}function k(e){return !e.valid||!e.userId?null:{userId:e.userId,user:e.user||{},permissions:e.permissions||[],apiKeyId:e.apiKeyId||"",tenantId:e.tenantId,role:e.role}}function v(e,r){if(e.length===0)return false;if(e.includes("*")||e.includes(r))return true;let[t,l]=r.split(":");return !!e.includes(`${t}:*`)}function b(){let e="abcdefghijklmnopqrstuvwxyz0123456789",r="";for(let t=0;t<32;t++)r+=e[Math.floor(Math.random()*e.length)];return `kyro_${r}`}function R(e){return e.substring(0,8)}export{p as a,h as b,x as c,u as d,P as e,K as f,k as g,v as h,b as i,R as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkBAVN7VDR_cjs=require('./chunk-BAVN7VDR.cjs'),chunkVRZC4TTF_cjs=require('./chunk-VRZC4TTF.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();var h=chunkVRZC4TTF_cjs.ra("media",{id:chunkVRZC4TTF_cjs.oa("id").primaryKey().defaultRandom(),filename:chunkVRZC4TTF_cjs.pa("filename",{length:255}).notNull().unique(),title:chunkVRZC4TTF_cjs.pa("title",{length:255}),originalName:chunkVRZC4TTF_cjs.pa("original_name",{length:255}).notNull(),mimeType:chunkVRZC4TTF_cjs.pa("mime_type",{length:100}).notNull(),fileSize:chunkVRZC4TTF_cjs.ca("file_size").notNull(),width:chunkVRZC4TTF_cjs.ca("width"),height:chunkVRZC4TTF_cjs.ca("height"),url:chunkVRZC4TTF_cjs.ia("url").notNull().unique(),thumbnailUrl:chunkVRZC4TTF_cjs.ia("thumbnail_url"),folder:chunkVRZC4TTF_cjs.pa("folder",{length:255}),provider:chunkVRZC4TTF_cjs.pa("provider",{length:50}).notNull(),alt:chunkVRZC4TTF_cjs.ia("alt"),caption:chunkVRZC4TTF_cjs.ia("caption"),type:chunkVRZC4TTF_cjs.pa("type",{length:50}).notNull().default("other"),status:chunkVRZC4TTF_cjs.pa("status",{length:20}).notNull().default("active"),metadata:chunkVRZC4TTF_cjs.fa("metadata").$type(),createdAt:chunkVRZC4TTF_cjs.ma("created_at").defaultNow().notNull(),updatedAt:chunkVRZC4TTF_cjs.ma("updated_at").defaultNow().notNull()},t=>[chunkBAVN7VDR_cjs.a("media_folder_idx").on(t.folder),chunkBAVN7VDR_cjs.a("media_provider_idx").on(t.provider),chunkBAVN7VDR_cjs.a("media_filename_idx").on(t.filename)]),f=chunkVRZC4TTF_cjs.ra("media_folders",{path:chunkVRZC4TTF_cjs.pa("path",{length:500}).primaryKey(),name:chunkVRZC4TTF_cjs.pa("name",{length:255}).notNull(),parentPath:chunkVRZC4TTF_cjs.pa("parent_path",{length:500}),createdAt:chunkVRZC4TTF_cjs.ma("created_at").defaultNow().notNull()},t=>[chunkBAVN7VDR_cjs.a("media_folders_parent_idx").on(t.parentPath)]);exports.a=h;exports.b=f;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var i={name:"@aws-sdk/nested-clients",version:"3.997.33",description:"Nested clients for AWS SDK packages.",homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients",license:"Apache-2.0",author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/sdk-for-javascript/"},repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"packages/nested-clients"},files:["./cognito-identity.d.ts","./cognito-identity.js","./signin.d.ts","./signin.js","./sso-oidc.d.ts","./sso-oidc.js","./sso.d.ts","./sso.js","./sts.d.ts","./sts.js","dist-*/**"],sideEffects:false,main:"./dist-cjs/index.js",module:"./dist-es/index.js",browser:{"./dist-es/submodules/cognito-identity/runtimeConfig":"./dist-es/submodules/cognito-identity/runtimeConfig.browser","./dist-es/submodules/signin/runtimeConfig":"./dist-es/submodules/signin/runtimeConfig.browser","./dist-es/submodules/sso-oidc/runtimeConfig":"./dist-es/submodules/sso-oidc/runtimeConfig.browser","./dist-es/submodules/sso/runtimeConfig":"./dist-es/submodules/sso/runtimeConfig.browser","./dist-es/submodules/sts/runtimeConfig":"./dist-es/submodules/sts/runtimeConfig.browser"},types:"./dist-types/index.d.ts",typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"],"*":["dist-types/ts3.4/submodules/*/index.d.ts"]}},"react-native":{},exports:{"./package.json":"./package.json","./sso-oidc":{types:"./dist-types/submodules/sso-oidc/index.d.ts",module:"./dist-es/submodules/sso-oidc/index.js",node:"./dist-cjs/submodules/sso-oidc/index.js",import:"./dist-es/submodules/sso-oidc/index.js",require:"./dist-cjs/submodules/sso-oidc/index.js"},"./sts":{types:"./dist-types/submodules/sts/index.d.ts",module:"./dist-es/submodules/sts/index.js",node:"./dist-cjs/submodules/sts/index.js",import:"./dist-es/submodules/sts/index.js",require:"./dist-cjs/submodules/sts/index.js"},"./signin":{types:"./dist-types/submodules/signin/index.d.ts",module:"./dist-es/submodules/signin/index.js",node:"./dist-cjs/submodules/signin/index.js",import:"./dist-es/submodules/signin/index.js",require:"./dist-cjs/submodules/signin/index.js"},"./cognito-identity":{types:"./dist-types/submodules/cognito-identity/index.d.ts",module:"./dist-es/submodules/cognito-identity/index.js",node:"./dist-cjs/submodules/cognito-identity/index.js",import:"./dist-es/submodules/cognito-identity/index.js",require:"./dist-cjs/submodules/cognito-identity/index.js"},"./sso":{types:"./dist-types/submodules/sso/index.d.ts",module:"./dist-es/submodules/sso/index.js",node:"./dist-cjs/submodules/sso/index.js",import:"./dist-es/submodules/sso/index.js",require:"./dist-cjs/submodules/sso/index.js"}},scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline","build:es":"premove dist-es && tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"premove dist-types && tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types",lint:"node ../../scripts/validation/submodules-linter.js",prebuild:"yarn lint",test:"yarn g:vitest run","test:watch":"yarn g:vitest watch"},dependencies:{"@aws-sdk/core":"^3.975.3","@aws-sdk/signature-v4-multi-region":"^3.996.41","@aws-sdk/types":"^3.974.2","@smithy/core":"^3.29.4","@smithy/fetch-http-handler":"^5.6.6","@smithy/node-http-handler":"^4.9.6","@smithy/types":"^4.16.1",tslib:"^2.6.2"},devDependencies:{concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~5.8.3"},engines:{node:">=20.0.0"}};
|
|
2
|
+
exports.a=i;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {createRequire}from'module';import {a,c,b,d}from'./chunk-MCZ3YZ2L.js';import {a as a$1}from'./chunk-CGPAS4U5.js';import {a as a$2}from'./chunk-BLH2MRK4.js';import {g}from'./chunk-C2PXMVR5.js';import {randomBytes}from'crypto';createRequire(import.meta.url);
|
|
2
|
+
g();g();var w=class extends a{dialect="mongodb";client;db;database;connectionString;constructor(o){if(super(),o.connectionString){this.connectionString=o.connectionString;try{let e=new URL(o.connectionString);this.database=e.pathname.replace(/^\//,"")||"kyro_cms";}catch{this.database="kyro_cms";}}else this.client=o.client,this.database=o.database;}async connect(){if(this.connectionString&&!this.client){let o;try{o=(await import('./lib-IYW32OER.js')).MongoClient;}catch{a$1(["mongodb"]),o=(await import('./lib-IYW32OER.js')).MongoClient;}this.client=new o(this.connectionString),await this.client.connect();}this.db=this.client.db(this.database),this.connected=true;}async disconnect(){this.client&&(await this.client.close(),this.connected=false);}getMongoCollection(o){if(!this.db)throw new Error("MongoDB not connected");return this.db.collection(o)}async find(o){let{collection:e,where:n={},sort:s,limit:t=10,page:i=1,tenantId:r,select:a,draft:d$1}=o,l=this.getCollectionConfig(e),f=this.getMongoCollection(e),g={...n};this.tenantContext&&l.tenantScoped&&(g=c({where:g},e,this.tenantContext,b).where||{});let u=this.buildFilter(g,l.tenantScoped?r:void 0),c$1=l.fields.find(p=>p.name==="status"),h=c$1?.type==="select"&&Array.isArray(c$1.options)&&c$1.options.some(p=>p.value==="published");!d$1&&h&&(u.status="published");let y=this.parseSort(s),O={[y.field]:y.direction==="asc"?1:-1},$=(i-1)*t,[x,M]=await Promise.all([f.find(u).sort(O).skip($).limit(t).project(this.buildProjection(a)).toArray(),f.countDocuments(u)]),C=x.map(p=>this.processResult(p,l));return this.tenantContext&&!this.tenantContext.isSuperAdmin&&(C=C.filter(p=>d(p,e,this.tenantContext,b))),d$1&&(C=await Promise.all(C.map(async p=>{let m=await this.getMongoCollection(`${e}_versions`).findOne({document_id:p.id},{sort:{createdAt:-1}});if(m){let P=typeof m.data=="string"?JSON.parse(m.data):m.data&&typeof m.data=="object"?m.data:{};return {...p,...P,status:p.status}}return p}))),{docs:C,...this.calculatePagination(i,t,M)}}async findByID(o){let{collection:e,id:n,tenantId:s,draft:t}=o,i=this.getCollectionConfig(e),r=this.getMongoCollection(e);if(this.tenantContext&&i.tenantScoped){let u={_id:n,tenantId:this.tenantContext.tenantId};if(!d(u,e,this.tenantContext,b))return null}let a={_id:n};s&&i.tenantScoped&&(a.tenantId=s);let d$1=i.fields.find(u=>u.name==="status"),l=d$1?.type==="select"&&Array.isArray(d$1.options)&&d$1.options.some(u=>u.value==="published");!t&&l&&(a.status="published");let f=await r.findOne(a);if(!f)return null;let g=this.processResult(f,i);if(t){let c=await this.getMongoCollection(`${e}_versions`).findOne({document_id:g.id},{sort:{createdAt:-1}});if(c){let h=typeof c.data=="string"?JSON.parse(c.data):c.data&&typeof c.data=="object"?c.data:{};g={...g,...h,status:g.status};}}return g}async create(o){let{collection:e,data:n,tenantId:s}=o,t=this.getCollectionConfig(e),i=this.getMongoCollection(e),r=this.prepareData(n,t),a=r.id||this.generateId();delete r.id;let d={...r,_id:a};return s&&t.tenantScoped&&(d.tenantId=s),await i.insertOne(d),this.processResult(d,t)}async update(o){let{collection:e,id:n,data:s,tenantId:t}=o,i=this.getCollectionConfig(e),r=this.getMongoCollection(e),a={_id:n};t&&i.tenantScoped&&(a.tenantId=t);let d=this.prepareData(s,i),l=await r.findOneAndUpdate(a,{$set:d},{returnDocument:"after"});if(!l)throw new Error(`Document not found: ${e}/${n}`);return this.processResult(l,i)}async delete(o){let{collection:e,id:n,tenantId:s}=o,t=this.getCollectionConfig(e),i=this.getMongoCollection(e),r={_id:n};s&&t.tenantScoped&&(r.tenantId=s);let a=await i.findOneAndDelete(r);if(!a)throw new Error(`Document not found: ${e}/${n}`);return this.processResult(a,t)}async count(o){let{collection:e,where:n={},tenantId:s}=o,t=this.getCollectionConfig(e),i=this.getMongoCollection(e),r=this.buildFilter(n,t.tenantScoped?s:void 0);return i.countDocuments(r)}async findOne(o){let{collection:e,where:n={},tenantId:s,draft:t}=o,i=this.getCollectionConfig(e),r=this.getMongoCollection(e),a=this.buildFilter(n,i.tenantScoped?s:void 0),d=i.fields.find(u=>u.name==="status"),l=d?.type==="select"&&Array.isArray(d.options)&&d.options.some(u=>u.value==="published");!t&&l&&(a.status="published");let f=await r.findOne(a);if(!f)return null;let g=this.processResult(f,i);if(t){let c=await this.getMongoCollection(`${e}_versions`).findOne({document_id:g.id},{sort:{createdAt:-1}});if(c){let h=typeof c.data=="string"?JSON.parse(c.data):c.data&&typeof c.data=="object"?c.data:{};g={...g,...h,status:g.status};}}return g}async findVersions(o){let{collection:e,documentId:n,sort:s,limit:t=10,page:i=1,tenantId:r}=o,a=this.getCollectionConfig(e),d=this.getMongoCollection(`${e}_versions`),l={document_id:n,autosave:{$ne:true}};r&&a.tenantScoped&&(l.tenant_id=r);let f=(i-1)*t,g=this.parseSort(s),u={[g.field]:g.direction==="asc"?1:-1},[c,h]=await Promise.all([d.find(l).sort(u).skip(f).limit(t).toArray(),d.countDocuments(l)]);return {docs:c.map(y=>this.processResult(y,{})),...this.calculatePagination(i,t,h)}}async findVersionByID(o){let{collection:e,versionId:n,tenantId:s}=o,t=this.getCollectionConfig(e),i=this.getMongoCollection(`${e}_versions`),r={_id:n};s&&t.tenantScoped&&(r.tenant_id=s);let a=await i.findOne(r);return a?this.processResult(a,{}):null}async createVersion(o){let{collection:e,documentId:n,data:s,status:t,createdBy:i,changeDescription:r,tenantId:a,autosave:d}=o,l=this.getCollectionConfig(e),f=this.getMongoCollection(`${e}_versions`);if(d){let c={document_id:n,collection_slug:e,autosave:true};a&&l.tenantScoped&&(c.tenant_id=a);let h=await f.findOne(c);if(h){let y=new Date().toISOString();return await f.updateOne({_id:h._id},{$set:{data:s,status:t,updatedAt:y}}),this.processResult({...h,data:s,status:t,updatedAt:y},{})}}let g=new Date().toISOString(),u={_id:this.generateId(),document_id:n,collection_slug:e,data:s,status:t,autosave:d===true,created_by:i,change_description:r,createdAt:g,updatedAt:g};if(a&&l.tenantScoped&&(u.tenant_id=a),await f.insertOne(u),!d){let c=this.getCollectionConfig(e);c.versions?.maxPerDoc&&await this.deleteVersions({collection:e,documentId:n,keepLatest:c.versions.maxPerDoc,tenantId:a});}return this.processResult(u,{})}async updateLatestVersion(o){return this.createVersion({...o,autosave:true})}async deleteVersions(o){let{collection:e,documentId:n,keepLatest:s,tenantId:t}=o,i=this.getCollectionConfig(e),r=this.getMongoCollection(`${e}_versions`);if(s){let a={document_id:n,autosave:{$ne:true}};t&&i.tenantScoped&&(a.tenant_id=t);let l=(await r.find(a).sort({createdAt:-1}).limit(s).project({_id:1}).toArray()).map(f=>f._id);l.length>0&&await r.deleteMany({document_id:n,autosave:{$ne:true},_id:{$nin:l},...t&&i.tenantScoped?{tenant_id:t}:{}});}else {let a={document_id:n};t&&i.tenantScoped&&(a.tenant_id=t),await r.deleteMany(a);}}async migrate(){for(let o of this.collections.values()){let e=this.getMongoCollection(o.slug);await e.createIndex({_id:1}),o.tenantScoped&&await e.createIndex({tenantId:1}),o.timestamps&&await e.createIndex({createdAt:-1});for(let n of o.fields)n.unique&&n.name&&await e.createIndex({[n.name]:1},{unique:true}),n.indexed&&n.name&&await e.createIndex({[n.name]:1});}}getCollectionConfig(o){if(o.startsWith("_globals_")){let n=o.replace("_globals_",""),s=this.globals.get(n);if(!s)throw new Error(`Global "${n}" not found`);return s}let e=this.collections.get(o);if(!e)throw new Error(`Collection "${o}" not found`);return e}buildFilter(o={},e){let n={};e&&(n.tenantId=e);for(let[s,t]of Object.entries(o))if(s==="AND"&&Array.isArray(t)){let i=t.map(r=>this.buildFilter(r));Object.assign(n,...i);}else if(s==="OR"&&Array.isArray(t))n.$or=t.map(i=>this.buildFilter(i));else if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let i={};if(t.equals!==void 0){n[s==="id"?"_id":s]=t.equals;continue}t.not_equals!==void 0&&(i.$ne=t.not_equals),t.in!==void 0&&(i.$in=t.in),t.not_in!==void 0&&(i.$nin=t.not_in),t.greater_than!==void 0&&(i.$gt=t.greater_than),t.greater_than_equal!==void 0&&(i.$gte=t.greater_than_equal),t.less_than!==void 0&&(i.$lt=t.less_than),t.less_than_equal!==void 0&&(i.$lte=t.less_than_equal),t.like!==void 0&&(i.$regex=new RegExp(t.like.replace(/%/g,".*"),"i")),t.not_like!==void 0&&(i.$not=new RegExp(t.not_like.replace(/%/g,".*"),"i")),t.contains!==void 0&&(i.$regex=new RegExp(`.*${t.contains}.*`,"i")),t.exists!==void 0&&(i.$exists=t.exists),Object.keys(i).length>0&&(n[s==="id"?"_id":s]=i);}else n[s==="id"?"_id":s]=t;return n}buildProjection(o){if(!o||o.length===0)return;let e={_id:1};for(let n of o)e[n]=1;return e}processResult(o,e){if(!o)return null;let n={...o};for(let s of Object.keys(n))/^\d+$/.test(s)&&delete n[s];return o._id&&(n.id=o._id,delete n._id),delete n.__v,n.createdAt&&(n.createdAt=new Date(n.createdAt).toISOString()),n.updatedAt&&(n.updatedAt=new Date(n.updatedAt).toISOString()),a$2(n)}generateId(){let o=Date.now().toString(16).padStart(12,"0"),e=randomBytes(6).toString("hex");return o+e}};function k(v){return new w(v)}
|
|
3
|
+
export{w as a,k as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkLQ3YZTPU_cjs=require('./chunk-LQ3YZTPU.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),H=require('zlib'),stream=require('stream'),crypto=require('crypto');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var H__namespace=/*#__PURE__*/_interopNamespace(H);chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var C=new Uint32Array(256);for(let n=0;n<256;++n){let e=n;for(let t=0;t<8;++t)e=e&1?3988292384^e>>>1:e>>>1;C[n]=e>>>0;}var L=4294967295,g=class{digestLength=4;checksum=L;update(e){for(let t=0;t<e.length;++t)this.checksum=this.checksum>>>8^C[(this.checksum^e[t])&255];}digestSync(){return (this.checksum^L)>>>0}async digest(){let e=this.digestSync(),t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,false),t}reset(){this.checksum=L;}};var M=typeof H__namespace.crc32=="function"?H__namespace.crc32:void 0,v=M?K(M):g;function K(n){return class{digestLength=4;value=0;update(t){this.value=n(t,this.value);}digestSync(){return this.value>>>0}async digest(){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,this.digestSync(),false),t}reset(){this.value=0;}}}chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var w=class extends stream.Writable{hash;constructor(e,t){super(t),this.hash=e;}_write(e,t,r){try{this.hash.update(chunkLQ3YZTPU_cjs.v(e));}catch(s){return r(s)}r();}};chunkBUNLC3II_cjs.h();var J=(n,e)=>{if(e.readableFlowing!==null)throw new Error("Unable to calculate hash for flowing readable stream");let t=new n,r=new w(t);return e.pipe(r),new Promise((s,f)=>{e.on("error",h=>{r.end(),f(h);}),r.on("error",f),r.on("finish",()=>{t.digest().then(s).catch(f);});})};chunkBUNLC3II_cjs.h();var A=class{digestLength=16;state=Uint32Array.from(E);writeBuffer=new DataView(new ArrayBuffer(64));bufferLength=0;bytesHashed=0;update(e){let t=chunkLQ3YZTPU_cjs.v(e),r=0,s=t.byteLength;for(this.bytesHashed+=s;s>0;)this.writeBuffer.setUint8(this.bufferLength++,t[r++]),--s,this.bufferLength===64&&(N(this.state,this.writeBuffer),this.bufferLength=0);}async digest(){let e=Uint32Array.from(this.state),t=new DataView(this.writeBuffer.buffer.slice(0)),r=this.bufferLength,s=this.bytesHashed*8;if(t.setUint8(r++,128),this.bufferLength%64>=56){for(let i=r;i<64;++i)t.setUint8(i,0);N(e,t),r=0;}for(let i=r;i<56;++i)t.setUint8(i,0);t.setUint32(56,s>>>0,true),t.setUint32(60,Math.floor(s/2**32),true),N(e,t);let f=new Uint8Array(16),h=new DataView(f.buffer);for(let i=0;i<4;++i)h.setUint32(i*4,e[i],true);return f}reset(){this.state.set(E),this.writeBuffer=new DataView(new ArrayBuffer(64)),this.bufferLength=0,this.bytesHashed=0;}},E=[1732584193,4023233417,2562383102,271733878],l=4294967295,_=Uint8Array.of(7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21),R=Array.from({length:64},(n,e)=>Math.abs(Math.sin(e+1))*2**32>>>0);function N(n,e){let t=n[0],r=n[1],s=n[2],f=n[3];for(let h=0;h<64;++h){let i,c;h<16?(i=r&s|~r&f,c=h):h<32?(i=f&r|s&~f,c=(5*h+1)%16):h<48?(i=r^s^f,c=(3*h+5)%16):(i=s^(r|~f),c=7*h%16);let y=e.getUint32(c*4,true),m=f;f=s,s=r;let p=_[(h>>4)*4+(h&3)],a=(t+i&l)+(y+R[h]&l)&l;r=r+((a<<p|a>>>32-p)>>>0)&l,t=m;}n[0]=n[0]+t&l,n[1]=n[1]+r&l,n[2]=n[2]+s&l,n[3]=n[3]+f&l;}chunkBUNLC3II_cjs.h();var F=(()=>{try{return crypto.createHash("md5"),!0}catch{return false}})(),I=F?P():A;function P(){return class{digestLength=16;hash=crypto.createHash("md5");update(e){this.hash.update(chunkLQ3YZTPU_cjs.v(e));}async digest(){let e=this.hash.copy().digest();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=crypto.createHash("md5");}}}chunkBUNLC3II_cjs.h();var u=64,D=32,X=2**53-1,U=class n{digestLength=D;state=Int32Array.from(V);w;buffer=new Uint8Array(64);bufferLength=0;bytesHashed=0;finished=false;inner;outer;constructor(e){if(e){let t=n.normalizeKey(e);this.inner=new n,this.outer=new n;let{inner:r,outer:s}=this,f=new Uint8Array(u*2);for(let h=0;h<u;++h)f[h]=54^t[h],f[h+u]=92^t[h];r.update(f.subarray(0,u)),s.update(f.subarray(u));}}update(e){if(this.finished)throw new Error("Attempted to update an already finished HMAC.");if(this.inner){this.inner.update(e);return}let t=chunkLQ3YZTPU_cjs.v(e),r=0,{byteLength:s}=t;if(this.bytesHashed+=s,this.bytesHashed*8>X)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;s>0;)this.buffer[this.bufferLength++]=t[r++],s--,this.bufferLength===u&&(this.hashBuffer(),this.bufferLength=0);}async digest(){let{inner:e,outer:t}=this;if(e&&t){if(this.finished)throw new Error("Attempted to digest an already finished HMAC.");this.finished=true;let r=e.digestSync();return t.update(r),t.digestSync()}return this.digestSync()}reset(){this.state=Int32Array.from(V),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0;}digestSync(){let e=this.state.slice(),t=this.buffer.slice(),r=this.bufferLength,s=this.bytesHashed*8,f=new DataView(t.buffer,t.byteOffset,t.byteLength);if(f.setUint8(r++,128),(r-1)%u>=u-8){for(let i=r;i<u;++i)f.setUint8(i,0);this.hashBufferWith(e,t),r=0;}for(let i=r;i<u-8;++i)f.setUint8(i,0);f.setUint32(u-8,Math.floor(s/4294967296),false),f.setUint32(u-4,s,false),this.hashBufferWith(e,t);let h=new Uint8Array(D);for(let i=0;i<8;++i)h[i*4]=e[i]>>>24&255,h[i*4+1]=e[i]>>>16&255,h[i*4+2]=e[i]>>>8&255,h[i*4+3]=e[i]>>>0&255;return h}static normalizeKey(e){let t=chunkLQ3YZTPU_cjs.v(e);if(t.byteLength>u){let r=new n;r.update(t);let s=r.digestSync(),f=new Uint8Array(u);return f.set(s),f}if(t.byteLength<u){let r=new Uint8Array(u);return r.set(t),r}return t}hashBuffer(){this.hashBufferWith(this.state,this.buffer);}hashBufferWith(e,t){let r=this.w??=new Int32Array(64),s=e[0],f=e[1],h=e[2],i=e[3],c=e[4],y=e[5],m=e[6],p=e[7];for(let a=0;a<u;++a){if(a<16)r[a]=(t[a*4]&255)<<24|(t[a*4+1]&255)<<16|(t[a*4+2]&255)<<8|t[a*4+3]&255;else {let d=r[a-2],O=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10;d=r[a-15];let W=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;r[a]=(O+r[a-7]|0)+(W+r[a-16]|0);}let B=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&y^~c&m)|0)+(p+(q[a]+r[a]|0)|0)|0,z=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&f^s&h^f&h)|0;p=m,m=y,y=c,c=i+B|0,i=h,h=f,f=s,s=B+z|0;}e[0]+=s,e[1]+=f,e[2]+=h,e[3]+=i,e[4]+=c,e[5]+=y,e[6]+=m,e[7]+=p;}},V=new Int32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),q=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);chunkBUNLC3II_cjs.h();var Y=(()=>{try{return crypto.createHash("sha256"),!0}catch{return false}})(),T=Y?Z():U;function Z(){return class{digestLength=32;secret;hash;isHmac;finished=false;constructor(e){this.secret=e,this.isHmac=!!e,this.hash=this.createHash();}update(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");this.hash.update(e);}async digest(){let e;return this.isHmac?(this.finished=true,e=this.hash.digest()):e=this.hash.copy().digest(),new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=this.createHash(),this.finished=false;}createHash(){return this.secret?crypto.createHmac("sha256",$(this.secret)):crypto.createHash("sha256")}}}function $(n){return typeof n=="string"?n:ArrayBuffer.isView(n)?Buffer.from(n.buffer,n.byteOffset,n.byteLength):Buffer.from(n)}exports.a=J;exports.b=I;exports.c=v;exports.d=T;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';var chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),child_process=require('child_process'),fs=require('fs'),path=require('path');chunkBUNLC3II_cjs.h();function s(){let n=process.cwd();return fs.existsSync(path.join(n,"pnpm-lock.yaml"))?"pnpm":fs.existsSync(path.join(n,"yarn.lock"))?"yarn":fs.existsSync(path.join(n,"bun.lockb"))||fs.existsSync(path.join(n,"bun.lock"))?"bun":"npm"}function u(n){let o=s();console.log(`
|
|
2
|
+
\u{1F4E6} [Kyro CMS] Auto-installing missing database drivers: ${n.join(", ")}...`);try{let i=o==="npm"?"npm install":`${o} add`;child_process.execSync(`${i} ${n.join(" ")}`,{stdio:"inherit"}),console.log(`\u2705 [Kyro CMS] Successfully installed drivers!
|
|
3
|
+
`);}catch(i){throw console.error(`\u274C [Kyro CMS] Failed to auto-install drivers. Please run manually: ${o==="npm"?"npm install":`${o} add`} ${n.join(" ")}`),i}}exports.a=u;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';var chunkGNEVCEJU_cjs=require('./chunk-GNEVCEJU.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),w=require('https'),stream=require('stream');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var w__default=/*#__PURE__*/_interopDefault(w);chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();function S(o){let e=o&&typeof o=="object"&&"reason"in o?o.reason:void 0;if(e){if(e instanceof Error){let n=new Error("Request aborted");return n.name="AbortError",n.cause=e,n}let r=new Error(String(e));return r.name="AbortError",r}let t=new Error("Request aborted");return t.name="AbortError",t}chunkBUNLC3II_cjs.h();var U=["ECONNRESET","EPIPE","ETIMEDOUT"];chunkBUNLC3II_cjs.h();var B=o=>{let e={};for(let t in o){let r=o[t];e[t]=Array.isArray(r)?r.join(","):r;}return e};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var a={setTimeout:(o,e)=>setTimeout(o,e),clearTimeout:o=>clearTimeout(o)};var $=1e3,j=(o,e,t=0)=>{if(!t)return -1;let r=n=>{let c=a.setTimeout(()=>{o.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${t} ms.`),{name:"TimeoutError"}));},t-n),i=u=>{u?.connecting?u.on("connect",()=>{a.clearTimeout(c);}):a.clearTimeout(c);};o.socket?i(o.socket):o.on("socket",i);};return t<2e3?(r(0),0):a.setTimeout(r.bind(null,$),$)};chunkBUNLC3II_cjs.h();var W=(o,e,t=0,r,n)=>t?a.setTimeout(()=>{let c=`@smithy/node-http-handler - [${r?"ERROR":"WARN"}] a request has exceeded the configured ${t} ms requestTimeout.`;if(r){let i=Object.assign(new Error(c),{name:"TimeoutError",code:"ETIMEDOUT"});o.destroy(i),e(i);}else c+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",n?.warn?.(c);},t):-1;chunkBUNLC3II_cjs.h();var G=3e3,F=(o,{keepAlive:e,keepAliveMsecs:t},r=G)=>{if(e!==true)return -1;let n=()=>{o.socket?o.socket.setKeepAlive(e,t||0):o.on("socket",c=>{c.setKeepAlive(e,t||0);});};return r===0?(n(),0):a.setTimeout(n,r)};chunkBUNLC3II_cjs.h();var K=3e3,M=(o,e,t=0)=>{let r=n=>{let c=t-n,i=()=>{o.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${t} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}));};o.socket?(o.socket.setTimeout(c,i),o.on("close",()=>o.socket?.removeListener("timeout",i))):o.setTimeout(c,i);};return 0<t&&t<6e3?(r(0),0):a.setTimeout(r.bind(null,t===0?0:K),K)};chunkBUNLC3II_cjs.h();var V=6e3;async function Q(o,e,t=V,r=false){let n=e.headers,c=n?n.Expect||n.expect:void 0,i=-1,u=true;!r&&c==="100-continue"&&(u=await Promise.race([new Promise(m=>{i=Number(a.setTimeout(()=>m(true),Math.max(V,t)));}),new Promise(m=>{o.on("continue",()=>{a.clearTimeout(i),m(true);}),o.on("response",()=>{a.clearTimeout(i),m(false);}),o.on("error",()=>{a.clearTimeout(i),m(false);});})])),u&&Y(o,e.body);}function Y(o,e){if(e instanceof stream.Readable){e.pipe(o);return}if(e){let t=Buffer.isBuffer(e);if(t||typeof e=="string"){t&&e.byteLength===0?o.end():o.end(e);return}let n=e;if(typeof n=="object"&&n.buffer&&typeof n.byteOffset=="number"&&typeof n.byteLength=="number"){o.end(Buffer.from(n.buffer,n.byteOffset,n.byteLength));return}o.end(Buffer.from(e));return}o.end();}var b,J,I=class o{config;configProvider;socketWarningTimestamp=0;externalAgent=false;metadata={handlerProtocol:"http/1.1"};static create(e){return typeof e?.handle=="function"?e:new o(e)}static checkSocketUsage(e,t,r=console){let{sockets:n,requests:c,maxSockets:i}=e;if(typeof i!="number"||i===1/0||Date.now()-15e3<t)return t;if(n&&c)for(let m in n){let g=n[m]?.length??0,l=c[m]?.length??0;if(g>=i&&l>=2*i)return r?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${g} and ${l} additional requests are enqueued.
|
|
2
|
+
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
3
|
+
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return t}constructor(e){this.configProvider=new Promise((t,r)=>{typeof e=="function"?e().then(n=>{t(this.resolveDefaultConfig(n));}).catch(r):t(this.resolveDefaultConfig(e));});}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy();}async handle(e,{abortSignal:t,requestTimeout:r}={}){this.config||(this.config=await this.configProvider);let n=this.config,c=e.protocol==="https:";return !c&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((i,u)=>{let m,g=-1,l=-1,E=-1,A=-1,x=-1,y=()=>{a.clearTimeout(g),a.clearTimeout(l),a.clearTimeout(E),a.clearTimeout(A),a.clearTimeout(x);},q=async f=>{await m,y(),i(f);},T=async f=>{await m,y(),u(f);};if(t?.aborted){let f=S(t);T(f);return}let R=e.headers,z=R?(R.Expect??R.expect)==="100-continue":false,_=c?n.httpsAgent:n.httpAgent;z&&!this.externalAgent&&(_=new(c?w__default.default.Agent:b)({keepAlive:false,maxSockets:1/0})),g=a.setTimeout(()=>{this.socketWarningTimestamp=o.checkSocketUsage(_,this.socketWarningTimestamp,n.logger);},n.socketAcquisitionWarningTimeout??(n.requestTimeout??2e3)+(n.connectionTimeout??1e3));let D=e.query?chunkGNEVCEJU_cjs.V(e.query):"",N;if(e.username!=null||e.password!=null){let f=e.username??"",p=e.password??"";N=`${f}:${p}`;}let O=e.path;D&&(O+=`?${D}`),e.fragment&&(O+=`#${e.fragment}`);let k=e.hostname??"";k[0]==="["&&k.endsWith("]")?k=e.hostname.slice(1,-1):k=e.hostname;let P={headers:e.headers,host:k,method:e.method,path:O,port:e.port,agent:_,auth:N},h=(c?w__default.default.request:J)(P,f=>{let p=new chunkGNEVCEJU_cjs.f({statusCode:f.statusCode||-1,reason:f.statusMessage,headers:B(f.headers),body:f});q({response:p});});if(h.on("error",f=>{U.includes(f.code)?T(Object.assign(f,{name:"TimeoutError"})):T(f);}),t){let f=()=>{h.destroy();let p=S(t);T(p);};if(typeof t.addEventListener=="function"){let p=t;p.addEventListener("abort",f,{once:true}),h.once("close",()=>p.removeEventListener("abort",f));}else t.onabort=f;}let C=r??n.requestTimeout;l=j(h,T,n.connectionTimeout),E=W(h,T,C,n.throwOnRequestTimeout,n.logger??console),A=M(h,T,n.socketTimeout);let v=P.agent;typeof v=="object"&&"keepAlive"in v&&(x=F(h,{keepAlive:v.keepAlive,keepAliveMsecs:v.keepAliveMsecs})),m=Q(h,e,C,this.externalAgent).catch(f=>(y(),u(f)));})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(r=>({...r,[e]:t}));}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:t,connectionTimeout:r,socketTimeout:n,socketAcquisitionWarningTimeout:c,httpAgent:i,httpsAgent:u,throwOnRequestTimeout:m,logger:g}=e||{},l=true,E=50;return {connectionTimeout:r,requestTimeout:t,socketTimeout:n,socketAcquisitionWarningTimeout:c,throwOnRequestTimeout:m,httpAgentProvider:async()=>{let A=await import('http'),{Agent:x,request:y}=A.default??A;return J=y,b=x,i instanceof b||typeof i?.destroy=="function"?(this.externalAgent=true,i):new b({keepAlive:l,maxSockets:E,...i})},httpsAgent:u instanceof w__default.default.Agent||typeof u?.destroy=="function"?(this.externalAgent=true,u):new w__default.default.Agent({keepAlive:l,maxSockets:E,...u}),logger:g}}};chunkBUNLC3II_cjs.h();exports.a=I;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';var chunkLQ3YZTPU_cjs=require('./chunk-LQ3YZTPU.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),path=require('path'),os=require('os'),promises=require('fs/promises'),crypto=require('crypto');chunkBUNLC3II_cjs.h();exports.b=void 0;(function(r){r.MD5="md5",r.CRC32="crc32",r.CRC32C="crc32c",r.SHA1="sha1",r.SHA256="sha256";})(exports.b||(exports.b={}));chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var te="__smithy_context";chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();exports.a=void 0;(function(r){r.HTTP="http",r.HTTPS="https";})(exports.a||(exports.a={}));chunkBUNLC3II_cjs.h();var C;(function(r){r.PROFILE="profile",r.SSO_SESSION="sso-session",r.SERVICES="services";})(C||(C={}));chunkBUNLC3II_cjs.h();var z=r=>r[te]||(r[te]={});chunkBUNLC3II_cjs.h();var Mt=r=>{if(typeof r=="function")return r;let e=Promise.resolve(r);return ()=>e};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();function Ke(r){let e={};if(r=r.replace(/^\?/,""),r)for(let t of r.split("&")){let[o,s=null]=t.split("=");o=decodeURIComponent(o),s&&(s=decodeURIComponent(s)),o in e?Array.isArray(e[o])?e[o].push(s):e[o]=[e[o],s]:e[o]=s;}return e}var R=r=>{if(typeof r=="string")return R(new URL(r));let{hostname:e,pathname:t,port:o,protocol:s,search:n}=r,a;return n&&(a=Ke(n)),{hostname:e,port:o?parseInt(o):void 0,protocol:s,path:t,query:a}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var b=class r{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment;}static clone(e){let t=new r({...e,headers:{...e.headers}});return t.query&&(t.query=Lt(t.query)),t}static isInstance(e){if(!e)return false;let t=e;return "method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&typeof t.query=="object"&&typeof t.headers=="object"}clone(){return r.clone(this)}};function Lt(r){return Object.keys(r).reduce((e,t)=>{let o=r[t];return {...e,[t]:Array.isArray(o)?[...o]:o}},{})}chunkBUNLC3II_cjs.h();var D=class{statusCode;reason;headers;body;constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body;}static isInstance(e){if(!e)return false;let t=e;return typeof t.statusCode=="number"&&typeof t.headers=="object"}};chunkBUNLC3II_cjs.h();var zt=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),re=(r,e=false)=>{if(!e)return zt.test(r);let t=r.split(".");for(let o of t)if(!re(o))return false;return true};chunkBUNLC3II_cjs.h();function ye(r){return /^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(r)}chunkBUNLC3II_cjs.h();var xe=r=>{if(typeof r=="object"){if("url"in r){let e=R(r.url);if(r.headers){e.headers={};for(let t in r.headers)e.headers[t.toLowerCase()]=r.headers[t].join(", ");}return e}return r}return R(r)};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var oe=(r,e,t,o,s)=>({name:e,namespace:r,traits:t,input:o,output:s});var qe=r=>(e,t)=>async o=>{let{response:s}=await e(o),{operationSchema:n}=z(t),[,a,f,m,h,u]=n??[];try{let p=await r.protocol.deserializeResponse(oe(a,f,m,h,u),{...r,...t},s);return {response:s,output:p}}catch(p){if(Object.defineProperty(p,"$response",{value:s,enumerable:false,writable:false,configurable:false}),!("$metadata"in p)){let S="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{p.message+=`
|
|
2
|
+
`+S;}catch{!t.logger||t.logger?.constructor?.name==="NoOpLogger"?console.warn(S):t.logger?.warn?.(S);}typeof p.$responseBodyText<"u"&&p.$response&&(p.$response.body=p.$responseBodyText);try{if(D.isInstance(s)){let{headers:E={},statusCode:d}=s,l=Object.entries(E);p.$metadata={httpStatusCode:d,requestId:Te(/^x-[\w-]+-request-?id$/,l),extendedRequestId:Te(/^x-[\w-]+-id-2$/,l),cfId:Te(/^x-[\w-]+-cf-id$/,l)};}}catch{}}throw p}},Te=(r,e)=>(e.find(([t])=>t.match(r))||[void 0,void 0])[1];chunkBUNLC3II_cjs.h();var Qe=r=>(e,t)=>async o=>{let{operationSchema:s}=z(t),[,n,a,f,m,h]=s??[],u=t.endpointV2?async()=>xe(t.endpointV2):r.endpoint,p=await r.protocol.serializeRequest(oe(n,a,f,m,h),o.input,{...r,...t,endpoint:u});return e({...o,request:p})};var Xe={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:true},Je={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:true};function Ht(r){return {applyToStack:e=>{e.add(Qe(r),Je),e.add(qe(r),Xe),r.protocol.setSerdeContext(r);}}}chunkBUNLC3II_cjs.h();var H=class r{namespace;schemas;exceptions;static registries=new Map;constructor(e,t=new Map,o=new Map){this.namespace=e,this.schemas=t,this.exceptions=o;}static for(e){return r.registries.has(e)||r.registries.set(e,new r(e)),r.registries.get(e)}copyFrom(e){let{schemas:t,exceptions:o}=this;for(let[s,n]of e.schemas)t.has(s)||t.set(s,n);for(let[s,n]of e.exceptions)o.has(s)||o.set(s,n);}register(e,t){let o=this.normalizeShapeId(e);for(let s of [this,r.for(o.split("#")[0])])s.schemas.set(o,t);}getSchema(e){let t=this.normalizeShapeId(e);if(!this.schemas.has(t)){if(!e.includes("#")){let o="#"+e,s=[];for(let[n,a]of this.schemas.entries())n.endsWith(o)&&s.push(a);if(s.length===1)return s[0]}throw new Error(`@smithy/core/schema - schema not found for ${t}`)}return this.schemas.get(t)}registerError(e,t){let o=e,s=o[1];for(let n of [this,r.for(s)])n.schemas.set(s+"#"+o[2],o),n.exceptions.set(o,t);}getErrorCtor(e){let t=e;return this.exceptions.has(t)?this.exceptions.get(t):r.for(t[1]).exceptions.get(t)}getBaseException(){for(let e of this.exceptions.keys())if(Array.isArray(e)){let[,t,o]=e,s=t+"#"+o;if(s.startsWith("smithy.ts.sdk.synthetic.")&&s.endsWith("ServiceException"))return e}}find(e){for(let t of this.schemas.values())if(e(t))return t}clear(){this.schemas.clear(),this.exceptions.clear();}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var U=r=>typeof r=="function"?r():r;chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var se=[];function _(r){if(typeof r=="object")return r;if(r=r|0,se[r])return se[r];let e={},t=0;for(let o of ["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(r>>t++&1)===1&&(e[o]=1);return se[r]=e}var k={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},ie=[],ne={},y=class r{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=r.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,t){this.ref=e,this.memberName=t;let o=[],s=e,n=e;for(this._isMemberSchema=false;be(s);)o.push(s[1]),s=s[0],n=U(s),this._isMemberSchema=true;if(o.length>0){this.memberTraits={};for(let a=o.length-1;a>=0;--a){let f=o[a];Object.assign(this.memberTraits,_(f));}}else this.memberTraits=0;if(n instanceof r){let a=this.memberTraits;Object.assign(this,n),this.memberTraits=Object.assign({},a,n.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=t??n.memberName;return}if(this.schema=U(n),Ye(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(n),this.traits=0),this._isMemberSchema&&!t)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`)}static[Symbol.hasInstance](e){let t=this.prototype.isPrototypeOf(e);return !t&&typeof e=="object"&&e!==null?e.symbol===this.symbol:t}static of(e){let t=typeof e=="function"||typeof e=="object"&&e!==null;if(typeof e=="number"){if(ie[e])return ie[e]}else if(typeof e=="string"){if(ne[e])return ne[e]}else if(t&&e[k.ns])return e[k.ns];let o=U(e);if(o instanceof r)return o;if(be(o)){let[n,a]=o;if(n instanceof r)return Object.assign(n.getMergedTraits(),_(a)),n;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}let s=new r(o);return t?e[k.ns]=s:typeof o=="string"?ne[o]=s:typeof o=="number"?ie[o]=s:s}getSchema(){let e=this.schema;return Array.isArray(e)&&e[0]===0?e[4]:e}getName(e=false){let{name:t}=this;return !e&&t&&t.includes("#")?t.split("#")[1]:t||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){let e=this.getSchema();return typeof e=="number"?e>=64&&e<128:e[0]===1}isMapSchema(){let e=this.getSchema();return typeof e=="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){let e=this.getSchema();if(typeof e!="object")return false;let t=e[0];return t===3||t===-3||t===4}isUnionSchema(){let e=this.getSchema();return typeof e!="object"?false:e[0]===4}isBlobSchema(){let e=this.getSchema();return e===21||e===42}isTimestampSchema(){let e=this.getSchema();return typeof e=="number"&&e>=4&&e<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){let{streaming:e}=this.getMergedTraits();return !!e||this.getSchema()===42}isIdempotencyToken(){return !!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return _(this.memberTraits)}getOwnTraits(){return _(this.traits)}getKeySchema(){let[e,t]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!t)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`);let o=this.getSchema(),s=e?15:o[4]??0;return $([s,0],"key")}getValueSchema(){let e=this.getSchema(),[t,o,s]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],n=typeof e=="number"?63&e:e&&typeof e=="object"&&(o||s)?e[3+e[0]]:t?15:void 0;if(n!=null)return $([n,0],o?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(true)} has no value member.`)}getMemberSchema(e){let t=this.getSchema();if(this.isStructSchema()&&t[4].includes(e)){let o=t[4].indexOf(e),s=t[5][o];return $(be(s)?s:[s,0],e)}if(this.isDocumentSchema())return $([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(true)} has no member=${e}.`)}getMemberSchemas(){let e={};try{for(let[t,o]of this.structIterator())e[t]=o;}catch{}return e}getEventStreamMember(){if(this.isStructSchema()){for(let[e,t]of this.structIterator())if(t.isStreaming()&&t.isStructSchema())return e}return ""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");let e=this.getSchema(),t=e[4].length,o=e[k.it];if(o&&t===o.length){yield*o;return}o=Array(t);for(let s=0;s<t;++s){let n=e[4][s],a=$([e[5][s],0],n);yield o[s]=[n,a];}e[k.it]=o;}};function $(r,e){if(r instanceof y)return Object.assign(r,{memberName:e,_isMemberSchema:true});let t=y;return new t(r,e)}var be=r=>Array.isArray(r)&&r.length===2,Ye=r=>Array.isArray(r)&&r.length>=5;chunkBUNLC3II_cjs.h();var O=class r extends Error{name="ProviderError";tryNextLink;constructor(e,t=true){let o,s=true;typeof t=="boolean"?(o=void 0,s=t):t!=null&&typeof t=="object"&&(o=t.logger,s=t.tryNextLink??true),super(e),this.tryNextLink=s,Object.setPrototypeOf(this,r.prototype),o?.debug?.(`@smithy/property-provider ${s?"->":"(!)"} ${e}`);}static from(e,t=true){return Object.assign(new this(e.message,t),e)}};chunkBUNLC3II_cjs.h();var F=class r extends O{name="CredentialsProviderError";constructor(e,t=true){super(e,t),Object.setPrototypeOf(this,r.prototype);}};chunkBUNLC3II_cjs.h();var Ze="AWS_PROFILE",et="default",Ne=r=>r.profile||process.env[Ze]||et;chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var Ce={},$t=()=>process&&process.geteuid?`${process.geteuid()}`:"DEFAULT",v=()=>{let{HOME:r,USERPROFILE:e,HOMEPATH:t,HOMEDRIVE:o=`C:${path.sep}`}=process.env;if(r)return r;if(e)return e;if(t)return `${o}${t}`;let s=$t();return Ce[s]||(Ce[s]=os.homedir()),Ce[s]};var jt="AWS_CONFIG_FILE",ae=()=>process.env[jt]||path.join(v(),".aws","config");chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var tt=r=>Object.entries(r).filter(([e])=>{let t=e.indexOf(".");return t===-1?false:Object.values(C).includes(e.substring(0,t))}).reduce((e,[t,o])=>{let s=t.indexOf("."),n=t.substring(0,s)===C.PROFILE?t.substring(s+1):t;return e[n]=o,e},{...r.default&&{default:r.default}});chunkBUNLC3II_cjs.h();var Bt="AWS_SHARED_CREDENTIALS_FILE",rt=()=>process.env[Bt]||path.join(v(),".aws","credentials");chunkBUNLC3II_cjs.h();var Wt=/^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/,Kt=["__proto__","profile __proto__"],j=r=>{let e={},t,o;for(let s of r.split(/\r?\n/)){let n=s.split(/(^|\s)[;#]/)[0].trim();if(n[0]==="["&&n[n.length-1]==="]"){t=void 0,o=void 0;let f=n.substring(1,n.length-1),m=Wt.exec(f);if(m){let[,h,,u]=m;Object.values(C).includes(h)&&(t=[h,u].join("."));}else t=f;if(Kt.includes(f))throw new Error(`Found invalid profile name "${f}"`)}else if(t){let f=n.indexOf("=");if(![0,-1].includes(f)){let[m,h]=[n.substring(0,f).trim(),n.substring(f+1).trim()];if(h==="")o=m;else {o&&s.trimStart()===s&&(o=void 0),e[t]=e[t]||{};let u=o?[o,m].join("."):m;e[t][u]=h;}}}}return e};chunkBUNLC3II_cjs.h();var _e={},G={},M=(r,e)=>G[r]!==void 0?G[r]:((!_e[r]||e?.ignoreCache)&&(_e[r]=promises.readFile(r,"utf8")),_e[r]);var st=()=>({}),ce=async(r={})=>{let{filepath:e=rt(),configFilepath:t=ae()}=r,o=v(),s="~/",n=e;e.startsWith(s)&&(n=path.join(o,e.slice(2)));let a=t;t.startsWith(s)&&(a=path.join(o,t.slice(2)));let f=await Promise.all([M(a,{ignoreCache:r.ignoreCache}).then(j).then(tt).catch(st),M(n,{ignoreCache:r.ignoreCache}).then(j).catch(st)]);return {configFile:f[0],credentialsFile:f[1]}};var it=r=>Object.entries(r).filter(([e])=>e.startsWith(C.SSO_SESSION+".")).reduce((e,[t,o])=>({...e,[t.substring(t.indexOf(".")+1)]:o}),{});var Qt=()=>({}),Xt=async(r={})=>M(r.configFilepath??ae()).then(j).then(it).catch(Qt);chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var nt=(...r)=>{let e={};for(let t of r)for(let[o,s]of Object.entries(t))e[o]!==void 0?Object.assign(e[o],s):e[o]=s;return e};var Jt=async r=>{let e=await ce(r);return nt(e.configFile,e.credentialsFile)};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var we=r=>{let t=crypto.createHash("sha1").update(r).digest("hex");return path.join(v(),".aws","sso","cache",`${t}.json`)};var B={},tr=async r=>{if(B[r])return B[r];let e=we(r),t=await promises.readFile(e,"utf8");return JSON.parse(t)};var rr={getFileRecord(){return G},interceptFile(r,e){G[r]=Promise.resolve(e);},getTokenRecord(){return B},interceptToken(r,e){B[r]=e;}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var Oe=(...r)=>async()=>{if(r.length===0)throw new O("No providers in chain");let e;for(let t of r)try{return await t()}catch(o){if(e=o,o?.tryNextLink)continue;throw o}throw e};chunkBUNLC3II_cjs.h();var me=(r,e,t)=>{let o,s,n,a=false,f=async()=>{s||(s=r());try{o=await s,n=!0,a=!1;}finally{s=void 0;}return o};return e===void 0?async m=>((!n||m?.forceRefresh)&&(o=await f()),o):async m=>((!n||m?.forceRefresh)&&(o=await f()),a?o:t&&!t(o)?(a=true,o):(e(o)&&await f(),o))};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();function fe(r){try{let e=new Set(Array.from(r.match(/([A-Z_]){3,}/g)??[]));return e.delete("CONFIG"),e.delete("CONFIG_PREFIX_SEPARATOR"),e.delete("ENV"),[...e].join(", ")}catch{return r}}var at=(r,e)=>async()=>{try{let t=r(process.env,e);if(t===void 0)throw new Error;return t}catch(t){throw new F(t.message||`Not found in ENV: ${fe(r.toString())}`,{logger:e?.logger})}};chunkBUNLC3II_cjs.h();var ct=(r,{preferredFile:e="config",...t}={})=>async()=>{let o=Ne(t),{configFile:s,credentialsFile:n}=await ce(t),a=n[o]||{},f=s[o]||{},m=e==="config"?{...a,...f}:{...f,...a};try{let u=r(m,e==="config"?s:n);if(u===void 0)throw new Error;return u}catch(h){throw new F(h.message||`Not found in config files w/ profile [${o}]: ${fe(r.toString())}`,{logger:t.logger})}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var mt=r=>()=>Promise.resolve(r);var or=r=>typeof r=="function",ft=r=>or(r)?async()=>await r():mt(r);var he=({environmentVariableSelector:r,configFileSelector:e,default:t},o={})=>{let{signingName:s,logger:n}=o;return me(Oe(at(r,{signingName:s,logger:n}),ct(e,o),ft(t)))};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var ht=new Set,lt=(r,e=re)=>{if(!ht.has(r)&&!e(r))if(r==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${r}" is not a valid hostname component.`);else ht.add(r);};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var le=r=>typeof r=="string"&&(r.startsWith("fips-")||r.endsWith("-fips"));var pt=r=>le(r)?["fips-aws-global","aws-fips"].includes(r)?"us-east-1":r.replace(/fips-(dkr-|prod-)?|-fips/,""):r;var sr=r=>{let{region:e,useFipsEndpoint:t}=r;if(!e)throw new Error("Region is missing");return Object.assign(r,{region:async()=>{let o=typeof e=="function"?await e():e,s=pt(o);return lt(s),s},useFipsEndpoint:async()=>{let o=typeof e=="string"?e:await e();return le(o)?true:typeof t!="function"?Promise.resolve(!!t):t()}})};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var Ie=class r extends O{name="TokenProviderError";constructor(e,t=true){super(e,t),Object.setPrototypeOf(this,r.prototype);}};chunkBUNLC3II_cjs.h();var P=(r,e,t)=>{if(e in r){if(r[e]==="true")return true;if(r[e]==="false")return false;throw new Error(`Cannot load ${t} "${e}". Expected "true" or "false", got ${r[e]}.`)}};chunkBUNLC3II_cjs.h();exports.t=void 0;(function(r){r.ENV="env",r.CONFIG="shared config entry";})(exports.t||(exports.t={}));chunkBUNLC3II_cjs.h();var dt="AWS_USE_DUALSTACK_ENDPOINT",ut="use_dualstack_endpoint";var ir={environmentVariableSelector:r=>P(r,dt,exports.t.ENV),configFileSelector:r=>P(r,ut,exports.t.CONFIG),default:false};chunkBUNLC3II_cjs.h();var gt="AWS_USE_FIPS_ENDPOINT",St="use_fips_endpoint";var nr={environmentVariableSelector:r=>P(r,gt,exports.t.ENV),configFileSelector:r=>P(r,St,exports.t.CONFIG),default:false};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var Et="AWS_EXECUTION_ENV",Ae="AWS_REGION",De="AWS_DEFAULT_REGION",yt="AWS_EC2_METADATA_DISABLED",xt=["in-region","cross-region","mobile","standard","legacy"],Tt="/latest/meta-data/placement/region",bt="/latest/api/token",Nt="x-aws-ec2-metadata-token",Ct="x-aws-ec2-metadata-token-ttl-seconds";var _t=1e3,ar=6e4,It=0,pe=async()=>{if(!process.env[yt]&&!(Date.now()<It))try{let r=cr(),e=(await Ot({...r,path:bt,method:"PUT",headers:{[Ct]:"21600"}})).toString();return (await Ot({...r,path:Tt,method:"GET",headers:{[Nt]:e}})).toString().trim()||wt()}catch{return wt()}},wt=()=>{It=Date.now()+ar;},cr=()=>{let r=process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT;if(r){let e=new URL(r);return {hostname:e.hostname.replace(/^\[(.+)]$/,"$1"),port:e.port?Number(e.port):void 0}}return process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE==="IPv6"?{hostname:"fd00:ec2::254"}:{hostname:"169.254.169.254"}},Ot=async r=>{let{request:e}=await import('http');return new Promise((t,o)=>{let s=e({hostname:r.hostname,port:r.port,path:r.path,method:r.method,headers:r.headers,timeout:_t,signal:AbortSignal.timeout(_t)});s.on("error",n=>{o(n),s.destroy();}),s.on("timeout",()=>{o(new Error("TimeoutError from instance metadata service")),s.destroy();}),s.on("response",n=>{let{statusCode:a=400}=n;if(a<200||a>=300){o(Object.assign(new Error("Error response received from instance metadata service"),{statusCode:a})),s.destroy();return}let f=[];n.on("data",m=>f.push(m)),n.on("end",()=>{t(Buffer.concat(f)),s.destroy();});}),s.end();})};var At="AWS_REGION",Dt="region",ve={environmentVariableSelector:r=>r[At],configFileSelector:r=>r[Dt],default:async()=>{let r=await pe();if(r)return r;throw new Error("Region is missing")}},mr={preferredFile:"credentials"};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var fr="AWS_DEFAULTS_MODE",hr="defaults_mode",vt={environmentVariableSelector:r=>r[fr],configFileSelector:r=>r[hr],default:"legacy"};var lr=({region:r=he(ve),defaultsMode:e=he(vt)}={})=>me(async()=>{let t=typeof e=="function"?await e():e;switch(t?.toLowerCase()){case "auto":return pr(r);case "in-region":case "cross-region":case "mobile":case "standard":case "legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${xt.join(", ")}, got ${t}`)}}),pr=async r=>{if(r){let e=typeof r=="function"?await r():r,t=await dr();return t?e===t?"in-region":"cross-region":"standard"}return "standard"},dr=async()=>process.env[Et]&&(process.env[Ae]||process.env[De])?process.env[Ae]??process.env[De]:pe();chunkBUNLC3II_cjs.h();var Ft="content-length";function Pt(r){return e=>async t=>{let o=t.request;if(b.isInstance(o)){let{body:s,headers:n}=o;if(s&&Object.keys(n).map(a=>a.toLowerCase()).indexOf(Ft)===-1)try{let a=r(s);o.headers={...o.headers,[Ft]:String(a)};}catch{}}return e({...t,request:o})}}var Rt={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:true},ur=r=>({applyToStack:e=>{e.add(Pt(r.bodyLengthChecker),Rt);}});chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var A=async(r=new Uint8Array,e)=>{if(r instanceof Uint8Array)return chunkLQ3YZTPU_cjs.B.mutate(r);if(!r)return chunkLQ3YZTPU_cjs.B.mutate(new Uint8Array);let t=e.streamCollector(r);return chunkLQ3YZTPU_cjs.B.mutate(await t)};chunkBUNLC3II_cjs.h();function de(r){return encodeURIComponent(r).replace(/[!'()*]/g,function(e){return "%"+e.charCodeAt(0).toString(16).toUpperCase()})}chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var w=class{serdeContext;setSerdeContext(e){this.serdeContext=e;}};var L=class extends w{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=H.for(e.defaultNamespace);for(let t of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(t);}getRequestType(){return b}getResponseType(){return D}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e);}updateServiceEndpoint(e,t){if("url"in t){e.protocol=t.url.protocol,e.hostname=t.url.hostname,e.port=t.url.port?Number(t.url.port):void 0,e.path=t.url.pathname,e.fragment=t.url.hash||void 0,e.username=t.url.username||void 0,e.password=t.url.password||void 0,e.query||(e.query={});for(let[o,s]of t.url.searchParams.entries())e.query[o]=s;if(t.headers)for(let o in t.headers)e.headers[o]=t.headers[o].join(", ");return e}else {if(e.protocol=t.protocol,e.hostname=t.hostname,e.port=t.port?Number(t.port):void 0,e.path=t.path,e.query={...t.query},t.headers)for(let o in t.headers)e.headers[o]=t.headers[o];return e}}setHostPrefix(e,t,o){if(this.serdeContext?.disableHostPrefix)return;let s=y.of(t.input),n=_(t.traits??{});if(n.endpoint){let a=n.endpoint?.[0];if(typeof a=="string"){for(let[f,m]of s.structIterator()){if(!m.getMergedTraits().hostLabel)continue;let h=o[f];if(typeof h!="string")throw new Error(`@smithy/core/schema - ${f} in input must be a string as hostLabel.`);a=a.replace(`{${f}}`,h);}if(e.hostname=a+e.hostname,!ye(e.hostname))throw new Error(`[${e.hostname}] is not a valid hostname.`)}}}deserializeMetadata(e){return {httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:o}){return (await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:t,initialRequest:o})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:o}){return (await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:o})}async loadEventStreamCapability(){let{EventStreamSerde:e,eventStreamSerdeProvider:t}=await import('./event-streams-JBMWCI2O.cjs'),o=this.resolveEventStreamMarshaller(t);return new e({marshaller:o,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}resolveEventStreamMarshaller(e){let t=this.serdeContext;return t.eventStreamMarshaller?t.eventStreamMarshaller:e(this.serdeContext)}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,t,o,s,n){return []}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}};var Fe=class extends L{async serializeRequest(e,t,o){let s=t&&typeof t=="object"?t:{},n=this.serializer,a={},f={},m=await o.endpoint(),h=y.of(e?.input),u=[],p=[],S=false,E,d=new b({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:a,headers:f,body:void 0});if(m){this.updateServiceEndpoint(d,m),this.setHostPrefix(d,e,s);let l=_(e.traits);if(l.http){d.method=l.http[0];let[g,x]=l.http[1].split("?");d.path=="/"?d.path=g:d.path+=g;let T=new URLSearchParams(x??"");for(let[N,Q]of T)a[N]=Q;}}for(let[l,g]of h.structIterator()){let x=g.getMergedTraits()??{},T=s[l];if(T==null&&!g.isIdempotencyToken()){if(x.httpLabel&&(d.path.includes(`{${l}+}`)||d.path.includes(`{${l}}`)))throw new Error(`No value provided for input HTTP label: ${l}.`);continue}if(x.httpPayload)g.isStreaming()?g.isStructSchema()?s[l]&&(E=await this.serializeEventStream({eventStream:s[l],requestSchema:h})):E=T:(n.write(g,T),E=n.flush());else if(x.httpLabel){n.write(g,T);let N=n.flush();d.path.includes(`{${l}+}`)?d.path=d.path.replace(`{${l}+}`,N.split("/").map(de).join("/")):d.path.includes(`{${l}}`)&&(d.path=d.path.replace(`{${l}}`,de(N)));}else if(x.httpHeader)n.write(g,T),f[x.httpHeader.toLowerCase()]=String(n.flush());else if(typeof x.httpPrefixHeaders=="string")for(let N in T){let Q=T[N],Le=x.httpPrefixHeaders+N;n.write([g.getValueSchema(),{httpHeader:Le}],Q),f[Le.toLowerCase()]=n.flush();}else x.httpQuery||x.httpQueryParams?this.serializeQuery(g,T,a):(S=true,u.push(l),p.push(g));}if(S&&s){let[l,g]=(h.getName(true)??"#Unknown").split("#"),x=h.getSchema()[6],T=[3,l,g,h.getMergedTraits(),u,p,void 0];x?T[6]=x:T.pop(),n.write(T,s),E=n.flush();}return d.headers=f,d.query=a,d.body=E,d}serializeQuery(e,t,o){let s=this.serializer,n=e.getMergedTraits();if(n.httpQueryParams){for(let a in t)if(!(a in o)){let f=t[a],m=e.getValueSchema();Object.assign(m.getMergedTraits(),{...n,httpQuery:a,httpQueryParams:void 0}),this.serializeQuery(m,f,o);}return}if(e.isListSchema()){let a=!!e.getMergedTraits().sparse,f=[];for(let m of t){s.write([e.getValueSchema(),n],m);let h=s.flush();(a||h!==void 0)&&f.push(h);}o[n.httpQuery]=f;}else s.write([e,n],t),o[n.httpQuery]=s.flush();}async deserializeResponse(e,t,o){let s=this.deserializer,n=y.of(e.output),a={};if(o.statusCode>=300){let m=await A(o.body,t);throw m.byteLength>0&&Object.assign(a,await s.read(15,m)),await this.handleError(e,t,o,a,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let m in o.headers){let h=o.headers[m];delete o.headers[m],o.headers[m.toLowerCase()]=h;}let f=await this.deserializeHttpMessage(n,t,o,a);if(f.length){let m=await A(o.body,t);if(m.byteLength>0){let h=await s.read(n,m);for(let u of f)h[u]!=null&&(a[u]=h[u]);}}else f.discardResponseBody&&await A(o.body,t);return a.$metadata=this.deserializeMetadata(o),a}async deserializeHttpMessage(e,t,o,s,n){let a;s instanceof Set?a=n:a=s;let f=true,m=this.deserializer,h=y.of(e),u=[];for(let[p,S]of h.structIterator()){let E=S.getMemberTraits();if(E.httpPayload){if(f=false,S.isStreaming())S.isStructSchema()?a[p]=await this.deserializeEventStream({response:o,responseSchema:h}):a[p]=chunkLQ3YZTPU_cjs.A(o.body);else if(o.body){let l=await A(o.body,t);l.byteLength>0&&(a[p]=await m.read(S,l));}}else if(E.httpHeader){let d=String(E.httpHeader).toLowerCase(),l=o.headers[d];if(l!=null)if(S.isListSchema()){let g=S.getValueSchema();g.getMergedTraits().httpHeader=d;let x;g.isTimestampSchema()&&g.getSchema()===4?x=chunkLQ3YZTPU_cjs.p(l,",",2):x=chunkLQ3YZTPU_cjs.q(l);let T=[];for(let N of x)T.push(await m.read(g,N.trim()));a[p]=T;}else a[p]=await m.read(S,l);}else if(E.httpPrefixHeaders!==void 0){a[p]={};for(let d in o.headers)if(d.startsWith(E.httpPrefixHeaders)){let l=o.headers[d],g=S.getValueSchema();g.getMergedTraits().httpHeader=d,a[p][d.slice(E.httpPrefixHeaders.length)]=await m.read(g,l);}}else E.httpResponseCode?a[p]=o.statusCode:u.push(p);}return u.discardResponseBody=f,u}};chunkBUNLC3II_cjs.h();var Pe=class extends L{async serializeRequest(e,t,o){let s=this.serializer,n={},a={},f=await o.endpoint(),m=y.of(e?.input),h=m.getSchema(),u,p=t&&typeof t=="object"?t:{},S=new b({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:n,headers:a,body:void 0});if(f&&(this.updateServiceEndpoint(S,f),this.setHostPrefix(S,e,p)),p){let E=m.getEventStreamMember();if(E){if(p[E]){let d={};for(let[l,g]of m.structIterator())l!==E&&p[l]&&(s.write(g,p[l]),d[l]=s.flush());u=await this.serializeEventStream({eventStream:p[E],requestSchema:m,initialRequest:d});}}else s.write(h,p),u=s.flush();}return S.headers=Object.assign(S.headers,a),S.query=n,S.body=u,S.method="POST",S}async deserializeResponse(e,t,o){let s=this.deserializer,n=y.of(e.output),a={};if(o.statusCode>=300){let m=await A(o.body,t);throw m.byteLength>0&&Object.assign(a,await s.read(15,m)),await this.handleError(e,t,o,a,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let m in o.headers){let h=o.headers[m];delete o.headers[m],o.headers[m.toLowerCase()]=h;}let f=n.getEventStreamMember();if(f)a[f]=await this.deserializeEventStream({response:o,responseSchema:n,initialResponseContainer:a});else {let m=await A(o.body,t);m.byteLength>0&&Object.assign(a,await s.read(n,m));}return a.$metadata=this.deserializeMetadata(o),a}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();function W(r,e){if(e.timestampFormat.useTrait&&r.isTimestampSchema()&&(r.getSchema()===5||r.getSchema()===6||r.getSchema()===7))return r.getSchema();let{httpLabel:t,httpPrefixHeaders:o,httpHeader:s,httpQuery:n}=r.getMergedTraits();return (e.httpBindings?typeof o=="string"||s?6:n||t?5:void 0:void 0)??e.timestampFormat.default}var K=class extends w{settings;constructor(e){super(),this.settings=e;}read(e,t){let o=y.of(e);if(o.isListSchema())return chunkLQ3YZTPU_cjs.q(t).map(s=>this.read(o.getValueSchema(),s));if(o.isBlobSchema())return (this.serdeContext?.base64Decoder??chunkLQ3YZTPU_cjs.b)(t);if(o.isTimestampSchema())switch(W(o,this.settings)){case 5:return chunkLQ3YZTPU_cjs.n(t);case 6:return chunkLQ3YZTPU_cjs.o(t);case 7:return chunkLQ3YZTPU_cjs.m(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}if(o.isStringSchema()){let s=o.getMergedTraits().mediaType,n=t;if(s)return o.getMergedTraits().httpHeader&&(n=this.base64ToUtf8(n)),(s==="application/json"||s.endsWith("+json"))&&(n=chunkLQ3YZTPU_cjs.k.from(n)),n}return o.isNumericSchema()?Number(t):o.isBigIntegerSchema()?BigInt(t):o.isBigDecimalSchema()?new chunkLQ3YZTPU_cjs.r(t,"bigDecimal"):o.isBooleanSchema()?String(t).toLowerCase()==="true":t}base64ToUtf8(e){return (this.serdeContext?.utf8Encoder??chunkLQ3YZTPU_cjs.e)((this.serdeContext?.base64Decoder??chunkLQ3YZTPU_cjs.b)(e))}};chunkBUNLC3II_cjs.h();var Re=class extends w{codecDeserializer;stringDeserializer;constructor(e,t){super(),this.codecDeserializer=e,this.stringDeserializer=new K(t);}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e;}read(e,t){let o=y.of(e),s=o.getMergedTraits(),n=this.serdeContext?.utf8Encoder??chunkLQ3YZTPU_cjs.e;if(s.httpHeader||s.httpResponseCode)return this.stringDeserializer.read(o,n(t));if(s.httpPayload){if(o.isBlobSchema()){let a=this.serdeContext?.utf8Decoder??chunkLQ3YZTPU_cjs.c;return typeof t=="string"?a(t):t}else if(o.isStringSchema())return "byteLength"in t?n(t):t}return this.codecDeserializer.read(o,t)}};chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var ue=class extends w{settings;stringBuffer="";constructor(e){super(),this.settings=e;}write(e,t){let o=y.of(e);switch(typeof t){case "object":if(t===null){this.stringBuffer="null";return}if(o.isTimestampSchema()){if(!(t instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${t} when schema expected Date in ${o.getName(true)}`);switch(W(o,this.settings)){case 5:this.stringBuffer=t.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=chunkLQ3YZTPU_cjs.f(t);break;case 7:this.stringBuffer=String(t.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",t),this.stringBuffer=String(t.getTime()/1e3);}return}if(o.isBlobSchema()&&"byteLength"in t){this.stringBuffer=(this.serdeContext?.base64Encoder??chunkLQ3YZTPU_cjs.d)(t);return}if(o.isListSchema()&&Array.isArray(t)){let a="";for(let f of t){this.write([o.getValueSchema(),o.getMergedTraits()],f);let m=this.flush(),h=o.getValueSchema().isTimestampSchema()?m:chunkLQ3YZTPU_cjs.l(m);a!==""&&(a+=", "),a+=h;}this.stringBuffer=a;return}this.stringBuffer=JSON.stringify(t,null,2);break;case "string":let s=o.getMergedTraits().mediaType,n=t;if(s&&((s==="application/json"||s.endsWith("+json"))&&(n=chunkLQ3YZTPU_cjs.k.from(n)),o.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??chunkLQ3YZTPU_cjs.d)(n.toString());return}this.stringBuffer=t;break;default:o.isIdempotencyToken()?this.stringBuffer=chunkLQ3YZTPU_cjs.D():this.stringBuffer=String(t);}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}};var Me=class{codecSerializer;stringSerializer;buffer;constructor(e,t,o=new ue(t)){this.codecSerializer=e,this.stringSerializer=o;}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e);}write(e,t){let o=y.of(e),s=o.getMergedTraits();if(s.httpHeader||s.httpLabel||s.httpQuery){this.stringSerializer.write(o,t),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(o,t)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}};chunkBUNLC3II_cjs.h();var gr=r=>({setHttpHandler(e){r.httpHandler=e;},httpHandler(){return r.httpHandler},updateHttpClientConfig(e,t){r.httpHandler?.updateHttpClientConfig(e,t);},httpHandlerConfigs(){return r.httpHandler.httpHandlerConfigs()}}),Sr=r=>({httpHandler:r.httpHandler()});chunkBUNLC3II_cjs.h();var q=r=>encodeURIComponent(r).replace(/[!'()*]/g,Er),Er=r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`;chunkBUNLC3II_cjs.h();function yr(r){let e=[];for(let t of Object.keys(r).sort()){let o=r[t];if(t=q(t),Array.isArray(o))for(let s=0,n=o.length;s<n;s++)e.push(`${t}=${q(o[s])}`);else {let s=t;(o||typeof o=="string")&&(s+=`=${q(o)}`),e.push(s);}}return e.join("&")}
|
|
3
|
+
exports.A=Jt;exports.B=rr;exports.C=he;exports.D=ir;exports.E=nr;exports.F=ve;exports.G=mr;exports.H=sr;exports.I=lr;exports.J=A;exports.K=de;exports.L=Fe;exports.M=Pe;exports.N=W;exports.O=K;exports.P=Re;exports.Q=Me;exports.R=gr;exports.S=Sr;exports.T=ur;exports.U=q;exports.V=yr;exports.c=te;exports.d=z;exports.e=b;exports.f=D;exports.g=re;exports.h=Mt;exports.i=R;exports.j=xe;exports.k=U;exports.l=Ht;exports.m=y;exports.n=H;exports.o=O;exports.p=F;exports.q=Ie;exports.r=Oe;exports.s=P;exports.u=Ze;exports.v=Ne;exports.w=we;exports.x=tr;exports.y=M;exports.z=Xt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkBCEE4NBZ_cjs=require('./chunk-BCEE4NBZ.cjs'),chunkVRZC4TTF_cjs=require('./chunk-VRZC4TTF.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();var m=class{static[chunkVRZC4TTF_cjs.a]="Cache"},S=class extends m{strategy(){return "all"}static[chunkVRZC4TTF_cjs.a]="NoopCache";async get(e){}async put(e,a,i,t){}async onMutate(e){}};async function N(s,e){let a=`${s}-${JSON.stringify(e)}`,t=new TextEncoder().encode(a),n=await crypto.subtle.digest("SHA-256",t);return [...new Uint8Array(n)].map(_=>_.toString(16).padStart(2,"0")).join("")}chunkBUNLC3II_cjs.h();var x=class s{static[chunkVRZC4TTF_cjs.a]="SelectionProxyHandler";config;constructor(e){this.config={...e};}get(e,a){if(a==="_")return {...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(a===chunkVRZC4TTF_cjs.l)return {...e[chunkVRZC4TTF_cjs.l],selectedFields:new Proxy(e[chunkVRZC4TTF_cjs.l].selectedFields,this)};if(typeof a=="symbol")return e[a];let t=(chunkVRZC4TTF_cjs.c(e,chunkVRZC4TTF_cjs.i)?e._.selectedFields:chunkVRZC4TTF_cjs.c(e,chunkVRZC4TTF_cjs.N)?e[chunkVRZC4TTF_cjs.l].selectedFields:e)[a];if(chunkVRZC4TTF_cjs.c(t,chunkVRZC4TTF_cjs.A.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!t.isSelectionField)return t.sql;let n=t.clone();return n.isSelectionField=true,n}if(chunkVRZC4TTF_cjs.c(t,chunkVRZC4TTF_cjs.A)){if(this.config.sqlBehavior==="sql")return t;throw new Error(`You tried to reference "${a}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return chunkVRZC4TTF_cjs.c(t,chunkVRZC4TTF_cjs.d)?this.config.alias?new Proxy(t,new chunkBCEE4NBZ_cjs.a(new Proxy(t.table,new chunkBCEE4NBZ_cjs.b(this.config.alias,this.config.replaceOriginalName??false)))):t:typeof t!="object"||t===null?t:new Proxy(t,new s(this.config))}};chunkBUNLC3II_cjs.h();function $(s){return (s.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(a=>a.toLowerCase()).join("_")}function F(s){return (s.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((a,i,t)=>{let n=t===0?i.toLowerCase():`${i[0].toUpperCase()}${i.slice(1)}`;return a+n},"")}function T(s){return s}var C=class{static[chunkVRZC4TTF_cjs.a]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert=e==="snake_case"?$:e==="camelCase"?F:T;}getColumnCasing(e){if(!e.keyAsName)return e.name;let a=e.table[chunkVRZC4TTF_cjs.t.Symbol.Schema]??"public",i=e.table[chunkVRZC4TTF_cjs.t.Symbol.OriginalName],t=`${a}.${i}.${e.name}`;return this.cache[t]||this.cacheTable(e.table),this.cache[t]}cacheTable(e){let a=e[chunkVRZC4TTF_cjs.t.Symbol.Schema]??"public",i=e[chunkVRZC4TTF_cjs.t.Symbol.OriginalName],t=`${a}.${i}`;if(!this.cachedTables[t]){for(let n of Object.values(e[chunkVRZC4TTF_cjs.t.Symbol.Columns])){let u=`${t}.${n.name}`;this.cache[u]=this.convert(n.name);}this.cachedTables[t]=true;}}clearCache(){this.cache={},this.cachedTables={};}};chunkBUNLC3II_cjs.h();var A=class{static[chunkVRZC4TTF_cjs.a]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}};exports.a=x;exports.b=C;exports.c=A;exports.d=S;exports.e=N;
|