@quatrain/worker 1.1.11 → 1.1.13
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/lib/FileSystem.js +1 -1
- package/lib/Worker.js +8 -8
- package/package.json +6 -6
package/lib/FileSystem.js
CHANGED
|
@@ -101,7 +101,6 @@ class FileSystem {
|
|
|
101
101
|
});
|
|
102
102
|
Worker_1.Worker.info(`Uploading file ${filename} with size ${size} bytes`);
|
|
103
103
|
(0, node_fetch_native_1.default)(destination, {
|
|
104
|
-
//res.headers.get('location'), {
|
|
105
104
|
method: 'PUT',
|
|
106
105
|
mode: 'cors',
|
|
107
106
|
duplex: 'half',
|
|
@@ -121,6 +120,7 @@ class FileSystem {
|
|
|
121
120
|
// .catch((err: any) => reject(err))
|
|
122
121
|
}
|
|
123
122
|
catch (err) {
|
|
123
|
+
console.log(err);
|
|
124
124
|
reject(err);
|
|
125
125
|
}
|
|
126
126
|
});
|
package/lib/Worker.js
CHANGED
|
@@ -24,18 +24,18 @@ class Worker extends core_1.Core {
|
|
|
24
24
|
return new Promise((resolve, reject) => {
|
|
25
25
|
const child = (0, child_process_1.spawn)(command, args, { cwd });
|
|
26
26
|
child.stdout.on('data', (data) => {
|
|
27
|
-
|
|
27
|
+
Worker.debug(data.toString());
|
|
28
28
|
});
|
|
29
29
|
child.stderr.on('data', (data) => {
|
|
30
|
-
|
|
30
|
+
Worker.debug(data.toString());
|
|
31
31
|
});
|
|
32
32
|
child.on('close', (code) => {
|
|
33
33
|
if (code !== 0) {
|
|
34
|
-
|
|
34
|
+
Worker.error(`Command execution failed with code: ${code}`);
|
|
35
35
|
reject(code);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
|
|
38
|
+
Worker.info(`Command execution completed with code: ${code}`);
|
|
39
39
|
resolve(undefined);
|
|
40
40
|
}
|
|
41
41
|
});
|
|
@@ -43,7 +43,7 @@ class Worker extends core_1.Core {
|
|
|
43
43
|
};
|
|
44
44
|
static pushEvent(event, data = {}, ts = 0) {
|
|
45
45
|
if (!this.endpoint) {
|
|
46
|
-
Worker.
|
|
46
|
+
Worker.warn(`Events endpoint is not set, can't send update!`);
|
|
47
47
|
return false;
|
|
48
48
|
}
|
|
49
49
|
ts = ts === Date.now() ? Date.now() + 1 : Date.now();
|
|
@@ -55,9 +55,9 @@ class Worker extends core_1.Core {
|
|
|
55
55
|
ts,
|
|
56
56
|
};
|
|
57
57
|
axios_1.default
|
|
58
|
-
.
|
|
59
|
-
.then((res) => Worker.
|
|
60
|
-
.catch((err) => Worker.
|
|
58
|
+
.patch(Worker.endpoint, payload)
|
|
59
|
+
.then((res) => Worker.info(`Event pushed to backend: ${res.statusText}`))
|
|
60
|
+
.catch((err) => Worker.error(`Failed to push event to backend: ${err}`));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
exports.Worker = Worker;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/worker",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"description": "Container Worker helpers",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"typescript": "^5.1.5"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@quatrain/core": "^1.1.
|
|
27
|
+
"@quatrain/core": "^1.1.11",
|
|
28
28
|
"axios": "^1.7.7",
|
|
29
29
|
"fs-extra": "^11.2.0",
|
|
30
30
|
"node-fetch-native": "^1.6.4"
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"wbuild": "tsc --watch",
|
|
36
36
|
"bump-to": "yarn version",
|
|
37
37
|
"hash": "node ../../bin/hashFolder.js",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"publish": "yarn
|
|
41
|
-
"
|
|
38
|
+
"hash:persist": "yarn hash > .hash_latest.txt",
|
|
39
|
+
"hash:compare": "yarn hash > .hash_newest.txt && cmp -s .hash_latest.txt .hash_newest.txt",
|
|
40
|
+
"publish": "yarn hash:compare || yarn publish:process",
|
|
41
|
+
"publish:process": "yarn version patch && yarn build && yarn npm publish --access public && yarn hash:persist"
|
|
42
42
|
}
|
|
43
43
|
}
|