@bkm016/basalt 0.1.0 → 0.1.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/README.md +16 -22
- package/chunk-06hdzq5n.js +2 -0
- package/chunk-09rj27b2.js +2 -0
- package/{chunk-qnr1f5pj.js → chunk-0y7ne3d0.js} +2 -2
- package/{chunk-8wjgbd9k.js → chunk-10xzzn07.js} +2 -2
- package/{chunk-bj14jshr.js → chunk-1qpces5a.js} +2 -2
- package/chunk-1zdwrgd4.js +2 -0
- package/chunk-27gntzs5.js +5 -0
- package/chunk-2esbgxps.js +25 -0
- package/{chunk-913tfr9c.js → chunk-362g64pd.js} +1 -1
- package/{chunk-rjdhaasf.js → chunk-3cjsd292.js} +2 -2
- package/chunk-5c9j8qe4.js +478 -0
- package/chunk-5j1krv9v.js +2 -0
- package/{chunk-vkkj4awb.js → chunk-6hssbcgj.js} +1 -1
- package/chunk-75m78j7x.js +10 -0
- package/{chunk-zt1wvkyf.js → chunk-8296hw9m.js} +1 -1
- package/{chunk-9y69ywyg.js → chunk-8d46jtbj.js} +2 -2
- package/{chunk-sf13azm4.js → chunk-8tjad3r0.js} +4 -4
- package/{chunk-agntrqs9.js → chunk-97rzj7f6.js} +1 -1
- package/{chunk-k7w7ac9q.js → chunk-981f9dw8.js} +8 -8
- package/chunk-9mmz6wt3.js +2 -0
- package/chunk-aefadsy6.js +3 -0
- package/chunk-bannb9xm.js +3 -0
- package/chunk-bpw6q7g0.js +3 -0
- package/{chunk-3jz9g8ab.js → chunk-c7x1zq39.js} +3 -3
- package/{chunk-rv06x0kn.js → chunk-cjc90f84.js} +1 -1
- package/{chunk-6gyhajhx.js → chunk-d2j735sd.js} +2 -2
- package/{chunk-qcwnkr5y.js → chunk-d8gtbw9g.js} +1 -1
- package/{chunk-rm3kcxq9.js → chunk-fjtvjrkg.js} +13 -13
- package/{chunk-qbf8x2ft.js → chunk-fm0k0qtz.js} +1 -1
- package/{chunk-1yzt0qm0.js → chunk-fw2bpqmw.js} +1 -1
- package/{chunk-kgdrjqsy.js → chunk-g2t6t8fk.js} +2 -2
- package/{chunk-wc5j0hfw.js → chunk-gp7y0fja.js} +13 -13
- package/{chunk-5fdgy0q2.js → chunk-gzxnene8.js} +10 -10
- package/{chunk-y9xe9ct2.js → chunk-hwr56pfj.js} +1 -1
- package/{chunk-0hbjv3y6.js → chunk-jwdb0ccj.js} +3 -3
- package/{chunk-x9982ek7.js → chunk-k23t7vhs.js} +5 -5
- package/{chunk-qffb7een.js → chunk-k506w58v.js} +2 -2
- package/{chunk-0tdv0t5q.js → chunk-k6w6y71k.js} +2 -2
- package/chunk-m40gxwq4.js +5 -0
- package/chunk-m8vkwdgr.js +5 -0
- package/{chunk-7yw8aa5j.js → chunk-mvfsxdx6.js} +13 -13
- package/{chunk-3p7q2pyp.js → chunk-nbb9trwz.js} +1 -1
- package/{chunk-0szjy61m.js → chunk-pbcy6zdt.js} +1 -1
- package/chunk-pmqtkqsf.js +2 -0
- package/{chunk-hat3s3pr.js → chunk-pxsrqrd0.js} +1 -1
- package/{chunk-xsbxykr4.js → chunk-qe0teyn1.js} +1 -1
- package/{chunk-2zqny2sy.js → chunk-r7fpkb49.js} +1 -1
- package/{chunk-xhk54h2q.js → chunk-rtzqqngy.js} +4 -4
- package/chunk-ry0z4ev6.js +2 -0
- package/{chunk-0rya8cxe.js → chunk-shadcb9z.js} +2 -2
- package/chunk-shhrr741.js +3753 -0
- package/{chunk-tnrqkc7b.js → chunk-t6zs4kw0.js} +2 -2
- package/chunk-tvm4zmgj.js +3 -0
- package/{chunk-hcn9cf6v.js → chunk-v258nxcz.js} +1 -1
- package/{chunk-a6r4z44b.js → chunk-vk1gxk1t.js} +1 -1
- package/{chunk-d913kpyw.js → chunk-vv7fp27r.js} +2 -2
- package/{chunk-g2k3yhgh.js → chunk-x1xss1d7.js} +3 -3
- package/{chunk-dakrpbe6.js → chunk-x4874m8e.js} +2 -2
- package/{chunk-wx7kdf0b.js → chunk-xfvvh1s5.js} +1 -1
- package/{chunk-1egbcp85.js → chunk-y0m980k3.js} +7 -7
- package/{chunk-5wp4egky.js → chunk-y58ygzn9.js} +4 -4
- package/{chunk-kjr81mrd.js → chunk-y648fzx0.js} +5 -5
- package/{chunk-32at88hc.js → chunk-y7nma9rk.js} +1 -1
- package/{chunk-wd9zxhza.js → chunk-ykens1hy.js} +1 -1
- package/chunk-z55bmysw.js +2 -0
- package/chunk-zmsgwr3s.js +2 -0
- package/{chunk-501zkf9b.js → chunk-ztsjgssj.js} +1 -1
- package/cli.js +89 -0
- package/compiled.js +12 -3762
- package/package.json +4 -3
- package/ui-test-worker.js +67 -67
- package/web/chunk-0sewdyz1.js +1 -0
- package/web/{chunk-g9qv15hq.js → chunk-1z5p7a1h.js} +1 -1
- package/web/chunk-21ke27j6.js +1 -0
- package/web/{chunk-svmhj9hd.js → chunk-24k0r5aq.js} +1 -1
- package/web/{chunk-vqjs551t.js → chunk-284a17k8.js} +1 -1
- package/web/{chunk-3cfabjey.js → chunk-2pjdtesn.js} +14 -14
- package/web/{chunk-ngpq43vn.js → chunk-3mvr2gwh.js} +1 -1
- package/web/chunk-3t3zwx9j.js +1 -0
- package/web/{chunk-ezyvv4ab.js → chunk-3z93efr4.js} +1 -1
- package/web/{chunk-rkesqprv.js → chunk-43jqvsrg.js} +1 -1
- package/web/{chunk-4y2td14d.js → chunk-4bry4xds.js} +2 -2
- package/web/{chunk-ea9swkkt.js → chunk-5e7ygjdn.js} +1 -1
- package/web/{chunk-3ahpr030.js → chunk-5jbf7n5q.js} +1 -1
- package/web/{chunk-bhe4jzha.js → chunk-5rx8rtsa.js} +1 -1
- package/web/chunk-5xc9d5ft.js +1 -0
- package/web/{chunk-fdkp6tzq.js → chunk-693m9kt7.js} +3 -3
- package/web/{chunk-mq92vqb1.js → chunk-6qejm5s2.js} +1 -1
- package/web/{chunk-z1jtv4c0.js → chunk-8ah6ce1b.js} +2 -2
- package/web/{chunk-zk2f7x5e.js → chunk-8e43yaq3.js} +3 -3
- package/web/{chunk-hejz98gw.js → chunk-8wye0wbb.js} +1 -1
- package/web/{chunk-pz934t6t.js → chunk-986z0p48.js} +5 -5
- package/web/{chunk-jtwhjp20.js → chunk-9dd1c37b.js} +77 -77
- package/web/{chunk-sc63gh9d.js → chunk-9re6yttj.js} +2 -2
- package/web/{chunk-1t760bg0.js → chunk-abbvjt4e.js} +1 -1
- package/web/{chunk-1v3d60pp.js → chunk-agmkx996.js} +3 -3
- package/web/{chunk-kbtbbarw.js → chunk-anbn2ttv.js} +2 -2
- package/web/chunk-aqm3spxt.js +1139 -0
- package/web/{chunk-jvhmna7z.js → chunk-avwpjsxw.js} +5 -5
- package/web/chunk-b470hvpk.js +1 -0
- package/web/{chunk-29e1trsq.js → chunk-bt1m87ck.js} +2 -2
- package/web/chunk-cqp1d4p0.js +1 -0
- package/web/{chunk-b5brnfv9.js → chunk-ctcrk3qn.js} +2 -2
- package/web/{chunk-zakv2xdf.js → chunk-ctd8bfg2.js} +1 -1
- package/web/{chunk-5hex8g0y.js → chunk-cwvtraca.js} +1 -1
- package/web/{chunk-1x8fn8w9.js → chunk-dk90px7g.js} +1 -1
- package/web/{chunk-0mrkjnte.js → chunk-ds7srg4p.js} +1 -1
- package/web/{chunk-6r912gfj.js → chunk-dt8ss97f.js} +5 -5
- package/web/{chunk-ykxpb3wv.js → chunk-ezkqa7we.js} +1 -1
- package/web/{chunk-svdzmaxb.js → chunk-f078k1ej.js} +1 -1
- package/web/chunk-fekjj24p.css +1 -0
- package/web/{chunk-v6v831tc.js → chunk-fqj9kry9.js} +5 -5
- package/web/chunk-frjfamx7.js +8 -0
- package/web/{chunk-rz6wwdd5.js → chunk-fy8ey195.js} +1 -1
- package/web/{chunk-p8y0hjx9.js → chunk-g8ee1csm.js} +1 -1
- package/web/{chunk-ktqt87qw.js → chunk-h31p43qa.js} +1 -1
- package/web/chunk-h5p5jsrw.js +1 -0
- package/web/chunk-h9fmr6ch.js +1 -0
- package/web/{chunk-x9q4kh67.js → chunk-jf2ehmvp.js} +2 -2
- package/web/{chunk-canbct9d.js → chunk-jmnaq7c1.js} +1 -1
- package/web/chunk-jq0pw0k2.js +1 -0
- package/web/{chunk-ghxe4gam.js → chunk-jvj66qhs.js} +2 -2
- package/web/{chunk-7f0m2yrd.js → chunk-jzmzhj8z.js} +4 -4
- package/web/chunk-k4cfnvyq.js +1 -0
- package/web/{chunk-942prjb6.js → chunk-kgerjbn4.js} +1 -1
- package/web/{chunk-3bqh2dkw.js → chunk-kww4azv5.js} +5 -5
- package/web/chunk-m29dhjkh.js +1 -0
- package/web/chunk-mj6tee5h.js +1 -0
- package/web/{chunk-a3xt6840.js → chunk-mjpjkyd1.js} +1 -1
- package/web/{chunk-20q90epj.js → chunk-n8sky2q6.js} +1 -1
- package/web/{chunk-3pf33xsm.js → chunk-pk3ap3wh.js} +4 -4
- package/web/{chunk-tfyxp2qs.js → chunk-q1pkntc6.js} +4 -4
- package/web/{chunk-gxn0bey7.js → chunk-qryrg2pq.js} +2 -2
- package/web/{chunk-0xck277j.js → chunk-r92sbgwv.js} +5 -5
- package/web/{chunk-ev1g5cqw.js → chunk-raqqscwa.js} +2 -2
- package/web/{chunk-c85wxnpw.js → chunk-rc2vq9wz.js} +3 -3
- package/web/{chunk-rsn8j7xv.js → chunk-rkj743fg.js} +3 -3
- package/web/{chunk-v47rhg7b.js → chunk-rrws61wf.js} +1 -1
- package/web/{chunk-ytpwz01r.js → chunk-s3hwejnr.js} +2 -2
- package/web/{chunk-bwyw10wx.js → chunk-s3rdx28k.js} +2 -2
- package/web/{chunk-hryhthxr.js → chunk-shbw6wg8.js} +1 -1
- package/web/chunk-szcy5z56.js +1 -0
- package/web/{chunk-ejd43q75.js → chunk-t1xk6hca.js} +4 -4
- package/web/chunk-t2hhdg9r.js +1 -0
- package/web/chunk-tj4cmkwe.js +1 -0
- package/web/{chunk-mdsgekpk.js → chunk-tn1xzmgx.js} +1 -1
- package/web/{chunk-0k0hvh59.js → chunk-tnv7z83q.js} +1 -1
- package/web/chunk-v2b5q0n5.js +1 -0
- package/web/{chunk-haphmhz8.js → chunk-vj6kstpp.js} +5 -5
- package/web/{chunk-e5rmr47n.js → chunk-vjqmnkh2.js} +1 -1
- package/web/{chunk-vfqe8298.js → chunk-vkc149rb.js} +1 -1
- package/web/{chunk-n5fn9khr.js → chunk-vny496ba.js} +1 -1
- package/web/{chunk-s8vapqgr.js → chunk-vz5ck6x9.js} +1 -1
- package/web/{chunk-6atq9qtt.js → chunk-xa88zgkr.js} +1 -1
- package/web/{chunk-d4d3mnak.js → chunk-xdcs8qz3.js} +4 -4
- package/web/chunk-y5x74t89.js +1 -0
- package/web/{chunk-x3zwjkwg.js → chunk-yen2kkn2.js} +1 -1
- package/web/{chunk-vadqkz3x.js → chunk-yjv2c45j.js} +4 -4
- package/web/chunk-yx3dh5hg.js +1 -0
- package/web/chunk-yz4fmtk2.js +1 -0
- package/web/{chunk-4b5mt5pd.js → chunk-z24vs8q9.js} +3 -3
- package/web/chunk-z5j6x6j8.js +2 -0
- package/web/chunk-z5stjrhc.js +1 -0
- package/web/{chunk-3pm4645m.js → chunk-z760wagr.js} +1 -1
- package/web/{chunk-nerx2q12.js → chunk-znvnb9dh.js} +1 -1
- package/web/{chunk-55kw67nv.js → chunk-zrzq29e6.js} +1 -1
- package/web/{icon-yx2p2pye.svg → icon-1wgy7kzy.svg} +13 -13
- package/web/icon.svg +13 -13
- package/web/index.html +2 -2
- package/web/install.sh +0 -0
- package/web/sw.js +9 -0
- package/worker.js +1 -1
- package/chunk-1fv27j4b.js +0 -3
- package/chunk-356q8e0y.js +0 -10
- package/chunk-58vz2qsq.js +0 -2
- package/chunk-665jzf2w.js +0 -25
- package/chunk-97kjn55j.js +0 -2
- package/chunk-b9bg5fhd.js +0 -2
- package/chunk-c25s4w6a.js +0 -5
- package/chunk-j2x0g1vg.js +0 -2
- package/chunk-k0t23cmx.js +0 -2
- package/chunk-m38ber71.js +0 -2
- package/chunk-rad3dm0q.js +0 -2
- package/chunk-sytpmbfp.js +0 -471
- package/chunk-t057xfrt.js +0 -5
- package/chunk-tjpvayr1.js +0 -2
- package/chunk-ve7qx8wm.js +0 -3
- package/chunk-y8ced1jm.js +0 -5
- package/chunk-yb1jxgnk.js +0 -2
- package/web/chunk-00mq7bhx.js +0 -1
- package/web/chunk-0atfn8jf.js +0 -1
- package/web/chunk-310yey4q.js +0 -1
- package/web/chunk-32ezm0ry.js +0 -1136
- package/web/chunk-3hvgs5aw.js +0 -1
- package/web/chunk-3kh6zefg.js +0 -1
- package/web/chunk-401v5ht6.js +0 -8
- package/web/chunk-5r5kv4gh.js +0 -1
- package/web/chunk-95q1bwxn.js +0 -1
- package/web/chunk-9s7c178f.js +0 -1
- package/web/chunk-benmmqt2.js +0 -1
- package/web/chunk-bgqdcnke.js +0 -1
- package/web/chunk-eqegxtdt.js +0 -1
- package/web/chunk-gmfp7fg4.js +0 -1
- package/web/chunk-gxay64d5.js +0 -1
- package/web/chunk-jg6nzn6q.js +0 -1
- package/web/chunk-kx2xk3bb.js +0 -1
- package/web/chunk-ry9256r7.js +0 -1
- package/web/chunk-vfqdy860.js +0 -1
- package/web/chunk-wtawdeej.css +0 -1
- package/web/chunk-x59p8sg2.js +0 -1
- package/web/chunk-y7z144e3.js +0 -1
- package/web/chunk-ydgqrfvw.js +0 -2
- package/web/chunk-yj1a2d37.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{F}from"./chunk-
|
|
2
|
+
import{F}from"./chunk-m8vkwdgr.js";import{_}from"./chunk-pxsrqrd0.js";import{z,fe}from"./chunk-x4874m8e.js";import{M,qt,Te}from"./chunk-shadcb9z.js";class u extends Error{code;diagnosticDetails;constructor(r,t,n){super(r);this.name="PiMessagesResponseError",this.code=t,this.diagnosticDetails=n}}function x(r){try{let t=JSON.parse(r),n=t?.error;return t&&typeof n==="object"&&n!==null&&!Array.isArray(n)?t:void 0}catch{return}}function m(r){return r.length>8192?`${r.slice(0,8192)}\u2026`:r}function y(r,t,n){let e=typeof n?.error?.message==="string"?n.error.message:void 0,s=typeof n?.error?.code==="string"?n.error.code:void 0,a=e??t,o=s?` (${s})`:"";return`${r.status} ${r.statusText}: ${a}${o}`}function k(r,t,n,e){let s=x(e),a=typeof s?.error?.code==="string"?s.error.code:void 0;return new u(y(n,e,s),a,{version:1,provider:r.provider,model:r.id,url:t.toString(),status:n.status,statusText:n.statusText,...s?.error===void 0?{}:{error:s.error},...s?{}:{body:m(e)},timestampMs:Date.now()})}function h(){return{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}function l(r,t){if(!t)return;Te(r,{type:"pi_messages_rewrite",timestamp:Date.now(),details:{...t}})}function w(r){let t={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:"pending",timestamp:Date.now()},n=new Map;return(e)=>{switch(e.type){case"done":if(Object.assign(t,{stopReason:e.reason,usage:e.usage,responseId:e.responseId}),e.providerThinkingLevel!==void 0)t.providerThinkingLevel=e.providerThinkingLevel;return l(t,e.rewrite),{type:"done",reason:e.reason,message:t};case"error":if(Object.assign(t,{stopReason:e.reason,usage:e.usage,errorMessage:e.errorMessage,responseId:e.responseId}),e.providerThinkingLevel!==void 0)t.providerThinkingLevel=e.providerThinkingLevel;return l(t,e.rewrite),{type:"error",reason:e.reason,error:t};case"start":break;case"text_start":t.content[e.contentIndex]={type:"text",text:""};break;case"text_delta":t.content[e.contentIndex].text+=e.delta;break;case"text_end":Object.assign(t.content[e.contentIndex],{text:e.content,textSignature:e.contentSignature});break;case"thinking_start":t.content[e.contentIndex]={type:"thinking",thinking:""};break;case"thinking_delta":t.content[e.contentIndex].thinking+=e.delta;break;case"thinking_end":Object.assign(t.content[e.contentIndex],{thinking:e.content,thinkingSignature:e.contentSignature,redacted:e.redacted});break;case"toolcall_start":t.content[e.contentIndex]={type:"toolCall",id:e.id,name:e.toolName,arguments:{}},n.set(e.contentIndex,"");break;case"toolcall_delta":{let s=`${n.get(e.contentIndex)??""}${e.delta}`;n.set(e.contentIndex,s),t.content[e.contentIndex].arguments=F(s);break}case"toolcall_end":return Object.assign(t.content[e.contentIndex],e.toolCall),n.delete(e.contentIndex),{type:"toolcall_end",contentIndex:e.contentIndex,toolCall:t.content[e.contentIndex],partial:t}}return{...e,partial:t}}}async function*b(r){let t=new TextDecoder,n=r.getReader(),e="";try{while(!0){let{done:s,value:a}=await n.read();e+=s?t.decode():t.decode(a,{stream:!0}),e=e.replace(/\r\n/g,`
|
|
3
3
|
`);let o=e.indexOf(`
|
|
4
4
|
|
|
5
5
|
`);while(o!==-1){let c=f(e.slice(0,o));if(c)yield c;e=e.slice(o+2),o=e.indexOf(`
|
|
6
6
|
|
|
7
7
|
`)}if(s)break}if(e.trim()){let s=f(e);if(s)yield s}}finally{n.releaseLock()}}function f(r){let t=r.split(`
|
|
8
|
-
`).find((n)=>n.startsWith("data:"))?.slice(5).trim();return t&&t!=="[DONE]"?JSON.parse(t):void 0}function I(r,t,n){let e=n?"aborted":"error",s={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:e,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()};if(!n&&t instanceof u)Te(s,qt("pi_messages_response_failure",t,t.diagnosticDetails));return{type:"error",reason:e,error:s}}function E(r,t){if(r)return r;return _("PI_CACHE_RETENTION",t)==="long"?"long":void 0}var T=(r,t,n)=>{let e=new M,s=w(r);return(async()=>{try{let a=n?.apiKey;if(!a)throw Error(`No API key provided for provider "${r.provider}"`);let o=new URL(`${r.baseUrl.replace(/\/+$/u,"")}/messages`);if(n?.debug)o.searchParams.set("debug","1");let c={model:r.id,context:t,options:{temperature:n?.temperature,maxTokens:n?.maxTokens,reasoning:n?.reasoning,cacheRetention:E(n?.cacheRetention,n?.env),sessionId:n?.sessionId,toolChoice:n?.toolChoice}},p=await n?.onPayload?.(c,r);if(p!==void 0)c=p;let i=await(n?.fetch??globalThis.fetch)(o,{method:"POST",headers:{authorization:`Bearer ${a}`,accept:"text/event-stream","content-type":"application/json",...
|
|
8
|
+
`).find((n)=>n.startsWith("data:"))?.slice(5).trim();return t&&t!=="[DONE]"?JSON.parse(t):void 0}function I(r,t,n){let e=n?"aborted":"error",s={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:e,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()};if(!n&&t instanceof u)Te(s,qt("pi_messages_response_failure",t,t.diagnosticDetails));return{type:"error",reason:e,error:s}}function E(r,t){if(r)return r;return _("PI_CACHE_RETENTION",t)==="long"?"long":void 0}var T=(r,t,n)=>{let e=new M,s=w(r);return(async()=>{try{let a=n?.apiKey;if(!a)throw Error(`No API key provided for provider "${r.provider}"`);let o=new URL(`${r.baseUrl.replace(/\/+$/u,"")}/messages`);if(n?.debug)o.searchParams.set("debug","1");let c={model:r.id,context:t,options:{temperature:n?.temperature,maxTokens:n?.maxTokens,reasoning:n?.reasoning,cacheRetention:E(n?.cacheRetention,n?.env),sessionId:n?.sessionId,toolChoice:n?.toolChoice}},p=await n?.onPayload?.(c,r);if(p!==void 0)c=p;let i=await(n?.fetch??globalThis.fetch)(o,{method:"POST",headers:{authorization:`Bearer ${a}`,accept:"text/event-stream","content-type":"application/json",...fe(n?.headers)},body:JSON.stringify(c),signal:n?.signal});if(await n?.onResponse?.({status:i.status,headers:z(i.headers)},r),!i.ok){let d=await i.text();throw k(r,o,i,d)}if(!i.body)throw Error(`${r.provider} response has no body`);for await(let d of b(i.body)){await n?.onProviderStreamEvent?.(d,r);let g=s(d);if(e.push(g),g.type==="done"||g.type==="error")return}throw Error(`${r.provider} stream ended without a terminal event`)}catch(a){e.push(I(r,a,n?.signal?.aborted??!1))}})(),e},C=(r,t,n)=>{let e=n;return T(r,t,{...n,reasoning:n?.reasoning,toolChoice:n?.toolChoice,debug:e?.debug})};export{u as PiMessagesResponseError,T as stream,C as streamSimple};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{L}from"./chunk-
|
|
2
|
+
import{L}from"./chunk-jwdb0ccj.js";import{b}from"./chunk-981f9dw8.js";import{i}from"./chunk-0y7ne3d0.js";var _=i(L()),N=i(b()),Nr="AWS_ACCESS_KEY_ID",Dr="AWS_SECRET_ACCESS_KEY",S="AWS_SESSION_TOKEN",C="AWS_CREDENTIAL_EXPIRATION",A="AWS_CREDENTIAL_SCOPE",p="AWS_ACCOUNT_ID",Rn=(e)=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");let o=process.env[Nr],E=process.env[Dr],r=process.env[S],n=process.env[C],s=process.env[A],t=process.env[p];if(o&&E){let c={accessKeyId:o,secretAccessKey:E,...r&&{sessionToken:r},...n&&{expiration:new Date(n)},...s&&{credentialScope:s},...t&&{accountId:t}};return _.setCredentialFeature(c,"CREDENTIALS_ENV_VARS","g"),c}throw new N.CredentialsProviderError("Unable to find environment variable credentials.",{logger:e?.logger})};export{Nr,Dr,Rn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{L}from"./chunk-
|
|
2
|
+
import{L}from"./chunk-jwdb0ccj.js";import{b}from"./chunk-981f9dw8.js";import{i}from"./chunk-0y7ne3d0.js";var d=i(b());var t=i(b());import{exec as w}from"child_process";import{promisify as P}from"util";var p=i(L()),f=(r,e,o)=>{if(e.Version!==1)throw Error(`Profile ${r} credential_process did not return Version 1.`);if(e.AccessKeyId===void 0||e.SecretAccessKey===void 0)throw Error(`Profile ${r} credential_process returned invalid credentials.`);if(e.Expiration){let l=new Date;if(new Date(e.Expiration)<l)throw Error(`Profile ${r} credential_process returned expired credentials.`)}let s=e.AccountId;if(!s&&o?.[r]?.aws_account_id)s=o[r].aws_account_id;let n={accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,...e.SessionToken&&{sessionToken:e.SessionToken},...e.Expiration&&{expiration:new Date(e.Expiration)},...e.CredentialScope&&{credentialScope:e.CredentialScope},...s&&{accountId:s}};return p.setCredentialFeature(n,"CREDENTIALS_PROCESS","w"),n};var u=async(r,e,o)=>{let s=e[r];if(e[r]){let n=s.credential_process;if(n!==void 0){let l=P(t.externalDataInterceptor?.getTokenRecord?.().exec??w);try{let{stdout:c}=await l(n),a;try{a=JSON.parse(c.trim())}catch{throw Error(`Profile ${r} credential_process returned invalid JSON.`)}return f(r,a,e)}catch(c){throw new t.CredentialsProviderError(c.message,{logger:o})}}else throw new t.CredentialsProviderError(`Profile ${r} did not contain credential_process.`,{logger:o})}else throw new t.CredentialsProviderError(`Profile ${r} could not be found in shared credentials file.`,{logger:o})};var m=(r={})=>async({callerClientConfig:e}={})=>{r.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");let o=await d.parseKnownFiles(r);return u(d.getProfileName({profile:r.profile??e?.profile}),o,r.logger)};export{m as fromProcess};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var A=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],I=["content-type","cache-control","allow"];function p(e){let r=e.path;if(!r?.startsWith("/api/")||/[\\\r\n#]/.test(r))throw Error("request path must start with /api/");let n=new URL(r,"http://basalt.internal");if(n.origin!=="http://basalt.internal"||!n.pathname.startsWith("/api/"))throw Error("request path must stay within /api/");let o=e.method??"GET";if(!A.includes(o))throw Error("Unsupported request method");if(e.body!==void 0&&(!e.body||typeof e.body!=="object"||Array.isArray(e.body)))throw Error("request body must be a JSON object");if(e.body!==void 0&&(o==="GET"||o==="HEAD"))throw Error("GET and HEAD requests cannot have a body");let s=e.timeoutMs??1e4;if(!Number.isSafeInteger(s)||s<1||s>60000)throw Error("timeoutMs must be an integer between 1 and 60000");return{url:n,method:o,timeoutMs:s}}function g(e){let r={};for(let n of I){let o=e.headers.get(n);if(o)r[n]=o.slice(0,500)}return r}async function M(e,r){let n=e.getReader();r(()=>n.cancel());let o=[],s=0,i=!1;while(!0){let t=await n.read();if(t.done)break;let d=20480-s;if(o.push(t.value.subarray(0,d)),s+=Math.min(t.value.length,d),t.value.length>d){i=!0,await n.cancel();break}}let u=new Uint8Array(s),c=0;for(let t of o)u.set(t,c),c+=t.length;return{text:new TextDecoder().decode(u,{stream:i}),truncated:i}}async function
|
|
3
|
-
export{
|
|
2
|
+
var A=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],I=["content-type","cache-control","allow"];function p(e){let r=e.path;if(!r?.startsWith("/api/")||/[\\\r\n#]/.test(r))throw Error("request path must start with /api/");let n=new URL(r,"http://basalt.internal");if(n.origin!=="http://basalt.internal"||!n.pathname.startsWith("/api/"))throw Error("request path must stay within /api/");let o=e.method??"GET";if(!A.includes(o))throw Error("Unsupported request method");if(e.body!==void 0&&(!e.body||typeof e.body!=="object"||Array.isArray(e.body)))throw Error("request body must be a JSON object");if(e.body!==void 0&&(o==="GET"||o==="HEAD"))throw Error("GET and HEAD requests cannot have a body");let s=e.timeoutMs??1e4;if(!Number.isSafeInteger(s)||s<1||s>60000)throw Error("timeoutMs must be an integer between 1 and 60000");return{url:n,method:o,timeoutMs:s}}function g(e){let r={};for(let n of I){let o=e.headers.get(n);if(o)r[n]=o.slice(0,500)}return r}async function M(e,r){let n=e.getReader();r(()=>n.cancel());let o=[],s=0,i=!1;while(!0){let t=await n.read();if(t.done)break;let d=20480-s;if(o.push(t.value.subarray(0,d)),s+=Math.min(t.value.length,d),t.value.length>d){i=!0,await n.cancel();break}}let u=new Uint8Array(s),c=0;for(let t of o)u.set(t,c),c+=t.length;return{text:new TextDecoder().decode(u,{stream:i}),truncated:i}}async function Xt(e,r,n){let{url:o,method:s,timeoutMs:i}=p(r),u=e.http;if(!u)throw Error("HTTP API is not attached; start the Basalt server first");let c=new AbortController,t=n?AbortSignal.any([n,c.signal]):c.signal;t.throwIfAborted();let d,b=()=>{d?.().catch(()=>{})},E=async()=>{let h=r.body!==void 0,a=await u.request(new Request(o.toString(),{method:s,headers:h?{"content-type":"application/json"}:void 0,body:h?JSON.stringify(r.body):void 0,signal:t}));if(t.aborted)throw await a.body?.cancel(),Error("API request cancelled");let m=a.body?await M(a.body,(T)=>{d=T}):{text:"",truncated:!1};return{status:a.status,headers:g(a),body:m.text,truncated:m.truncated}},f,l,y=new Promise((h,a)=>{if(l=()=>{a(Error("API request cancelled")),b()},t.addEventListener("abort",l,{once:!0}),t.aborted)l()}),w=new Promise((h,a)=>{f=setTimeout(()=>{a(Error(`API request timed out after ${i}ms`)),c.abort(),b()},i)});try{return await Promise.race([E(),y,w])}finally{if(clearTimeout(f),l)t.removeEventListener("abort",l)}}
|
|
3
|
+
export{Xt};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{F}from"./chunk-
|
|
3
|
-
`),d=o.filter((c)=>c.type==="image"),u=l.length>0;if(d.length===0||!a.input.includes("image"))return g(u?l:d.length>0?"(see attached image)":"(no tool output)");let p=[];if(u)p.push({type:"input_text",text:g(l)});for(let c of d)p.push({type:"input_image",detail:"auto",image_url:`data:${c.mimeType};base64,${c.data}`});return p}function
|
|
2
|
+
import{F}from"./chunk-m8vkwdgr.js";import{Ze}from"./chunk-g2t6t8fk.js";import{me,Mr,Lr,ce,Jt,he}from"./chunk-3cjsd292.js";import{g}from"./chunk-n6e43rvk.js";import{N,Me,re,ye,Q}from"./chunk-8tjad3r0.js";function j(a,o){let l={v:1,id:a};if(o)l.phase=o;return JSON.stringify(l)}function E(a){if(!a)return;if(a.startsWith("{"))try{let o=JSON.parse(a);if(o.v===1&&typeof o.id==="string"){if(o.phase==="commentary"||o.phase==="final_answer")return{id:o.id,phase:o.phase};return{id:o.id}}}catch{}return{id:a}}function W(a,o){let l=o.filter((c)=>c.type==="text").map((c)=>c.text).join(`
|
|
3
|
+
`),d=o.filter((c)=>c.type==="image"),u=l.length>0;if(d.length===0||!a.input.includes("image"))return g(u?l:d.length>0?"(see attached image)":"(no tool output)");let p=[];if(u)p.push({type:"input_text",text:g(l)});for(let c of d)p.push({type:"input_image",detail:"auto",image_url:`data:${c.mimeType};base64,${c.data}`});return p}function at(a,o,l,d){let u=re(o,d?.supportsMidConvoSystemMessages),p=[],c=(n)=>{let s=n.replace(/[^a-zA-Z0-9_-]/g,"_");return(s.length>64?s.slice(0,64):s).replace(/_+$/,"")},b=(n)=>{let s=`fc_${Ze(n)}`;return s.length>64?s.slice(0,64):s},k=(n,s,i)=>{if(!l.has(a.provider))return c(n);if(!n.includes("|"))return c(n);let[r,_]=n.split("|"),y=c(r),x=i.provider!==a.provider||i.api!==a.api?b(_):c(_);if(!x.startsWith("fc_"))x=c(`fc_${x}`);return`${y}|${x}`},m=he(u.messages,a,k),I=ye(u.messages,(d?.supportsAdditionalTools??!1)||(d?.supportsToolSearch??!1)),v=(n,s)=>{let i=I.anchorsAdditions?n.toolsAdded??[]:[];if(i.length===0)return;if(d?.supportsAdditionalTools){p.push({type:"additional_tools",role:"developer",tools:Je(i,d.toolOptions)});return}if(!d?.supportsToolSearch)return;let r=i.map((y)=>y.name),_=`pi_tool_load_${Ze(`${s}:${r.join(",")}`)}`;p.push({type:"tool_search_call",call_id:_,execution:"client",status:"completed",arguments:{query:r.join(" "),limit:r.length}}),p.push({type:"tool_search_output",call_id:_,execution:"client",status:"completed",tools:Je(i,{...d.toolOptions,toolSearchResult:!0})})},C=d?.includeSystemPrompt??!0,w=a.compat,M=a.reasoning&&w?.supportsDeveloperRole!==!1?"developer":"system",t=0,e=0;for(let n of m){let s=e++===0&&n.role==="system";if(n.role==="system"){if(!s)v(n,`system:${t}`);if(!s||C){let i=s?N(n):Me(n);if(i.length>0)p.push({role:M,content:g(i)})}}else if(n.role==="user")if(typeof n.content==="string")p.push({role:"user",content:[{type:"input_text",text:g(n.content)}]});else{let i=n.content.map((r)=>{if(r.type==="text")return{type:"input_text",text:g(r.text)};return{type:"input_image",detail:"auto",image_url:`data:${r.mimeType};base64,${r.data}`}});if(i.length===0)continue;p.push({role:"user",content:i})}else if(n.role==="assistant"){let i=[],r=n,_=r.provider===a.provider&&r.api===a.api,y=_&&r.model===a.id,P=_&&r.model!==a.id,x=0;for(let S of n.content)if(S.type==="thinking"){if(S.thinkingSignature){let f=JSON.parse(S.thinkingSignature);i.push(f)}}else if(S.type==="text"){let f=S,T=E(f.textSignature),J=x===0?`msg_pi_${t}`:`msg_pi_${t}_${x}`;x++;let h=T?.id;if(!h)h=J;else if(h.length>64)h=`msg_${Ze(h)}`;i.push({type:"message",role:"assistant",content:[{type:"output_text",text:g(f.text),annotations:[]}],status:"completed",id:h,phase:T?.phase})}else if(S.type==="toolCall"){let f=S,[T,J]=f.id.split("|"),h=d?.grammarToolInputProperties?.get(f.name),R=J,A=h===void 0?"fc_":"ctc_";if(P||!R?.startsWith(A))R=void 0;if(h!==void 0)i.push({type:"custom_tool_call",id:R,call_id:T,name:f.name,input:g(Mr(f.name,f.arguments,h)),...y&&f.namespace!==void 0?{namespace:f.namespace}:{}});else i.push({type:"function_call",id:R,call_id:T,name:f.name,arguments:JSON.stringify(f.arguments),...y&&f.namespace!==void 0?{namespace:f.namespace}:{}})}if(i.length===0)continue;p.push(...i)}else if(n.role==="toolResult"){let[i]=n.toolCallId.split("|"),r=W(a,n.content);if(d?.grammarToolInputProperties?.has(n.toolName))p.push({type:"custom_tool_call_output",call_id:i,output:r});else p.push({type:"function_call_output",call_id:i,output:r})}if(!s)t++}return p}function Je(a,o){let l=o?.strict===void 0?!1:o.strict,d=o?.supportsStrictMode??!0,u=o?.supportsOpenAIGrammarTools??!1;return a.map((p)=>{let c=Jt(p,u);if(c)return{type:"custom",name:p.name,description:p.description,format:{type:"grammar",syntax:c.format,definition:c.definition},...o?.toolSearchResult?{defer_loading:!0}:{}};let k=ce(p,d)??l,m={type:"function",name:p.name,description:p.description,parameters:me(p,k===!0),...o?.toolSearchResult?{defer_loading:!0}:{}};if(d)m.strict=k;return m})}function z(a){let o=a.customInput?.property;if(o===void 0)return"";let l=a.arguments[o];return typeof l==="string"?l:""}function O(a,o,l){let d=a.customInput;if(!d)return;let u=Lr(d.jsonBuffer,d.property,o,l);return a.arguments={[d.property]:o},u}async function lt(a,o,l,d,u){let p=!1,c=new Map,b=new Map,k=(t)=>{if(t.type==="message"&&t.phase==="final_answer")o.stopReason="stop"},m=(t,e)=>{let n=c.get(t);return n?.type===e?n:void 0},I=(t,e)=>{if(e===void 0)return;l.push({type:"toolcall_delta",contentIndex:t.contentIndex,delta:e,partial:o})},v=(t,e)=>{if(e.type==="reasoning"){let n={type:"thinking",thinking:""};o.content.push(n);let s={type:"thinking",block:n,contentIndex:o.content.length-1};return c.set(t,s),l.push({type:"thinking_start",contentIndex:s.contentIndex,partial:o}),s}if(e.type==="message"){k(e);let n={type:"text",text:""};o.content.push(n);let s={type:"text",block:n,contentIndex:o.content.length-1};return c.set(t,s),l.push({type:"text_start",contentIndex:s.contentIndex,partial:o}),s}if(e.type==="function_call"){let n={type:"toolCall",id:`${e.call_id}|${e.id}`,name:e.name,arguments:{},...e.namespace!==void 0?{namespace:e.namespace}:{},partialJson:e.arguments||""};o.content.push(n);let s={type:"toolCall",block:n,contentIndex:o.content.length-1};return c.set(t,s),l.push({type:"toolcall_start",contentIndex:s.contentIndex,partial:o}),s}if(e.type==="custom_tool_call"){let n=u?.grammarToolInputProperties?.get(e.name)??"input",s=e.input||"",i={type:"toolCall",id:`${e.call_id}|${e.id}`,name:e.name,arguments:{[n]:s},...e.namespace!==void 0?{namespace:e.namespace}:{},customInput:{property:n,jsonBuffer:{input:"",started:!1,closed:!1}}};o.content.push(i);let r={type:"toolCall",block:i,contentIndex:o.content.length-1};return c.set(t,r),l.push({type:"toolcall_start",contentIndex:r.contentIndex,partial:o}),r}return},C=(t,e)=>c.get(t)??v(t,e),w=(t)=>{for(let e of t){if(e.type!=="reasoning"||!e.encrypted_content)continue;let n=b.get(e.id);if(!n?.thinkingSignature)continue;let s=JSON.parse(n.thinkingSignature);if(s.encrypted_content)continue;n.thinkingSignature=JSON.stringify({...s,encrypted_content:e.encrypted_content})}},M=(t)=>{if(p=!0,w(t.output??[]),t?.id)o.responseId=t.id;if(t?.usage){let r=t.usage.input_tokens_details,_=r?.cached_tokens||0,y=r?.cache_write_tokens||0;o.usage={input:Math.max(0,(t.usage.input_tokens||0)-_-y),output:t.usage.output_tokens||0,cacheRead:_,cacheWrite:y,reasoning:t.usage.output_tokens_details?.reasoning_tokens||0,totalTokens:t.usage.total_tokens||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}if(Q(d,o.usage),u?.applyServiceTierPricing){let r=u.resolveServiceTier?u.resolveServiceTier(t?.service_tier,u.serviceTier):t?.service_tier??u.serviceTier;u.applyServiceTierPricing(o.usage,r)}let e=t?.status,n=t?.incomplete_details,s=typeof n?.reason==="string"?n.reason:void 0;o.rawStopReason=s?`${e}.${s}`:e;let i=B(e,s);if(o.stopReason=i.stopReason,i.errorMessage===void 0)delete o.errorMessage;else o.errorMessage=i.errorMessage;if(o.content.some((r)=>r.type==="toolCall")&&o.stopReason==="stop")o.stopReason="toolUse"};for await(let t of a)if(await u?.onProviderStreamEvent?.(t,d),t.type==="response.created")o.responseId=t.response.id;else if(t.type==="response.output_item.added")v(t.output_index,t.item);else if(t.type==="response.reasoning_summary_text.delta"){let e=m(t.output_index,"thinking");if(!e)continue;e.block.thinking+=t.delta,l.push({type:"thinking_delta",contentIndex:e.contentIndex,delta:t.delta,partial:o})}else if(t.type==="response.reasoning_summary_part.done"){let e=m(t.output_index,"thinking");if(!e)continue;e.block.thinking+=`
|
|
4
4
|
|
|
5
5
|
`,l.push({type:"thinking_delta",contentIndex:e.contentIndex,delta:`
|
|
6
6
|
|
|
@@ -9,4 +9,4 @@ import{F}from"./chunk-c25s4w6a.js";import{Je}from"./chunk-kgdrjqsy.js";import{de
|
|
|
9
9
|
`)||"",i=e.content?.map((r)=>r.text).join(`
|
|
10
10
|
|
|
11
11
|
`)||"";n.block.thinking=s||i||n.block.thinking,n.block.thinkingSignature=JSON.stringify(e),b.set(e.id,n.block),l.push({type:"thinking_end",contentIndex:n.contentIndex,content:n.block.thinking,partial:o}),c.delete(t.output_index)}else if(e.type==="message"&&n?.type==="text")n.block.text=e.content?.map((s)=>s.type==="output_text"?s.text:s.refusal).join("")||"",n.block.textSignature=j(e.id,e.phase??void 0),l.push({type:"text_end",contentIndex:n.contentIndex,content:n.block.text,partial:o}),c.delete(t.output_index);else if(e.type==="function_call"&&n?.type==="toolCall"&&n.block.partialJson!==void 0){if(n.block.arguments=F(e.arguments||n.block.partialJson||"{}"),e.namespace!==void 0)n.block.namespace=e.namespace;delete n.block.partialJson,l.push({type:"toolcall_end",contentIndex:n.contentIndex,toolCall:n.block,partial:o}),c.delete(t.output_index)}else if(e.type==="custom_tool_call"&&n?.type==="toolCall"&&n.block.customInput){if(I(n,O(n.block,e.input??z(n.block),!0)),e.namespace!==void 0)n.block.namespace=e.namespace;delete n.block.customInput,l.push({type:"toolcall_end",contentIndex:n.contentIndex,toolCall:n.block,partial:o}),c.delete(t.output_index)}}else if(t.type==="response.completed"||t.type==="response.incomplete")M(t.response);else if(t.type==="error")throw Error(`Error Code ${t.code}: ${t.message}`||"Unknown error");else if(t.type==="response.failed"){p=!0,o.rawStopReason=t.response?.status;let e=t.response?.error,n=t.response?.incomplete_details,s=e?`${e.code||"unknown"}: ${e.message||"no message"}`:n?.reason?`incomplete: ${n.reason}`:"Unknown error (no error details in response)";throw Error(s)}if(!p)throw Error("OpenAI Responses stream ended before a terminal response event");if(o.stopReason==="toolUse")for(let t of o.content){if(t.type!=="toolCall")continue;let e=t;if(e.partialJson!==void 0||e.customInput!==void 0)throw Error(`OpenAI Responses stream completed with an unfinished tool call: ${e.name} (${e.id})`)}}function B(a,o){if(!a)return{stopReason:"stop"};switch(a){case"completed":return{stopReason:"stop"};case"incomplete":if(o==="max_output_tokens")return{stopReason:"length"};return{stopReason:"error",errorMessage:o?`Response incomplete: ${o}`:"Response incomplete without a provider reason"};case"failed":case"cancelled":return{stopReason:"error"};case"in_progress":case"queued":return{stopReason:"stop"};default:throw Error(`Unhandled stop reason: ${a}`)}}
|
|
12
|
-
export{
|
|
12
|
+
export{at,Je,lt};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function z(r){let e={};for(let[n,o]of r.entries())e[n]=o;return e}function
|
|
3
|
-
export{z,
|
|
2
|
+
function z(r){let e={};for(let[n,o]of r.entries())e[n]=o;return e}function fe(...r){let e=new Map;for(let n of r)for(let[o,t]of Object.entries(n??{})){let s=o.toLowerCase();if(e.delete(s),t!==null)e.set(s,[o,t])}return e.size>0?Object.fromEntries(e.values()):void 0}
|
|
3
|
+
export{z,fe};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{zo,Ue,ot}from"./chunk-rm3kcxq9.js";import{Fe}from"./chunk-t057xfrt.js";import{qe,ve,L}from"./chunk-0hbjv3y6.js";import{be,Y,b,Se,X,Qe,B}from"./chunk-k7w7ac9q.js";import{t}from"./chunk-qnr1f5pj.js";var fe=t(function(Dt){var{SignatureV4:kt,signatureV4aContainer:de}=zo(),O={CrtSignerV4:null},ge="X-Amz-S3session-Token".toLowerCase();class Z extends kt{async signWithCredentials(e,s,n){let r=pe(s);e.headers[ge]=s.sessionToken;let o=this;return he(o,r),o.signRequest(e,n??{})}async presignWithCredentials(e,s,n){let r=pe(s);return delete e.headers[ge],e.headers["X-Amz-S3session-Token"]=s.sessionToken,e.query=e.query??{},e.query["X-Amz-S3session-Token"]=s.sessionToken,he(this,r),this.presign(e,n)}}function pe(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,expiration:e.expiration}}function he(e,s){let n=e.credentialProvider;e.credentialProvider=()=>(e.credentialProvider=n,Promise.resolve(s))}class me{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){if(typeof O.CrtSignerV4==="function")return"crt";else if(typeof de.SignatureV4a==="function")return"js";return"none"}constructor(e){this.sigv4Signer=new Z(e),this.signerOptions=e}async sign(e,s={}){if(s.signingRegion==="*")return this.getSigv4aSigner().sign(e,s);return this.sigv4Signer.sign(e,s)}async signWithCredentials(e,s,n={}){if(n.signingRegion==="*"){let r=this.getSigv4aSigner(),o=O.CrtSignerV4;if(o&&r instanceof o)return r.signWithCredentials(e,s,n);else throw Error(`signWithCredentials with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}return this.sigv4Signer.signWithCredentials(e,s,n)}async presign(e,s={}){if(s.signingRegion==="*"){let n=this.getSigv4aSigner(),r=O.CrtSignerV4;if(r&&n instanceof r)return n.presign(e,s);else throw Error(`presign with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}return this.sigv4Signer.presign(e,s)}async presignWithCredentials(e,s,n={}){if(n.signingRegion==="*")throw Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(e,s,n)}getSigv4aSigner(){if(!this.sigv4aSigner){let e=O.CrtSignerV4,s=de.SignatureV4a;if(this.signerOptions.runtime==="node"){if(!e&&!s)throw Error("Neither CRT nor JS SigV4a implementation is available. Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt");if(e&&typeof e==="function")this.sigv4aSigner=new e({...this.signerOptions,signingAlgorithm:1});else if(s&&typeof s==="function")this.sigv4aSigner=new s({...this.signerOptions});else throw Error("Available SigV4a implementation is not a valid constructor. Please ensure you've properly imported @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a.For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt")}else{if(!s||typeof s!=="function")throw Error("JS SigV4a implementation is not available or not a valid constructor. Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. You must also register the package by calling [require('@aws-sdk/signature-v4a');] or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. For more information please go to https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a");this.sigv4aSigner=new s({...this.signerOptions})}}return this.sigv4aSigner}}Dt.SignatureV4MultiRegion=me;Dt.SignatureV4SignWithCredentials=Z;Dt.signatureV4CrtContainer=O});var{awsEndpointFunctions:Nt,emitWarningIfUnsupportedVersion:Wt,createDefaultUserAgentProvider:Ht,NODE_APP_ID_CONFIG_OPTIONS:Ut,getAwsRegionExtensionConfiguration:qt,resolveAwsRegionExtensionConfiguration:Ft,resolveUserAgentConfig:Vt,resolveHostHeaderConfig:Lt,getUserAgentPlugin:Kt,getHostHeaderPlugin:Mt,getLoggerPlugin:jt,getRecursionDetectionPlugin:zt,setCredentialFeature:se,stsRegionDefaultResolver:Gt}=L(),{NoAuthSigner:_e,getHttpAuthSchemeEndpointRuleSetPlugin:Yt,DefaultIdentityProviderConfig:Qt,getHttpSigningPlugin:Bt}=ve(),{normalizeProvider:xe,getSmithyContext:Te,ServiceException:Jt,NoOpLogger:Xt,emitWarningIfUnsupportedVersion:Zt,loadConfigsForDefaultMode:es,getDefaultExtensionConfiguration:ts,resolveDefaultRuntimeConfig:ss,Client:ke,makeBuilder:ns,createAggregatedClient:os}=Y(),{Command:rs}=Y();var io=rs,ao=ke;var{resolveDefaultsModeConfig:is,loadConfig:y,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:as,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:cs,NODE_REGION_CONFIG_OPTIONS:us,NODE_REGION_CONFIG_FILE_OPTIONS:ls,resolveRegionConfig:ds}=b(),{BinaryDecisionDiagram:gs,EndpointCache:ps,decideEndpoint:hs,customEndpointFunctions:ms,resolveParams:Ss,resolveEndpointConfig:vs,getEndpointPlugin:fs}=Se(),{parseUrl:Ps,getHttpHandlerExtensionConfiguration:ys,resolveHttpHandlerRuntimeConfig:Es,getContentLengthPlugin:As}=B(),{DEFAULT_RETRY_MODE:Is,NODE_RETRY_MODE_CONFIG_OPTIONS:ws,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:Rs,resolveRetryConfig:Cs,getRetryPlugin:_s}=qe(),{TypeRegistry:De,getSchemaSerdePlugin:xs}=be(),{resolveAwsSdkSigV4Config:Ts,resolveAwsSdkSigV4AConfig:ks,AwsSdkSigV4Signer:Oe,AwsSdkSigV4ASigner:$e,NODE_SIGV4A_CONFIG_OPTIONS:Ds,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:bs}=Ue(),{SignatureV4MultiRegion:Ne}=fe(),{toUtf8:Os,fromUtf8:$s,toBase64:Ns,fromBase64:Ws,calculateBodyLength:Hs}=X(),{streamCollector:Us,NodeHttpHandler:qs}=Fe(),{AwsQueryProtocol:Fs}=ot(),{Sha256:Vs}=Qe(),D="ref",I=-1,N=!0,Pe="isSet",We="PartitionResult",W="booleanEquals",l="stringEquals",ee="getAttr",ye="us-east-1",Ee="sigv4",Ae="sts",Ie="https://sts.{Region}.{PartitionResult#dnsSuffix}",we={[D]:"Endpoint"},d={[D]:"Region"},te={[D]:We},k={},Re=[d],Ce={conditions:[[Pe,[we]],[Pe,Re],["aws.partition",Re,We],[W,[{[D]:"UseFIPS"},N]],[W,[{[D]:"UseDualStack"},N]],[l,[d,"aws-global"]],[W,[{[D]:"UseGlobalEndpoint"},N]],[l,[d,"eu-central-1"]],[W,[{fn:ee,argv:[te,"supportsDualStack"]},N]],[W,[{fn:ee,argv:[te,"supportsFIPS"]},N]],[l,[d,"ap-south-1"]],[l,[d,"eu-north-1"]],[l,[d,"eu-west-1"]],[l,[d,"eu-west-2"]],[l,[d,"eu-west-3"]],[l,[d,"sa-east-1"]],[l,[d,ye]],[l,[d,"us-east-2"]],[l,[d,"us-west-2"]],[l,[d,"us-west-1"]],[l,[d,"ca-central-1"]],[l,[d,"ap-southeast-1"]],[l,[d,"ap-northeast-1"]],[l,[d,"ap-southeast-2"]],[l,[{fn:ee,argv:[te,"name"]},"aws-us-gov"]]],results:[[I],["https://sts.amazonaws.com",{authSchemes:[{name:Ee,signingName:Ae,signingRegion:ye}]}],[Ie,{authSchemes:[{name:Ee,signingName:Ae,signingRegion:"{Region}"}]}],[I,"Invalid Configuration: FIPS and custom endpoint are not supported"],[I,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[we,k],["https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",k],[I,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://sts.{Region}.amazonaws.com",k],["https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",k],[I,"FIPS is enabled but this partition does not support FIPS"],["https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",k],[I,"DualStack is enabled but this partition does not support DualStack"],[Ie,k],[I,"Invalid Configuration: Missing Region"]]},Ls=2,i=1e8,Ks=new Int32Array([-1,1,-1,0,30,3,1,4,i+14,2,5,i+14,3,25,6,4,24,7,5,i+1,8,6,9,i+13,7,i+1,10,10,i+1,11,11,i+1,12,12,i+1,13,13,i+1,14,14,i+1,15,15,i+1,16,16,i+1,17,17,i+1,18,18,i+1,19,19,i+1,20,20,i+1,21,21,i+1,22,22,i+1,23,23,i+1,i+2,8,i+11,i+12,4,28,26,9,27,i+10,24,i+8,i+9,8,29,i+7,9,i+6,i+7,3,i+3,31,4,i+4,i+5]),Ms=gs.from(Ks,Ls,Ce.conditions,Ce.results),js=new ps({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),He=(e,s={})=>js.get(e,()=>hs(Ms,{endpointParams:e,logger:s.logger}));ms.aws=Nt;var zs=(e)=>async(s,n,r)=>{if(!r)throw Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");let o=await e(s,n,r),u=Te(n)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!u)throw Error(`getEndpointParameterInstructions() is not defined on '${n.commandName}'`);let a=await Ss(r,{getEndpointParameterInstructions:u},s);return Object.assign(o,a)},Gs=async(e,s,n)=>({operation:Te(s).operation,region:await xe(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),Ys=zs(Gs);function Ve(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(s,n)=>({signingProperties:{config:s,context:n}})}}function ne(e){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(s,n)=>({signingProperties:{config:s,context:n}})}}function Le(e){return{schemeId:"smithy.api#noAuth"}}var Qs=(e,s,n)=>(o)=>{let a=e(o).properties?.authSchemes;if(!a)return s(o);let g=[];for(let S of a){let{name:p,properties:v={},...A}=S,f=p.toLowerCase();if(p!==f)console.warn(`HttpAuthScheme has been normalized with lowercasing: '${p}' to '${f}'`);let m;if(f==="sigv4a"){m="aws.auth#sigv4a";let Q=a.find((J)=>{let le=J.name.toLowerCase();return le!=="sigv4a"&&le.startsWith("sigv4")});if(Ne.sigv4aDependency()==="none"&&Q)continue}else if(f.startsWith("sigv4"))m="aws.auth#sigv4";else throw Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${f}'`);let T=n[m];if(!T)throw Error(`Could not find HttpAuthOption create function for '${m}'`);let P=T(o);P.schemeId=m,P.signingProperties={...P.signingProperties||{},...A,...v},g.push(P)}return g},Bs=(e)=>{let s=[];switch(e.operation){case"AssumeRoleWithWebIdentity":{s.push(Le()),s.push(ne(e));break}default:s.push(Ve(e)),s.push(ne(e))}return s},Js=Qs(He,Bs,{"aws.auth#sigv4":Ve,"aws.auth#sigv4a":ne,"smithy.api#noAuth":Le}),Xs=(e)=>{let s=Ts(e),n=ks(s);return Object.assign(n,{authSchemePreference:xe(e.authSchemePreference??[])})},Zs=(e)=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,useGlobalEndpoint:e.useGlobalEndpoint??!1,defaultSigningName:"sts"}),en={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"}},tn="3.997.47",sn={version:tn};class h extends Jt{static shapeId="smithy.ts.sdk.synthetic.com.amazonaws.sts#STSServiceException";constructor(e){super(e);Object.setPrototypeOf(this,h.prototype)}}class U extends h{static shapeId="com.amazonaws.sts#ExpiredTokenException";name="ExpiredTokenException";$fault="client";constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e});Object.setPrototypeOf(this,U.prototype)}}class q extends h{static shapeId="com.amazonaws.sts#MalformedPolicyDocumentException";name="MalformedPolicyDocumentException";$fault="client";constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e});Object.setPrototypeOf(this,q.prototype)}}class F extends h{static shapeId="com.amazonaws.sts#PackedPolicyTooLargeException";name="PackedPolicyTooLargeException";$fault="client";constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e});Object.setPrototypeOf(this,F.prototype)}}class V extends h{static shapeId="com.amazonaws.sts#RegionDisabledException";name="RegionDisabledException";$fault="client";constructor(e){super({name:"RegionDisabledException",$fault:"client",...e});Object.setPrototypeOf(this,V.prototype)}}class K extends h{static shapeId="com.amazonaws.sts#IDPRejectedClaimException";name="IDPRejectedClaimException";$fault="client";constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e});Object.setPrototypeOf(this,K.prototype)}}class M extends h{static shapeId="com.amazonaws.sts#InvalidIdentityTokenException";name="InvalidIdentityTokenException";$fault="client";constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e});Object.setPrototypeOf(this,M.prototype)}}class j extends h{static shapeId="com.amazonaws.sts#IDPCommunicationErrorException";name="IDPCommunicationErrorException";$fault="client";$retryable={};constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e});Object.setPrototypeOf(this,j.prototype)}}var nn="Arn",on="AccessKeyId",rn="AssumeRole",an="AssumedRoleId",cn="AssumeRoleRequest",un="AssumeRoleResponse",oe="AssumedRoleUser",ln="AssumeRoleWithWebIdentity",dn="AssumeRoleWithWebIdentityRequest",gn="AssumeRoleWithWebIdentityResponse",pn="Audience",re="Credentials",hn="ContextAssertion",Ke="DurationSeconds",mn="Expiration",Sn="ExternalId",vn="ExpiredTokenException",fn="IDPCommunicationErrorException",Pn="IDPRejectedClaimException",yn="InvalidIdentityTokenException",En="Key",An="MalformedPolicyDocumentException",Me="MinimumSessionTokenSize",je="Policy",ze="PolicyArns",In="ProviderArn",wn="ProvidedContexts",Rn="ProvidedContextsListType",Cn="ProvidedContext",_n="PolicyDescriptorType",xn="ProviderId",Ge="PackedPolicySize",Tn="PackedPolicyTooLargeException",kn="Provider",Ye="RoleArn",Dn="RegionDisabledException",Be="RoleSessionName",bn="SecretAccessKey",On="SubjectFromWebIdentityToken",ie="SourceIdentity",$n="SerialNumber",Nn="SessionToken",Je="SessionTokenSize",Xe="SessionTokenUtilization",Wn="Tags",Hn="TokenCode",Un="TransitiveTagKeys",qn="Tag",Fn="Value",Vn="WebIdentityToken",Ln="arn",Kn="accessKeySecretType",w="awsQueryError",R="client",Mn="clientTokenType",C="error",_="httpError",x="message",jn="policyDescriptorListType",Ze="smithy.ts.sdk.synthetic.com.amazonaws.sts",zn="tagListType",c="com.amazonaws.sts",et=new De(Ze),tt=[-3,Ze,"STSServiceException",0,[],[]];et.registerError(tt,h);var E=new De(c),st=[-3,c,vn,{[w]:["ExpiredTokenException",400],[C]:R,[_]:400},[x],[0]];E.registerError(st,U);var nt=[-3,c,fn,{[w]:["IDPCommunicationError",400],[C]:R,[_]:400},[x],[0]];E.registerError(nt,j);var rt=[-3,c,Pn,{[w]:["IDPRejectedClaim",403],[C]:R,[_]:403},[x],[0]];E.registerError(rt,K);var it=[-3,c,yn,{[w]:["InvalidIdentityToken",400],[C]:R,[_]:400},[x],[0]];E.registerError(it,M);var at=[-3,c,An,{[w]:["MalformedPolicyDocument",400],[C]:R,[_]:400},[x],[0]];E.registerError(at,q);var ct=[-3,c,Tn,{[w]:["PackedPolicyTooLarge",400],[C]:R,[_]:400},[x],[0]];E.registerError(ct,F);var ut=[-3,c,Dn,{[w]:["RegionDisabledException",403],[C]:R,[_]:403},[x],[0]];E.registerError(ut,V);var lt=[et,E],Gn=[0,c,Kn,8,0],Yn=[0,c,Mn,8,0],ae=[3,c,oe,0,[an,nn],[0,0],2],dt=[3,c,cn,0,[Ye,Be,ze,je,Ke,Wn,Un,Sn,$n,Hn,ie,wn,Me],[0,0,()=>ft,0,1,()=>Bn,64,0,0,0,0,()=>Qn,1],2],gt=[3,c,un,0,[re,oe,Ge,ie,Xe,Je],[[()=>ce,0],()=>ae,1,0,1,1]],pt=[3,c,dn,0,[Ye,Be,Vn,xn,ze,je,Ke,Me],[0,0,[()=>Yn,0],0,()=>ft,0,1,1],3],ht=[3,c,gn,0,[re,On,oe,Ge,kn,pn,ie,Xe,Je],[[()=>ce,0],0,()=>ae,1,0,0,0,1,1]],ce=[3,c,re,0,[on,bn,Nn,mn],[0,[()=>Gn,0],0,4],4],mt=[3,c,_n,0,[Ln],[0]],St=[3,c,Cn,0,[In,hn],[0,0]],vt=[3,c,qn,0,[En,Fn],[0,0],2],ft=[1,c,jn,0,()=>mt],Qn=[1,c,Rn,0,()=>St],Bn=[1,c,zn,0,()=>vt],Pt=[9,c,rn,0,()=>dt,()=>gt],yt=[9,c,ln,0,()=>pt,()=>ht],Jn=(e)=>({apiVersion:"2011-06-15",base64Decoder:e?.base64Decoder??Ws,base64Encoder:e?.base64Encoder??Ns,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??He,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Js,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4"),signer:new Oe},{schemeId:"aws.auth#sigv4a",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4a"),signer:new $e},{schemeId:"smithy.api#noAuth",identityProvider:(s)=>s.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new _e}],logger:e?.logger??new Xt,protocol:e?.protocol??Fs,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",errorTypeRegistries:lt,xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:e?.serviceId??"STS",sha256:e?.sha256??Vs,signerConstructor:e?.signerConstructor??Ne,urlParser:e?.urlParser??Ps,utf8Decoder:e?.utf8Decoder??$s,utf8Encoder:e?.utf8Encoder??Os}),Xn=(e)=>{Zt(process.version);let s=is(e),n=()=>s().then(es),r=Jn(e);Wt(process.version);let o={profile:e?.profile,logger:r.logger};return{...r,...e,runtime:"node",defaultsMode:s,authSchemePreference:e?.authSchemePreference??y(bs,o),bodyLengthChecker:e?.bodyLengthChecker??Hs,defaultUserAgentProvider:e?.defaultUserAgentProvider??Ht({serviceId:r.serviceId,clientVersion:sn.version}),httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(u)=>u.getIdentityProvider("aws.auth#sigv4")||(async(a)=>await e.credentialDefaultProvider(a?.__config||{})()),signer:new Oe},{schemeId:"aws.auth#sigv4a",identityProvider:(u)=>u.getIdentityProvider("aws.auth#sigv4a"),signer:new $e},{schemeId:"smithy.api#noAuth",identityProvider:(u)=>u.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new _e}],maxAttempts:e?.maxAttempts??y(Rs,e),region:e?.region??y(us,{...ls,...o}),requestHandler:qs.create(e?.requestHandler??n),retryMode:e?.retryMode??y({...ws,default:async()=>(await n()).retryMode||Is},e),sigv4aSigningRegionSet:e?.sigv4aSigningRegionSet??y(Ds,o),streamCollector:e?.streamCollector??Us,useDualstackEndpoint:e?.useDualstackEndpoint??y(cs,o),useFipsEndpoint:e?.useFipsEndpoint??y(as,o),userAgentAppId:e?.userAgentAppId??y(Ut,o)}},Zn=(e)=>{let{httpAuthSchemes:s,httpAuthSchemeProvider:n,credentials:r}=e;return{setHttpAuthScheme(o){let u=s.findIndex((a)=>a.schemeId===o.schemeId);if(u===-1)s.push(o);else s.splice(u,1,o)},httpAuthSchemes(){return s},setHttpAuthSchemeProvider(o){n=o},httpAuthSchemeProvider(){return n},setCredentials(o){r=o},credentials(){return r}}},eo=(e)=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),to=(e,s)=>{let n=Object.assign(qt(e),ts(e),ys(e),Zn(e));return s.forEach((r)=>r.configure(n)),Object.assign(e,Ft(n),ss(n),Es(n),eo(n))};class H extends ke{config;constructor(...[e]){let s=Xn(e||{});super(s);this.initConfig=s;let n=Zs(s),r=Vt(n),o=Cs(r),u=ds(o),a=Lt(u),g=vs(a),S=Xs(g),p=to(S,e?.extensions||[]);this.config=p,this.middlewareStack.use(xs(this.config)),this.middlewareStack.use(Kt(this.config)),this.middlewareStack.use(_s(this.config)),this.middlewareStack.use(As(this.config)),this.middlewareStack.use(Mt(this.config)),this.middlewareStack.use(jt(this.config)),this.middlewareStack.use(zt(this.config)),this.middlewareStack.use(Yt(this.config,{httpAuthSchemeParametersProvider:Ys,identityProviderConfigProvider:async(v)=>new Qt({"aws.auth#sigv4":v.credentials,"aws.auth#sigv4a":v.credentials})})),this.middlewareStack.use(Bt(this.config))}destroy(){super.destroy()}}var Et=ns(en,"AWSSecurityTokenServiceV20110615","STSClient",fs),At={},It=(e,s,n,r)=>[];class z extends Et(At,It,"AssumeRole",Pt){}class G extends Et(At,It,"AssumeRoleWithWebIdentity",yt){}var so={AssumeRoleCommand:z,AssumeRoleWithWebIdentityCommand:G};class ue extends H{}os(so,ue);var wt=(e)=>{if(typeof e?.Arn==="string"){let s=e.Arn.split(":");if(s.length>4&&s[4]!=="")return s[4]}return},Rt=async(e,s,n,r={})=>{let o=typeof e==="function"?await e():e,u=typeof s==="function"?await s():s,a="",g=o??u??(a=await Gt(r)());return n?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${o} (credential provider clientConfig)`,`${u} (contextual client)`,`${a} (STS default: AWS_REGION, profile region, or us-east-1)`),g},no=(e,s)=>{let n,r;return async(o,u)=>{if(r=o,!n){let{logger:v=e?.parentClientConfig?.logger,profile:A=e?.parentClientConfig?.profile,region:f,requestHandler:m=e?.parentClientConfig?.requestHandler,credentialProviderLogger:T,userAgentAppId:P=e?.parentClientConfig?.userAgentAppId}=e,Q=await Rt(f,e?.parentClientConfig?.region,T,{logger:v,profile:A}),J=!Ct(m);n=new s({...e,userAgentAppId:P,profile:A,credentialDefaultProvider:()=>async()=>r,region:Q,requestHandler:J?m:void 0,logger:v})}let{Credentials:a,AssumedRoleUser:g}=await n.send(new z(u));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw Error(`Invalid response from STS.assumeRole call with role ${u.RoleArn}`);let S=wt(g),p={accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...S&&{accountId:S}};return se(p,"CREDENTIALS_STS_ASSUME_ROLE","i"),p}},oo=(e,s)=>{let n;return async(r)=>{if(!n){let{logger:S=e?.parentClientConfig?.logger,profile:p=e?.parentClientConfig?.profile,region:v,requestHandler:A=e?.parentClientConfig?.requestHandler,credentialProviderLogger:f,userAgentAppId:m=e?.parentClientConfig?.userAgentAppId}=e,T=await Rt(v,e?.parentClientConfig?.region,f,{logger:S,profile:p}),P=!Ct(A);n=new s({...e,userAgentAppId:m,profile:p,region:T,requestHandler:P?A:void 0,logger:S})}let{Credentials:o,AssumedRoleUser:u}=await n.send(new G(r));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${r.RoleArn}`);let a=wt(u),g={accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}};if(a)se(g,"RESOLVED_ACCOUNT_ID","T");return se(g,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),g}},Ct=(e)=>e?.metadata?.handlerProtocol==="h2",_t=(e,s)=>{if(!s)return e;else return class extends e{constructor(r){super(r);for(let o of s)this.middlewareStack.use(o)}}},xt=(e={},s)=>no(e,_t(H,s)),Tt=(e={},s)=>oo(e,_t(H,s)),ro=(e)=>(s)=>e({roleAssumer:xt(s),roleAssumerWithWebIdentity:Tt(s),...s});var co=Pt,uo=z,lo=dt,go=gt,po=yt,ho=G,mo=pt,So=ht,vo=ae,fo=ce,Po=U,yo=st,Eo=j,Ao=nt,Io=K,wo=rt,Ro=M,Co=it,_o=q,xo=at,To=F,ko=ct,Do=mt,bo=St,Oo=V,$o=ut,No=ue,Wo=H,Ho=h,Uo=tt,qo=vt,Fo=ro,Vo=lt,Lo=xt,Ko=Tt;export{io as $Command,ao as __Client,co as AssumeRole$,uo as AssumeRoleCommand,lo as AssumeRoleRequest$,go as AssumeRoleResponse$,po as AssumeRoleWithWebIdentity$,ho as AssumeRoleWithWebIdentityCommand,mo as AssumeRoleWithWebIdentityRequest$,So as AssumeRoleWithWebIdentityResponse$,vo as AssumedRoleUser$,fo as Credentials$,Po as ExpiredTokenException,yo as ExpiredTokenException$,Eo as IDPCommunicationErrorException,Ao as IDPCommunicationErrorException$,Io as IDPRejectedClaimException,wo as IDPRejectedClaimException$,Ro as InvalidIdentityTokenException,Co as InvalidIdentityTokenException$,_o as MalformedPolicyDocumentException,xo as MalformedPolicyDocumentException$,To as PackedPolicyTooLargeException,ko as PackedPolicyTooLargeException$,Do as PolicyDescriptorType$,bo as ProvidedContext$,Oo as RegionDisabledException,$o as RegionDisabledException$,No as STS,Wo as STSClient,Ho as STSServiceException,Uo as STSServiceException$,qo as Tag$,Fo as decorateDefaultCredentialProvider,Vo as errorTypeRegistries,Lo as getDefaultRoleAssumer,Ko as getDefaultRoleAssumerWithWebIdentity};
|
|
2
|
+
import{jo,Ue,ot}from"./chunk-fjtvjrkg.js";import{Fe}from"./chunk-m40gxwq4.js";import{qe,ve,L}from"./chunk-jwdb0ccj.js";import{be,Y,b,Se,X,Qe,B}from"./chunk-981f9dw8.js";import{r}from"./chunk-0y7ne3d0.js";var fe=r(function(Dt){var{SignatureV4:kt,signatureV4aContainer:de}=jo(),O={CrtSignerV4:null},ge="X-Amz-S3session-Token".toLowerCase();class Z extends kt{async signWithCredentials(e,t,s){let o=pe(t);e.headers[ge]=t.sessionToken;let n=this;return he(n,o),n.signRequest(e,s??{})}async presignWithCredentials(e,t,s){let o=pe(t);return delete e.headers[ge],e.headers["X-Amz-S3session-Token"]=t.sessionToken,e.query=e.query??{},e.query["X-Amz-S3session-Token"]=t.sessionToken,he(this,o),this.presign(e,s)}}function pe(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,expiration:e.expiration}}function he(e,t){let s=e.credentialProvider;e.credentialProvider=()=>(e.credentialProvider=s,Promise.resolve(t))}class me{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){if(typeof O.CrtSignerV4==="function")return"crt";else if(typeof de.SignatureV4a==="function")return"js";return"none"}constructor(e){this.sigv4Signer=new Z(e),this.signerOptions=e}async sign(e,t={}){if(t.signingRegion==="*")return this.getSigv4aSigner().sign(e,t);return this.sigv4Signer.sign(e,t)}async signWithCredentials(e,t,s={}){if(s.signingRegion==="*"){let o=this.getSigv4aSigner(),n=O.CrtSignerV4;if(n&&o instanceof n)return o.signWithCredentials(e,t,s);else throw Error(`signWithCredentials with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}return this.sigv4Signer.signWithCredentials(e,t,s)}async presign(e,t={}){if(t.signingRegion==="*"){let s=this.getSigv4aSigner(),o=O.CrtSignerV4;if(o&&s instanceof o)return s.presign(e,t);else throw Error(`presign with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}return this.sigv4Signer.presign(e,t)}async presignWithCredentials(e,t,s={}){if(s.signingRegion==="*")throw Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(e,t,s)}getSigv4aSigner(){if(!this.sigv4aSigner){let e=O.CrtSignerV4,t=de.SignatureV4a;if(this.signerOptions.runtime==="node"){if(!e&&!t)throw Error("Neither CRT nor JS SigV4a implementation is available. Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt");if(e&&typeof e==="function")this.sigv4aSigner=new e({...this.signerOptions,signingAlgorithm:1});else if(t&&typeof t==="function")this.sigv4aSigner=new t({...this.signerOptions});else throw Error("Available SigV4a implementation is not a valid constructor. Please ensure you've properly imported @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a.For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt")}else{if(!t||typeof t!=="function")throw Error("JS SigV4a implementation is not available or not a valid constructor. Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. You must also register the package by calling [require('@aws-sdk/signature-v4a');] or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. For more information please go to https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a");this.sigv4aSigner=new t({...this.signerOptions})}}return this.sigv4aSigner}}Dt.SignatureV4MultiRegion=me;Dt.SignatureV4SignWithCredentials=Z;Dt.signatureV4CrtContainer=O});var{awsEndpointFunctions:Nt,emitWarningIfUnsupportedVersion:Wt,createDefaultUserAgentProvider:Ht,NODE_APP_ID_CONFIG_OPTIONS:Ut,getAwsRegionExtensionConfiguration:qt,resolveAwsRegionExtensionConfiguration:Ft,resolveUserAgentConfig:Vt,resolveHostHeaderConfig:Lt,getUserAgentPlugin:Kt,getHostHeaderPlugin:Mt,getLoggerPlugin:jt,getRecursionDetectionPlugin:zt,setCredentialFeature:se,stsRegionDefaultResolver:Gt}=L(),{NoAuthSigner:_e,getHttpAuthSchemeEndpointRuleSetPlugin:Yt,DefaultIdentityProviderConfig:Qt,getHttpSigningPlugin:Bt}=ve(),{normalizeProvider:xe,getSmithyContext:Te,ServiceException:Jt,NoOpLogger:Xt,emitWarningIfUnsupportedVersion:Zt,loadConfigsForDefaultMode:es,getDefaultExtensionConfiguration:ts,resolveDefaultRuntimeConfig:ss,Client:ke,makeBuilder:ns,createAggregatedClient:os}=Y(),{Command:rs}=Y();var io=rs,ao=ke;var{resolveDefaultsModeConfig:is,loadConfig:y,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:as,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:cs,NODE_REGION_CONFIG_OPTIONS:us,NODE_REGION_CONFIG_FILE_OPTIONS:ls,resolveRegionConfig:ds}=b(),{BinaryDecisionDiagram:gs,EndpointCache:ps,decideEndpoint:hs,customEndpointFunctions:ms,resolveParams:Ss,resolveEndpointConfig:vs,getEndpointPlugin:fs}=Se(),{parseUrl:Ps,getHttpHandlerExtensionConfiguration:ys,resolveHttpHandlerRuntimeConfig:Es,getContentLengthPlugin:As}=B(),{DEFAULT_RETRY_MODE:Is,NODE_RETRY_MODE_CONFIG_OPTIONS:ws,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:Rs,resolveRetryConfig:Cs,getRetryPlugin:_s}=qe(),{TypeRegistry:De,getSchemaSerdePlugin:xs}=be(),{resolveAwsSdkSigV4Config:Ts,resolveAwsSdkSigV4AConfig:ks,AwsSdkSigV4Signer:Oe,AwsSdkSigV4ASigner:$e,NODE_SIGV4A_CONFIG_OPTIONS:Ds,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:bs}=Ue(),{SignatureV4MultiRegion:Ne}=fe(),{toUtf8:Os,fromUtf8:$s,toBase64:Ns,fromBase64:Ws,calculateBodyLength:Hs}=X(),{streamCollector:Us,NodeHttpHandler:qs}=Fe(),{AwsQueryProtocol:Fs}=ot(),{Sha256:Vs}=Qe(),D="ref",I=-1,N=!0,Pe="isSet",We="PartitionResult",W="booleanEquals",l="stringEquals",ee="getAttr",ye="us-east-1",Ee="sigv4",Ae="sts",Ie="https://sts.{Region}.{PartitionResult#dnsSuffix}",we={[D]:"Endpoint"},d={[D]:"Region"},te={[D]:We},k={},Re=[d],Ce={conditions:[[Pe,[we]],[Pe,Re],["aws.partition",Re,We],[W,[{[D]:"UseFIPS"},N]],[W,[{[D]:"UseDualStack"},N]],[l,[d,"aws-global"]],[W,[{[D]:"UseGlobalEndpoint"},N]],[l,[d,"eu-central-1"]],[W,[{fn:ee,argv:[te,"supportsDualStack"]},N]],[W,[{fn:ee,argv:[te,"supportsFIPS"]},N]],[l,[d,"ap-south-1"]],[l,[d,"eu-north-1"]],[l,[d,"eu-west-1"]],[l,[d,"eu-west-2"]],[l,[d,"eu-west-3"]],[l,[d,"sa-east-1"]],[l,[d,ye]],[l,[d,"us-east-2"]],[l,[d,"us-west-2"]],[l,[d,"us-west-1"]],[l,[d,"ca-central-1"]],[l,[d,"ap-southeast-1"]],[l,[d,"ap-northeast-1"]],[l,[d,"ap-southeast-2"]],[l,[{fn:ee,argv:[te,"name"]},"aws-us-gov"]]],results:[[I],["https://sts.amazonaws.com",{authSchemes:[{name:Ee,signingName:Ae,signingRegion:ye}]}],[Ie,{authSchemes:[{name:Ee,signingName:Ae,signingRegion:"{Region}"}]}],[I,"Invalid Configuration: FIPS and custom endpoint are not supported"],[I,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[we,k],["https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",k],[I,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://sts.{Region}.amazonaws.com",k],["https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",k],[I,"FIPS is enabled but this partition does not support FIPS"],["https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",k],[I,"DualStack is enabled but this partition does not support DualStack"],[Ie,k],[I,"Invalid Configuration: Missing Region"]]},Ls=2,i=1e8,Ks=new Int32Array([-1,1,-1,0,30,3,1,4,i+14,2,5,i+14,3,25,6,4,24,7,5,i+1,8,6,9,i+13,7,i+1,10,10,i+1,11,11,i+1,12,12,i+1,13,13,i+1,14,14,i+1,15,15,i+1,16,16,i+1,17,17,i+1,18,18,i+1,19,19,i+1,20,20,i+1,21,21,i+1,22,22,i+1,23,23,i+1,i+2,8,i+11,i+12,4,28,26,9,27,i+10,24,i+8,i+9,8,29,i+7,9,i+6,i+7,3,i+3,31,4,i+4,i+5]),Ms=gs.from(Ks,Ls,Ce.conditions,Ce.results),js=new ps({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),He=(e,t={})=>js.get(e,()=>hs(Ms,{endpointParams:e,logger:t.logger}));ms.aws=Nt;var zs=(e)=>async(t,s,o)=>{if(!o)throw Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");let n=await e(t,s,o),u=Te(s)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!u)throw Error(`getEndpointParameterInstructions() is not defined on '${s.commandName}'`);let a=await Ss(o,{getEndpointParameterInstructions:u},t);return Object.assign(n,a)},Gs=async(e,t,s)=>({operation:Te(t).operation,region:await xe(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),Ys=zs(Gs);function Ve(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(t,s)=>({signingProperties:{config:t,context:s}})}}function ne(e){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(t,s)=>({signingProperties:{config:t,context:s}})}}function Le(e){return{schemeId:"smithy.api#noAuth"}}var Qs=(e,t,s)=>(n)=>{let a=e(n).properties?.authSchemes;if(!a)return t(n);let g=[];for(let S of a){let{name:p,properties:v={},...A}=S,f=p.toLowerCase();if(p!==f)console.warn(`HttpAuthScheme has been normalized with lowercasing: '${p}' to '${f}'`);let m;if(f==="sigv4a"){m="aws.auth#sigv4a";let Q=a.find((J)=>{let le=J.name.toLowerCase();return le!=="sigv4a"&&le.startsWith("sigv4")});if(Ne.sigv4aDependency()==="none"&&Q)continue}else if(f.startsWith("sigv4"))m="aws.auth#sigv4";else throw Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${f}'`);let T=s[m];if(!T)throw Error(`Could not find HttpAuthOption create function for '${m}'`);let P=T(n);P.schemeId=m,P.signingProperties={...P.signingProperties||{},...A,...v},g.push(P)}return g},Bs=(e)=>{let t=[];switch(e.operation){case"AssumeRoleWithWebIdentity":{t.push(Le()),t.push(ne(e));break}default:t.push(Ve(e)),t.push(ne(e))}return t},Js=Qs(He,Bs,{"aws.auth#sigv4":Ve,"aws.auth#sigv4a":ne,"smithy.api#noAuth":Le}),Xs=(e)=>{let t=Ts(e),s=ks(t);return Object.assign(s,{authSchemePreference:xe(e.authSchemePreference??[])})},Zs=(e)=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,useGlobalEndpoint:e.useGlobalEndpoint??!1,defaultSigningName:"sts"}),en={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"}},tn="3.997.47",sn={version:tn};class h extends Jt{static shapeId="smithy.ts.sdk.synthetic.com.amazonaws.sts#STSServiceException";constructor(e){super(e);Object.setPrototypeOf(this,h.prototype)}}class U extends h{static shapeId="com.amazonaws.sts#ExpiredTokenException";name="ExpiredTokenException";$fault="client";constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e});Object.setPrototypeOf(this,U.prototype)}}class q extends h{static shapeId="com.amazonaws.sts#MalformedPolicyDocumentException";name="MalformedPolicyDocumentException";$fault="client";constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e});Object.setPrototypeOf(this,q.prototype)}}class F extends h{static shapeId="com.amazonaws.sts#PackedPolicyTooLargeException";name="PackedPolicyTooLargeException";$fault="client";constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e});Object.setPrototypeOf(this,F.prototype)}}class V extends h{static shapeId="com.amazonaws.sts#RegionDisabledException";name="RegionDisabledException";$fault="client";constructor(e){super({name:"RegionDisabledException",$fault:"client",...e});Object.setPrototypeOf(this,V.prototype)}}class K extends h{static shapeId="com.amazonaws.sts#IDPRejectedClaimException";name="IDPRejectedClaimException";$fault="client";constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e});Object.setPrototypeOf(this,K.prototype)}}class M extends h{static shapeId="com.amazonaws.sts#InvalidIdentityTokenException";name="InvalidIdentityTokenException";$fault="client";constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e});Object.setPrototypeOf(this,M.prototype)}}class j extends h{static shapeId="com.amazonaws.sts#IDPCommunicationErrorException";name="IDPCommunicationErrorException";$fault="client";$retryable={};constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e});Object.setPrototypeOf(this,j.prototype)}}var nn="Arn",on="AccessKeyId",rn="AssumeRole",an="AssumedRoleId",cn="AssumeRoleRequest",un="AssumeRoleResponse",oe="AssumedRoleUser",ln="AssumeRoleWithWebIdentity",dn="AssumeRoleWithWebIdentityRequest",gn="AssumeRoleWithWebIdentityResponse",pn="Audience",re="Credentials",hn="ContextAssertion",Ke="DurationSeconds",mn="Expiration",Sn="ExternalId",vn="ExpiredTokenException",fn="IDPCommunicationErrorException",Pn="IDPRejectedClaimException",yn="InvalidIdentityTokenException",En="Key",An="MalformedPolicyDocumentException",Me="MinimumSessionTokenSize",je="Policy",ze="PolicyArns",In="ProviderArn",wn="ProvidedContexts",Rn="ProvidedContextsListType",Cn="ProvidedContext",_n="PolicyDescriptorType",xn="ProviderId",Ge="PackedPolicySize",Tn="PackedPolicyTooLargeException",kn="Provider",Ye="RoleArn",Dn="RegionDisabledException",Be="RoleSessionName",bn="SecretAccessKey",On="SubjectFromWebIdentityToken",ie="SourceIdentity",$n="SerialNumber",Nn="SessionToken",Je="SessionTokenSize",Xe="SessionTokenUtilization",Wn="Tags",Hn="TokenCode",Un="TransitiveTagKeys",qn="Tag",Fn="Value",Vn="WebIdentityToken",Ln="arn",Kn="accessKeySecretType",w="awsQueryError",R="client",Mn="clientTokenType",C="error",_="httpError",x="message",jn="policyDescriptorListType",Ze="smithy.ts.sdk.synthetic.com.amazonaws.sts",zn="tagListType",c="com.amazonaws.sts",et=new De(Ze),tt=[-3,Ze,"STSServiceException",0,[],[]];et.registerError(tt,h);var E=new De(c),st=[-3,c,vn,{[w]:["ExpiredTokenException",400],[C]:R,[_]:400},[x],[0]];E.registerError(st,U);var nt=[-3,c,fn,{[w]:["IDPCommunicationError",400],[C]:R,[_]:400},[x],[0]];E.registerError(nt,j);var rt=[-3,c,Pn,{[w]:["IDPRejectedClaim",403],[C]:R,[_]:403},[x],[0]];E.registerError(rt,K);var it=[-3,c,yn,{[w]:["InvalidIdentityToken",400],[C]:R,[_]:400},[x],[0]];E.registerError(it,M);var at=[-3,c,An,{[w]:["MalformedPolicyDocument",400],[C]:R,[_]:400},[x],[0]];E.registerError(at,q);var ct=[-3,c,Tn,{[w]:["PackedPolicyTooLarge",400],[C]:R,[_]:400},[x],[0]];E.registerError(ct,F);var ut=[-3,c,Dn,{[w]:["RegionDisabledException",403],[C]:R,[_]:403},[x],[0]];E.registerError(ut,V);var lt=[et,E],Gn=[0,c,Kn,8,0],Yn=[0,c,Mn,8,0],ae=[3,c,oe,0,[an,nn],[0,0],2],dt=[3,c,cn,0,[Ye,Be,ze,je,Ke,Wn,Un,Sn,$n,Hn,ie,wn,Me],[0,0,()=>ft,0,1,()=>Bn,64,0,0,0,0,()=>Qn,1],2],gt=[3,c,un,0,[re,oe,Ge,ie,Xe,Je],[[()=>ce,0],()=>ae,1,0,1,1]],pt=[3,c,dn,0,[Ye,Be,Vn,xn,ze,je,Ke,Me],[0,0,[()=>Yn,0],0,()=>ft,0,1,1],3],ht=[3,c,gn,0,[re,On,oe,Ge,kn,pn,ie,Xe,Je],[[()=>ce,0],0,()=>ae,1,0,0,0,1,1]],ce=[3,c,re,0,[on,bn,Nn,mn],[0,[()=>Gn,0],0,4],4],mt=[3,c,_n,0,[Ln],[0]],St=[3,c,Cn,0,[In,hn],[0,0]],vt=[3,c,qn,0,[En,Fn],[0,0],2],ft=[1,c,jn,0,()=>mt],Qn=[1,c,Rn,0,()=>St],Bn=[1,c,zn,0,()=>vt],Pt=[9,c,rn,0,()=>dt,()=>gt],yt=[9,c,ln,0,()=>pt,()=>ht],Jn=(e)=>({apiVersion:"2011-06-15",base64Decoder:e?.base64Decoder??Ws,base64Encoder:e?.base64Encoder??Ns,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??He,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Js,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(t)=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Oe},{schemeId:"aws.auth#sigv4a",identityProvider:(t)=>t.getIdentityProvider("aws.auth#sigv4a"),signer:new $e},{schemeId:"smithy.api#noAuth",identityProvider:(t)=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new _e}],logger:e?.logger??new Xt,protocol:e?.protocol??Fs,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",errorTypeRegistries:lt,xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:e?.serviceId??"STS",sha256:e?.sha256??Vs,signerConstructor:e?.signerConstructor??Ne,urlParser:e?.urlParser??Ps,utf8Decoder:e?.utf8Decoder??$s,utf8Encoder:e?.utf8Encoder??Os}),Xn=(e)=>{Zt(process.version);let t=is(e),s=()=>t().then(es),o=Jn(e);Wt(process.version);let n={profile:e?.profile,logger:o.logger};return{...o,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??y(bs,n),bodyLengthChecker:e?.bodyLengthChecker??Hs,defaultUserAgentProvider:e?.defaultUserAgentProvider??Ht({serviceId:o.serviceId,clientVersion:sn.version}),httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(u)=>u.getIdentityProvider("aws.auth#sigv4")||(async(a)=>await e.credentialDefaultProvider(a?.__config||{})()),signer:new Oe},{schemeId:"aws.auth#sigv4a",identityProvider:(u)=>u.getIdentityProvider("aws.auth#sigv4a"),signer:new $e},{schemeId:"smithy.api#noAuth",identityProvider:(u)=>u.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new _e}],maxAttempts:e?.maxAttempts??y(Rs,e),region:e?.region??y(us,{...ls,...n}),requestHandler:qs.create(e?.requestHandler??s),retryMode:e?.retryMode??y({...ws,default:async()=>(await s()).retryMode||Is},e),sigv4aSigningRegionSet:e?.sigv4aSigningRegionSet??y(Ds,n),streamCollector:e?.streamCollector??Us,useDualstackEndpoint:e?.useDualstackEndpoint??y(cs,n),useFipsEndpoint:e?.useFipsEndpoint??y(as,n),userAgentAppId:e?.userAgentAppId??y(Ut,n)}},Zn=(e)=>{let{httpAuthSchemes:t,httpAuthSchemeProvider:s,credentials:o}=e;return{setHttpAuthScheme(n){let u=t.findIndex((a)=>a.schemeId===n.schemeId);if(u===-1)t.push(n);else t.splice(u,1,n)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(n){s=n},httpAuthSchemeProvider(){return s},setCredentials(n){o=n},credentials(){return o}}},eo=(e)=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),to=(e,t)=>{let s=Object.assign(qt(e),ts(e),ys(e),Zn(e));return t.forEach((o)=>o.configure(s)),Object.assign(e,Ft(s),ss(s),Es(s),eo(s))};class H extends ke{config;constructor(...[e]){let t=Xn(e||{});super(t);this.initConfig=t;let s=Zs(t),o=Vt(s),n=Cs(o),u=ds(n),a=Lt(u),g=vs(a),S=Xs(g),p=to(S,e?.extensions||[]);this.config=p,this.middlewareStack.use(xs(this.config)),this.middlewareStack.use(Kt(this.config)),this.middlewareStack.use(_s(this.config)),this.middlewareStack.use(As(this.config)),this.middlewareStack.use(Mt(this.config)),this.middlewareStack.use(jt(this.config)),this.middlewareStack.use(zt(this.config)),this.middlewareStack.use(Yt(this.config,{httpAuthSchemeParametersProvider:Ys,identityProviderConfigProvider:async(v)=>new Qt({"aws.auth#sigv4":v.credentials,"aws.auth#sigv4a":v.credentials})})),this.middlewareStack.use(Bt(this.config))}destroy(){super.destroy()}}var Et=ns(en,"AWSSecurityTokenServiceV20110615","STSClient",fs),At={},It=(e,t,s,o)=>[];class z extends Et(At,It,"AssumeRole",Pt){}class G extends Et(At,It,"AssumeRoleWithWebIdentity",yt){}var so={AssumeRoleCommand:z,AssumeRoleWithWebIdentityCommand:G};class ue extends H{}os(so,ue);var wt=(e)=>{if(typeof e?.Arn==="string"){let t=e.Arn.split(":");if(t.length>4&&t[4]!=="")return t[4]}return},Rt=async(e,t,s,o={})=>{let n=typeof e==="function"?await e():e,u=typeof t==="function"?await t():t,a="",g=n??u??(a=await Gt(o)());return s?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${n} (credential provider clientConfig)`,`${u} (contextual client)`,`${a} (STS default: AWS_REGION, profile region, or us-east-1)`),g},no=(e,t)=>{let s,o;return async(n,u)=>{if(o=n,!s){let{logger:v=e?.parentClientConfig?.logger,profile:A=e?.parentClientConfig?.profile,region:f,requestHandler:m=e?.parentClientConfig?.requestHandler,credentialProviderLogger:T,userAgentAppId:P=e?.parentClientConfig?.userAgentAppId}=e,Q=await Rt(f,e?.parentClientConfig?.region,T,{logger:v,profile:A}),J=!Ct(m);s=new t({...e,userAgentAppId:P,profile:A,credentialDefaultProvider:()=>async()=>o,region:Q,requestHandler:J?m:void 0,logger:v})}let{Credentials:a,AssumedRoleUser:g}=await s.send(new z(u));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw Error(`Invalid response from STS.assumeRole call with role ${u.RoleArn}`);let S=wt(g),p={accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...S&&{accountId:S}};return se(p,"CREDENTIALS_STS_ASSUME_ROLE","i"),p}},oo=(e,t)=>{let s;return async(o)=>{if(!s){let{logger:S=e?.parentClientConfig?.logger,profile:p=e?.parentClientConfig?.profile,region:v,requestHandler:A=e?.parentClientConfig?.requestHandler,credentialProviderLogger:f,userAgentAppId:m=e?.parentClientConfig?.userAgentAppId}=e,T=await Rt(v,e?.parentClientConfig?.region,f,{logger:S,profile:p}),P=!Ct(A);s=new t({...e,userAgentAppId:m,profile:p,region:T,requestHandler:P?A:void 0,logger:S})}let{Credentials:n,AssumedRoleUser:u}=await s.send(new G(o));if(!n||!n.AccessKeyId||!n.SecretAccessKey)throw Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${o.RoleArn}`);let a=wt(u),g={accessKeyId:n.AccessKeyId,secretAccessKey:n.SecretAccessKey,sessionToken:n.SessionToken,expiration:n.Expiration,...n.CredentialScope&&{credentialScope:n.CredentialScope},...a&&{accountId:a}};if(a)se(g,"RESOLVED_ACCOUNT_ID","T");return se(g,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),g}},Ct=(e)=>e?.metadata?.handlerProtocol==="h2",_t=(e,t)=>{if(!t)return e;else return class extends e{constructor(o){super(o);for(let n of t)this.middlewareStack.use(n)}}},xt=(e={},t)=>no(e,_t(H,t)),Tt=(e={},t)=>oo(e,_t(H,t)),ro=(e)=>(t)=>e({roleAssumer:xt(t),roleAssumerWithWebIdentity:Tt(t),...t});var co=Pt,uo=z,lo=dt,go=gt,po=yt,ho=G,mo=pt,So=ht,vo=ae,fo=ce,Po=U,yo=st,Eo=j,Ao=nt,Io=K,wo=rt,Ro=M,Co=it,_o=q,xo=at,To=F,ko=ct,Do=mt,bo=St,Oo=V,$o=ut,No=ue,Wo=H,Ho=h,Uo=tt,qo=vt,Fo=ro,Vo=lt,Lo=xt,Ko=Tt;export{io as $Command,ao as __Client,co as AssumeRole$,uo as AssumeRoleCommand,lo as AssumeRoleRequest$,go as AssumeRoleResponse$,po as AssumeRoleWithWebIdentity$,ho as AssumeRoleWithWebIdentityCommand,mo as AssumeRoleWithWebIdentityRequest$,So as AssumeRoleWithWebIdentityResponse$,vo as AssumedRoleUser$,fo as Credentials$,Po as ExpiredTokenException,yo as ExpiredTokenException$,Eo as IDPCommunicationErrorException,Ao as IDPCommunicationErrorException$,Io as IDPRejectedClaimException,wo as IDPRejectedClaimException$,Ro as InvalidIdentityTokenException,Co as InvalidIdentityTokenException$,_o as MalformedPolicyDocumentException,xo as MalformedPolicyDocumentException$,To as PackedPolicyTooLargeException,ko as PackedPolicyTooLargeException$,Do as PolicyDescriptorType$,bo as ProvidedContext$,Oo as RegionDisabledException,$o as RegionDisabledException$,No as STS,Wo as STSClient,Ho as STSServiceException,Uo as STSServiceException$,qo as Tag$,Fo as decorateDefaultCredentialProvider,Vo as errorTypeRegistries,Lo as getDefaultRoleAssumer,Ko as getDefaultRoleAssumerWithWebIdentity};
|