@shumai-one/shumai 0.6.0 → 0.6.2
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/bin/chunk-01052ssf.js +32 -0
- package/bin/{chunk-cdk8vqeg.js → chunk-02fvcrej.js} +4 -4
- package/bin/chunk-0bj887zm.js +2 -0
- package/bin/chunk-167z646e.js +2 -0
- package/bin/chunk-1ktk6764.js +10 -0
- package/bin/{chunk-4jj92zwa.js → chunk-1nvd90g2.js} +1 -1
- package/bin/{chunk-ww9qq8yq.js → chunk-1wfg56z3.js} +5 -5
- package/bin/{chunk-3tg10kwz.js → chunk-257dcd2f.js} +2 -2
- package/bin/chunk-26qn7fek.js +2 -0
- package/bin/chunk-2cdxm1cp.js +55 -0
- package/bin/chunk-2jj4j8cn.js +3 -0
- package/bin/chunk-2ne2b54t.js +2 -0
- package/bin/{chunk-h1fbev9c.js → chunk-2nhgdqdg.js} +2 -2
- package/bin/chunk-2vbeqczj.js +1 -0
- package/bin/chunk-37p6bcx2.js +1 -0
- package/bin/chunk-3ckkwdjx.js +13 -0
- package/bin/chunk-3knfx6dm.js +1 -0
- package/bin/chunk-3z85zxkn.js +1 -0
- package/bin/chunk-4mws03es.js +5 -0
- package/bin/chunk-54tbfvya.js +2 -0
- package/bin/chunk-55h9ze53.js +2 -0
- package/bin/chunk-56kh5fxc.js +1 -0
- package/bin/chunk-576nj64j.js +2 -0
- package/bin/{chunk-9gftd4f7.js → chunk-5wapd171.js} +13 -13
- package/bin/chunk-6cnqjngz.js +1 -0
- package/bin/chunk-73yncv54.js +2 -0
- package/bin/chunk-7g46e1wy.js +3 -0
- package/bin/{chunk-3020am4q.js → chunk-7naa7tpn.js} +2 -2
- package/bin/{chunk-6zerk0em.js → chunk-7sgrtxbt.js} +2 -2
- package/bin/{chunk-5bpvwv66.js → chunk-7v7mypc6.js} +2 -2
- package/bin/chunk-82tps5n1.js +2 -0
- package/bin/chunk-84x8p7v5.js +1 -0
- package/bin/{chunk-fxg81vtx.js → chunk-88jg9dq5.js} +2 -2
- package/bin/chunk-8cjet7pp.js +12 -0
- package/bin/chunk-8fyg9dy4.js +2 -0
- package/bin/chunk-8gtfgkrn.js +2 -0
- package/bin/chunk-8mqbztj8.js +2 -0
- package/bin/chunk-8qdtvfx3.css +1 -0
- package/bin/chunk-8xb6yz11.js +2 -0
- package/bin/chunk-8yjsmr7g.js +2 -0
- package/bin/chunk-91rb0jpb.js +2 -0
- package/bin/chunk-96qpjght.js +2 -0
- package/bin/chunk-9f1xk1nt.js +1 -0
- package/bin/chunk-9mk9cvbk.js +1 -0
- package/bin/{chunk-65t6rm5d.js → chunk-9n1w5dw1.js} +3 -3
- package/bin/chunk-9nw5w8vh.js +1 -0
- package/bin/{chunk-cv5xx81e.js → chunk-9t3p4xp6.js} +1 -1
- package/bin/chunk-9xhjy897.js +11 -0
- package/bin/chunk-9zsv6d2f.js +1 -0
- package/bin/chunk-a411xhmm.js +7 -0
- package/bin/{chunk-xbw7ffrz.js → chunk-a74g6h8a.js} +2 -2
- package/bin/chunk-ah8fjb6f.js +2 -0
- package/bin/chunk-atfz7g7e.js +2 -0
- package/bin/{chunk-j4p3eqtd.js → chunk-b5rhvzv9.js} +2 -2
- package/bin/{chunk-rq2h2bwt.js → chunk-b7bnp021.js} +2 -2
- package/bin/chunk-cf5axr8c.js +1 -0
- package/bin/chunk-cgmebxx6.js +2 -0
- package/bin/chunk-cwat1jwx.js +3 -0
- package/bin/chunk-cz13a82m.js +3 -0
- package/bin/chunk-dk42gf7v.js +2 -0
- package/bin/chunk-e4f56spj.js +4 -0
- package/bin/chunk-e4yscwen.js +18 -0
- package/bin/chunk-eb7mzbfm.js +1 -0
- package/bin/chunk-er14d498.js +3 -0
- package/bin/{chunk-sbyyn9yw.js → chunk-eyjfhdp9.js} +2 -2
- package/bin/chunk-f25fe9th.js +393 -0
- package/bin/chunk-f6avg5qe.js +129 -0
- package/bin/{chunk-vjyget8s.js → chunk-fatmqnp1.js} +1 -1
- package/bin/chunk-fvx9k1dc.js +2 -0
- package/bin/chunk-g22wmpk1.js +3 -0
- package/bin/chunk-g6sdezec.js +2 -0
- package/bin/chunk-gtf19jc1.js +2 -0
- package/bin/chunk-gxepkvt2.js +2 -0
- package/bin/chunk-h1n7jqnw.js +1 -0
- package/bin/chunk-hfm82066.js +2 -0
- package/bin/chunk-hnkcgvcj.js +3 -0
- package/bin/{chunk-fg9sr6r9.js → chunk-hpbn0k9n.js} +2 -2
- package/bin/{chunk-qk5hsn6e.js → chunk-hpwv4am3.js} +4 -4
- package/bin/{chunk-d6xezgrg.js → chunk-hw6czrya.js} +1 -1
- package/bin/{chunk-59t9s2jh.js → chunk-hzkjgcre.js} +1 -1
- package/bin/chunk-j2s311yc.js +3 -0
- package/bin/{chunk-6hzktewz.js → chunk-jt02kpfc.js} +2 -2
- package/bin/{chunk-qnyqtaf0.js → chunk-jt0ykktx.js} +1 -1
- package/bin/{chunk-047n9gfs.js → chunk-jzgbxqdg.js} +2 -2
- package/bin/chunk-kj6h5j5a.js +4 -0
- package/bin/chunk-km4gn6b6.js +1 -0
- package/bin/chunk-knj2s8mg.js +16 -0
- package/bin/{chunk-01ym2agz.js → chunk-kvhf12b4.js} +2 -2
- package/bin/chunk-m0q2cgfg.js +2 -0
- package/bin/chunk-m82tkhaa.js +11 -0
- package/bin/chunk-m9adtgzk.js +2 -0
- package/bin/{chunk-rh8dy99a.js → chunk-mcj1xpcc.js} +2 -2
- package/bin/chunk-mcw198kg.js +13 -0
- package/bin/{chunk-5e7r7a9d.js → chunk-mwktrwtx.js} +1 -1
- package/bin/chunk-mzsw9var.js +3 -0
- package/bin/chunk-ns33grgx.js +2 -0
- package/bin/{chunk-emgyjhmx.js → chunk-ny1kbmxt.js} +2 -2
- package/bin/{chunk-czybv3vy.js → chunk-p3f5aevs.js} +1 -1
- package/bin/chunk-p3j6ydk1.js +1 -0
- package/bin/chunk-p4s95471.js +2 -0
- package/bin/chunk-pk406dgy.js +2 -0
- package/bin/chunk-q2bew2vc.js +2 -0
- package/bin/chunk-q5vkxee3.js +5 -0
- package/bin/{chunk-n0wwtjwv.js → chunk-q83h0hkx.js} +2 -2
- package/bin/chunk-q8w4mbw4.js +2 -0
- package/bin/{chunk-hjwpd09v.js → chunk-qwpkcp8d.js} +2 -2
- package/bin/chunk-r1xer8gn.js +5 -0
- package/bin/chunk-s1e4qy3q.js +14 -0
- package/bin/{chunk-w89czwjj.js → chunk-s9ksftq2.js} +1 -1
- package/bin/chunk-srxp5jav.js +42 -0
- package/bin/chunk-swtwaaqe.js +1 -0
- package/bin/chunk-tagdrg7p.js +1 -0
- package/bin/{chunk-da86fpjt.js → chunk-tekwpkjf.js} +2 -2
- package/bin/chunk-twtxnzbv.js +2 -0
- package/bin/{chunk-q7t5zs7n.js → chunk-v05rrxp5.js} +2 -2
- package/bin/{chunk-8s9fehda.js → chunk-v5cn90cf.js} +2 -2
- package/bin/chunk-v5mcjwxy.js +2 -0
- package/bin/{chunk-fyb6t7ct.js → chunk-vcrmjtcz.js} +2 -2
- package/bin/chunk-vkzasgxw.js +2 -0
- package/bin/chunk-vp3czaeh.js +7 -0
- package/bin/chunk-x03jwaga.js +8 -0
- package/bin/chunk-x342vzdx.js +2 -0
- package/bin/chunk-x8mjh387.js +5 -0
- package/bin/chunk-xc54vhfz.js +2 -0
- package/bin/chunk-xvkwbczx.js +3 -0
- package/bin/chunk-y241cxff.js +1 -0
- package/bin/chunk-yk12hydf.js +7 -0
- package/bin/chunk-ympbfzz4.js +2 -0
- package/bin/chunk-yq32evnn.js +20 -0
- package/bin/chunk-z1p13dnc.js +2 -0
- package/bin/chunk-zarz3sqn.js +211 -0
- package/bin/chunk-zezje74z.js +4 -0
- package/bin/chunk-zrszykjf.js +3 -0
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +947 -1012
- package/package.json +7 -7
- package/prisma/migrations/20261026024507_hash_api_tokens/migration.sql +28 -0
- package/prisma/migrations/20261026031904_add_audit_log_via/migration.sql +2 -0
- package/prisma/migrations/20261029024626_add_oauth_and_jwks/migration.sql +205 -0
- package/prisma/migrations/20261029030321_default_empty_arrays_oauth/migration.sql +25 -0
- package/prisma/schema.prisma +186 -1
- package/bin/chunk-0a4ahz7r.js +0 -2
- package/bin/chunk-0awcpx0a.js +0 -3
- package/bin/chunk-0fbgfgxv.js +0 -12
- package/bin/chunk-0nnqha4f.js +0 -3
- package/bin/chunk-0tvggyy4.js +0 -1
- package/bin/chunk-113baw0m.js +0 -2
- package/bin/chunk-1dbjyarc.js +0 -2
- package/bin/chunk-1qre79kf.js +0 -1
- package/bin/chunk-23780yj6.js +0 -3
- package/bin/chunk-27v3yepb.js +0 -1
- package/bin/chunk-2rq3w8sg.js +0 -2
- package/bin/chunk-3fjgf7eb.js +0 -3
- package/bin/chunk-3pwwg1xm.js +0 -1
- package/bin/chunk-3sfb63fp.js +0 -2
- package/bin/chunk-4g4pxmef.js +0 -3
- package/bin/chunk-4yhvexzk.js +0 -5
- package/bin/chunk-58cbk6e8.js +0 -1
- package/bin/chunk-5m51b7af.js +0 -2
- package/bin/chunk-6bed0rz4.js +0 -1
- package/bin/chunk-6smn0q1n.js +0 -20
- package/bin/chunk-7bbsv8g0.js +0 -2
- package/bin/chunk-83bdgs2c.js +0 -1
- package/bin/chunk-86qtjd30.js +0 -11
- package/bin/chunk-8rekh4h9.js +0 -3
- package/bin/chunk-8sf2hf31.js +0 -2
- package/bin/chunk-9d3w678j.js +0 -1
- package/bin/chunk-9rcg8zgs.js +0 -42
- package/bin/chunk-a23q1kc4.js +0 -5
- package/bin/chunk-a6cdt85k.js +0 -2
- package/bin/chunk-a76h3ehe.js +0 -1
- package/bin/chunk-b1bkd2p4.js +0 -32
- package/bin/chunk-bf5m8f6t.js +0 -2
- package/bin/chunk-cf57fk11.js +0 -2
- package/bin/chunk-d4sbcvpa.js +0 -2
- package/bin/chunk-dzjmwat0.js +0 -14
- package/bin/chunk-eex8sjfs.js +0 -2
- package/bin/chunk-exmwerag.js +0 -18
- package/bin/chunk-f38xyahm.js +0 -1
- package/bin/chunk-fb1bes2h.js +0 -2
- package/bin/chunk-fbvak7q2.js +0 -1
- package/bin/chunk-g2ptqqm3.js +0 -3
- package/bin/chunk-ggwqxn95.js +0 -2
- package/bin/chunk-ghk54h71.js +0 -13
- package/bin/chunk-h9akn41s.js +0 -3
- package/bin/chunk-hdansxny.js +0 -2
- package/bin/chunk-hjzbw975.js +0 -2
- package/bin/chunk-jtkxeat4.js +0 -2
- package/bin/chunk-jw4g9628.js +0 -5
- package/bin/chunk-jxebakyq.js +0 -1
- package/bin/chunk-kfewyax2.js +0 -2
- package/bin/chunk-kk3m4za5.js +0 -1
- package/bin/chunk-m7tnj47b.js +0 -3
- package/bin/chunk-maw5ah8t.js +0 -3
- package/bin/chunk-nahdd2t9.js +0 -2
- package/bin/chunk-nv7tztvh.js +0 -129
- package/bin/chunk-nyjwdxyj.js +0 -3
- package/bin/chunk-p0yfxt5e.js +0 -54
- package/bin/chunk-q27qn367.js +0 -5
- package/bin/chunk-q36sdt2w.js +0 -2
- package/bin/chunk-qbj5pe8t.js +0 -1
- package/bin/chunk-qj0bxb1m.js +0 -2
- package/bin/chunk-qqkr6h07.js +0 -11
- package/bin/chunk-qyqc5j3a.css +0 -1
- package/bin/chunk-qzaf6bre.js +0 -2
- package/bin/chunk-r1e59gf0.js +0 -2
- package/bin/chunk-ra5csbkr.js +0 -2
- package/bin/chunk-rx9g95wk.js +0 -10
- package/bin/chunk-rxyy37wa.js +0 -4
- package/bin/chunk-scez7ppq.js +0 -3
- package/bin/chunk-t2a1vq34.js +0 -7
- package/bin/chunk-t879v3b7.js +0 -1
- package/bin/chunk-tjavzarz.js +0 -3
- package/bin/chunk-treyx8em.js +0 -2
- package/bin/chunk-v3z4z04s.js +0 -2
- package/bin/chunk-v3z63tpw.js +0 -2
- package/bin/chunk-v9bes1fv.js +0 -2
- package/bin/chunk-vmm9m3nv.js +0 -2
- package/bin/chunk-vvr8tnse.js +0 -211
- package/bin/chunk-w3stry4v.js +0 -1
- package/bin/chunk-wk0hk00z.js +0 -1
- package/bin/chunk-x4q082e6.js +0 -2
- package/bin/chunk-x6rf77jm.js +0 -16
- package/bin/chunk-x7dyj53k.js +0 -2
- package/bin/chunk-xcrd0y8v.js +0 -6
- package/bin/chunk-z0z0jn5h.js +0 -4
- package/bin/chunk-zasjhrwc.js +0 -2
- package/bin/chunk-zefds5gg.js +0 -1
- package/bin/chunk-zzzgk1d5.js +0 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{z}from"./chunk-zarz3sqn.js";var a=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],zo=z("upload",a);
|
|
2
|
+
export{zo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Yt}from"./chunk-9xhjy897.js";import{at,sr}from"./chunk-e4yscwen.js";import{se}from"./chunk-2jj4j8cn.js";var A=se(Yt()),f=se(at());var g=se(at()),P=se(sr());import{createHash as F,createPrivateKey as L,createPublicKey as O,sign as H}from"crypto";import{promises as x}from"fs";import{homedir as K}from"os";import{dirname as _,join as I}from"path";class h{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=300000;constructor(e,t,s){this.profileData=e,this.init=t,this.callerClientConfig=s}async loadCredentials(){let e=await this.loadToken();if(!e)throw new g.CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:!1,logger:this.logger});let t=e.accessToken,s=Date.now();if(new Date(t.expiresAt).getTime()-s<=h.REFRESH_THRESHOLD)return this.refresh(e);return this.toCredentials(e.accessToken)}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}toCredentials(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken,accountId:e.accountId,expiration:new Date(e.expiresAt)}}async refresh(e){let t=await this.loadToken().catch(()=>e),s=Date.now(),r=new Date(t.accessToken.expiresAt).getTime(),n=new Date(e.accessToken.expiresAt).getTime(),o=r<=s&&n>s?e:t;if(new Date(o.accessToken.expiresAt).getTime()-Date.now()>h.REFRESH_THRESHOLD)return this.toCredentials(o.accessToken);let{SigninClient:p,CreateOAuth2TokenCommand:w}=await import("./chunk-fatmqnp1.js"),{logger:y,userAgentAppId:m}=this.callerClientConfig??{},T=((i)=>i?.metadata?.handlerProtocol==="h2")(this.callerClientConfig?.requestHandler)?void 0:this.callerClientConfig?.requestHandler,d=this.profileData.region??await this.callerClientConfig?.region?.()??process.env.AWS_REGION,u=new p({credentials:{accessKeyId:"",secretAccessKey:""},region:d,requestHandler:T,logger:y,userAgentAppId:m,...this.init?.clientConfig});this.createDPoPInterceptor(u.middlewareStack);let S={tokenInput:{clientId:o.clientId,refreshToken:o.refreshToken,grantType:"refresh_token"}};try{let i=await u.send(new w(S)),{accessKeyId:c,secretAccessKey:k,sessionToken:l}=i.tokenOutput?.accessToken??{},{refreshToken:D,expiresIn:N}=i.tokenOutput??{};if(!c||!k||!l||!D)throw new g.CredentialsProviderError("Token refresh response missing required fields",{logger:this.logger,tryNextLink:!1});let R=(N??900)*1000,b=new Date(Date.now()+R),C={...o,accessToken:{...o.accessToken,accessKeyId:c,secretAccessKey:k,sessionToken:l,expiresAt:b.toISOString()},refreshToken:D};return await this.saveToken(C),this.toCredentials(C.accessToken)}catch(i){if(i.name==="AccessDeniedException"){let k=i.error,l;switch(k){case"TOKEN_EXPIRED":l="Your session has expired. Please reauthenticate.";break;case"USER_CREDENTIALS_CHANGED":l="Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";break;case"INSUFFICIENT_PERMISSIONS":l="Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";break;default:l=`Failed to refresh token: ${String(i)}. Please re-authenticate using \`aws login\``}throw new g.CredentialsProviderError(l,{logger:this.logger,tryNextLink:!1})}if(new Date(o.accessToken.expiresAt).getTime()>Date.now())return this.logger?.warn?.(`Failed to refresh token: ${String(i)}. Using existing token until expiry.`),this.toCredentials(o.accessToken);throw new g.CredentialsProviderError(`Failed to refresh token: ${String(i)}. Please re-authenticate using aws login`,{logger:this.logger})}}async loadToken(){let e=this.getTokenFilePath();try{let t=await x.readFile(e,"utf8"),s=JSON.parse(t),r=["accessToken","clientId","refreshToken","dpopKey"].filter((n)=>!s[n]);if(!s.accessToken?.accountId)r.push("accountId");if(r.length>0)throw new g.CredentialsProviderError(`Token validation failed, missing fields: ${r.join(", ")}`,{logger:this.logger,tryNextLink:!1});return s}catch(t){throw new g.CredentialsProviderError(`Failed to load token from ${e}: ${String(t)}`,{logger:this.logger,tryNextLink:!1})}}async saveToken(e){let t=this.getTokenFilePath(),s=_(t);try{await x.mkdir(s,{recursive:!0})}catch(r){}await x.writeFile(t,JSON.stringify(e,null,2),"utf8")}getTokenFilePath(){let e=process.env.AWS_LOGIN_CACHE_DIRECTORY??I(K(),".aws","login","cache"),t=Buffer.from(this.loginSession,"utf8"),s=F("sha256").update(t).digest("hex");return I(e,`${s}.json`)}derToRawSignature(e){let t=2;if(e[t]!==2)throw Error("Invalid DER signature");t++;let s=e[t++],r=e.subarray(t,t+s);if(t+=s,e[t]!==2)throw Error("Invalid DER signature");t++;let n=e[t++],o=e.subarray(t,t+n);r=r[0]===0?r.subarray(1):r,o=o[0]===0?o.subarray(1):o;let a=Buffer.concat([Buffer.alloc(32-r.length),r]),p=Buffer.concat([Buffer.alloc(32-o.length),o]);return Buffer.concat([a,p])}createDPoPInterceptor(e){e.add((t)=>async(s)=>{if(P.HttpRequest.isInstance(s.request)){let r=s.request,n=`${r.protocol}//${r.hostname}${r.port?`:${r.port}`:""}${r.path}`,o=await this.generateDpop(r.method,n);r.headers={...r.headers,DPoP:o}}return t(s)},{step:"finalizeRequest",name:"dpopInterceptor",override:!0})}async generateDpop(e="POST",t){let s=await this.loadToken();try{let r=L({key:s.dpopKey,format:"pem",type:"sec1"}),o=O(r).export({format:"der",type:"spki"}),a=-1;for(let c=0;c<o.length;c++)if(o[c]===4){a=c;break}let p=o.slice(a+1,a+33),w=o.slice(a+33,a+65),y={alg:"ES256",typ:"dpop+jwt",jwk:{kty:"EC",crv:"P-256",x:p.toString("base64url"),y:w.toString("base64url")}},m={jti:crypto.randomUUID(),htm:e,htu:t,iat:Math.floor(Date.now()/1000)},E=Buffer.from(JSON.stringify(y)).toString("base64url"),T=Buffer.from(JSON.stringify(m)).toString("base64url"),d=`${E}.${T}`,u=H("sha256",Buffer.from(d),r),i=this.derToRawSignature(u).toString("base64url");return`${d}.${i}`}catch(r){throw new g.CredentialsProviderError(`Failed to generate Dpop proof: ${r instanceof Error?r.message:String(r)}`,{logger:this.logger,tryNextLink:!1})}}}var v=(e)=>async({callerClientConfig:t}={})=>{e?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");let s=await f.parseKnownFiles(e||{}),r=f.getProfileName({profile:e?.profile??t?.profile}),n=s[r];if(!n?.login_session)throw new f.CredentialsProviderError(`Profile ${r} does not contain login_session.`,{tryNextLink:!0,logger:e?.logger});let a=await new h(n,e,t).loadCredentials();return A.setCredentialFeature(a,"CREDENTIALS_LOGIN","AD")};export{v as fromLoginCredentials};
|