@flowscripter/dynamic-cli-framework 1.2.1 → 1.3.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 (166) hide show
  1. package/README/core-service-providers.md +2 -2
  2. package/README/development.md +3 -6
  3. package/README/implementation-details.md +17 -17
  4. package/README/key-concepts.md +17 -17
  5. package/README.md +4 -4
  6. package/bun.lock +0 -2
  7. package/index.ts +22 -30
  8. package/package.json +19 -19
  9. package/src/api/argument/Argument.ts +1 -1
  10. package/src/api/argument/ArgumentValueTypes.ts +3 -10
  11. package/src/api/argument/ComplexOption.ts +5 -9
  12. package/src/api/command/GlobalCommand.ts +1 -4
  13. package/src/api/service/core/ArgumentPrompterService.ts +1 -3
  14. package/src/api/service/core/AsciiBannerGeneratorService.ts +1 -4
  15. package/src/api/service/core/CompletionService.ts +2 -6
  16. package/src/api/service/core/ImagePrinterService.ts +1 -2
  17. package/src/api/service/core/KeyValueService.ts +1 -2
  18. package/src/api/service/core/PrettyPrinterService.ts +1 -4
  19. package/src/api/service/core/PrinterService.ts +8 -9
  20. package/src/api/service/core/PrompterService.ts +4 -11
  21. package/src/api/service/core/ShutdownService.ts +1 -2
  22. package/src/api/service/core/SyntaxHighlighterService.ts +1 -5
  23. package/src/api/service/core/Table.ts +7 -25
  24. package/src/api/service/core/TreePrinterService.ts +1 -2
  25. package/src/cli/BaseCLI.ts +17 -47
  26. package/src/cli/DefaultRuntimeCLI.ts +1 -4
  27. package/src/command/CompletionCommand.ts +19 -45
  28. package/src/command/MultiCommandCliHelpCommand.ts +45 -92
  29. package/src/command/SingleCommandCliHelpCommand.ts +17 -28
  30. package/src/command/UsageCommand.ts +6 -12
  31. package/src/command/VersionCommand.ts +2 -6
  32. package/src/launcher.ts +4 -2
  33. package/src/runtime/DefaultContext.ts +2 -5
  34. package/src/runtime/argument/ArgumentTypeGuards.ts +1 -3
  35. package/src/runtime/command/CommandTypeGuards.ts +5 -14
  36. package/src/runtime/command/CommandValidator.ts +56 -118
  37. package/src/runtime/parser.ts +13 -17
  38. package/src/runtime/registry/CommandRegistry.ts +2 -7
  39. package/src/runtime/registry/DefaultCommandRegistry.ts +32 -84
  40. package/src/runtime/registry/DefaultServiceProviderRegistry.ts +3 -9
  41. package/src/runtime/runner.ts +103 -142
  42. package/src/runtime/scanner.ts +28 -46
  43. package/src/runtime/values/ValuePopulationResult.ts +1 -2
  44. package/src/runtime/values/argumentValueMerge.ts +16 -28
  45. package/src/runtime/values/argumentValueValidation.ts +21 -67
  46. package/src/runtime/values/globalCommandValuePopulation.ts +9 -18
  47. package/src/runtime/values/subCommandValuePopulation.ts +42 -65
  48. package/src/service/argumentPrompter/ArgumentPrompterServiceProvider.ts +3 -10
  49. package/src/service/argumentPrompter/DefaultArgumentPrompterService.ts +22 -59
  50. package/src/service/asciiBannerGenerator/AsciiBannerGeneratorServiceProvider.ts +5 -14
  51. package/src/service/asciiBannerGenerator/DefaultAsciiBannerGeneratorService.ts +59 -77
  52. package/src/service/banner/BannerServiceProvider.ts +13 -35
  53. package/src/service/banner/command/NoBannerCommand.ts +2 -8
  54. package/src/service/chiselAsciiBannerGenerator/ChiselFontAsciiBannerGeneratorService.ts +5 -10
  55. package/src/service/completion/CompletionServiceProvider.ts +20 -48
  56. package/src/service/completion/DefaultCompletionService.ts +17 -56
  57. package/src/service/completion/shell/ShellHandler.ts +1 -3
  58. package/src/service/completion/shell/fish.ts +1 -1
  59. package/src/service/completion/shell/powershell.ts +2 -12
  60. package/src/service/completion/shell/zsh.ts +1 -1
  61. package/src/service/configuration/ConfigurationServiceProvider.ts +40 -133
  62. package/src/service/configuration/DefaultKeyValueService.ts +6 -20
  63. package/src/service/configuration/DefaultSecretService.ts +10 -14
  64. package/src/service/configuration/command/ConfigCommand.ts +1 -4
  65. package/src/service/configuration/command/DumpConfigCommand.ts +9 -21
  66. package/src/service/dataDumpGenerator/DataDumpGeneratorServiceProvider.ts +5 -14
  67. package/src/service/dataDumpGenerator/DefaultDataDumpGeneratorService.ts +5 -12
  68. package/src/service/imagePrinter/DefaultImagePrinterService.ts +1 -5
  69. package/src/service/imagePrinter/ImagePrinterServiceProvider.ts +1 -4
  70. package/src/service/prettyPrinter/DefaultPrettyPrinterService.ts +4 -12
  71. package/src/service/prettyPrinter/PrettyPrinterServiceProvider.ts +3 -10
  72. package/src/service/printer/DefaultPrinterService.ts +20 -83
  73. package/src/service/printer/PrinterServiceProvider.ts +3 -11
  74. package/src/service/printer/command/DarkModeCommand.ts +3 -10
  75. package/src/service/printer/command/LogLevelCommand.ts +7 -26
  76. package/src/service/printer/command/NoColorCommand.ts +3 -10
  77. package/src/service/printer/command/NoHyperlinksCommand.ts +3 -10
  78. package/src/service/printer/terminal/Progress.ts +99 -90
  79. package/src/service/printer/terminal/Spinner.ts +7 -26
  80. package/src/service/prompter/DefaultPrompterService.ts +2 -6
  81. package/src/service/prompter/PrompterServiceProvider.ts +3 -11
  82. package/src/service/prompter/command/NoPromptCommand.ts +3 -10
  83. package/src/service/prompter/prompt/PromptContext.ts +5 -18
  84. package/src/service/prompter/prompt/promptMultiSelect.ts +6 -21
  85. package/src/service/prompter/prompt/promptOpenUrl.ts +7 -22
  86. package/src/service/prompter/prompt/promptSingleSelect.ts +6 -23
  87. package/src/service/prompter/prompt/promptText.ts +10 -27
  88. package/src/service/prompter/prompt/promptToggle.ts +8 -8
  89. package/src/service/shutdown/ShutdownServiceProvider.ts +3 -10
  90. package/src/service/syntaxHighlighter/DefaultSyntaxHighlighterService.ts +13 -26
  91. package/src/service/syntaxHighlighter/SyntaxHighlighterServiceProvider.ts +8 -21
  92. package/src/service/tableGenerator/DefaultTableGeneratorService.ts +44 -68
  93. package/src/service/tableGenerator/TableGeneratorServiceProvider.ts +7 -16
  94. package/src/service/treePrinter/DefaultTreePrinterService.ts +2 -7
  95. package/src/service/treePrinter/TreePrinterServiceProvider.ts +4 -12
  96. package/src/terminal/ImageRenderer.ts +35 -54
  97. package/src/terminal/PngDecoder.ts +10 -19
  98. package/src/terminal/TtyStyler.ts +11 -9
  99. package/src/terminal/TtyTerminal.ts +2 -10
  100. package/src/terminal/supportsHyperlinks.ts +4 -10
  101. package/src/util/configHelper.ts +3 -10
  102. package/src/util/envVarHelper.ts +50 -88
  103. package/src/util/helpHelper.ts +123 -193
  104. package/src/util/logger.ts +12 -42
  105. package/src/util/runnerHelper.ts +20 -61
  106. package/tests/cli/BaseCLI.test.ts +23 -80
  107. package/tests/command/CompletionCommand.test.ts +1 -6
  108. package/tests/command/MultiCommandCliHelpCommand.test.ts +51 -205
  109. package/tests/command/SingleCommandCliHelpCommand.test.ts +21 -103
  110. package/tests/command/UsageCommand.test.ts +4 -10
  111. package/tests/fixtures/Command.ts +87 -68
  112. package/tests/fixtures/CommandRegistry.ts +1 -3
  113. package/tests/fixtures/Context.ts +3 -11
  114. package/tests/fixtures/ServiceProviderRegistry.ts +1 -1
  115. package/tests/fixtures/prettierPluginFoo.ts +1 -1
  116. package/tests/fixtures/util.ts +2 -8
  117. package/tests/runtime/argument/ArgumentTypeGuards.test.ts +1 -3
  118. package/tests/runtime/command/CommandValidator.test.ts +881 -604
  119. package/tests/runtime/parser.test.ts +222 -246
  120. package/tests/runtime/registry/DefaultCommandRegistry.test.ts +15 -37
  121. package/tests/runtime/registry/DefaultServiceProviderRegistry.test.ts +2 -8
  122. package/tests/runtime/runner.test.ts +231 -281
  123. package/tests/runtime/scanner.test.ts +277 -475
  124. package/tests/runtime/values/argumentValueMerge.test.ts +133 -81
  125. package/tests/runtime/values/argumentValueValidation.test.ts +444 -588
  126. package/tests/runtime/values/globalCommandValuePopulation.test.ts +71 -253
  127. package/tests/runtime/values/subCommandValuePopulation.test.ts +1342 -1570
  128. package/tests/service/argumentPrompter/ArgumentPrompterServiceProvider.test.ts +3 -12
  129. package/tests/service/argumentPrompter/DefaultArgumentPrompterService.test.ts +36 -45
  130. package/tests/service/asciiBannerGenerator/AsciiBannerGeneratorServiceProvider.test.ts +2 -8
  131. package/tests/service/asciiBannerGenerator/DefaultAsciiBannerGeneratorService.test.ts +40 -62
  132. package/tests/service/banner/BannerServiceProvider.test.ts +5 -18
  133. package/tests/service/banner/command/NoBannerCommand.test.ts +1 -4
  134. package/tests/service/completion/CompletionServiceProvider.test.ts +145 -214
  135. package/tests/service/completion/DefaultCompletionService.test.ts +17 -79
  136. package/tests/service/completion/shell/fish.test.ts +1 -3
  137. package/tests/service/configuration/ConfigurationServiceProvider.test.ts +26 -75
  138. package/tests/service/configuration/DefaultKeyValueService.test.ts +9 -21
  139. package/tests/service/configuration/DefaultSecretService.test.ts +7 -15
  140. package/tests/service/configuration/command/DumpConfigCommand.test.ts +4 -13
  141. package/tests/service/dataDumpGenerator/DataDumpGeneratorServiceProvider.test.ts +6 -12
  142. package/tests/service/dataDumpGenerator/DefaultDataDumpGeneratorService.test.ts +1 -10
  143. package/tests/service/imagePrinter/DefaultImagePrinterService.test.ts +5 -70
  144. package/tests/service/prettyPrinter/DefaultPrettyPrinterService.test.ts +4 -11
  145. package/tests/service/prettyPrinter/PrettyPrinterServiceProvider.test.ts +2 -6
  146. package/tests/service/printer/DefaultPrinterService.test.ts +57 -255
  147. package/tests/service/printer/PrinterServiceProvider.test.ts +2 -8
  148. package/tests/service/printer/command/DarkModeCommand.test.ts +4 -12
  149. package/tests/service/printer/command/LogLevelCommand.test.ts +4 -17
  150. package/tests/service/printer/command/NoColorCommand.test.ts +4 -12
  151. package/tests/service/printer/command/NoHyperlinksCommand.test.ts +7 -21
  152. package/tests/service/printer/terminal/Progress.test.ts +1 -3
  153. package/tests/service/printer/terminal/Spinner.test.ts +2 -8
  154. package/tests/service/prompter/DefaultPrompterService.test.ts +52 -69
  155. package/tests/service/prompter/PrompterServiceProvider.test.ts +2 -8
  156. package/tests/service/shutdown/ShutdownServiceProvider.test.ts +1 -3
  157. package/tests/service/syntaxHighlighter/DefaultSyntaxHighlighterService.test.ts +13 -99
  158. package/tests/service/syntaxHighlighter/SyntaxHighlighterServiceProvider.test.ts +2 -7
  159. package/tests/service/tableGenerator/DefaultTableGeneratorService.test.ts +12 -33
  160. package/tests/service/tableGenerator/TableGeneratorServiceProvider.test.ts +2 -2
  161. package/tests/service/treePrinter/DefaultTreePrinterService.test.ts +4 -6
  162. package/tests/service/treePrinter/TreePrinterServiceProvider.test.ts +4 -8
  163. package/tests/terminal/ImageRenderer.test.ts +2 -11
  164. package/tests/terminal/PngDecoder.test.ts +2 -6
  165. package/tests/util/configHelper.test.ts +55 -137
  166. package/tests/util/envVarHelper.test.ts +46 -110
@@ -28,14 +28,8 @@ export default class DefaultCommandRegistry implements CommandRegistry {
28
28
  > = new Map();
29
29
  readonly #globalCommandsByName: Map<string, GlobalCommand> = new Map();
30
30
  readonly #globalCommandsByShortAlias: Map<string, GlobalCommand> = new Map();
31
- readonly #globalModifierCommandsByName: Map<
32
- string,
33
- GlobalModifierCommand
34
- > = new Map();
35
- readonly #globalModifierCommandsByShortAlias: Map<
36
- string,
37
- GlobalModifierCommand
38
- > = new Map();
31
+ readonly #globalModifierCommandsByName: Map<string, GlobalModifierCommand> = new Map();
32
+ readonly #globalModifierCommandsByShortAlias: Map<string, GlobalModifierCommand> = new Map();
39
33
  readonly #globalModifierCommandsByNameByServiceId: Map<
40
34
  string,
41
35
  Map<string, GlobalModifierCommand>
@@ -44,14 +38,10 @@ export default class DefaultCommandRegistry implements CommandRegistry {
44
38
  string,
45
39
  Map<string, GlobalModifierCommand>
46
40
  > = new Map();
47
- readonly #globalModifierCommandsByNameWithoutServiceId: Map<
48
- string,
49
- GlobalModifierCommand
50
- > = new Map();
51
- readonly #globalModifierCommandsByShortAliasWithoutServiceId: Map<
52
- string,
53
- GlobalModifierCommand
54
- > = new Map();
41
+ readonly #globalModifierCommandsByNameWithoutServiceId: Map<string, GlobalModifierCommand> =
42
+ new Map();
43
+ readonly #globalModifierCommandsByShortAliasWithoutServiceId: Map<string, GlobalModifierCommand> =
44
+ new Map();
55
45
  readonly #nonModifierCommandsByName: Map<string, Command> = new Map();
56
46
 
57
47
  /**
@@ -60,10 +50,7 @@ export default class DefaultCommandRegistry implements CommandRegistry {
60
50
  * @param commands optional list of {@link Command} instances.
61
51
  * @param commandValidator optional {@link CommandValidator} to use for all registered {@link Command} instances.
62
52
  */
63
- public constructor(
64
- commands?: ReadonlyArray<Command>,
65
- commandValidator?: CommandValidator,
66
- ) {
53
+ public constructor(commands?: ReadonlyArray<Command>, commandValidator?: CommandValidator) {
67
54
  this.#commandValidator = commandValidator;
68
55
  commands?.forEach((command) => this.addCommand(command));
69
56
  }
@@ -73,9 +60,7 @@ export default class DefaultCommandRegistry implements CommandRegistry {
73
60
  *
74
61
  * @throws {Error} if the name of the provided {@link GlobalCommand} is already registered.
75
62
  */
76
- #validateGlobalCommandWithOtherGlobalCommands(
77
- globalCommand: GlobalCommand,
78
- ): void {
63
+ #validateGlobalCommandWithOtherGlobalCommands(globalCommand: GlobalCommand): void {
79
64
  if (this.#globalCommandsByName.has(globalCommand.name)) {
80
65
  throw new Error(
81
66
  `Command name: ${globalCommand.name} duplicates the name of an existing command`,
@@ -92,9 +77,7 @@ export default class DefaultCommandRegistry implements CommandRegistry {
92
77
  `Command name: ${globalCommand.shortAlias} duplicates the short alias of an existing command`,
93
78
  );
94
79
  }
95
- if (
96
- this.#globalModifierCommandsByShortAlias.has(globalCommand.shortAlias)
97
- ) {
80
+ if (this.#globalModifierCommandsByShortAlias.has(globalCommand.shortAlias)) {
98
81
  throw new Error(
99
82
  `Command name: ${globalCommand.shortAlias} duplicates the short alias of an existing command`,
100
83
  );
@@ -107,18 +90,12 @@ export default class DefaultCommandRegistry implements CommandRegistry {
107
90
  *
108
91
  * @throws {Error} if the name of the provided {@link Command} is already registered.
109
92
  */
110
- #validateNonGlobalCommandWithOtherNonGlobalCommands(
111
- command: Command,
112
- ): void {
93
+ #validateNonGlobalCommandWithOtherNonGlobalCommands(command: Command): void {
113
94
  if (this.#subCommandsByName.has(command.name)) {
114
- throw new Error(
115
- `Command name: ${command.name} duplicates the name of an existing command`,
116
- );
95
+ throw new Error(`Command name: ${command.name} duplicates the name of an existing command`);
117
96
  }
118
97
  if (this.#groupCommandsByName.has(command.name)) {
119
- throw new Error(
120
- `Command name: ${command.name} duplicates the name of an existing command`,
121
- );
98
+ throw new Error(`Command name: ${command.name} duplicates the name of an existing command`);
122
99
  }
123
100
  }
124
101
 
@@ -165,13 +142,10 @@ export default class DefaultCommandRegistry implements CommandRegistry {
165
142
  this.#nonModifierCommandsByName.set(command.name, command);
166
143
  const groupCommand = command as GroupCommand;
167
144
  groupCommand.memberSubCommands.forEach((command) => {
168
- this.#groupCommandsAndMemberSubCommandsByName.set(
169
- `${groupCommand.name}:${command.name}`,
170
- {
171
- groupCommand,
172
- command,
173
- },
174
- );
145
+ this.#groupCommandsAndMemberSubCommandsByName.set(`${groupCommand.name}:${command.name}`, {
146
+ groupCommand,
147
+ command,
148
+ });
175
149
  });
176
150
  return;
177
151
  }
@@ -190,43 +164,24 @@ export default class DefaultCommandRegistry implements CommandRegistry {
190
164
  this.#validateGlobalCommandWithOtherGlobalCommands(command);
191
165
  this.#globalModifierCommandsByName.set(command.name, command);
192
166
  if (command.shortAlias !== undefined) {
193
- this.#globalModifierCommandsByShortAlias.set(
194
- command.shortAlias,
195
- command,
196
- );
167
+ this.#globalModifierCommandsByShortAlias.set(command.shortAlias, command);
197
168
  }
198
169
  if (serviceId === undefined) {
199
- this.#globalModifierCommandsByNameWithoutServiceId.set(
200
- command.name,
201
- command,
202
- );
170
+ this.#globalModifierCommandsByNameWithoutServiceId.set(command.name, command);
203
171
  if (command.shortAlias !== undefined) {
204
- this.#globalModifierCommandsByShortAliasWithoutServiceId.set(
205
- command.shortAlias,
206
- command,
207
- );
172
+ this.#globalModifierCommandsByShortAliasWithoutServiceId.set(command.shortAlias, command);
208
173
  }
209
174
  } else {
210
175
  if (!this.#globalModifierCommandsByNameByServiceId.has(serviceId)) {
211
- this.#globalModifierCommandsByNameByServiceId.set(
212
- serviceId,
213
- new Map(),
214
- );
176
+ this.#globalModifierCommandsByNameByServiceId.set(serviceId, new Map());
215
177
  }
216
- this.#globalModifierCommandsByNameByServiceId.get(serviceId)!.set(
217
- command.name,
218
- command,
219
- );
178
+ this.#globalModifierCommandsByNameByServiceId.get(serviceId)!.set(command.name, command);
220
179
  if (command.shortAlias !== undefined) {
221
- if (
222
- !this.#globalModifierCommandsByShortAliasByServiceId.has(serviceId)
223
- ) {
224
- this.#globalModifierCommandsByShortAliasByServiceId.set(
225
- serviceId,
226
- new Map(),
227
- );
180
+ if (!this.#globalModifierCommandsByShortAliasByServiceId.has(serviceId)) {
181
+ this.#globalModifierCommandsByShortAliasByServiceId.set(serviceId, new Map());
228
182
  }
229
- this.#globalModifierCommandsByShortAliasByServiceId.get(serviceId)!
183
+ this.#globalModifierCommandsByShortAliasByServiceId
184
+ .get(serviceId)!
230
185
  .set(command.shortAlias, command);
231
186
  }
232
187
  }
@@ -245,18 +200,14 @@ export default class DefaultCommandRegistry implements CommandRegistry {
245
200
  public getGroupCommandAndMemberSubCommandByJoinedName(
246
201
  groupAndMemberSubCommandName: string,
247
202
  ): { groupCommand: GroupCommand; command: SubCommand } | undefined {
248
- return this.#groupCommandsAndMemberSubCommandsByName.get(
249
- groupAndMemberSubCommandName,
250
- );
203
+ return this.#groupCommandsAndMemberSubCommandsByName.get(groupAndMemberSubCommandName);
251
204
  }
252
205
 
253
206
  public getGlobalCommandByName(name: string): GlobalCommand | undefined {
254
207
  return this.#globalCommandsByName.get(name);
255
208
  }
256
209
 
257
- public getGlobalModifierCommandByName(
258
- name: string,
259
- ): GlobalModifierCommand | undefined {
210
+ public getGlobalModifierCommandByName(name: string): GlobalModifierCommand | undefined {
260
211
  return this.#globalModifierCommandsByName.get(name);
261
212
  }
262
213
 
@@ -270,8 +221,8 @@ export default class DefaultCommandRegistry implements CommandRegistry {
270
221
  public getGlobalModifierCommandsByNameProvidedByService(
271
222
  serviceId: string,
272
223
  ): ReadonlyMap<string, GlobalModifierCommand> {
273
- const getGlobalModifierCommandByName = this
274
- .#globalModifierCommandsByNameByServiceId.get(serviceId);
224
+ const getGlobalModifierCommandByName =
225
+ this.#globalModifierCommandsByNameByServiceId.get(serviceId);
275
226
 
276
227
  if (getGlobalModifierCommandByName !== undefined) {
277
228
  return getGlobalModifierCommandByName;
@@ -282,8 +233,8 @@ export default class DefaultCommandRegistry implements CommandRegistry {
282
233
  public getGlobalModifierCommandsByShortAliasProvidedByService(
283
234
  serviceId: string,
284
235
  ): ReadonlyMap<string, GlobalModifierCommand> {
285
- const getGlobalModifierCommandByShortAlias = this
286
- .#globalModifierCommandsByShortAliasByServiceId.get(serviceId);
236
+ const getGlobalModifierCommandByShortAlias =
237
+ this.#globalModifierCommandsByShortAliasByServiceId.get(serviceId);
287
238
 
288
239
  if (getGlobalModifierCommandByShortAlias !== undefined) {
289
240
  return getGlobalModifierCommandByShortAlias;
@@ -305,10 +256,7 @@ export default class DefaultCommandRegistry implements CommandRegistry {
305
256
  return this.#globalModifierCommandsByShortAliasWithoutServiceId;
306
257
  }
307
258
 
308
- public getNonModifierCommandsByName(): ReadonlyMap<
309
- string,
310
- Command
311
- > {
259
+ public getNonModifierCommandsByName(): ReadonlyMap<string, Command> {
312
260
  return this.#nonModifierCommandsByName;
313
261
  }
314
262
 
@@ -7,8 +7,7 @@ const logger = getLogger("DefaultServiceProviderRegistry");
7
7
  /**
8
8
  * Default implementation of a {@link ServiceProviderRegistry}.
9
9
  */
10
- export default class DefaultServiceProviderRegistry
11
- implements ServiceProviderRegistry {
10
+ export default class DefaultServiceProviderRegistry implements ServiceProviderRegistry {
12
11
  readonly #serviceProviders: Array<ServiceProvider> = [];
13
12
 
14
13
  public constructor(serviceProviders?: ReadonlyArray<ServiceProvider>) {
@@ -18,16 +17,11 @@ export default class DefaultServiceProviderRegistry
18
17
  }
19
18
 
20
19
  public addServiceProvider(serviceProvider: ServiceProvider): void {
21
- logger.debug(
22
- "Adding service provider for service ID: %s",
23
- serviceProvider.serviceId,
24
- );
20
+ logger.debug("Adding service provider for service ID: %s", serviceProvider.serviceId);
25
21
  this.#serviceProviders.push(serviceProvider);
26
22
  }
27
23
 
28
24
  public getServiceProviders(): ReadonlyArray<ServiceProvider> {
29
- return this.#serviceProviders.sort((a, b) =>
30
- b.servicePriority - a.servicePriority
31
- );
25
+ return this.#serviceProviders.sort((a, b) => b.servicePriority - a.servicePriority);
32
26
  }
33
27
  }