@apimatic/cli 1.0.2-alpha.2 → 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 +220 -72
  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 +44 -40
  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 +33 -24
  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 -79
  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 +48 -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 -8
  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 +6 -2
  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
@@ -1,38 +1,145 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printValidationMessages = exports.getFileNameFromPath = exports.isJSONParsable = exports.replaceHTML = exports.stopProgress = exports.startProgress = exports.zipDirectory = exports.writeFileUsingReadableStream = exports.deleteFile = exports.unzipFile = void 0;
4
- const cli_ux_1 = require("cli-ux");
5
- const path = require("path");
6
- const fs = require("fs-extra");
7
- const archiver = require("archiver");
8
- const unzipper = require("unzipper");
9
- const stripTags = require("striptags");
10
- exports.unzipFile = (stream, destination) => {
1
+ import { __asyncValues } from "tslib";
2
+ import * as path from "path";
3
+ import net from "net";
4
+ import fs from "fs-extra";
5
+ import os from "os";
6
+ import archiver from "archiver";
7
+ import unzipper from "unzipper";
8
+ import stripTags from "striptags";
9
+ import AdmZip from "adm-zip";
10
+ import colors from "picocolors";
11
+ import { PassThrough } from "stream";
12
+ export const unzipFile = (stream, destination) => {
11
13
  return new Promise((resolve, reject) => {
12
- stream.pipe(unzipper.Extract({ path: destination }));
13
- stream.on("close", (error) => {
14
- if (error) {
15
- reject(new Error("Couldn't extract the zip"));
16
- }
17
- resolve("Extracted");
14
+ const extractStream = unzipper.Extract({ path: destination });
15
+ stream
16
+ .pipe(extractStream)
17
+ .on("error", (error) => reject(new Error("Error during extraction: " + error.message)));
18
+ extractStream.on("close", () => resolve("Extracted"));
19
+ extractStream.on("error", (error) => reject(new Error("Error during extraction: " + error.message)));
20
+ });
21
+ };
22
+ export const createTempDirectory = async () => {
23
+ return fs.mkdtempSync(path.join(os.tmpdir(), "apimatic-cli-"));
24
+ };
25
+ export const clearDirectory = async (folderPath) => {
26
+ if (!fs.existsSync(folderPath)) {
27
+ throw new Error(`Directory ${folderPath} does not exist`);
28
+ }
29
+ const files = await fs.readdir(folderPath);
30
+ for (const file of files) {
31
+ const filePath = path.join(folderPath, file);
32
+ await deleteFile(filePath);
33
+ }
34
+ await deleteFile(folderPath);
35
+ };
36
+ export const validationMessagesToJson = (validationMessages) => {
37
+ const structuredValidationMessages = {
38
+ "Validation Messages": {
39
+ Errors: [],
40
+ Warnings: [],
41
+ Messages: []
42
+ }
43
+ };
44
+ if (validationMessages.errors) {
45
+ validationMessages.errors.forEach((error) => {
46
+ structuredValidationMessages["Validation Messages"]["Errors"].push(replaceHTML(error));
47
+ });
48
+ }
49
+ if (validationMessages.warnings) {
50
+ validationMessages.warnings.forEach((warning) => {
51
+ structuredValidationMessages["Validation Messages"]["Warnings"].push(replaceHTML(warning));
18
52
  });
53
+ }
54
+ if (validationMessages.messages) {
55
+ validationMessages.messages.forEach((message) => {
56
+ structuredValidationMessages["Validation Messages"]["Messages"].push(replaceHTML(message));
57
+ });
58
+ }
59
+ return structuredValidationMessages;
60
+ };
61
+ // TODO: Move to portal:quickstart command.
62
+ const descriptions = Object.entries({
63
+ "APIMATIC-BUILD.json": "# Defines all configurations for the API portal, including programming languages and themes",
64
+ spec: "# Contains all API definition files",
65
+ content: "# Includes custom documentation pages in Markdown",
66
+ "content/toc.yml": "# Controls the structure of the side navigation bar in the API portal",
67
+ static: "# Includes all static files, such as images, GIFs, and PDFs"
68
+ }).reduce((acc, [key, value]) => {
69
+ acc[path.normalize(key)] = value;
70
+ return acc;
71
+ }, {});
72
+ // TODO: Move to portal:quickstart command.
73
+ export const directoryToJson = (dirPath, parentPath = "") => {
74
+ const directoryStructure = {};
75
+ const items = fs.readdirSync(dirPath);
76
+ items.forEach((item) => {
77
+ if (item === ".git")
78
+ return; // Skip .git directory
79
+ const itemPath = path.join(dirPath, item);
80
+ const relativePath = path.join(parentPath, item);
81
+ const stats = fs.statSync(itemPath);
82
+ if (stats.isDirectory()) {
83
+ const subdirectoryStructure = directoryToJson(itemPath, relativePath);
84
+ const folderName = descriptions[path.normalize(relativePath)]
85
+ ? `${item} : ${descriptions[path.normalize(relativePath)]}`
86
+ : item;
87
+ directoryStructure[folderName] = subdirectoryStructure;
88
+ }
89
+ else {
90
+ directoryStructure[descriptions[path.normalize(relativePath)] ? `${item} : ${descriptions[path.normalize(relativePath)]}` : item] = null;
91
+ }
19
92
  });
93
+ return directoryStructure;
94
+ };
95
+ export const isValidUrl = (input) => {
96
+ if (!input) {
97
+ return false;
98
+ }
99
+ try {
100
+ const url = new URL(input);
101
+ if (!["http:", "https:"].includes(url.protocol)) {
102
+ return false;
103
+ }
104
+ if (url.protocol === "file:" || fs.existsSync(input)) {
105
+ return false;
106
+ }
107
+ if (!url.host) {
108
+ return false;
109
+ }
110
+ return true;
111
+ }
112
+ catch (_) {
113
+ return false;
114
+ }
20
115
  };
21
- exports.deleteFile = async (filePath) => {
116
+ export const deleteFile = async (filePath) => {
22
117
  return await fs.remove(filePath);
23
118
  };
24
- exports.writeFileUsingReadableStream = (stream, destinationPath) => {
25
- return new Promise((resolve, reject) => {
119
+ export const writeFileUsingReadableStream = (stream, destinationPath) => {
120
+ return new Promise((resolve) => {
26
121
  const writeStream = fs.createWriteStream(destinationPath);
27
122
  stream.pipe(writeStream);
28
- writeStream.on("close", (error) => {
29
- if (error) {
30
- return reject(new Error("Couldn't zip the stream"));
31
- }
123
+ writeStream.on("close", () => {
32
124
  resolve("Zipped");
33
125
  });
34
126
  });
35
127
  };
128
+ export const zipDirectoryToStream = async (sourcePath) => {
129
+ // Check if the directory exists for the user or not
130
+ await fs.ensureDir(sourcePath);
131
+ const archive = archiver("zip");
132
+ return new Promise((resolve, reject) => {
133
+ archive.on("error", (err) => {
134
+ reject(new Error(err.message));
135
+ });
136
+ const passThroughStream = new PassThrough();
137
+ archive.pipe(passThroughStream);
138
+ archive.directory(sourcePath, false);
139
+ archive.finalize().catch(reject);
140
+ resolve(passThroughStream);
141
+ });
142
+ };
36
143
  /**
37
144
  * Packages local files into a ZIP archive
38
145
  *
@@ -40,60 +147,31 @@ exports.writeFileUsingReadableStream = (stream, destinationPath) => {
40
147
  * @param {destinationZipPath} path to generated zip
41
148
  * return {string}
42
149
  */
43
- exports.zipDirectory = async (sourcePath, destinationPath) => {
150
+ export const zipDirectory = async (sourcePath, destinationPath) => {
44
151
  // Check if the directory exists for the user or not
45
152
  await fs.ensureDir(sourcePath);
46
- const zipPath = path.join(destinationPath, "target.zip");
153
+ const zipPath = path.join(destinationPath, ".target.zip");
47
154
  const output = fs.createWriteStream(zipPath);
48
155
  const archive = archiver("zip");
49
- archive.on("error", (err) => {
50
- throw err;
51
- });
52
- archive.pipe(output);
53
- // append files from a sub-directory, putting its contents at the root of archive
54
- archive.directory(sourcePath, false);
55
- await archive.finalize();
56
- return zipPath;
57
- };
58
- // TODO: Instead of making progressBar a static, you should have "startProgress"
59
- // return the instance of the progress bar created, the same way "cli.progress"
60
- // method does.
61
- let progressBar;
62
- // TODO: I didn't mean to say that we should create a fake progress bar when we
63
- // set the requirements to include progress bar. You should get the download or
64
- // upload progress by tracking how much of the steam has been read/written and
65
- // compare that with the remaining size of the stream (in case of upload, you
66
- // get size from the file size and in case of download, you get it from the
67
- // content-type header). In case the progress can not be calculated, show a
68
- // spinner.
69
- exports.startProgress = (title) => {
70
- progressBar = cli_ux_1.default.progress({
71
- format: `${title} | {bar}`,
72
- barCompleteChar: "\u2588",
73
- barIncompleteChar: "\u2591"
156
+ return new Promise((resolve, reject) => {
157
+ archive.on("error", (err) => {
158
+ reject(new Error(err.message));
159
+ });
160
+ output.on("error", (err) => {
161
+ reject(new Error(err.message));
162
+ });
163
+ output.on("close", () => {
164
+ resolve(zipPath);
165
+ });
166
+ archive.pipe(output);
167
+ archive.directory(sourcePath, false);
168
+ archive.finalize().catch(reject);
74
169
  });
75
- progressBar.start();
76
- const total = 100;
77
- let count = 0;
78
- const iv = setInterval(() => {
79
- count++;
80
- progressBar.update(count);
81
- if (count === total - 1) {
82
- clearInterval(iv);
83
- }
84
- }, 50);
85
170
  };
86
- exports.stopProgress = (isError = false) => {
87
- if (isError) {
88
- return progressBar ? progressBar.stop() : null;
89
- }
90
- progressBar.update(100);
91
- return progressBar.stop();
92
- };
93
- exports.replaceHTML = (string) => {
171
+ export const replaceHTML = (string) => {
94
172
  return stripTags(string);
95
173
  };
96
- exports.isJSONParsable = (json) => {
174
+ export const isJSONParsable = (json) => {
97
175
  try {
98
176
  JSON.parse(json);
99
177
  return true;
@@ -102,20 +180,184 @@ exports.isJSONParsable = (json) => {
102
180
  return false;
103
181
  }
104
182
  };
105
- exports.getFileNameFromPath = (filePath) => {
183
+ export const getGeneratedFilesPaths = (sourceDirectoryPath, generatedPortalArtifactsDirectoryPath) => {
184
+ const generatedBuildInputZipPath = path.join(sourceDirectoryPath, ".portal_source.zip");
185
+ const generatedPortalArtifactsZipFilePath = path.join(sourceDirectoryPath, ".generated_portal.zip");
186
+ const generatedPortalArtifactsFolderPath = path.join(path.dirname(generatedPortalArtifactsDirectoryPath), "generated_portal");
187
+ return [generatedBuildInputZipPath, generatedPortalArtifactsFolderPath, generatedPortalArtifactsZipFilePath];
188
+ };
189
+ export const getFileNameFromPath = (filePath) => {
106
190
  return path.basename(filePath).split(".")[0];
107
191
  };
108
- exports.printValidationMessages = ({ warnings, errors, messages }, { log, warn, error }) => {
192
+ export const printValidationMessages = ({ warnings, errors, messages }, { log, warn, error }) => {
109
193
  warnings = warnings || [];
110
194
  messages = messages || [];
111
195
  const singleError = errors.join("\n") || "";
112
196
  messages.forEach((message) => {
113
- log(`Info: ${exports.replaceHTML(message)}`);
197
+ log(`Info: ${replaceHTML(message)}`);
114
198
  });
115
199
  warnings.forEach((warning) => {
116
- warn(exports.replaceHTML(warning));
200
+ warn(replaceHTML(warning));
117
201
  });
118
202
  if (errors.length > 0) {
119
- error(exports.replaceHTML(singleError));
203
+ error(replaceHTML(singleError));
204
+ }
205
+ };
206
+ /**
207
+ * Extracts a ZIP file to a specified destination directory.
208
+ *
209
+ * @param zipFilePath Path to the ZIP file.
210
+ * @param destinationDir Path to the destination directory where files will be extracted.
211
+ */
212
+ export async function extractZipFile(zipFilePath, destinationDir) {
213
+ const MAX_ZIP_SIZE = 300 * 1024 * 1024;
214
+ return new Promise((resolve, reject) => {
215
+ try {
216
+ const zip = new AdmZip(zipFilePath);
217
+ const zipEntries = zip.getEntries();
218
+ let totalSize = 0;
219
+ zipEntries.forEach((entry) => {
220
+ totalSize += entry.getData().length;
221
+ const normalizedPath = path.normalize(entry.entryName);
222
+ if (normalizedPath.startsWith("..") || path.isAbsolute(normalizedPath)) {
223
+ return reject(new Error(`Blocked potentially unsafe path: ${normalizedPath}`));
224
+ }
225
+ });
226
+ if (totalSize > MAX_ZIP_SIZE) {
227
+ return reject(new Error(getMessageInRedColor("Archive size is too large for safe extraction.")));
228
+ }
229
+ if (!fs.existsSync(destinationDir)) {
230
+ fs.mkdirSync(destinationDir, { recursive: true });
231
+ }
232
+ zipEntries.forEach((entry) => {
233
+ const resolvedPath = path.resolve(destinationDir, entry.entryName);
234
+ if (!resolvedPath.startsWith(path.resolve(destinationDir))) {
235
+ return reject(new Error("An error occurred while extracting zip file."));
236
+ }
237
+ zip.extractEntryTo(entry, destinationDir, true, true);
238
+ });
239
+ resolve();
240
+ }
241
+ catch (error) {
242
+ return reject(new Error(`Failed to extract ZIP File: ${error}`));
243
+ }
244
+ });
245
+ }
246
+ export async function validateAndZipPortalSource(sourceDir, outputPath, ignoredPaths = []) {
247
+ const output = fs.createWriteStream(outputPath);
248
+ const archive = archiver("zip", {
249
+ zlib: { level: 9 }
250
+ });
251
+ return new Promise((resolve, reject) => {
252
+ output.on("close", () => resolve(outputPath));
253
+ output.on("error", (err) => {
254
+ return reject(new Error(`Failed to zip the source directory: ${err.message}`));
255
+ });
256
+ archive.on("error", (err) => {
257
+ return reject(new Error(`Failed to zip the source directory: ${err.message}`));
258
+ });
259
+ archive.pipe(output);
260
+ // Function to recursively add files and directories to the archive, excluding ignored paths
261
+ const addItemsToArchive = async (currentPath, archivePath) => {
262
+ const items = await fs.readdir(currentPath);
263
+ for (const item of items) {
264
+ const fullPath = path.join(currentPath, item);
265
+ const relativePath = path.relative(sourceDir, fullPath);
266
+ // Check if the path is ignored.
267
+ const isIgnored = ignoredPaths.some((ignoredPath) => fullPath === ignoredPath ||
268
+ relativePath === ignoredPath ||
269
+ fullPath === path.resolve(ignoredPath) ||
270
+ relativePath.startsWith(ignoredPath + "/") ||
271
+ relativePath.startsWith(ignoredPath + "\\"));
272
+ if (!isIgnored) {
273
+ const stats = await fs.stat(fullPath);
274
+ if (stats.isDirectory()) {
275
+ await addItemsToArchive(fullPath, archivePath ? path.join(archivePath, item) : item);
276
+ }
277
+ else {
278
+ archive.file(fullPath, { name: archivePath ? path.join(archivePath, item) : item });
279
+ }
280
+ }
281
+ }
282
+ };
283
+ // Start adding items from the source directory
284
+ addItemsToArchive(sourceDir, false)
285
+ .then(() => {
286
+ archive.finalize();
287
+ })
288
+ .catch((err) => {
289
+ return reject(new Error(`Failed to add items to the zip created for source directory: ${err.message}`));
290
+ });
291
+ });
292
+ }
293
+ export async function cleanUpGeneratedPortalFiles(sourceDir) {
294
+ const generatedPortalZipFilePath = path.join(sourceDir, ".generated_portal.zip");
295
+ const generatedPortalSourceZipFilePath = path.join(sourceDir, ".portal_source.zip");
296
+ if (fs.existsSync(generatedPortalZipFilePath)) {
297
+ await deleteFile(generatedPortalZipFilePath);
298
+ }
299
+ if (fs.existsSync(generatedPortalSourceZipFilePath)) {
300
+ await deleteFile(generatedPortalSourceZipFilePath);
301
+ }
302
+ }
303
+ export function isPortInUse(port) {
304
+ return new Promise((resolve) => {
305
+ const server = net.createServer();
306
+ server.once("error", (err) => {
307
+ if (err.code === "EADDRINUSE") {
308
+ resolve(true);
309
+ }
310
+ else {
311
+ resolve(false);
312
+ }
313
+ });
314
+ server.once("listening", () => {
315
+ server.close();
316
+ resolve(false);
317
+ });
318
+ server.listen(port);
319
+ });
320
+ }
321
+ export async function parseStreamBodyToJson(body) {
322
+ var _a, e_1, _b, _c;
323
+ const chunks = [];
324
+ try {
325
+ for (var _d = true, body_1 = __asyncValues(body), body_1_1; body_1_1 = await body_1.next(), _a = body_1_1.done, !_a; _d = true) {
326
+ _c = body_1_1.value;
327
+ _d = false;
328
+ const chunk = _c;
329
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
330
+ }
120
331
  }
332
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
333
+ finally {
334
+ try {
335
+ if (!_d && !_a && (_b = body_1.return)) await _b.call(body_1);
336
+ }
337
+ finally { if (e_1) throw e_1.error; }
338
+ }
339
+ const text = Buffer.concat(chunks).toString("utf-8");
340
+ return JSON.parse(text);
341
+ }
342
+ export const getNonHiddenItemsFromDirectory = (directoryPath) => {
343
+ return fs.readdirSync(directoryPath).filter((item) => !item.startsWith("."));
344
+ };
345
+ export const getMessageInOrangeColor = (message) => {
346
+ return colors.yellow(message);
347
+ };
348
+ export const getMessageInBlueColor = (message) => {
349
+ return colors.blueBright(message);
350
+ };
351
+ export const getMessageInCyanColor = (message) => {
352
+ return colors.cyan(message);
353
+ };
354
+ export const getMessageInGreenColor = (message) => {
355
+ return colors.greenBright(message);
356
+ };
357
+ export const getMessageInMagentaColor = (message) => {
358
+ return colors.magentaBright(message);
359
+ };
360
+ export const getMessageInRedColor = (message) => {
361
+ return colors.redBright(message);
121
362
  };
363
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAA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idator {
2
+ private readonly error;
3
+ constructor(error: (message: string) => void);
4
+ validateSourceDirectory(sourceDir: string): void;
5
+ validateGeneratedPortalDestinationDirectory(destinationDir: string, portalDir: string): Promise<void>;
6
+ validatePortalSourceDirectory(sourceDir: string): void;
7
+ validatePortalSourceSpecDirectory(sourceDir: string): void;
8
+ validateGeneratedPortalDestinationDirectoryIsEmpty(destinationDir: string): void;
9
+ }
@@ -0,0 +1,49 @@
1
+ import fsExtra from "fs-extra";
2
+ import * as path from "path";
3
+ import { getMessageInRedColor, getNonHiddenItemsFromDirectory } from "../../utils/utils.js";
4
+ export class DirectoryValidator {
5
+ constructor(error) {
6
+ this.error = error;
7
+ }
8
+ validateSourceDirectory(sourceDir) {
9
+ if (!fsExtra.pathExistsSync(sourceDir)) {
10
+ this.error(getMessageInRedColor(`The specified source directory does not exist: ${sourceDir}. Please provide a valid source directory to continue.`));
11
+ }
12
+ }
13
+ async validateGeneratedPortalDestinationDirectory(destinationDir, portalDir) {
14
+ if (!fsExtra.pathExistsSync(destinationDir) && destinationDir != "./generated_portal") {
15
+ this.error(getMessageInRedColor(`The specified destination directory does not exist: ${destinationDir}. Please provide a valid destination directory to continue.`));
16
+ }
17
+ if (destinationDir == "./generated_portal") {
18
+ await fsExtra.ensureDir(portalDir);
19
+ }
20
+ }
21
+ validatePortalSourceDirectory(sourceDir) {
22
+ const sourceDirItems = getNonHiddenItemsFromDirectory(sourceDir);
23
+ if (sourceDirItems.length == 0) {
24
+ this.error(getMessageInRedColor("The source directory is empty. Please ensure that the provided path points to a directory containing a valid build input."));
25
+ }
26
+ if (!sourceDirItems.includes("spec")) {
27
+ this.error(getMessageInRedColor("The provided build directory is missing a 'spec' directory. Please create a 'spec' directory containing a valid API Definition file to continue."));
28
+ }
29
+ if (!sourceDirItems.some((item) => item.startsWith("APIMATIC-BUILD"))) {
30
+ this.error(getMessageInRedColor("The provided directory is missing an APIMATIC-BUILD.json file. Please add a valid build file to continue."));
31
+ }
32
+ }
33
+ validatePortalSourceSpecDirectory(sourceDir) {
34
+ const specFolderItems = getNonHiddenItemsFromDirectory(path.join(sourceDir, "spec"));
35
+ if (specFolderItems.length == 0) {
36
+ this.error(getMessageInRedColor("The provided build directory is missing an API Definition file. Please add a valid API Definition file to the 'spec' directory to continue."));
37
+ }
38
+ if (specFolderItems.length == 1 && specFolderItems.some((item) => item.toLowerCase().startsWith("apimatic-meta"))) {
39
+ this.error(getMessageInRedColor("The provided build directory is missing an API Definition file. Please add a valid API Definition file to the 'spec' directory to continue."));
40
+ }
41
+ }
42
+ validateGeneratedPortalDestinationDirectoryIsEmpty(destinationDir) {
43
+ const portalDirItems = getNonHiddenItemsFromDirectory(destinationDir);
44
+ if (portalDirItems.length > 0 && destinationDir != "./generated_portal") {
45
+ this.error(getMessageInRedColor("The destination directory is not empty. Please specify an empty destination directory or empty the provided directory."));
46
+ }
47
+ }
48
+ }
49
+ //# sourceMappingURL=directoryValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directoryValidator.js","sourceRoot":"","sources":["../../../src/validators/common/directoryValidator.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAE5F,MAAM,OAAO,kBAAkB;IAC7B,YAA6B,KAAgC;QAAhC,UAAK,GAAL,KAAK,CAA2B;IAAG,CAAC;IAEjE,uBAAuB,CAAC,SAAiB;QACvC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;YACvC,IAAI,CAAC,KAAK,CACR,oBAAoB,CAClB,kDAAkD,SAAS,wDAAwD,CACpH,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,2CAA2C,CAAC,cAAsB,EAAE,SAAiB;QACzF,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,IAA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C,UAAU,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC;YAClH,IAAI,CAAC,KAAK,CACR,oBAAoB,CAClB,6IAA6I,CAC9I,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,kDAAkD,CAAC,cAAsB;QACvE,MAAM,cAAc,GAAG,8BAA8B,CAAC,cAAc,CAAC,CAAC;QACtE,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc,IAAI,oBAAoB,EAAE,CAAC;YACxE,IAAI,CAAC,KAAK,CACR,oBAAoB,CAClB,wHAAwH,CACzH,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ export declare class PortValidator {
2
+ private readonly error;
3
+ constructor(error: (message: string) => void);
4
+ validate(port: number): Promise<void>;
5
+ }
@@ -0,0 +1,16 @@
1
+ import { getMessageInRedColor, isPortInUse } from "../../utils/utils.js";
2
+ export class PortValidator {
3
+ constructor(error) {
4
+ this.error = error;
5
+ }
6
+ async validate(port) {
7
+ if (isNaN(port) || port < 1 || port > 65535) {
8
+ this.error(getMessageInRedColor("The specified port number is invalid. Please enter a valid port."));
9
+ }
10
+ const portInUse = await isPortInUse(port);
11
+ if (portInUse) {
12
+ this.error(getMessageInRedColor(`Port ${port} is already in use. Please provide an alternative port number to continue.`));
13
+ }
14
+ }
15
+ }
16
+ //# sourceMappingURL=portValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portValidator.js","sourceRoot":"","sources":["../../../src/validators/common/portValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEzE,MAAM,OAAO,aAAa;IACxB,YAA6B,KAAgC;QAAhC,UAAK,GAAL,KAAK,CAA2B;IAAG,CAAC;IAEjE,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;YAC5C,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,kEAAkE,CAAC,CAAC,CAAC;QACvG,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,QAAQ,IAAI,4EAA4E,CAAC,CAAC,CAAC;QAC7H,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ export declare class PortalServeValidator {
2
+ private readonly portValidator;
3
+ private readonly directoryValidator;
4
+ constructor(error: (message: string) => void);
5
+ validate(port: number, destination: string, sourceDir: string, portalDir: string): Promise<void>;
6
+ }
@@ -0,0 +1,17 @@
1
+ import { DirectoryValidator } from "../common/directoryValidator.js";
2
+ import { PortValidator } from "../common/portValidator.js";
3
+ export class PortalServeValidator {
4
+ constructor(error) {
5
+ this.portValidator = new PortValidator(error);
6
+ this.directoryValidator = new DirectoryValidator(error);
7
+ }
8
+ async validate(port, destination, sourceDir, portalDir) {
9
+ await this.portValidator.validate(port);
10
+ this.directoryValidator.validateSourceDirectory(sourceDir);
11
+ await this.directoryValidator.validateGeneratedPortalDestinationDirectory(destination, portalDir);
12
+ this.directoryValidator.validatePortalSourceDirectory(sourceDir);
13
+ this.directoryValidator.validatePortalSourceSpecDirectory(sourceDir);
14
+ this.directoryValidator.validateGeneratedPortalDestinationDirectoryIsEmpty(destination);
15
+ }
16
+ }
17
+ //# sourceMappingURL=serveValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serveValidator.js","sourceRoot":"","sources":["../../../src/validators/portal/serveValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,OAAO,oBAAoB;IAI/B,YAAY,KAAgC;QAC1C,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,CAAC,kBAAkB,GAAG,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAY,EAAE,WAAmB,EAAE,SAAiB,EAAE,SAAiB;QACpF,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;QAC3D,MAAM,IAAI,CAAC,kBAAkB,CAAC,2CAA2C,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAClG,IAAI,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,SAAS,CAAC,CAAC;QACjE,IAAI,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,SAAS,CAAC,CAAC;QACrE,IAAI,CAAC,kBAAkB,CAAC,kDAAkD,CAAC,WAAW,CAAC,CAAC;IAC1F,CAAC;CACF"}