@apimatic/cli 1.1.0-alpha.2 → 1.1.0-alpha.20
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 +249 -99
- package/bin/run.js +5 -0
- package/lib/actions/action-result.d.ts +8 -0
- package/lib/actions/action-result.js +25 -0
- package/lib/actions/action-result.js.map +1 -0
- package/lib/actions/auth/login.d.ts +12 -0
- package/lib/actions/auth/login.js +63 -0
- package/lib/actions/auth/login.js.map +1 -0
- package/lib/actions/portal/copilot.d.ts +11 -0
- package/lib/actions/portal/copilot.js +49 -0
- package/lib/actions/portal/copilot.js.map +1 -0
- package/lib/actions/portal/generate.d.ts +13 -0
- package/lib/actions/portal/generate.js +61 -0
- package/lib/actions/portal/generate.js.map +1 -0
- package/lib/actions/portal/recipe/new-recipe.d.ts +24 -0
- package/lib/actions/portal/recipe/new-recipe.js +250 -0
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
- package/lib/actions/portal/serve.d.ts +14 -0
- package/lib/actions/portal/serve.js +24 -0
- package/lib/actions/portal/serve.js.map +1 -0
- package/lib/actions/portal/toc/new-toc.d.ts +20 -0
- package/lib/actions/portal/toc/new-toc.js +133 -0
- package/lib/actions/portal/toc/new-toc.js.map +1 -0
- package/lib/actions/sdk/generate.d.ts +14 -0
- package/lib/actions/sdk/generate.js +72 -0
- package/lib/actions/sdk/generate.js.map +1 -0
- package/lib/application/portal/recipe/portal-recipe.d.ts +8 -0
- package/lib/application/portal/recipe/portal-recipe.js +33 -0
- package/lib/application/portal/recipe/portal-recipe.js.map +1 -0
- package/lib/application/portal/recipe/recipe-generator.d.ts +16 -0
- package/lib/application/portal/recipe/recipe-generator.js +147 -0
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
- package/lib/application/portal/serve/portal-watcher.d.ts +11 -0
- package/lib/application/portal/serve/portal-watcher.js +64 -0
- package/lib/application/portal/serve/portal-watcher.js.map +1 -0
- package/lib/application/portal/serve/serve-handler.d.ts +16 -0
- package/lib/application/portal/serve/serve-handler.js +91 -0
- package/lib/application/portal/serve/serve-handler.js.map +1 -0
- package/lib/application/portal/serve/watcher-handler.d.ts +10 -0
- package/lib/application/portal/serve/watcher-handler.js +51 -0
- package/lib/application/portal/serve/watcher-handler.js.map +1 -0
- package/lib/application/portal/toc/sdl-parser.d.ts +19 -0
- package/lib/application/portal/toc/sdl-parser.js +90 -0
- package/lib/application/portal/toc/sdl-parser.js.map +1 -0
- package/lib/application/portal/toc/toc-content-parser.d.ts +5 -0
- package/lib/application/portal/toc/toc-content-parser.js +44 -0
- package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
- package/lib/application/portal/toc/toc-structure-generator.d.ts +6 -0
- package/lib/application/portal/toc/toc-structure-generator.js +84 -0
- package/lib/application/portal/toc/toc-structure-generator.js.map +1 -0
- package/lib/client-utils/auth-manager.d.ts +8 -3
- package/lib/client-utils/auth-manager.js +23 -10
- package/lib/client-utils/auth-manager.js.map +1 -0
- package/lib/client-utils/sdk-client.d.ts +0 -1
- package/lib/client-utils/sdk-client.js +25 -55
- package/lib/client-utils/sdk-client.js.map +1 -0
- package/lib/commands/api/transform.d.ts +7 -7
- package/lib/commands/api/transform.js +43 -51
- package/lib/commands/api/transform.js.map +1 -0
- package/lib/commands/api/validate.d.ts +4 -4
- package/lib/commands/api/validate.js +26 -33
- package/lib/commands/api/validate.js.map +1 -0
- package/lib/commands/auth/login.d.ts +3 -2
- package/lib/commands/auth/login.js +22 -53
- package/lib/commands/auth/login.js.map +1 -0
- package/lib/commands/auth/logout.d.ts +1 -1
- package/lib/commands/auth/logout.js +8 -13
- package/lib/commands/auth/logout.js.map +1 -0
- package/lib/commands/auth/status.d.ts +1 -1
- package/lib/commands/auth/status.js +9 -13
- package/lib/commands/auth/status.js.map +1 -0
- package/lib/commands/portal/copilot.d.ts +12 -0
- package/lib/commands/portal/copilot.js +32 -0
- package/lib/commands/portal/copilot.js.map +1 -0
- package/lib/commands/portal/generate.d.ts +10 -8
- package/lib/commands/portal/generate.js +28 -107
- package/lib/commands/portal/generate.js.map +1 -0
- package/lib/commands/portal/quickstart.d.ts +10 -0
- package/lib/commands/portal/quickstart.js +105 -0
- package/lib/commands/portal/quickstart.js.map +1 -0
- package/lib/commands/portal/recipe/new.d.ts +10 -0
- package/lib/commands/portal/recipe/new.js +38 -0
- package/lib/commands/portal/recipe/new.js.map +1 -0
- package/lib/commands/portal/serve.d.ts +16 -0
- package/lib/commands/portal/serve.js +80 -0
- package/lib/commands/portal/serve.js.map +1 -0
- package/lib/commands/portal/toc/new.d.ts +14 -0
- package/lib/commands/portal/toc/new.js +52 -0
- package/lib/commands/portal/toc/new.js.map +1 -0
- package/lib/commands/sdk/generate.d.ts +9 -8
- package/lib/commands/sdk/generate.js +39 -128
- package/lib/commands/sdk/generate.js.map +1 -0
- package/lib/config/axios-config.d.ts +2 -0
- package/lib/config/axios-config.js +10 -0
- package/lib/config/axios-config.js.map +1 -0
- package/lib/config/env.d.ts +26 -1
- package/lib/config/env.js +27 -4
- package/lib/config/env.js.map +1 -0
- package/lib/controllers/api/transform.d.ts +1 -1
- package/lib/controllers/api/transform.js +23 -22
- package/lib/controllers/api/transform.js.map +1 -0
- package/lib/controllers/api/validate.d.ts +3 -3
- package/lib/controllers/api/validate.js +19 -12
- package/lib/controllers/api/validate.js.map +1 -0
- package/lib/controllers/portal/quickstart.d.ts +15 -0
- package/lib/controllers/portal/quickstart.js +217 -0
- package/lib/controllers/portal/quickstart.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -4
- package/lib/index.js.map +1 -0
- package/lib/infrastructure/api-utils.d.ts +9 -0
- package/lib/infrastructure/api-utils.js +33 -0
- package/lib/infrastructure/api-utils.js.map +1 -0
- package/lib/infrastructure/env-info.d.ts +8 -0
- package/lib/infrastructure/env-info.js +37 -0
- package/lib/infrastructure/env-info.js.map +1 -0
- package/lib/infrastructure/file-service.d.ts +18 -0
- package/lib/infrastructure/file-service.js +76 -0
- package/lib/infrastructure/file-service.js.map +1 -0
- package/lib/infrastructure/services/api-service.d.ts +10 -0
- package/lib/infrastructure/services/api-service.js +54 -0
- package/lib/infrastructure/services/api-service.js.map +1 -0
- package/lib/infrastructure/services/auth-service.d.ts +11 -0
- package/lib/infrastructure/services/auth-service.js +33 -0
- package/lib/infrastructure/services/auth-service.js.map +1 -0
- package/lib/infrastructure/services/portal-service.d.ts +20 -0
- package/lib/infrastructure/services/portal-service.js +163 -0
- package/lib/infrastructure/services/portal-service.js.map +1 -0
- package/lib/infrastructure/services/telemetry-service.d.ts +8 -0
- package/lib/infrastructure/services/telemetry-service.js +40 -0
- package/lib/infrastructure/services/telemetry-service.js.map +1 -0
- package/lib/infrastructure/tmp-extensions.d.ts +2 -0
- package/lib/infrastructure/tmp-extensions.js +6 -0
- package/lib/infrastructure/tmp-extensions.js.map +1 -0
- package/lib/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/auth/login.d.ts +5 -0
- package/lib/prompts/auth/login.js +13 -0
- package/lib/prompts/auth/login.js.map +1 -0
- package/lib/prompts/portal/common/base-prompts.d.ts +7 -0
- package/lib/prompts/portal/common/base-prompts.js +19 -0
- package/lib/prompts/portal/common/base-prompts.js.map +1 -0
- package/lib/prompts/portal/copilot.d.ts +8 -0
- package/lib/prompts/portal/copilot.js +54 -0
- package/lib/prompts/portal/copilot.js.map +1 -0
- package/lib/prompts/portal/generate.d.ts +11 -0
- package/lib/prompts/portal/generate.js +42 -0
- package/lib/prompts/portal/generate.js.map +1 -0
- package/lib/prompts/portal/quickstart.d.ts +30 -0
- package/lib/prompts/portal/quickstart.js +240 -0
- package/lib/prompts/portal/quickstart.js.map +1 -0
- package/lib/prompts/portal/recipe/new-recipe.d.ts +24 -0
- package/lib/prompts/portal/recipe/new-recipe.js +203 -0
- package/lib/prompts/portal/recipe/new-recipe.js.map +1 -0
- package/lib/prompts/portal/serve.d.ts +4 -0
- package/lib/prompts/portal/serve.js +14 -0
- package/lib/prompts/portal/serve.js.map +1 -0
- package/lib/prompts/portal/toc/new-toc.d.ts +11 -0
- package/lib/prompts/portal/toc/new-toc.js +39 -0
- package/lib/prompts/portal/toc/new-toc.js.map +1 -0
- package/lib/prompts/sdk/generate.d.ts +11 -0
- package/lib/prompts/sdk/generate.js +42 -0
- package/lib/prompts/sdk/generate.js.map +1 -0
- package/lib/types/api/account.d.ts +10 -0
- package/lib/types/api/account.js +2 -0
- package/lib/types/api/account.js.map +1 -0
- package/lib/types/api/transform.d.ts +19 -4
- package/lib/types/api/transform.js +19 -4
- package/lib/types/api/transform.js.map +1 -0
- package/lib/types/api/validate.d.ts +3 -3
- package/lib/types/api/validate.js +2 -2
- package/lib/types/api/validate.js.map +1 -0
- package/lib/types/build/build.d.ts +14 -0
- package/lib/types/build/build.js +4 -0
- package/lib/types/build/build.js.map +1 -0
- package/lib/types/build-context.d.ts +13 -0
- package/lib/types/build-context.js +30 -0
- package/lib/types/build-context.js.map +1 -0
- package/lib/types/common/result.d.ts +17 -0
- package/lib/types/common/result.js +32 -0
- package/lib/types/common/result.js.map +1 -0
- package/lib/types/events/domain-event.d.ts +8 -0
- package/lib/types/events/domain-event.js +11 -0
- package/lib/types/events/domain-event.js.map +1 -0
- package/lib/types/events/recipe-creation-failed.d.ts +5 -0
- package/lib/types/events/recipe-creation-failed.js +8 -0
- package/lib/types/events/recipe-creation-failed.js.map +1 -0
- package/lib/types/events/toc-creation-failed.d.ts +5 -0
- package/lib/types/events/toc-creation-failed.js +8 -0
- package/lib/types/events/toc-creation-failed.js.map +1 -0
- package/lib/types/file/directoryPath.d.ts +7 -0
- package/lib/types/file/directoryPath.js +16 -0
- package/lib/types/file/directoryPath.js.map +1 -0
- package/lib/types/file/fileName.d.ts +5 -0
- package/lib/types/file/fileName.js +9 -0
- package/lib/types/file/fileName.js.map +1 -0
- package/lib/types/file/filePath.d.ts +8 -0
- package/lib/types/file/filePath.js +11 -0
- package/lib/types/file/filePath.js.map +1 -0
- package/lib/types/flags-provider.d.ts +15 -0
- package/lib/types/flags-provider.js +34 -0
- package/lib/types/flags-provider.js.map +1 -0
- package/lib/types/portal/generate.d.ts +13 -9
- package/lib/types/portal/generate.js +3 -2
- package/lib/types/portal/generate.js.map +1 -0
- package/lib/types/portal/quickstart.d.ts +17 -0
- package/lib/types/portal/quickstart.js +2 -0
- package/lib/types/portal/quickstart.js.map +1 -0
- package/lib/types/portal/serve.d.ts +12 -0
- package/lib/types/portal/serve.js +2 -0
- package/lib/types/portal/serve.js.map +1 -0
- package/lib/types/portal-context.d.ts +11 -0
- package/lib/types/portal-context.js +28 -0
- package/lib/types/portal-context.js.map +1 -0
- package/lib/types/recipe/recipe.d.ts +37 -0
- package/lib/types/recipe/recipe.js +6 -0
- package/lib/types/recipe/recipe.js.map +1 -0
- package/lib/types/sdk/generate.d.ts +11 -10
- package/lib/types/sdk/generate.js +11 -12
- package/lib/types/sdk/generate.js.map +1 -0
- package/lib/types/sdk-context.d.ts +13 -0
- package/lib/types/sdk-context.js +28 -0
- package/lib/types/sdk-context.js.map +1 -0
- package/lib/types/sdl/sdl.d.ts +12 -0
- package/lib/types/sdl/sdl.js +2 -0
- package/lib/types/sdl/sdl.js.map +1 -0
- package/lib/types/spec-context.d.ts +7 -0
- package/lib/types/spec-context.js +12 -0
- package/lib/types/spec-context.js.map +1 -0
- package/lib/types/toc/toc.d.ts +31 -0
- package/lib/types/toc/toc.js +9 -0
- package/lib/types/toc/toc.js.map +1 -0
- package/lib/types/utils.d.ts +3 -3
- package/lib/types/utils.js +2 -2
- package/lib/types/utils.js.map +1 -0
- package/lib/utils/utils.d.ts +16 -7
- package/lib/utils/utils.js +142 -86
- package/lib/utils/utils.js.map +1 -0
- package/lib/validators/common/directoryValidator.d.ts +5 -0
- package/lib/validators/common/directoryValidator.js +22 -0
- package/lib/validators/common/directoryValidator.js.map +1 -0
- package/lib/validators/portal/serve-validator.d.ts +6 -0
- package/lib/validators/portal/serve-validator.js +15 -0
- package/lib/validators/portal/serve-validator.js.map +1 -0
- package/package.json +96 -40
- package/bin/run +0 -5
- package/lib/controllers/portal/generate.d.ts +0 -2
- package/lib/controllers/portal/generate.js +0 -49
- package/lib/controllers/sdk/generate.d.ts +0 -4
- package/lib/controllers/sdk/generate.js +0 -64
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/types/portal/generate.ts"],"names":[],"mappings":"AAMC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type LoginCredentials = {
|
|
2
|
+
email: string;
|
|
3
|
+
password: string;
|
|
4
|
+
};
|
|
5
|
+
export type SpecFile = {
|
|
6
|
+
localPath: string;
|
|
7
|
+
url: string;
|
|
8
|
+
};
|
|
9
|
+
export type PortalServerConfig = {
|
|
10
|
+
generatedPortalPath: string;
|
|
11
|
+
sourceDirectoryPath: string;
|
|
12
|
+
configDir: string;
|
|
13
|
+
authKey: string | null;
|
|
14
|
+
ignoredPaths?: string[];
|
|
15
|
+
port?: number;
|
|
16
|
+
openInBrowser?: boolean;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/types/portal/quickstart.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ServeFlags {
|
|
2
|
+
readonly port: number;
|
|
3
|
+
readonly folder: string;
|
|
4
|
+
readonly destination: string;
|
|
5
|
+
readonly open: boolean;
|
|
6
|
+
readonly "auth-key": string | undefined;
|
|
7
|
+
readonly "no-reload": boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ServePaths {
|
|
10
|
+
readonly sourceDirectoryPath: string;
|
|
11
|
+
readonly destinationDirectoryPath: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/types/portal/serve.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DirectoryPath } from "./file/directoryPath.js";
|
|
2
|
+
import { FilePath } from "./file/filePath.js";
|
|
3
|
+
export declare class PortalContext {
|
|
4
|
+
private readonly portalDirectory;
|
|
5
|
+
private readonly fileService;
|
|
6
|
+
private readonly zipService;
|
|
7
|
+
constructor(portalDirectory: DirectoryPath);
|
|
8
|
+
get ZipPath(): FilePath;
|
|
9
|
+
exists(): Promise<boolean>;
|
|
10
|
+
save(tempPortalFilePath: FilePath, zipPortal: boolean): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FileService } from "../infrastructure/file-service.js";
|
|
2
|
+
import { FilePath } from "./file/filePath.js";
|
|
3
|
+
import { FileName } from "./file/fileName.js";
|
|
4
|
+
import { ZipService } from "../infrastructure/zip-service.js";
|
|
5
|
+
export class PortalContext {
|
|
6
|
+
constructor(portalDirectory) {
|
|
7
|
+
this.portalDirectory = portalDirectory;
|
|
8
|
+
this.fileService = new FileService();
|
|
9
|
+
this.zipService = new ZipService();
|
|
10
|
+
}
|
|
11
|
+
get ZipPath() {
|
|
12
|
+
// TODO: add checks for build file path
|
|
13
|
+
return new FilePath(this.portalDirectory, new FileName("portal.zip"));
|
|
14
|
+
}
|
|
15
|
+
async exists() {
|
|
16
|
+
return !await this.fileService.directoryEmpty(this.portalDirectory);
|
|
17
|
+
}
|
|
18
|
+
async save(tempPortalFilePath, zipPortal) {
|
|
19
|
+
await this.fileService.cleanDirectory(this.portalDirectory);
|
|
20
|
+
if (zipPortal) {
|
|
21
|
+
await this.fileService.copy(tempPortalFilePath, this.ZipPath);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
await this.zipService.unArchive(tempPortalFilePath, this.portalDirectory);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=portal-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal-context.js","sourceRoot":"","sources":["../../src/types/portal-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE9D,MAAM,OAAO,aAAa;IAKxB,YAA6B,eAA8B;QAA9B,oBAAe,GAAf,eAAe,CAAe;QAH1C,gBAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QAChC,eAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAG/C,CAAC;IAED,IAAW,OAAO;QAChB,uCAAuC;QACvC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;IACxE,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACtE,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,kBAA4B,EAAE,SAAkB;QAChE,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC5D,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAChE,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,kBAAkB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare enum StepType {
|
|
2
|
+
Content = "content",
|
|
3
|
+
Endpoint = "endpoint"
|
|
4
|
+
}
|
|
5
|
+
export interface RecipeContext {
|
|
6
|
+
showContent(content: string): Promise<any>;
|
|
7
|
+
showEndpoint(config: EndpointConfig): Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface EndpointConfig {
|
|
10
|
+
description: string;
|
|
11
|
+
endpointPermalink: string;
|
|
12
|
+
}
|
|
13
|
+
export interface StepConfig {
|
|
14
|
+
name: string;
|
|
15
|
+
stepCallback: () => Promise<any>;
|
|
16
|
+
}
|
|
17
|
+
export interface RecipeDefinition {
|
|
18
|
+
[stepKey: string]: StepConfig;
|
|
19
|
+
}
|
|
20
|
+
export interface SerializableRecipe {
|
|
21
|
+
name: string;
|
|
22
|
+
steps: SerializableStep[];
|
|
23
|
+
}
|
|
24
|
+
export interface SerializableStep {
|
|
25
|
+
key: string;
|
|
26
|
+
name: string;
|
|
27
|
+
type: "content" | "endpoint";
|
|
28
|
+
config: ContentStepConfig | EndpointStepConfig;
|
|
29
|
+
}
|
|
30
|
+
export interface ContentStepConfig {
|
|
31
|
+
content: string;
|
|
32
|
+
}
|
|
33
|
+
export interface EndpointStepConfig extends EndpointConfig {
|
|
34
|
+
}
|
|
35
|
+
export interface DirectoryNode {
|
|
36
|
+
[key: string]: DirectoryNode | string | null | undefined;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe.js","sourceRoot":"","sources":["../../../src/types/recipe/recipe.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;AACvB,CAAC,EAHW,QAAQ,KAAR,QAAQ,QAGnB"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type GenerationIdParams = {
|
|
2
2
|
file: string;
|
|
3
3
|
url: string;
|
|
4
4
|
platform: string;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type DownloadSDKParams = {
|
|
7
7
|
codeGenId: string;
|
|
8
8
|
zip: boolean;
|
|
9
9
|
zippedSDKPath: string;
|
|
10
10
|
sdkFolderPath: string;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type SDKGenerateUnprocessableError = {
|
|
13
13
|
message: string;
|
|
14
14
|
};
|
|
15
|
-
export declare enum
|
|
16
|
-
CSHARP = "
|
|
17
|
-
JAVA = "
|
|
18
|
-
PHP = "
|
|
19
|
-
PYTHON = "
|
|
20
|
-
RUBY = "
|
|
21
|
-
TYPESCRIPT = "
|
|
15
|
+
export declare enum LanguagePlatform {
|
|
16
|
+
CSHARP = "csharp",
|
|
17
|
+
JAVA = "java",
|
|
18
|
+
PHP = "php",
|
|
19
|
+
PYTHON = "python",
|
|
20
|
+
RUBY = "ruby",
|
|
21
|
+
TYPESCRIPT = "typescript",
|
|
22
|
+
GO = "go"
|
|
22
23
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})(SimplePlatforms = exports.SimplePlatforms || (exports.SimplePlatforms = {}));
|
|
1
|
+
export var LanguagePlatform;
|
|
2
|
+
(function (LanguagePlatform) {
|
|
3
|
+
LanguagePlatform["CSHARP"] = "csharp";
|
|
4
|
+
LanguagePlatform["JAVA"] = "java";
|
|
5
|
+
LanguagePlatform["PHP"] = "php";
|
|
6
|
+
LanguagePlatform["PYTHON"] = "python";
|
|
7
|
+
LanguagePlatform["RUBY"] = "ruby";
|
|
8
|
+
LanguagePlatform["TYPESCRIPT"] = "typescript";
|
|
9
|
+
LanguagePlatform["GO"] = "go";
|
|
10
|
+
})(LanguagePlatform || (LanguagePlatform = {}));
|
|
11
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/types/sdk/generate.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAN,IAAY,gBAQX;AARD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,iCAAa,CAAA;IACb,+BAAW,CAAA;IACX,qCAAiB,CAAA;IACjB,iCAAa,CAAA;IACb,6CAAyB,CAAA;IACzB,6BAAS,CAAA;AACX,CAAC,EARW,gBAAgB,KAAhB,gBAAgB,QAQ3B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DirectoryPath } from "./file/directoryPath.js";
|
|
2
|
+
import { FilePath } from "./file/filePath.js";
|
|
3
|
+
import { LanguagePlatform } from "./sdk/generate.js";
|
|
4
|
+
export declare class SdkContext {
|
|
5
|
+
private readonly sdkDirectory;
|
|
6
|
+
private readonly platform;
|
|
7
|
+
private readonly fileService;
|
|
8
|
+
private readonly zipService;
|
|
9
|
+
constructor(sdkDirectory: DirectoryPath, platform: LanguagePlatform);
|
|
10
|
+
get ZipPath(): FilePath;
|
|
11
|
+
exists(): Promise<boolean>;
|
|
12
|
+
save(tempPortalFilePath: FilePath, zipPortal: boolean): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FileService } from "../infrastructure/file-service.js";
|
|
2
|
+
import { FilePath } from "./file/filePath.js";
|
|
3
|
+
import { FileName } from "./file/fileName.js";
|
|
4
|
+
import { ZipService } from "../infrastructure/zip-service.js";
|
|
5
|
+
export class SdkContext {
|
|
6
|
+
constructor(sdkDirectory, platform) {
|
|
7
|
+
this.sdkDirectory = sdkDirectory;
|
|
8
|
+
this.platform = platform;
|
|
9
|
+
this.fileService = new FileService();
|
|
10
|
+
this.zipService = new ZipService();
|
|
11
|
+
}
|
|
12
|
+
get ZipPath() {
|
|
13
|
+
return new FilePath(this.sdkDirectory, new FileName(`${this.platform}.zip`));
|
|
14
|
+
}
|
|
15
|
+
async exists() {
|
|
16
|
+
return !await this.fileService.directoryEmpty(this.sdkDirectory);
|
|
17
|
+
}
|
|
18
|
+
async save(tempPortalFilePath, zipPortal) {
|
|
19
|
+
await this.fileService.cleanDirectory(this.sdkDirectory);
|
|
20
|
+
if (zipPortal) {
|
|
21
|
+
await this.fileService.copy(tempPortalFilePath, this.ZipPath);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
await this.zipService.unArchive(tempPortalFilePath, this.sdkDirectory);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=sdk-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-context.js","sourceRoot":"","sources":["../../src/types/sdk-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAG9D,MAAM,OAAO,UAAU;IAKrB,YAA6B,YAA2B,EACrC,QAA0B;QADhB,iBAAY,GAAZ,YAAY,CAAe;QACrC,aAAQ,GAAR,QAAQ,CAAkB;QAJ5B,gBAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QAChC,eAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAI/C,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,QAAQ,CAAC,GAAG,IAAI,CAAC,QAAQ,MAAM,CAAC,CAAC,CAAC;IAC/E,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACnE,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,kBAA4B,EAAE,SAAkB;QAChE,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzD,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAChE,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,kBAAkB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Sdl {
|
|
2
|
+
readonly Endpoints: SdlEndpoint[];
|
|
3
|
+
readonly CustomTypes: SdlModel[];
|
|
4
|
+
}
|
|
5
|
+
export interface SdlEndpoint {
|
|
6
|
+
readonly Name: string;
|
|
7
|
+
readonly Description: string;
|
|
8
|
+
readonly Group: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SdlModel {
|
|
11
|
+
readonly Name: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdl.js","sourceRoot":"","sources":["../../../src/types/sdl/sdl.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FileService } from "../infrastructure/file-service.js";
|
|
2
|
+
export class SpecContext {
|
|
3
|
+
constructor(specDirectory) {
|
|
4
|
+
this.fileService = new FileService();
|
|
5
|
+
this.specDirectory = specDirectory;
|
|
6
|
+
}
|
|
7
|
+
async validate() {
|
|
8
|
+
// TODO: add more checks here
|
|
9
|
+
return await this.fileService.directoryExists(this.specDirectory);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=spec-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-context.js","sourceRoot":"","sources":["../../src/types/spec-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGhE,MAAM,OAAO,WAAW;IAItB,YAAY,aAA4B;QAHvB,gBAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QAI/C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,6BAA6B;QAC7B,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IACnE,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface Toc {
|
|
2
|
+
toc: Array<TocGroup | TocGenerated>;
|
|
3
|
+
}
|
|
4
|
+
export interface TocGroup {
|
|
5
|
+
readonly group: string;
|
|
6
|
+
readonly items: Array<TocGroup | TocGenerated | TocEndpoint | TocEndpointGroupOverview | TocModel | TocCustomPage>;
|
|
7
|
+
}
|
|
8
|
+
export interface TocGenerated {
|
|
9
|
+
readonly generate: string;
|
|
10
|
+
readonly from: string;
|
|
11
|
+
}
|
|
12
|
+
export interface TocEndpointGroupOverview {
|
|
13
|
+
readonly generate: null;
|
|
14
|
+
readonly from: "endpoint-group-overview";
|
|
15
|
+
readonly endpointGroup: string;
|
|
16
|
+
}
|
|
17
|
+
export interface TocEndpoint {
|
|
18
|
+
readonly generate: null;
|
|
19
|
+
readonly from: "endpoint";
|
|
20
|
+
readonly endpointName: string;
|
|
21
|
+
readonly endpointGroup: string;
|
|
22
|
+
}
|
|
23
|
+
export interface TocModel {
|
|
24
|
+
readonly generate: null;
|
|
25
|
+
readonly from: "model";
|
|
26
|
+
readonly modelName: string;
|
|
27
|
+
}
|
|
28
|
+
export interface TocCustomPage {
|
|
29
|
+
readonly page: string;
|
|
30
|
+
readonly file: string;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toc.js","sourceRoot":"","sources":["../../../src/types/toc/toc.ts"],"names":[],"mappings":"AAEC,CAAC;AAKD,CAAC;AAKD,CAAC;AAMD,CAAC;AAOD,CAAC;AAMD,CAAC;AAKD,CAAC"}
|
package/lib/types/utils.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type ValidationMessages = {
|
|
2
2
|
messages: string[];
|
|
3
3
|
warnings: string[];
|
|
4
4
|
errors: string[];
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type loggers = {
|
|
7
7
|
log: (message: string) => void;
|
|
8
8
|
warn: (message: string) => void;
|
|
9
9
|
error: (message: string) => void;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type AuthenticationError = {
|
|
12
12
|
statusCode: number;
|
|
13
13
|
body: string;
|
|
14
14
|
};
|
package/lib/types/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/types/utils.ts"],"names":[],"mappings":""}
|
package/lib/utils/utils.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { loggers, ValidationMessages } from "../types/utils.js";
|
|
2
|
+
export declare const createTempDirectory: () => Promise<string>;
|
|
3
|
+
export declare const clearDirectory: (folderPath: string) => Promise<void>;
|
|
4
|
+
interface DirectoryNode {
|
|
5
|
+
[key: string]: DirectoryNode | string | null | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare const directoryToJson: (dirPath: string, parentPath?: string) => DirectoryNode;
|
|
8
|
+
export declare const isValidUrl: (input: string) => boolean;
|
|
5
9
|
export declare const deleteFile: (filePath: string) => Promise<void>;
|
|
6
10
|
export declare const writeFileUsingReadableStream: (stream: NodeJS.ReadableStream, destinationPath: string) => Promise<unknown>;
|
|
7
11
|
/**
|
|
@@ -12,9 +16,14 @@ export declare const writeFileUsingReadableStream: (stream: NodeJS.ReadableStrea
|
|
|
12
16
|
* return {string}
|
|
13
17
|
*/
|
|
14
18
|
export declare const zipDirectory: (sourcePath: string, destinationPath: string) => Promise<string>;
|
|
15
|
-
export declare const startProgress: (title: string) => void;
|
|
16
|
-
export declare const stopProgress: (isError?: boolean) => void | null;
|
|
17
19
|
export declare const replaceHTML: (string: string) => string;
|
|
18
|
-
export declare const isJSONParsable: (json: string) => boolean;
|
|
19
20
|
export declare const getFileNameFromPath: (filePath: string) => string;
|
|
20
21
|
export declare const printValidationMessages: ({ warnings, errors, messages }: ValidationMessages, { log, warn, error }: loggers) => void;
|
|
22
|
+
export declare function parseStreamBodyToJson(body: NodeJS.ReadableStream): Promise<any>;
|
|
23
|
+
export declare const getMessageInOrangeColor: (message: string) => string;
|
|
24
|
+
export declare const getMessageInBlueColor: (message: string) => string;
|
|
25
|
+
export declare const getMessageInCyanColor: (message: string) => string;
|
|
26
|
+
export declare const getMessageInGreenColor: (message: string) => string;
|
|
27
|
+
export declare const getMessageInMagentaColor: (message: string) => string;
|
|
28
|
+
export declare const getMessageInRedColor: (message: string) => string;
|
|
29
|
+
export {};
|