@platformatic/basic 2.19.0-alpha.6 → 2.19.0-alpha.8
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 +12 -5
- package/lib/worker/child-manager.js +4 -3
- package/lib/worker/child-process.js +3 -2
- package/package.json +8 -8
- package/schema.json +1 -1
package/lib/base.js
CHANGED
|
@@ -13,9 +13,11 @@ import { NonZeroExitCode } from './errors.js'
|
|
|
13
13
|
import { cleanBasePath } from './utils.js'
|
|
14
14
|
import { ChildManager } from './worker/child-manager.js'
|
|
15
15
|
|
|
16
|
+
const kITC = Symbol.for('plt.runtime.itc')
|
|
17
|
+
|
|
16
18
|
export class BaseStackable {
|
|
17
19
|
childManager
|
|
18
|
-
subprocess
|
|
20
|
+
#subprocess
|
|
19
21
|
#subprocessStarted
|
|
20
22
|
|
|
21
23
|
constructor (type, version, options, root, configManager) {
|
|
@@ -68,7 +70,8 @@ export class BaseStackable {
|
|
|
68
70
|
setGraphqlSchema: this.setGraphqlSchema.bind(this),
|
|
69
71
|
setConnectionString: this.setConnectionString.bind(this),
|
|
70
72
|
setBasePath: this.setBasePath.bind(this),
|
|
71
|
-
runtimeBasePath: this.runtimeConfig?.basePath ?? null
|
|
73
|
+
runtimeBasePath: this.runtimeConfig?.basePath ?? null,
|
|
74
|
+
invalidateHttpCache: this.#invalidateHttpCache.bind(this)
|
|
72
75
|
})
|
|
73
76
|
}
|
|
74
77
|
|
|
@@ -204,7 +207,7 @@ export class BaseStackable {
|
|
|
204
207
|
}
|
|
205
208
|
}
|
|
206
209
|
|
|
207
|
-
async startWithCommand (command, loader) {
|
|
210
|
+
async startWithCommand (command, loader, scripts) {
|
|
208
211
|
const config = this.configManager.current
|
|
209
212
|
const basePath = config.application?.basePath ? cleanBasePath(config.application?.basePath) : ''
|
|
210
213
|
|
|
@@ -212,7 +215,8 @@ export class BaseStackable {
|
|
|
212
215
|
this.childManager = new ChildManager({
|
|
213
216
|
logger: this.logger,
|
|
214
217
|
loader,
|
|
215
|
-
context
|
|
218
|
+
context,
|
|
219
|
+
scripts
|
|
216
220
|
})
|
|
217
221
|
|
|
218
222
|
this.childManager.on('config', config => {
|
|
@@ -359,6 +363,10 @@ export class BaseStackable {
|
|
|
359
363
|
return format === 'json' ? await this.metricsRegistry.getMetricsAsJSON() : await this.metricsRegistry.metrics()
|
|
360
364
|
}
|
|
361
365
|
|
|
366
|
+
async #invalidateHttpCache (opts = {}) {
|
|
367
|
+
await globalThis[kITC].send('invalidateHttpCache', opts)
|
|
368
|
+
}
|
|
369
|
+
|
|
362
370
|
getMeta () {
|
|
363
371
|
return {
|
|
364
372
|
composer: {
|
|
@@ -372,7 +380,6 @@ export class BaseStackable {
|
|
|
372
380
|
|
|
373
381
|
return {
|
|
374
382
|
id: this.id,
|
|
375
|
-
config: this.configManager.current,
|
|
376
383
|
serviceId: this.serviceId,
|
|
377
384
|
workerId: this.workerId,
|
|
378
385
|
// Always use URL to avoid serialization problem in Windows
|
|
@@ -3,15 +3,16 @@ 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 { createRequire, register } from 'node:module'
|
|
7
|
-
import { platform, tmpdir } from 'node:os'
|
|
8
|
-
import { dirname, join, resolve } from 'node:path'
|
|
9
6
|
import { pathToFileURL } from 'node:url'
|
|
7
|
+
import { register } from 'node:module'
|
|
8
|
+
import { platform, tmpdir } from 'node:os'
|
|
9
|
+
import { dirname, resolve, join } from 'node:path'
|
|
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'
|
|
15
16
|
|
|
16
17
|
export const isWindows = platform() === 'win32'
|
|
17
18
|
|
|
@@ -11,7 +11,7 @@ import { basename, resolve } from 'node:path'
|
|
|
11
11
|
import { fileURLToPath } from 'node:url'
|
|
12
12
|
import { isMainThread } from 'node:worker_threads'
|
|
13
13
|
import pino from 'pino'
|
|
14
|
-
import {
|
|
14
|
+
import { Agent, setGlobalDispatcher } from 'undici'
|
|
15
15
|
import { WebSocket } from 'ws'
|
|
16
16
|
import { exitCodes } from '../errors.js'
|
|
17
17
|
import { importFile } from '../utils.js'
|
|
@@ -269,7 +269,8 @@ export class ChildProcess extends ITC {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
#setupInterceptors () {
|
|
272
|
-
|
|
272
|
+
const globalDispatcher = new Agent().compose(createInterceptor(this))
|
|
273
|
+
setGlobalDispatcher(globalDispatcher)
|
|
273
274
|
}
|
|
274
275
|
|
|
275
276
|
#setupHandlers () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/basic",
|
|
3
|
-
"version": "2.19.0-alpha.
|
|
3
|
+
"version": "2.19.0-alpha.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"pino-abstract-transport": "^2.0.0",
|
|
22
22
|
"semver": "^7.6.3",
|
|
23
23
|
"split2": "^4.2.0",
|
|
24
|
-
"undici": "^
|
|
24
|
+
"undici": "^7.0.0",
|
|
25
25
|
"ws": "^8.18.0",
|
|
26
|
-
"@platformatic/config": "2.19.0-alpha.
|
|
27
|
-
"@platformatic/
|
|
28
|
-
"@platformatic/
|
|
29
|
-
"@platformatic/
|
|
30
|
-
"@platformatic/
|
|
26
|
+
"@platformatic/config": "2.19.0-alpha.8",
|
|
27
|
+
"@platformatic/utils": "2.19.0-alpha.8",
|
|
28
|
+
"@platformatic/telemetry": "2.19.0-alpha.8",
|
|
29
|
+
"@platformatic/itc": "2.19.0-alpha.8",
|
|
30
|
+
"@platformatic/metrics": "2.19.0-alpha.8"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"borp": "^0.19.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"fastify": "^5.0.0",
|
|
37
37
|
"json-schema-to-typescript": "^15.0.0",
|
|
38
38
|
"neostandard": "^0.11.1",
|
|
39
|
-
"next": "^
|
|
39
|
+
"next": "^15.0.0",
|
|
40
40
|
"react": "^18.3.1",
|
|
41
41
|
"react-dom": "^18.3.1",
|
|
42
42
|
"typescript": "^5.5.4",
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/basic/2.19.0-alpha.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/basic/2.19.0-alpha.8.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Stackable",
|
|
5
5
|
"type": "object",
|