@apimatic/cli 0.0.0-alpha.4 → 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 -44
- 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
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import prettier from "prettier";
|
|
2
|
+
import { stringify } from "yaml";
|
|
3
|
+
import { FileService } from "../../../infrastructure/file-service.js";
|
|
4
|
+
import { FilePath } from "../../../types/file/filePath.js";
|
|
5
|
+
import { FileName } from "../../../types/file/fileName.js";
|
|
6
|
+
export class PortalRecipeGenerator {
|
|
7
|
+
constructor() {
|
|
8
|
+
//TODO: Replace tocFileContent any type with concrete type.
|
|
9
|
+
this.fileService = new FileService();
|
|
10
|
+
}
|
|
11
|
+
async createRecipe(recipe, tocFileContent, tocFilePath, recipeName, recipeFileName, buildContext, buildDirectory) {
|
|
12
|
+
await this.addRecipeToToc(tocFileContent, tocFilePath, recipeName, recipeFileName);
|
|
13
|
+
await this.registerRecipeInBuildConfigFile(buildContext, recipeName, recipeFileName);
|
|
14
|
+
await this.createMarkdownFile(recipeFileName, buildDirectory.join("content"));
|
|
15
|
+
const generatedRecipeScript = await this.createScriptFromRecipe(recipe);
|
|
16
|
+
const generatedRecipeScriptsDirectoryPath = buildDirectory.join("static", "scripts", "recipes");
|
|
17
|
+
await this.saveGeneratedRecipeScriptToBuildDirectory(generatedRecipeScript, generatedRecipeScriptsDirectoryPath, recipeFileName);
|
|
18
|
+
}
|
|
19
|
+
async addRecipeToToc(tocData, tocFilePath, recipeName, recipeFileName) {
|
|
20
|
+
let toc = tocData.toc;
|
|
21
|
+
let apiRecipesGroup = toc.find((item) => item.group === "API Recipes");
|
|
22
|
+
if (!apiRecipesGroup) {
|
|
23
|
+
// If the group doesn't exist, create and insert it after the last group
|
|
24
|
+
apiRecipesGroup = {
|
|
25
|
+
group: "API Recipes",
|
|
26
|
+
items: []
|
|
27
|
+
};
|
|
28
|
+
// Insert after the last group section, before generate sections
|
|
29
|
+
let lastGroupIdx = -1;
|
|
30
|
+
for (let i = 0; i < toc.length; i++) {
|
|
31
|
+
if (toc[i].group)
|
|
32
|
+
lastGroupIdx = i;
|
|
33
|
+
}
|
|
34
|
+
toc.splice(lastGroupIdx + 1, 0, apiRecipesGroup);
|
|
35
|
+
}
|
|
36
|
+
// Only add the recipe if it doesn't already exist
|
|
37
|
+
const existingRecipe = apiRecipesGroup.items.find((item) => item.page === recipeName || item.file === `recipes/${recipeFileName}.md`);
|
|
38
|
+
if (!existingRecipe) {
|
|
39
|
+
apiRecipesGroup.items.push({
|
|
40
|
+
page: recipeName,
|
|
41
|
+
file: `recipes/${recipeFileName}.md`
|
|
42
|
+
});
|
|
43
|
+
await this.fileService.writeContents(tocFilePath, stringify(tocData));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async registerRecipeInBuildConfigFile(buildContext, recipeName, recipeFileName) {
|
|
47
|
+
const buildConfig = await buildContext.getBuildFileContents();
|
|
48
|
+
if (!buildConfig.recipes) {
|
|
49
|
+
buildConfig.recipes = {};
|
|
50
|
+
}
|
|
51
|
+
const recipesConfig = buildConfig.recipes;
|
|
52
|
+
if (!recipesConfig.workflows) {
|
|
53
|
+
recipesConfig.workflows = [];
|
|
54
|
+
}
|
|
55
|
+
const existingIndex = recipesConfig.workflows.findIndex((workflow) => workflow.permalink === `page:recipes/${recipeFileName}`);
|
|
56
|
+
const newWorkflow = {
|
|
57
|
+
name: recipeName,
|
|
58
|
+
permalink: `page:recipes/${recipeFileName}`,
|
|
59
|
+
functionName: this.toPascalCase(recipeName),
|
|
60
|
+
scriptPath: `./static/scripts/recipes/${recipeFileName}.js`
|
|
61
|
+
};
|
|
62
|
+
if (existingIndex !== -1) {
|
|
63
|
+
// Replace the existing workflow
|
|
64
|
+
recipesConfig.workflows[existingIndex] = newWorkflow;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// Add as new workflow
|
|
68
|
+
recipesConfig.workflows.push(newWorkflow);
|
|
69
|
+
}
|
|
70
|
+
await buildContext.updateBuildFileContents(buildConfig);
|
|
71
|
+
}
|
|
72
|
+
async createMarkdownFile(recipeFileName, contentFolder) {
|
|
73
|
+
const directory = contentFolder.join("recipes");
|
|
74
|
+
const markdownFileContent = this.getMarkdownFileContent();
|
|
75
|
+
await this.fileService.createDirectoryIfNotExists(directory);
|
|
76
|
+
await this.fileService.writeContents(new FilePath(directory, new FileName(`${recipeFileName}.md`)), markdownFileContent);
|
|
77
|
+
}
|
|
78
|
+
async createScriptFromRecipe(recipe) {
|
|
79
|
+
let script = `export default function ${this.toPascalCase(recipe.name)}(workflowCtx, portal) {`;
|
|
80
|
+
script += "return {";
|
|
81
|
+
recipe.steps.forEach((step, index) => {
|
|
82
|
+
script += `"${step.key}": {`;
|
|
83
|
+
script += `name: "${step.name}",`;
|
|
84
|
+
script += "stepCallback: async () => {";
|
|
85
|
+
if (step.type === "content") {
|
|
86
|
+
script += this.addContentStepToScript(step.config);
|
|
87
|
+
}
|
|
88
|
+
else if (step.type === "endpoint") {
|
|
89
|
+
script += this.addEndpointStepToScript(step.config);
|
|
90
|
+
}
|
|
91
|
+
script += "},";
|
|
92
|
+
script += "}";
|
|
93
|
+
if (index < recipe.steps.length - 1) {
|
|
94
|
+
script += ",";
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
script += "};";
|
|
98
|
+
script += "}";
|
|
99
|
+
return script;
|
|
100
|
+
}
|
|
101
|
+
async saveGeneratedRecipeScriptToBuildDirectory(generatedRecipeScript, generatedRecipeScriptsDirectoryPath, recipeFileName, format = false) {
|
|
102
|
+
if (format) {
|
|
103
|
+
generatedRecipeScript = await this.formatScript(generatedRecipeScript);
|
|
104
|
+
}
|
|
105
|
+
await this.fileService.createDirectoryIfNotExists(generatedRecipeScriptsDirectoryPath);
|
|
106
|
+
await this.fileService.writeContents(new FilePath(generatedRecipeScriptsDirectoryPath, new FileName(`${recipeFileName}.js`)), generatedRecipeScript);
|
|
107
|
+
}
|
|
108
|
+
generateVerifyFunction() {
|
|
109
|
+
return `if (response.StatusCode == 200) { return true; } else { setError("API Call wasn't able to get a valid response. Please try again."); return false; }`;
|
|
110
|
+
}
|
|
111
|
+
addContentStepToScript(contentConfig) {
|
|
112
|
+
return `return workflowCtx.showContent(${JSON.stringify(contentConfig.content)});`;
|
|
113
|
+
}
|
|
114
|
+
addEndpointStepToScript(endpointConfig) {
|
|
115
|
+
let script = "return workflowCtx.showEndpoint({";
|
|
116
|
+
if (endpointConfig.description !== "") {
|
|
117
|
+
script += `description: ${JSON.stringify(endpointConfig.description)},`;
|
|
118
|
+
}
|
|
119
|
+
script += `endpointPermalink: "${endpointConfig.endpointPermalink}",`;
|
|
120
|
+
script += "verify: (response, setError) => {";
|
|
121
|
+
script += this.generateVerifyFunction();
|
|
122
|
+
script += "},";
|
|
123
|
+
script += "});";
|
|
124
|
+
return script;
|
|
125
|
+
}
|
|
126
|
+
getMarkdownFileContent() {
|
|
127
|
+
return `# This is a Guided Walkthrough File
|
|
128
|
+
This is the starter content`;
|
|
129
|
+
}
|
|
130
|
+
async formatScript(code) {
|
|
131
|
+
return prettier.format(code, {
|
|
132
|
+
parser: "babel",
|
|
133
|
+
semi: true,
|
|
134
|
+
singleQuote: false,
|
|
135
|
+
tabWidth: 2,
|
|
136
|
+
trailingComma: "es5"
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
toPascalCase(str) {
|
|
140
|
+
return str
|
|
141
|
+
.split(" ")
|
|
142
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
143
|
+
.join("");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=recipe-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe-generator.js","sourceRoot":"","sources":["../../../../src/application/portal/recipe/recipe-generator.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAG3D,MAAM,OAAO,qBAAqB;IAAlC;QACE,2DAA2D;QAC1C,gBAAW,GAAgB,IAAI,WAAW,EAAE,CAAC;IA8LhE,CAAC;IA5LQ,KAAK,CAAC,YAAY,CACvB,MAA0B,EAC1B,cAAmB,EACnB,WAAqB,EACrB,UAAkB,EAClB,cAAwB,EACxB,YAA0B,EAC1B,cAA6B;QAE7B,MAAM,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;QACnF,MAAM,IAAI,CAAC,+BAA+B,CAAC,YAAY,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;QACrF,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAE9E,MAAM,qBAAqB,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QACxE,MAAM,mCAAmC,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QAChG,MAAM,IAAI,CAAC,yCAAyC,CAClD,qBAAqB,EACrB,mCAAmC,EACnC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E,KAAK;YAClB,QAAQ,EAAE,CAAC;YACX,aAAa,EAAE,KAAK;SACrB,CAAC,CAAC;IACL,CAAC;IAEO,YAAY,CAAC,GAAW;QAC9B,OAAO,GAAG;aACP,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;aACzE,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import * as fs from "fs/promises";
|
|
3
|
+
export class TocContentParser {
|
|
4
|
+
async parseContentFolder(contentFolderPath, workingDirectory) {
|
|
5
|
+
const items = await fs.readdir(contentFolderPath);
|
|
6
|
+
const contentItems = [];
|
|
7
|
+
for (const item of items) {
|
|
8
|
+
const itemPath = path.join(contentFolderPath, item);
|
|
9
|
+
const stats = await fs.stat(itemPath);
|
|
10
|
+
if (stats.isDirectory()) {
|
|
11
|
+
const subItems = await this.parseContentFolder(itemPath, workingDirectory);
|
|
12
|
+
if (subItems.length > 0) {
|
|
13
|
+
contentItems.push({
|
|
14
|
+
group: item,
|
|
15
|
+
items: subItems[0].items // Take items from the Custom Content group
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else if (stats.isFile() && item.endsWith(".md")) {
|
|
20
|
+
const relativePath = path.relative(workingDirectory, itemPath);
|
|
21
|
+
const pageName = path.basename(item, ".md");
|
|
22
|
+
contentItems.push({
|
|
23
|
+
page: pageName,
|
|
24
|
+
file: this.normalizePath(relativePath)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Return empty array if no markdown files were found
|
|
29
|
+
if (contentItems.length === 0) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
// Wrap everything under a "Custom Content" group
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
group: "Custom Content",
|
|
36
|
+
items: contentItems
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
normalizePath(path) {
|
|
41
|
+
return path.replace(/\\/g, "/");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=toc-content-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toc-content-parser.js","sourceRoot":"","sources":["../../../../src/application/portal/toc/toc-content-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAGlC,MAAM,OAAO,gBAAgB;IAC3B,KAAK,CAAC,kBAAkB,CAAC,iBAAyB,EAAE,gBAAwB;QAC1E,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAClD,MAAM,YAAY,GAAiC,EAAE,CAAC;QAEtD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YACpD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAEtC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;gBAC3E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACxB,YAAY,CAAC,IAAI,CAAC;wBAChB,KAAK,EAAE,IAAI;wBACX,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,2CAA2C;qBACrE,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAClD,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;gBAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBAE5C,YAAY,CAAC,IAAI,CAAC;oBAChB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC;iBACvC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,iDAAiD;QACjD,OAAO;YACL;gBACE,KAAK,EAAE,gBAAgB;gBACvB,KAAK,EAAE,YAAY;aACpB;SACF,CAAC;IACJ,CAAC;IAEO,aAAa,CAAC,IAAY;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Toc, TocGroup, TocEndpoint, TocModel } from "../../../types/toc/toc.js";
|
|
2
|
+
export declare class TocStructureGenerator {
|
|
3
|
+
createTocStructure(endpointGroups: Map<string, TocEndpoint[]>, models: TocModel[], expandEndpoints?: boolean, expandModels?: boolean, contentGroups?: TocGroup[]): Toc;
|
|
4
|
+
transformToYaml(toc: Toc): string;
|
|
5
|
+
private transformKeys;
|
|
6
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { stringify } from "yaml";
|
|
2
|
+
export class TocStructureGenerator {
|
|
3
|
+
createTocStructure(endpointGroups, models, expandEndpoints = false, expandModels = false, contentGroups = []) {
|
|
4
|
+
const tocStructure = {
|
|
5
|
+
toc: []
|
|
6
|
+
};
|
|
7
|
+
// Add Getting Started section
|
|
8
|
+
tocStructure.toc.push({
|
|
9
|
+
group: "Getting Started",
|
|
10
|
+
items: [
|
|
11
|
+
{
|
|
12
|
+
generate: "How to Get Started",
|
|
13
|
+
from: "getting-started"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
// Add content groups
|
|
18
|
+
if (contentGroups.length > 0) {
|
|
19
|
+
tocStructure.toc.push(...contentGroups);
|
|
20
|
+
}
|
|
21
|
+
// Add API Endpoints section
|
|
22
|
+
if (!expandEndpoints || endpointGroups.size === 0) {
|
|
23
|
+
tocStructure.toc.push({
|
|
24
|
+
generate: "API Endpoints",
|
|
25
|
+
from: "endpoints"
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
tocStructure.toc.push({
|
|
30
|
+
group: "API Endpoints",
|
|
31
|
+
items: Array.from(endpointGroups).map(([groupName, endpoints]) => ({
|
|
32
|
+
group: groupName,
|
|
33
|
+
items: [
|
|
34
|
+
{
|
|
35
|
+
generate: null,
|
|
36
|
+
from: "endpoint-group-overview",
|
|
37
|
+
endpointGroup: groupName
|
|
38
|
+
},
|
|
39
|
+
...endpoints
|
|
40
|
+
]
|
|
41
|
+
}))
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
// Add Models section
|
|
45
|
+
if (!expandModels || models.length === 0) {
|
|
46
|
+
tocStructure.toc.push({
|
|
47
|
+
generate: "Models",
|
|
48
|
+
from: "models"
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
tocStructure.toc.push({
|
|
53
|
+
group: "Models",
|
|
54
|
+
items: models
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//Add Sdk Infra section
|
|
58
|
+
tocStructure.toc.push({
|
|
59
|
+
generate: "SDK Infrastructure",
|
|
60
|
+
from: "sdk-infra"
|
|
61
|
+
});
|
|
62
|
+
return tocStructure;
|
|
63
|
+
}
|
|
64
|
+
transformToYaml(toc) {
|
|
65
|
+
const transformedToc = this.transformKeys(toc);
|
|
66
|
+
return stringify(transformedToc, {
|
|
67
|
+
indent: 2,
|
|
68
|
+
nullStr: ""
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
transformKeys(obj) {
|
|
72
|
+
if (Array.isArray(obj)) {
|
|
73
|
+
return obj.map((item) => this.transformKeys(item));
|
|
74
|
+
}
|
|
75
|
+
if (obj !== null && typeof obj === "object") {
|
|
76
|
+
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [
|
|
77
|
+
key.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(),
|
|
78
|
+
this.transformKeys(value)
|
|
79
|
+
]));
|
|
80
|
+
}
|
|
81
|
+
return obj;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=toc-structure-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toc-structure-generator.js","sourceRoot":"","sources":["../../../../src/application/portal/toc/toc-structure-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAGjC,MAAM,OAAO,qBAAqB;IAChC,kBAAkB,CAChB,cAA0C,EAC1C,MAAkB,EAClB,kBAA2B,KAAK,EAChC,eAAwB,KAAK,EAC7B,gBAA4B,EAAE;QAE9B,MAAM,YAAY,GAAQ;YACxB,GAAG,EAAE,EAAE;SACR,CAAC;QAEF,8BAA8B;QAC9B,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;YACpB,KAAK,EAAE,iBAAiB;YACxB,KAAK,EAAE;gBACL;oBACE,QAAQ,EAAE,oBAAoB;oBAC9B,IAAI,EAAE,iBAAiB;iBACxB;aACF;SACF,CAAC,CAAC;QAEH,qBAAqB;QACrB,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,aAA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GAAG,CAAC,CAAC;QAC/C,OAAO,SAAS,CAAC,cAAc,EAAE;YAC/B,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,EAAE;SACZ,CAAC,CAAC;IACL,CAAC;IAEO,aAAa,CAAC,GAAQ;QAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC5C,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;gBACxC,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE;gBACxD,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;aAC1B,CAAC,CACH,CAAC;QACJ,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { DirectoryPath } from "../types/file/directoryPath.js";
|
|
2
|
+
export type AuthInfo = {
|
|
2
3
|
email: string;
|
|
3
4
|
authKey: string;
|
|
5
|
+
APIMATIC_CLI_TELEMETRY_OPTOUT?: string;
|
|
4
6
|
};
|
|
5
7
|
/**
|
|
6
8
|
*
|
|
@@ -10,8 +12,11 @@ export declare type AuthInfo = {
|
|
|
10
12
|
export declare function getAuthInfo(configDir: string): Promise<AuthInfo | null>;
|
|
11
13
|
/**
|
|
12
14
|
*
|
|
13
|
-
* @param {
|
|
15
|
+
* @param {string} email
|
|
16
|
+
* @param {string} authKey
|
|
17
|
+
* @param {string} isTelemetryOptedOut
|
|
14
18
|
* @param {string} configDir <- Directory with user configuration
|
|
15
19
|
* //Function to set credentials.
|
|
16
20
|
*/
|
|
17
|
-
export declare function setAuthInfo(
|
|
21
|
+
export declare function setAuthInfo(email: string, authKey: string, isTelemetryOptedOut: boolean, configDir: DirectoryPath): Promise<void>;
|
|
22
|
+
export declare function removeAuthInfo(configDir: DirectoryPath): Promise<void>;
|
|
@@ -1,33 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.setAuthInfo = exports.getAuthInfo = void 0;
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const fs = require("fs-extra");
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import fs from "fs-extra";
|
|
6
3
|
/**
|
|
7
4
|
*
|
|
8
5
|
* @param {string} configDir <- Directory with user configuration
|
|
9
6
|
* //Function to get credentials
|
|
10
7
|
*/
|
|
11
|
-
async function getAuthInfo(configDir) {
|
|
8
|
+
export async function getAuthInfo(configDir) {
|
|
12
9
|
try {
|
|
13
|
-
|
|
14
|
-
return data;
|
|
10
|
+
return JSON.parse(await fs.readFile(path.join(configDir, "config.json"), "utf8"));
|
|
15
11
|
}
|
|
16
|
-
catch (
|
|
12
|
+
catch (_a) {
|
|
17
13
|
return null;
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
|
-
exports.getAuthInfo = getAuthInfo;
|
|
21
16
|
/**
|
|
22
17
|
*
|
|
23
|
-
* @param {
|
|
18
|
+
* @param {string} email
|
|
19
|
+
* @param {string} authKey
|
|
20
|
+
* @param {string} isTelemetryOptedOut
|
|
24
21
|
* @param {string} configDir <- Directory with user configuration
|
|
25
22
|
* //Function to set credentials.
|
|
26
23
|
*/
|
|
27
|
-
async function setAuthInfo(
|
|
28
|
-
const
|
|
24
|
+
export async function setAuthInfo(email, authKey, isTelemetryOptedOut, configDir) {
|
|
25
|
+
const credentials = {
|
|
26
|
+
email,
|
|
27
|
+
authKey,
|
|
28
|
+
APIMATIC_CLI_TELEMETRY_OPTOUT: isTelemetryOptedOut ? "1" : "0"
|
|
29
|
+
};
|
|
30
|
+
const configFilePath = path.join(configDir.toString(), "config.json");
|
|
29
31
|
if (!fs.existsSync(configFilePath))
|
|
30
32
|
fs.createFileSync(configFilePath);
|
|
31
33
|
return await fs.writeFile(configFilePath, JSON.stringify(credentials));
|
|
32
34
|
}
|
|
33
|
-
|
|
35
|
+
export async function removeAuthInfo(configDir) {
|
|
36
|
+
const credentials = {
|
|
37
|
+
email: "",
|
|
38
|
+
authKey: ""
|
|
39
|
+
};
|
|
40
|
+
const configFilePath = path.join(configDir.toString(), "config.json");
|
|
41
|
+
if (!fs.existsSync(configFilePath))
|
|
42
|
+
fs.createFileSync(configFilePath);
|
|
43
|
+
return await fs.writeFile(configFilePath, JSON.stringify(credentials));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=auth-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-manager.js","sourceRoot":"","sources":["../../src/client-utils/auth-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,MAAM,UAAU,CAAC;AAQ1B;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,SAAiB;IACjD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACpF,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAa,EACb,OAAe,EACf,mBAA4B,EAC5B,SAAwB;IAExB,MAAM,WAAW,GAAa;QAC5B,KAAK;QACL,OAAO;QACP,6BAA6B,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;KAC/D,CAAC;IACF,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,aAAa,CAAC,CAAC;IAEtE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC;QAAE,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IAEtE,OAAO,MAAM,EAAE,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,SAAwB;IAC3D,MAAM,WAAW,GAAa;QAC5B,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,EAAE;KACZ,CAAC;IACF,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,aAAa,CAAC,CAAC;IAEtE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC;QAAE,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IAEtE,OAAO,MAAM,EAAE,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
2
|
export default class Transform extends Command {
|
|
3
|
-
static
|
|
3
|
+
static readonly summary = "Transform API specifications between different formats";
|
|
4
|
+
static readonly description = "Transform API specifications from one format to another.\nSupports multiple formats including OpenAPI/Swagger, RAML, WSDL, and Postman Collections.";
|
|
5
|
+
static readonly cmdTxt: string;
|
|
4
6
|
static examples: string[];
|
|
5
7
|
static flags: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
8
|
+
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
destination: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
14
|
};
|
|
13
15
|
run(): Promise<void>;
|
|
16
|
+
private readonly getConfigDir;
|
|
14
17
|
}
|
|
@@ -1,111 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { Command, Flags } from "@oclif/core";
|
|
2
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
3
|
+
import { FlagsProvider } from "../../types/flags-provider.js";
|
|
4
|
+
import { TransformAction } from "../../actions/api/transform.js";
|
|
5
|
+
import { format, intro, outro } from "../../prompts/format.js";
|
|
6
|
+
import { createResourceInput } from "../../types/file/resource-input.js";
|
|
7
|
+
import { TransformationFormats } from "../../types/api/transform.js";
|
|
8
|
+
import { ExportFormats } from "@apimatic/sdk";
|
|
9
|
+
const DEFAULT_WORKING_DIRECTORY = "./";
|
|
10
|
+
class Transform extends Command {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.getConfigDir = () => {
|
|
14
|
+
return new DirectoryPath(this.config.configDir);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
14
17
|
async run() {
|
|
15
|
-
const { flags } = this.parse(Transform);
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const overrideAuthKey = flags["auth-key"] ? flags["auth-key"] : null;
|
|
32
|
-
const client = await sdk_client_1.SDKClient.getInstance().getClient(overrideAuthKey, this.config.configDir);
|
|
33
|
-
const transformationController = new sdk_1.TransformationController(client);
|
|
34
|
-
const { id, apiValidationSummary } = await transform_2.getTransformationId(flags, transformationController);
|
|
35
|
-
const logFunctions = {
|
|
36
|
-
log: this.log,
|
|
37
|
-
warn: this.warn,
|
|
38
|
-
error: this.error
|
|
39
|
-
};
|
|
40
|
-
utils_1.printValidationMessages(apiValidationSummary, logFunctions);
|
|
41
|
-
const savedTransformationFile = await transform_2.downloadTransformationFile({
|
|
42
|
-
id,
|
|
43
|
-
destinationFilePath,
|
|
44
|
-
transformationController
|
|
45
|
-
});
|
|
46
|
-
this.log(`Success! Your transformed file is located at ${savedTransformationFile}`);
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
if (error.result) {
|
|
50
|
-
const apiError = error;
|
|
51
|
-
// TODO: Hopefully, this type-cast won't be necessary when the SDK is
|
|
52
|
-
// updated to throw the right exception type for this status code.
|
|
53
|
-
const result = apiError.result;
|
|
54
|
-
if (apiError.statusCode === 422 && result && "errors" in result && Array.isArray(result.errors)) {
|
|
55
|
-
this.error(utils_2.replaceHTML(`${result.errors}`));
|
|
56
|
-
}
|
|
57
|
-
else if (apiError.statusCode === 422 && apiError.body && typeof apiError.body === "string") {
|
|
58
|
-
this.error(JSON.parse(apiError.body)["dto.FileUrl"][0]);
|
|
59
|
-
}
|
|
60
|
-
else if (apiError.statusCode === 401 && apiError.body && typeof apiError.body === "string") {
|
|
61
|
-
this.error(apiError.body);
|
|
62
|
-
}
|
|
63
|
-
else if (apiError.statusCode === 500) {
|
|
64
|
-
this.error(apiError.message);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
else if (error.statusCode === 401 &&
|
|
68
|
-
error.body &&
|
|
69
|
-
typeof error.body === "string") {
|
|
70
|
-
this.error(error.body);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.error(`${error.message}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
18
|
+
const { flags: { format, file, url, destination, force, "auth-key": authKey } } = await this.parse(Transform);
|
|
19
|
+
const workingDirectory = new DirectoryPath(destination !== null && destination !== void 0 ? destination : DEFAULT_WORKING_DIRECTORY);
|
|
20
|
+
const transformedApiDirectory = workingDirectory.join("transformations");
|
|
21
|
+
const specFile = createResourceInput(file, url);
|
|
22
|
+
// Directly map the format flag to ExportFormats using TransformationFormats
|
|
23
|
+
const key = format;
|
|
24
|
+
const transformationFormat = TransformationFormats[key];
|
|
25
|
+
const parsedFormat = ExportFormats[transformationFormat];
|
|
26
|
+
const commandMetadata = {
|
|
27
|
+
commandName: Transform.id,
|
|
28
|
+
shell: this.config.shell
|
|
29
|
+
};
|
|
30
|
+
intro("Transform API");
|
|
31
|
+
const action = new TransformAction(this.getConfigDir(), commandMetadata, authKey);
|
|
32
|
+
const result = await action.execute(specFile, parsedFormat, transformedApiDirectory, force);
|
|
33
|
+
outro(result);
|
|
76
34
|
}
|
|
77
35
|
}
|
|
78
|
-
|
|
79
|
-
Transform.description = `Transform API specifications from one format to another.
|
|
36
|
+
Transform.summary = "Transform API specifications between different formats";
|
|
37
|
+
Transform.description = `Transform API specifications from one format to another.
|
|
38
|
+
Supports multiple formats including OpenAPI/Swagger, RAML, WSDL, and Postman Collections.`;
|
|
39
|
+
Transform.cmdTxt = format.cmd("apimatic", "api", "transform");
|
|
80
40
|
Transform.examples = [
|
|
81
|
-
`$
|
|
82
|
-
|
|
83
|
-
`,
|
|
84
|
-
`$ apimatic api:transform --format=RAML --url="https://petstore.swagger.io/v2/swagger.json" --destination="D:/"
|
|
85
|
-
Success! Your transformed file is located at D:/swagger_raml.yaml
|
|
86
|
-
`
|
|
41
|
+
`${Transform.cmdTxt} ${format.flag("format", "OPENAPI3YAML")} ${format.flag("file", "./specs/sample.json")} ${format.flag("destination", "./")}`,
|
|
42
|
+
`${Transform.cmdTxt} ${format.flag("format", "RAML")} ${format.flag("url", '"https://petstore.swagger.io/v2/swagger.json"')} ${format.flag("destination", "./")}`
|
|
87
43
|
];
|
|
88
|
-
Transform.flags = {
|
|
89
|
-
format: command_1.flags.string({
|
|
90
|
-
parse: (format) => transform_2.getValidFormat(format.toUpperCase()),
|
|
44
|
+
Transform.flags = Object.assign(Object.assign({ format: Flags.string({
|
|
91
45
|
required: true,
|
|
92
|
-
description:
|
|
93
|
-
|
|
94
|
-
}),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
default:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
parse: (input) => path.resolve(input),
|
|
106
|
-
default: path.resolve("./"),
|
|
107
|
-
description: "directory to download transformed file to"
|
|
108
|
-
}),
|
|
109
|
-
force: command_1.flags.boolean({ char: "f", default: false, description: "overwrite if same file exist in the destination" }),
|
|
110
|
-
"auth-key": command_1.flags.string({ description: "override current authentication state with an authentication key" })
|
|
111
|
-
};
|
|
46
|
+
description: "Specification format to transform API specification into",
|
|
47
|
+
options: Object.keys(TransformationFormats)
|
|
48
|
+
}), file: Flags.string({
|
|
49
|
+
description: "Path to the API specification file to transform"
|
|
50
|
+
}), url: Flags.string({
|
|
51
|
+
description: "URL to the API specification file to transform (publicly accessible)"
|
|
52
|
+
}), destination: Flags.string({
|
|
53
|
+
char: "d",
|
|
54
|
+
description: "Directory to save the transformed file to",
|
|
55
|
+
default: DEFAULT_WORKING_DIRECTORY
|
|
56
|
+
}) }, FlagsProvider.force), FlagsProvider.authKey);
|
|
57
|
+
export default Transform;
|
|
58
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -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M,CAAC;QACnB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,0DAA0D;QACvE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC;KAC5C,CAAC,EACJ,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE,iDAAiD;KAC/D,CAAC,EACF,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC;QAChB,WAAW,EAAE,sEAAsE;KACpF,CAAC,EACF,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,2CAA2C;QACxD,OAAO,EAAE,yBAAyB;KACnC,CAAC,IACC,aAAa,CAAC,KAAK,GACnB,aAAa,CAAC,OAAO,CAlBd,CAmBV;eAtCiB,SAAS"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
2
|
export default class Validate extends Command {
|
|
3
|
-
static
|
|
3
|
+
static readonly summary = "Validate API specification for syntactic and semantic correctness";
|
|
4
|
+
static readonly description = "Validate your API specification to ensure it adheres to syntactic and semantic standards.";
|
|
5
|
+
static readonly cmdTxt: string;
|
|
4
6
|
static examples: string[];
|
|
5
7
|
static flags: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
8
|
+
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
11
|
};
|
|
10
12
|
run(): Promise<void>;
|
|
13
|
+
private readonly getConfigDir;
|
|
11
14
|
}
|