@lango-project/lango-boss 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/NOTICE +2 -0
- package/README.md +111 -2
- package/dist/.lango/bignumber.mjs +3119 -0
- package/dist/.lango/localization.mjs +108 -0
- package/dist/.lango/runtime.mjs +725 -0
- package/dist/.lango/vendor/i18next.LICENSE +21 -0
- package/dist/.lango/vendor/i18next.mjs +2434 -0
- package/dist/.lango/xmldom/conventions.js +429 -0
- package/dist/.lango/xmldom/dom-parser.js +591 -0
- package/dist/.lango/xmldom/dom.js +3759 -0
- package/dist/.lango/xmldom/entities.js +2171 -0
- package/dist/.lango/xmldom/errors.js +205 -0
- package/dist/.lango/xmldom/grammar.js +559 -0
- package/dist/.lango/xmldom/index.js +41 -0
- package/dist/.lango/xmldom/package.json +1 -0
- package/dist/.lango/xmldom/sax.js +983 -0
- package/dist/.lango/xmldom.LICENSE.md +8 -0
- package/dist/boss.mjs +136 -0
- package/dist/boss.mjs.map +1 -0
- package/dist/claim_watch.mjs +99 -0
- package/dist/claim_watch.mjs.map +1 -0
- package/dist/cli.mjs +143 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/configuration.mjs +58 -0
- package/dist/configuration.mjs.map +1 -0
- package/dist/dispatcher.mjs +108 -0
- package/dist/dispatcher.mjs.map +1 -0
- package/dist/driver.mjs +98 -0
- package/dist/driver.mjs.map +1 -0
- package/dist/envelope.mjs +92 -0
- package/dist/envelope.mjs.map +1 -0
- package/dist/library.mjs +139 -0
- package/dist/library.mjs.map +1 -0
- package/dist/management.mjs +360 -0
- package/dist/management.mjs.map +1 -0
- package/dist/management_transaction.mjs +26 -0
- package/dist/management_transaction.mjs.map +1 -0
- package/dist/namespace.mjs +27 -0
- package/dist/namespace.mjs.map +1 -0
- package/dist/queue.mjs +161 -0
- package/dist/queue.mjs.map +1 -0
- package/dist/reads.mjs +359 -0
- package/dist/reads.mjs.map +1 -0
- package/dist/retention.mjs +133 -0
- package/dist/retention.mjs.map +1 -0
- package/dist/schedule_sync.mjs +222 -0
- package/dist/schedule_sync.mjs.map +1 -0
- package/dist/schedule_transaction.mjs +24 -0
- package/dist/schedule_transaction.mjs.map +1 -0
- package/dist/schedules.mjs +201 -0
- package/dist/schedules.mjs.map +1 -0
- package/dist/transaction.mjs +16 -0
- package/dist/transaction.mjs.map +1 -0
- package/dist/validation.mjs +90 -0
- package/dist/validation.mjs.map +1 -0
- package/dist/worker.mjs +316 -0
- package/dist/worker.mjs.map +1 -0
- package/docs/guide.md +88 -0
- package/docs/management.md +93 -0
- package/docs/producer.md +115 -0
- package/docs/reads.md +107 -0
- package/docs/reference.md +77 -0
- package/docs/release.md +103 -0
- package/docs/retention.md +47 -0
- package/docs/scheduling.md +79 -0
- package/docs/worker.md +90 -0
- package/examples/reports/README.md +118 -0
- package/examples/reports/app.lango +133 -0
- package/examples/reports/deploy.xml +6 -0
- package/examples/reports/dist/.lango/bignumber.mjs +3119 -0
- package/examples/reports/dist/.lango/localization.mjs +108 -0
- package/examples/reports/dist/.lango/runtime.mjs +725 -0
- package/examples/reports/dist/.lango/vendor/i18next.LICENSE +21 -0
- package/examples/reports/dist/.lango/vendor/i18next.mjs +2434 -0
- package/examples/reports/dist/.lango/xmldom/conventions.js +429 -0
- package/examples/reports/dist/.lango/xmldom/dom-parser.js +591 -0
- package/examples/reports/dist/.lango/xmldom/dom.js +3759 -0
- package/examples/reports/dist/.lango/xmldom/entities.js +2171 -0
- package/examples/reports/dist/.lango/xmldom/errors.js +205 -0
- package/examples/reports/dist/.lango/xmldom/grammar.js +559 -0
- package/examples/reports/dist/.lango/xmldom/index.js +41 -0
- package/examples/reports/dist/.lango/xmldom/package.json +1 -0
- package/examples/reports/dist/.lango/xmldom/sax.js +983 -0
- package/examples/reports/dist/.lango/xmldom.LICENSE.md +8 -0
- package/examples/reports/dist/app.mjs +137 -0
- package/examples/reports/dist/app.mjs.map +1 -0
- package/examples/reports/dist/handlers.mjs +202 -0
- package/examples/reports/dist/handlers.mjs.map +1 -0
- package/examples/reports/dist/setup.mjs +14 -0
- package/examples/reports/dist/setup.mjs.map +1 -0
- package/examples/reports/handlers.lango +153 -0
- package/examples/reports/jobs.xml +5 -0
- package/examples/reports/package.json +23 -0
- package/examples/reports/routes.xml +4 -0
- package/examples/reports/setup.lango +17 -0
- package/package.json +60 -4
- package/src/boss.lango +92 -0
- package/src/claim_watch.lango +58 -0
- package/src/cli.lango +103 -0
- package/src/configuration.lango +43 -0
- package/src/dispatcher.lango +75 -0
- package/src/driver.lango +72 -0
- package/src/envelope.lango +56 -0
- package/src/library.lango +66 -0
- package/src/management.lango +302 -0
- package/src/management_transaction.lango +28 -0
- package/src/namespace.lango +15 -0
- package/src/queue.lango +115 -0
- package/src/reads.lango +277 -0
- package/src/retention.lango +107 -0
- package/src/schedule_sync.lango +190 -0
- package/src/schedule_transaction.lango +22 -0
- package/src/schedules.lango +165 -0
- package/src/transaction.lango +23 -0
- package/src/validation.lango +45 -0
- package/src/worker.lango +230 -0
package/dist/driver.mjs
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { schemaName } from "./namespace.mjs";
|
|
2
|
+
import * as pgBoss from "pg-boss";
|
|
3
|
+
import {
|
|
4
|
+
hostGlobal as __hostGlobal,
|
|
5
|
+
contextGet as __contextGet,
|
|
6
|
+
contextSet as __contextSet,
|
|
7
|
+
contextRestore as __contextRestore,
|
|
8
|
+
bindContexts as __bindContexts,
|
|
9
|
+
requireBoolean as __requireBoolean,
|
|
10
|
+
normalize as __normalize,
|
|
11
|
+
finite as __finite,
|
|
12
|
+
boundary as __boundary,
|
|
13
|
+
requireArity as __requireArity,
|
|
14
|
+
withArity as __withArity,
|
|
15
|
+
} from "./.lango/runtime.mjs";
|
|
16
|
+
|
|
17
|
+
export function createDriver(config, consumer = false, scheduling = false, cronMonitorIntervalSeconds = 30) {
|
|
18
|
+
__requireArity(arguments.length, [0], "createDriver");
|
|
19
|
+
config = __boundary(config);
|
|
20
|
+
consumer = __boundary(consumer);
|
|
21
|
+
scheduling = __boundary(scheduling);
|
|
22
|
+
cronMonitorIntervalSeconds = __boundary(cronMonitorIntervalSeconds);
|
|
23
|
+
let connections = 2;
|
|
24
|
+
if (__requireBoolean(consumer)) {
|
|
25
|
+
connections = 4;
|
|
26
|
+
}
|
|
27
|
+
let driver = new pgBoss.PgBoss({ connectionString: config.database.connection, connectionTimeoutMillis: __normalize(__hostGlobal(["Math"]).min(2147483647, __finite(config.database.connectTimeoutSeconds * 1000))), statement_timeout: config.database.queryTimeoutMs, schema: schemaName(__normalize(config.application)), max: connections, schedule: scheduling, cronMonitorIntervalSeconds: cronMonitorIntervalSeconds, supervise: consumer, registerInstance: consumer, application_name: "lango-boss" });
|
|
28
|
+
__normalize(driver.on("error", __withArity(__bindContexts((error) => {
|
|
29
|
+
const __contextScope = [];
|
|
30
|
+
try {
|
|
31
|
+
error = __boundary(error);
|
|
32
|
+
__normalize(__contextGet("log").err(`Boss PostgreSQL error: ${__normalize(error.message)}`));
|
|
33
|
+
return null;
|
|
34
|
+
} finally {
|
|
35
|
+
__contextRestore(__contextScope);
|
|
36
|
+
}
|
|
37
|
+
}), [0], "closure")));
|
|
38
|
+
__normalize(driver.on("warning", __withArity(__bindContexts((warning) => {
|
|
39
|
+
const __contextScope = [];
|
|
40
|
+
try {
|
|
41
|
+
warning = __boundary(warning);
|
|
42
|
+
__normalize(__contextGet("log").warn(`Boss PostgreSQL warning: ${__normalize(warning.message)}`));
|
|
43
|
+
return null;
|
|
44
|
+
} finally {
|
|
45
|
+
__contextRestore(__contextScope);
|
|
46
|
+
}
|
|
47
|
+
}), [0], "closure")));
|
|
48
|
+
return driver;
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function prepareQueues(driver, targets) {
|
|
53
|
+
__requireArity(arguments.length, [0, 1], "prepareQueues");
|
|
54
|
+
driver = __boundary(driver);
|
|
55
|
+
targets = __boundary(targets);
|
|
56
|
+
let pending = __normalize(__hostGlobal(["Promise"]).resolve(null));
|
|
57
|
+
let queues = [];
|
|
58
|
+
for (const target of targets) {
|
|
59
|
+
if (__requireBoolean(!__requireBoolean(__normalize(queues.includes(__normalize(target.queue)))))) {
|
|
60
|
+
queues.push(__normalize(target.queue));
|
|
61
|
+
pending = prepareQueue(pending, driver, __normalize(target.queue));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return pending;
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function prepareQueue(pending, driver, name) {
|
|
69
|
+
__requireArity(arguments.length, [0, 1, 2], "prepareQueue");
|
|
70
|
+
pending = __boundary(pending);
|
|
71
|
+
driver = __boundary(driver);
|
|
72
|
+
name = __boundary(name);
|
|
73
|
+
return pending.then(__withArity(__bindContexts((ignored) => {
|
|
74
|
+
ignored = __boundary(ignored);
|
|
75
|
+
return __normalize(driver.createQueue(name, { policy: "standard" }));
|
|
76
|
+
return null;
|
|
77
|
+
}), [0], "closure")).then(__withArity(__bindContexts((ignored) => {
|
|
78
|
+
ignored = __boundary(ignored);
|
|
79
|
+
return __normalize(driver.getQueue(name));
|
|
80
|
+
return null;
|
|
81
|
+
}), [0], "closure")).then(__withArity(__bindContexts((queue) => {
|
|
82
|
+
queue = __boundary(queue);
|
|
83
|
+
if (__requireBoolean(__normalize(queue.policy) !== "standard")) {
|
|
84
|
+
throw "Lango Boss requires standard queues";
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
return null;
|
|
88
|
+
}), [0], "closure"));
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function queueProvider(config) {
|
|
93
|
+
__requireArity(arguments.length, [0], "queueProvider");
|
|
94
|
+
config = __boundary(config);
|
|
95
|
+
return { module: "@lango-project/lango-boss/queue", handler: "createQueue", options: { application: __normalize(config.application), schema: schemaName(__normalize(config.application)), targets: __normalize(config.targets) } };
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=driver.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver.mjs","sources":["driver.lango"],"sourcesContent":["import \"./namespace\"\n schemaName(application)\nimport js \"pg-boss\" as pgBoss\nimport js global Math\nimport js global Promise\n\nexport createDriver(config, consumer = false, scheduling = false, cronMonitorIntervalSeconds = 30)\nexport prepareQueues(driver, targets)\nexport queueProvider(config)\n\ncreateDriver(config, consumer = false, scheduling = false, cronMonitorIntervalSeconds = 30)\n connections = 2\n if consumer\n connections = 4\n driver = new pgBoss/PgBoss({\n connectionString: config.database.connection\n connectionTimeoutMillis: Math/min(2147483647, config.database.connectTimeoutSeconds * 1000)\n statement_timeout: config.database.queryTimeoutMs\n schema: schemaName(config.application)\n max: connections\n schedule: scheduling\n cronMonitorIntervalSeconds: cronMonitorIntervalSeconds\n supervise: consumer\n registerInstance: consumer\n application_name: \"lango-boss\"\n })\n driver.on(\"error\", (error)\n context log\n log.err(\"Boss PostgreSQL error: ${error.message}\")\n )\n driver.on(\"warning\", (warning)\n context log\n log.warn(\"Boss PostgreSQL warning: ${warning.message}\")\n )\n return driver\n\nprepareQueues(driver, targets)\n pending = Promise/resolve(null)\n queues = []\n for targets as target\n if !queues.includes(target.queue)\n queues.add(target.queue)\n pending = prepareQueue(pending, driver, target.queue)\n return pending\n\nprepareQueue(pending, driver, name)\n return chain pending\n then(ignored)\n capture driver\n capture name\n return driver.createQueue(name, {\n policy: \"standard\"\n })\n then(ignored)\n capture driver\n capture name\n return driver.getQueue(name)\n then(queue)\n if queue.policy != \"standard\"\n throw \"Lango Boss requires standard queues\"\n return null\n\nqueueProvider(config)\n return {\n module: \"@lango-project/lango-boss/queue\"\n handler: \"createQueue\"\n options: {\n application: config.application\n schema: schemaName(config.application)\n targets: config.targets\n }\n }\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA;;;;;;;;;;;;;;;;AASA;;;;;;;;;;;;;;;;;;;;;;;;AAiBA;;;;;;;"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
hostGlobal as __hostGlobal,
|
|
3
|
+
isNumber as __isNumber,
|
|
4
|
+
isString as __isString,
|
|
5
|
+
isBool as __isBool,
|
|
6
|
+
isObject as __isObject,
|
|
7
|
+
isArray as __isArray,
|
|
8
|
+
entries as __entries,
|
|
9
|
+
requireBoolean as __requireBoolean,
|
|
10
|
+
normalize as __normalize,
|
|
11
|
+
numericAdd as __numericAdd,
|
|
12
|
+
boundary as __boundary,
|
|
13
|
+
requireArity as __requireArity,
|
|
14
|
+
} from "./.lango/runtime.mjs";
|
|
15
|
+
|
|
16
|
+
function map(value, label) {
|
|
17
|
+
__requireArity(arguments.length, [0, 1], "map");
|
|
18
|
+
value = __boundary(value);
|
|
19
|
+
label = __boundary(label);
|
|
20
|
+
if (__requireBoolean(__requireBoolean(__requireBoolean(value === null) || __requireBoolean(!__requireBoolean(__isObject(value)))) || __requireBoolean(__isArray(value)))) {
|
|
21
|
+
throw `${label} must be a map`;
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function fields(value, allowed) {
|
|
28
|
+
__requireArity(arguments.length, [0, 1], "fields");
|
|
29
|
+
value = __boundary(value);
|
|
30
|
+
allowed = __boundary(allowed);
|
|
31
|
+
for (const [key, item] of __entries(value)) {
|
|
32
|
+
if (__requireBoolean(!__requireBoolean(__normalize(allowed.includes(key))))) {
|
|
33
|
+
throw `Unknown envelope field: ${key}`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function executionTask(config, queue, job) {
|
|
41
|
+
__requireArity(arguments.length, [0, 1, 2], "executionTask");
|
|
42
|
+
config = __boundary(config);
|
|
43
|
+
queue = __boundary(queue);
|
|
44
|
+
job = __boundary(job);
|
|
45
|
+
let payload = __normalize(job.data);
|
|
46
|
+
map(payload, "Job envelope");
|
|
47
|
+
fields(payload, ["version", "application", "path", "input", "source", "failedRetentionSeconds"]);
|
|
48
|
+
if (__requireBoolean(__requireBoolean(__normalize(payload.version) !== 1) || __requireBoolean(__normalize(payload.application) !== __normalize(config.application)))) {
|
|
49
|
+
throw "Unsupported or foreign job envelope";
|
|
50
|
+
}
|
|
51
|
+
let target = null;
|
|
52
|
+
for (const item of __normalize(config.targets)) {
|
|
53
|
+
if (__requireBoolean(__requireBoolean(__normalize(item.path) === __normalize(payload.path)) && __requireBoolean(__normalize(item.queue) === queue))) {
|
|
54
|
+
target = item;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (__requireBoolean(target === null)) {
|
|
58
|
+
throw "Job path is not registered for this queue";
|
|
59
|
+
}
|
|
60
|
+
map(__normalize(payload.input), "Job input");
|
|
61
|
+
let source = __normalize(payload.source);
|
|
62
|
+
map(source, "Job source");
|
|
63
|
+
fields(source, ["kind", "clientId", "userId", "grantId", "identity"]);
|
|
64
|
+
for (const [key, value] of __entries(source)) {
|
|
65
|
+
if (__requireBoolean(__requireBoolean(!__requireBoolean(__isString(value))) || __requireBoolean(__normalize(value.trim()) === ""))) {
|
|
66
|
+
throw "Job source references must be nonempty strings";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (__normalize(source.kind) === "user") {
|
|
70
|
+
if (__requireBoolean(__requireBoolean(__normalize(source.clientId) === null) || __requireBoolean(__normalize(source.identity) !== null))) {
|
|
71
|
+
throw "Invalid user job source";
|
|
72
|
+
}
|
|
73
|
+
} else if (__normalize(source.kind) === "system") {
|
|
74
|
+
if (__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__normalize(source.identity) === null) || __requireBoolean(__normalize(source.clientId) !== null)) || __requireBoolean(__normalize(source.userId) !== null)) || __requireBoolean(__normalize(source.grantId) !== null))) {
|
|
75
|
+
throw "Invalid system job source";
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
throw "Unsupported job source";
|
|
79
|
+
}
|
|
80
|
+
if (__requireBoolean(__requireBoolean(__requireBoolean(!__requireBoolean(__normalize(__hostGlobal(["Number"]).isSafeInteger(__normalize(payload.failedRetentionSeconds))))) || __requireBoolean(__normalize(payload.failedRetentionSeconds) < 1)) || __requireBoolean(__normalize(payload.failedRetentionSeconds) > 2147483647))) {
|
|
81
|
+
throw "Invalid failed retention metadata";
|
|
82
|
+
}
|
|
83
|
+
if (__requireBoolean(__requireBoolean(!__requireBoolean(__normalize(__hostGlobal(["Number"]).isSafeInteger(__normalize(job.retryCount))))) || __requireBoolean(__normalize(job.retryCount) < 0))) {
|
|
84
|
+
throw "Invalid job attempt metadata";
|
|
85
|
+
}
|
|
86
|
+
if (__requireBoolean(__requireBoolean(__requireBoolean(!__requireBoolean(__normalize(__hostGlobal(["Number"]).isSafeInteger(__normalize(job.expireInSeconds))))) || __requireBoolean(__normalize(job.expireInSeconds) < 1)) || __requireBoolean(__normalize(job.expireInSeconds) > 1209600))) {
|
|
87
|
+
throw "Invalid job expiration metadata";
|
|
88
|
+
}
|
|
89
|
+
return { id: __normalize(job.id), path: __normalize(target.path), input: __normalize(payload.input), source: source, attempt: __numericAdd(__normalize(job.retryCount), 1) };
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=envelope.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envelope.mjs","sources":["envelope.lango"],"sourcesContent":["import js global Number\n\nexport executionTask(config, queue, job)\n\nmap(value, label)\n if value == null or !is_object(value) or is_array(value)\n throw \"${label} must be a map\"\n return null\n\nfields(value, allowed)\n for value as key: item\n if !allowed.includes(key)\n throw \"Unknown envelope field: ${key}\"\n return null\n\nexecutionTask(config, queue, job)\n payload = job.data\n map(payload, \"Job envelope\")\n fields(payload, [\"version\", \"application\", \"path\", \"input\", \"source\", \"failedRetentionSeconds\"])\n if payload.version != 1 or payload.application != config.application\n throw \"Unsupported or foreign job envelope\"\n target = null\n for config.targets as item\n if item.path == payload.path and item.queue == queue\n target = item\n if target == null\n throw \"Job path is not registered for this queue\"\n map(payload.input, \"Job input\")\n source = payload.source\n map(source, \"Job source\")\n fields(source, [\"kind\", \"clientId\", \"userId\", \"grantId\", \"identity\"])\n for source as key: value\n if !is_string(value) or value.trim() == \"\"\n throw \"Job source references must be nonempty strings\"\n switch source.kind\n case \"user\"\n if source.clientId == null or source.identity != null\n throw \"Invalid user job source\"\n case \"system\"\n if source.identity == null or source.clientId != null or source.userId != null or source.grantId != null\n throw \"Invalid system job source\"\n else\n throw \"Unsupported job source\"\n if !Number/isSafeInteger(payload.failedRetentionSeconds) or payload.failedRetentionSeconds < 1 or payload.failedRetentionSeconds > 2147483647\n throw \"Invalid failed retention metadata\"\n if !Number/isSafeInteger(job.retryCount) or job.retryCount < 0\n throw \"Invalid job attempt metadata\"\n if !Number/isSafeInteger(job.expireInSeconds) or job.expireInSeconds < 1 or job.expireInSeconds > 1209600\n throw \"Invalid job expiration metadata\"\n return {\n id: job.id\n path: target.path\n input: payload.input\n source: source\n attempt: job.retryCount + 1\n }\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAIA;;;;;;;;;;;AAKA;;;;;;;;;;;;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/library.mjs
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { loadConfiguration as configuration } from "./configuration.mjs";
|
|
2
|
+
import { Boss as BossClass } from "./boss.mjs";
|
|
3
|
+
import { Worker as WorkerClass } from "./worker.mjs";
|
|
4
|
+
import {
|
|
5
|
+
contextGet as __contextGet,
|
|
6
|
+
contextSet as __contextSet,
|
|
7
|
+
contextRestore as __contextRestore,
|
|
8
|
+
normalize as __normalize,
|
|
9
|
+
boundary as __boundary,
|
|
10
|
+
requireArity as __requireArity,
|
|
11
|
+
} from "./.lango/runtime.mjs";
|
|
12
|
+
|
|
13
|
+
export let Boss = BossClass;
|
|
14
|
+
|
|
15
|
+
export let Worker = WorkerClass;
|
|
16
|
+
export function loadConfiguration(directory) {
|
|
17
|
+
__requireArity(arguments.length, [0], "loadConfiguration");
|
|
18
|
+
directory = __boundary(directory);
|
|
19
|
+
return configuration(directory);
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function jobs(options = null) {
|
|
24
|
+
const __contextScope = [];
|
|
25
|
+
try {
|
|
26
|
+
options = __boundary(options);
|
|
27
|
+
return __normalize(__contextGet("queue").jobs(options));
|
|
28
|
+
return null;
|
|
29
|
+
} finally {
|
|
30
|
+
__contextRestore(__contextScope);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function job(id) {
|
|
35
|
+
const __contextScope = [];
|
|
36
|
+
try {
|
|
37
|
+
__requireArity(arguments.length, [0], "job");
|
|
38
|
+
id = __boundary(id);
|
|
39
|
+
return __normalize(__contextGet("queue").job(id));
|
|
40
|
+
return null;
|
|
41
|
+
} finally {
|
|
42
|
+
__contextRestore(__contextScope);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function retry(id) {
|
|
47
|
+
const __contextScope = [];
|
|
48
|
+
try {
|
|
49
|
+
__requireArity(arguments.length, [0], "retry");
|
|
50
|
+
id = __boundary(id);
|
|
51
|
+
return __normalize(__contextGet("queue").manage("retry", id));
|
|
52
|
+
return null;
|
|
53
|
+
} finally {
|
|
54
|
+
__contextRestore(__contextScope);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function cancel(id) {
|
|
59
|
+
const __contextScope = [];
|
|
60
|
+
try {
|
|
61
|
+
__requireArity(arguments.length, [0], "cancel");
|
|
62
|
+
id = __boundary(id);
|
|
63
|
+
return __normalize(__contextGet("queue").manage("cancel", id));
|
|
64
|
+
return null;
|
|
65
|
+
} finally {
|
|
66
|
+
__contextRestore(__contextScope);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function queues(options = null) {
|
|
71
|
+
const __contextScope = [];
|
|
72
|
+
try {
|
|
73
|
+
options = __boundary(options);
|
|
74
|
+
return __normalize(__contextGet("queue").manage("queues", null, options));
|
|
75
|
+
return null;
|
|
76
|
+
} finally {
|
|
77
|
+
__contextRestore(__contextScope);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function schedules(options = null) {
|
|
82
|
+
const __contextScope = [];
|
|
83
|
+
try {
|
|
84
|
+
options = __boundary(options);
|
|
85
|
+
return __normalize(__contextGet("queue").manage("schedules", null, options));
|
|
86
|
+
return null;
|
|
87
|
+
} finally {
|
|
88
|
+
__contextRestore(__contextScope);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function pauseQueue(name) {
|
|
93
|
+
const __contextScope = [];
|
|
94
|
+
try {
|
|
95
|
+
__requireArity(arguments.length, [0], "pauseQueue");
|
|
96
|
+
name = __boundary(name);
|
|
97
|
+
return __normalize(__contextGet("queue").manage("pauseQueue", name));
|
|
98
|
+
return null;
|
|
99
|
+
} finally {
|
|
100
|
+
__contextRestore(__contextScope);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function resumeQueue(name) {
|
|
105
|
+
const __contextScope = [];
|
|
106
|
+
try {
|
|
107
|
+
__requireArity(arguments.length, [0], "resumeQueue");
|
|
108
|
+
name = __boundary(name);
|
|
109
|
+
return __normalize(__contextGet("queue").manage("resumeQueue", name));
|
|
110
|
+
return null;
|
|
111
|
+
} finally {
|
|
112
|
+
__contextRestore(__contextScope);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function pauseSchedule(name) {
|
|
117
|
+
const __contextScope = [];
|
|
118
|
+
try {
|
|
119
|
+
__requireArity(arguments.length, [0], "pauseSchedule");
|
|
120
|
+
name = __boundary(name);
|
|
121
|
+
return __normalize(__contextGet("queue").manage("pauseSchedule", name));
|
|
122
|
+
return null;
|
|
123
|
+
} finally {
|
|
124
|
+
__contextRestore(__contextScope);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function resumeSchedule(name) {
|
|
129
|
+
const __contextScope = [];
|
|
130
|
+
try {
|
|
131
|
+
__requireArity(arguments.length, [0], "resumeSchedule");
|
|
132
|
+
name = __boundary(name);
|
|
133
|
+
return __normalize(__contextGet("queue").manage("resumeSchedule", name));
|
|
134
|
+
return null;
|
|
135
|
+
} finally {
|
|
136
|
+
__contextRestore(__contextScope);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=library.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library.mjs","sources":["library.lango"],"sourcesContent":["import \"./configuration\"\n alias configuration = loadConfiguration(directory)\nimport \"./boss\"\n alias BossClass = class Boss\nimport \"./worker\"\n alias WorkerClass = class Worker\n\nexport loadConfiguration(directory)\nexport global Boss\nexport global Worker\nexport jobs(options = null)\nexport job(id)\nexport retry(id)\nexport cancel(id)\nexport queues(options = null)\nexport schedules(options = null)\nexport pauseQueue(name)\nexport resumeQueue(name)\nexport pauseSchedule(name)\nexport resumeSchedule(name)\n\nglobal Boss = BossClass\nglobal Worker = WorkerClass\n\nloadConfiguration(directory)\n return configuration(directory)\n\njobs(options = null)\n context queue\n return queue.jobs(options)\n\njob(id)\n context queue\n return queue.job(id)\n\nretry(id)\n context queue\n return queue.manage(\"retry\", id)\n\ncancel(id)\n context queue\n return queue.manage(\"cancel\", id)\n\nqueues(options = null)\n context queue\n return queue.manage(\"queues\", null, options)\n\nschedules(options = null)\n context queue\n return queue.manage(\"schedules\", null, options)\n\npauseQueue(name)\n context queue\n return queue.manage(\"pauseQueue\", name)\n\nresumeQueue(name)\n context queue\n return queue.manage(\"resumeQueue\", name)\n\npauseSchedule(name)\n context queue\n return queue.manage(\"pauseSchedule\", name)\n\nresumeSchedule(name)\n context queue\n return queue.manage(\"resumeSchedule\", name)\n"],"names":[],"mappings":";;;;;;;;;;;;AAqBA;;AACA;AAEA;;;;;;;AAGA;;;;;;;;;;;AAIA;;;;;;;;;;;;AAIA;;;;;;;;;;;;AAIA;;;;;;;;;;;;AAIA;;;;;;;;;;;AAIA;;;;;;;;;;;AAIA;;;;;;;;;;;;AAIA;;;;;;;;;;;;AAIA;;;;;;;;;;;;AAIA;;;;;;;;;;;;"}
|