@platformatic/foundation 3.53.0 → 3.55.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/index.d.ts +4 -0
- package/lib/node.js +38 -0
- package/lib/schema.js +16 -2
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -273,12 +273,16 @@ export declare function loadModule (require: NodeRequire, path: string): Promise
|
|
|
273
273
|
|
|
274
274
|
// Node types
|
|
275
275
|
export declare function checkNodeVersionForApplications (): void
|
|
276
|
+
export declare function mirrorGlobalDispatcherForBuiltinFetch (dispatcher: unknown): void
|
|
276
277
|
export declare const features: {
|
|
277
278
|
node: {
|
|
278
279
|
reusePort: boolean
|
|
279
280
|
worker: {
|
|
280
281
|
getHeapStatistics: boolean
|
|
281
282
|
}
|
|
283
|
+
permission: {
|
|
284
|
+
network: boolean
|
|
285
|
+
}
|
|
282
286
|
}
|
|
283
287
|
}
|
|
284
288
|
|
package/lib/node.js
CHANGED
|
@@ -14,11 +14,49 @@ export function checkNodeVersionForApplications () {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/*
|
|
18
|
+
Node.js >= 26 bundles undici >= 8, whose built-in `fetch()` reads the global
|
|
19
|
+
dispatcher from `Symbol.for('undici.globalDispatcher.2')`. Our bundled undici
|
|
20
|
+
(v7) `setGlobalDispatcher()` only writes `Symbol.for('undici.globalDispatcher.1')`,
|
|
21
|
+
so the application's global `fetch()` bypasses the runtime mesh interceptor and
|
|
22
|
+
internal `*.plt.local` calls fail with ENOTFOUND.
|
|
23
|
+
|
|
24
|
+
Mirror the dispatcher onto every known global dispatcher symbol so the built-in
|
|
25
|
+
`fetch()` and the userland undici observe the same dispatcher, regardless of
|
|
26
|
+
which undici version Node bundles. This can be dropped once undici aligns the
|
|
27
|
+
symbols across versions: https://github.com/nodejs/undici/pull/5319
|
|
28
|
+
*/
|
|
29
|
+
export function mirrorGlobalDispatcherForBuiltinFetch (dispatcher) {
|
|
30
|
+
for (const version of [1, 2]) {
|
|
31
|
+
const symbol = Symbol.for(`undici.globalDispatcher.${version}`)
|
|
32
|
+
const descriptor = Object.getOwnPropertyDescriptor(globalThis, symbol)
|
|
33
|
+
|
|
34
|
+
if (!descriptor) {
|
|
35
|
+
Object.defineProperty(globalThis, symbol, {
|
|
36
|
+
value: dispatcher,
|
|
37
|
+
writable: true,
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: false
|
|
40
|
+
})
|
|
41
|
+
} else if (descriptor.writable) {
|
|
42
|
+
// The symbol is created as non-configurable but writable, so a plain
|
|
43
|
+
// assignment is the only legal way to update an already-defined slot.
|
|
44
|
+
globalThis[symbol] = dispatcher
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
17
49
|
export const features = {
|
|
18
50
|
node: {
|
|
19
51
|
reusePort: satisfies(process.version, '^22.12.0 || ^23.1.0 || >=24.0.0') && !['win32', 'darwin'].includes(currentPlatform),
|
|
20
52
|
worker: {
|
|
21
53
|
getHeapStatistics: satisfies(process.version, '^22.16.0 || >=24.0.0')
|
|
54
|
+
},
|
|
55
|
+
permission: {
|
|
56
|
+
// The Permission Model gates network access (dns.lookup, listen, connect,
|
|
57
|
+
// fetch) behind --allow-net starting from Node.js 25. On older versions the
|
|
58
|
+
// flag does not exist and must not be passed.
|
|
59
|
+
network: process.allowedNodeEnvironmentFlags.has('--allow-net')
|
|
22
60
|
}
|
|
23
61
|
}
|
|
24
62
|
}
|
package/lib/schema.js
CHANGED
|
@@ -617,7 +617,9 @@ export const health = {
|
|
|
617
617
|
maxHeapUsed: overridableValue({ type: 'number', minimum: 0, maximum: 1 }, 0.99),
|
|
618
618
|
maxHeapTotal: overridableValue({ type: 'number', minimum: 0 }, 4 * Math.pow(1024, 3)), // 4GB
|
|
619
619
|
maxYoungGeneration: overridableValue({ type: 'number', minimum: 0 }, 128 * Math.pow(1024, 2)), // 128MB,
|
|
620
|
-
codeRangeSize: overridableValue({ type: 'number', minimum: 0 }, 268435456)
|
|
620
|
+
codeRangeSize: overridableValue({ type: 'number', minimum: 0 }, 268435456),
|
|
621
|
+
bufferPoolSize: overridableValue({ type: 'number', minimum: 0 }, 256 * 1024), // 256KB
|
|
622
|
+
defaultHighWaterMark: overridableValue({ type: 'number', minimum: 0 }, 256 * 1024) // 256KB
|
|
621
623
|
},
|
|
622
624
|
additionalProperties: false
|
|
623
625
|
}
|
|
@@ -704,7 +706,14 @@ export const telemetry = {
|
|
|
704
706
|
]
|
|
705
707
|
},
|
|
706
708
|
diagLogger: {
|
|
707
|
-
|
|
709
|
+
anyOf: [
|
|
710
|
+
{
|
|
711
|
+
type: 'boolean'
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
type: 'string'
|
|
715
|
+
}
|
|
716
|
+
],
|
|
708
717
|
description: 'Enable the OpenTelemetry diagnostic logger. Diagnostic messages are forwarded to the Platformatic global logger using the current logger level.'
|
|
709
718
|
}
|
|
710
719
|
},
|
|
@@ -1221,6 +1230,11 @@ export const runtimeProperties = {
|
|
|
1221
1230
|
description:
|
|
1222
1231
|
'The label name to use for the application identifier in metrics (e.g., applicationId, serviceId)'
|
|
1223
1232
|
},
|
|
1233
|
+
httpClientMetrics: {
|
|
1234
|
+
anyOf: [{ type: 'boolean' }, { type: 'string' }],
|
|
1235
|
+
default: false,
|
|
1236
|
+
description: 'Enable outgoing HTTP client request duration metrics'
|
|
1237
|
+
},
|
|
1224
1238
|
readiness: {
|
|
1225
1239
|
anyOf: [
|
|
1226
1240
|
{ type: 'boolean' },
|