@apimatic/cli 1.1.0-alpha.21 → 1.1.0-alpha.22
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/README.md +112 -90
- package/lib/actions/action-result.d.ts +8 -3
- package/lib/actions/action-result.js +34 -15
- package/lib/actions/action-result.js.map +1 -1
- package/lib/actions/api/transform.d.ts +15 -0
- package/lib/actions/api/transform.js +48 -0
- package/lib/actions/api/transform.js.map +1 -0
- package/lib/actions/api/validate.d.ts +12 -0
- package/lib/actions/api/validate.js +41 -0
- package/lib/actions/api/validate.js.map +1 -0
- package/lib/actions/auth/login.d.ts +6 -5
- package/lib/actions/auth/login.js +25 -33
- package/lib/actions/auth/login.js.map +1 -1
- package/lib/actions/auth/logout.d.ts +8 -0
- package/lib/actions/auth/logout.js +15 -0
- package/lib/actions/auth/logout.js.map +1 -0
- package/lib/actions/auth/status.d.ts +11 -0
- package/lib/actions/auth/status.js +26 -0
- package/lib/actions/auth/status.js.map +1 -0
- package/lib/actions/portal/copilot.d.ts +5 -3
- package/lib/actions/portal/copilot.js +47 -37
- package/lib/actions/portal/copilot.js.map +1 -1
- package/lib/actions/portal/generate.d.ts +4 -5
- package/lib/actions/portal/generate.js +30 -37
- package/lib/actions/portal/generate.js.map +1 -1
- package/lib/actions/portal/quickstart.d.ts +16 -0
- package/lib/actions/portal/quickstart.js +145 -0
- package/lib/actions/portal/quickstart.js.map +1 -0
- package/lib/actions/portal/recipe/new-recipe.d.ts +11 -20
- package/lib/actions/portal/recipe/new-recipe.js +147 -221
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -1
- package/lib/actions/portal/serve.d.ts +12 -10
- package/lib/actions/portal/serve.js +112 -17
- package/lib/actions/portal/serve.js.map +1 -1
- package/lib/actions/portal/toc/new-toc.d.ts +16 -15
- package/lib/actions/portal/toc/new-toc.js +80 -116
- package/lib/actions/portal/toc/new-toc.js.map +1 -1
- package/lib/actions/sdk/generate.d.ts +5 -6
- package/lib/actions/sdk/generate.js +22 -47
- package/lib/actions/sdk/generate.js.map +1 -1
- package/lib/application/portal/recipe/portal-recipe.d.ts +2 -2
- package/lib/application/portal/recipe/portal-recipe.js +9 -9
- package/lib/application/portal/recipe/portal-recipe.js.map +1 -1
- package/lib/application/portal/recipe/recipe-generator.d.ts +7 -2
- package/lib/application/portal/recipe/recipe-generator.js +21 -22
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -1
- package/lib/client-utils/auth-manager.d.ts +1 -1
- package/lib/client-utils/auth-manager.js +3 -4
- package/lib/client-utils/auth-manager.js.map +1 -1
- package/lib/commands/api/transform.d.ts +6 -3
- package/lib/commands/api/transform.js +43 -94
- package/lib/commands/api/transform.js.map +1 -1
- package/lib/commands/api/validate.d.ts +6 -3
- package/lib/commands/api/validate.js +27 -66
- package/lib/commands/api/validate.js.map +1 -1
- package/lib/commands/auth/login.d.ts +2 -1
- package/lib/commands/auth/login.js +15 -9
- package/lib/commands/auth/login.js.map +1 -1
- package/lib/commands/auth/logout.d.ts +3 -1
- package/lib/commands/auth/logout.js +12 -13
- package/lib/commands/auth/logout.js.map +1 -1
- package/lib/commands/auth/status.d.ts +1 -0
- package/lib/commands/auth/status.js +13 -11
- package/lib/commands/auth/status.js.map +1 -1
- package/lib/commands/portal/copilot.d.ts +2 -2
- package/lib/commands/portal/copilot.js +22 -20
- package/lib/commands/portal/copilot.js.map +1 -1
- package/lib/commands/portal/generate.d.ts +3 -4
- package/lib/commands/portal/generate.js +19 -14
- package/lib/commands/portal/generate.js.map +1 -1
- package/lib/commands/portal/quickstart.d.ts +3 -4
- package/lib/commands/portal/quickstart.js +24 -101
- package/lib/commands/portal/quickstart.js.map +1 -1
- package/lib/commands/portal/recipe/new.d.ts +3 -1
- package/lib/commands/portal/recipe/new.js +31 -23
- package/lib/commands/portal/recipe/new.js.map +1 -1
- package/lib/commands/portal/serve.d.ts +5 -5
- package/lib/commands/portal/serve.js +31 -57
- package/lib/commands/portal/serve.js.map +1 -1
- package/lib/commands/portal/toc/new.d.ts +2 -2
- package/lib/commands/portal/toc/new.js +35 -26
- package/lib/commands/portal/toc/new.js.map +1 -1
- package/lib/commands/sdk/generate.d.ts +5 -4
- package/lib/commands/sdk/generate.js +26 -17
- package/lib/commands/sdk/generate.js.map +1 -1
- package/lib/hooks/not-found.js +1 -1
- package/lib/hooks/not-found.js.map +1 -1
- package/lib/infrastructure/api-utils.js +3 -2
- package/lib/infrastructure/api-utils.js.map +1 -1
- package/lib/{application/portal/serve/watcher-handler.d.ts → infrastructure/debounce-service.d.ts} +3 -3
- package/lib/{application/portal/serve/watcher-handler.js → infrastructure/debounce-service.js} +5 -4
- package/lib/infrastructure/debounce-service.js.map +1 -0
- package/lib/infrastructure/env-info.d.ts +1 -1
- package/lib/infrastructure/env-info.js +2 -2
- package/lib/infrastructure/env-info.js.map +1 -1
- package/lib/infrastructure/file-service.d.ts +7 -2
- package/lib/infrastructure/file-service.js +46 -5
- package/lib/infrastructure/file-service.js.map +1 -1
- package/lib/infrastructure/launcher-service.d.ts +2 -0
- package/lib/infrastructure/launcher-service.js +4 -0
- package/lib/infrastructure/launcher-service.js.map +1 -1
- package/lib/infrastructure/network-service.d.ts +3 -0
- package/lib/infrastructure/network-service.js +7 -0
- package/lib/infrastructure/network-service.js.map +1 -0
- package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
- package/lib/infrastructure/services/api-client-factory.js +20 -0
- package/lib/infrastructure/services/api-client-factory.js.map +1 -0
- package/lib/infrastructure/services/api-service.d.ts +2 -2
- package/lib/infrastructure/services/api-service.js +6 -6
- package/lib/infrastructure/services/api-service.js.map +1 -1
- package/lib/infrastructure/services/auth-service.d.ts +1 -1
- package/lib/infrastructure/services/auth-service.js +7 -5
- package/lib/infrastructure/services/auth-service.js.map +1 -1
- package/lib/infrastructure/services/file-download-service.d.ts +15 -0
- package/lib/infrastructure/services/file-download-service.js +104 -0
- package/lib/infrastructure/services/file-download-service.js.map +1 -0
- package/lib/infrastructure/services/portal-service.d.ts +11 -13
- package/lib/infrastructure/services/portal-service.js +73 -102
- package/lib/infrastructure/services/portal-service.js.map +1 -1
- package/lib/infrastructure/services/telemetry-service.d.ts +3 -2
- package/lib/infrastructure/services/telemetry-service.js +4 -6
- package/lib/infrastructure/services/telemetry-service.js.map +1 -1
- package/lib/infrastructure/services/transformation-service.d.ts +23 -0
- package/lib/infrastructure/services/transformation-service.js +56 -0
- package/lib/infrastructure/services/transformation-service.js.map +1 -0
- package/lib/infrastructure/services/validation-service.d.ts +17 -0
- package/lib/infrastructure/services/validation-service.js +49 -0
- package/lib/infrastructure/services/validation-service.js.map +1 -0
- package/lib/prompts/api/transform.d.ts +11 -0
- package/lib/prompts/api/transform.js +30 -0
- package/lib/prompts/api/transform.js.map +1 -0
- package/lib/prompts/api/validate.d.ts +12 -0
- package/lib/prompts/api/validate.js +41 -0
- package/lib/prompts/api/validate.js.map +1 -0
- package/lib/prompts/auth/login.d.ts +6 -1
- package/lib/prompts/auth/login.js +12 -3
- package/lib/prompts/auth/login.js.map +1 -1
- package/lib/prompts/auth/logout.d.ts +3 -0
- package/lib/prompts/auth/logout.js +7 -0
- package/lib/prompts/auth/logout.js.map +1 -0
- package/lib/prompts/auth/status.d.ts +8 -0
- package/lib/prompts/auth/status.js +21 -0
- package/lib/prompts/auth/status.js.map +1 -0
- package/lib/prompts/format.d.ts +33 -0
- package/lib/prompts/format.js +99 -0
- package/lib/prompts/format.js.map +1 -0
- package/lib/prompts/portal/copilot.d.ts +8 -4
- package/lib/prompts/portal/copilot.js +35 -24
- package/lib/prompts/portal/copilot.js.map +1 -1
- package/lib/prompts/portal/generate.d.ts +9 -7
- package/lib/prompts/portal/generate.js +22 -23
- package/lib/prompts/portal/generate.js.map +1 -1
- package/lib/prompts/portal/quickstart.d.ts +30 -29
- package/lib/prompts/portal/quickstart.js +99 -193
- package/lib/prompts/portal/quickstart.js.map +1 -1
- package/lib/prompts/portal/recipe/new-recipe.d.ts +23 -18
- package/lib/prompts/portal/recipe/new-recipe.js +70 -108
- package/lib/prompts/portal/recipe/new-recipe.js.map +1 -1
- package/lib/prompts/portal/serve.d.ts +10 -3
- package/lib/prompts/portal/serve.js +30 -11
- package/lib/prompts/portal/serve.js.map +1 -1
- package/lib/prompts/portal/toc/new-toc.d.ts +12 -8
- package/lib/prompts/portal/toc/new-toc.js +20 -22
- package/lib/prompts/portal/toc/new-toc.js.map +1 -1
- package/lib/prompts/sdk/generate.d.ts +7 -7
- package/lib/prompts/sdk/generate.js +17 -23
- package/lib/prompts/sdk/generate.js.map +1 -1
- package/lib/types/api/account.d.ts +1 -1
- package/lib/types/api/transform.d.ts +14 -25
- package/lib/types/api/transform.js +16 -16
- package/lib/types/api/transform.js.map +1 -1
- package/lib/types/build/build.d.ts +9 -1
- package/lib/types/build/build.js +5 -2
- package/lib/types/build/build.js.map +1 -1
- package/lib/types/build-context.d.ts +5 -1
- package/lib/types/build-context.js +21 -4
- package/lib/types/build-context.js.map +1 -1
- package/lib/types/common/command-metadata.d.ts +4 -0
- package/lib/types/common/command-metadata.js +2 -0
- package/lib/types/common/command-metadata.js.map +1 -0
- package/lib/types/events/domain-event.d.ts +1 -1
- package/lib/types/events/domain-event.js.map +1 -1
- package/lib/types/events/quickstart-completed.js +1 -1
- package/lib/types/events/quickstart-initiated.js +1 -1
- package/lib/types/events/recipe-creation-failed.d.ts +1 -1
- package/lib/types/events/recipe-creation-failed.js +1 -1
- package/lib/types/events/recipe-creation-failed.js.map +1 -1
- package/lib/types/events/toc-creation-failed.d.ts +1 -1
- package/lib/types/events/toc-creation-failed.js +1 -1
- package/lib/types/events/toc-creation-failed.js.map +1 -1
- package/lib/types/file/directory.d.ts +17 -0
- package/lib/types/file/directory.js +86 -0
- package/lib/types/file/directory.js.map +1 -0
- package/lib/types/file/directoryPath.d.ts +3 -1
- package/lib/types/file/directoryPath.js +8 -2
- package/lib/types/file/directoryPath.js.map +1 -1
- package/lib/types/file/fileName.d.ts +2 -0
- package/lib/types/file/fileName.js +12 -0
- package/lib/types/file/fileName.js.map +1 -1
- package/lib/types/file/filePath.d.ts +2 -0
- package/lib/types/file/filePath.js +21 -0
- package/lib/types/file/filePath.js.map +1 -1
- package/lib/types/file/resource-input.d.ts +5 -0
- package/lib/types/file/resource-input.js +42 -0
- package/lib/types/file/resource-input.js.map +1 -0
- package/lib/types/file/urlPath.d.ts +6 -0
- package/lib/types/file/urlPath.js +22 -0
- package/lib/types/file/urlPath.js.map +1 -0
- package/lib/types/portal-context.d.ts +3 -1
- package/lib/types/portal-context.js +10 -0
- package/lib/types/portal-context.js.map +1 -1
- package/lib/types/recipe/recipe.d.ts +2 -17
- package/lib/types/recipe-context.d.ts +8 -0
- package/lib/types/recipe-context.js +21 -0
- package/lib/types/recipe-context.js.map +1 -0
- package/lib/types/resource-context.d.ts +12 -0
- package/lib/types/resource-context.js +30 -0
- package/lib/types/resource-context.js.map +1 -0
- package/lib/types/sdk/generate.d.ts +2 -15
- package/lib/types/sdk/generate.js +24 -10
- package/lib/types/sdk/generate.js.map +1 -1
- package/lib/types/sdk-context.d.ts +6 -5
- package/lib/types/sdk-context.js +12 -8
- package/lib/types/sdk-context.js.map +1 -1
- package/lib/types/sdl/sdl.d.ts +9 -0
- package/lib/types/sdl/sdl.js +46 -1
- package/lib/types/sdl/sdl.js.map +1 -1
- package/lib/types/spec-context.d.ts +3 -0
- package/lib/types/spec-context.js +7 -2
- package/lib/types/spec-context.js.map +1 -1
- package/lib/types/temp-context.d.ts +11 -0
- package/lib/types/temp-context.js +27 -0
- package/lib/types/temp-context.js.map +1 -0
- package/lib/types/toc-context.d.ts +12 -0
- package/lib/types/toc-context.js +26 -0
- package/lib/types/toc-context.js.map +1 -0
- package/lib/types/transform-context.d.ts +13 -0
- package/lib/types/transform-context.js +30 -0
- package/lib/types/transform-context.js.map +1 -0
- package/lib/types/utils.d.ts +0 -9
- package/lib/utils/string-utils.d.ts +1 -0
- package/lib/utils/string-utils.js +10 -0
- package/lib/utils/string-utils.js.map +1 -0
- package/lib/utils/utils.d.ts +2 -27
- package/lib/utils/utils.js +6 -145
- package/lib/utils/utils.js.map +1 -1
- package/package.json +4 -4
- package/lib/application/portal/serve/portal-watcher.d.ts +0 -11
- package/lib/application/portal/serve/portal-watcher.js +0 -64
- package/lib/application/portal/serve/portal-watcher.js.map +0 -1
- package/lib/application/portal/serve/serve-handler.d.ts +0 -16
- package/lib/application/portal/serve/serve-handler.js +0 -91
- package/lib/application/portal/serve/serve-handler.js.map +0 -1
- package/lib/application/portal/serve/watcher-handler.js.map +0 -1
- package/lib/application/portal/toc/sdl-parser.d.ts +0 -19
- package/lib/application/portal/toc/sdl-parser.js +0 -90
- package/lib/application/portal/toc/sdl-parser.js.map +0 -1
- package/lib/client-utils/sdk-client.d.ts +0 -18
- package/lib/client-utils/sdk-client.js +0 -41
- package/lib/client-utils/sdk-client.js.map +0 -1
- package/lib/config/env.d.ts +0 -26
- package/lib/config/env.js +0 -27
- package/lib/config/env.js.map +0 -1
- package/lib/controllers/api/transform.d.ts +0 -5
- package/lib/controllers/api/transform.js +0 -50
- package/lib/controllers/api/transform.js.map +0 -1
- package/lib/controllers/api/validate.d.ts +0 -3
- package/lib/controllers/api/validate.js +0 -29
- package/lib/controllers/api/validate.js.map +0 -1
- package/lib/controllers/portal/quickstart.d.ts +0 -13
- package/lib/controllers/portal/quickstart.js +0 -214
- package/lib/controllers/portal/quickstart.js.map +0 -1
- package/lib/infrastructure/api-client-utils.d.ts +0 -6
- package/lib/infrastructure/api-client-utils.js +0 -34
- package/lib/infrastructure/api-client-utils.js.map +0 -1
- package/lib/prompts/portal/common/base-prompts.d.ts +0 -7
- package/lib/prompts/portal/common/base-prompts.js +0 -19
- package/lib/prompts/portal/common/base-prompts.js.map +0 -1
- package/lib/types/api/validate.d.ts +0 -12
- package/lib/types/api/validate.js +0 -2
- package/lib/types/api/validate.js.map +0 -1
- package/lib/types/common/result.d.ts +0 -17
- package/lib/types/common/result.js +0 -32
- package/lib/types/common/result.js.map +0 -1
- package/lib/types/portal/generate.d.ts +0 -13
- package/lib/types/portal/generate.js +0 -3
- package/lib/types/portal/generate.js.map +0 -1
- package/lib/types/portal/quickstart.d.ts +0 -17
- package/lib/types/portal/quickstart.js +0 -2
- package/lib/types/portal/quickstart.js.map +0 -1
- package/lib/types/portal/serve.d.ts +0 -12
- package/lib/types/portal/serve.js +0 -2
- package/lib/types/portal/serve.js.map +0 -1
- package/lib/validators/common/directoryValidator.d.ts +0 -5
- package/lib/validators/common/directoryValidator.js +0 -22
- package/lib/validators/common/directoryValidator.js.map +0 -1
- package/lib/validators/portal/serve-validator.d.ts +0 -6
- package/lib/validators/portal/serve-validator.js +0 -15
- package/lib/validators/portal/serve-validator.js.map +0 -1
|
@@ -1,28 +1,34 @@
|
|
|
1
1
|
import { Command, Flags } from "@oclif/core";
|
|
2
2
|
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
3
|
-
import { LoginPrompts } from "../../prompts/auth/login.js";
|
|
4
3
|
import { LoginAction } from "../../actions/auth/login.js";
|
|
4
|
+
import { format, intro, outro } from "../../prompts/format.js";
|
|
5
5
|
class Login extends Command {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.prompts = new LoginPrompts();
|
|
9
|
-
}
|
|
10
6
|
async run() {
|
|
11
7
|
const { flags: { "auth-key": authKey } } = await this.parse(Login);
|
|
12
8
|
if (authKey === "") {
|
|
13
9
|
this.error("Flag --auth-key must not be empty when provided.");
|
|
14
10
|
}
|
|
15
|
-
const
|
|
11
|
+
const commandMetadata = {
|
|
12
|
+
commandName: Login.id,
|
|
13
|
+
shell: this.config.shell
|
|
14
|
+
};
|
|
15
|
+
intro("Login");
|
|
16
|
+
const loginAction = new LoginAction(new DirectoryPath(this.config.configDir), commandMetadata);
|
|
16
17
|
const result = await loginAction.execute(authKey);
|
|
17
|
-
result
|
|
18
|
+
outro(result);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
21
|
+
Login.summary = "Login to your APIMatic account";
|
|
20
22
|
Login.description = "Login using your APIMatic credentials or an API Key";
|
|
21
|
-
Login.
|
|
23
|
+
Login.cmdTxt = format.cmd('apimatic', 'auth', 'login');
|
|
24
|
+
Login.examples = [
|
|
25
|
+
Login.cmdTxt,
|
|
26
|
+
`${Login.cmdTxt} ${format.flag('auth-key', '{api-key}')}`
|
|
27
|
+
];
|
|
22
28
|
Login.flags = {
|
|
23
29
|
"auth-key": Flags.string({
|
|
24
30
|
char: "k",
|
|
25
|
-
description: "Sets authentication key for all commands."
|
|
31
|
+
description: "Sets authentication key for all commands."
|
|
26
32
|
})
|
|
27
33
|
};
|
|
28
34
|
export default Login;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAqB,KAAM,SAAQ,OAAO;IAkBxC,KAAK,CAAC,GAAG;QACP,MAAM,EACJ,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,EAC/B,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE5B,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;YACnB,IAAI,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACjE,CAAC;QAED,MAAM,eAAe,GAAoB;YACvC,WAAW,EAAE,KAAK,CAAC,EAAE;YACrB,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;SACzB,CAAC;QAEF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC,CAAC;QAC/F,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAClD,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;;AAnCM,aAAO,GAAG,gCAAgC,CAAC;AAE3C,iBAAW,GAAG,qDAAqD,CAAC;AAE5D,YAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAG,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1D,cAAQ,GAAG;IAChB,KAAK,CAAC,MAAM;IACZ,GAAG,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE;CAAC,CAAC;AAEtD,WAAK,GAAG;IACb,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC;QACvB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,2CAA2C;KACzD,CAAC;CACH,CAAC;eAfiB,KAAK"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
|
-
export default class
|
|
2
|
+
export default class Logout extends Command {
|
|
3
|
+
static summary: string;
|
|
3
4
|
static description: string;
|
|
5
|
+
private static cmdTxt;
|
|
4
6
|
static examples: string[];
|
|
5
7
|
run(): Promise<void>;
|
|
6
8
|
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { format, intro, outro } from "../../prompts/format.js";
|
|
3
|
+
import { LogoutAction } from "../../actions/auth/logout.js";
|
|
4
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
5
|
+
class Logout extends Command {
|
|
4
6
|
async run() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.log(response);
|
|
9
|
-
}
|
|
10
|
-
catch (error) {
|
|
11
|
-
this.error(error);
|
|
12
|
-
}
|
|
7
|
+
intro("Logout");
|
|
8
|
+
const actionResult = await new LogoutAction(new DirectoryPath(this.config.configDir)).execute();
|
|
9
|
+
outro(actionResult);
|
|
13
10
|
}
|
|
14
11
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
Logout.summary = "Clears the local login credentials.";
|
|
13
|
+
Logout.description = "Clears the local login credentials. This will also clear any cached credentials from the CLI.";
|
|
14
|
+
Logout.cmdTxt = format.cmd('apimatic', 'auth', 'logout');
|
|
15
|
+
Logout.examples = [Logout.cmdTxt];
|
|
16
|
+
export default Logout;
|
|
18
17
|
//# sourceMappingURL=logout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAElE,MAAqB,MAAO,SAAQ,OAAO;IAQzC,KAAK,CAAC,GAAG;QAEP,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,MAAM,YAAY,GAAG,MAAM,IAAI,YAAY,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAChG,KAAK,CAAC,YAAY,CAAC,CAAA;IACrB,CAAC;;AAZM,cAAO,GAAG,qCAAqC,CAAC;AAEhD,kBAAW,GAAG,+FAA+F,CAAC;AAEtG,aAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAG,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC3D,eAAQ,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;eANf,MAAM"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
|
-
import {
|
|
2
|
+
import { format, intro, outro } from "../../prompts/format.js";
|
|
3
|
+
import { StatusAction } from "../../actions/auth/status.js";
|
|
4
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
3
5
|
class Status extends Command {
|
|
4
6
|
async run() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
7
|
+
const commandMetadata = {
|
|
8
|
+
commandName: Status.id,
|
|
9
|
+
shell: this.config.shell
|
|
10
|
+
};
|
|
11
|
+
intro('Status');
|
|
12
|
+
const statusAction = new StatusAction(new DirectoryPath(this.config.configDir), commandMetadata);
|
|
13
|
+
const actionResult = await statusAction.execute(null);
|
|
14
|
+
outro(actionResult);
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
Status.description = "View the currently logged in user.";
|
|
17
|
-
Status.
|
|
18
|
+
Status.cmdTxt = format.cmd('apimatic', 'auth', 'status');
|
|
19
|
+
Status.examples = [Status.cmdTxt];
|
|
18
20
|
export default Status;
|
|
19
21
|
//# sourceMappingURL=status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/auth/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/auth/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAIlE,MAAqB,MAAO,SAAQ,OAAO;IAMzC,KAAK,CAAC,GAAG;QAEP,MAAM,eAAe,GAAoB;YACvC,WAAW,EAAE,MAAM,CAAC,EAAE;YACtB,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;SACzB,CAAC;QAEF,KAAK,CAAC,QAAQ,CAAC,CAAA;QACf,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC,CAAC;QACjG,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtD,KAAK,CAAC,YAAY,CAAC,CAAA;IACrB,CAAC;;AAhBM,kBAAW,GAAG,oCAAoC,CAAC;AAE3C,aAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAG,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC3D,eAAQ,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;eAJf,MAAM"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
|
-
export default class
|
|
2
|
+
export default class PortalCopilot extends Command {
|
|
3
3
|
static summary: string;
|
|
4
4
|
static description: string;
|
|
5
5
|
static flags: {
|
|
@@ -7,7 +7,7 @@ export default class PortalCopilotEnable extends Command {
|
|
|
7
7
|
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
8
|
disable: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
9
|
};
|
|
10
|
+
static cmdTxt: string;
|
|
10
11
|
static examples: string[];
|
|
11
|
-
private readonly prompts;
|
|
12
12
|
run(): Promise<void>;
|
|
13
13
|
}
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { Command, Flags } from "@oclif/core";
|
|
2
3
|
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
3
|
-
import { PortalCopilotPrompts } from "../../prompts/portal/copilot.js";
|
|
4
4
|
import { FlagsProvider } from "../../types/flags-provider.js";
|
|
5
5
|
import { CopilotAction } from "../../actions/portal/copilot.js";
|
|
6
|
-
|
|
7
|
-
class
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.prompts = new PortalCopilotPrompts();
|
|
11
|
-
}
|
|
6
|
+
import { format, intro, outro } from "../../prompts/format.js";
|
|
7
|
+
class PortalCopilot extends Command {
|
|
12
8
|
async run() {
|
|
13
|
-
const { flags: { input, "auth-key": authKey, disable, force } } = await this.parse(
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
const { flags: { input, "auth-key": authKey, disable, force } } = await this.parse(_a);
|
|
10
|
+
const commandMetadata = {
|
|
11
|
+
commandName: _a.id,
|
|
12
|
+
shell: this.config.shell
|
|
13
|
+
};
|
|
14
|
+
intro("Configure API Copilot");
|
|
15
|
+
const buildDirectory = new DirectoryPath(input !== null && input !== void 0 ? input : "./", "src");
|
|
16
|
+
const copilotConfigAction = new CopilotAction(new DirectoryPath(this.config.configDir), commandMetadata, authKey);
|
|
17
17
|
const result = await copilotConfigAction.execute(buildDirectory, force, !disable);
|
|
18
|
-
result
|
|
18
|
+
outro(result);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
_a = PortalCopilot;
|
|
22
|
+
PortalCopilot.summary = "Configure API Copilot for your API Documentation portal";
|
|
23
|
+
PortalCopilot.description = `Displays available API Copilots associated with your account and allows you to select which one to integrate with your portal. Each APIMatic account includes one Copilot by default. The selected Copilot will be added to your ${format.var("APIMATIC-BUILD.json")} file`;
|
|
24
|
+
PortalCopilot.flags = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, FlagsProvider.input), { disable: Flags.boolean({
|
|
24
25
|
default: false,
|
|
25
26
|
description: "marks the API Copilot as disabled in the configuration"
|
|
26
|
-
}) }), FlagsProvider.force), FlagsProvider.authKey);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
}) }), FlagsProvider.force), FlagsProvider.force), FlagsProvider.authKey);
|
|
28
|
+
PortalCopilot.cmdTxt = format.cmd("apimatic", "portal", "copilot");
|
|
29
|
+
PortalCopilot.examples = [
|
|
30
|
+
`${_a.cmdTxt} ${format.flag("input", './')}`,
|
|
31
|
+
`${_a.cmdTxt} ${format.flag("input", './')} ${format.flag("disable")}`
|
|
30
32
|
];
|
|
31
|
-
export default
|
|
33
|
+
export default PortalCopilot;
|
|
32
34
|
//# sourceMappingURL=copilot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/commands/portal/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/commands/portal/copilot.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAqB,aAAc,SAAQ,OAAO;IAuBhD,KAAK,CAAC,GAAG;QACP,MAAM,EACJ,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,EACtD,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,EAAa,CAAC,CAAC;QAEpC,MAAM,eAAe,GAAoB;YACvC,WAAW,EAAE,EAAa,CAAC,EAAE;YAC7B,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;SACzB,CAAC;QAEF,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC/B,MAAM,cAAc,GAAG,IAAI,aAAa,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,EAAE,KAAK,CAAC,CAAC;QAC/D,MAAM,mBAAmB,GAAG,IAAI,aAAa,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;QAClH,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,cAAc,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC;QAClF,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;;;AArCM,qBAAO,GAAG,yDAAyD,AAA5D,CAA6D;AAEpE,yBAAW,GAChB,oOAAoO,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,OAAO,AAD5P,CAC6P;AAExQ,mBAAK,6EACP,aAAa,CAAC,KAAK,KACtB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;QACrB,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,wDAAwD;KACtE,CAAC,KACC,aAAa,CAAC,KAAK,GACnB,aAAa,CAAC,KAAK,GACnB,aAAa,CAAC,OAAO,CARd,CASV;AAEK,oBAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,AAA9C,CAA+C;AACrD,sBAAQ,GAAG;IAChB,GAAG,EAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE;IAC9C,GAAG,EAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;CACzE,AAHc,CAGb;eArBiB,aAAa"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Command
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
2
|
export declare class PortalGenerate extends Command {
|
|
3
|
+
static summary: string;
|
|
3
4
|
static description: string;
|
|
4
5
|
static flags: {
|
|
5
6
|
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -7,9 +8,7 @@ export declare class PortalGenerate extends Command {
|
|
|
7
8
|
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
};
|
|
11
|
+
static cmdTxt: string;
|
|
10
12
|
static examples: string[];
|
|
11
|
-
private readonly prompts;
|
|
12
|
-
constructor(argv: string[], config: Config);
|
|
13
13
|
run(): Promise<void>;
|
|
14
|
-
private getConfigDir;
|
|
15
14
|
}
|
|
@@ -1,31 +1,36 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { Command, Flags } from "@oclif/core";
|
|
2
3
|
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
3
4
|
import { GenerateAction } from "../../actions/portal/generate.js";
|
|
4
|
-
import { PortalGeneratePrompts } from "../../prompts/portal/generate.js";
|
|
5
5
|
import { FlagsProvider } from "../../types/flags-provider.js";
|
|
6
|
+
import { format, intro, outro } from "../../prompts/format.js";
|
|
6
7
|
const DEFAULT_WORKING_DIRECTORY = "./";
|
|
7
8
|
export class PortalGenerate extends Command {
|
|
8
|
-
constructor(argv, config) {
|
|
9
|
-
super(argv, config);
|
|
10
|
-
this.getConfigDir = () => {
|
|
11
|
-
return new DirectoryPath(this.config.configDir);
|
|
12
|
-
};
|
|
13
|
-
this.prompts = new PortalGeneratePrompts();
|
|
14
|
-
}
|
|
15
9
|
async run() {
|
|
16
|
-
const { flags: { input, destination, force, zip: zipPortal, "auth-key": authKey } } = await this.parse(
|
|
10
|
+
const { flags: { input, destination, force, zip: zipPortal, "auth-key": authKey } } = await this.parse(_a);
|
|
17
11
|
const workingDirectory = new DirectoryPath(input !== null && input !== void 0 ? input : DEFAULT_WORKING_DIRECTORY);
|
|
18
12
|
const buildDirectory = input ? new DirectoryPath(input, "src") : workingDirectory.join("src");
|
|
19
13
|
const portalDirectory = destination ? new DirectoryPath(destination) : workingDirectory.join("portal");
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
const commandMetadata = {
|
|
15
|
+
commandName: _a.id,
|
|
16
|
+
shell: this.config.shell
|
|
17
|
+
};
|
|
18
|
+
intro("Generate Portal");
|
|
19
|
+
const action = new GenerateAction(new DirectoryPath(this.config.configDir), commandMetadata, authKey);
|
|
20
|
+
const result = await action.execute(buildDirectory, portalDirectory, force, zipPortal);
|
|
21
|
+
outro(result);
|
|
23
22
|
}
|
|
24
23
|
}
|
|
24
|
+
_a = PortalGenerate;
|
|
25
|
+
PortalGenerate.summary = "Generate an API Documentation portal";
|
|
25
26
|
PortalGenerate.description = "Generate an API Documentation portal. Requires an input directory containing API specifications, a config file and optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/build-file-reference)";
|
|
26
27
|
PortalGenerate.flags = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, FlagsProvider.input), FlagsProvider.destination("portal", "portal")), FlagsProvider.force), { zip: Flags.boolean({
|
|
27
28
|
default: false,
|
|
28
|
-
description: "
|
|
29
|
+
description: "Download the generated portal as a .zip archive"
|
|
29
30
|
}) }), FlagsProvider.authKey);
|
|
30
|
-
PortalGenerate.
|
|
31
|
+
PortalGenerate.cmdTxt = format.cmd("apimatic", "portal", "generate");
|
|
32
|
+
PortalGenerate.examples = [
|
|
33
|
+
_a.cmdTxt,
|
|
34
|
+
`${_a.cmdTxt} ${format.flag("input", '"./"')} ${format.flag("destination", '"./portal"')}`
|
|
35
|
+
];
|
|
31
36
|
//# sourceMappingURL=generate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/commands/portal/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/commands/portal/generate.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAG/D,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAEvC,MAAM,OAAO,cAAe,SAAQ,OAAO;IAuBzC,KAAK,CAAC,GAAG;QACP,MAAM,EACJ,KAAK,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,EAC1E,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,EAAc,CAAC,CAAC;QAErC,MAAM,gBAAgB,GAAG,IAAI,aAAa,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,yBAAyB,CAAC,CAAC;QAC/E,MAAM,cAAc,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9F,MAAM,eAAe,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvG,MAAM,eAAe,GAAoB;YACvC,WAAW,EAAE,EAAc,CAAC,EAAE;YAC9B,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;SACzB,CAAC;QAEF,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACzB,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;QACtG,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QACvF,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;;;AAvCM,sBAAO,GAAG,sCAAsC,AAAzC,CAA0C;AAEjD,0BAAW,GAChB,mSAAmS,AADnR,CACoR;AAE/R,oBAAK,6EACP,aAAa,CAAC,KAAK,GACnB,aAAa,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAC7C,aAAa,CAAC,KAAK,KACtB,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC;QACjB,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,iDAAiD;KAC/D,CAAC,KACC,aAAa,CAAC,OAAO,CARd,CASV;AAEK,qBAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,AAA/C,CAAgD;AACtD,uBAAQ,GAAG;IAChB,EAAI,CAAC,MAAM;IACX,GAAG,EAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,EAAE;CAC7F,AAHc,CAGb"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
2
|
export default class PortalQuickstart extends Command {
|
|
3
3
|
static description: string;
|
|
4
|
+
static summary: string;
|
|
5
|
+
static cmdTxt: string;
|
|
4
6
|
static examples: string[];
|
|
5
|
-
private getSpecFile;
|
|
6
|
-
private getSpecValidationSummary;
|
|
7
|
-
private getWorkingDirectory;
|
|
8
7
|
run(): Promise<void>;
|
|
9
|
-
private
|
|
8
|
+
private readonly getConfigDir;
|
|
10
9
|
}
|
|
@@ -1,114 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
var _a;
|
|
2
2
|
import { Command } from "@oclif/core";
|
|
3
|
-
import {
|
|
4
|
-
import { PortalQuickstartPrompts } from "../../prompts/portal/quickstart.js";
|
|
5
|
-
import { PortalQuickstartController } from "../../controllers/portal/quickstart.js";
|
|
6
|
-
import { getMessageInRedColor } from "../../utils/utils.js";
|
|
3
|
+
import { PortalQuickstartAction } from "../../actions/portal/quickstart.js";
|
|
7
4
|
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
8
|
-
import { PortalServeAction } from "../../actions/portal/serve.js";
|
|
9
|
-
import { ServeHandler } from "../../application/portal/serve/serve-handler.js";
|
|
10
|
-
import { PortalService } from "../../infrastructure/services/portal-service.js";
|
|
11
|
-
import { PortalServePrompts } from "../../prompts/portal/serve.js";
|
|
12
|
-
import { GenerateAction } from "../../actions/portal/generate.js";
|
|
13
|
-
import { LoginAction } from "../../actions/auth/login.js";
|
|
14
5
|
import { TelemetryService } from "../../infrastructure/services/telemetry-service.js";
|
|
15
6
|
import { QuickstartInitiatedEvent } from "../../types/events/quickstart-initiated.js";
|
|
16
7
|
import { QuickstartCompletedEvent } from "../../types/events/quickstart-completed.js";
|
|
17
|
-
import {
|
|
18
|
-
import { createApiClient, createAuthorizationHeader } from "../../infrastructure/api-client-utils.js";
|
|
8
|
+
import { format, intro, outro } from "../../prompts/format.js";
|
|
19
9
|
class PortalQuickstart extends Command {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
async getSpecValidationSummary(prompts, controller, specFile, apiValidationController) {
|
|
27
|
-
const apiValidationSummary = await controller.getSpecValidationSummary(prompts, specFile, apiValidationController);
|
|
28
|
-
if (!apiValidationSummary.success) {
|
|
29
|
-
prompts.displaySpecValidationFailureMessage();
|
|
30
|
-
await prompts.specValidationFailurePrompt();
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
prompts.displaySpecValidationSuccessMessage();
|
|
34
|
-
}
|
|
35
|
-
return apiValidationSummary;
|
|
36
|
-
}
|
|
37
|
-
async getWorkingDirectory(prompts, controller, specFile, apiValidationSummary, languages) {
|
|
38
|
-
const workingDirectory = await prompts.workingDirectoryPrompt();
|
|
39
|
-
prompts.displayBuildDirectoryGenerationMessage();
|
|
40
|
-
const buildDirectory = new DirectoryPath(workingDirectory, "src").toString();
|
|
41
|
-
await controller.setupBuildDirectory(prompts, buildDirectory, specFile, apiValidationSummary, languages);
|
|
42
|
-
prompts.displayBuildDirectoryGenerationSuccessMessage(buildDirectory);
|
|
43
|
-
prompts.displayBuildDirectoryAsTree(buildDirectory);
|
|
44
|
-
return workingDirectory;
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.getConfigDir = () => {
|
|
13
|
+
return new DirectoryPath(this.config.configDir);
|
|
14
|
+
};
|
|
45
15
|
}
|
|
46
16
|
async run() {
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const authInfo = await getAuthInfo(this.config.configDir);
|
|
62
|
-
const authorizationHeader = createAuthorizationHeader(authInfo, null);
|
|
63
|
-
const client = createApiClient(authorizationHeader, 0);
|
|
64
|
-
const apiValidationController = new ApiValidationExternalApisController(client);
|
|
65
|
-
try {
|
|
66
|
-
const specFile = await this.getSpecFile(prompts, controller);
|
|
67
|
-
const apiValidationSummary = await this.getSpecValidationSummary(prompts, controller, specFile, apiValidationController);
|
|
68
|
-
const languages = await prompts.sdkLanguagesPrompt();
|
|
69
|
-
const workingDirectory = await this.getWorkingDirectory(prompts, controller, specFile, apiValidationSummary, languages);
|
|
70
|
-
const portalServePrompts = new PortalServePrompts();
|
|
71
|
-
const portalServeAction = new PortalServeAction(portalServePrompts, new ServeHandler(), new PortalService());
|
|
72
|
-
//TODO: This needs to be moved within the action. Port should not be initialized again here.
|
|
73
|
-
const port = await this.getServerPort(3000);
|
|
74
|
-
const buildDirectory = new DirectoryPath(workingDirectory, "src");
|
|
75
|
-
const portalDirectory = new DirectoryPath(workingDirectory, "portal");
|
|
76
|
-
const generatePortalAction = new GenerateAction(new DirectoryPath(this.config.configDir), null);
|
|
77
|
-
const serveFlags = {
|
|
78
|
-
folder: buildDirectory.toString(),
|
|
79
|
-
destination: portalDirectory.toString(),
|
|
80
|
-
port: port,
|
|
81
|
-
open: true,
|
|
82
|
-
"no-reload": false,
|
|
83
|
-
"auth-key": undefined
|
|
84
|
-
};
|
|
85
|
-
const serverPaths = {
|
|
86
|
-
sourceDirectoryPath: buildDirectory.toString(),
|
|
87
|
-
destinationDirectoryPath: portalDirectory.toString()
|
|
88
|
-
};
|
|
89
|
-
const servePortalResult = await portalServeAction.servePortal(serveFlags, serverPaths, PortalQuickstart.id, generatePortalAction.execute);
|
|
90
|
-
if (servePortalResult.isFailed()) {
|
|
91
|
-
portalServePrompts.logError(getMessageInRedColor(servePortalResult.error));
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (servePortalResult.isCancelled()) {
|
|
95
|
-
portalServePrompts.logError(getMessageInRedColor(servePortalResult.value));
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
prompts.displayOutroMessage(buildDirectory.toString());
|
|
99
|
-
await telemetryService.trackEvent(new QuickstartCompletedEvent());
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
this.error(getMessageInRedColor(error instanceof Error ? error.message : String(error)));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async getServerPort(port) {
|
|
106
|
-
const defaultPorts = [3000, 3001, 3002];
|
|
107
|
-
const preferredPorts = typeof port === "number" ? [port, ...defaultPorts.filter((p) => p !== port)] : defaultPorts;
|
|
108
|
-
return await getPort({ port: preferredPorts });
|
|
17
|
+
const telemetryService = new TelemetryService(this.getConfigDir());
|
|
18
|
+
const commandMetadata = {
|
|
19
|
+
commandName: _a.id,
|
|
20
|
+
shell: this.config.shell
|
|
21
|
+
};
|
|
22
|
+
await telemetryService.trackEvent(new QuickstartInitiatedEvent(), commandMetadata.shell);
|
|
23
|
+
intro("Portal Quickstart");
|
|
24
|
+
const action = new PortalQuickstartAction(this.getConfigDir(), commandMetadata);
|
|
25
|
+
const result = await action.execute();
|
|
26
|
+
outro(result);
|
|
27
|
+
// TODO: Remove this, find a solution for tracking.
|
|
28
|
+
await result.mapAll(async () => await telemetryService.trackEvent(new QuickstartCompletedEvent(), commandMetadata.shell), () => new Promise(() => { }), () => new Promise(() => { }));
|
|
109
29
|
}
|
|
110
30
|
}
|
|
31
|
+
_a = PortalQuickstart;
|
|
111
32
|
PortalQuickstart.description = "Create your first API Portal using APIMatic's Docs as Code offering.";
|
|
112
|
-
PortalQuickstart.
|
|
33
|
+
PortalQuickstart.summary = "Get started with your first API Portal in four easy steps.";
|
|
34
|
+
PortalQuickstart.cmdTxt = format.cmd("apimatic", "portal", "quickstart");
|
|
35
|
+
PortalQuickstart.examples = [_a.cmdTxt];
|
|
113
36
|
export default PortalQuickstart;
|
|
114
37
|
//# sourceMappingURL=quickstart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/commands/portal/quickstart.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/commands/portal/quickstart.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAEtF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAqB,gBAAiB,SAAQ,OAAO;IAArD;;QA+BmB,iBAAY,GAAG,GAAG,EAAE;YACnC,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAClD,CAAC,CAAC;IACJ,CAAC;IAzBC,KAAK,CAAC,GAAG;QACP,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QACnE,MAAM,eAAe,GAAoB;YACvC,WAAW,EAAE,EAAgB,CAAC,EAAE;YAChC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;SACzB,CAAC;QAEF,MAAM,gBAAgB,CAAC,UAAU,CAAC,IAAI,wBAAwB,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;QAEzF,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3B,MAAM,MAAM,GAAG,IAAI,sBAAsB,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,eAAe,CAAC,CAAC;QAChF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACtC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,mDAAmD;QACnD,MAAM,MAAM,CAAC,MAAM,CACjB,KAAK,IAAI,EAAE,CAAC,MAAM,gBAAgB,CAAC,UAAU,CAAC,IAAI,wBAAwB,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,EACpG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,EAC3B,GAAG,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAC5B,CAAC;IACJ,CAAC;;;AA5BM,4BAAW,GAAG,sEAAsE,AAAzE,CAA0E;AAErF,wBAAO,GAAG,4DAA4D,AAA/D,CAAgE;AAEvE,uBAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,YAAY,CAAC,AAAjD,CAAkD;AAExD,yBAAQ,GAAG,CAAC,EAAI,CAAC,MAAM,CAAC,AAAhB,CAAiB;eAPb,gBAAgB"}
|
|
@@ -2,9 +2,11 @@ import { Command } from "@oclif/core";
|
|
|
2
2
|
export default class PortalRecipeNew extends Command {
|
|
3
3
|
static summary: string;
|
|
4
4
|
static description: string;
|
|
5
|
-
static examples: string[];
|
|
6
5
|
static flags: {
|
|
6
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
};
|
|
9
|
+
static readonly cmdTxt: string;
|
|
10
|
+
static readonly examples: string[];
|
|
9
11
|
run(): Promise<void>;
|
|
10
12
|
}
|
|
@@ -1,38 +1,46 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { Command, Flags } from "@oclif/core";
|
|
2
3
|
import { PortalRecipeAction } from "../../../actions/portal/recipe/new-recipe.js";
|
|
3
|
-
import { PortalRecipePrompts } from "../../../prompts/portal/recipe/new-recipe.js";
|
|
4
|
-
import { getMessageInRedColor } from "../../../utils/utils.js";
|
|
5
4
|
import { TelemetryService } from "../../../infrastructure/services/telemetry-service.js";
|
|
6
5
|
import { RecipeCreationFailedEvent } from "../../../types/events/recipe-creation-failed.js";
|
|
7
6
|
import { DirectoryPath } from "../../../types/file/directoryPath.js";
|
|
8
7
|
import { FlagsProvider } from "../../../types/flags-provider.js";
|
|
8
|
+
import { format, intro, outro } from "../../../prompts/format.js";
|
|
9
9
|
const DEFAULT_WORKING_DIRECTORY = "./";
|
|
10
10
|
class PortalRecipeNew extends Command {
|
|
11
11
|
async run() {
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
const { flags: { name, input, force } } = await this.parse(_a);
|
|
13
|
+
const workingDirectory = new DirectoryPath(input !== null && input !== void 0 ? input : DEFAULT_WORKING_DIRECTORY);
|
|
14
|
+
const buildDirectory = input ? new DirectoryPath(input, "src") : workingDirectory.join("src");
|
|
15
|
+
const commandMetadata = {
|
|
16
|
+
commandName: _a.id,
|
|
17
|
+
shell: this.config.shell
|
|
18
|
+
};
|
|
19
|
+
intro("New Recipe");
|
|
20
|
+
const action = new PortalRecipeAction(new DirectoryPath(this.config.configDir), commandMetadata);
|
|
21
|
+
const result = await action.execute(buildDirectory, name);
|
|
22
|
+
outro(result);
|
|
23
|
+
result.mapAll(() => { }, async () => {
|
|
24
|
+
const telemetryService = new TelemetryService(new DirectoryPath(this.config.configDir));
|
|
25
|
+
await telemetryService.trackEvent(new RecipeCreationFailedEvent("error", _a.id, {
|
|
26
|
+
name,
|
|
27
|
+
input,
|
|
28
|
+
force
|
|
29
|
+
}), commandMetadata.shell);
|
|
30
|
+
}, () => { });
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
|
-
|
|
31
|
-
PortalRecipeNew.
|
|
33
|
+
_a = PortalRecipeNew;
|
|
34
|
+
PortalRecipeNew.summary = "Add an API Recipe to your API documentation portal.";
|
|
35
|
+
PortalRecipeNew.description = `This command adds a new API Recipe file to your documentation portal.
|
|
36
|
+
|
|
37
|
+
To learn more about API Recipes, visit:
|
|
38
|
+
${format.link("https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes")}`;
|
|
39
|
+
PortalRecipeNew.flags = Object.assign(Object.assign({ name: Flags.string({ description: "name for the recipe" }) }, FlagsProvider.input), FlagsProvider.force);
|
|
40
|
+
PortalRecipeNew.cmdTxt = format.cmd("apimatic", "portal", "recipe", "new");
|
|
32
41
|
PortalRecipeNew.examples = [
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
`${_a.cmdTxt}`,
|
|
43
|
+
`${_a.cmdTxt} ${format.flag("name", '"My API Recipe"')} ${format.flag("input", '"./"')}`
|
|
35
44
|
];
|
|
36
|
-
PortalRecipeNew.flags = Object.assign({ name: Flags.string({ description: "name for the recipe" }) }, FlagsProvider.input);
|
|
37
45
|
export default PortalRecipeNew;
|
|
38
46
|
//# sourceMappingURL=new.js.map
|