@apimatic/cli 0.0.0-alpha.3 → 1.0.0-beta.1
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 +308 -130
- package/bin/run.js +5 -0
- package/lib/actions/action-result.d.ts +13 -0
- package/lib/actions/action-result.js +44 -0
- package/lib/actions/action-result.js.map +1 -0
- 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 +13 -0
- package/lib/actions/auth/login.js +55 -0
- package/lib/actions/auth/login.js.map +1 -0
- 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 +16 -0
- package/lib/actions/portal/copilot.js +89 -0
- package/lib/actions/portal/copilot.js.map +1 -0
- package/lib/actions/portal/generate.d.ts +13 -0
- package/lib/actions/portal/generate.js +59 -0
- package/lib/actions/portal/generate.js.map +1 -0
- 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 +15 -0
- package/lib/actions/portal/recipe/new-recipe.js +176 -0
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
- package/lib/actions/portal/serve.d.ts +16 -0
- package/lib/actions/portal/serve.js +119 -0
- package/lib/actions/portal/serve.js.map +1 -0
- package/lib/actions/portal/toc/new-toc.d.ts +21 -0
- package/lib/actions/portal/toc/new-toc.js +97 -0
- package/lib/actions/portal/toc/new-toc.js.map +1 -0
- package/lib/actions/sdk/generate.d.ts +13 -0
- package/lib/actions/sdk/generate.js +47 -0
- package/lib/actions/sdk/generate.js.map +1 -0
- package/lib/application/portal/recipe/portal-recipe.d.ts +8 -0
- package/lib/application/portal/recipe/portal-recipe.js +33 -0
- package/lib/application/portal/recipe/portal-recipe.js.map +1 -0
- package/lib/application/portal/recipe/recipe-generator.d.ts +21 -0
- package/lib/application/portal/recipe/recipe-generator.js +146 -0
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
- package/lib/application/portal/toc/toc-content-parser.d.ts +5 -0
- package/lib/application/portal/toc/toc-content-parser.js +44 -0
- package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
- package/lib/application/portal/toc/toc-structure-generator.d.ts +6 -0
- package/lib/application/portal/toc/toc-structure-generator.js +84 -0
- package/lib/application/portal/toc/toc-structure-generator.js.map +1 -0
- package/lib/client-utils/auth-manager.d.ts +8 -3
- package/lib/client-utils/auth-manager.js +26 -14
- package/lib/client-utils/auth-manager.js.map +1 -0
- package/lib/commands/api/transform.d.ts +11 -8
- package/lib/commands/api/transform.js +52 -105
- package/lib/commands/api/transform.js.map +1 -0
- package/lib/commands/api/validate.d.ts +8 -5
- package/lib/commands/api/validate.js +31 -63
- package/lib/commands/api/validate.js.map +1 -0
- package/lib/commands/auth/login.d.ts +4 -2
- package/lib/commands/auth/login.js +26 -51
- package/lib/commands/auth/login.js.map +1 -0
- package/lib/commands/auth/logout.d.ts +4 -2
- package/lib/commands/auth/logout.js +14 -20
- package/lib/commands/auth/logout.js.map +1 -0
- package/lib/commands/auth/status.d.ts +2 -1
- package/lib/commands/auth/status.js +18 -20
- package/lib/commands/auth/status.js.map +1 -0
- package/lib/commands/portal/copilot.d.ts +13 -0
- package/lib/commands/portal/copilot.js +34 -0
- package/lib/commands/portal/copilot.js.map +1 -0
- package/lib/commands/portal/generate.d.ts +9 -8
- package/lib/commands/portal/generate.js +31 -97
- package/lib/commands/portal/generate.js.map +1 -0
- package/lib/commands/portal/quickstart.d.ts +9 -0
- package/lib/commands/portal/quickstart.js +37 -0
- package/lib/commands/portal/quickstart.js.map +1 -0
- package/lib/commands/portal/recipe/new.d.ts +12 -0
- package/lib/commands/portal/recipe/new.js +46 -0
- package/lib/commands/portal/recipe/new.js.map +1 -0
- package/lib/commands/portal/serve.d.ts +16 -0
- package/lib/commands/portal/serve.js +54 -0
- package/lib/commands/portal/serve.js.map +1 -0
- package/lib/commands/portal/toc/new.d.ts +14 -0
- package/lib/commands/portal/toc/new.js +61 -0
- package/lib/commands/portal/toc/new.js.map +1 -0
- package/lib/commands/sdk/generate.d.ts +11 -9
- package/lib/commands/sdk/generate.js +48 -122
- package/lib/commands/sdk/generate.js.map +1 -0
- package/lib/config/axios-config.d.ts +2 -0
- package/lib/config/axios-config.js +10 -0
- package/lib/config/axios-config.js.map +1 -0
- package/lib/hooks/not-found.d.ts +3 -0
- package/lib/hooks/not-found.js +52 -0
- package/lib/hooks/not-found.js.map +1 -0
- package/lib/hooks/utils.d.ts +5 -0
- package/lib/hooks/utils.js +51 -0
- package/lib/hooks/utils.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -4
- package/lib/index.js.map +1 -0
- package/lib/infrastructure/api-utils.d.ts +9 -0
- package/lib/infrastructure/api-utils.js +34 -0
- package/lib/infrastructure/api-utils.js.map +1 -0
- package/lib/infrastructure/debounce-service.d.ts +10 -0
- package/lib/infrastructure/debounce-service.js +52 -0
- package/lib/infrastructure/debounce-service.js.map +1 -0
- package/lib/infrastructure/env-info.d.ts +12 -0
- package/lib/infrastructure/env-info.js +58 -0
- package/lib/infrastructure/env-info.js.map +1 -0
- package/lib/infrastructure/file-service.d.ts +23 -0
- package/lib/infrastructure/file-service.js +117 -0
- package/lib/infrastructure/file-service.js.map +1 -0
- package/lib/infrastructure/launcher-service.d.ts +7 -0
- package/lib/infrastructure/launcher-service.js +51 -0
- package/lib/infrastructure/launcher-service.js.map +1 -0
- 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 +10 -0
- package/lib/infrastructure/services/api-service.js +55 -0
- package/lib/infrastructure/services/api-service.js.map +1 -0
- package/lib/infrastructure/services/auth-service.d.ts +11 -0
- package/lib/infrastructure/services/auth-service.js +37 -0
- package/lib/infrastructure/services/auth-service.js.map +1 -0
- 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 +21 -0
- package/lib/infrastructure/services/portal-service.js +157 -0
- package/lib/infrastructure/services/portal-service.js.map +1 -0
- package/lib/infrastructure/services/telemetry-service.d.ts +9 -0
- package/lib/infrastructure/services/telemetry-service.js +38 -0
- package/lib/infrastructure/services/telemetry-service.js.map +1 -0
- 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/infrastructure/tmp-extensions.d.ts +2 -0
- package/lib/infrastructure/tmp-extensions.js +6 -0
- package/lib/infrastructure/tmp-extensions.js.map +1 -0
- package/lib/infrastructure/zip-service.d.ts +6 -0
- package/lib/infrastructure/zip-service.js +39 -0
- package/lib/infrastructure/zip-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 +10 -0
- package/lib/prompts/auth/login.js +22 -0
- package/lib/prompts/auth/login.js.map +1 -0
- 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 +18 -0
- package/lib/prompts/portal/copilot.js +82 -0
- package/lib/prompts/portal/copilot.js.map +1 -0
- package/lib/prompts/portal/generate.d.ts +13 -0
- package/lib/prompts/portal/generate.js +41 -0
- package/lib/prompts/portal/generate.js.map +1 -0
- package/lib/prompts/portal/quickstart.d.ts +31 -0
- package/lib/prompts/portal/quickstart.js +146 -0
- package/lib/prompts/portal/quickstart.js.map +1 -0
- package/lib/prompts/portal/recipe/new-recipe.d.ts +29 -0
- package/lib/prompts/portal/recipe/new-recipe.js +165 -0
- package/lib/prompts/portal/recipe/new-recipe.js.map +1 -0
- package/lib/prompts/portal/serve.d.ts +11 -0
- package/lib/prompts/portal/serve.js +33 -0
- package/lib/prompts/portal/serve.js.map +1 -0
- package/lib/prompts/portal/toc/new-toc.d.ts +15 -0
- package/lib/prompts/portal/toc/new-toc.js +37 -0
- package/lib/prompts/portal/toc/new-toc.js.map +1 -0
- package/lib/prompts/sdk/generate.d.ts +11 -0
- package/lib/prompts/sdk/generate.js +36 -0
- package/lib/prompts/sdk/generate.js.map +1 -0
- package/lib/types/api/account.d.ts +10 -0
- package/lib/types/api/account.js +2 -0
- package/lib/types/api/account.js.map +1 -0
- package/lib/types/api/transform.d.ts +17 -17
- package/lib/types/api/transform.js +21 -6
- package/lib/types/api/transform.js.map +1 -0
- package/lib/types/build/build.d.ts +22 -0
- package/lib/types/build/build.js +7 -0
- package/lib/types/build/build.js.map +1 -0
- package/lib/types/build-context.d.ts +17 -0
- package/lib/types/build-context.js +47 -0
- package/lib/types/build-context.js.map +1 -0
- 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 +8 -0
- package/lib/types/events/domain-event.js +11 -0
- package/lib/types/events/domain-event.js.map +1 -0
- package/lib/types/events/quickstart-completed.d.ts +7 -0
- package/lib/types/events/quickstart-completed.js +10 -0
- package/lib/types/events/quickstart-completed.js.map +1 -0
- package/lib/types/events/quickstart-initiated.d.ts +7 -0
- package/lib/types/events/quickstart-initiated.js +10 -0
- package/lib/types/events/quickstart-initiated.js.map +1 -0
- package/lib/types/events/recipe-creation-failed.d.ts +5 -0
- package/lib/types/events/recipe-creation-failed.js +8 -0
- package/lib/types/events/recipe-creation-failed.js.map +1 -0
- package/lib/types/events/toc-creation-failed.d.ts +5 -0
- package/lib/types/events/toc-creation-failed.js +8 -0
- package/lib/types/events/toc-creation-failed.js.map +1 -0
- 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 +9 -0
- package/lib/types/file/directoryPath.js +22 -0
- package/lib/types/file/directoryPath.js.map +1 -0
- package/lib/types/file/fileName.d.ts +7 -0
- package/lib/types/file/fileName.js +21 -0
- package/lib/types/file/fileName.js.map +1 -0
- package/lib/types/file/filePath.d.ts +10 -0
- package/lib/types/file/filePath.js +32 -0
- package/lib/types/file/filePath.js.map +1 -0
- 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/flags-provider.d.ts +15 -0
- package/lib/types/flags-provider.js +34 -0
- package/lib/types/flags-provider.js.map +1 -0
- package/lib/types/portal-context.d.ts +13 -0
- package/lib/types/portal-context.js +38 -0
- package/lib/types/portal-context.js.map +1 -0
- package/lib/types/recipe/recipe.d.ts +22 -0
- package/lib/types/recipe/recipe.js +6 -0
- package/lib/types/recipe/recipe.js.map +1 -0
- 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 +9 -21
- package/lib/types/sdk/generate.js +25 -12
- package/lib/types/sdk/generate.js.map +1 -0
- package/lib/types/sdk-context.d.ts +14 -0
- package/lib/types/sdk-context.js +32 -0
- package/lib/types/sdk-context.js.map +1 -0
- package/lib/types/sdl/sdl.d.ts +21 -0
- package/lib/types/sdl/sdl.js +47 -0
- package/lib/types/sdl/sdl.js.map +1 -0
- package/lib/types/spec-context.d.ts +10 -0
- package/lib/types/spec-context.js +17 -0
- package/lib/types/spec-context.js.map +1 -0
- 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/toc.d.ts +31 -0
- package/lib/types/toc/toc.js +9 -0
- package/lib/types/toc/toc.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 +1 -6
- package/lib/types/utils.js +2 -2
- package/lib/types/utils.js.map +1 -0
- 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 -18
- package/lib/utils/utils.js +33 -116
- package/lib/utils/utils.js.map +1 -0
- package/package.json +101 -46
- package/bin/run +0 -5
- package/lib/client-utils/sdk-client.d.ts +0 -23
- package/lib/client-utils/sdk-client.js +0 -119
- package/lib/config/env.d.ts +0 -1
- package/lib/config/env.js +0 -4
- package/lib/controllers/api/transform.d.ts +0 -5
- package/lib/controllers/api/transform.js +0 -49
- package/lib/controllers/api/validate.d.ts +0 -3
- package/lib/controllers/api/validate.js +0 -22
- package/lib/controllers/portal/generate.d.ts +0 -2
- package/lib/controllers/portal/generate.js +0 -49
- package/lib/controllers/sdk/generate.d.ts +0 -4
- package/lib/controllers/sdk/generate.js +0 -64
- package/lib/types/api/validate.d.ts +0 -12
- package/lib/types/api/validate.js +0 -2
- package/lib/types/portal/generate.d.ts +0 -9
- package/lib/types/portal/generate.js +0 -2
- package/oclif.manifest.json +0 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { isCancel, log, multiselect, note, select, text } from "@clack/prompts";
|
|
2
|
+
import { format as f, getTree, withSpinner } from "../format.js";
|
|
3
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
4
|
+
import { removeQuotes } from "../../utils/string-utils.js";
|
|
5
|
+
import { getErrorMessage } from "../../infrastructure/api-utils.js";
|
|
6
|
+
import { createResourceInputFromInput } from "../../types/file/resource-input.js";
|
|
7
|
+
const vscodeExtensionUrl = "https://marketplace.visualstudio.com/items?itemName=apimatic-developers.apimatic-for-vscode";
|
|
8
|
+
const referenceDocumentationUrl = "https://docs.apimatic.io/cli-getting-started/advanced-portal-setup";
|
|
9
|
+
const defaultPortalDirectoryPath = process.cwd();
|
|
10
|
+
export class PortalQuickstartPrompts {
|
|
11
|
+
welcomeMessage() {
|
|
12
|
+
log.info(`Welcome to the Portal Quickstart Wizard.`);
|
|
13
|
+
const message = `This wizard will help you set up an API Portal via APIMatic's Docs as Code workflow in 4 simple steps.
|
|
14
|
+
|
|
15
|
+
Let's get started!`;
|
|
16
|
+
log.message(message);
|
|
17
|
+
}
|
|
18
|
+
importSpecStep() {
|
|
19
|
+
log.info(`Step 1 of 4: Import your OpenAPI Definition`);
|
|
20
|
+
}
|
|
21
|
+
async specPathPrompt(defaultSpecUrl) {
|
|
22
|
+
const spec = await text({
|
|
23
|
+
message: `Provide a local path or a public URL for your OpenAPI definition file:`,
|
|
24
|
+
placeholder: "Provide absolute URL/local path or press Enter to use a sample OpenAPI file from APIMatic.",
|
|
25
|
+
defaultValue: defaultSpecUrl.toString(),
|
|
26
|
+
validate: (value) => {
|
|
27
|
+
if (value && !createResourceInputFromInput(value)) {
|
|
28
|
+
return "Please enter a valid file path or URL.";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
if (isCancel(spec)) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
return createResourceInputFromInput(spec);
|
|
36
|
+
}
|
|
37
|
+
specFileDoesNotExist() {
|
|
38
|
+
log.error("The specified file does not exist or is not a valid file. Please enter a valid file path.");
|
|
39
|
+
}
|
|
40
|
+
noSpecSpecified() {
|
|
41
|
+
log.error("No API definition was provided.");
|
|
42
|
+
}
|
|
43
|
+
async useDefaultSpecPrompt() {
|
|
44
|
+
const useDefaultSpec = await select({
|
|
45
|
+
message: `How would you like to proceed?`,
|
|
46
|
+
options: [
|
|
47
|
+
{
|
|
48
|
+
value: "no",
|
|
49
|
+
label: `1. Fix the issues using APIMatic's interactive VS Code Extension: ${vscodeExtensionUrl}`
|
|
50
|
+
},
|
|
51
|
+
{ value: "yes", label: `2. Use an example API spec instead (recommended)` }
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
if (isCancel(useDefaultSpec)) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return useDefaultSpec === "yes";
|
|
58
|
+
}
|
|
59
|
+
fixYourSpec() {
|
|
60
|
+
const message = `Good luck fixing your API definition! Feel free to run this command again once you're done.`;
|
|
61
|
+
log.info(message);
|
|
62
|
+
}
|
|
63
|
+
validateSpecStep() {
|
|
64
|
+
log.info(`Step 2 of 4: Validate and Lint your OpenAPI file`);
|
|
65
|
+
}
|
|
66
|
+
selectLanguagesStep() {
|
|
67
|
+
log.info(`Step 3 of 4: Select programming languages`);
|
|
68
|
+
}
|
|
69
|
+
async selectLanguagesPrompt() {
|
|
70
|
+
const languages = (await multiselect({
|
|
71
|
+
message: "Your API Portal will contain SDKs and SDK Documentation in the following Languages. Press enter to continue with all languages, or use the arrow keys and space to customize your selection:",
|
|
72
|
+
options: [
|
|
73
|
+
{ label: "Typescript", value: "typescript" },
|
|
74
|
+
{ label: "Ruby", value: "ruby" },
|
|
75
|
+
{ label: "Python", value: "python" },
|
|
76
|
+
{ label: "Java", value: "java" },
|
|
77
|
+
{ label: "C#", value: "csharp" },
|
|
78
|
+
{ label: "PHP", value: "php" },
|
|
79
|
+
{ label: "Go", value: "go" }
|
|
80
|
+
],
|
|
81
|
+
initialValues: ["typescript", "ruby", "python", "java", "csharp", "php", "go"]
|
|
82
|
+
}));
|
|
83
|
+
if (isCancel(languages)) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
return ["http", ...languages];
|
|
87
|
+
}
|
|
88
|
+
noLanguagesSelected() {
|
|
89
|
+
log.error("No programming languages were selected.");
|
|
90
|
+
}
|
|
91
|
+
selectInputDirectoryStep() {
|
|
92
|
+
log.info(`Step 4 of 4: Generate source files for Docs as Code`);
|
|
93
|
+
}
|
|
94
|
+
async inputDirectoryPathPrompt() {
|
|
95
|
+
var _a;
|
|
96
|
+
const inputDirectory = await text({
|
|
97
|
+
message: "Enter the directory path where you would like to setup the API Portal (Requires an empty directory):",
|
|
98
|
+
placeholder: "Provide absolute path to the directory or press Enter to use the current directory.",
|
|
99
|
+
defaultValue: "./"
|
|
100
|
+
});
|
|
101
|
+
if (isCancel(inputDirectory)) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
const cleanedPath = removeQuotes((_a = inputDirectory === null || inputDirectory === void 0 ? void 0 : inputDirectory.trim()) !== null && _a !== void 0 ? _a : "");
|
|
105
|
+
const directoryPath = new DirectoryPath(cleanedPath);
|
|
106
|
+
if (inputDirectory === "./") {
|
|
107
|
+
return new DirectoryPath(defaultPortalDirectoryPath);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
return directoryPath;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
inputDirectoryPathDoesNotExist(inputDirectory) {
|
|
114
|
+
log.error(`The specified directory path ${f.path(inputDirectory)} does not exist.`);
|
|
115
|
+
}
|
|
116
|
+
inputDirectoryNotEmpty(inputDirectory) {
|
|
117
|
+
log.error(`The target directory ${f.path(inputDirectory)} is not empty. Please provide a path to an empty directory or clear its contents.`);
|
|
118
|
+
}
|
|
119
|
+
noInputDirectoryProvided() {
|
|
120
|
+
log.error("No source directory was provided.");
|
|
121
|
+
}
|
|
122
|
+
downloadBuildDirectory(fn) {
|
|
123
|
+
return withSpinner("Setting up source directory", `Source directory set up successfully`, "Unable to set up source directory", fn);
|
|
124
|
+
}
|
|
125
|
+
downloadSpecFile(fn) {
|
|
126
|
+
return withSpinner("Downloading Spec file", `Spec file downloaded`, "Unable to download spec file", fn);
|
|
127
|
+
}
|
|
128
|
+
nextSteps() {
|
|
129
|
+
const message = `- Use the API Playground or an SDK to call your API.
|
|
130
|
+
- Customize the Portal theme, add API recipes and enable AI features
|
|
131
|
+
${f.link(referenceDocumentationUrl)}`;
|
|
132
|
+
note(message, "Next steps");
|
|
133
|
+
}
|
|
134
|
+
serviceError(error) {
|
|
135
|
+
log.error(getErrorMessage(error));
|
|
136
|
+
}
|
|
137
|
+
printDirectoryStructure(inputDirectory, directory) {
|
|
138
|
+
const heading = `${f.var('src')} directory containing source files created at ${f.path(inputDirectory)}\n`;
|
|
139
|
+
const message = getTree(directory.toTreeNode());
|
|
140
|
+
log.info(heading + message);
|
|
141
|
+
}
|
|
142
|
+
specValidationFailed() {
|
|
143
|
+
log.error(`Oops, it looks like there are some errors in your API Definition`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# s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,CAAC,UAAU,EAAE,CAAC,CAAC;QAChD,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC;IAC9B,CAAC;IAEM,oBAAoB;QACzB,GAAG,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;IAChF,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Sdl, SdlEndpoint } from "../../../types/sdl/sdl.js";
|
|
2
|
+
import { DirectoryPath } from "../../../types/file/directoryPath.js";
|
|
3
|
+
import { TreeNode } from "../../format.js";
|
|
4
|
+
import { StepType } from "../../../types/recipe/recipe.js";
|
|
5
|
+
import { ServiceError } from "../../../infrastructure/api-utils.js";
|
|
6
|
+
import { Result } from "neverthrow";
|
|
7
|
+
export declare class PortalRecipePrompts {
|
|
8
|
+
displayWelcomeMessage(): void;
|
|
9
|
+
recipeNameEmpty(): void;
|
|
10
|
+
contentFolderNotFound(): void;
|
|
11
|
+
specFileEmptyInvalid(): void;
|
|
12
|
+
recipeNamePrompt(): Promise<string | undefined>;
|
|
13
|
+
stepNamePrompt(defaultStepName: string): Promise<string | undefined>;
|
|
14
|
+
displayStepsInformation(): void;
|
|
15
|
+
stepTypeSelectionPrompt(): Promise<StepType | undefined>;
|
|
16
|
+
endpointGroupNamePrompt(endpointGroups: Map<string, SdlEndpoint[]>): Promise<string | undefined>;
|
|
17
|
+
endpointNamePrompt(endpointGroups: Map<string, SdlEndpoint[]>, endpointGroupName: string): Promise<string | undefined>;
|
|
18
|
+
endpointDescriptionPrompt(defaultDescription: string): Promise<string | undefined>;
|
|
19
|
+
addAnotherStepSelectionPrompt(): Promise<boolean>;
|
|
20
|
+
overwriteApiRecipeInTocPrompt(name: string): Promise<boolean>;
|
|
21
|
+
displayStepAddedSuccessfullyMessage(): void;
|
|
22
|
+
invalidBuildDirectory(directory: DirectoryPath): void;
|
|
23
|
+
serviceError(serviceError: ServiceError): void;
|
|
24
|
+
openRecipeMarkdownEditor(): void;
|
|
25
|
+
displayRecipeStructure(tocStructure: TreeNode): void;
|
|
26
|
+
nextSteps(): void;
|
|
27
|
+
generateSdl(fn: Promise<Result<Sdl, ServiceError>>): Promise<Result<Sdl, ServiceError>>;
|
|
28
|
+
recipeCreated(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { select, text, isCancel, log, autocomplete, confirm, note } from "@clack/prompts";
|
|
2
|
+
import { format as f, getTree, withSpinner } from "../../format.js";
|
|
3
|
+
import { getErrorMessage } from "../../../infrastructure/api-utils.js";
|
|
4
|
+
export class PortalRecipePrompts {
|
|
5
|
+
displayWelcomeMessage() {
|
|
6
|
+
log.step(`Welcome to the API Recipe Generation Wizard.`);
|
|
7
|
+
const message = `This wizard will guide you through the process of creating an API Recipe.
|
|
8
|
+
|
|
9
|
+
An API Recipe is a collection of steps that allows you to define a single use case for your API Documentation portal.
|
|
10
|
+
Learn more: ${f.link("https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes")}
|
|
11
|
+
|
|
12
|
+
Let's get started!`;
|
|
13
|
+
log.info(message);
|
|
14
|
+
}
|
|
15
|
+
recipeNameEmpty() {
|
|
16
|
+
const message = "No recipe name provided";
|
|
17
|
+
log.error(message);
|
|
18
|
+
}
|
|
19
|
+
contentFolderNotFound() {
|
|
20
|
+
const message = "Content folder not found.";
|
|
21
|
+
log.error(message);
|
|
22
|
+
}
|
|
23
|
+
specFileEmptyInvalid() {
|
|
24
|
+
const message = "Spec file is empty or invalid.";
|
|
25
|
+
log.error(message);
|
|
26
|
+
}
|
|
27
|
+
async recipeNamePrompt() {
|
|
28
|
+
const recipeName = await text({
|
|
29
|
+
message: `Enter a name for your API Recipe:`,
|
|
30
|
+
placeholder: "This name will be displayed in your API Documentation portal sidebar.",
|
|
31
|
+
validate: (name) => {
|
|
32
|
+
if (!name) {
|
|
33
|
+
return "Recipe name cannot be empty. Please provide a name for your API Recipe.";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
if (isCancel(recipeName)) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return recipeName.trim();
|
|
41
|
+
}
|
|
42
|
+
async stepNamePrompt(defaultStepName) {
|
|
43
|
+
const stepName = await text({
|
|
44
|
+
message: `Enter a name for the step:`,
|
|
45
|
+
defaultValue: defaultStepName,
|
|
46
|
+
placeholder: `Press enter to use the default, i.e. ${defaultStepName}`
|
|
47
|
+
});
|
|
48
|
+
if (isCancel(stepName)) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return stepName.trim();
|
|
52
|
+
}
|
|
53
|
+
displayStepsInformation() {
|
|
54
|
+
log.step(`Add Steps to your API Recipe:`);
|
|
55
|
+
const message = `You can add:
|
|
56
|
+
1. Content Step: Display custom content, such as instructions or information related to your API.
|
|
57
|
+
2. Endpoint Step: Display an API endpoint, its playground and other relevant details.
|
|
58
|
+
Steps appear in the order you add them.
|
|
59
|
+
Let's proceed to adding steps to your API Recipe.`;
|
|
60
|
+
log.message(message);
|
|
61
|
+
}
|
|
62
|
+
async stepTypeSelectionPrompt() {
|
|
63
|
+
const stepType = await select({
|
|
64
|
+
message: `Select the type of step you want to add:`,
|
|
65
|
+
options: [
|
|
66
|
+
{ value: "content", label: "Content Step", hint: "For displaying custom content" },
|
|
67
|
+
{ value: "endpoint", label: "Endpoint Step", hint: "For displaying an API endpoint with its details" }
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
if (isCancel(stepType)) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
return stepType;
|
|
74
|
+
}
|
|
75
|
+
async endpointGroupNamePrompt(endpointGroups) {
|
|
76
|
+
const groupNames = Array.from(endpointGroups.keys()).map((name) => ({
|
|
77
|
+
value: name,
|
|
78
|
+
label: name
|
|
79
|
+
}));
|
|
80
|
+
const endpointGroupName = await autocomplete({
|
|
81
|
+
message: `Select the endpoint group name:`,
|
|
82
|
+
maxItems: 10,
|
|
83
|
+
options: groupNames
|
|
84
|
+
});
|
|
85
|
+
if (isCancel(endpointGroupName)) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
return endpointGroupName.trim();
|
|
89
|
+
}
|
|
90
|
+
async endpointNamePrompt(endpointGroups, endpointGroupName) {
|
|
91
|
+
const endpoints = endpointGroups.get(endpointGroupName);
|
|
92
|
+
const endpointName = await autocomplete({
|
|
93
|
+
message: `Select the name of the endpoint:`,
|
|
94
|
+
maxItems: 10,
|
|
95
|
+
options: endpoints.map((endpoint) => ({
|
|
96
|
+
value: endpoint.Name,
|
|
97
|
+
label: endpoint.Name
|
|
98
|
+
}))
|
|
99
|
+
});
|
|
100
|
+
if (isCancel(endpointName)) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
return endpointName.trim();
|
|
104
|
+
}
|
|
105
|
+
async endpointDescriptionPrompt(defaultDescription) {
|
|
106
|
+
const endpointDescription = await text({
|
|
107
|
+
message: `Enter a description for the endpoint:`,
|
|
108
|
+
placeholder: `Optional. Leave this empty to use the endpoint description defined in the API Specification`,
|
|
109
|
+
defaultValue: defaultDescription
|
|
110
|
+
});
|
|
111
|
+
if (isCancel(endpointDescription)) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
return endpointDescription.trim();
|
|
115
|
+
}
|
|
116
|
+
async addAnotherStepSelectionPrompt() {
|
|
117
|
+
const addAnotherStep = await confirm({
|
|
118
|
+
message: `Do you want to add another step?`,
|
|
119
|
+
initialValue: true
|
|
120
|
+
});
|
|
121
|
+
if (isCancel(addAnotherStep)) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return addAnotherStep;
|
|
125
|
+
}
|
|
126
|
+
async overwriteApiRecipeInTocPrompt(name) {
|
|
127
|
+
const overwrite = await confirm({
|
|
128
|
+
message: `An API Recipe with name ${f.var(name)} already exists. Do you want to overwrite it?`,
|
|
129
|
+
initialValue: false
|
|
130
|
+
});
|
|
131
|
+
if (isCancel(overwrite)) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
return overwrite;
|
|
135
|
+
}
|
|
136
|
+
displayStepAddedSuccessfullyMessage() {
|
|
137
|
+
log.step(`Step has been added successfully.`);
|
|
138
|
+
}
|
|
139
|
+
invalidBuildDirectory(directory) {
|
|
140
|
+
const message = `The ${f.var("src")} directory is either empty or invalid: ${f.path(directory)}`;
|
|
141
|
+
log.error(message);
|
|
142
|
+
}
|
|
143
|
+
serviceError(serviceError) {
|
|
144
|
+
log.error(getErrorMessage(serviceError));
|
|
145
|
+
}
|
|
146
|
+
openRecipeMarkdownEditor() {
|
|
147
|
+
log.step("Opening markdown editor for you to enter recipe content...");
|
|
148
|
+
}
|
|
149
|
+
displayRecipeStructure(tocStructure) {
|
|
150
|
+
const heading = `You can edit the following files to customize your API Recipe:\n`;
|
|
151
|
+
const message = getTree(tocStructure);
|
|
152
|
+
log.info(heading + message);
|
|
153
|
+
}
|
|
154
|
+
nextSteps() {
|
|
155
|
+
const message = `Run the command '${f.cmdAlt(`apimatic`, 'portal', 'serve')}' to preview your documentation portal`;
|
|
156
|
+
note(message, "Next Steps");
|
|
157
|
+
}
|
|
158
|
+
generateSdl(fn) {
|
|
159
|
+
return withSpinner("Extracting endpoints", "Endpoints extracted", "Endpoints extraction failed", fn);
|
|
160
|
+
}
|
|
161
|
+
recipeCreated() {
|
|
162
|
+
log.info(`A new API Recipe has been created successfully.`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=new-recipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-recipe.js","sourceRoot":"","sources":["../../../../src/prompts/portal/recipe/new-recipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG1F,OAAO,EAAE,MA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W,CAChB,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,EAAE,CACH,CAAC;IACJ,CAAC;IAEM,aAAa;QAClB,GAAG,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;IAC9D,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UrlPath } from "../../types/file/urlPath.js";
|
|
2
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
3
|
+
export declare class PortalServePrompts {
|
|
4
|
+
usingFallbackPort(currentPort: number, availablePort: number): void;
|
|
5
|
+
portalServed(urlPath: UrlPath): void;
|
|
6
|
+
promptForExit(): void;
|
|
7
|
+
changesDetected(): void;
|
|
8
|
+
watcherError(): void;
|
|
9
|
+
blockExecution(): Promise<void>;
|
|
10
|
+
hotReloadEnabled(srcDirectory: DirectoryPath): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { log, note } from "@clack/prompts";
|
|
2
|
+
import { format as f } from "../format.js";
|
|
3
|
+
import { once } from "events";
|
|
4
|
+
export class PortalServePrompts {
|
|
5
|
+
usingFallbackPort(currentPort, availablePort) {
|
|
6
|
+
const message = `Port ${f.var(currentPort.toString())} is already in use. Available port ${f.var(availablePort.toString())} will be used.`;
|
|
7
|
+
log.step(message);
|
|
8
|
+
}
|
|
9
|
+
portalServed(urlPath) {
|
|
10
|
+
const message = `The portal is running at ${f.link(urlPath.toString())}`;
|
|
11
|
+
log.message(message);
|
|
12
|
+
}
|
|
13
|
+
promptForExit() {
|
|
14
|
+
const message = "Press CTRL+C to stop the server.";
|
|
15
|
+
log.message(message);
|
|
16
|
+
}
|
|
17
|
+
changesDetected() {
|
|
18
|
+
const message = "Changes detected...";
|
|
19
|
+
log.info(message);
|
|
20
|
+
}
|
|
21
|
+
watcherError() {
|
|
22
|
+
const message = `An unexpected error occurred while watching your build folder for changes. Please try again later. If the issue persists, contact our team at ${f.var('support@apimatic.io')}`;
|
|
23
|
+
log.error(message);
|
|
24
|
+
}
|
|
25
|
+
async blockExecution() {
|
|
26
|
+
await Promise.race([once(process, "SIGINT"), once(process, "SIGTERM")]);
|
|
27
|
+
}
|
|
28
|
+
hotReloadEnabled(srcDirectory) {
|
|
29
|
+
note(`Hot reload is enabled.
|
|
30
|
+
Watching the directory ${f.path(srcDirectory)} for any changes`, `Note`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/prompts/portal/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,MAAM,OAAO,kBAAkB;IACtB,iBAAiB,CAAC,WAAmB,EAAE,aAAqB;QACjE,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,sCAAsC,CAAC,CAAC,GAAG,CAC9F,aAAa,CAAC,QAAQ,EAAE,CACzB,gBAAgB,CAAC;QAClB,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC;IAEM,YAAY,CAAC,OAAgB;QAClC,MAAM,OAAO,GAAG,4BAA4B,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;QACzE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAEM,aAAa;QAClB,MAAM,OAAO,GAAG,kCAAkC,CAAC;QACnD,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAEM,eAAe;QACpB,MAAM,OAAO,GAAG,qBAAqB,CAAC;QACtC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC;IAEM,YAAY;QACjB,MAAM,OAAO,GACX,iJAAiJ,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,CAAC;QAClL,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,cAAc;QACzB,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;IAEM,gBAAgB,CAAC,YAA2B;QACjD,IAAI,CAAC;yBACgB,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FilePath } from "../../../types/file/filePath.js";
|
|
2
|
+
import { Result } from "neverthrow";
|
|
3
|
+
import { DirectoryPath } from "../../../types/file/directoryPath.js";
|
|
4
|
+
import { ServiceError } from "../../../infrastructure/api-utils.js";
|
|
5
|
+
import { Sdl } from "../../../types/sdl/sdl.js";
|
|
6
|
+
export declare class PortalNewTocPrompts {
|
|
7
|
+
overwriteToc(tocPath: FilePath): Promise<boolean>;
|
|
8
|
+
fallingBackToDefault(): void;
|
|
9
|
+
tocFileAlreadyExists(): void;
|
|
10
|
+
logError(message: string): void;
|
|
11
|
+
contentDirectoryNotFound(contentFolderPath: DirectoryPath): void;
|
|
12
|
+
invalidBuildDirectory(directory: DirectoryPath): void;
|
|
13
|
+
extractEndpointGroupsAndModels(fn: Promise<Result<Sdl, ServiceError>>): Promise<Result<Sdl, ServiceError>>;
|
|
14
|
+
tocCreated(tocPath: FilePath): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { confirm, isCancel, log } from "@clack/prompts";
|
|
2
|
+
import { format as f, withSpinner } from "../../format.js";
|
|
3
|
+
export class PortalNewTocPrompts {
|
|
4
|
+
async overwriteToc(tocPath) {
|
|
5
|
+
const overwrite = await confirm({
|
|
6
|
+
message: `The destination file ${f.path(tocPath)} already exists, do you want to overwrite it?`,
|
|
7
|
+
initialValue: false
|
|
8
|
+
});
|
|
9
|
+
if (isCancel(overwrite)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return overwrite;
|
|
13
|
+
}
|
|
14
|
+
fallingBackToDefault() {
|
|
15
|
+
log.warn(`Falling back to the default TOC structure.`);
|
|
16
|
+
}
|
|
17
|
+
tocFileAlreadyExists() {
|
|
18
|
+
log.error(`Please enter a different destination path or delete the existing toc.yml file and try again.`);
|
|
19
|
+
}
|
|
20
|
+
logError(message) {
|
|
21
|
+
log.error(message);
|
|
22
|
+
}
|
|
23
|
+
contentDirectoryNotFound(contentFolderPath) {
|
|
24
|
+
log.error(`Content folder not found at: ${contentFolderPath}`);
|
|
25
|
+
}
|
|
26
|
+
invalidBuildDirectory(directory) {
|
|
27
|
+
const message = `The ${f.var("src")} directory is either empty or invalid: ${f.path(directory)}`;
|
|
28
|
+
log.error(message);
|
|
29
|
+
}
|
|
30
|
+
extractEndpointGroupsAndModels(fn) {
|
|
31
|
+
return withSpinner("Extracting endpoint groups and models", "Endpoint groups and models extracted", "Endpoint groups and models extraction failed", fn);
|
|
32
|
+
}
|
|
33
|
+
tocCreated(tocPath) {
|
|
34
|
+
log.info(`The TOC file successfully created at: ${f.path(tocPath)}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=new-toc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-toc.js","sourceRoot":"","sources":["../../../../src/prompts/portal/toc/new-toc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGxD,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,WAAW,EAAE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ryPath } from "../../types/file/directoryPath.js";
|
|
2
|
+
import { Result } from "neverthrow";
|
|
3
|
+
export declare class SdkGeneratePrompts {
|
|
4
|
+
overwriteSdk(directory: DirectoryPath): Promise<boolean>;
|
|
5
|
+
sameSpecAndSdkDir(directory: DirectoryPath): void;
|
|
6
|
+
invalidSpecDirectory(directory: DirectoryPath): void;
|
|
7
|
+
destinationDirNotEmpty(): void;
|
|
8
|
+
generateSDK(fn: Promise<Result<NodeJS.ReadableStream, string>>): Promise<Result<NodeJS.ReadableStream, string>>;
|
|
9
|
+
logGenerationError(error: string): void;
|
|
10
|
+
sdkGenerated(sdk: DirectoryPath): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isCancel, confirm, log } from "@clack/prompts";
|
|
2
|
+
import { format as f, withSpinner } from "../format.js";
|
|
3
|
+
export class SdkGeneratePrompts {
|
|
4
|
+
async overwriteSdk(directory) {
|
|
5
|
+
const overwrite = await confirm({
|
|
6
|
+
message: `The destination ${f.path(directory)} is not empty, do you want to overwrite?`,
|
|
7
|
+
initialValue: false
|
|
8
|
+
});
|
|
9
|
+
if (isCancel(overwrite)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return overwrite;
|
|
13
|
+
}
|
|
14
|
+
sameSpecAndSdkDir(directory) {
|
|
15
|
+
const message = `The ${f.var("src")} and ${f.var("portal")} directories must be different. Current value: ${f.path(directory)}`;
|
|
16
|
+
this.logGenerationError(message);
|
|
17
|
+
}
|
|
18
|
+
invalidSpecDirectory(directory) {
|
|
19
|
+
const message = `The ${f.var("src")} directory is either empty or invalid: ${f.path(directory)}`;
|
|
20
|
+
this.logGenerationError(message);
|
|
21
|
+
}
|
|
22
|
+
destinationDirNotEmpty() {
|
|
23
|
+
const message = `Please enter a different destination folder or remove the existing files and try again.`;
|
|
24
|
+
this.logGenerationError(message);
|
|
25
|
+
}
|
|
26
|
+
generateSDK(fn) {
|
|
27
|
+
return withSpinner("Generating SDK", "SDK generated successfully.", "SDK Generation failed.", fn);
|
|
28
|
+
}
|
|
29
|
+
logGenerationError(error) {
|
|
30
|
+
log.error(error);
|
|
31
|
+
}
|
|
32
|
+
sdkGenerated(sdk) {
|
|
33
|
+
log.info(`Generated SDK can be found at ${f.path(sdk)}.`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/prompts/sdk/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGxD,MAAM,OAAO,kBAAkB;IACtB,KAAK,CAAC,YAAY,CAAC,SAAwB;QAChD,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC;YAC9B,OAAO,EAAE,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,0CAA0C;YACvF,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,iBAAiB,CAAC,SAAwB;QAChD,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,kDAAkD,CAAC,CAAC,IAAI,CAC/G,SAAS,CACV,EAAE,CAAC;QAAI,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAEM,oBAAoB,CAAC,SAAwB;QAClD,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACjG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAEM,sBAAsB;QAC3B,MAAM,OAAO,GAAG,yFAAyF,CAAC;QAC1G,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAEM,WAAW,CAAC,EAAkD;QACnE,OAAO,WAAW,CAAC,gBAAgB,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,EAAE,CAAC,CAAC;IACpG,CAAC;IAEM,kBAAkB,CAAC,KAAa;QACrC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAEM,YAAY,CAAC,GAAkB;QACpC,GAAG,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/types/api/account.ts"],"names":[],"mappings":""}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { TransformationController } from "@apimatic/sdk";
|
|
3
|
-
export declare type AuthenticationError = {
|
|
4
|
-
statusCode: number;
|
|
5
|
-
body: string;
|
|
6
|
-
};
|
|
7
|
-
export declare type TransformationIdParams = {
|
|
8
|
-
file: string;
|
|
9
|
-
url: string;
|
|
10
|
-
format: string;
|
|
11
|
-
};
|
|
12
|
-
export declare type DownloadTransformationParams = {
|
|
13
|
-
id: string;
|
|
14
|
-
destinationFilePath: string;
|
|
15
|
-
transformationController: TransformationController;
|
|
16
|
-
};
|
|
17
|
-
export declare type TransformationData = {
|
|
1
|
+
export type TransformationData = {
|
|
18
2
|
result: NodeJS.ReadableStream | Blob;
|
|
19
3
|
};
|
|
20
4
|
export declare const DestinationFormats: {
|
|
@@ -32,3 +16,19 @@ export declare const DestinationFormats: {
|
|
|
32
16
|
Postman20: string;
|
|
33
17
|
GraphQlSchema: string;
|
|
34
18
|
};
|
|
19
|
+
export declare enum TransformationFormats {
|
|
20
|
+
apimatic = "Apimatic",
|
|
21
|
+
wadl2009 = "Wadl2009",
|
|
22
|
+
wsdl = "Wsdl",
|
|
23
|
+
swagger10 = "Swagger10",
|
|
24
|
+
swagger20 = "Swagger20",
|
|
25
|
+
swaggeryaml = "Swaggeryaml",
|
|
26
|
+
oas3 = "Oas3",
|
|
27
|
+
openapi3yaml = "Openapi3Yaml",
|
|
28
|
+
apiblueprint = "Apiblueprint",
|
|
29
|
+
raml = "Raml",
|
|
30
|
+
raml10 = "Raml10",
|
|
31
|
+
postman10 = "Postman10",
|
|
32
|
+
postman20 = "Postman20",
|
|
33
|
+
graphqlschema = "Graphqlschema"
|
|
34
|
+
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DestinationFormats = void 0;
|
|
4
|
-
exports.DestinationFormats = {
|
|
1
|
+
export const DestinationFormats = {
|
|
5
2
|
OpenApi3Json: "json",
|
|
6
3
|
OpenApi3Yaml: "yaml",
|
|
7
4
|
APIMATIC: "json",
|
|
@@ -10,9 +7,27 @@ exports.DestinationFormats = {
|
|
|
10
7
|
Swagger10: "json",
|
|
11
8
|
Swagger20: "json",
|
|
12
9
|
SwaggerYaml: "yaml",
|
|
13
|
-
RAML: "
|
|
14
|
-
RAML10: "
|
|
10
|
+
RAML: "raml",
|
|
11
|
+
RAML10: "raml",
|
|
15
12
|
Postman10: "json",
|
|
16
13
|
Postman20: "json",
|
|
17
14
|
GraphQlSchema: "json"
|
|
18
15
|
};
|
|
16
|
+
export var TransformationFormats;
|
|
17
|
+
(function (TransformationFormats) {
|
|
18
|
+
TransformationFormats["apimatic"] = "Apimatic";
|
|
19
|
+
TransformationFormats["wadl2009"] = "Wadl2009";
|
|
20
|
+
TransformationFormats["wsdl"] = "Wsdl";
|
|
21
|
+
TransformationFormats["swagger10"] = "Swagger10";
|
|
22
|
+
TransformationFormats["swagger20"] = "Swagger20";
|
|
23
|
+
TransformationFormats["swaggeryaml"] = "Swaggeryaml";
|
|
24
|
+
TransformationFormats["oas3"] = "Oas3";
|
|
25
|
+
TransformationFormats["openapi3yaml"] = "Openapi3Yaml";
|
|
26
|
+
TransformationFormats["apiblueprint"] = "Apiblueprint";
|
|
27
|
+
TransformationFormats["raml"] = "Raml";
|
|
28
|
+
TransformationFormats["raml10"] = "Raml10";
|
|
29
|
+
TransformationFormats["postman10"] = "Postman10";
|
|
30
|
+
TransformationFormats["postman20"] = "Postman20";
|
|
31
|
+
TransformationFormats["graphqlschema"] = "Graphqlschema";
|
|
32
|
+
})(TransformationFormats || (TransformationFormats = {}));
|
|
33
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/types/api/transform.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,YAAY,EAAE,MAAM;IACpB,YAAY,EAAE,MAAM;IACpB,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,KAAK;IACX,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,MAAM;CACtB,CAAC;AAEF,MAAM,CAAN,IAAY,qBAeX;AAfD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;IACrB,sCAAa,CAAA;IACb,gDAAuB,CAAA;IACvB,gDAAuB,CAAA;IACvB,oDAA2B,CAAA;IAC3B,sCAAa,CAAA;IACb,sDAA6B,CAAA;IAC7B,sDAA6B,CAAA;IAC7B,sCAAa,CAAA;IACb,0CAAiB,CAAA;IACjB,gDAAuB,CAAA;IACvB,gDAAuB,CAAA;IACvB,wDAA+B,CAAA;AACjC,CAAC,EAfW,qBAAqB,KAArB,qBAAqB,QAehC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DirectoryPath } from "../file/directoryPath.js";
|
|
2
|
+
export interface BuildConfig {
|
|
3
|
+
generatePortal?: PortalConfig;
|
|
4
|
+
apiCopilotConfig?: CopilotConfig;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface PortalConfig {
|
|
8
|
+
contentFolder?: string;
|
|
9
|
+
languageConfig: {
|
|
10
|
+
[key: string]: object;
|
|
11
|
+
};
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
apiSpecPath?: DirectoryPath;
|
|
14
|
+
}
|
|
15
|
+
export interface CopilotConfig {
|
|
16
|
+
isEnabled: boolean;
|
|
17
|
+
key: string;
|
|
18
|
+
welcomeMessage: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function getLanguagesConfig(selectedLanguages: string[]): {
|
|
21
|
+
[key: string]: object;
|
|
22
|
+
};
|