@platformatic/control 3.63.0-alpha.2 → 3.63.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.d.ts +0 -2
- package/lib/errors.js +0 -10
- package/lib/index.d.ts +0 -26
- package/lib/index.js +0 -46
- package/package.json +4 -4
package/lib/errors.d.ts
CHANGED
|
@@ -7,8 +7,6 @@ export declare const ApplicationNotFound: (value: string) => FastifyError
|
|
|
7
7
|
export declare const MissingRequestURL: (value: string) => FastifyError
|
|
8
8
|
export declare const FailedToGetRuntimeMetadata: (value: string) => FastifyError
|
|
9
9
|
export declare const FailedToGetRuntimeApplications: (value: string) => FastifyError
|
|
10
|
-
export declare const FailedToGetRuntimeScheduler: (value: string) => FastifyError
|
|
11
|
-
export declare const FailedToUpdateRuntimeScheduler: (value: string) => FastifyError
|
|
12
10
|
export declare const FailedToGetRuntimeEnv: (value: string) => FastifyError
|
|
13
11
|
export declare const FailedToGetRuntimeOpenapi: (value: string) => FastifyError
|
|
14
12
|
export declare const FailedToStreamRuntimeLogs: (value: string) => FastifyError
|
package/lib/errors.js
CHANGED
|
@@ -28,16 +28,6 @@ export const FailedToGetRuntimeOpenapi = createError(
|
|
|
28
28
|
'Failed to get runtime OpenAPI schema %s.'
|
|
29
29
|
)
|
|
30
30
|
|
|
31
|
-
export const FailedToGetRuntimeScheduler = createError(
|
|
32
|
-
`${ERROR_PREFIX}_FAILED_TO_GET_RUNTIME_SCHEDULER`,
|
|
33
|
-
'Failed to get runtime scheduler %s.'
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
export const FailedToUpdateRuntimeScheduler = createError(
|
|
37
|
-
`${ERROR_PREFIX}_FAILED_TO_UPDATE_RUNTIME_SCHEDULER`,
|
|
38
|
-
'Failed to update runtime scheduler %s.'
|
|
39
|
-
)
|
|
40
|
-
|
|
41
31
|
export const FailedToStreamRuntimeLogs = createError(
|
|
42
32
|
`${ERROR_PREFIX}_FAILED_TO_STREAM_RUNTIME_LOGS`,
|
|
43
33
|
'Failed to stream runtime logs %s.'
|
package/lib/index.d.ts
CHANGED
|
@@ -94,37 +94,11 @@ export interface LogIndexes {
|
|
|
94
94
|
indexes: number[]
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
export interface RuntimeSchedulerJob {
|
|
98
|
-
name: string
|
|
99
|
-
cron: string
|
|
100
|
-
source: 'config' | 'application'
|
|
101
|
-
paused: boolean
|
|
102
|
-
maxRetries: number
|
|
103
|
-
lastExecutedAt: string | null
|
|
104
|
-
lastStatus: 'success' | 'failed' | null
|
|
105
|
-
nextRunAt: string | null
|
|
106
|
-
callbackUrl?: string
|
|
107
|
-
method?: string
|
|
108
|
-
applicationId?: string
|
|
109
|
-
scheduleId?: string
|
|
110
|
-
tasks?: string[]
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface RuntimeSchedulerRunResult {
|
|
114
|
-
name: string
|
|
115
|
-
success: boolean
|
|
116
|
-
executedAt: string
|
|
117
|
-
}
|
|
118
|
-
|
|
119
97
|
export class RuntimeApiClient {
|
|
120
98
|
getMatchingRuntime (options?: { pid?: string; name?: string }): Promise<Runtime>
|
|
121
99
|
getRuntimes (): Promise<Runtime[]>
|
|
122
100
|
getRuntimeMetadata (pid: number): Promise<Runtime>
|
|
123
101
|
getRuntimeApplications (pid: number): Promise<RuntimeApplications>
|
|
124
|
-
getRuntimeScheduler (pid: number): Promise<{ jobs: RuntimeSchedulerJob[] }>
|
|
125
|
-
pauseRuntimeSchedulerJob (pid: number, name: string): Promise<RuntimeSchedulerJob>
|
|
126
|
-
resumeRuntimeSchedulerJob (pid: number, name: string): Promise<RuntimeSchedulerJob>
|
|
127
|
-
runRuntimeSchedulerJob (pid: number, name: string): Promise<RuntimeSchedulerRunResult>
|
|
128
102
|
getRuntimeConfig (
|
|
129
103
|
pid: number
|
|
130
104
|
): Promise<
|
package/lib/index.js
CHANGED
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
FailedToGetRuntimeMetadata,
|
|
21
21
|
FailedToGetRuntimeMetrics,
|
|
22
22
|
FailedToGetRuntimeOpenapi,
|
|
23
|
-
FailedToGetRuntimeScheduler,
|
|
24
23
|
FailedToReloadRuntime,
|
|
25
24
|
FailedToRemoveApplications,
|
|
26
25
|
FailedToStartProfiling,
|
|
@@ -28,7 +27,6 @@ import {
|
|
|
28
27
|
FailedToStopRuntime,
|
|
29
28
|
FailedToStreamRuntimeLogs,
|
|
30
29
|
FailedToTakeHeapSnapshot,
|
|
31
|
-
FailedToUpdateRuntimeScheduler,
|
|
32
30
|
ProfilingAlreadyStarted,
|
|
33
31
|
ProfilingNotStarted,
|
|
34
32
|
RuntimeNotFound
|
|
@@ -195,50 +193,6 @@ export class RuntimeApiClient {
|
|
|
195
193
|
return runtimeApplications
|
|
196
194
|
}
|
|
197
195
|
|
|
198
|
-
async getRuntimeScheduler (pid) {
|
|
199
|
-
const client = this.#getUndiciClient(pid)
|
|
200
|
-
|
|
201
|
-
const { statusCode, body } = await client.request({
|
|
202
|
-
path: '/api/v1/scheduler',
|
|
203
|
-
method: 'GET'
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
if (statusCode !== 200) {
|
|
207
|
-
const error = await body.text()
|
|
208
|
-
throw new FailedToGetRuntimeScheduler(error)
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return body.json()
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
async pauseRuntimeSchedulerJob (pid, name) {
|
|
215
|
-
return this.#updateRuntimeSchedulerJob(pid, name, 'pause')
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
async resumeRuntimeSchedulerJob (pid, name) {
|
|
219
|
-
return this.#updateRuntimeSchedulerJob(pid, name, 'resume')
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
async runRuntimeSchedulerJob (pid, name) {
|
|
223
|
-
return this.#updateRuntimeSchedulerJob(pid, name, 'run')
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
async #updateRuntimeSchedulerJob (pid, name, action) {
|
|
227
|
-
const client = this.#getUndiciClient(pid)
|
|
228
|
-
|
|
229
|
-
const { statusCode, body } = await client.request({
|
|
230
|
-
path: `/api/v1/scheduler/${encodeURIComponent(name)}/${action}`,
|
|
231
|
-
method: 'POST'
|
|
232
|
-
})
|
|
233
|
-
|
|
234
|
-
if (statusCode !== 200) {
|
|
235
|
-
const error = await body.text()
|
|
236
|
-
throw new FailedToUpdateRuntimeScheduler(error)
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
return body.json()
|
|
240
|
-
}
|
|
241
|
-
|
|
242
196
|
async getRuntimeConfig (pid, metadata = false) {
|
|
243
197
|
const client = this.#getUndiciClient(pid)
|
|
244
198
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/control",
|
|
3
|
-
"version": "3.63.0
|
|
3
|
+
"version": "3.63.0",
|
|
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": "^5.9.3",
|
|
26
|
-
"@platformatic/runtime": "3.63.0
|
|
27
|
-
"@platformatic/service": "3.63.0
|
|
26
|
+
"@platformatic/runtime": "3.63.0",
|
|
27
|
+
"@platformatic/service": "3.63.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@fastify/error": "^4.0.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"table": "^6.8.1",
|
|
35
35
|
"undici": "^7.27.2",
|
|
36
36
|
"ws": "^8.16.0",
|
|
37
|
-
"@platformatic/foundation": "3.63.0
|
|
37
|
+
"@platformatic/foundation": "3.63.0"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">=22.19.0"
|