Comparing version 2.0.1 to 2.0.2
@@ -1,2 +0,2 @@ | ||
// Generated by dts-bundle-generator v6.9.0 | ||
// Generated by dts-bundle-generator v8.1.1 | ||
@@ -7,6 +7,6 @@ export declare function sleep(timeout: number): Promise<void>; | ||
resolve(v: T): void; | ||
reject(reason: any): void; | ||
reject(reason: unknown): void; | ||
} | ||
export declare function defer<T>(): Defer<T>; | ||
export declare type QueueState = { | ||
export type QueueState = { | ||
readonly pending: number; | ||
@@ -24,3 +24,3 @@ readonly size: number; | ||
} | ||
export declare type Job<T> = () => Promise<T>; | ||
export type Job<T> = () => Promise<T>; | ||
export interface QueuePromises { | ||
@@ -27,0 +27,0 @@ state(): "idle" | QueueState; |
@@ -1,1 +0,1 @@ | ||
var w=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var F=(t,o)=>{for(var a in o)w(t,a,{get:o[a],enumerable:!0})},q=(t,o,a,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let u of S(o))!z.call(t,u)&&u!==a&&w(t,u,{get:()=>o[u],enumerable:!(s=Q(o,u))||s.enumerable});return t};var I=t=>q(w({},"__esModule",{value:!0}),t);var k={};F(k,{asap:()=>J,defer:()=>U,queuePromises:()=>j,sleep:()=>V});module.exports=I(k);function V(t){return new Promise(o=>{setTimeout(o,t)})}function U(){let t,o;return{promise:new Promise((s,u)=>{t=s,o=u}),resolve(s){t&&t(s)},reject(s){o&&o(s)}}}function J(t){setTimeout(()=>t(),1)}function j(t){let o=Math.max(1,t?.concurrency||1),a=t?.onProgress,s=[],u=0,l=!0,c=[],d=0,y=0,g,v=0,p,T=0;return{state(){return l?"idle":D()},enqueue(e){Array.isArray(e)?(s.push(...e),u+=e.length):(s.push(e),u++),y=Date.now()+1e3,x()},promise(e){if(Array.isArray(e))return Promise.all(e.map(r=>this.promise(r)));let i=U();return this.enqueue(()=>e().then(i.resolve,i.reject)),i.promise},forEach(e,i){return Promise.all(e.map((r,n,m)=>this.promise(()=>i(r,n,m)))).then(()=>{})},map(e,i){return Promise.all(e.map((r,n,m)=>this.promise(()=>i(r,n,m))))},reduce(e,i,r){let n=r;return Promise.all(e.map((m,f,P)=>this.promise(()=>i(n,m,f,P).then(h=>{n=h})))).then(()=>n)},some(e,i){let r=!1;return new Promise((n,m)=>{Promise.all(e.map((f,P,h)=>this.promise(()=>r?Promise.resolve():i(f,P,h).then(R=>{R&&(r=!0,n(f))},m)))).then(()=>{r||n(void 0)})})},waitFor(){return new Promise((e,i)=>{setTimeout(r,100);function r(){l?(p?i(p):e(),p=void 0):setTimeout(r,100)}})},setConcurrency(e){o=Math.max(e,1),x()},forceState(e){c=[[e.start,0]],y=e.canRate,u=e.size,T=e.done}};function x(){l&&(c=[[Date.now(),0]],l=!1),s.length?A():d<1?(u=0,T=0,l=!0,b(),setTimeout(()=>{p=void 0},2e3)):b()}function b(){l||Date.now()>v?J(e):(g&&clearTimeout(g),g=setTimeout(b,1e3));function e(){Date.now()<v||a&&(v=Date.now()+1e3,u>0?a(D()):a("idle"))}}function A(){for(;d<o;){let e=s.shift();if(!e)break;d++,b(),e().catch(i=>{p=i}).finally(()=>{T++,d--,b(),x()})}}function D(){return{get size(){return u},get running(){return d},get pending(){return s.length},get done(){return T},get percent(){return Math.round(T/u*1e3)/10},get rate(){return e()||"-"},get timeRemaining(){return i()}};function e(){let r=Date.now();if(r<y)return!1;let n=T+d,m=c[0][1],f=n-m;if(f<=0)return!1;for(c.push([r,n]);c.length>30;)c=c.slice(c.length-30);let P=c[0][0],h=(r-P)/1e3;return f/h}function i(){let r=e();if(r===!1)return"-";let n=(d+s.length)/r;if(n<2)return"one second";if(n<50)return`${n.toFixed(0)} seconds`;if(n<120)return"one minute";let m=n/60;if(m<60)return`${m.toFixed(0)} minutes`;let f=m/60;return m<120?"one hour":`${f.toFixed(0)} hours`}}}0&&(module.exports={asap,defer,queuePromises,sleep}); | ||
"use strict";var w=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var F=(t,o)=>{for(var a in o)w(t,a,{get:o[a],enumerable:!0})},k=(t,o,a,u)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of S(o))!z.call(t,s)&&s!==a&&w(t,s,{get:()=>o[s],enumerable:!(u=Q(o,s))||u.enumerable});return t};var q=t=>k(w({},"__esModule",{value:!0}),t);var j={};F(j,{asap:()=>J,defer:()=>U,queuePromises:()=>V,sleep:()=>I});module.exports=q(j);function I(t){return new Promise(o=>{setTimeout(o,t)})}function U(){let t,o;return{promise:new Promise((u,s)=>{t=u,o=s}),resolve(u){t&&t(u)},reject(u){o&&o(u)}}}function J(t){setTimeout(()=>t(),1)}function V(t){let o=Math.max(1,t?.concurrency||1),a=t?.onProgress,u=[],s=0,l=!0,c=[],d=0,y=0,g,v=0,p,T=0;return{state(){return l?"idle":D()},enqueue(e){Array.isArray(e)?(u.push(...e),s+=e.length):(u.push(e),s++),y=Date.now()+1e3,x()},promise(e){if(Array.isArray(e))return Promise.all(e.map(r=>this.promise(r)));let i=U();return this.enqueue(()=>e().then(i.resolve,i.reject)),i.promise},forEach(e,i){return Promise.all(e.map((r,n,m)=>this.promise(()=>i(r,n,m)))).then(()=>{})},map(e,i){return Promise.all(e.map((r,n,m)=>this.promise(()=>i(r,n,m))))},reduce(e,i,r){let n=r;return Promise.all(e.map((m,f,P)=>this.promise(()=>i(n,m,f,P).then(h=>{n=h})))).then(()=>n)},some(e,i){let r=!1;return new Promise((n,m)=>{Promise.all(e.map((f,P,h)=>this.promise(()=>r?Promise.resolve():i(f,P,h).then(R=>{R&&(r=!0,n(f))},m)))).then(()=>{r||n(void 0)})})},waitFor(){return new Promise((e,i)=>{setTimeout(r,100);function r(){l?(p?i(p):e(),p=void 0):setTimeout(r,100)}})},setConcurrency(e){o=Math.max(e,1),x()},forceState(e){c=[[e.start,0]],y=e.canRate,s=e.size,T=e.done}};function x(){l&&(c=[[Date.now(),0]],l=!1),u.length?A():d<1?(s=0,T=0,l=!0,b(),setTimeout(()=>{p=void 0},2e3)):b()}function b(){l||Date.now()>v?J(e):(g&&clearTimeout(g),g=setTimeout(b,1e3));function e(){Date.now()<v||a&&(v=Date.now()+1e3,s>0?a(D()):a("idle"))}}function A(){for(;d<o;){let e=u.shift();if(!e)break;d++,b(),e().catch(i=>{p=i}).finally(()=>{T++,d--,b(),x()})}}function D(){return{get size(){return s},get running(){return d},get pending(){return u.length},get done(){return T},get percent(){return Math.round(T/s*1e3)/10},get rate(){return e()||"-"},get timeRemaining(){return i()}};function e(){let r=Date.now();if(r<y)return!1;let n=T+d,m=c[0][1],f=n-m;if(f<=0)return!1;for(c.push([r,n]);c.length>30;)c=c.slice(c.length-30);let P=c[0][0],h=(r-P)/1e3;return f/h}function i(){let r=e();if(r===!1)return"-";let n=(d+u.length)/r;if(n<2)return"one second";if(n<50)return`${n.toFixed(0)} seconds`;if(n<120)return"one minute";let m=n/60;if(m<60)return`${m.toFixed(0)} minutes`;let f=m/60;return m<120?"one hour":`${f.toFixed(0)} hours`}}}0&&(module.exports={asap,defer,queuePromises,sleep}); |
@@ -7,3 +7,3 @@ /* eslint-disable import/extensions */ | ||
const { pathsToModuleNameMapper } = require("ts-jest/utils"); | ||
const { pathsToModuleNameMapper } = require("ts-jest"); | ||
const { compilerOptions } = require("./tsconfig.test"); | ||
@@ -10,0 +10,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple, efficient, small and no dependencies queue job executor using promises with concurrency control. And some promise's utilities.", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"repository": { | ||
@@ -15,23 +15,23 @@ "type": "git", | ||
"devDependencies": { | ||
"@types/jest": "^27.4.1", | ||
"@types/source-map-support": "^0.5.4", | ||
"@typescript-eslint/eslint-plugin": "^5.21.0", | ||
"@typescript-eslint/parser": "^5.21.0", | ||
"dts-bundle-generator": "^6.9.0", | ||
"esbuild": "^0.14.38", | ||
"@types/jest": "^29.5.6", | ||
"@types/source-map-support": "^0.5.9", | ||
"@typescript-eslint/eslint-plugin": "^6.8.0", | ||
"@typescript-eslint/parser": "^6.8.0", | ||
"dts-bundle-generator": "^8.1.1", | ||
"esbuild": "^0.19.5", | ||
"esbuild-jest": "^0.5.0", | ||
"eslint": "^8.14.0", | ||
"eslint": "^8.52.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-config-standard": "^17.0.0", | ||
"eslint-import-resolver-typescript": "^2.7.1", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-config-standard": "^17.1.0", | ||
"eslint-import-resolver-typescript": "^3.6.1", | ||
"eslint-plugin-import": "^2.29.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-promise": "^6.0.0", | ||
"jest": "^27.5.1", | ||
"prettier": "^2.6.2", | ||
"eslint-plugin-prettier": "^5.0.1", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"jest": "^29.7.0", | ||
"prettier": "^3.0.3", | ||
"source-map-support": "^0.5.21", | ||
"ts-jest": "^27.1.4", | ||
"typescript": "^4.6.3" | ||
"ts-jest": "^29.1.1", | ||
"typescript": "^5.2.2" | ||
}, | ||
@@ -38,0 +38,0 @@ "scripts": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
45380
6
102
1