@flowscripter/dynamic-cli-framework 12.0.1 → 12.2.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.
Files changed (80) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/src/cli/BaseCLI.d.ts.map +1 -1
  5. package/dist/src/cli/BaseCLI.js +3 -1
  6. package/dist/src/cli/BaseCLIFeatureOptions.d.ts +6 -0
  7. package/dist/src/cli/BaseCLIFeatureOptions.d.ts.map +1 -1
  8. package/dist/src/runtime/runner.d.ts.map +1 -1
  9. package/dist/src/runtime/runner.js +4 -1
  10. package/dist/src/service/configuration/ConfigurationServiceProvider.d.ts +33 -15
  11. package/dist/src/service/configuration/ConfigurationServiceProvider.d.ts.map +1 -1
  12. package/dist/src/service/configuration/ConfigurationServiceProvider.js +80 -173
  13. package/dist/src/service/configuration/DefaultConfigurationService.d.ts +78 -0
  14. package/dist/src/service/configuration/DefaultConfigurationService.d.ts.map +1 -0
  15. package/dist/src/service/configuration/DefaultConfigurationService.js +296 -0
  16. package/dist/src/service/configuration/DefaultKeyValueService.d.ts.map +1 -1
  17. package/dist/src/service/configuration/DefaultKeyValueService.js +7 -3
  18. package/dist/src/service/configuration/DefaultSecretService.d.ts +17 -2
  19. package/dist/src/service/configuration/DefaultSecretService.d.ts.map +1 -1
  20. package/dist/src/service/configuration/DefaultSecretService.js +44 -5
  21. package/dist/src/service/configuration/KeyValueServiceProvider.d.ts +3 -1
  22. package/dist/src/service/configuration/KeyValueServiceProvider.d.ts.map +1 -1
  23. package/dist/src/service/configuration/KeyValueServiceProvider.js +6 -3
  24. package/dist/src/service/configuration/command/ConfigDumpSubCommand.d.ts +3 -7
  25. package/dist/src/service/configuration/command/ConfigDumpSubCommand.d.ts.map +1 -1
  26. package/dist/src/service/configuration/command/ConfigDumpSubCommand.js +5 -10
  27. package/dist/src/service/configuration/command/ConfigGetSubCommand.d.ts +16 -0
  28. package/dist/src/service/configuration/command/ConfigGetSubCommand.d.ts.map +1 -0
  29. package/dist/src/service/configuration/command/ConfigGetSubCommand.js +137 -0
  30. package/dist/src/service/configuration/command/ConfigSetSubCommand.d.ts +18 -0
  31. package/dist/src/service/configuration/command/ConfigSetSubCommand.d.ts.map +1 -0
  32. package/dist/src/service/configuration/command/ConfigSetSubCommand.js +289 -0
  33. package/dist/src/service/configuration/command/ConfigUnsetSubCommand.d.ts +15 -0
  34. package/dist/src/service/configuration/command/ConfigUnsetSubCommand.d.ts.map +1 -0
  35. package/dist/src/service/configuration/command/ConfigUnsetSubCommand.js +101 -0
  36. package/dist/src/service/configuration/configTargets.d.ts +91 -0
  37. package/dist/src/service/configuration/configTargets.d.ts.map +1 -0
  38. package/dist/src/service/configuration/configTargets.js +348 -0
  39. package/dist/src/service/configuration/format/ConfigFormat.d.ts +42 -0
  40. package/dist/src/service/configuration/format/ConfigFormat.d.ts.map +1 -0
  41. package/dist/src/service/configuration/format/ConfigFormat.js +0 -0
  42. package/dist/src/service/configuration/format/JsonConfigFormat.d.ts +7 -0
  43. package/dist/src/service/configuration/format/JsonConfigFormat.d.ts.map +1 -0
  44. package/dist/src/service/configuration/format/JsonConfigFormat.js +17 -0
  45. package/dist/src/service/configuration/format/TomlConfigFormat.d.ts +10 -0
  46. package/dist/src/service/configuration/format/TomlConfigFormat.d.ts.map +1 -0
  47. package/dist/src/service/configuration/format/TomlConfigFormat.js +78 -0
  48. package/dist/src/service/configuration/format/YamlConfigFormat.d.ts +9 -0
  49. package/dist/src/service/configuration/format/YamlConfigFormat.d.ts.map +1 -0
  50. package/dist/src/service/configuration/format/YamlConfigFormat.js +63 -0
  51. package/dist/src/service/configuration/resolveSecrets.d.ts.map +1 -1
  52. package/dist/src/service/configuration/resolveSecrets.js +7 -1
  53. package/dist/toml.d.ts +2 -0
  54. package/dist/toml.d.ts.map +1 -0
  55. package/dist/toml.js +1 -0
  56. package/dist/yaml.d.ts +2 -0
  57. package/dist/yaml.d.ts.map +1 -0
  58. package/dist/yaml.js +1 -0
  59. package/index.ts +3 -0
  60. package/package.json +27 -3
  61. package/src/cli/BaseCLI.ts +4 -0
  62. package/src/cli/BaseCLIFeatureOptions.ts +6 -0
  63. package/src/runtime/runner.ts +4 -1
  64. package/src/service/configuration/ConfigurationServiceProvider.ts +108 -214
  65. package/src/service/configuration/DefaultConfigurationService.ts +378 -0
  66. package/src/service/configuration/DefaultKeyValueService.ts +9 -3
  67. package/src/service/configuration/DefaultSecretService.ts +51 -8
  68. package/src/service/configuration/KeyValueServiceProvider.ts +7 -2
  69. package/src/service/configuration/command/ConfigDumpSubCommand.ts +6 -10
  70. package/src/service/configuration/command/ConfigGetSubCommand.ts +198 -0
  71. package/src/service/configuration/command/ConfigSetSubCommand.ts +401 -0
  72. package/src/service/configuration/command/ConfigUnsetSubCommand.ts +126 -0
  73. package/src/service/configuration/configTargets.ts +481 -0
  74. package/src/service/configuration/format/ConfigFormat.ts +42 -0
  75. package/src/service/configuration/format/JsonConfigFormat.ts +22 -0
  76. package/src/service/configuration/format/TomlConfigFormat.ts +92 -0
  77. package/src/service/configuration/format/YamlConfigFormat.ts +72 -0
  78. package/src/service/configuration/resolveSecrets.ts +7 -1
  79. package/toml.ts +1 -0
  80. package/yaml.ts +1 -0
package/dist/index.d.ts CHANGED
@@ -36,6 +36,9 @@ export { default as DefaultSecretService } from "./src/service/configuration/Def
36
36
  export type { SecretsApi } from "./src/service/configuration/DefaultSecretService.ts";
37
37
  export { default as ConfigCommand } from "./src/service/configuration/command/ConfigCommand.ts";
38
38
  export { default as ConfigurationServiceProvider, type KeyValueServiceScopeType, } from "./src/service/configuration/ConfigurationServiceProvider.ts";
39
+ export type { default as ConfigFormat } from "./src/service/configuration/format/ConfigFormat.ts";
40
+ export type { ConfigData } from "./src/service/configuration/format/ConfigFormat.ts";
41
+ export { default as jsonFormat } from "./src/service/configuration/format/JsonConfigFormat.ts";
39
42
  export { default as KeyValueServiceProvider } from "./src/service/configuration/KeyValueServiceProvider.ts";
40
43
  export { PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
41
44
  export type { PrinterService } from "@flowscripter/dynamic-cli-framework-api";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACxE,YAAY,EACV,eAAe,EACf,MAAM,EACN,SAAS,EACT,wBAAwB,EACxB,eAAe,EACf,kBAAkB,GACnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC9F,YAAY,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,yCAAyC,CAAC;AAC/F,YAAY,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,YAAY,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,YAAY,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACtE,YAAY,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAG1E,YAAY,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,YAAY,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAC7E,YAAY,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,YAAY,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC5E,YAAY,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,YAAY,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAG5E,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAG5F,YAAY,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC/E,Y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C;AAC7E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAGjG,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,8BAA8B,EAC9B,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,kCAAkC,EAClC,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,mCAAmC,EACnC,8BAA8B,EAC9B,uBAAuB,EACvB,kCAAkC,EAClC,2BAA2B,EAC3B,8BAA8B,EAC9B,sCAAsC,GACvC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAG9E,YAAY,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,OAAO,IAAI,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ export { default as DefaultKeyValueService } from "./src/service/configuration/D
14
14
  export { default as DefaultSecretService } from "./src/service/configuration/DefaultSecretService.js";
15
15
  export { default as ConfigCommand } from "./src/service/configuration/command/ConfigCommand.js";
16
16
  export { default as ConfigurationServiceProvider, } from "./src/service/configuration/ConfigurationServiceProvider.js";
17
+ export { default as jsonFormat } from "./src/service/configuration/format/JsonConfigFormat.js";
17
18
  export { default as KeyValueServiceProvider } from "./src/service/configuration/KeyValueServiceProvider.js";
18
19
  export { PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
19
20
  export { Icon, Level, ProgressStyle, SpinnerStyle } from "@flowscripter/dynamic-cli-framework-api";
@@ -1 +1 @@
1
- {"version":3,"file":"BaseCLI.d.ts","sourceRoot":"","sources":["../../../src/cli/BaseCLI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,yCAAyC,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAGvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAsBzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAU3E,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAGpD,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAC;AAqCpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,YAAW,GAAG;;IAazC,YACE,SAAS,EAAE,SAAS,EACpB,oBAAoB,EAAE,cAAc,EACpC,oBAAoB,EAAE,cAAc,EACpC,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,OAAO,EACtB,cAAc,EAAE,QAAQ,EACxB,cAAc,EAAE,QAAQ,EACxB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,OAAO,CAAC,EAAE,qBAAqB,EAuEhC;IAED;;;;;;;OAOG;IACI,kBAAkB,CAAC,eAAe,EAAE,eAAe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G,SAAS,EAChC,OAAO,CAAC,EAAE,qBAAqB,EAwEhC;IAED;;;;;;;OAOG;IACI,kBAAkB,CAAC,eAAe,EAAE,eAAe,QAEzD;IAED;;;;;;;;OAQG;IACH;;;;;OAKG;IACI,cAAc,CAAC,IAAI,EAAE,WAAW,QAEtC;IAEM,UAAU,CAAC,OAAO,EAAE,OAAO,QAQjC;IAEK,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CA6QzD;CACF"}
@@ -12,6 +12,7 @@ import CommandValidator from "../runtime/command/CommandValidator.js";
12
12
  import ShutdownServiceProvider from "../service/shutdown/ShutdownServiceProvider.js";
13
13
  import StartupServiceProvider from "../service/startup/StartupServiceProvider.js";
14
14
  import { shutdownState } from "../service/shutdown/ShutdownState.js";
15
+ import jsonFormat from "../service/configuration/format/JsonConfigFormat.js";
15
16
  import ConfigurationServiceProvider from "../service/configuration/ConfigurationServiceProvider.js";
16
17
  import KeyValueServiceProvider from "../service/configuration/KeyValueServiceProvider.js";
17
18
  import PrinterServiceProvider from "../service/printer/PrinterServiceProvider.js";
@@ -100,6 +101,7 @@ export default class BaseCLI {
100
101
  }
101
102
  this.#cliConfig = cliConfig;
102
103
  this.#options = {
104
+ configFormat: jsonFormat,
103
105
  configFileSupportEnabled: false,
104
106
  envVarsSupportEnabled: false,
105
107
  keyValueServiceEnabled: false,
@@ -245,7 +247,7 @@ export default class BaseCLI {
245
247
  if (this.#options.pluginServiceEnabled) {
246
248
  this.addServiceProvider(new PluginServiceProvider(PLUGIN_SERVICE_PRIORITY, this.#options.pluginServiceRemoteConfig, this.#options.pluginServiceLocalConfig, this.#commandRegistry, this.#serviceProviderRegistry));
247
249
  }
248
- const configurationServiceProvider = new ConfigurationServiceProvider(CONFIGURATION_SERVICE_PRIORITY, this.#options.envVarsSupportEnabled, this.#options.configFileSupportEnabled, this.#options.secretServiceEnabled);
250
+ const configurationServiceProvider = new ConfigurationServiceProvider(CONFIGURATION_SERVICE_PRIORITY, this.#options.envVarsSupportEnabled, this.#options.configFileSupportEnabled, this.#options.secretServiceEnabled, this.#options.configFormat, this.#commandRegistry);
249
251
  this.addServiceProvider(configurationServiceProvider);
250
252
  const keyValueServiceProvider = new KeyValueServiceProvider(KEY_VALUE_SERVICE_PRIORITY, configurationServiceProvider, this.#options.keyValueServiceEnabled, this.#options.secretServiceEnabled);
251
253
  this.addServiceProvider(keyValueServiceProvider);
@@ -1,7 +1,13 @@
1
+ import type ConfigFormat from "../service/configuration/format/ConfigFormat.ts";
1
2
  import type { UpgradeLocationsConfig } from "../service/upgrade/UpgradeLocationsConfig.ts";
2
3
  import type { NpmjsPluginRepositoryConfig, NpmPluginRepositoryConfig } from "@flowscripter/dynamic-plugin-framework";
3
4
  export default interface BaseCLIFeatureOptions {
4
5
  readonly configFileSupportEnabled?: boolean;
6
+ /**
7
+ * The syntax of the configuration file. Defaults to JSON. YAML and TOML are available from the
8
+ * `@flowscripter/dynamic-cli-framework/yaml` and `@flowscripter/dynamic-cli-framework/toml` entry points.
9
+ */
10
+ readonly configFormat?: ConfigFormat;
5
11
  readonly envVarsSupportEnabled?: boolean;
6
12
  readonly keyValueServiceEnabled?: boolean;
7
13
  readonly secretServiceEnabled?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"BaseCLIFeatureOptions.d.ts","sourceRoot":"","sources":["../../../src/cli/BaseCLIFeatureOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,wCAAwC,CAAC;AAEhD,MAAM,CAAC,OAAO,WAAW,qBAAqB;IAC5C,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IACzC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;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C,aAAa,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAyfzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AACH,wBAAsB,GAAG,CACvB,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,eAAe,EAAE,eAAe,EAChC,uBAAuB,EAAE,uBAAuB,EAChD,4BAA4B,EAAE,4BAA4B,GAAG,SAAS,EACtE,uBAAuB,EAAE,uBAAuB,GAAG,SAAS,EAC5D,OAAO,EAAE,OAAO,EAChB,cAAc,CAAC,EAAE,OAAO,EACxB,cAAc,CAAC,EAAE,qBAAqB,GACrC,OAAO,CAAC,YAAY,CAAC,CAkKvB"}
@@ -62,8 +62,11 @@ async function executeParsedCommand(parseResult, context, keyValueServiceProvide
62
62
  await parseResult.groupCommand.execute(groupContext);
63
63
  }
64
64
  logger.debug("Executing command with name: %s and args: %O", parseResult.command.name, parseResult.populatedArgumentValues);
65
+ const commandScopeKey = parseResult.groupCommand
66
+ ? `${parseResult.groupCommand.name}:${parseResult.command.name}`
67
+ : parseResult.command.name;
65
68
  const commandContext = keyValueServiceProvider
66
- ? keyValueServiceProvider.getContextForScope(context, "command", parseResult.command.name)
69
+ ? keyValueServiceProvider.getContextForScope(context, "command", commandScopeKey)
67
70
  : context;
68
71
  if (isSubCommand(parseResult.command)) {
69
72
  await parseResult.command.execute(commandContext, parseResult.populatedArgumentValues);
@@ -2,20 +2,22 @@ import type { ServiceInfo, ServiceProvider } from "@flowscripter/dynamic-cli-fra
2
2
  import type { SingleValueType, Values, ValueNode, PopulatedValues, PopulatedValueType } from "@flowscripter/dynamic-cli-framework-api";
3
3
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
4
4
  import type { GroupCommand } from "@flowscripter/dynamic-cli-framework-api";
5
+ import type { CommandRegistry } from "@flowscripter/dynamic-cli-framework-api";
6
+ import DefaultConfigurationService, { type KeyValueServiceScopeType } from "./DefaultConfigurationService.ts";
7
+ import { type SecretsApi } from "./DefaultSecretService.ts";
8
+ import type ConfigFormat from "./format/ConfigFormat.ts";
5
9
  import type { Command } from "@flowscripter/dynamic-cli-framework-api";
6
10
  import type { CLIConfig } from "@flowscripter/dynamic-cli-framework-api";
7
- export type KeyValueServiceScopeType = "command" | "service";
11
+ export type { KeyValueServiceScopeType };
8
12
  /**
9
13
  * Provides configuration of default command arguments using a configuration file and/or
10
14
  * environment variables.
11
15
  *
12
16
  * The same configuration file also backs the raw, per-scope key-value data consumed by
13
17
  * {@link KeyValueServiceProvider} (which holds a direct reference to this provider - see
14
- * {@link getKeyValueData} and {@link flushIfDirty} - rather than looking this provider up via
15
- * {@link Context}, since only {@link configLocation}/{@link setConfigLocation} are safe to expose
16
- * generally; {@link getConfigString} is wired directly to {@link ConfigDumpSubCommand} for the same
17
- * reason - a full config dump would leak every other command's/service's key-value data if it
18
- * were reachable through a general lookup).
18
+ * {@link getKeyValueData} and {@link flushIfDirty}). The configuration data and its persistence are
19
+ * owned by {@link DefaultConfigurationService}, which is passed directly to the `config` group commands. Only a
20
+ * view exposing the config file location is registered under {@link CONFIGURATION_SERVICE_ID}.
19
21
  *
20
22
  * **Default Command Arguments**
21
23
  *
@@ -26,7 +28,7 @@ export type KeyValueServiceScopeType = "command" | "service";
26
28
  *
27
29
  * *Configuration File*
28
30
  *
29
- * A JSON file where the structure matches {@link Values} and the defaults are stored
31
+ * A file (JSON by default, see {@link ConfigFormat}) where the structure matches {@link Values} and the defaults are stored
30
32
  * under a top level `defaults` property. The second level of properties is used to refer to {@link Command.name}
31
33
  * (or `<group name>:<member name>` for a member of a {@link GroupCommand}) and the contained values are treated as
32
34
  * command {@link Values}. As an example:
@@ -57,14 +59,19 @@ export type KeyValueServiceScopeType = "command" | "service";
57
59
  * }
58
60
  * ```
59
61
  *
60
- * The default location of the configuration file is `$HOME/.<application_name>.json`. If `$HOME` is not defined no
62
+ * The syntax of the file is set by the `configFormat` constructor argument: JSON (the default), or YAML or TOML
63
+ * from the `yaml` and `toml` entry points of this package. The format is never inferred from the file name or
64
+ * extension and existing files are not migrated between formats. For YAML and TOML, comments and layout in the
65
+ * existing file are preserved when it is written back.
66
+ *
67
+ * The default location of the configuration file is `$HOME/.<application_name>.<format extension>`. If `$HOME` is not defined no
61
68
  * default configuration will be used. The location of the configuration file can be modified via the
62
69
  * {@link ConfigCommand}.
63
70
  *
64
- * NOTE: You may store default arguments for secrets by manually configuring secrets in your OS
65
- * credential store and referencing them in the config file using the sentinel format
66
- * `__SECRET__:<bun_secret_name>`. These values will be resolved from the OS secret store
67
- * before being returned as default argument values. See {@link KeyValueServiceProvider} for the
71
+ * NOTE: Secrets in default arguments are referenced in the config file or an environment variable using
72
+ * the sentinel format `__SECRET__:<bun_secret_name>` and resolved from the OS secret store before being
73
+ * returned as default argument values. A command's defaults may only reference secrets stored for that
74
+ * command via `config set` (named `defaults_Z<command>_Z<option path>`, each part escaped). See {@link KeyValueServiceProvider} for the
68
75
  * generic key-value store which uses the same secret sentinel mechanism.
69
76
  *
70
77
  * *Environment Variables*
@@ -113,8 +120,7 @@ export default class ConfigurationServiceProvider implements ServiceProvider {
113
120
  readonly envVarsEnabled: boolean;
114
121
  readonly configEnabled: boolean;
115
122
  readonly secretServiceEnabled: boolean;
116
- configLocation: string | undefined;
117
- defaultsData: Map<string, Values | SingleValueType>;
123
+ readonly configFormat: ConfigFormat;
118
124
  /**
119
125
  * Create an instance of the service provider with the specified details.
120
126
  *
@@ -123,9 +129,21 @@ export default class ConfigurationServiceProvider implements ServiceProvider {
123
129
  * @param configEnabled optionally enable configuration file support for default argument values.
124
130
  * @param secretServiceEnabled optionally enable OS-native secret storage via Bun.secrets for resolving
125
131
  * secrets embedded in default argument values: `configEnabled` must be true in this case
132
+ * @param configFormat optionally set the syntax of the configuration file, defaults to JSON.
133
+ * @param commandRegistry optionally provide the registry of all commands, required for the `config:get`,
134
+ * `config:set` and `config:unset` commands to be provided.
135
+ * @param secretsApi optionally override the OS secret store used for storing SECRET default values.
126
136
  */
127
- constructor(servicePriority: number, envVarsEnabled?: boolean, configEnabled?: boolean, secretServiceEnabled?: boolean);
137
+ constructor(servicePriority: number, envVarsEnabled?: boolean, configEnabled?: boolean, secretServiceEnabled?: boolean, configFormat?: ConfigFormat, commandRegistry?: CommandRegistry, secretsApi?: SecretsApi);
128
138
  getServiceInfo(cliConfig: CLIConfig): Promise<ServiceInfo>;
139
+ /**
140
+ * The {@link DefaultConfigurationService} which owns the configuration data, for trusted wiring and tests.
141
+ */
142
+ get configurationService(): DefaultConfigurationService;
143
+ get configLocation(): string | undefined;
144
+ set configLocation(location: string | undefined);
145
+ get defaultsData(): Map<string, Values | SingleValueType>;
146
+ set defaultsData(data: Map<string, Values | SingleValueType>);
129
147
  setConfigLocation(configLocation: string): void;
130
148
  /**
131
149
  * Retrieve the default command argument values (if any) for the provided {@link Command}.
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigurationServiceProvider.d.ts","sourceRoot":"","sources":["../../../../src/service/configuration/ConfigurationServiceProvider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE5F,OAAO,KAAK,EACV,eAAe,EACf,MAAM,EACN,SAAS,EACT,eAAe,EACf,kBAAkB,EACnB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAU5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAOvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQzE,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,SAAS,CAAC;AAkB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BAAoB,UAAQ,EAC5B,YAAY,GAAE,YAAyB,EACvC,eAAe,CAAC,EAAE,eAAe,EACjC,UAAU,CAAC,EAAE,UAAU,EAkBxB;IAEM,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAyBhE;IAED;;OAEG;IACH,IAAW,oBAAoB,IAAI,2BAA2B,CAE7D;IAED,IAAW,cAAc,IAAI,MAAM,GAAG,SAAS,CAE9C;IAED,IAAW,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAErD;IAED,IAAW,YAAY,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC,CAE/D;IAED,IAAW,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC,EAElE;IAEM,iBAAiB,CAAC,cAAc,EAAE,MAAM,QAE9C;IAED;;;;;;;;;OASG;IACU,wBAAwB,CACnC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAC,CA2C3D;IAED;;;;;;OAMG;IACI,eAAe,CACpB,SAAS,EAAE,wBAAwB,EACnC,QAAQ,EAAE,MAAM,GACf,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAExB;IAED;;;;;;OAMG;IACI,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnD;IAEY,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAKxD;IAEM,eAAe,IAAI,MAAM,CAE/B;CACF"}
@@ -1,28 +1,34 @@
1
- import process from "node:process";
2
- import path from "node:path";
3
- import fs from "node:fs/promises";
4
- import { Stats } from "node:fs";
5
1
  import ConfigCommand from "./command/ConfigCommand.js";
6
2
  import getLogger from "../../util/logger.js";
7
3
  import ConfigDumpSubCommand from "./command/ConfigDumpSubCommand.js";
8
4
  import ConfigGroupCommand from "./command/ConfigGroupCommand.js";
9
- import { CONFIGURATION_SERVICE_ID, SECRET_SENTINEL_PREFIX, } from "@flowscripter/dynamic-cli-framework-api";
10
- import DefaultSecretService from "./DefaultSecretService.js";
11
- import resolveSecrets from "./resolveSecrets.js";
5
+ import ConfigGetSubCommand from "./command/ConfigGetSubCommand.js";
6
+ import ConfigSetSubCommand from "./command/ConfigSetSubCommand.js";
7
+ import ConfigUnsetSubCommand from "./command/ConfigUnsetSubCommand.js";
8
+ import { CONFIGURATION_SERVICE_ID, } from "@flowscripter/dynamic-cli-framework-api";
9
+ import DefaultConfigurationService, {} from "./DefaultConfigurationService.js";
10
+ import DefaultSecretService, {} from "./DefaultSecretService.js";
11
+ import jsonFormat from "./format/JsonConfigFormat.js";
12
12
  import argumentValueMerge from "../../runtime/values/argumentValueMerge.js";
13
13
  import { isGlobalCommand, isGlobalModifierCommand, isSubCommand, } from "../../runtime/command/CommandTypeGuards.js";
14
14
  import { getGlobalCommandValueFromEnvVars, getSubCommandValuesFromEnvVars, } from "../../util/envVarHelper.js";
15
15
  const logger = getLogger("ConfigurationServiceProvider");
16
- class ConfigurationServiceImpl {
17
- #provider;
18
- constructor(provider) {
19
- this.#provider = provider;
16
+ /**
17
+ * The only view of the configuration which is registered in the {@link Context}, and therefore reachable by
18
+ * every command and service. It deliberately exposes nothing but the config file location: the
19
+ * {@link DefaultConfigurationService} (default values, per-scope key-value data, secret resolution and
20
+ * persistence) is only handed to the `config` group commands and {@link KeyValueServiceProvider}.
21
+ */
22
+ class ConfigurationLocationService {
23
+ #service;
24
+ constructor(service) {
25
+ this.#service = service;
20
26
  }
21
27
  get configLocation() {
22
- return this.#provider.configLocation;
28
+ return this.#service.configLocation;
23
29
  }
24
30
  setConfigLocation(location) {
25
- this.#provider.setConfigLocation(location);
31
+ this.#service.setConfigLocation(location);
26
32
  }
27
33
  }
28
34
  /**
@@ -31,11 +37,9 @@ class ConfigurationServiceImpl {
31
37
  *
32
38
  * The same configuration file also backs the raw, per-scope key-value data consumed by
33
39
  * {@link KeyValueServiceProvider} (which holds a direct reference to this provider - see
34
- * {@link getKeyValueData} and {@link flushIfDirty} - rather than looking this provider up via
35
- * {@link Context}, since only {@link configLocation}/{@link setConfigLocation} are safe to expose
36
- * generally; {@link getConfigString} is wired directly to {@link ConfigDumpSubCommand} for the same
37
- * reason - a full config dump would leak every other command's/service's key-value data if it
38
- * were reachable through a general lookup).
40
+ * {@link getKeyValueData} and {@link flushIfDirty}). The configuration data and its persistence are
41
+ * owned by {@link DefaultConfigurationService}, which is passed directly to the `config` group commands. Only a
42
+ * view exposing the config file location is registered under {@link CONFIGURATION_SERVICE_ID}.
39
43
  *
40
44
  * **Default Command Arguments**
41
45
  *
@@ -46,7 +50,7 @@ class ConfigurationServiceImpl {
46
50
  *
47
51
  * *Configuration File*
48
52
  *
49
- * A JSON file where the structure matches {@link Values} and the defaults are stored
53
+ * A file (JSON by default, see {@link ConfigFormat}) where the structure matches {@link Values} and the defaults are stored
50
54
  * under a top level `defaults` property. The second level of properties is used to refer to {@link Command.name}
51
55
  * (or `<group name>:<member name>` for a member of a {@link GroupCommand}) and the contained values are treated as
52
56
  * command {@link Values}. As an example:
@@ -77,14 +81,19 @@ class ConfigurationServiceImpl {
77
81
  * }
78
82
  * ```
79
83
  *
80
- * The default location of the configuration file is `$HOME/.<application_name>.json`. If `$HOME` is not defined no
84
+ * The syntax of the file is set by the `configFormat` constructor argument: JSON (the default), or YAML or TOML
85
+ * from the `yaml` and `toml` entry points of this package. The format is never inferred from the file name or
86
+ * extension and existing files are not migrated between formats. For YAML and TOML, comments and layout in the
87
+ * existing file are preserved when it is written back.
88
+ *
89
+ * The default location of the configuration file is `$HOME/.<application_name>.<format extension>`. If `$HOME` is not defined no
81
90
  * default configuration will be used. The location of the configuration file can be modified via the
82
91
  * {@link ConfigCommand}.
83
92
  *
84
- * NOTE: You may store default arguments for secrets by manually configuring secrets in your OS
85
- * credential store and referencing them in the config file using the sentinel format
86
- * `__SECRET__:<bun_secret_name>`. These values will be resolved from the OS secret store
87
- * before being returned as default argument values. See {@link KeyValueServiceProvider} for the
93
+ * NOTE: Secrets in default arguments are referenced in the config file or an environment variable using
94
+ * the sentinel format `__SECRET__:<bun_secret_name>` and resolved from the OS secret store before being
95
+ * returned as default argument values. A command's defaults may only reference secrets stored for that
96
+ * command via `config set` (named `defaults_Z<command>_Z<option path>`, each part escaped). See {@link KeyValueServiceProvider} for the
88
97
  * generic key-value store which uses the same secret sentinel mechanism.
89
98
  *
90
99
  * *Environment Variables*
@@ -132,28 +141,14 @@ export default class ConfigurationServiceProvider {
132
141
  envVarsEnabled;
133
142
  configEnabled;
134
143
  secretServiceEnabled;
135
- // the location of the currently managed configuration data
136
- configLocation;
137
- // the configuration data to be used by the CLI runner implementation when setting command defaults.
138
- // SingleValueType is for GlobalCommandArgument values, Values is for
139
- // SubCommandArgument values.
140
- defaultsData = new Map();
141
- // the underlying per-scope key-value data, read from/written to the configuration file. Exposed
142
- // (raw, not wrapped in a KeyValueService) only via getKeyValueData(), for KeyValueServiceProvider's
143
- // exclusive use.
144
- #commandKeyValueData = new Map();
145
- #serviceKeyValueData = new Map();
146
- // secret service used only to resolve secret sentinels embedded in default command argument
147
- // values (getDefaultArgumentValues()) - unrelated to per-command/per-service KV scoping, so it
148
- // uses its own fixed, dedicated scope prefix ("defaults"). Its scope is otherwise irrelevant,
149
- // since only getSecret() (which doesn't consult scope) is ever called on it.
150
- #defaultsSecretService;
144
+ configFormat;
151
145
  /**
152
- * A {@link ConfigurationService} view of this provider, registered in the {@link Context} under
153
- * {@link CONFIGURATION_SERVICE_ID}. Its `configLocation` getter always reflects this provider's
154
- * current value.
146
+ * The {@link DefaultConfigurationService} which owns the configuration data. It is never registered
147
+ * in the {@link Context}: it is handed directly to the `config` group commands only.
155
148
  */
156
149
  #configurationService;
150
+ #hasCommandRegistry;
151
+ #secretsApi;
157
152
  /**
158
153
  * Create an instance of the service provider with the specified details.
159
154
  *
@@ -162,8 +157,12 @@ export default class ConfigurationServiceProvider {
162
157
  * @param configEnabled optionally enable configuration file support for default argument values.
163
158
  * @param secretServiceEnabled optionally enable OS-native secret storage via Bun.secrets for resolving
164
159
  * secrets embedded in default argument values: `configEnabled` must be true in this case
160
+ * @param configFormat optionally set the syntax of the configuration file, defaults to JSON.
161
+ * @param commandRegistry optionally provide the registry of all commands, required for the `config:get`,
162
+ * `config:set` and `config:unset` commands to be provided.
163
+ * @param secretsApi optionally override the OS secret store used for storing SECRET default values.
165
164
  */
166
- constructor(servicePriority, envVarsEnabled = false, configEnabled = false, secretServiceEnabled = false) {
165
+ constructor(servicePriority, envVarsEnabled = false, configEnabled = false, secretServiceEnabled = false, configFormat = jsonFormat, commandRegistry, secretsApi) {
167
166
  if (!configEnabled && secretServiceEnabled) {
168
167
  throw new Error("configEnabled must be true if secretServiceEnabled is true");
169
168
  }
@@ -171,25 +170,50 @@ export default class ConfigurationServiceProvider {
171
170
  this.envVarsEnabled = envVarsEnabled;
172
171
  this.configEnabled = configEnabled;
173
172
  this.secretServiceEnabled = secretServiceEnabled;
174
- this.#configurationService = new ConfigurationServiceImpl(this);
173
+ this.configFormat = configFormat;
174
+ this.#hasCommandRegistry = commandRegistry !== undefined;
175
+ this.#secretsApi = secretsApi;
176
+ this.#configurationService = new DefaultConfigurationService(envVarsEnabled, configFormat, commandRegistry);
175
177
  }
176
178
  getServiceInfo(cliConfig) {
177
179
  const commands = [];
178
180
  if (this.configEnabled) {
179
181
  commands.push(new ConfigCommand(this.servicePriority));
180
- commands.push(new ConfigGroupCommand([new ConfigDumpSubCommand(() => this.getConfigString())]));
182
+ const members = [new ConfigDumpSubCommand(this.#configurationService)];
183
+ if (this.#hasCommandRegistry) {
184
+ members.push(new ConfigGetSubCommand(this.#configurationService), new ConfigSetSubCommand(this.#configurationService), new ConfigUnsetSubCommand(this.#configurationService));
185
+ }
186
+ commands.push(new ConfigGroupCommand(members));
181
187
  }
182
188
  if (this.secretServiceEnabled) {
183
- this.#defaultsSecretService = new DefaultSecretService(cliConfig.name, "defaults");
189
+ this.#configurationService.setDefaultsSecretService(new DefaultSecretService(cliConfig.name, ["defaults"], this.#secretsApi));
184
190
  }
185
191
  return Promise.resolve({
186
- service: this.#configurationService,
192
+ service: new ConfigurationLocationService(this.#configurationService),
187
193
  // this may be empty if configEnabled is false
188
194
  commands,
189
195
  });
190
196
  }
197
+ /**
198
+ * The {@link DefaultConfigurationService} which owns the configuration data, for trusted wiring and tests.
199
+ */
200
+ get configurationService() {
201
+ return this.#configurationService;
202
+ }
203
+ get configLocation() {
204
+ return this.#configurationService.configLocation;
205
+ }
206
+ set configLocation(location) {
207
+ this.#configurationService.configLocation = location;
208
+ }
209
+ get defaultsData() {
210
+ return this.#configurationService.defaultsData;
211
+ }
212
+ set defaultsData(data) {
213
+ this.#configurationService.defaultsData = data;
214
+ }
191
215
  setConfigLocation(configLocation) {
192
- this.configLocation = configLocation;
216
+ this.#configurationService.setConfigLocation(configLocation);
193
217
  }
194
218
  /**
195
219
  * Retrieve the default command argument values (if any) for the provided {@link Command}.
@@ -236,14 +260,8 @@ export default class ConfigurationServiceProvider {
236
260
  result = argumentValueMerge(envVarValues, configuredValues);
237
261
  }
238
262
  }
239
- if (result !== undefined && this.#defaultsSecretService) {
240
- result = await resolveSecrets(result, async (bunSecretName) => {
241
- const secretValue = await this.#defaultsSecretService.getSecret(bunSecretName);
242
- if (secretValue === null) {
243
- throw new Error(`Secret not found in OS secret store for sentinel: '${SECRET_SENTINEL_PREFIX}${bunSecretName}'`);
244
- }
245
- return secretValue;
246
- });
263
+ if (result !== undefined) {
264
+ result = await this.#configurationService.resolveDefaultSecrets(result, commandKey);
247
265
  }
248
266
  return result;
249
267
  }
@@ -255,11 +273,7 @@ export default class ConfigurationServiceProvider {
255
273
  * @param scopeKey the command name or service/task ID to scope the key-value data to.
256
274
  */
257
275
  getKeyValueData(scopeType, scopeKey) {
258
- const keyValueData = scopeType === "command" ? this.#commandKeyValueData : this.#serviceKeyValueData;
259
- if (!keyValueData.has(scopeKey)) {
260
- keyValueData.set(scopeKey, new Map());
261
- }
262
- return keyValueData.get(scopeKey);
276
+ return this.#configurationService.getKeyValueData(scopeType, scopeKey);
263
277
  }
264
278
  /**
265
279
  * Write the configuration file, if `isDirty` is true - for {@link KeyValueServiceProvider}'s
@@ -268,123 +282,16 @@ export default class ConfigurationServiceProvider {
268
282
  *
269
283
  * @param isDirty whether any scoped KeyValueService has unwritten changes.
270
284
  */
271
- async flushIfDirty(isDirty) {
272
- if (!isDirty) {
273
- return;
274
- }
275
- if (this.configLocation === undefined) {
276
- throw new Error("Attempt to write updated config with no configLocation set");
277
- }
278
- await this.#writeConfig(this.configLocation);
285
+ flushIfDirty(isDirty) {
286
+ return this.#configurationService.flushIfDirty(isDirty);
279
287
  }
280
288
  async initService(context) {
281
289
  if (!this.configEnabled) {
282
290
  return;
283
291
  }
284
- let isDefault = false;
285
- if (this.configLocation === undefined) {
286
- isDefault = true;
287
- // default to `$HOME/.<application_name>.json`
288
- const home = process.env["HOME"];
289
- if (home) {
290
- this.configLocation = path.join(home, `.${context.cliConfig.name.replace(/\W/g, "")}.json`);
291
- }
292
- }
293
- if (this.configLocation === undefined) {
294
- return;
295
- }
296
- let fileInfo;
297
- try {
298
- fileInfo = await fs.lstat(this.configLocation);
299
- }
300
- catch (err) {
301
- const error = err;
302
- if (isDefault) {
303
- logger.debug("Default config file location: %s does not exist or is not visible - ignoring: %s", this.configLocation, error.message);
304
- return;
305
- }
306
- else {
307
- throw new Error(`Config file location: '${this.configLocation}' doesn't exist or not visible: ${error.message}`);
308
- }
309
- }
310
- if (fileInfo.isDirectory()) {
311
- throw new Error(`Config file location: '${this.configLocation}' is a directory and not a file!`);
312
- }
313
- await this.#readConfig(this.configLocation);
314
- }
315
- async #readConfig(location) {
316
- try {
317
- logger.debug("Reading config from: %s", location);
318
- const data = await fs.readFile(location);
319
- const config = JSON.parse(data.toString());
320
- if (config === undefined) {
321
- return;
322
- }
323
- this.defaultsData.clear();
324
- this.#commandKeyValueData.clear();
325
- this.#serviceKeyValueData.clear();
326
- if (config.defaults !== undefined) {
327
- const defaults = config.defaults;
328
- Object.keys(defaults).forEach((commandName) => {
329
- this.defaultsData.set(commandName, defaults[commandName]);
330
- logger.debug("Set default argument values for command name: %s", commandName);
331
- });
332
- }
333
- if (config["key-values"] !== undefined) {
334
- const keyValues = config["key-values"];
335
- if (keyValues.commands !== undefined) {
336
- const commandKeyValues = keyValues.commands;
337
- Object.keys(commandKeyValues).forEach((commandName) => {
338
- this.#commandKeyValueData.set(commandName, new Map(Object.entries(commandKeyValues[commandName])));
339
- logger.debug("Set default argument values for command name: %s", commandName);
340
- });
341
- }
342
- if (keyValues.services !== undefined) {
343
- const serviceKeyValues = keyValues.services;
344
- Object.keys(serviceKeyValues).forEach((serviceId) => {
345
- this.#serviceKeyValueData.set(serviceId, new Map(Object.entries(serviceKeyValues[serviceId])));
346
- logger.debug("Set default argument values for service ID: %s", serviceId);
347
- });
348
- }
349
- }
350
- }
351
- catch (err) {
352
- throw new Error(`Failed to read config at location: '${this.configLocation}': ${err}`);
353
- }
354
- }
355
- async #writeConfig(location) {
356
- logger.debug("Writing config to: %s", location);
357
- try {
358
- await fs.writeFile(location, this.getConfigString());
359
- }
360
- catch (err) {
361
- throw new Error(`Failed to write config at location: '${this.configLocation}': ${err}`);
362
- }
292
+ await this.#configurationService.init(context.cliConfig.name);
363
293
  }
364
294
  getConfigString() {
365
- const config = {};
366
- if (this.defaultsData.size > 0) {
367
- config.defaults = Object.fromEntries(this.defaultsData);
368
- }
369
- if (this.#commandKeyValueData.size > 0 || this.#serviceKeyValueData.size > 0) {
370
- config["key-values"] = {};
371
- if (this.#commandKeyValueData.size > 0) {
372
- config["key-values"].commands = {};
373
- for (const [commandName, keyValueData] of this.#commandKeyValueData.entries()) {
374
- if (keyValueData.size > 0) {
375
- config["key-values"].commands[commandName] = Object.fromEntries(keyValueData);
376
- }
377
- }
378
- }
379
- if (this.#serviceKeyValueData.size > 0) {
380
- config["key-values"].services = {};
381
- for (const [serviceId, keyValueData] of this.#serviceKeyValueData.entries()) {
382
- if (keyValueData.size > 0) {
383
- config["key-values"].services[serviceId] = Object.fromEntries(keyValueData);
384
- }
385
- }
386
- }
387
- }
388
- return JSON.stringify(config, null, 2);
295
+ return this.#configurationService.getConfigString();
389
296
  }
390
297
  }