brass-runtime 1.11.1 → 1.12.1
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 +48 -5
- package/dist/agent/cli/main.cjs +16 -0
- package/dist/agent/cli/main.d.mts +1 -0
- package/dist/agent/cli/main.d.ts +1 -0
- package/dist/agent/cli/main.js +16 -0
- package/dist/agent/index.cjs +1 -0
- package/dist/agent/index.d.mts +688 -0
- package/dist/agent/index.d.ts +688 -0
- package/dist/agent/index.js +1 -0
- package/dist/chunk-63MXGA7P.js +1 -0
- package/dist/chunk-63ODH5W4.cjs +25 -0
- package/dist/chunk-7PHP7KQB.cjs +1 -0
- package/dist/chunk-MAR4TNUH.js +1 -0
- package/dist/chunk-P4IND5C3.js +25 -0
- package/dist/chunk-T3QEEHK6.cjs +1 -0
- package/dist/effect-NSaHksNl.d.mts +367 -0
- package/dist/effect-NSaHksNl.d.ts +367 -0
- package/dist/http/index.cjs +1 -0
- package/dist/http/index.d.mts +2 -1
- package/dist/http/index.d.ts +2 -1
- package/dist/http/index.js +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.mts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +1 -1
- package/dist/stream-DNTGNv-G.d.ts +66 -0
- package/dist/stream-FwtnWmgX.d.mts +66 -0
- package/package.json +30 -3
- package/dist/chunk-Q2H2CAII.js +0 -1
- package/dist/chunk-ZXK3XM2Q.mjs +0 -1
- package/dist/http/index.mjs +0 -1
- package/dist/index.mjs +0 -1
- package/dist/stream-hTHRKq88.d.mts +0 -355
- package/dist/stream-hTHRKq88.d.ts +0 -355
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var chunkQ2H2CAII_js=require('./chunk-Q2H2CAII.js');function ze(){let t=false,e=new Set;return {isCancelled:()=>t,onCancel:r=>{if(t){try{r();}catch{}return ()=>{}}return e.add(r),()=>{e.delete(r);}},cancel:()=>{t||(t=true,e.forEach(r=>r()),e.clear());}}}function De(t,e){return t.onCancel(()=>e.abort())}var v=class{head=null;tail=null;len=0;get length(){return this.len}isEmpty(){return this.len===0}push(e){let n={value:e,next:null,prev:this.tail,removed:false};return this.tail?this.tail.next=n:this.head=n,this.tail=n,this.len++,n}shift(){let e=this.head;if(e)return this.unlink(e),e.value}remove(e){e.removed||this.unlink(e);}unlink(e){e.removed=true;let{prev:n,next:r}=e;n?n.next=r:this.head=r,r?r.prev=n:this.tail=n,e.next=null,e.prev=null,this.len--;}};function w(t,e="backpressure"){return chunkQ2H2CAII_js.g(()=>M(t,e))}function M(t,e){let n=new chunkQ2H2CAII_js.C(t),r=false,s={_tag:"QueueClosed"},o=new v,a=new v,l=()=>{for(;a.length>0&&n.length>0;){let u=a.shift(),f=n.shift();u({_tag:"Success",value:f});}for(;o.length>0&&n.length<t&&a.length===0;){let u=o.shift();n.push(u.a),u.cb(true);}for(;a.length>0&&o.length>0;){let u=a.shift(),f=o.shift();f.cb(true),u({_tag:"Success",value:f.a});}};return {size:()=>n.length,shutdown:()=>{if(!r){for(r=true;a.length>0;)a.shift()({_tag:"Failure",error:s});for(;o.length>0;)o.shift().cb(false);n.clear();}},offer:u=>chunkQ2H2CAII_js.i((f,i)=>{if(r){i({_tag:"Success",value:false});return}if(a.length>0){a.shift()({_tag:"Success",value:u}),i({_tag:"Success",value:true});return}if(n.length<t){n.push(u),i({_tag:"Success",value:true}),l();return}if(e==="dropping"){i({_tag:"Success",value:false});return}if(e==="sliding"){n.shift(),n.push(u),i({_tag:"Success",value:true}),l();return}let A=o.push({a:u,cb:m=>i({_tag:"Success",value:m})});return ()=>{o.remove(A);}}),take:()=>chunkQ2H2CAII_js.i((u,f)=>{if(n.length>0){let m=n.shift();f({_tag:"Success",value:m}),l();return}if(o.length>0){let m=o.shift();m.cb(true),f({_tag:"Success",value:m.a});return}if(r){f({_tag:"Failure",error:s});return}let i=m=>f(m),A=a.push(i);return ()=>{a.remove(A);}})}}function F(t,e,n="backpressure"){let r=false,s=null,o=null,a=t,l=()=>chunkQ2H2CAII_js.a(chunkQ2H2CAII_js.ha(a),i=>chunkQ2H2CAII_js.e(i._tag==="None"?{_tag:"End"}:{_tag:"Fail",error:i.value}),([i,A])=>chunkQ2H2CAII_js.g(()=>(a=A,{_tag:"Elem",value:i}))),p=i=>chunkQ2H2CAII_js.k(w(e,n),A=>{s=A;let S=()=>chunkQ2H2CAII_js.k(l(),m=>chunkQ2H2CAII_js.k(s.offer(m),()=>m._tag==="End"||m._tag==="Fail"?chunkQ2H2CAII_js.e(void 0):S()));return o=chunkQ2H2CAII_js.K(S(),i),r=true,chunkQ2H2CAII_js.e(void 0)}),u={_tag:"Async",register:(i,A)=>{(()=>{if(!r){chunkQ2H2CAII_js.K(p(i),i).join(()=>{f(i,A);});return}f(i,A);})();}};function f(i,A){let S=s.take();chunkQ2H2CAII_js.K(S,i).join(m=>{if(m._tag!=="Success")return;let _=m.value;switch(_._tag){case "Elem":A({_tag:"Success",value:[_.value,chunkQ2H2CAII_js._(u)]});return;case "End":o?.interrupt?.(),A({_tag:"Failure",error:chunkQ2H2CAII_js.q});return;case "Fail":o?.interrupt?.(),A({_tag:"Failure",error:chunkQ2H2CAII_js.r(_.error)});return}});}return chunkQ2H2CAII_js._(u)}var I=t=>t==="BackPressure"?"backpressure":t==="Dropping"?"dropping":"sliding";function N(t,e="BackPressure"){let n=new Set,r=false,s=p=>{if(r)return chunkQ2H2CAII_js.e(false);let u=Array.from(n),f=chunkQ2H2CAII_js.e(true);return u.forEach(i=>{f=chunkQ2H2CAII_js.k(f,A=>chunkQ2H2CAII_js.k(i.offer(p),S=>chunkQ2H2CAII_js.e(A&&S)));}),f};return {publish:s,publishAll:p=>{let u=chunkQ2H2CAII_js.e(true),f=p[Symbol.iterator]();for(;;){let i=f.next();if(i.done)break;let A=i.value;u=chunkQ2H2CAII_js.k(u,S=>chunkQ2H2CAII_js.k(s(A),m=>chunkQ2H2CAII_js.e(S&&m)));}return u},subscribe:()=>r?chunkQ2H2CAII_js.h(()=>{throw {_tag:"HubClosed"}}):chunkQ2H2CAII_js.k(w(t,I(e)),p=>chunkQ2H2CAII_js.g(()=>(n.add(p),{...p,unsubscribe:()=>{n.has(p)&&(n.delete(p),p.shutdown());}}))),shutdown:()=>chunkQ2H2CAII_js.g(()=>{r||(r=true,Array.from(n).forEach(p=>p.shutdown()),n.clear());})}}var yn=N;function dn(t,e){return chunkQ2H2CAII_js.ma(t,n=>chunkQ2H2CAII_js.k(e.publish(n),()=>chunkQ2H2CAII_js.e(void 0)))}function Rn(t){return chunkQ2H2CAII_js.aa(chunkQ2H2CAII_js.k(t.subscribe(),e=>{let n=chunkQ2H2CAII_js._(chunkQ2H2CAII_js.k(chunkQ2H2CAII_js.c(e.take(),r=>chunkQ2H2CAII_js.q),r=>chunkQ2H2CAII_js.e([r,n])));return chunkQ2H2CAII_js.e({stream:n,release:r=>chunkQ2H2CAII_js.g(()=>e.unsubscribe())})}))}function _n(t,e){return e(t)}function z(t,e){return(n=>e(t(n)))}function Cn(t,e){return z(e,t)}function On(){return(t=>t)}function Pn(t){return(e=>{let n=r=>chunkQ2H2CAII_js._(chunkQ2H2CAII_js.a(chunkQ2H2CAII_js.ha(r),s=>chunkQ2H2CAII_js.f(s),([s,o])=>chunkQ2H2CAII_js.e([t(s),n(o)])));return n(e)})}function Bn(t){return(e=>{let n=s=>chunkQ2H2CAII_js.a(chunkQ2H2CAII_js.ha(s),o=>chunkQ2H2CAII_js.f(o),([o,a])=>t(o)?chunkQ2H2CAII_js.e([o,r(a)]):n(a)),r=s=>chunkQ2H2CAII_js._(n(s));return r(e)})}function Tn(t){return(e=>{let n=s=>chunkQ2H2CAII_js.a(chunkQ2H2CAII_js.ha(s),o=>chunkQ2H2CAII_js.f(o),([o,a])=>{let l=t(o);return l._tag==="Some"?chunkQ2H2CAII_js.e([l.value,r(a)]):n(a)}),r=s=>chunkQ2H2CAII_js._(n(s));return r(e)})}function Hn(t){let e=Math.max(0,t|0);return(n=>{let r=(s,o)=>o<=0?chunkQ2H2CAII_js.ca():chunkQ2H2CAII_js._(chunkQ2H2CAII_js.a(chunkQ2H2CAII_js.ha(s),a=>chunkQ2H2CAII_js.f(a),([a,l])=>chunkQ2H2CAII_js.e([a,r(l,o-1)])));return r(n,e)})}function Qn(t){let e=Math.max(0,t|0);return(n=>{let r=(s,o)=>o<=0?s:chunkQ2H2CAII_js._(chunkQ2H2CAII_js.a(chunkQ2H2CAII_js.ha(s),a=>chunkQ2H2CAII_js.f(a),([a,l])=>chunkQ2H2CAII_js.ha(r(l,o-1))));return r(n,e)})}function D(t){return(e=>{let n=s=>chunkQ2H2CAII_js.c(s,o=>chunkQ2H2CAII_js.r(o)),r=s=>chunkQ2H2CAII_js._(chunkQ2H2CAII_js.a(chunkQ2H2CAII_js.c(chunkQ2H2CAII_js.ha(s),o=>chunkQ2H2CAII_js.Z(o)),o=>chunkQ2H2CAII_js.f(o),([o,a])=>chunkQ2H2CAII_js.a(n(t(o)),l=>chunkQ2H2CAII_js.f(l),l=>chunkQ2H2CAII_js.e([l,r(a)]))));return r(e)})}function Fn(t){return D(e=>chunkQ2H2CAII_js.k(t(e),()=>chunkQ2H2CAII_js.e(e)))}function Mn(t,e="backpressure"){return(n=>F(n,t,e))}function In(t){let e=Math.max(1,t|0);return(n=>{let r=(o,a,l)=>a<=0?chunkQ2H2CAII_js.e({chunk:l,rest:o}):chunkQ2H2CAII_js.a(chunkQ2H2CAII_js.ha(o),p=>p._tag==="None"?chunkQ2H2CAII_js.e({chunk:l,rest:chunkQ2H2CAII_js.ca()}):chunkQ2H2CAII_js.f(p),([p,u])=>r(u,a-1,[...l,p])),s=o=>chunkQ2H2CAII_js._(chunkQ2H2CAII_js.a(chunkQ2H2CAII_js.ha(o),a=>chunkQ2H2CAII_js.f(a),([a,l])=>chunkQ2H2CAII_js.k(r(l,e-1,[a]),({chunk:p,rest:u})=>chunkQ2H2CAII_js.e([p,s(u)]))));return s(n)})}Object.defineProperty(exports,"PushStatus",{enumerable:true,get:function(){return chunkQ2H2CAII_js.B}});Object.defineProperty(exports,"RingBuffer",{enumerable:true,get:function(){return chunkQ2H2CAII_js.C}});Object.defineProperty(exports,"Runtime",{enumerable:true,get:function(){return chunkQ2H2CAII_js.I}});Object.defineProperty(exports,"RuntimeFiber",{enumerable:true,get:function(){return chunkQ2H2CAII_js.F}});Object.defineProperty(exports,"Scheduler",{enumerable:true,get:function(){return chunkQ2H2CAII_js.D}});Object.defineProperty(exports,"Scope",{enumerable:true,get:function(){return chunkQ2H2CAII_js.S}});Object.defineProperty(exports,"acquireRelease",{enumerable:true,get:function(){return chunkQ2H2CAII_js.l}});Object.defineProperty(exports,"assertNever",{enumerable:true,get:function(){return chunkQ2H2CAII_js.ia}});Object.defineProperty(exports,"async",{enumerable:true,get:function(){return chunkQ2H2CAII_js.i}});Object.defineProperty(exports,"asyncCatchAll",{enumerable:true,get:function(){return chunkQ2H2CAII_js.b}});Object.defineProperty(exports,"asyncFail",{enumerable:true,get:function(){return chunkQ2H2CAII_js.f}});Object.defineProperty(exports,"asyncFlatMap",{enumerable:true,get:function(){return chunkQ2H2CAII_js.k}});Object.defineProperty(exports,"asyncFold",{enumerable:true,get:function(){return chunkQ2H2CAII_js.a}});Object.defineProperty(exports,"asyncInterruptible",{enumerable:true,get:function(){return chunkQ2H2CAII_js.m}});Object.defineProperty(exports,"asyncMap",{enumerable:true,get:function(){return chunkQ2H2CAII_js.j}});Object.defineProperty(exports,"asyncMapError",{enumerable:true,get:function(){return chunkQ2H2CAII_js.c}});Object.defineProperty(exports,"asyncSucceed",{enumerable:true,get:function(){return chunkQ2H2CAII_js.e}});Object.defineProperty(exports,"asyncSync",{enumerable:true,get:function(){return chunkQ2H2CAII_js.g}});Object.defineProperty(exports,"asyncTotal",{enumerable:true,get:function(){return chunkQ2H2CAII_js.h}});Object.defineProperty(exports,"catchAll",{enumerable:true,get:function(){return chunkQ2H2CAII_js.y}});Object.defineProperty(exports,"collectAllPar",{enumerable:true,get:function(){return chunkQ2H2CAII_js.X}});Object.defineProperty(exports,"collectStream",{enumerable:true,get:function(){return chunkQ2H2CAII_js.oa}});Object.defineProperty(exports,"concatStream",{enumerable:true,get:function(){return chunkQ2H2CAII_js.ea}});Object.defineProperty(exports,"emitStream",{enumerable:true,get:function(){return chunkQ2H2CAII_js.da}});Object.defineProperty(exports,"emptyStream",{enumerable:true,get:function(){return chunkQ2H2CAII_js.ca}});Object.defineProperty(exports,"end",{enumerable:true,get:function(){return chunkQ2H2CAII_js.A}});Object.defineProperty(exports,"fail",{enumerable:true,get:function(){return chunkQ2H2CAII_js.t}});Object.defineProperty(exports,"flatMap",{enumerable:true,get:function(){return chunkQ2H2CAII_js.w}});Object.defineProperty(exports,"flattenStream",{enumerable:true,get:function(){return chunkQ2H2CAII_js.fa}});Object.defineProperty(exports,"foreachStream",{enumerable:true,get:function(){return chunkQ2H2CAII_js.ma}});Object.defineProperty(exports,"fork",{enumerable:true,get:function(){return chunkQ2H2CAII_js.K}});Object.defineProperty(exports,"from",{enumerable:true,get:function(){return chunkQ2H2CAII_js.J}});Object.defineProperty(exports,"fromArray",{enumerable:true,get:function(){return chunkQ2H2CAII_js.na}});Object.defineProperty(exports,"fromCallback",{enumerable:true,get:function(){return chunkQ2H2CAII_js.O}});Object.defineProperty(exports,"fromPromise",{enumerable:true,get:function(){return chunkQ2H2CAII_js.N}});Object.defineProperty(exports,"fromPromiseAbortable",{enumerable:true,get:function(){return chunkQ2H2CAII_js.Q}});Object.defineProperty(exports,"fromPull",{enumerable:true,get:function(){return chunkQ2H2CAII_js._}});Object.defineProperty(exports,"getCurrentFiber",{enumerable:true,get:function(){return chunkQ2H2CAII_js.G}});Object.defineProperty(exports,"getCurrentRuntime",{enumerable:true,get:function(){return chunkQ2H2CAII_js.R}});Object.defineProperty(exports,"globalScheduler",{enumerable:true,get:function(){return chunkQ2H2CAII_js.E}});Object.defineProperty(exports,"managedStream",{enumerable:true,get:function(){return chunkQ2H2CAII_js.aa}});Object.defineProperty(exports,"map",{enumerable:true,get:function(){return chunkQ2H2CAII_js.v}});Object.defineProperty(exports,"mapAsync",{enumerable:true,get:function(){return chunkQ2H2CAII_js.o}});Object.defineProperty(exports,"mapError",{enumerable:true,get:function(){return chunkQ2H2CAII_js.x}});Object.defineProperty(exports,"mapStream",{enumerable:true,get:function(){return chunkQ2H2CAII_js.ja}});Object.defineProperty(exports,"mapTryAsync",{enumerable:true,get:function(){return chunkQ2H2CAII_js.p}});Object.defineProperty(exports,"merge",{enumerable:true,get:function(){return chunkQ2H2CAII_js.ga}});Object.defineProperty(exports,"mergeStream",{enumerable:true,get:function(){return chunkQ2H2CAII_js.ba}});Object.defineProperty(exports,"none",{enumerable:true,get:function(){return chunkQ2H2CAII_js.q}});Object.defineProperty(exports,"orElseOptional",{enumerable:true,get:function(){return chunkQ2H2CAII_js.z}});Object.defineProperty(exports,"race",{enumerable:true,get:function(){return chunkQ2H2CAII_js.V}});Object.defineProperty(exports,"raceWith",{enumerable:true,get:function(){return chunkQ2H2CAII_js.Y}});Object.defineProperty(exports,"rangeStream",{enumerable:true,get:function(){return chunkQ2H2CAII_js.ka}});Object.defineProperty(exports,"some",{enumerable:true,get:function(){return chunkQ2H2CAII_js.r}});Object.defineProperty(exports,"streamFromReadableStream",{enumerable:true,get:function(){return chunkQ2H2CAII_js.pa}});Object.defineProperty(exports,"succeed",{enumerable:true,get:function(){return chunkQ2H2CAII_js.s}});Object.defineProperty(exports,"sync",{enumerable:true,get:function(){return chunkQ2H2CAII_js.u}});Object.defineProperty(exports,"toPromise",{enumerable:true,get:function(){return chunkQ2H2CAII_js.M}});Object.defineProperty(exports,"tryPromiseAbortable",{enumerable:true,get:function(){return chunkQ2H2CAII_js.P}});Object.defineProperty(exports,"uncons",{enumerable:true,get:function(){return chunkQ2H2CAII_js.ha}});Object.defineProperty(exports,"unit",{enumerable:true,get:function(){return chunkQ2H2CAII_js.d}});Object.defineProperty(exports,"unsafeRunAsync",{enumerable:true,get:function(){return chunkQ2H2CAII_js.L}});Object.defineProperty(exports,"unwrapScoped",{enumerable:true,get:function(){return chunkQ2H2CAII_js.$}});Object.defineProperty(exports,"widenOpt",{enumerable:true,get:function(){return chunkQ2H2CAII_js.Z}});Object.defineProperty(exports,"withAsyncPromise",{enumerable:true,get:function(){return chunkQ2H2CAII_js.n}});Object.defineProperty(exports,"withCurrentFiber",{enumerable:true,get:function(){return chunkQ2H2CAII_js.H}});Object.defineProperty(exports,"withScope",{enumerable:true,get:function(){return chunkQ2H2CAII_js.T}});Object.defineProperty(exports,"withScopeAsync",{enumerable:true,get:function(){return chunkQ2H2CAII_js.U}});Object.defineProperty(exports,"zip",{enumerable:true,get:function(){return chunkQ2H2CAII_js.la}});Object.defineProperty(exports,"zipPar",{enumerable:true,get:function(){return chunkQ2H2CAII_js.W}});exports.LinkedQueue=v;exports.andThen=z;exports.bounded=w;exports.broadcast=yn;exports.broadcastToHub=dn;exports.buffer=F;exports.bufferP=Mn;exports.compose=Cn;exports.dropP=Qn;exports.filterMapP=Tn;exports.filterP=Bn;exports.fromHub=Rn;exports.groupedP=In;exports.identity=On;exports.linkAbortController=De;exports.makeCancelToken=ze;exports.makeHub=N;exports.mapEffectP=D;exports.mapP=Pn;exports.takeP=Hn;exports.tapEffectP=Fn;exports.via=_n;
|
|
1
|
+
import {b,p,d,k,a,f as f$1}from'./chunk-MAR4TNUH.js';export{l as assertNever,r as collectStream,h as concatStream,g as emitStream,f as emptyStream,i as flattenStream,p as foreachStream,q as fromArray,b as fromPull,d as managedStream,m as mapStream,j as merge,e as mergeStream,n as rangeStream,s as streamFromReadableStream,k as uncons,c as unwrapScoped,a as widenOpt,o as zip}from'./chunk-MAR4TNUH.js';import {h,F,j,i,l,f,d as d$1,r,K,s,b as b$1,g,N as N$1}from'./chunk-63MXGA7P.js';export{a as Async,t as Cause,u as Exit,E as PushStatus,F as RingBuffer,M as Runtime,I as RuntimeFiber,G as Scheduler,S as Scope,m as acquireRelease,j as async,c as asyncCatchAll,g as asyncFail,l as asyncFlatMap,b as asyncFold,n as asyncInterruptible,k as asyncMap,d as asyncMapError,f as asyncSucceed,h as asyncSync,i as asyncTotal,B as catchAll,X as collectAllPar,D as end,w as fail,z as flatMap,N as fork,Q as fromPromiseAbortable,J as getCurrentFiber,H as globalScheduler,y as map,p as mapAsync,A as mapError,q as mapTryAsync,r as none,C as orElseOptional,V as race,Y as raceWith,s as some,v as succeed,x as sync,P as toPromise,e as unit,K as unsafeGetCurrentRuntime,O as unsafeRunAsync,R as unsafeRunFoldWithEnv,o as withAsyncPromise,L as withCurrentFiber,U as withScope,T as withScopeAsync,W as zipPar}from'./chunk-63MXGA7P.js';function ze(){let t=false,e=new Set;return {isCancelled:()=>t,onCancel:r=>{if(t){try{r();}catch{}return ()=>{}}return e.add(r),()=>{e.delete(r);}},cancel:()=>{t||(t=true,e.forEach(r=>r()),e.clear());}}}function De(t,e){return t.onCancel(()=>e.abort())}var v=class{head=null;tail=null;len=0;get length(){return this.len}isEmpty(){return this.len===0}push(e){let n={value:e,next:null,prev:this.tail,removed:false};return this.tail?this.tail.next=n:this.head=n,this.tail=n,this.len++,n}shift(){let e=this.head;if(e)return this.unlink(e),e.value}remove(e){e.removed||this.unlink(e);}unlink(e){e.removed=true;let{prev:n,next:r}=e;n?n.next=r:this.head=r,r?r.prev=n:this.tail=n,e.next=null,e.prev=null,this.len--;}};function Z(t,e="backpressure"){return h(()=>I(t,e))}function I(t,e){let n=new F(t),r=false,s={_tag:"QueueClosed"},o=new v,a=new v,l=()=>{for(;a.length>0&&n.length>0;){let u=a.shift(),f=n.shift();u({_tag:"Success",value:f});}for(;o.length>0&&n.length<t&&a.length===0;){let u=o.shift();n.push(u.a),u.cb(true);}for(;a.length>0&&o.length>0;){let u=a.shift(),f=o.shift();f.cb(true),u({_tag:"Success",value:f.a});}};return {size:()=>n.length,shutdown:()=>{if(!r){for(r=true;a.length>0;)a.shift()({_tag:"Failure",cause:{_tag:"Fail",error:s}});for(;o.length>0;)o.shift().cb(false);n.clear();}},offer:u=>j((f,i)=>{if(r){i({_tag:"Success",value:false});return}if(a.length>0){a.shift()({_tag:"Success",value:u}),i({_tag:"Success",value:true});return}if(n.length<t){n.push(u),i({_tag:"Success",value:true}),l();return}if(e==="dropping"){i({_tag:"Success",value:false});return}if(e==="sliding"){n.shift(),n.push(u),i({_tag:"Success",value:true}),l();return}let m=o.push({a:u,cb:A=>i({_tag:"Success",value:A})});return ()=>{o.remove(m);}}),take:()=>j((u,f)=>{if(n.length>0){let A=n.shift();f({_tag:"Success",value:A}),l();return}if(o.length>0){let A=o.shift();A.cb(true),f({_tag:"Success",value:A.a});return}if(r){f({_tag:"Failure",cause:{_tag:"Fail",error:s}});return}let i=A=>f(A),m=a.push(i);return ()=>{a.remove(m);}})}}function M(t,e,n="backpressure"){let r$1=false,s$1=null,o=null,a=t,l$1=()=>b$1(k(a),i=>f(i._tag==="None"?{_tag:"End"}:{_tag:"Fail",error:i.value}),([i,m])=>h(()=>(a=m,{_tag:"Elem",value:i}))),p=i=>l(Z(e,n),m=>{s$1=m;let S=()=>l(l$1(),A=>l(s$1.offer(A),()=>A._tag==="End"||A._tag==="Fail"?f(void 0):S()));return o=N$1(S(),i),r$1=true,f(void 0)}),u={_tag:"Async",register:(i,m)=>{(()=>{if(!r$1){K().fork(p(i)).join(()=>{f$1(i,m);});return}f$1(i,m);})();}};function f$1(i,m){let S=s$1.take();K().fork(S).join(A=>{if(A._tag!=="Success")return;let w=A.value;switch(w._tag){case "Elem":m({_tag:"Success",value:[w.value,b(u)]});return;case "End":o?.interrupt?.(),m({_tag:"Failure",cause:{_tag:"Fail",error:r}});return;case "Fail":o?.interrupt?.(),m({_tag:"Failure",cause:{_tag:"Fail",error:s(w.error)}});return}});}return b(u)}var N=t=>t==="BackPressure"?"backpressure":t==="Dropping"?"dropping":"sliding";function z(t,e="BackPressure"){let n=new Set,r=false,s=p=>{if(r)return f(false);let u=Array.from(n),f$1=f(true);return u.forEach(i=>{f$1=l(f$1,m=>l(i.offer(p),S=>f(m&&S)));}),f$1};return {publish:s,publishAll:p=>{let u=f(true),f$1=p[Symbol.iterator]();for(;;){let i=f$1.next();if(i.done)break;let m=i.value;u=l(u,S=>l(s(m),A=>f(S&&A)));}return u},subscribe:()=>r?i(()=>{throw {_tag:"HubClosed"}}):l(Z(t,N(e)),p=>h(()=>(n.add(p),{...p,unsubscribe:()=>{n.has(p)&&(n.delete(p),p.shutdown());}}))),shutdown:()=>h(()=>{r||(r=true,Array.from(n).forEach(p=>p.shutdown()),n.clear());})}}var dn=z;function Rn(t,e){return p(t,n=>l(e.publish(n),()=>f(void 0)))}function Sn(t){return d(l(t.subscribe(),e=>{let n=b(l(d$1(e.take(),r$1=>r),r=>f([r,n])));return f({stream:n,release:r=>h(()=>e.unsubscribe())})}))}function Cn(t,e){return e(t)}function D(t,e){return(n=>e(t(n)))}function On(t,e){return D(e,t)}function Pn(){return(t=>t)}function Bn(t){return(e=>{let n=r=>b(b$1(k(r),s=>g(s),([s,o])=>f([t(s),n(o)])));return n(e)})}function Tn(t){return(e=>{let n=s=>b$1(k(s),o=>g(o),([o,a])=>t(o)?f([o,r(a)]):n(a)),r=s=>b(n(s));return r(e)})}function Fn(t){return(e=>{let n=s=>b$1(k(s),o=>g(o),([o,a])=>{let l=t(o);return l._tag==="Some"?f([l.value,r(a)]):n(a)}),r=s=>b(n(s));return r(e)})}function Hn(t){let e=Math.max(0,t|0);return(n=>{let r=(s,o)=>o<=0?f$1():b(b$1(k(s),a=>g(a),([a,l])=>f([a,r(l,o-1)])));return r(n,e)})}function Qn(t){let e=Math.max(0,t|0);return(n=>{let r=(s,o)=>o<=0?s:b(b$1(k(s),a=>g(a),([a,l])=>k(r(l,o-1))));return r(n,e)})}function W(t){return(e=>{let n=s$1=>d$1(s$1,o=>s(o)),r=s=>b(b$1(d$1(k(s),o=>a(o)),o=>g(o),([o,a])=>b$1(n(t(o)),l=>g(l),l=>f([l,r(a)]))));return r(e)})}function Mn(t){return W(e=>l(t(e),()=>f(e)))}function In(t,e="backpressure"){return(n=>M(n,t,e))}function Nn(t){let e=Math.max(1,t|0);return(n=>{let r=(o,a,l)=>a<=0?f({chunk:l,rest:o}):b$1(k(o),p=>p._tag==="None"?f({chunk:l,rest:f$1()}):g(p),([p,u])=>r(u,a-1,[...l,p])),s=o=>b(b$1(k(o),a=>g(a),([a,l$1])=>l(r(l$1,e-1,[a]),({chunk:p,rest:u})=>f([p,s(u)]))));return s(n)})}export{v as LinkedQueue,D as andThen,Z as bounded,dn as broadcast,Rn as broadcastToHub,M as buffer,In as bufferP,On as compose,Qn as dropP,Fn as filterMapP,Tn as filterP,Sn as fromHub,Nn as groupedP,Pn as identity,De as linkAbortController,ze as makeCancelToken,z as makeHub,W as mapEffectP,Bn as mapP,Hn as takeP,Mn as tapEffectP,Cn as via};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Z as ZIO, O as Option, E as Exit, A as Async } from './effect-NSaHksNl.js';
|
|
2
|
+
|
|
3
|
+
type Empty<R, E, A> = {
|
|
4
|
+
readonly _tag: "Empty";
|
|
5
|
+
};
|
|
6
|
+
type Emit<R, E, A> = {
|
|
7
|
+
readonly _tag: "Emit";
|
|
8
|
+
readonly value: ZIO<R, E, A>;
|
|
9
|
+
};
|
|
10
|
+
type Concat<R, E, A> = {
|
|
11
|
+
readonly _tag: "Concat";
|
|
12
|
+
readonly left: ZStream<R, E, A>;
|
|
13
|
+
readonly right: ZStream<R, E, A>;
|
|
14
|
+
};
|
|
15
|
+
type Flatten<R, E, A> = {
|
|
16
|
+
readonly _tag: "Flatten";
|
|
17
|
+
readonly stream: ZStream<R, E, ZStream<R, E, A>>;
|
|
18
|
+
};
|
|
19
|
+
type FromPull<R, E, A> = {
|
|
20
|
+
readonly _tag: "FromPull";
|
|
21
|
+
readonly pull: ZIO<R, Option<E>, [A, ZStream<R, E, A>]>;
|
|
22
|
+
};
|
|
23
|
+
type Merge<R, E, A> = {
|
|
24
|
+
readonly _tag: "Merge";
|
|
25
|
+
readonly left: ZStream<R, E, A>;
|
|
26
|
+
readonly right: ZStream<R, E, A>;
|
|
27
|
+
readonly flip: boolean;
|
|
28
|
+
};
|
|
29
|
+
type Scoped<R, E, A> = {
|
|
30
|
+
readonly _tag: "Scoped";
|
|
31
|
+
readonly acquire: ZIO<R, E, ZStream<R, E, A>>;
|
|
32
|
+
readonly release: (exit: Exit<any, any>) => Async<R, any, void>;
|
|
33
|
+
};
|
|
34
|
+
type Managed<R, E, A> = {
|
|
35
|
+
readonly _tag: "Managed";
|
|
36
|
+
readonly acquire: ZIO<R, E, {
|
|
37
|
+
stream: ZStream<R, E, A>;
|
|
38
|
+
release: (exit: Exit<any, any>) => Async<R, any, void>;
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
type ZStream<R, E, A> = Empty<R, E, A> | Emit<R, E, A> | Concat<R, E, A> | FromPull<R, E, A> | Flatten<R, E, A> | Merge<R, E, A> | Scoped<R, E, A> | Managed<R, E, A>;
|
|
42
|
+
type Normalize<E> = (u: unknown) => E;
|
|
43
|
+
declare const widenOpt: <E1, E2>(opt: Option<E1>) => Option<E1 | E2>;
|
|
44
|
+
declare const fromPull: <R, E, A>(pull: ZIO<R, Option<E>, [A, ZStream<R, E, A>]>) => ZStream<R, E, A>;
|
|
45
|
+
declare const unwrapScoped: <R, E, A>(acquire: ZIO<R, E, ZStream<R, E, A>>, release: (exit: Exit<any, any>) => Async<R, any, void>) => ZStream<R, E, A>;
|
|
46
|
+
declare const managedStream: <R, E, A>(acquire: ZIO<R, E, {
|
|
47
|
+
stream: ZStream<R, E, A>;
|
|
48
|
+
release: (exit: Exit<any, any>) => Async<R, any, void>;
|
|
49
|
+
}>) => ZStream<R, E, A>;
|
|
50
|
+
declare const mergeStream: <R, E, A>(left: ZStream<R, E, A>, right: ZStream<R, E, A>, flip?: boolean) => ZStream<R, E, A>;
|
|
51
|
+
declare const emptyStream: <R, E, A>() => ZStream<R, E, A>;
|
|
52
|
+
declare const emitStream: <R, E, A>(value: ZIO<R, E, A>) => ZStream<R, E, A>;
|
|
53
|
+
declare const concatStream: <R, E, A>(left: ZStream<R, E, A>, right: ZStream<R, E, A>) => ZStream<R, E, A>;
|
|
54
|
+
declare const flattenStream: <R, E, A>(stream: ZStream<R, E, ZStream<R, E, A>>) => ZStream<R, E, A>;
|
|
55
|
+
declare function merge<R, E, A>(left: ZStream<R, E, A>, right: ZStream<R, E, A>): ZStream<R, E, A>;
|
|
56
|
+
declare function uncons<R, E, A>(self: ZStream<R, E, A>): ZIO<R, Option<E>, [A, ZStream<R, E, A>]>;
|
|
57
|
+
declare function assertNever(x: never, msg?: string): never;
|
|
58
|
+
declare function mapStream<R, E, A, B>(self: ZStream<R, E, A>, f: (a: A) => B): ZStream<R, E, B>;
|
|
59
|
+
declare function rangeStream(start: number, end: number): ZStream<unknown, never, number>;
|
|
60
|
+
declare function zip<R, E1, A, E2, B>(left: ZStream<R, E1, A>, right: ZStream<R, E2, B>): ZStream<R, E1 | E2, [A, B]>;
|
|
61
|
+
declare function foreachStream<R, E, A, R2, E2>(stream: ZStream<R, E, A>, f: (a: A) => Async<R2, E2, void>): Async<R & R2, E | E2, void>;
|
|
62
|
+
declare function fromArray<A>(values: readonly A[]): ZStream<unknown, never, A>;
|
|
63
|
+
declare function collectStream<R, E, A>(stream: ZStream<R, E, A>): ZIO<R, E, A[]>;
|
|
64
|
+
declare function streamFromReadableStream<E>(body: ReadableStream<Uint8Array> | null | undefined, normalizeError: Normalize<E>): ZStream<unknown, E, Uint8Array>;
|
|
65
|
+
|
|
66
|
+
export { type Concat as C, type Emit as E, type Flatten as F, type Managed as M, type Normalize as N, type Scoped as S, type ZStream as Z, type Empty as a, type FromPull as b, type Merge as c, assertNever as d, collectStream as e, concatStream as f, emitStream as g, emptyStream as h, flattenStream as i, foreachStream as j, fromArray as k, fromPull as l, managedStream as m, mapStream as n, merge as o, mergeStream as p, unwrapScoped as q, rangeStream as r, streamFromReadableStream as s, uncons as u, widenOpt as w, zip as z };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Z as ZIO, O as Option, E as Exit, A as Async } from './effect-NSaHksNl.mjs';
|
|
2
|
+
|
|
3
|
+
type Empty<R, E, A> = {
|
|
4
|
+
readonly _tag: "Empty";
|
|
5
|
+
};
|
|
6
|
+
type Emit<R, E, A> = {
|
|
7
|
+
readonly _tag: "Emit";
|
|
8
|
+
readonly value: ZIO<R, E, A>;
|
|
9
|
+
};
|
|
10
|
+
type Concat<R, E, A> = {
|
|
11
|
+
readonly _tag: "Concat";
|
|
12
|
+
readonly left: ZStream<R, E, A>;
|
|
13
|
+
readonly right: ZStream<R, E, A>;
|
|
14
|
+
};
|
|
15
|
+
type Flatten<R, E, A> = {
|
|
16
|
+
readonly _tag: "Flatten";
|
|
17
|
+
readonly stream: ZStream<R, E, ZStream<R, E, A>>;
|
|
18
|
+
};
|
|
19
|
+
type FromPull<R, E, A> = {
|
|
20
|
+
readonly _tag: "FromPull";
|
|
21
|
+
readonly pull: ZIO<R, Option<E>, [A, ZStream<R, E, A>]>;
|
|
22
|
+
};
|
|
23
|
+
type Merge<R, E, A> = {
|
|
24
|
+
readonly _tag: "Merge";
|
|
25
|
+
readonly left: ZStream<R, E, A>;
|
|
26
|
+
readonly right: ZStream<R, E, A>;
|
|
27
|
+
readonly flip: boolean;
|
|
28
|
+
};
|
|
29
|
+
type Scoped<R, E, A> = {
|
|
30
|
+
readonly _tag: "Scoped";
|
|
31
|
+
readonly acquire: ZIO<R, E, ZStream<R, E, A>>;
|
|
32
|
+
readonly release: (exit: Exit<any, any>) => Async<R, any, void>;
|
|
33
|
+
};
|
|
34
|
+
type Managed<R, E, A> = {
|
|
35
|
+
readonly _tag: "Managed";
|
|
36
|
+
readonly acquire: ZIO<R, E, {
|
|
37
|
+
stream: ZStream<R, E, A>;
|
|
38
|
+
release: (exit: Exit<any, any>) => Async<R, any, void>;
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
type ZStream<R, E, A> = Empty<R, E, A> | Emit<R, E, A> | Concat<R, E, A> | FromPull<R, E, A> | Flatten<R, E, A> | Merge<R, E, A> | Scoped<R, E, A> | Managed<R, E, A>;
|
|
42
|
+
type Normalize<E> = (u: unknown) => E;
|
|
43
|
+
declare const widenOpt: <E1, E2>(opt: Option<E1>) => Option<E1 | E2>;
|
|
44
|
+
declare const fromPull: <R, E, A>(pull: ZIO<R, Option<E>, [A, ZStream<R, E, A>]>) => ZStream<R, E, A>;
|
|
45
|
+
declare const unwrapScoped: <R, E, A>(acquire: ZIO<R, E, ZStream<R, E, A>>, release: (exit: Exit<any, any>) => Async<R, any, void>) => ZStream<R, E, A>;
|
|
46
|
+
declare const managedStream: <R, E, A>(acquire: ZIO<R, E, {
|
|
47
|
+
stream: ZStream<R, E, A>;
|
|
48
|
+
release: (exit: Exit<any, any>) => Async<R, any, void>;
|
|
49
|
+
}>) => ZStream<R, E, A>;
|
|
50
|
+
declare const mergeStream: <R, E, A>(left: ZStream<R, E, A>, right: ZStream<R, E, A>, flip?: boolean) => ZStream<R, E, A>;
|
|
51
|
+
declare const emptyStream: <R, E, A>() => ZStream<R, E, A>;
|
|
52
|
+
declare const emitStream: <R, E, A>(value: ZIO<R, E, A>) => ZStream<R, E, A>;
|
|
53
|
+
declare const concatStream: <R, E, A>(left: ZStream<R, E, A>, right: ZStream<R, E, A>) => ZStream<R, E, A>;
|
|
54
|
+
declare const flattenStream: <R, E, A>(stream: ZStream<R, E, ZStream<R, E, A>>) => ZStream<R, E, A>;
|
|
55
|
+
declare function merge<R, E, A>(left: ZStream<R, E, A>, right: ZStream<R, E, A>): ZStream<R, E, A>;
|
|
56
|
+
declare function uncons<R, E, A>(self: ZStream<R, E, A>): ZIO<R, Option<E>, [A, ZStream<R, E, A>]>;
|
|
57
|
+
declare function assertNever(x: never, msg?: string): never;
|
|
58
|
+
declare function mapStream<R, E, A, B>(self: ZStream<R, E, A>, f: (a: A) => B): ZStream<R, E, B>;
|
|
59
|
+
declare function rangeStream(start: number, end: number): ZStream<unknown, never, number>;
|
|
60
|
+
declare function zip<R, E1, A, E2, B>(left: ZStream<R, E1, A>, right: ZStream<R, E2, B>): ZStream<R, E1 | E2, [A, B]>;
|
|
61
|
+
declare function foreachStream<R, E, A, R2, E2>(stream: ZStream<R, E, A>, f: (a: A) => Async<R2, E2, void>): Async<R & R2, E | E2, void>;
|
|
62
|
+
declare function fromArray<A>(values: readonly A[]): ZStream<unknown, never, A>;
|
|
63
|
+
declare function collectStream<R, E, A>(stream: ZStream<R, E, A>): ZIO<R, E, A[]>;
|
|
64
|
+
declare function streamFromReadableStream<E>(body: ReadableStream<Uint8Array> | null | undefined, normalizeError: Normalize<E>): ZStream<unknown, E, Uint8Array>;
|
|
65
|
+
|
|
66
|
+
export { type Concat as C, type Emit as E, type Flatten as F, type Managed as M, type Normalize as N, type Scoped as S, type ZStream as Z, type Empty as a, type FromPull as b, type Merge as c, assertNever as d, collectStream as e, concatStream as f, emitStream as g, emptyStream as h, flattenStream as i, foreachStream as j, fromArray as k, fromPull as l, managedStream as m, mapStream as n, merge as o, mergeStream as p, unwrapScoped as q, rangeStream as r, streamFromReadableStream as s, uncons as u, widenOpt as w, zip as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brass-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.1",
|
|
4
4
|
"description": "Effect runtime utilities for TypeScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Augusto Vivaldelli",
|
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
"import": "./dist/http/index.js",
|
|
19
19
|
"require": "./dist/http/index.cjs"
|
|
20
20
|
},
|
|
21
|
+
"./agent": {
|
|
22
|
+
"types": "./dist/agent/index.d.ts",
|
|
23
|
+
"import": "./dist/agent/index.js",
|
|
24
|
+
"require": "./dist/agent/index.cjs"
|
|
25
|
+
},
|
|
21
26
|
"./package.json": "./package.json"
|
|
22
27
|
},
|
|
23
28
|
"files": [
|
|
@@ -50,7 +55,25 @@
|
|
|
50
55
|
"build:types": "tsc -p tsconfig.types.json",
|
|
51
56
|
"build:esm": "tsc -p tsconfig.esm.json",
|
|
52
57
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
53
|
-
"prepublishOnly": "npm run build"
|
|
58
|
+
"prepublishOnly": "npm run build",
|
|
59
|
+
"agent:dev": "tsx src/agent/cli/main.ts",
|
|
60
|
+
"agent:doctor": "tsx src/agent/cli/main.ts --doctor",
|
|
61
|
+
"agent:vscode:package": "node scripts/install-vscode-extension.mjs --no-code-install --no-settings",
|
|
62
|
+
"agent:vscode:install": "node scripts/install-vscode-extension.mjs",
|
|
63
|
+
"agent:vscode:uninstall": "node scripts/clean-vscode-extension.mjs --yes --no-vsix --no-settings --no-global-storage",
|
|
64
|
+
"agent:vscode:clean": "node scripts/clean-vscode-extension.mjs --yes",
|
|
65
|
+
"agent:vscode:reinstall": "npm run agent:vscode:clean && npm run agent:vscode:install",
|
|
66
|
+
"agent:local-install": "npm run agent:vscode:install",
|
|
67
|
+
"agent:init": "tsx src/agent/cli/main.ts --init",
|
|
68
|
+
"agent:init:dry-run": "tsx src/agent/cli/main.ts --init --init-dry-run",
|
|
69
|
+
"agent:test:smoke": "node scripts/agent-local-smoke.mjs",
|
|
70
|
+
"agent:test:local": "npm run build && npm run agent:test:smoke",
|
|
71
|
+
"agent:link": "npm run build && npm link",
|
|
72
|
+
"agent:unlink": "node scripts/unlink-agent-cli.mjs",
|
|
73
|
+
"agent:vscode:install:global": "npm run agent:link && node scripts/install-vscode-extension.mjs --use-global-command --no-root-build",
|
|
74
|
+
"agent:vscode:bundle": "npm run build && node scripts/prepare-vscode-bundle.mjs",
|
|
75
|
+
"agent:vscode:uninstall:global": "npm run agent:vscode:clean && npm run agent:unlink",
|
|
76
|
+
"agent:vscode:reinstall:global": "npm run agent:vscode:uninstall:global && npm run agent:vscode:install:global"
|
|
54
77
|
},
|
|
55
78
|
"devDependencies": {
|
|
56
79
|
"@semantic-release/changelog": "^6.0.0",
|
|
@@ -59,6 +82,7 @@
|
|
|
59
82
|
"@semantic-release/github": "^11.0.0",
|
|
60
83
|
"@semantic-release/npm": "^13.1.3",
|
|
61
84
|
"@semantic-release/release-notes-generator": "^14.0.0",
|
|
85
|
+
"@types/node": "^25.6.0",
|
|
62
86
|
"conventional-changelog-conventionalcommits": "^7.x.x",
|
|
63
87
|
"rimraf": "^6.1.2",
|
|
64
88
|
"semantic-release": "^25.0.2",
|
|
@@ -74,5 +98,8 @@
|
|
|
74
98
|
"bugs": {
|
|
75
99
|
"url": "https://github.com/BaldrVivaldelli/brass-runtime/issues"
|
|
76
100
|
},
|
|
77
|
-
"homepage": "https://github.com/BaldrVivaldelli/brass-runtime#readme"
|
|
101
|
+
"homepage": "https://github.com/BaldrVivaldelli/brass-runtime#readme",
|
|
102
|
+
"bin": {
|
|
103
|
+
"brass-agent": "./dist/agent/cli/main.cjs"
|
|
104
|
+
}
|
|
78
105
|
}
|
package/dist/chunk-Q2H2CAII.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';function R(t,e,n){return {_tag:"Fold",first:t,onFailure:e,onSuccess:n}}function be(t,e){return R(t,n=>e(n),n=>E(n))}function b(t,e){return R(t,n=>f(e(n)),n=>E(n))}var Z=()=>E(void 0),E=t=>({_tag:"Succeed",value:t}),f=t=>({_tag:"Fail",error:t}),_=t=>({_tag:"Sync",thunk:t}),Fe=t=>_(()=>t()),p=t=>({_tag:"Async",register:t});function Q(t,e){return A(t,n=>E(e(n)))}function A(t,e){return {_tag:"FlatMap",first:t,andThen:e}}function ke(t,e,n){return A(t,r=>(n.addFinalizer(o=>e(r,o)),E(r)))}function Ie(t){return p(t)}var _e=t=>e=>{let n=e;return n.toPromise||(n.toPromise=r=>t(e,r),n.unsafeRunPromise=()=>t(e,{})),n},we=(t,e)=>A(t,n=>E(e(n))),Oe=(t,e)=>A(t,n=>_(()=>e(n)));var F={_tag:"None"},w=t=>({_tag:"Some",value:t});var j=t=>E(t),C=t=>f(t),$=t=>_(e=>t(e)),k=(t,e)=>Q(t,e),K=(t,e)=>A(t,n=>e(n)),H=(t,e)=>b(t,e),Pe=(t,e)=>R(t,n=>e(n),n=>E(n));function q(t,e){return R(t,n=>n._tag==="Some"?f(n):e(),n=>E(n))}var Te=()=>C(F);var ie=(r=>(r[r.Ok=0]="Ok",r[r.Grew=1]="Grew",r[r.Dropped=2]="Dropped",r))(ie||{}),N=class{buf;head=0;tail=0;size_=0;maxCap;constructor(e=1024,n=e){let r=Math.max(2,this.nextPow2(e)),o=Math.max(r,this.nextPow2(n));this.buf=new Array(r),this.maxCap=o;}get length(){return this.size_}get capacity(){return this.buf.length}isEmpty(){return this.size_===0}push(e){return this.size_===this.buf.length?this.buf.length>=this.maxCap?2:(this.grow(),this.buf[this.tail]=e,this.tail=this.tail+1&this.buf.length-1,this.size_++,1):(this.buf[this.tail]=e,this.tail=this.tail+1&this.buf.length-1,this.size_++,0)}shift(){if(this.size_===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=this.head+1&this.buf.length-1,this.size_--,e}clear(){this.buf.fill(void 0),this.head=0,this.tail=0,this.size_=0;}grow(){let e=this.buf,n=Math.min(e.length*2,this.maxCap),r=new Array(n);for(let o=0;o<this.size_;o++)r[o]=e[this.head+o&e.length-1];this.buf=r,this.head=0,this.tail=this.size_;}nextPow2(e){let n=1;for(;n<e;)n<<=1;return n}};var X=2048,Y=4096,se=(()=>{if(typeof globalThis.setImmediate=="function")return t=>globalThis.setImmediate(t);if(typeof globalThis.MessageChannel=="function"){let t=new globalThis.MessageChannel,e=null;return t.port1.onmessage=()=>{let n=e;e=null,n?.();},n=>{e=n,t.port2.postMessage(0);}}return t=>setTimeout(t,0)})(),L=class{queue=new N(1024);flushing=false;scheduled=false;schedule(e,n="anonymous"){if(typeof e=="function"&&(this.queue.push({tag:n,task:e}),!this.flushing&&!this.scheduled)){this.scheduled=true;let r=this.queue.length>Y?"macro":"micro";this.requestFlush(r);}}requestFlush(e){e==="micro"?queueMicrotask(()=>this.flush()):se(()=>this.flush());}flush(){if(this.flushing)return;this.flushing=true,this.scheduled=false;let e=0;try{for(;e<X;){let n=this.queue.shift();if(!n)break;e++;try{n.task();}catch(r){console.error(`[Scheduler] task threw (tag=${n.tag})`,r);}}}finally{if(this.flushing=false,this.queue.length>0&&!this.scheduled){this.scheduled=true;let n=e>=X||this.queue.length>Y?"macro":"micro";this.requestFlush(n);}}}},B=new L;var P=null,h={CONTINUE:"Continue",SUSPEND:"Suspend",DONE:"Done"},g={QUEUED:"Queued",RUNNING:"Running",SUSPENDED:"Suspended",DONE:"Done"},ce=1,ue=1024;function le(t){let e=t;for(;e._tag==="FlatMap"&&e.first._tag==="FlatMap";){let n=e.first,r=e.andThen;e={_tag:"FlatMap",first:n.first,andThen:o=>({_tag:"FlatMap",first:n.andThen(o),andThen:r})};}return e}var T=class{id;runtime;closing=null;finishing=false;runState=g.RUNNING;interrupted=false;result=null;joiners=[];current;stack=[];fiberFinalizers=[];finalizersDrained=false;fiberContext;name;scopeId;constructor(e,n){this.id=ce++,this.runtime=e,this.current=n;}get env(){return this.runtime.env}get scheduler(){return this.runtime.scheduler}addFinalizer(e){this.fiberFinalizers.push(e);}status(){return this.result==null?"Running":this.interrupted?"Interrupted":"Done"}join(e){this.result!=null?e(this.result):this.joiners.push(e);}interrupt(){this.result==null&&(this.interrupted||(this.interrupted=true,this.schedule("interrupt-step")));}schedule(e="step"){this.runState===g.DONE||this.runState===g.QUEUED||(this.runState=g.QUEUED,this.scheduler.schedule(()=>{pe(this,()=>{if(this.runState===g.DONE)return;switch(this.runState=g.RUNNING,this.step()){case h.CONTINUE:this.schedule("continue");return;case h.SUSPEND:this.runState=g.SUSPENDED;return;case h.DONE:this.runState=g.DONE;return}});},`fiber#${this.id}.${e}`));}runFinalizersOnce(e){if(!this.finalizersDrained)for(this.finalizersDrained=true;this.fiberFinalizers.length>0;){let n=this.fiberFinalizers.pop();try{n(e);}catch{}}}notify(e){if(this.result==null&&this.closing==null){this.finishing=true,this.closing=e,this.runFinalizersOnce(e),this.result=e;for(let n of this.joiners)n(e);this.joiners.length=0;}}onSuccess(e){let n=this.stack.pop();if(!n){this.notify({_tag:"Success",value:e});return}this.current=n._tag==="SuccessCont"?n.k(e):n.onSuccess(e);}onFailure(e){for(;this.stack.length>0;){let n=this.stack.pop();if(n._tag==="FoldCont"){this.current=n.onFailure(e);return}}this.notify({_tag:"Failure",error:e});}step(){let e=ue;for(;e-- >0;){if(this.result!=null)return h.DONE;if(this.interrupted&&this.closing==null)return this.notify({_tag:"Failure",error:{_tag:"Interrupted"}}),h.DONE;let n=le(this.current);switch(n._tag){case "Succeed":{this.onSuccess(n.value);break}case "Fail":{this.onFailure(n.error);break}case "Sync":{try{let r=n.thunk(this.env);this.onSuccess(r);}catch(r){this.onFailure(r);}break}case "FlatMap":{this.stack.push({_tag:"SuccessCont",k:n.andThen}),this.current=n.first;break}case "Fold":{this.stack.push({_tag:"FoldCont",onFailure:n.onFailure,onSuccess:n.onSuccess}),this.current=n.first;break}case "Async":{if(this.finishing)return this.result!=null?h.DONE:h.CONTINUE;let r=false,o=i=>{r||(r=true,!(this.result!=null||this.closing!=null)&&(this.current=i._tag==="Success"?{_tag:"Succeed",value:i.value}:{_tag:"Fail",error:i.error},this.schedule("async-resume")));},a=n.register(this.env,o);return typeof a=="function"&&this.addFinalizer(()=>{r=true;try{a();}catch{}}),h.SUSPEND}}}return this.result!=null?h.DONE:h.CONTINUE}};function D(){return P}function pe(t,e){let n=P;P=t;try{return e()}finally{P=n;}}var ee={parent:null,patch:Object.create(null)};function te(t,e){let n=Ee(t);return {initChild(r,o){let a=o?.fiberContext,i=Ae(n,a?.trace??null);r.fiberContext={log:a?.log??ee,trace:i},r.parentFiberId=o?.id,r.name=n.childName(o?.name),e.emit({type:"fiber.start",fiberId:r.id,parentFiberId:o?.id,name:r.name},{fiberId:o?.id,traceId:a?.trace?.traceId,spanId:a?.trace?.spanId});}}}function Ee(t){let e={newTraceId:()=>crypto.randomUUID(),newSpanId:()=>crypto.randomUUID()},n=t?.brass,r=n?.tracer??e,o=n?.traceSeed,a=n?.childName??(i=>i?`${i}/child`:void 0);return {tracer:r,seed:o,childName:a}}function Ae(t,e){return e?{traceId:e.traceId,spanId:t.tracer.newSpanId(),parentSpanId:e.spanId,sampled:e.sampled}:t.seed?{...t.seed}:{traceId:t.tracer.newTraceId(),spanId:t.tracer.newSpanId(),sampled:true}}var de={emit(){}},O=class t{env;scheduler;hooks;forkPolicy;constructor(e){this.env=e.env,this.scheduler=e.scheduler??B,this.hooks=e.hooks??de,this.forkPolicy=te(this.env,this.hooks);}fork(e){let n=D(),r=new T(this,e);return this.forkPolicy.initChild(r,n),r.schedule("initial-step"),r}unsafeRunAsync(e,n){this.fork(e).join(n);}toPromise(e){return new Promise((n,r)=>{this.fork(e).join(a=>{let i=a;i._tag==="Success"?n(i.value):r(i.error);});})}log(e,n,r){this.emit({type:"log",level:e,message:n,fields:r});}withHooks(e){return new t({env:this.env,scheduler:this.scheduler,hooks:e})}emit(e){let n=D(),r={fiberId:n?.id,scopeId:n?.scope?.id,traceId:n?.fiberContext?.trace?.traceId,spanId:n?.fiberContext?.trace?.spanId};this.hooks.emit(e,r);}static make(e,n=B){return new t({env:e,scheduler:n})}};function Ye(t){return p((e,n)=>{let r=false,o=s=>{r||(r=true,n(s));},a=s=>o({_tag:"Failure",error:s instanceof Error?s:new Error(String(s))}),i=s=>o({_tag:"Success",value:s});try{typeof t=="function"&&t.length>=1?t((s,c)=>s?a(s):i(c)):t().then(i,a);}catch(s){a(s);}})}function et(t,e,n=B){return new O({env:e,scheduler:n}).fork(t)}function tt(t,e,n){return new O({env:e}).unsafeRunAsync(t,n)}function nt(t,e){return new O({env:e}).toPromise(t)}function rt(t,e){return p((n,r)=>{t(n).then(o=>r({_tag:"Success",value:o})).catch(o=>r({_tag:"Failure",error:e(o)}));})}function ot(t){return p((e,n)=>{let r=false,o=a=>{r||(r=true,n(a));};try{t((a,i)=>{o(a?{_tag:"Failure",error:a}:{_tag:"Success",value:i});});}catch(a){o({_tag:"Failure",error:a instanceof Error?a:new Error(String(a))});}})}function at(t){return ye((n,r)=>t.length===1?t(r):t(n,r),n=>Re(n)?{_tag:"Abort"}:{_tag:"PromiseRejected",reason:n})}function ye(t,e){return p((n,r)=>{let o=new AbortController,a=false,i=s=>{a||(a=true,r(s));};try{(t.length===1?t(o.signal):t(n,o.signal)).then(c=>i({_tag:"Success",value:c})).catch(c=>i({_tag:"Failure",error:e(c)}));}catch(s){i({_tag:"Failure",error:e(s)});}return ()=>{a=true,o.abort();}})}var Re=t=>typeof t=="object"&&t!==null&&"name"in t&&t.name==="AbortError";function G(){let t=D();if(!t)throw new Error("No current runtime: est\xE1s llamando esto fuera de un fiber (fuera del runtime).");return t.runtime}var me=1;function fe(t){return p((e,n)=>{let r=t.length;if(r===0){n({_tag:"Success",value:void 0});return}for(let o of t)o.join(()=>{r-=1,r===0&&n({_tag:"Success",value:void 0});});})}function he(t){return R(t,()=>Z(),()=>Z())}var I=class t{constructor(e){this.runtime=e;this.id=me++;}id;closed=false;children=new Set;subScopes=new Set;finalizers=[];get env(){return this.runtime.env}addFinalizer(e){if(this.closed)throw new Error("Trying to add finalizer to closed scope");this.finalizers.push(e);}subScope(){if(this.closed)throw new Error("Scope closed");let e=new t(this.runtime);return this.subScopes.add(e),e}fork(e){if(this.closed)throw new Error("Scope closed");let n=this.runtime.fork(e);return this.children.add(n),n.join(()=>{this.children.delete(n);}),n}close(e={_tag:"Success",value:void 0}){this.runtime.fork(this.closeAsync(e));}closeAsync(e={_tag:"Success",value:void 0},n={}){return p((r,o)=>{if(this.closed){o({_tag:"Success",value:void 0});return}this.closed=true;let a=Array.from(this.children),i=Array.from(this.subScopes);this.children.clear(),this.subScopes.clear();for(let l of a)try{l.interrupt();}catch{}let s=Z();for(let l of i)s=A(s,()=>l.closeAsync(e,n));for(;this.finalizers.length>0;){let l=this.finalizers.pop();s=A(s,()=>he(l(e)));}n.awaitChildren&&(s=A(s,()=>fe(a))),this.runtime.fork(s).join(()=>o({_tag:"Success",value:void 0}));})}};function ut(t,e){let n=new I(t);try{return e(n)}finally{n.close();}}function lt(t,e){return p((n,r)=>{let o=new I(t);o.fork(e(o)).join(i=>{try{o.close(i);}catch(s){r({_tag:"Failure",error:s});return}r(i);});})}function dt(t,e,n){return p((r,o)=>{let a=n.subScope(),i=false,s=m=>{i||(i=true,a.close(m),o(m));},c=a.fork(t),l=a.fork(e);c.join(s),l.join(s);})}function yt(t,e,n){return p((r,o)=>{let a=n.subScope(),i=null,s=null,c=false,l=()=>{if(!i||!s||c)return;if(c=true,i._tag==="Success"&&s._tag==="Success"){a.close({_tag:"Success",value:void 0}),o({_tag:"Success",value:[i.value,s.value]});return}let u;if(i._tag==="Failure")u=i.error;else if(s._tag==="Failure")u=s.error;else throw new Error("zipPar: unreachable state (no Failure exit)");let v={_tag:"Failure",error:u};a.close(v),o(v);},m=a.fork(t),y=a.fork(e);m.join(u=>{i=u,l();}),y.join(u=>{s=u,l();});})}function Rt(t,e){return p((n,r)=>{let o=e.subScope(),a=new Array(t.length),i=0,s=false;t.forEach((c,l)=>{o.fork(c).join(y=>{if(!s){if(y._tag==="Failure"){s=true;let u={_tag:"Failure",error:y.error};o.close(u),r(u);return}if(a[l]=y.value,i++,i===t.length){s=true;let u={_tag:"Success",value:a};o.close({_tag:"Success",value:void 0}),r(u);}}});});})}function ne(t,e,n,r,o){return p((a,i)=>{let s=n.subScope(),c=false,l=s.fork(t),m=s.fork(e),y=u=>{s.fork(u).join(v=>{s.close(v),i(v);});};l.join(u=>{c||(c=true,y(r(u,m,s)));}),m.join(u=>{c||(c=true,y(o(u,l,s)));});})}var J=t=>t._tag==="None"?F:w(t.value),x=t=>({_tag:"FromPull",pull:t}),oe=(t,e)=>({_tag:"Scoped",acquire:t,release:e}),Ot=t=>({_tag:"Scoped",acquire:A(t,e=>E(e.stream)),release:e=>A(t,n=>n.release(e))}),ge=(t,e,n=true)=>({_tag:"Merge",left:t,right:e,flip:n}),M=()=>({_tag:"Empty"}),ae=t=>({_tag:"Emit",value:t}),z=(t,e)=>({_tag:"Concat",left:t,right:e}),V=t=>({_tag:"Flatten",stream:t});function re(t,e,n,r,o){return (a,i,s)=>{if(a._tag,a._tag,a._tag==="Success"){let[m,y]=a.value;i.interrupt();let u=x(t==="L"?U(y,n):U(e,y));return E([m,u])}let c=a.error;if(typeof c=="object"&&c!==null&&c._tag==="Interrupted")return f(c);let l=c;return l._tag==="None"?d(t==="L"?n:e):f(l)}}function U(t,e,n,r){return p((o,a)=>{let s=G(),c=new I(s),l=d(t),m=d(e),y=re("L",t,e),u=re("R",t,e),v=ne(l,m,c,y,u);c.fork(v).join(W=>{c.close(W),a(W);});})}function Zt(t,e){return x(U(t,e))}function d(t){switch(t._tag){case "Empty":return C(F);case "Emit":return k(H(t.value,e=>w(e)),e=>[e,M()]);case "FromPull":return t.pull;case "Concat":return q(k(d(t.left),([e,n])=>[e,z(n,t.right)]),()=>d(t.right));case "Flatten":return K(d(t.stream),([e,n])=>q(k(d(e),([r,o])=>[r,z(o,V(n))]),()=>d(V(n))));case "Merge":return U(t.left,t.right,t.flip);case "Scoped":return p((e,n)=>{let r=G(),o=new I(r);o.addFinalizer(a=>t.release(a)),o.fork(t.acquire).join(a=>{if(a._tag==="Failure"){o.close(a),n({_tag:"Failure",error:w(a.error)});return}let i=a.value;d(i)(e,c=>{o.close(c),n(c);});});})}}function Se(t,e){throw new Error(e??`Unexpected value: ${String(t)}`)}function S(t,e){switch(t._tag){case "Empty":return M();case "Emit":return ae(k(t.value,e));case "FromPull":return x(k(t.pull,([n,r])=>[e(n),S(r,e)]));case "Concat":return z(S(t.left,e),S(t.right,e));case "Flatten":{let n=S(t.stream,r=>S(r,e));return V(n)}case "Merge":return ge(S(t.left,e),S(t.right,e),t.flip);case "Scoped":return oe(k(t.acquire,n=>S(n,e)),t.release);default:return Se(t)}}function Ct(t,e){let n=r=>x(r>e?f(F):E([r,n(r+1)]));return n(t)}function xe(t,e){let n=R(b(d(t),r=>J(r)),r=>f(r),([r,o])=>R(b(d(e),a=>J(a)),a=>f(a),([a,i])=>E([[r,a],xe(o,i)])));return x(n)}function Nt(t,e){let n=r=>R(b(d(r),o=>J(o)),o=>o._tag==="None"?E(void 0):f(o),([o,a])=>A(b(e(o),i=>w(i)),()=>n(a)));return R(n(t),r=>r._tag==="None"?E(void 0):f(r.value),()=>E(void 0))}function Bt(t){let e=M();for(let n=t.length-1;n>=0;n--){let r=ae(j(t[n]));e=z(r,e);}return e}function Pt(t){let e=(n,r)=>R(d(n),o=>o._tag==="None"?j(r):C(o),([o,a])=>e(a,[...r,o]));return H(e(t,[]),n=>{if(n._tag==="Some")return n.value;throw new Error("unreachable: stream end handled as success")})}function ve(t,e){let n=p((r,o)=>{t.read().then(({done:a,value:i})=>{if(a){o({_tag:"Failure",error:F});return}o({_tag:"Success",value:[i,x(n)]});}).catch(a=>{o({_tag:"Failure",error:w(e(a))});});});return x(n)}function Tt(t,e){if(!t)return M();let n;return oe($(()=>(n=t.getReader(),ve(n,e))),()=>_(()=>{try{n?.cancel();}catch{}}))}exports.$=oe;exports.A=Te;exports.B=ie;exports.C=N;exports.D=L;exports.E=B;exports.F=T;exports.G=D;exports.H=pe;exports.I=O;exports.J=Ye;exports.K=et;exports.L=tt;exports.M=nt;exports.N=rt;exports.O=ot;exports.P=at;exports.Q=ye;exports.R=G;exports.S=I;exports.T=ut;exports.U=lt;exports.V=dt;exports.W=yt;exports.X=Rt;exports.Y=ne;exports.Z=J;exports._=x;exports.a=R;exports.aa=Ot;exports.b=be;exports.ba=ge;exports.c=b;exports.ca=M;exports.d=Z;exports.da=ae;exports.e=E;exports.ea=z;exports.f=f;exports.fa=V;exports.g=_;exports.ga=Zt;exports.h=Fe;exports.ha=d;exports.i=p;exports.ia=Se;exports.j=Q;exports.ja=S;exports.k=A;exports.ka=Ct;exports.l=ke;exports.la=xe;exports.m=Ie;exports.ma=Nt;exports.n=_e;exports.na=Bt;exports.o=we;exports.oa=Pt;exports.p=Oe;exports.pa=Tt;exports.q=F;exports.r=w;exports.s=j;exports.t=C;exports.u=$;exports.v=k;exports.w=K;exports.x=H;exports.y=Pe;exports.z=q;
|
package/dist/chunk-ZXK3XM2Q.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function R(t,e,n){return {_tag:"Fold",first:t,onFailure:e,onSuccess:n}}function be(t,e){return R(t,n=>e(n),n=>E(n))}function b(t,e){return R(t,n=>f(e(n)),n=>E(n))}var Z=()=>E(void 0),E=t=>({_tag:"Succeed",value:t}),f=t=>({_tag:"Fail",error:t}),_=t=>({_tag:"Sync",thunk:t}),Fe=t=>_(()=>t()),p=t=>({_tag:"Async",register:t});function Q(t,e){return A(t,n=>E(e(n)))}function A(t,e){return {_tag:"FlatMap",first:t,andThen:e}}function ke(t,e,n){return A(t,r=>(n.addFinalizer(o=>e(r,o)),E(r)))}function Ie(t){return p(t)}var _e=t=>e=>{let n=e;return n.toPromise||(n.toPromise=r=>t(e,r),n.unsafeRunPromise=()=>t(e,{})),n},we=(t,e)=>A(t,n=>E(e(n))),Oe=(t,e)=>A(t,n=>_(()=>e(n)));var F={_tag:"None"},w=t=>({_tag:"Some",value:t});var j=t=>E(t),C=t=>f(t),$=t=>_(e=>t(e)),k=(t,e)=>Q(t,e),K=(t,e)=>A(t,n=>e(n)),H=(t,e)=>b(t,e),Pe=(t,e)=>R(t,n=>e(n),n=>E(n));function q(t,e){return R(t,n=>n._tag==="Some"?f(n):e(),n=>E(n))}var Te=()=>C(F);var ie=(r=>(r[r.Ok=0]="Ok",r[r.Grew=1]="Grew",r[r.Dropped=2]="Dropped",r))(ie||{}),N=class{buf;head=0;tail=0;size_=0;maxCap;constructor(e=1024,n=e){let r=Math.max(2,this.nextPow2(e)),o=Math.max(r,this.nextPow2(n));this.buf=new Array(r),this.maxCap=o;}get length(){return this.size_}get capacity(){return this.buf.length}isEmpty(){return this.size_===0}push(e){return this.size_===this.buf.length?this.buf.length>=this.maxCap?2:(this.grow(),this.buf[this.tail]=e,this.tail=this.tail+1&this.buf.length-1,this.size_++,1):(this.buf[this.tail]=e,this.tail=this.tail+1&this.buf.length-1,this.size_++,0)}shift(){if(this.size_===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=this.head+1&this.buf.length-1,this.size_--,e}clear(){this.buf.fill(void 0),this.head=0,this.tail=0,this.size_=0;}grow(){let e=this.buf,n=Math.min(e.length*2,this.maxCap),r=new Array(n);for(let o=0;o<this.size_;o++)r[o]=e[this.head+o&e.length-1];this.buf=r,this.head=0,this.tail=this.size_;}nextPow2(e){let n=1;for(;n<e;)n<<=1;return n}};var X=2048,Y=4096,se=(()=>{if(typeof globalThis.setImmediate=="function")return t=>globalThis.setImmediate(t);if(typeof globalThis.MessageChannel=="function"){let t=new globalThis.MessageChannel,e=null;return t.port1.onmessage=()=>{let n=e;e=null,n?.();},n=>{e=n,t.port2.postMessage(0);}}return t=>setTimeout(t,0)})(),L=class{queue=new N(1024);flushing=false;scheduled=false;schedule(e,n="anonymous"){if(typeof e=="function"&&(this.queue.push({tag:n,task:e}),!this.flushing&&!this.scheduled)){this.scheduled=true;let r=this.queue.length>Y?"macro":"micro";this.requestFlush(r);}}requestFlush(e){e==="micro"?queueMicrotask(()=>this.flush()):se(()=>this.flush());}flush(){if(this.flushing)return;this.flushing=true,this.scheduled=false;let e=0;try{for(;e<X;){let n=this.queue.shift();if(!n)break;e++;try{n.task();}catch(r){console.error(`[Scheduler] task threw (tag=${n.tag})`,r);}}}finally{if(this.flushing=false,this.queue.length>0&&!this.scheduled){this.scheduled=true;let n=e>=X||this.queue.length>Y?"macro":"micro";this.requestFlush(n);}}}},B=new L;var P=null,h={CONTINUE:"Continue",SUSPEND:"Suspend",DONE:"Done"},g={QUEUED:"Queued",RUNNING:"Running",SUSPENDED:"Suspended",DONE:"Done"},ce=1,ue=1024;function le(t){let e=t;for(;e._tag==="FlatMap"&&e.first._tag==="FlatMap";){let n=e.first,r=e.andThen;e={_tag:"FlatMap",first:n.first,andThen:o=>({_tag:"FlatMap",first:n.andThen(o),andThen:r})};}return e}var T=class{id;runtime;closing=null;finishing=false;runState=g.RUNNING;interrupted=false;result=null;joiners=[];current;stack=[];fiberFinalizers=[];finalizersDrained=false;fiberContext;name;scopeId;constructor(e,n){this.id=ce++,this.runtime=e,this.current=n;}get env(){return this.runtime.env}get scheduler(){return this.runtime.scheduler}addFinalizer(e){this.fiberFinalizers.push(e);}status(){return this.result==null?"Running":this.interrupted?"Interrupted":"Done"}join(e){this.result!=null?e(this.result):this.joiners.push(e);}interrupt(){this.result==null&&(this.interrupted||(this.interrupted=true,this.schedule("interrupt-step")));}schedule(e="step"){this.runState===g.DONE||this.runState===g.QUEUED||(this.runState=g.QUEUED,this.scheduler.schedule(()=>{pe(this,()=>{if(this.runState===g.DONE)return;switch(this.runState=g.RUNNING,this.step()){case h.CONTINUE:this.schedule("continue");return;case h.SUSPEND:this.runState=g.SUSPENDED;return;case h.DONE:this.runState=g.DONE;return}});},`fiber#${this.id}.${e}`));}runFinalizersOnce(e){if(!this.finalizersDrained)for(this.finalizersDrained=true;this.fiberFinalizers.length>0;){let n=this.fiberFinalizers.pop();try{n(e);}catch{}}}notify(e){if(this.result==null&&this.closing==null){this.finishing=true,this.closing=e,this.runFinalizersOnce(e),this.result=e;for(let n of this.joiners)n(e);this.joiners.length=0;}}onSuccess(e){let n=this.stack.pop();if(!n){this.notify({_tag:"Success",value:e});return}this.current=n._tag==="SuccessCont"?n.k(e):n.onSuccess(e);}onFailure(e){for(;this.stack.length>0;){let n=this.stack.pop();if(n._tag==="FoldCont"){this.current=n.onFailure(e);return}}this.notify({_tag:"Failure",error:e});}step(){let e=ue;for(;e-- >0;){if(this.result!=null)return h.DONE;if(this.interrupted&&this.closing==null)return this.notify({_tag:"Failure",error:{_tag:"Interrupted"}}),h.DONE;let n=le(this.current);switch(n._tag){case "Succeed":{this.onSuccess(n.value);break}case "Fail":{this.onFailure(n.error);break}case "Sync":{try{let r=n.thunk(this.env);this.onSuccess(r);}catch(r){this.onFailure(r);}break}case "FlatMap":{this.stack.push({_tag:"SuccessCont",k:n.andThen}),this.current=n.first;break}case "Fold":{this.stack.push({_tag:"FoldCont",onFailure:n.onFailure,onSuccess:n.onSuccess}),this.current=n.first;break}case "Async":{if(this.finishing)return this.result!=null?h.DONE:h.CONTINUE;let r=false,o=i=>{r||(r=true,!(this.result!=null||this.closing!=null)&&(this.current=i._tag==="Success"?{_tag:"Succeed",value:i.value}:{_tag:"Fail",error:i.error},this.schedule("async-resume")));},a=n.register(this.env,o);return typeof a=="function"&&this.addFinalizer(()=>{r=true;try{a();}catch{}}),h.SUSPEND}}}return this.result!=null?h.DONE:h.CONTINUE}};function D(){return P}function pe(t,e){let n=P;P=t;try{return e()}finally{P=n;}}var ee={parent:null,patch:Object.create(null)};function te(t,e){let n=Ee(t);return {initChild(r,o){let a=o?.fiberContext,i=Ae(n,a?.trace??null);r.fiberContext={log:a?.log??ee,trace:i},r.parentFiberId=o?.id,r.name=n.childName(o?.name),e.emit({type:"fiber.start",fiberId:r.id,parentFiberId:o?.id,name:r.name},{fiberId:o?.id,traceId:a?.trace?.traceId,spanId:a?.trace?.spanId});}}}function Ee(t){let e={newTraceId:()=>crypto.randomUUID(),newSpanId:()=>crypto.randomUUID()},n=t?.brass,r=n?.tracer??e,o=n?.traceSeed,a=n?.childName??(i=>i?`${i}/child`:void 0);return {tracer:r,seed:o,childName:a}}function Ae(t,e){return e?{traceId:e.traceId,spanId:t.tracer.newSpanId(),parentSpanId:e.spanId,sampled:e.sampled}:t.seed?{...t.seed}:{traceId:t.tracer.newTraceId(),spanId:t.tracer.newSpanId(),sampled:true}}var de={emit(){}},O=class t{env;scheduler;hooks;forkPolicy;constructor(e){this.env=e.env,this.scheduler=e.scheduler??B,this.hooks=e.hooks??de,this.forkPolicy=te(this.env,this.hooks);}fork(e){let n=D(),r=new T(this,e);return this.forkPolicy.initChild(r,n),r.schedule("initial-step"),r}unsafeRunAsync(e,n){this.fork(e).join(n);}toPromise(e){return new Promise((n,r)=>{this.fork(e).join(a=>{let i=a;i._tag==="Success"?n(i.value):r(i.error);});})}log(e,n,r){this.emit({type:"log",level:e,message:n,fields:r});}withHooks(e){return new t({env:this.env,scheduler:this.scheduler,hooks:e})}emit(e){let n=D(),r={fiberId:n?.id,scopeId:n?.scope?.id,traceId:n?.fiberContext?.trace?.traceId,spanId:n?.fiberContext?.trace?.spanId};this.hooks.emit(e,r);}static make(e,n=B){return new t({env:e,scheduler:n})}};function Ye(t){return p((e,n)=>{let r=false,o=s=>{r||(r=true,n(s));},a=s=>o({_tag:"Failure",error:s instanceof Error?s:new Error(String(s))}),i=s=>o({_tag:"Success",value:s});try{typeof t=="function"&&t.length>=1?t((s,c)=>s?a(s):i(c)):t().then(i,a);}catch(s){a(s);}})}function et(t,e,n=B){return new O({env:e,scheduler:n}).fork(t)}function tt(t,e,n){return new O({env:e}).unsafeRunAsync(t,n)}function nt(t,e){return new O({env:e}).toPromise(t)}function rt(t,e){return p((n,r)=>{t(n).then(o=>r({_tag:"Success",value:o})).catch(o=>r({_tag:"Failure",error:e(o)}));})}function ot(t){return p((e,n)=>{let r=false,o=a=>{r||(r=true,n(a));};try{t((a,i)=>{o(a?{_tag:"Failure",error:a}:{_tag:"Success",value:i});});}catch(a){o({_tag:"Failure",error:a instanceof Error?a:new Error(String(a))});}})}function at(t){return ye((n,r)=>t.length===1?t(r):t(n,r),n=>Re(n)?{_tag:"Abort"}:{_tag:"PromiseRejected",reason:n})}function ye(t,e){return p((n,r)=>{let o=new AbortController,a=false,i=s=>{a||(a=true,r(s));};try{(t.length===1?t(o.signal):t(n,o.signal)).then(c=>i({_tag:"Success",value:c})).catch(c=>i({_tag:"Failure",error:e(c)}));}catch(s){i({_tag:"Failure",error:e(s)});}return ()=>{a=true,o.abort();}})}var Re=t=>typeof t=="object"&&t!==null&&"name"in t&&t.name==="AbortError";function G(){let t=D();if(!t)throw new Error("No current runtime: est\xE1s llamando esto fuera de un fiber (fuera del runtime).");return t.runtime}var me=1;function fe(t){return p((e,n)=>{let r=t.length;if(r===0){n({_tag:"Success",value:void 0});return}for(let o of t)o.join(()=>{r-=1,r===0&&n({_tag:"Success",value:void 0});});})}function he(t){return R(t,()=>Z(),()=>Z())}var I=class t{constructor(e){this.runtime=e;this.id=me++;}id;closed=false;children=new Set;subScopes=new Set;finalizers=[];get env(){return this.runtime.env}addFinalizer(e){if(this.closed)throw new Error("Trying to add finalizer to closed scope");this.finalizers.push(e);}subScope(){if(this.closed)throw new Error("Scope closed");let e=new t(this.runtime);return this.subScopes.add(e),e}fork(e){if(this.closed)throw new Error("Scope closed");let n=this.runtime.fork(e);return this.children.add(n),n.join(()=>{this.children.delete(n);}),n}close(e={_tag:"Success",value:void 0}){this.runtime.fork(this.closeAsync(e));}closeAsync(e={_tag:"Success",value:void 0},n={}){return p((r,o)=>{if(this.closed){o({_tag:"Success",value:void 0});return}this.closed=true;let a=Array.from(this.children),i=Array.from(this.subScopes);this.children.clear(),this.subScopes.clear();for(let l of a)try{l.interrupt();}catch{}let s=Z();for(let l of i)s=A(s,()=>l.closeAsync(e,n));for(;this.finalizers.length>0;){let l=this.finalizers.pop();s=A(s,()=>he(l(e)));}n.awaitChildren&&(s=A(s,()=>fe(a))),this.runtime.fork(s).join(()=>o({_tag:"Success",value:void 0}));})}};function ut(t,e){let n=new I(t);try{return e(n)}finally{n.close();}}function lt(t,e){return p((n,r)=>{let o=new I(t);o.fork(e(o)).join(i=>{try{o.close(i);}catch(s){r({_tag:"Failure",error:s});return}r(i);});})}function dt(t,e,n){return p((r,o)=>{let a=n.subScope(),i=false,s=m=>{i||(i=true,a.close(m),o(m));},c=a.fork(t),l=a.fork(e);c.join(s),l.join(s);})}function yt(t,e,n){return p((r,o)=>{let a=n.subScope(),i=null,s=null,c=false,l=()=>{if(!i||!s||c)return;if(c=true,i._tag==="Success"&&s._tag==="Success"){a.close({_tag:"Success",value:void 0}),o({_tag:"Success",value:[i.value,s.value]});return}let u;if(i._tag==="Failure")u=i.error;else if(s._tag==="Failure")u=s.error;else throw new Error("zipPar: unreachable state (no Failure exit)");let v={_tag:"Failure",error:u};a.close(v),o(v);},m=a.fork(t),y=a.fork(e);m.join(u=>{i=u,l();}),y.join(u=>{s=u,l();});})}function Rt(t,e){return p((n,r)=>{let o=e.subScope(),a=new Array(t.length),i=0,s=false;t.forEach((c,l)=>{o.fork(c).join(y=>{if(!s){if(y._tag==="Failure"){s=true;let u={_tag:"Failure",error:y.error};o.close(u),r(u);return}if(a[l]=y.value,i++,i===t.length){s=true;let u={_tag:"Success",value:a};o.close({_tag:"Success",value:void 0}),r(u);}}});});})}function ne(t,e,n,r,o){return p((a,i)=>{let s=n.subScope(),c=false,l=s.fork(t),m=s.fork(e),y=u=>{s.fork(u).join(v=>{s.close(v),i(v);});};l.join(u=>{c||(c=true,y(r(u,m,s)));}),m.join(u=>{c||(c=true,y(o(u,l,s)));});})}var J=t=>t._tag==="None"?F:w(t.value),x=t=>({_tag:"FromPull",pull:t}),oe=(t,e)=>({_tag:"Scoped",acquire:t,release:e}),Ot=t=>({_tag:"Scoped",acquire:A(t,e=>E(e.stream)),release:e=>A(t,n=>n.release(e))}),ge=(t,e,n=true)=>({_tag:"Merge",left:t,right:e,flip:n}),M=()=>({_tag:"Empty"}),ae=t=>({_tag:"Emit",value:t}),z=(t,e)=>({_tag:"Concat",left:t,right:e}),V=t=>({_tag:"Flatten",stream:t});function re(t,e,n,r,o){return (a,i,s)=>{if(a._tag,a._tag,a._tag==="Success"){let[m,y]=a.value;i.interrupt();let u=x(t==="L"?U(y,n):U(e,y));return E([m,u])}let c=a.error;if(typeof c=="object"&&c!==null&&c._tag==="Interrupted")return f(c);let l=c;return l._tag==="None"?d(t==="L"?n:e):f(l)}}function U(t,e,n,r){return p((o,a)=>{let s=G(),c=new I(s),l=d(t),m=d(e),y=re("L",t,e),u=re("R",t,e),v=ne(l,m,c,y,u);c.fork(v).join(W=>{c.close(W),a(W);});})}function Zt(t,e){return x(U(t,e))}function d(t){switch(t._tag){case "Empty":return C(F);case "Emit":return k(H(t.value,e=>w(e)),e=>[e,M()]);case "FromPull":return t.pull;case "Concat":return q(k(d(t.left),([e,n])=>[e,z(n,t.right)]),()=>d(t.right));case "Flatten":return K(d(t.stream),([e,n])=>q(k(d(e),([r,o])=>[r,z(o,V(n))]),()=>d(V(n))));case "Merge":return U(t.left,t.right,t.flip);case "Scoped":return p((e,n)=>{let r=G(),o=new I(r);o.addFinalizer(a=>t.release(a)),o.fork(t.acquire).join(a=>{if(a._tag==="Failure"){o.close(a),n({_tag:"Failure",error:w(a.error)});return}let i=a.value;d(i)(e,c=>{o.close(c),n(c);});});})}}function Se(t,e){throw new Error(e??`Unexpected value: ${String(t)}`)}function S(t,e){switch(t._tag){case "Empty":return M();case "Emit":return ae(k(t.value,e));case "FromPull":return x(k(t.pull,([n,r])=>[e(n),S(r,e)]));case "Concat":return z(S(t.left,e),S(t.right,e));case "Flatten":{let n=S(t.stream,r=>S(r,e));return V(n)}case "Merge":return ge(S(t.left,e),S(t.right,e),t.flip);case "Scoped":return oe(k(t.acquire,n=>S(n,e)),t.release);default:return Se(t)}}function Ct(t,e){let n=r=>x(r>e?f(F):E([r,n(r+1)]));return n(t)}function xe(t,e){let n=R(b(d(t),r=>J(r)),r=>f(r),([r,o])=>R(b(d(e),a=>J(a)),a=>f(a),([a,i])=>E([[r,a],xe(o,i)])));return x(n)}function Nt(t,e){let n=r=>R(b(d(r),o=>J(o)),o=>o._tag==="None"?E(void 0):f(o),([o,a])=>A(b(e(o),i=>w(i)),()=>n(a)));return R(n(t),r=>r._tag==="None"?E(void 0):f(r.value),()=>E(void 0))}function Bt(t){let e=M();for(let n=t.length-1;n>=0;n--){let r=ae(j(t[n]));e=z(r,e);}return e}function Pt(t){let e=(n,r)=>R(d(n),o=>o._tag==="None"?j(r):C(o),([o,a])=>e(a,[...r,o]));return H(e(t,[]),n=>{if(n._tag==="Some")return n.value;throw new Error("unreachable: stream end handled as success")})}function ve(t,e){let n=p((r,o)=>{t.read().then(({done:a,value:i})=>{if(a){o({_tag:"Failure",error:F});return}o({_tag:"Success",value:[i,x(n)]});}).catch(a=>{o({_tag:"Failure",error:w(e(a))});});});return x(n)}function Tt(t,e){if(!t)return M();let n;return oe($(()=>(n=t.getReader(),ve(n,e))),()=>_(()=>{try{n?.cancel();}catch{}}))}export{oe as $,Te as A,ie as B,N as C,L as D,B as E,T as F,D as G,pe as H,O as I,Ye as J,et as K,tt as L,nt as M,rt as N,ot as O,at as P,ye as Q,G as R,I as S,ut as T,lt as U,dt as V,yt as W,Rt as X,ne as Y,J as Z,x as _,R as a,Ot as aa,be as b,ge as ba,b as c,M as ca,Z as d,ae as da,E as e,z as ea,f,V as fa,_ as g,Zt as ga,Fe as h,d as ha,p as i,Se as ia,Q as j,S as ja,A as k,Ct as ka,ke as l,xe as la,Ie as m,Nt as ma,_e as n,Bt as na,we as o,Pt as oa,Oe as p,Tt as pa,F as q,w as r,j as s,C as t,$ as u,k as v,K as w,H as x,Pe as y,q as z};
|
package/dist/http/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {Q as Q$1,pa,a,p,n,f,k as k$1,e,M as M$1}from'../chunk-ZXK3XM2Q.mjs';var b={make(t,e){return {get:t,set:e}},over(t,e){return r=>t.set(e(t.get(r)))(r)},compose(t,e){return b.make(r=>t.get(e.get(r)),r=>n=>e.set(t.set(r)(e.get(n)))(n))}};var A={headers:b.make(t=>t.headers??{},t=>e=>({...e,headers:t}))};var I=t=>e=>b.over(A.headers,r=>({...r,...t}))(e),C=t=>e=>b.over(A.headers,r=>({...t,...r}))(e),g=(t,e)=>r=>b.over(A.headers,n=>n[t]?n:{...n,[t]:e})(r);var v=t=>typeof t=="object"&&t!==null&&"_tag"in t,J=t=>v(t)?t:typeof t=="object"&&t!==null&&t.name==="AbortError"?{_tag:"Abort"}:{_tag:"FetchError",message:String(t)},M=t=>Q$1(e=>new Promise((r,n)=>{if(e.aborted)return n({_tag:"Abort"});let u=setTimeout(r,t),p=()=>{clearTimeout(u),n({_tag:"Abort"});};e.addEventListener("abort",p,{once:true});}),J);var lt=t=>e=>T(t(e)),T=t=>Object.assign((e=>t(e)),{with:e=>T(e(t))}),O=t=>t instanceof DOMException&&t.name==="AbortError"?{_tag:"Abort"}:typeof t=="object"&&t&&"_tag"in t?t:{_tag:"FetchError",message:String(t)},k=t=>{if(t){if(typeof Headers<"u"&&t instanceof Headers){let e={};return t.forEach((r,n)=>e[n]=r),e}if(Array.isArray(t))return Object.fromEntries(t);if(typeof t=="object")return {...t}}},D=t=>e=>{let r=Object.keys(t).length?C(t)(e):e,n=k(e.init?.headers);return n&&Object.keys(n).length&&(r=C(n)(r)),r};function N(t={}){let e=t.baseUrl??"",r=t.headers??{},n=D(r);return u=>Q$1(async p=>{let y=n(u),i;try{i=new URL(y.url,e);}catch{throw {_tag:"BadUrl",message:`URL inv\xE1lida: ${y.url}`}}let a=performance.now(),s=await fetch(i,{...y.init??{},method:y.method,headers:A.headers.get(y),body:y.body,signal:p}),c={};s.headers.forEach((d,m)=>c[m]=d);let o=pa(s.body,O);return {status:s.status,statusText:s.statusText,headers:c,body:o,ms:Math.round(performance.now()-a)}},O)}function _(t={}){let e=t.baseUrl??"",r=t.headers??{},n=D(r);return T(p=>Q$1(async y=>{let i=n(p),a;try{a=new URL(i.url,e);}catch{throw {_tag:"BadUrl",message:`URL inv\xE1lida: ${i.url}`}}let s=performance.now(),c=await fetch(a,{...i.init??{},method:i.method,headers:A.headers.get(i),body:i.body,signal:y}),o=await c.text(),d={};return c.headers.forEach((m,H)=>d[H]=m),{status:c.status,statusText:c.statusText,headers:d,bodyText:o,ms:Math.round(performance.now()-s)}},O))}var G=(t,e,r)=>Math.max(e,Math.min(r,t)),z=t=>t._tag==="FetchError",Z=t=>t===408||t===429||t===500||t===502||t===503||t===504,F=(t,e,r)=>{let n=e*Math.pow(2,t),u=G(n,0,r);return Math.floor(Math.random()*u)},$=t=>{let e=Object.keys(t).find(p=>p.toLowerCase()==="retry-after");if(!e)return;let r=t[e]?.trim();if(!r)return;let n=Number(r);if(Number.isFinite(n))return Math.max(0,Math.floor(n*1e3));let u=Date.parse(r);if(Number.isFinite(u))return Math.max(0,u-Date.now())},U=t=>e$1=>(r=>{let n=u=>a(e$1(r),p=>{if(p._tag==="Abort"||p._tag==="BadUrl")return f(p);if(!(u<t.maxRetries&&(t.retryOnError??z)(p)))return f(p);let i=F(u,t.baseDelayMs,t.maxDelayMs);return k$1(M(i),()=>n(u+1))},p=>{if(!(u<t.maxRetries&&(t.retryOnStatus??Z)(p.status)))return e(p);let a=$(p.headers)??F(u,t.baseDelayMs,t.maxDelayMs);return k$1(M(a),()=>n(u+1))});return n(0)});var K=["GET","HEAD","OPTIONS"],Q=t=>t===408||t===429||t===500||t===502||t===503||t===504,V=t=>t._tag==="FetchError";var X=(t,e,r)=>Math.max(e,Math.min(r,t)),L=(t,e,r)=>{let n=Math.max(0,e),u=Math.max(0,r),p=n*Math.pow(2,t),y=X(p,0,u);return Math.floor(Math.random()*y)},Y=(t,e)=>{let r=Object.keys(t).find(n=>n.toLowerCase()===e.toLowerCase());return r?t[r]:void 0},tt=t=>{let e=Y(t,"retry-after")?.trim();if(!e)return;let r=Number(e);if(Number.isFinite(r))return Math.max(0,Math.floor(r*1e3));let n=Date.parse(e);if(Number.isFinite(n))return Math.max(0,n-Date.now())},j=t=>e$1=>{let r=t.retryOnMethods??K,n=t.retryOnStatus??Q,u=t.retryOnError??V,p=i=>r.includes(i.method),y=(i,a$1)=>p(i)?a(e$1(i),s=>{if(s._tag==="Abort"||s._tag==="BadUrl")return f(s);if(!(a$1<t.maxRetries&&u(s)))return f(s);let o=L(a$1,t.baseDelayMs,t.maxDelayMs);return k$1(M(o),()=>y(i,a$1+1))},s=>{if(!(a$1<t.maxRetries&&n(s.status)))return e(s);let d=tt(s.headers)??L(a$1,t.baseDelayMs,t.maxDelayMs);return k$1(M(d),()=>y(i,a$1+1))}):e$1(i);return i=>y(i,0)};var et=(t,e)=>{try{return new URL(e,t??"").toString()}catch{return (t??"")+e}},B=(t={})=>{let e=_(t),r=a=>n((s,c)=>M$1(s,c))(a),n$1=a=>e(a),u=a=>{let{headers:s,...c}=a??{};return {headers:k(s),init:c}},p=a=>s=>a?I(a)(s):s;return {cfg:t,wire:e,withPromise:r,requestRaw:n$1,splitInit:u,applyInitHeaders:p,buildReq:(a,s,c,o)=>{let d=u(c),m={method:a,url:s,...o&&o.length>0?{body:o}:{},init:d.init};return p(d.headers)(m)},toResponse:(a,s)=>({status:a.status,statusText:a.statusText,headers:a.headers,body:s})}};function _t(t={}){let e=B(t),r=n=>{let u=o=>n(o),p$1=o=>e.withPromise(u(o));return {request:p$1,get:(o,d)=>p$1(e.buildReq("GET",o,d)),post:(o,d,m)=>p$1(e.buildReq("POST",o,m,d)),getText:(o,d)=>{let m=e.buildReq("GET",o,d);return e.withPromise(p(u(m),H=>e.toResponse(H,H.bodyText)))},getJson:(o,d)=>{let m=e.buildReq("GET",o,d),H=g("accept","application/json")(m);return e.withPromise(p(u(H),l=>e.toResponse(l,JSON.parse(l.bodyText))))},postJson:(o,d,m)=>{let H=e.buildReq("POST",o,m,JSON.stringify(d??{})),l=g("content-type","application/json")(g("accept","application/json")(H));return e.withPromise(p(u(l),P=>e.toResponse(P,JSON.parse(P.bodyText))))},with:o=>r(n.with(o)),withRetry:o=>r(n.with(j(o))),wire:n}};return r(e.wire)}function Ut(t={}){let e=B(t),r=(s,c,o)=>({request:s,urlFinal:et(e.cfg.baseUrl,s.url),startedAt:o,durationMs:c.ms}),n=s=>{let c=Date.now();return e.withPromise(p(e.requestRaw(s),o=>({wire:o,meta:r(s,o,c)})))};return {request:n,get:(s,c)=>{let o=e.buildReq("GET",s,c);return n(o)},getText:(s,c)=>{let o=e.buildReq("GET",s,c),d=Date.now();return e.withPromise(p(e.requestRaw(o),m=>({wire:m,response:e.toResponse(m,m.bodyText),meta:r(o,m,d)})))},getJson:(s,c)=>{let o=e.buildReq("GET",s,c),d=g("accept","application/json")(o),m=Date.now();return e.withPromise(p(e.requestRaw(d),H=>({wire:H,response:e.toResponse(H,JSON.parse(H.bodyText)),meta:r(d,H,m)})))},post:(s,c,o)=>{let d=e.buildReq("POST",s,o,c);return n(d)},postJson:(s,c,o)=>{let d=e.buildReq("POST",s,o,JSON.stringify(c??{})),m=g("content-type","application/json")(g("accept","application/json")(d)),H=Date.now();return e.withPromise(p(e.requestRaw(m),l=>({wire:l,response:e.toResponse(l,JSON.parse(l.bodyText)),meta:r(m,l,H)})))}}}function Lt(t={}){let e=N(t),r=n$1=>{let u=i=>n((a,s)=>M$1(a,s))(i),p=i=>u(n$1(i)),y=(i,a)=>{let s={method:"GET",url:i,init:a},c=g("accept","*/*")(s);return p(c)};return {request:p,getStream:y,get:y,with:i=>r(i(n$1)),withRetry:i=>r(U(i)(n$1)),wire:n$1}};return r(e)}export{T as decorate,_t as httpClient,Lt as httpClientStream,Ut as httpClientWithMeta,_ as makeHttp,N as makeHttpStream,k as normalizeHeadersInit,lt as withMiddleware,U as withRetryStream};
|
package/dist/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {g,C,i,_,h,k,e,ma,aa,c,q,ca,K,r,a,ha,f,Z}from'./chunk-ZXK3XM2Q.mjs';export{B as PushStatus,C as RingBuffer,I as Runtime,F as RuntimeFiber,D as Scheduler,S as Scope,l as acquireRelease,ia as assertNever,i as async,b as asyncCatchAll,f as asyncFail,k as asyncFlatMap,a as asyncFold,m as asyncInterruptible,j as asyncMap,c as asyncMapError,e as asyncSucceed,g as asyncSync,h as asyncTotal,y as catchAll,X as collectAllPar,oa as collectStream,ea as concatStream,da as emitStream,ca as emptyStream,A as end,t as fail,w as flatMap,fa as flattenStream,ma as foreachStream,K as fork,J as from,na as fromArray,O as fromCallback,N as fromPromise,Q as fromPromiseAbortable,_ as fromPull,G as getCurrentFiber,R as getCurrentRuntime,E as globalScheduler,aa as managedStream,v as map,o as mapAsync,x as mapError,ja as mapStream,p as mapTryAsync,ga as merge,ba as mergeStream,q as none,z as orElseOptional,V as race,Y as raceWith,ka as rangeStream,r as some,pa as streamFromReadableStream,s as succeed,u as sync,M as toPromise,P as tryPromiseAbortable,ha as uncons,d as unit,L as unsafeRunAsync,$ as unwrapScoped,Z as widenOpt,n as withAsyncPromise,H as withCurrentFiber,T as withScope,U as withScopeAsync,la as zip,W as zipPar}from'./chunk-ZXK3XM2Q.mjs';function ze(){let t=false,e=new Set;return {isCancelled:()=>t,onCancel:r=>{if(t){try{r();}catch{}return ()=>{}}return e.add(r),()=>{e.delete(r);}},cancel:()=>{t||(t=true,e.forEach(r=>r()),e.clear());}}}function De(t,e){return t.onCancel(()=>e.abort())}var v=class{head=null;tail=null;len=0;get length(){return this.len}isEmpty(){return this.len===0}push(e){let n={value:e,next:null,prev:this.tail,removed:false};return this.tail?this.tail.next=n:this.head=n,this.tail=n,this.len++,n}shift(){let e=this.head;if(e)return this.unlink(e),e.value}remove(e){e.removed||this.unlink(e);}unlink(e){e.removed=true;let{prev:n,next:r}=e;n?n.next=r:this.head=r,r?r.prev=n:this.tail=n,e.next=null,e.prev=null,this.len--;}};function w(t,e="backpressure"){return g(()=>M(t,e))}function M(t,e){let n=new C(t),r=false,s={_tag:"QueueClosed"},o=new v,a=new v,l=()=>{for(;a.length>0&&n.length>0;){let u=a.shift(),f=n.shift();u({_tag:"Success",value:f});}for(;o.length>0&&n.length<t&&a.length===0;){let u=o.shift();n.push(u.a),u.cb(true);}for(;a.length>0&&o.length>0;){let u=a.shift(),f=o.shift();f.cb(true),u({_tag:"Success",value:f.a});}};return {size:()=>n.length,shutdown:()=>{if(!r){for(r=true;a.length>0;)a.shift()({_tag:"Failure",error:s});for(;o.length>0;)o.shift().cb(false);n.clear();}},offer:u=>i((f,i)=>{if(r){i({_tag:"Success",value:false});return}if(a.length>0){a.shift()({_tag:"Success",value:u}),i({_tag:"Success",value:true});return}if(n.length<t){n.push(u),i({_tag:"Success",value:true}),l();return}if(e==="dropping"){i({_tag:"Success",value:false});return}if(e==="sliding"){n.shift(),n.push(u),i({_tag:"Success",value:true}),l();return}let A=o.push({a:u,cb:m=>i({_tag:"Success",value:m})});return ()=>{o.remove(A);}}),take:()=>i((u,f)=>{if(n.length>0){let m=n.shift();f({_tag:"Success",value:m}),l();return}if(o.length>0){let m=o.shift();m.cb(true),f({_tag:"Success",value:m.a});return}if(r){f({_tag:"Failure",error:s});return}let i=m=>f(m),A=a.push(i);return ()=>{a.remove(A);}})}}function F(t,e$1,n="backpressure"){let r$1=false,s=null,o=null,a$1=t,l=()=>a(ha(a$1),i=>e(i._tag==="None"?{_tag:"End"}:{_tag:"Fail",error:i.value}),([i,A])=>g(()=>(a$1=A,{_tag:"Elem",value:i}))),p=i=>k(w(e$1,n),A=>{s=A;let S=()=>k(l(),m=>k(s.offer(m),()=>m._tag==="End"||m._tag==="Fail"?e(void 0):S()));return o=K(S(),i),r$1=true,e(void 0)}),u={_tag:"Async",register:(i,A)=>{(()=>{if(!r$1){K(p(i),i).join(()=>{f(i,A);});return}f(i,A);})();}};function f(i,A){let S=s.take();K(S,i).join(m=>{if(m._tag!=="Success")return;let _$1=m.value;switch(_$1._tag){case "Elem":A({_tag:"Success",value:[_$1.value,_(u)]});return;case "End":o?.interrupt?.(),A({_tag:"Failure",error:q});return;case "Fail":o?.interrupt?.(),A({_tag:"Failure",error:r(_$1.error)});return}});}return _(u)}var I=t=>t==="BackPressure"?"backpressure":t==="Dropping"?"dropping":"sliding";function N(t,e$1="BackPressure"){let n=new Set,r=false,s=p=>{if(r)return e(false);let u=Array.from(n),f=e(true);return u.forEach(i=>{f=k(f,A=>k(i.offer(p),S=>e(A&&S)));}),f};return {publish:s,publishAll:p=>{let u=e(true),f=p[Symbol.iterator]();for(;;){let i=f.next();if(i.done)break;let A=i.value;u=k(u,S=>k(s(A),m=>e(S&&m)));}return u},subscribe:()=>r?h(()=>{throw {_tag:"HubClosed"}}):k(w(t,I(e$1)),p=>g(()=>(n.add(p),{...p,unsubscribe:()=>{n.has(p)&&(n.delete(p),p.shutdown());}}))),shutdown:()=>g(()=>{r||(r=true,Array.from(n).forEach(p=>p.shutdown()),n.clear());})}}var yn=N;function dn(t,e$1){return ma(t,n=>k(e$1.publish(n),()=>e(void 0)))}function Rn(t){return aa(k(t.subscribe(),e$1=>{let n=_(k(c(e$1.take(),r=>q),r=>e([r,n])));return e({stream:n,release:r=>g(()=>e$1.unsubscribe())})}))}function _n(t,e){return e(t)}function z(t,e){return(n=>e(t(n)))}function Cn(t,e){return z(e,t)}function On(){return(t=>t)}function Pn(t){return(e$1=>{let n=r=>_(a(ha(r),s=>f(s),([s,o])=>e([t(s),n(o)])));return n(e$1)})}function Bn(t){return(e$1=>{let n=s=>a(ha(s),o=>f(o),([o,a])=>t(o)?e([o,r(a)]):n(a)),r=s=>_(n(s));return r(e$1)})}function Tn(t){return(e$1=>{let n=s=>a(ha(s),o=>f(o),([o,a])=>{let l=t(o);return l._tag==="Some"?e([l.value,r(a)]):n(a)}),r=s=>_(n(s));return r(e$1)})}function Hn(t){let e$1=Math.max(0,t|0);return(n=>{let r=(s,o)=>o<=0?ca():_(a(ha(s),a=>f(a),([a,l])=>e([a,r(l,o-1)])));return r(n,e$1)})}function Qn(t){let e=Math.max(0,t|0);return(n=>{let r=(s,o)=>o<=0?s:_(a(ha(s),a=>f(a),([a,l])=>ha(r(l,o-1))));return r(n,e)})}function D(t){return(e$1=>{let n=s=>c(s,o=>r(o)),r$1=s=>_(a(c(ha(s),o=>Z(o)),o=>f(o),([o,a$1])=>a(n(t(o)),l=>f(l),l=>e([l,r$1(a$1)]))));return r$1(e$1)})}function Fn(t){return D(e$1=>k(t(e$1),()=>e(e$1)))}function Mn(t,e="backpressure"){return(n=>F(n,t,e))}function In(t){let e$1=Math.max(1,t|0);return(n=>{let r=(o,a$1,l)=>a$1<=0?e({chunk:l,rest:o}):a(ha(o),p=>p._tag==="None"?e({chunk:l,rest:ca()}):f(p),([p,u])=>r(u,a$1-1,[...l,p])),s=o=>_(a(ha(o),a=>f(a),([a,l])=>k(r(l,e$1-1,[a]),({chunk:p,rest:u})=>e([p,s(u)]))));return s(n)})}export{v as LinkedQueue,z as andThen,w as bounded,yn as broadcast,dn as broadcastToHub,F as buffer,Mn as bufferP,Cn as compose,Qn as dropP,Tn as filterMapP,Bn as filterP,Rn as fromHub,In as groupedP,On as identity,De as linkAbortController,ze as makeCancelToken,N as makeHub,D as mapEffectP,Pn as mapP,Hn as takeP,Fn as tapEffectP,_n as via};
|