@platformatic/foundation 3.39.0 → 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/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
@@ -900,7 +900,23 @@ export const application = {
900
900
  }
901
901
  }
902
902
  },
903
- 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
+ }
904
920
  }
905
921
  }
906
922
 
@@ -1146,6 +1162,22 @@ export const runtimeProperties = {
1146
1162
  ],
1147
1163
  default: true
1148
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
+ },
1149
1181
  metrics: {
1150
1182
  anyOf: [
1151
1183
  { type: 'boolean' },
@@ -1456,7 +1488,8 @@ export const applicationsUnwrappablePropertiesList = [
1456
1488
  'url',
1457
1489
  'gitBranch',
1458
1490
  'dependencies',
1459
- 'useHttp'
1491
+ 'useHttp',
1492
+ 'management'
1460
1493
  ]
1461
1494
 
1462
1495
  export const wrappedRuntimeProperties = omitProperties(runtimeProperties, runtimeUnwrappablePropertiesList)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/foundation",
3
- "version": "3.39.0",
3
+ "version": "3.40.0",
4
4
  "description": "Platformatic Foundation",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",