@platformatic/control
Advanced tools
Comparing version
@@ -13,7 +13,42 @@ import { ChildProcess } from "node:child_process"; | ||
interface Runtime { | ||
pid: number, | ||
cwd: string, | ||
argv: string[], | ||
uptimeSeconds: number, | ||
execPath: string, | ||
nodeVersion: string, | ||
projectDir: string, | ||
packageName: string | null, | ||
packageVersion: string | null, | ||
url: string | null, | ||
platformaticVersion: string | ||
} | ||
interface Services { | ||
entrypoint: string, | ||
production: boolean, | ||
services: ({ | ||
id: string; | ||
type: string; | ||
status: string; | ||
version: string; | ||
localUrl: string; | ||
entrypoint: boolean; | ||
dependencies: { | ||
id: string; | ||
url: string; | ||
local: boolean; | ||
}[]; | ||
} | { | ||
id: string; | ||
status: string; | ||
})[] | ||
} | ||
export class RuntimeApiClient { | ||
getMatchingRuntime(opts: { pid?: string; name?: string }): Promise<unknown>; | ||
getRuntimes(): Promise<unknown[]>; | ||
getRuntimeMetadata(pid: number): Promise<unknown>; | ||
getRuntimeServices(pid: number): Promise<unknown>; | ||
getMatchingRuntime(opts: { pid?: string; name?: string }): Promise<Runtime>; | ||
getRuntimes(): Promise<Runtime[]>; | ||
getRuntimeMetadata(pid: number): Promise<Runtime>; | ||
getRuntimeServices(pid: number): Promise<Services>; | ||
getRuntimeConfig(pid: number): Promise<void>; | ||
@@ -20,0 +55,0 @@ getRuntimeServiceConfig(pid: number, serviceId?: string): Promise<void>; |
import { expectError, expectType } from 'tsd' | ||
import { errors, RuntimeApiClient } from '.' | ||
import { errors, Runtime, RuntimeApiClient, Services } from '.' | ||
import { FastifyError } from '@fastify/error' | ||
// RuntimeApiClient | ||
let runtime = {} as Runtime | ||
let services = {} as Services | ||
const api = new RuntimeApiClient() | ||
expectType<Promise<unknown[]>>(api.getRuntimes()) | ||
expectType<Promise<Runtime[]>>(api.getRuntimes()) | ||
expectType<string[]>(runtime.argv) | ||
expectType<number>(runtime.uptimeSeconds) | ||
expectType<string | null>(runtime.packageVersion) | ||
expectType<Promise<{ | ||
entrypoint: string, | ||
production: boolean, | ||
services: Services['services'] | ||
}>>(api.getRuntimeServices(45)) | ||
expectType<string>(services.services[0].id) | ||
expectType<string>(services.services[0].status) | ||
expectType<Promise<void>>(api.close()) | ||
@@ -9,0 +21,0 @@ |
{ | ||
"name": "@platformatic/control", | ||
"version": "2.30.1-alpha.1", | ||
"version": "2.30.1", | ||
"description": "Platformatic Control", | ||
@@ -28,4 +28,4 @@ "main": "index.js", | ||
"typescript": "^5.5.4", | ||
"@platformatic/service": "2.30.1-alpha.1", | ||
"@platformatic/runtime": "2.30.1-alpha.1" | ||
"@platformatic/runtime": "2.30.1", | ||
"@platformatic/service": "2.30.1" | ||
}, | ||
@@ -41,3 +41,3 @@ "dependencies": { | ||
"ws": "^8.16.0", | ||
"@platformatic/utils": "2.30.1-alpha.1" | ||
"@platformatic/utils": "2.30.1" | ||
}, | ||
@@ -44,0 +44,0 @@ "scripts": { |
53210
2.08%1028
4.58%+ Added
- Removed
Updated