pipane 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/dist/client/assets/{index-DuJn-Nwv.js → index-Bf_69wyB.js} +1 -1
- package/dist/client/assets/{index-yL1A-vgM.css → index-CUE9pgq9.css} +1 -1
- package/dist/client/assets/{index-Pj8zaBYJ.js → index-CekVLaL6.js} +1 -1
- package/dist/client/assets/{index-DQxrqu4K.js → index-Cp2vV6HJ.js} +734 -713
- package/dist/client/assets/{index-CQP8RzjO.js → index-D14II7Hd.js} +1 -1
- package/dist/client/assets/{index-CVr_JVrA.js → index-D16nGmo3.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/server/server.js +22 -2
- package/dist/server/server/update-check.js +39 -0
- package/package.json +1 -1
- package/patches/@mariozechner+pi-web-ui+0.55.3.patch +166 -8
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as N,H as B}from"./index-
|
|
1
|
+
import{b as N,H as B}from"./index-Cp2vV6HJ.js";import{_ as M,a as x,b as P}from"./_node-stub_stream-DDexIdn_.js";const F=["ECONNRESET","EPIPE","ETIMEDOUT"],I=o=>{const e={};for(const t of Object.keys(o)){const n=o[t];e[t]=Array.isArray(n)?n.join(","):n}return e},m={setTimeout:(o,e)=>setTimeout(o,e),clearTimeout:o=>clearTimeout(o)},H=1e3,K=(o,e,t=0)=>{if(!t)return-1;const n=r=>{const i=m.setTimeout(()=>{o.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${t} ms.`),{name:"TimeoutError"}))},t-r),s=f=>{f?.connecting?f.on("connect",()=>{m.clearTimeout(i)}):m.clearTimeout(i)};o.socket?s(o.socket):o.on("socket",s)};return t<2e3?(n(0),0):m.setTimeout(n.bind(null,H),H)},V=(o,e,t=0,n,r)=>t?m.setTimeout(()=>{let i=`@smithy/node-http-handler - [${n?"ERROR":"WARN"}] a request has exceeded the configured ${t} ms requestTimeout.`;if(n){const s=Object.assign(new Error(i),{name:"TimeoutError",code:"ETIMEDOUT"});o.destroy(s),e(s)}else i+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",r?.warn?.(i)},t):-1,z=3e3,q=(o,{keepAlive:e,keepAliveMsecs:t},n=z)=>{if(e!==!0)return-1;const r=()=>{o.socket?o.socket.setKeepAlive(e,t||0):o.on("socket",i=>{i.setKeepAlive(e,t||0)})};return n===0?(r(),0):m.setTimeout(r,n)},L=3e3,Q=(o,e,t=0)=>{const n=r=>{const i=t-r,s=()=>{o.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${t} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};o.socket?(o.socket.setTimeout(i,s),o.on("close",()=>o.socket?.removeListener("timeout",s))):o.setTimeout(i,s)};return 0<t&&t<6e3?(n(0),0):m.setTimeout(n.bind(null,t===0?0:L),L)},U=6e3;async function O(o,e,t=U,n=!1){const r=e.headers??{},i=r.Expect||r.expect;let s=-1,f=!0;!n&&i==="100-continue"&&(f=await Promise.race([new Promise(c=>{s=Number(m.setTimeout(()=>c(!0),Math.max(U,t)))}),new Promise(c=>{o.on("continue",()=>{m.clearTimeout(s),c(!0)}),o.on("response",()=>{m.clearTimeout(s),c(!1)}),o.on("error",()=>{m.clearTimeout(s),c(!1)})})])),f&&J(o,e.body)}function J(o,e){if(e instanceof M.Readable){e.pipe(o);return}if(e){const t=Buffer.isBuffer(e);if(t||typeof e=="string"){t&&e.byteLength===0?o.end():o.end(e);return}const r=e;if(typeof r=="object"&&r.buffer&&typeof r.byteOffset=="number"&&typeof r.byteLength=="number"){o.end(Buffer.from(r.buffer,r.byteOffset,r.byteLength));return}o.end(Buffer.from(e));return}o.end()}const oe=0;class _{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){return typeof e?.handle=="function"?e:new _(e)}static checkSocketUsage(e,t,n=console){const{sockets:r,requests:i,maxSockets:s}=e;if(typeof s!="number"||s===1/0||Date.now()-15e3<t)return t;if(r&&i)for(const c in r){const g=r[c]?.length??0,d=i[c]?.length??0;if(g>=s&&d>=2*s)return n?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${g} and ${d} additional requests are enqueued.
|
|
2
2
|
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
3
3
|
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return t}constructor(e){this.configProvider=new Promise((t,n)=>{typeof e=="function"?e().then(r=>{t(this.resolveDefaultConfig(r))}).catch(n):t(this.resolveDefaultConfig(e))})}resolveDefaultConfig(e){const{requestTimeout:t,connectionTimeout:n,socketTimeout:r,socketAcquisitionWarningTimeout:i,httpAgent:s,httpsAgent:f,throwOnRequestTimeout:c,logger:g}=e||{},d=!0,E=50;return{connectionTimeout:n,requestTimeout:t,socketTimeout:r,socketAcquisitionWarningTimeout:i,throwOnRequestTimeout:c,httpAgent:s instanceof P.Agent||typeof s?.destroy=="function"?(this.externalAgent=!0,s):new P.Agent({keepAlive:d,maxSockets:E,...s}),httpsAgent:f instanceof x.Agent||typeof f?.destroy=="function"?(this.externalAgent=!0,f):new x.Agent({keepAlive:d,maxSockets:E,...f}),logger:g}}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:t,requestTimeout:n}={}){return this.config||(this.config=await this.configProvider),new Promise((r,i)=>{const s=this.config;let f;const c=[],g=async a=>{await f,c.forEach(m.clearTimeout),r(a)},d=async a=>{await f,c.forEach(m.clearTimeout),i(a)};if(t?.aborted){const a=new Error("Request aborted");a.name="AbortError",d(a);return}const E=e.protocol==="https:",b=e.headers??{},R=(b.Expect??b.expect)==="100-continue";let C=E?s.httpsAgent:s.httpAgent;R&&!this.externalAgent&&(C=new(E?x.Agent:P.Agent)({keepAlive:!1,maxSockets:1/0})),c.push(m.setTimeout(()=>{this.socketWarningTimestamp=_.checkSocketUsage(C,this.socketWarningTimestamp,s.logger)},s.socketAcquisitionWarningTimeout??(s.requestTimeout??2e3)+(s.connectionTimeout??1e3)));const S=N(e.query||{});let k;if(e.username!=null||e.password!=null){const a=e.username??"",u=e.password??"";k=`${a}:${u}`}let A=e.path;S&&(A+=`?${S}`),e.fragment&&(A+=`#${e.fragment}`);let T=e.hostname??"";T[0]==="["&&T.endsWith("]")?T=e.hostname.slice(1,-1):T=e.hostname;const v={headers:e.headers,host:T,method:e.method,path:A,port:e.port,agent:C,auth:k},l=(E?x.request:P.request)(v,a=>{const u=new B({statusCode:a.statusCode||-1,reason:a.statusMessage,headers:I(a.headers),body:a});g({response:u})});if(l.on("error",a=>{F.includes(a.code)?d(Object.assign(a,{name:"TimeoutError"})):d(a)}),t){const a=()=>{l.destroy();const u=new Error("Request aborted");u.name="AbortError",d(u)};if(typeof t.addEventListener=="function"){const u=t;u.addEventListener("abort",a,{once:!0}),l.once("close",()=>u.removeEventListener("abort",a))}else t.onabort=a}const p=n??s.requestTimeout;c.push(K(l,d,s.connectionTimeout)),c.push(V(l,d,p,s.throwOnRequestTimeout,s.logger??console)),c.push(Q(l,d,s.socketTimeout));const w=v.agent;typeof w=="object"&&"keepAlive"in w&&c.push(q(l,{keepAlive:w.keepAlive,keepAliveMsecs:w.keepAliveMsecs})),f=O(l,e,p,this.externalAgent).catch(a=>(c.forEach(m.clearTimeout),i(a)))})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>({...n,[e]:t}))}httpHandlerConfigs(){return this.config??{}}}const $=new Proxy({},{get(o,e){return e==="__esModule"?!0:new Proxy(function(){},{get:()=>()=>{},apply:()=>({})})}});class G{sessions=[];constructor(e){this.sessions=e??[]}poll(){if(this.sessions.length>0)return this.sessions.shift()}offerLast(e){this.sessions.push(e)}contains(e){return this.sessions.includes(e)}remove(e){this.sessions=this.sessions.filter(t=>t!==e)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}destroy(e){for(const t of this.sessions)t===e&&(t.destroyed||t.destroy())}}class X{constructor(e){if(this.config=e,this.config.maxConcurrency&&this.config.maxConcurrency<=0)throw new RangeError("maxConcurrency must be greater than zero.")}config;sessionCache=new Map;lease(e,t){const n=this.getUrlString(e),r=this.sessionCache.get(n);if(r){const c=r.poll();if(c&&!this.config.disableConcurrency)return c}const i=$.connect(n);this.config.maxConcurrency&&i.settings({maxConcurrentStreams:this.config.maxConcurrency},c=>{if(c)throw new Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())}),i.unref();const s=()=>{i.destroy(),this.deleteSession(n,i)};i.on("goaway",s),i.on("error",s),i.on("frameError",s),i.on("close",()=>this.deleteSession(n,i)),t.requestTimeout&&i.setTimeout(t.requestTimeout,s);const f=this.sessionCache.get(n)||new G;return f.offerLast(i),this.sessionCache.set(n,f),i}deleteSession(e,t){const n=this.sessionCache.get(e);n&&n.contains(t)&&(n.remove(t),this.sessionCache.set(e,n))}release(e,t){const n=this.getUrlString(e);this.sessionCache.get(n)?.offerLast(t)}destroy(){for(const[e,t]of this.sessionCache){for(const n of t)n.destroyed||n.destroy(),t.remove(n);this.sessionCache.delete(e)}}setMaxConcurrentStreams(e){if(e&&e<=0)throw new RangeError("maxConcurrentStreams must be greater than zero.");this.config.maxConcurrency=e}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}getUrlString(e){return e.destination.toString()}}class j{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new X({});static create(e){return typeof e?.handle=="function"?e:new j(e)}constructor(e){this.configProvider=new Promise((t,n)=>{typeof e=="function"?e().then(r=>{t(r||{})}).catch(n):t(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:t,requestTimeout:n}={}){this.config||(this.config=await this.configProvider,this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams||!1),this.config.maxConcurrentStreams&&this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams));const{requestTimeout:r,disableConcurrentStreams:i}=this.config,s=n??r;return new Promise((f,c)=>{let g=!1,d;const E=async h=>{await d,f(h)},b=async h=>{await d,c(h)};if(t?.aborted){g=!0;const h=new Error("Request aborted");h.name="AbortError",b(h);return}const{hostname:R,method:C,port:S,protocol:k,query:A}=e;let T="";if(e.username!=null||e.password!=null){const h=e.username??"",y=e.password??"";T=`${h}:${y}@`}const v=`${k}//${T}${R}${S?`:${S}`:""}`,D={destination:new URL(v)},l=this.connectionManager.lease(D,{requestTimeout:this.config?.sessionTimeout,disableConcurrentStreams:i||!1}),p=h=>{i&&this.destroySession(l),g=!0,b(h)},w=N(A||{});let a=e.path;w&&(a+=`?${w}`),e.fragment&&(a+=`#${e.fragment}`);const u=l.request({...e.headers,[$.constants.HTTP2_HEADER_PATH]:a,[$.constants.HTTP2_HEADER_METHOD]:C});if(l.ref(),u.on("response",h=>{const y=new B({statusCode:h[":status"]||-1,headers:I(h),body:u});g=!0,E({response:y}),i&&(l.close(),this.connectionManager.deleteSession(v,l))}),s&&u.setTimeout(s,()=>{u.close();const h=new Error(`Stream timed out because of no activity for ${s} ms`);h.name="TimeoutError",p(h)}),t){const h=()=>{u.close();const y=new Error("Request aborted");y.name="AbortError",p(y)};if(typeof t.addEventListener=="function"){const y=t;y.addEventListener("abort",h,{once:!0}),u.once("close",()=>y.removeEventListener("abort",h))}else t.onabort=h}u.on("frameError",(h,y,W)=>{p(new Error(`Frame type id ${h} in stream id ${W} has failed with code ${y}.`))}),u.on("error",p),u.on("aborted",()=>{p(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${u.rstCode}.`))}),u.on("close",()=>{l.unref(),i&&l.destroy(),g||p(new Error("Unexpected error: http2 request did not get a response"))}),d=O(u,e,s)})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>({...n,[e]:t}))}httpHandlerConfigs(){return this.config??{}}destroySession(e){e.destroyed||e.destroy()}}class Y extends M.Writable{bufferedBytes=[];_write(e,t,n){this.bufferedBytes.push(e),n()}}const se=o=>Z(o)?ee(o):new Promise((e,t)=>{const n=new Y;o.pipe(n),o.on("error",r=>{n.end(),t(r)}),n.on("error",t),n.on("finish",function(){const r=new Uint8Array(Buffer.concat(this.bufferedBytes));e(r)})}),Z=o=>typeof ReadableStream=="function"&&o instanceof ReadableStream;async function ee(o){const e=[],t=o.getReader();let n=!1,r=0;for(;!n;){const{done:f,value:c}=await t.read();c&&(e.push(c),r+=c.length),n=f}const i=new Uint8Array(r);let s=0;for(const f of e)i.set(f,s),s+=f.length;return i}export{oe as DEFAULT_REQUEST_TIMEOUT,j as NodeHttp2Handler,_ as NodeHttpHandler,se as streamCollector};
|