@platformatic/runtime 2.59.1 → 2.61.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/config.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * and run json-schema-to-typescript to regenerate this file.
6
6
  */
7
7
 
8
- export type HttpsSchemasPlatformaticDevPlatformaticRuntime2591Json = {
8
+ export type HttpsSchemasPlatformaticDevPlatformaticRuntime2610Json = {
9
9
  [k: string]: unknown;
10
10
  } & {
11
11
  $schema?: string;
package/lib/runtime.js CHANGED
@@ -7,7 +7,7 @@ const { createReadStream, watch, existsSync } = require('node:fs')
7
7
  const { readdir, readFile, stat, access } = require('node:fs/promises')
8
8
  const { STATUS_CODES } = require('node:http')
9
9
  const { join } = require('node:path')
10
- const { setTimeout: sleep, setImmediate: sleepUntilNextTick } = require('node:timers/promises')
10
+ const { setTimeout: sleep, setImmediate: immediate } = require('node:timers/promises')
11
11
  const { Worker } = require('node:worker_threads')
12
12
  const ts = require('tail-file-stream')
13
13
  const { Agent, interceptors: undiciInterceptors, request } = require('undici')
@@ -1732,14 +1732,17 @@ class Runtime extends EventEmitter {
1732
1732
  for (const raw of data.split('\n')) {
1733
1733
  // First of all, try to parse the message as JSON
1734
1734
  let message
1735
- try {
1736
- message = JSON.parse(raw)
1737
- } catch (e) {
1738
- // No-op, we assume the message is raw
1735
+ // The message is a JSON object if it has at least 2 bytes
1736
+ if (raw.length >= 2) {
1737
+ try {
1738
+ message = JSON.parse(raw)
1739
+ } catch (e) {
1740
+ // No-op, we assume the message is raw
1741
+ }
1739
1742
  }
1740
1743
 
1741
1744
  // Not a Pino JSON, accumulate the message and continue
1742
- if (typeof message?.level !== 'number' || typeof message?.time !== 'number') {
1745
+ if (typeof message?.level !== 'number' || (typeof message?.time !== 'number' && typeof message?.msg !== 'string')) {
1743
1746
  plainMessages += (plainMessages.length ? '\n' : '') + raw
1744
1747
  continue
1745
1748
  }
@@ -1771,7 +1774,7 @@ class Runtime extends EventEmitter {
1771
1774
  // Let's wait few more ticks to ensure the right order.
1772
1775
  async #avoidOutOfOrderThreadLogs () {
1773
1776
  for (let i = 0; i < 2; i++) {
1774
- await sleepUntilNextTick()
1777
+ await immediate()
1775
1778
  }
1776
1779
  }
1777
1780
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/runtime",
3
- "version": "2.59.1",
3
+ "version": "2.61.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -33,16 +33,16 @@
33
33
  "neostandard": "^0.12.0",
34
34
  "pino-abstract-transport": "^2.0.0",
35
35
  "split2": "^4.2.0",
36
- "tsd": "^0.31.0",
36
+ "tsd": "^0.32.0",
37
37
  "typescript": "^5.5.4",
38
38
  "undici-oidc-interceptor": "^0.5.0",
39
39
  "why-is-node-running": "^2.2.2",
40
- "@platformatic/composer": "2.59.1",
41
- "@platformatic/db": "2.59.1",
42
- "@platformatic/node": "2.59.1",
43
- "@platformatic/service": "2.59.1",
44
- "@platformatic/sql-graphql": "2.59.1",
45
- "@platformatic/sql-mapper": "2.59.1"
40
+ "@platformatic/composer": "2.61.0",
41
+ "@platformatic/db": "2.61.0",
42
+ "@platformatic/service": "2.61.0",
43
+ "@platformatic/sql-graphql": "2.61.0",
44
+ "@platformatic/sql-mapper": "2.61.0",
45
+ "@platformatic/node": "2.61.0"
46
46
  },
47
47
  "dependencies": {
48
48
  "@fastify/accepts": "^5.0.0",
@@ -73,27 +73,26 @@
73
73
  "prom-client": "^15.1.2",
74
74
  "semgrator": "^0.3.0",
75
75
  "tail-file-stream": "^0.2.0",
76
- "thread-cpu-usage": "^0.2.0",
77
76
  "undici": "^7.0.0",
78
77
  "undici-thread-interceptor": "^0.13.1",
79
78
  "ws": "^8.16.0",
80
- "@platformatic/basic": "2.59.1",
81
- "@platformatic/config": "2.59.1",
82
- "@platformatic/itc": "2.59.1",
83
- "@platformatic/generators": "2.59.1",
84
- "@platformatic/telemetry": "2.59.1",
85
- "@platformatic/ts-compiler": "2.59.1",
86
- "@platformatic/utils": "2.59.1"
79
+ "@platformatic/basic": "2.61.0",
80
+ "@platformatic/generators": "2.61.0",
81
+ "@platformatic/config": "2.61.0",
82
+ "@platformatic/itc": "2.61.0",
83
+ "@platformatic/telemetry": "2.61.0",
84
+ "@platformatic/utils": "2.61.0",
85
+ "@platformatic/ts-compiler": "2.61.0"
87
86
  },
88
87
  "scripts": {
89
- "test": "npm run lint && borp --concurrency=1 --timeout=300000 && tsd",
88
+ "test": "pnpm run lint && borp --concurrency=1 --timeout=300000 && tsd",
90
89
  "test:main": "borp --concurrency=1 --timeout=300000 test/*.test.js test/*.test.mjs test/versions/*.test.js test/versions/*.test.mjs",
91
90
  "test:api": "borp --concurrency=1 --timeout=300000 test/api/*.test.js test/api/*.test.mjs test/management-api/*.test.js test/management-api/*.test.mjs",
92
91
  "test:cli": "borp --concurrency=1 --timeout=300000 test/cli/*.test.js test/cli/*.test.mjs test/cli/**/*.test.js test/cli/**/*.test.mjs",
93
92
  "test:start": "borp --concurrency=1 --timeout=300000 test/start/*.test.js test/start/*.test.mjs",
94
93
  "test:multiple-workers": "borp --concurrency=1 --timeout=300000 test/multiple-workers/*.test.js test/multiple-workers/*.test.mjs",
95
94
  "test:types": "tsd",
96
- "coverage": "npm run lint && borp -X fixtures -X test -C --concurrency=1 --timeout=300000 && tsd",
95
+ "coverage": "pnpm run lint && borp -X fixtures -X test -C --concurrency=1 --timeout=300000 && tsd",
97
96
  "gen-schema": "node lib/schema.js > schema.json",
98
97
  "gen-types": "json2ts > config.d.ts < schema.json",
99
98
  "build": "pnpm run gen-schema && pnpm run gen-types",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/runtime/2.59.1.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/runtime/2.61.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "type": "object",
5
5
  "properties": {