@gapi/cli-builder 1.8.169 → 1.8.170
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/coverage/block-navigation.js +9 -1
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +27 -22
- package/coverage/lcov-report/block-navigation.js +9 -1
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +27 -22
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +40 -0
- package/coverage/lcov-report/src/app.constants.ts.html +12 -7
- package/coverage/lcov-report/src/core/services/index.html +22 -17
- package/coverage/lcov-report/src/core/services/systemctl.ts.html +69 -37
- package/coverage/lcov-report/src/index.html +16 -11
- package/coverage/lcov.info +53 -36
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +40 -0
- package/coverage/src/app.constants.ts.html +12 -7
- package/coverage/src/core/services/index.html +22 -17
- package/coverage/src/core/services/systemctl.ts.html +69 -37
- package/coverage/src/index.html +16 -11
- package/dist/app.constants.d.ts +1 -1
- package/dist/app.constants.js +17 -15
- package/dist/app.controller.d.ts +0 -1
- package/dist/app.controller.js +7 -7
- package/dist/app.frame.js +3 -3
- package/dist/app.tokents.d.ts +2 -2
- package/dist/app.tokents.js +5 -5
- package/dist/app.types.d.ts +1 -3
- package/dist/cli-builder.js +5 -5
- package/dist/core/core.moduile.js +3 -3
- package/dist/core/executors/commands.d.ts +4 -4
- package/dist/core/executors/commands.js +4 -2
- package/dist/core/executors/helpers/execute.js +3 -2
- package/dist/core/executors/helpers/index.js +6 -2
- package/dist/core/executors/index.js +6 -2
- package/dist/core/services/get-ip-adresses.js +5 -3
- package/dist/core/services/subscription.service.d.ts +1 -1
- package/dist/core/services/subscription.service.js +12 -12
- package/dist/core/services/systemctl.js +32 -22
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -4
- package/dist/scalar-object.d.ts +2 -2
- package/dist/scalar-object.js +0 -1
- package/eslint.config.mjs +38 -0
- package/package.json +5 -5
- package/src/app.constants.ts +1 -1
- package/src/app.controller.ts +4 -4
- package/src/app.frame.ts +5 -3
- package/src/app.tokents.ts +5 -3
- package/src/cli-builder.ts +8 -7
- package/src/core/executors/commands.ts +5 -5
- package/src/core/executors/helpers/execute.ts +1 -1
- package/src/core/services/get-ip-adresses.ts +1 -1
- package/src/core/services/subscription.service.ts +44 -34
- package/src/core/services/systemctl.spec.ts +4 -4
- package/src/core/services/systemctl.ts +26 -17
- package/src/index.ts +3 -4
- package/src/main.ts +6 -6
- package/src/scalar-object.ts +3 -4
|
@@ -10,16 +10,16 @@ describe('[SystemCTL]: tests', () => {
|
|
|
10
10
|
const config = systemctl.generateConfig();
|
|
11
11
|
console.log(config);
|
|
12
12
|
expect(
|
|
13
|
-
config.includes('GRAPHQL_RUNNER_API_PORT=42043')
|
|
13
|
+
config.includes('GRAPHQL_RUNNER_API_PORT=42043'),
|
|
14
14
|
).toBeTruthy();
|
|
15
15
|
expect(
|
|
16
|
-
config.includes('GRAPHQL_RUNNER_GRAPHIQL=true')
|
|
16
|
+
config.includes('GRAPHQL_RUNNER_GRAPHIQL=true'),
|
|
17
17
|
).toBeTruthy();
|
|
18
18
|
expect(
|
|
19
|
-
config.includes('GRAPHQL_RUNNER_TYPE=true')
|
|
19
|
+
config.includes('GRAPHQL_RUNNER_TYPE=true'),
|
|
20
20
|
).toBeTruthy();
|
|
21
21
|
expect(
|
|
22
|
-
config.includes('WantedBy=multi-user.target')
|
|
22
|
+
config.includes('WantedBy=multi-user.target'),
|
|
23
23
|
).toBeTruthy();
|
|
24
24
|
});
|
|
25
25
|
});
|
|
@@ -18,21 +18,32 @@ export class SystemctlService {
|
|
|
18
18
|
await this.install(
|
|
19
19
|
service_description,
|
|
20
20
|
service,
|
|
21
|
-
executableBinary
|
|
21
|
+
executableBinary,
|
|
22
22
|
);
|
|
23
|
-
} catch (e) {
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.error(e);
|
|
25
|
+
}
|
|
24
26
|
try {
|
|
25
27
|
await this.reload();
|
|
26
|
-
} catch (e) {
|
|
28
|
+
} catch (e) {
|
|
29
|
+
console.error(e);
|
|
30
|
+
}
|
|
27
31
|
try {
|
|
28
32
|
await this.enable(service);
|
|
29
|
-
} catch (e) {
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.error(e);
|
|
35
|
+
}
|
|
36
|
+
|
|
30
37
|
try {
|
|
31
38
|
await this.stop(service);
|
|
32
|
-
} catch (e) {
|
|
39
|
+
} catch (e) {
|
|
40
|
+
console.error(e);
|
|
41
|
+
}
|
|
33
42
|
try {
|
|
34
43
|
await this.start(service);
|
|
35
|
-
} catch (e) {
|
|
44
|
+
} catch (e) {
|
|
45
|
+
console.error(e);
|
|
46
|
+
}
|
|
36
47
|
}
|
|
37
48
|
|
|
38
49
|
async enable(name: string) {
|
|
@@ -41,7 +52,7 @@ export class SystemctlService {
|
|
|
41
52
|
|
|
42
53
|
generateConfig(
|
|
43
54
|
description = 'Graphql Runner',
|
|
44
|
-
executable = 'runner-linux'
|
|
55
|
+
executable = 'runner-linux',
|
|
45
56
|
) {
|
|
46
57
|
return `
|
|
47
58
|
[Unit]
|
|
@@ -56,7 +67,7 @@ ${Object.entries(Environment)
|
|
|
56
67
|
'GRAPHQL_SYSTEM_SERVICE',
|
|
57
68
|
'GRAPHQL_SYSTEM_SERVICE_NAME',
|
|
58
69
|
'GRAPHQL_SYSTEM_SERVICE_DESCRIPTION',
|
|
59
|
-
].includes(key) && !!value
|
|
70
|
+
].includes(key) && !!value,
|
|
60
71
|
)
|
|
61
72
|
.map(([key, value]) => `Environment="${key}=${value}"`)
|
|
62
73
|
.join('\n')}
|
|
@@ -71,25 +82,23 @@ WantedBy=multi-user.target
|
|
|
71
82
|
async install(
|
|
72
83
|
description = 'Graphql Runner',
|
|
73
84
|
name = defaultRunnerName,
|
|
74
|
-
executable = 'runner-linux'
|
|
85
|
+
executable = 'runner-linux',
|
|
75
86
|
) {
|
|
76
|
-
await promisify(
|
|
77
|
-
writeFile
|
|
78
|
-
)(
|
|
87
|
+
await promisify(writeFile)(
|
|
79
88
|
`/etc/systemd/system/${name}.service`,
|
|
80
89
|
this.generateConfig(description, executable),
|
|
81
|
-
{ encoding: 'utf-8' }
|
|
90
|
+
{ encoding: 'utf-8' },
|
|
82
91
|
);
|
|
83
92
|
}
|
|
84
93
|
async reload() {
|
|
85
94
|
const data = await promisify(exec)(
|
|
86
|
-
`systemctl daemon-reload
|
|
95
|
+
`systemctl daemon-reload`,
|
|
87
96
|
);
|
|
88
97
|
console.log(data);
|
|
89
98
|
}
|
|
90
99
|
async start(name = defaultRunnerName) {
|
|
91
100
|
const data = await promisify(exec)(
|
|
92
|
-
`systemctl start ${name}
|
|
101
|
+
`systemctl start ${name}`,
|
|
93
102
|
);
|
|
94
103
|
console.log(data);
|
|
95
104
|
}
|
|
@@ -101,13 +110,13 @@ WantedBy=multi-user.target
|
|
|
101
110
|
}
|
|
102
111
|
async stop(name = defaultRunnerName) {
|
|
103
112
|
const data = await promisify(exec)(
|
|
104
|
-
`systemctl stop ${name}
|
|
113
|
+
`systemctl stop ${name}`,
|
|
105
114
|
);
|
|
106
115
|
console.log(data);
|
|
107
116
|
}
|
|
108
117
|
async status(name = defaultRunnerName) {
|
|
109
118
|
const data = await promisify(exec)(
|
|
110
|
-
`systemctl status ${name}
|
|
119
|
+
`systemctl status ${name}`,
|
|
111
120
|
);
|
|
112
121
|
console.log(data);
|
|
113
122
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export * from './cli-builder';
|
|
2
1
|
export * from './app.constants';
|
|
3
|
-
export
|
|
2
|
+
export * from './app.tokents';
|
|
3
|
+
export * from './cli-builder';
|
|
4
4
|
export {
|
|
5
5
|
executeCommand,
|
|
6
6
|
ProcessReturn,
|
|
7
7
|
} from './core/executors';
|
|
8
|
+
export { GenericEnum } from './core/executors/commands';
|
|
8
9
|
export { Bootstrap } from '@gapi/core';
|
|
9
10
|
export { SpawnOptionsWithoutStdio } from 'child_process';
|
|
10
|
-
|
|
11
|
-
export * from './app.tokents';
|
package/src/main.ts
CHANGED
|
@@ -36,7 +36,7 @@ Bootstrap(
|
|
|
36
36
|
DOCKER: async (args: string[]) => {
|
|
37
37
|
console.log(
|
|
38
38
|
'[RUN_DOCKER]: started arguments: ',
|
|
39
|
-
args
|
|
39
|
+
args,
|
|
40
40
|
);
|
|
41
41
|
console.log('[RUN_DOCKER]: exited');
|
|
42
42
|
return 1;
|
|
@@ -44,26 +44,26 @@ Bootstrap(
|
|
|
44
44
|
DOCKER_COMPOSE2: async (args: string[]) => {
|
|
45
45
|
console.log(
|
|
46
46
|
'[RUN_DOCKER_COMPOSE]: started arguments: ',
|
|
47
|
-
args
|
|
47
|
+
args,
|
|
48
48
|
);
|
|
49
49
|
console.log('[RUN_DOCKER_COMPOSE]: exited');
|
|
50
50
|
return 1;
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
|
-
Commands
|
|
54
|
-
)
|
|
53
|
+
Commands,
|
|
54
|
+
),
|
|
55
55
|
).subscribe(() => {
|
|
56
56
|
if (Environment.GRAPHQL_RUNNER_SUBSCRIPTION_URI) {
|
|
57
57
|
console.log(
|
|
58
58
|
'STARTED_SUBSCRIPTIONS:',
|
|
59
|
-
Environment.GRAPHQL_RUNNER_SUBSCRIPTION_URI
|
|
59
|
+
Environment.GRAPHQL_RUNNER_SUBSCRIPTION_URI,
|
|
60
60
|
);
|
|
61
61
|
} else {
|
|
62
62
|
console.log(
|
|
63
63
|
'SIGNAL_MAIN_API_STARTED',
|
|
64
64
|
`Running at http://localhost:${
|
|
65
65
|
Container.get<Server>(HAPI_SERVER).info.port
|
|
66
|
-
}
|
|
66
|
+
}`,
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
});
|
package/src/scalar-object.ts
CHANGED
|
@@ -12,7 +12,7 @@ function ensureObject(value) {
|
|
|
12
12
|
Array.isArray(value)
|
|
13
13
|
) {
|
|
14
14
|
throw new TypeError(
|
|
15
|
-
`JSONObject cannot represent non-object value: ${value}
|
|
15
|
+
`JSONObject cannot represent non-object value: ${value}`,
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -22,10 +22,9 @@ function ensureObject(value) {
|
|
|
22
22
|
function parseObject(ast, variables) {
|
|
23
23
|
const value = Object.create(null);
|
|
24
24
|
ast.fields.forEach((field) => {
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
26
25
|
value[field.name.value] = parseLiteral(
|
|
27
26
|
field.value,
|
|
28
|
-
variables
|
|
27
|
+
variables,
|
|
29
28
|
);
|
|
30
29
|
});
|
|
31
30
|
|
|
@@ -44,7 +43,7 @@ function parseLiteral(ast, variables) {
|
|
|
44
43
|
return parseObject(ast, variables);
|
|
45
44
|
case Kind.LIST:
|
|
46
45
|
return ast.values.map((n) =>
|
|
47
|
-
parseLiteral(n, variables)
|
|
46
|
+
parseLiteral(n, variables),
|
|
48
47
|
);
|
|
49
48
|
case Kind.NULL:
|
|
50
49
|
return null;
|