@flowscripter/dynamic-cli-framework 2.4.0 → 3.0.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/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/src/cli/BaseCLI.d.ts +1 -0
- package/dist/src/cli/BaseCLI.d.ts.map +1 -1
- package/dist/src/cli/BaseCLI.js +6 -0
- package/dist/src/cli/BaseCLIFeatureOptions.d.ts +1 -0
- package/dist/src/cli/BaseCLIFeatureOptions.d.ts.map +1 -1
- package/dist/src/command/MultiCommandCliHelpCommand.d.ts +4 -4
- package/dist/src/command/MultiCommandCliHelpCommand.d.ts.map +1 -1
- package/dist/src/command/MultiCommandCliHelpCommand.js +3 -3
- package/dist/src/runtime/command/CommandValidator.d.ts.map +1 -1
- package/dist/src/runtime/command/CommandValidator.js +14 -16
- package/dist/src/runtime/parser.d.ts +5 -5
- package/dist/src/runtime/parser.d.ts.map +1 -1
- package/dist/src/runtime/parser.js +2 -2
- package/dist/src/runtime/runner.d.ts.map +1 -1
- package/dist/src/runtime/values/ValuePopulationResult.d.ts +3 -3
- package/dist/src/runtime/values/ValuePopulationResult.d.ts.map +1 -1
- package/dist/src/runtime/values/argumentValueMerge.d.ts +2 -2
- package/dist/src/runtime/values/argumentValueMerge.d.ts.map +1 -1
- package/dist/src/runtime/values/argumentValueValidation.d.ts +4 -4
- package/dist/src/runtime/values/argumentValueValidation.d.ts.map +1 -1
- package/dist/src/runtime/values/argumentValueValidation.js +6 -6
- package/dist/src/runtime/values/globalCommandValuePopulation.d.ts +4 -4
- package/dist/src/runtime/values/globalCommandValuePopulation.d.ts.map +1 -1
- package/dist/src/runtime/values/globalCommandValuePopulation.js +5 -5
- package/dist/src/runtime/values/subCommandValuePopulation.d.ts +5 -5
- package/dist/src/runtime/values/subCommandValuePopulation.d.ts.map +1 -1
- package/dist/src/runtime/values/subCommandValuePopulation.js +8 -7
- package/dist/src/service/argumentPrompter/DefaultArgumentPrompterService.d.ts.map +1 -1
- package/dist/src/service/argumentPrompter/DefaultArgumentPrompterService.js +6 -6
- package/dist/src/service/banner/command/NoBannerCommand.d.ts +2 -2
- package/dist/src/service/banner/command/NoBannerCommand.d.ts.map +1 -1
- package/dist/src/service/banner/command/NoBannerCommand.js +2 -2
- package/dist/src/service/completion/command/CompletionCompleteSubCommand.d.ts +2 -2
- package/dist/src/service/completion/command/CompletionCompleteSubCommand.d.ts.map +1 -1
- package/dist/src/service/completion/command/CompletionCompleteSubCommand.js +3 -3
- package/dist/src/service/completion/command/CompletionIntegrationSubCommand.d.ts +2 -2
- package/dist/src/service/completion/command/CompletionIntegrationSubCommand.d.ts.map +1 -1
- package/dist/src/service/completion/command/CompletionIntegrationSubCommand.js +3 -3
- package/dist/src/service/configuration/ConfigurationServiceProvider.d.ts +6 -6
- package/dist/src/service/configuration/ConfigurationServiceProvider.d.ts.map +1 -1
- package/dist/src/service/configuration/ConfigurationServiceProvider.js +4 -4
- package/dist/src/service/configuration/command/ConfigCommand.d.ts +2 -2
- package/dist/src/service/configuration/command/ConfigCommand.d.ts.map +1 -1
- package/dist/src/service/configuration/command/ConfigCommand.js +2 -2
- package/dist/src/service/fetch/DefaultFetchService.d.ts +7 -0
- package/dist/src/service/fetch/DefaultFetchService.d.ts.map +1 -0
- package/dist/src/service/fetch/DefaultFetchService.js +44 -0
- package/dist/src/service/fetch/FetchServiceProvider.d.ts +10 -0
- package/dist/src/service/fetch/FetchServiceProvider.d.ts.map +1 -0
- package/dist/src/service/fetch/FetchServiceProvider.js +22 -0
- package/dist/src/service/plugin/DefaultPluginServiceProvider.d.ts +2 -1
- package/dist/src/service/plugin/DefaultPluginServiceProvider.d.ts.map +1 -1
- package/dist/src/service/plugin/DefaultPluginServiceProvider.js +23 -8
- package/dist/src/service/plugin/FetchInterfaceAdapter.d.ts +17 -0
- package/dist/src/service/plugin/FetchInterfaceAdapter.d.ts.map +1 -0
- package/dist/src/service/plugin/FetchInterfaceAdapter.js +16 -0
- package/dist/src/service/plugin/SpawnInterfaceAdapter.js +1 -1
- package/dist/src/service/plugin/command/PluginAddSubCommand.d.ts +4 -4
- package/dist/src/service/plugin/command/PluginAddSubCommand.d.ts.map +1 -1
- package/dist/src/service/plugin/command/PluginAddSubCommand.js +2 -2
- package/dist/src/service/plugin/command/PluginListSubCommand.d.ts +2 -2
- package/dist/src/service/plugin/command/PluginListSubCommand.d.ts.map +1 -1
- package/dist/src/service/plugin/command/PluginRemoveSubCommand.d.ts +4 -4
- package/dist/src/service/plugin/command/PluginRemoveSubCommand.d.ts.map +1 -1
- package/dist/src/service/plugin/command/PluginRemoveSubCommand.js +2 -2
- package/dist/src/service/plugin/command/PluginSearchSubCommand.d.ts +4 -4
- package/dist/src/service/plugin/command/PluginSearchSubCommand.d.ts.map +1 -1
- package/dist/src/service/plugin/command/PluginSearchSubCommand.js +2 -2
- package/dist/src/service/plugin/command/PluginUpgradeSubCommand.d.ts +2 -2
- package/dist/src/service/plugin/command/PluginUpgradeSubCommand.d.ts.map +1 -1
- package/dist/src/service/printer/command/DarkModeCommand.d.ts +2 -2
- package/dist/src/service/printer/command/DarkModeCommand.d.ts.map +1 -1
- package/dist/src/service/printer/command/DarkModeCommand.js +2 -2
- package/dist/src/service/printer/command/LogLevelCommand.d.ts +2 -2
- package/dist/src/service/printer/command/LogLevelCommand.d.ts.map +1 -1
- package/dist/src/service/printer/command/LogLevelCommand.js +2 -2
- package/dist/src/service/printer/command/NoColorCommand.d.ts +2 -2
- package/dist/src/service/printer/command/NoColorCommand.d.ts.map +1 -1
- package/dist/src/service/printer/command/NoColorCommand.js +2 -2
- package/dist/src/service/printer/command/NoHyperlinksCommand.d.ts +2 -2
- package/dist/src/service/printer/command/NoHyperlinksCommand.d.ts.map +1 -1
- package/dist/src/service/printer/command/NoHyperlinksCommand.js +2 -2
- package/dist/src/service/prompter/command/NoPromptCommand.d.ts +2 -2
- package/dist/src/service/prompter/command/NoPromptCommand.d.ts.map +1 -1
- package/dist/src/service/prompter/command/NoPromptCommand.js +2 -2
- package/dist/src/service/spawn/DefaultSpawnService.js +6 -6
- package/dist/src/service/upgrade/DefaultUpgradeService.d.ts +2 -2
- package/dist/src/service/upgrade/DefaultUpgradeService.d.ts.map +1 -1
- package/dist/src/service/upgrade/DefaultUpgradeService.js +33 -51
- package/dist/src/service/upgrade/UpgradeServiceProvider.d.ts.map +1 -1
- package/dist/src/service/upgrade/UpgradeServiceProvider.js +12 -9
- package/dist/src/service/upgrade/command/UpgradeSubCommand.d.ts +2 -2
- package/dist/src/service/upgrade/command/UpgradeSubCommand.d.ts.map +1 -1
- package/dist/src/service/upgrade/command/UpgradeSubCommand.js +3 -3
- package/dist/src/util/envVarHelper.d.ts +3 -3
- package/dist/src/util/envVarHelper.d.ts.map +1 -1
- package/dist/src/util/envVarHelper.js +9 -12
- package/dist/src/util/helpHelper.d.ts.map +1 -1
- package/dist/src/util/helpHelper.js +27 -28
- package/index.ts +12 -10
- package/package.json +3 -3
- package/src/cli/BaseCLI.ts +7 -0
- package/src/cli/BaseCLIFeatureOptions.ts +1 -0
- package/src/command/MultiCommandCliHelpCommand.ts +7 -7
- package/src/runtime/command/CommandValidator.ts +17 -26
- package/src/runtime/parser.ts +8 -8
- package/src/runtime/runner.ts +16 -19
- package/src/runtime/values/ValuePopulationResult.ts +4 -4
- package/src/runtime/values/argumentValueMerge.ts +33 -50
- package/src/runtime/values/argumentValueValidation.ts +38 -52
- package/src/runtime/values/globalCommandValuePopulation.ts +7 -7
- package/src/runtime/values/subCommandValuePopulation.ts +42 -47
- package/src/service/argumentPrompter/DefaultArgumentPrompterService.ts +23 -26
- package/src/service/banner/command/NoBannerCommand.ts +3 -6
- package/src/service/completion/command/CompletionCompleteSubCommand.ts +4 -7
- package/src/service/completion/command/CompletionIntegrationSubCommand.ts +4 -7
- package/src/service/configuration/ConfigurationServiceProvider.ts +21 -21
- package/src/service/configuration/command/ConfigCommand.ts +3 -6
- package/src/service/fetch/DefaultFetchService.ts +55 -0
- package/src/service/fetch/FetchServiceProvider.ts +33 -0
- package/src/service/plugin/DefaultPluginServiceProvider.ts +29 -12
- package/src/service/plugin/FetchInterfaceAdapter.ts +28 -0
- package/src/service/plugin/SpawnInterfaceAdapter.ts +1 -1
- package/src/service/plugin/command/PluginAddSubCommand.ts +4 -4
- package/src/service/plugin/command/PluginListSubCommand.ts +2 -2
- package/src/service/plugin/command/PluginRemoveSubCommand.ts +4 -4
- package/src/service/plugin/command/PluginSearchSubCommand.ts +4 -4
- package/src/service/plugin/command/PluginUpgradeSubCommand.ts +2 -2
- package/src/service/printer/command/DarkModeCommand.ts +3 -6
- package/src/service/printer/command/LogLevelCommand.ts +3 -6
- package/src/service/printer/command/NoColorCommand.ts +3 -6
- package/src/service/printer/command/NoHyperlinksCommand.ts +3 -6
- package/src/service/prompter/command/NoPromptCommand.ts +3 -6
- package/src/service/prompter/prompt/promptText.ts +2 -2
- package/src/service/spawn/DefaultSpawnService.ts +6 -6
- package/src/service/upgrade/DefaultUpgradeService.ts +66 -65
- package/src/service/upgrade/UpgradeServiceProvider.ts +13 -9
- package/src/service/upgrade/command/UpgradeSubCommand.ts +4 -7
- package/src/util/envVarHelper.ts +23 -26
- package/src/util/helpHelper.ts +28 -36
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValueTypeName, } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
2
|
import getLogger from "../../util/logger.js";
|
|
3
3
|
import argumentValueMerge from "./argumentValueMerge.js";
|
|
4
4
|
import { MAXIMUM_COMPLEX_OPTION_NESTING_DEPTH } from "@flowscripter/dynamic-cli-framework-api";
|
|
@@ -333,7 +333,8 @@ class ParseContext {
|
|
|
333
333
|
}
|
|
334
334
|
else {
|
|
335
335
|
// set the new value on the array
|
|
336
|
-
optionValue[pathElement] =
|
|
336
|
+
optionValue[pathElement] =
|
|
337
|
+
value;
|
|
337
338
|
}
|
|
338
339
|
} // otherwise continue to navigate the path
|
|
339
340
|
else {
|
|
@@ -410,7 +411,7 @@ class ParseContext {
|
|
|
410
411
|
// the potential arg as a following option arg or positional value
|
|
411
412
|
if (potentialArg !== "true" &&
|
|
412
413
|
potentialArg !== "false" &&
|
|
413
|
-
this.currentOption.type ===
|
|
414
|
+
this.currentOption.type === ValueTypeName.BOOLEAN) {
|
|
414
415
|
// Set the value to implicit value of true and return ony error.
|
|
415
416
|
if (!this.setOptionValue("true")) {
|
|
416
417
|
return;
|
|
@@ -483,11 +484,11 @@ class ParseContext {
|
|
|
483
484
|
}
|
|
484
485
|
}
|
|
485
486
|
/**
|
|
486
|
-
* Populate {@link
|
|
487
|
+
* Populate {@link PopulatedValues} for the provided {@link SubCommand} using the provided potential args.
|
|
487
488
|
*
|
|
488
|
-
* @param subCommand the {@link SubCommand} for which {@link
|
|
489
|
+
* @param subCommand the {@link SubCommand} for which {@link PopulatedValues} values should be populated.
|
|
489
490
|
* @param potentialArgs the potential args to use for population.
|
|
490
|
-
* @param defaultValues optional default {@link
|
|
491
|
+
* @param defaultValues optional default {@link Values} to use for population before parsing the provided arguments.
|
|
491
492
|
*/
|
|
492
493
|
export default function populateSubCommandValues(subCommand, potentialArgs, defaultValues) {
|
|
493
494
|
logger.debug(() => {
|
|
@@ -519,7 +520,7 @@ export default function populateSubCommandValues(subCommand, potentialArgs, defa
|
|
|
519
520
|
// Check if the last arg specified an option but no value
|
|
520
521
|
if (parseContext.state === ParseState.OPTION_VALUE_EXPECTED) {
|
|
521
522
|
// special case if the last arg was for a boolean option where the value was implicitly `true`
|
|
522
|
-
if (parseContext.currentOption.type ===
|
|
523
|
+
if (parseContext.currentOption.type === ValueTypeName.BOOLEAN) {
|
|
523
524
|
parseContext.setOptionValue("true");
|
|
524
525
|
}
|
|
525
526
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultArgumentPrompterService.d.ts","sourceRoot":"","sources":["../../../../src/service/argumentPrompter/DefaultArgumentPrompterService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAuB/E,MAAM,CAAC,OAAO,OAAO,8BAA+B,YAAW,uBAAuB;;gBAGjE,eAAe,EAAE,eAAe;IAI7C,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"DefaultArgumentPrompterService.d.ts","sourceRoot":"","sources":["../../../../src/service/argumentPrompter/DefaultArgumentPrompterService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAuB/E,MAAM,CAAC,OAAO,OAAO,8BAA+B,YAAW,uBAAuB;;gBAGjE,eAAe,EAAE,eAAe;IAI7C,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CAiQhF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PromptType, } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
2
|
import { InvalidArgumentReason } from "@flowscripter/dynamic-cli-framework-api";
|
|
3
|
-
import {
|
|
3
|
+
import { ValueTypeName, ComplexValueTypeName, } from "@flowscripter/dynamic-cli-framework-api";
|
|
4
4
|
import { isGlobalCommand, isSubCommand } from "../../runtime/command/CommandTypeGuards.js";
|
|
5
5
|
export default class DefaultArgumentPrompterService {
|
|
6
6
|
#prompterService;
|
|
@@ -127,7 +127,7 @@ export default class DefaultArgumentPrompterService {
|
|
|
127
127
|
return values;
|
|
128
128
|
}
|
|
129
129
|
static #argumentToPrompt(name, description, arg) {
|
|
130
|
-
if (arg.type ===
|
|
130
|
+
if (arg.type === ValueTypeName.BOOLEAN) {
|
|
131
131
|
return {
|
|
132
132
|
name,
|
|
133
133
|
promptText: description,
|
|
@@ -148,7 +148,7 @@ export default class DefaultArgumentPrompterService {
|
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
const validationOption = {
|
|
151
|
-
displayValue: arg.type ===
|
|
151
|
+
displayValue: arg.type === ValueTypeName.SECRET ? "__SECRET__" : name,
|
|
152
152
|
returnedValue: "",
|
|
153
153
|
min: arg.minValueInclusive,
|
|
154
154
|
max: arg.maxValueInclusive,
|
|
@@ -164,11 +164,11 @@ export default class DefaultArgumentPrompterService {
|
|
|
164
164
|
static #coerceValue(value, type) {
|
|
165
165
|
if (typeof value === "string") {
|
|
166
166
|
switch (type) {
|
|
167
|
-
case
|
|
167
|
+
case ValueTypeName.INTEGER:
|
|
168
168
|
return parseInt(value, 10);
|
|
169
|
-
case
|
|
169
|
+
case ValueTypeName.NUMBER:
|
|
170
170
|
return parseFloat(value);
|
|
171
|
-
case
|
|
171
|
+
case ValueTypeName.BOOLEAN:
|
|
172
172
|
return value.toLowerCase() === "true";
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GlobalModifierCommand } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
|
-
import { type
|
|
2
|
+
import { type SingleValueType } from "@flowscripter/dynamic-cli-framework-api";
|
|
3
3
|
import type { Context } from "@flowscripter/dynamic-cli-framework-api";
|
|
4
4
|
import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
|
|
5
5
|
import type BannerServiceProvider from "../BannerServiceProvider.ts";
|
|
@@ -14,6 +14,6 @@ export default class NoBannerCommand implements GlobalModifierCommand {
|
|
|
14
14
|
readonly argument: GlobalCommandArgument;
|
|
15
15
|
readonly executePriority: number;
|
|
16
16
|
constructor(bannerServiceProvider: BannerServiceProvider, executePriority: number);
|
|
17
|
-
execute(_context: Context, argumentValue:
|
|
17
|
+
execute(_context: Context, argumentValue: SingleValueType): Promise<void>;
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=NoBannerCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoBannerCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/banner/command/NoBannerCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,
|
|
1
|
+
{"version":3,"file":"NoBannerCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/banner/command/NoBannerCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,yCAAyC,CAAC;AAC9F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,KAAK,qBAAqB,MAAM,6BAA6B,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,YAAW,qBAAqB;;IACnE,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,WAAW,8BAA8B;IAClD,QAAQ,CAAC,mBAAmB,QAAQ;IACpC,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAItC;IACF,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;gBAId,qBAAqB,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM;IAKjF,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAKjF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
2
|
/**
|
|
3
3
|
* Command to disable banner output for the CLI application.
|
|
4
4
|
*/
|
|
@@ -7,7 +7,7 @@ export default class NoBannerCommand {
|
|
|
7
7
|
description = "Disable output of banner";
|
|
8
8
|
enableConfiguration = true;
|
|
9
9
|
argument = {
|
|
10
|
-
type:
|
|
10
|
+
type: ValueTypeName.BOOLEAN,
|
|
11
11
|
defaultValue: true,
|
|
12
12
|
configurationKey: "NO_BANNER",
|
|
13
13
|
};
|
|
@@ -2,7 +2,7 @@ import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
|
|
|
2
2
|
import type { Option } from "@flowscripter/dynamic-cli-framework-api";
|
|
3
3
|
import type { Positional } from "@flowscripter/dynamic-cli-framework-api";
|
|
4
4
|
import type { Context } from "@flowscripter/dynamic-cli-framework-api";
|
|
5
|
-
import { type
|
|
5
|
+
import { type Values } from "@flowscripter/dynamic-cli-framework-api";
|
|
6
6
|
export declare class CompletionCompleteSubCommand implements SubCommand {
|
|
7
7
|
readonly name = "complete";
|
|
8
8
|
readonly description = "Generate completions for shell integration";
|
|
@@ -10,6 +10,6 @@ export declare class CompletionCompleteSubCommand implements SubCommand {
|
|
|
10
10
|
readonly disableGenericHelpDisplay = true;
|
|
11
11
|
readonly options: ReadonlyArray<Option>;
|
|
12
12
|
readonly positionals: ReadonlyArray<Positional>;
|
|
13
|
-
execute(context: Context, argumentValues:
|
|
13
|
+
execute(context: Context, argumentValues: Values): Promise<void>;
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=CompletionCompleteSubCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompletionCompleteSubCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/completion/command/CompletionCompleteSubCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,
|
|
1
|
+
{"version":3,"file":"CompletionCompleteSubCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/completion/command/CompletionCompleteSubCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,KAAK,MAAM,EAAiB,MAAM,yCAAyC,CAAC;AAMrF,qBAAa,4BAA6B,YAAW,UAAU;IAC7D,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,WAAW,gDAAgD;IACpE,QAAQ,CAAC,mBAAmB,SAAS;IACrC,QAAQ,CAAC,yBAAyB,QAAQ;IAE1C,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAM;IAE7C,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,UAAU,CAAC,CAc7C;IAEI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAqBvE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
2
|
import { COMPLETION_SERVICE_ID, ShellType } from "@flowscripter/dynamic-cli-framework-api";
|
|
3
3
|
import { PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
|
|
4
4
|
export class CompletionCompleteSubCommand {
|
|
@@ -10,13 +10,13 @@ export class CompletionCompleteSubCommand {
|
|
|
10
10
|
positionals = [
|
|
11
11
|
{
|
|
12
12
|
name: "shell",
|
|
13
|
-
type:
|
|
13
|
+
type: ValueTypeName.STRING,
|
|
14
14
|
allowableValues: Object.values(ShellType),
|
|
15
15
|
description: "Shell type",
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
name: "args",
|
|
19
|
-
type:
|
|
19
|
+
type: ValueTypeName.STRING,
|
|
20
20
|
isVarargMultiple: true,
|
|
21
21
|
isVarargOptional: true,
|
|
22
22
|
description: "Shell-specific completion context arguments",
|
|
@@ -2,13 +2,13 @@ import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
|
|
|
2
2
|
import type { Option } from "@flowscripter/dynamic-cli-framework-api";
|
|
3
3
|
import type { Positional } from "@flowscripter/dynamic-cli-framework-api";
|
|
4
4
|
import type { Context } from "@flowscripter/dynamic-cli-framework-api";
|
|
5
|
-
import { type
|
|
5
|
+
import { type Values } from "@flowscripter/dynamic-cli-framework-api";
|
|
6
6
|
export declare class CompletionIntegrationSubCommand implements SubCommand {
|
|
7
7
|
readonly name = "integration";
|
|
8
8
|
readonly description = "Install shell completion integration";
|
|
9
9
|
readonly enableConfiguration = false;
|
|
10
10
|
readonly options: ReadonlyArray<Option>;
|
|
11
11
|
readonly positionals: ReadonlyArray<Positional>;
|
|
12
|
-
execute(context: Context, argumentValues:
|
|
12
|
+
execute(context: Context, argumentValues: Values): Promise<void>;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=CompletionIntegrationSubCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompletionIntegrationSubCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/completion/command/CompletionIntegrationSubCommand.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,
|
|
1
|
+
{"version":3,"file":"CompletionIntegrationSubCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/completion/command/CompletionIntegrationSubCommand.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,KAAK,MAAM,EAAiB,MAAM,yCAAyC,CAAC;AAMrF,qBAAa,+BAAgC,YAAW,UAAU;IAChE,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,WAAW,0CAA0C;IAC9D,QAAQ,CAAC,mBAAmB,SAAS;IAErC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAOrC;IAEF,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,UAAU,CAAC,CAO7C;IAEI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CA4DvE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
|
-
import {
|
|
2
|
+
import { ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
|
|
3
3
|
import { COMPLETION_SERVICE_ID, ShellType } from "@flowscripter/dynamic-cli-framework-api";
|
|
4
4
|
import { Icon, PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
|
|
5
5
|
export class CompletionIntegrationSubCommand {
|
|
@@ -9,7 +9,7 @@ export class CompletionIntegrationSubCommand {
|
|
|
9
9
|
options = [
|
|
10
10
|
{
|
|
11
11
|
name: "config-path",
|
|
12
|
-
type:
|
|
12
|
+
type: ValueTypeName.STRING,
|
|
13
13
|
isOptional: true,
|
|
14
14
|
description: "Path to shell configuration file",
|
|
15
15
|
},
|
|
@@ -17,7 +17,7 @@ export class CompletionIntegrationSubCommand {
|
|
|
17
17
|
positionals = [
|
|
18
18
|
{
|
|
19
19
|
name: "shell",
|
|
20
|
-
type:
|
|
20
|
+
type: ValueTypeName.STRING,
|
|
21
21
|
allowableValues: Object.values(ShellType),
|
|
22
22
|
description: "Shell type to configure",
|
|
23
23
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ServiceInfo, ServiceProvider } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
|
-
import type {
|
|
2
|
+
import type { SingleValueType, Values, PopulatedValues, PopulatedValueType } from "@flowscripter/dynamic-cli-framework-api";
|
|
3
3
|
import type { Context } from "@flowscripter/dynamic-cli-framework-api";
|
|
4
4
|
import type { Command } from "@flowscripter/dynamic-cli-framework-api";
|
|
5
5
|
import type { CLIConfig } from "@flowscripter/dynamic-cli-framework-api";
|
|
@@ -11,16 +11,16 @@ import type { CLIConfig } from "@flowscripter/dynamic-cli-framework-api";
|
|
|
11
11
|
*
|
|
12
12
|
* **Default Command Arguments**
|
|
13
13
|
*
|
|
14
|
-
* Configuration of default {@link
|
|
14
|
+
* Configuration of default {@link Values} for {@link Command} instances is supported if they
|
|
15
15
|
* have defined {@link Command.enableConfiguration} as `true`.
|
|
16
16
|
*
|
|
17
17
|
* Two sources of configuration are supported and both are expected to be manually managed by the user of the CLI.
|
|
18
18
|
*
|
|
19
19
|
* *Configuration File*
|
|
20
20
|
*
|
|
21
|
-
* A JSON file where the structure matches {@link
|
|
21
|
+
* A JSON file where the structure matches {@link Values} and the defaults are stored
|
|
22
22
|
* under a top level `defaults` property. The second level of properties is used to refer to {@link Command.name}
|
|
23
|
-
* and the contained values are treated as command {@link
|
|
23
|
+
* and the contained values are treated as command {@link Values}. As an example:
|
|
24
24
|
*
|
|
25
25
|
* ```
|
|
26
26
|
* {
|
|
@@ -143,7 +143,7 @@ export default class ConfigurationServiceProvider implements ServiceProvider {
|
|
|
143
143
|
readonly keyValueServiceEnabled: boolean;
|
|
144
144
|
readonly secretServiceEnabled: boolean;
|
|
145
145
|
configLocation: string | undefined;
|
|
146
|
-
defaultsData: Map<string,
|
|
146
|
+
defaultsData: Map<string, Values | SingleValueType>;
|
|
147
147
|
/**
|
|
148
148
|
* Create an instance of the service provider with the specified details.
|
|
149
149
|
*
|
|
@@ -164,7 +164,7 @@ export default class ConfigurationServiceProvider implements ServiceProvider {
|
|
|
164
164
|
* @param cliConfig the {@link CLIConfig} to use for retrieving configuration keys.
|
|
165
165
|
* @param command the {@link Command} instance to retrieve default argument values for.
|
|
166
166
|
*/
|
|
167
|
-
getDefaultArgumentValues(cliConfig: CLIConfig, command: Command): Promise<
|
|
167
|
+
getDefaultArgumentValues(cliConfig: CLIConfig, command: Command): Promise<PopulatedValues | PopulatedValueType | undefined>;
|
|
168
168
|
/**
|
|
169
169
|
* Indicate that the contained {@link DefaultKeyValueService} should be set to have a scope of the provided
|
|
170
170
|
* command name.
|
|
@@ -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,
|
|
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,eAAe,EACf,kBAAkB,EACnB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAQvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAOvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkIG;AACH,MAAM,CAAC,OAAO,OAAO,4BAA6B,YAAW,eAAe;;IAC1E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAwB;IAClD,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC,SAAgB,cAAc,EAAE,OAAO,CAAC;IACxC,SAAgB,aAAa,EAAE,OAAO,CAAC;IACvC,SAAgB,sBAAsB,EAAE,OAAO,CAAC;IAChD,SAAgB,oBAAoB,EAAE,OAAO,CAAC;IAGvC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAKnC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC,CAAa;IAmBvE;;;;;;;;OAQG;gBAED,eAAe,EAAE,MAAM,EACvB,cAAc,UAAQ,EACtB,aAAa,UAAQ,EACrB,sBAAsB,UAAQ,EAC9B,oBAAoB,UAAQ;IAevB,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAqB1D,iBAAiB,CAAC,cAAc,EAAE,MAAM;IAI/C;;;;;;;OAOG;IACU,wBAAwB,CACnC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAC;IAuE5D;;;;;;;OAOG;IACI,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IA6BzD;;;;;;;OAOG;IACI,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IA6BvD;;;;;OAKG;IACU,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBnC,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAsGlD,eAAe,IAAI,MAAM;CAiCjC"}
|
|
@@ -20,16 +20,16 @@ const logger = getLogger("ConfigurationServiceProvider");
|
|
|
20
20
|
*
|
|
21
21
|
* **Default Command Arguments**
|
|
22
22
|
*
|
|
23
|
-
* Configuration of default {@link
|
|
23
|
+
* Configuration of default {@link Values} for {@link Command} instances is supported if they
|
|
24
24
|
* have defined {@link Command.enableConfiguration} as `true`.
|
|
25
25
|
*
|
|
26
26
|
* Two sources of configuration are supported and both are expected to be manually managed by the user of the CLI.
|
|
27
27
|
*
|
|
28
28
|
* *Configuration File*
|
|
29
29
|
*
|
|
30
|
-
* A JSON file where the structure matches {@link
|
|
30
|
+
* A JSON file where the structure matches {@link Values} and the defaults are stored
|
|
31
31
|
* under a top level `defaults` property. The second level of properties is used to refer to {@link Command.name}
|
|
32
|
-
* and the contained values are treated as command {@link
|
|
32
|
+
* and the contained values are treated as command {@link Values}. As an example:
|
|
33
33
|
*
|
|
34
34
|
* ```
|
|
35
35
|
* {
|
|
@@ -153,7 +153,7 @@ export default class ConfigurationServiceProvider {
|
|
|
153
153
|
// the location of the currently managed configuration data
|
|
154
154
|
configLocation;
|
|
155
155
|
// the configuration data to be used by the CLI runner implementation when setting command defaults.
|
|
156
|
-
//
|
|
156
|
+
// SingleValueType is for GlobalCommandArgument values, Values is for
|
|
157
157
|
// SubCommandArgument values.
|
|
158
158
|
defaultsData = new Map();
|
|
159
159
|
// the configuration data to be used by the CLI runner implementation
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GlobalModifierCommand } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
2
|
import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
|
|
3
|
-
import { type
|
|
3
|
+
import { type SingleValueType } from "@flowscripter/dynamic-cli-framework-api";
|
|
4
4
|
import type { Context } from "@flowscripter/dynamic-cli-framework-api";
|
|
5
5
|
import type ConfigurationServiceProvider from "../ConfigurationServiceProvider.ts";
|
|
6
6
|
/**
|
|
@@ -14,6 +14,6 @@ export default class ConfigCommand implements GlobalModifierCommand {
|
|
|
14
14
|
readonly argument: GlobalCommandArgument;
|
|
15
15
|
readonly executePriority: number;
|
|
16
16
|
constructor(configurationServiceProvider: ConfigurationServiceProvider, executePriority: number);
|
|
17
|
-
execute(_context: Context, argumentValue:
|
|
17
|
+
execute(_context: Context, argumentValue: SingleValueType): Promise<void>;
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=ConfigCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/configuration/command/ConfigCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,
|
|
1
|
+
{"version":3,"file":"ConfigCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/configuration/command/ConfigCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,yCAAyC,CAAC;AAC9F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,4BAA4B,MAAM,oCAAoC,CAAC;AAEnF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,qBAAqB;;IACjE,QAAQ,CAAC,IAAI,YAAY;IACzB,QAAQ,CAAC,WAAW,yCAAyC;IAC7D,QAAQ,CAAC,mBAAmB,QAAQ;IACpC,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAGtC;IACF,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;gBAK/B,4BAA4B,EAAE,4BAA4B,EAC1D,eAAe,EAAE,MAAM;IAMlB,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAOjF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
2
|
/**
|
|
3
3
|
* Command allowing the specification of the configuration file location used by the {@link ConfigurationServiceProvider}.
|
|
4
4
|
*/
|
|
@@ -7,7 +7,7 @@ export default class ConfigCommand {
|
|
|
7
7
|
description = "Set the configuration file location";
|
|
8
8
|
enableConfiguration = true;
|
|
9
9
|
argument = {
|
|
10
|
-
type:
|
|
10
|
+
type: ValueTypeName.STRING,
|
|
11
11
|
configurationKey: "CONFIG",
|
|
12
12
|
};
|
|
13
13
|
executePriority;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FetchOptions, FetchService, ShutdownService } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
|
+
export default class DefaultFetchService implements FetchService {
|
|
3
|
+
#private;
|
|
4
|
+
setDependencies(shutdownService: ShutdownService): void;
|
|
5
|
+
fetch(input: string | URL, options?: FetchOptions): Promise<Response>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=DefaultFetchService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultFetchService.d.ts","sourceRoot":"","sources":["../../../../src/service/fetch/DefaultFetchService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,eAAe,EAChB,MAAM,yCAAyC,CAAC;AAKjD,MAAM,CAAC,OAAO,OAAO,mBAAoB,YAAW,YAAY;;IAGvD,eAAe,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;IAIjD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC;CAsCvF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import getLogger from "../../util/logger.js";
|
|
2
|
+
const logger = getLogger("DefaultFetchService");
|
|
3
|
+
export default class DefaultFetchService {
|
|
4
|
+
#shutdownService;
|
|
5
|
+
setDependencies(shutdownService) {
|
|
6
|
+
this.#shutdownService = shutdownService;
|
|
7
|
+
}
|
|
8
|
+
async fetch(input, options = {}) {
|
|
9
|
+
if (this.#shutdownService === undefined) {
|
|
10
|
+
throw new Error("DefaultFetchService.fetch() called before setDependencies()");
|
|
11
|
+
}
|
|
12
|
+
const shutdownService = this.#shutdownService;
|
|
13
|
+
const { timeoutMs, longRunning = false, signal: callerSignal, ...requestInit } = options;
|
|
14
|
+
const controller = new AbortController();
|
|
15
|
+
const signals = [controller.signal];
|
|
16
|
+
if (callerSignal) {
|
|
17
|
+
signals.push(callerSignal);
|
|
18
|
+
}
|
|
19
|
+
if (timeoutMs !== undefined) {
|
|
20
|
+
signals.push(AbortSignal.timeout(timeoutMs));
|
|
21
|
+
}
|
|
22
|
+
const signal = signals.length === 1 ? signals[0] : AbortSignal.any(signals);
|
|
23
|
+
let settled = false;
|
|
24
|
+
if (longRunning) {
|
|
25
|
+
shutdownService.enterLongRunningMode();
|
|
26
|
+
shutdownService.addShutdownListener(async () => {
|
|
27
|
+
if (settled) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
logger.debug(() => `Aborting fetch of '${input.toString()}' due to shutdown`);
|
|
31
|
+
controller.abort();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
return await fetch(input, { ...requestInit, signal });
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
settled = true;
|
|
39
|
+
if (longRunning) {
|
|
40
|
+
shutdownService.leaveLongRunningMode();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CLIConfig, Context, ServiceInfo, ServiceProvider } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
|
+
export default class FetchServiceProvider implements ServiceProvider {
|
|
3
|
+
#private;
|
|
4
|
+
readonly serviceId: string;
|
|
5
|
+
readonly servicePriority: number;
|
|
6
|
+
constructor(servicePriority: number);
|
|
7
|
+
getServiceInfo(_cliConfig: CLIConfig): Promise<ServiceInfo>;
|
|
8
|
+
initService(context: Context): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=FetchServiceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchServiceProvider.d.ts","sourceRoot":"","sources":["../../../../src/service/fetch/FetchServiceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,OAAO,EACP,WAAW,EACX,eAAe,EAEhB,MAAM,yCAAyC,CAAC;AAIjD,MAAM,CAAC,OAAO,OAAO,oBAAqB,YAAW,eAAe;;IAClE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAoB;IAC9C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;gBAGd,eAAe,EAAE,MAAM;IAInC,cAAc,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAQ3D,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAKpD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FETCH_SERVICE_ID, SHUTDOWN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
|
+
import DefaultFetchService from "./DefaultFetchService.js";
|
|
3
|
+
export default class FetchServiceProvider {
|
|
4
|
+
serviceId = FETCH_SERVICE_ID;
|
|
5
|
+
servicePriority;
|
|
6
|
+
#fetchService;
|
|
7
|
+
constructor(servicePriority) {
|
|
8
|
+
this.servicePriority = servicePriority;
|
|
9
|
+
}
|
|
10
|
+
getServiceInfo(_cliConfig) {
|
|
11
|
+
this.#fetchService = new DefaultFetchService();
|
|
12
|
+
return Promise.resolve({
|
|
13
|
+
service: this.#fetchService,
|
|
14
|
+
commands: [],
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
initService(context) {
|
|
18
|
+
const shutdownService = context.getServiceById(SHUTDOWN_SERVICE_ID);
|
|
19
|
+
this.#fetchService.setDependencies(shutdownService);
|
|
20
|
+
return Promise.resolve();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -3,11 +3,12 @@ import type { Context } from "@flowscripter/dynamic-cli-framework-api";
|
|
|
3
3
|
import type { CLIConfig } from "@flowscripter/dynamic-cli-framework-api";
|
|
4
4
|
import type { MarketplacePluginManager } from "@flowscripter/dynamic-plugin-framework";
|
|
5
5
|
import { type SpawnInterfaceAdapterOptions } from "./SpawnInterfaceAdapter.ts";
|
|
6
|
+
import { type FetchInterfaceAdapterOptions } from "./FetchInterfaceAdapter.ts";
|
|
6
7
|
export default class DefaultPluginServiceProvider implements ServiceProvider {
|
|
7
8
|
#private;
|
|
8
9
|
readonly serviceId = "PLUGIN_SERVICE";
|
|
9
10
|
readonly servicePriority: number;
|
|
10
|
-
constructor(pluginManager: MarketplacePluginManager, servicePriority?: number, spawnInterfaceAdapterOptions?: SpawnInterfaceAdapterOptions);
|
|
11
|
+
constructor(pluginManager: MarketplacePluginManager, servicePriority?: number, spawnInterfaceAdapterOptions?: SpawnInterfaceAdapterOptions, fetchInterfaceAdapterOptions?: FetchInterfaceAdapterOptions);
|
|
11
12
|
getServiceInfo(_cliConfig: CLIConfig): Promise<ServiceInfo>;
|
|
12
13
|
initService(context: Context): Promise<void>;
|
|
13
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultPluginServiceProvider.d.ts","sourceRoot":"","sources":["../../../../src/service/plugin/DefaultPluginServiceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"DefaultPluginServiceProvider.d.ts","sourceRoot":"","sources":["../../../../src/service/plugin/DefaultPluginServiceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKzE,OAAO,KAAK,EAEV,wBAAwB,EAEzB,MAAM,wCAAwC,CAAC;AAIhD,OAA8B,EAC5B,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAA8B,EAC5B,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AAKpC,MAAM,CAAC,OAAO,OAAO,4BAA6B,YAAW,eAAe;;IAC1E,QAAQ,CAAC,SAAS,oBAAqB;IACvC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;gBAO/B,aAAa,EAAE,wBAAwB,EACvC,eAAe,SAAK,EACpB,4BAA4B,GAAE,4BAAiC,EAC/D,4BAA4B,GAAE,4BAAiC;IAQ3D,cAAc,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAQjE,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CA4B7C"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { PRINTER_SERVICE_ID, SPAWN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
|
+
import { FETCH_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
3
|
import { PLUGIN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
|
|
3
4
|
import DefaultPluginService from "./DefaultPluginService.js";
|
|
4
5
|
import { PluginGroupCommand } from "./command/PluginGroupCommand.js";
|
|
5
6
|
import SpawnInterfaceAdapter, {} from "./SpawnInterfaceAdapter.js";
|
|
7
|
+
import FetchInterfaceAdapter, {} from "./FetchInterfaceAdapter.js";
|
|
6
8
|
import getLogger from "../../util/logger.js";
|
|
7
9
|
const logger = getLogger("DefaultPluginServiceProvider");
|
|
8
10
|
export default class DefaultPluginServiceProvider {
|
|
@@ -10,11 +12,13 @@ export default class DefaultPluginServiceProvider {
|
|
|
10
12
|
servicePriority;
|
|
11
13
|
#pluginManager;
|
|
12
14
|
#spawnInterfaceAdapterOptions;
|
|
15
|
+
#fetchInterfaceAdapterOptions;
|
|
13
16
|
#pluginService;
|
|
14
|
-
constructor(pluginManager, servicePriority = 50, spawnInterfaceAdapterOptions = {}) {
|
|
17
|
+
constructor(pluginManager, servicePriority = 50, spawnInterfaceAdapterOptions = {}, fetchInterfaceAdapterOptions = {}) {
|
|
15
18
|
this.#pluginManager = pluginManager;
|
|
16
19
|
this.servicePriority = servicePriority;
|
|
17
20
|
this.#spawnInterfaceAdapterOptions = spawnInterfaceAdapterOptions;
|
|
21
|
+
this.#fetchInterfaceAdapterOptions = fetchInterfaceAdapterOptions;
|
|
18
22
|
}
|
|
19
23
|
async getServiceInfo(_cliConfig) {
|
|
20
24
|
this.#pluginService = new DefaultPluginService(this.#pluginManager);
|
|
@@ -26,16 +30,27 @@ export default class DefaultPluginServiceProvider {
|
|
|
26
30
|
initService(context) {
|
|
27
31
|
if (!context.doesServiceExist(SPAWN_SERVICE_ID)) {
|
|
28
32
|
logger.debug("SpawnService not available, plugin manager will spawn processes directly");
|
|
29
|
-
return Promise.resolve();
|
|
30
33
|
}
|
|
31
|
-
if (!("setSpawn" in this.#pluginManager)) {
|
|
34
|
+
else if (!("setSpawn" in this.#pluginManager)) {
|
|
32
35
|
logger.debug("Plugin manager does not support SpawnCapable, skipping spawn injection");
|
|
33
|
-
return Promise.resolve();
|
|
34
36
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
else {
|
|
38
|
+
const spawnService = context.getServiceById(SPAWN_SERVICE_ID);
|
|
39
|
+
const printerService = context.getServiceById(PRINTER_SERVICE_ID);
|
|
40
|
+
const adapter = new SpawnInterfaceAdapter(spawnService, printerService, this.#spawnInterfaceAdapterOptions);
|
|
41
|
+
this.#pluginManager.setSpawn(adapter);
|
|
42
|
+
}
|
|
43
|
+
if (!context.doesServiceExist(FETCH_SERVICE_ID)) {
|
|
44
|
+
logger.debug("FetchService not available, plugin manager will fetch directly");
|
|
45
|
+
}
|
|
46
|
+
else if (!("setFetch" in this.#pluginManager)) {
|
|
47
|
+
logger.debug("Plugin manager does not support FetchCapable, skipping fetch injection");
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const fetchService = context.getServiceById(FETCH_SERVICE_ID);
|
|
51
|
+
const adapter = new FetchInterfaceAdapter(fetchService, this.#fetchInterfaceAdapterOptions);
|
|
52
|
+
this.#pluginManager.setFetch(adapter);
|
|
53
|
+
}
|
|
39
54
|
return Promise.resolve();
|
|
40
55
|
}
|
|
41
56
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FetchService } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
|
+
import type { FetchInterface } from "@flowscripter/dynamic-plugin-framework";
|
|
3
|
+
export interface FetchInterfaceAdapterOptions {
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Adapts a {@link FetchService} to dynamic-plugin-framework's {@link FetchInterface}, so plugin
|
|
8
|
+
* manager/repository fetches respect the host CLI's shutdown handling and default timeout.
|
|
9
|
+
*/
|
|
10
|
+
export default class FetchInterfaceAdapter implements FetchInterface {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(fetchService: FetchService, options?: FetchInterfaceAdapterOptions);
|
|
13
|
+
fetch(input: string, init?: RequestInit & {
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
}): Promise<Response>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=FetchInterfaceAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchInterfaceAdapter.d.ts","sourceRoot":"","sources":["../../../../src/service/plugin/FetchInterfaceAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAE7E,MAAM,WAAW,4BAA4B;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,YAAW,cAAc;;gBAI/C,YAAY,EAAE,YAAY,EAAE,OAAO,GAAE,4BAAiC;IAK5E,KAAK,CAChB,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,WAAW,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1C,OAAO,CAAC,QAAQ,CAAC;CAIrB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapts a {@link FetchService} to dynamic-plugin-framework's {@link FetchInterface}, so plugin
|
|
3
|
+
* manager/repository fetches respect the host CLI's shutdown handling and default timeout.
|
|
4
|
+
*/
|
|
5
|
+
export default class FetchInterfaceAdapter {
|
|
6
|
+
#fetchService;
|
|
7
|
+
#timeoutMs;
|
|
8
|
+
constructor(fetchService, options = {}) {
|
|
9
|
+
this.#fetchService = fetchService;
|
|
10
|
+
this.#timeoutMs = options.timeoutMs;
|
|
11
|
+
}
|
|
12
|
+
async fetch(input, init) {
|
|
13
|
+
const { timeoutMs = this.#timeoutMs, ...requestInit } = init ?? {};
|
|
14
|
+
return this.#fetchService.fetch(input, { ...requestInit, timeoutMs });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
2
|
import type { Context } from "@flowscripter/dynamic-cli-framework-api";
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
3
|
+
import type { Values } from "@flowscripter/dynamic-cli-framework-api";
|
|
4
|
+
import { ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
|
|
5
5
|
export declare class PluginAddSubCommand implements SubCommand {
|
|
6
6
|
readonly name = "add";
|
|
7
7
|
readonly description = "Install a remote plugin";
|
|
@@ -10,8 +10,8 @@ export declare class PluginAddSubCommand implements SubCommand {
|
|
|
10
10
|
readonly positionals: {
|
|
11
11
|
name: string;
|
|
12
12
|
description: string;
|
|
13
|
-
type:
|
|
13
|
+
type: ValueTypeName;
|
|
14
14
|
}[];
|
|
15
|
-
execute(context: Context, argumentValues:
|
|
15
|
+
execute(context: Context, argumentValues: Values): Promise<void>;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=PluginAddSubCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginAddSubCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/plugin/command/PluginAddSubCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"PluginAddSubCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/plugin/command/PluginAddSubCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAQxE,qBAAa,mBAAoB,YAAW,UAAU;IACpD,QAAQ,CAAC,IAAI,SAAS;IACtB,QAAQ,CAAC,WAAW,6BAA6B;IACjD,QAAQ,CAAC,mBAAmB,SAAS;IACrC,QAAQ,CAAC,OAAO,UAAM;IACtB,QAAQ,CAAC,WAAW;;;;QAMlB;IAEI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAuCvE"}
|