@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
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.downloadDocsPortal = void 0;
|
|
4
|
-
const cli_ux_1 = require("cli-ux");
|
|
5
|
-
const fs = require("fs-extra");
|
|
6
|
-
const FormData = require("form-data");
|
|
7
|
-
const env_1 = require("../../config/env");
|
|
8
|
-
const utils_1 = require("../../utils/utils");
|
|
9
|
-
const auth_manager_1 = require("../../client-utils/auth-manager");
|
|
10
|
-
const axios_1 = require("axios");
|
|
11
|
-
// TODO: Remove after SDK is patched
|
|
12
|
-
const downloadPortalAxios = async (zippedBuildFilePath, overrideAuthKey, configDir) => {
|
|
13
|
-
const formData = new FormData();
|
|
14
|
-
const authInfo = await auth_manager_1.getAuthInfo(configDir);
|
|
15
|
-
formData.append("file", fs.createReadStream(zippedBuildFilePath));
|
|
16
|
-
const config = {
|
|
17
|
-
headers: Object.assign({ Authorization: authInfo || overrideAuthKey ? `X-Auth-Key ${(authInfo === null || authInfo === void 0 ? void 0 : authInfo.authKey.trim()) || overrideAuthKey}` : "" }, formData.getHeaders()),
|
|
18
|
-
responseType: "arraybuffer"
|
|
19
|
-
};
|
|
20
|
-
const { data } = await axios_1.default.post(`${env_1.baseURL}/portal`, formData, config);
|
|
21
|
-
return data;
|
|
22
|
-
};
|
|
23
|
-
// Download Docs Portal
|
|
24
|
-
exports.downloadDocsPortal = async ({ zippedBuildFilePath, portalFolderPath, zippedPortalPath, overrideAuthKey, zip }, configDir) => {
|
|
25
|
-
cli_ux_1.default.action.start("Downloading portal");
|
|
26
|
-
// Check if the build file exists for the user or not
|
|
27
|
-
if (!(await fs.pathExists(zippedBuildFilePath))) {
|
|
28
|
-
throw new Error("Build file doesn't exist");
|
|
29
|
-
}
|
|
30
|
-
// TODO: ***CRITICAL*** Remove this call once the SDK is patched
|
|
31
|
-
const data = await downloadPortalAxios(zippedBuildFilePath, overrideAuthKey, configDir);
|
|
32
|
-
await utils_1.deleteFile(zippedBuildFilePath);
|
|
33
|
-
await fs.writeFile(zippedPortalPath, data);
|
|
34
|
-
// TODO: Uncomment this code block when the SDK is patched
|
|
35
|
-
// const file: FileWrapper = new FileWrapper(fs.createReadStream(zippedBuildFilePath));
|
|
36
|
-
// const { result }: ApiResponse<NodeJS.ReadableStream | Blob> =
|
|
37
|
-
// await docsPortalController.generateOnPremPortalViaBuildInput(file);
|
|
38
|
-
// if ((data as NodeJS.ReadableStream).readable) {
|
|
39
|
-
// await writeFileUsingReadableStream(data as NodeJS.ReadableStream, zippedPortalPath);
|
|
40
|
-
if (!zip) {
|
|
41
|
-
await utils_1.unzipFile(fs.createReadStream(zippedPortalPath), portalFolderPath);
|
|
42
|
-
await utils_1.deleteFile(zippedPortalPath);
|
|
43
|
-
}
|
|
44
|
-
cli_ux_1.default.action.stop();
|
|
45
|
-
return zip ? zippedPortalPath : portalFolderPath;
|
|
46
|
-
// } else {
|
|
47
|
-
// throw new Error("Couldn't download the portal");
|
|
48
|
-
// }
|
|
49
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { CodeGenerationExternalApisController } from "@apimatic/sdk";
|
|
2
|
-
import { GenerationIdParams, DownloadSDKParams } from "../../types/sdk/generate";
|
|
3
|
-
export declare const getSDKGenerationId: ({ file, url, platform }: GenerationIdParams, sdkGenerationController: CodeGenerationExternalApisController) => Promise<string>;
|
|
4
|
-
export declare const downloadGeneratedSDK: ({ codeGenId, zippedSDKPath, sdkFolderPath, zip }: DownloadSDKParams, sdkGenerationController: CodeGenerationExternalApisController) => Promise<string>;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.downloadGeneratedSDK = exports.getSDKGenerationId = void 0;
|
|
4
|
-
const fs = require("fs-extra");
|
|
5
|
-
const cli_ux_1 = require("cli-ux");
|
|
6
|
-
const sdk_1 = require("@apimatic/sdk");
|
|
7
|
-
const core_1 = require("@apimatic/core");
|
|
8
|
-
const generate_1 = require("../../types/sdk/generate");
|
|
9
|
-
const utils_1 = require("../../utils/utils");
|
|
10
|
-
exports.getSDKGenerationId = async ({ file, url, platform }, sdkGenerationController) => {
|
|
11
|
-
cli_ux_1.default.action.start("Generating SDK");
|
|
12
|
-
let generation;
|
|
13
|
-
const sdkPlatform = getSDKPlatform(platform);
|
|
14
|
-
if (file) {
|
|
15
|
-
const fileDescriptor = new core_1.FileWrapper(fs.createReadStream(file));
|
|
16
|
-
generation = await sdkGenerationController.generateSDKViaFile(fileDescriptor, sdkPlatform);
|
|
17
|
-
}
|
|
18
|
-
else if (url) {
|
|
19
|
-
// If url to spec file is provided
|
|
20
|
-
const body = {
|
|
21
|
-
url: url,
|
|
22
|
-
template: sdkPlatform
|
|
23
|
-
};
|
|
24
|
-
generation = await sdkGenerationController.generateSDKViaURL(body);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
throw new Error("Please provide a specification file");
|
|
28
|
-
}
|
|
29
|
-
cli_ux_1.default.action.stop();
|
|
30
|
-
return generation.result.id;
|
|
31
|
-
};
|
|
32
|
-
// Get valid platform from user's input, convert simple platform to valid Platforms enum value
|
|
33
|
-
const getSDKPlatform = (platform) => {
|
|
34
|
-
if (Object.keys(generate_1.SimplePlatforms).includes(platform)) {
|
|
35
|
-
return generate_1.SimplePlatforms[platform];
|
|
36
|
-
}
|
|
37
|
-
else if (Object.values(sdk_1.Platforms).includes(platform)) {
|
|
38
|
-
return platform;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const platforms = Object.keys(generate_1.SimplePlatforms).concat(Object.values(sdk_1.Platforms)).join("|");
|
|
42
|
-
throw new Error(`Please provide a valid platform i.e. ${platforms}`);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
// Download Platform
|
|
46
|
-
exports.downloadGeneratedSDK = async ({ codeGenId, zippedSDKPath, sdkFolderPath, zip }, sdkGenerationController) => {
|
|
47
|
-
cli_ux_1.default.action.start("Downloading SDK");
|
|
48
|
-
const { result } = await sdkGenerationController.downloadSDK(codeGenId);
|
|
49
|
-
if (result.readable) {
|
|
50
|
-
if (!zip) {
|
|
51
|
-
await utils_1.unzipFile(result, sdkFolderPath);
|
|
52
|
-
cli_ux_1.default.action.stop();
|
|
53
|
-
return sdkFolderPath;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
await utils_1.writeFileUsingReadableStream(result, zippedSDKPath);
|
|
57
|
-
cli_ux_1.default.action.stop();
|
|
58
|
-
return zippedSDKPath;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
throw new Error("Couldn't download the SDK");
|
|
63
|
-
}
|
|
64
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DocsPortalManagementController } from "@apimatic/sdk";
|
|
2
|
-
export declare type GeneratePortalParams = {
|
|
3
|
-
zippedBuildFilePath: string;
|
|
4
|
-
portalFolderPath: string;
|
|
5
|
-
zippedPortalPath: string;
|
|
6
|
-
docsPortalController: DocsPortalManagementController;
|
|
7
|
-
overrideAuthKey: string | null;
|
|
8
|
-
zip: boolean;
|
|
9
|
-
};
|