@platformatic/foundation 3.38.1 → 3.40.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
@@ -250,7 +250,7 @@ export declare const fastifyServer: JSONSchemaType<object>
250
250
  export declare const undiciInterceptor: JSONSchemaType<object>
251
251
  export declare const health: JSONSchemaType<object>
252
252
  export declare const healthWithoutDefaults: JSONSchemaType<object>
253
- export declare const telemetryExporter: JSONSchemaType<object>
253
+ export declare const openTelemetryExporter: JSONSchemaType<object>
254
254
  export declare const telemetry: JSONSchemaType<object>
255
255
  export declare const applications: JSONSchemaType<object[]>
256
256
  export declare const runtimeUnwrappablePropertiesList: string[]
package/lib/cli.js CHANGED
@@ -13,40 +13,64 @@ let prettyPrint = true
13
13
  let executableId = ''
14
14
  let executableName = ''
15
15
 
16
+ // TODO: Deprecated and currently unused. Remove in v4.
16
17
  export function isVerbose () {
17
18
  return verbose
18
19
  }
19
20
 
21
+ // TODO: Deprecated and currently unused. Remove in v4.
20
22
  export function usePrettyPrint () {
21
23
  return prettyPrint
22
24
  }
23
25
 
26
+ // TODO: Deprecated and currently unused. Remove in v4.
24
27
  export function getExecutableId () {
25
28
  return executableId
26
29
  }
27
30
 
31
+ // TODO: Deprecated and currently unused. Remove in v4.
28
32
  export function getExecutableName () {
29
33
  return executableName
30
34
  }
31
35
 
36
+ // TODO: Deprecated and currently unused. Remove in v4.
32
37
  export function setVerbose (value) {
33
38
  verbose = value
34
39
  }
35
40
 
41
+ // TODO: Deprecated and currently unused. Remove in v4.
36
42
  export function setPrettyPrint (value) {
37
43
  prettyPrint = value
38
44
  }
39
45
 
46
+ // TODO: Deprecated and currently unused. Remove in v4.
40
47
  export function setExecutableId (id) {
41
48
  executableId = id
42
49
  }
43
50
 
51
+ // TODO: Deprecated and currently unused. Remove in v4.
44
52
  export function setExecutableName (name) {
45
53
  executableName = name
46
54
  }
47
55
 
56
+ export function createCLIContext (
57
+ executableId = '',
58
+ executableName = '',
59
+ verbose = false,
60
+ prettyPrint = true,
61
+ options = {}
62
+ ) {
63
+ return {
64
+ executableId,
65
+ executableName,
66
+ verbose,
67
+ prettyPrint,
68
+ ...options
69
+ }
70
+ }
71
+
48
72
  export function logo (color = true, name = undefined) {
49
- name ??= getExecutableName()
73
+ name ??= this ? this.executableName : 'Watt'
50
74
 
51
75
  /* c8 ignore next - else */
52
76
  const executableName = color && isColorSupported ? bold(name) : name
@@ -92,7 +116,7 @@ export function createCliLogger (level, noPretty) {
92
116
 
93
117
  /* c8 ignore next 3 - Covered elsewhere */
94
118
  if (noPretty) {
95
- setPrettyPrint(false)
119
+ process.env.PLT_PRETTY_PRINT = 'false'
96
120
  } else {
97
121
  pretty = pinoPretty({
98
122
  colorize: process.env.NO_COLOR !== 'true',
@@ -182,7 +206,8 @@ export async function findRuntimeConfigurationFile (
182
206
  configurationFile,
183
207
  fallback = true,
184
208
  throwOnError = true,
185
- verifyPackages = true
209
+ verifyPackages = true,
210
+ executableName = ''
186
211
  ) {
187
212
  let configFile = await findConfigurationFileRecursive(root, configurationFile, '@platformatic/runtime')
188
213
 
@@ -205,7 +230,7 @@ export async function findRuntimeConfigurationFile (
205
230
  if (throwOnError) {
206
231
  return logFatalError(
207
232
  logger,
208
- `Cannot find a supported ${getExecutableName()} configuration file (like ${bold('watt.json')}, a ${bold('wattpm.json')} or a ${bold(
233
+ `Cannot find a supported ${executableName} configuration file (like ${bold('watt.json')}, a ${bold('wattpm.json')} or a ${bold(
209
234
  'platformatic.json'
210
235
  )}) in ${bold(resolve(root))}.`
211
236
  )
package/lib/schema.js CHANGED
@@ -333,9 +333,22 @@ export const logger = {
333
333
  customLevels: {
334
334
  type: 'object',
335
335
  additionalProperties: true
336
+ },
337
+ openTelemetryExporter: {
338
+ type: 'object',
339
+ properties: {
340
+ protocol: {
341
+ type: 'string',
342
+ enum: ['grpc', 'http']
343
+ },
344
+ url: {
345
+ type: 'string'
346
+ }
347
+ },
348
+ required: ['protocol', 'url'],
349
+ additionalProperties: false
336
350
  }
337
351
  },
338
-
339
352
  default: {},
340
353
  additionalProperties: true
341
354
  }
@@ -612,7 +625,7 @@ export const health = {
612
625
 
613
626
  export const healthWithoutDefaults = removeDefaults(health)
614
627
 
615
- export const telemetryExporter = {
628
+ export const openTelemetryExporter = {
616
629
  type: 'object',
617
630
  properties: {
618
631
  type: {
@@ -686,9 +699,9 @@ export const telemetry = {
686
699
  anyOf: [
687
700
  {
688
701
  type: 'array',
689
- items: telemetryExporter
702
+ items: openTelemetryExporter
690
703
  },
691
- telemetryExporter
704
+ openTelemetryExporter
692
705
  ]
693
706
  }
694
707
  },
@@ -887,7 +900,23 @@ export const application = {
887
900
  }
888
901
  }
889
902
  },
890
- compileCache
903
+ compileCache,
904
+ management: {
905
+ anyOf: [
906
+ { type: 'boolean' },
907
+ {
908
+ type: 'object',
909
+ properties: {
910
+ enabled: { type: 'boolean', default: true },
911
+ operations: {
912
+ type: 'array',
913
+ items: { type: 'string' }
914
+ }
915
+ },
916
+ additionalProperties: false
917
+ }
918
+ ]
919
+ }
891
920
  }
892
921
  }
893
922
 
@@ -1077,7 +1106,8 @@ export const runtimeProperties = {
1077
1106
  items: {
1078
1107
  type: 'string'
1079
1108
  },
1080
- description: 'Whitelist of origins to cache. Supports exact strings and regex patterns (e.g., "/https:\\\\/\\\\/.*\\\\.example\\\\.com/").'
1109
+ description:
1110
+ 'Whitelist of origins to cache. Supports exact strings and regex patterns (e.g., "/https:\\\\/\\\\/.*\\\\.example\\\\.com/").'
1081
1111
  },
1082
1112
  cacheByDefault: {
1083
1113
  type: 'integer',
@@ -1123,7 +1153,8 @@ export const runtimeProperties = {
1123
1153
  },
1124
1154
  socket: {
1125
1155
  type: 'string',
1126
- description: 'Custom path for the control socket. If not specified, uses the default platform-specific location.'
1156
+ description:
1157
+ 'Custom path for the control socket. If not specified, uses the default platform-specific location.'
1127
1158
  }
1128
1159
  },
1129
1160
  additionalProperties: false
@@ -1131,6 +1162,22 @@ export const runtimeProperties = {
1131
1162
  ],
1132
1163
  default: true
1133
1164
  },
1165
+ management: {
1166
+ anyOf: [
1167
+ { type: 'boolean' },
1168
+ {
1169
+ type: 'object',
1170
+ properties: {
1171
+ enabled: { type: 'boolean', default: true },
1172
+ operations: {
1173
+ type: 'array',
1174
+ items: { type: 'string' }
1175
+ }
1176
+ },
1177
+ additionalProperties: false
1178
+ }
1179
+ ]
1180
+ },
1134
1181
  metrics: {
1135
1182
  anyOf: [
1136
1183
  { type: 'boolean' },
@@ -1441,7 +1488,8 @@ export const applicationsUnwrappablePropertiesList = [
1441
1488
  'url',
1442
1489
  'gitBranch',
1443
1490
  'dependencies',
1444
- 'useHttp'
1491
+ 'useHttp',
1492
+ 'management'
1445
1493
  ]
1446
1494
 
1447
1495
  export const wrappedRuntimeProperties = omitProperties(runtimeProperties, runtimeUnwrappablePropertiesList)
@@ -1474,7 +1522,7 @@ export const schemaComponents = {
1474
1522
  undiciInterceptor,
1475
1523
  health,
1476
1524
  healthWithoutDefaults,
1477
- telemetryExporter,
1525
+ openTelemetryExporter,
1478
1526
  telemetry,
1479
1527
  policies,
1480
1528
  compileCache,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/foundation",
3
- "version": "3.38.1",
3
+ "version": "3.40.0",
4
4
  "description": "Platformatic Foundation",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",