@kyro-cms/core 0.12.47 → 0.12.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dist/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +1 -1
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +1 -1
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.js +1 -1
- package/dist/auth-session-DHVGXHOH.cjs +1 -0
- package/dist/auth-session-O7IIH7EP.js +1 -0
- package/dist/bcryptjs-ZEEHSMAG.js +2 -0
- package/dist/{better-sqlite3-42Q3FG3E.js → better-sqlite3-B34RIU4C.js} +1 -1
- package/dist/bootstrap-4FK3LPPH.js +1 -0
- package/dist/bootstrap-F4SDJLPK.cjs +1 -0
- package/dist/{bowser-FI5JQGKZ.js → bowser-SB3ZUPO4.js} +1 -1
- package/dist/chokidar-5RVQZVHP.cjs +5 -0
- package/dist/chokidar-BOYGRT4Q.js +6 -0
- package/dist/{chunk-DS5DE5BU.js → chunk-24L3UEJJ.js} +1 -1
- package/dist/{chunk-HT44I66C.js → chunk-2HA6EKXX.js} +1 -1
- package/dist/{chunk-7AQSH3KR.js → chunk-3NSZZCOJ.js} +1 -1
- package/dist/{chunk-VIUU4D5I.js → chunk-47CXBWMA.js} +1 -1
- package/dist/{chunk-6MSS5X77.js → chunk-5M3FKE2V.js} +1 -1
- package/dist/chunk-63BSQ3FK.cjs +1 -0
- package/dist/chunk-6TPICJ2L.js +7 -0
- package/dist/{chunk-K7YNEKVE.js → chunk-7FXEXHK6.js} +1 -1
- package/dist/{chunk-WSP7PSXC.js → chunk-7MNDQU6K.js} +1 -1
- package/dist/{chunk-7V67ONUD.js → chunk-7N7U2ERH.js} +1 -1
- package/dist/{chunk-BPMA2ECA.js → chunk-7NH7H3WA.js} +1 -1
- package/dist/{chunk-ZJE3VAAW.js → chunk-BU6O3TP7.js} +3 -3
- package/dist/{chunk-W46LZ4MY.js → chunk-C7QCZX7X.js} +1 -1
- package/dist/chunk-CFZVJTXW.cjs +264 -0
- package/dist/{chunk-2WFTETFB.js → chunk-CIVA6SKW.js} +1 -1
- package/dist/chunk-EFGOYI57.js +265 -0
- package/dist/{chunk-2BUODBE2.js → chunk-EML5FDUU.js} +1 -1
- package/dist/{chunk-66BJXVFJ.js → chunk-FLMUMPDE.js} +1 -1
- package/dist/{chunk-QYI3GOHF.cjs → chunk-HKNQVI76.cjs} +1 -1
- package/dist/{chunk-IP6JUEH3.js → chunk-HRAY65XH.js} +1 -1
- package/dist/{chunk-KH7LM52S.js → chunk-IKGVPXMK.js} +1 -1
- package/dist/{chunk-XSRISWOY.js → chunk-JR6IOJO7.js} +2 -2
- package/dist/{chunk-XOACKBG7.js → chunk-JRUQ5ABB.js} +2 -2
- package/dist/{chunk-OMWQVPV7.js → chunk-JV4HJBXW.js} +1 -1
- package/dist/{chunk-X54XZACS.cjs → chunk-KZHXYXSH.cjs} +2 -2
- package/dist/{chunk-UD6ZPO7T.js → chunk-L2QXP26Q.js} +1 -1
- package/dist/{chunk-ORG67NXX.js → chunk-L3Q64RUX.js} +1 -1
- package/dist/chunk-LELK3TYX.js +3 -0
- package/dist/chunk-LGYBTBWE.js +2 -0
- package/dist/{chunk-7I6URA6F.js → chunk-LVBHOZZF.js} +1 -1
- package/dist/{chunk-R3NEPC4I.js → chunk-LWM4WABU.js} +1 -1
- package/dist/{chunk-TR3ZS3T3.js → chunk-M75VGFCI.js} +1 -1
- package/dist/chunk-MCIZG4A3.cjs +1 -0
- package/dist/{chunk-VBPAAQEF.js → chunk-N5POANYV.js} +1 -1
- package/dist/chunk-O4YE57OS.cjs +6 -0
- package/dist/{chunk-A73AVVFR.js → chunk-OBYAIJVU.js} +1 -1
- package/dist/chunk-OLRCZ6E3.js +2 -0
- package/dist/{chunk-WGESLAWV.js → chunk-OXGJOYEO.js} +1 -1
- package/dist/{chunk-CGPAS4U5.js → chunk-P6JITOFF.js} +1 -1
- package/dist/{chunk-JUJZOG6P.js → chunk-PA4ZZREG.js} +1 -1
- package/dist/{chunk-45TJAB5X.js → chunk-PENOCINR.js} +3 -3
- package/dist/{chunk-MZOWPV4D.js → chunk-PRMILS4Y.js} +1 -1
- package/dist/chunk-QDBGBDCT.js +2 -0
- package/dist/{chunk-XBH4YMC7.js → chunk-R25WLKX4.js} +1 -1
- package/dist/{chunk-J6U5LWZ7.js → chunk-RPRGGGIW.js} +3 -3
- package/dist/{chunk-E27KEZPT.js → chunk-RTHJ6SS5.js} +1 -1
- package/dist/{chunk-MCZ3YZ2L.js → chunk-SLMIYECU.js} +1 -1
- package/dist/{chunk-IPXOY4RI.js → chunk-SQBTIMWF.js} +1 -1
- package/dist/{chunk-VJ2WMKPK.js → chunk-SZT6BLUR.js} +1 -1
- package/dist/{chunk-6KRR7YHA.js → chunk-TBHNE4VV.js} +1 -1
- package/dist/{chunk-OSAVAYJZ.js → chunk-TYQYKKWJ.js} +1 -1
- package/dist/{chunk-ICVQWR2A.js → chunk-U6KFONKM.js} +1 -1
- package/dist/chunk-UT7RGIYS.js +2 -0
- package/dist/{chunk-PBOZJOKN.js → chunk-UWHWSWDE.js} +1 -1
- package/dist/chunk-VVVCCB6R.js +2 -0
- package/dist/{chunk-MY42EWZP.js → chunk-W45TLOOT.js} +1 -1
- package/dist/{chunk-R4N352LI.cjs → chunk-WC7H45ZG.cjs} +3 -3
- package/dist/chunk-WJBQ2NBD.cjs +1 -0
- package/dist/{chunk-ATBH763U.js → chunk-WPM6LFCY.js} +1 -1
- package/dist/chunk-XBQ6HV3T.cjs +114 -0
- package/dist/{chunk-C2PXMVR5.js → chunk-Y2YAKDEQ.js} +1 -1
- package/dist/chunk-YENNL5HG.js +2 -0
- package/dist/{chunk-SYEP5QLG.js → chunk-YUUXFD73.js} +1 -1
- package/dist/{chunk-NWCREF47.js → chunk-YZEMLLD2.js} +1 -1
- package/dist/chunk-ZKHTFR5S.cjs +2 -0
- package/dist/{chunk-7T35572E.js → chunk-ZMG7Z3KF.js} +1 -1
- package/dist/{chunk-HLAEJB5R.js → chunk-ZRIBWDYJ.js} +1 -1
- package/dist/chunk-ZWDBPEXL.js +115 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/client.js +1 -1
- package/dist/{d1-VPH75GI2.js → d1-HPB6B253.js} +1 -1
- package/dist/{dist-es-6TQTDPE7.js → dist-es-64F22JL2.js} +2 -2
- package/dist/{dist-es-XZBHIIKY.js → dist-es-F2ZR55UK.js} +2 -2
- package/dist/dist-es-IPSSZNFP.js +1 -0
- package/dist/{dist-es-SJ76GYCI.js → dist-es-M2F7M27Y.js} +1 -1
- package/dist/{dist-es-U4ZB3ZDA.js → dist-es-M66JKZF5.js} +1 -1
- package/dist/{dist-es-MNIQZC4U.js → dist-es-OKLLRYI3.js} +2 -2
- package/dist/{dist-es-TX4DBXEW.js → dist-es-SVHZDVUF.js} +2 -2
- package/dist/{dist-es-EMUQ6ZNZ.js → dist-es-WFI55HKT.js} +1 -1
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.d.cts +1 -0
- package/dist/drizzle/index.d.ts +1 -0
- package/dist/drizzle/index.js +1 -1
- package/dist/drizzle-orm-XRTSOQJS.js +1 -0
- package/dist/event-streams-7NAWZW2I.js +1 -0
- package/dist/fields/index.js +1 -1
- package/dist/fs-KWBRQ6T6.js +1 -0
- package/dist/fs-ZQYOJOIO.cjs +1 -0
- package/dist/graphql/index.js +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.js +10 -10
- package/dist/integration.js +1 -1
- package/dist/{jsonwebtoken-S7BG2YWK.js → jsonwebtoken-OD67R5JS.js} +3 -3
- package/dist/{lib-IYW32OER.js → lib-XXYYUPMW.js} +3 -3
- package/dist/{loadSso-YTG2GQGW.js → loadSso-UQR6545M.js} +1 -1
- package/dist/local-3V3XEQUY.js +1 -0
- package/dist/media-E762GEHL.js +1 -0
- package/dist/mongo-auth-adapter-QDXVHREJ.js +1 -0
- package/dist/{mongo-auth-adapter-7K64Y2QM.cjs → mongo-auth-adapter-W3HLB7OR.cjs} +1 -1
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.js +1 -1
- package/dist/{nodemailer-AXROO37D.js → nodemailer-NITB45SS.js} +3 -3
- package/dist/postgres-auth-adapter-SK3N3OSS.js +1 -0
- package/dist/postgres-auth-adapter-ZO6HK5AK.cjs +1 -0
- package/dist/postgres-js-3Y54EXVQ.cjs +1 -1
- package/dist/postgres-js-4CI7FMYS.js +1 -0
- package/dist/redis-adapter-QPCTMF55.js +1 -0
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.js +1 -1
- package/dist/schema-YFMSJK2P.js +2 -0
- package/dist/{signin-KZBIAHGS.js → signin-N3T2KF5Q.js} +1 -1
- package/dist/sqlite-adapter-4TPNROJK.js +1 -0
- package/dist/src-QBADSZV4.js +1 -0
- package/dist/{sso-oidc-SX5OIQGG.js → sso-oidc-UB7G4END.js} +1 -1
- package/dist/{sts-HVGDJYIF.js → sts-WAA6I22C.js} +1 -1
- package/dist/templates/index.js +1 -1
- package/dist/trpc/index.js +1 -1
- package/dist/ws/index.js +1 -1
- package/package.json +2 -2
- package/dist/bcryptjs-AZA6WEN2.js +0 -2
- package/dist/bootstrap-7CI3NVSY.js +0 -1
- package/dist/bootstrap-DOOM2CNQ.cjs +0 -1
- package/dist/chokidar-24HVS6XD.cjs +0 -5
- package/dist/chokidar-43DT7CVN.js +0 -6
- package/dist/chunk-5DWYVUQR.cjs +0 -1
- package/dist/chunk-6QWLXJ7L.js +0 -2
- package/dist/chunk-B3GDQ7UI.cjs +0 -114
- package/dist/chunk-BLH2MRK4.js +0 -2
- package/dist/chunk-EOOZDOL7.js +0 -3
- package/dist/chunk-F3MCWKOW.cjs +0 -1
- package/dist/chunk-FYPEL7XW.js +0 -270
- package/dist/chunk-MPGROUMH.js +0 -2
- package/dist/chunk-PL5AIE6F.js +0 -2
- package/dist/chunk-QDHP5E4P.cjs +0 -2
- package/dist/chunk-QN5ULXBX.cjs +0 -269
- package/dist/chunk-R4LXRAMX.js +0 -2
- package/dist/chunk-SVYUTQVE.js +0 -115
- package/dist/chunk-UB5TJHQR.js +0 -2
- package/dist/chunk-XPPVX4GQ.cjs +0 -1
- package/dist/dist-es-6SVFVYN3.js +0 -1
- package/dist/drizzle-orm-7YTX5NTT.js +0 -1
- package/dist/event-streams-25YJ2Z6R.js +0 -1
- package/dist/fs-DGKZLRM6.cjs +0 -1
- package/dist/fs-YZJ5FM6J.js +0 -2
- package/dist/local-VDCSEMC2.js +0 -1
- package/dist/media-HK2IZMUZ.js +0 -1
- package/dist/mongo-auth-adapter-BUKINEZL.js +0 -1
- package/dist/postgres-auth-adapter-2M4RNEY3.cjs +0 -1
- package/dist/postgres-auth-adapter-MKSHIJDL.js +0 -1
- package/dist/postgres-js-INQPBHJP.js +0 -1
- package/dist/redis-adapter-SXOXLHNH.js +0 -1
- package/dist/schema-XC5ISGNR.js +0 -2
- package/dist/sqlite-adapter-DV7ZX2EJ.js +0 -1
- package/dist/src-GZRZ4VAO.js +0 -1
- /package/dist/{chunk-P7XYIKL6.cjs → chunk-YUER4JU3.cjs} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {a as a$2}from'./chunk-L3Q64RUX.js';import {h as h$1,k as k$1,c as c$2,f as f$2}from'./chunk-YUUXFD73.js';import {a as a$1}from'./chunk-LVBHOZZF.js';import {p,q,R as R$1,r,n as n$2,u as u$1,e,f as f$1,c,N as N$1,x as x$1,t,O as O$1,z,B,C as C$1,D as D$1,E as E$1,I as I$1,G as G$1,i,a,Q,v as v$1,y as y$1,w as w$1,P as P$1,T as T$2,j as j$1,U,k as k$2,m,J,h as h$3,s as s$1}from'./chunk-OBYAIJVU.js';export{d as $Command,c as __Client}from'./chunk-OBYAIJVU.js';import {n as n$1,H,l as l$1,T as T$1,I as I$2,C as C$2,E as E$2,D as D$2,F,G as G$2,h as h$2,R as R$2,S as S$1,d as d$1,i as i$1}from'./chunk-JRUQ5ABB.js';import {d as d$2}from'./chunk-U6KFONKM.js';import {z as z$1,u as u$2,e as e$1,c as c$1,d as d$3,b as b$1}from'./chunk-TYQYKKWJ.js';import {g}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();g();g();var Ye=async(e,t,i)=>({operation:d$1(t).operation,region:await h$2(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function Dt(e){return {schemeId:"aws.auth#sigv4",signingProperties:{name:"sso-oauth",region:e.region},propertiesExtractor:(t,i)=>({signingProperties:{config:t,context:i}})}}function yt(e){return {schemeId:"smithy.api#noAuth"}}var We=e=>{let t=[];return e.operation==="CreateToken"?t.push(yt()):t.push(Dt(e)),t},Je=e=>{let t=k$1(e);return Object.assign(t,{authSchemePreference:h$2(e.authSchemePreference??[])})};g();var Xe=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??false,useFipsEndpoint:e.useFipsEndpoint??false,defaultSigningName:"sso-oauth"}),Qe={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};g();g();g();g();var S="ref",E=-1,v=true,Ze="isSet",ot="PartitionResult",I="booleanEquals",M="getAttr",et={[S]:"Endpoint"},G={[S]:ot},x={},tt=[{[S]:"Region"}],rt={conditions:[[Ze,[et]],[Ze,tt],["aws.partition",tt,ot],[I,[{[S]:"UseFIPS"},v]],[I,[{[S]:"UseDualStack"},v]],[I,[{fn:M,argv:[G,"supportsDualStack"]},v]],[I,[{fn:M,argv:[G,"supportsFIPS"]},v]],["stringEquals",[{fn:M,argv:[G,"name"]},"aws-us-gov"]]],results:[[E],[E,"Invalid Configuration: FIPS and custom endpoint are not supported"],[E,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[et,x],["https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",x],[E,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://oidc.{Region}.amazonaws.com",x],["https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",x],[E,"FIPS is enabled but this partition does not support FIPS"],["https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",x],[E,"DualStack is enabled but this partition does not support DualStack"],["https://oidc.{Region}.{PartitionResult#dnsSuffix}",x],[E,"Invalid Configuration: Missing Region"]]},Tt=2,d=1e8,Rt=new Int32Array([-1,1,-1,0,13,3,1,4,d+12,2,5,d+12,3,8,6,4,7,d+11,5,d+9,d+10,4,11,9,6,10,d+8,7,d+6,d+7,5,12,d+5,6,d+4,d+5,3,d+1,14,4,d+2,d+3]),nt=p.from(Rt,Tt,rt.conditions,rt.results);var kt=new q({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),it=(e,t={})=>kt.get(e,()=>s$1(nt,{endpointParams:e,logger:t.logger}));r.aws=R$1;g();g();g();var s=class e extends f$1{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype);}};var P=class e extends s{name="AccessDeniedException";$fault="client";error;reason;error_description;constructor(t){super({name:"AccessDeniedException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.reason=t.reason,this.error_description=t.error_description;}},C=class e extends s{name="AuthorizationPendingException";$fault="client";error;error_description;constructor(t){super({name:"AuthorizationPendingException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.error_description=t.error_description;}},O=class e extends s{name="ExpiredTokenException";$fault="client";error;error_description;constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.error_description=t.error_description;}},A=class e extends s{name="InternalServerException";$fault="server";error;error_description;constructor(t){super({name:"InternalServerException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.error_description=t.error_description;}},D=class e extends s{name="InvalidClientException";$fault="client";error;error_description;constructor(t){super({name:"InvalidClientException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.error_description=t.error_description;}},y=class e extends s{name="InvalidGrantException";$fault="client";error;error_description;constructor(t){super({name:"InvalidGrantException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.error_description=t.error_description;}},T=class e extends s{name="InvalidRequestException";$fault="client";error;reason;error_description;constructor(t){super({name:"InvalidRequestException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.reason=t.reason,this.error_description=t.error_description;}},R=class e extends s{name="InvalidScopeException";$fault="client";error;error_description;constructor(t){super({name:"InvalidScopeException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.error_description=t.error_description;}},k=class e extends s{name="SlowDownException";$fault="client";error;error_description;constructor(t){super({name:"SlowDownException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.error_description=t.error_description;}},w=class e extends s{name="UnauthorizedClientException";$fault="client";error;error_description;constructor(t){super({name:"UnauthorizedClientException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.error_description=t.error_description;}},N=class e extends s{name="UnsupportedGrantTypeException";$fault="client";error;error_description;constructor(t){super({name:"UnsupportedGrantTypeException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.error_description=t.error_description;}};var wt="AccessDeniedException",Nt="AuthorizationPendingException",bt="AccessToken",$t="ClientSecret",Ut="CreateToken",Ht="CreateTokenRequest",Ft="CreateTokenResponse",Mt="CodeVerifier",Gt="ExpiredTokenException",jt="InvalidClientException",Kt="InvalidGrantException",Vt="InvalidRequestException",zt="InternalServerException",qt="InvalidScopeException",Lt="IdToken",Bt="RefreshToken",Yt="SlowDownException",Wt="UnauthorizedClientException",Jt="UnsupportedGrantTypeException",Xt="accessToken",f="client",Qt="clientId",Zt="clientSecret",er="codeVerifier",tr="code",rr="deviceCode",o="error",or="expiresIn",l="error_description",nr="grantType",ir="http",h="httpError",sr="idToken",st="reason",ct="refreshToken",cr="redirectUri",at="smithy.ts.sdk.synthetic.com.amazonaws.ssooidc",ar="scope",pr="server",dr="tokenType",n="com.amazonaws.ssooidc",pt=n$1.for(at),ur=[-3,at,"SSOOIDCServiceException",0,[],[]];pt.registerError(ur,s);var u=n$1.for(n),mr=[-3,n,wt,{[o]:f,[h]:400},[o,st,l],[0,0,0]];u.registerError(mr,P);var lr=[-3,n,Nt,{[o]:f,[h]:400},[o,l],[0,0]];u.registerError(lr,C);var hr=[-3,n,Gt,{[o]:f,[h]:400},[o,l],[0,0]];u.registerError(hr,O);var fr=[-3,n,zt,{[o]:pr,[h]:500},[o,l],[0,0]];u.registerError(fr,A);var gr=[-3,n,jt,{[o]:f,[h]:401},[o,l],[0,0]];u.registerError(gr,D);var Er=[-3,n,Kt,{[o]:f,[h]:400},[o,l],[0,0]];u.registerError(Er,y);var xr=[-3,n,Vt,{[o]:f,[h]:400},[o,st,l],[0,0,0]];u.registerError(xr,T);var Sr=[-3,n,qt,{[o]:f,[h]:400},[o,l],[0,0]];u.registerError(Sr,R);var _r=[-3,n,Yt,{[o]:f,[h]:400},[o,l],[0,0]];u.registerError(_r,k);var vr=[-3,n,Wt,{[o]:f,[h]:400},[o,l],[0,0]];u.registerError(vr,w);var Ir=[-3,n,Jt,{[o]:f,[h]:400},[o,l],[0,0]];u.registerError(Ir,N);var dt=[pt,u],Pr=[0,n,bt,8,0],Cr=[0,n,$t,8,0],Or=[0,n,Mt,8,0],Ar=[0,n,Lt,8,0],ut=[0,n,Bt,8,0],Dr=[3,n,Ht,0,[Qt,Zt,nr,rr,tr,ct,ar,cr,er],[0,[()=>Cr,0],0,0,0,[()=>ut,0],64,0,[()=>Or,0]],3],yr=[3,n,Ft,0,[Xt,dr,or,ct,sr],[[()=>Pr,0],0,1,[()=>ut,0],[()=>Ar,0]]];var mt=[9,n,Ut,{[ir]:["POST","/token",200]},()=>Dr,()=>yr];var lt=e=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??b$1,base64Encoder:e?.base64Encoder??d$3,disableHostPrefix:e?.disableHostPrefix??false,endpointProvider:e?.endpointProvider??it,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??We,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new f$2},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new J}],logger:e?.logger??new m,protocol:e?.protocol??c$2,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.ssooidc",errorTypeRegistries:dt,version:"2019-06-10",serviceTarget:"AWSSSOOIDCService"},serviceId:e?.serviceId??"SSO OIDC",sha256:e?.sha256??d$2,urlParser:e?.urlParser??i$1,utf8Decoder:e?.utf8Decoder??c$1,utf8Encoder:e?.utf8Encoder??e$1});var ht=e=>{i(process.version);let t=I$2(e),i$1=()=>t().then(h$3),m=lt(e);a(process.version);let p={profile:e?.profile,logger:m.logger};return {...m,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??C$2(h$1,p),bodyLengthChecker:e?.bodyLengthChecker??u$2,defaultUserAgentProvider:e?.defaultUserAgentProvider??P$1({serviceId:m.serviceId,clientVersion:a$2.version}),maxAttempts:e?.maxAttempts??C$2(w$1,e),region:e?.region??C$2(F,{...G$2,...p}),requestHandler:a$1.create(e?.requestHandler??i$1),retryMode:e?.retryMode??C$2({...y$1,default:async()=>(await i$1()).retryMode||v$1},e),streamCollector:e?.streamCollector??z$1,useDualstackEndpoint:e?.useDualstackEndpoint??C$2(D$2,p),useFipsEndpoint:e?.useFipsEndpoint??C$2(E$2,p),userAgentAppId:e?.userAgentAppId??C$2(Q,p)}};g();g();var ft=e=>{let t=e.httpAuthSchemes,i=e.httpAuthSchemeProvider,m=e.credentials;return {setHttpAuthScheme(p){let _=t.findIndex(U=>U.schemeId===p.schemeId);_===-1?t.push(p):t.splice(_,1,p);},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(p){i=p;},httpAuthSchemeProvider(){return i},setCredentials(p){m=p;},credentials(){return m}}},gt=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()});var Et=(e,t)=>{let i=Object.assign(T$2(e),j$1(e),R$2(e),ft(e));return t.forEach(m=>m.configure(i)),Object.assign(e,U(i),k$2(i),S$1(i),gt(i))};var b=class extends c{config;constructor(...[t$1]){let i=ht(t$1||{});super(i),this.initConfig=i;let m=Xe(i),p=N$1(m),_=x$1(p),U=H(_),vt=U,It=t(vt),Pt=Je(It),Ct=Et(Pt,t$1?.extensions||[]);this.config=Ct,this.middlewareStack.use(l$1(this.config)),this.middlewareStack.use(O$1(this.config)),this.middlewareStack.use(z(this.config)),this.middlewareStack.use(T$1(this.config)),this.middlewareStack.use(B(this.config)),this.middlewareStack.use(C$1(this.config)),this.middlewareStack.use(D$1(this.config)),this.middlewareStack.use(E$1(this.config,{httpAuthSchemeParametersProvider:Ye,identityProviderConfigProvider:async Ot=>new I$1({"aws.auth#sigv4":Ot.credentials})})),this.middlewareStack.use(G$1(this.config));}destroy(){super.destroy();}};g();g();g();var xt=n$2(Qe,"AWSSSOOIDCService","SSOOIDCClient",u$1),St={},_t=(e,t,i,m)=>[];var $=class extends xt(St,_t,"CreateToken",mt){};var Tr={CreateTokenCommand:$},j=class extends b{};e(Tr,j);g();var pn={KMS_ACCESS_DENIED:"KMS_AccessDeniedException"},dn={KMS_DISABLED_KEY:"KMS_DisabledException",KMS_INVALID_KEY_USAGE:"KMS_InvalidKeyUsageException",KMS_INVALID_STATE:"KMS_InvalidStateException",KMS_KEY_NOT_FOUND:"KMS_NotFoundException"};
|
|
3
3
|
export{P as AccessDeniedException,mr as AccessDeniedException$,pn as AccessDeniedExceptionReason,C as AuthorizationPendingException,lr as AuthorizationPendingException$,mt as CreateToken$,$ as CreateTokenCommand,Dr as CreateTokenRequest$,yr as CreateTokenResponse$,O as ExpiredTokenException,hr as ExpiredTokenException$,A as InternalServerException,fr as InternalServerException$,D as InvalidClientException,gr as InvalidClientException$,y as InvalidGrantException,Er as InvalidGrantException$,T as InvalidRequestException,xr as InvalidRequestException$,dn as InvalidRequestExceptionReason,R as InvalidScopeException,Sr as InvalidScopeException$,j as SSOOIDC,b as SSOOIDCClient,s as SSOOIDCServiceException,ur as SSOOIDCServiceException$,k as SlowDownException,_r as SlowDownException$,w as UnauthorizedClientException,vr as UnauthorizedClientException$,N as UnsupportedGrantTypeException,Ir as UnsupportedGrantTypeException$,dt as errorTypeRegistries};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {a as a$2}from'./chunk-L3Q64RUX.js';import {a as a$3}from'./chunk-IKGVPXMK.js';import {f as f$1,g as g$2,j,h,k,i as i$1,d as d$1}from'./chunk-YUUXFD73.js';import {a as a$1}from'./chunk-LVBHOZZF.js';import {p,q as q$1,R as R$1,r,n as n$1,u as u$1,e,f,c as c$1,N as N$1,x,t,O as O$1,z as z$1,B as B$1,C as C$1,D as D$1,E,I as I$1,G as G$1,i,a,J as J$1,Q as Q$1,v,y,w as w$1,P,T as T$2,j as j$1,U,k as k$1,m as m$1,h as h$2,o,s as s$1,b as b$2,S as S$1}from'./chunk-OBYAIJVU.js';export{d as $Command,c as __Client}from'./chunk-OBYAIJVU.js';import {n,H as H$1,l,T as T$1,I as I$2,C as C$2,E as E$1,D as D$2,F,G as G$2,h as h$1,R as R$2,S,i as i$2,d as d$3}from'./chunk-JRUQ5ABB.js';import {d}from'./chunk-U6KFONKM.js';import {z as z$2,u as u$2,e as e$1,c as c$2,d as d$2,b as b$1}from'./chunk-TYQYKKWJ.js';import {g as g$1}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g$1();g$1();g$1();g$1();g$1();var N="ref",R=-1,$=true,vt="isSet",Tt="PartitionResult",L="booleanEquals",u="stringEquals",ie="getAttr",yt="us-east-1",xt="sigv4",It="sts",Rt="https://sts.{Region}.{PartitionResult#dnsSuffix}",_t={[N]:"Endpoint"},m={[N]:"Region"},ae={[N]:Tt},O={},Ct=[m],wt={conditions:[[vt,[_t]],[vt,Ct],["aws.partition",Ct,Tt],[L,[{[N]:"UseFIPS"},$]],[L,[{[N]:"UseDualStack"},$]],[u,[m,"aws-global"]],[L,[{[N]:"UseGlobalEndpoint"},$]],[u,[m,"eu-central-1"]],[L,[{fn:ie,argv:[ae,"supportsDualStack"]},$]],[L,[{fn:ie,argv:[ae,"supportsFIPS"]},$]],[u,[m,"ap-south-1"]],[u,[m,"eu-north-1"]],[u,[m,"eu-west-1"]],[u,[m,"eu-west-2"]],[u,[m,"eu-west-3"]],[u,[m,"sa-east-1"]],[u,[m,yt]],[u,[m,"us-east-2"]],[u,[m,"us-west-2"]],[u,[m,"us-west-1"]],[u,[m,"ca-central-1"]],[u,[m,"ap-southeast-1"]],[u,[m,"ap-northeast-1"]],[u,[m,"ap-southeast-2"]],[u,[{fn:ie,argv:[ae,"name"]},"aws-us-gov"]]],results:[[R],["https://sts.amazonaws.com",{authSchemes:[{name:xt,signingName:It,signingRegion:yt}]}],[Rt,{authSchemes:[{name:xt,signingName:It,signingRegion:"{Region}"}]}],[R,"Invalid Configuration: FIPS and custom endpoint are not supported"],[R,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[_t,O],["https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",O],[R,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://sts.{Region}.amazonaws.com",O],["https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",O],[R,"FIPS is enabled but this partition does not support FIPS"],["https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",O],[R,"DualStack is enabled but this partition does not support DualStack"],[Rt,O],[R,"Invalid Configuration: Missing Region"]]},lo=2,s=1e8,uo=new Int32Array([-1,1,-1,0,30,3,1,4,s+14,2,5,s+14,3,25,6,4,24,7,5,s+1,8,6,9,s+13,7,s+1,10,10,s+1,11,11,s+1,12,12,s+1,13,13,s+1,14,14,s+1,15,15,s+1,16,16,s+1,17,17,s+1,18,18,s+1,19,19,s+1,20,20,s+1,21,21,s+1,22,22,s+1,23,23,s+1,s+2,8,s+11,s+12,4,28,26,9,27,s+10,24,s+8,s+9,8,29,s+7,9,s+6,s+7,3,s+3,31,4,s+4,s+5]),Dt=p.from(uo,lo,wt.conditions,wt.results);var mo=new q$1({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),G=(e,t={})=>mo.get(e,()=>s$1(Dt,{endpointParams:e,logger:t.logger}));r.aws=R$1;var go=e=>async(t,o$1,a)=>{if(!a)throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");let r=await e(t,o$1,a),p=d$3(o$1)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!p)throw new Error(`getEndpointParameterInstructions() is not defined on '${o$1.commandName}'`);let i=await o(a,{getEndpointParameterInstructions:p},t);return Object.assign(r,i)},fo=async(e,t,o)=>({operation:d$3(t).operation,region:await h$1(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),bt=go(fo);function kt(e){return {schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(t,o)=>({signingProperties:{config:t,context:o}})}}function ce(e){return {schemeId:"aws.auth#sigv4a",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(t,o)=>({signingProperties:{config:t,context:o}})}}function Ot(e){return {schemeId:"smithy.api#noAuth"}}var ho=(e,t,o)=>r=>{let i=e(r).properties?.authSchemes;if(!i)return t(r);let f=[];for(let A of i){let{name:h,properties:y={},...S}=A,E=h.toLowerCase();h!==E&&console.warn(`HttpAuthScheme has been normalized with lowercasing: '${h}' to '${E}'`);let P;if(E==="sigv4a"){P="aws.auth#sigv4a";let te=i.find(oe=>{let me=oe.name.toLowerCase();return me!=="sigv4a"&&me.startsWith("sigv4")});if(a$3.sigv4aDependency()==="none"&&te)continue}else if(E.startsWith("sigv4"))P="aws.auth#sigv4";else throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${E}'`);let k=o[P];if(!k)throw new Error(`Could not find HttpAuthOption create function for '${P}'`);let x=k(r);x.schemeId=P,x.signingProperties={...x.signingProperties||{},...S,...y},f.push(x);}return f},So=e=>{let t=[];return e.operation==="AssumeRoleWithWebIdentity"?(t.push(Ot()),t.push(ce(e))):(t.push(kt(e)),t.push(ce(e))),t},Nt=ho(G,So,{"aws.auth#sigv4":kt,"aws.auth#sigv4a":ce,"smithy.api#noAuth":Ot}),Ht=e=>{let t=k(e),o=i$1(t);return Object.assign(o,{authSchemePreference:h$1(e.authSchemePreference??[])})};g$1();var Wt=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??false,useFipsEndpoint:e.useFipsEndpoint??false,useGlobalEndpoint:e.useGlobalEndpoint??false,defaultSigningName:"sts"}),$t={UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};g$1();g$1();g$1();g$1();g$1();var g=class e extends f{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype);}};var V=class e extends g{name="ExpiredTokenException";$fault="client";constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype);}},q=class e extends g{name="MalformedPolicyDocumentException";$fault="client";constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype);}},z=class e extends g{name="PackedPolicyTooLargeException";$fault="client";constructor(t){super({name:"PackedPolicyTooLargeException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype);}},B=class e extends g{name="RegionDisabledException";$fault="client";constructor(t){super({name:"RegionDisabledException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype);}},Q=class e extends g{name="IDPRejectedClaimException";$fault="client";constructor(t){super({name:"IDPRejectedClaimException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype);}},Y=class e extends g{name="InvalidIdentityTokenException";$fault="client";constructor(t){super({name:"InvalidIdentityTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype);}},X=class e extends g{name="IDPCommunicationErrorException";$fault="client";$retryable={};constructor(t){super({name:"IDPCommunicationErrorException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype);}};var Po="Arn",Ao="AccessKeyId",Eo="AssumeRole",vo="AssumedRoleId",yo="AssumeRoleRequest",xo="AssumeRoleResponse",pe="AssumedRoleUser",Io="AssumeRoleWithWebIdentity",Ro="AssumeRoleWithWebIdentityRequest",_o="AssumeRoleWithWebIdentityResponse",Co="Audience",de="Credentials",wo="ContextAssertion",Lt="DurationSeconds",To="Expiration",Do="ExternalId",bo="ExpiredTokenException",ko="IDPCommunicationErrorException",Oo="IDPRejectedClaimException",No="InvalidIdentityTokenException",Ho="Key",Wo="MalformedPolicyDocumentException",Ft="Policy",Ut="PolicyArns",$o="ProviderArn",Lo="ProvidedContexts",Fo="ProvidedContextsListType",Uo="ProvidedContext",Ko="PolicyDescriptorType",Mo="ProviderId",Kt="PackedPolicySize",jo="PackedPolicyTooLargeException",Go="Provider",Mt="RoleArn",Vo="RegionDisabledException",jt="RoleSessionName",qo="SecretAccessKey",zo="SubjectFromWebIdentityToken",le="SourceIdentity",Bo="SerialNumber",Qo="SessionToken",Yo="Tags",Xo="TokenCode",Jo="TransitiveTagKeys",Zo="Tag",er="Value",tr="WebIdentityToken",or="arn",rr="accessKeySecretType",_="awsQueryError",C="client",nr="clientTokenType",w="error",T="httpError",D="message",sr="policyDescriptorListType",Gt="smithy.ts.sdk.synthetic.com.amazonaws.sts",ir="tagListType",c="com.amazonaws.sts",Vt=n.for(Gt),ar=[-3,Gt,"STSServiceException",0,[],[]];Vt.registerError(ar,g);var I=n.for(c),cr=[-3,c,bo,{[_]:["ExpiredTokenException",400],[w]:C,[T]:400},[D],[0]];I.registerError(cr,V);var pr=[-3,c,ko,{[_]:["IDPCommunicationError",400],[w]:C,[T]:400},[D],[0]];I.registerError(pr,X);var dr=[-3,c,Oo,{[_]:["IDPRejectedClaim",403],[w]:C,[T]:403},[D],[0]];I.registerError(dr,Q);var lr=[-3,c,No,{[_]:["InvalidIdentityToken",400],[w]:C,[T]:400},[D],[0]];I.registerError(lr,Y);var ur=[-3,c,Wo,{[_]:["MalformedPolicyDocument",400],[w]:C,[T]:400},[D],[0]];I.registerError(ur,q);var mr=[-3,c,jo,{[_]:["PackedPolicyTooLarge",400],[w]:C,[T]:400},[D],[0]];I.registerError(mr,z);var gr=[-3,c,Vo,{[_]:["RegionDisabledException",403],[w]:C,[T]:403},[D],[0]];I.registerError(gr,B);var qt=[Vt,I],fr=[0,c,rr,8,0],hr=[0,c,nr,8,0],zt=[3,c,pe,0,[vo,Po],[0,0],2],Sr=[3,c,yo,0,[Mt,jt,Ut,Ft,Lt,Yo,Jo,Do,Bo,Xo,le,Lo],[0,0,()=>Qt,0,1,()=>Rr,64,0,0,0,0,()=>Ir],2],Pr=[3,c,xo,0,[de,pe,Kt,le],[[()=>Bt,0],()=>zt,1,0]],Ar=[3,c,Ro,0,[Mt,jt,tr,Mo,Ut,Ft,Lt],[0,0,[()=>hr,0],0,()=>Qt,0,1],3],Er=[3,c,_o,0,[de,zo,pe,Kt,Go,Co,le],[[()=>Bt,0],0,()=>zt,1,0,0,0]],Bt=[3,c,de,0,[Ao,qo,Qo,To],[0,[()=>fr,0],0,4],4],vr=[3,c,Ko,0,[or],[0]],yr=[3,c,Uo,0,[$o,wo],[0,0]],xr=[3,c,Zo,0,[Ho,er],[0,0],2],Qt=[1,c,sr,0,()=>vr],Ir=[1,c,Fo,0,()=>yr];var Rr=[1,c,ir,0,()=>xr],Yt=[9,c,Eo,0,()=>Sr,()=>Pr],Xt=[9,c,Io,0,()=>Ar,()=>Er];var Jt=e=>({apiVersion:"2011-06-15",base64Decoder:e?.base64Decoder??b$1,base64Encoder:e?.base64Encoder??d$2,disableHostPrefix:e?.disableHostPrefix??false,endpointProvider:e?.endpointProvider??G,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Nt,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new f$1},{schemeId:"aws.auth#sigv4a",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4a"),signer:new g$2},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new J$1}],logger:e?.logger??new m$1,protocol:e?.protocol??d$1,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",errorTypeRegistries:qt,xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:e?.serviceId??"STS",sha256:e?.sha256??d,signerConstructor:e?.signerConstructor??a$3,urlParser:e?.urlParser??i$2,utf8Decoder:e?.utf8Decoder??c$2,utf8Encoder:e?.utf8Encoder??e$1});var Zt=e=>{i(process.version);let t=I$2(e),o=()=>t().then(h$2),a$3=Jt(e);a(process.version);let r={profile:e?.profile,logger:a$3.logger};return {...a$3,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??C$2(h,r),bodyLengthChecker:e?.bodyLengthChecker??u$2,defaultUserAgentProvider:e?.defaultUserAgentProvider??P({serviceId:a$3.serviceId,clientVersion:a$2.version}),httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:p=>p.getIdentityProvider("aws.auth#sigv4")||(async i=>await e.credentialDefaultProvider(i?.__config||{})()),signer:new f$1},{schemeId:"aws.auth#sigv4a",identityProvider:p=>p.getIdentityProvider("aws.auth#sigv4a"),signer:new g$2},{schemeId:"smithy.api#noAuth",identityProvider:p=>p.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new J$1}],maxAttempts:e?.maxAttempts??C$2(w$1,e),region:e?.region??C$2(F,{...G$2,...r}),requestHandler:a$1.create(e?.requestHandler??o),retryMode:e?.retryMode??C$2({...y,default:async()=>(await o()).retryMode||v},e),sigv4aSigningRegionSet:e?.sigv4aSigningRegionSet??C$2(j,r),streamCollector:e?.streamCollector??z$2,useDualstackEndpoint:e?.useDualstackEndpoint??C$2(D$2,r),useFipsEndpoint:e?.useFipsEndpoint??C$2(E$1,r),userAgentAppId:e?.userAgentAppId??C$2(Q$1,r)}};g$1();g$1();var eo=e=>{let t=e.httpAuthSchemes,o=e.httpAuthSchemeProvider,a=e.credentials;return {setHttpAuthScheme(r){let p=t.findIndex(i=>i.schemeId===r.schemeId);p===-1?t.push(r):t.splice(p,1,r);},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(r){o=r;},httpAuthSchemeProvider(){return o},setCredentials(r){a=r;},credentials(){return a}}},to=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()});var oo=(e,t)=>{let o=Object.assign(T$2(e),j$1(e),R$2(e),eo(e));return t.forEach(a=>a.configure(o)),Object.assign(e,U(o),k$1(o),S(o),to(o))};var b=class extends c$1{config;constructor(...[t$1]){let o=Zt(t$1||{});super(o),this.initConfig=o;let a=Wt(o),r=N$1(a),p=x(r),i=H$1(p),f=i,A=t(f),h=Ht(A),y=oo(h,t$1?.extensions||[]);this.config=y,this.middlewareStack.use(l(this.config)),this.middlewareStack.use(O$1(this.config)),this.middlewareStack.use(z$1(this.config)),this.middlewareStack.use(T$1(this.config)),this.middlewareStack.use(B$1(this.config)),this.middlewareStack.use(C$1(this.config)),this.middlewareStack.use(D$1(this.config)),this.middlewareStack.use(E(this.config,{httpAuthSchemeParametersProvider:bt,identityProviderConfigProvider:async S=>new I$1({"aws.auth#sigv4":S.credentials,"aws.auth#sigv4a":S.credentials})})),this.middlewareStack.use(G$1(this.config));}destroy(){super.destroy();}};g$1();g$1();g$1();var J=n$1($t,"AWSSecurityTokenServiceV20110615","STSClient",u$1),Z={},ee=(e,t,o,a)=>[];var H=class extends J(Z,ee,"AssumeRole",Yt){};g$1();var W=class extends J(Z,ee,"AssumeRoleWithWebIdentity",Xt){};var _r={AssumeRoleCommand:H,AssumeRoleWithWebIdentityCommand:W},ue=class extends b{};e(_r,ue);g$1();g$1();var ro=e=>{if(typeof e?.Arn=="string"){let t=e.Arn.split(":");if(t.length>4&&t[4]!=="")return t[4]}},no=async(e,t,o,a={})=>{let r=typeof e=="function"?await e():e,p=typeof t=="function"?await t():t,i="",f=r??p??(i=await S$1(a)());return o?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${r} (credential provider clientConfig)`,`${p} (contextual client)`,`${i} (STS default: AWS_REGION, profile region, or us-east-1)`),f},so=(e,t)=>{let o,a;return async(r,p)=>{if(a=r,!o){let{logger:y=e?.parentClientConfig?.logger,profile:S=e?.parentClientConfig?.profile,region:E,requestHandler:P=e?.parentClientConfig?.requestHandler,credentialProviderLogger:k,userAgentAppId:x=e?.parentClientConfig?.userAgentAppId}=e,te=await no(E,e?.parentClientConfig?.region,k,{logger:y,profile:S}),oe=!ao(P);o=new t({...e,userAgentAppId:x,profile:S,credentialDefaultProvider:()=>async()=>a,region:te,requestHandler:oe?P:void 0,logger:y});}let{Credentials:i,AssumedRoleUser:f}=await o.send(new H(p));if(!i||!i.AccessKeyId||!i.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${p.RoleArn}`);let A=ro(f),h={accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,sessionToken:i.SessionToken,expiration:i.Expiration,...i.CredentialScope&&{credentialScope:i.CredentialScope},...A&&{accountId:A}};return b$2(h,"CREDENTIALS_STS_ASSUME_ROLE","i"),h}},io=(e,t)=>{let o;return async a=>{if(!o){let{logger:A=e?.parentClientConfig?.logger,profile:h=e?.parentClientConfig?.profile,region:y,requestHandler:S=e?.parentClientConfig?.requestHandler,credentialProviderLogger:E,userAgentAppId:P=e?.parentClientConfig?.userAgentAppId}=e,k=await no(y,e?.parentClientConfig?.region,E,{logger:A,profile:h}),x=!ao(S);o=new t({...e,userAgentAppId:P,profile:h,region:k,requestHandler:x?S:void 0,logger:A});}let{Credentials:r,AssumedRoleUser:p}=await o.send(new W(a));if(!r||!r.AccessKeyId||!r.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${a.RoleArn}`);let i=ro(p),f={accessKeyId:r.AccessKeyId,secretAccessKey:r.SecretAccessKey,sessionToken:r.SessionToken,expiration:r.Expiration,...r.CredentialScope&&{credentialScope:r.CredentialScope},...i&&{accountId:i}};return i&&b$2(f,"RESOLVED_ACCOUNT_ID","T"),b$2(f,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),f}},ao=e=>e?.metadata?.handlerProtocol==="h2";var co=(e,t)=>t?class extends e{constructor(a){super(a);for(let r of t)this.middlewareStack.use(r);}}:e,Cr=(e={},t)=>so(e,co(b,t)),wr=(e={},t)=>io(e,co(b,t)),Rs=e=>t=>e({roleAssumer:Cr(t),roleAssumerWithWebIdentity:wr(t),...t});
|
|
3
3
|
export{Yt as AssumeRole$,H as AssumeRoleCommand,Sr as AssumeRoleRequest$,Pr as AssumeRoleResponse$,Xt as AssumeRoleWithWebIdentity$,W as AssumeRoleWithWebIdentityCommand,Ar as AssumeRoleWithWebIdentityRequest$,Er as AssumeRoleWithWebIdentityResponse$,zt as AssumedRoleUser$,Bt as Credentials$,V as ExpiredTokenException,cr as ExpiredTokenException$,X as IDPCommunicationErrorException,pr as IDPCommunicationErrorException$,Q as IDPRejectedClaimException,dr as IDPRejectedClaimException$,Y as InvalidIdentityTokenException,lr as InvalidIdentityTokenException$,q as MalformedPolicyDocumentException,ur as MalformedPolicyDocumentException$,z as PackedPolicyTooLargeException,mr as PackedPolicyTooLargeException$,vr as PolicyDescriptorType$,yr as ProvidedContext$,B as RegionDisabledException,gr as RegionDisabledException$,ue as STS,b as STSClient,g as STSServiceException,ar as STSServiceException$,xr as Tag$,Rs as decorateDefaultCredentialProvider,qt as errorTypeRegistries,Cr as getDefaultRoleAssumer,wr as getDefaultRoleAssumerWithWebIdentity};
|
package/dist/templates/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{g as accessSettingsGlobal,k as allGlobalSettings,q as blogCollections,e as brandSettingsGlobal,S as brandsCollection,T as brandsCollections,A as categoriesCollection,B as categoriesCollections,l as coreGlobalSettings,K as couponsCollection,L as couponsCollections,V as createTemplateConfig,G as customersCollection,H as customersCollections,r as ecommerceCollections,s as ecommerceGlobals,f as emailSettingsGlobal,O as formEntriesCollection,P as formEntriesCollections,M as formsCollection,N as formsCollections,n as getSettingsForTemplate,t as kitchenSinkCollections,u as mediaCollection,v as mediaCollections,w as menuCollection,x as menuCollections,a as minimalCollections,I as ordersCollection,J as ordersCollections,y as pageCollection,z as pageCollections,o as postsCollection,p as postsCollections,C as productCategoriesCollection,D as productCategoriesCollections,E as productsCollection,F as productsCollections,Q as reviewsCollection,R as reviewsCollections,d as seoSettingsGlobal,m as settingsBySlug,i as shippingSettingsGlobal,c as siteSettingsGlobal,b as starterCollections,h as storeSettingsGlobal,j as systemSettingsGlobal,U as templateCollections}from'../chunk-7N7U2ERH.js';export{a as storageSettingsGlobal}from'../chunk-LWM4WABU.js';export{b as authCollections}from'../chunk-CIVA6SKW.js';import'../chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
package/dist/trpc/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{a as createContext,g as createCountProcedure,d as createCreateProcedure,f as createDeleteProcedure,h as createDynamicRouter,c as createFindByIDProcedure,b as createFindProcedure,i as createKyroServer,e as createUpdateProcedure}from'../chunk-PA4ZZREG.js';import'../chunk-YZEMLLD2.js';import'../chunk-RTHJ6SS5.js';import'../chunk-VVVCCB6R.js';import'../chunk-TBHNE4VV.js';import'../chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
package/dist/ws/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{b as KyroPubSub,c as KyroWSServer,a as PubSub,d as createWSServer}from'../chunk-5M3FKE2V.js';import'../chunk-7MNDQU6K.js';import'../chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kyro-cms/core",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.49",
|
|
4
4
|
"description": "Astro-native headless CMS with multi-database adapters, multi-protocol APIs, and multi-vendor support",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
"ws": "^8.18.0",
|
|
192
192
|
"zod": "^3.24.0",
|
|
193
193
|
"zod-to-json-schema": "^3.25.2",
|
|
194
|
-
"@kyro-cms/ai": "0.12.
|
|
194
|
+
"@kyro-cms/ai": "0.12.49"
|
|
195
195
|
},
|
|
196
196
|
"devDependencies": {
|
|
197
197
|
"@tailwindcss/vite": "^4.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {createRequire}from'module';export{e as autoBootstrap,a as bootstrapAdmin,f as bootstrapWithRetry,c as buildBootstrapConfig,b as checkBootstrapRequired,d as getBootstrapFromEnv}from'./chunk-DS5DE5BU.js';import'./chunk-45TJAB5X.js';import'./chunk-R4LXRAMX.js';import'./chunk-XBH4YMC7.js';import'./chunk-7AQSH3KR.js';import'./chunk-BPMA2ECA.js';import'./chunk-C2PXMVR5.js';createRequire(import.meta.url);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkQYI3GOHF_cjs=require('./chunk-QYI3GOHF.cjs');require('./chunk-P7XYIKL6.cjs'),require('./chunk-HPYH7GTS.cjs'),require('./chunk-BHR7OAU4.cjs'),require('./chunk-VRZC4TTF.cjs'),require('./chunk-HTYVI2HK.cjs'),require('./chunk-BUNLC3II.cjs');Object.defineProperty(exports,"autoBootstrap",{enumerable:true,get:function(){return chunkQYI3GOHF_cjs.e}});Object.defineProperty(exports,"bootstrapAdmin",{enumerable:true,get:function(){return chunkQYI3GOHF_cjs.a}});Object.defineProperty(exports,"bootstrapWithRetry",{enumerable:true,get:function(){return chunkQYI3GOHF_cjs.f}});Object.defineProperty(exports,"buildBootstrapConfig",{enumerable:true,get:function(){return chunkQYI3GOHF_cjs.c}});Object.defineProperty(exports,"checkBootstrapRequired",{enumerable:true,get:function(){return chunkQYI3GOHF_cjs.b}});Object.defineProperty(exports,"getBootstrapFromEnv",{enumerable:true,get:function(){return chunkQYI3GOHF_cjs.d}});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),promises=require('fs/promises'),f=require('path'),stream=require('stream'),fs=require('fs'),os=require('os'),events=require('events');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 f__namespace=/*#__PURE__*/_interopNamespace(f);function Z(r,t={}){let e=t.entryType||t.type;if(e==="both"&&(e=E.FILE_DIR_TYPE),e&&(t.type=e),r){if(typeof r!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(e&&!$.includes(e))throw new Error(`readdirp: Invalid type passed. Use one of ${$.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return t.root=r,new C(t)}var E,L,X,bt,$,Dt,It,Tt,vt,q,J,C,tt=chunkBUNLC3II_cjs.b(()=>{chunkBUNLC3II_cjs.h();E={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},L={root:".",fileFilter:r=>true,directoryFilter:r=>true,type:E.FILE_TYPE,lstat:false,depth:2147483648,alwaysStat:false,highWaterMark:4096};Object.freeze(L);X="READDIRP_RECURSIVE_ERROR",bt=new Set(["ENOENT","EPERM","EACCES","ELOOP",X]),$=[E.DIR_TYPE,E.EVERYTHING_TYPE,E.FILE_DIR_TYPE,E.FILE_TYPE],Dt=new Set([E.DIR_TYPE,E.EVERYTHING_TYPE,E.FILE_DIR_TYPE]),It=new Set([E.EVERYTHING_TYPE,E.FILE_DIR_TYPE,E.FILE_TYPE]),Tt=r=>bt.has(r.code),vt=process.platform==="win32",q=r=>true,J=r=>{if(r===void 0)return q;if(typeof r=="function")return r;if(typeof r=="string"){let t=r.trim();return e=>e.basename===t}if(Array.isArray(r)){let t=r.map(e=>e.trim());return e=>t.some(i=>e.basename===i)}return q},C=class extends stream.Readable{parents;reading;parent;_stat;_maxDepth;_wantsDir;_wantsFile;_wantsEverything;_root;_isDirent;_statsProp;_rdOptions;_fileFilter;_directoryFilter;constructor(t={}){super({objectMode:true,autoDestroy:true,highWaterMark:t.highWaterMark});let e={...L,...t},{root:i,type:s}=e;this._fileFilter=J(e.fileFilter),this._directoryFilter=J(e.directoryFilter);let n=e.lstat?promises.lstat:promises.stat;vt?this._stat=h=>n(h,{bigint:true}):this._stat=n,this._maxDepth=e.depth!=null&&Number.isSafeInteger(e.depth)?e.depth:L.depth,this._wantsDir=s?Dt.has(s):false,this._wantsFile=s?It.has(s):false,this._wantsEverything=s===E.EVERYTHING_TYPE,this._root=f.resolve(i),this._isDirent=!e.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(i,1)],this.reading=false,this.parent=void 0;}async _read(t){if(!this.reading){this.reading=true;try{for(;!this.destroyed&&t>0;){let e=this.parent,i=e&&e.files;if(i&&i.length>0){let{path:s,depth:n}=e,h=i.splice(0,t).map(a=>this._formatEntry(a,s)),o=await Promise.all(h);for(let a of o){if(!a)continue;if(this.destroyed)return;let l=await this._getEntryType(a);l==="directory"&&this._directoryFilter(a)?(n<=this._maxDepth&&this.parents.push(this._exploreDir(a.fullPath,n+1)),this._wantsDir&&(this.push(a),t--)):(l==="file"||this._includeAsFile(a))&&this._fileFilter(a)&&this._wantsFile&&(this.push(a),t--);}}else {let s=this.parents.pop();if(!s){this.push(null);break}if(this.parent=await s,this.destroyed)return}}}catch(e){this.destroy(e);}finally{this.reading=false;}}}async _exploreDir(t,e){let i;try{i=await promises.readdir(t,this._rdOptions);}catch(s){this._onError(s);}return {files:i,depth:e,path:t}}async _formatEntry(t,e){let i,s=this._isDirent?t.name:t;try{let n=f.resolve(f.join(e,s));i={path:f.relative(this._root,n),fullPath:n,basename:s},i[this._statsProp]=this._isDirent?t:await this._stat(n);}catch(n){this._onError(n);return}return i}_onError(t){Tt(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t);}async _getEntryType(t){if(!t&&this._statsProp in t)return "";let e=t[this._statsProp];if(e.isFile())return "file";if(e.isDirectory())return "directory";if(e&&e.isSymbolicLink()){let i=t.fullPath;try{let s=await promises.realpath(i),n=await promises.lstat(s);if(n.isFile())return "file";if(n.isDirectory()){let h=s.length;if(i.startsWith(s)&&i.substr(h,1)===f.sep){let o=new Error(`Circular symlink detected: "${i}" points to "${s}"`);return o.code=X,this._onError(o)}return "directory"}}catch(s){return this._onError(s),""}}}_includeAsFile(t){let e=t&&t[this._statsProp];return e&&this._wantsEverything&&!e.isDirectory()}};});function st(r,t,e,i,s){let n=(h,o)=>{e(r),s(h,o,{watchedPath:r}),o&&r!==o&&x(f__namespace.resolve(r,o),P,f__namespace.join(r,o));};try{return fs.watch(r,{persistent:t.persistent},n)}catch(h){i(h);return}}var Nt,H,rt,S,A,j,kt,Lt,Ct,nt,p,g,Ot,Mt,P,T,b,zt,Ht,jt,z,D,Yt,I,ot,v,x,Ut,M,Gt,F,at=chunkBUNLC3II_cjs.b(()=>{chunkBUNLC3II_cjs.h();Nt="data",H="end",rt="close",S=()=>{},A=process.platform,j=A==="win32",kt=A==="darwin",Lt=A==="linux",Ct=A==="freebsd",nt=os.type()==="OS400",p={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},g=p,Ot="watch",Mt={lstat:promises.lstat,stat:promises.stat},P="listeners",T="errHandlers",b="rawEmitters",zt=[P,T,b],Ht=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),jt=r=>Ht.has(f__namespace.extname(r).slice(1).toLowerCase()),z=(r,t)=>{r instanceof Set?r.forEach(t):t(r);},D=(r,t,e)=>{let i=r[t];i instanceof Set||(r[t]=i=new Set([i])),i.add(e);},Yt=r=>t=>{let e=r[t];e instanceof Set?e.clear():delete r[t];},I=(r,t,e)=>{let i=r[t];i instanceof Set?i.delete(e):i===e&&delete r[t];},ot=r=>r instanceof Set?r.size===0:!r,v=new Map;x=(r,t,e,i,s)=>{let n=v.get(r);n&&z(n[t],h=>{h(e,i,s);});},Ut=(r,t,e,i)=>{let{listener:s,errHandler:n,rawEmitter:h}=i,o=v.get(t),a;if(!e.persistent)return a=st(r,e,s,n,h),a?a.close.bind(a):void 0;if(o)D(o,P,s),D(o,T,n),D(o,b,h);else {if(a=st(r,e,x.bind(null,t,P),n,x.bind(null,t,b)),!a)return;a.on(g.ERROR,async l=>{let c=x.bind(null,t,T);if(o&&(o.watcherUnusable=true),j&&l.code==="EPERM")try{await(await promises.open(r,"r")).close(),c(l);}catch{}else c(l);}),o={listeners:s,errHandlers:n,rawEmitters:h,watcher:a},v.set(t,o);}return ()=>{I(o,P,s),I(o,T,n),I(o,b,h),ot(o.listeners)&&(o.watcher.close(),v.delete(t),zt.forEach(Yt(o)),o.watcher=void 0,Object.freeze(o));}},M=new Map,Gt=(r,t,e,i)=>{let{listener:s,rawEmitter:n}=i,h=M.get(t),o=h&&h.options;return o&&(o.persistent<e.persistent||o.interval>e.interval)&&(fs.unwatchFile(t),h=void 0),h?(D(h,P,s),D(h,b,n)):(h={listeners:s,rawEmitters:n,options:e,watcher:fs.watchFile(t,e,(a,l)=>{z(h.rawEmitters,u=>{u(g.CHANGE,t,{curr:a,prev:l});});let c=a.mtimeMs;(a.size!==l.size||c>l.mtimeMs||c===0)&&z(h.listeners,u=>u(r,a));})},M.set(t,h)),()=>{I(h,P,s),I(h,b,n),ot(h.listeners)&&(M.delete(t),fs.unwatchFile(t),h.options=h.watcher=void 0,Object.freeze(h));}},F=class{fsw;_boundHandleError;constructor(t){this.fsw=t,this._boundHandleError=e=>t._handleError(e);}_watchWithNodeFs(t,e){let i=this.fsw.options,s=f__namespace.dirname(t),n=f__namespace.basename(t);this.fsw._getWatchedDir(s).add(n);let o=f__namespace.resolve(t),a={persistent:i.persistent};e||(e=S);let l;if(i.usePolling){let c=i.interval!==i.binaryInterval;a.interval=c&&jt(n)?i.binaryInterval:i.interval,l=Gt(t,o,a,{listener:e,rawEmitter:this.fsw._emitRaw});}else l=Ut(t,o,a,{listener:e,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return l}_handleFile(t,e,i){if(this.fsw.closed)return;let s=f__namespace.dirname(t),n=f__namespace.basename(t),h=this.fsw._getWatchedDir(s),o=e;if(h.has(n))return;let a=async(c,u)=>{if(this.fsw._throttle(Ot,t,5)){if(!u||u.mtimeMs===0)try{let d=await promises.stat(t);if(this.fsw.closed)return;let m=d.atimeMs,w=d.mtimeMs;if((!m||m<=w||w!==o.mtimeMs)&&this.fsw._emit(g.CHANGE,t,d),(kt||Lt||Ct)&&o.ino!==d.ino){this.fsw._closeFile(c),o=d;let y=this._watchWithNodeFs(t,a);y&&this.fsw._addPathCloser(c,y);}else o=d;}catch{this.fsw._remove(s,n);}else if(h.has(n)){let d=u.atimeMs,m=u.mtimeMs;(!d||d<=m||m!==o.mtimeMs)&&this.fsw._emit(g.CHANGE,t,u),o=u;}}},l=this._watchWithNodeFs(t,a);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(g.ADD,t,0))return;this.fsw._emit(g.ADD,t,e);}return l}async _handleSymlink(t,e,i,s){if(this.fsw.closed)return;let n=t.fullPath,h=this.fsw._getWatchedDir(e);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let o;try{o=await promises.realpath(i);}catch{return this.fsw._emitReady(),true}return this.fsw.closed?void 0:(h.has(s)?this.fsw._symlinkPaths.get(n)!==o&&(this.fsw._symlinkPaths.set(n,o),this.fsw._emit(g.CHANGE,i,t.stats)):(h.add(s),this.fsw._symlinkPaths.set(n,o),this.fsw._emit(g.ADD,i,t.stats)),this.fsw._emitReady(),true)}if(this.fsw._symlinkPaths.has(n))return true;this.fsw._symlinkPaths.set(n,true);}_handleRead(t,e,i,s,n,h,o){t=f__namespace.join(t,"");let a=s?`${t}:${s}`:t;if(o=this.fsw._throttle("readdir",a,1e3),!o)return;let l=this.fsw._getWatchedDir(i.path),c=new Set,u=this.fsw._readdirp(t,{fileFilter:d=>i.filterPath(d),directoryFilter:d=>i.filterDir(d)});if(u)return u.on(Nt,async d=>{if(this.fsw.closed){u=void 0;return}let m=d.path,w=f__namespace.join(t,m);if(c.add(m),!(d.stats.isSymbolicLink()&&await this._handleSymlink(d,t,w,m))){if(this.fsw.closed){u=void 0;return}(m===s||!s&&!l.has(m))&&(this.fsw._incrReadyCount(),w=f__namespace.join(n,f__namespace.relative(n,w)),this._addToNodeFs(w,e,i,h+1));}}).on(g.ERROR,this._boundHandleError),new Promise((d,m)=>{if(!u)return m();u.once(H,()=>{if(this.fsw.closed){u=void 0;return}let w=o?o.clear():false;d(void 0),l.getChildren().filter(y=>y!==t&&!c.has(y)).forEach(y=>{this.fsw._remove(t,y);}),u=void 0,w&&this._handleRead(t,false,i,s,n,h,o);});})}async _handleDir(t,e,i,s,n,h,o){let a=this.fsw._getWatchedDir(f__namespace.dirname(t)),l=a.has(f__namespace.basename(t));!(i&&this.fsw.options.ignoreInitial)&&!n&&!l&&this.fsw._emit(g.ADD_DIR,t,e),a.add(f__namespace.basename(t)),this.fsw._getWatchedDir(t);let c,u,d=this.fsw.options.depth;if((d==null||s<=d)&&!this.fsw._symlinkPaths.has(o)){if(!n&&(await this._handleRead(t,i,h,n,t,s,c),this.fsw.closed))return;u=this._watchWithNodeFs(t,(m,w)=>{w&&w.mtimeMs===0||this._handleRead(m,false,h,n,t,s,c);});}return u}async _addToNodeFs(t,e,i,s,n){let h=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return h(),false;let o=this.fsw._getWatchHelpers(t);i&&(o.filterPath=a=>i.filterPath(a),o.filterDir=a=>i.filterDir(a));try{let a=await Mt[o.statMethod](o.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(o.watchPath,a))return h(),!1;let l=this.fsw.options.followSymlinks,c;if(a.isDirectory()){let u=f__namespace.resolve(t),d=l?await promises.realpath(t):t;if(this.fsw.closed||(c=await this._handleDir(o.watchPath,a,e,s,n,o,d),this.fsw.closed))return;u!==d&&d!==void 0&&this.fsw._symlinkPaths.set(u,d);}else if(a.isSymbolicLink()){let u=l?await promises.realpath(t):t;if(this.fsw.closed)return;let d=f__namespace.dirname(o.watchPath);if(this.fsw._getWatchedDir(d).add(o.watchPath),this.fsw._emit(g.ADD,o.watchPath,a),c=await this._handleDir(d,a,e,s,t,o,u),this.fsw.closed)return;u!==void 0&&this.fsw._symlinkPaths.set(f__namespace.resolve(t),u);}else c=this._handleFile(o.watchPath,a,e);return h(),c&&this.fsw._addPathCloser(t,c),!1}catch(a){if(this.fsw._handleError(a))return h(),t}}};});function W(r){return Array.isArray(r)?r:[r]}function ee(r){return typeof r=="function"?r:typeof r=="string"?t=>r===t:r instanceof RegExp?t=>r.test(t):typeof r=="object"&&r!==null?t=>{if(r.path===t)return true;if(r.recursive){let e=f__namespace.relative(r.path,t);return e?!e.startsWith("..")&&!f__namespace.isAbsolute(e):false}return false}:()=>false}function se(r){if(typeof r!="string")throw new Error("string expected");r=f__namespace.normalize(r),r=r.replace(/\\/g,"/");let t=false;return r.startsWith("//")&&(t=true),r=r.replace(ut,"/"),t&&(r="/"+r),r}function ht(r,t,e){let i=se(t);for(let s=0;s<r.length;s++){let n=r[s];if(n(i,e))return true}return false}function ie(r,t){if(r==null)throw new TypeError("anymatch: specify first argument");let i=W(r).map(s=>ee(s));return t==null?(s,n)=>ht(i,s,n):ht(i,t)}function he(r,t={}){let e=new exports.FSWatcher(t);return e.add(r),e}var Y,qt,ft,Jt,Qt,Xt,ut,Zt,te,U,lt,ct,_t,dt,re,ne,G,oe,ae;exports.WatchHelper=void 0;exports.FSWatcher=void 0;exports.default=void 0;var le=chunkBUNLC3II_cjs.b(()=>{chunkBUNLC3II_cjs.h();tt();at();Y="/",qt="//",ft=".",Jt="..",Qt="string",Xt=/\\/g,ut=/\/\//g,Zt=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,te=/^\.[/\\]/;U=r=>typeof r=="object"&&r!==null&&!(r instanceof RegExp);lt=r=>{let t=W(r).flat();if(!t.every(e=>typeof e===Qt))throw new TypeError(`Non-string provided as watch path: ${t}`);return t.map(_t)},ct=r=>{let t=r.replace(Xt,Y),e=false;return t.startsWith(qt)&&(e=true),t=t.replace(ut,Y),e&&(t=Y+t),t},_t=r=>ct(f__namespace.normalize(ct(r))),dt=(r="")=>t=>typeof t=="string"?_t(f__namespace.isAbsolute(t)?t:f__namespace.join(r,t)):t,re=(r,t)=>f__namespace.isAbsolute(r)?r:f__namespace.join(t,r),ne=Object.freeze(new Set),G=class{path;_removeWatcher;items;constructor(t,e){this.path=t,this._removeWatcher=e,this.items=new Set;}add(t){let{items:e}=this;e&&t!==ft&&t!==Jt&&e.add(t);}async remove(t){let{items:e}=this;if(!e||(e.delete(t),e.size>0))return;let i=this.path;try{await promises.readdir(i);}catch{this._removeWatcher&&this._removeWatcher(f__namespace.dirname(i),f__namespace.basename(i));}}has(t){let{items:e}=this;if(e)return e.has(t)}getChildren(){let{items:t}=this;return t?[...t.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=S,this.items=ne,Object.freeze(this);}},oe="stat",ae="lstat",exports.WatchHelper=class{fsw;path;watchPath;fullWatchPath;dirParts;followSymlinks;statMethod;constructor(t,e,i){this.fsw=i;let s=t;this.path=t=t.replace(te,""),this.watchPath=s,this.fullWatchPath=f__namespace.resolve(s),this.dirParts=[],this.dirParts.forEach(n=>{n.length>1&&n.pop();}),this.followSymlinks=e,this.statMethod=e?oe:ae;}entryPath(t){return f__namespace.join(this.watchPath,f__namespace.relative(this.watchPath,t.fullPath))}filterPath(t){let{stats:e}=t;if(e&&e.isSymbolicLink())return this.filterDir(t);let i=this.entryPath(t);return this.fsw._isntIgnored(i,e)&&this.fsw._hasReadPermissions(e)}filterDir(t){return this.fsw._isntIgnored(this.entryPath(t),t.stats)}},exports.FSWatcher=class extends events.EventEmitter{closed;options;_closers;_ignoredPaths;_throttled;_streams;_symlinkPaths;_watched;_pendingWrites;_pendingUnlinks;_readyCount;_emitReady;_closePromise;_userIgnored;_readyEmitted;_emitRaw;_boundRemove;_nodeFsHandler;constructor(t={}){super(),this.closed=false,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=false;let e=t.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},s={persistent:true,ignoreInitial:false,ignorePermissionErrors:false,interval:100,binaryInterval:300,followSymlinks:true,usePolling:false,atomic:true,...t,ignored:t.ignored?W(t.ignored):W([]),awaitWriteFinish:e===true?i:typeof e=="object"?{...i,...e}:false};nt&&(s.usePolling=true),s.atomic===void 0&&(s.atomic=!s.usePolling);let n=process.env.CHOKIDAR_USEPOLLING;if(n!==void 0){let a=n.toLowerCase();a==="false"||a==="0"?s.usePolling=false:a==="true"||a==="1"?s.usePolling=true:s.usePolling=!!a;}let h=process.env.CHOKIDAR_INTERVAL;h&&(s.interval=Number.parseInt(h,10));let o=0;this._emitReady=()=>{o++,o>=this._readyCount&&(this._emitReady=S,this._readyEmitted=true,process.nextTick(()=>this.emit(p.READY)));},this._emitRaw=(...a)=>this.emit(p.RAW,...a),this._boundRemove=this._remove.bind(this),this.options=s,this._nodeFsHandler=new F(this),Object.freeze(s);}_addIgnoredPath(t){if(U(t)){for(let e of this._ignoredPaths)if(U(e)&&e.path===t.path&&e.recursive===t.recursive)return}this._ignoredPaths.add(t);}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let e of this._ignoredPaths)U(e)&&e.path===t&&this._ignoredPaths.delete(e);}add(t,e,i){let{cwd:s}=this.options;this.closed=false,this._closePromise=void 0;let n=lt(t);return s&&(n=n.map(h=>re(h,s))),n.forEach(h=>{this._removeIgnoredPath(h);}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=n.length,Promise.all(n.map(async h=>{let o=await this._nodeFsHandler._addToNodeFs(h,!i,void 0,0,e);return o&&this._emitReady(),o})).then(h=>{this.closed||h.forEach(o=>{o&&this.add(f__namespace.dirname(o),f__namespace.basename(e||o));});}),this}unwatch(t){if(this.closed)return this;let e=lt(t),{cwd:i}=this.options;return e.forEach(s=>{!f__namespace.isAbsolute(s)&&!this._closers.has(s)&&(i&&(s=f__namespace.join(i,s)),s=f__namespace.resolve(s)),this._closePath(s),this._addIgnoredPath(s),this._watched.has(s)&&this._addIgnoredPath({path:s,recursive:true}),this._userIgnored=void 0;}),this}close(){if(this._closePromise)return this._closePromise;this.closed=true,this.removeAllListeners();let t=[];return this._closers.forEach(e=>e.forEach(i=>{let s=i();s instanceof Promise&&t.push(s);})),this._streams.forEach(e=>e.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=false,this._watched.forEach(e=>e.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((e,i)=>{let n=(this.options.cwd?f__namespace.relative(this.options.cwd,i):i)||ft;t[n]=e.getChildren().sort();}),t}emitWithAll(t,e){this.emit(t,...e),t!==p.ERROR&&this.emit(p.ALL,t,...e);}async _emit(t,e,i){if(this.closed)return;let s=this.options;j&&(e=f__namespace.normalize(e)),s.cwd&&(e=f__namespace.relative(s.cwd,e));let n=[e];i!=null&&n.push(i);let h=s.awaitWriteFinish,o;if(h&&(o=this._pendingWrites.get(e)))return o.lastChange=new Date,this;if(s.atomic){if(t===p.UNLINK)return this._pendingUnlinks.set(e,[t,...n]),setTimeout(()=>{this._pendingUnlinks.forEach((a,l)=>{this.emit(...a),this.emit(p.ALL,...a),this._pendingUnlinks.delete(l);});},typeof s.atomic=="number"?s.atomic:100),this;t===p.ADD&&this._pendingUnlinks.has(e)&&(t=p.CHANGE,this._pendingUnlinks.delete(e));}if(h&&(t===p.ADD||t===p.CHANGE)&&this._readyEmitted){let a=(l,c)=>{l?(t=p.ERROR,n[0]=l,this.emitWithAll(t,n)):c&&(n.length>1?n[1]=c:n.push(c),this.emitWithAll(t,n));};return this._awaitWriteFinish(e,h.stabilityThreshold,t,a),this}if(t===p.CHANGE&&!this._throttle(p.CHANGE,e,50))return this;if(s.alwaysStat&&i===void 0&&(t===p.ADD||t===p.ADD_DIR||t===p.CHANGE)){let a=s.cwd?f__namespace.join(s.cwd,e):e,l;try{l=await promises.stat(a);}catch{}if(!l||this.closed)return;n.push(l);}return this.emitWithAll(t,n),this}_handleError(t){let e=t&&t.code;return t&&e!=="ENOENT"&&e!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||e!=="EPERM"&&e!=="EACCES")&&this.emit(p.ERROR,t),t||this.closed}_throttle(t,e,i){this._throttled.has(t)||this._throttled.set(t,new Map);let s=this._throttled.get(t);if(!s)throw new Error("invalid throttle");let n=s.get(e);if(n)return n.count++,false;let h,o=()=>{let l=s.get(e),c=l?l.count:0;return s.delete(e),clearTimeout(h),l&&clearTimeout(l.timeoutObject),c};h=setTimeout(o,i);let a={timeoutObject:h,clear:o,count:0};return s.set(e,a),a}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,e,i,s){let n=this.options.awaitWriteFinish;if(typeof n!="object")return;let h=n.pollInterval,o,a=t;this.options.cwd&&!f__namespace.isAbsolute(t)&&(a=f__namespace.join(this.options.cwd,t));let l=new Date,c=this._pendingWrites;function u(d){fs.stat(a,(m,w)=>{if(m||!c.has(t)){m&&m.code!=="ENOENT"&&s(m);return}let y=Number(new Date);d&&w.size!==d.size&&(c.get(t).lastChange=y);let pt=c.get(t);y-pt.lastChange>=e?(c.delete(t),s(void 0,w)):o=setTimeout(u,h,w);});}c.has(t)||(c.set(t,{lastChange:l,cancelWait:()=>(c.delete(t),clearTimeout(o),i)}),o=setTimeout(u,h));}_isIgnored(t,e){if(this.options.atomic&&Zt.test(t))return true;if(!this._userIgnored){let{cwd:i}=this.options,n=(this.options.ignored||[]).map(dt(i)),o=[...[...this._ignoredPaths].map(dt(i)),...n];this._userIgnored=ie(o,void 0);}return this._userIgnored(t,e)}_isntIgnored(t,e){return !this._isIgnored(t,e)}_getWatchHelpers(t){return new exports.WatchHelper(t,this.options.followSymlinks,this)}_getWatchedDir(t){let e=f__namespace.resolve(t);return this._watched.has(e)||this._watched.set(e,new G(e,this._boundRemove)),this._watched.get(e)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?true:!!(Number(t.mode)&256)}_remove(t,e,i){let s=f__namespace.join(t,e),n=f__namespace.resolve(s);if(i=i??(this._watched.has(s)||this._watched.has(n)),!this._throttle("remove",s,100))return;!i&&this._watched.size===1&&this.add(t,e,true),this._getWatchedDir(s).getChildren().forEach(d=>this._remove(s,d));let a=this._getWatchedDir(t),l=a.has(e);a.remove(e),this._symlinkPaths.has(n)&&this._symlinkPaths.delete(n);let c=s;if(this.options.cwd&&(c=f__namespace.relative(this.options.cwd,s)),this.options.awaitWriteFinish&&this._pendingWrites.has(c)&&this._pendingWrites.get(c).cancelWait()===p.ADD)return;this._watched.delete(s),this._watched.delete(n);let u=i?p.UNLINK_DIR:p.UNLINK;l&&!this._isIgnored(s)&&this._emit(u,s),this._closePath(s);}_closePath(t){this._closeFile(t);let e=f__namespace.dirname(t);this._getWatchedDir(e).remove(f__namespace.basename(t));}_closeFile(t){let e=this._closers.get(t);e&&(e.forEach(i=>i()),this._closers.delete(t));}_addPathCloser(t,e){if(!e)return;let i=this._closers.get(t);i||(i=[],this._closers.set(t,i)),i.push(e);}_readdirp(t,e){if(this.closed)return;let i={type:p.ALL,alwaysStat:true,lstat:true,...e,depth:0},s=Z(t,i);return this._streams.add(s),s.once(rt,()=>{s=void 0;}),s.once(H,()=>{s&&(this._streams.delete(s),s=void 0);}),s}};exports.default={watch:he,FSWatcher:exports.FSWatcher};});le();/*! Bundled license information:
|
|
2
|
-
|
|
3
|
-
chokidar/index.js:
|
|
4
|
-
(*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
|
|
5
|
-
*/exports.watch=he;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import {createRequire}from'module';import {b as b$1,g as g$1}from'./chunk-C2PXMVR5.js';import {stat,lstat,readdir,realpath,open}from'fs/promises';import*as f from'path';import {resolve,join,relative,sep}from'path';import {Readable}from'stream';import {stat as stat$1,unwatchFile,watchFile,watch}from'fs';import {type}from'os';import {EventEmitter}from'events';createRequire(import.meta.url);
|
|
2
|
-
function tt(r,t={}){let e=t.entryType||t.type;if(e==="both"&&(e=E.FILE_DIR_TYPE),e&&(t.type=e),r){if(typeof r!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(e&&!$.includes(e))throw new Error(`readdirp: Invalid type passed. Use one of ${$.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return t.root=r,new C(t)}var E,L,Z,Dt,$,It,Tt,vt,xt,q,J,C,et=b$1(()=>{g$1();E={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},L={root:".",fileFilter:r=>true,directoryFilter:r=>true,type:E.FILE_TYPE,lstat:false,depth:2147483648,alwaysStat:false,highWaterMark:4096};Object.freeze(L);Z="READDIRP_RECURSIVE_ERROR",Dt=new Set(["ENOENT","EPERM","EACCES","ELOOP",Z]),$=[E.DIR_TYPE,E.EVERYTHING_TYPE,E.FILE_DIR_TYPE,E.FILE_TYPE],It=new Set([E.DIR_TYPE,E.EVERYTHING_TYPE,E.FILE_DIR_TYPE]),Tt=new Set([E.EVERYTHING_TYPE,E.FILE_DIR_TYPE,E.FILE_TYPE]),vt=r=>Dt.has(r.code),xt=process.platform==="win32",q=r=>true,J=r=>{if(r===void 0)return q;if(typeof r=="function")return r;if(typeof r=="string"){let t=r.trim();return e=>e.basename===t}if(Array.isArray(r)){let t=r.map(e=>e.trim());return e=>t.some(i=>e.basename===i)}return q},C=class extends Readable{parents;reading;parent;_stat;_maxDepth;_wantsDir;_wantsFile;_wantsEverything;_root;_isDirent;_statsProp;_rdOptions;_fileFilter;_directoryFilter;constructor(t={}){super({objectMode:true,autoDestroy:true,highWaterMark:t.highWaterMark});let e={...L,...t},{root:i,type:s}=e;this._fileFilter=J(e.fileFilter),this._directoryFilter=J(e.directoryFilter);let n=e.lstat?lstat:stat;xt?this._stat=h=>n(h,{bigint:true}):this._stat=n,this._maxDepth=e.depth!=null&&Number.isSafeInteger(e.depth)?e.depth:L.depth,this._wantsDir=s?It.has(s):false,this._wantsFile=s?Tt.has(s):false,this._wantsEverything=s===E.EVERYTHING_TYPE,this._root=resolve(i),this._isDirent=!e.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(i,1)],this.reading=false,this.parent=void 0;}async _read(t){if(!this.reading){this.reading=true;try{for(;!this.destroyed&&t>0;){let e=this.parent,i=e&&e.files;if(i&&i.length>0){let{path:s,depth:n}=e,h=i.splice(0,t).map(a=>this._formatEntry(a,s)),o=await Promise.all(h);for(let a of o){if(!a)continue;if(this.destroyed)return;let l=await this._getEntryType(a);l==="directory"&&this._directoryFilter(a)?(n<=this._maxDepth&&this.parents.push(this._exploreDir(a.fullPath,n+1)),this._wantsDir&&(this.push(a),t--)):(l==="file"||this._includeAsFile(a))&&this._fileFilter(a)&&this._wantsFile&&(this.push(a),t--);}}else {let s=this.parents.pop();if(!s){this.push(null);break}if(this.parent=await s,this.destroyed)return}}}catch(e){this.destroy(e);}finally{this.reading=false;}}}async _exploreDir(t,e){let i;try{i=await readdir(t,this._rdOptions);}catch(s){this._onError(s);}return {files:i,depth:e,path:t}}async _formatEntry(t,e){let i,s=this._isDirent?t.name:t;try{let n=resolve(join(e,s));i={path:relative(this._root,n),fullPath:n,basename:s},i[this._statsProp]=this._isDirent?t:await this._stat(n);}catch(n){this._onError(n);return}return i}_onError(t){vt(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t);}async _getEntryType(t){if(!t&&this._statsProp in t)return "";let e=t[this._statsProp];if(e.isFile())return "file";if(e.isDirectory())return "directory";if(e&&e.isSymbolicLink()){let i=t.fullPath;try{let s=await realpath(i),n=await lstat(s);if(n.isFile())return "file";if(n.isDirectory()){let h=s.length;if(i.startsWith(s)&&i.substr(h,1)===sep){let o=new Error(`Circular symlink detected: "${i}" points to "${s}"`);return o.code=Z,this._onError(o)}return "directory"}}catch(s){return this._onError(s),""}}}_includeAsFile(t){let e=t&&t[this._statsProp];return e&&this._wantsEverything&&!e.isDirectory()}};});function it(r,t,e,i,s){let n=(h,o)=>{e(r),s(h,o,{watchedPath:r}),o&&r!==o&&x(f.resolve(r,o),P,f.join(r,o));};try{return watch(r,{persistent:t.persistent},n)}catch(h){i(h);return}}var kt,H,nt,S,A,j,Lt,Ct,Ot,ot,p,g,Mt,zt,P,T,b,Ht,jt,Yt,z,D,Ut,I,at,v,x,Gt,M,Kt,F,ht=b$1(()=>{g$1();kt="data",H="end",nt="close",S=()=>{},A=process.platform,j=A==="win32",Lt=A==="darwin",Ct=A==="linux",Ot=A==="freebsd",ot=type()==="OS400",p={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},g=p,Mt="watch",zt={lstat:lstat,stat:stat},P="listeners",T="errHandlers",b="rawEmitters",Ht=[P,T,b],jt=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),Yt=r=>jt.has(f.extname(r).slice(1).toLowerCase()),z=(r,t)=>{r instanceof Set?r.forEach(t):t(r);},D=(r,t,e)=>{let i=r[t];i instanceof Set||(r[t]=i=new Set([i])),i.add(e);},Ut=r=>t=>{let e=r[t];e instanceof Set?e.clear():delete r[t];},I=(r,t,e)=>{let i=r[t];i instanceof Set?i.delete(e):i===e&&delete r[t];},at=r=>r instanceof Set?r.size===0:!r,v=new Map;x=(r,t,e,i,s)=>{let n=v.get(r);n&&z(n[t],h=>{h(e,i,s);});},Gt=(r,t,e,i)=>{let{listener:s,errHandler:n,rawEmitter:h}=i,o=v.get(t),a;if(!e.persistent)return a=it(r,e,s,n,h),a?a.close.bind(a):void 0;if(o)D(o,P,s),D(o,T,n),D(o,b,h);else {if(a=it(r,e,x.bind(null,t,P),n,x.bind(null,t,b)),!a)return;a.on(g.ERROR,async l=>{let c=x.bind(null,t,T);if(o&&(o.watcherUnusable=true),j&&l.code==="EPERM")try{await(await open(r,"r")).close(),c(l);}catch{}else c(l);}),o={listeners:s,errHandlers:n,rawEmitters:h,watcher:a},v.set(t,o);}return ()=>{I(o,P,s),I(o,T,n),I(o,b,h),at(o.listeners)&&(o.watcher.close(),v.delete(t),Ht.forEach(Ut(o)),o.watcher=void 0,Object.freeze(o));}},M=new Map,Kt=(r,t,e,i)=>{let{listener:s,rawEmitter:n}=i,h=M.get(t),o=h&&h.options;return o&&(o.persistent<e.persistent||o.interval>e.interval)&&(unwatchFile(t),h=void 0),h?(D(h,P,s),D(h,b,n)):(h={listeners:s,rawEmitters:n,options:e,watcher:watchFile(t,e,(a,l)=>{z(h.rawEmitters,u=>{u(g.CHANGE,t,{curr:a,prev:l});});let c=a.mtimeMs;(a.size!==l.size||c>l.mtimeMs||c===0)&&z(h.listeners,u=>u(r,a));})},M.set(t,h)),()=>{I(h,P,s),I(h,b,n),at(h.listeners)&&(M.delete(t),unwatchFile(t),h.options=h.watcher=void 0,Object.freeze(h));}},F=class{fsw;_boundHandleError;constructor(t){this.fsw=t,this._boundHandleError=e=>t._handleError(e);}_watchWithNodeFs(t,e){let i=this.fsw.options,s=f.dirname(t),n=f.basename(t);this.fsw._getWatchedDir(s).add(n);let o=f.resolve(t),a={persistent:i.persistent};e||(e=S);let l;if(i.usePolling){let c=i.interval!==i.binaryInterval;a.interval=c&&Yt(n)?i.binaryInterval:i.interval,l=Kt(t,o,a,{listener:e,rawEmitter:this.fsw._emitRaw});}else l=Gt(t,o,a,{listener:e,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return l}_handleFile(t,e,i){if(this.fsw.closed)return;let s=f.dirname(t),n=f.basename(t),h=this.fsw._getWatchedDir(s),o=e;if(h.has(n))return;let a=async(c,u)=>{if(this.fsw._throttle(Mt,t,5)){if(!u||u.mtimeMs===0)try{let d=await stat(t);if(this.fsw.closed)return;let m=d.atimeMs,w=d.mtimeMs;if((!m||m<=w||w!==o.mtimeMs)&&this.fsw._emit(g.CHANGE,t,d),(Lt||Ct||Ot)&&o.ino!==d.ino){this.fsw._closeFile(c),o=d;let y=this._watchWithNodeFs(t,a);y&&this.fsw._addPathCloser(c,y);}else o=d;}catch{this.fsw._remove(s,n);}else if(h.has(n)){let d=u.atimeMs,m=u.mtimeMs;(!d||d<=m||m!==o.mtimeMs)&&this.fsw._emit(g.CHANGE,t,u),o=u;}}},l=this._watchWithNodeFs(t,a);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(g.ADD,t,0))return;this.fsw._emit(g.ADD,t,e);}return l}async _handleSymlink(t,e,i,s){if(this.fsw.closed)return;let n=t.fullPath,h=this.fsw._getWatchedDir(e);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let o;try{o=await realpath(i);}catch{return this.fsw._emitReady(),true}return this.fsw.closed?void 0:(h.has(s)?this.fsw._symlinkPaths.get(n)!==o&&(this.fsw._symlinkPaths.set(n,o),this.fsw._emit(g.CHANGE,i,t.stats)):(h.add(s),this.fsw._symlinkPaths.set(n,o),this.fsw._emit(g.ADD,i,t.stats)),this.fsw._emitReady(),true)}if(this.fsw._symlinkPaths.has(n))return true;this.fsw._symlinkPaths.set(n,true);}_handleRead(t,e,i,s,n,h,o){t=f.join(t,"");let a=s?`${t}:${s}`:t;if(o=this.fsw._throttle("readdir",a,1e3),!o)return;let l=this.fsw._getWatchedDir(i.path),c=new Set,u=this.fsw._readdirp(t,{fileFilter:d=>i.filterPath(d),directoryFilter:d=>i.filterDir(d)});if(u)return u.on(kt,async d=>{if(this.fsw.closed){u=void 0;return}let m=d.path,w=f.join(t,m);if(c.add(m),!(d.stats.isSymbolicLink()&&await this._handleSymlink(d,t,w,m))){if(this.fsw.closed){u=void 0;return}(m===s||!s&&!l.has(m))&&(this.fsw._incrReadyCount(),w=f.join(n,f.relative(n,w)),this._addToNodeFs(w,e,i,h+1));}}).on(g.ERROR,this._boundHandleError),new Promise((d,m)=>{if(!u)return m();u.once(H,()=>{if(this.fsw.closed){u=void 0;return}let w=o?o.clear():false;d(void 0),l.getChildren().filter(y=>y!==t&&!c.has(y)).forEach(y=>{this.fsw._remove(t,y);}),u=void 0,w&&this._handleRead(t,false,i,s,n,h,o);});})}async _handleDir(t,e,i,s,n,h,o){let a=this.fsw._getWatchedDir(f.dirname(t)),l=a.has(f.basename(t));!(i&&this.fsw.options.ignoreInitial)&&!n&&!l&&this.fsw._emit(g.ADD_DIR,t,e),a.add(f.basename(t)),this.fsw._getWatchedDir(t);let c,u,d=this.fsw.options.depth;if((d==null||s<=d)&&!this.fsw._symlinkPaths.has(o)){if(!n&&(await this._handleRead(t,i,h,n,t,s,c),this.fsw.closed))return;u=this._watchWithNodeFs(t,(m,w)=>{w&&w.mtimeMs===0||this._handleRead(m,false,h,n,t,s,c);});}return u}async _addToNodeFs(t,e,i,s,n){let h=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return h(),false;let o=this.fsw._getWatchHelpers(t);i&&(o.filterPath=a=>i.filterPath(a),o.filterDir=a=>i.filterDir(a));try{let a=await zt[o.statMethod](o.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(o.watchPath,a))return h(),!1;let l=this.fsw.options.followSymlinks,c;if(a.isDirectory()){let u=f.resolve(t),d=l?await realpath(t):t;if(this.fsw.closed||(c=await this._handleDir(o.watchPath,a,e,s,n,o,d),this.fsw.closed))return;u!==d&&d!==void 0&&this.fsw._symlinkPaths.set(u,d);}else if(a.isSymbolicLink()){let u=l?await realpath(t):t;if(this.fsw.closed)return;let d=f.dirname(o.watchPath);if(this.fsw._getWatchedDir(d).add(o.watchPath),this.fsw._emit(g.ADD,o.watchPath,a),c=await this._handleDir(d,a,e,s,t,o,u),this.fsw.closed)return;u!==void 0&&this.fsw._symlinkPaths.set(f.resolve(t),u);}else c=this._handleFile(o.watchPath,a,e);return h(),c&&this.fsw._addPathCloser(t,c),!1}catch(a){if(this.fsw._handleError(a))return h(),t}}};});function W(r){return Array.isArray(r)?r:[r]}function se(r){return typeof r=="function"?r:typeof r=="string"?t=>r===t:r instanceof RegExp?t=>r.test(t):typeof r=="object"&&r!==null?t=>{if(r.path===t)return true;if(r.recursive){let e=f.relative(r.path,t);return e?!e.startsWith("..")&&!f.isAbsolute(e):false}return false}:()=>false}function ie(r){if(typeof r!="string")throw new Error("string expected");r=f.normalize(r),r=r.replace(/\\/g,"/");let t=false;return r.startsWith("//")&&(t=true),r=r.replace(_t,"/"),t&&(r="/"+r),r}function lt(r,t,e){let i=ie(t);for(let s=0;s<r.length;s++){let n=r[s];if(n(i,e))return true}return false}function re(r,t){if(r==null)throw new TypeError("anymatch: specify first argument");let i=W(r).map(s=>se(s));return t==null?(s,n)=>lt(i,s,n):lt(i,t)}function le(r,t={}){let e=new N(t);return e.add(r),e}var Y,Jt,ut,Qt,Xt,Zt,_t,te,ee,U,ct,dt,pt,ft,ne,oe,G,ae,he,K,N,Fe,ce=b$1(()=>{g$1();et();ht();Y="/",Jt="//",ut=".",Qt="..",Xt="string",Zt=/\\/g,_t=/\/\//g,te=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,ee=/^\.[/\\]/;U=r=>typeof r=="object"&&r!==null&&!(r instanceof RegExp);ct=r=>{let t=W(r).flat();if(!t.every(e=>typeof e===Xt))throw new TypeError(`Non-string provided as watch path: ${t}`);return t.map(pt)},dt=r=>{let t=r.replace(Zt,Y),e=false;return t.startsWith(Jt)&&(e=true),t=t.replace(_t,Y),e&&(t=Y+t),t},pt=r=>dt(f.normalize(dt(r))),ft=(r="")=>t=>typeof t=="string"?pt(f.isAbsolute(t)?t:f.join(r,t)):t,ne=(r,t)=>f.isAbsolute(r)?r:f.join(t,r),oe=Object.freeze(new Set),G=class{path;_removeWatcher;items;constructor(t,e){this.path=t,this._removeWatcher=e,this.items=new Set;}add(t){let{items:e}=this;e&&t!==ut&&t!==Qt&&e.add(t);}async remove(t){let{items:e}=this;if(!e||(e.delete(t),e.size>0))return;let i=this.path;try{await readdir(i);}catch{this._removeWatcher&&this._removeWatcher(f.dirname(i),f.basename(i));}}has(t){let{items:e}=this;if(e)return e.has(t)}getChildren(){let{items:t}=this;return t?[...t.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=S,this.items=oe,Object.freeze(this);}},ae="stat",he="lstat",K=class{fsw;path;watchPath;fullWatchPath;dirParts;followSymlinks;statMethod;constructor(t,e,i){this.fsw=i;let s=t;this.path=t=t.replace(ee,""),this.watchPath=s,this.fullWatchPath=f.resolve(s),this.dirParts=[],this.dirParts.forEach(n=>{n.length>1&&n.pop();}),this.followSymlinks=e,this.statMethod=e?ae:he;}entryPath(t){return f.join(this.watchPath,f.relative(this.watchPath,t.fullPath))}filterPath(t){let{stats:e}=t;if(e&&e.isSymbolicLink())return this.filterDir(t);let i=this.entryPath(t);return this.fsw._isntIgnored(i,e)&&this.fsw._hasReadPermissions(e)}filterDir(t){return this.fsw._isntIgnored(this.entryPath(t),t.stats)}},N=class extends EventEmitter{closed;options;_closers;_ignoredPaths;_throttled;_streams;_symlinkPaths;_watched;_pendingWrites;_pendingUnlinks;_readyCount;_emitReady;_closePromise;_userIgnored;_readyEmitted;_emitRaw;_boundRemove;_nodeFsHandler;constructor(t={}){super(),this.closed=false,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=false;let e=t.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},s={persistent:true,ignoreInitial:false,ignorePermissionErrors:false,interval:100,binaryInterval:300,followSymlinks:true,usePolling:false,atomic:true,...t,ignored:t.ignored?W(t.ignored):W([]),awaitWriteFinish:e===true?i:typeof e=="object"?{...i,...e}:false};ot&&(s.usePolling=true),s.atomic===void 0&&(s.atomic=!s.usePolling);let n=process.env.CHOKIDAR_USEPOLLING;if(n!==void 0){let a=n.toLowerCase();a==="false"||a==="0"?s.usePolling=false:a==="true"||a==="1"?s.usePolling=true:s.usePolling=!!a;}let h=process.env.CHOKIDAR_INTERVAL;h&&(s.interval=Number.parseInt(h,10));let o=0;this._emitReady=()=>{o++,o>=this._readyCount&&(this._emitReady=S,this._readyEmitted=true,process.nextTick(()=>this.emit(p.READY)));},this._emitRaw=(...a)=>this.emit(p.RAW,...a),this._boundRemove=this._remove.bind(this),this.options=s,this._nodeFsHandler=new F(this),Object.freeze(s);}_addIgnoredPath(t){if(U(t)){for(let e of this._ignoredPaths)if(U(e)&&e.path===t.path&&e.recursive===t.recursive)return}this._ignoredPaths.add(t);}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let e of this._ignoredPaths)U(e)&&e.path===t&&this._ignoredPaths.delete(e);}add(t,e,i){let{cwd:s}=this.options;this.closed=false,this._closePromise=void 0;let n=ct(t);return s&&(n=n.map(h=>ne(h,s))),n.forEach(h=>{this._removeIgnoredPath(h);}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=n.length,Promise.all(n.map(async h=>{let o=await this._nodeFsHandler._addToNodeFs(h,!i,void 0,0,e);return o&&this._emitReady(),o})).then(h=>{this.closed||h.forEach(o=>{o&&this.add(f.dirname(o),f.basename(e||o));});}),this}unwatch(t){if(this.closed)return this;let e=ct(t),{cwd:i}=this.options;return e.forEach(s=>{!f.isAbsolute(s)&&!this._closers.has(s)&&(i&&(s=f.join(i,s)),s=f.resolve(s)),this._closePath(s),this._addIgnoredPath(s),this._watched.has(s)&&this._addIgnoredPath({path:s,recursive:true}),this._userIgnored=void 0;}),this}close(){if(this._closePromise)return this._closePromise;this.closed=true,this.removeAllListeners();let t=[];return this._closers.forEach(e=>e.forEach(i=>{let s=i();s instanceof Promise&&t.push(s);})),this._streams.forEach(e=>e.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=false,this._watched.forEach(e=>e.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((e,i)=>{let n=(this.options.cwd?f.relative(this.options.cwd,i):i)||ut;t[n]=e.getChildren().sort();}),t}emitWithAll(t,e){this.emit(t,...e),t!==p.ERROR&&this.emit(p.ALL,t,...e);}async _emit(t,e,i){if(this.closed)return;let s=this.options;j&&(e=f.normalize(e)),s.cwd&&(e=f.relative(s.cwd,e));let n=[e];i!=null&&n.push(i);let h=s.awaitWriteFinish,o;if(h&&(o=this._pendingWrites.get(e)))return o.lastChange=new Date,this;if(s.atomic){if(t===p.UNLINK)return this._pendingUnlinks.set(e,[t,...n]),setTimeout(()=>{this._pendingUnlinks.forEach((a,l)=>{this.emit(...a),this.emit(p.ALL,...a),this._pendingUnlinks.delete(l);});},typeof s.atomic=="number"?s.atomic:100),this;t===p.ADD&&this._pendingUnlinks.has(e)&&(t=p.CHANGE,this._pendingUnlinks.delete(e));}if(h&&(t===p.ADD||t===p.CHANGE)&&this._readyEmitted){let a=(l,c)=>{l?(t=p.ERROR,n[0]=l,this.emitWithAll(t,n)):c&&(n.length>1?n[1]=c:n.push(c),this.emitWithAll(t,n));};return this._awaitWriteFinish(e,h.stabilityThreshold,t,a),this}if(t===p.CHANGE&&!this._throttle(p.CHANGE,e,50))return this;if(s.alwaysStat&&i===void 0&&(t===p.ADD||t===p.ADD_DIR||t===p.CHANGE)){let a=s.cwd?f.join(s.cwd,e):e,l;try{l=await stat(a);}catch{}if(!l||this.closed)return;n.push(l);}return this.emitWithAll(t,n),this}_handleError(t){let e=t&&t.code;return t&&e!=="ENOENT"&&e!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||e!=="EPERM"&&e!=="EACCES")&&this.emit(p.ERROR,t),t||this.closed}_throttle(t,e,i){this._throttled.has(t)||this._throttled.set(t,new Map);let s=this._throttled.get(t);if(!s)throw new Error("invalid throttle");let n=s.get(e);if(n)return n.count++,false;let h,o=()=>{let l=s.get(e),c=l?l.count:0;return s.delete(e),clearTimeout(h),l&&clearTimeout(l.timeoutObject),c};h=setTimeout(o,i);let a={timeoutObject:h,clear:o,count:0};return s.set(e,a),a}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,e,i,s){let n=this.options.awaitWriteFinish;if(typeof n!="object")return;let h=n.pollInterval,o,a=t;this.options.cwd&&!f.isAbsolute(t)&&(a=f.join(this.options.cwd,t));let l=new Date,c=this._pendingWrites;function u(d){stat$1(a,(m,w)=>{if(m||!c.has(t)){m&&m.code!=="ENOENT"&&s(m);return}let y=Number(new Date);d&&w.size!==d.size&&(c.get(t).lastChange=y);let mt=c.get(t);y-mt.lastChange>=e?(c.delete(t),s(void 0,w)):o=setTimeout(u,h,w);});}c.has(t)||(c.set(t,{lastChange:l,cancelWait:()=>(c.delete(t),clearTimeout(o),i)}),o=setTimeout(u,h));}_isIgnored(t,e){if(this.options.atomic&&te.test(t))return true;if(!this._userIgnored){let{cwd:i}=this.options,n=(this.options.ignored||[]).map(ft(i)),o=[...[...this._ignoredPaths].map(ft(i)),...n];this._userIgnored=re(o,void 0);}return this._userIgnored(t,e)}_isntIgnored(t,e){return !this._isIgnored(t,e)}_getWatchHelpers(t){return new K(t,this.options.followSymlinks,this)}_getWatchedDir(t){let e=f.resolve(t);return this._watched.has(e)||this._watched.set(e,new G(e,this._boundRemove)),this._watched.get(e)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?true:!!(Number(t.mode)&256)}_remove(t,e,i){let s=f.join(t,e),n=f.resolve(s);if(i=i??(this._watched.has(s)||this._watched.has(n)),!this._throttle("remove",s,100))return;!i&&this._watched.size===1&&this.add(t,e,true),this._getWatchedDir(s).getChildren().forEach(d=>this._remove(s,d));let a=this._getWatchedDir(t),l=a.has(e);a.remove(e),this._symlinkPaths.has(n)&&this._symlinkPaths.delete(n);let c=s;if(this.options.cwd&&(c=f.relative(this.options.cwd,s)),this.options.awaitWriteFinish&&this._pendingWrites.has(c)&&this._pendingWrites.get(c).cancelWait()===p.ADD)return;this._watched.delete(s),this._watched.delete(n);let u=i?p.UNLINK_DIR:p.UNLINK;l&&!this._isIgnored(s)&&this._emit(u,s),this._closePath(s);}_closePath(t){this._closeFile(t);let e=f.dirname(t);this._getWatchedDir(e).remove(f.basename(t));}_closeFile(t){let e=this._closers.get(t);e&&(e.forEach(i=>i()),this._closers.delete(t));}_addPathCloser(t,e){if(!e)return;let i=this._closers.get(t);i||(i=[],this._closers.set(t,i)),i.push(e);}_readdirp(t,e){if(this.closed)return;let i={type:p.ALL,alwaysStat:true,lstat:true,...e,depth:0},s=tt(t,i);return this._streams.add(s),s.once(nt,()=>{s=void 0;}),s.once(H,()=>{s&&(this._streams.delete(s),s=void 0);}),s}};Fe={watch:le,FSWatcher:N};});ce();/*! Bundled license information:
|
|
3
|
-
|
|
4
|
-
chokidar/index.js:
|
|
5
|
-
(*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
|
|
6
|
-
*/export{N as FSWatcher,K as WatchHelper,Fe as default,le as watch};
|
package/dist/chunk-5DWYVUQR.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkHTYVI2HK_cjs=require('./chunk-HTYVI2HK.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),crypto=require('crypto');chunkBUNLC3II_cjs.h();var c=chunkBUNLC3II_cjs.e(chunkHTYVI2HK_cjs.a(),1);var g=class{db;adapter;prefix;sessionTTL;refreshTokenTTL;indexesEnsured=false;constructor(e){this.db=e.db,this.adapter=e.adapter,this.prefix=e.collectionPrefix||"",this.sessionTTL=e.sessionTTL||86400,this.refreshTokenTTL=e.refreshTokenTTL||604800;}getDatabase(){let e=typeof this.db=="function"?this.db():this.db;if(!e&&this.adapter&&(this.adapter.db?e=this.adapter.db:this.adapter.client&&(this.adapter.db=this.adapter.client.db(this.adapter.database||"kyro_cms"),e=this.adapter.db)),!e)throw new Error("MongoDB database not initialized");return e}col(e){return this.getDatabase().collection(`${this.prefix}${e}`)}async connect(){this.indexesEnsured||await this.ensureIndexes();}async disconnect(){}async ensureIndexes(){await this.col("users").createIndex({email:1},{unique:true}),await this.col("users").createIndex({tenantId:1}),await this.col("users").createIndex({role:1}),await this.col("sessions").createIndex({token:1},{unique:true}),await this.col("sessions").createIndex({refreshToken:1}),await this.col("sessions").createIndex({userId:1}),await this.col("sessions").createIndex({expiresAt:1},{expireAfterSeconds:0}),await this.col("audit_logs").createIndex({timestamp:-1}),await this.col("audit_logs").createIndex({userId:1}),await this.col("audit_logs").createIndex({action:1}),await this.col("audit_logs").createIndex({resource:1}),await this.col("password_history").createIndex({userId:1,createdAt:-1}),await this.col("lockouts").createIndex({userId:1},{unique:true}),await this.col("lockouts").createIndex({lockedUntil:1}),this.indexesEnsured=true;}async createUser(e){let s=crypto.randomUUID(),t=new Date,i=await this.hashPassword(e.password),r={_id:s,name:e.name||null,email:e.email.toLowerCase(),passwordHash:i,role:e.role||"customer",avatar:e.avatar||null,tenantId:e.tenantId||null,emailVerified:false,locked:false,lastLogin:null,failedLoginAttempts:0,createdAt:t,updatedAt:t};return await this.col("users").insertOne(r),this.docToAuthUser(r)}async findUserByEmail(e){let s=await this.col("users").findOne({email:e.toLowerCase()});return s?this.docToAuthUser(s):null}async findUserById(e){let s=await this.col("users").findOne({_id:e});return s?this.docToAuthUser(s):null}async updateUser(e,s){let t={updatedAt:new Date};s.name!==void 0&&(t.name=s.name),s.email!==void 0&&(t.email=s.email),s.passwordHash!==void 0&&(t.passwordHash=s.passwordHash),s.role!==void 0&&(t.role=s.role),s.avatar!==void 0&&(t.avatar=s.avatar),s.tenantId!==void 0&&(t.tenantId=s.tenantId),s.emailVerified!==void 0&&(t.emailVerified=s.emailVerified),s.locked!==void 0&&(t.locked=s.locked),s.lastLogin!==void 0&&(t.lastLogin=s.lastLogin?new Date(s.lastLogin):null),s.failedLoginAttempts!==void 0&&(t.failedLoginAttempts=s.failedLoginAttempts);let i=await this.col("users").findOneAndUpdate({_id:e},{$set:t},{returnDocument:"after"});return i?this.docToAuthUser(i):null}async deleteUser(e){return (await this.col("users").deleteOne({_id:e})).deletedCount>0}async verifyPassword(e,s){let t=await this.findUserByEmail(e);if(!t)return null;let i=await this.col("users").findOne({email:e.toLowerCase()},{projection:{passwordHash:1}});return i?.passwordHash&&await c.default.compare(s,i.passwordHash)?t:null}async hashPassword(e){return c.default.hash(e,12)}async createSession(e,s){let t=crypto.randomUUID(),i=crypto.randomBytes(32).toString("base64url"),r=crypto.randomBytes(32).toString("base64url"),o=new Date,u=new Date(o.getTime()+this.sessionTTL*1e3),d={_id:t,userId:e,token:i,refreshToken:r,ipAddress:s?.ipAddress||null,userAgent:s?.userAgent||null,expiresAt:u,createdAt:o};return await this.col("sessions").insertOne(d),this.docToSession(d)}async findSessionByToken(e){let s=await this.col("sessions").findOne({token:e,expiresAt:{$gt:new Date}});return s?this.docToSession(s):null}async findSessionByRefreshToken(e){let s=await this.col("sessions").findOne({refreshToken:e,expiresAt:{$gt:new Date}});return s?this.docToSession(s):null}async deleteSession(e){return (await this.col("sessions").deleteOne({_id:e})).deletedCount>0}async deleteUserSessions(e){return (await this.col("sessions").deleteMany({userId:e})).deletedCount}async hasAnyUsers(){return await this.col("users").countDocuments()>0}async addPasswordToHistory(e,s){await this.col("password_history").insertOne({userId:e,passwordHash:s,createdAt:new Date});}async getPasswordHistory(e,s=5){return (await this.col("password_history").find({userId:e}).sort({createdAt:-1}).limit(s).toArray()).map(i=>i.passwordHash)}async isPasswordInHistory(e,s,t=5){let i=await this.getPasswordHistory(s,t);for(let r of i)if(await c.default.compare(e,r))return true;return false}async findAuditLogs(e){let{limit:s=50,offset:t=0,userId:i,action:r,resource:o,resourceId:u,success:d,startDate:f,endDate:h}=e,a={};i&&(a.userId=i),r&&(Array.isArray(r)?a.action={$in:r}:a.action=r),o&&(a.resource=o),u&&(a.resourceId=u),d!==void 0&&(a.success=d),(f||h)&&(a.timestamp={},f&&(a.timestamp.$gte=f),h&&(a.timestamp.$lte=h));let w=await this.col("audit_logs").countDocuments(a);return {logs:(await this.col("audit_logs").find(a).sort({timestamp:-1}).skip(t).limit(s).toArray()).map(n=>({id:n._id,timestamp:n.timestamp,action:n.action,userId:n.userId||void 0,userEmail:n.userEmail||void 0,role:n.role||void 0,resource:n.resource,resourceId:n.resourceId||void 0,changes:n.changes||void 0,ipAddress:n.ipAddress||void 0,userAgent:n.userAgent||void 0,success:n.success,error:n.error||void 0,metadata:n.metadata||void 0})),total:w}}async createAuditLog(e){let s=crypto.randomUUID(),t=new Date;return await this.col("audit_logs").insertOne({_id:s,action:e.action,userId:e.userId||null,userEmail:e.userEmail||null,role:e.role||null,resource:e.resource,resourceId:e.resourceId||null,changes:e.changes||null,ipAddress:e.ipAddress||null,userAgent:e.userAgent||null,success:e.success,error:e.error||null,metadata:e.metadata||null,timestamp:t}),{...e,id:s,timestamp:t}}docToAuthUser(e){return {id:e._id,name:e.name||void 0,email:e.email,passwordHash:e.passwordHash||void 0,role:e.role,tenantId:e.tenantId||void 0,avatar:e.avatar||void 0,emailVerified:e.emailVerified||false,locked:e.locked||false,lastLogin:e.lastLogin?.toISOString?.()||e.lastLogin||void 0,failedLoginAttempts:e.failedLoginAttempts||0,createdAt:e.createdAt?.toISOString?.()||e.createdAt,updatedAt:e.updatedAt?.toISOString?.()||e.updatedAt}}docToSession(e){return {id:e._id,userId:e.userId,token:e.token,refreshToken:e.refreshToken||void 0,expiresAt:e.expiresAt?.toISOString?.()||e.expiresAt,createdAt:e.createdAt?.toISOString?.()||e.createdAt,ipAddress:e.ipAddress||void 0,userAgent:e.userAgent||void 0}}async createEmailVerificationToken(e){let s=crypto.randomBytes(32).toString("hex"),t=new Date(Date.now()+1440*60*1e3),i=await import('./lib-5QYYN6ML.cjs');return await this.db.collection("email_verifications").insertOne({userId:new i.ObjectId(e),token:s,expiresAt:t,createdAt:new Date}),{token:s,expiresAt:t}}async verifyEmailToken(e){let s=await this.db.collection("email_verifications").findOne({token:e});return s?s.expiresAt<new Date?{success:false,error:"Verification token has expired"}:(await this.db.collection("users").updateOne({_id:s.userId},{$set:{emailVerified:true}}),await this.db.collection("email_verifications").deleteOne({_id:s._id}),{success:true,userId:s.userId.toString()}):{success:false,error:"Invalid verification token"}}async createPasswordResetToken(e){let s=await this.findUserByEmail(e);if(!s)return {token:"",expiresAt:new Date,error:"User not found"};let t=crypto.randomBytes(32).toString("hex"),i=new Date(Date.now()+3600*1e3),r=await import('./lib-5QYYN6ML.cjs');return await this.db.collection("password_resets").insertOne({userId:new r.ObjectId(s.id),token:t,expiresAt:i,createdAt:new Date}),{token:t,expiresAt:i}}async resetPasswordWithToken(e,s){let t=await this.db.collection("password_resets").findOne({token:e});if(!t)return {success:false,error:"Invalid reset token"};if(t.expiresAt<new Date)return {success:false,error:"Reset token has expired"};if(t.usedAt)return {success:false,error:"Reset token has already been used"};let i=await this.hashPassword(s);return await this.db.collection("users").updateOne({_id:t.userId},{$set:{passwordHash:i,updatedAt:new Date}}),await this.db.collection("password_resets").updateOne({_id:t._id},{$set:{usedAt:new Date}}),await this.db.collection("sessions").deleteMany({userId:t.userId}),{success:true}}};exports.a=g;
|
package/dist/chunk-6QWLXJ7L.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {createRequire}from'module';import {a}from'./chunk-BPMA2ECA.js';import {g as g$1,e}from'./chunk-C2PXMVR5.js';import {randomUUID,randomBytes}from'crypto';createRequire(import.meta.url);
|
|
2
|
-
g$1();var c=e(a(),1);var g=class{db;adapter;prefix;sessionTTL;refreshTokenTTL;indexesEnsured=false;constructor(e){this.db=e.db,this.adapter=e.adapter,this.prefix=e.collectionPrefix||"",this.sessionTTL=e.sessionTTL||86400,this.refreshTokenTTL=e.refreshTokenTTL||604800;}getDatabase(){let e=typeof this.db=="function"?this.db():this.db;if(!e&&this.adapter&&(this.adapter.db?e=this.adapter.db:this.adapter.client&&(this.adapter.db=this.adapter.client.db(this.adapter.database||"kyro_cms"),e=this.adapter.db)),!e)throw new Error("MongoDB database not initialized");return e}col(e){return this.getDatabase().collection(`${this.prefix}${e}`)}async connect(){this.indexesEnsured||await this.ensureIndexes();}async disconnect(){}async ensureIndexes(){await this.col("users").createIndex({email:1},{unique:true}),await this.col("users").createIndex({tenantId:1}),await this.col("users").createIndex({role:1}),await this.col("sessions").createIndex({token:1},{unique:true}),await this.col("sessions").createIndex({refreshToken:1}),await this.col("sessions").createIndex({userId:1}),await this.col("sessions").createIndex({expiresAt:1},{expireAfterSeconds:0}),await this.col("audit_logs").createIndex({timestamp:-1}),await this.col("audit_logs").createIndex({userId:1}),await this.col("audit_logs").createIndex({action:1}),await this.col("audit_logs").createIndex({resource:1}),await this.col("password_history").createIndex({userId:1,createdAt:-1}),await this.col("lockouts").createIndex({userId:1},{unique:true}),await this.col("lockouts").createIndex({lockedUntil:1}),this.indexesEnsured=true;}async createUser(e){let s=randomUUID(),t=new Date,i=await this.hashPassword(e.password),r={_id:s,name:e.name||null,email:e.email.toLowerCase(),passwordHash:i,role:e.role||"customer",avatar:e.avatar||null,tenantId:e.tenantId||null,emailVerified:false,locked:false,lastLogin:null,failedLoginAttempts:0,createdAt:t,updatedAt:t};return await this.col("users").insertOne(r),this.docToAuthUser(r)}async findUserByEmail(e){let s=await this.col("users").findOne({email:e.toLowerCase()});return s?this.docToAuthUser(s):null}async findUserById(e){let s=await this.col("users").findOne({_id:e});return s?this.docToAuthUser(s):null}async updateUser(e,s){let t={updatedAt:new Date};s.name!==void 0&&(t.name=s.name),s.email!==void 0&&(t.email=s.email),s.passwordHash!==void 0&&(t.passwordHash=s.passwordHash),s.role!==void 0&&(t.role=s.role),s.avatar!==void 0&&(t.avatar=s.avatar),s.tenantId!==void 0&&(t.tenantId=s.tenantId),s.emailVerified!==void 0&&(t.emailVerified=s.emailVerified),s.locked!==void 0&&(t.locked=s.locked),s.lastLogin!==void 0&&(t.lastLogin=s.lastLogin?new Date(s.lastLogin):null),s.failedLoginAttempts!==void 0&&(t.failedLoginAttempts=s.failedLoginAttempts);let i=await this.col("users").findOneAndUpdate({_id:e},{$set:t},{returnDocument:"after"});return i?this.docToAuthUser(i):null}async deleteUser(e){return (await this.col("users").deleteOne({_id:e})).deletedCount>0}async verifyPassword(e,s){let t=await this.findUserByEmail(e);if(!t)return null;let i=await this.col("users").findOne({email:e.toLowerCase()},{projection:{passwordHash:1}});return i?.passwordHash&&await c.default.compare(s,i.passwordHash)?t:null}async hashPassword(e){return c.default.hash(e,12)}async createSession(e,s){let t=randomUUID(),i=randomBytes(32).toString("base64url"),r=randomBytes(32).toString("base64url"),o=new Date,u=new Date(o.getTime()+this.sessionTTL*1e3),d={_id:t,userId:e,token:i,refreshToken:r,ipAddress:s?.ipAddress||null,userAgent:s?.userAgent||null,expiresAt:u,createdAt:o};return await this.col("sessions").insertOne(d),this.docToSession(d)}async findSessionByToken(e){let s=await this.col("sessions").findOne({token:e,expiresAt:{$gt:new Date}});return s?this.docToSession(s):null}async findSessionByRefreshToken(e){let s=await this.col("sessions").findOne({refreshToken:e,expiresAt:{$gt:new Date}});return s?this.docToSession(s):null}async deleteSession(e){return (await this.col("sessions").deleteOne({_id:e})).deletedCount>0}async deleteUserSessions(e){return (await this.col("sessions").deleteMany({userId:e})).deletedCount}async hasAnyUsers(){return await this.col("users").countDocuments()>0}async addPasswordToHistory(e,s){await this.col("password_history").insertOne({userId:e,passwordHash:s,createdAt:new Date});}async getPasswordHistory(e,s=5){return (await this.col("password_history").find({userId:e}).sort({createdAt:-1}).limit(s).toArray()).map(i=>i.passwordHash)}async isPasswordInHistory(e,s,t=5){let i=await this.getPasswordHistory(s,t);for(let r of i)if(await c.default.compare(e,r))return true;return false}async findAuditLogs(e){let{limit:s=50,offset:t=0,userId:i,action:r,resource:o,resourceId:u,success:d,startDate:f,endDate:h}=e,a={};i&&(a.userId=i),r&&(Array.isArray(r)?a.action={$in:r}:a.action=r),o&&(a.resource=o),u&&(a.resourceId=u),d!==void 0&&(a.success=d),(f||h)&&(a.timestamp={},f&&(a.timestamp.$gte=f),h&&(a.timestamp.$lte=h));let w=await this.col("audit_logs").countDocuments(a);return {logs:(await this.col("audit_logs").find(a).sort({timestamp:-1}).skip(t).limit(s).toArray()).map(n=>({id:n._id,timestamp:n.timestamp,action:n.action,userId:n.userId||void 0,userEmail:n.userEmail||void 0,role:n.role||void 0,resource:n.resource,resourceId:n.resourceId||void 0,changes:n.changes||void 0,ipAddress:n.ipAddress||void 0,userAgent:n.userAgent||void 0,success:n.success,error:n.error||void 0,metadata:n.metadata||void 0})),total:w}}async createAuditLog(e){let s=randomUUID(),t=new Date;return await this.col("audit_logs").insertOne({_id:s,action:e.action,userId:e.userId||null,userEmail:e.userEmail||null,role:e.role||null,resource:e.resource,resourceId:e.resourceId||null,changes:e.changes||null,ipAddress:e.ipAddress||null,userAgent:e.userAgent||null,success:e.success,error:e.error||null,metadata:e.metadata||null,timestamp:t}),{...e,id:s,timestamp:t}}docToAuthUser(e){return {id:e._id,name:e.name||void 0,email:e.email,passwordHash:e.passwordHash||void 0,role:e.role,tenantId:e.tenantId||void 0,avatar:e.avatar||void 0,emailVerified:e.emailVerified||false,locked:e.locked||false,lastLogin:e.lastLogin?.toISOString?.()||e.lastLogin||void 0,failedLoginAttempts:e.failedLoginAttempts||0,createdAt:e.createdAt?.toISOString?.()||e.createdAt,updatedAt:e.updatedAt?.toISOString?.()||e.updatedAt}}docToSession(e){return {id:e._id,userId:e.userId,token:e.token,refreshToken:e.refreshToken||void 0,expiresAt:e.expiresAt?.toISOString?.()||e.expiresAt,createdAt:e.createdAt?.toISOString?.()||e.createdAt,ipAddress:e.ipAddress||void 0,userAgent:e.userAgent||void 0}}async createEmailVerificationToken(e){let s=randomBytes(32).toString("hex"),t=new Date(Date.now()+1440*60*1e3),i=await import('./lib-IYW32OER.js');return await this.db.collection("email_verifications").insertOne({userId:new i.ObjectId(e),token:s,expiresAt:t,createdAt:new Date}),{token:s,expiresAt:t}}async verifyEmailToken(e){let s=await this.db.collection("email_verifications").findOne({token:e});return s?s.expiresAt<new Date?{success:false,error:"Verification token has expired"}:(await this.db.collection("users").updateOne({_id:s.userId},{$set:{emailVerified:true}}),await this.db.collection("email_verifications").deleteOne({_id:s._id}),{success:true,userId:s.userId.toString()}):{success:false,error:"Invalid verification token"}}async createPasswordResetToken(e){let s=await this.findUserByEmail(e);if(!s)return {token:"",expiresAt:new Date,error:"User not found"};let t=randomBytes(32).toString("hex"),i=new Date(Date.now()+3600*1e3),r=await import('./lib-IYW32OER.js');return await this.db.collection("password_resets").insertOne({userId:new r.ObjectId(s.id),token:t,expiresAt:i,createdAt:new Date}),{token:t,expiresAt:i}}async resetPasswordWithToken(e,s){let t=await this.db.collection("password_resets").findOne({token:e});if(!t)return {success:false,error:"Invalid reset token"};if(t.expiresAt<new Date)return {success:false,error:"Reset token has expired"};if(t.usedAt)return {success:false,error:"Reset token has already been used"};let i=await this.hashPassword(s);return await this.db.collection("users").updateOne({_id:t.userId},{$set:{passwordHash:i,updatedAt:new Date}}),await this.db.collection("password_resets").updateOne({_id:t._id},{$set:{usedAt:new Date}}),await this.db.collection("sessions").deleteMany({userId:t.userId}),{success:true}}};export{g as a};
|
package/dist/chunk-B3GDQ7UI.cjs
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
'use strict';var chunk7JWQ2PZP_cjs=require('./chunk-7JWQ2PZP.cjs'),chunkBCEE4NBZ_cjs=require('./chunk-BCEE4NBZ.cjs'),chunkVRZC4TTF_cjs=require('./chunk-VRZC4TTF.cjs'),chunkHTYVI2HK_cjs=require('./chunk-HTYVI2HK.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),crypto$1=require('crypto');chunkBUNLC3II_cjs.h();var R=chunkBUNLC3II_cjs.e(chunkHTYVI2HK_cjs.a(),1);var S=false,_=class{db;prefix;sessionTTL;refreshTokenTTL;constructor(e){this.db=e.db,this.prefix=e.prefix||"kyro:",this.sessionTTL=e.sessionTTL||86400,this.refreshTokenTTL=e.refreshTokenTTL||604800;}async connect(){S||(await this.db.execute(chunkVRZC4TTF_cjs.J`
|
|
2
|
-
CREATE TABLE IF NOT EXISTS "users" (
|
|
3
|
-
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
4
|
-
"name" VARCHAR(255),
|
|
5
|
-
"email" VARCHAR(255) NOT NULL,
|
|
6
|
-
"password_hash" VARCHAR(255),
|
|
7
|
-
"role" VARCHAR(50) NOT NULL DEFAULT 'customer',
|
|
8
|
-
"tenant_id" UUID,
|
|
9
|
-
"email_verified" BOOLEAN DEFAULT false,
|
|
10
|
-
"locked" BOOLEAN DEFAULT false,
|
|
11
|
-
"last_login" TIMESTAMP,
|
|
12
|
-
"failed_login_attempts" INTEGER DEFAULT 0,
|
|
13
|
-
"metadata" JSONB,
|
|
14
|
-
"avatar" VARCHAR(255),
|
|
15
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
16
|
-
"updated_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
17
|
-
)
|
|
18
|
-
`),await this.db.execute(chunkVRZC4TTF_cjs.J`ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "avatar" VARCHAR(255)`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE UNIQUE INDEX IF NOT EXISTS "users_email_idx" ON "users" ("email")`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "users_tenant_idx" ON "users" ("tenant_id")`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "users_role_idx" ON "users" ("role")`),await this.db.execute(chunkVRZC4TTF_cjs.J`
|
|
19
|
-
CREATE TABLE IF NOT EXISTS "sessions" (
|
|
20
|
-
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
21
|
-
"user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
|
22
|
-
"token" VARCHAR(512) NOT NULL UNIQUE,
|
|
23
|
-
"refresh_token" VARCHAR(512),
|
|
24
|
-
"ip_address" VARCHAR(45),
|
|
25
|
-
"user_agent" TEXT,
|
|
26
|
-
"expires_at" TIMESTAMP NOT NULL,
|
|
27
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
28
|
-
)
|
|
29
|
-
`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "sessions_user_idx" ON "sessions" ("user_id")`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "sessions_token_idx" ON "sessions" ("token")`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "sessions_expires_idx" ON "sessions" ("expires_at")`),await this.db.execute(chunkVRZC4TTF_cjs.J`
|
|
30
|
-
CREATE TABLE IF NOT EXISTS "audit_logs" (
|
|
31
|
-
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
32
|
-
"action" VARCHAR(100) NOT NULL,
|
|
33
|
-
"user_id" UUID REFERENCES "users"("id") ON DELETE SET NULL,
|
|
34
|
-
"user_email" VARCHAR(255),
|
|
35
|
-
"role" VARCHAR(50),
|
|
36
|
-
"resource" VARCHAR(100) NOT NULL,
|
|
37
|
-
"resource_id" VARCHAR(255),
|
|
38
|
-
"changes" JSONB,
|
|
39
|
-
"ip_address" VARCHAR(45),
|
|
40
|
-
"user_agent" TEXT,
|
|
41
|
-
"success" BOOLEAN NOT NULL DEFAULT true,
|
|
42
|
-
"error" TEXT,
|
|
43
|
-
"metadata" JSONB,
|
|
44
|
-
"timestamp" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
45
|
-
)
|
|
46
|
-
`),await this.db.execute(chunkVRZC4TTF_cjs.J`ALTER TABLE "audit_logs" ALTER COLUMN "resource_id" TYPE VARCHAR(255)`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "audit_logs_user_idx" ON "audit_logs" ("user_id")`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "audit_logs_action_idx" ON "audit_logs" ("action")`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "audit_logs_resource_idx" ON "audit_logs" ("resource")`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "audit_logs_timestamp_idx" ON "audit_logs" ("timestamp")`),await this.db.execute(chunkVRZC4TTF_cjs.J`
|
|
47
|
-
CREATE TABLE IF NOT EXISTS "password_history" (
|
|
48
|
-
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
49
|
-
"user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
|
50
|
-
"password_hash" VARCHAR(255) NOT NULL,
|
|
51
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
52
|
-
)
|
|
53
|
-
`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "password_history_user_idx" ON "password_history" ("user_id")`),await this.db.execute(chunkVRZC4TTF_cjs.J`
|
|
54
|
-
CREATE TABLE IF NOT EXISTS "lockouts" (
|
|
55
|
-
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
56
|
-
"user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
|
57
|
-
"ip_address" VARCHAR(45),
|
|
58
|
-
"reason" VARCHAR(255),
|
|
59
|
-
"locked_until" TIMESTAMP NOT NULL,
|
|
60
|
-
"released_at" TIMESTAMP,
|
|
61
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
62
|
-
)
|
|
63
|
-
`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "lockouts_user_idx" ON "lockouts" ("user_id")`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "lockouts_locked_until_idx" ON "lockouts" ("locked_until")`),await this.db.execute(chunkVRZC4TTF_cjs.J`
|
|
64
|
-
CREATE TABLE IF NOT EXISTS "roles" (
|
|
65
|
-
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
66
|
-
"name" VARCHAR(100) NOT NULL UNIQUE,
|
|
67
|
-
"level" INTEGER NOT NULL DEFAULT 0,
|
|
68
|
-
"inherits" TEXT[],
|
|
69
|
-
"description" TEXT,
|
|
70
|
-
"permissions" JSONB DEFAULT '[]',
|
|
71
|
-
"is_system" BOOLEAN DEFAULT false,
|
|
72
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
73
|
-
"updated_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
74
|
-
)
|
|
75
|
-
`),await this.db.execute(chunkVRZC4TTF_cjs.J`CREATE INDEX IF NOT EXISTS "roles_level_idx" ON "roles" ("level")`),await this.db.execute(chunkVRZC4TTF_cjs.J`
|
|
76
|
-
CREATE TABLE IF NOT EXISTS "tenants" (
|
|
77
|
-
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
78
|
-
"name" VARCHAR(255) NOT NULL,
|
|
79
|
-
"slug" VARCHAR(100) NOT NULL UNIQUE,
|
|
80
|
-
"settings" JSONB DEFAULT '{}',
|
|
81
|
-
"is_active" BOOLEAN DEFAULT true,
|
|
82
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
83
|
-
"updated_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
84
|
-
)
|
|
85
|
-
`),await this.db.execute(chunkVRZC4TTF_cjs.J`
|
|
86
|
-
CREATE TABLE IF NOT EXISTS "api_keys" (
|
|
87
|
-
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
88
|
-
"user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
|
89
|
-
"name" VARCHAR(255) NOT NULL,
|
|
90
|
-
"key" VARCHAR(64) NOT NULL UNIQUE,
|
|
91
|
-
"key_prefix" VARCHAR(8) NOT NULL,
|
|
92
|
-
"permissions" JSONB DEFAULT '[]',
|
|
93
|
-
"last_used_at" TIMESTAMP,
|
|
94
|
-
"expires_at" TIMESTAMP,
|
|
95
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
96
|
-
)
|
|
97
|
-
`),await this.db.execute(chunkVRZC4TTF_cjs.J`
|
|
98
|
-
CREATE TABLE IF NOT EXISTS "email_verifications" (
|
|
99
|
-
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
100
|
-
"user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
|
101
|
-
"token" VARCHAR(64) NOT NULL UNIQUE,
|
|
102
|
-
"expires_at" TIMESTAMP NOT NULL,
|
|
103
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
104
|
-
)
|
|
105
|
-
`),await this.db.execute(chunkVRZC4TTF_cjs.J`
|
|
106
|
-
CREATE TABLE IF NOT EXISTS "password_resets" (
|
|
107
|
-
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
108
|
-
"user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
|
109
|
-
"token" VARCHAR(64) NOT NULL UNIQUE,
|
|
110
|
-
"expires_at" TIMESTAMP NOT NULL,
|
|
111
|
-
"used_at" TIMESTAMP,
|
|
112
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
113
|
-
)
|
|
114
|
-
`),S=true);}async disconnect(){}async createUser(e){let s=await this.hashPassword(e.password),[t]=await this.db.insert(chunk7JWQ2PZP_cjs.a).values({email:e.email.toLowerCase(),name:e.name,passwordHash:s,role:e.role||"customer",avatar:e.avatar,tenantId:e.tenantId}).returning();return this.userToAuthUser(t)}async findUserByEmail(e){let[s]=await this.db.select().from(chunk7JWQ2PZP_cjs.a).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.a.email,e.toLowerCase())).limit(1);return s?this.userToAuthUser(s):null}async findUserById(e){let[s]=await this.db.select().from(chunk7JWQ2PZP_cjs.a).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.a.id,e)).limit(1);return s?this.userToAuthUser(s):null}async updateUser(e,s){let t={updatedAt:new Date};s.name!==void 0&&(t.name=s.name),s.email!==void 0&&(t.email=s.email),s.passwordHash!==void 0&&(t.passwordHash=s.passwordHash),s.role!==void 0&&(t.role=s.role),s.tenantId!==void 0&&(t.tenantId=s.tenantId),s.avatar!==void 0&&(t.avatar=s.avatar),s.emailVerified!==void 0&&(t.emailVerified=s.emailVerified),s.locked!==void 0&&(t.locked=s.locked),s.lastLogin!==void 0&&(t.lastLogin=s.lastLogin?new Date(s.lastLogin):null),s.failedLoginAttempts!==void 0&&(t.failedLoginAttempts=s.failedLoginAttempts);let[r]=await this.db.update(chunk7JWQ2PZP_cjs.a).set(t).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.a.id,e)).returning();return r?this.userToAuthUser(r):null}async deleteUser(e){return await this.db.delete(chunk7JWQ2PZP_cjs.a).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.a.id,e)),true}async findUsers(e={}){let s=e.page??1,t=e.limit??10,r=(s-1)*t,u=e.search;if(u){let m=`%${u}%`,[w,[{count:p}]]=await Promise.all([this.db.select().from(chunk7JWQ2PZP_cjs.a).where(chunkVRZC4TTF_cjs.J`${chunk7JWQ2PZP_cjs.a.email} ILIKE ${m}`).orderBy(chunkBCEE4NBZ_cjs.M(chunk7JWQ2PZP_cjs.a.createdAt)).limit(t).offset(r),this.db.select({count:chunkVRZC4TTF_cjs.J`count(*)`}).from(chunk7JWQ2PZP_cjs.a).where(chunkVRZC4TTF_cjs.J`${chunk7JWQ2PZP_cjs.a.email} ILIKE ${m}`)]);return {users:w.map(c=>this.userToAuthUser(c)),total:Number(p)}}let[l,[{count:E}]]=await Promise.all([this.db.select().from(chunk7JWQ2PZP_cjs.a).orderBy(chunkBCEE4NBZ_cjs.M(chunk7JWQ2PZP_cjs.a.createdAt)).limit(t).offset(r),this.db.select({count:chunkVRZC4TTF_cjs.J`count(*)`}).from(chunk7JWQ2PZP_cjs.a)]);return {users:l.map(m=>this.userToAuthUser(m)),total:Number(E)}}async verifyPassword(e,s){let t=await this.findUserByEmail(e);if(!t)return null;let[r]=await this.db.select().from(chunk7JWQ2PZP_cjs.a).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.a.email,e.toLowerCase())).limit(1);return r?.passwordHash&&await R.default.compare(s,r.passwordHash)?t:null}async hashPassword(e){return R.default.hash(e,12)}async createSession(e,s){let t=crypto$1.randomBytes(32).toString("base64url"),r=crypto$1.randomBytes(32).toString("base64url"),u=new Date(Date.now()+this.sessionTTL*1e3);new Date(Date.now()+this.refreshTokenTTL*1e3);let [E]=await this.db.insert(chunk7JWQ2PZP_cjs.d).values({userId:e,token:t,refreshToken:r,ipAddress:s?.ipAddress,userAgent:s?.userAgent,expiresAt:u}).returning();return this.sessionToSession(E)}async findSessionByToken(e){let[s]=await this.db.select().from(chunk7JWQ2PZP_cjs.d).where(chunkBCEE4NBZ_cjs.p(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.d.token,e),chunkBCEE4NBZ_cjs.s(chunk7JWQ2PZP_cjs.d.expiresAt,new Date))).limit(1);return s?this.sessionToSession(s):null}async findSessionByRefreshToken(e){let[s]=await this.db.select().from(chunk7JWQ2PZP_cjs.d).where(chunkBCEE4NBZ_cjs.p(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.d.refreshToken,e),chunkBCEE4NBZ_cjs.s(chunk7JWQ2PZP_cjs.d.expiresAt,new Date))).limit(1);return s?this.sessionToSession(s):null}async deleteSession(e){return await this.db.delete(chunk7JWQ2PZP_cjs.d).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.d.id,e)),true}async deleteUserSessions(e){return await this.db.delete(chunk7JWQ2PZP_cjs.d).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.d.userId,e)),1}async addPasswordToHistory(e,s){await this.db.insert(chunk7JWQ2PZP_cjs.j).values({userId:e,passwordHash:s});}async getPasswordHistory(e,s=5){return (await this.db.select({passwordHash:chunk7JWQ2PZP_cjs.j.passwordHash}).from(chunk7JWQ2PZP_cjs.j).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.j.userId,e)).orderBy(chunkBCEE4NBZ_cjs.M(chunk7JWQ2PZP_cjs.j.createdAt)).limit(s)).map(r=>r.passwordHash)}async isPasswordInHistory(e,s,t=5){let r=await this.getPasswordHistory(s,t);for(let u of r)if(await this.verifyPassword(e,u))return true;return false}async isLocked(e){let[s]=await this.db.select().from(chunk7JWQ2PZP_cjs.k).where(chunkBCEE4NBZ_cjs.p(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.k.userId,e),chunkBCEE4NBZ_cjs.s(chunk7JWQ2PZP_cjs.k.lockedUntil,new Date))).limit(1);return !!s}async getLockout(e){let[s]=await this.db.select().from(chunk7JWQ2PZP_cjs.k).where(chunkBCEE4NBZ_cjs.p(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.k.userId,e),chunkBCEE4NBZ_cjs.s(chunk7JWQ2PZP_cjs.k.lockedUntil,new Date))).limit(1);return s?{lockedUntil:s.lockedUntil}:null}async recordFailedAttempt(e,s){let r=((await this.findUserById(e))?.failedLoginAttempts||0)+1;await this.updateUser(e,{failedLoginAttempts:r});let l=r>=5;return l&&await this.db.insert(chunk7JWQ2PZP_cjs.k).values({userId:e,ipAddress:s,reason:"Too many failed login attempts",lockedUntil:new Date(Date.now()+9e5)}),{attempts:r,locked:l}}async resetAttempts(e){await this.updateUser(e,{failedLoginAttempts:0});}async findAuditLogs(e){let{limit:s=50,offset:t=0,userId:r,action:u,resource:l,resourceId:E,success:m,startDate:w,endDate:p}=e,c=[];r&&c.push(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.e.userId,r)),u&&(Array.isArray(u)?c.push(chunkVRZC4TTF_cjs.J`${chunk7JWQ2PZP_cjs.e.action} = ANY(${u})`):c.push(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.e.action,u))),l&&c.push(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.e.resource,l)),E&&c.push(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.e.resourceId,E)),m!==void 0&&c.push(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.e.success,m)),w&&c.push(chunkVRZC4TTF_cjs.J`${chunk7JWQ2PZP_cjs.e.timestamp} >= ${w}`),p&&c.push(chunkVRZC4TTF_cjs.J`${chunk7JWQ2PZP_cjs.e.timestamp} <= ${p}`);let O=c.length>0?chunkBCEE4NBZ_cjs.p(...c):void 0,b=await this.db.select({count:chunkVRZC4TTF_cjs.J`count(*)`}).from(chunk7JWQ2PZP_cjs.e).where(O);return {logs:(await this.db.select().from(chunk7JWQ2PZP_cjs.e).where(O).orderBy(chunkBCEE4NBZ_cjs.M(chunk7JWQ2PZP_cjs.e.timestamp)).limit(s).offset(t)).map(o=>({id:o.id,timestamp:o.timestamp,action:o.action,userId:o.userId||void 0,userEmail:o.userEmail||void 0,role:o.role||void 0,resource:o.resource,resourceId:o.resourceId||void 0,changes:o.changes||void 0,ipAddress:o.ipAddress||void 0,userAgent:o.userAgent||void 0,success:o.success,error:o.error||void 0,metadata:o.metadata||void 0})),total:Number(b[0]?.count||0)}}async createAuditLog(e){let s=crypto.randomUUID(),t=new Date;return await this.db.insert(chunk7JWQ2PZP_cjs.e).values({id:s,action:e.action,userId:e.userId??null,userEmail:e.userEmail??null,role:e.role??null,resource:e.resource,resourceId:e.resourceId??null,changes:e.changes??null,ipAddress:e.ipAddress??null,userAgent:e.userAgent??null,success:e.success,error:e.error??null,metadata:e.metadata??null,timestamp:t}),{...e,id:s,timestamp:t}}userToAuthUser(e){return {id:e.id,name:e.name||void 0,email:e.email,passwordHash:e.passwordHash||void 0,role:e.role,avatar:e.avatar&&typeof e.avatar=="object"?e.avatar.id||void 0:e.avatar||void 0,tenantId:e.tenantId||void 0,emailVerified:e.emailVerified||false,locked:e.locked||false,lastLogin:e.lastLogin?new Date(e.lastLogin).toISOString():void 0,failedLoginAttempts:e.failedLoginAttempts||0,createdAt:new Date(e.createdAt).toISOString(),updatedAt:new Date(e.updatedAt).toISOString()}}sessionToSession(e){return {id:e.id,userId:e.userId,token:e.token,refreshToken:e.refreshToken||void 0,expiresAt:new Date(e.expiresAt).toISOString(),createdAt:new Date(e.createdAt).toISOString(),ipAddress:e.ipAddress||void 0,userAgent:e.userAgent||void 0}}async createEmailVerificationToken(e){let s=crypto$1.randomBytes(32).toString("hex"),t=new Date(Date.now()+1440*60*1e3);return await this.db.insert(chunk7JWQ2PZP_cjs.h).values({userId:e,token:s,expiresAt:t}),{token:s,expiresAt:t}}async verifyEmailToken(e){let[s]=await this.db.select().from(chunk7JWQ2PZP_cjs.h).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.h.token,e)).limit(1);return s?s.expiresAt<new Date?{success:false,error:"Verification token has expired"}:(await this.db.update(chunk7JWQ2PZP_cjs.a).set({emailVerified:true}).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.a.id,s.userId)),await this.db.delete(chunk7JWQ2PZP_cjs.h).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.h.id,s.id)),{success:true,userId:s.userId}):{success:false,error:"Invalid verification token"}}async createPasswordResetToken(e){let s=await this.findUserByEmail(e);if(!s)return {token:"",expiresAt:new Date,error:"User not found"};let t=crypto$1.randomBytes(32).toString("hex"),r=new Date(Date.now()+3600*1e3);return await this.db.insert(chunk7JWQ2PZP_cjs.i).values({userId:s.id,token:t,expiresAt:r}),{token:t,expiresAt:r}}async resetPasswordWithToken(e,s){let[t]=await this.db.select().from(chunk7JWQ2PZP_cjs.i).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.i.token,e)).limit(1);if(!t)return {success:false,error:"Invalid reset token"};if(t.expiresAt<new Date)return {success:false,error:"Reset token has expired"};if(t.usedAt)return {success:false,error:"Reset token has already been used"};let r=await this.hashPassword(s);return await this.db.update(chunk7JWQ2PZP_cjs.a).set({passwordHash:r,updatedAt:new Date}).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.a.id,t.userId)),await this.db.update(chunk7JWQ2PZP_cjs.i).set({usedAt:new Date}).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.i.id,t.id)),await this.db.delete(chunk7JWQ2PZP_cjs.d).where(chunkBCEE4NBZ_cjs.n(chunk7JWQ2PZP_cjs.d.userId,t.userId)),{success:true}}};exports.a=_;
|
package/dist/chunk-BLH2MRK4.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {createRequire}from'module';import {g}from'./chunk-C2PXMVR5.js';createRequire(import.meta.url);
|
|
2
|
-
g();function o(e){if(e==null)return e;if(Array.isArray(e))return e.map(n=>o(n));if(typeof e=="object"&&!(e instanceof Date)&&!(e instanceof RegExp)){let n={};for(let r of Object.keys(e))/^\d+$/.test(r)||(n[r]=o(e[r]));return n}return e}export{o as a};
|
package/dist/chunk-EOOZDOL7.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
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};
|
package/dist/chunk-F3MCWKOW.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkR4N352LI_cjs=require('./chunk-R4N352LI.cjs'),chunkQYI3GOHF_cjs=require('./chunk-QYI3GOHF.cjs'),chunkQN5ULXBX_cjs=require('./chunk-QN5ULXBX.cjs'),chunkBHR7OAU4_cjs=require('./chunk-BHR7OAU4.cjs'),chunk6KUL2BSA_cjs=require('./chunk-6KUL2BSA.cjs'),chunkB3GDQ7UI_cjs=require('./chunk-B3GDQ7UI.cjs'),chunk5DWYVUQR_cjs=require('./chunk-5DWYVUQR.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),w=require('kyro:config');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var w__default=/*#__PURE__*/_interopDefault(w);chunkBUNLC3II_cjs.h();exports.a=null;var l=null;async function b(){if(!exports.a){if(globalThis.__KYRO_INSTANCE__)try{await globalThis.__KYRO_INSTANCE__.shutdown();}catch{}try{let e=w__default.default.default||w__default.default,t=e.adapter,o=t&&!t.dialect&&typeof t.connect=="function";if(globalThis.DB&&(!t||o)){let s=globalThis.DB;e.adapter=new chunk6KUL2BSA_cjs.c({type:"sqlite",client:s}),chunkR4N352LI_cjs.C.info("Hot-swapped to D1 DrizzleAdapter");}exports.a=chunkR4N352LI_cjs.A(e);let a=e.adapter,p=a&&a.dialect&&(a.dialect==="postgres"||a.dialect==="sqlite"),c=a&&a.dialect==="mongodb",n;if(p)a.dialect==="postgres"?n=new chunkB3GDQ7UI_cjs.a({db:a.client}):a.dialect==="sqlite"&&(n=new chunkQN5ULXBX_cjs.nb({db:a.rawClient||a.client}));else if(o&&!globalThis.DB){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";n=new chunkBHR7OAU4_cjs.a({path:s});}else c&&(n=new chunk5DWYVUQR_cjs.a({db:a.client}));if(n?.connect)try{await n.connect();}catch(s){chunkR4N352LI_cjs.C.warn("Auth connect warning:",s);}await exports.a.init();try{await exports.a.loadSettings();}catch(s){chunkR4N352LI_cjs.C.warn("loadSettings warning:",s);}try{await chunkQYI3GOHF_cjs.e(n);}catch(s){chunkR4N352LI_cjs.C.warn("autoBootstrap warning:",s);}globalThis.__KYRO_INSTANCE__=exports.a;}catch(e){throw exports.a=null,l=null,chunkR4N352LI_cjs.C.error("Init failed, will retry:",e),e}}}async function E(e){let t=globalThis.DB?globalThis:null;try{let{env:o}=await import('cloudflare:workers');o&&(t=o);}catch{}if(e)try{t=e.locals?.cfContext?.env||e?.env||t;}catch{}if(!t)try{t=process.env;}catch{}t?.DB&&(globalThis.DB=t.DB),t?.STORAGE_BUCKET&&(globalThis.STORAGE_BUCKET=t.STORAGE_BUCKET),l||(l=b()),await l;}var _={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function T(e){return exports.a?exports.a.settings?.access?.apiAccess?.[e]??_[e]??true:_[e]??true}var q=async e=>{if(!exports.a)try{await Promise.race([E(e),new Promise((t,o)=>setTimeout(()=>o(new Error("Initialization timeout")),3e4))]);}catch(t){return console.error("[Kyro API] Warm error:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Service Unavailable",message:"Kyro CMS is still starting up. Please try again in a moment."}),{status:503,headers:{"Content-Type":"application/json","Retry-After":"5"}})}try{let o=new URL(e.request.url).pathname,a=__KYRO_API_PATH__;if(o===`${a}/graphql`&&typeof exports.a.getGraphQL=="function"){if(!T("graphqlEnabled"))return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await exports.a.getGraphQL().fetch(e.request,e.locals);return new Response(n.body,n)}if(o.startsWith(`${a}/trpc/`)&&typeof exports.a.getTRPC=="function"){if(!T("trpcEnabled"))return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await exports.a.getTRPC().fetch(e.request,e.locals);return new Response(n.body,n)}return await(await exports.a.getREST()).fetch(e.request,e.locals)}catch(t){return console.error("[Kyro API Execution Error]:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Internal Server Error",message:t?.message||String(t),stack:t?.stack}),{status:500,headers:{"Content-Type":"application/json"}})}};exports.b=E;exports.c=q;
|