@platformatic/control 1.29.0 → 1.31.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/lib/errors.js +1 -0
- package/lib/ps.js +1 -1
- package/lib/runtime-api-client.js +21 -7
- package/lib/services.js +2 -2
- package/package.json +2 -2
package/lib/errors.js
CHANGED
|
@@ -19,5 +19,6 @@ module.exports = {
|
|
|
19
19
|
FailedToGetRuntimeConfig: createError(`${ERROR_PREFIX}_FAILED_TO_GET_RUNTIME_CONFIG`, 'Failed to get runtime config %s.'),
|
|
20
20
|
FailedToGetRuntimeServiceConfig: createError(`${ERROR_PREFIX}_FAILED_TO_GET_RUNTIME_SERVICE_CONFIG`, 'Failed to get runtime service config %s.'),
|
|
21
21
|
FailedToGetRuntimeHistoryLogs: createError(`${ERROR_PREFIX}_FAILED_TO_GET_HISTORY_LOGS`, 'Failed to get history logs %s.'),
|
|
22
|
+
FailedToGetRuntimeAllLogs: createError(`${ERROR_PREFIX}_FAILED_TO_GET_RUNTIME_ALL_LOGS`, 'Failed to get runtime all logs %s.'),
|
|
22
23
|
FailedToGetRuntimeLogIndexes: createError(`${ERROR_PREFIX}_FAILED_TO_GET_HISTORY_LOGS_COUNT`, 'Failed to get history logs count %s.')
|
|
23
24
|
}
|
package/lib/ps.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { tmpdir, platform, EOL } = require('node:os')
|
|
4
4
|
const { join } = require('node:path')
|
|
5
5
|
const { exec, spawn } = require('node:child_process')
|
|
6
|
-
const { readdir,
|
|
6
|
+
const { readdir, rm, access } = require('node:fs/promises')
|
|
7
7
|
const { Readable } = require('node:stream')
|
|
8
8
|
const { Client } = require('undici')
|
|
9
9
|
const WebSocket = require('ws')
|
|
@@ -50,7 +50,7 @@ class RuntimeApiClient {
|
|
|
50
50
|
const metadataRequest = getMetadataRequests[i]
|
|
51
51
|
|
|
52
52
|
if (metadataRequest.status === 'rejected') {
|
|
53
|
-
await this.#
|
|
53
|
+
await this.#removeRuntimeTmpDir(runtimePID).catch(() => {})
|
|
54
54
|
} else {
|
|
55
55
|
runtimes.push(metadataRequest.value)
|
|
56
56
|
}
|
|
@@ -220,6 +220,22 @@ class RuntimeApiClient {
|
|
|
220
220
|
return body
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
async getRuntimeAllLogsStream (pid) {
|
|
224
|
+
const client = this.#getUndiciClient(pid)
|
|
225
|
+
|
|
226
|
+
const { statusCode, body } = await client.request({
|
|
227
|
+
path: '/api/v1/logs/all',
|
|
228
|
+
method: 'GET'
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
if (statusCode !== 200) {
|
|
232
|
+
const error = await body.text()
|
|
233
|
+
throw new errors.FailedToGetRuntimeAllLogs(error)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return body
|
|
237
|
+
}
|
|
238
|
+
|
|
223
239
|
async getRuntimeLogIndexes (pid) {
|
|
224
240
|
const client = this.#getUndiciClient(pid)
|
|
225
241
|
|
|
@@ -323,11 +339,9 @@ class RuntimeApiClient {
|
|
|
323
339
|
})
|
|
324
340
|
}
|
|
325
341
|
|
|
326
|
-
async #
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
await unlink(socketPath)
|
|
330
|
-
}
|
|
342
|
+
async #removeRuntimeTmpDir (pid) {
|
|
343
|
+
const runtimeDir = join(PLATFORMATIC_TMP_DIR, pid.toString())
|
|
344
|
+
await rm(runtimeDir, { recursive: true, force: true })
|
|
331
345
|
}
|
|
332
346
|
}
|
|
333
347
|
|
package/lib/services.js
CHANGED
|
@@ -25,7 +25,7 @@ const tableColumns = [
|
|
|
25
25
|
const tableConfig = {
|
|
26
26
|
border: getBorderCharacters('void'),
|
|
27
27
|
columnDefault: {
|
|
28
|
-
paddingLeft:
|
|
28
|
+
paddingLeft: 0,
|
|
29
29
|
paddingRight: 1
|
|
30
30
|
},
|
|
31
31
|
drawHorizontalLine: () => false
|
|
@@ -48,7 +48,7 @@ async function printRuntimeServices (services) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const servicesTable = table(raws, tableConfig)
|
|
51
|
-
|
|
51
|
+
process.stdout.write(servicesTable)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
async function getRuntimeServicesCommand (argv) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/control",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "Platformatic Control",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"split2": "^4.2.0",
|
|
25
25
|
"standard": "^17.1.0",
|
|
26
26
|
"tsd": "^0.30.7",
|
|
27
|
-
"@platformatic/runtime": "1.
|
|
27
|
+
"@platformatic/runtime": "1.31.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@fastify/error": "^3.4.1",
|