@platformatic/control 2.69.0 → 2.70.1

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/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { ChildProcess } from "node:child_process";
2
2
  import BodyReadable from "undici/types/readable";
3
3
  import { FastifyError } from "@fastify/error";
4
4
  import { Readable } from "node:stream";
5
+ import { HttpHeader } from 'fastify/types/utils'
5
6
  import WebSocket from "ws";
6
7
 
7
8
  declare namespace control {
@@ -122,7 +123,7 @@ declare namespace control {
122
123
  headers: object;
123
124
  body: unknown;
124
125
  }
125
- ): Promise<unknown>;
126
+ ): Promise<{ headers: Record<string, HttpHeader>, statusCode: number, body: unknown }>;
126
127
  close(): Promise<void>;
127
128
  }
128
129
 
package/index.test-d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { expectError, expectType } from 'tsd'
1
+ import { expectAssignable, expectError, expectType } from 'tsd'
2
2
  import { errors, Metric, Runtime, RuntimeApiClient, RuntimeServices } from '.'
3
3
  import { FastifyError } from '@fastify/error'
4
4
 
@@ -14,6 +14,15 @@ expectType<Promise<Metric[]>>(api.getRuntimeMetrics(runtime.pid, { format: 'json
14
14
  expectType<Promise<string>>(api.getRuntimeMetrics(runtime.pid, { format: 'text' }))
15
15
  expectType<Promise<Runtime[]>>(api.getRuntimes())
16
16
 
17
+ async () => {
18
+ const result = await api.injectRuntime(0, '', { body: {}, headers: {}, method: 'PUT', url: '/foo' })
19
+
20
+ expectType<unknown>(result.body)
21
+ expectType<number>(result.statusCode)
22
+ expectAssignable<Record<string, unknown>>(result.headers)
23
+ return result
24
+ }
25
+
17
26
  const [service1] = service.services
18
27
  expectType<Promise<unknown>>(api.getRuntimeOpenapi(runtime.pid, service1.id))
19
28
  expectType<string[]>(runtime.argv)
@@ -128,7 +128,7 @@ class RuntimeApiClient {
128
128
  // No-op
129
129
  }
130
130
 
131
- if (jsonError?.code === 'PLT_RUNTIME_SERVICE_NOT_FOUND') {
131
+ if (jsonError?.code === 'PLT_RUNTIME_SERVICE_NOT_FOUND' || jsonError?.code === 'PLT_RUNTIME_SERVICE_WORKER_NOT_FOUND') {
132
132
  throw new errors.ServiceNotFound(error)
133
133
  }
134
134
 
@@ -190,7 +190,7 @@ class RuntimeApiClient {
190
190
  // No-op
191
191
  }
192
192
 
193
- if (jsonError?.code === 'PLT_RUNTIME_SERVICE_NOT_FOUND') {
193
+ if (jsonError?.code === 'PLT_RUNTIME_SERVICE_NOT_FOUND' || jsonError?.code === 'PLT_RUNTIME_SERVICE_WORKER_NOT_FOUND') {
194
194
  throw new errors.ServiceNotFound(error)
195
195
  }
196
196
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/control",
3
- "version": "2.69.0",
3
+ "version": "2.70.1",
4
4
  "description": "Platformatic Control",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -25,8 +25,8 @@
25
25
  "split2": "^4.2.0",
26
26
  "tsd": "^0.32.0",
27
27
  "typescript": "^5.5.4",
28
- "@platformatic/runtime": "2.69.0",
29
- "@platformatic/service": "2.69.0"
28
+ "@platformatic/runtime": "2.70.1",
29
+ "@platformatic/service": "2.70.1"
30
30
  },
31
31
  "dependencies": {
32
32
  "@fastify/error": "^4.0.0",
@@ -37,11 +37,11 @@
37
37
  "table": "^6.8.1",
38
38
  "undici": "^7.0.0",
39
39
  "ws": "^8.16.0",
40
- "@platformatic/utils": "2.69.0"
40
+ "@platformatic/utils": "2.70.1"
41
41
  },
42
42
  "scripts": {
43
43
  "test": "pnpm run lint && pnpm run unit && tsd",
44
- "unit": "borp --concurrency=1 --timeout=300000",
44
+ "unit": "borp --concurrency=1 --timeout=1200000",
45
45
  "lint": "eslint"
46
46
  }
47
47
  }