@apimatic/cli 1.1.0-alpha.2 → 1.1.0-alpha.21
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 +257 -101
- 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 +14 -0
- package/lib/actions/portal/copilot.js +79 -0
- package/lib/actions/portal/copilot.js.map +1 -0
- package/lib/actions/portal/generate.d.ts +14 -0
- package/lib/actions/portal/generate.js +66 -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 +4 -9
- package/lib/client-utils/sdk-client.js +9 -87
- 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 +46 -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 +35 -36
- 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 +13 -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 +114 -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 +13 -0
- package/lib/controllers/portal/quickstart.js +214 -0
- package/lib/controllers/portal/quickstart.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.d.ts +1 -1
- package/lib/index.js +2 -4
- package/lib/index.js.map +1 -0
- package/lib/infrastructure/api-client-utils.d.ts +6 -0
- package/lib/infrastructure/api-client-utils.js +34 -0
- package/lib/infrastructure/api-client-utils.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 +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 +18 -0
- package/lib/infrastructure/file-service.js +76 -0
- package/lib/infrastructure/file-service.js.map +1 -0
- package/lib/infrastructure/launcher-service.d.ts +5 -0
- package/lib/infrastructure/launcher-service.js +47 -0
- package/lib/infrastructure/launcher-service.js.map +1 -0
- package/lib/infrastructure/services/api-service.d.ts +10 -0
- package/lib/infrastructure/services/api-service.js +55 -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 +35 -0
- package/lib/infrastructure/services/auth-service.js.map +1 -0
- package/lib/infrastructure/services/portal-service.d.ts +23 -0
- package/lib/infrastructure/services/portal-service.js +186 -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 +14 -0
- package/lib/prompts/portal/copilot.js +71 -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/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/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 +100 -43
- 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,91 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
import livereload from "livereload";
|
|
3
|
+
import connectLivereload from "connect-livereload";
|
|
4
|
+
import open from "open";
|
|
5
|
+
import process from "process";
|
|
6
|
+
import getPort from "get-port";
|
|
7
|
+
import console from "console";
|
|
8
|
+
import { Result } from "../../../types/common/result.js";
|
|
9
|
+
import { PortalWatcher } from "./portal-watcher.js";
|
|
10
|
+
export class ServeHandler {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.app = express();
|
|
13
|
+
this.portalWatcher = new PortalWatcher();
|
|
14
|
+
}
|
|
15
|
+
//TODO: Needs to be refactored after refactoring quickstart.
|
|
16
|
+
async setupServer(generatedPortalArtifactsDirectoryPath) {
|
|
17
|
+
const createLiveReloadServerResult = await this.createLiveReloadServer(generatedPortalArtifactsDirectoryPath);
|
|
18
|
+
if (createLiveReloadServerResult.isFailed()) {
|
|
19
|
+
return Result.failure(createLiveReloadServerResult.error);
|
|
20
|
+
}
|
|
21
|
+
this.app.use(express.static(generatedPortalArtifactsDirectoryPath, { extensions: ["html"] }));
|
|
22
|
+
return Result.success(`Server is set up and serving files from ${generatedPortalArtifactsDirectoryPath}`);
|
|
23
|
+
}
|
|
24
|
+
//TODO: Needs to be refactored after refactoring quickstart.
|
|
25
|
+
async startServer(paths, flags, commandName, generatePortal, displayShutdownMessages = true) {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
this.server = this.app
|
|
28
|
+
.listen(flags.port, async () => {
|
|
29
|
+
if (flags.open) {
|
|
30
|
+
await open(`http://localhost:${flags.port}`);
|
|
31
|
+
}
|
|
32
|
+
if (!flags["no-reload"]) {
|
|
33
|
+
await this.portalWatcher.watchAndRegeneratePortalOnChange(paths, commandName, generatePortal);
|
|
34
|
+
}
|
|
35
|
+
if (process.platform !== "darwin") {
|
|
36
|
+
//For non-macOS users.
|
|
37
|
+
if (process.stdin.setRawMode) {
|
|
38
|
+
process.stdin.setRawMode(false);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
resolve(Result.success(true));
|
|
42
|
+
})
|
|
43
|
+
.on("error", () => {
|
|
44
|
+
reject(new Error(`Something went wrong while serving your portal. Please try again later. If the issue persists, contact our team at support@apimatic.io`));
|
|
45
|
+
});
|
|
46
|
+
const shutdown = async () => {
|
|
47
|
+
if (displayShutdownMessages) {
|
|
48
|
+
console.log("Shutting down server...");
|
|
49
|
+
}
|
|
50
|
+
await this.stopServer();
|
|
51
|
+
if (displayShutdownMessages) {
|
|
52
|
+
console.log("Server shut down successfully.");
|
|
53
|
+
}
|
|
54
|
+
resolve(Result.success(true));
|
|
55
|
+
process.exit(0);
|
|
56
|
+
};
|
|
57
|
+
process.on("SIGINT", shutdown);
|
|
58
|
+
process.on("SIGTERM", shutdown);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async stopServer() {
|
|
62
|
+
this.portalWatcher.cancelPendingOperations();
|
|
63
|
+
if (this.liveReloadServer) {
|
|
64
|
+
this.liveReloadServer.close();
|
|
65
|
+
}
|
|
66
|
+
if (this.server) {
|
|
67
|
+
await new Promise((resolve) => {
|
|
68
|
+
this.server.close(() => resolve());
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async createLiveReloadServer(generatedPortalPath) {
|
|
73
|
+
try {
|
|
74
|
+
const availablePort = await this.getPortForReloadServer();
|
|
75
|
+
this.liveReloadServer = livereload.createServer({
|
|
76
|
+
port: availablePort
|
|
77
|
+
});
|
|
78
|
+
this.liveReloadServer.watch(generatedPortalPath);
|
|
79
|
+
this.app.use(connectLivereload());
|
|
80
|
+
return Result.success("Live Reload Server setup successfully.");
|
|
81
|
+
}
|
|
82
|
+
catch (_a) {
|
|
83
|
+
return Result.failure("An unexpected error occurred while serving your portal, please try again later. If the issue persists, contact our team at support@apimatic.io for assistance.");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async getPortForReloadServer() {
|
|
87
|
+
const defaultPorts = [35729, 35730, 35731];
|
|
88
|
+
return await getPort({ port: defaultPorts });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=serve-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve-handler.js","sourceRoot":"","sources":["../../../../src/application/portal/serve/serve-handler.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AACnD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,OAAO,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AAE,CAAC;YAC1B,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAChC,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;gBAClC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,sBAAsB,CAAC,mBAA2B;QAC9D,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC1D,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC,YAAY,CAAC;gBAC9C,IAAI,EAAE,aAAa;aACpB,CAAC,CAAC;YAEH,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACjD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;YAElC,OAAO,MAAM,CAAC,OAAO,CAAC,wCAAwC,CAAC,CAAC;QAClE,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,MAAM,CAAC,OAAO,CACnB,gKAAgK,CACjK,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,sBAAsB;QAClC,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC3C,OAAO,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class WatcherHandler {
|
|
2
|
+
private isProcessing;
|
|
3
|
+
private latestHandler;
|
|
4
|
+
private debounceTimer;
|
|
5
|
+
private readonly debounceMs;
|
|
6
|
+
constructor(debounceMs?: number);
|
|
7
|
+
execute(handler: () => Promise<void>): Promise<void>;
|
|
8
|
+
private scheduleExecution;
|
|
9
|
+
cancel(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export class WatcherHandler {
|
|
2
|
+
constructor(debounceMs = 500) {
|
|
3
|
+
this.isProcessing = false;
|
|
4
|
+
this.latestHandler = null;
|
|
5
|
+
this.debounceTimer = null;
|
|
6
|
+
this.debounceMs = debounceMs;
|
|
7
|
+
}
|
|
8
|
+
async execute(handler) {
|
|
9
|
+
// Always store the latest handler
|
|
10
|
+
this.latestHandler = handler;
|
|
11
|
+
// If already processing, don't start a new timer. Just update the latest handler
|
|
12
|
+
if (this.isProcessing) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
// Clear any existing timer
|
|
16
|
+
if (this.debounceTimer) {
|
|
17
|
+
clearTimeout(this.debounceTimer);
|
|
18
|
+
}
|
|
19
|
+
// Set up debounced execution
|
|
20
|
+
this.scheduleExecution();
|
|
21
|
+
}
|
|
22
|
+
scheduleExecution() {
|
|
23
|
+
this.debounceTimer = setTimeout(async () => {
|
|
24
|
+
if (this.isProcessing) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this.isProcessing = true;
|
|
28
|
+
this.debounceTimer = null;
|
|
29
|
+
try {
|
|
30
|
+
// Execute the latest handler if it exists
|
|
31
|
+
if (this.latestHandler) {
|
|
32
|
+
const currentHandler = this.latestHandler;
|
|
33
|
+
this.latestHandler = null;
|
|
34
|
+
await currentHandler();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
this.isProcessing = false;
|
|
39
|
+
}
|
|
40
|
+
}, this.debounceMs);
|
|
41
|
+
}
|
|
42
|
+
// Method to clear any pending execution.
|
|
43
|
+
cancel() {
|
|
44
|
+
if (this.debounceTimer) {
|
|
45
|
+
clearTimeout(this.debounceTimer);
|
|
46
|
+
this.debounceTimer = null;
|
|
47
|
+
}
|
|
48
|
+
this.latestHandler = null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=watcher-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watcher-handler.js","sourceRoot":"","sources":["../../../../src/application/portal/serve/watcher-handler.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;IAMzB,YAAY,aAAqB,GAAG;QAL5B,iBAAY,GAAG,KAAK,CAAC;QACrB,kBAAa,GAAiC,IAAI,CAAC;QACnD,kBAAa,GAA0B,IAAI,CAAC;QAIlD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAA4B;QACxC,kCAAkC;QAClC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAE7B,iFAAiF;QACjF,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,2BAA2B;QAC3B,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACnC,CAAC;QAED,6BAA6B;QAC7B,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,KAAK,IAAI,EAAE;YACzC,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;gBACtB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAE1B,IAAI,CAAC;gBACH,0CAA0C;gBAC1C,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;oBACvB,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC;oBAC1C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;oBAC1B,MAAM,cAAc,EAAE,CAAC;gBACzB,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;YAC5B,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC;IAED,yCAAyC;IAClC,MAAM;QACX,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACjC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PortalService } from "../../../infrastructure/services/portal-service.js";
|
|
2
|
+
import { TocEndpoint, TocModel } from "../../../types/toc/toc.js";
|
|
3
|
+
import { Result } from "../../../types/common/result.js";
|
|
4
|
+
import { SdlEndpoint } from "../../../types/sdl/sdl.js";
|
|
5
|
+
export declare class SdlParser {
|
|
6
|
+
private readonly portalService;
|
|
7
|
+
private readonly zipArchiver;
|
|
8
|
+
private readonly fileService;
|
|
9
|
+
constructor(portalService: PortalService);
|
|
10
|
+
getTocComponentsFromSdl(specFolderPath: string, configDir: string, commandName: string): Promise<Result<{
|
|
11
|
+
endpointGroups: Map<string, TocEndpoint[]>;
|
|
12
|
+
models: TocModel[];
|
|
13
|
+
}, string>>;
|
|
14
|
+
getEndpointGroupsFromSdl(specFolderPath: string, configDir: string, commandName: string): Promise<Result<Map<string, SdlEndpoint[]>, string>>;
|
|
15
|
+
private generateSdlFromSpec;
|
|
16
|
+
private extractEndpointGroupsForRecipe;
|
|
17
|
+
private extractEndpointGroupsForToc;
|
|
18
|
+
private extractModelsForToc;
|
|
19
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Result } from "../../../types/common/result.js";
|
|
2
|
+
import { DirectoryPath } from "../../../types/file/directoryPath.js";
|
|
3
|
+
import { withDirPath } from "../../../infrastructure/tmp-extensions.js";
|
|
4
|
+
import { FileName } from "../../../types/file/fileName.js";
|
|
5
|
+
import { ZipService } from "../../../infrastructure/zip-service.js";
|
|
6
|
+
import { FilePath } from "../../../types/file/filePath.js";
|
|
7
|
+
import { FileService } from "../../../infrastructure/file-service.js";
|
|
8
|
+
export class SdlParser {
|
|
9
|
+
constructor(portalService) {
|
|
10
|
+
this.portalService = portalService;
|
|
11
|
+
this.zipArchiver = new ZipService();
|
|
12
|
+
this.fileService = new FileService();
|
|
13
|
+
}
|
|
14
|
+
async getTocComponentsFromSdl(specFolderPath, configDir, commandName) {
|
|
15
|
+
const sdlResult = await this.generateSdlFromSpec(specFolderPath, configDir, commandName);
|
|
16
|
+
if (!sdlResult.isSuccess()) {
|
|
17
|
+
return Result.failure("Failed to extract endpoints/models from the specification. Please validate your spec using APIMatic's interactive VS Code Extension and then try again.");
|
|
18
|
+
}
|
|
19
|
+
const sdl = sdlResult.value;
|
|
20
|
+
const endpointGroups = this.extractEndpointGroupsForToc(sdl);
|
|
21
|
+
const models = this.extractModelsForToc(sdl);
|
|
22
|
+
return Result.success({ endpointGroups, models });
|
|
23
|
+
}
|
|
24
|
+
async getEndpointGroupsFromSdl(specFolderPath, configDir, commandName) {
|
|
25
|
+
const sdlResult = await this.generateSdlFromSpec(specFolderPath, configDir, commandName);
|
|
26
|
+
if (!sdlResult.isSuccess()) {
|
|
27
|
+
return Result.failure("Failed to extract endpoints from the API specification. Please validate your spec using APIMatic's interactive VS Code Extension and then try again.");
|
|
28
|
+
}
|
|
29
|
+
const sdl = sdlResult.value;
|
|
30
|
+
const endpointGroups = this.extractEndpointGroupsForRecipe(sdl);
|
|
31
|
+
return Result.success(endpointGroups);
|
|
32
|
+
}
|
|
33
|
+
async generateSdlFromSpec(specFolderPath, configDir, commandName) {
|
|
34
|
+
return await withDirPath(async (tempDirectory) => {
|
|
35
|
+
const specZipPath = new FilePath(tempDirectory, new FileName("spec.zip"));
|
|
36
|
+
await this.zipArchiver.archive(new DirectoryPath(specFolderPath), specZipPath);
|
|
37
|
+
const specFileStream = await this.fileService.getStream(specZipPath);
|
|
38
|
+
let result;
|
|
39
|
+
try {
|
|
40
|
+
result = await this.portalService.generateSdl(specFileStream, configDir, commandName);
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
specFileStream.close();
|
|
44
|
+
}
|
|
45
|
+
if (!result.isSuccess()) {
|
|
46
|
+
return Result.failure("Failed to generate SDL from the API specification. Please validate your spec using APIMatic's interactive VS Code Extension.");
|
|
47
|
+
}
|
|
48
|
+
return Result.success(result.value);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
extractEndpointGroupsForRecipe(sdl) {
|
|
52
|
+
const endpointGroups = new Map();
|
|
53
|
+
for (const endpoint of sdl.Endpoints) {
|
|
54
|
+
if (!endpointGroups.has(endpoint.Group)) {
|
|
55
|
+
endpointGroups.set(endpoint.Group, []);
|
|
56
|
+
}
|
|
57
|
+
endpointGroups.get(endpoint.Group).push({
|
|
58
|
+
Name: endpoint.Name,
|
|
59
|
+
Description: endpoint.Description,
|
|
60
|
+
Group: endpoint.Group
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return endpointGroups;
|
|
64
|
+
}
|
|
65
|
+
extractEndpointGroupsForToc(sdl) {
|
|
66
|
+
const endpointGroups = new Map();
|
|
67
|
+
const endpoints = sdl.Endpoints.map((e) => ({
|
|
68
|
+
generate: null,
|
|
69
|
+
from: "endpoint",
|
|
70
|
+
endpointName: e.Name,
|
|
71
|
+
endpointGroup: e.Group
|
|
72
|
+
}));
|
|
73
|
+
endpoints.forEach((endpoint) => {
|
|
74
|
+
const group = endpoint.endpointGroup;
|
|
75
|
+
if (!endpointGroups.has(group)) {
|
|
76
|
+
endpointGroups.set(group, []);
|
|
77
|
+
}
|
|
78
|
+
endpointGroups.get(group).push(endpoint);
|
|
79
|
+
});
|
|
80
|
+
return endpointGroups;
|
|
81
|
+
}
|
|
82
|
+
extractModelsForToc(sdl) {
|
|
83
|
+
return sdl.CustomTypes.map((e) => ({
|
|
84
|
+
generate: null,
|
|
85
|
+
from: "model",
|
|
86
|
+
modelName: e.Name
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=sdl-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdl-parser.js","sourceRoot":"","sources":["../../../../src/application/portal/toc/sdl-parser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAEtE,MAAM,OAAO,SAAS;IAIpB,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAHxC,gBAAW,GAAe,IAAI,UAAU,EAAE,CAAC;QAC3C,gBAAW,GAAG,IAAI,WAAW,EAAE,CAAC;IAEW,CAAC;IAEtD,KAAK,CAAC,uBAAuB,CAClC,cAAsB,EACtB,SAAiB,EACjB,WAAmB;QAEnB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,cAAc,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;QAEzF,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,CAAC;YAC3B,OAAO,MAAM,CAAC,OAAO,CACnB,yJAAyJ,CAC1J,CAAC;QACJ,CAAC;QAED,MAAM,GAAG,GAAQ,SAAS,CAAC,KAAM,CAAC;QAClC,MAAM,cAAc,GAAG,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;QAE7C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CAAC;gBAC/B,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAChC,CAAC;YACD,cAAc,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,OAAO,cAAc,CAAC;IACxB,CAAC;IAEO,mBAAmB,CAAC,GAAQ;QAClC,OAAO,GAAG,CAAC,WAAW,CAAC,GAAG,CACxB,CAAC,CAAW,EAAY,EAAE,CAAC,CAAC;YAC1B,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,SAAS,EAAE,CAAC,CAAC,IAAI;SAClB,CAAC,CACH,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import * as fs from "fs/promises";
|
|
3
|
+
export class TocContentParser {
|
|
4
|
+
async parseContentFolder(contentFolderPath, workingDirectory) {
|
|
5
|
+
const items = await fs.readdir(contentFolderPath);
|
|
6
|
+
const contentItems = [];
|
|
7
|
+
for (const item of items) {
|
|
8
|
+
const itemPath = path.join(contentFolderPath, item);
|
|
9
|
+
const stats = await fs.stat(itemPath);
|
|
10
|
+
if (stats.isDirectory()) {
|
|
11
|
+
const subItems = await this.parseContentFolder(itemPath, workingDirectory);
|
|
12
|
+
if (subItems.length > 0) {
|
|
13
|
+
contentItems.push({
|
|
14
|
+
group: item,
|
|
15
|
+
items: subItems[0].items // Take items from the Custom Content group
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else if (stats.isFile() && item.endsWith(".md")) {
|
|
20
|
+
const relativePath = path.relative(workingDirectory, itemPath);
|
|
21
|
+
const pageName = path.basename(item, ".md");
|
|
22
|
+
contentItems.push({
|
|
23
|
+
page: pageName,
|
|
24
|
+
file: this.normalizePath(relativePath)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Return empty array if no markdown files were found
|
|
29
|
+
if (contentItems.length === 0) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
// Wrap everything under a "Custom Content" group
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
group: "Custom Content",
|
|
36
|
+
items: contentItems
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
normalizePath(path) {
|
|
41
|
+
return path.replace(/\\/g, "/");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=toc-content-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toc-content-parser.js","sourceRoot":"","sources":["../../../../src/application/portal/toc/toc-content-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAGlC,MAAM,OAAO,gBAAgB;IAC3B,KAAK,CAAC,kBAAkB,CAAC,iBAAyB,EAAE,gBAAwB;QAC1E,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAClD,MAAM,YAAY,GAAiC,EAAE,CAAC;QAEtD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YACpD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAEtC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;gBAC3E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACxB,YAAY,CAAC,IAAI,CAAC;wBAChB,KAAK,EAAE,IAAI;wBACX,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,2CAA2C;qBACrE,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAClD,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;gBAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBAE5C,YAAY,CAAC,IAAI,CAAC;oBAChB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC;iBACvC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,iDAAiD;QACjD,OAAO;YACL;gBACE,KAAK,EAAE,gBAAgB;gBACvB,KAAK,EAAE,YAAY;aACpB;SACF,CAAC;IACJ,CAAC;IAEO,aAAa,CAAC,IAAY;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Toc, TocGroup, TocEndpoint, TocModel } from "../../../types/toc/toc.js";
|
|
2
|
+
export declare class TocStructureGenerator {
|
|
3
|
+
createTocStructure(endpointGroups: Map<string, TocEndpoint[]>, models: TocModel[], expandEndpoints?: boolean, expandModels?: boolean, contentGroups?: TocGroup[]): Toc;
|
|
4
|
+
transformToYaml(toc: Toc): string;
|
|
5
|
+
private transformKeys;
|
|
6
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { stringify } from "yaml";
|
|
2
|
+
export class TocStructureGenerator {
|
|
3
|
+
createTocStructure(endpointGroups, models, expandEndpoints = false, expandModels = false, contentGroups = []) {
|
|
4
|
+
const tocStructure = {
|
|
5
|
+
toc: []
|
|
6
|
+
};
|
|
7
|
+
// Add Getting Started section
|
|
8
|
+
tocStructure.toc.push({
|
|
9
|
+
group: "Getting Started",
|
|
10
|
+
items: [
|
|
11
|
+
{
|
|
12
|
+
generate: "How to Get Started",
|
|
13
|
+
from: "getting-started"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
// Add content groups
|
|
18
|
+
if (contentGroups.length > 0) {
|
|
19
|
+
tocStructure.toc.push(...contentGroups);
|
|
20
|
+
}
|
|
21
|
+
// Add API Endpoints section
|
|
22
|
+
if (!expandEndpoints || endpointGroups.size === 0) {
|
|
23
|
+
tocStructure.toc.push({
|
|
24
|
+
generate: "API Endpoints",
|
|
25
|
+
from: "endpoints"
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
tocStructure.toc.push({
|
|
30
|
+
group: "API Endpoints",
|
|
31
|
+
items: Array.from(endpointGroups).map(([groupName, endpoints]) => ({
|
|
32
|
+
group: groupName,
|
|
33
|
+
items: [
|
|
34
|
+
{
|
|
35
|
+
generate: null,
|
|
36
|
+
from: "endpoint-group-overview",
|
|
37
|
+
endpointGroup: groupName
|
|
38
|
+
},
|
|
39
|
+
...endpoints
|
|
40
|
+
]
|
|
41
|
+
}))
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
// Add Models section
|
|
45
|
+
if (!expandModels || models.length === 0) {
|
|
46
|
+
tocStructure.toc.push({
|
|
47
|
+
generate: "Models",
|
|
48
|
+
from: "models"
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
tocStructure.toc.push({
|
|
53
|
+
group: "Models",
|
|
54
|
+
items: models
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//Add Sdk Infra section
|
|
58
|
+
tocStructure.toc.push({
|
|
59
|
+
generate: "SDK Infrastructure",
|
|
60
|
+
from: "sdk-infra"
|
|
61
|
+
});
|
|
62
|
+
return tocStructure;
|
|
63
|
+
}
|
|
64
|
+
transformToYaml(toc) {
|
|
65
|
+
const transformedToc = this.transformKeys(toc);
|
|
66
|
+
return stringify(transformedToc, {
|
|
67
|
+
indent: 2,
|
|
68
|
+
nullStr: ""
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
transformKeys(obj) {
|
|
72
|
+
if (Array.isArray(obj)) {
|
|
73
|
+
return obj.map((item) => this.transformKeys(item));
|
|
74
|
+
}
|
|
75
|
+
if (obj !== null && typeof obj === "object") {
|
|
76
|
+
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [
|
|
77
|
+
key.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(),
|
|
78
|
+
this.transformKeys(value)
|
|
79
|
+
]));
|
|
80
|
+
}
|
|
81
|
+
return obj;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=toc-structure-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toc-structure-generator.js","sourceRoot":"","sources":["../../../../src/application/portal/toc/toc-structure-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAGjC,MAAM,OAAO,qBAAqB;IAChC,kBAAkB,CAChB,cAA0C,EAC1C,MAAkB,EAClB,kBAA2B,KAAK,EAChC,eAAwB,KAAK,EAC7B,gBAA4B,EAAE;QAE9B,MAAM,YAAY,GAAQ;YACxB,GAAG,EAAE,EAAE;SACR,CAAC;QAEF,8BAA8B;QAC9B,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;YACpB,KAAK,EAAE,iBAAiB;YACxB,KAAK,EAAE;gBACL;oBACE,QAAQ,EAAE,oBAAoB;oBAC9B,IAAI,EAAE,iBAAiB;iBACxB;aACF;SACF,CAAC,CAAC;QAEH,qBAAqB;QACrB,IAAI,aAAa,CAAC,MAA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,CAAC;IAED,eAAe,CAAC,GAAQ;QACtB,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC/C,OAAO,SAAS,CAAC,cAAc,EAAE;YAC/B,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,EAAE;SACZ,CAAC,CAAC;IACL,CAAC;IAEO,aAAa,CAAC,GAAQ;QAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC5C,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;gBACxC,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE;gBACxD,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;aAC1B,CAAC,CACH,CAAC;QACJ,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { DirectoryPath } from "../types/file/directoryPath.js";
|
|
2
|
+
export type AuthInfo = {
|
|
2
3
|
email: string;
|
|
3
4
|
authKey: string;
|
|
5
|
+
APIMATIC_CLI_TELEMETRY_OPTOUT?: string;
|
|
4
6
|
};
|
|
5
7
|
/**
|
|
6
8
|
*
|
|
@@ -10,8 +12,11 @@ export declare type AuthInfo = {
|
|
|
10
12
|
export declare function getAuthInfo(configDir: string): Promise<AuthInfo | null>;
|
|
11
13
|
/**
|
|
12
14
|
*
|
|
13
|
-
* @param {
|
|
15
|
+
* @param {string} email
|
|
16
|
+
* @param {string} authKey
|
|
17
|
+
* @param {string} isTelemetryOptedOut
|
|
14
18
|
* @param {string} configDir <- Directory with user configuration
|
|
15
19
|
* //Function to set credentials.
|
|
16
20
|
*/
|
|
17
|
-
export declare function setAuthInfo(
|
|
21
|
+
export declare function setAuthInfo(email: string, authKey: string, isTelemetryOptedOut: boolean, configDir: DirectoryPath): Promise<void>;
|
|
22
|
+
export declare function removeAuthInfo(configDir: string): Promise<void>;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.setAuthInfo = exports.getAuthInfo = void 0;
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const fs = require("fs-extra");
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import fs from "fs-extra";
|
|
6
3
|
/**
|
|
7
4
|
*
|
|
8
5
|
* @param {string} configDir <- Directory with user configuration
|
|
9
6
|
* //Function to get credentials
|
|
10
7
|
*/
|
|
11
|
-
async function getAuthInfo(configDir) {
|
|
8
|
+
export async function getAuthInfo(configDir) {
|
|
12
9
|
try {
|
|
13
10
|
const data = JSON.parse(await fs.readFile(path.join(configDir, "config.json"), "utf8"));
|
|
14
11
|
return data;
|
|
@@ -17,17 +14,33 @@ async function getAuthInfo(configDir) {
|
|
|
17
14
|
return null;
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
|
-
exports.getAuthInfo = getAuthInfo;
|
|
21
17
|
/**
|
|
22
18
|
*
|
|
23
|
-
* @param {
|
|
19
|
+
* @param {string} email
|
|
20
|
+
* @param {string} authKey
|
|
21
|
+
* @param {string} isTelemetryOptedOut
|
|
24
22
|
* @param {string} configDir <- Directory with user configuration
|
|
25
23
|
* //Function to set credentials.
|
|
26
24
|
*/
|
|
27
|
-
async function setAuthInfo(
|
|
25
|
+
export async function setAuthInfo(email, authKey, isTelemetryOptedOut, configDir) {
|
|
26
|
+
const credentials = {
|
|
27
|
+
email,
|
|
28
|
+
authKey,
|
|
29
|
+
APIMATIC_CLI_TELEMETRY_OPTOUT: isTelemetryOptedOut ? "1" : "0"
|
|
30
|
+
};
|
|
31
|
+
const configFilePath = path.join(configDir.toString(), "config.json");
|
|
32
|
+
if (!fs.existsSync(configFilePath))
|
|
33
|
+
fs.createFileSync(configFilePath);
|
|
34
|
+
return await fs.writeFile(configFilePath, JSON.stringify(credentials));
|
|
35
|
+
}
|
|
36
|
+
export async function removeAuthInfo(configDir) {
|
|
37
|
+
const credentials = {
|
|
38
|
+
email: "",
|
|
39
|
+
authKey: ""
|
|
40
|
+
};
|
|
28
41
|
const configFilePath = path.join(configDir, "config.json");
|
|
29
42
|
if (!fs.existsSync(configFilePath))
|
|
30
43
|
fs.createFileSync(configFilePath);
|
|
31
44
|
return await fs.writeFile(configFilePath, JSON.stringify(credentials));
|
|
32
45
|
}
|
|
33
|
-
|
|
46
|
+
//# sourceMappingURL=auth-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-manager.js","sourceRoot":"","sources":["../../src/client-utils/auth-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,MAAM,UAAU,CAAC;AAQ1B;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,SAAiB;IACjD,IAAI,CAAC;QACH,MAAM,IAAI,GAAoB,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QACzG,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAa,EACb,OAAe,EACf,mBAA4B,EAC5B,SAAwB;IAExB,MAAM,WAAW,GAAa;QAC5B,KAAK;QACL,OAAO;QACP,6BAA6B,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;KAC/D,CAAC;IACF,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,aAAa,CAAC,CAAC;IAEtE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC;QAAE,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IAEtE,OAAO,MAAM,EAAE,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,SAAiB;IACpD,MAAM,WAAW,GAAa;QAC5B,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,EAAE;KACZ,CAAC;IACF,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IAE3D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC;QAAE,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IAEtE,OAAO,MAAM,EAAE,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Client } from "@apimatic/sdk";
|
|
2
|
+
/**
|
|
3
|
+
* The Singleton class defines the `getInstance` method that lets clients access
|
|
4
|
+
* the unique singleton instance.
|
|
5
|
+
*/
|
|
2
6
|
export declare class SDKClient {
|
|
3
7
|
static client: Client;
|
|
4
8
|
private static instance;
|
|
5
|
-
private static authAPI;
|
|
6
9
|
/**
|
|
7
10
|
* The static method that controls the access to the SDKClient instance.
|
|
8
11
|
*
|
|
@@ -10,14 +13,6 @@ export declare class SDKClient {
|
|
|
10
13
|
* just one instance of each subclass around.
|
|
11
14
|
*/
|
|
12
15
|
static getInstance(): SDKClient;
|
|
13
|
-
/**
|
|
14
|
-
* Finally, any SDKClient should define some business logic, which can be
|
|
15
|
-
* executed on its instance.
|
|
16
|
-
*/
|
|
17
|
-
login(email: string, password: string, configDir: string): Promise<string>;
|
|
18
16
|
logout(configDir: string): Promise<string>;
|
|
19
17
|
status(configDir: string): Promise<string>;
|
|
20
|
-
getClient(overrideAuthKey: string | null, configDir: string): Promise<Client>;
|
|
21
|
-
private getAuthKey;
|
|
22
|
-
setAuthKey: (authKey: string, configDir: string) => string;
|
|
23
18
|
}
|