@stacksjs/queue 0.65.0 → 0.68.0
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.d.ts +23 -12
- package/dist/index.js +1 -4
- package/package.json +3 -5
- package/dist/index.js.map +0 -13
- package/src/index.ts +0 -25
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import type { JobOptions } from
|
|
1
|
+
import type { JobOptions } from '@stacksjs/types';
|
|
2
|
+
|
|
3
|
+
export { DeferQueue } from '@poppinss/defer'
|
|
2
4
|
export declare class Job {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
5
|
+
name: JobOptions['name']
|
|
6
|
+
description: JobOptions['description']
|
|
7
|
+
action?: JobOptions['action']
|
|
8
|
+
handle?: JobOptions['handle']
|
|
9
|
+
rate: JobOptions['rate']
|
|
10
|
+
tries: JobOptions['tries']
|
|
11
|
+
backoff: JobOptions['backoff']
|
|
12
|
+
enabled: JobOptions['enabled']
|
|
13
|
+
|
|
14
|
+
constructor({ name, description, handle, rate, tries, backoff, action, enabled }: JobOptions) {
|
|
15
|
+
this.name = name
|
|
16
|
+
this.description = description
|
|
17
|
+
this.handle = handle
|
|
18
|
+
this.rate = rate
|
|
19
|
+
this.action = action
|
|
20
|
+
this.tries = tries
|
|
21
|
+
this.backoff = backoff
|
|
22
|
+
this.enabled = enabled
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var H=Object.create;var{getPrototypeOf:v,defineProperty:D,getOwnPropertyNames:g}=Object;var y=Object.prototype.hasOwnProperty;var x=(J,O,z)=>{z=J!=null?H(v(J)):{};
|
|
3
|
-
|
|
4
|
-
//# debugId=9FA930A86BC1B96964756E2164756E21
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
2
|
+
var H=Object.create;var{getPrototypeOf:v,defineProperty:D,getOwnPropertyNames:g}=Object;var y=Object.prototype.hasOwnProperty;var x=(J,O,z)=>{z=J!=null?H(v(J)):{};let I=O||!J||!J.__esModule?D(z,"default",{value:J,enumerable:!0}):z;for(let m of g(J))if(!y.call(I,m))D(I,m,{get:()=>J[m],enumerable:!0});return I};var N=(J,O)=>()=>(O||J((O={exports:{}}).exports,O),O.exports);var C=N((l,h)=>{function i(J){var O=new J,z=O;function I(){var B=O;if(B.next)O=B.next;else O=new J,z=O;return B.next=null,B}function m(B){z.next=B,z=B}return{get:I,release:m}}h.exports=i});var j=N((t,A)=>{var _=C();function b(J,O,z){if(typeof J==="function")z=O,O=J,J=null;if(!(z>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var I=_(k),m=null,B=null,F=0,$=null,K={push:P,drain:X,saturated:X,pause:Z,paused:!1,get concurrency(){return z},set concurrency(G){if(!(G>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(z=G,K.paused)return;for(;m&&F<z;)F++,U()},running:W,resume:M,idle:L,length:V,getQueue:Y,unshift:p,empty:X,kill:T,killAndDrain:Q,error:w};return K;function W(){return F}function Z(){K.paused=!0}function V(){var G=m,S=0;while(G)G=G.next,S++;return S}function Y(){var G=m,S=[];while(G)S.push(G.value),G=G.next;return S}function M(){if(!K.paused)return;if(K.paused=!1,m===null){F++,U();return}for(;m&&F<z;)F++,U()}function L(){return F===0&&K.length()===0}function P(G,S){var E=I.get();if(E.context=J,E.release=U,E.value=G,E.callback=S||X,E.errorHandler=$,F>=z||K.paused)if(B)B.next=E,B=E;else m=E,B=E,K.saturated();else F++,O.call(J,E.value,E.worked)}function p(G,S){var E=I.get();if(E.context=J,E.release=U,E.value=G,E.callback=S||X,E.errorHandler=$,F>=z||K.paused)if(m)E.next=m,m=E;else m=E,B=E,K.saturated();else F++,O.call(J,E.value,E.worked)}function U(G){if(G)I.release(G);var S=m;if(S&&F<=z)if(!K.paused){if(B===m)B=null;if(m=S.next,S.next=null,O.call(J,S.value,S.worked),B===null)K.empty()}else F--;else if(--F===0)K.drain()}function T(){m=null,B=null,K.drain=X}function Q(){m=null,B=null,K.drain(),K.drain=X}function w(G){$=G}}function X(){}function k(){this.value=null,this.callback=X,this.next=null,this.release=X,this.context=null,this.errorHandler=null;var J=this;this.worked=function O(z,I){var{callback:m,errorHandler:B,value:F}=J;if(J.value=null,J.callback=X,J.errorHandler)B(z,F);m.call(J.context,z,I),J.release(J)}}function q(J,O,z){if(typeof J==="function")z=O,O=J,J=null;function I(Z,V){O.call(this,Z).then(function(Y){V(null,Y)},V)}var m=b(J,I,z),B=m.push,F=m.unshift;return m.push=$,m.unshift=K,m.drained=W,m;function $(Z){var V=new Promise(function(Y,M){B(Z,function(L,P){if(L){M(L);return}Y(P)})});return V.catch(X),V}function K(Z){var V=new Promise(function(Y,M){F(Z,function(L,P){if(L){M(L);return}Y(P)})});return V.catch(X),V}function W(){if(m.idle())return new Promise(function(Y){Y()});var Z=m.drain,V=new Promise(function(Y){m.drain=function(){Z(),Y()}});return V}}A.exports=b;A.exports.promise=q});var R=x(j(),1),d=class{resolve;reject;promise=new Promise((J,O)=>{this.reject=O,this.resolve=J})},f=class{#O;#J;#m=[];#z=(J,O)=>{let z=this.#m.shift();if(J){if(this.onError)this.onError(J,O);if(z)z.resolve({status:"rejected",reason:J});return}if(this.taskCompleted)this.taskCompleted(O);if(z)z.resolve({status:"fulfilled",value:O})};onError;taskCompleted;taskAdded;get drained(){return this.#J.drain}set drained(J){this.#O=J,this.#J.drain=J}constructor(J){this.#J=R.default(async(O,z)=>{try{let I=await(typeof O==="function"?O():O.run());z(null,{name:O.name,response:I})}catch(I){z(I,{name:O.name})}},J?.concurrency??10)}createNotifier(){let J=new d;return this.#m.push(J),J.promise}push(J){if(this.taskAdded)this.taskAdded(J);return this.#J.push(J,this.#z),this}unshift(J){if(this.taskAdded)this.taskAdded(J);return this.#J.unshift(J,this.#z),this}pause(){this.#J.pause()}resume(){this.#J.resume()}isIdle(){return this.#J.idle()}size(){return this.#J.length()}kill(){if(this.#J.killAndDrain(),this.#O)this.#J.drain=this.#O}};class s{name;description;action;handle;rate;tries;backoff;enabled;constructor({name:J,description:O,handle:z,rate:I,tries:m,backoff:B,action:F,enabled:$}){this.name=J,this.description=O,this.handle=z,this.rate=I,this.action=F,this.tries=m,this.backoff=B,this.enabled=$}}export{s as Job,f as DeferQueue};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/queue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.68.0",
|
|
5
5
|
"description": "The Stacks Queue system.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": ["Chris Breuer <chris@stacksjs.org>"],
|
|
@@ -28,17 +28,15 @@
|
|
|
28
28
|
],
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
|
-
"bun": "./src/index.ts",
|
|
32
31
|
"import": "./dist/index.js"
|
|
33
32
|
},
|
|
34
33
|
"./*": {
|
|
35
|
-
"bun": "./src/*",
|
|
36
34
|
"import": "./dist/*"
|
|
37
35
|
}
|
|
38
36
|
},
|
|
39
37
|
"module": "dist/index.js",
|
|
40
38
|
"types": "dist/index.d.ts",
|
|
41
|
-
"files": ["README.md", "dist"
|
|
39
|
+
"files": ["README.md", "dist"],
|
|
42
40
|
"scripts": {
|
|
43
41
|
"build": "bun build.ts",
|
|
44
42
|
"typecheck": "bun tsc --noEmit",
|
|
@@ -48,6 +46,6 @@
|
|
|
48
46
|
"@poppinss/defer": "^1.1.0"
|
|
49
47
|
},
|
|
50
48
|
"devDependencies": {
|
|
51
|
-
"@stacksjs/development": "0.
|
|
49
|
+
"@stacksjs/development": "0.67.0"
|
|
52
50
|
}
|
|
53
51
|
}
|
package/dist/index.js.map
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../node_modules/reusify/reusify.js", "../../../../../node_modules/fastq/queue.js", "../../../../../node_modules/@poppinss/defer/build/index.js", "../src/index.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"'use strict'\n\nfunction reusify (Constructor) {\n var head = new Constructor()\n var tail = head\n\n function get () {\n var current = head\n\n if (current.next) {\n head = current.next\n } else {\n head = new Constructor()\n tail = head\n }\n\n current.next = null\n\n return current\n }\n\n function release (obj) {\n tail.next = obj\n tail = obj\n }\n\n return {\n get: get,\n release: release\n }\n}\n\nmodule.exports = reusify\n",
|
|
6
|
-
"'use strict'\n\n/* eslint-disable no-var */\n\nvar reusify = require('reusify')\n\nfunction fastqueue (context, worker, _concurrency) {\n if (typeof context === 'function') {\n _concurrency = worker\n worker = context\n context = null\n }\n\n if (!(_concurrency >= 1)) {\n throw new Error('fastqueue concurrency must be equal to or greater than 1')\n }\n\n var cache = reusify(Task)\n var queueHead = null\n var queueTail = null\n var _running = 0\n var errorHandler = null\n\n var self = {\n push: push,\n drain: noop,\n saturated: noop,\n pause: pause,\n paused: false,\n\n get concurrency () {\n return _concurrency\n },\n set concurrency (value) {\n if (!(value >= 1)) {\n throw new Error('fastqueue concurrency must be equal to or greater than 1')\n }\n _concurrency = value\n\n if (self.paused) return\n for (; queueHead && _running < _concurrency;) {\n _running++\n release()\n }\n },\n\n running: running,\n resume: resume,\n idle: idle,\n length: length,\n getQueue: getQueue,\n unshift: unshift,\n empty: noop,\n kill: kill,\n killAndDrain: killAndDrain,\n error: error\n }\n\n return self\n\n function running () {\n return _running\n }\n\n function pause () {\n self.paused = true\n }\n\n function length () {\n var current = queueHead\n var counter = 0\n\n while (current) {\n current = current.next\n counter++\n }\n\n return counter\n }\n\n function getQueue () {\n var current = queueHead\n var tasks = []\n\n while (current) {\n tasks.push(current.value)\n current = current.next\n }\n\n return tasks\n }\n\n function resume () {\n if (!self.paused) return\n self.paused = false\n if (queueHead === null) {\n _running++\n release()\n return\n }\n for (; queueHead && _running < _concurrency;) {\n _running++\n release()\n }\n }\n\n function idle () {\n return _running === 0 && self.length() === 0\n }\n\n function push (value, done) {\n var current = cache.get()\n\n current.context = context\n current.release = release\n current.value = value\n current.callback = done || noop\n current.errorHandler = errorHandler\n\n if (_running >= _concurrency || self.paused) {\n if (queueTail) {\n queueTail.next = current\n queueTail = current\n } else {\n queueHead = current\n queueTail = current\n self.saturated()\n }\n } else {\n _running++\n worker.call(context, current.value, current.worked)\n }\n }\n\n function unshift (value, done) {\n var current = cache.get()\n\n current.context = context\n current.release = release\n current.value = value\n current.callback = done || noop\n current.errorHandler = errorHandler\n\n if (_running >= _concurrency || self.paused) {\n if (queueHead) {\n current.next = queueHead\n queueHead = current\n } else {\n queueHead = current\n queueTail = current\n self.saturated()\n }\n } else {\n _running++\n worker.call(context, current.value, current.worked)\n }\n }\n\n function release (holder) {\n if (holder) {\n cache.release(holder)\n }\n var next = queueHead\n if (next && _running <= _concurrency) {\n if (!self.paused) {\n if (queueTail === queueHead) {\n queueTail = null\n }\n queueHead = next.next\n next.next = null\n worker.call(context, next.value, next.worked)\n if (queueTail === null) {\n self.empty()\n }\n } else {\n _running--\n }\n } else if (--_running === 0) {\n self.drain()\n }\n }\n\n function kill () {\n queueHead = null\n queueTail = null\n self.drain = noop\n }\n\n function killAndDrain () {\n queueHead = null\n queueTail = null\n self.drain()\n self.drain = noop\n }\n\n function error (handler) {\n errorHandler = handler\n }\n}\n\nfunction noop () {}\n\nfunction Task () {\n this.value = null\n this.callback = noop\n this.next = null\n this.release = noop\n this.context = null\n this.errorHandler = null\n\n var self = this\n\n this.worked = function worked (err, result) {\n var callback = self.callback\n var errorHandler = self.errorHandler\n var val = self.value\n self.value = null\n self.callback = noop\n if (self.errorHandler) {\n errorHandler(err, val)\n }\n callback.call(self.context, err, result)\n self.release(self)\n }\n}\n\nfunction queueAsPromised (context, worker, _concurrency) {\n if (typeof context === 'function') {\n _concurrency = worker\n worker = context\n context = null\n }\n\n function asyncWrapper (arg, cb) {\n worker.call(this, arg)\n .then(function (res) {\n cb(null, res)\n }, cb)\n }\n\n var queue = fastqueue(context, asyncWrapper, _concurrency)\n\n var pushCb = queue.push\n var unshiftCb = queue.unshift\n\n queue.push = push\n queue.unshift = unshift\n queue.drained = drained\n\n return queue\n\n function push (value) {\n var p = new Promise(function (resolve, reject) {\n pushCb(value, function (err, result) {\n if (err) {\n reject(err)\n return\n }\n resolve(result)\n })\n })\n\n // Let's fork the promise chain to\n // make the error bubble up to the user but\n // not lead to a unhandledRejection\n p.catch(noop)\n\n return p\n }\n\n function unshift (value) {\n var p = new Promise(function (resolve, reject) {\n unshiftCb(value, function (err, result) {\n if (err) {\n reject(err)\n return\n }\n resolve(result)\n })\n })\n\n // Let's fork the promise chain to\n // make the error bubble up to the user but\n // not lead to a unhandledRejection\n p.catch(noop)\n\n return p\n }\n\n function drained () {\n if (queue.idle()) {\n return new Promise(function (resolve) {\n resolve()\n })\n }\n\n var previousDrain = queue.drain\n\n var p = new Promise(function (resolve) {\n queue.drain = function () {\n previousDrain()\n resolve()\n }\n })\n\n return p\n }\n}\n\nmodule.exports = fastqueue\nmodule.exports.promise = queueAsPromised\n",
|
|
7
|
-
"// src/queue.ts\nimport fastq from \"fastq\";\nvar Deferred = class {\n resolve;\n reject;\n promise = new Promise((resolve, reject) => {\n this.reject = reject;\n this.resolve = resolve;\n });\n};\nvar DeferQueue = class {\n /**\n * Custom drain callback assigned to the queue. We keep a\n * reference to it so that we can assign it back after\n * the kill method\n */\n #drainCallback;\n /**\n * Reference to the undelying fastq\n */\n #fastQueue;\n /**\n * Notifiers is a collection of promises that are invoked\n * when a task is completed and then removed from the\n * stack.\n *\n * You can create notifiers using the \"createNotifier\" method\n * to lineraly monitor the completion of a task\n */\n #notifiers = [];\n /**\n * Notifies the onError and taskCompleted handlers\n */\n #notifier = (error, taskResult) => {\n const awaitingNotifier = this.#notifiers.shift();\n if (error) {\n if (this.onError) {\n this.onError(error, taskResult);\n }\n if (awaitingNotifier) {\n awaitingNotifier.resolve({ status: \"rejected\", reason: error });\n }\n return;\n }\n if (this.taskCompleted) {\n this.taskCompleted(taskResult);\n }\n if (awaitingNotifier) {\n awaitingNotifier.resolve({ status: \"fulfilled\", value: taskResult });\n }\n };\n /**\n * Function that listens for the errors on the queue\n */\n onError;\n /**\n * Function that listens successful task completions\n */\n taskCompleted;\n /**\n * Function that listens for new task additions\n */\n taskAdded;\n /**\n * Function that is invoked when the last task is executed\n * by the worker\n */\n get drained() {\n return this.#fastQueue.drain;\n }\n set drained(callback) {\n this.#drainCallback = callback;\n this.#fastQueue.drain = callback;\n }\n constructor(options) {\n this.#fastQueue = fastq(async (cb, done) => {\n try {\n const response = await (typeof cb === \"function\" ? cb() : cb.run());\n done(null, { name: cb.name, response });\n } catch (error) {\n done(error, { name: cb.name });\n }\n }, options?.concurrency ?? 10);\n }\n /**\n * Create a notifier in advance that will be resolved when\n * a queued task is completed.\n *\n * Notifiers must be used during testing to track the execution\n * of an async task.\n *\n * One notifier can only listen for a maximum of one task that will\n * be executed after the notifier has been created and after that\n * the notifier will be removed.\n */\n createNotifier() {\n const deferred = new Deferred();\n this.#notifiers.push(deferred);\n return deferred.promise;\n }\n /**\n * Push a new callback (aka task) to the end of the queue.\n */\n push(task) {\n if (this.taskAdded) {\n this.taskAdded(task);\n }\n this.#fastQueue.push(task, this.#notifier);\n return this;\n }\n /**\n * Push a new callback (aka task) to the start of the queue.\n */\n unshift(task) {\n if (this.taskAdded) {\n this.taskAdded(task);\n }\n this.#fastQueue.unshift(task, this.#notifier);\n return this;\n }\n /**\n * Pause queue\n */\n pause() {\n this.#fastQueue.pause();\n }\n /**\n * Resume queue\n */\n resume() {\n this.#fastQueue.resume();\n }\n /**\n * Check if queue is currently idle\n */\n isIdle() {\n return this.#fastQueue.idle();\n }\n /**\n * Get the size of tasks in the queue\n */\n size() {\n return this.#fastQueue.length();\n }\n /**\n * Kill the queue and reset the drain method to a\n * noop function.\n *\n * The drain method will be called before the queue gets\n * killed\n */\n kill() {\n this.#fastQueue.killAndDrain();\n if (this.#drainCallback) {\n this.#fastQueue.drain = this.#drainCallback;\n }\n }\n};\nexport {\n DeferQueue\n};\n//# sourceMappingURL=index.js.map",
|
|
8
|
-
"import type { JobOptions } from '@stacksjs/types'\n\nexport class Job {\n name: JobOptions['name']\n description: JobOptions['description']\n action?: JobOptions['action']\n handle?: JobOptions['handle']\n rate: JobOptions['rate']\n tries: JobOptions['tries']\n backoff: JobOptions['backoff']\n enabled: JobOptions['enabled']\n\n constructor({ name, description, handle, rate, tries, backoff, action, enabled }: JobOptions) {\n this.name = name\n this.description = description\n this.handle = handle\n this.rate = rate\n this.action = action\n this.tries = tries\n this.backoff = backoff\n this.enabled = enabled\n }\n}\n\nexport { DeferQueue } from '@poppinss/defer'\n"
|
|
9
|
-
],
|
|
10
|
-
"mappings": ";uYAEA,SAAS,CAAQ,CAAC,EAAa,CAC7B,IAAI,EAAO,IAAI,EACX,EAAO,EAEX,SAAS,CAAI,EAAG,CACd,IAAI,EAAU,EAEd,GAAI,EAAQ,KACV,EAAO,EAAQ,SAEf,GAAO,IAAI,EACX,EAAO,EAKT,OAFA,EAAQ,KAAO,KAER,EAGT,SAAS,CAAQ,CAAC,EAAK,CACrB,EAAK,KAAO,EACZ,EAAO,EAGT,MAAO,CACL,IAAK,EACL,QAAS,CACX,EAGF,EAAO,QAAU,oBC1BjB,SAAS,CAAU,CAAC,EAAS,EAAQ,EAAc,CACjD,UAAW,IAAY,WACrB,EAAe,EACf,EAAS,EACT,EAAU,KAGZ,KAAM,GAAgB,GACpB,MAAM,IAAI,MAAM,0DAA0D,EAG5E,IAAI,EAAQ,EAAQ,CAAI,EACpB,EAAY,KACZ,EAAY,KACZ,EAAW,EACX,EAAe,KAEf,EAAO,CACT,KAAM,EACN,MAAO,EACP,UAAW,EACX,MAAO,EACP,OAAQ,MAEJ,YAAY,EAAG,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AW,KAAK,EAK9B,IAAI,EAAG,CACL,OAAO,KAAK,GAAW,OAAO,EAShC,IAAI,EAAG,CAEL,GADA,KAAK,GAAW,aAAa,EACzB,KAAK,GACP,KAAK,GAAW,MAAQ,KAAK,GAGnC,EC3JO,MAAM,CAAI,CACf,KACA,YACA,OACA,OACA,KACA,MACA,QACA,QAEA,WAAW,EAAG,OAAM,cAAa,SAAQ,OAAM,QAAO,UAAS,SAAQ,WAAuB,CAC5F,KAAK,KAAO,EACZ,KAAK,YAAc,EACnB,KAAK,OAAS,EACd,KAAK,KAAO,EACZ,KAAK,OAAS,EACd,KAAK,MAAQ,EACb,KAAK,QAAU,EACf,KAAK,QAAU,EAEnB",
|
|
11
|
-
"debugId": "9FA930A86BC1B96964756E2164756E21",
|
|
12
|
-
"names": []
|
|
13
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { JobOptions } from '@stacksjs/types'
|
|
2
|
-
|
|
3
|
-
export class Job {
|
|
4
|
-
name: JobOptions['name']
|
|
5
|
-
description: JobOptions['description']
|
|
6
|
-
action?: JobOptions['action']
|
|
7
|
-
handle?: JobOptions['handle']
|
|
8
|
-
rate: JobOptions['rate']
|
|
9
|
-
tries: JobOptions['tries']
|
|
10
|
-
backoff: JobOptions['backoff']
|
|
11
|
-
enabled: JobOptions['enabled']
|
|
12
|
-
|
|
13
|
-
constructor({ name, description, handle, rate, tries, backoff, action, enabled }: JobOptions) {
|
|
14
|
-
this.name = name
|
|
15
|
-
this.description = description
|
|
16
|
-
this.handle = handle
|
|
17
|
-
this.rate = rate
|
|
18
|
-
this.action = action
|
|
19
|
-
this.tries = tries
|
|
20
|
-
this.backoff = backoff
|
|
21
|
-
this.enabled = enabled
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { DeferQueue } from '@poppinss/defer'
|