@apimatic/cli 1.1.0-alpha.20 → 1.1.0-alpha.22
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 +119 -91
- package/lib/actions/action-result.d.ts +8 -3
- package/lib/actions/action-result.js +34 -15
- package/lib/actions/action-result.js.map +1 -1
- 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 +6 -5
- package/lib/actions/auth/login.js +25 -33
- package/lib/actions/auth/login.js.map +1 -1
- 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 +7 -2
- package/lib/actions/portal/copilot.js +72 -32
- package/lib/actions/portal/copilot.js.map +1 -1
- package/lib/actions/portal/generate.d.ts +5 -5
- package/lib/actions/portal/generate.js +33 -35
- package/lib/actions/portal/generate.js.map +1 -1
- package/lib/actions/portal/quickstart.d.ts +16 -0
- package/lib/actions/portal/quickstart.js +145 -0
- package/lib/actions/portal/quickstart.js.map +1 -0
- package/lib/actions/portal/recipe/new-recipe.d.ts +11 -20
- package/lib/actions/portal/recipe/new-recipe.js +147 -221
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -1
- package/lib/actions/portal/serve.d.ts +12 -10
- package/lib/actions/portal/serve.js +112 -17
- package/lib/actions/portal/serve.js.map +1 -1
- package/lib/actions/portal/toc/new-toc.d.ts +16 -15
- package/lib/actions/portal/toc/new-toc.js +80 -116
- package/lib/actions/portal/toc/new-toc.js.map +1 -1
- package/lib/actions/sdk/generate.d.ts +5 -6
- package/lib/actions/sdk/generate.js +22 -47
- package/lib/actions/sdk/generate.js.map +1 -1
- package/lib/application/portal/recipe/portal-recipe.d.ts +2 -2
- package/lib/application/portal/recipe/portal-recipe.js +9 -9
- package/lib/application/portal/recipe/portal-recipe.js.map +1 -1
- package/lib/application/portal/recipe/recipe-generator.d.ts +7 -2
- package/lib/application/portal/recipe/recipe-generator.js +21 -22
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -1
- package/lib/client-utils/auth-manager.d.ts +1 -1
- package/lib/client-utils/auth-manager.js +3 -4
- package/lib/client-utils/auth-manager.js.map +1 -1
- package/lib/commands/api/transform.d.ts +6 -3
- package/lib/commands/api/transform.js +43 -91
- package/lib/commands/api/transform.js.map +1 -1
- package/lib/commands/api/validate.d.ts +6 -3
- package/lib/commands/api/validate.js +27 -60
- package/lib/commands/api/validate.js.map +1 -1
- package/lib/commands/auth/login.d.ts +2 -1
- package/lib/commands/auth/login.js +15 -9
- package/lib/commands/auth/login.js.map +1 -1
- package/lib/commands/auth/logout.d.ts +3 -1
- package/lib/commands/auth/logout.js +12 -13
- package/lib/commands/auth/logout.js.map +1 -1
- package/lib/commands/auth/status.d.ts +1 -0
- package/lib/commands/auth/status.js +13 -11
- package/lib/commands/auth/status.js.map +1 -1
- package/lib/commands/portal/copilot.d.ts +3 -2
- package/lib/commands/portal/copilot.js +23 -21
- package/lib/commands/portal/copilot.js.map +1 -1
- package/lib/commands/portal/generate.d.ts +3 -4
- package/lib/commands/portal/generate.js +18 -13
- package/lib/commands/portal/generate.js.map +1 -1
- package/lib/commands/portal/quickstart.d.ts +3 -4
- package/lib/commands/portal/quickstart.js +27 -95
- package/lib/commands/portal/quickstart.js.map +1 -1
- package/lib/commands/portal/recipe/new.d.ts +3 -1
- package/lib/commands/portal/recipe/new.js +31 -23
- package/lib/commands/portal/recipe/new.js.map +1 -1
- package/lib/commands/portal/serve.d.ts +5 -5
- package/lib/commands/portal/serve.js +31 -57
- package/lib/commands/portal/serve.js.map +1 -1
- package/lib/commands/portal/toc/new.d.ts +2 -2
- package/lib/commands/portal/toc/new.js +35 -26
- package/lib/commands/portal/toc/new.js.map +1 -1
- package/lib/commands/sdk/generate.d.ts +5 -4
- package/lib/commands/sdk/generate.js +26 -17
- package/lib/commands/sdk/generate.js.map +1 -1
- 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/infrastructure/api-utils.js +3 -2
- package/lib/infrastructure/api-utils.js.map +1 -1
- package/lib/{application/portal/serve/watcher-handler.d.ts → infrastructure/debounce-service.d.ts} +3 -3
- package/lib/{application/portal/serve/watcher-handler.js → infrastructure/debounce-service.js} +5 -4
- package/lib/infrastructure/debounce-service.js.map +1 -0
- package/lib/infrastructure/env-info.d.ts +5 -1
- package/lib/infrastructure/env-info.js +23 -2
- package/lib/infrastructure/env-info.js.map +1 -1
- package/lib/infrastructure/file-service.d.ts +7 -2
- package/lib/infrastructure/file-service.js +49 -8
- package/lib/infrastructure/file-service.js.map +1 -1
- package/lib/infrastructure/launcher-service.d.ts +7 -0
- package/lib/infrastructure/launcher-service.js +51 -0
- package/lib/infrastructure/launcher-service.js.map +1 -0
- package/lib/infrastructure/network-service.d.ts +3 -0
- package/lib/infrastructure/network-service.js +7 -0
- package/lib/infrastructure/network-service.js.map +1 -0
- package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
- package/lib/infrastructure/services/api-client-factory.js +20 -0
- package/lib/infrastructure/services/api-client-factory.js.map +1 -0
- package/lib/infrastructure/services/api-service.d.ts +2 -2
- package/lib/infrastructure/services/api-service.js +8 -7
- package/lib/infrastructure/services/api-service.js.map +1 -1
- package/lib/infrastructure/services/auth-service.d.ts +1 -1
- package/lib/infrastructure/services/auth-service.js +10 -6
- package/lib/infrastructure/services/auth-service.js.map +1 -1
- 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 +12 -11
- package/lib/infrastructure/services/portal-service.js +77 -83
- package/lib/infrastructure/services/portal-service.js.map +1 -1
- package/lib/infrastructure/services/telemetry-service.d.ts +3 -2
- package/lib/infrastructure/services/telemetry-service.js +4 -6
- package/lib/infrastructure/services/telemetry-service.js.map +1 -1
- 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/prompts/api/transform.d.ts +11 -0
- package/lib/prompts/api/transform.js +30 -0
- package/lib/prompts/api/transform.js.map +1 -0
- package/lib/prompts/api/validate.d.ts +12 -0
- package/lib/prompts/api/validate.js +41 -0
- package/lib/prompts/api/validate.js.map +1 -0
- package/lib/prompts/auth/login.d.ts +6 -1
- package/lib/prompts/auth/login.js +12 -3
- package/lib/prompts/auth/login.js.map +1 -1
- package/lib/prompts/auth/logout.d.ts +3 -0
- package/lib/prompts/auth/logout.js +7 -0
- package/lib/prompts/auth/logout.js.map +1 -0
- package/lib/prompts/auth/status.d.ts +8 -0
- package/lib/prompts/auth/status.js +21 -0
- package/lib/prompts/auth/status.js.map +1 -0
- package/lib/prompts/format.d.ts +33 -0
- package/lib/prompts/format.js +99 -0
- package/lib/prompts/format.js.map +1 -0
- package/lib/prompts/portal/copilot.d.ts +15 -5
- package/lib/prompts/portal/copilot.js +49 -21
- package/lib/prompts/portal/copilot.js.map +1 -1
- package/lib/prompts/portal/generate.d.ts +9 -7
- package/lib/prompts/portal/generate.js +22 -23
- package/lib/prompts/portal/generate.js.map +1 -1
- package/lib/prompts/portal/quickstart.d.ts +30 -29
- package/lib/prompts/portal/quickstart.js +99 -193
- package/lib/prompts/portal/quickstart.js.map +1 -1
- package/lib/prompts/portal/recipe/new-recipe.d.ts +23 -18
- package/lib/prompts/portal/recipe/new-recipe.js +70 -108
- package/lib/prompts/portal/recipe/new-recipe.js.map +1 -1
- package/lib/prompts/portal/serve.d.ts +10 -3
- package/lib/prompts/portal/serve.js +30 -11
- package/lib/prompts/portal/serve.js.map +1 -1
- package/lib/prompts/portal/toc/new-toc.d.ts +12 -8
- package/lib/prompts/portal/toc/new-toc.js +20 -22
- package/lib/prompts/portal/toc/new-toc.js.map +1 -1
- package/lib/prompts/sdk/generate.d.ts +7 -7
- package/lib/prompts/sdk/generate.js +17 -23
- package/lib/prompts/sdk/generate.js.map +1 -1
- package/lib/types/api/account.d.ts +1 -1
- package/lib/types/api/transform.d.ts +14 -25
- package/lib/types/api/transform.js +16 -16
- package/lib/types/api/transform.js.map +1 -1
- package/lib/types/build/build.d.ts +9 -1
- package/lib/types/build/build.js +5 -2
- package/lib/types/build/build.js.map +1 -1
- package/lib/types/build-context.d.ts +5 -1
- package/lib/types/build-context.js +21 -4
- package/lib/types/build-context.js.map +1 -1
- 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 +1 -1
- package/lib/types/events/domain-event.js.map +1 -1
- 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 +1 -1
- package/lib/types/events/recipe-creation-failed.js +1 -1
- package/lib/types/events/recipe-creation-failed.js.map +1 -1
- package/lib/types/events/toc-creation-failed.d.ts +1 -1
- package/lib/types/events/toc-creation-failed.js +1 -1
- package/lib/types/events/toc-creation-failed.js.map +1 -1
- package/lib/types/file/directory.d.ts +17 -0
- package/lib/types/file/directory.js +86 -0
- package/lib/types/file/directory.js.map +1 -0
- package/lib/types/file/directoryPath.d.ts +3 -1
- package/lib/types/file/directoryPath.js +8 -2
- package/lib/types/file/directoryPath.js.map +1 -1
- package/lib/types/file/fileName.d.ts +3 -1
- package/lib/types/file/fileName.js +14 -2
- package/lib/types/file/fileName.js.map +1 -1
- package/lib/types/file/filePath.d.ts +2 -0
- package/lib/types/file/filePath.js +21 -0
- package/lib/types/file/filePath.js.map +1 -1
- 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/portal-context.d.ts +3 -1
- package/lib/types/portal-context.js +10 -0
- package/lib/types/portal-context.js.map +1 -1
- package/lib/types/recipe/recipe.d.ts +2 -17
- package/lib/types/recipe-context.d.ts +8 -0
- package/lib/types/recipe-context.js +21 -0
- package/lib/types/recipe-context.js.map +1 -0
- package/lib/types/resource-context.d.ts +12 -0
- package/lib/types/resource-context.js +30 -0
- package/lib/types/resource-context.js.map +1 -0
- package/lib/types/sdk/generate.d.ts +2 -15
- package/lib/types/sdk/generate.js +24 -10
- package/lib/types/sdk/generate.js.map +1 -1
- package/lib/types/sdk-context.d.ts +6 -5
- package/lib/types/sdk-context.js +12 -8
- package/lib/types/sdk-context.js.map +1 -1
- package/lib/types/sdl/sdl.d.ts +9 -0
- package/lib/types/sdl/sdl.js +46 -1
- package/lib/types/sdl/sdl.js.map +1 -1
- package/lib/types/spec-context.d.ts +3 -0
- package/lib/types/spec-context.js +7 -2
- package/lib/types/spec-context.js.map +1 -1
- 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-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/utils/string-utils.d.ts +1 -0
- package/lib/utils/string-utils.js +10 -0
- package/lib/utils/string-utils.js.map +1 -0
- package/lib/utils/utils.d.ts +2 -27
- package/lib/utils/utils.js +6 -145
- package/lib/utils/utils.js.map +1 -1
- package/package.json +11 -10
- package/lib/application/portal/serve/portal-watcher.d.ts +0 -11
- package/lib/application/portal/serve/portal-watcher.js +0 -64
- package/lib/application/portal/serve/portal-watcher.js.map +0 -1
- package/lib/application/portal/serve/serve-handler.d.ts +0 -16
- package/lib/application/portal/serve/serve-handler.js +0 -91
- package/lib/application/portal/serve/serve-handler.js.map +0 -1
- package/lib/application/portal/serve/watcher-handler.js.map +0 -1
- package/lib/application/portal/toc/sdl-parser.d.ts +0 -19
- package/lib/application/portal/toc/sdl-parser.js +0 -90
- package/lib/application/portal/toc/sdl-parser.js.map +0 -1
- package/lib/client-utils/sdk-client.d.ts +0 -22
- package/lib/client-utils/sdk-client.js +0 -89
- package/lib/client-utils/sdk-client.js.map +0 -1
- package/lib/config/env.d.ts +0 -26
- package/lib/config/env.js +0 -27
- package/lib/config/env.js.map +0 -1
- package/lib/controllers/api/transform.d.ts +0 -5
- package/lib/controllers/api/transform.js +0 -50
- package/lib/controllers/api/transform.js.map +0 -1
- package/lib/controllers/api/validate.d.ts +0 -3
- package/lib/controllers/api/validate.js +0 -29
- package/lib/controllers/api/validate.js.map +0 -1
- package/lib/controllers/portal/quickstart.d.ts +0 -15
- package/lib/controllers/portal/quickstart.js +0 -217
- package/lib/controllers/portal/quickstart.js.map +0 -1
- package/lib/prompts/portal/common/base-prompts.d.ts +0 -7
- package/lib/prompts/portal/common/base-prompts.js +0 -19
- package/lib/prompts/portal/common/base-prompts.js.map +0 -1
- package/lib/types/api/validate.d.ts +0 -12
- package/lib/types/api/validate.js +0 -2
- package/lib/types/api/validate.js.map +0 -1
- package/lib/types/common/result.d.ts +0 -17
- package/lib/types/common/result.js +0 -32
- package/lib/types/common/result.js.map +0 -1
- package/lib/types/portal/generate.d.ts +0 -13
- package/lib/types/portal/generate.js +0 -3
- package/lib/types/portal/generate.js.map +0 -1
- package/lib/types/portal/quickstart.d.ts +0 -17
- package/lib/types/portal/quickstart.js +0 -2
- package/lib/types/portal/quickstart.js.map +0 -1
- package/lib/types/portal/serve.d.ts +0 -12
- package/lib/types/portal/serve.js +0 -2
- package/lib/types/portal/serve.js.map +0 -1
- package/lib/validators/common/directoryValidator.d.ts +0 -5
- package/lib/validators/common/directoryValidator.js +0 -22
- package/lib/validators/common/directoryValidator.js.map +0 -1
- package/lib/validators/portal/serve-validator.d.ts +0 -6
- package/lib/validators/portal/serve-validator.js +0 -15
- package/lib/validators/portal/serve-validator.js.map +0 -1
|
@@ -1 +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,
|
|
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,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,EAAE;gBACzD,IAAI;gBACJ,KAAK;gBACL,KAAK;aACN,CAAC,EACF,eAAe,CAAC,KAAK,CACtB,CAAC;QACJ,CAAC,EACD,GAAG,EAAE,GAAE,CAAC,CACT,CAAC;IACJ,CAAC;;;AAtDM,uBAAO,GAAG,qDAAqD,AAAxD,CAAyD;AAEhE,2BAAW,GAAG;;;EAGrB,MAAM,CAAC,IAAI,CACX,+FAA+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
|
-
import { Command
|
|
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
|
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
7
|
open: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
8
|
"no-reload": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
-
port: import("@oclif/core/interfaces").OptionFlag<number
|
|
10
|
+
port: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
-
constructor(argv: string[], config: Config);
|
|
12
|
+
static cmdTxt: string;
|
|
13
13
|
static examples: string[];
|
|
14
14
|
run(): Promise<void>;
|
|
15
|
-
private
|
|
15
|
+
private getConfigDir;
|
|
16
16
|
}
|
|
@@ -1,80 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
var _a;
|
|
2
2
|
import { Command, Flags } from "@oclif/core";
|
|
3
|
-
import { PortalServePrompts } from "../../prompts/portal/serve.js";
|
|
4
3
|
import { PortalServeAction } from "../../actions/portal/serve.js";
|
|
5
|
-
import { getMessageInRedColor } from "../../utils/utils.js";
|
|
6
|
-
import { ServeHandler } from "../../application/portal/serve/serve-handler.js";
|
|
7
|
-
import { PortalService } from "../../infrastructure/services/portal-service.js";
|
|
8
|
-
import { GenerateAction } from "../../actions/portal/generate.js";
|
|
9
4
|
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
10
5
|
import { FlagsProvider } from "../../types/flags-provider.js";
|
|
6
|
+
import { format, intro, outro } from "../../prompts/format.js";
|
|
11
7
|
const DEFAULT_WORKING_DIRECTORY = "./";
|
|
12
8
|
class PortalServe extends Command {
|
|
13
|
-
constructor(argv, config) {
|
|
14
|
-
super(argv, config);
|
|
15
|
-
this.prompts = new PortalServePrompts();
|
|
16
|
-
}
|
|
17
9
|
async run() {
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const buildDirectory = flags.input ? new DirectoryPath(flags.input, "src") : workingDirectory.join("src");
|
|
26
|
-
const portalDirectory = flags.destination ? new DirectoryPath(flags.destination) : workingDirectory.join("portal");
|
|
27
|
-
const generatePortalAction = new GenerateAction(new DirectoryPath(this.config.configDir), flags["auth-key"]);
|
|
28
|
-
const serveFlags = {
|
|
29
|
-
folder: buildDirectory.toString(),
|
|
30
|
-
destination: portalDirectory.toString(),
|
|
31
|
-
"auth-key": flags["auth-key"],
|
|
32
|
-
port: port,
|
|
33
|
-
open: flags.open,
|
|
34
|
-
"no-reload": flags["no-reload"]
|
|
35
|
-
};
|
|
36
|
-
const servePaths = {
|
|
37
|
-
sourceDirectoryPath: buildDirectory.toString(),
|
|
38
|
-
destinationDirectoryPath: portalDirectory.toString()
|
|
10
|
+
const { flags: { input, destination, port, open, "no-reload": noReload, "auth-key": authKey } } = await this.parse(_a);
|
|
11
|
+
const workingDirectory = new DirectoryPath(input !== null && input !== void 0 ? input : DEFAULT_WORKING_DIRECTORY);
|
|
12
|
+
const buildDirectory = input ? new DirectoryPath(input, "src") : workingDirectory.join("src");
|
|
13
|
+
const portalDirectory = destination ? new DirectoryPath(destination) : workingDirectory.join("portal");
|
|
14
|
+
const commandMetadata = {
|
|
15
|
+
commandName: _a.id,
|
|
16
|
+
shell: this.config.shell
|
|
39
17
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
if (servePortalResult.isCancelled()) {
|
|
46
|
-
portalServePrompts.logError(getMessageInRedColor(servePortalResult.value));
|
|
47
|
-
}
|
|
48
|
-
if (servePortalResult.isSuccess()) {
|
|
49
|
-
this.prompts.displayOutroMessage(buildDirectory.toString(), portalDirectory.toString(), port, flags["no-reload"]);
|
|
50
|
-
}
|
|
18
|
+
intro("Portal Serve");
|
|
19
|
+
const portalServeAction = new PortalServeAction(this.getConfigDir(), commandMetadata, authKey);
|
|
20
|
+
const result = await portalServeAction.execute(buildDirectory, portalDirectory, port, open, !noReload);
|
|
21
|
+
outro(result);
|
|
51
22
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const preferredPorts = typeof port === "number" ? [port, ...defaultPorts.filter((p) => p !== port)] : defaultPorts;
|
|
55
|
-
const availablePort = await getPort({ port: preferredPorts });
|
|
56
|
-
// Show warning only if user provided --port and it is not available
|
|
57
|
-
if (typeof port === "number" && availablePort !== port) {
|
|
58
|
-
this.prompts.displayInfo(`⚠️ Port ${port} is already in use. Available port ${availablePort} will be used.`);
|
|
59
|
-
}
|
|
60
|
-
return availablePort;
|
|
23
|
+
getConfigDir() {
|
|
24
|
+
return new DirectoryPath(this.config.configDir);
|
|
61
25
|
}
|
|
62
26
|
}
|
|
63
|
-
|
|
27
|
+
_a = PortalServe;
|
|
28
|
+
PortalServe.summary = "Generate and serve an API Documentation Portal with hot reload.";
|
|
29
|
+
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.";
|
|
64
30
|
PortalServe.flags = Object.assign(Object.assign(Object.assign(Object.assign({ port: Flags.integer({
|
|
65
31
|
char: "p",
|
|
66
|
-
description: "
|
|
32
|
+
description: "port to serve the portal.",
|
|
33
|
+
default: 3000,
|
|
34
|
+
helpValue: "3000"
|
|
67
35
|
}) }, FlagsProvider.input), FlagsProvider.destination("portal", "portal")), { open: Flags.boolean({
|
|
68
36
|
char: "o",
|
|
69
|
-
description: "
|
|
37
|
+
description: "open the portal in the default browser.",
|
|
70
38
|
default: false
|
|
71
39
|
}), "no-reload": Flags.boolean({
|
|
72
|
-
description: "
|
|
40
|
+
description: "disable hot reload.",
|
|
73
41
|
default: false
|
|
74
42
|
}) }), FlagsProvider.authKey);
|
|
43
|
+
PortalServe.cmdTxt = format.cmd("apimatic", "portal", "serve");
|
|
75
44
|
PortalServe.examples = [
|
|
76
|
-
|
|
77
|
-
|
|
45
|
+
_a.cmdTxt,
|
|
46
|
+
`${_a.cmdTxt} ` +
|
|
47
|
+
`${format.flag("input", './')} ` +
|
|
48
|
+
`${format.flag("destination", './portal')} ` +
|
|
49
|
+
`${format.flag("port", "3000")} ` +
|
|
50
|
+
`${format.flag("open")} ` +
|
|
51
|
+
`${format.flag("no-reload")}`
|
|
78
52
|
];
|
|
79
53
|
export default PortalServe;
|
|
80
54
|
//# sourceMappingURL=serve.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/commands/portal/serve.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAEvC,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,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,eAAe,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvG,MAAM,eAAe,GA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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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
2
|
export default class PortalTocNew extends Command {
|
|
3
3
|
static summary: string;
|
|
4
4
|
static description: string;
|
|
@@ -8,7 +8,7 @@ export default class PortalTocNew extends Command {
|
|
|
8
8
|
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
9
|
destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
};
|
|
11
|
+
static cmdTxt: string;
|
|
11
12
|
static examples: string[];
|
|
12
|
-
constructor(argv: string[], config: Config);
|
|
13
13
|
run(): Promise<void>;
|
|
14
14
|
}
|
|
@@ -1,33 +1,41 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { Command, Flags } from "@oclif/core";
|
|
2
3
|
import { PortalNewTocAction } from "../../../actions/portal/toc/new-toc.js";
|
|
3
4
|
import { TelemetryService } from "../../../infrastructure/services/telemetry-service.js";
|
|
4
5
|
import { TocCreationFailedEvent } from "../../../types/events/toc-creation-failed.js";
|
|
5
6
|
import { DirectoryPath } from "../../../types/file/directoryPath.js";
|
|
6
7
|
import { FlagsProvider } from "../../../types/flags-provider.js";
|
|
8
|
+
import { format, intro, outro } from "../../../prompts/format.js";
|
|
7
9
|
const DEFAULT_WORKING_DIRECTORY = "./";
|
|
8
10
|
class PortalTocNew extends Command {
|
|
9
|
-
constructor(argv, config) {
|
|
10
|
-
super(argv, config);
|
|
11
|
-
}
|
|
12
11
|
async run() {
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const result = await
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
const { flags: { input, destination, force, "expand-endpoints": expandEndpoints, "expand-models": expandModels } } = await this.parse(_a);
|
|
13
|
+
const workingDirectory = new DirectoryPath(input !== null && input !== void 0 ? input : DEFAULT_WORKING_DIRECTORY);
|
|
14
|
+
const buildDirectory = input ? new DirectoryPath(input, "src") : workingDirectory.join("src");
|
|
15
|
+
const tocDirectory = destination ? new DirectoryPath(destination) : undefined;
|
|
16
|
+
const commandMetadata = {
|
|
17
|
+
commandName: _a.id,
|
|
18
|
+
shell: this.config.shell
|
|
19
|
+
};
|
|
20
|
+
intro("New TOC");
|
|
21
|
+
const action = new PortalNewTocAction(new DirectoryPath(this.config.configDir), commandMetadata);
|
|
22
|
+
const result = await action.execute(buildDirectory, tocDirectory, force, expandEndpoints, expandModels);
|
|
23
|
+
outro(result);
|
|
24
|
+
result.mapAll(() => { }, async () => {
|
|
25
|
+
const telemetryService = new TelemetryService(new DirectoryPath(this.config.configDir));
|
|
26
|
+
await telemetryService.trackEvent(
|
|
27
|
+
// TODO: fix Toc error message
|
|
28
|
+
new TocCreationFailedEvent("error", _a.id, {
|
|
29
|
+
input,
|
|
30
|
+
destination,
|
|
31
|
+
force,
|
|
32
|
+
"expand-endpoints": expandEndpoints,
|
|
33
|
+
"expand-models": expandModels
|
|
34
|
+
}), commandMetadata.shell);
|
|
35
|
+
}, () => { });
|
|
29
36
|
}
|
|
30
37
|
}
|
|
38
|
+
_a = PortalTocNew;
|
|
31
39
|
PortalTocNew.summary = "Generate a Table of Contents (TOC) file for your API documentation portal";
|
|
32
40
|
PortalTocNew.description = `This command generates a new Table of Contents (TOC) file used in the
|
|
33
41
|
generation of your API documentation portal.
|
|
@@ -35,18 +43,19 @@ generation of your API documentation portal.
|
|
|
35
43
|
The output is a YAML file with the .yml extension.
|
|
36
44
|
|
|
37
45
|
To learn more about the TOC file and APIMatic build directory structure, visit:
|
|
38
|
-
https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal`;
|
|
39
|
-
PortalTocNew.flags = Object.assign(Object.assign(Object.assign(Object.assign({}, FlagsProvider.destination("src/content", `
|
|
46
|
+
${format.link("https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal")}`;
|
|
47
|
+
PortalTocNew.flags = Object.assign(Object.assign(Object.assign(Object.assign({}, FlagsProvider.destination("src/content", `toc.yml`)), FlagsProvider.input), FlagsProvider.force), { "expand-endpoints": Flags.boolean({
|
|
40
48
|
default: false,
|
|
41
|
-
description:
|
|
49
|
+
description: `include individual entries for each endpoint in the generated ${format.var("toc.yml")}. Requires a valid API specification in the working directory.`
|
|
42
50
|
}), "expand-models": Flags.boolean({
|
|
43
51
|
default: false,
|
|
44
|
-
description:
|
|
52
|
+
description: `include individual entries for each model in the generated ${format.var("toc.yml")}. Requires a valid API specification in the working directory.`
|
|
45
53
|
}) });
|
|
54
|
+
PortalTocNew.cmdTxt = format.cmd("apimatic", "portal", "toc", "new");
|
|
46
55
|
PortalTocNew.examples = [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
`${_a.cmdTxt} ${format.flag("destination", './src/content/')}`,
|
|
57
|
+
`${_a.cmdTxt} ${format.flag("input", './')}`,
|
|
58
|
+
`${_a.cmdTxt} ${format.flag("input", './')} ${format.flag("destination", './src/content/')}`
|
|
50
59
|
];
|
|
51
60
|
export default PortalTocNew;
|
|
52
61
|
//# sourceMappingURL=new.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new.js","sourceRoot":"","sources":["../../../../src/commands/portal/toc/new.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"new.js","sourceRoot":"","sources":["../../../../src/commands/portal/toc/new.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uDAAuD,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,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,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAEvC,MAAqB,YAAa,SAAQ,OAAO;IAsC/C,KAAK,CAAC,GAAG;QACP,MAAM,EACJ,KAAK,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,EACzG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,EAAY,CAAC,CAAC;QAEnC,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,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,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kB,EAAE,KAAK,CAAC,OAAO,CAAC;QAChC,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,iEAAiE,MAAM,CAAC,GAAG,CACtF,SAAS,CACV,gEAAgE;KAClE,CAAC,EACF,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC;QAC7B,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,8DAA8D,MAAM,CAAC,GAAG,CACnF,SAAS,CACV,gEAAgE;KAClE,CAAC,GAfQ,CAgBV;AAEK,mBAAM,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"}
|
|
@@ -1,16 +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
7
|
"auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
8
|
zip: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
9
|
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
-
|
|
10
|
+
language: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
11
|
spec: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
12
|
destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
13
|
};
|
|
12
14
|
static examples: string[];
|
|
13
|
-
private readonly prompts;
|
|
14
15
|
run(): Promise<void>;
|
|
15
|
-
private getConfigDir;
|
|
16
|
+
private readonly getConfigDir;
|
|
16
17
|
}
|
|
@@ -1,46 +1,55 @@
|
|
|
1
1
|
import { Command, Flags } from "@oclif/core";
|
|
2
2
|
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
3
3
|
import { FlagsProvider } from "../../types/flags-provider.js";
|
|
4
|
-
import { SdkGeneratePrompts } from "../../prompts/sdk/generate.js";
|
|
5
4
|
import { GenerateAction } from "../../actions/sdk/generate.js";
|
|
6
|
-
import {
|
|
5
|
+
import { Language } from "../../types/sdk/generate.js";
|
|
6
|
+
import { format, intro, outro } from "../../prompts/format.js";
|
|
7
7
|
const DEFAULT_WORKING_DIRECTORY = "./";
|
|
8
8
|
class SdkGenerate extends Command {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
|
-
this.prompts = new SdkGeneratePrompts();
|
|
12
11
|
this.getConfigDir = () => {
|
|
13
12
|
return new DirectoryPath(this.config.configDir);
|
|
14
13
|
};
|
|
15
14
|
}
|
|
16
15
|
async run() {
|
|
17
|
-
const { flags: {
|
|
16
|
+
const { flags: { language, spec, destination, force, zip: zipSdk, "auth-key": authKey } } = await this.parse(SdkGenerate);
|
|
18
17
|
const workingDirectory = new DirectoryPath(DEFAULT_WORKING_DIRECTORY);
|
|
19
18
|
const specDirectory = new DirectoryPath(spec);
|
|
20
|
-
const sdkDirectory = destination ? new DirectoryPath(destination) : workingDirectory.join("sdk")
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const sdkDirectory = destination ? new DirectoryPath(destination) : workingDirectory.join("sdk");
|
|
20
|
+
const commandMetadata = {
|
|
21
|
+
commandName: SdkGenerate.id,
|
|
22
|
+
shell: this.config.shell
|
|
23
|
+
};
|
|
24
|
+
intro("Generate SDK");
|
|
25
|
+
const action = new GenerateAction(this.getConfigDir(), commandMetadata, authKey);
|
|
26
|
+
const result = await action.execute(specDirectory, sdkDirectory, language, force, zipSdk);
|
|
27
|
+
outro(result);
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
|
-
SdkGenerate.
|
|
27
|
-
SdkGenerate.
|
|
30
|
+
SdkGenerate.summary = "Generate an SDK for your API";
|
|
31
|
+
SdkGenerate.description = `Generate Software Development Kits (SDKs) from API specifications.
|
|
32
|
+
Supports multiple programming languages including Java, C#, Python, JavaScript, and more.`;
|
|
33
|
+
SdkGenerate.cmdTxt = format.cmd("apimatic", "sdk", "generate");
|
|
34
|
+
SdkGenerate.flags = Object.assign(Object.assign(Object.assign({ language: Flags.string({
|
|
35
|
+
char: "l",
|
|
28
36
|
required: true,
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
description: "Programming language for SDK generation",
|
|
38
|
+
options: Object.values(Language).map((p) => p.valueOf()),
|
|
31
39
|
}), spec: Flags.string({
|
|
32
|
-
description: "
|
|
40
|
+
description: "Path to the folder containing the API specification file",
|
|
33
41
|
default: "./src/spec"
|
|
34
42
|
}), destination: Flags.string({
|
|
35
43
|
char: "d",
|
|
36
|
-
description:
|
|
44
|
+
description: "Directory where the SDK will be generated"
|
|
37
45
|
}) }, FlagsProvider.force), { zip: Flags.boolean({
|
|
38
46
|
default: false,
|
|
39
|
-
description: "
|
|
47
|
+
description: "Download the generated SDK as a .zip archive"
|
|
40
48
|
}) }), FlagsProvider.authKey);
|
|
41
49
|
SdkGenerate.examples = [
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
`${SdkGenerate.cmdTxt} ${format.flag("language", "java")}`,
|
|
51
|
+
`${SdkGenerate.cmdTxt} ${format.flag("language", "csharp")} ${format.flag("spec", "./src/spec")}`,
|
|
52
|
+
`${SdkGenerate.cmdTxt} ${format.flag("language", "python")} ${format.flag("destination", "./sdk")} ${format.flag("zip")}`
|
|
44
53
|
];
|
|
45
54
|
export default SdkGenerate;
|
|
46
55
|
//# sourceMappingURL=generate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/commands/sdk/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/commands/sdk/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAEvC,MAAqB,WAAY,SAAQ,OAAO;IAAhD;;QA2DmB,iBAAY,GAAG,GAAG,EAAE;YACnC,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAClD,CAAC,CAAC;IACJ,CAAC;IAvBC,KAAK,CAAC,GAAG;QACP,MAAM,EACJ,KAAK,EAAE,E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AAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;KACzD,CAAC,EACF,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE,0DAA0D;QACvE,OAAO,EAAE,YAAY;KACtB,CAAC,EACF,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,2CAA2C;KACzD,CAAC,IACC,aAAa,CAAC,KAAK,KACtB,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC;QACjB,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,8CAA8C;KAC5D,CAAC,KACC,aAAa,CAAC,OAAO,CApBd,CAqBV;AAEK,oBAAQ,GAAG;IAChB,GAAG,WAAW,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE;IAC1D,GAAG,WAAW,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE;IACjG,GAAG,WAAW,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,CAC9G,KAAK,CACN,EAAE;CACJ,AANc,CAMb;eArCiB,WAAW"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// This code was originally forked from https://github.com/oclif/plugin-not-found/blob/main/src/index.ts
|
|
2
|
+
import { toConfiguredId } from "@oclif/core";
|
|
3
|
+
import { cyan, yellow } from "ansis";
|
|
4
|
+
import utils from "./utils.js";
|
|
5
|
+
const hook = async function (opts) {
|
|
6
|
+
var _a;
|
|
7
|
+
const hiddenCommandIds = new Set(opts.config.commands.filter((c) => c.hidden).map((c) => c.id));
|
|
8
|
+
const commandIDs = [...opts.config.commandIDs, ...opts.config.commands.flatMap((c) => c.aliases)].filter((c) => !hiddenCommandIds.has(c));
|
|
9
|
+
if (commandIDs.length === 0)
|
|
10
|
+
return;
|
|
11
|
+
let binHelp = `${opts.config.bin} help`;
|
|
12
|
+
const idSplit = opts.id.split(":");
|
|
13
|
+
if (opts.config.findTopic(idSplit[0])) {
|
|
14
|
+
binHelp = `${binHelp} ${idSplit[0]}`;
|
|
15
|
+
}
|
|
16
|
+
let suggestion;
|
|
17
|
+
if (/:?help:?/.test(opts.id)) {
|
|
18
|
+
suggestion = ["help", ...opts.id.split(":").filter((cmd) => cmd !== "help")].join(":");
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
suggestion = utils.closest(opts.id, commandIDs);
|
|
22
|
+
}
|
|
23
|
+
const readableSuggestion = suggestion ? toConfiguredId(suggestion, this.config) : null;
|
|
24
|
+
const originalCmd = toConfiguredId(opts.id, this.config);
|
|
25
|
+
this.warn(`${yellow(originalCmd)} is not a ${opts.config.bin} command.`);
|
|
26
|
+
if (!process.stdin.isTTY || !suggestion) {
|
|
27
|
+
this.error(`Run ${cyan.bold(binHelp)} for a list of available commands.`, {
|
|
28
|
+
exit: 127
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
let response;
|
|
32
|
+
try {
|
|
33
|
+
response = await utils.getConfirmation(readableSuggestion);
|
|
34
|
+
}
|
|
35
|
+
catch (_b) {
|
|
36
|
+
response = false;
|
|
37
|
+
}
|
|
38
|
+
if (response) {
|
|
39
|
+
const confirmedSuggestion = suggestion;
|
|
40
|
+
let argv = ((_a = opts.argv) === null || _a === void 0 ? void 0 : _a.length) ? opts.argv : opts.id.split(":").slice(confirmedSuggestion.split(":").length);
|
|
41
|
+
if (confirmedSuggestion.startsWith("help:")) {
|
|
42
|
+
argv = confirmedSuggestion.split(":").slice(1);
|
|
43
|
+
suggestion = "help";
|
|
44
|
+
}
|
|
45
|
+
return this.config.runCommand(confirmedSuggestion, argv);
|
|
46
|
+
}
|
|
47
|
+
this.error(`Run ${cyan.bold(binHelp)} for a list of available commands.`, {
|
|
48
|
+
exit: 127
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
export default hook;
|
|
52
|
+
//# sourceMappingURL=not-found.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-found.js","sourceRoot":"","sources":["../../src/hooks/not-found.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,OAAO,EAAQ,cAAc,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,MAAM,IAAI,GAAyB,KAAK,WAAW,IAAI;;IACrD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEhG,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CACtG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAChC,CAAC;IAEF,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAEpC,IAAI,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,I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,CAAC,CAAC;IAC9D,CAAC;IAAC,WAAM,CAAC;QACP,QAAQ,GAAG,KAAK,CAAC;IACnB,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,mBAAmB,GAAG,UAAW,CAAC;QACxC,IAAI,IAAI,GAAG,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM,EAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;QAE3G,IAAI,mBAAmB,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5C,IAAI,GAAG,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC/C,UAAU,GAAG,MAAM,CAAC;QACtB,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,oCAAoC,EAAE;QACxE,IAAI,EAAE,GAAG;KACV,CAAC,CAAC;AAEL,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// This code was originally forked from https://github.com/oclif/plugin-not-found/blob/main/src/utils.ts
|
|
2
|
+
import readline from 'node:readline';
|
|
3
|
+
import { blueBright, reset } from 'ansis';
|
|
4
|
+
import levenshtein from 'fast-levenshtein';
|
|
5
|
+
const getConfirmation = async (suggestion) => {
|
|
6
|
+
if (!process.stdin.isTTY)
|
|
7
|
+
return false;
|
|
8
|
+
const question = `${reset('Did you mean ' + blueBright(suggestion) + '?')} (Y/n) `;
|
|
9
|
+
return new Promise((resolve) => {
|
|
10
|
+
const rl = readline.createInterface({
|
|
11
|
+
input: process.stdin,
|
|
12
|
+
output: process.stdout,
|
|
13
|
+
});
|
|
14
|
+
let settled = false;
|
|
15
|
+
const cleanup = () => {
|
|
16
|
+
rl.close();
|
|
17
|
+
clearTimeout(timeout);
|
|
18
|
+
};
|
|
19
|
+
const finish = (result) => {
|
|
20
|
+
if (!settled) {
|
|
21
|
+
settled = true;
|
|
22
|
+
cleanup();
|
|
23
|
+
resolve(result);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const timeout = setTimeout(() => {
|
|
27
|
+
finish(false);
|
|
28
|
+
}, 10000);
|
|
29
|
+
rl.question(question, (answer) => {
|
|
30
|
+
const a = (answer !== null && answer !== void 0 ? answer : '').trim().toLowerCase();
|
|
31
|
+
finish(a === '' || a === 'y' || a === 'yes');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const closest = (target, possibilities) => {
|
|
36
|
+
let best = null;
|
|
37
|
+
let bestDistance = Infinity;
|
|
38
|
+
for (const id of possibilities) {
|
|
39
|
+
const distance = levenshtein.get(target, id, { useCollator: true });
|
|
40
|
+
if (distance < bestDistance) {
|
|
41
|
+
bestDistance = distance;
|
|
42
|
+
best = id;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return best;
|
|
46
|
+
};
|
|
47
|
+
export default {
|
|
48
|
+
closest,
|
|
49
|
+
getConfirmation,
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/hooks/utils.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAE3C,MAAM,eAAe,GAAG,KAAK,EAAE,UAAkB,EAAoB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AAM,OAAO,GAAG,CAAC,MAAc,EAAE,aAAuB,EAAiB,EAAE;IACzE,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,IAAI,YAAY,GAAG,QAAQ,CAAC;IAE5B,KAAK,MAAM,EAAE,IAAI,aAAa,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QACpE,IAAI,QAAQ,GAAG,YAAY,EAAE,CAAC;YAC5B,YAAY,GAAG,QAAQ,CAAC;YACxB,IAAI,GAAG,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,eAAe;IACb,OAAO;IACP,eAAe;CAChB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import { format as f } from "../prompts/format.js";
|
|
2
3
|
export function getErrorMessage(error) {
|
|
3
4
|
switch (error) {
|
|
4
5
|
case "NETWORK_ERROR" /* ServiceError.NetworkError */:
|
|
@@ -9,7 +10,7 @@ export function getErrorMessage(error) {
|
|
|
9
10
|
case "SERVER_ERROR" /* ServiceError.ServerError */:
|
|
10
11
|
case "INVALID_RESPONSE" /* ServiceError.InvalidResponse */:
|
|
11
12
|
default:
|
|
12
|
-
return
|
|
13
|
+
return `An unexpected error occurred, please try again later. If the problem persists, please reach out to our team at ${f.var('support@apimatic.io')}`;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
export function handleServiceError(error) {
|
|
@@ -24,7 +25,7 @@ export function handleServiceError(error) {
|
|
|
24
25
|
if (((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === 500) {
|
|
25
26
|
return "SERVER_ERROR" /* ServiceError.ServerError */;
|
|
26
27
|
}
|
|
27
|
-
if (error.code === "ECONNABORTED" || error.code === "ECONNREFUSED") {
|
|
28
|
+
if (error.code === "ECONNABORTED" || error.code === "ECONNREFUSED" || error.code === "ENOTFOUND") {
|
|
28
29
|
return "NETWORK_ERROR" /* ServiceError.NetworkError */;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-utils.js","sourceRoot":"","sources":["../../src/infrastructure/api-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"api-utils.js","sourceRoot":"","sources":["../../src/infrastructure/api-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,sBAAsB,CAAC;AAUnD,MAAM,UAAU,eAAe,CAAC,KAAmB;IACjD,QAAQ,KAAK,EAAE,CAAC;QACd;YACE,OAAO,kCAAkC,CAAC;QAC5C;YACE,OAAO,sBAAsB,CAAC;QAChC,6CAA2B;QAC3B,mDAA8B;QAC9B,2DAAkC;QAClC;YACE,OAAO,kHAAkH,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,CAAC;IAC5J,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAc;;IAC/C,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;YACnC,sDAAiC;QACnC,CAAC;QACD,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;YACnC,+CAA6B;QAC/B,CAAC;QACD,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;YACnC,qDAAgC;QAClC,CAAC;QACD,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YACjG,uDAAiC;QACnC,CAAC;IACH,CAAC;IACD,qDAAgC;AAClC,CAAC"}
|
package/lib/{application/portal/serve/watcher-handler.d.ts → infrastructure/debounce-service.d.ts}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare class
|
|
1
|
+
export declare class DebounceService {
|
|
2
2
|
private isProcessing;
|
|
3
3
|
private latestHandler;
|
|
4
4
|
private debounceTimer;
|
|
5
5
|
private readonly debounceMs;
|
|
6
6
|
constructor(debounceMs?: number);
|
|
7
|
-
|
|
7
|
+
batchSingleRequest(handler: () => Promise<void>): Promise<void>;
|
|
8
8
|
private scheduleExecution;
|
|
9
|
-
|
|
9
|
+
close(): void;
|
|
10
10
|
}
|