@platformatic/foundation 3.59.0 → 3.60.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 +1 -0
- package/lib/file-system.js +23 -2
- package/lib/schema.js +86 -58
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -197,6 +197,7 @@ export declare function generateDashedName (): string
|
|
|
197
197
|
export declare function isFileAccessible (filename: string, directory?: string): Promise<boolean>
|
|
198
198
|
export declare function createDirectory (path: string, empty?: boolean): Promise<string | undefined>
|
|
199
199
|
export declare function createTemporaryDirectory (prefix: string): Promise<string>
|
|
200
|
+
export declare function createSharedTemporaryDirectory (...segments: string[]): Promise<string>
|
|
200
201
|
export declare function safeRemove (path: string): Promise<void>
|
|
201
202
|
export declare function searchFilesWithExtensions (
|
|
202
203
|
root: string,
|
package/lib/file-system.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import generateName from 'boring-name-generator'
|
|
2
2
|
import { EventEmitter } from 'node:events'
|
|
3
3
|
import { existsSync } from 'node:fs'
|
|
4
|
-
import { access, glob, mkdir, rm, watch } from 'node:fs/promises'
|
|
5
|
-
import { tmpdir } from 'node:os'
|
|
4
|
+
import { access, chmod, glob, mkdir, rm, watch } from 'node:fs/promises'
|
|
5
|
+
import { platform, tmpdir } from 'node:os'
|
|
6
6
|
import { join, matchesGlob, resolve } from 'node:path'
|
|
7
7
|
import { setTimeout as sleep } from 'node:timers/promises'
|
|
8
8
|
import { PathOptionRequiredError } from './errors.js'
|
|
@@ -42,6 +42,27 @@ export async function createTemporaryDirectory (prefix) {
|
|
|
42
42
|
return createDirectory(directory)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
// Directories under os.tmpdir() shared by every user running Platformatic must be
|
|
46
|
+
// writable by all of them, like os.tmpdir() itself. The mode passed to mkdir is
|
|
47
|
+
// masked with the process umask, so chmod each segment explicitly; chmod failures
|
|
48
|
+
// are ignored as the segment might be owned by another user.
|
|
49
|
+
export async function createSharedTemporaryDirectory (...segments) {
|
|
50
|
+
let directory = tmpdir()
|
|
51
|
+
|
|
52
|
+
for (const segment of segments) {
|
|
53
|
+
directory = join(directory, segment)
|
|
54
|
+
await mkdir(directory, { recursive: true, maxRetries: 10, retryDelay: 1000 })
|
|
55
|
+
|
|
56
|
+
if (platform() !== 'win32') {
|
|
57
|
+
try {
|
|
58
|
+
await chmod(directory, 0o1777)
|
|
59
|
+
} catch {}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return directory
|
|
64
|
+
}
|
|
65
|
+
|
|
45
66
|
export async function safeRemove (path) {
|
|
46
67
|
let i = 0
|
|
47
68
|
while (i++ < 10) {
|
package/lib/schema.js
CHANGED
|
@@ -626,6 +626,35 @@ export const health = {
|
|
|
626
626
|
|
|
627
627
|
export const healthWithoutDefaults = removeDefaults(health)
|
|
628
628
|
|
|
629
|
+
const healthProbeEndpoint = {
|
|
630
|
+
anyOf: [
|
|
631
|
+
{ type: 'boolean' },
|
|
632
|
+
{
|
|
633
|
+
type: 'object',
|
|
634
|
+
properties: {
|
|
635
|
+
endpoint: { type: 'string' },
|
|
636
|
+
success: {
|
|
637
|
+
type: 'object',
|
|
638
|
+
properties: {
|
|
639
|
+
statusCode: { type: 'number' },
|
|
640
|
+
body: { type: 'string' }
|
|
641
|
+
},
|
|
642
|
+
additionalProperties: false
|
|
643
|
+
},
|
|
644
|
+
fail: {
|
|
645
|
+
type: 'object',
|
|
646
|
+
properties: {
|
|
647
|
+
statusCode: { type: 'number' },
|
|
648
|
+
body: { type: 'string' }
|
|
649
|
+
},
|
|
650
|
+
additionalProperties: false
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
additionalProperties: false
|
|
654
|
+
}
|
|
655
|
+
]
|
|
656
|
+
}
|
|
657
|
+
|
|
629
658
|
export const openTelemetryExporter = {
|
|
630
659
|
type: 'object',
|
|
631
660
|
properties: {
|
|
@@ -1070,7 +1099,32 @@ export const runtimeProperties = {
|
|
|
1070
1099
|
},
|
|
1071
1100
|
health,
|
|
1072
1101
|
healthProbes: {
|
|
1073
|
-
anyOf: [
|
|
1102
|
+
anyOf: [
|
|
1103
|
+
{ type: 'boolean' },
|
|
1104
|
+
{ type: 'string' },
|
|
1105
|
+
{
|
|
1106
|
+
type: 'object',
|
|
1107
|
+
properties: {
|
|
1108
|
+
enabled: {
|
|
1109
|
+
anyOf: [
|
|
1110
|
+
{
|
|
1111
|
+
type: 'boolean'
|
|
1112
|
+
},
|
|
1113
|
+
{
|
|
1114
|
+
type: 'string'
|
|
1115
|
+
}
|
|
1116
|
+
]
|
|
1117
|
+
},
|
|
1118
|
+
hostname: { type: 'string' },
|
|
1119
|
+
port: {
|
|
1120
|
+
anyOf: [{ type: 'integer' }, { type: 'string' }]
|
|
1121
|
+
},
|
|
1122
|
+
readiness: healthProbeEndpoint,
|
|
1123
|
+
liveness: healthProbeEndpoint
|
|
1124
|
+
},
|
|
1125
|
+
additionalProperties: false
|
|
1126
|
+
}
|
|
1127
|
+
],
|
|
1074
1128
|
default: true
|
|
1075
1129
|
},
|
|
1076
1130
|
undici: {
|
|
@@ -1261,65 +1315,13 @@ export const runtimeProperties = {
|
|
|
1261
1315
|
default: false,
|
|
1262
1316
|
description: 'Enable outgoing HTTP client request duration metrics'
|
|
1263
1317
|
},
|
|
1264
|
-
readiness:
|
|
1265
|
-
|
|
1266
|
-
{ type: 'boolean' },
|
|
1267
|
-
{
|
|
1268
|
-
type: 'object',
|
|
1269
|
-
properties: {
|
|
1270
|
-
endpoint: { type: 'string' },
|
|
1271
|
-
success: {
|
|
1272
|
-
type: 'object',
|
|
1273
|
-
properties: {
|
|
1274
|
-
statusCode: { type: 'number' },
|
|
1275
|
-
body: { type: 'string' }
|
|
1276
|
-
},
|
|
1277
|
-
additionalProperties: false
|
|
1278
|
-
},
|
|
1279
|
-
fail: {
|
|
1280
|
-
type: 'object',
|
|
1281
|
-
properties: {
|
|
1282
|
-
statusCode: { type: 'number' },
|
|
1283
|
-
body: { type: 'string' }
|
|
1284
|
-
},
|
|
1285
|
-
additionalProperties: false
|
|
1286
|
-
}
|
|
1287
|
-
},
|
|
1288
|
-
additionalProperties: false
|
|
1289
|
-
}
|
|
1290
|
-
]
|
|
1291
|
-
},
|
|
1292
|
-
liveness: {
|
|
1293
|
-
anyOf: [
|
|
1294
|
-
{ type: 'boolean' },
|
|
1295
|
-
{
|
|
1296
|
-
type: 'object',
|
|
1297
|
-
properties: {
|
|
1298
|
-
endpoint: { type: 'string' },
|
|
1299
|
-
success: {
|
|
1300
|
-
type: 'object',
|
|
1301
|
-
properties: {
|
|
1302
|
-
statusCode: { type: 'number' },
|
|
1303
|
-
body: { type: 'string' }
|
|
1304
|
-
},
|
|
1305
|
-
additionalProperties: false
|
|
1306
|
-
},
|
|
1307
|
-
fail: {
|
|
1308
|
-
type: 'object',
|
|
1309
|
-
properties: {
|
|
1310
|
-
statusCode: { type: 'number' },
|
|
1311
|
-
body: { type: 'string' }
|
|
1312
|
-
},
|
|
1313
|
-
additionalProperties: false
|
|
1314
|
-
}
|
|
1315
|
-
},
|
|
1316
|
-
additionalProperties: false
|
|
1317
|
-
}
|
|
1318
|
-
]
|
|
1319
|
-
},
|
|
1318
|
+
readiness: healthProbeEndpoint,
|
|
1319
|
+
liveness: healthProbeEndpoint,
|
|
1320
1320
|
healthChecksTimeouts: {
|
|
1321
1321
|
anyOf: [{ type: 'integer' }, { type: 'string' }],
|
|
1322
|
-
default: 5000
|
|
1322
|
+
default: 5000,
|
|
1323
|
+
deprecated: true,
|
|
1324
|
+
description: 'Deprecated. Health probe timeout configuration is no longer used.'
|
|
1323
1325
|
},
|
|
1324
1326
|
plugins: {
|
|
1325
1327
|
type: 'array',
|
|
@@ -1370,6 +1372,32 @@ export const runtimeProperties = {
|
|
|
1370
1372
|
required: ['endpoint'],
|
|
1371
1373
|
additionalProperties: false
|
|
1372
1374
|
},
|
|
1375
|
+
opentelemetry: {
|
|
1376
|
+
type: 'object',
|
|
1377
|
+
description: 'Configuration for forwarding user OpenTelemetry metrics to an OTLP endpoint',
|
|
1378
|
+
properties: {
|
|
1379
|
+
enabled: {
|
|
1380
|
+
anyOf: [{ type: 'boolean' }, { type: 'string' }],
|
|
1381
|
+
description: 'Enable or disable OpenTelemetry metrics forwarding'
|
|
1382
|
+
},
|
|
1383
|
+
endpoint: {
|
|
1384
|
+
type: 'string',
|
|
1385
|
+
description: 'OTLP metrics endpoint URL (e.g., http://collector:4318/v1/metrics)'
|
|
1386
|
+
},
|
|
1387
|
+
interval: {
|
|
1388
|
+
anyOf: [{ type: 'integer' }, { type: 'string' }],
|
|
1389
|
+
default: 60000,
|
|
1390
|
+
description: 'Interval in milliseconds between metric forwards'
|
|
1391
|
+
},
|
|
1392
|
+
headers: {
|
|
1393
|
+
type: 'object',
|
|
1394
|
+
additionalProperties: { type: 'string' },
|
|
1395
|
+
description: 'Additional HTTP headers for authentication'
|
|
1396
|
+
}
|
|
1397
|
+
},
|
|
1398
|
+
required: ['endpoint'],
|
|
1399
|
+
additionalProperties: false
|
|
1400
|
+
},
|
|
1373
1401
|
httpCustomLabels: {
|
|
1374
1402
|
type: 'array',
|
|
1375
1403
|
description:
|