brass-runtime 1.12.0 → 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/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- import {h,F,j,_,i,l,f,ma,aa,d,r,ca,K,s,b,ha,g,Z as Z$1,N as N$1}from'./chunk-CNA5AQHG.mjs';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,ia as assertNever,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,oa as collectStream,ea as concatStream,da as emitStream,ca as emptyStream,D as end,w as fail,z as flatMap,fa as flattenStream,ma as foreachStream,N as fork,na as fromArray,Q as fromPromiseAbortable,_ as fromPull,J as getCurrentFiber,H as globalScheduler,aa as managedStream,y as map,p as mapAsync,A as mapError,ja as mapStream,q as mapTryAsync,ga as merge,ba as mergeStream,r as none,C as orElseOptional,V as race,Y as raceWith,ka as rangeStream,s as some,pa as streamFromReadableStream,v as succeed,x as sync,P as toPromise,ha as uncons,e as unit,K as unsafeGetCurrentRuntime,O as unsafeRunAsync,R as unsafeRunFoldWithEnv,$ as unwrapScoped,Z as widenOpt,o as withAsyncPromise,L as withCurrentFiber,U as withScope,T as withScopeAsync,la as zip,W as zipPar}from'./chunk-CNA5AQHG.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 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(ha(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,_(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 _(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 ma(t,n=>l(e.publish(n),()=>f(void 0)))}function Sn(t){return aa(l(t.subscribe(),e=>{let n=_(l(d(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(ha(r),s=>g(s),([s,o])=>f([t(s),n(o)])));return n(e)})}function Tn(t){return(e=>{let n=s=>b(ha(s),o=>g(o),([o,a])=>t(o)?f([o,r(a)]):n(a)),r=s=>_(n(s));return r(e)})}function Fn(t){return(e=>{let n=s=>b(ha(s),o=>g(o),([o,a])=>{let l=t(o);return l._tag==="Some"?f([l.value,r(a)]):n(a)}),r=s=>_(n(s));return r(e)})}function Hn(t){let e=Math.max(0,t|0);return(n=>{let r=(s,o)=>o<=0?ca():_(b(ha(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(ha(s),a=>g(a),([a,l])=>ha(r(l,o-1))));return r(n,e)})}function W(t){return(e=>{let n=s$1=>d(s$1,o=>s(o)),r=s=>_(b(d(ha(s),o=>Z$1(o)),o=>g(o),([o,a])=>b(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(ha(o),p=>p._tag==="None"?f({chunk:l,rest:ca()}):g(p),([p,u])=>r(u,a-1,[...l,p])),s=o=>_(b(ha(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};