@platformatic/control
Advanced tools
Comparing version 2.0.0-alpha.2 to 2.0.0-alpha.3
@@ -20,3 +20,3 @@ #! /usr/bin/env node | ||
dir: join(__dirname, 'help'), | ||
ext: '.txt' | ||
ext: '.txt', | ||
}) | ||
@@ -46,5 +46,5 @@ | ||
options: { | ||
version: { type: 'boolean', short: 'v' } | ||
version: { type: 'boolean', short: 'v' }, | ||
}, | ||
strict: false | ||
strict: false, | ||
}).values | ||
@@ -84,3 +84,3 @@ | ||
injectRuntimeCommand, | ||
streamRuntimeLogsCommand | ||
streamRuntimeLogsCommand, | ||
} |
@@ -6,3 +6,3 @@ 'use strict' | ||
module.exports = { | ||
RuntimeApiClient | ||
RuntimeApiClient, | ||
} |
@@ -12,5 +12,5 @@ 'use strict' | ||
name: { type: 'string', short: 'n' }, | ||
service: { type: 'string', short: 's' } | ||
service: { type: 'string', short: 's' }, | ||
}, | ||
strict: false | ||
strict: false, | ||
}).values | ||
@@ -17,0 +17,0 @@ |
@@ -11,5 +11,5 @@ 'use strict' | ||
pid: { type: 'string', short: 'p' }, | ||
name: { type: 'string', short: 'n' } | ||
name: { type: 'string', short: 'n' }, | ||
}, | ||
strict: false | ||
strict: false, | ||
}).values | ||
@@ -16,0 +16,0 @@ |
@@ -23,3 +23,3 @@ 'use strict' | ||
FailedToGetRuntimeAllLogs: createError(`${ERROR_PREFIX}_FAILED_TO_GET_RUNTIME_ALL_LOGS`, 'Failed to get runtime all logs %s.'), | ||
FailedToGetRuntimeLogIndexes: createError(`${ERROR_PREFIX}_FAILED_TO_GET_HISTORY_LOGS_COUNT`, 'Failed to get history logs count %s.') | ||
FailedToGetRuntimeLogIndexes: createError(`${ERROR_PREFIX}_FAILED_TO_GET_HISTORY_LOGS_COUNT`, 'Failed to get history logs count %s.'), | ||
} |
@@ -20,5 +20,5 @@ 'use strict' | ||
verbose: { type: 'boolean', short: 'v', default: false }, | ||
output: { type: 'string', short: 'o' } | ||
output: { type: 'string', short: 'o' }, | ||
}, | ||
strict: false | ||
strict: false, | ||
}) | ||
@@ -25,0 +25,0 @@ |
@@ -13,3 +13,3 @@ 'use strict' | ||
debug: 20, | ||
trace: 10 | ||
trace: 10, | ||
} | ||
@@ -25,5 +25,5 @@ | ||
pretty: { type: 'string', default: 'true' }, | ||
service: { type: 'string', short: 's' } | ||
service: { type: 'string', short: 's' }, | ||
}, | ||
strict: false | ||
strict: false, | ||
}).values | ||
@@ -30,0 +30,0 @@ |
@@ -9,11 +9,11 @@ 'use strict' | ||
value: 'pid', | ||
alias: 'PID' | ||
alias: 'PID', | ||
}, | ||
{ | ||
value: 'packageName', | ||
alias: 'NAME' | ||
alias: 'NAME', | ||
}, | ||
{ | ||
value: 'platformaticVersion', | ||
alias: 'PLT' | ||
alias: 'PLT', | ||
}, | ||
@@ -23,12 +23,12 @@ { | ||
alias: 'TIME', | ||
formatter: formatRuntimeTime | ||
formatter: formatRuntimeTime, | ||
}, | ||
{ | ||
value: 'url', | ||
alias: 'URL' | ||
alias: 'URL', | ||
}, | ||
{ | ||
value: 'projectDir', | ||
alias: 'PWD' | ||
} | ||
alias: 'PWD', | ||
}, | ||
] | ||
@@ -61,5 +61,5 @@ | ||
paddingLeft: 0, | ||
paddingRight: 1 | ||
paddingRight: 1, | ||
}, | ||
drawHorizontalLine: () => false | ||
drawHorizontalLine: () => false, | ||
} | ||
@@ -66,0 +66,0 @@ |
@@ -11,5 +11,5 @@ 'use strict' | ||
pid: { type: 'string', short: 'p' }, | ||
name: { type: 'string', short: 'n' } | ||
name: { type: 'string', short: 'n' }, | ||
}, | ||
strict: false | ||
strict: false, | ||
}).values | ||
@@ -16,0 +16,0 @@ |
@@ -11,5 +11,5 @@ 'use strict' | ||
pid: { type: 'string', short: 'p' }, | ||
name: { type: 'string', short: 'n' } | ||
name: { type: 'string', short: 'n' }, | ||
}, | ||
strict: false | ||
strict: false, | ||
}).values | ||
@@ -16,0 +16,0 @@ |
@@ -6,3 +6,3 @@ 'use strict' | ||
const { exec, spawn } = require('node:child_process') | ||
const { readdir, rm, access } = require('node:fs/promises') | ||
const { readdir, access } = require('node:fs/promises') | ||
const { Readable } = require('node:stream') | ||
@@ -12,2 +12,3 @@ const { Client } = require('undici') | ||
const errors = require('./errors.js') | ||
const { safeRemove } = require('@platformatic/utils') | ||
@@ -39,8 +40,6 @@ const PLATFORMATIC_TMP_DIR = join(tmpdir(), 'platformatic', 'runtimes') | ||
async getRuntimes () { | ||
const runtimePIDs = platform() === 'win32' | ||
? await this.#getWindowsRuntimePIDs() | ||
: await this.#getUnixRuntimePIDs() | ||
const runtimePIDs = platform() === 'win32' ? await this.#getWindowsRuntimePIDs() : await this.#getUnixRuntimePIDs() | ||
const getMetadataRequests = await Promise.allSettled( | ||
runtimePIDs.map(async (runtimePID) => { | ||
runtimePIDs.map(async runtimePID => { | ||
return this.getRuntimeMetadata(runtimePID) | ||
@@ -69,3 +68,3 @@ }) | ||
path: '/api/v1/metadata', | ||
method: 'GET' | ||
method: 'GET', | ||
}) | ||
@@ -87,3 +86,3 @@ | ||
path: '/api/v1/services', | ||
method: 'GET' | ||
method: 'GET', | ||
}) | ||
@@ -105,3 +104,3 @@ | ||
path: `/api/v1/services/${serviceId}/config`, | ||
method: 'GET' | ||
method: 'GET', | ||
}) | ||
@@ -123,3 +122,3 @@ | ||
path: '/api/v1/config', | ||
method: 'GET' | ||
method: 'GET', | ||
}) | ||
@@ -141,3 +140,3 @@ | ||
path: '/api/v1/env', | ||
method: 'GET' | ||
method: 'GET', | ||
}) | ||
@@ -169,3 +168,3 @@ | ||
path: '/api/v1/reload', | ||
method: 'POST' | ||
method: 'POST', | ||
}) | ||
@@ -184,3 +183,3 @@ | ||
path: '/api/v1/stop', | ||
method: 'POST' | ||
method: 'POST', | ||
}) | ||
@@ -224,3 +223,3 @@ | ||
method: 'GET', | ||
query: { pid: runtimePID } | ||
query: { pid: runtimePID }, | ||
}) | ||
@@ -243,3 +242,3 @@ | ||
method: 'GET', | ||
query: { pid: runtimePID } | ||
query: { pid: runtimePID }, | ||
}) | ||
@@ -262,3 +261,3 @@ | ||
method: 'GET', | ||
query: { all } | ||
query: { all }, | ||
}) | ||
@@ -285,3 +284,3 @@ | ||
query: options.query, | ||
body: options.body | ||
body: options.body, | ||
}) | ||
@@ -304,6 +303,9 @@ return response | ||
const socketPath = this.#getSocketPathFromPid(pid) | ||
undiciClient = new Client({ | ||
hostname: 'localhost', | ||
protocol: 'http:' | ||
}, { socketPath }) | ||
undiciClient = new Client( | ||
{ | ||
hostname: 'localhost', | ||
protocol: 'http:', | ||
}, | ||
{ socketPath } | ||
) | ||
@@ -350,14 +352,10 @@ this.#undiciClients.set(pid, undiciClient) | ||
return new Promise((resolve, reject) => { | ||
exec( | ||
'[System.IO.Directory]::GetFiles("\\\\.\\pipe\\")', | ||
{ shell: 'powershell.exe' }, | ||
(err, stdout) => { | ||
if (err) { | ||
reject(err) | ||
return | ||
} | ||
const namedPipes = stdout.split(EOL) | ||
resolve(namedPipes) | ||
exec('[System.IO.Directory]::GetFiles("\\\\.\\pipe\\")', { shell: 'powershell.exe' }, (err, stdout) => { | ||
if (err) { | ||
reject(err) | ||
return | ||
} | ||
) | ||
const namedPipes = stdout.split(EOL) | ||
resolve(namedPipes) | ||
}) | ||
}) | ||
@@ -368,3 +366,3 @@ } | ||
const runtimeDir = join(PLATFORMATIC_TMP_DIR, pid.toString()) | ||
await rm(runtimeDir, { recursive: true, force: true }) | ||
await safeRemove(runtimeDir) | ||
} | ||
@@ -378,3 +376,3 @@ } | ||
this.ws.on('message', (data) => { | ||
this.ws.on('message', data => { | ||
this.push(data) | ||
@@ -385,3 +383,3 @@ }) | ||
}) | ||
this.ws.on('error', (err) => { | ||
this.ws.on('error', err => { | ||
this.emit('error', new errors.FailedToStreamRuntimeLogs(err.message)) | ||
@@ -388,0 +386,0 @@ }) |
@@ -10,7 +10,7 @@ 'use strict' | ||
value: 'id', | ||
alias: 'NAME' | ||
alias: 'NAME', | ||
}, | ||
{ | ||
value: 'type', | ||
alias: 'TYPE' | ||
alias: 'TYPE', | ||
}, | ||
@@ -22,4 +22,4 @@ { | ||
return entrypoint ? 'yes' : 'no' | ||
} | ||
} | ||
}, | ||
}, | ||
] | ||
@@ -31,5 +31,5 @@ | ||
paddingLeft: 0, | ||
paddingRight: 1 | ||
paddingRight: 1, | ||
}, | ||
drawHorizontalLine: () => false | ||
drawHorizontalLine: () => false, | ||
} | ||
@@ -62,5 +62,5 @@ | ||
pid: { type: 'string', short: 'p' }, | ||
name: { type: 'string', short: 'n' } | ||
name: { type: 'string', short: 'n' }, | ||
}, | ||
strict: false | ||
strict: false, | ||
}).values | ||
@@ -67,0 +67,0 @@ |
@@ -11,5 +11,5 @@ 'use strict' | ||
pid: { type: 'string', short: 'p' }, | ||
name: { type: 'string', short: 'n' } | ||
name: { type: 'string', short: 'n' }, | ||
}, | ||
strict: false | ||
strict: false, | ||
}).values | ||
@@ -16,0 +16,0 @@ |
{ | ||
"name": "@platformatic/control", | ||
"version": "2.0.0-alpha.2", | ||
"version": "2.0.0-alpha.3", | ||
"description": "Platformatic Control", | ||
@@ -20,10 +20,12 @@ "main": "index.js", | ||
"devDependencies": { | ||
"borp": "^0.16.0", | ||
"borp": "^0.17.0", | ||
"desm": "^1.3.1", | ||
"eslint": "9", | ||
"execa": "^8.0.1", | ||
"snazzy": "^9.0.0", | ||
"neostandard": "^0.11.1", | ||
"split2": "^4.2.0", | ||
"standard": "^17.1.0", | ||
"tsd": "^0.31.0", | ||
"@platformatic/runtime": "2.0.0-alpha.2" | ||
"typescript": "^5.5.4", | ||
"@platformatic/runtime": "2.0.0-alpha.3", | ||
"@platformatic/service": "2.0.0-alpha.3" | ||
}, | ||
@@ -38,10 +40,11 @@ "dependencies": { | ||
"undici": "^6.9.0", | ||
"ws": "^8.16.0" | ||
"ws": "^8.16.0", | ||
"@platformatic/utils": "2.0.0-alpha.3" | ||
}, | ||
"scripts": { | ||
"test": "pnpm run lint && pnpm run unit", | ||
"unit": "borp --concurrency=1 --timeout 60000", | ||
"unit": "borp --concurrency=1 --timeout=180000", | ||
"build": "node lib/schema.js | json2ts > config.d.ts", | ||
"lint": "standard | snazzy" | ||
"lint": "eslint" | ||
} | ||
} |
45083
28
9
10
+ Added@fastify/deepmerge@1.3.0(transitive)
+ Added@platformatic/utils@2.0.0-alpha.3(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedleven@3.1.0(transitive)
+ Addedminimatch@8.0.4(transitive)