@openfn/ws-worker 0.1.6 → 0.1.8
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/CHANGELOG.md +16 -0
- package/dist/index.js +4 -3
- package/dist/start.js +5 -5
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# ws-worker
|
|
2
2
|
|
|
3
|
+
## 0.1.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b8fd13d: Fix undefined log output
|
|
8
|
+
|
|
9
|
+
## 0.1.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 8f7f57b: Send timestamps as strings in microsecond precision
|
|
14
|
+
- Updated dependencies [ca701e8]
|
|
15
|
+
- @openfn/logger@0.0.19
|
|
16
|
+
- @openfn/engine-multi@0.1.5
|
|
17
|
+
- @openfn/runtime@0.0.33
|
|
18
|
+
|
|
3
19
|
## 0.1.6
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -216,7 +216,7 @@ var eventMap = {
|
|
|
216
216
|
"workflow-start": ATTEMPT_START,
|
|
217
217
|
"job-start": RUN_START,
|
|
218
218
|
"job-complete": RUN_COMPLETE,
|
|
219
|
-
log: ATTEMPT_LOG,
|
|
219
|
+
"workflow-log": ATTEMPT_LOG,
|
|
220
220
|
"workflow-complete": ATTEMPT_COMPLETE
|
|
221
221
|
};
|
|
222
222
|
function execute(channel, engine, logger, plan, options = {}, onComplete = (_result) => {
|
|
@@ -231,7 +231,7 @@ function execute(channel, engine, logger, plan, options = {}, onComplete = (_res
|
|
|
231
231
|
const context = { channel, state, logger, onComplete };
|
|
232
232
|
const addEvent = (eventName, handler) => {
|
|
233
233
|
const wrappedFn = async (event) => {
|
|
234
|
-
const lightningEvent = eventMap[eventName];
|
|
234
|
+
const lightningEvent = eventMap[eventName] ?? eventName;
|
|
235
235
|
try {
|
|
236
236
|
await handler(context, event);
|
|
237
237
|
logger.info(`${plan.id} :: ${lightningEvent} :: OK`);
|
|
@@ -328,12 +328,13 @@ async function onWorkflowError({ state, channel, onComplete }, event) {
|
|
|
328
328
|
onComplete({});
|
|
329
329
|
}
|
|
330
330
|
function onJobLog({ channel, state }, event) {
|
|
331
|
+
const timeInMicroseconds = BigInt(event.time) / BigInt(1e3);
|
|
331
332
|
const log = {
|
|
332
333
|
attempt_id: state.plan.id,
|
|
333
334
|
message: event.message,
|
|
334
335
|
source: event.name,
|
|
335
336
|
level: event.level,
|
|
336
|
-
timestamp:
|
|
337
|
+
timestamp: timeInMicroseconds.toString()
|
|
337
338
|
};
|
|
338
339
|
if (state.activeRun) {
|
|
339
340
|
log.run_id = state.activeRun;
|
package/dist/start.js
CHANGED
|
@@ -4917,7 +4917,7 @@ async function createMock() {
|
|
|
4917
4917
|
workflowId,
|
|
4918
4918
|
message,
|
|
4919
4919
|
level: "info",
|
|
4920
|
-
|
|
4920
|
+
time: (BigInt(Date.now()) * BigInt(1e3)).toString(),
|
|
4921
4921
|
name: "mck"
|
|
4922
4922
|
});
|
|
4923
4923
|
};
|
|
@@ -5198,7 +5198,7 @@ var eventMap = {
|
|
|
5198
5198
|
"workflow-start": ATTEMPT_START,
|
|
5199
5199
|
"job-start": RUN_START,
|
|
5200
5200
|
"job-complete": RUN_COMPLETE,
|
|
5201
|
-
log: ATTEMPT_LOG,
|
|
5201
|
+
"workflow-log": ATTEMPT_LOG,
|
|
5202
5202
|
"workflow-complete": ATTEMPT_COMPLETE
|
|
5203
5203
|
};
|
|
5204
5204
|
function execute(channel, engine, logger2, plan, options = {}, onComplete = (_result) => {
|
|
@@ -5213,7 +5213,7 @@ function execute(channel, engine, logger2, plan, options = {}, onComplete = (_re
|
|
|
5213
5213
|
const context = { channel, state, logger: logger2, onComplete };
|
|
5214
5214
|
const addEvent = (eventName, handler) => {
|
|
5215
5215
|
const wrappedFn = async (event) => {
|
|
5216
|
-
const lightningEvent = eventMap[eventName];
|
|
5216
|
+
const lightningEvent = eventMap[eventName] ?? eventName;
|
|
5217
5217
|
try {
|
|
5218
5218
|
await handler(context, event);
|
|
5219
5219
|
logger2.info(`${plan.id} :: ${lightningEvent} :: OK`);
|
|
@@ -5310,12 +5310,13 @@ async function onWorkflowError({ state, channel, onComplete }, event) {
|
|
|
5310
5310
|
onComplete({});
|
|
5311
5311
|
}
|
|
5312
5312
|
function onJobLog({ channel, state }, event) {
|
|
5313
|
+
const timeInMicroseconds = BigInt(event.time) / BigInt(1e3);
|
|
5313
5314
|
const log = {
|
|
5314
5315
|
attempt_id: state.plan.id,
|
|
5315
5316
|
message: event.message,
|
|
5316
5317
|
source: event.name,
|
|
5317
5318
|
level: event.level,
|
|
5318
|
-
timestamp:
|
|
5319
|
+
timestamp: timeInMicroseconds.toString()
|
|
5319
5320
|
};
|
|
5320
5321
|
if (state.activeRun) {
|
|
5321
5322
|
log.run_id = state.activeRun;
|
|
@@ -5583,7 +5584,6 @@ if (args.lightning === "mock") {
|
|
|
5583
5584
|
args.secret = WORKER_SECRET;
|
|
5584
5585
|
}
|
|
5585
5586
|
var [minBackoff, maxBackoff] = args.backoff.split("/").map((n) => parseInt(n, 10) * 1e3);
|
|
5586
|
-
console.log(minBackoff, maxBackoff);
|
|
5587
5587
|
function engineReady(engine) {
|
|
5588
5588
|
server_default(engine, {
|
|
5589
5589
|
port: args.port,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/ws-worker",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "A Websocket Worker to connect Lightning to a Runtime Engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"koa-logger": "^3.2.1",
|
|
22
22
|
"phoenix": "^1.7.7",
|
|
23
23
|
"ws": "^8.14.1",
|
|
24
|
-
"@openfn/engine-multi": "0.1.
|
|
25
|
-
"@openfn/logger": "0.0.
|
|
26
|
-
"@openfn/runtime": "0.0.
|
|
24
|
+
"@openfn/engine-multi": "0.1.5",
|
|
25
|
+
"@openfn/logger": "0.0.19",
|
|
26
|
+
"@openfn/runtime": "0.0.33"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/koa": "^2.13.5",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"tsup": "^6.2.3",
|
|
41
41
|
"typescript": "^4.6.4",
|
|
42
42
|
"yargs": "^17.6.2",
|
|
43
|
-
"@openfn/lightning-mock": "1.0.
|
|
43
|
+
"@openfn/lightning-mock": "1.0.6"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"dist",
|