@apimatic/cli 1.1.0-alpha.9 → 1.1.0-beta.2
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 +436 -374
- 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 +11 -5
- package/lib/actions/portal/generate.js +60 -55
- package/lib/actions/portal/generate.js.map +1 -0
- package/lib/actions/portal/quickstart.d.ts +16 -0
- package/lib/actions/portal/quickstart.js +146 -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 +177 -0
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
- package/lib/actions/portal/serve.d.ts +15 -0
- package/lib/actions/portal/serve.js +118 -0
- package/lib/actions/portal/serve.js.map +1 -0
- package/lib/actions/portal/toc/new-toc.d.ts +17 -13
- package/lib/actions/portal/toc/new-toc.js +85 -122
- package/lib/actions/portal/toc/new-toc.js.map +1 -0
- package/lib/actions/quickstart.d.ts +10 -0
- package/lib/actions/quickstart.js +30 -0
- package/lib/actions/quickstart.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/actions/sdk/quickstart.d.ts +14 -0
- package/lib/actions/sdk/quickstart.js +149 -0
- package/lib/actions/sdk/quickstart.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 +145 -0
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
- package/lib/application/portal/toc/toc-content-parser.d.ts +1 -1
- package/lib/application/portal/toc/toc-content-parser.js +9 -11
- package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
- package/lib/application/portal/toc/toc-structure-generator.d.ts +1 -1
- package/lib/application/portal/toc/toc-structure-generator.js +4 -8
- package/lib/application/portal/toc/toc-structure-generator.js.map +1 -0
- package/lib/client-utils/auth-manager.d.ts +7 -2
- 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 +10 -7
- package/lib/commands/api/transform.js +51 -111
- package/lib/commands/api/transform.js.map +1 -0
- package/lib/commands/api/validate.d.ts +7 -4
- package/lib/commands/api/validate.js +31 -74
- package/lib/commands/api/validate.js.map +1 -0
- package/lib/commands/auth/login.d.ts +3 -1
- package/lib/commands/auth/login.js +26 -68
- package/lib/commands/auth/login.js.map +1 -0
- package/lib/commands/auth/logout.d.ts +3 -1
- package/lib/commands/auth/logout.js +14 -21
- package/lib/commands/auth/logout.js.map +1 -0
- package/lib/commands/auth/status.d.ts +1 -0
- package/lib/commands/auth/status.js +18 -21
- 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 +7 -11
- package/lib/commands/portal/generate.js +26 -89
- package/lib/commands/portal/generate.js.map +1 -0
- package/lib/commands/portal/recipe/new.d.ts +12 -0
- package/lib/commands/portal/recipe/new.js +45 -0
- package/lib/commands/portal/recipe/new.js.map +1 -0
- package/lib/commands/portal/serve.d.ts +8 -8
- package/lib/commands/portal/serve.js +41 -125
- package/lib/commands/portal/serve.js.map +1 -0
- package/lib/commands/portal/toc/new.d.ts +5 -6
- package/lib/commands/portal/toc/new.js +45 -50
- package/lib/commands/portal/toc/new.js.map +1 -0
- package/lib/commands/quickstart.d.ts +9 -0
- package/lib/commands/quickstart.js +37 -0
- package/lib/commands/quickstart.js.map +1 -0
- package/lib/commands/sdk/generate.d.ts +10 -8
- package/lib/commands/sdk/generate.js +46 -131
- package/lib/commands/sdk/generate.js.map +1 -0
- package/lib/config/axios-config.js +4 -6
- 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.js +2 -5
- package/lib/index.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 +24 -0
- package/lib/infrastructure/file-service.js +120 -0
- package/lib/infrastructure/file-service.js.map +1 -0
- package/lib/infrastructure/launcher-service.d.ts +9 -0
- package/lib/infrastructure/launcher-service.js +72 -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/service-error.d.ts +16 -0
- package/lib/infrastructure/service-error.js +49 -0
- package/lib/infrastructure/service-error.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 +12 -0
- package/lib/infrastructure/services/api-service.js +79 -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 +17 -12
- package/lib/infrastructure/services/portal-service.js +134 -99
- 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 +29 -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 +40 -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 +22 -0
- package/lib/prompts/auth/status.js.map +1 -0
- package/lib/prompts/format.d.ts +31 -0
- package/lib/prompts/format.js +89 -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 -8
- package/lib/prompts/portal/generate.js +36 -53
- package/lib/prompts/portal/generate.js.map +1 -0
- package/lib/prompts/portal/quickstart.d.ts +28 -29
- package/lib/prompts/portal/quickstart.js +102 -185
- 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 +9 -5
- package/lib/prompts/portal/serve.js +29 -19
- package/lib/prompts/portal/serve.js.map +1 -0
- package/lib/prompts/portal/toc/new-toc.d.ts +13 -8
- package/lib/prompts/portal/toc/new-toc.js +28 -36
- package/lib/prompts/portal/toc/new-toc.js.map +1 -0
- package/lib/prompts/prompt.d.ts +3 -0
- package/lib/prompts/prompt.js +37 -0
- package/lib/prompts/prompt.js.map +1 -0
- package/lib/prompts/quickstart.d.ts +6 -0
- package/lib/prompts/quickstart.js +25 -0
- package/lib/prompts/quickstart.js.map +1 -0
- package/lib/prompts/sdk/generate.d.ts +11 -0
- package/lib/prompts/sdk/generate.js +37 -0
- package/lib/prompts/sdk/generate.js.map +1 -0
- package/lib/prompts/sdk/quickstart.d.ts +32 -0
- package/lib/prompts/sdk/quickstart.js +140 -0
- package/lib/prompts/sdk/quickstart.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 +14 -25
- package/lib/types/api/transform.js +20 -23
- 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 +13 -0
- package/lib/types/build-context.js +33 -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 +87 -0
- package/lib/types/file/directory.js.map +1 -0
- package/lib/types/file/directoryPath.d.ts +10 -0
- package/lib/types/file/directoryPath.js +26 -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 +9 -0
- package/lib/types/recipe-context.js +26 -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 -22
- package/lib/types/sdk/generate.js +25 -14
- 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 +10 -0
- package/lib/types/sdl/sdl.js +47 -3
- package/lib/types/sdl/sdl.js.map +1 -0
- package/lib/types/spec-context.d.ts +12 -0
- package/lib/types/spec-context.js +29 -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.js +2 -10
- 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 +0 -9
- package/lib/types/utils.js +2 -3
- package/lib/types/utils.js.map +1 -0
- package/lib/utils/string-utils.d.ts +2 -0
- package/lib/utils/string-utils.js +37 -0
- package/lib/utils/string-utils.js.map +1 -0
- package/lib/utils/utils.d.ts +2 -44
- package/lib/utils/utils.js +14 -366
- package/lib/utils/utils.js.map +1 -0
- package/package.json +50 -31
- package/bin/run +0 -9
- package/lib/application/portal/toc/sdl-parser.d.ts +0 -13
- package/lib/application/portal/toc/sdl-parser.js +0 -53
- package/lib/client-utils/sdk-client.d.ts +0 -23
- package/lib/client-utils/sdk-client.js +0 -124
- package/lib/commands/portal/quickstart.d.ts +0 -10
- package/lib/commands/portal/quickstart.js +0 -79
- package/lib/config/env.d.ts +0 -27
- package/lib/config/env.js +0 -31
- package/lib/controllers/api/transform.d.ts +0 -5
- package/lib/controllers/api/transform.js +0 -56
- package/lib/controllers/api/validate.d.ts +0 -3
- package/lib/controllers/api/validate.js +0 -33
- package/lib/controllers/portal/generate.d.ts +0 -3
- package/lib/controllers/portal/generate.js +0 -110
- package/lib/controllers/portal/quickstart.d.ts +0 -14
- package/lib/controllers/portal/quickstart.js +0 -258
- package/lib/controllers/portal/serve.d.ts +0 -3
- package/lib/controllers/portal/serve.js +0 -138
- package/lib/controllers/sdk/generate.d.ts +0 -4
- package/lib/controllers/sdk/generate.js +0 -66
- package/lib/services/portal/server.d.ts +0 -14
- package/lib/services/portal/server.js +0 -101
- package/lib/types/api/validate.d.ts +0 -12
- package/lib/types/api/validate.js +0 -3
- package/lib/types/common/result.d.ts +0 -17
- package/lib/types/common/result.js +0 -36
- package/lib/types/portal/generate.d.ts +0 -26
- package/lib/types/portal/generate.js +0 -4
- package/lib/types/portal/quickstart.d.ts +0 -17
- package/lib/types/portal/quickstart.js +0 -3
- package/lib/validators/common/directoryValidator.d.ts +0 -9
- package/lib/validators/common/directoryValidator.js +0 -53
- package/lib/validators/common/portValidator.d.ts +0 -5
- package/lib/validators/common/portValidator.js +0 -20
- package/lib/validators/portal/serveValidator.d.ts +0 -6
- package/lib/validators/portal/serveValidator.js +0 -21
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { Command, Flags } from "@oclif/core";
|
|
3
|
+
import { PortalRecipeAction } from "../../../actions/portal/recipe/new-recipe.js";
|
|
4
|
+
import { TelemetryService } from "../../../infrastructure/services/telemetry-service.js";
|
|
5
|
+
import { RecipeCreationFailedEvent } from "../../../types/events/recipe-creation-failed.js";
|
|
6
|
+
import { DirectoryPath } from "../../../types/file/directoryPath.js";
|
|
7
|
+
import { FlagsProvider } from "../../../types/flags-provider.js";
|
|
8
|
+
import { format, intro, outro } from "../../../prompts/format.js";
|
|
9
|
+
class PortalRecipeNew extends Command {
|
|
10
|
+
async run() {
|
|
11
|
+
const { flags: { name, input, force } } = await this.parse(_a);
|
|
12
|
+
const workingDirectory = DirectoryPath.createInput(input);
|
|
13
|
+
const buildDirectory = input ? new DirectoryPath(input, "src") : workingDirectory.join("src");
|
|
14
|
+
const commandMetadata = {
|
|
15
|
+
commandName: _a.id,
|
|
16
|
+
shell: this.config.shell
|
|
17
|
+
};
|
|
18
|
+
intro("New Recipe");
|
|
19
|
+
const action = new PortalRecipeAction(new DirectoryPath(this.config.configDir), commandMetadata);
|
|
20
|
+
const result = await action.execute(buildDirectory, name);
|
|
21
|
+
outro(result);
|
|
22
|
+
result.mapAll(() => { }, async () => {
|
|
23
|
+
const telemetryService = new TelemetryService(new DirectoryPath(this.config.configDir));
|
|
24
|
+
await telemetryService.trackEvent(new RecipeCreationFailedEvent("error", _a.id, {
|
|
25
|
+
name,
|
|
26
|
+
input,
|
|
27
|
+
force
|
|
28
|
+
}), commandMetadata.shell);
|
|
29
|
+
}, () => { });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
_a = PortalRecipeNew;
|
|
33
|
+
PortalRecipeNew.summary = "Add an API Recipe to your API documentation portal.";
|
|
34
|
+
PortalRecipeNew.description = `This command adds a new API Recipe file to your documentation portal.
|
|
35
|
+
|
|
36
|
+
To learn more about API Recipes, visit:
|
|
37
|
+
${format.link("https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes")}`;
|
|
38
|
+
PortalRecipeNew.flags = Object.assign(Object.assign({ name: Flags.string({ description: "name for the recipe" }) }, FlagsProvider.input), FlagsProvider.force);
|
|
39
|
+
PortalRecipeNew.cmdTxt = format.cmd("apimatic", "portal", "recipe", "new");
|
|
40
|
+
PortalRecipeNew.examples = [
|
|
41
|
+
`${_a.cmdTxt}`,
|
|
42
|
+
`${_a.cmdTxt} ${format.flag("name", '"My API Recipe"')} ${format.flag("input", '"./"')}`
|
|
43
|
+
];
|
|
44
|
+
export default PortalRecipeNew;
|
|
45
|
+
//# sourceMappingURL=new.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new.js","sourceRoot":"","sources":["../../../../src/commands/portal/recipe/new.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uDAAuD,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAqB,eAAgB,SAAQ,OAAO;IAsBlD,KAAK,CAAC,GAAG;QACP,MAAM,EACJ,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,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F,CAChG,EAAE,AALiB,CAKhB;AAEK,qBAAK,iCACV,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC,IACvD,aAAa,CAAC,KAAK,GACnB,aAAa,CAAC,KAAK,CAHZ,CAIV;AAEc,sBAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,AAApD,CAAqD;AAC3D,wBAAQ,GAAG;IACzB,GAAG,EAAI,CAAC,MAAM,EAAE;IAChB,GAAG,EAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;CAC3F,AAHuB,CAGtB;eApBiB,eAAe"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
2
|
export default class PortalServe extends Command {
|
|
3
|
+
static summary: string;
|
|
3
4
|
static description: string;
|
|
4
5
|
static flags: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
ignore: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
-
"auth-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
|
+
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
open: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
"no-reload": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
port: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
11
|
};
|
|
12
|
+
static cmdTxt: string;
|
|
13
13
|
static examples: string[];
|
|
14
14
|
run(): Promise<void>;
|
|
15
|
-
private
|
|
15
|
+
private getConfigDir;
|
|
16
16
|
}
|
|
@@ -1,137 +1,53 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var _a;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const serve_2 = require("../../prompts/portal/serve");
|
|
10
|
-
const utils_1 = require("../../utils/utils");
|
|
11
|
-
const serveValidator_1 = require("../../validators/portal/serveValidator");
|
|
12
|
-
class PortalServe extends core_1.Command {
|
|
2
|
+
import { Command, Flags } from "@oclif/core";
|
|
3
|
+
import { PortalServeAction } from "../../actions/portal/serve.js";
|
|
4
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
5
|
+
import { FlagsProvider } from "../../types/flags-provider.js";
|
|
6
|
+
import { format, intro, outro } from "../../prompts/format.js";
|
|
7
|
+
class PortalServe extends Command {
|
|
13
8
|
async run() {
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
prompts.displayGeneratingPortalMessage();
|
|
28
|
-
await (0, serve_1.generatePortal)(sourceDir, portalDir, this.config.configDir, allIgnoredPaths, overrideAuthKey);
|
|
29
|
-
prompts.displayGeneratedPortalMessage(portalDir);
|
|
30
|
-
await (0, utils_1.cleanUpGeneratedPortalFiles)(sourceDir);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
prompts.displayGeneratingPortalErrorMessage();
|
|
34
|
-
await (0, utils_1.cleanUpGeneratedPortalFiles)(sourceDir);
|
|
35
|
-
this.handleError(error);
|
|
36
|
-
}
|
|
37
|
-
serverService.setupServer(portalDir);
|
|
38
|
-
serverService.startServer({
|
|
39
|
-
generatedPortalPath: portalDir,
|
|
40
|
-
targetFolder: sourceDir,
|
|
41
|
-
configDir: this.config.configDir,
|
|
42
|
-
authKey: overrideAuthKey,
|
|
43
|
-
ignoredPaths: allIgnoredPaths,
|
|
44
|
-
port,
|
|
45
|
-
openInBrowser: flags.open
|
|
46
|
-
}, flags["no-reload"]);
|
|
47
|
-
prompts.displayOutroMessage(port);
|
|
9
|
+
const { flags: { input, destination, port, open, "no-reload": noReload, "auth-key": authKey } } = await this.parse(_a);
|
|
10
|
+
const workingDirectory = DirectoryPath.createInput(input);
|
|
11
|
+
const buildDirectory = input ? new DirectoryPath(input, "src") : workingDirectory.join("src");
|
|
12
|
+
const portalDirectory = destination ? new DirectoryPath(destination) : workingDirectory.join("portal");
|
|
13
|
+
const commandMetadata = {
|
|
14
|
+
commandName: _a.id,
|
|
15
|
+
shell: this.config.shell
|
|
16
|
+
};
|
|
17
|
+
intro("Portal Serve");
|
|
18
|
+
const portalServeAction = new PortalServeAction(this.getConfigDir(), commandMetadata, authKey);
|
|
19
|
+
const result = await portalServeAction.execute(buildDirectory, portalDirectory, port, open, !noReload);
|
|
20
|
+
outro(result);
|
|
48
21
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const axiosError = error;
|
|
52
|
-
if (axiosError.response) {
|
|
53
|
-
if (axiosError.response.status === 400) {
|
|
54
|
-
this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal. Please ensure that the provided build directory follows the correct structure and contains valid API definition and build files.`));
|
|
55
|
-
}
|
|
56
|
-
else if (axiosError.response.status === 401) {
|
|
57
|
-
this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal. Please ensure that you are logged in or have provided a valid Auth key.`));
|
|
58
|
-
}
|
|
59
|
-
else if (axiosError.response.status === 403) {
|
|
60
|
-
this.error((0, utils_1.getMessageInRedColor)(`Access denied. It looks like you don’t have access to APIMatic’s Docs as Code offering. Check your subscription details and contact our team at support@apimatic.io if you believe this is a mistake.`));
|
|
61
|
-
}
|
|
62
|
-
else if (axiosError.response.status === 422) {
|
|
63
|
-
this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal. Please ensure that the provided build directory follows the correct structure and contains valid API definition and build files.`));
|
|
64
|
-
}
|
|
65
|
-
else if (axiosError.response.status === 500) {
|
|
66
|
-
this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal. Please ensure that the provided build directory follows the correct structure and contains valid API definition and build files. If the issue persists, reach out to our team at support@apimatic.io`));
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal. Please ensure that the provided build directory follows the correct structure and contains valid API definition and build files. If the issue persists, reach out to our team at support@apimatic.io`));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else if (axiosError.request) {
|
|
73
|
-
if (axiosError.code === "ECONNABORTED") {
|
|
74
|
-
this.error((0, utils_1.getMessageInRedColor)(`Your request timed out. Please try again or reach out to our team at support@apimatic.io for help if your problem persists.`));
|
|
75
|
-
}
|
|
76
|
-
else if (error.code === "ENOTFOUND" || error.code === "ERR_NETWORK") {
|
|
77
|
-
this.error((0, utils_1.getMessageInRedColor)(`Network error. Please check your internet connection and try again.`));
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
this.error((0, utils_1.getMessageInRedColor)(`No response received from the server. Please try again later.`));
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal: ${axiosError.message}`));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
else if (error instanceof Error) {
|
|
88
|
-
this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal: ${error.message}`));
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
this.error((0, utils_1.getMessageInRedColor)(`Something went wrong while generating the portal, please try again later. If the issue persists, contact our team at support@apimatic.io`));
|
|
92
|
-
}
|
|
22
|
+
getConfigDir() {
|
|
23
|
+
return new DirectoryPath(this.config.configDir);
|
|
93
24
|
}
|
|
94
25
|
}
|
|
95
26
|
_a = PortalServe;
|
|
96
|
-
PortalServe.
|
|
97
|
-
PortalServe.
|
|
98
|
-
|
|
27
|
+
PortalServe.summary = "Generate and serve an API Documentation Portal with hot reload.";
|
|
28
|
+
PortalServe.description = "Requires an input directory with API specifications, a config file, and optionally markdown guides. Supports disabling hot reload and opening the portal in the default browser.";
|
|
29
|
+
PortalServe.flags = Object.assign(Object.assign(Object.assign(Object.assign({ port: Flags.integer({
|
|
99
30
|
char: "p",
|
|
100
|
-
description: "
|
|
101
|
-
default: 3000
|
|
102
|
-
|
|
103
|
-
destination:
|
|
104
|
-
char: "d",
|
|
105
|
-
description: "Directory to store and serve the generated portal.",
|
|
106
|
-
default: "./generated_portal",
|
|
107
|
-
parse: async (input) => path.resolve(input)
|
|
108
|
-
}),
|
|
109
|
-
source: core_1.Flags.string({
|
|
110
|
-
char: "s",
|
|
111
|
-
description: "Source directory containing specs, content, and build file. By default, the current directory is used.",
|
|
112
|
-
default: "./",
|
|
113
|
-
parse: async (input) => path.resolve(input)
|
|
114
|
-
}),
|
|
115
|
-
open: core_1.Flags.boolean({
|
|
31
|
+
description: "port to serve the portal.",
|
|
32
|
+
default: 3000,
|
|
33
|
+
helpValue: "3000"
|
|
34
|
+
}) }, FlagsProvider.input), FlagsProvider.destination("portal", "portal")), { open: Flags.boolean({
|
|
116
35
|
char: "o",
|
|
117
|
-
description: "
|
|
36
|
+
description: "open the portal in the default browser.",
|
|
118
37
|
default: false
|
|
119
|
-
}),
|
|
120
|
-
|
|
121
|
-
description: "Disable hot reload.",
|
|
38
|
+
}), "no-reload": Flags.boolean({
|
|
39
|
+
description: "disable hot reload.",
|
|
122
40
|
default: false
|
|
123
|
-
}),
|
|
124
|
-
|
|
125
|
-
char: "i",
|
|
126
|
-
description: "Comma-separated list of files/directories to ignore.",
|
|
127
|
-
default: ""
|
|
128
|
-
}),
|
|
129
|
-
"auth-key": core_1.Flags.string({
|
|
130
|
-
description: "Override current authentication state with an authentication key."
|
|
131
|
-
})
|
|
132
|
-
};
|
|
41
|
+
}) }), FlagsProvider.authKey);
|
|
42
|
+
PortalServe.cmdTxt = format.cmd("apimatic", "portal", "serve");
|
|
133
43
|
PortalServe.examples = [
|
|
134
|
-
|
|
44
|
+
_a.cmdTxt,
|
|
45
|
+
`${_a.cmdTxt} ` +
|
|
46
|
+
`${format.flag("input", './')} ` +
|
|
47
|
+
`${format.flag("destination", './portal')} ` +
|
|
48
|
+
`${format.flag("port", "3000")} ` +
|
|
49
|
+
`${format.flag("open")} ` +
|
|
50
|
+
`${format.flag("no-reload")}`
|
|
135
51
|
];
|
|
136
|
-
|
|
137
|
-
//# sourceMappingURL=
|
|
52
|
+
export default PortalServe;
|
|
53
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/commands/portal/serve.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAqB,WAAY,SAAQ,OAAO;IAsCvC,KAAK,CAAC,GAAG;QACd,MAAM,EACJ,KAAK,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,EACtF,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,EAAW,CAAC,CAAC;QAElC,MAAM,gB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I,EAAE,KAAK,CAAC,OAAO,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,yCAAyC;QACtD,OAAO,EAAE,KAAK;KACf,CAAC,EACF,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC;QACzB,WAAW,EAAE,qBAAqB;QAClC,OAAO,EAAE,KAAK;KACf,CAAC,KACC,aAAa,CAAC,OAAO,CAlBd,CAmBV;AAEK,kBAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,AAA5C,CAA6C;AACnD,oBAAQ,GAAG;IAChB,EAAI,CAAC,MAAM;IACX,GAAG,EAAI,CAAC,MAAM,GAAG;QACf,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG;QAChC,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,GAAG;QAC5C,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;QACjC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG;QACzB,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;CAChC,AARc,CAQb;eApCiB,WAAW"}
|
|
@@ -3,13 +3,12 @@ export default class PortalTocNew extends Command {
|
|
|
3
3
|
static summary: string;
|
|
4
4
|
static description: string;
|
|
5
5
|
static flags: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
force: import("@oclif/core/
|
|
9
|
-
"
|
|
10
|
-
"expand-models": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
|
+
"expand-endpoints": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
"expand-models": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
10
|
};
|
|
11
|
+
static cmdTxt: string;
|
|
12
12
|
static examples: string[];
|
|
13
|
-
constructor(argv: string[], config: any);
|
|
14
13
|
run(): Promise<void>;
|
|
15
14
|
}
|
|
@@ -1,65 +1,60 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var _a;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
2
|
+
import { Command, Flags } from "@oclif/core";
|
|
3
|
+
import { PortalNewTocAction } from "../../../actions/portal/toc/new-toc.js";
|
|
4
|
+
import { TelemetryService } from "../../../infrastructure/services/telemetry-service.js";
|
|
5
|
+
import { TocCreationFailedEvent } from "../../../types/events/toc-creation-failed.js";
|
|
6
|
+
import { DirectoryPath } from "../../../types/file/directoryPath.js";
|
|
7
|
+
import { FlagsProvider } from "../../../types/flags-provider.js";
|
|
8
|
+
import { format, intro, outro } from "../../../prompts/format.js";
|
|
9
|
+
class PortalTocNew extends Command {
|
|
12
10
|
async run() {
|
|
13
|
-
const { flags } = await this.parse(_a);
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
const { flags: { input, destination, force, "expand-endpoints": expandEndpoints, "expand-models": expandModels } } = await this.parse(_a);
|
|
12
|
+
const workingDirectory = DirectoryPath.createInput(input);
|
|
13
|
+
const buildDirectory = input ? new DirectoryPath(input, "src") : workingDirectory.join("src");
|
|
14
|
+
const tocDirectory = destination ? new DirectoryPath(destination) : undefined;
|
|
15
|
+
const commandMetadata = {
|
|
16
|
+
commandName: _a.id,
|
|
17
|
+
shell: this.config.shell
|
|
18
|
+
};
|
|
19
|
+
intro("New TOC");
|
|
20
|
+
const action = new PortalNewTocAction(new DirectoryPath(this.config.configDir), commandMetadata);
|
|
21
|
+
const result = await action.execute(buildDirectory, tocDirectory, force, expandEndpoints, expandModels);
|
|
22
|
+
outro(result);
|
|
23
|
+
result.mapAll(() => { }, async () => {
|
|
24
|
+
const telemetryService = new TelemetryService(new DirectoryPath(this.config.configDir));
|
|
25
|
+
await telemetryService.trackEvent(
|
|
26
|
+
// TODO: fix Toc error message
|
|
27
|
+
new TocCreationFailedEvent("error", _a.id, {
|
|
28
|
+
input,
|
|
29
|
+
destination,
|
|
30
|
+
force,
|
|
31
|
+
"expand-endpoints": expandEndpoints,
|
|
32
|
+
"expand-models": expandModels
|
|
33
|
+
}), commandMetadata.shell);
|
|
34
|
+
}, () => { });
|
|
19
35
|
}
|
|
20
36
|
}
|
|
21
37
|
_a = PortalTocNew;
|
|
22
|
-
PortalTocNew.summary =
|
|
38
|
+
PortalTocNew.summary = "Generate a Table of Contents (TOC) file for your API documentation portal";
|
|
23
39
|
PortalTocNew.description = `This command generates a new Table of Contents (TOC) file used in the
|
|
24
40
|
generation of your API documentation portal.
|
|
25
41
|
|
|
26
42
|
The output is a YAML file with the .yml extension.
|
|
27
43
|
|
|
28
44
|
To learn more about the TOC file and APIMatic build directory structure, visit:
|
|
29
|
-
https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal`;
|
|
30
|
-
PortalTocNew.flags = {
|
|
31
|
-
destination: core_1.Flags.string({
|
|
32
|
-
parse: async (input) => path.resolve(input),
|
|
33
|
-
description: "optional path where the generated TOC file will be saved. Defaults to the current working directory if not provided.",
|
|
34
|
-
}),
|
|
35
|
-
folder: core_1.Flags.string({
|
|
36
|
-
parse: async (input) => path.resolve(input),
|
|
37
|
-
description: "path to the working directory containing the API project files. Defaults to the current working directory if not specified.",
|
|
38
|
-
default: DEFAULT_FOLDER
|
|
39
|
-
}),
|
|
40
|
-
force: core_1.Flags.boolean({
|
|
41
|
-
default: false,
|
|
42
|
-
description: "overwrite the TOC file if one already exists at the destination.",
|
|
43
|
-
}),
|
|
44
|
-
"expand-endpoints": core_1.Flags.boolean({
|
|
45
|
+
${format.link("https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal")}`;
|
|
46
|
+
PortalTocNew.flags = Object.assign(Object.assign(Object.assign(Object.assign({}, FlagsProvider.destination("src/content", `toc.yml`)), FlagsProvider.input), FlagsProvider.force), { "expand-endpoints": Flags.boolean({
|
|
45
47
|
default: false,
|
|
46
|
-
description:
|
|
47
|
-
}),
|
|
48
|
-
"expand-models": core_1.Flags.boolean({
|
|
48
|
+
description: `include individual entries for each endpoint in the generated ${format.var("toc.yml")}. Requires a valid API specification in the working directory.`
|
|
49
|
+
}), "expand-models": Flags.boolean({
|
|
49
50
|
default: false,
|
|
50
|
-
description:
|
|
51
|
-
})
|
|
52
|
-
|
|
51
|
+
description: `include individual entries for each model in the generated ${format.var("toc.yml")}. Requires a valid API specification in the working directory.`
|
|
52
|
+
}) });
|
|
53
|
+
PortalTocNew.cmdTxt = format.cmd("apimatic", "portal", "toc", "new");
|
|
53
54
|
PortalTocNew.examples = [
|
|
54
|
-
`$
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
`$ apimatic portal:toc:new --folder="./my-project"
|
|
58
|
-
A new toc file has been created at ./my-project/content/toc.yml
|
|
59
|
-
`,
|
|
60
|
-
`$ apimatic portal:toc:new --folder="./my-project" --destination="./portal/content/"
|
|
61
|
-
A new toc file has been created at ./portal/content/toc.yml
|
|
62
|
-
`
|
|
55
|
+
`${_a.cmdTxt} ${format.flag("destination", './src/content/')}`,
|
|
56
|
+
`${_a.cmdTxt} ${format.flag("input", './')}`,
|
|
57
|
+
`${_a.cmdTxt} ${format.flag("input", './')} ${format.flag("destination", './src/content/')}`
|
|
63
58
|
];
|
|
64
|
-
|
|
65
|
-
//# sourceMappingURL=
|
|
59
|
+
export default PortalTocNew;
|
|
60
|
+
//# sourceMappingURL=new.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new.js","sourceRoot":"","sources":["../../../../src/commands/portal/toc/new.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO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GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,AAAjD,CAAkD;AACxD,qBAAQ,GAAG;IAChB,GAAG,EAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,EAAE;IAChE,GAAG,EAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE;IAC9C,GAAG,EAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,EAAE;CAC/F,AAJc,CAIb;eApCiB,YAAY"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { Command } from "@oclif/core";
|
|
3
|
+
import { format, intro, outro } from "../prompts/format.js";
|
|
4
|
+
import { TelemetryService } from "../infrastructure/services/telemetry-service.js";
|
|
5
|
+
import { DirectoryPath } from "../types/file/directoryPath.js";
|
|
6
|
+
import { QuickstartInitiatedEvent } from "../types/events/quickstart-initiated.js";
|
|
7
|
+
import { QuickstartAction } from "../actions/quickstart.js";
|
|
8
|
+
import { QuickstartCompletedEvent } from "../types/events/quickstart-completed.js";
|
|
9
|
+
class Quickstart extends Command {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.getConfigDir = () => {
|
|
13
|
+
return new DirectoryPath(this.config.configDir);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
async run() {
|
|
17
|
+
const telemetryService = new TelemetryService(this.getConfigDir());
|
|
18
|
+
const commandMetadata = {
|
|
19
|
+
commandName: _a.id,
|
|
20
|
+
shell: this.config.shell
|
|
21
|
+
};
|
|
22
|
+
await telemetryService.trackEvent(new QuickstartInitiatedEvent(), commandMetadata.shell);
|
|
23
|
+
intro("Quickstart");
|
|
24
|
+
const action = new QuickstartAction(this.getConfigDir(), commandMetadata);
|
|
25
|
+
const result = await action.execute();
|
|
26
|
+
outro(result);
|
|
27
|
+
// TODO: Remove this, find a solution for tracking.
|
|
28
|
+
await result.mapAll(async () => await telemetryService.trackEvent(new QuickstartCompletedEvent(), commandMetadata.shell), () => new Promise(() => { }), () => new Promise(() => { }));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
_a = Quickstart;
|
|
32
|
+
Quickstart.description = "Get started with your first SDK or API Portal in four easy steps.";
|
|
33
|
+
Quickstart.summary = "Create your first SDK or API Portal using APIMatic.";
|
|
34
|
+
Quickstart.cmdTxt = format.cmd("apimatic", "quickstart");
|
|
35
|
+
Quickstart.examples = [_a.cmdTxt];
|
|
36
|
+
export default Quickstart;
|
|
37
|
+
//# sourceMappingURL=quickstart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../src/commands/quickstart.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAEnF,MAAqB,UAAW,SAAQ,OAAO;IAA/C;;QA+BmB,iBAAY,GAAG,GAAG,EAAE;YACnC,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAClD,CAAC,CAAC;IACJ,CAAC;IAzBC,KAAK,CAAC,GAAG;QACP,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QACnE,MAAM,eAAe,GAAoB;YACvC,WAAW,EAAE,EAAU,CAAC,EAAE;YAC1B,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;SACzB,CAAC;QAEF,MAAM,gBAAgB,CAAC,UAAU,CAAC,IAAI,wBAAwB,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;QAEzF,KAAK,CAAC,YAAY,CAAC,CAAC;QACpB,MAAM,MAAM,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,eAAe,CAAC,CAAC;QAC1E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACtC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,mDAAmD;QACnD,MAAM,MAAM,CAAC,MAAM,CACjB,KAAK,IAAI,EAAE,CAAC,MAAM,gBAAgB,CAAC,UAAU,CAAC,IAAI,wBAAwB,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,EACpG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,EAC3B,GAAG,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAC5B,CAAC;IACJ,CAAC;;;AA5BM,sBAAW,GAAG,mEAAmE,AAAtE,CAAuE;AAElF,kBAAO,GAAG,qDAAqD,AAAxD,CAAyD;AAEhE,iBAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,AAAvC,CAAwC;AAE9C,mBAAQ,GAAG,CAAC,EAAI,CAAC,MAAM,CAAC,AAAhB,CAAiB;eAPb,UAAU"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
2
|
export default class SdkGenerate extends Command {
|
|
3
|
-
static
|
|
3
|
+
static readonly summary = "Generate an SDK for your API";
|
|
4
|
+
static readonly description = "Generate Software Development Kits (SDKs) from API specifications.\nSupports multiple programming languages including Java, C#, Python, JavaScript, and more.";
|
|
5
|
+
static readonly cmdTxt: string;
|
|
4
6
|
static flags: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"auth-key": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
zip: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
language: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
spec: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
13
|
};
|
|
13
14
|
static examples: string[];
|
|
14
15
|
run(): Promise<void>;
|
|
16
|
+
private readonly getConfigDir;
|
|
15
17
|
}
|