@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-client.js","sourceRoot":"","sources":["../../src/client-utils/sdk-client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"sdk-client.js","sourceRoot":"","sources":["../../src/client-utils/sdk-client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAY,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAU/D,MAAM,OAAO,SAAS;IAKpB;;;;;OAKG;IACI,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;YACxB,SAAS,CAAC,QAAQ,GAAG,IAAI,SAAS,EAAE,CAAC;QACvC,CAAC;QAED,OAAO,SAAS,CAAC,QAAQ,CAAC;IAC5B,CAAC;IAED;;;OAGG;IAEI,KAAK,CAAC,KAAK,CAAC,KAAa,EAAE,QAAgB,EAAE,SAAiB;QACnE,MAAM,WAAW,GAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;QACrD,MAAM,OAAO,GAAW,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3D,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,KAAK,GAAG,CAAC;QAE9E,MAAM,WAAW,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GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAC9C,CAAC;QACD,IAAI,cAAc,CAAC,OAAO,KAAK,EAAE,EAAE,CAAC;YAClC,OAAO,IAAI,MAAM,CAAC;gBAChB,OAAO,EAAE,CAAC;gBACV,qCAAqC,EAAE;oBACrC,aAAa,EAAE,cAAc,cAAc,CAAC,OAAO,EAAE;iBACtD;aACF,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,WAAwB;QAC/C,MAAM,MAAM,GAAG;YACb,OAAO,EAAE;gBACP,aAAa,EAAE,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAE;aACxF;SACF,CAAC;QACF,MAAM,QAAQ,GAAkB,MAAM,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3E,OAAO,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC;IACtC,CAAC;;AA1Fc,iBAAO,GAAG,GAAG,OAAO,kBAAkB,CAAC"}
|
|
@@ -3,12 +3,12 @@ export default class Transform extends Command {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
+
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
6
8
|
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
9
|
file: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
10
|
url: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
11
|
destination: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
-
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
};
|
|
13
13
|
run(): Promise<void>;
|
|
14
14
|
}
|
|
@@ -8,6 +8,7 @@ import { printValidationMessages } from "../../utils/utils.js";
|
|
|
8
8
|
import { getFileNameFromPath, replaceHTML } from "../../utils/utils.js";
|
|
9
9
|
import { DestinationFormats, TransformationFormats } from "../../types/api/transform.js";
|
|
10
10
|
import { getValidFormat, getTransformationId, downloadTransformationFile } from "../../controllers/api/transform.js";
|
|
11
|
+
import { FlagsProvider } from "../../types/flags-provider.js";
|
|
11
12
|
const formats = Object.keys(TransformationFormats).join("|");
|
|
12
13
|
class Transform extends Command {
|
|
13
14
|
async run() {
|
|
@@ -80,32 +81,26 @@ class Transform extends Command {
|
|
|
80
81
|
_a = Transform;
|
|
81
82
|
Transform.description = `Transform API specifications from one format to another. Supports [10+ different formats](https://www.apimatic.io/transformer/#supported-formats) including OpenApi/Swagger, RAML, WSDL and Postman Collections.`;
|
|
82
83
|
Transform.examples = [
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
`apimatic api:transform --format="OpenApi3Json" --file="./specs/sample.json" --destination="D:/"`,
|
|
85
|
+
`apimatic api:transform --format=RAML --url="https://petstore.swagger.io/v2/swagger.json" --destination="D:/"`
|
|
85
86
|
];
|
|
86
|
-
Transform.flags = {
|
|
87
|
-
format: Flags.string({
|
|
87
|
+
Transform.flags = Object.assign(Object.assign({ format: Flags.string({
|
|
88
88
|
parse: async (format) => getValidFormat(format),
|
|
89
89
|
required: true,
|
|
90
90
|
description: `specification format to transform API specification into
|
|
91
91
|
${formats}`
|
|
92
|
-
}),
|
|
93
|
-
file: Flags.string({
|
|
92
|
+
}), file: Flags.string({
|
|
94
93
|
parse: async (input) => path.resolve(input),
|
|
95
94
|
default: "",
|
|
96
95
|
description: "path to the API specification file to transform"
|
|
97
|
-
}),
|
|
98
|
-
url: Flags.string({
|
|
96
|
+
}), url: Flags.string({
|
|
99
97
|
default: "",
|
|
100
98
|
description: "URL to the API specification file to transform. Can be used in place of the --file option if the API specification is publicly available."
|
|
101
|
-
}),
|
|
102
|
-
destination: Flags.string({
|
|
99
|
+
}), destination: Flags.string({
|
|
103
100
|
parse: async (input) => path.resolve(input),
|
|
104
101
|
default: path.resolve("./"),
|
|
105
|
-
description: "directory to download transformed file to"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"auth-key": Flags.string({ description: "override current authentication state with an authentication key" })
|
|
109
|
-
};
|
|
102
|
+
description: "directory to download transformed file to",
|
|
103
|
+
char: "d"
|
|
104
|
+
}) }, FlagsProvider.force), FlagsProvider.authKey);
|
|
110
105
|
export default Transform;
|
|
111
106
|
//# sourceMappingURL=transform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/commands/api/transform.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAoC,MAAM,eAAe,CAAC;AAG3F,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
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X,WAAW,EACT,2IAA2I;KAC9I,CAAC,EACF,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC;QACxB,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAC3C,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAC3B,WAAW,EAAE,2CAA2C;QACxD,IAAI,EAAE,GAAG;KACV,CAAC,IACC,aAAa,CAAC,KAAK,GACnB,aAAa,CAAC,OAAO,CAxBd,CAyBV;eAjCiB,SAAS"}
|
|
@@ -3,9 +3,9 @@ export default class Validate extends Command {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
+
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
7
|
file: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
8
|
url: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
-
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
};
|
|
10
10
|
run(): Promise<void>;
|
|
11
11
|
}
|
|
@@ -4,6 +4,7 @@ import { ApiValidationExternalApisController } from "@apimatic/sdk";
|
|
|
4
4
|
import { SDKClient } from "../../client-utils/sdk-client.js";
|
|
5
5
|
import { getValidationSummary } from "../../controllers/api/validate.js";
|
|
6
6
|
import { printValidationMessages, replaceHTML } from "../../utils/utils.js";
|
|
7
|
+
import { FlagsProvider } from "../../types/flags-provider.js";
|
|
7
8
|
class Validate extends Command {
|
|
8
9
|
async run() {
|
|
9
10
|
const { flags } = await this.parse(Validate);
|
|
@@ -57,17 +58,12 @@ class Validate extends Command {
|
|
|
57
58
|
}
|
|
58
59
|
Validate.description = "Validate the syntactic and semantic correctness of an API specification";
|
|
59
60
|
Validate.examples = [
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
`apimatic api:validate --file="./specs/sample.json"`,
|
|
62
|
+
`apimatic api:validate --url=https://petstore.swagger.io/v2/swagger.json`
|
|
62
63
|
];
|
|
63
|
-
Validate.flags = {
|
|
64
|
-
file: Flags.string({ default: "", description: "Path to the API specification file to validate" }),
|
|
65
|
-
url: Flags.string({
|
|
64
|
+
Validate.flags = Object.assign({ file: Flags.string({ default: "", description: "Path to the API specification file to validate" }), url: Flags.string({
|
|
66
65
|
default: "",
|
|
67
66
|
description: "URL to the specification file to validate. Can be used in place of the --file option if the API specification is publicly available."
|
|
68
|
-
}),
|
|
69
|
-
// docs: flags.boolean({ default: false, description: "Validate specification for docs generation" }), // Next tier, not included in API spec
|
|
70
|
-
"auth-key": Flags.string({ description: "override current authentication state with an authentication key" })
|
|
71
|
-
};
|
|
67
|
+
}) }, FlagsProvider.authKey);
|
|
72
68
|
export default Validate;
|
|
73
69
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/commands/api/validate.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAY,mCAAmC,EAAgC,MAAM,eAAe,CAAC;AAG5G,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/commands/api/validate.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE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6B,CAAC,UAAU,KAAK,GAAG;gBAChD,KAA6B,CAAC,IAAI;gBACnC,OAAQ,KAA6B,CAAC,IAAI,KAAK,QAAQ,EACvD,CAAC;gBACD,IAAI,CAAC,KAAK,CAAE,KAA6B,CAAC,IAAI,CAAC,CAAC;YAClD,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,KAAK,CAAC,GAAI,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;IACH,CAAC;;AApEM,oBAAW,GAAG,yEAAyE,CAAC;AAExF,iBAAQ,GAAG;IAChB,oDAAoD;IACpD,yEAAyE;CAC1E,CAAC;AAEK,cAAK,mBACV,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,gDAAgD,EAAE,CAAC,EAClG,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC;QAChB,OAAO,EAAE,EAAE;QACX,WAAW,EACT,sIAAsI;KACzI,CAAC,IAEC,aAAa,CAAC,OAAO,EACxB;eAjBiB,QAAQ"}
|
|
@@ -3,7 +3,8 @@ export default class Login extends Command {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
-
"auth-key": import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
};
|
|
8
|
+
private readonly prompts;
|
|
8
9
|
run(): Promise<void>;
|
|
9
10
|
}
|
|
@@ -1,73 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { getAuthInfo } from "../../client-utils/auth-manager.js";
|
|
1
|
+
import { Command, Flags } from "@oclif/core";
|
|
2
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
3
|
+
import { LoginPrompts } from "../../prompts/auth/login.js";
|
|
4
|
+
import { LoginAction } from "../../actions/auth/login.js";
|
|
6
5
|
class Login extends Command {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.prompts = new LoginPrompts();
|
|
9
|
+
}
|
|
7
10
|
async run() {
|
|
8
|
-
const { flags } = await this.parse(Login);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// Check if already logged in
|
|
12
|
-
const storedAuthInfo = await getAuthInfo(configDir);
|
|
13
|
-
if (storedAuthInfo && storedAuthInfo.authKey) {
|
|
14
|
-
if (storedAuthInfo.email) {
|
|
15
|
-
return this.log(`You are already logged in as '${storedAuthInfo.email}'. Use 'auth:logout' to logout before logging in again.`);
|
|
16
|
-
}
|
|
17
|
-
return this.log(`You are already logged in with authentication key. Use 'auth:logout' to logout before logging in again.`);
|
|
18
|
-
}
|
|
19
|
-
const client = SDKClient.getInstance();
|
|
20
|
-
// If user is setting auth key
|
|
21
|
-
if (flags["auth-key"]) {
|
|
22
|
-
const response = client.setAuthKey(flags["auth-key"], configDir);
|
|
23
|
-
return this.log(response);
|
|
24
|
-
}
|
|
25
|
-
// If user logs in with email and password
|
|
26
|
-
const email = await text({
|
|
27
|
-
message: "Enter your registered email:",
|
|
28
|
-
validate: (input) => {
|
|
29
|
-
if (!input) {
|
|
30
|
-
return getMessageInRedColor("Email is required.");
|
|
31
|
-
}
|
|
32
|
-
const emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
|
33
|
-
if (!emailRegex.test(input)) {
|
|
34
|
-
return getMessageInRedColor("Please enter a valid email address.");
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
const pass = await password({
|
|
39
|
-
message: "Please enter your password:",
|
|
40
|
-
validate: (input) => {
|
|
41
|
-
if (!input) {
|
|
42
|
-
return getMessageInRedColor("Password is required.");
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
const response = await client.login(email, pass, configDir);
|
|
47
|
-
outro(response);
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
if (error && error.response) {
|
|
51
|
-
const apiError = error;
|
|
52
|
-
const apiResponse = apiError.response;
|
|
53
|
-
if (apiResponse) {
|
|
54
|
-
const responseData = apiResponse.data;
|
|
55
|
-
if (apiResponse.status === 403 && responseData) {
|
|
56
|
-
return this.error(replaceHTML(JSON.stringify(responseData)));
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
return this.error(apiError.message);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
this.error(error.message);
|
|
11
|
+
const { flags: { "auth-key": authKey } } = await this.parse(Login);
|
|
12
|
+
if (authKey === "") {
|
|
13
|
+
this.error("Flag --auth-key must not be empty when provided.");
|
|
64
14
|
}
|
|
15
|
+
const loginAction = new LoginAction(new DirectoryPath(this.config.configDir));
|
|
16
|
+
const result = await loginAction.execute(authKey);
|
|
17
|
+
result.match((email) => this.prompts.loginSuccessful(email), (error) => this.prompts.logError(error));
|
|
65
18
|
}
|
|
66
19
|
}
|
|
67
20
|
Login.description = "Login using your APIMatic credentials or an API Key";
|
|
68
|
-
Login.examples = [
|
|
21
|
+
Login.examples = [`apimatic auth:login`, `apimatic auth:login --auth-key={api-key}`];
|
|
69
22
|
Login.flags = {
|
|
70
|
-
"auth-key": Flags.string({
|
|
23
|
+
"auth-key": Flags.string({
|
|
24
|
+
char: "k",
|
|
25
|
+
description: "Sets authentication key for all commands.",
|
|
26
|
+
})
|
|
71
27
|
};
|
|
72
28
|
export default Login;
|
|
73
29
|
//# sourceMappingURL=login.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/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AM,CAAC;QACvB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,2CAA2C;KACzD,CAAC;CACH,AALW,CAKV;eAViB,KAAK"}
|
|
@@ -12,7 +12,7 @@ class Login extends Command {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
Login.description = "
|
|
16
|
-
Login.examples = [
|
|
15
|
+
Login.description = "Clears the local login credentials.";
|
|
16
|
+
Login.examples = [`apimatic auth:logout`];
|
|
17
17
|
export default Login;
|
|
18
18
|
//# sourceMappingURL=logout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,MAAqB,KAAM,SAAQ,OAAO;IAKxC,KAAK,CAAC,GAAG;QACP,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;YACvC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAE5D,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,KAAe,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;;AAbM,iBAAW,GAAG
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,MAAqB,KAAM,SAAQ,OAAO;IAKxC,KAAK,CAAC,GAAG;QACP,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;YACvC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAE5D,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,KAAe,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;;AAbM,iBAAW,GAAG,qCAAqC,CAAC;AAEpD,cAAQ,GAAG,CAAC,sBAAsB,CAAC,CAAC;eAHxB,KAAK"}
|
|
@@ -4,6 +4,7 @@ class Status extends Command {
|
|
|
4
4
|
async run() {
|
|
5
5
|
try {
|
|
6
6
|
const client = SDKClient.getInstance();
|
|
7
|
+
// TODO: Add validation for auth key from the server.
|
|
7
8
|
const response = await client.status(this.config.configDir);
|
|
8
9
|
this.log(response);
|
|
9
10
|
}
|
|
@@ -12,7 +13,7 @@ class Status extends Command {
|
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
|
-
Status.description = "View
|
|
16
|
-
Status.examples = [
|
|
16
|
+
Status.description = "View the currently logged in user.";
|
|
17
|
+
Status.examples = [`apimatic auth:status`];
|
|
17
18
|
export default Status;
|
|
18
19
|
//# sourceMappingURL=status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/auth/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,MAAqB,MAAO,SAAQ,OAAO;IAKzC,KAAK,CAAC,GAAG;QACP,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;YACvC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAE5D,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,KAAe,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;;
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/auth/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,MAAqB,MAAO,SAAQ,OAAO;IAKzC,KAAK,CAAC,GAAG;QACP,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;YACvC,qDAAqD;YACrD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAE5D,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,KAAe,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;;AAdM,kBAAW,GAAG,oCAAoC,CAAC;AAEnD,eAAQ,GAAG,CAAC,sBAAsB,CAAC,CAAC;eAHxB,MAAM"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
export default class PortalCopilotEnable extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
"welcome-message": import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
disable: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
static examples: string[];
|
|
10
|
+
private readonly prompts;
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Command, Flags } from "@oclif/core";
|
|
2
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
3
|
+
import { PortalCopilotPrompts } from "../../prompts/portal/copilot.js";
|
|
4
|
+
import { FlagsProvider } from "../../types/flags-provider.js";
|
|
5
|
+
import { CopilotAction } from "../../actions/portal/copilot.js";
|
|
6
|
+
const DEFAULT_WORKING_DIRECTORY = "./";
|
|
7
|
+
class PortalCopilotEnable extends Command {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.prompts = new PortalCopilotPrompts();
|
|
11
|
+
}
|
|
12
|
+
async run() {
|
|
13
|
+
const { flags: { input, "auth-key": authKey, disable, 'welcome-message': welcomeMessage } } = await this.parse(PortalCopilotEnable);
|
|
14
|
+
const workingDirectory = new DirectoryPath(input !== null && input !== void 0 ? input : DEFAULT_WORKING_DIRECTORY);
|
|
15
|
+
const buildDirectory = input ? new DirectoryPath(input, "src") : workingDirectory.join("src");
|
|
16
|
+
const copilotConfigAction = new CopilotAction(new DirectoryPath(this.config.configDir), authKey);
|
|
17
|
+
const result = await copilotConfigAction.execute(buildDirectory, welcomeMessage, !disable);
|
|
18
|
+
result.map((message) => this.prompts.logError(message));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
PortalCopilotEnable.description = "Adds the API Copilot configuration in APIMATIC-BUILD.json";
|
|
22
|
+
PortalCopilotEnable.flags = Object.assign(Object.assign(Object.assign({}, FlagsProvider.input), { "welcome-message": Flags.string({
|
|
23
|
+
char: "m",
|
|
24
|
+
default: "",
|
|
25
|
+
description: "welcome message for the API copilot"
|
|
26
|
+
}), disable: Flags.boolean({
|
|
27
|
+
default: false,
|
|
28
|
+
description: "marks the API Copilot as disabled in the configuration"
|
|
29
|
+
}) }), FlagsProvider.authKey);
|
|
30
|
+
PortalCopilotEnable.examples = [
|
|
31
|
+
`apimatic portal:copilot --input="./" --welcome-message="Welcome to our API!"`,
|
|
32
|
+
`apimatic portal:copilot --input="./"`
|
|
33
|
+
];
|
|
34
|
+
export default PortalCopilotEnable;
|
|
35
|
+
//# sourceMappingURL=copilot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/commands/portal/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAEvC,MAAqB,mBAAoB,SAAQ,OAAO;IAAxD;;QAsBmB,YAAO,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAaxD,CAAC;IAXC,KAAK,CAAC,GAAG;QACP,MAAM,EACJ,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAC,EACjF,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAE1C,MAAM,gBAAgB,GAAG,IAAI,aAAa,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,yBAAyB,CAAC,CAAC;QAC/E,MAAM,cAAc,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9F,MAAM,mBAAmB,GAAG,IAAI,aAAa,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;QACjG,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC,OAAO,CAAC,CAAC;QAC3F,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,CAAC;;AAjCM,+BAAW,GAAG,2DAA2D,AAA9D,CAA+D;AAE1E,yBAAK,iDACP,aAAa,CAAC,KAAK,KACtB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC;QAC9B,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,qCAAqC;KACnD,CAAC,EACF,OAAO,EAAG,KAAK,CAAC,OAAO,CAAC;QACtB,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,wDAAwD;KACtE,CAAC,KACC,aAAa,CAAC,OAAO,CAXd,CAYV;AAEK,4BAAQ,GAAG;IAChB,8EAA8E;IAC9E,sCAAsC;CACvC,AAHc,CAGb;eApBiB,mBAAmB"}
|
|
@@ -2,11 +2,10 @@ import { Command, Config } from "@oclif/core";
|
|
|
2
2
|
export declare class PortalGenerate extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
folder: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
-
destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
-
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
-
zip: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
5
|
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
zip: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
9
|
};
|
|
11
10
|
static examples: string[];
|
|
12
11
|
private readonly prompts;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Command, Flags } from "@oclif/core";
|
|
2
2
|
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
3
|
-
import {
|
|
3
|
+
import { GenerateAction } from "../../actions/portal/generate.js";
|
|
4
4
|
import { PortalGeneratePrompts } from "../../prompts/portal/generate.js";
|
|
5
|
+
import { FlagsProvider } from "../../types/flags-provider.js";
|
|
5
6
|
const DEFAULT_WORKING_DIRECTORY = "./";
|
|
6
7
|
export class PortalGenerate extends Command {
|
|
7
8
|
constructor(argv, config) {
|
|
@@ -12,35 +13,19 @@ export class PortalGenerate extends Command {
|
|
|
12
13
|
this.prompts = new PortalGeneratePrompts();
|
|
13
14
|
}
|
|
14
15
|
async run() {
|
|
15
|
-
const { flags: {
|
|
16
|
-
const workingDirectory = new DirectoryPath(
|
|
17
|
-
const buildDirectory =
|
|
16
|
+
const { flags: { input, destination, force, zip: zipPortal, "auth-key": authKey } } = await this.parse(PortalGenerate);
|
|
17
|
+
const workingDirectory = new DirectoryPath(input !== null && input !== void 0 ? input : DEFAULT_WORKING_DIRECTORY);
|
|
18
|
+
const buildDirectory = input ? new DirectoryPath(input, "src") : workingDirectory.join("src");
|
|
18
19
|
const portalDirectory = destination ? new DirectoryPath(destination) : workingDirectory.join("portal");
|
|
19
|
-
const action = new
|
|
20
|
+
const action = new GenerateAction(this.getConfigDir(), authKey);
|
|
20
21
|
const result = await action.execute(buildDirectory, portalDirectory, force, zipPortal);
|
|
21
22
|
result.mapAll(() => this.prompts.displayOutroMessage(portalDirectory.toString()), (message) => this.prompts.logError(message));
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
PortalGenerate.description = "Generate and download a static API Documentation portal. Requires an input directory containing API specifications, a config file and optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/build-file-reference)";
|
|
25
|
-
PortalGenerate.flags = {
|
|
26
|
-
folder: Flags.string({
|
|
27
|
-
description: "[default: ./] path to the parent directory containing the 'build' folder, which includes API specifications and configuration files."
|
|
28
|
-
}),
|
|
29
|
-
destination: Flags.string({
|
|
30
|
-
description: "[default: <folder>/portal] path where the portal will be generated."
|
|
31
|
-
}),
|
|
32
|
-
force: Flags.boolean({
|
|
33
|
-
char: "f",
|
|
34
|
-
default: false,
|
|
35
|
-
description: "overwrite if a portal exists in the destination"
|
|
36
|
-
}),
|
|
37
|
-
zip: Flags.boolean({
|
|
26
|
+
PortalGenerate.flags = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, FlagsProvider.input), FlagsProvider.destination("portal", "portal")), FlagsProvider.force), { zip: Flags.boolean({
|
|
38
27
|
default: false,
|
|
39
28
|
description: "download the generated portal as a .zip archive"
|
|
40
|
-
}),
|
|
41
|
-
|
|
42
|
-
description: "override current authentication state with an authentication key"
|
|
43
|
-
})
|
|
44
|
-
};
|
|
45
|
-
PortalGenerate.examples = [`$ apimatic portal:generate`, `$ apimatic portal:generate --folder="./" --destination="./portal"`];
|
|
29
|
+
}) }), FlagsProvider.authKey);
|
|
30
|
+
PortalGenerate.examples = [`apimatic portal:generate`, `apimatic portal:generate --input="./" --destination="./portal"`];
|
|
46
31
|
//# sourceMappingURL=generate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/commands/portal/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,KAAK,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../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C,QAAQ,CAAC,CAAC;QAEvG,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,OAAO,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QACvF,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,EAClE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAC5C,CAAC;IACJ,CAAC;;AAtCM,0BAAW,GAChB,sTAAsT,AADtS,CACuS;AAElT,oBAAK,6EACP,aAAa,CAAC,KAAK,GACnB,aAAa,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAC7C,aAAa,CAAC,KAAK,KACtB,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC;QACjB,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,iDAAiD;KAC/D,CAAC,KACC,aAAa,CAAC,OAAO,CARd,CASV;AAEK,uBAAQ,GAAG,CAAC,0BAA0B,EAAE,gEAAgE,CAAC,AAAjG,CAAkG"}
|
|
@@ -10,7 +10,8 @@ import { PortalServeAction } from "../../actions/portal/serve.js";
|
|
|
10
10
|
import { ServeHandler } from "../../application/portal/serve/serve-handler.js";
|
|
11
11
|
import { PortalService } from "../../infrastructure/services/portal-service.js";
|
|
12
12
|
import { PortalServePrompts } from "../../prompts/portal/serve.js";
|
|
13
|
-
import {
|
|
13
|
+
import { GenerateAction } from "../../actions/portal/generate.js";
|
|
14
|
+
import { LoginAction } from "../../actions/auth/login.js";
|
|
14
15
|
class PortalQuickstart extends Command {
|
|
15
16
|
async getSpecFile(prompts, controller) {
|
|
16
17
|
const specPath = await prompts.specPrompt();
|
|
@@ -32,7 +33,7 @@ class PortalQuickstart extends Command {
|
|
|
32
33
|
async getWorkingDirectory(prompts, controller, specFile, apiValidationSummary, languages) {
|
|
33
34
|
const workingDirectory = await prompts.workingDirectoryPrompt();
|
|
34
35
|
prompts.displayBuildDirectoryGenerationMessage();
|
|
35
|
-
const buildDirectory = new DirectoryPath(workingDirectory, "
|
|
36
|
+
const buildDirectory = new DirectoryPath(workingDirectory, "src").toString();
|
|
36
37
|
await controller.setupBuildDirectory(prompts, buildDirectory, specFile, apiValidationSummary, languages);
|
|
37
38
|
prompts.displayBuildDirectoryGenerationSuccessMessage(buildDirectory);
|
|
38
39
|
prompts.displayBuildDirectoryAsTree(buildDirectory);
|
|
@@ -43,17 +44,13 @@ class PortalQuickstart extends Command {
|
|
|
43
44
|
const controller = new PortalQuickstartController();
|
|
44
45
|
prompts.displayWelcomeMessage();
|
|
45
46
|
let loggedIn = await controller.isUserAuthenticated(this.config.configDir);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
catch (_a) {
|
|
55
|
-
prompts.displayLoggingInErrorMessage();
|
|
56
|
-
}
|
|
47
|
+
if (!loggedIn) {
|
|
48
|
+
prompts.getLoggedInFirst();
|
|
49
|
+
const loginAction = new LoginAction(new DirectoryPath(this.config.configDir));
|
|
50
|
+
const loginResult = await loginAction.execute();
|
|
51
|
+
loginResult.match(e => prompts.displayLoggedInMessage(e), error => prompts.logError(error));
|
|
52
|
+
if (loginResult.isErr())
|
|
53
|
+
return;
|
|
57
54
|
}
|
|
58
55
|
const client = await SDKClient.getInstance().getClient(null, this.config.configDir);
|
|
59
56
|
const apiValidationController = new ApiValidationExternalApisController(client);
|
|
@@ -66,9 +63,9 @@ class PortalQuickstart extends Command {
|
|
|
66
63
|
const portalServeAction = new PortalServeAction(portalServePrompts, new ServeHandler(), new PortalService());
|
|
67
64
|
//TODO: This needs to be moved within the action. Port should not be initialized again here.
|
|
68
65
|
const port = await this.getServerPort(3000);
|
|
69
|
-
const buildDirectory = new DirectoryPath(workingDirectory, "
|
|
66
|
+
const buildDirectory = new DirectoryPath(workingDirectory, "src");
|
|
70
67
|
const portalDirectory = new DirectoryPath(workingDirectory, "portal");
|
|
71
|
-
const generatePortalAction = new
|
|
68
|
+
const generatePortalAction = new GenerateAction(new DirectoryPath(this.config.configDir), null);
|
|
72
69
|
const serveFlags = {
|
|
73
70
|
folder: buildDirectory.toString(),
|
|
74
71
|
destination: portalDirectory.toString(),
|
|
@@ -104,6 +101,6 @@ class PortalQuickstart extends Command {
|
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
103
|
PortalQuickstart.description = "Create your first API Portal using APIMatic's Docs as Code offering.";
|
|
107
|
-
PortalQuickstart.examples = ["
|
|
104
|
+
PortalQuickstart.examples = ["apimatic portal:quickstart"];
|
|
108
105
|
export default PortalQuickstart;
|
|
109
106
|
//# sourceMappingURL=quickstart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/commands/portal/quickstart.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,mCAAmC,EAAgC,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EAAE,aA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C,QAAQ,EAAE,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3F,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,IAAwB;QAClD,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAExC,MAAM,cAAc,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;QAEnH,OAAO,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACjD,CAAC;;AA9JM,4BAAW,GAAG,sEAAsE,CAAC;AAErF,yBAAQ,GAAG,CAAC,4BAA4B,CAAC,CAAC;eAH9B,gBAAgB"}
|
|
@@ -5,7 +5,6 @@ export default class PortalRecipeNew extends Command {
|
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
7
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
-
folder: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
8
|
};
|
|
10
9
|
run(): Promise<void>;
|
|
11
10
|
}
|