@apimatic/cli 1.1.0-alpha.14 → 1.1.0-alpha.16
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 +92 -68
- package/lib/actions/{actionResult.js → action-result.js} +1 -1
- 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 +11 -0
- package/lib/actions/portal/copilot.js +46 -0
- package/lib/actions/portal/copilot.js.map +1 -0
- package/lib/actions/portal/{generatePortalAction.d.ts → generate.d.ts} +2 -4
- package/lib/actions/portal/{generatePortalAction.js → generate.js} +17 -32
- package/lib/actions/portal/generate.js.map +1 -0
- package/lib/actions/portal/recipe/new-recipe.d.ts +0 -1
- package/lib/actions/portal/recipe/new-recipe.js +0 -6
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -1
- package/lib/actions/portal/serve.d.ts +1 -1
- package/lib/actions/portal/toc/new-toc.d.ts +2 -0
- package/lib/actions/portal/toc/new-toc.js +21 -18
- package/lib/actions/portal/toc/new-toc.js.map +1 -1
- package/lib/actions/sdk/generate.d.ts +13 -0
- package/lib/actions/sdk/generate.js +49 -0
- package/lib/actions/sdk/generate.js.map +1 -0
- package/lib/application/portal/serve/portal-watcher.d.ts +4 -1
- package/lib/application/portal/serve/portal-watcher.js +11 -4
- package/lib/application/portal/serve/portal-watcher.js.map +1 -1
- package/lib/application/portal/serve/serve-handler.d.ts +1 -1
- package/lib/application/portal/serve/serve-handler.js +1 -0
- package/lib/application/portal/serve/serve-handler.js.map +1 -1
- package/lib/application/portal/serve/watcher-handler.d.ts +5 -0
- package/lib/application/portal/serve/watcher-handler.js +36 -12
- package/lib/application/portal/serve/watcher-handler.js.map +1 -1
- package/lib/client-utils/auth-manager.d.ts +7 -2
- package/lib/client-utils/auth-manager.js +24 -7
- package/lib/client-utils/auth-manager.js.map +1 -1
- package/lib/client-utils/sdk-client.d.ts +0 -1
- package/lib/client-utils/sdk-client.js +6 -20
- package/lib/client-utils/sdk-client.js.map +1 -1
- package/lib/commands/api/transform.d.ts +2 -2
- package/lib/commands/api/transform.js +10 -15
- package/lib/commands/api/transform.js.map +1 -1
- package/lib/commands/api/validate.d.ts +1 -1
- package/lib/commands/api/validate.js +5 -9
- package/lib/commands/api/validate.js.map +1 -1
- package/lib/commands/auth/login.d.ts +2 -1
- package/lib/commands/auth/login.js +19 -63
- package/lib/commands/auth/login.js.map +1 -1
- package/lib/commands/auth/logout.js +2 -2
- package/lib/commands/auth/logout.js.map +1 -1
- package/lib/commands/auth/status.js +3 -2
- package/lib/commands/auth/status.js.map +1 -1
- package/lib/commands/portal/copilot.d.ts +12 -0
- package/lib/commands/portal/copilot.js +35 -0
- package/lib/commands/portal/copilot.js.map +1 -0
- package/lib/commands/portal/generate.d.ts +3 -4
- package/lib/commands/portal/generate.js +9 -24
- package/lib/commands/portal/generate.js.map +1 -1
- package/lib/commands/portal/quickstart.js +13 -16
- package/lib/commands/portal/quickstart.js.map +1 -1
- package/lib/commands/portal/recipe/new.d.ts +0 -1
- package/lib/commands/portal/recipe/new.js +11 -10
- package/lib/commands/portal/recipe/new.js.map +1 -1
- package/lib/commands/portal/serve.d.ts +3 -4
- package/lib/commands/portal/serve.js +12 -25
- package/lib/commands/portal/serve.js.map +1 -1
- package/lib/commands/portal/toc/new.d.ts +4 -5
- package/lib/commands/portal/toc/new.js +14 -21
- package/lib/commands/portal/toc/new.js.map +1 -1
- package/lib/commands/sdk/generate.d.ts +8 -6
- package/lib/commands/sdk/generate.js +53 -116
- package/lib/commands/sdk/generate.js.map +1 -1
- 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 +8 -0
- package/lib/infrastructure/env-info.js +37 -0
- package/lib/infrastructure/env-info.js.map +1 -0
- package/lib/infrastructure/file-service.d.ts +3 -1
- package/lib/infrastructure/file-service.js +15 -8
- package/lib/infrastructure/file-service.js.map +1 -1
- package/lib/infrastructure/services/api-service.d.ts +10 -0
- package/lib/infrastructure/services/api-service.js +52 -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 +33 -0
- package/lib/infrastructure/services/auth-service.js.map +1 -0
- package/lib/infrastructure/services/portal-service.d.ts +3 -1
- package/lib/infrastructure/services/portal-service.js +51 -15
- package/lib/infrastructure/services/portal-service.js.map +1 -1
- 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/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/copilot.d.ts +6 -0
- package/lib/prompts/portal/copilot.js +35 -0
- package/lib/prompts/portal/copilot.js.map +1 -0
- package/lib/prompts/portal/generate.d.ts +0 -1
- package/lib/prompts/portal/generate.js +7 -35
- package/lib/prompts/portal/generate.js.map +1 -1
- package/lib/prompts/portal/quickstart.d.ts +3 -3
- package/lib/prompts/portal/quickstart.js +18 -14
- package/lib/prompts/portal/quickstart.js.map +1 -1
- package/lib/prompts/portal/recipe/new-recipe.d.ts +1 -0
- package/lib/prompts/portal/recipe/new-recipe.js +14 -3
- package/lib/prompts/portal/recipe/new-recipe.js.map +1 -1
- package/lib/prompts/portal/toc/new-toc.d.ts +3 -2
- package/lib/prompts/portal/toc/new-toc.js +9 -13
- package/lib/prompts/portal/toc/new-toc.js.map +1 -1
- 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/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/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/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/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 +0 -13
- 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/sdk/generate.d.ts +8 -8
- package/lib/types/sdk/generate.js +10 -10
- package/lib/types/sdk/generate.js.map +1 -1
- 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/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/utils/utils.js +9 -8
- package/lib/utils/utils.js.map +1 -1
- package/package.json +3 -1
- package/lib/actions/actionResult.js.map +0 -1
- package/lib/actions/portal/generatePortalAction.js.map +0 -1
- package/lib/controllers/sdk/generate.d.ts +0 -4
- package/lib/controllers/sdk/generate.js +0 -61
- package/lib/controllers/sdk/generate.js.map +0 -1
- /package/lib/actions/{actionResult.d.ts → action-result.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fs from "fs
|
|
1
|
+
import fs from "fs";
|
|
2
2
|
import { FilePath } from "../types/file/filePath.js";
|
|
3
3
|
import { DirectoryPath } from "../types/file/directoryPath.js";
|
|
4
4
|
export declare class FileService {
|
|
@@ -8,6 +8,8 @@ export declare class FileService {
|
|
|
8
8
|
cleanDirectory(dir: DirectoryPath): Promise<void>;
|
|
9
9
|
deleteFile(filePath: FilePath): Promise<void>;
|
|
10
10
|
getStream(filePath: FilePath): Promise<fs.ReadStream>;
|
|
11
|
+
getContents(filePath: FilePath): Promise<string>;
|
|
11
12
|
writeFile(filePath: FilePath, stream: NodeJS.ReadableStream): Promise<void>;
|
|
13
|
+
writeContents(filePath: FilePath, contents: string): Promise<void>;
|
|
12
14
|
copy(source: FilePath, destination: FilePath): Promise<void>;
|
|
13
15
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import fs from "fs
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import fsExtra from "fs-extra";
|
|
2
3
|
import { pipeline } from "stream";
|
|
3
4
|
import { promisify } from "util";
|
|
4
5
|
export class FileService {
|
|
5
6
|
async fileExists(file) {
|
|
6
7
|
try {
|
|
7
|
-
const stat = await
|
|
8
|
+
const stat = await fsExtra.stat(file.toString());
|
|
8
9
|
return stat.isFile();
|
|
9
10
|
}
|
|
10
11
|
catch (_a) {
|
|
@@ -13,7 +14,7 @@ export class FileService {
|
|
|
13
14
|
}
|
|
14
15
|
async directoryExists(dir) {
|
|
15
16
|
try {
|
|
16
|
-
const stat = await
|
|
17
|
+
const stat = await fsExtra.stat(dir.toString());
|
|
17
18
|
return stat.isDirectory();
|
|
18
19
|
}
|
|
19
20
|
catch (_a) {
|
|
@@ -22,7 +23,7 @@ export class FileService {
|
|
|
22
23
|
}
|
|
23
24
|
async directoryEmpty(dir) {
|
|
24
25
|
try {
|
|
25
|
-
const files = await
|
|
26
|
+
const files = await fsExtra.readdir(dir.toString());
|
|
26
27
|
return files.length === 0;
|
|
27
28
|
}
|
|
28
29
|
catch (error) {
|
|
@@ -30,24 +31,30 @@ export class FileService {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
async cleanDirectory(dir) {
|
|
33
|
-
await
|
|
34
|
-
await
|
|
34
|
+
await fsExtra.ensureDir(dir.toString());
|
|
35
|
+
await fsExtra.emptyDir(dir.toString()); // removes everything inside, keeps the dir
|
|
35
36
|
}
|
|
36
37
|
async deleteFile(filePath) {
|
|
37
38
|
const exists = await this.fileExists(filePath);
|
|
38
39
|
if (exists) {
|
|
39
|
-
await
|
|
40
|
+
await fsExtra.remove(filePath.toString());
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
async getStream(filePath) {
|
|
43
44
|
return fs.createReadStream(filePath.toString());
|
|
44
45
|
}
|
|
46
|
+
async getContents(filePath) {
|
|
47
|
+
return await fsExtra.readFile(filePath.toString(), 'utf-8');
|
|
48
|
+
}
|
|
45
49
|
async writeFile(filePath, stream) {
|
|
46
50
|
const writeStream = fs.createWriteStream(filePath.toString());
|
|
47
51
|
await streamPipeline(stream, writeStream);
|
|
48
52
|
}
|
|
53
|
+
async writeContents(filePath, contents) {
|
|
54
|
+
await fsExtra.writeFile(filePath.toString(), contents, 'utf-8');
|
|
55
|
+
}
|
|
49
56
|
async copy(source, destination) {
|
|
50
|
-
await
|
|
57
|
+
await fsExtra.copyFile(source.toString(), destination.toString());
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
60
|
const streamPipeline = promisify(pipeline);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-service.js","sourceRoot":"","sources":["../../src/infrastructure/file-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"file-service.js","sourceRoot":"","sources":["../../src/infrastructure/file-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,O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account.js";
|
|
3
|
+
import { Result } from "neverthrow";
|
|
4
|
+
import { ServiceError } from "../api-utils.js";
|
|
5
|
+
export declare class ApiService {
|
|
6
|
+
private readonly apiBaseUrl;
|
|
7
|
+
getAccountInfo(configDir: DirectoryPath, authKey: string | null): Promise<Result<SubscriptionInfo, ServiceError>>;
|
|
8
|
+
sendTelemetry(payload: string, authKey: string): Promise<Result<string, string>>;
|
|
9
|
+
private axiosInstance;
|
|
10
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { getAuthInfo } from "../../client-utils/auth-manager.js";
|
|
3
|
+
import { envInfo } from "../env-info.js";
|
|
4
|
+
import { err, ok } from "neverthrow";
|
|
5
|
+
import { handleServiceError } from "../api-utils.js";
|
|
6
|
+
export class ApiService {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.apiBaseUrl = "https://api.apimatic.io";
|
|
9
|
+
}
|
|
10
|
+
async getAccountInfo(configDir, authKey) {
|
|
11
|
+
const authInfo = await getAuthInfo(configDir.toString());
|
|
12
|
+
if (authInfo === null && !authKey) {
|
|
13
|
+
return err("UNAUTHORIZED" /* ServiceError.UnAuthorized */);
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const token = authKey || (authInfo === null || authInfo === void 0 ? void 0 : authInfo.authKey);
|
|
17
|
+
const response = await this.axiosInstance(token).get("/account/profile");
|
|
18
|
+
if (response.status === 200) {
|
|
19
|
+
return ok(response.data);
|
|
20
|
+
}
|
|
21
|
+
return err("INVALID_RESPONSE" /* ServiceError.InvalidResponse */);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
return err(handleServiceError(error));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async sendTelemetry(payload, authKey) {
|
|
28
|
+
try {
|
|
29
|
+
const response = await this.axiosInstance(authKey).post("/telemetry/track", payload);
|
|
30
|
+
if (response.status === 200) {
|
|
31
|
+
return ok("telemetry sent");
|
|
32
|
+
}
|
|
33
|
+
return err("Failed to send telemetry data");
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
return err(handleServiceError(error));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
axiosInstance(apiKey) {
|
|
40
|
+
const headers = {
|
|
41
|
+
"User-Agent": envInfo.getUserAgent()
|
|
42
|
+
};
|
|
43
|
+
if (apiKey) {
|
|
44
|
+
headers.Authorization = `X-Auth-Key ${apiKey}`;
|
|
45
|
+
}
|
|
46
|
+
return axios.create({
|
|
47
|
+
baseURL: this.apiBaseUrl,
|
|
48
|
+
headers
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=api-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/api-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAY,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAG3E,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAgB,MAAM,iBAAiB,CAAC;AAEnE,MAAM,OAAO,UAAU;IAAvB;QACmB,eAAU,GAAG,yBAAkC,CAAC;IAmDnE,CAAC;IAjDQ,KAAK,CAAC,cAAc,CACzB,SAAwB,EACxB,OAAsB;QAEtB,MAAM,QAAQ,GAAoB,MAAM,WAAW,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC1E,IAAI,QAAQ,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,OAAO,GAAG,gDAA2B,CAAC;QACxC,CAAC;QAED,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,OAAO,KAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CA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
|
|
1
|
+
import { Result } from "neverthrow";
|
|
2
|
+
import { ServiceError } from "../api-utils.js";
|
|
3
|
+
export interface DeviceAuthToken {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class AuthService {
|
|
7
|
+
private readonly apiBaseUrl;
|
|
8
|
+
private axiosInstance;
|
|
9
|
+
getDeviceLoginUrl(state: string): string;
|
|
10
|
+
getDeviceLoginToken(state: string): Promise<Result<DeviceAuthToken, ServiceError>>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { envInfo } from "../env-info.js";
|
|
3
|
+
import { err, ok } from "neverthrow";
|
|
4
|
+
import { handleServiceError } from "../api-utils.js";
|
|
5
|
+
export class AuthService {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.apiBaseUrl = "https://auth.apimatic.io";
|
|
8
|
+
this.axiosInstance = axios.create({
|
|
9
|
+
baseURL: this.apiBaseUrl,
|
|
10
|
+
timeout: 20000,
|
|
11
|
+
headers: {
|
|
12
|
+
"User-Agent": envInfo.getUserAgent()
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
getDeviceLoginUrl(state) {
|
|
17
|
+
return `${this.apiBaseUrl}/device-auth/login?state=${state}`;
|
|
18
|
+
}
|
|
19
|
+
async getDeviceLoginToken(state) {
|
|
20
|
+
var _a;
|
|
21
|
+
try {
|
|
22
|
+
const response = await this.axiosInstance.get(`/device-auth/token?state=${state}`);
|
|
23
|
+
if (response.status === 200 && ((_a = response.data) === null || _a === void 0 ? void 0 : _a.apiKey)) {
|
|
24
|
+
return ok({ apiKey: response.data.apiKey });
|
|
25
|
+
}
|
|
26
|
+
return err("INVALID_RESPONSE" /* ServiceError.InvalidResponse */);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
return err(handleServiceError(error));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=auth-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/auth-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAgB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAOnE,MAAM,OAAO,WAAW;IAAxB;QACmB,eAAU,GAAG,0BAAmC,CAAC;QAE1D,kBAAa,GAAkB,KAAK,CAAC,MAAM,CAAC;YAClD,OAAO,EAAE,IAAI,CAAC,UAAU;YACxB,OAAO,EAAE,KAAK;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE;aACrC;SACF,CAAC,CAAC;IAgBL,CAAC;IAdQ,iBAAiB,CAAC,KAAa;QACpC,OAAO,GAAG,IAAI,CAAC,UAAU,4BAA4B,KAAK,EAAE,CAAC;IAC/D,CAAC;IACM,KAAK,CAAC,mBAAmB,CAAC,KAAa;;QAC5C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,4BAA4B,KAAK,EAAE,CAAC,CAAC;YACnF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,KAAI,MAAA,QAAQ,CAAC,IAAI,0CAAE,MAAM,CAAA,EAAE,CAAC;gBACrD,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAC9C,CAAC;YACD,OAAO,GAAG,uDAA8B,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Platforms } from "@apimatic/sdk";
|
|
1
2
|
import { Result } from "../../types/common/result.js";
|
|
2
3
|
import { Sdl } from "../../types/sdl/sdl.js";
|
|
3
4
|
import { FilePath } from "../../types/file/filePath.js";
|
|
@@ -7,11 +8,12 @@ export declare class PortalService {
|
|
|
7
8
|
private readonly TIMEOUT;
|
|
8
9
|
private readonly fileService;
|
|
9
10
|
generatePortal(buildPath: FilePath, configDir: DirectoryPath, authKey: string | null): Promise<Result<NodeJS.ReadableStream, string | NodeJS.ReadableStream>>;
|
|
11
|
+
generateSdk(specPath: FilePath, sdkPlatform: Platforms, configDir: DirectoryPath, authKey: string | null): Promise<Result<NodeJS.ReadableStream, string>>;
|
|
10
12
|
generateSdl(specPath: string, configDir: string): Promise<Result<Sdl, string>>;
|
|
11
13
|
private createGenericErrorResult;
|
|
12
14
|
private createAuthorizationHeader;
|
|
13
|
-
private getUserAgent;
|
|
14
15
|
private createApiClient;
|
|
15
16
|
private handlePortalGenerationErrors;
|
|
16
17
|
private parseErrorResponse;
|
|
18
|
+
private handleSdkGenerationErrors;
|
|
17
19
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as os from "os";
|
|
2
1
|
import fs from "fs-extra";
|
|
3
|
-
import { ContentType, DocsPortalManagementController, Client, UnauthorizedResponseError, ProblemDetailsError, FileWrapper, ApiError, TransformationController, ExportFormats, InternalServerErrorResponseError } from "@apimatic/sdk";
|
|
2
|
+
import { ContentType, DocsPortalManagementController, Client, UnauthorizedResponseError, ProblemDetailsError, FileWrapper, ApiError, TransformationController, ExportFormats, InternalServerErrorResponseError, CodeGenerationExternalApisController } from "@apimatic/sdk";
|
|
4
3
|
import { getAuthInfo } from "../../client-utils/auth-manager.js";
|
|
5
4
|
import { Result } from "../../types/common/result.js";
|
|
6
5
|
import { getMessageInRedColor, parseStreamBodyToJson } from "../../utils/utils.js";
|
|
7
6
|
import { FileService } from "../file-service.js";
|
|
7
|
+
import { envInfo } from "../env-info.js";
|
|
8
8
|
export class PortalService {
|
|
9
9
|
constructor() {
|
|
10
10
|
this.CONTENT_TYPE = ContentType.EnumMultipartformdata;
|
|
@@ -19,22 +19,22 @@ export class PortalService {
|
|
|
19
19
|
customHeaderAuthenticationCredentials: {
|
|
20
20
|
Authorization: authorizationHeader
|
|
21
21
|
},
|
|
22
|
-
userAgent:
|
|
22
|
+
userAgent: envInfo.getUserAgent(),
|
|
23
23
|
timeout: this.TIMEOUT
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
this.handlePortalGenerationErrors = async (error) => {
|
|
27
|
-
var _a;
|
|
27
|
+
var _a, _b, _c, _d;
|
|
28
28
|
if (error instanceof UnauthorizedResponseError) {
|
|
29
29
|
//401
|
|
30
|
-
const
|
|
31
|
-
return getMessageInRedColor((_a =
|
|
30
|
+
const unAuthError = error;
|
|
31
|
+
return getMessageInRedColor((_b = (_a = unAuthError.result) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : "Authorization has been denied for this request.");
|
|
32
32
|
}
|
|
33
33
|
else if (error instanceof ProblemDetailsError) {
|
|
34
34
|
//400 & 403
|
|
35
|
-
const
|
|
36
|
-
const message =
|
|
37
|
-
return getMessageInRedColor(
|
|
35
|
+
const probDetailsError = error;
|
|
36
|
+
const message = (_d = (_c = probDetailsError.result.errors) === null || _c === void 0 ? void 0 : _c['']) === null || _d === void 0 ? void 0 : _d[0];
|
|
37
|
+
return getMessageInRedColor(probDetailsError.result.title + "\n- " + message);
|
|
38
38
|
}
|
|
39
39
|
else if (error instanceof ApiError && error.statusCode === 422) {
|
|
40
40
|
//422
|
|
@@ -56,6 +56,29 @@ export class PortalService {
|
|
|
56
56
|
}
|
|
57
57
|
throw error;
|
|
58
58
|
};
|
|
59
|
+
this.handleSdkGenerationErrors = async (error) => {
|
|
60
|
+
var _a, _b, _c, _d;
|
|
61
|
+
//TODO: Update the spec file to define different error code response types so that they can be handled here. Currently all failures go to the last else statement
|
|
62
|
+
if (error instanceof UnauthorizedResponseError) {
|
|
63
|
+
//401
|
|
64
|
+
const unAuthError = error;
|
|
65
|
+
return getMessageInRedColor((_b = (_a = unAuthError.result) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : "Authorization has been denied for this request.");
|
|
66
|
+
}
|
|
67
|
+
else if (error instanceof ProblemDetailsError) {
|
|
68
|
+
//400 & 403
|
|
69
|
+
const probDetailsError = error;
|
|
70
|
+
const message = (_d = (_c = probDetailsError.result.errors) === null || _c === void 0 ? void 0 : _c['']) === null || _d === void 0 ? void 0 : _d[0];
|
|
71
|
+
return getMessageInRedColor(probDetailsError.result.title + "\n- " + message);
|
|
72
|
+
}
|
|
73
|
+
else if (error instanceof InternalServerErrorResponseError) {
|
|
74
|
+
//500
|
|
75
|
+
const body = await this.parseErrorResponse(error);
|
|
76
|
+
return getMessageInRedColor(`${body.message} Please try again later or reach out to our team at support@apimatic.io for help if your problem persists.`);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return getMessageInRedColor("An unexpected error occurred while generating the portal, please try again later. If the problem persists, please reach out to our team at support@apimatic.io");
|
|
80
|
+
}
|
|
81
|
+
};
|
|
59
82
|
}
|
|
60
83
|
async generatePortal(buildPath, configDir, authKey) {
|
|
61
84
|
const buildFileStream = await this.fileService.getStream(buildPath);
|
|
@@ -75,6 +98,25 @@ export class PortalService {
|
|
|
75
98
|
buildFileStream.close();
|
|
76
99
|
}
|
|
77
100
|
}
|
|
101
|
+
async generateSdk(specPath, sdkPlatform, configDir, authKey) {
|
|
102
|
+
const specFileStream = await this.fileService.getStream(specPath);
|
|
103
|
+
const file = new FileWrapper(specFileStream);
|
|
104
|
+
const authInfo = await getAuthInfo(configDir.toString());
|
|
105
|
+
const authorizationHeader = this.createAuthorizationHeader(authInfo, authKey);
|
|
106
|
+
const client = this.createApiClient(authorizationHeader);
|
|
107
|
+
const sdkGenerationController = new CodeGenerationExternalApisController(client);
|
|
108
|
+
try {
|
|
109
|
+
const response = await sdkGenerationController.generateSdkViaFile(file, sdkPlatform);
|
|
110
|
+
const sdkResponse = await sdkGenerationController.downloadSdk(response.result.id);
|
|
111
|
+
return Result.success(sdkResponse.result);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
return Result.failure(await this.handleSdkGenerationErrors(error));
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
specFileStream.close();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
78
120
|
async generateSdl(specPath, configDir) {
|
|
79
121
|
if (!(await fs.pathExists(specPath))) {
|
|
80
122
|
return Result.failure("Spec file doesn't exist");
|
|
@@ -105,11 +147,5 @@ export class PortalService {
|
|
|
105
147
|
createGenericErrorResult() {
|
|
106
148
|
return Result.failure("An unexpected error occurred");
|
|
107
149
|
}
|
|
108
|
-
getUserAgent() {
|
|
109
|
-
const osInfo = `${os.platform()} ${os.release()}`;
|
|
110
|
-
const engine = "Node.js";
|
|
111
|
-
const engineVersion = process.version;
|
|
112
|
-
return `APIMATIC CLI - [OS: ${osInfo}, Engine: ${engine}/${engineVersion}]`;
|
|
113
|
-
}
|
|
114
150
|
}
|
|
115
151
|
//# sourceMappingURL=portal-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/portal-service.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"portal-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/portal-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EACL,WAAW,EACX,8BAA8B,EAC9B,MAAM,EACN,yBAAyB,EACzB,mBAAmB,EACnB,WAAW,EAEX,QAAQ,EACR,wBAAwB,EAExB,aAAa,EACb,gCAAgC,EAChC,oCAAoC,EAErC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAY,WAAW,EAAE,MA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,CAAC,MAA+B,CAAC,CAAQ,CAAC,CAAC;YAC/F,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC;YACzC,CAAC;QACH,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC;QACzC,CAAC;IACH,CAAC;IAEO,wBAAwB;QAC9B,OAAO,MAAM,CAAC,OAAO,CAAc,8BAA8B,CAAC,CAAC;IACrE,CAAC;CA0EF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DomainEvent } from "../../types/events/domain-event.js";
|
|
2
|
+
export declare class TelemetryService {
|
|
3
|
+
private readonly configDirectory;
|
|
4
|
+
private readonly apiService;
|
|
5
|
+
constructor(configDirectory: string);
|
|
6
|
+
trackEvent<T extends DomainEvent>(event: T): Promise<void>;
|
|
7
|
+
private getAuthInfo;
|
|
8
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import process from "process";
|
|
2
|
+
import os from "os";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import { envInfo } from "../env-info.js";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { ApiService } from "./api-service.js";
|
|
7
|
+
export class TelemetryService {
|
|
8
|
+
constructor(configDirectory) {
|
|
9
|
+
this.configDirectory = configDirectory;
|
|
10
|
+
this.apiService = new ApiService();
|
|
11
|
+
}
|
|
12
|
+
async trackEvent(event) {
|
|
13
|
+
const authInfo = await this.getAuthInfo(this.configDirectory);
|
|
14
|
+
const telemetryOptedOut = process.env.APIMATIC_CLI_TELEMETRY_OPTOUT === "1";
|
|
15
|
+
const authKey = authInfo === null || authInfo === void 0 ? void 0 : authInfo.authKey;
|
|
16
|
+
if (telemetryOptedOut || (authInfo === null || authInfo === void 0 ? void 0 : authInfo.APIMATIC_CLI_TELEMETRY_OPTOUT) === "1" || !authKey) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const payload = {
|
|
20
|
+
payload: event,
|
|
21
|
+
timestamp: new Date().toISOString(),
|
|
22
|
+
cliVersion: envInfo.getCLIVersion(),
|
|
23
|
+
platform: os.platform(),
|
|
24
|
+
releaseVersion: os.release(),
|
|
25
|
+
nodeVersion: process.version,
|
|
26
|
+
};
|
|
27
|
+
const result = await this.apiService.sendTelemetry(JSON.stringify(payload), authKey);
|
|
28
|
+
// eslint-disable-next-line no-undef
|
|
29
|
+
result.mapErr((err) => console.log(err));
|
|
30
|
+
}
|
|
31
|
+
async getAuthInfo(configDirectory) {
|
|
32
|
+
try {
|
|
33
|
+
return JSON.parse(await fs.readFile(path.join(configDirectory, "config.json"), "utf8"));
|
|
34
|
+
}
|
|
35
|
+
catch (_a) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=telemetry-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/telemetry-service.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,UAAU,CAAC;AAG1B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAW9C,MAAM,OAAO,gBAAgB;IAG3B,YAA6B,eAAuB;QAAvB,oBAAe,GAAf,eAAe,CAAQ;QAFnC,eAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAG/C,CAAC;IAEM,KAAK,CAAC,UAAU,CAAwB,KAAQ;QACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC9D,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,KAAK,GAAG,CAAC;QAC5E,MAAM,OAAO,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC;QAElC,IAAI,iBAAiB,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,6BAA6B,MAAK,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;YACrF,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAqB;YAChC,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,UAAU,EAAE,OAAO,CAAC,aAAa,EAAE;YACnC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE;YACvB,cAAc,EAAE,EAAE,CAAC,OAAO,EAAE;YAC5B,WAAW,EAAE,OAAO,CAAC,OAAO;SAC7B,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QACrF,oCAAoC;QACpC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3C,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,eAAuB;QAC/C,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1F,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DirectoryPath } from "../types/file/directoryPath.js";
|
|
2
|
+
import { withDir } from "tmp-promise";
|
|
3
|
+
export function withDirPath(fn) {
|
|
4
|
+
return withDir(results => fn(new DirectoryPath(results.path)), { unsafeCleanup: true });
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=tmp-extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tmp-extensions.js","sourceRoot":"","sources":["../../src/infrastructure/tmp-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,UAAU,WAAW,CACzB,EAA0C;IAE1C,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { log } from "@clack/prompts";
|
|
2
|
+
export class LoginPrompts {
|
|
3
|
+
logError(error) {
|
|
4
|
+
log.error(error);
|
|
5
|
+
}
|
|
6
|
+
loginSuccessful(email) {
|
|
7
|
+
log.success(`Successfully logged in as ${email}`);
|
|
8
|
+
}
|
|
9
|
+
openBrowser() {
|
|
10
|
+
log.info("Please continue with authentication in the opened browser window.");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/prompts/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,MAAM,OAAO,YAAY;IACvB,QAAQ,CAAC,KAAa;QACpB,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,eAAe,CAAC,KAAa;QAC3B,GAAG,CAAC,OAAO,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,WAAW;QACT,GAAG,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;IAChF,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { select, cancel, isCancel, outro, confirm, log } from "@clack/prompts";
|
|
2
|
+
export class PortalCopilotPrompts {
|
|
3
|
+
async selectCopilotKey(keys) {
|
|
4
|
+
const selectedKey = await select({
|
|
5
|
+
message: 'Select API Copilot key form your subscription:',
|
|
6
|
+
maxItems: 10,
|
|
7
|
+
options: keys.map((key) => ({
|
|
8
|
+
value: key,
|
|
9
|
+
label: key
|
|
10
|
+
}))
|
|
11
|
+
});
|
|
12
|
+
if (isCancel(selectedKey)) {
|
|
13
|
+
cancel("Operation cancelled.");
|
|
14
|
+
return process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
return selectedKey;
|
|
17
|
+
}
|
|
18
|
+
copilotConfigured(apiCopilotKey) {
|
|
19
|
+
outro(`API Copilot is configured successfully with key '${apiCopilotKey}'. You can now generate a portal using the command 'apimatic portal:generate'`);
|
|
20
|
+
}
|
|
21
|
+
async confirmOverwrite() {
|
|
22
|
+
const shouldOverwrite = await confirm({
|
|
23
|
+
message: "API Copilot configuration already exists. Do you want to overwrite?",
|
|
24
|
+
initialValue: false,
|
|
25
|
+
});
|
|
26
|
+
if (isCancel(shouldOverwrite)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return shouldOverwrite;
|
|
30
|
+
}
|
|
31
|
+
logError(error) {
|
|
32
|
+
log.error(error);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=copilot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/prompts/portal/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE/E,MAAM,OAAO,oBAAoB;IAExB,KAAK,CAAC,gBAAgB,CAAC,IAAc;QAC1C,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC;YAC/B,OAAO,EAAE,gDAAgD;YACzD,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;gBAC1B,KAAK,EAAE,GAAG;gBACV,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;SACJ,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YAC1B,MAAM,CAAC,sBAAsB,CAAC,CAAC;YAC/B,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAEM,iBAAiB,CAAC,aAAqB;QAC5C,KAAK,CACH,oDAAoD,aAAa,+EAA+E,CACjJ,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,gBAAgB;QAC3B,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC;YACpC,OAAO,EAAE,qEAAqE;YAC9E,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -2,7 +2,6 @@ import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
|
2
2
|
export declare class PortalGeneratePrompts {
|
|
3
3
|
private readonly spin;
|
|
4
4
|
overwritePortal(directory: DirectoryPath): Promise<boolean>;
|
|
5
|
-
existingDestinationPortalZipPrompt(): Promise<boolean>;
|
|
6
5
|
displayPortalGenerationMessage(): void;
|
|
7
6
|
displayPortalGenerationSuccessMessage(): void;
|
|
8
7
|
displayPortalGenerationErrorMessage(): void;
|
|
@@ -1,46 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { outro, spinner, isCancel, confirm, log } from "@clack/prompts";
|
|
2
|
+
import { getMessageInRedColor, getMessageInMagentaColor, getMessageInCyanColor } from "../../utils/utils.js";
|
|
3
3
|
export class PortalGeneratePrompts {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.spin = spinner();
|
|
6
6
|
}
|
|
7
7
|
async overwritePortal(directory) {
|
|
8
|
-
const overwrite = await
|
|
9
|
-
message:
|
|
10
|
-
options: [
|
|
11
|
-
{ value: true, label: "Yes" },
|
|
12
|
-
{ value: false, label: "No" }
|
|
13
|
-
],
|
|
8
|
+
const overwrite = await confirm({
|
|
9
|
+
message: `The destination '${directory}' is not empty, do you want to overwrite?`,
|
|
14
10
|
initialValue: false
|
|
15
11
|
});
|
|
16
12
|
if (isCancel(overwrite)) {
|
|
17
|
-
|
|
18
|
-
process.exit(1);
|
|
13
|
+
return false;
|
|
19
14
|
}
|
|
20
|
-
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
outro("Please enter a different destination folder or remove the existing files and try again.");
|
|
24
|
-
process.exit(1);
|
|
25
|
-
// TODO: it should return false (no process exit);
|
|
26
|
-
}
|
|
27
|
-
async existingDestinationPortalZipPrompt() {
|
|
28
|
-
const useExistingZip = await select({
|
|
29
|
-
message: `⚠️ A zip file already exists at the specified destination path, do you want to overwrite it?`,
|
|
30
|
-
options: [
|
|
31
|
-
{ value: "yes", label: "Yes" },
|
|
32
|
-
{ value: "no", label: "No" }
|
|
33
|
-
],
|
|
34
|
-
initialValue: "no"
|
|
35
|
-
});
|
|
36
|
-
if (isCancel(useExistingZip)) {
|
|
37
|
-
cancel("Operation cancelled.");
|
|
38
|
-
return process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
if (useExistingZip === "no") {
|
|
41
|
-
outro("Please enter a different destination path or delete the existing zip file and try again.");
|
|
42
|
-
}
|
|
43
|
-
return useExistingZip === "yes";
|
|
15
|
+
return overwrite;
|
|
44
16
|
}
|
|
45
17
|
displayPortalGenerationMessage() {
|
|
46
18
|
this.spin.start(getMessageInMagentaColor("Generating portal"));
|
|
@@ -57,7 +29,7 @@ export class PortalGeneratePrompts {
|
|
|
57
29
|
outro(`The generated portal can be found at ${generatedPortalPath}`);
|
|
58
30
|
}
|
|
59
31
|
logError(error) {
|
|
60
|
-
|
|
32
|
+
log.error(error);
|
|
61
33
|
}
|
|
62
34
|
//This clears the standard input to allow interrupts like CTRL+C to work properly.
|
|
63
35
|
cleanUpStandardInput() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/prompts/portal/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/prompts/portal/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,qBAAqB;IAAlC;QACmB,SAAI,GAAG,OAAO,EAAE,CAAC;IA4CpC,CAAC;IA1CQ,KAAK,CAAC,eAAe,CAAC,SAAwB;QACnD,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,8BAA8B;QAC5B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,qCAAqC;QACnC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,mCAAmC,CAAC,CAAC,CAAC;QAC3E,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED,mCAAmC;QACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,2BAA2B,CAAC,CAAC,CAAC;QAClE,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED,mBAAmB,CAAC,mBAA2B;QAC7C,KAAK,CAAC,wCAAwC,mBAAmB,EAAE,CAAC,CAAC;IACvE,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"}
|
|
@@ -10,9 +10,6 @@ export declare class PortalQuickstartPrompts extends BasePrompts {
|
|
|
10
10
|
email: string;
|
|
11
11
|
password: string;
|
|
12
12
|
}>;
|
|
13
|
-
displayLoggingInMessage(): void;
|
|
14
|
-
displayLoggingInErrorMessage(): void;
|
|
15
|
-
displayLoggedInMessage(): void;
|
|
16
13
|
removeQuotes(str: string): string;
|
|
17
14
|
specPrompt(): Promise<string>;
|
|
18
15
|
displaySpecValidationMessage(): void;
|
|
@@ -27,4 +24,7 @@ export declare class PortalQuickstartPrompts extends BasePrompts {
|
|
|
27
24
|
displayBuildDirectoryGenerationSuccessMessage(targetFolder: string): void;
|
|
28
25
|
displayBuildDirectoryAsTree(targetFolder: string): void;
|
|
29
26
|
displayOutroMessage(buildDirectory: string): void;
|
|
27
|
+
getLoggedInFirst(): void;
|
|
28
|
+
displayLoggedInMessage(email: string): void;
|
|
29
|
+
logError(error: string): void;
|
|
30
30
|
}
|