@platformatic/basic 2.69.0 → 2.70.1

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 CHANGED
@@ -107,7 +107,7 @@ export interface PlatformaticStackable {
107
107
  maxELU?: number | string;
108
108
  maxHeapUsed?: number | string;
109
109
  maxHeapTotal?: number | string;
110
- maxYoungGeneration?: number;
110
+ maxYoungGeneration?: number | string;
111
111
  };
112
112
  undici?: {
113
113
  agentOptions?: {
@@ -297,6 +297,7 @@ export interface PlatformaticStackable {
297
297
  [k: string]: unknown;
298
298
  };
299
299
  serviceTimeout?: number | string;
300
+ messagingTimeout?: number | string;
300
301
  env?: {
301
302
  [k: string]: string;
302
303
  };
package/lib/base.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { client, collectMetrics } from '@platformatic/metrics'
2
- import { buildPinoOptions, deepmerge, executeWithTimeout } from '@platformatic/utils'
2
+ import { buildPinoOptions, deepmerge, executeWithTimeout, kTimeout } from '@platformatic/utils'
3
3
  import { parseCommandString } from 'execa'
4
4
  import { spawn } from 'node:child_process'
5
5
  import EventEmitter, { once } from 'node:events'
@@ -46,8 +46,6 @@ export class BaseStackable extends EventEmitter {
46
46
  this.#metricsCollected = false
47
47
  this.customHealthCheck = null
48
48
  this.customReadinessCheck = null
49
- this.startHttpTimer = null
50
- this.endHttpTimer = null
51
49
  this.clientWs = null
52
50
  this.runtimeConfig = deepmerge(options.context?.runtimeConfig ?? {}, workerData?.config ?? {})
53
51
  this.stdout = standardStreams?.stdout ?? process.stdout
@@ -319,12 +317,12 @@ export class BaseStackable extends EventEmitter {
319
317
  /* c8 ignore next 10 */
320
318
  const res = await executeWithTimeout(exitPromise, exitTimeout)
321
319
 
322
- if (res === 'timeout') {
320
+ if (res === kTimeout) {
323
321
  this.subprocess.kill(this.subprocessTerminationSignal)
324
322
 
325
323
  // If the process hasn't exited in X seconds, kill it the hard way
326
324
  const res = await executeWithTimeout(exitPromise, exitTimeout)
327
- if (res === 'timeout') {
325
+ if (res === kTimeout) {
328
326
  this.subprocess.kill('SIGKILL')
329
327
  }
330
328
  }
@@ -418,15 +416,12 @@ export class BaseStackable extends EventEmitter {
418
416
  return
419
417
  }
420
418
 
421
- const { startHttpTimer, endHttpTimer } = await collectMetrics(
419
+ await collectMetrics(
422
420
  this.serviceId,
423
421
  this.workerId,
424
422
  metricsConfig,
425
423
  this.metricsRegistry
426
424
  )
427
-
428
- this.startHttpTimer = startHttpTimer
429
- this.endHttpTimer = endHttpTimer
430
425
  }
431
426
  }
432
427
 
@@ -1,4 +1,4 @@
1
- import { generateRequest } from '@platformatic/itc'
1
+ import { generateRequest, sanitize } from '@platformatic/itc'
2
2
  import { ensureLoggableError } from '@platformatic/utils'
3
3
  import { once } from 'node:events'
4
4
  import { platform } from 'node:os'
@@ -42,7 +42,7 @@ export default async function () {
42
42
  return build(
43
43
  async function (source) {
44
44
  for await (const obj of source) {
45
- socket.send(JSON.stringify(generateRequest('log', { logs: [obj] })))
45
+ socket.send(JSON.stringify(sanitize(generateRequest('log', { logs: [obj] }))))
46
46
  }
47
47
  },
48
48
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/basic",
3
- "version": "2.69.0",
3
+ "version": "2.70.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -24,11 +24,11 @@
24
24
  "split2": "^4.2.0",
25
25
  "undici": "^7.0.0",
26
26
  "ws": "^8.18.0",
27
- "@platformatic/config": "2.69.0",
28
- "@platformatic/itc": "2.69.0",
29
- "@platformatic/metrics": "2.69.0",
30
- "@platformatic/telemetry": "2.69.0",
31
- "@platformatic/utils": "2.69.0"
27
+ "@platformatic/config": "2.70.1",
28
+ "@platformatic/itc": "2.70.1",
29
+ "@platformatic/metrics": "2.70.1",
30
+ "@platformatic/telemetry": "2.70.1",
31
+ "@platformatic/utils": "2.70.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "borp": "^0.20.0",
@@ -37,13 +37,9 @@
37
37
  "fastify": "^5.0.0",
38
38
  "get-port": "^7.1.0",
39
39
  "json-schema-to-typescript": "^15.0.0",
40
- "minimatch": "^10.0.1",
40
+ "minimatch": "^10.0.3",
41
41
  "neostandard": "^0.12.0",
42
- "next": "^15.0.0",
43
- "react": "^18.3.1",
44
- "react-dom": "^18.3.1",
45
- "typescript": "^5.5.4",
46
- "vite": "^5.4.0"
42
+ "typescript": "^5.5.4"
47
43
  },
48
44
  "scripts": {
49
45
  "test": "npm run lint && borp --concurrency=1 --no-timeout",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/basic/2.69.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/basic/2.70.1.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Stackable",
5
5
  "type": "object",
@@ -367,7 +367,6 @@
367
367
  "default": {},
368
368
  "properties": {
369
369
  "enabled": {
370
- "default": true,
371
370
  "anyOf": [
372
371
  {
373
372
  "type": "boolean"
@@ -375,10 +374,10 @@
375
374
  {
376
375
  "type": "string"
377
376
  }
378
- ]
377
+ ],
378
+ "default": true
379
379
  },
380
380
  "interval": {
381
- "default": 30000,
382
381
  "anyOf": [
383
382
  {
384
383
  "type": "number",
@@ -387,10 +386,10 @@
387
386
  {
388
387
  "type": "string"
389
388
  }
390
- ]
389
+ ],
390
+ "default": 30000
391
391
  },
392
392
  "gracePeriod": {
393
- "default": 30000,
394
393
  "anyOf": [
395
394
  {
396
395
  "type": "number",
@@ -399,10 +398,10 @@
399
398
  {
400
399
  "type": "string"
401
400
  }
402
- ]
401
+ ],
402
+ "default": 30000
403
403
  },
404
404
  "maxUnhealthyChecks": {
405
- "default": 10,
406
405
  "anyOf": [
407
406
  {
408
407
  "type": "number",
@@ -411,10 +410,10 @@
411
410
  {
412
411
  "type": "string"
413
412
  }
414
- ]
413
+ ],
414
+ "default": 10
415
415
  },
416
416
  "maxELU": {
417
- "default": 0.99,
418
417
  "anyOf": [
419
418
  {
420
419
  "type": "number",
@@ -424,10 +423,10 @@
424
423
  {
425
424
  "type": "string"
426
425
  }
427
- ]
426
+ ],
427
+ "default": 0.99
428
428
  },
429
429
  "maxHeapUsed": {
430
- "default": 0.99,
431
430
  "anyOf": [
432
431
  {
433
432
  "type": "number",
@@ -437,10 +436,10 @@
437
436
  {
438
437
  "type": "string"
439
438
  }
440
- ]
439
+ ],
440
+ "default": 0.99
441
441
  },
442
442
  "maxHeapTotal": {
443
- "default": 4294967296,
444
443
  "anyOf": [
445
444
  {
446
445
  "type": "number",
@@ -449,11 +448,19 @@
449
448
  {
450
449
  "type": "string"
451
450
  }
452
- ]
451
+ ],
452
+ "default": 4294967296
453
453
  },
454
454
  "maxYoungGeneration": {
455
- "type": "number",
456
- "minimum": 0
455
+ "anyOf": [
456
+ {
457
+ "type": "number",
458
+ "minimum": 0
459
+ },
460
+ {
461
+ "type": "string"
462
+ }
463
+ ]
457
464
  }
458
465
  },
459
466
  "additionalProperties": false
@@ -928,6 +935,18 @@
928
935
  ],
929
936
  "default": 300000
930
937
  },
938
+ "messagingTimeout": {
939
+ "anyOf": [
940
+ {
941
+ "type": "number",
942
+ "minimum": 1
943
+ },
944
+ {
945
+ "type": "string"
946
+ }
947
+ ],
948
+ "default": 30000
949
+ },
931
950
  "env": {
932
951
  "type": "object",
933
952
  "additionalProperties": {