@platformatic/foundation 3.58.1 → 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 +98 -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: {
|
|
@@ -784,6 +813,17 @@ export const application = {
|
|
|
784
813
|
id: {
|
|
785
814
|
type: 'string'
|
|
786
815
|
},
|
|
816
|
+
enabled: {
|
|
817
|
+
anyOf: [
|
|
818
|
+
{ type: 'boolean' },
|
|
819
|
+
{ type: 'string' },
|
|
820
|
+
{
|
|
821
|
+
type: 'object',
|
|
822
|
+
additionalProperties: { type: 'boolean' }
|
|
823
|
+
}
|
|
824
|
+
],
|
|
825
|
+
default: true
|
|
826
|
+
},
|
|
787
827
|
path: {
|
|
788
828
|
type: 'string',
|
|
789
829
|
// This is required for the resolve command to allow empty paths after environment variable replacement
|
|
@@ -1059,7 +1099,32 @@ export const runtimeProperties = {
|
|
|
1059
1099
|
},
|
|
1060
1100
|
health,
|
|
1061
1101
|
healthProbes: {
|
|
1062
|
-
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
|
+
],
|
|
1063
1128
|
default: true
|
|
1064
1129
|
},
|
|
1065
1130
|
undici: {
|
|
@@ -1250,65 +1315,13 @@ export const runtimeProperties = {
|
|
|
1250
1315
|
default: false,
|
|
1251
1316
|
description: 'Enable outgoing HTTP client request duration metrics'
|
|
1252
1317
|
},
|
|
1253
|
-
readiness:
|
|
1254
|
-
|
|
1255
|
-
{ type: 'boolean' },
|
|
1256
|
-
{
|
|
1257
|
-
type: 'object',
|
|
1258
|
-
properties: {
|
|
1259
|
-
endpoint: { type: 'string' },
|
|
1260
|
-
success: {
|
|
1261
|
-
type: 'object',
|
|
1262
|
-
properties: {
|
|
1263
|
-
statusCode: { type: 'number' },
|
|
1264
|
-
body: { type: 'string' }
|
|
1265
|
-
},
|
|
1266
|
-
additionalProperties: false
|
|
1267
|
-
},
|
|
1268
|
-
fail: {
|
|
1269
|
-
type: 'object',
|
|
1270
|
-
properties: {
|
|
1271
|
-
statusCode: { type: 'number' },
|
|
1272
|
-
body: { type: 'string' }
|
|
1273
|
-
},
|
|
1274
|
-
additionalProperties: false
|
|
1275
|
-
}
|
|
1276
|
-
},
|
|
1277
|
-
additionalProperties: false
|
|
1278
|
-
}
|
|
1279
|
-
]
|
|
1280
|
-
},
|
|
1281
|
-
liveness: {
|
|
1282
|
-
anyOf: [
|
|
1283
|
-
{ type: 'boolean' },
|
|
1284
|
-
{
|
|
1285
|
-
type: 'object',
|
|
1286
|
-
properties: {
|
|
1287
|
-
endpoint: { type: 'string' },
|
|
1288
|
-
success: {
|
|
1289
|
-
type: 'object',
|
|
1290
|
-
properties: {
|
|
1291
|
-
statusCode: { type: 'number' },
|
|
1292
|
-
body: { type: 'string' }
|
|
1293
|
-
},
|
|
1294
|
-
additionalProperties: false
|
|
1295
|
-
},
|
|
1296
|
-
fail: {
|
|
1297
|
-
type: 'object',
|
|
1298
|
-
properties: {
|
|
1299
|
-
statusCode: { type: 'number' },
|
|
1300
|
-
body: { type: 'string' }
|
|
1301
|
-
},
|
|
1302
|
-
additionalProperties: false
|
|
1303
|
-
}
|
|
1304
|
-
},
|
|
1305
|
-
additionalProperties: false
|
|
1306
|
-
}
|
|
1307
|
-
]
|
|
1308
|
-
},
|
|
1318
|
+
readiness: healthProbeEndpoint,
|
|
1319
|
+
liveness: healthProbeEndpoint,
|
|
1309
1320
|
healthChecksTimeouts: {
|
|
1310
1321
|
anyOf: [{ type: 'integer' }, { type: 'string' }],
|
|
1311
|
-
default: 5000
|
|
1322
|
+
default: 5000,
|
|
1323
|
+
deprecated: true,
|
|
1324
|
+
description: 'Deprecated. Health probe timeout configuration is no longer used.'
|
|
1312
1325
|
},
|
|
1313
1326
|
plugins: {
|
|
1314
1327
|
type: 'array',
|
|
@@ -1359,6 +1372,32 @@ export const runtimeProperties = {
|
|
|
1359
1372
|
required: ['endpoint'],
|
|
1360
1373
|
additionalProperties: false
|
|
1361
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
|
+
},
|
|
1362
1401
|
httpCustomLabels: {
|
|
1363
1402
|
type: 'array',
|
|
1364
1403
|
description:
|
|
@@ -1518,6 +1557,7 @@ export const runtimeUnwrappablePropertiesList = [
|
|
|
1518
1557
|
|
|
1519
1558
|
export const applicationsUnwrappablePropertiesList = [
|
|
1520
1559
|
'id',
|
|
1560
|
+
'enabled',
|
|
1521
1561
|
'path',
|
|
1522
1562
|
'config',
|
|
1523
1563
|
'url',
|