@platformatic/runtime 2.19.0-alpha.6 → 2.19.0-alpha.7
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/runtime.js +20 -7
- package/lib/worker/main.js +3 -7
- package/package.json +14 -14
- 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 HttpsSchemasPlatformaticDevPlatformaticRuntime2190Alpha7Json = {
|
|
9
9
|
[k: string]: unknown;
|
|
10
10
|
} & {
|
|
11
11
|
$schema?: string;
|
package/lib/runtime.js
CHANGED
|
@@ -134,6 +134,21 @@ class Runtime extends EventEmitter {
|
|
|
134
134
|
|
|
135
135
|
// Recompute the list of services after sorting
|
|
136
136
|
this.#servicesIds = config.services.map(service => service.id)
|
|
137
|
+
|
|
138
|
+
// When autoloading is disabled, add a warning if a service is defined before its dependencies
|
|
139
|
+
if (!autoloadEnabled) {
|
|
140
|
+
for (let i = 0; i < config.services.length; i++) {
|
|
141
|
+
const current = config.services[i]
|
|
142
|
+
|
|
143
|
+
for (const dep of current.dependencies ?? []) {
|
|
144
|
+
if (config.services.findIndex(s => s.id === dep.id) > i) {
|
|
145
|
+
this.logger.warn(
|
|
146
|
+
`Service "${current.id}" depends on service "${dep.id}", but it is defined and it will be started before it. Please check your configuration file.`
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
137
152
|
} catch (e) {
|
|
138
153
|
await this.close()
|
|
139
154
|
throw e
|
|
@@ -766,7 +781,7 @@ class Runtime extends EventEmitter {
|
|
|
766
781
|
}
|
|
767
782
|
|
|
768
783
|
async #setupWorker (config, serviceConfig, workersCount, serviceId, index) {
|
|
769
|
-
const {
|
|
784
|
+
const { restartOnError } = config
|
|
770
785
|
const workerId = `${serviceId}:${index}`
|
|
771
786
|
|
|
772
787
|
const { port1: loggerDestination, port2: loggingPort } = new MessageChannel()
|
|
@@ -931,12 +946,10 @@ class Runtime extends EventEmitter {
|
|
|
931
946
|
// Store dependencies
|
|
932
947
|
const [{ dependencies }] = await waitEventFromITC(worker, 'init')
|
|
933
948
|
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
serviceConfig.localServiceEnvVars.set(envVar, url)
|
|
939
|
-
}
|
|
949
|
+
serviceConfig.dependencies = dependencies
|
|
950
|
+
for (const { envVar, url } of dependencies) {
|
|
951
|
+
if (envVar) {
|
|
952
|
+
serviceConfig.localServiceEnvVars.set(envVar, url)
|
|
940
953
|
}
|
|
941
954
|
}
|
|
942
955
|
|
package/lib/worker/main.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { EventEmitter } = require('node:events')
|
|
4
3
|
const { createRequire } = require('node:module')
|
|
5
4
|
const { hostname } = require('node:os')
|
|
6
5
|
const { join } = require('node:path')
|
|
@@ -36,10 +35,7 @@ globalThis[kId] = threadId
|
|
|
36
35
|
let app
|
|
37
36
|
|
|
38
37
|
const config = workerData.config
|
|
39
|
-
globalThis.platformatic = Object.assign(globalThis.platformatic ?? {}, {
|
|
40
|
-
logger: createLogger(),
|
|
41
|
-
events: new EventEmitter()
|
|
42
|
-
})
|
|
38
|
+
globalThis.platformatic = Object.assign(globalThis.platformatic ?? {}, { logger: createLogger() })
|
|
43
39
|
|
|
44
40
|
function handleUnhandled (type, err) {
|
|
45
41
|
const label =
|
|
@@ -159,7 +155,7 @@ async function main () {
|
|
|
159
155
|
|
|
160
156
|
if (service.entrypoint && config.basePath) {
|
|
161
157
|
const meta = await app.stackable.getMeta()
|
|
162
|
-
if (!meta.wantsAbsoluteUrls) {
|
|
158
|
+
if (!meta.composer.wantsAbsoluteUrls) {
|
|
163
159
|
stripBasePath(config.basePath)
|
|
164
160
|
}
|
|
165
161
|
}
|
|
@@ -169,7 +165,7 @@ async function main () {
|
|
|
169
165
|
globalThis[kITC] = itc
|
|
170
166
|
|
|
171
167
|
// Get the dependencies
|
|
172
|
-
const dependencies =
|
|
168
|
+
const dependencies = await app.getBootstrapDependencies()
|
|
173
169
|
itc.notify('init', { dependencies })
|
|
174
170
|
}
|
|
175
171
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/runtime",
|
|
3
|
-
"version": "2.19.0-alpha.
|
|
3
|
+
"version": "2.19.0-alpha.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"typescript": "^5.5.4",
|
|
36
36
|
"undici-oidc-interceptor": "^0.5.0",
|
|
37
37
|
"why-is-node-running": "^2.2.2",
|
|
38
|
-
"@platformatic/composer": "2.19.0-alpha.
|
|
39
|
-
"@platformatic/db": "2.19.0-alpha.
|
|
40
|
-
"@platformatic/node": "2.19.0-alpha.
|
|
41
|
-
"@platformatic/
|
|
42
|
-
"@platformatic/
|
|
43
|
-
"@platformatic/sql-
|
|
38
|
+
"@platformatic/composer": "2.19.0-alpha.7",
|
|
39
|
+
"@platformatic/db": "2.19.0-alpha.7",
|
|
40
|
+
"@platformatic/node": "2.19.0-alpha.7",
|
|
41
|
+
"@platformatic/service": "2.19.0-alpha.7",
|
|
42
|
+
"@platformatic/sql-graphql": "2.19.0-alpha.7",
|
|
43
|
+
"@platformatic/sql-mapper": "2.19.0-alpha.7"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@fastify/error": "^4.0.0",
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
"undici": "^6.9.0",
|
|
71
71
|
"undici-thread-interceptor": "^0.9.0",
|
|
72
72
|
"ws": "^8.16.0",
|
|
73
|
-
"@platformatic/basic": "2.19.0-alpha.
|
|
74
|
-
"@platformatic/generators": "2.19.0-alpha.
|
|
75
|
-
"@platformatic/
|
|
76
|
-
"@platformatic/
|
|
77
|
-
"@platformatic/
|
|
78
|
-
"@platformatic/
|
|
79
|
-
"@platformatic/
|
|
73
|
+
"@platformatic/basic": "2.19.0-alpha.7",
|
|
74
|
+
"@platformatic/generators": "2.19.0-alpha.7",
|
|
75
|
+
"@platformatic/ts-compiler": "2.19.0-alpha.7",
|
|
76
|
+
"@platformatic/utils": "2.19.0-alpha.7",
|
|
77
|
+
"@platformatic/config": "2.19.0-alpha.7",
|
|
78
|
+
"@platformatic/itc": "2.19.0-alpha.7",
|
|
79
|
+
"@platformatic/telemetry": "2.19.0-alpha.7"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
|
82
82
|
"test": "npm run lint && borp --concurrency=1 --timeout=300000 && tsd",
|
package/schema.json
CHANGED