@akiflow/ergon
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -18,24 +18,6 @@ import { AxiosInstance } from 'axios'; | ||
term(job: IErgonJob): Promise<void>; | ||
schedule(sch: IErgonSchedule): Promise<void>; | ||
schedule(sch: IErgonSchedule): Promise<IErgonSchedule>; | ||
triggerSchedule(id: string): Promise<void>; | ||
deleteJobs(key: string): Promise<void>; | ||
deleteSchedules(key: string): Promise<void>; | ||
} | ||
/** | ||
* @question this function is not used in the library, and is not exported, do we need it? | ||
function decodeSchedule (sch: ErgonScheduleJSON): ErgonSchedule { | ||
return { | ||
id: sch.id, | ||
queue_id: sch.queue_id, | ||
ordering_key: sch.ordering_key, | ||
subject: sch.subject, | ||
every: sch.every, | ||
last_enqueued_at: sch.last_enqueued_at ? new Date(sch.last_enqueued_at) : null, | ||
next_enqueue_at: sch.next_enqueue_at ? new Date(sch.next_enqueue_at) : null, | ||
max_enqueues: sch.max_enqueues, | ||
total_enqueues: sch.total_enqueues ?? 0, | ||
max_retries: sch.max_retries ?? 0, | ||
payload: sch.payload, | ||
ack_delay: sch.ack_delay ?? 0, | ||
} | ||
} | ||
*/ |
@@ -111,2 +111,19 @@ "use strict"; | ||
} | ||
function decodeSchedule(sch) { | ||
var _a, _b, _c; | ||
return { | ||
id: sch.id, | ||
queue_id: sch.queue_id, | ||
ordering_key: sch.ordering_key, | ||
subject: sch.subject, | ||
every: sch.every, | ||
last_enqueued_at: sch.last_enqueued_at ? new Date(sch.last_enqueued_at) : null, | ||
next_enqueue_at: sch.next_enqueue_at ? new Date(sch.next_enqueue_at) : null, | ||
max_enqueues: sch.max_enqueues, | ||
total_enqueues: (_a = sch.total_enqueues) !== null && _a !== void 0 ? _a : 0, | ||
max_retries: (_b = sch.max_retries) !== null && _b !== void 0 ? _b : 0, | ||
payload: sch.payload, | ||
ack_delay: (_c = sch.ack_delay) !== null && _c !== void 0 ? _c : 0, | ||
}; | ||
} | ||
var ErgonQueue = /** @class */ (function () { | ||
@@ -337,3 +354,3 @@ function ErgonQueue(host, queueID, token) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var e_8; | ||
var resp, e_8; | ||
return __generator(this, function (_a) { | ||
@@ -345,4 +362,4 @@ switch (_a.label) { | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
resp = _a.sent(); | ||
return [2 /*return*/, decodeSchedule(resp.data)]; | ||
case 2: | ||
@@ -357,3 +374,3 @@ e_8 = _a.sent(); | ||
}; | ||
ErgonQueue.prototype.deleteJobs = function (key) { | ||
ErgonQueue.prototype.triggerSchedule = function (id) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -365,3 +382,3 @@ var e_9; | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, this.cli.delete("/jobs/".concat(key))]; | ||
return [4 /*yield*/, this.cli.post("/schedules/".concat(id, "/trigger"))]; | ||
case 1: | ||
@@ -379,3 +396,3 @@ _a.sent(); | ||
}; | ||
ErgonQueue.prototype.deleteSchedules = function (key) { | ||
ErgonQueue.prototype.deleteJobs = function (key) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -387,3 +404,3 @@ var e_10; | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, this.cli.delete("/schedules/".concat(key))]; | ||
return [4 /*yield*/, this.cli.delete("/jobs/".concat(key))]; | ||
case 1: | ||
@@ -401,23 +418,24 @@ _a.sent(); | ||
}; | ||
ErgonQueue.prototype.deleteSchedules = function (key) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var e_11; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, this.cli.delete("/schedules/".concat(key))]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
case 2: | ||
e_11 = _a.sent(); | ||
console.error(e_11); | ||
throw e_11; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return ErgonQueue; | ||
}()); | ||
exports.ErgonQueue = ErgonQueue; | ||
/** | ||
* @question this function is not used in the library, and is not exported, do we need it? | ||
function decodeSchedule (sch: ErgonScheduleJSON): ErgonSchedule { | ||
return { | ||
id: sch.id, | ||
queue_id: sch.queue_id, | ||
ordering_key: sch.ordering_key, | ||
subject: sch.subject, | ||
every: sch.every, | ||
last_enqueued_at: sch.last_enqueued_at ? new Date(sch.last_enqueued_at) : null, | ||
next_enqueue_at: sch.next_enqueue_at ? new Date(sch.next_enqueue_at) : null, | ||
max_enqueues: sch.max_enqueues, | ||
total_enqueues: sch.total_enqueues ?? 0, | ||
max_retries: sch.max_retries ?? 0, | ||
payload: sch.payload, | ||
ack_delay: sch.ack_delay ?? 0, | ||
} | ||
} | ||
*/ |
{ | ||
"name": "@akiflow/ergon", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Client for Ergon job queue", | ||
@@ -5,0 +5,0 @@ "main": "./dist/ergon.js", |
Sorry, the diff of this file is too big to display
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
379981
7943