@platformatic/basic 2.18.0 → 2.19.0-alpha.2
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/base.js +2 -24
- package/lib/worker/child-manager.js +4 -5
- package/lib/worker/child-process.js +0 -27
- package/package.json +6 -6
- package/schema.json +1 -1
package/lib/base.js
CHANGED
|
@@ -15,7 +15,7 @@ import { ChildManager } from './worker/child-manager.js'
|
|
|
15
15
|
|
|
16
16
|
export class BaseStackable {
|
|
17
17
|
childManager
|
|
18
|
-
|
|
18
|
+
subprocess
|
|
19
19
|
#subprocessStarted
|
|
20
20
|
|
|
21
21
|
constructor (type, version, options, root, configManager) {
|
|
@@ -32,8 +32,6 @@ export class BaseStackable {
|
|
|
32
32
|
this.serverConfig = deepmerge(options.context.serverConfig ?? {}, configManager.current.server ?? {})
|
|
33
33
|
this.openapiSchema = null
|
|
34
34
|
this.graphqlSchema = null
|
|
35
|
-
this.connectionString = null
|
|
36
|
-
this.basePath = null
|
|
37
35
|
this.isEntrypoint = options.context.isEntrypoint
|
|
38
36
|
this.isProduction = options.context.isProduction
|
|
39
37
|
this.metricsRegistry = null
|
|
@@ -66,7 +64,6 @@ export class BaseStackable {
|
|
|
66
64
|
root: pathToFileURL(this.root).toString(),
|
|
67
65
|
setOpenapiSchema: this.setOpenapiSchema.bind(this),
|
|
68
66
|
setGraphqlSchema: this.setGraphqlSchema.bind(this),
|
|
69
|
-
setConnectionString: this.setConnectionString.bind(this),
|
|
70
67
|
setBasePath: this.setBasePath.bind(this),
|
|
71
68
|
runtimeBasePath: this.runtimeConfig?.basePath ?? null
|
|
72
69
|
})
|
|
@@ -129,10 +126,6 @@ export class BaseStackable {
|
|
|
129
126
|
this.graphqlSchema = schema
|
|
130
127
|
}
|
|
131
128
|
|
|
132
|
-
setConnectionString (connectionString) {
|
|
133
|
-
this.connectionString = connectionString
|
|
134
|
-
}
|
|
135
|
-
|
|
136
129
|
setBasePath (basePath) {
|
|
137
130
|
this.basePath = basePath
|
|
138
131
|
}
|
|
@@ -219,22 +212,6 @@ export class BaseStackable {
|
|
|
219
212
|
this.subprocessConfig = config
|
|
220
213
|
})
|
|
221
214
|
|
|
222
|
-
this.childManager.on('connectionString', connectionString => {
|
|
223
|
-
this.connectionString = connectionString
|
|
224
|
-
})
|
|
225
|
-
|
|
226
|
-
this.childManager.on('openapiSchema', schema => {
|
|
227
|
-
this.openapiSchema = schema
|
|
228
|
-
})
|
|
229
|
-
|
|
230
|
-
this.childManager.on('graphqlSchema', schema => {
|
|
231
|
-
this.graphqlSchema = schema
|
|
232
|
-
})
|
|
233
|
-
|
|
234
|
-
this.childManager.on('basePath', path => {
|
|
235
|
-
this.basePath = path
|
|
236
|
-
})
|
|
237
|
-
|
|
238
215
|
try {
|
|
239
216
|
await this.childManager.inject()
|
|
240
217
|
|
|
@@ -372,6 +349,7 @@ export class BaseStackable {
|
|
|
372
349
|
|
|
373
350
|
return {
|
|
374
351
|
id: this.id,
|
|
352
|
+
config: this.configManager.current,
|
|
375
353
|
serviceId: this.serviceId,
|
|
376
354
|
workerId: this.workerId,
|
|
377
355
|
// Always use URL to avoid serialization problem in Windows
|
|
@@ -3,16 +3,15 @@ import { createDirectory, ensureLoggableError } from '@platformatic/utils'
|
|
|
3
3
|
import { once } from 'node:events'
|
|
4
4
|
import { rm, writeFile } from 'node:fs/promises'
|
|
5
5
|
import { createServer } from 'node:http'
|
|
6
|
-
import {
|
|
7
|
-
import { register } from 'node:module'
|
|
6
|
+
import { createRequire, register } from 'node:module'
|
|
8
7
|
import { platform, tmpdir } from 'node:os'
|
|
9
|
-
import { dirname,
|
|
8
|
+
import { dirname, join, resolve } from 'node:path'
|
|
9
|
+
import { pathToFileURL } from 'node:url'
|
|
10
10
|
import { workerData } from 'node:worker_threads'
|
|
11
11
|
import { request } from 'undici'
|
|
12
12
|
import { WebSocketServer } from 'ws'
|
|
13
13
|
import { exitCodes } from '../errors.js'
|
|
14
14
|
import { ensureFileUrl } from '../utils.js'
|
|
15
|
-
import { createRequire } from 'node:module'
|
|
16
15
|
|
|
17
16
|
export const isWindows = platform() === 'win32'
|
|
18
17
|
|
|
@@ -171,7 +170,7 @@ export class ChildManager extends ITC {
|
|
|
171
170
|
if (this.#context.telemetryConfig) {
|
|
172
171
|
const require = createRequire(import.meta.url)
|
|
173
172
|
const telemetryPath = require.resolve('@platformatic/telemetry')
|
|
174
|
-
const openTelemetrySetupPath = join(telemetryPath, '..', 'lib', 'node-telemetry.js')
|
|
173
|
+
const openTelemetrySetupPath = join(telemetryPath, '..', 'lib', 'node-http-telemetry.js')
|
|
175
174
|
telemetryInclude = `--import="${pathToFileURL(openTelemetrySetupPath)}"`
|
|
176
175
|
}
|
|
177
176
|
|
|
@@ -118,13 +118,6 @@ export class ChildProcess extends ITC {
|
|
|
118
118
|
process.exit(0)
|
|
119
119
|
}
|
|
120
120
|
})
|
|
121
|
-
|
|
122
|
-
this.registerGlobals({
|
|
123
|
-
setOpenapiSchema: this.setOpenapiSchema.bind(this),
|
|
124
|
-
setGraphqlSchema: this.setGraphqlSchema.bind(this),
|
|
125
|
-
setConnectionString: this.setConnectionString.bind(this),
|
|
126
|
-
setBasePath: this.setBasePath.bind(this),
|
|
127
|
-
})
|
|
128
121
|
}
|
|
129
122
|
|
|
130
123
|
_setupListener (listener) {
|
|
@@ -288,26 +281,6 @@ export class ChildProcess extends ITC {
|
|
|
288
281
|
process.on('uncaughtException', handleUnhandled.bind(this, 'uncaught exception'))
|
|
289
282
|
process.on('unhandledRejection', handleUnhandled.bind(this, 'unhandled rejection'))
|
|
290
283
|
}
|
|
291
|
-
|
|
292
|
-
registerGlobals (globals) {
|
|
293
|
-
globalThis.platformatic = Object.assign(globalThis.platformatic ?? {}, globals)
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
setOpenapiSchema (schema) {
|
|
297
|
-
this.notify('openapiSchema', schema)
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
setGraphqlSchema (schema) {
|
|
301
|
-
this.notify('graphqlSchema', schema)
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
setConnectionString (connectionString) {
|
|
305
|
-
this.notify('connectionString', connectionString)
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
setBasePath (basePath) {
|
|
309
|
-
this.notify('basePath', basePath)
|
|
310
|
-
}
|
|
311
284
|
}
|
|
312
285
|
|
|
313
286
|
function stripBasePath (basePath) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/basic",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0-alpha.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"split2": "^4.2.0",
|
|
24
24
|
"undici": "^6.19.5",
|
|
25
25
|
"ws": "^8.18.0",
|
|
26
|
-
"@platformatic/config": "2.
|
|
27
|
-
"@platformatic/itc": "2.
|
|
28
|
-
"@platformatic/metrics": "2.
|
|
29
|
-
"@platformatic/utils": "2.
|
|
30
|
-
"@platformatic/telemetry": "2.
|
|
26
|
+
"@platformatic/config": "2.19.0-alpha.2",
|
|
27
|
+
"@platformatic/itc": "2.19.0-alpha.2",
|
|
28
|
+
"@platformatic/metrics": "2.19.0-alpha.2",
|
|
29
|
+
"@platformatic/utils": "2.19.0-alpha.2",
|
|
30
|
+
"@platformatic/telemetry": "2.19.0-alpha.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"borp": "^0.19.0",
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/basic/2.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/basic/2.19.0-alpha.2.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Stackable",
|
|
5
5
|
"type": "object",
|