@platformatic/runtime 2.70.1 → 2.71.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 +1 -1
- package/lib/generator/runtime-generator.js +7 -2
- package/lib/runtime.js +5 -1
- package/lib/start.js +1 -1
- package/lib/worker/app.js +12 -0
- package/package.json +15 -15
- package/schema.json +1 -1
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
|
|
8
|
+
export type HttpsSchemasPlatformaticDevPlatformaticRuntime2710Json = {
|
|
9
9
|
[k: string]: unknown;
|
|
10
10
|
} & {
|
|
11
11
|
$schema?: string;
|
|
@@ -12,7 +12,7 @@ const { getServiceTemplateFromSchemaUrl } = require('@platformatic/generators/li
|
|
|
12
12
|
const { DotEnvTool } = require('dotenv-tool')
|
|
13
13
|
const { getArrayDifference } = require('../utils')
|
|
14
14
|
const { pathToFileURL } = require('node:url')
|
|
15
|
-
const { safeRemove, generateDashedName } = require('@platformatic/utils')
|
|
15
|
+
const { safeRemove, generateDashedName, DEFAULT_PACKAGE_MANAGER } = require('@platformatic/utils')
|
|
16
16
|
const { createRequire } = require('node:module')
|
|
17
17
|
|
|
18
18
|
const wrappableProperties = {
|
|
@@ -50,6 +50,7 @@ class RuntimeGenerator extends BaseGenerator {
|
|
|
50
50
|
this.services = []
|
|
51
51
|
this.existingServices = []
|
|
52
52
|
this.entryPoint = null
|
|
53
|
+
this.packageManager = opts.packageManager ?? DEFAULT_PACKAGE_MANAGER
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
async addService (service, name) {
|
|
@@ -85,7 +86,6 @@ class RuntimeGenerator extends BaseGenerator {
|
|
|
85
86
|
async generatePackageJson () {
|
|
86
87
|
const template = {
|
|
87
88
|
name: `${this.runtimeName}`,
|
|
88
|
-
workspaces: [this.servicesFolder + '/*'],
|
|
89
89
|
scripts: {
|
|
90
90
|
dev: this.config.devCommand,
|
|
91
91
|
build: this.config.buildCommand,
|
|
@@ -103,6 +103,11 @@ class RuntimeGenerator extends BaseGenerator {
|
|
|
103
103
|
},
|
|
104
104
|
engines
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
if (this.packageManager === 'npm' || this.packageManager === 'yarn') {
|
|
108
|
+
template.workspaces = [this.servicesFolder + '/*']
|
|
109
|
+
}
|
|
110
|
+
|
|
106
111
|
if (this.config.typescript) {
|
|
107
112
|
const typescriptVersion = JSON.parse(await readFile(join(__dirname, '..', '..', 'package.json'), 'utf-8'))
|
|
108
113
|
.devDependencies.typescript
|
package/lib/runtime.js
CHANGED
|
@@ -1786,7 +1786,11 @@ class Runtime extends EventEmitter {
|
|
|
1786
1786
|
})
|
|
1787
1787
|
}
|
|
1788
1788
|
|
|
1789
|
-
|
|
1789
|
+
try {
|
|
1790
|
+
this.#workersBroadcastChannel.postMessage(workers)
|
|
1791
|
+
} catch (err) {
|
|
1792
|
+
this.logger?.error({ err }, 'Error when broadcasting workers')
|
|
1793
|
+
}
|
|
1790
1794
|
}
|
|
1791
1795
|
|
|
1792
1796
|
async #getWorkerMessagingChannel ({ service, worker }, context) {
|
package/lib/start.js
CHANGED
|
@@ -98,7 +98,7 @@ async function setupAndStartRuntime (config) {
|
|
|
98
98
|
try {
|
|
99
99
|
address = await runtime.start()
|
|
100
100
|
} catch (err) {
|
|
101
|
-
if (err.code === 'EADDRINUSE') {
|
|
101
|
+
if (err.code === 'EADDRINUSE' || err.code === 'EACCES') {
|
|
102
102
|
// Get the actual port from the error message if original port was 0
|
|
103
103
|
if (!port) {
|
|
104
104
|
const mo = err.message.match(/ address already in use (.+)/)
|
package/lib/worker/app.js
CHANGED
|
@@ -207,6 +207,18 @@ class PlatformaticApp extends EventEmitter {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
async getMetrics ({ format }) {
|
|
210
|
+
const dispatcher = getGlobalDispatcher()
|
|
211
|
+
if (globalThis.platformatic?.onHttpStatsFree && dispatcher?.stats) {
|
|
212
|
+
for (const url in dispatcher.stats) {
|
|
213
|
+
const { free, connected, pending, queued, running, size } = dispatcher.stats[url]
|
|
214
|
+
globalThis.platformatic.onHttpStatsFree(url, free || 0)
|
|
215
|
+
globalThis.platformatic.onHttpStatsConnected(url, connected || 0)
|
|
216
|
+
globalThis.platformatic.onHttpStatsPending(url, pending || 0)
|
|
217
|
+
globalThis.platformatic.onHttpStatsQueued(url, queued || 0)
|
|
218
|
+
globalThis.platformatic.onHttpStatsRunning(url, running || 0)
|
|
219
|
+
globalThis.platformatic.onHttpStatsSize(url, size || 0)
|
|
220
|
+
}
|
|
221
|
+
}
|
|
210
222
|
return this.stackable.getMetrics({ format })
|
|
211
223
|
}
|
|
212
224
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/runtime",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.71.0",
|
|
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.
|
|
41
|
-
"@platformatic/
|
|
42
|
-
"@platformatic/
|
|
43
|
-
"@platformatic/
|
|
44
|
-
"@platformatic/sql-
|
|
45
|
-
"@platformatic/
|
|
40
|
+
"@platformatic/composer": "2.71.0",
|
|
41
|
+
"@platformatic/db": "2.71.0",
|
|
42
|
+
"@platformatic/node": "2.71.0",
|
|
43
|
+
"@platformatic/service": "2.71.0",
|
|
44
|
+
"@platformatic/sql-graphql": "2.71.0",
|
|
45
|
+
"@platformatic/sql-mapper": "2.71.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@fastify/accepts": "^5.0.0",
|
|
@@ -76,14 +76,14 @@
|
|
|
76
76
|
"undici": "^7.0.0",
|
|
77
77
|
"undici-thread-interceptor": "^0.14.0",
|
|
78
78
|
"ws": "^8.16.0",
|
|
79
|
-
"@platformatic/
|
|
80
|
-
"@platformatic/
|
|
81
|
-
"@platformatic/generators": "2.
|
|
82
|
-
"@platformatic/
|
|
83
|
-
"@platformatic/
|
|
84
|
-
"@platformatic/telemetry": "2.
|
|
85
|
-
"@platformatic/
|
|
86
|
-
"@platformatic/
|
|
79
|
+
"@platformatic/basic": "2.71.0",
|
|
80
|
+
"@platformatic/config": "2.71.0",
|
|
81
|
+
"@platformatic/generators": "2.71.0",
|
|
82
|
+
"@platformatic/metrics": "2.71.0",
|
|
83
|
+
"@platformatic/itc": "2.71.0",
|
|
84
|
+
"@platformatic/telemetry": "2.71.0",
|
|
85
|
+
"@platformatic/utils": "2.71.0",
|
|
86
|
+
"@platformatic/ts-compiler": "2.71.0"
|
|
87
87
|
},
|
|
88
88
|
"scripts": {
|
|
89
89
|
"test": "pnpm run lint && borp --concurrency=1 --timeout=1200000 && tsd",
|
package/schema.json
CHANGED