@platformatic/control 4.0.0-new-config.2 → 4.0.0-new-config.5

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 CHANGED
@@ -53,11 +53,6 @@ export const FailedToReloadRuntime = createError(
53
53
  'Failed to reload the runtime %s.'
54
54
  )
55
55
 
56
- export const FailedToGetRuntimeConfig = createError(
57
- `${ERROR_PREFIX}_FAILED_TO_GET_RUNTIME_CONFIG`,
58
- 'Failed to get runtime config %s.'
59
- )
60
-
61
56
  export const FailedToGetRuntimeApplicationEnv = createError(
62
57
  `${ERROR_PREFIX}_FAILED_TO_GET_RUNTIME_APPLICATION_ENV`,
63
58
  'Failed to get runtime application environment variables %s.'
package/lib/index.d.ts CHANGED
@@ -23,16 +23,26 @@ export interface RuntimeApplicationBase {
23
23
  status: string
24
24
  }
25
25
 
26
+ export type ServingState = 'listening' | 'mesh-only' | 'background' | 'inactive'
27
+
26
28
  export interface RuntimeApplication {
27
29
  id: string
28
30
  type: string
29
31
  status: string
32
+ /** How the application serves, as opposed to whether it runs. Absent when it is not started. */
33
+ servingState?: ServingState
30
34
  version: string
31
35
  localUrl: string
32
36
  url: string | null
33
37
  urls: string[]
34
38
  workers?: number
35
39
  dependencies: string[]
40
+ path?: string
41
+ sourceMaps?: boolean
42
+ /** v3 only: the path to the application's configuration file. v4 reports configPath. */
43
+ config?: string
44
+ /** v4 only: the configuration file the loader decided on, absent for an inline definition. */
45
+ configPath?: string
36
46
  }
37
47
 
38
48
  export interface Runtime {
@@ -43,6 +53,10 @@ export interface Runtime {
43
53
  execPath: string
44
54
  nodeVersion: string
45
55
  projectDir: string
56
+ /** The configuration file the loader decided on. Null when the runtime was built from an object. */
57
+ configPath: string | null
58
+ /** The autoload declaration, with its path resolved. Null when the project does not autoload. */
59
+ autoload: { path: string, exclude?: string[], mappings?: Record<string, unknown> } | null
46
60
  packageName: string | null
47
61
  packageVersion: string | null
48
62
  platformaticVersion: string
@@ -124,11 +138,6 @@ export class RuntimeApiClient {
124
138
  pauseRuntimeSchedulerJob (pid: number, name: string): Promise<RuntimeSchedulerJob>
125
139
  resumeRuntimeSchedulerJob (pid: number, name: string): Promise<RuntimeSchedulerJob>
126
140
  runRuntimeSchedulerJob (pid: number, name: string): Promise<RuntimeSchedulerRunResult>
127
- getRuntimeConfig (
128
- pid: number
129
- ): Promise<
130
- Record<string, unknown> & { path?: string; configFile?: string; configPath?: string; server?: { path?: string } }
131
- >
132
141
  getRuntimeApplicationConfig (pid: number, applicationId?: string): Promise<Record<string, unknown>>
133
142
  getRuntimeEnv (pid: number): Promise<Record<string, string>>
134
143
  getRuntimeOpenapi (pid: number, applicationId: string): Promise<Record<string, unknown>>
@@ -140,7 +149,6 @@ export class RuntimeApiClient {
140
149
  pid: number,
141
150
  options?: T
142
151
  ): Promise<T extends { format: 'text' } ? string : Metric[]>
143
- getRuntimeLiveMetricsStream (pid: number): WebSocketStream
144
152
  getRuntimeLiveLogsStream (pid: number, startLogIndex?: number): WebSocketStream
145
153
  getRuntimeLogsStream (pid: number, logsId: string, options?: { runtimePID?: number }): Promise<ReadableBody>
146
154
  getRuntimeAllLogsStream (pid: number, options?: { runtimePID?: number }): Promise<ReadableBody>
package/lib/index.js CHANGED
@@ -13,7 +13,6 @@ import {
13
13
  FailedToGetRuntimeApplicationConfig,
14
14
  FailedToGetRuntimeApplicationEnv,
15
15
  FailedToGetRuntimeApplications,
16
- FailedToGetRuntimeConfig,
17
16
  FailedToGetRuntimeEnv,
18
17
  FailedToGetRuntimeHistoryLogs,
19
18
  FailedToGetRuntimeLogIndexes,
@@ -239,23 +238,6 @@ export class RuntimeApiClient {
239
238
  return body.json()
240
239
  }
241
240
 
242
- async getRuntimeConfig (pid, metadata = false) {
243
- const client = this.#getUndiciClient(pid)
244
-
245
- const { statusCode, body } = await client.request({
246
- path: `/api/v1/config?metadata=${metadata ? 'true' : 'false'}`,
247
- method: 'GET'
248
- })
249
-
250
- if (statusCode !== 200) {
251
- const error = await body.text()
252
- throw new FailedToGetRuntimeConfig(error)
253
- }
254
-
255
- const runtimeConfig = await body.json()
256
- return runtimeConfig
257
- }
258
-
259
241
  async getRuntimeApplicationConfig (pid, applicationId) {
260
242
  const client = this.#getUndiciClient(pid)
261
243
 
@@ -587,17 +569,6 @@ export class RuntimeApiClient {
587
569
  return metrics
588
570
  }
589
571
 
590
- getRuntimeLiveMetricsStream (pid) {
591
- const socketPath = this.#getSocketPathFromPid(pid)
592
-
593
- const protocol = platform() === 'win32' ? 'ws+unix:' : 'ws+unix://'
594
- const webSocketUrl = protocol + socketPath + ':/api/v1/metrics/live'
595
- const webSocketStream = new WebSocketStream(webSocketUrl)
596
- this.#webSockets.add(webSocketStream.ws)
597
-
598
- return webSocketStream
599
- }
600
-
601
572
  getRuntimeLiveLogsStream (pid) {
602
573
  const socketPath = this.#getSocketPathFromPid(pid)
603
574
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/control",
3
- "version": "4.0.0-new-config.2",
3
+ "version": "4.0.0-new-config.5",
4
4
  "description": "Platformatic Control",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -23,8 +23,8 @@
23
23
  "split2": "^4.2.0",
24
24
  "tstyche": "^6.0.0",
25
25
  "typescript": "~6.0.3",
26
- "@platformatic/runtime": "4.0.0-new-config.2",
27
- "@platformatic/service": "4.0.0-new-config.2"
26
+ "@platformatic/runtime": "4.0.0-new-config.5",
27
+ "@platformatic/service": "4.0.0-new-config.5"
28
28
  },
29
29
  "dependencies": {
30
30
  "@fastify/error": "^4.0.0",
@@ -32,9 +32,9 @@
32
32
  "pino": "^9.9.0",
33
33
  "pino-pretty": "^13.0.0",
34
34
  "table": "^6.8.1",
35
- "undici": "^7.27.2",
35
+ "undici": "^8.5.0",
36
36
  "ws": "^8.16.0",
37
- "@platformatic/foundation": "4.0.0-new-config.2"
37
+ "@platformatic/foundation": "4.0.0-new-config.5"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=22.19.0"