Comparing version 1.0.9 to 1.1.2
@@ -1,7 +0,7 @@ | ||
{"total": {"lines":{"total":101,"covered":101,"skipped":0,"pct":100},"statements":{"total":118,"covered":118,"skipped":0,"pct":100},"functions":{"total":36,"covered":36,"skipped":0,"pct":100},"branches":{"total":32,"covered":32,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}} | ||
{"total": {"lines":{"total":103,"covered":103,"skipped":0,"pct":100},"statements":{"total":120,"covered":120,"skipped":0,"pct":100},"functions":{"total":41,"covered":41,"skipped":0,"pct":100},"branches":{"total":32,"covered":32,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}} | ||
,"/Users/fernandotolentino/workspace/teintinu/pjobs/src/asap.ts": {"lines":{"total":2,"covered":2,"skipped":0,"pct":100},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"statements":{"total":3,"covered":3,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}} | ||
,"/Users/fernandotolentino/workspace/teintinu/pjobs/src/defer.ts": {"lines":{"total":7,"covered":7,"skipped":0,"pct":100},"functions":{"total":5,"covered":5,"skipped":0,"pct":100},"statements":{"total":9,"covered":9,"skipped":0,"pct":100},"branches":{"total":2,"covered":2,"skipped":0,"pct":100}} | ||
,"/Users/fernandotolentino/workspace/teintinu/pjobs/src/index.ts": {"lines":{"total":4,"covered":4,"skipped":0,"pct":100},"functions":{"total":0,"covered":0,"skipped":0,"pct":100},"statements":{"total":5,"covered":5,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}} | ||
,"/Users/fernandotolentino/workspace/teintinu/pjobs/src/queue.ts": {"lines":{"total":85,"covered":85,"skipped":0,"pct":100},"functions":{"total":25,"covered":25,"skipped":0,"pct":100},"statements":{"total":98,"covered":98,"skipped":0,"pct":100},"branches":{"total":30,"covered":30,"skipped":0,"pct":100}} | ||
,"/Users/fernandotolentino/workspace/teintinu/pjobs/src/queue.ts": {"lines":{"total":87,"covered":87,"skipped":0,"pct":100},"functions":{"total":30,"covered":30,"skipped":0,"pct":100},"statements":{"total":100,"covered":100,"skipped":0,"pct":100},"branches":{"total":30,"covered":30,"skipped":0,"pct":100}} | ||
,"/Users/fernandotolentino/workspace/teintinu/pjobs/src/sleep.ts": {"lines":{"total":3,"covered":3,"skipped":0,"pct":100},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"statements":{"total":3,"covered":3,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}} | ||
} |
@@ -26,3 +26,3 @@ // Generated by dts-bundle-generator v6.2.0 | ||
readonly runned: number; | ||
state(): "idle" | QueueState; | ||
state(): "idle" | "finished" | QueueState; | ||
enqueue<T>(item: Job<T>): void; | ||
@@ -29,0 +29,0 @@ promise<T>(item: Job<T>): Promise<T>; |
@@ -1,1 +0,1 @@ | ||
var g=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var F=r=>g(r,"__esModule",{value:!0});var z=(r,n)=>{for(var i in n)g(r,i,{get:n[i],enumerable:!0})},J=(r,n,i,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of D(n))!Q.call(r,o)&&(i||o!=="default")&&g(r,o,{get:()=>n[o],enumerable:!(t=R(n,o))||t.enumerable});return r};var S=(r=>(n,i)=>r&&r.get(n)||(i=J(F({}),n,1),r&&r.set(n,i),i))(typeof WeakMap!="undefined"?new WeakMap:0);var M={};z(M,{asap:()=>h,defer:()=>b,queuePromises:()=>j,sleep:()=>q});function q(r){return new Promise(n=>{setTimeout(n,r)})}function b(){let r,n;return{promise:new Promise((t,o)=>{r=t,n=o}),resolve(t){r&&r(t)},reject(t){n&&n(t)}}}function h(r){setTimeout(()=>r(),1)}function j(r){let n=Math.max(1,r?.concurrency||1),i=r?.onProgress,t=[],o=0,f=!0,d=Date.now(),u=0,l=0,y=0,a,T=0,v={get size(){return o},get running(){return u},get pending(){return t.length},get done(){return o-t.length},get percent(){return Math.round((o-t.length)/o*1e3)/10},get rate(){let e=Date.now();if(e<l)return"-";let s=(e-d)/1e3;return(o-t.length)/s},get timeRemaining(){let e=Date.now();if(e<l)return"-";let s=(e-d)/1e3,c=(o-t.length)/s,m=(o-t.length)/c;if(m<2)return"one second";if(m<50)return m.toFixed(0)+" seconds";if(m<120)return"one minute";let p=m/60;if(p<60)return p.toFixed(0)+" minutes";let P=p/60;return p<120?"one hour":P.toFixed(0)+" hours"}};return{get runned(){return T},state(){return f?"idle":v},enqueue(e){t.push(e),o++,l=Date.now()+1e3,x()},promise(e){let s=b();return this.enqueue(()=>e().then(s.resolve,s.reject)),s.promise},waitFor(){return new Promise((e,s)=>{setTimeout(c,100);function c(){u+t.length===0?(a?s(a):e(),a=void 0):setTimeout(c,100)}})},setConcurrency(e){n=Math.max(e,1)},forceState(e){d=e.start,l=e.canRate,y=e.canRefresh,o=e.size}};function x(){f&&(d=Date.now(),f=!1);let e=Date.now();e>y&&(y=e+1e3,i&&setTimeout(()=>{o>0&&i(v)},1)),t.length?h(w):u<1&&(o=0,i&&h(()=>i("finished")),f=!0,setTimeout(()=>{a=void 0},2e3))}async function w(){for(;u<n;){let e=t.shift();if(!e)break;u++;try{await e()}catch(s){a=s}finally{T++,u--,x()}}}}module.exports=S(M);0&&(module.exports={asap,defer,queuePromises,sleep}); | ||
var T=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var z=e=>T(e,"__esModule",{value:!0});var J=(e,n)=>{for(var i in n)T(e,i,{get:n[i],enumerable:!0})},q=(e,n,i,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of F(n))!S.call(e,o)&&(i||o!=="default")&&T(e,o,{get:()=>n[o],enumerable:!(t=Q(n,o))||t.enumerable});return e};var j=(e=>(n,i)=>e&&e.get(n)||(i=q(z({}),n,1),e&&e.set(n,i),i))(typeof WeakMap!="undefined"?new WeakMap:0);var C={};J(C,{asap:()=>f,defer:()=>v,queuePromises:()=>k,sleep:()=>M});function M(e){return new Promise(n=>{setTimeout(n,e)})}function v(){let e,n;return{promise:new Promise((t,o)=>{e=t,n=o}),resolve(t){e&&e(t)},reject(t){n&&n(t)}}}function f(e){setTimeout(()=>e(),1)}function k(e){let n=Math.max(1,e?.concurrency||1),i=e?.onProgress,t=[],o=0,d=!0,l=Date.now(),a=0,p=0,h=0,c,x=0;return{get runned(){return x},state(){return d?"idle":P()},enqueue(r){t.push(r),o++,p=Date.now()+1e3,b()},promise(r){let u=v();return this.enqueue(()=>r().then(u.resolve,u.reject)),u.promise},waitFor(){return new Promise((r,u)=>{setTimeout(s,100);function s(){a+t.length===0?(c?u(c):r(),c=void 0):setTimeout(s,100)}})},setConcurrency(r){n=Math.max(r,1),b()},forceState(r){l=r.start,p=r.canRate,h=r.canRefresh,o=r.size}};function b(){d&&(l=Date.now(),d=!1);let r=Date.now();r>h&&(h=r+1e3,i&&f(()=>{o>0&&i(P())})),t.length?f(R):a<1&&(o=0,i&&f(()=>i("finished")),d=!0,setTimeout(()=>{c=void 0},2e3))}function R(){for(;a<n;){let r=t.shift();if(!r)break;a++,r().catch(u=>{c=u}).finally(async()=>{x++,a--,b()})}}function P(){return{get size(){return o},get running(){return a},get pending(){return t.length},get done(){return o-t.length},get percent(){return Math.round((o-t.length)/o*1e3)/10},get rate(){return r()},get timeRemaining(){return u()}};function r(){let s=Date.now();if(s<p)return"-";let y=(s-l)/1e3;return(o-t.length)/y}function u(){let s=Date.now();if(s<p)return"-";let y=(s-l)/1e3,w=(o-t.length)/y,m=(o-t.length)/w;if(m<2)return"one second";if(m<50)return m.toFixed(0)+" seconds";if(m<120)return"one minute";let g=m/60;if(g<60)return g.toFixed(0)+" minutes";let D=g/60;return g<120?"one hour":D.toFixed(0)+" hours"}}}module.exports=j(C);0&&(module.exports={asap,defer,queuePromises,sleep}); |
{ | ||
"name": "pjobs", | ||
"description": "A simple and efficient queue job executor using promises. And some promise's utilities.", | ||
"version": "1.0.9", | ||
"version": "1.1.2", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
223877