@platformatic/foundation 3.54.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 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
  }
@@ -1228,6 +1230,11 @@ export const runtimeProperties = {
1228
1230
  description:
1229
1231
  'The label name to use for the application identifier in metrics (e.g., applicationId, serviceId)'
1230
1232
  },
1233
+ httpClientMetrics: {
1234
+ anyOf: [{ type: 'boolean' }, { type: 'string' }],
1235
+ default: false,
1236
+ description: 'Enable outgoing HTTP client request duration metrics'
1237
+ },
1231
1238
  readiness: {
1232
1239
  anyOf: [
1233
1240
  { type: 'boolean' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/foundation",
3
- "version": "3.54.0",
3
+ "version": "3.55.0",
4
4
  "description": "Platformatic Foundation",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",