@apimatic/cli 1.1.0-alpha.2 → 1.1.0-alpha.21
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 +257 -101
- package/bin/run.js +5 -0
- package/lib/actions/action-result.d.ts +8 -0
- package/lib/actions/action-result.js +25 -0
- package/lib/actions/action-result.js.map +1 -0
- package/lib/actions/auth/login.d.ts +12 -0
- package/lib/actions/auth/login.js +63 -0
- package/lib/actions/auth/login.js.map +1 -0
- package/lib/actions/portal/copilot.d.ts +14 -0
- package/lib/actions/portal/copilot.js +79 -0
- package/lib/actions/portal/copilot.js.map +1 -0
- package/lib/actions/portal/generate.d.ts +14 -0
- package/lib/actions/portal/generate.js +66 -0
- package/lib/actions/portal/generate.js.map +1 -0
- package/lib/actions/portal/recipe/new-recipe.d.ts +24 -0
- package/lib/actions/portal/recipe/new-recipe.js +250 -0
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
- package/lib/actions/portal/serve.d.ts +14 -0
- package/lib/actions/portal/serve.js +24 -0
- package/lib/actions/portal/serve.js.map +1 -0
- package/lib/actions/portal/toc/new-toc.d.ts +20 -0
- package/lib/actions/portal/toc/new-toc.js +133 -0
- package/lib/actions/portal/toc/new-toc.js.map +1 -0
- package/lib/actions/sdk/generate.d.ts +14 -0
- package/lib/actions/sdk/generate.js +72 -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 +16 -0
- package/lib/application/portal/recipe/recipe-generator.js +147 -0
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
- package/lib/application/portal/serve/portal-watcher.d.ts +11 -0
- package/lib/application/portal/serve/portal-watcher.js +64 -0
- package/lib/application/portal/serve/portal-watcher.js.map +1 -0
- package/lib/application/portal/serve/serve-handler.d.ts +16 -0
- package/lib/application/portal/serve/serve-handler.js +91 -0
- package/lib/application/portal/serve/serve-handler.js.map +1 -0
- package/lib/application/portal/serve/watcher-handler.d.ts +10 -0
- package/lib/application/portal/serve/watcher-handler.js +51 -0
- package/lib/application/portal/serve/watcher-handler.js.map +1 -0
- package/lib/application/portal/toc/sdl-parser.d.ts +19 -0
- package/lib/application/portal/toc/sdl-parser.js +90 -0
- package/lib/application/portal/toc/sdl-parser.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 +23 -10
- package/lib/client-utils/auth-manager.js.map +1 -0
- package/lib/client-utils/sdk-client.d.ts +4 -9
- package/lib/client-utils/sdk-client.js +9 -87
- package/lib/client-utils/sdk-client.js.map +1 -0
- package/lib/commands/api/transform.d.ts +7 -7
- package/lib/commands/api/transform.js +46 -51
- package/lib/commands/api/transform.js.map +1 -0
- package/lib/commands/api/validate.d.ts +4 -4
- package/lib/commands/api/validate.js +35 -36
- package/lib/commands/api/validate.js.map +1 -0
- package/lib/commands/auth/login.d.ts +3 -2
- package/lib/commands/auth/login.js +22 -53
- package/lib/commands/auth/login.js.map +1 -0
- package/lib/commands/auth/logout.d.ts +1 -1
- package/lib/commands/auth/logout.js +8 -13
- package/lib/commands/auth/logout.js.map +1 -0
- package/lib/commands/auth/status.d.ts +1 -1
- package/lib/commands/auth/status.js +9 -13
- package/lib/commands/auth/status.js.map +1 -0
- package/lib/commands/portal/copilot.d.ts +13 -0
- package/lib/commands/portal/copilot.js +32 -0
- package/lib/commands/portal/copilot.js.map +1 -0
- package/lib/commands/portal/generate.d.ts +10 -8
- package/lib/commands/portal/generate.js +28 -107
- package/lib/commands/portal/generate.js.map +1 -0
- package/lib/commands/portal/quickstart.d.ts +10 -0
- package/lib/commands/portal/quickstart.js +114 -0
- package/lib/commands/portal/quickstart.js.map +1 -0
- package/lib/commands/portal/recipe/new.d.ts +10 -0
- package/lib/commands/portal/recipe/new.js +38 -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 +80 -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 +52 -0
- package/lib/commands/portal/toc/new.js.map +1 -0
- package/lib/commands/sdk/generate.d.ts +9 -8
- package/lib/commands/sdk/generate.js +39 -128
- 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/config/env.d.ts +26 -1
- package/lib/config/env.js +27 -4
- package/lib/config/env.js.map +1 -0
- package/lib/controllers/api/transform.d.ts +1 -1
- package/lib/controllers/api/transform.js +23 -22
- package/lib/controllers/api/transform.js.map +1 -0
- package/lib/controllers/api/validate.d.ts +3 -3
- package/lib/controllers/api/validate.js +19 -12
- package/lib/controllers/api/validate.js.map +1 -0
- package/lib/controllers/portal/quickstart.d.ts +13 -0
- package/lib/controllers/portal/quickstart.js +214 -0
- package/lib/controllers/portal/quickstart.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-client-utils.d.ts +6 -0
- package/lib/infrastructure/api-client-utils.js +34 -0
- package/lib/infrastructure/api-client-utils.js.map +1 -0
- package/lib/infrastructure/api-utils.d.ts +9 -0
- package/lib/infrastructure/api-utils.js +33 -0
- package/lib/infrastructure/api-utils.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 +18 -0
- package/lib/infrastructure/file-service.js +76 -0
- package/lib/infrastructure/file-service.js.map +1 -0
- package/lib/infrastructure/launcher-service.d.ts +5 -0
- package/lib/infrastructure/launcher-service.js +47 -0
- package/lib/infrastructure/launcher-service.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 +35 -0
- package/lib/infrastructure/services/auth-service.js.map +1 -0
- package/lib/infrastructure/services/portal-service.d.ts +23 -0
- package/lib/infrastructure/services/portal-service.js +186 -0
- package/lib/infrastructure/services/portal-service.js.map +1 -0
- package/lib/infrastructure/services/telemetry-service.d.ts +8 -0
- package/lib/infrastructure/services/telemetry-service.js +40 -0
- package/lib/infrastructure/services/telemetry-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/auth/login.d.ts +5 -0
- package/lib/prompts/auth/login.js +13 -0
- package/lib/prompts/auth/login.js.map +1 -0
- package/lib/prompts/portal/common/base-prompts.d.ts +7 -0
- package/lib/prompts/portal/common/base-prompts.js +19 -0
- package/lib/prompts/portal/common/base-prompts.js.map +1 -0
- package/lib/prompts/portal/copilot.d.ts +14 -0
- package/lib/prompts/portal/copilot.js +71 -0
- package/lib/prompts/portal/copilot.js.map +1 -0
- package/lib/prompts/portal/generate.d.ts +11 -0
- package/lib/prompts/portal/generate.js +42 -0
- package/lib/prompts/portal/generate.js.map +1 -0
- package/lib/prompts/portal/quickstart.d.ts +30 -0
- package/lib/prompts/portal/quickstart.js +240 -0
- package/lib/prompts/portal/quickstart.js.map +1 -0
- package/lib/prompts/portal/recipe/new-recipe.d.ts +24 -0
- package/lib/prompts/portal/recipe/new-recipe.js +203 -0
- package/lib/prompts/portal/recipe/new-recipe.js.map +1 -0
- package/lib/prompts/portal/serve.d.ts +4 -0
- package/lib/prompts/portal/serve.js +14 -0
- package/lib/prompts/portal/serve.js.map +1 -0
- package/lib/prompts/portal/toc/new-toc.d.ts +11 -0
- package/lib/prompts/portal/toc/new-toc.js +39 -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 +42 -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 +19 -4
- package/lib/types/api/transform.js +19 -4
- package/lib/types/api/transform.js.map +1 -0
- package/lib/types/api/validate.d.ts +3 -3
- package/lib/types/api/validate.js +2 -2
- package/lib/types/api/validate.js.map +1 -0
- package/lib/types/build/build.d.ts +14 -0
- package/lib/types/build/build.js +4 -0
- package/lib/types/build/build.js.map +1 -0
- package/lib/types/build-context.d.ts +13 -0
- package/lib/types/build-context.js +30 -0
- package/lib/types/build-context.js.map +1 -0
- package/lib/types/common/result.d.ts +17 -0
- package/lib/types/common/result.js +32 -0
- package/lib/types/common/result.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/directoryPath.d.ts +7 -0
- package/lib/types/file/directoryPath.js +16 -0
- package/lib/types/file/directoryPath.js.map +1 -0
- package/lib/types/file/fileName.d.ts +5 -0
- package/lib/types/file/fileName.js +9 -0
- package/lib/types/file/fileName.js.map +1 -0
- package/lib/types/file/filePath.d.ts +8 -0
- package/lib/types/file/filePath.js +11 -0
- package/lib/types/file/filePath.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/generate.d.ts +13 -9
- package/lib/types/portal/generate.js +3 -2
- package/lib/types/portal/generate.js.map +1 -0
- package/lib/types/portal/quickstart.d.ts +17 -0
- package/lib/types/portal/quickstart.js +2 -0
- package/lib/types/portal/quickstart.js.map +1 -0
- package/lib/types/portal/serve.d.ts +12 -0
- package/lib/types/portal/serve.js +2 -0
- package/lib/types/portal/serve.js.map +1 -0
- package/lib/types/portal-context.d.ts +11 -0
- package/lib/types/portal-context.js +28 -0
- package/lib/types/portal-context.js.map +1 -0
- package/lib/types/recipe/recipe.d.ts +37 -0
- package/lib/types/recipe/recipe.js +6 -0
- package/lib/types/recipe/recipe.js.map +1 -0
- package/lib/types/sdk/generate.d.ts +11 -10
- package/lib/types/sdk/generate.js +11 -12
- package/lib/types/sdk/generate.js.map +1 -0
- package/lib/types/sdk-context.d.ts +13 -0
- package/lib/types/sdk-context.js +28 -0
- package/lib/types/sdk-context.js.map +1 -0
- package/lib/types/sdl/sdl.d.ts +12 -0
- package/lib/types/sdl/sdl.js +2 -0
- package/lib/types/sdl/sdl.js.map +1 -0
- package/lib/types/spec-context.d.ts +7 -0
- package/lib/types/spec-context.js +12 -0
- package/lib/types/spec-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/utils.d.ts +3 -3
- package/lib/types/utils.js +2 -2
- package/lib/types/utils.js.map +1 -0
- package/lib/utils/utils.d.ts +16 -7
- package/lib/utils/utils.js +142 -86
- package/lib/utils/utils.js.map +1 -0
- package/lib/validators/common/directoryValidator.d.ts +5 -0
- package/lib/validators/common/directoryValidator.js +22 -0
- package/lib/validators/common/directoryValidator.js.map +1 -0
- package/lib/validators/portal/serve-validator.d.ts +6 -0
- package/lib/validators/portal/serve-validator.js +15 -0
- package/lib/validators/portal/serve-validator.js.map +1 -0
- package/package.json +100 -43
- package/bin/run +0 -5
- 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
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import treeify from "treeify";
|
|
4
|
+
import { intro, spinner, select, text, cancel, isCancel, outro, log, autocomplete } from "@clack/prompts";
|
|
5
|
+
import { getMessageInGreenColor } from "../../../utils/utils.js";
|
|
6
|
+
export class PortalRecipePrompts {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.spin = spinner();
|
|
9
|
+
}
|
|
10
|
+
displayWelcomeMessage() {
|
|
11
|
+
intro(`Welcome to the API Recipe Generation Wizard. 🪄`);
|
|
12
|
+
log.step(`This wizard will guide you through the process of creating an API Recipe.`);
|
|
13
|
+
log.message(`An API Recipe is a collection of steps that allows you to define a single use case for your API Documentation portal.`);
|
|
14
|
+
log.message(`ℹ️ Learn more: https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes`);
|
|
15
|
+
log.message(`Let's get started! 🚀`);
|
|
16
|
+
}
|
|
17
|
+
async recipeNamePrompt() {
|
|
18
|
+
const recipeName = await text({
|
|
19
|
+
message: `📘 Enter a name for your API Recipe:`,
|
|
20
|
+
placeholder: "This name will be displayed in your API Documentation portal sidebar.",
|
|
21
|
+
validate: (name) => {
|
|
22
|
+
if (!name) {
|
|
23
|
+
return "Recipe name cannot be empty. Please provide a name for your API Recipe.";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
if (isCancel(recipeName)) {
|
|
28
|
+
cancel("Operation cancelled.");
|
|
29
|
+
return process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
return recipeName.trim();
|
|
32
|
+
}
|
|
33
|
+
//Todo: Find a better place for this function
|
|
34
|
+
removeQuotes(str) {
|
|
35
|
+
const quotes = ['"', "'"];
|
|
36
|
+
for (const quote of quotes) {
|
|
37
|
+
if (str.startsWith(quote) && str.endsWith(quote) && str.length > 1) {
|
|
38
|
+
return this.removeQuotes(str.slice(1, -1)); // Recursive call
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return str;
|
|
42
|
+
}
|
|
43
|
+
async buildConfigFilePathPrompt(buildDirectoryPath) {
|
|
44
|
+
const buildConfigFilePath = await text({
|
|
45
|
+
message: `⚠️ APIMATIC-BUILD.json is required and was not found in "${buildDirectoryPath}".\nPlease enter the path to your build config file (relative to this directory):`,
|
|
46
|
+
validate: (filePath) => {
|
|
47
|
+
if (!filePath) {
|
|
48
|
+
return "Build config file path cannot be empty. Please provide a valid file path.";
|
|
49
|
+
}
|
|
50
|
+
const cleanedPath = this.removeQuotes(filePath.trim());
|
|
51
|
+
const resolvedPath = path.resolve(buildDirectoryPath, cleanedPath);
|
|
52
|
+
if (!resolvedPath.endsWith(".json")) {
|
|
53
|
+
return "The content file must be a JSON (.json) file. Please provide a valid file path.";
|
|
54
|
+
}
|
|
55
|
+
if (fs.existsSync(resolvedPath) && fs.statSync(resolvedPath).isFile()) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
return "The specified path is either not a valid relative file path or it doesn't exist. Please provide a valid relative file path.";
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
if (isCancel(buildConfigFilePath)) {
|
|
62
|
+
cancel("Operation cancelled.");
|
|
63
|
+
return process.exit(0);
|
|
64
|
+
}
|
|
65
|
+
return path.resolve(buildDirectoryPath, this.removeQuotes(buildConfigFilePath.trim()));
|
|
66
|
+
}
|
|
67
|
+
async stepNamePrompt(defaultStepName) {
|
|
68
|
+
const stepName = await text({
|
|
69
|
+
message: `Enter a name for the step:`,
|
|
70
|
+
defaultValue: defaultStepName,
|
|
71
|
+
placeholder: `Press enter to use the default, i.e. ${defaultStepName}`
|
|
72
|
+
});
|
|
73
|
+
if (isCancel(stepName)) {
|
|
74
|
+
cancel("Operation cancelled.");
|
|
75
|
+
return process.exit(0);
|
|
76
|
+
}
|
|
77
|
+
return stepName.trim();
|
|
78
|
+
}
|
|
79
|
+
displayStepsInformation() {
|
|
80
|
+
log.step(`🔧 Add Steps to your API Recipe:`);
|
|
81
|
+
log.message(`You can add:`);
|
|
82
|
+
log.message(`1. 📄 Content Step: Display custom content, such as instructions or information related to your API.`);
|
|
83
|
+
log.message(`2. 🔗 Endpoint Step: Display an API endpoint, its playground and other relevant details.`);
|
|
84
|
+
log.message(`💡 Steps appear in the order you add them.`);
|
|
85
|
+
log.message(`📝 Let's proceed to adding steps to your API Recipe. `);
|
|
86
|
+
}
|
|
87
|
+
async stepTypeSelectionPrompt() {
|
|
88
|
+
const stepType = await select({
|
|
89
|
+
message: `➕ Select the type of step you want to add:`,
|
|
90
|
+
options: [
|
|
91
|
+
{ value: "content", label: "Content Step", hint: "For displaying custom content" },
|
|
92
|
+
{ value: "endpoint", label: "Endpoint Step", hint: "For displaying an API endpoint with its details" }
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
if (isCancel(stepType)) {
|
|
96
|
+
cancel("Operation cancelled.");
|
|
97
|
+
return process.exit(0);
|
|
98
|
+
}
|
|
99
|
+
return stepType;
|
|
100
|
+
}
|
|
101
|
+
displayContentStepInfo() {
|
|
102
|
+
log.step("📝 Opening markdown editor for you to add content in...");
|
|
103
|
+
}
|
|
104
|
+
async endpointGroupNamePrompt(endpointGroups) {
|
|
105
|
+
const groupNames = Array.from(endpointGroups.keys()).map((name) => ({
|
|
106
|
+
value: name,
|
|
107
|
+
label: name
|
|
108
|
+
}));
|
|
109
|
+
const endpointGroupName = await autocomplete({
|
|
110
|
+
message: `Select the endpoint group name:`,
|
|
111
|
+
maxItems: 10,
|
|
112
|
+
options: groupNames
|
|
113
|
+
});
|
|
114
|
+
if (isCancel(endpointGroupName)) {
|
|
115
|
+
cancel("Operation cancelled.");
|
|
116
|
+
return process.exit(0);
|
|
117
|
+
}
|
|
118
|
+
return endpointGroupName.trim();
|
|
119
|
+
}
|
|
120
|
+
async endpointNamePrompt(endpointGroups, endpointGroupName) {
|
|
121
|
+
const endpoints = endpointGroups.get(endpointGroupName);
|
|
122
|
+
const endpointName = await autocomplete({
|
|
123
|
+
message: `Select the name of the endpoint:`,
|
|
124
|
+
maxItems: 10,
|
|
125
|
+
options: endpoints.map((endpoint) => ({
|
|
126
|
+
value: endpoint.Name,
|
|
127
|
+
label: endpoint.Name
|
|
128
|
+
}))
|
|
129
|
+
});
|
|
130
|
+
if (isCancel(endpointName)) {
|
|
131
|
+
cancel("Operation cancelled.");
|
|
132
|
+
return process.exit(0);
|
|
133
|
+
}
|
|
134
|
+
return endpointName.trim();
|
|
135
|
+
}
|
|
136
|
+
async endpointDescriptionPrompt(endpointGroups, endpointGroupName, endpointName) {
|
|
137
|
+
const defaultDescription = endpointGroups.get(endpointGroupName).find((e) => e.Name === endpointName).Description;
|
|
138
|
+
const endpointDescription = await text({
|
|
139
|
+
message: `Enter a description for the endpoint:`,
|
|
140
|
+
placeholder: `Optional. Leave this empty to use the endpoint description defined in the API Specification`,
|
|
141
|
+
defaultValue: defaultDescription
|
|
142
|
+
});
|
|
143
|
+
if (isCancel(endpointDescription)) {
|
|
144
|
+
cancel("Operation cancelled.");
|
|
145
|
+
return process.exit(0);
|
|
146
|
+
}
|
|
147
|
+
return endpointDescription.trim();
|
|
148
|
+
}
|
|
149
|
+
async addAnotherStepSelectionPrompt() {
|
|
150
|
+
const addAnotherStep = await select({
|
|
151
|
+
message: `Do you want to add another step?`,
|
|
152
|
+
options: [
|
|
153
|
+
{ value: "yes", label: "Yes" },
|
|
154
|
+
{ value: "no", label: "No" }
|
|
155
|
+
],
|
|
156
|
+
initialValue: "yes"
|
|
157
|
+
});
|
|
158
|
+
if (isCancel(addAnotherStep)) {
|
|
159
|
+
cancel("Operation cancelled.");
|
|
160
|
+
return process.exit(0);
|
|
161
|
+
}
|
|
162
|
+
return addAnotherStep === "yes";
|
|
163
|
+
}
|
|
164
|
+
async overwriteApiRecipeInTocPrompt() {
|
|
165
|
+
const overwriteApiRecipeInToc = await select({
|
|
166
|
+
message: `⚠️ An API Recipe with this name already exists. Do you want to overwrite it?`,
|
|
167
|
+
options: [
|
|
168
|
+
{ value: "yes", label: "Yes" },
|
|
169
|
+
{ value: "no", label: "No" }
|
|
170
|
+
]
|
|
171
|
+
});
|
|
172
|
+
if (isCancel(overwriteApiRecipeInToc)) {
|
|
173
|
+
cancel("Operation cancelled.");
|
|
174
|
+
return process.exit(0);
|
|
175
|
+
}
|
|
176
|
+
return overwriteApiRecipeInToc === "yes";
|
|
177
|
+
}
|
|
178
|
+
displayStepAddedSuccessfullyMessage() {
|
|
179
|
+
log.step(`Step has been added successfully.`);
|
|
180
|
+
}
|
|
181
|
+
displayRecipeGenerationSuccessMessage(buildDirectoryPath) {
|
|
182
|
+
log.message(`🎉 Your new API Recipe has been added to the source directory at: ${buildDirectoryPath}`);
|
|
183
|
+
outro(`▶ Run the command 'apimatic portal:serve' to preview your documentation portal.`);
|
|
184
|
+
}
|
|
185
|
+
startProgressIndicatorWithMessage(message) {
|
|
186
|
+
this.spin.start(message);
|
|
187
|
+
}
|
|
188
|
+
stopProgressIndicatorWithMessage(message) {
|
|
189
|
+
this.spin.stop(message);
|
|
190
|
+
}
|
|
191
|
+
displayBuildDirectoryStructureAsTree(buildDirectoryTreeObject) {
|
|
192
|
+
const tree = treeify.asTree(buildDirectoryTreeObject, true, true);
|
|
193
|
+
const coloredLogString = tree
|
|
194
|
+
.split("\n")
|
|
195
|
+
.map((line) => line.replace(/#.*/, (match) => getMessageInGreenColor(match)))
|
|
196
|
+
.join("\n");
|
|
197
|
+
log.step(`🛠️ You can edit the following files to customize your API Recipe :\n\n` + coloredLogString);
|
|
198
|
+
}
|
|
199
|
+
logError(error) {
|
|
200
|
+
outro(error);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//# 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,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,MAAM,OAAO,mBAAmB;IAAhC;QACmB,SAAI,GAAG,OAAO,EAAE,CAAC;IAmPpC,CAAC;IAjPQ,qBAAqB;QAC1B,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACzD,GAAG,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;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zB,CAAC;QAED,OAAO,uBAAuB,KAAK,KAAK,CAAC;IAC3C,CAAC;IAEM,mCAAmC;QACxC,GAAG,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;IAChD,CAAC;IAEM,qCAAqC,CAAC,kBAA0B;QACrE,GAAG,CAAC,OAAO,CAAC,qEAAqE,kBAAkB,EAAE,CAAC,CAAC;QACvG,KAAK,CACH,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAEM,iCAAiC,CAAC,OAAe;QACtD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAEM,gCAAgC,CAAC,OAAe;QACrD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAEM,oCAAoC,CAAC,wBAA4C;QACtF,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,wBAAwB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAElE,MAAM,gBAAgB,GAAG,IAAI;aAC1B,KAAK,CAAC,IAAI,CAAC;aACX,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC;aAC5F,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,GAAG,CAAC,IAAI,CAAC,0EAA0E,GAAG,gBAAgB,CAAC,CAAC;IAC1G,CAAC;IAEM,QAAQ,CAAC,KAAa;QAC3B,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { log, outro } from "@clack/prompts";
|
|
2
|
+
import { BasePrompts } from "./common/base-prompts.js";
|
|
3
|
+
export class PortalServePrompts extends BasePrompts {
|
|
4
|
+
displayOutroMessage(buildDirectory, portalDirectory, port, hotReloadDisabled) {
|
|
5
|
+
log.message(`The generated portal can be found at ${portalDirectory}`);
|
|
6
|
+
log.message(`Server started at http://localhost:${port}`);
|
|
7
|
+
if (!hotReloadDisabled) {
|
|
8
|
+
log.message(`🔍 Hot reload enabled. Watching the following build folder for any changes:`);
|
|
9
|
+
log.message(`${buildDirectory}`);
|
|
10
|
+
}
|
|
11
|
+
outro(`Press CTRL+C to stop the server.`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# 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,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IAC1C,mBAAmB,CACxB,cAAsB,EACtB,eAAuB,EACvB,IAAY,EACZ,iBAA0B;QAE1B,GAAG,CAAC,OAAO,CAAC,wCAAwC,eAAe,EAAE,CAAC,CAAC;QACvE,GAAG,CAAC,OAAO,CAAC,sCAAsC,IAAI,EAAE,CAAC,CAAC;QAC1D,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACvB,GAAG,CAAC,OAAO,CAAC,6EAA6E,CAAC,CAAC;YAC3F,GAAG,CAAC,OAAO,CAAC,GAAG,cAAc,EAAE,CAAC,CAAC;QACnC,CAAC;QACD,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FilePath } from "../../../types/file/filePath.js";
|
|
2
|
+
export declare class PortalNewTocPrompts {
|
|
3
|
+
private readonly spin;
|
|
4
|
+
overwriteExistingTocPrompt(tocPath: FilePath): Promise<boolean>;
|
|
5
|
+
startProgressIndicatorWithMessage(message: string): void;
|
|
6
|
+
stopProgressIndicatorWithMessage(message: string): void;
|
|
7
|
+
displayOutroMessage(tocPath: FilePath): void;
|
|
8
|
+
logError(error: string): void;
|
|
9
|
+
displayWarning(message: string): void;
|
|
10
|
+
displayInfo(message: string): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { cancel, outro, confirm, spinner, isCancel, log } from "@clack/prompts";
|
|
2
|
+
export class PortalNewTocPrompts {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.spin = spinner();
|
|
5
|
+
}
|
|
6
|
+
async overwriteExistingTocPrompt(tocPath) {
|
|
7
|
+
const overwrite = await confirm({
|
|
8
|
+
message: `⚠️ The destination file '${tocPath}' already exists, do you want to overwrite it?`,
|
|
9
|
+
initialValue: false
|
|
10
|
+
});
|
|
11
|
+
if (isCancel(overwrite)) {
|
|
12
|
+
cancel("Operation cancelled.");
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (!overwrite) {
|
|
16
|
+
log.error("Please enter a different destination path or delete the existing toc.yml file and try again.");
|
|
17
|
+
}
|
|
18
|
+
return overwrite;
|
|
19
|
+
}
|
|
20
|
+
startProgressIndicatorWithMessage(message) {
|
|
21
|
+
this.spin.start(message);
|
|
22
|
+
}
|
|
23
|
+
stopProgressIndicatorWithMessage(message) {
|
|
24
|
+
this.spin.stop(message);
|
|
25
|
+
}
|
|
26
|
+
displayOutroMessage(tocPath) {
|
|
27
|
+
outro(`toc.yml file successfully created at: ${tocPath}`);
|
|
28
|
+
}
|
|
29
|
+
logError(error) {
|
|
30
|
+
outro(error);
|
|
31
|
+
}
|
|
32
|
+
displayWarning(message) {
|
|
33
|
+
log.warning(message);
|
|
34
|
+
}
|
|
35
|
+
displayInfo(message) {
|
|
36
|
+
log.step(message);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# 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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
+
export declare class SdkGeneratePrompts {
|
|
3
|
+
private readonly spin;
|
|
4
|
+
overwriteSdk(directory: DirectoryPath): Promise<boolean>;
|
|
5
|
+
displaySdkGenerationMessage(): void;
|
|
6
|
+
displaySdkGenerationSuccessMessage(): void;
|
|
7
|
+
displaySdkGenerationErrorMessage(): void;
|
|
8
|
+
displayOutroMessage(generatedSdkPath: DirectoryPath): void;
|
|
9
|
+
logError(error: string): void;
|
|
10
|
+
private cleanUpStandardInput;
|
|
11
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { outro, spinner, isCancel, confirm, log } from "@clack/prompts";
|
|
2
|
+
import { getMessageInRedColor, getMessageInMagentaColor, getMessageInCyanColor } from "../../utils/utils.js";
|
|
3
|
+
export class SdkGeneratePrompts {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.spin = spinner();
|
|
6
|
+
}
|
|
7
|
+
async overwriteSdk(directory) {
|
|
8
|
+
const overwrite = await confirm({
|
|
9
|
+
message: `The destination '${directory}' is not empty, do you want to overwrite?`,
|
|
10
|
+
initialValue: false
|
|
11
|
+
});
|
|
12
|
+
if (isCancel(overwrite)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return overwrite;
|
|
16
|
+
}
|
|
17
|
+
displaySdkGenerationMessage() {
|
|
18
|
+
this.spin.start(getMessageInMagentaColor("Generating SDK"));
|
|
19
|
+
}
|
|
20
|
+
displaySdkGenerationSuccessMessage() {
|
|
21
|
+
this.spin.stop(getMessageInCyanColor("SDK generated successfully."));
|
|
22
|
+
this.cleanUpStandardInput();
|
|
23
|
+
}
|
|
24
|
+
displaySdkGenerationErrorMessage() {
|
|
25
|
+
this.spin.stop(getMessageInRedColor(`SDK Generation failed.`), 1);
|
|
26
|
+
this.cleanUpStandardInput();
|
|
27
|
+
}
|
|
28
|
+
displayOutroMessage(generatedSdkPath) {
|
|
29
|
+
outro(`The generated SDK can be found at ${generatedSdkPath}`);
|
|
30
|
+
}
|
|
31
|
+
logError(error) {
|
|
32
|
+
log.error(error);
|
|
33
|
+
}
|
|
34
|
+
//This clears the standard input to allow interrupts like CTRL+C to work properly.
|
|
35
|
+
cleanUpStandardInput() {
|
|
36
|
+
if (process.stdin.isTTY) {
|
|
37
|
+
process.stdin.setRawMode(false);
|
|
38
|
+
process.stdin.pause();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# 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,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG7G,MAAM,OAAO,kBAAkB;IAA/B;QACmB,SAAI,GAAG,OAAO,EAAE,CAAC;IA4CpC,CAAC;IA1CQ,KAAK,CAAC,YAAY,CAAC,SAAwB;QAChD,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC;YAC9B,OAAO,EAAE,oBAAoB,SAAS,2CAA2C;YACjF,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;IAED,2BAA2B;QACzB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,kCAAkC;QAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,6BAA6B,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED,gCAAgC;QAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC,CAAC;QAClE,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED,mBAAmB,CAAC,gBAA+B;QACjD,KAAK,CAAC,qCAAqC,gBAAgB,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,kFAAkF;IAC1E,oBAAoB;QAC1B,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACxB,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAChC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/types/api/account.ts"],"names":[],"mappings":""}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { TransformationController } from "@apimatic/sdk";
|
|
3
|
-
export
|
|
2
|
+
export type TransformationIdParams = {
|
|
4
3
|
file: string;
|
|
5
4
|
url: string;
|
|
6
5
|
format: string;
|
|
7
6
|
};
|
|
8
|
-
export
|
|
7
|
+
export type DownloadTransformationParams = {
|
|
9
8
|
id: string;
|
|
10
9
|
destinationFilePath: string;
|
|
11
10
|
transformationController: TransformationController;
|
|
12
11
|
};
|
|
13
|
-
export
|
|
12
|
+
export type TransformationData = {
|
|
14
13
|
result: NodeJS.ReadableStream | Blob;
|
|
15
14
|
};
|
|
16
15
|
export declare const DestinationFormats: {
|
|
@@ -28,3 +27,19 @@ export declare const DestinationFormats: {
|
|
|
28
27
|
Postman20: string;
|
|
29
28
|
GraphQlSchema: string;
|
|
30
29
|
};
|
|
30
|
+
export declare enum TransformationFormats {
|
|
31
|
+
APIMATIC = "Apimatic",
|
|
32
|
+
WADL2009 = "Wadl2009",
|
|
33
|
+
WSDL = "Wsdl",
|
|
34
|
+
SWAGGER10 = "Swagger10",
|
|
35
|
+
SWAGGER20 = "Swagger20",
|
|
36
|
+
SWAGGERYAML = "Swaggeryaml",
|
|
37
|
+
OAS3 = "Oas3",
|
|
38
|
+
OPENAPI3YAML = "Openapi3Yaml",
|
|
39
|
+
APIBLUEPRINT = "Apiblueprint",
|
|
40
|
+
RAML = "Raml",
|
|
41
|
+
RAML10 = "Raml10",
|
|
42
|
+
POSTMAN10 = "Postman10",
|
|
43
|
+
POSTMAN20 = "Postman20",
|
|
44
|
+
GRAPHQLSCHEMA = "Graphqlschema"
|
|
45
|
+
}
|
|
@@ -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",
|
|
@@ -16,3 +13,21 @@ exports.DestinationFormats = {
|
|
|
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":"AAkBA,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"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type GetValidationParams = {
|
|
2
2
|
file: string;
|
|
3
3
|
url: string;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type APIValidateError = {
|
|
6
6
|
modelState: {
|
|
7
7
|
"exception Error": string[];
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type AuthorizationError = {
|
|
11
11
|
body: string;
|
|
12
12
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/types/api/validate.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface BuildConfig {
|
|
2
|
+
generatePortal?: PortalConfig;
|
|
3
|
+
apiCopilotConfig?: CopilotConfig;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface PortalConfig {
|
|
7
|
+
contentFolder?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CopilotConfig {
|
|
10
|
+
isEnabled: boolean;
|
|
11
|
+
key: string;
|
|
12
|
+
welcomeMessage: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function updateCopilotConfig(buildConfig: BuildConfig, copilotConfig: CopilotConfig): BuildConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/types/build/build.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,mBAAmB,CACjC,WAAwB,EACxB,aAA4B;IAE5B,uCACK,WAAW,KACd,gBAAgB,oBACX,aAAa,KAElB;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DirectoryPath } from "./file/directoryPath.js";
|
|
2
|
+
import { FilePath } from "./file/filePath.js";
|
|
3
|
+
import { BuildConfig } from "./build/build.js";
|
|
4
|
+
export declare class BuildContext {
|
|
5
|
+
private readonly fileService;
|
|
6
|
+
private readonly buildDirectory;
|
|
7
|
+
constructor(buildDirectory: DirectoryPath);
|
|
8
|
+
get BuildFile(): FilePath;
|
|
9
|
+
validate(): Promise<boolean>;
|
|
10
|
+
exists(): Promise<boolean>;
|
|
11
|
+
getBuildFileContents(): Promise<BuildConfig>;
|
|
12
|
+
updateBuildFileContents(buildJson: BuildConfig): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FileService } from "../infrastructure/file-service.js";
|
|
2
|
+
import { FilePath } from "./file/filePath.js";
|
|
3
|
+
import { FileName } from "./file/fileName.js";
|
|
4
|
+
export class BuildContext {
|
|
5
|
+
constructor(buildDirectory) {
|
|
6
|
+
this.fileService = new FileService();
|
|
7
|
+
this.buildDirectory = buildDirectory;
|
|
8
|
+
}
|
|
9
|
+
get BuildFile() {
|
|
10
|
+
// TODO: add checks for build file path
|
|
11
|
+
return new FilePath(this.buildDirectory, new FileName("APIMATIC-BUILD.json"));
|
|
12
|
+
}
|
|
13
|
+
async validate() {
|
|
14
|
+
// TODO: add more checks here
|
|
15
|
+
if (!(await this.fileService.directoryExists(this.buildDirectory)))
|
|
16
|
+
return false;
|
|
17
|
+
return await this.fileService.fileExists(this.BuildFile);
|
|
18
|
+
}
|
|
19
|
+
async exists() {
|
|
20
|
+
return !(await this.fileService.directoryEmpty(this.buildDirectory));
|
|
21
|
+
}
|
|
22
|
+
async getBuildFileContents() {
|
|
23
|
+
const buildFileContent = await this.fileService.getContents(this.BuildFile);
|
|
24
|
+
return JSON.parse(buildFileContent);
|
|
25
|
+
}
|
|
26
|
+
async updateBuildFileContents(buildJson) {
|
|
27
|
+
await this.fileService.writeContents(this.BuildFile, JSON.stringify(buildJson, null, 2));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=build-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-context.js","sourceRoot":"","sources":["../../src/types/build-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C,CAAC,CAAC;IAC3F,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class Result<T, TError> {
|
|
2
|
+
private readonly Status;
|
|
3
|
+
readonly value?: T | undefined;
|
|
4
|
+
readonly error?: TError | undefined;
|
|
5
|
+
private constructor();
|
|
6
|
+
static success<T, TError>(value: T): Result<T, TError>;
|
|
7
|
+
static failure<T, TError>(error: TError): Result<T, TError>;
|
|
8
|
+
static cancelled<T, TError>(value: T): Result<T, TError>;
|
|
9
|
+
isFailed(): boolean;
|
|
10
|
+
isCancelled(): boolean;
|
|
11
|
+
isSuccess(): boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare enum ResultStatus {
|
|
14
|
+
Success = 0,
|
|
15
|
+
Failed = 1,
|
|
16
|
+
Cancelled = 2
|
|
17
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class Result {
|
|
2
|
+
constructor(Status, value, error) {
|
|
3
|
+
this.Status = Status;
|
|
4
|
+
this.value = value;
|
|
5
|
+
this.error = error;
|
|
6
|
+
}
|
|
7
|
+
static success(value) {
|
|
8
|
+
return new Result(ResultStatus.Success, value, undefined);
|
|
9
|
+
}
|
|
10
|
+
static failure(error) {
|
|
11
|
+
return new Result(ResultStatus.Failed, undefined, error);
|
|
12
|
+
}
|
|
13
|
+
static cancelled(value) {
|
|
14
|
+
return new Result(ResultStatus.Cancelled, value, undefined);
|
|
15
|
+
}
|
|
16
|
+
isFailed() {
|
|
17
|
+
return this.Status == ResultStatus.Failed;
|
|
18
|
+
}
|
|
19
|
+
isCancelled() {
|
|
20
|
+
return this.Status == ResultStatus.Cancelled;
|
|
21
|
+
}
|
|
22
|
+
isSuccess() {
|
|
23
|
+
return this.Status == ResultStatus.Success;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export var ResultStatus;
|
|
27
|
+
(function (ResultStatus) {
|
|
28
|
+
ResultStatus[ResultStatus["Success"] = 0] = "Success";
|
|
29
|
+
ResultStatus[ResultStatus["Failed"] = 1] = "Failed";
|
|
30
|
+
ResultStatus[ResultStatus["Cancelled"] = 2] = "Cancelled";
|
|
31
|
+
})(ResultStatus || (ResultStatus = {}));
|
|
32
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/types/common/result.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,MAAM;IACjB,YACmB,MAAoB,EACrB,KAAS,EACT,KAAc;QAFb,WAAM,GAAN,MAAM,CAAc;QACrB,UAAK,GAAL,KAAK,CAAI;QACT,UAAK,GAAL,KAAK,CAAS;IAC7B,CAAC;IAEG,MAAM,CAAC,OAAO,CAAY,KAAQ;QACvC,OAAO,IAAI,MAAM,CAAY,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACvE,CAAC;IAEM,MAAM,CAAC,OAAO,CAAY,KAAa;QAC5C,OAAO,IAAI,MAAM,CAAY,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAEM,MAAM,CAAC,SAAS,CAAY,KAAQ;QACzC,OAAO,IAAI,MAAM,CAAY,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACzE,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC;IAC5C,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,SAAS,CAAC;IAC/C,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,OAAO,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,yDAAS,CAAA;AACX,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare abstract class DomainEvent {
|
|
2
|
+
protected abstract readonly eventName: string;
|
|
3
|
+
private readonly message;
|
|
4
|
+
private readonly commandName;
|
|
5
|
+
private readonly flags;
|
|
6
|
+
constructor(message: string, commandName: string, flags: Record<string, unknown>);
|
|
7
|
+
private extractFlagKeys;
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export class DomainEvent {
|
|
2
|
+
constructor(message, commandName, flags) {
|
|
3
|
+
this.message = message;
|
|
4
|
+
this.commandName = commandName;
|
|
5
|
+
this.flags = this.extractFlagKeys(flags);
|
|
6
|
+
}
|
|
7
|
+
extractFlagKeys(flags) {
|
|
8
|
+
return Object.keys(flags);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=domain-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-event.js","sourceRoot":"","sources":["../../../src/types/events/domain-event.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,WAAW;IAM/B,YAAY,OAAe,EAAE,WAAmB,EAAE,KAA8B;QAC9E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAEO,eAAe,CAAC,KAA8B;QACpD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;CACF"}
|