@stacksjs/buddy 0.70.4 → 0.70.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-wz2wxp9f.js → chunk-1vaz8fbz.js} +1 -1
- package/dist/{chunk-tv4f0d0g.js → chunk-1zz448cs.js} +1 -1
- package/dist/chunk-afqas5yf.js +5 -0
- package/dist/{chunk-y4k8k1by.js → chunk-j3bhtk0d.js} +1 -1
- package/dist/{chunk-fds99vbx.js → chunk-pnr51281.js} +1 -1
- package/dist/{chunk-zm0j2nyb.js → chunk-r0recaya.js} +1 -1
- package/dist/{chunk-7kc7thq5.js → chunk-w06e63eh.js} +3 -3
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-jky37dv1.js +0 -5
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$ as X,Aa as i,Ba as c,P as M,Q as N,R as O,S as Q,T as R,U as S,W as T,X as U,Z as V,_ as W,aa as Y,ba as Z,ca as _,da as $,ea as x,fa as z,ga as C,ha as F,ia as P,ja as h,ka as A,la as D,ma as k,na as f,oa as j,pa as I,qa as g,ra as p,sa as a,ta as m,ua as J,xa as n,ya as l}from"./chunk-
|
|
2
|
+
import{$ as X,Aa as i,Ba as c,P as M,Q as N,R as O,S as Q,T as R,U as S,W as T,X as U,Z as V,_ as W,aa as Y,ba as Z,ca as _,da as $,ea as x,fa as z,ga as C,ha as F,ia as P,ja as h,ka as A,la as D,ma as k,na as f,oa as j,pa as I,qa as g,ra as p,sa as a,ta as m,ua as J,xa as n,ya as l}from"./chunk-w06e63eh.js";import"./chunk-yv49ttdw.js";import"./chunk-ks9kq37e.js";import"./chunk-r0recaya.js";import"./chunk-e1kefb68.js";import"./chunk-afqas5yf.js";import"./chunk-5vhayxpk.js";import"./chunk-ww48v0ap.js";import"./chunk-8acb2bq0.js";import"./chunk-5eh2tfep.js";import"./chunk-2xrqj8ap.js";import"./chunk-z80nypa9.js";import"./chunk-bgqy98qw.js";import"./chunk-2pj0cr49.js";import w from"process";import{runAction as t}from"@stacksjs/actions";import{cli as e,log as v}from"@stacksjs/cli";import{Action as o}from"@stacksjs/enums";import{path as L}from"@stacksjs/path";import{fs as r}from"@stacksjs/storage";import{ensureProjectIsInitialized as b}from"@stacksjs/utils";w.on("uncaughtException",(q)=>{v.debug("Buddy uncaughtException"),v.error(q),w.exit(1)});w.on("unhandledRejection",(q)=>{v.debug("Buddy unhandledRejection"),v.error(q),w.exit(1)});async function s(){let q=e("buddy");if(J(q),x(q),await b())v.debug("Project is initialized");else{v.info("Your `APP_KEY` is not yet set"),v.info("Generating application key...");let B=await t(o.KeyGenerate);if(B.isErr())v.error("Failed to set random application key.",B.error),w.exit()}M(q),N(q),O(q),Q(q),R(q),S(q),U(q),W(q),T(q),V(q),A(q),k(q),Y(q),Z(q),_(q),$(q),z(q),C(q),F(q),P(q),h(q),f(q),j(q),I(q),g(q),a(q),X(q),m(q),J(q),p(q),n(q),l(q),c(q),D(q),i(q),await y(q),q.help(),q.parse()}await s();async function y(q){let G=L.appPath("Commands"),B=r.readdirSync(G).filter((E)=>E.endsWith(".ts"));for(let E of B){let H=await import(`${G}/${E}`);if(typeof H.default==="function")H.default(q);else console.error(`Expected a default export function in ${E}, but got:`,H.default)}let K=await import(L.listenersPath("Console.ts"));if(typeof K.default==="function")K.default(q)}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$ as i,Aa as P,Ba as Q,P as e,Q as f,R as m,S as p,T as t,U as x,V as a,W as b,X as c,Y as d,Z as g,_ as h,aa as j,ba as k,ca as l,da as n,ea as q,fa as s,ga as u,ha as v,ia as w,ja as y,ka as z,la as A,ma as B,na as C,oa as D,pa as E,qa as F,ra as G,sa as H,ta as I,ua as J,va as K,wa as L,xa as M,ya as N,za as O}from"./chunk-
|
|
2
|
+
import{$ as i,Aa as P,Ba as Q,P as e,Q as f,R as m,S as p,T as t,U as x,V as a,W as b,X as c,Y as d,Z as g,_ as h,aa as j,ba as k,ca as l,da as n,ea as q,fa as s,ga as u,ha as v,ia as w,ja as y,ka as z,la as A,ma as B,na as C,oa as D,pa as E,qa as F,ra as G,sa as H,ta as I,ua as J,va as K,wa as L,xa as M,ya as N,za as O}from"./chunk-w06e63eh.js";import"./chunk-yv49ttdw.js";import"./chunk-ks9kq37e.js";import"./chunk-r0recaya.js";import"./chunk-e1kefb68.js";import"./chunk-afqas5yf.js";import"./chunk-5vhayxpk.js";import"./chunk-ww48v0ap.js";import"./chunk-8acb2bq0.js";import"./chunk-5eh2tfep.js";import"./chunk-2xrqj8ap.js";import"./chunk-z80nypa9.js";import"./chunk-bgqy98qw.js";import"./chunk-2pj0cr49.js";export{Q as version,P as upgrade,O as types,N as tinker,M as test,d as startDevelopmentServer,J as setup,I as seed,H as search,G as schedule,F as saas,E as route,D as release,C as queue,B as projects,A as prepublish,z as ports,y as outdated,K as optimizePkgxDeps,w as migrate,v as make,u as list,s as lint,q as key,n as install,l as http,k as generate,j as fresh,i as env,L as ensureEnvIsSet,h as domains,g as dns,c as dev,b as deploy,a as create,x as configure,t as commit,p as cloud,m as clean,f as changelog,e as build};
|
package/package.json
CHANGED
package/dist/chunk-jky37dv1.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{tc as Ze,xc as O}from"./chunk-ww48v0ap.js";import{Gc as P}from"./chunk-5eh2tfep.js";import{Rc as C}from"./chunk-2pj0cr49.js";var b=(e,t)=>{let r=[];if(e)r.push(e);if(t)for(let n of t)r.push(n);return r},S=(e,t)=>{return`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`},M=()=>{let e=[],t=[],r=!1,n=new Set,o=(a)=>a.sort((f,d)=>q[d.step]-q[f.step]||V[d.priority||"normal"]-V[f.priority||"normal"]),s=(a)=>{let f=!1,d=(m)=>{let g=b(m.name,m.aliases);if(g.includes(a)){f=!0;for(let l of g)n.delete(l);return!1}return!0};return e=e.filter(d),t=t.filter(d),f},i=(a)=>{let f=!1,d=(m)=>{if(m.middleware===a){f=!0;for(let g of b(m.name,m.aliases))n.delete(g);return!1}return!0};return e=e.filter(d),t=t.filter(d),f},c=(a)=>{return e.forEach((f)=>{a.add(f.middleware,{...f})}),t.forEach((f)=>{a.addRelativeTo(f.middleware,{...f})}),a.identifyOnResolve?.(E.identifyOnResolve()),a},p=(a)=>{let f=[];return a.before.forEach((d)=>{if(d.before.length===0&&d.after.length===0)f.push(d);else f.push(...p(d))}),f.push(a),a.after.reverse().forEach((d)=>{if(d.before.length===0&&d.after.length===0)f.push(d);else f.push(...p(d))}),f},x=(a=!1)=>{let f=[],d=[],m={};return e.forEach((l)=>{let h={...l,before:[],after:[]};for(let u of b(h.name,h.aliases))m[u]=h;f.push(h)}),t.forEach((l)=>{let h={...l,before:[],after:[]};for(let u of b(h.name,h.aliases))m[u]=h;d.push(h)}),d.forEach((l)=>{if(l.toMiddleware){let h=m[l.toMiddleware];if(h===void 0){if(a)return;throw new Error(`${l.toMiddleware} is not found when adding ${S(l.name,l.aliases)} middleware ${l.relation} ${l.toMiddleware}`)}if(l.relation==="after")h.after.push(l);if(l.relation==="before")h.before.push(l)}}),o(f).map(p).reduce((l,h)=>{return l.push(...h),l},[])},E={add:(a,f={})=>{let{name:d,override:m,aliases:g}=f,l={step:"initialize",priority:"normal",middleware:a,...f},h=b(d,g);if(h.length>0){if(h.some((u)=>n.has(u))){if(!m)throw new Error(`Duplicate middleware name '${S(d,g)}'`);for(let u of h){let y=e.findIndex((I)=>I.name===u||I.aliases?.some((F)=>F===u));if(y===-1)continue;let T=e[y];if(T.step!==l.step||l.priority!==T.priority)throw new Error(`"${S(T.name,T.aliases)}" middleware with ${T.priority} priority in ${T.step} step cannot be overridden by "${S(d,g)}" middleware with ${l.priority} priority in ${l.step} step.`);e.splice(y,1)}}for(let u of h)n.add(u)}e.push(l)},addRelativeTo:(a,f)=>{let{name:d,override:m,aliases:g}=f,l={middleware:a,...f},h=b(d,g);if(h.length>0){if(h.some((u)=>n.has(u))){if(!m)throw new Error(`Duplicate middleware name '${S(d,g)}'`);for(let u of h){let y=t.findIndex((I)=>I.name===u||I.aliases?.some((F)=>F===u));if(y===-1)continue;let T=t[y];if(T.toMiddleware!==l.toMiddleware||T.relation!==l.relation)throw new Error(`"${S(T.name,T.aliases)}" middleware ${T.relation} "${T.toMiddleware}" middleware cannot be overridden by "${S(d,g)}" middleware ${l.relation} "${l.toMiddleware}" middleware.`);t.splice(y,1)}}for(let u of h)n.add(u)}t.push(l)},clone:()=>c(M()),use:(a)=>{a.applyToStack(E)},remove:(a)=>{if(typeof a==="string")return s(a);else return i(a)},removeByTag:(a)=>{let f=!1,d=(m)=>{let{tags:g,name:l,aliases:h}=m;if(g&&g.includes(a)){let u=b(l,h);for(let y of u)n.delete(y);return f=!0,!1}return!0};return e=e.filter(d),t=t.filter(d),f},concat:(a)=>{let f=c(M());return f.use(a),f.identifyOnResolve(r||f.identifyOnResolve()||(a.identifyOnResolve?.()??!1)),f},applyToStack:c,identify:()=>{return x(!0).map((a)=>{let f=a.step??a.relation+" "+a.toMiddleware;return S(a.name,a.aliases)+" - "+f})},identifyOnResolve(a){if(typeof a==="boolean")r=a;return r},resolve:(a,f)=>{for(let d of x().map((m)=>m.middleware).reverse())a=d(a,f);if(r)console.log(E.identify());return a}};return E},q={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},V={high:3,normal:2,low:1};class Ce{constructor(e){this.config=e,this.middlewareStack=M()}send(e,t,r){let n=typeof t!=="function"?t:void 0,o=typeof t==="function"?t:r,s=n===void 0&&this.config.cacheMiddleware===!0,i;if(s){if(!this.handlers)this.handlers=new WeakMap;let c=this.handlers;if(c.has(e.constructor))i=c.get(e.constructor);else i=e.resolveMiddleware(this.middlewareStack,this.config,n),c.set(e.constructor,i)}else delete this.handlers,i=e.resolveMiddleware(this.middlewareStack,this.config,n);if(o)i(e).then((c)=>o(null,c.output),(c)=>o(c)).catch(()=>{});else return i(e).then((c)=>c.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}var Q=C(P(),1);class G{constructor(){this.middlewareStack=M()}static classBuilder(){return new Z}resolveMiddlewareWithContext(e,t,r,{middlewareFn:n,clientName:o,commandName:s,inputFilterSensitiveLog:i,outputFilterSensitiveLog:c,smithyContext:p,additionalContext:x,CommandCtor:E}){for(let g of n.bind(this)(E,e,t,r))this.middlewareStack.use(g);let a=e.concat(this.middlewareStack),{logger:f}=t,d={logger:f,clientName:o,commandName:s,inputFilterSensitiveLog:i,outputFilterSensitiveLog:c,[Q.SMITHY_CONTEXT_KEY]:{commandInstance:this,...p},...x},{requestHandler:m}=t;return a.resolve((g)=>m.handle(g.request,r||{}),d)}}class Z{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=(e)=>e,this._outputFilterSensitiveLog=(e)=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,r={}){return this._smithyContext={service:e,operation:t,...r},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=(r)=>r,t=(r)=>r){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){let e=this,t;return t=class extends G{static getEndpointParameterInstructions(){return e._ep}constructor(...[r]){super();this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=r??{},e._init(this)}resolveMiddleware(r,n,o){return this.resolveMiddlewareWithContext(r,n,o,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}var $e=C(O(),1);var mt="***SensitiveInformation***";var Me=(e)=>{if(e===null||e===void 0)return;if(typeof e==="string"){let t=parseFloat(e);if(!Number.isNaN(t)){if(String(t)!==String(e))oe.warn(ne(`Expected number but observed string: ${e}`));return t}}if(typeof e==="number")return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)},Ae=Math.ceil(340282346638528860000000000000000000000),X=(e)=>{let t=Me(e);if(t!==void 0&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0){if(Math.abs(t)>Ae)throw new TypeError(`Expected 32-bit float, got ${e}`)}return t},Ie=(e)=>{if(e===null||e===void 0)return;if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)};var K=(e)=>D(e,32),v=(e)=>D(e,16),ee=(e)=>D(e,8),D=(e,t)=>{let r=Ie(e);if(r!==void 0&&Ne(r,t)!==r)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return r},Ne=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},yt=(e,t)=>{if(e===null||e===void 0){if(t)throw new TypeError(`Expected a non-null value for ${t}`);throw new TypeError("Expected a non-null value")}return e},wt=(e)=>{if(e===null||e===void 0)return;if(typeof e==="object"&&!Array.isArray(e))return e;let t=Array.isArray(e)?"array":typeof e;throw new TypeError(`Expected object, got ${t}: ${e}`)},xt=(e)=>{if(e===null||e===void 0)return;if(typeof e==="string")return e;if(["boolean","number","bigint"].includes(typeof e))return oe.warn(ne(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)};var te=(e)=>{if(typeof e=="string")return X(_(e));return X(e)},_e=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,_=(e)=>{let t=e.match(_e);if(t===null||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)};var Et=(e)=>{if(typeof e==="string")return K(_(e));return K(e)},U=(e)=>{if(typeof e==="string")return v(_(e));return v(e)},re=(e)=>{if(typeof e==="string")return ee(_(e));return ee(e)},ne=(e)=>{return String(new TypeError(e).stack||e).split(`
|
|
2
|
-
`).slice(0,5).filter((t)=>!t.includes("stackTraceWarning")).join(`
|
|
3
|
-
`)},oe={warn:console.warn};var ke=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var Re=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),Ct=(e)=>{if(e===null||e===void 0)return;if(typeof e!=="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let t=Re.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,s,i,c,p,x]=t,E=U(L(n)),a=$(o,"month",1,12),f=$(s,"day",1,31);return se(E,a,f,{hours:i,minutes:c,seconds:p,fractionalMilliseconds:x})},Fe=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),$t=(e)=>{if(e===null||e===void 0)return;if(typeof e!=="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let t=Fe.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,s,i,c,p,x,E]=t,a=U(L(n)),f=$(o,"month",1,12),d=$(s,"day",1,31),m=se(a,f,d,{hours:i,minutes:c,seconds:p,fractionalMilliseconds:x});if(E.toUpperCase()!="Z")m.setTime(m.getTime()-Le(E));return m},Mt=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),At=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),It=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/);var se=(e,t,r,n)=>{let o=t-1;return Oe(e,o,r),new Date(Date.UTC(e,o,r,$(n.hours,"hour",0,23),$(n.minutes,"minute",0,59),$(n.seconds,"seconds",0,60),Ue(n.fractionalMilliseconds)))};var Pe=[31,28,31,30,31,30,31,31,30,31,30,31],Oe=(e,t,r)=>{let n=Pe[t];if(t===1&&De(e))n=29;if(r>n)throw new TypeError(`Invalid day for ${ke[t]} in ${e}: ${r}`)},De=(e)=>{return e%4===0&&(e%100!==0||e%400===0)},$=(e,t,r,n)=>{let o=re(L(e));if(o<r||o>n)throw new TypeError(`${t} must be between ${r} and ${n}, inclusive`);return o},Ue=(e)=>{if(e===null||e===void 0)return 0;return te("0."+e)*1000},Le=(e)=>{let t=e[0],r=1;if(t=="+")r=1;else if(t=="-")r=-1;else throw new TypeError(`Offset direction, ${t}, must be "+" or "-"`);let n=Number(e.substring(1,3)),o=Number(e.substring(4,6));return r*(n*60+o)*60*1000},L=(e)=>{let t=0;while(t<e.length-1&&e.charAt(t)==="0")t++;if(t===0)return e;return e.slice(t)};class N extends Error{constructor(e){super(e.message);Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;let t=e;return N.prototype.isPrototypeOf(t)||Boolean(t.$fault)&&Boolean(t.$metadata)&&(t.$fault==="client"||t.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;let t=e;if(this===N)return N.isInstance(e);if(N.isInstance(e)){if(t.name&&this.name)return this.prototype.isPrototypeOf(e)||t.name===this.name;return this.prototype.isPrototypeOf(e)}return!1}}var ie=(e,t={})=>{Object.entries(t).filter(([,n])=>n!==void 0).forEach(([n,o])=>{if(e[n]==null||e[n]==="")e[n]=o});let r=e.message||e.Message||"UnknownError";return e.message=r,delete e.Message,e};var ze=({output:e,parsedBody:t,exceptionCtor:r,errorCode:n})=>{let o=He(e),s=o.httpStatusCode?o.httpStatusCode+"":void 0,i=new r({name:t?.code||t?.Code||n||s||"UnknownError",$fault:"client",$metadata:o});throw ie(i,t)},Rt=(e)=>{return({output:t,parsedBody:r,errorCode:n})=>{ze({output:t,parsedBody:r,exceptionCtor:e,errorCode:n})}},He=(e)=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]});var Pt=(e)=>{switch(e){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:30000};default:return{}}};var ce=!1,Dt=(e)=>{if(e&&!ce&&parseInt(e.substring(1,e.indexOf(".")))<16)ce=!0};var Be=C(O(),1);var z=C(P(),1);var ae=(e)=>{let t=[];for(let r in z.AlgorithmId){let n=z.AlgorithmId[r];if(e[n]===void 0)continue;t.push({algorithmId:()=>n,checksumConstructor:()=>e[n]})}return{_checksumAlgorithms:t,addChecksumAlgorithm(r){this._checksumAlgorithms.push(r)},checksumAlgorithms(){return this._checksumAlgorithms}}},fe=(e)=>{let t={};return e.checksumAlgorithms().forEach((r)=>{t[r.algorithmId()]=r.checksumConstructor()}),t};var de=(e)=>{let t=e.retryStrategy;return{setRetryStrategy(r){t=r},retryStrategy(){return t}}},ue=(e)=>{let t={};return t.retryStrategy=e.retryStrategy(),t};var Jt=(e)=>{return{...ae(e),...de(e)}};var jt=(e)=>{return{...fe(e),...ue(e)}};var Qt=(e)=>Array.isArray(e)?e:[e];var Xt=(e)=>{return e!=null};var A=function e(t){return Object.assign(new String(t),{deserializeJSON(){return JSON.parse(String(t))},toString(){return String(t)},toJSON(){return String(t)}})};A.from=(e)=>{if(e&&typeof e==="object"&&(e instanceof A||("deserializeJSON"in e)))return e;else if(typeof e==="string"||Object.getPrototypeOf(e)===String.prototype)return A(String(e));return A(JSON.stringify(e))};A.fromObject=A.from;class We{trace(){}debug(){}info(){}warn(){}error(){}}function Je(e,t,r){let n,o,s;if(typeof t==="undefined"&&typeof r==="undefined")n={},s=e;else if(n=e,typeof t==="function")return o=t,s=r,je(n,o,s);else s=t;for(let i of Object.keys(s)){if(!Array.isArray(s[i])){n[i]=s[i];continue}le(n,null,s,i)}return n}var tr=(e,t)=>{let r={};for(let n in t)le(r,e,t,n);return r},je=(e,t,r)=>{return Je(e,Object.entries(r).reduce((n,[o,s])=>{if(Array.isArray(s))n[o]=s;else if(typeof s==="function")n[o]=[t,s()];else n[o]=[t,s];return n},{}))},le=(e,t,r,n)=>{if(t!==null){let i=r[n];if(typeof i==="function")i=[,i];let[c=Ye,p=qe,x=n]=i;if(typeof c==="function"&&c(t[x])||typeof c!=="function"&&!!c)e[n]=p(t[x]);return}let[o,s]=r[n];if(typeof s==="function"){let i,c=o===void 0&&(i=s())!=null,p=typeof o==="function"&&!!o(void 0)||typeof o!=="function"&&!!o;if(c)e[n]=i;else if(p)e[n]=s()}else{let i=o===void 0&&s!=null,c=typeof o==="function"&&!!o(s)||typeof o!=="function"&&!!o;if(i||c)e[n]=s}},Ye=(e)=>e!=null,qe=(e)=>e;var Ve=C(O(),1);var he=(e)=>{if(e==null)return{};if(Array.isArray(e))return e.filter((t)=>t!=null).map(he);if(typeof e==="object"){let t={};for(let r of Object.keys(e)){if(e[r]==null)continue;t[r]=he(e[r])}return t}return e};var Or=(e)=>{let t=e.httpHandler;return{setHttpHandler(r){t=r},httpHandler(){return t},updateHttpClientConfig(r,n){t.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return t.httpHandlerConfigs()}}},Dr=(e)=>{return{httpHandler:e.httpHandler()}};var Qe=C(P(),1);class H{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let t=new H({...e,headers:{...e.headers}});if(t.query)t.query=Ge(t.query);return t}static isInstance(e){if(!e)return!1;let t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&typeof t.query==="object"&&typeof t.headers==="object"}clone(){return H.clone(this)}}function Ge(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}class k{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let t=e;return typeof t.statusCode==="number"&&typeof t.headers==="object"}}var R=C(Ze(),1);function B(e){let t=[];for(let r of Object.keys(e).sort()){let n=e[r];if(r=R.escapeUri(r),Array.isArray(n))for(let o=0,s=n.length;o<s;o++)t.push(`${r}=${R.escapeUri(n[o])}`);else{let o=r;if(n||typeof n==="string")o+=`=${R.escapeUri(n)}`;t.push(o)}}return t.join("&")}import{Agent as Se,request as et}from"http";import{Agent as be,request as tt}from"https";var me=["ECONNRESET","EPIPE","ETIMEDOUT"];var W=(e)=>{let t={};for(let r of Object.keys(e)){let n=e[r];t[r]=Array.isArray(n)?n.join(","):n}return t};var w={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:(e)=>clearTimeout(e)};var pe=1000,ge=(e,t,r=0)=>{if(!r)return-1;let n=(o)=>{let s=w.setTimeout(()=>{e.destroy(),t(Object.assign(new Error(`Socket timed out without establishing a connection within ${r} ms`),{name:"TimeoutError"}))},r-o),i=(c)=>{if(c?.connecting)c.on("connect",()=>{w.clearTimeout(s)});else w.clearTimeout(s)};if(e.socket)i(e.socket);else e.on("socket",i)};if(r<2000)return n(0),0;return w.setTimeout(n.bind(null,pe),pe)};var Xe=3000,ye=(e,{keepAlive:t,keepAliveMsecs:r},n=Xe)=>{if(t!==!0)return-1;let o=()=>{if(e.socket)e.socket.setKeepAlive(t,r||0);else e.on("socket",(s)=>{s.setKeepAlive(t,r||0)})};if(n===0)return o(),0;return w.setTimeout(o,n)};var we=3000,xe=(e,t,r=Ee)=>{let n=(o)=>{let s=r-o,i=()=>{e.destroy(),t(Object.assign(new Error(`Connection timed out after ${r} ms`),{name:"TimeoutError"}))};if(e.socket)e.socket.setTimeout(s,i),e.on("close",()=>e.socket?.removeListener("timeout",i));else e.setTimeout(s,i)};if(0<r&&r<6000)return n(0),0;return w.setTimeout(n.bind(null,r===0?0:we),we)};import{Readable as Ke}from"stream";var Te=6000;async function J(e,t,r=Te){let n=t.headers??{},o=n.Expect||n.expect,s=-1,i=!0;if(o==="100-continue")i=await Promise.race([new Promise((c)=>{s=Number(w.setTimeout(()=>c(!0),Math.max(Te,r)))}),new Promise((c)=>{e.on("continue",()=>{w.clearTimeout(s),c(!0)}),e.on("response",()=>{w.clearTimeout(s),c(!1)}),e.on("error",()=>{w.clearTimeout(s),c(!1)})})]);if(i)ve(e,t.body)}function ve(e,t){if(t instanceof Ke){t.pipe(e);return}if(t){if(Buffer.isBuffer(t)||typeof t==="string"){e.end(t);return}let r=t;if(typeof r==="object"&&r.buffer&&typeof r.byteOffset==="number"&&typeof r.byteLength==="number"){e.end(Buffer.from(r.buffer,r.byteOffset,r.byteLength));return}e.end(Buffer.from(t));return}e.end()}var Ee=0;class j{static create(e){if(typeof e?.handle==="function")return e;return new j(e)}static checkSocketUsage(e,t,r=console){let{sockets:n,requests:o,maxSockets:s}=e;if(typeof s!=="number"||s===1/0)return t;let i=15000;if(Date.now()-i<t)return t;if(n&&o)for(let c in n){let p=n[c]?.length??0,x=o[c]?.length??0;if(p>=s&&x>=2*s)return r?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${p} and ${x} additional requests are enqueued.
|
|
4
|
-
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
5
|
-
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return t}constructor(e){this.socketWarningTimestamp=0,this.metadata={handlerProtocol:"http/1.1"},this.configProvider=new Promise((t,r)=>{if(typeof e==="function")e().then((n)=>{t(this.resolveDefaultConfig(n))}).catch(r);else t(this.resolveDefaultConfig(e))})}resolveDefaultConfig(e){let{requestTimeout:t,connectionTimeout:r,socketTimeout:n,socketAcquisitionWarningTimeout:o,httpAgent:s,httpsAgent:i}=e||{},c=!0,p=50;return{connectionTimeout:r,requestTimeout:t??n,socketAcquisitionWarningTimeout:o,httpAgent:(()=>{if(s instanceof Se||typeof s?.destroy==="function")return s;return new Se({keepAlive:!0,maxSockets:50,...s})})(),httpsAgent:(()=>{if(i instanceof be||typeof i?.destroy==="function")return i;return new be({keepAlive:!0,maxSockets:50,...i})})(),logger:console}}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:t}={}){if(!this.config)this.config=await this.configProvider;return new Promise((r,n)=>{let o=void 0,s=[],i=async(u)=>{await o,s.forEach(w.clearTimeout),r(u)},c=async(u)=>{await o,s.forEach(w.clearTimeout),n(u)};if(!this.config)throw new Error("Node HTTP request handler config is not resolved");if(t?.aborted){let u=new Error("Request aborted");u.name="AbortError",c(u);return}let p=e.protocol==="https:",x=p?this.config.httpsAgent:this.config.httpAgent;s.push(w.setTimeout(()=>{this.socketWarningTimestamp=j.checkSocketUsage(x,this.socketWarningTimestamp,this.config.logger)},this.config.socketAcquisitionWarningTimeout??(this.config.requestTimeout??2000)+(this.config.connectionTimeout??1000)));let E=B(e.query||{}),a=void 0;if(e.username!=null||e.password!=null){let u=e.username??"",y=e.password??"";a=`${u}:${y}`}let f=e.path;if(E)f+=`?${E}`;if(e.fragment)f+=`#${e.fragment}`;let d=e.hostname??"";if(d[0]==="["&&d.endsWith("]"))d=e.hostname.slice(1,-1);else d=e.hostname;let m={headers:e.headers,host:d,method:e.method,path:f,port:e.port,agent:x,auth:a},l=(p?tt:et)(m,(u)=>{let y=new k({statusCode:u.statusCode||-1,reason:u.statusMessage,headers:W(u.headers),body:u});i({response:y})});if(l.on("error",(u)=>{if(me.includes(u.code))c(Object.assign(u,{name:"TimeoutError"}));else c(u)}),t){let u=()=>{l.destroy();let y=new Error("Request aborted");y.name="AbortError",c(y)};if(typeof t.addEventListener==="function"){let y=t;y.addEventListener("abort",u,{once:!0}),l.once("close",()=>y.removeEventListener("abort",u))}else t.onabort=u}s.push(ge(l,c,this.config.connectionTimeout)),s.push(xe(l,c,this.config.requestTimeout));let h=m.agent;if(typeof h==="object"&&"keepAlive"in h)s.push(ye(l,{keepAlive:h.keepAlive,keepAliveMsecs:h.keepAliveMsecs}));o=J(l,e,this.config.requestTimeout).catch((u)=>{return s.forEach(w.clearTimeout),n(u)})})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((r)=>{return{...r,[e]:t}})}httpHandlerConfigs(){return this.config??{}}}import{Writable as rt}from"stream";class Y extends rt{constructor(){super(...arguments);this.bufferedBytes=[]}_write(e,t,r){this.bufferedBytes.push(e),r()}}var Bn=(e)=>{if(nt(e))return ot(e);return new Promise((t,r)=>{let n=new Y;e.pipe(n),e.on("error",(o)=>{n.end(),r(o)}),n.on("error",r),n.on("finish",function(){let o=new Uint8Array(Buffer.concat(this.bufferedBytes));t(o)})})},nt=(e)=>typeof ReadableStream==="function"&&e instanceof ReadableStream;async function ot(e){let t=[],r=e.getReader(),n=!1,o=0;while(!n){let{done:c,value:p}=await r.read();if(p)t.push(p),o+=p.length;n=c}let s=new Uint8Array(o),i=0;for(let c of t)s.set(c,i),i+=c.length;return s}export{Or as Gb,Dr as Hb,H as Ib,k as Jb,Ce as Kb,G as Lb,mt as Mb,yt as Nb,wt as Ob,xt as Pb,Et as Qb,Ct as Rb,$t as Sb,N as Tb,ie as Ub,Rt as Vb,Pt as Wb,Dt as Xb,Jt as Yb,jt as Zb,Qt as _b,Xt as $b,We as ac,Je as bc,tr as cc,he as dc,j as ec,Bn as fc};
|