@quatrain/worker 1.2.1 → 1.2.2
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/Worker.js +7 -7
- package/dist/Worker.test.js +2 -2
- package/package.json +3 -3
- package/src/Helpers.ts +1 -1
- package/src/Worker.test.ts +1 -1
- package/src/Worker.ts +2 -2
package/dist/Worker.js
CHANGED
|
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Worker = void 0;
|
|
7
7
|
const core_1 = require("@quatrain/core");
|
|
8
|
-
const
|
|
8
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
9
9
|
const axios_1 = __importDefault(require("axios"));
|
|
10
|
-
const
|
|
10
|
+
const node_child_process_1 = require("node:child_process");
|
|
11
11
|
class Worker extends core_1.Core {
|
|
12
12
|
static endpoint = '';
|
|
13
13
|
static logger = this.addLogger('Worker');
|
|
@@ -24,7 +24,7 @@ class Worker extends core_1.Core {
|
|
|
24
24
|
Worker.info(`Executing command ${command} in ${cwd} with arguments:`);
|
|
25
25
|
args.forEach((arg) => console.log(`\t${arg}`));
|
|
26
26
|
return new Promise((resolve, reject) => {
|
|
27
|
-
const child = (0,
|
|
27
|
+
const child = (0, node_child_process_1.spawn)(command, args, { cwd, shell: false });
|
|
28
28
|
child.stdout.on('data', (data) => Worker.debug(data.toString()));
|
|
29
29
|
child.stderr.on('data', (data) => Worker.debug(data.toString()));
|
|
30
30
|
child.on('close', (code) => {
|
|
@@ -59,8 +59,8 @@ class Worker extends core_1.Core {
|
|
|
59
59
|
ts = ts === Date.now() ? Date.now() + 1 : Date.now();
|
|
60
60
|
const payload = {
|
|
61
61
|
event,
|
|
62
|
-
worker: `Container ${
|
|
63
|
-
os: `${
|
|
62
|
+
worker: `Container ${node_os_1.default.hostname}`,
|
|
63
|
+
os: `${node_os_1.default.type} ${node_os_1.default.release} (${node_os_1.default.platform} ${node_os_1.default.arch})`,
|
|
64
64
|
...data,
|
|
65
65
|
ts,
|
|
66
66
|
};
|
|
@@ -93,8 +93,8 @@ class Worker extends core_1.Core {
|
|
|
93
93
|
ts = ts === Date.now() ? Date.now() + 1 : Date.now();
|
|
94
94
|
const payload = {
|
|
95
95
|
event,
|
|
96
|
-
worker: `Container ${
|
|
97
|
-
os: `${
|
|
96
|
+
worker: `Container ${node_os_1.default.hostname}`,
|
|
97
|
+
os: `${node_os_1.default.type} ${node_os_1.default.release} (${node_os_1.default.platform} ${node_os_1.default.arch})`,
|
|
98
98
|
...data,
|
|
99
99
|
ts,
|
|
100
100
|
};
|
package/dist/Worker.test.js
CHANGED
|
@@ -5,12 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Worker_1 = require("./Worker");
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const
|
|
8
|
+
const node_child_process_1 = require("node:child_process");
|
|
9
9
|
// Mock dependencies
|
|
10
10
|
jest.mock('axios');
|
|
11
11
|
jest.mock('child_process');
|
|
12
12
|
const mockedAxios = axios_1.default;
|
|
13
|
-
const mockedSpawn =
|
|
13
|
+
const mockedSpawn = node_child_process_1.spawn;
|
|
14
14
|
describe('Worker', () => {
|
|
15
15
|
beforeEach(() => {
|
|
16
16
|
// Clear all mocks before each test
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/worker",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Container Worker helpers",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"typescript": "^5.1.5"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@quatrain/core": "^1.2.
|
|
37
|
+
"@quatrain/core": "^1.2.5",
|
|
38
38
|
"@quatrain/queue": "^1.2.1",
|
|
39
|
-
"@quatrain/storage": "^1.2.
|
|
39
|
+
"@quatrain/storage": "^1.2.2",
|
|
40
40
|
"axios": "^1.7.7",
|
|
41
41
|
"fluent-ffmpeg": "^2.1.2",
|
|
42
42
|
"fs-extra": "^11.2.0",
|
package/src/Helpers.ts
CHANGED
package/src/Worker.test.ts
CHANGED
package/src/Worker.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Core } from '@quatrain/core'
|
|
2
|
-
import os from 'os'
|
|
2
|
+
import os from 'node:os'
|
|
3
3
|
import axios from 'axios'
|
|
4
|
-
import { spawn } from 'child_process'
|
|
4
|
+
import { spawn } from 'node:child_process'
|
|
5
5
|
import { HandlerParameters } from './types/HandlerParameters'
|
|
6
6
|
|
|
7
7
|
export class Worker extends Core {
|