@apimatic/cli 1.1.0-alpha.1 → 1.1.0-alpha.10

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.
Files changed (156) hide show
  1. package/README.md +221 -73
  2. package/bin/run.js +5 -0
  3. package/lib/actions/portal/generate.d.ts +7 -0
  4. package/lib/actions/portal/generate.js +54 -0
  5. package/lib/actions/portal/generate.js.map +1 -0
  6. package/lib/actions/portal/recipe/new-recipe.d.ts +24 -0
  7. package/lib/actions/portal/recipe/new-recipe.js +258 -0
  8. package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
  9. package/lib/actions/portal/toc/new-toc.d.ts +17 -0
  10. package/lib/actions/portal/toc/new-toc.js +130 -0
  11. package/lib/actions/portal/toc/new-toc.js.map +1 -0
  12. package/lib/application/portal/recipe/portal-recipe.d.ts +8 -0
  13. package/lib/application/portal/recipe/portal-recipe.js +33 -0
  14. package/lib/application/portal/recipe/portal-recipe.js.map +1 -0
  15. package/lib/application/portal/recipe/recipe-generator.d.ts +16 -0
  16. package/lib/application/portal/recipe/recipe-generator.js +147 -0
  17. package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
  18. package/lib/application/portal/toc/sdl-parser.d.ts +16 -0
  19. package/lib/application/portal/toc/sdl-parser.js +74 -0
  20. package/lib/application/portal/toc/sdl-parser.js.map +1 -0
  21. package/lib/application/portal/toc/toc-content-parser.d.ts +5 -0
  22. package/lib/application/portal/toc/toc-content-parser.js +44 -0
  23. package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
  24. package/lib/application/portal/toc/toc-structure-generator.d.ts +6 -0
  25. package/lib/application/portal/toc/toc-structure-generator.js +84 -0
  26. package/lib/application/portal/toc/toc-structure-generator.js.map +1 -0
  27. package/lib/client-utils/auth-manager.d.ts +1 -1
  28. package/lib/client-utils/auth-manager.js +9 -13
  29. package/lib/client-utils/auth-manager.js.map +1 -0
  30. package/lib/client-utils/sdk-client.js +24 -23
  31. package/lib/client-utils/sdk-client.js.map +1 -0
  32. package/lib/commands/api/transform.d.ts +7 -7
  33. package/lib/commands/api/transform.js +39 -38
  34. package/lib/commands/api/transform.js.map +1 -0
  35. package/lib/commands/api/validate.d.ts +4 -4
  36. package/lib/commands/api/validate.js +24 -23
  37. package/lib/commands/api/validate.js.map +1 -0
  38. package/lib/commands/auth/login.d.ts +2 -2
  39. package/lib/commands/auth/login.js +33 -18
  40. package/lib/commands/auth/login.js.map +1 -0
  41. package/lib/commands/auth/logout.d.ts +1 -1
  42. package/lib/commands/auth/logout.js +6 -7
  43. package/lib/commands/auth/logout.js.map +1 -0
  44. package/lib/commands/auth/status.d.ts +1 -1
  45. package/lib/commands/auth/status.js +6 -7
  46. package/lib/commands/auth/status.js.map +1 -0
  47. package/lib/commands/portal/generate.d.ts +12 -7
  48. package/lib/commands/portal/generate.js +73 -87
  49. package/lib/commands/portal/generate.js.map +1 -0
  50. package/lib/commands/portal/quickstart.d.ts +10 -0
  51. package/lib/commands/portal/quickstart.js +77 -0
  52. package/lib/commands/portal/quickstart.js.map +1 -0
  53. package/lib/commands/portal/recipe/new.d.ts +12 -0
  54. package/lib/commands/portal/recipe/new.js +44 -0
  55. package/lib/commands/portal/recipe/new.js.map +1 -0
  56. package/lib/commands/portal/serve.d.ts +16 -0
  57. package/lib/commands/portal/serve.js +135 -0
  58. package/lib/commands/portal/serve.js.map +1 -0
  59. package/lib/commands/portal/toc/new.d.ts +15 -0
  60. package/lib/commands/portal/toc/new.js +63 -0
  61. package/lib/commands/portal/toc/new.js.map +1 -0
  62. package/lib/commands/sdk/generate.d.ts +8 -8
  63. package/lib/commands/sdk/generate.js +40 -41
  64. package/lib/commands/sdk/generate.js.map +1 -0
  65. package/lib/config/axios-config.d.ts +2 -0
  66. package/lib/config/axios-config.js +10 -0
  67. package/lib/config/axios-config.js.map +1 -0
  68. package/lib/config/env.d.ts +27 -1
  69. package/lib/config/env.js +28 -4
  70. package/lib/config/env.js.map +1 -0
  71. package/lib/controllers/api/transform.d.ts +1 -1
  72. package/lib/controllers/api/transform.js +23 -22
  73. package/lib/controllers/api/transform.js.map +1 -0
  74. package/lib/controllers/api/validate.d.ts +3 -3
  75. package/lib/controllers/api/validate.js +19 -12
  76. package/lib/controllers/api/validate.js.map +1 -0
  77. package/lib/controllers/portal/generate.d.ts +3 -2
  78. package/lib/controllers/portal/generate.js +105 -48
  79. package/lib/controllers/portal/generate.js.map +1 -0
  80. package/lib/controllers/portal/quickstart.d.ts +14 -0
  81. package/lib/controllers/portal/quickstart.js +253 -0
  82. package/lib/controllers/portal/quickstart.js.map +1 -0
  83. package/lib/controllers/portal/serve.d.ts +3 -0
  84. package/lib/controllers/portal/serve.js +133 -0
  85. package/lib/controllers/portal/serve.js.map +1 -0
  86. package/lib/controllers/sdk/generate.d.ts +4 -4
  87. package/lib/controllers/sdk/generate.js +23 -26
  88. package/lib/controllers/sdk/generate.js.map +1 -0
  89. package/lib/index.d.ts +1 -1
  90. package/lib/index.js +2 -4
  91. package/lib/index.js.map +1 -0
  92. package/lib/infrastructure/services/portal-service.d.ts +16 -0
  93. package/lib/infrastructure/services/portal-service.js +129 -0
  94. package/lib/infrastructure/services/portal-service.js.map +1 -0
  95. package/lib/prompts/portal/generate.d.ts +10 -0
  96. package/lib/prompts/portal/generate.js +57 -0
  97. package/lib/prompts/portal/generate.js.map +1 -0
  98. package/lib/prompts/portal/quickstart.d.ts +31 -0
  99. package/lib/prompts/portal/quickstart.js +212 -0
  100. package/lib/prompts/portal/quickstart.js.map +1 -0
  101. package/lib/prompts/portal/recipe/new-recipe.d.ts +23 -0
  102. package/lib/prompts/portal/recipe/new-recipe.js +193 -0
  103. package/lib/prompts/portal/recipe/new-recipe.js.map +1 -0
  104. package/lib/prompts/portal/serve.d.ts +7 -0
  105. package/lib/prompts/portal/serve.js +21 -0
  106. package/lib/prompts/portal/serve.js.map +1 -0
  107. package/lib/prompts/portal/toc/new-toc.d.ts +10 -0
  108. package/lib/prompts/portal/toc/new-toc.js +42 -0
  109. package/lib/prompts/portal/toc/new-toc.js.map +1 -0
  110. package/lib/services/portal/server.d.ts +14 -0
  111. package/lib/services/portal/server.js +97 -0
  112. package/lib/services/portal/server.js.map +1 -0
  113. package/lib/types/api/transform.d.ts +19 -4
  114. package/lib/types/api/transform.js +19 -4
  115. package/lib/types/api/transform.js.map +1 -0
  116. package/lib/types/api/validate.d.ts +3 -3
  117. package/lib/types/api/validate.js +2 -2
  118. package/lib/types/api/validate.js.map +1 -0
  119. package/lib/types/common/result.d.ts +17 -0
  120. package/lib/types/common/result.js +32 -0
  121. package/lib/types/common/result.js.map +1 -0
  122. package/lib/types/portal/generate.d.ts +26 -9
  123. package/lib/types/portal/generate.js +3 -2
  124. package/lib/types/portal/generate.js.map +1 -0
  125. package/lib/types/portal/quickstart.d.ts +17 -0
  126. package/lib/types/portal/quickstart.js +2 -0
  127. package/lib/types/portal/quickstart.js.map +1 -0
  128. package/lib/types/recipe/recipe.d.ts +37 -0
  129. package/lib/types/recipe/recipe.js +6 -0
  130. package/lib/types/recipe/recipe.js.map +1 -0
  131. package/lib/types/sdk/generate.d.ts +6 -5
  132. package/lib/types/sdk/generate.js +5 -6
  133. package/lib/types/sdk/generate.js.map +1 -0
  134. package/lib/types/sdl/sdl.d.ts +12 -0
  135. package/lib/types/sdl/sdl.js +2 -0
  136. package/lib/types/sdl/sdl.js.map +1 -0
  137. package/lib/types/toc/toc.d.ts +31 -0
  138. package/lib/types/toc/toc.js +9 -0
  139. package/lib/types/toc/toc.js.map +1 -0
  140. package/lib/types/utils.d.ts +3 -3
  141. package/lib/types/utils.js +2 -2
  142. package/lib/types/utils.js.map +1 -0
  143. package/lib/utils/utils.d.ts +31 -5
  144. package/lib/utils/utils.js +316 -74
  145. package/lib/utils/utils.js.map +1 -0
  146. package/lib/validators/common/directoryValidator.d.ts +9 -0
  147. package/lib/validators/common/directoryValidator.js +49 -0
  148. package/lib/validators/common/directoryValidator.js.map +1 -0
  149. package/lib/validators/common/portValidator.d.ts +5 -0
  150. package/lib/validators/common/portValidator.js +16 -0
  151. package/lib/validators/common/portValidator.js.map +1 -0
  152. package/lib/validators/portal/serveValidator.d.ts +6 -0
  153. package/lib/validators/portal/serveValidator.js +17 -0
  154. package/lib/validators/portal/serveValidator.js.map +1 -0
  155. package/package.json +86 -38
  156. package/bin/run +0 -5
@@ -0,0 +1,97 @@
1
+ import express from "express";
2
+ import livereload from "livereload";
3
+ import connectLivereload from "connect-livereload";
4
+ import open from "open";
5
+ import { watchAndRegeneratePortal } from "../../controllers/portal/serve.js";
6
+ import { getMessageInRedColor, isPortInUse } from "../../utils/utils.js";
7
+ export class PortalServerService {
8
+ constructor() {
9
+ this.port = 3000;
10
+ this.liveReloadPort = 35729;
11
+ this.app = express();
12
+ }
13
+ async findAvailablePort(startPort) {
14
+ let port = startPort;
15
+ const maxPort = startPort + 10; // Limit the port search range
16
+ while (port < maxPort) {
17
+ if (!(await isPortInUse(port))) {
18
+ return port;
19
+ }
20
+ port++;
21
+ }
22
+ // If no port is found in the range, return the original port
23
+ return startPort;
24
+ }
25
+ async createLiveReloadServer(generatedPortalPath) {
26
+ try {
27
+ const availablePort = await this.findAvailablePort(this.liveReloadPort);
28
+ this.liveReloadServer = livereload.createServer({
29
+ port: availablePort
30
+ });
31
+ this.liveReloadServer.watch(generatedPortalPath);
32
+ }
33
+ catch (error) {
34
+ console.log(getMessageInRedColor(`Unable to serve the portal: ${error.message}`));
35
+ }
36
+ }
37
+ async setupServer(generatedPortalPath) {
38
+ await this.createLiveReloadServer(generatedPortalPath);
39
+ if (this.liveReloadServer) {
40
+ this.app.use(connectLivereload());
41
+ }
42
+ this.app.use(express.static(generatedPortalPath));
43
+ }
44
+ async startServer(config, noReload = false, displayShutdownMessages = true) {
45
+ const { generatedPortalPath, targetFolder, configDir, authKey, ignoredPaths, port, openInBrowser } = config;
46
+ const requestedPort = port !== null && port !== void 0 ? port : this.port;
47
+ return new Promise((resolve, reject) => {
48
+ this.server = this.app.listen(requestedPort, () => {
49
+ if (openInBrowser) {
50
+ open(`http://localhost:${requestedPort}`);
51
+ }
52
+ if (!noReload) {
53
+ watchAndRegeneratePortal(targetFolder, generatedPortalPath, configDir, authKey, ignoredPaths);
54
+ }
55
+ if (process.platform !== "darwin") {
56
+ //For non-macOS users.
57
+ if (process.stdin.setRawMode) {
58
+ process.stdin.setRawMode(false);
59
+ }
60
+ }
61
+ resolve(true);
62
+ }).on('error', (err) => {
63
+ if (err.code === 'EADDRINUSE') {
64
+ console.error(getMessageInRedColor(`Port ${requestedPort} is not available. Unable to serve your portal.`));
65
+ }
66
+ else {
67
+ console.error(getMessageInRedColor(`Unable to serve the portal: ${err.message}`));
68
+ }
69
+ reject(err);
70
+ });
71
+ const shutdown = async () => {
72
+ if (displayShutdownMessages) {
73
+ console.log("Shutting down server...");
74
+ }
75
+ await this.stopServer();
76
+ if (displayShutdownMessages) {
77
+ console.log("Server shut down successfully.");
78
+ }
79
+ resolve(true);
80
+ process.exit(0);
81
+ };
82
+ process.on("SIGINT", shutdown);
83
+ process.on("SIGTERM", shutdown);
84
+ });
85
+ }
86
+ async stopServer() {
87
+ if (this.liveReloadServer) {
88
+ this.liveReloadServer.close();
89
+ }
90
+ if (this.server) {
91
+ await new Promise((resolve) => {
92
+ this.server.close(() => resolve());
93
+ });
94
+ }
95
+ }
96
+ }
97
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/services/portal/server.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,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAG7E,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEzE,MAAM,OAAO,mBAAmB;IAO9B;QA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C9G,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,+BAA+B,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;gBACpF,CAAC;gBACD,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;gBAC1B,IAAI,uBAAuB,EAAE,CAAC;oBAC5B,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;gBACzC,CAAC;gBACD,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;gBACxB,IAAI,uBAAuB,EAAE,CAAC;oBAC5B,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;gBAChD,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,CAAC;gBACd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC;YAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAAU;QACd,IAAI,IAAI,CAAC,gBAAgB,EAAE,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;CACF"}
@@ -1,16 +1,15 @@
1
- /// <reference types="node" />
2
1
  import { TransformationController } from "@apimatic/sdk";
3
- export declare type TransformationIdParams = {
2
+ export type TransformationIdParams = {
4
3
  file: string;
5
4
  url: string;
6
5
  format: string;
7
6
  };
8
- export declare type DownloadTransformationParams = {
7
+ export type DownloadTransformationParams = {
9
8
  id: string;
10
9
  destinationFilePath: string;
11
10
  transformationController: TransformationController;
12
11
  };
13
- export declare type TransformationData = {
12
+ export type TransformationData = {
14
13
  result: NodeJS.ReadableStream | Blob;
15
14
  };
16
15
  export declare const DestinationFormats: {
@@ -28,3 +27,19 @@ export declare const DestinationFormats: {
28
27
  Postman20: string;
29
28
  GraphQlSchema: string;
30
29
  };
30
+ export declare enum TransformationFormats {
31
+ APIMATIC = "Apimatic",
32
+ WADL2009 = "Wadl2009",
33
+ WSDL = "Wsdl",
34
+ SWAGGER10 = "Swagger10",
35
+ SWAGGER20 = "Swagger20",
36
+ SWAGGERYAML = "Swaggeryaml",
37
+ OAS3 = "Oas3",
38
+ OPENAPI3YAML = "Openapi3Yaml",
39
+ APIBLUEPRINT = "Apiblueprint",
40
+ RAML = "Raml",
41
+ RAML10 = "Raml10",
42
+ POSTMAN10 = "Postman10",
43
+ POSTMAN20 = "Postman20",
44
+ GRAPHQLSCHEMA = "Graphqlschema"
45
+ }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DestinationFormats = void 0;
4
- exports.DestinationFormats = {
1
+ export const DestinationFormats = {
5
2
  OpenApi3Json: "json",
6
3
  OpenApi3Yaml: "yaml",
7
4
  APIMATIC: "json",
@@ -16,3 +13,21 @@ exports.DestinationFormats = {
16
13
  Postman20: "json",
17
14
  GraphQlSchema: "json"
18
15
  };
16
+ export var TransformationFormats;
17
+ (function (TransformationFormats) {
18
+ TransformationFormats["APIMATIC"] = "Apimatic";
19
+ TransformationFormats["WADL2009"] = "Wadl2009";
20
+ TransformationFormats["WSDL"] = "Wsdl";
21
+ TransformationFormats["SWAGGER10"] = "Swagger10";
22
+ TransformationFormats["SWAGGER20"] = "Swagger20";
23
+ TransformationFormats["SWAGGERYAML"] = "Swaggeryaml";
24
+ TransformationFormats["OAS3"] = "Oas3";
25
+ TransformationFormats["OPENAPI3YAML"] = "Openapi3Yaml";
26
+ TransformationFormats["APIBLUEPRINT"] = "Apiblueprint";
27
+ TransformationFormats["RAML"] = "Raml";
28
+ TransformationFormats["RAML10"] = "Raml10";
29
+ TransformationFormats["POSTMAN10"] = "Postman10";
30
+ TransformationFormats["POSTMAN20"] = "Postman20";
31
+ TransformationFormats["GRAPHQLSCHEMA"] = "Graphqlschema";
32
+ })(TransformationFormats || (TransformationFormats = {}));
33
+ //# sourceMappingURL=transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/types/api/transform.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,YAAY,EAAE,MAAM;IACpB,YAAY,EAAE,MAAM;IACpB,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,KAAK;IACX,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,MAAM;CACtB,CAAC;AAEF,MAAM,CAAN,IAAY,qBAeX;AAfD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;IACrB,sCAAa,CAAA;IACb,gDAAuB,CAAA;IACvB,gDAAuB,CAAA;IACvB,oDAA2B,CAAA;IAC3B,sCAAa,CAAA;IACb,sDAA6B,CAAA;IAC7B,sDAA6B,CAAA;IAC7B,sCAAa,CAAA;IACb,0CAAiB,CAAA;IACjB,gDAAuB,CAAA;IACvB,gDAAuB,CAAA;IACvB,wDAA+B,CAAA;AACjC,CAAC,EAfW,qBAAqB,KAArB,qBAAqB,QAehC"}
@@ -1,12 +1,12 @@
1
- export declare type GetValidationParams = {
1
+ export type GetValidationParams = {
2
2
  file: string;
3
3
  url: string;
4
4
  };
5
- export declare type APIValidateError = {
5
+ export type APIValidateError = {
6
6
  modelState: {
7
7
  "exception Error": string[];
8
8
  };
9
9
  };
10
- export declare type AuthorizationError = {
10
+ export type AuthorizationError = {
11
11
  body: string;
12
12
  };
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
2
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/types/api/validate.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ export declare class Result<T, TError> {
2
+ private readonly Status;
3
+ readonly value?: T | undefined;
4
+ readonly error?: TError | undefined;
5
+ private constructor();
6
+ static success<T, TError>(value: T): Result<T, TError>;
7
+ static failure<T, TError>(error: TError): Result<T, TError>;
8
+ static cancelled<T, TError>(value: T): Result<T, TError>;
9
+ isFailed(): boolean;
10
+ isCancelled(): boolean;
11
+ isSuccess(): boolean;
12
+ }
13
+ export declare enum ResultStatus {
14
+ Success = 0,
15
+ Failed = 1,
16
+ Cancelled = 2
17
+ }
@@ -0,0 +1,32 @@
1
+ export class Result {
2
+ constructor(Status, value, error) {
3
+ this.Status = Status;
4
+ this.value = value;
5
+ this.error = error;
6
+ }
7
+ static success(value) {
8
+ return new Result(ResultStatus.Success, value, undefined);
9
+ }
10
+ static failure(error) {
11
+ return new Result(ResultStatus.Failed, undefined, error);
12
+ }
13
+ static cancelled(value) {
14
+ return new Result(ResultStatus.Cancelled, value, undefined);
15
+ }
16
+ isFailed() {
17
+ return this.Status == ResultStatus.Failed;
18
+ }
19
+ isCancelled() {
20
+ return this.Status == ResultStatus.Cancelled;
21
+ }
22
+ isSuccess() {
23
+ return this.Status == ResultStatus.Success;
24
+ }
25
+ }
26
+ export var ResultStatus;
27
+ (function (ResultStatus) {
28
+ ResultStatus[ResultStatus["Success"] = 0] = "Success";
29
+ ResultStatus[ResultStatus["Failed"] = 1] = "Failed";
30
+ ResultStatus[ResultStatus["Cancelled"] = 2] = "Cancelled";
31
+ })(ResultStatus || (ResultStatus = {}));
32
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/types/common/result.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,MAAM;IACjB,YACmB,MAAoB,EACrB,KAAS,EACT,KAAc;QAFb,WAAM,GAAN,MAAM,CAAc;QACrB,UAAK,GAAL,KAAK,CAAI;QACT,UAAK,GAAL,KAAK,CAAS;IAC7B,CAAC;IAEG,MAAM,CAAC,OAAO,CAAY,KAAQ;QACvC,OAAO,IAAI,MAAM,CAAY,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACvE,CAAC;IAEM,MAAM,CAAC,OAAO,CAAY,KAAa;QAC5C,OAAO,IAAI,MAAM,CAAY,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAEM,MAAM,CAAC,SAAS,CAAY,KAAQ;QACzC,OAAO,IAAI,MAAM,CAAY,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACzE,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC;IAC5C,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,SAAS,CAAC;IAC/C,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,OAAO,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,yDAAS,CAAA;AACX,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB"}
@@ -1,9 +1,26 @@
1
- import { DocsPortalManagementController } from "@apimatic/sdk";
2
- export declare type GeneratePortalParams = {
3
- zippedBuildFilePath: string;
4
- portalFolderPath: string;
5
- zippedPortalPath: string;
6
- docsPortalController: DocsPortalManagementController;
7
- overrideAuthKey: string | null;
8
- zip: boolean;
9
- };
1
+ export interface GeneratePortalParams {
2
+ readonly sourceBuildInputZipFilePath: string;
3
+ readonly generatedPortalArtifactsFolderPath: string;
4
+ readonly generatedPortalArtifactsZipFilePath: string;
5
+ readonly overrideAuthKey: string | null;
6
+ readonly generateZipFile: boolean;
7
+ }
8
+ export interface PortalPaths {
9
+ readonly sourceFolderPath: string;
10
+ readonly destinationFolderPath: string;
11
+ readonly generatedPortalArtifactsFolderPath: string;
12
+ readonly generatedPortalArtifactsZipFilePath: string;
13
+ }
14
+ export interface ErrorResponse {
15
+ readonly title: string;
16
+ readonly detail?: string;
17
+ readonly errors: Record<string, string[]>;
18
+ readonly message?: string;
19
+ }
20
+ export interface GenerateFlags {
21
+ readonly folder: string;
22
+ readonly destination: string;
23
+ readonly force: boolean;
24
+ readonly zip: boolean;
25
+ readonly "auth-key": string;
26
+ }
@@ -1,2 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ ;
2
+ export {};
3
+ //# sourceMappingURL=generate.js.map
@@ -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
+ filePath: string;
7
+ url: string;
8
+ };
9
+ export type PortalServerConfig = {
10
+ generatedPortalPath: string;
11
+ targetFolder: string;
12
+ configDir: string;
13
+ authKey: string | null;
14
+ ignoredPaths?: string[];
15
+ port?: number;
16
+ openInBrowser?: boolean;
17
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=quickstart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/types/portal/quickstart.ts"],"names":[],"mappings":""}
@@ -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,6 @@
1
+ export var StepType;
2
+ (function (StepType) {
3
+ StepType["Content"] = "content";
4
+ StepType["Endpoint"] = "endpoint";
5
+ })(StepType || (StepType = {}));
6
+ //# sourceMappingURL=recipe.js.map
@@ -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 declare type GenerationIdParams = {
1
+ export type GenerationIdParams = {
2
2
  file: string;
3
3
  url: string;
4
4
  platform: string;
5
5
  };
6
- export declare type DownloadSDKParams = {
6
+ export type DownloadSDKParams = {
7
7
  codeGenId: string;
8
8
  zip: boolean;
9
9
  zippedSDKPath: string;
10
10
  sdkFolderPath: string;
11
11
  };
12
- export declare type SDKGenerateUnprocessableError = {
12
+ export type SDKGenerateUnprocessableError = {
13
13
  message: string;
14
14
  };
15
15
  export declare enum SimplePlatforms {
16
16
  CSHARP = "CS_NET_STANDARD_LIB",
17
17
  JAVA = "JAVA_ECLIPSE_JRE_LIB",
18
- PHP = "PHP_GENERIC_LIB",
18
+ PHP = "PHP_GENERIC_LIB_V2",
19
19
  PYTHON = "PYTHON_GENERIC_LIB",
20
20
  RUBY = "RUBY_GENERIC_LIB",
21
- TYPESCRIPT = "TS_GENERIC_LIB"
21
+ TYPESCRIPT = "TS_GENERIC_LIB",
22
+ GO = "GO_GENERIC_LIB"
22
23
  }
@@ -1,12 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SimplePlatforms = void 0;
4
- var SimplePlatforms;
1
+ export var SimplePlatforms;
5
2
  (function (SimplePlatforms) {
6
3
  SimplePlatforms["CSHARP"] = "CS_NET_STANDARD_LIB";
7
4
  SimplePlatforms["JAVA"] = "JAVA_ECLIPSE_JRE_LIB";
8
- SimplePlatforms["PHP"] = "PHP_GENERIC_LIB";
5
+ SimplePlatforms["PHP"] = "PHP_GENERIC_LIB_V2";
9
6
  SimplePlatforms["PYTHON"] = "PYTHON_GENERIC_LIB";
10
7
  SimplePlatforms["RUBY"] = "RUBY_GENERIC_LIB";
11
8
  SimplePlatforms["TYPESCRIPT"] = "TS_GENERIC_LIB";
12
- })(SimplePlatforms = exports.SimplePlatforms || (exports.SimplePlatforms = {}));
9
+ SimplePlatforms["GO"] = "GO_GENERIC_LIB";
10
+ })(SimplePlatforms || (SimplePlatforms = {}));
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,eAQX;AARD,WAAY,eAAe;IACzB,iDAA8B,CAAA;IAC9B,gDAA6B,CAAA;IAC7B,6CAA0B,CAAA;IAC1B,gDAA6B,CAAA;IAC7B,4CAAyB,CAAA;IACzB,gDAA6B,CAAA;IAC7B,wCAAqB,CAAA;AACvB,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B"}
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sdl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdl.js","sourceRoot":"","sources":["../../../src/types/sdl/sdl.ts"],"names":[],"mappings":""}
@@ -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,9 @@
1
+ ;
2
+ ;
3
+ ;
4
+ ;
5
+ ;
6
+ ;
7
+ ;
8
+ export {};
9
+ //# sourceMappingURL=toc.js.map
@@ -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"}
@@ -1,14 +1,14 @@
1
- export declare type ValidationMessages = {
1
+ export type ValidationMessages = {
2
2
  messages: string[];
3
3
  warnings: string[];
4
4
  errors: string[];
5
5
  };
6
- export declare type loggers = {
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 declare type AuthenticationError = {
11
+ export type AuthenticationError = {
12
12
  statusCode: number;
13
13
  body: string;
14
14
  };
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
2
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/types/utils.ts"],"names":[],"mappings":""}
@@ -1,9 +1,17 @@
1
- /// <reference types="node" />
2
- /// <reference types="mocha" />
3
- import { loggers, ValidationMessages } from "../types/utils";
1
+ import { loggers, ValidationMessages } from "../types/utils.js";
2
+ import { ApiValidationSummary } from "@apimatic/sdk";
4
3
  export declare const unzipFile: (stream: NodeJS.ReadableStream, destination: string) => Promise<unknown>;
4
+ export declare const createTempDirectory: () => Promise<string>;
5
+ export declare const clearDirectory: (folderPath: string) => Promise<void>;
6
+ export declare const validationMessagesToJson: (validationMessages: ApiValidationSummary) => object;
7
+ interface DirectoryNode {
8
+ [key: string]: DirectoryNode | string | null | undefined;
9
+ }
10
+ export declare const directoryToJson: (dirPath: string, parentPath?: string) => DirectoryNode;
11
+ export declare const isValidUrl: (input: string) => boolean;
5
12
  export declare const deleteFile: (filePath: string) => Promise<void>;
6
13
  export declare const writeFileUsingReadableStream: (stream: NodeJS.ReadableStream, destinationPath: string) => Promise<unknown>;
14
+ export declare const zipDirectoryToStream: (sourcePath: string) => Promise<NodeJS.ReadableStream>;
7
15
  /**
8
16
  * Packages local files into a ZIP archive
9
17
  *
@@ -12,9 +20,27 @@ export declare const writeFileUsingReadableStream: (stream: NodeJS.ReadableStrea
12
20
  * return {string}
13
21
  */
14
22
  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
23
  export declare const replaceHTML: (string: string) => string;
18
24
  export declare const isJSONParsable: (json: string) => boolean;
25
+ export declare const getGeneratedFilesPaths: (sourceDirectoryPath: string, generatedPortalArtifactsDirectoryPath: string) => string[];
19
26
  export declare const getFileNameFromPath: (filePath: string) => string;
20
27
  export declare const printValidationMessages: ({ warnings, errors, messages }: ValidationMessages, { log, warn, error }: loggers) => void;
28
+ /**
29
+ * Extracts a ZIP file to a specified destination directory.
30
+ *
31
+ * @param zipFilePath Path to the ZIP file.
32
+ * @param destinationDir Path to the destination directory where files will be extracted.
33
+ */
34
+ export declare function extractZipFile(zipFilePath: string, destinationDir: string): Promise<void>;
35
+ export declare function validateAndZipPortalSource(sourceDir: string, outputPath: string, ignoredPaths?: string[]): Promise<string>;
36
+ export declare function cleanUpGeneratedPortalFiles(sourceDir: string): Promise<void>;
37
+ export declare function isPortInUse(port: number): Promise<boolean>;
38
+ export declare function parseStreamBodyToJson(body: NodeJS.ReadableStream): Promise<any>;
39
+ export declare const getNonHiddenItemsFromDirectory: (directoryPath: string) => string[];
40
+ export declare const getMessageInOrangeColor: (message: string) => string;
41
+ export declare const getMessageInBlueColor: (message: string) => string;
42
+ export declare const getMessageInCyanColor: (message: string) => string;
43
+ export declare const getMessageInGreenColor: (message: string) => string;
44
+ export declare const getMessageInMagentaColor: (message: string) => string;
45
+ export declare const getMessageInRedColor: (message: string) => string;
46
+ export {};