@platformatic/runtime 2.65.1 → 2.66.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/lib/start.js CHANGED
@@ -91,16 +91,29 @@ async function setupAndStartRuntime (config) {
91
91
 
92
92
  let address = null
93
93
  const startErr = null
94
- const originalPort = runtimeConfig.current.server?.port || 0
94
+
95
+ runtimeConfig.current.server ??= { port: 0 }
96
+ let port = runtimeConfig.current.server.port
95
97
  while (address === null) {
96
98
  try {
97
99
  address = await runtime.start()
98
100
  } catch (err) {
99
101
  if (err.code === 'EADDRINUSE') {
102
+ // Get the actual port from the error message if original port was 0
103
+ if (!port) {
104
+ const mo = err.message.match(/ address already in use (.+)/)
105
+ const url = new URL(`http://${mo[1]}`)
106
+ port = Number(url.port)
107
+ }
108
+
109
+ port++
100
110
  await runtime.close()
101
111
 
102
- if (runtimeConfig.current?.server?.port > MAX_PORT) throw err
103
- runtimeConfig.current.server.port++
112
+ if (port > MAX_PORT) {
113
+ throw err
114
+ }
115
+
116
+ runtimeConfig.current.server.port = port
104
117
  runtime = await buildRuntime(runtimeConfig)
105
118
  } else {
106
119
  throw err
@@ -114,7 +127,7 @@ async function setupAndStartRuntime (config) {
114
127
  ignore: 'hostname,pid'
115
128
  })
116
129
  )
117
- logger.warn(`Port: ${originalPort} is already in use!`)
130
+ logger.warn(`Port: ${port} is already in use!`)
118
131
  logger.warn(`Changing the port to ${runtimeConfig.current.server.port}`)
119
132
  }
120
133
  return { address, runtime }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/runtime",
3
- "version": "2.65.1",
3
+ "version": "2.66.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -37,12 +37,12 @@
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.65.1",
41
- "@platformatic/db": "2.65.1",
42
- "@platformatic/node": "2.65.1",
43
- "@platformatic/service": "2.65.1",
44
- "@platformatic/sql-graphql": "2.65.1",
45
- "@platformatic/sql-mapper": "2.65.1"
40
+ "@platformatic/composer": "2.66.1",
41
+ "@platformatic/db": "2.66.1",
42
+ "@platformatic/node": "2.66.1",
43
+ "@platformatic/service": "2.66.1",
44
+ "@platformatic/sql-graphql": "2.66.1",
45
+ "@platformatic/sql-mapper": "2.66.1"
46
46
  },
47
47
  "dependencies": {
48
48
  "@fastify/accepts": "^5.0.0",
@@ -72,17 +72,18 @@
72
72
  "pino-roll": "^2.0.0",
73
73
  "prom-client": "^15.1.2",
74
74
  "semgrator": "^0.3.0",
75
+ "sonic-boom": "^4.2.0",
75
76
  "tail-file-stream": "^0.2.0",
76
77
  "undici": "^7.0.0",
77
78
  "undici-thread-interceptor": "^0.13.1",
78
79
  "ws": "^8.16.0",
79
- "@platformatic/basic": "2.65.1",
80
- "@platformatic/config": "2.65.1",
81
- "@platformatic/generators": "2.65.1",
82
- "@platformatic/telemetry": "2.65.1",
83
- "@platformatic/itc": "2.65.1",
84
- "@platformatic/ts-compiler": "2.65.1",
85
- "@platformatic/utils": "2.65.1"
80
+ "@platformatic/basic": "2.66.1",
81
+ "@platformatic/config": "2.66.1",
82
+ "@platformatic/itc": "2.66.1",
83
+ "@platformatic/telemetry": "2.66.1",
84
+ "@platformatic/generators": "2.66.1",
85
+ "@platformatic/ts-compiler": "2.66.1",
86
+ "@platformatic/utils": "2.66.1"
86
87
  },
87
88
  "scripts": {
88
89
  "test": "pnpm run lint && borp --concurrency=1 --timeout=300000 && tsd",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/runtime/2.65.1.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/runtime/2.66.1.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "type": "object",
5
5
  "properties": {
@@ -773,6 +773,28 @@
773
773
  "paths"
774
774
  ],
775
775
  "additionalProperties": false
776
+ },
777
+ "base": {
778
+ "anyOf": [
779
+ {
780
+ "type": "object",
781
+ "additionalProperties": true
782
+ },
783
+ {
784
+ "type": "null"
785
+ }
786
+ ]
787
+ },
788
+ "messageKey": {
789
+ "type": "string"
790
+ },
791
+ "customLevels": {
792
+ "type": "object",
793
+ "additionalProperties": true
794
+ },
795
+ "captureStdio": {
796
+ "type": "boolean",
797
+ "default": true
776
798
  }
777
799
  },
778
800
  "required": [
@@ -1057,7 +1079,20 @@
1057
1079
  {
1058
1080
  "type": "array",
1059
1081
  "items": {
1060
- "$ref": "#/$defs/undiciInterceptor"
1082
+ "type": "object",
1083
+ "properties": {
1084
+ "module": {
1085
+ "type": "string"
1086
+ },
1087
+ "options": {
1088
+ "type": "object",
1089
+ "additionalProperties": true
1090
+ }
1091
+ },
1092
+ "required": [
1093
+ "module",
1094
+ "options"
1095
+ ]
1061
1096
  }
1062
1097
  },
1063
1098
  {
@@ -1066,19 +1101,58 @@
1066
1101
  "Client": {
1067
1102
  "type": "array",
1068
1103
  "items": {
1069
- "$ref": "#/$defs/undiciInterceptor"
1104
+ "type": "object",
1105
+ "properties": {
1106
+ "module": {
1107
+ "type": "string"
1108
+ },
1109
+ "options": {
1110
+ "type": "object",
1111
+ "additionalProperties": true
1112
+ }
1113
+ },
1114
+ "required": [
1115
+ "module",
1116
+ "options"
1117
+ ]
1070
1118
  }
1071
1119
  },
1072
1120
  "Pool": {
1073
1121
  "type": "array",
1074
1122
  "items": {
1075
- "$ref": "#/$defs/undiciInterceptor"
1123
+ "type": "object",
1124
+ "properties": {
1125
+ "module": {
1126
+ "type": "string"
1127
+ },
1128
+ "options": {
1129
+ "type": "object",
1130
+ "additionalProperties": true
1131
+ }
1132
+ },
1133
+ "required": [
1134
+ "module",
1135
+ "options"
1136
+ ]
1076
1137
  }
1077
1138
  },
1078
1139
  "Agent": {
1079
1140
  "type": "array",
1080
1141
  "items": {
1081
- "$ref": "#/$defs/undiciInterceptor"
1142
+ "type": "object",
1143
+ "properties": {
1144
+ "module": {
1145
+ "type": "string"
1146
+ },
1147
+ "options": {
1148
+ "type": "object",
1149
+ "additionalProperties": true
1150
+ }
1151
+ },
1152
+ "required": [
1153
+ "module",
1154
+ "options"
1155
+ ]
1082
1156
  }
1083
1157
  }
1084
1158
  }
@@ -1305,7 +1379,6 @@
1305
1379
  ]
1306
1380
  },
1307
1381
  "telemetry": {
1308
- "$id": "/OpenTelemetry",
1309
1382
  "type": "object",
1310
1383
  "properties": {
1311
1384
  "enabled": {
@@ -1562,23 +1635,5 @@
1562
1635
  ]
1563
1636
  }
1564
1637
  ],
1565
- "additionalProperties": false,
1566
- "$defs": {
1567
- "undiciInterceptor": {
1568
- "type": "object",
1569
- "properties": {
1570
- "module": {
1571
- "type": "string"
1572
- },
1573
- "options": {
1574
- "type": "object",
1575
- "additionalProperties": true
1576
- }
1577
- },
1578
- "required": [
1579
- "module",
1580
- "options"
1581
- ]
1582
- }
1583
- }
1638
+ "additionalProperties": false
1584
1639
  }
package/undefined ADDED
@@ -0,0 +1,5 @@
1
+ {"level":30,"time":1747909640025,"pid":84550,"hostname":"work","msg":"Starting the service \"service\"..."}
2
+ {"level":30,"time":1747909640055,"pid":84550,"hostname":"work","msg":"Started the service \"service\"..."}
3
+ {"level":30,"time":1747909640055,"pid":84550,"hostname":"work","msg":"Platformatic is now listening at http://127.0.0.1:41619"}
4
+ {"level":30,"time":1747909640066,"pid":84550,"hostname":"work","msg":"Stopping the service \"service\"..."}
5
+ {"level":30,"time":1747909640069,"pid":84550,"hostname":"work","msg":"Stopped the service \"service\"..."}