@platformatic/control 3.63.0-alpha.3 → 3.64.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/index.d.ts CHANGED
@@ -121,7 +121,7 @@ export class RuntimeApiClient {
121
121
  getRuntimes (): Promise<Runtime[]>
122
122
  getRuntimeMetadata (pid: number): Promise<Runtime>
123
123
  getRuntimeApplications (pid: number): Promise<RuntimeApplications>
124
- getRuntimeScheduler (pid: number): Promise<{ jobs: RuntimeSchedulerJob[] }>
124
+ getRuntimeSchedulerJobs (pid: number): Promise<{ jobs: RuntimeSchedulerJob[] }>
125
125
  pauseRuntimeSchedulerJob (pid: number, name: string): Promise<RuntimeSchedulerJob>
126
126
  resumeRuntimeSchedulerJob (pid: number, name: string): Promise<RuntimeSchedulerJob>
127
127
  runRuntimeSchedulerJob (pid: number, name: string): Promise<RuntimeSchedulerRunResult>
package/lib/index.js CHANGED
@@ -195,7 +195,7 @@ export class RuntimeApiClient {
195
195
  return runtimeApplications
196
196
  }
197
197
 
198
- async getRuntimeScheduler (pid) {
198
+ async getRuntimeSchedulerJobs (pid) {
199
199
  const client = this.#getUndiciClient(pid)
200
200
 
201
201
  const { statusCode, body } = await client.request({
@@ -393,7 +393,7 @@ export class RuntimeApiClient {
393
393
  async stopApplicationProfiling (pid, applicationId, options = {}) {
394
394
  const client = this.#getUndiciClient(pid)
395
395
 
396
- const { statusCode, body } = await client.request({
396
+ const { statusCode, headers, body } = await client.request({
397
397
  path: `/api/v1/applications/${applicationId}/pprof/stop`,
398
398
  method: 'POST',
399
399
  headers: {
@@ -425,6 +425,21 @@ export class RuntimeApiClient {
425
425
  throw new FailedToStopProfiling(applicationId, message)
426
426
  }
427
427
 
428
+ if (options.allWorkers) {
429
+ // One profile per worker, JSON encoded with base64 payloads
430
+ if (headers['content-type']?.includes('application/json')) {
431
+ const { profiles } = await body.json()
432
+ return profiles.map(({ workerIndex, profile }) => ({
433
+ workerIndex,
434
+ profile: Buffer.from(profile, 'base64')
435
+ }))
436
+ }
437
+
438
+ // Older runtimes ignore the allWorkers option and return a single
439
+ // binary profile from one of the workers.
440
+ return [{ workerIndex: null, profile: Buffer.from(await body.arrayBuffer()) }]
441
+ }
442
+
428
443
  // Return the binary profile data as ArrayBuffer
429
444
  return await body.arrayBuffer()
430
445
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/control",
3
- "version": "3.63.0-alpha.3",
3
+ "version": "3.64.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-alpha.3",
27
- "@platformatic/service": "3.63.0-alpha.3"
26
+ "@platformatic/service": "3.64.0",
27
+ "@platformatic/runtime": "3.64.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-alpha.3"
37
+ "@platformatic/foundation": "3.64.0"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=22.19.0"