mulesoft-anypoint-cli-agent-fabric-plugin 1.0.5

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 (114) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +321 -0
  3. package/bin/run +5 -0
  4. package/bin/run.cmd +3 -0
  5. package/dist/commands/agent-network/project/build.d.ts +26 -0
  6. package/dist/commands/agent-network/project/build.js +192 -0
  7. package/dist/commands/agent-network/project/build.js.map +1 -0
  8. package/dist/commands/agent-network/project/create.d.ts +28 -0
  9. package/dist/commands/agent-network/project/create.js +101 -0
  10. package/dist/commands/agent-network/project/create.js.map +1 -0
  11. package/dist/commands/agent-network/project/deploy.d.ts +67 -0
  12. package/dist/commands/agent-network/project/deploy.js +580 -0
  13. package/dist/commands/agent-network/project/deploy.js.map +1 -0
  14. package/dist/commands/agent-network/project/publish.d.ts +27 -0
  15. package/dist/commands/agent-network/project/publish.js +159 -0
  16. package/dist/commands/agent-network/project/publish.js.map +1 -0
  17. package/dist/commands/agent-network/setup/dependencies.d.ts +12 -0
  18. package/dist/commands/agent-network/setup/dependencies.js +65 -0
  19. package/dist/commands/agent-network/setup/dependencies.js.map +1 -0
  20. package/dist/commands/agent-network/setup/gateways.d.ts +31 -0
  21. package/dist/commands/agent-network/setup/gateways.js +175 -0
  22. package/dist/commands/agent-network/setup/gateways.js.map +1 -0
  23. package/dist/errors/base-error.d.ts +8 -0
  24. package/dist/errors/base-error.js +81 -0
  25. package/dist/errors/base-error.js.map +1 -0
  26. package/dist/errors/error-factory.d.ts +71 -0
  27. package/dist/errors/error-factory.js +362 -0
  28. package/dist/errors/error-factory.js.map +1 -0
  29. package/dist/helpers/dependency-manager.d.ts +30 -0
  30. package/dist/helpers/dependency-manager.js +366 -0
  31. package/dist/helpers/dependency-manager.js.map +1 -0
  32. package/dist/helpers/entitlement-utils.d.ts +4 -0
  33. package/dist/helpers/entitlement-utils.js +20 -0
  34. package/dist/helpers/entitlement-utils.js.map +1 -0
  35. package/dist/helpers/policy-helper.d.ts +21 -0
  36. package/dist/helpers/policy-helper.js +96 -0
  37. package/dist/helpers/policy-helper.js.map +1 -0
  38. package/dist/helpers/project/api-project-dependency-fetcher.d.ts +10 -0
  39. package/dist/helpers/project/api-project-dependency-fetcher.js +213 -0
  40. package/dist/helpers/project/api-project-dependency-fetcher.js.map +1 -0
  41. package/dist/helpers/project/constants.d.ts +52 -0
  42. package/dist/helpers/project/constants.js +52 -0
  43. package/dist/helpers/project/constants.js.map +1 -0
  44. package/dist/helpers/project/debug-messages.d.ts +4 -0
  45. package/dist/helpers/project/debug-messages.js +8 -0
  46. package/dist/helpers/project/debug-messages.js.map +1 -0
  47. package/dist/helpers/project/templates.d.ts +1 -0
  48. package/dist/helpers/project/templates.js +6 -0
  49. package/dist/helpers/project/templates.js.map +1 -0
  50. package/dist/helpers/project/uris.d.ts +2 -0
  51. package/dist/helpers/project/uris.js +8 -0
  52. package/dist/helpers/project/uris.js.map +1 -0
  53. package/dist/helpers/project/validation-commons.d.ts +6 -0
  54. package/dist/helpers/project/validation-commons.js +50 -0
  55. package/dist/helpers/project/validation-commons.js.map +1 -0
  56. package/dist/helpers/types.d.ts +54 -0
  57. package/dist/helpers/types.js +10 -0
  58. package/dist/helpers/types.js.map +1 -0
  59. package/dist/helpers/utils.d.ts +68 -0
  60. package/dist/helpers/utils.js +374 -0
  61. package/dist/helpers/utils.js.map +1 -0
  62. package/dist/index.d.ts +5 -0
  63. package/dist/index.js +17 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/resources/mule-generation-dependencies.json +1 -0
  66. package/dist/resources/runtime-dependencies.json +13 -0
  67. package/dist/resources/schemas/mule-generation-dependencies-schema.json +52 -0
  68. package/dist/resources/schemas/runtime-dependencies-schema.json +57 -0
  69. package/dist/types/agent-network.d.ts +214 -0
  70. package/dist/types/agent-network.js +13 -0
  71. package/dist/types/agent-network.js.map +1 -0
  72. package/dist/types/types.d.ts +296 -0
  73. package/dist/types/types.js +3 -0
  74. package/dist/types/types.js.map +1 -0
  75. package/dist/utils/access-management.d.ts +5 -0
  76. package/dist/utils/access-management.js +14 -0
  77. package/dist/utils/access-management.js.map +1 -0
  78. package/dist/utils/api-instance-builder.d.ts +28 -0
  79. package/dist/utils/api-instance-builder.js +450 -0
  80. package/dist/utils/api-instance-builder.js.map +1 -0
  81. package/dist/utils/asset-builder.d.ts +28 -0
  82. package/dist/utils/asset-builder.js +248 -0
  83. package/dist/utils/asset-builder.js.map +1 -0
  84. package/dist/utils/constants.d.ts +73 -0
  85. package/dist/utils/constants.js +87 -0
  86. package/dist/utils/constants.js.map +1 -0
  87. package/dist/utils/exchange.d.ts +4 -0
  88. package/dist/utils/exchange.js +26 -0
  89. package/dist/utils/exchange.js.map +1 -0
  90. package/dist/utils/files.d.ts +63 -0
  91. package/dist/utils/files.js +300 -0
  92. package/dist/utils/files.js.map +1 -0
  93. package/dist/utils/gateway.d.ts +12 -0
  94. package/dist/utils/gateway.js +83 -0
  95. package/dist/utils/gateway.js.map +1 -0
  96. package/dist/utils/naming.d.ts +1 -0
  97. package/dist/utils/naming.js +17 -0
  98. package/dist/utils/naming.js.map +1 -0
  99. package/dist/utils/report/junit-report.d.ts +2 -0
  100. package/dist/utils/report/junit-report.js +19 -0
  101. package/dist/utils/report/junit-report.js.map +1 -0
  102. package/dist/utils/report/validation-report.d.ts +27 -0
  103. package/dist/utils/report/validation-report.js +16 -0
  104. package/dist/utils/report/validation-report.js.map +1 -0
  105. package/dist/utils/uris.d.ts +26 -0
  106. package/dist/utils/uris.js +41 -0
  107. package/dist/utils/uris.js.map +1 -0
  108. package/dist/utils/variables.d.ts +6 -0
  109. package/dist/utils/variables.js +22 -0
  110. package/dist/utils/variables.js.map +1 -0
  111. package/package.json +100 -0
  112. package/scripts/post-install.js +102 -0
  113. package/templates/agent-network.yaml.template +89 -0
  114. package/templates/exchange.json.template +36 -0
@@ -0,0 +1,300 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileValidator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
6
+ const node_os_1 = tslib_1.__importDefault(require("node:os"));
7
+ const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
8
+ /**
9
+ * Utility class for file path validation and security checks
10
+ */
11
+ class FileValidator {
12
+ /**
13
+ * Validates if a file path is safe and doesn't contain dangerous characters
14
+ * that could lead to directory traversal or command injection attacks.
15
+ *
16
+ * @param filePath - The file path to validate
17
+ * @returns true if the path is valid, false otherwise
18
+ */
19
+ static isValidPath(filePath) {
20
+ if (!filePath) {
21
+ return false;
22
+ }
23
+ filePath = node_path_1.default.resolve(filePath);
24
+ // Check for null bytes
25
+ if (filePath.includes('\0')) {
26
+ return false;
27
+ }
28
+ // Check for control characters (newline, carriage return, tab, etc.)
29
+ if (/[\x00-\x1f\x7f]/.test(filePath)) {
30
+ return false;
31
+ }
32
+ // Check for dangerous shell characters that could be used for command injection
33
+ const dangerousChars = [';', '|', '&', '$', '`', '(', ')', '{', '}', '<', '>', '*', '?'];
34
+ for (const char of dangerousChars) {
35
+ if (filePath.includes(char)) {
36
+ return false;
37
+ }
38
+ }
39
+ // Check for directory traversal patterns
40
+ // Check for ..\ in original path (before normalization, for Windows paths)
41
+ if (filePath.includes('..\\')) {
42
+ return false;
43
+ }
44
+ // Check for paths ending with \.. (Windows backslash, before normalization)
45
+ return !filePath.endsWith('\\..');
46
+ }
47
+ /**
48
+ * Validates if a file or directory path is safe to use for creating new directories.
49
+ * Checks against system reserved directories based on the operating system.
50
+ * If the path points to a file, the parent directory of the file is validated.
51
+ * If the path points to a directory, the directory itself is validated.
52
+ *
53
+ * @param fileOrDirectoryPath - The file or directory path to validate
54
+ * @returns true if the path (or its parent directory if it's a file) is safe, false if it's in a system reserved directory
55
+ */
56
+ static isSafePath(fileOrDirectoryPath) {
57
+ if (!fileOrDirectoryPath) {
58
+ return false;
59
+ }
60
+ // First validate the path format
61
+ if (!this.isValidPath(fileOrDirectoryPath)) {
62
+ return false;
63
+ }
64
+ // Normalize path: resolve to absolute and normalize separators
65
+ // We need to normalize both the directoryPath and the original path
66
+ // to check for reserved patterns in the original path as well
67
+ const platform = node_os_1.default.platform();
68
+ // Normalize the original path for reserved pattern checking
69
+ const normalizedPath = this.normalizePath(fileOrDirectoryPath, platform);
70
+ const endsWithSeparator = normalizedPath.endsWith(node_path_1.default.sep) || normalizedPath.endsWith('/') || normalizedPath.endsWith('\\');
71
+ // Remove file name
72
+ const stats = FileValidator.statSync(normalizedPath);
73
+ let directoryPath = '';
74
+ if ((stats === null || stats === void 0 ? void 0 : stats.isFile()) && !endsWithSeparator) {
75
+ directoryPath = this.getParentDirName(normalizedPath);
76
+ }
77
+ else {
78
+ directoryPath = normalizedPath;
79
+ }
80
+ // Check if the directory is safe based on platform-specific rules
81
+ const isSafe = this.checkForSafeDirectory(directoryPath, platform);
82
+ // If the directory is not safe according to platform rules, return false
83
+ if (!isSafe) {
84
+ return false;
85
+ }
86
+ // Check write permissions on the directory
87
+ return this.hasWritePermission(directoryPath);
88
+ }
89
+ static checkForSafeDirectory(directoryPath, platform) {
90
+ let isSafe;
91
+ if (platform === 'win32') {
92
+ isSafe = this.isWindowsSafeDirectory(directoryPath, this.getOSHomeDir());
93
+ }
94
+ else if (platform === 'darwin') {
95
+ isSafe = this.isMacOSSafeDirectory(directoryPath);
96
+ }
97
+ else {
98
+ // Linux and other Unix-like systems
99
+ isSafe = this.isLinuxSafeDirectory(directoryPath);
100
+ }
101
+ return isSafe;
102
+ }
103
+ static normalizePath(fileOrDirectoryPath, platform) {
104
+ let originalResolvedPath;
105
+ const windowsAbsolutePathPattern = /^[a-z]:[\\/]/i;
106
+ if (platform === 'win32' && windowsAbsolutePathPattern.test(fileOrDirectoryPath)) {
107
+ originalResolvedPath = fileOrDirectoryPath.replace(/\//g, '\\');
108
+ }
109
+ else if (fileOrDirectoryPath.startsWith('/')) {
110
+ originalResolvedPath = fileOrDirectoryPath;
111
+ }
112
+ else {
113
+ originalResolvedPath = node_path_1.default.resolve(fileOrDirectoryPath);
114
+ if (platform === 'win32') {
115
+ originalResolvedPath = originalResolvedPath.replace(/\//g, '\\');
116
+ }
117
+ }
118
+ return originalResolvedPath.toLowerCase();
119
+ }
120
+ static getOSHomeDir() {
121
+ return node_os_1.default.homedir();
122
+ }
123
+ static getParentDirName(fileOrDirectoryPath) {
124
+ return node_path_1.default.dirname(fileOrDirectoryPath);
125
+ }
126
+ /**
127
+ * Checks if a directory is safe on Windows
128
+ */
129
+ static isWindowsSafeDirectory(normalizedPath, homeDir) {
130
+ // System reserved directories to avoid
131
+ const reservedDirs = [
132
+ 'c:\\perflogs',
133
+ 'c:\\program files',
134
+ 'c:\\program files (x86)',
135
+ 'c:\\programdata',
136
+ 'c:\\recovery',
137
+ 'c:\\syswow64',
138
+ 'c:\\system32',
139
+ 'c:\\users\\default',
140
+ 'c:\\windows',
141
+ 'c:\\boot',
142
+ 'c:\\$recycle.bin',
143
+ homeDir + '\\appdata',
144
+ homeDir + '\\local settings',
145
+ homeDir + '\\application data'
146
+ ];
147
+ // Check if path starts with any reserved directory
148
+ // Check both the directory path and the original path (in case it's a file in a reserved directory)
149
+ for (const reserved of reservedDirs) {
150
+ if (normalizedPath === reserved || normalizedPath.startsWith(reserved + '\\')) {
151
+ return false;
152
+ }
153
+ }
154
+ return true;
155
+ }
156
+ /**
157
+ * Checks if a directory is safe on macOS
158
+ */
159
+ static isMacOSSafeDirectory(normalizedPath) {
160
+ // System reserved directories protected by SIP
161
+ const reservedDirs = [
162
+ '/bin',
163
+ '/cores',
164
+ '/dev',
165
+ '/etc',
166
+ '/private',
167
+ '/sbin',
168
+ '/system',
169
+ '/usr',
170
+ '/usr/bin',
171
+ '/usr/lib',
172
+ '/usr/libexec',
173
+ '/usr/sbin',
174
+ '/',
175
+ ];
176
+ return this.isGenericUnixSafeDirectory(reservedDirs, normalizedPath);
177
+ }
178
+ /**
179
+ * Checks if a directory is safe on Linux
180
+ */
181
+ static isLinuxSafeDirectory(normalizedPath) {
182
+ // System reserved directories to avoid
183
+ const reservedDirs = [
184
+ '/bin',
185
+ '/boot',
186
+ '/dev',
187
+ '/etc',
188
+ '/lib',
189
+ '/lib64',
190
+ '/proc',
191
+ '/root',
192
+ '/sbin',
193
+ '/sys',
194
+ '/usr/bin',
195
+ '/usr/sbin',
196
+ '/usr/lib',
197
+ '/',
198
+ ];
199
+ return this.isGenericUnixSafeDirectory(reservedDirs, normalizedPath);
200
+ }
201
+ static isGenericUnixSafeDirectory(reservedDirs, normalizedPath) {
202
+ // Check if path starts with any reserved directory
203
+ for (const reserved of reservedDirs) {
204
+ if (normalizedPath === reserved || normalizedPath.startsWith(reserved + '/')) {
205
+ // Exception: /usr/local is writable and safe
206
+ if (reserved === '/usr' && normalizedPath.startsWith('/usr/local')) {
207
+ continue;
208
+ }
209
+ return false;
210
+ }
211
+ }
212
+ // Check if path is in /usr/local (safe, writable)
213
+ if (normalizedPath.startsWith('/usr/local')) {
214
+ return true;
215
+ }
216
+ // Default: not safe if it doesn't match safe patterns
217
+ return true;
218
+ }
219
+ /**
220
+ * Checks if a directory has write permission.
221
+ * If the directory doesn't exist, recursively checks the parent directory.
222
+ * Continues walking up the directory tree until an existing directory is found or root is reached.
223
+ * Stops at root directory and does not check its permissions.
224
+ *
225
+ * @param directoryPath - The directory path to check for write permissions
226
+ * @returns true if write permission is available, false otherwise. Returns true if root is reached.
227
+ */
228
+ static hasWritePermission(directoryPath) {
229
+ if (!directoryPath) {
230
+ return false;
231
+ }
232
+ // Get the root directory for the path
233
+ const rootPath = node_path_1.default.parse(directoryPath).root;
234
+ // Walk up the directory tree until we find an existing directory or reach root
235
+ let currentPath = directoryPath;
236
+ while (true) {
237
+ // Stop if we've reached the root directory
238
+ if (currentPath === rootPath || currentPath.match(/^[a-z]:\/?$/i)) {
239
+ return this.hasOSWritePermission(currentPath);
240
+ }
241
+ // Check if current path exists
242
+ const stats = this.statSync(currentPath);
243
+ if (stats) {
244
+ if (stats.isDirectory()) {
245
+ // Found an existing directory, check write permissions
246
+ return this.hasOSWritePermission(currentPath);
247
+ }
248
+ else {
249
+ // It's a file, check the parent directory
250
+ currentPath = this.getParentDirName(currentPath);
251
+ }
252
+ }
253
+ else {
254
+ // Path doesn't exist, check parent directory
255
+ const parentPath = this.getParentDirName(currentPath);
256
+ // If parent path is the same as current path, we've reached root
257
+ if (parentPath === currentPath) {
258
+ return this.hasOSWritePermission(currentPath);
259
+ }
260
+ currentPath = parentPath;
261
+ }
262
+ }
263
+ }
264
+ static statSync(fileOrDirectoryPath) {
265
+ try {
266
+ return node_fs_1.default.statSync(fileOrDirectoryPath);
267
+ }
268
+ catch (e) {
269
+ return undefined;
270
+ }
271
+ }
272
+ static hasOSWritePermission(directory) {
273
+ try {
274
+ node_fs_1.default.accessSync(directory, node_fs_1.default.constants.W_OK);
275
+ return true;
276
+ }
277
+ catch (error) {
278
+ // No write permissions
279
+ return false;
280
+ }
281
+ }
282
+ /**
283
+ * Validates if a file or directory path is both valid and safe.
284
+ * First checks if the path format is valid using isValidPath,
285
+ * then checks if the path (or its parent directory if it's a file) is safe using isSafePath.
286
+ *
287
+ * @param fileOrDirectoryPath - The file or directory path to validate
288
+ * @returns true if the path is both valid and safe, false otherwise
289
+ */
290
+ static isValidAndSafePath(fileOrDirectoryPath) {
291
+ // First validate the path format
292
+ if (!this.isValidPath(fileOrDirectoryPath)) {
293
+ return false;
294
+ }
295
+ // Then validate if it's safe
296
+ return this.isSafePath(fileOrDirectoryPath);
297
+ }
298
+ }
299
+ exports.FileValidator = FileValidator;
300
+ //# sourceMappingURL=files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/utils/files.ts"],"names":[],"mappings":";;;;AAAA,kEAA6B;AAC7B,8DAAyB;AACzB,8DAAkC;AAElC;;GAEG;AACH,MAAa,aAAa;IACxB;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,QAA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AC,mBAAmB,CAAC,CAAA;SACxC;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,SAAS,CAAA;SACjB;IACH,CAAC;IAED,MAAM,CAAC,oBAAoB,CAAC,SAAiB;QAC3C,IAAI;YACF,iBAAE,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAC3C,OAAO,IAAI,CAAA;SACZ;QAAC,OAAO,KAAK,EAAE;YACd,uBAAuB;YACvB,OAAO,KAAK,CAAA;SACb;IACH,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,kBAAkB,CAAC,mBAAuC;QAC/D,iCAAiC;QACjC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,EAAE;YAC1C,OAAO,KAAK,CAAA;SACb;QAED,6BAA6B;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAA;IAC7C,CAAC;CACF;AA3TD,sCA2TC"}
@@ -0,0 +1,12 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ExchangeDescriptor, Gateway, GatewayDetails, RuntimeTargetSpace, TargetSpace } from '../types/types';
3
+ export declare const GatewayUtils: {
4
+ getGatewayId(requester: AxiosInstance, organizationId: string, environment: object, targetGwName: string): Promise<string>;
5
+ getGatewayDescription(requester: AxiosInstance, organizationId: string, environment: object, targetGwName: string): Promise<GatewayDetails>;
6
+ getGatewayStatus(requester: AxiosInstance, organizationId: string, environmentId: string, gatewayId: string): Promise<GatewayDetails>;
7
+ getPrivateSpace(requester: AxiosInstance, organizationId: string, environment: object, targetSpace: string): Promise<RuntimeTargetSpace>;
8
+ getTargetSpaceMetadata(requester: AxiosInstance, organizationId: string, targetSpaceId: string): Promise<TargetSpace>;
9
+ getGateways(requester: AxiosInstance, organizationId: string, environmentId: string): Promise<Gateway[]>;
10
+ intoMuleAppName(descriptor: ExchangeDescriptor): string;
11
+ getLatestGatewayVersion(requester: AxiosInstance, channelReleaseName: string): Promise<string>;
12
+ };
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GatewayUtils = void 0;
4
+ const constants_1 = require("./constants");
5
+ const error_factory_1 = require("../errors/error-factory");
6
+ const uris_1 = require("./uris");
7
+ exports.GatewayUtils = {
8
+ async getGatewayId(requester, organizationId, environment, targetGwName) {
9
+ const environmentId = environment['id'];
10
+ const environmentName = environment['name'];
11
+ const gatewaysResponse = await requester.get((0, uris_1.getAllGatewaysUrl)(organizationId, environmentId));
12
+ const gateways = gatewaysResponse.data;
13
+ const selectedGateway = gateways.content.find(gw => gw.name === targetGwName);
14
+ if (!selectedGateway) {
15
+ throw error_factory_1.ErrorFactory.gatewayNotFoundError(targetGwName, gateways.content, environmentId, environmentName);
16
+ }
17
+ return selectedGateway.id;
18
+ },
19
+ async getGatewayDescription(requester, organizationId, environment, targetGwName) {
20
+ const environmentId = environment['id'];
21
+ const gatewayId = await this.getGatewayId(requester, organizationId, environment, targetGwName);
22
+ // Get the url from /api/v1/organizations/{organizationId}/environments/{environmentId}/gateways/{gatewayId}
23
+ const gatewayResponse = await requester.get((0, uris_1.getGatewayDescriptionUrl)(organizationId, environmentId, gatewayId));
24
+ return gatewayResponse.data;
25
+ },
26
+ async getGatewayStatus(requester, organizationId, environmentId, gatewayId) {
27
+ // Get the url from /xapi/v1/organizations/{organizationId}/environments/{environmentId}/gateways/{gatewayId}
28
+ const gatewayResponse = await requester.get((0, uris_1.getGatewayStatusUrl)(organizationId, environmentId, gatewayId));
29
+ return gatewayResponse.data;
30
+ },
31
+ async getPrivateSpace(requester, organizationId, environment, targetSpace) {
32
+ const environmentId = environment['id'];
33
+ const environmentName = environment['name'];
34
+ const privateSpacesResponse = await requester.get((0, uris_1.getPrivateSpaceUrl)(organizationId, environmentId));
35
+ const targetPrivateSpace = privateSpacesResponse.data.content.find((item) => item.name === targetSpace);
36
+ if (!targetPrivateSpace) {
37
+ throw error_factory_1.ErrorFactory.privateSpaceNotFoundError(targetSpace, privateSpacesResponse.data.content, environmentId, environmentName);
38
+ }
39
+ return targetPrivateSpace;
40
+ },
41
+ async getTargetSpaceMetadata(requester, organizationId, targetSpaceId) {
42
+ const targetResponse = await requester.get((0, uris_1.getTargetSpaceMetadataUrl)(organizationId, targetSpaceId));
43
+ if (targetResponse.status !== 200) {
44
+ throw error_factory_1.ErrorFactory.unableToRetrieveTargetSpaceMetadata(targetSpaceId, targetResponse.statusText);
45
+ }
46
+ return targetResponse.data;
47
+ },
48
+ async getGateways(requester, organizationId, environmentId) {
49
+ const gatewaysResponse = await requester.get((0, uris_1.getAllGatewaysUrl)(organizationId, environmentId));
50
+ if (gatewaysResponse.status !== 200) {
51
+ throw error_factory_1.ErrorFactory.unableToRetrieveGateways(organizationId, environmentId, gatewaysResponse.statusText);
52
+ }
53
+ return gatewaysResponse.data.content;
54
+ },
55
+ intoMuleAppName(descriptor) {
56
+ return descriptor.assetId + constants_1.MULE_APPLICATION_SUFFIX;
57
+ },
58
+ async getLatestGatewayVersion(requester, channelReleaseName) {
59
+ // Get the latest gateway version for the specified channel
60
+ try {
61
+ const response = await requester.get((0, uris_1.getGatewayVersionsUrl)());
62
+ if (response.status !== 200) {
63
+ throw error_factory_1.ErrorFactory.unableToRetrieveGatewayVersions(response.statusText);
64
+ }
65
+ const versionsData = response.data;
66
+ // Check if the requested channel exists
67
+ if (!versionsData.channels[channelReleaseName]) {
68
+ const availableChannels = Object.keys(versionsData.channels);
69
+ throw error_factory_1.ErrorFactory.gatewayChannelNotFoundError(channelReleaseName, availableChannels);
70
+ }
71
+ const channel = versionsData.channels[channelReleaseName];
72
+ // Get the first version (latest) from the versions array
73
+ if (!channel.versions || channel.versions.length === 0) {
74
+ throw error_factory_1.ErrorFactory.noGatewayVersionsFoundError(channelReleaseName);
75
+ }
76
+ return channel.versions[0].displayName;
77
+ }
78
+ catch (error) {
79
+ throw error_factory_1.ErrorFactory.unableToRetrieveGatewayVersions(error instanceof Error ? error.message :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G,YAAY,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAA;YAEzD,yDAAyD;YACzD,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;gBACtD,MAAM,4BAAY,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,CAAA;aACnE;YAED,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;SACvC;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,4BAAY,CAAC,+BAA+B,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAA;SAC7G;IACH,CAAC;CAEF,CAAA"}
@@ -0,0 +1 @@
1
+ export declare function toSlug(input: string): string;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toSlug = void 0;
4
+ const WILDCARD = '-';
5
+ const WHITESPACE_PATTERN = /\s+/g;
6
+ const NON_LATIN_PATTERN = /[^\w-]+/g;
7
+ function toSlug(input) {
8
+ if (!input || input.trim() === '') {
9
+ return '';
10
+ }
11
+ const noWhitespace = input.trim().replace(WHITESPACE_PATTERN, WILDCARD);
12
+ const normalized = noWhitespace.normalize('NFD');
13
+ const slug = normalized.replace(NON_LATIN_PATTERN, '');
14
+ return slug.toLowerCase();
15
+ }
16
+ exports.toSlug = toSlug;
17
+ //# sourceMappingURL=naming.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"naming.js","sourceRoot":"","sources":["../../src/utils/naming.ts"],"names":[],"mappings":";;;AAAA,MAAM,QAAQ,GAAG,GAAG,CAAA;AACpB,MAAM,kBAAkB,GAAG,MAAM,CAAA;AACjC,MAAM,iBAAiB,GAAG,UAAU,CAAA;AAEpC,SAAgB,MAAM,CAAC,KAAa;IAClC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACjC,OAAO,EAAE,CAAA;KACV;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAA;IACvE,MAAM,UAAU,GAAG,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAChD,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAA;IAEtD,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;AAC3B,CAAC;AAVD,wBAUC"}
@@ -0,0 +1,2 @@
1
+ import { FunctionalValidation } from './validation-report';
2
+ export declare const buildJunitReport: (report: Array<FunctionalValidation>, reportPath?: string) => void;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildJunitReport = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
6
+ const builder = require('junit-report-builder');
7
+ const buildJunitReport = (report, reportPath = './') => {
8
+ const suite = builder.testSuite().name('Api Project Report');
9
+ report.forEach((line) => {
10
+ suite.testCase()
11
+ // .className(line.location)
12
+ .name(line.validationId)
13
+ .file(line.location)
14
+ .failure(line.message);
15
+ });
16
+ builder.writeTo(node_path_1.default.join(reportPath, 'api-project-report.xml'));
17
+ };
18
+ exports.buildJunitReport = buildJunitReport;
19
+ //# sourceMappingURL=junit-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"junit-report.js","sourceRoot":"","sources":["../../../src/utils/report/junit-report.ts"],"names":[],"mappings":";;;;AAAA,kEAA4B;AAE5B,MAAM,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAA;AAExC,MAAM,gBAAgB,GAAG,CAAC,MAAmC,EAAE,UAAU,GAAG,IAAI,EAAE,EAAE;IACzF,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;IAE5D,MAAM,CAAC,OAAO,CAAC,CAAC,IAA0B,EAAE,EAAE;QAC5C,KAAK,CAAC,QAAQ,EAAE;YAChB,4BAA4B;aAC3B,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;aACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;aACnB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACxB,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,OAAO,CAAC,mBAAI,CAAC,IAAI,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC,CAAA;AAClE,CAAC,CAAA;AAZY,QAAA,gBAAgB,oBAY5B"}
@@ -0,0 +1,27 @@
1
+ export type ValidationReport = {
2
+ isLegacy?: boolean;
3
+ syntaxValidations?: Array<FunctionalValidation>;
4
+ functionalValidations?: Array<FunctionalValidation>;
5
+ };
6
+ export type FunctionalValidation = {
7
+ validationId?: string;
8
+ severityLevel: string;
9
+ message: string;
10
+ targetProperty?: string;
11
+ targetNode?: string;
12
+ location?: string;
13
+ position?: Range;
14
+ source?: any;
15
+ };
16
+ export type LintReport = {
17
+ id: string;
18
+ results: Array<FunctionalValidation>;
19
+ };
20
+ export declare class Range {
21
+ columnFrom: number;
22
+ lineFrom: number;
23
+ lineTo: number;
24
+ columnTo: number;
25
+ constructor(lineFrom?: number, columnFrom?: number, lineTo?: number, columnTo?: number);
26
+ toString(): string;
27
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Range = void 0;
4
+ class Range {
5
+ constructor(lineFrom = 0, columnFrom = 0, lineTo = 0, columnTo = 0) {
6
+ this.lineFrom = lineFrom;
7
+ this.columnFrom = columnFrom;
8
+ this.lineTo = lineTo;
9
+ this.columnTo = columnTo;
10
+ }
11
+ toString() {
12
+ return `[(${this.lineFrom},${this.columnFrom})-(${this.lineTo},${this.columnTo})]`;
13
+ }
14
+ }
15
+ exports.Range = Range;
16
+ //# sourceMappingURL=validation-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-report.js","sourceRoot":"","sources":["../../../src/utils/report/validation-report.ts"],"names":[],"mappings":";;;AAsBA,MAAa,KAAK;IAMd,YAAY,QAAQ,GAAG,CAAC,EAAE,UAAU,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,QAAQ,GAAG,CAAC;QAChE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,QAAQ;QACN,OAAO,KAAK,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU,MAAM,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAA;IACpF,CAAC;CACJ;AAhBD,sBAgBC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * URI utility functions for API endpoints
3
+ */
4
+ /**
5
+ * Get the URI for checking if an asset exists in exchange
6
+ */
7
+ export declare const getAssetExistsUri: (groupId: string, assetId: string, version: string) => string;
8
+ /**
9
+ * Get the URI for publishing an asset to exchange
10
+ */
11
+ export declare const getPublishAssetUri: (groupId: string, assetId: string, version: string) => string;
12
+ /**
13
+ * Get the URI for getting asset information from exchange
14
+ */
15
+ export declare const getAssetInfoUri: (groupId: string, assetId: string) => string;
16
+ /**
17
+ * Get the exchange URL for an asset
18
+ */
19
+ export declare const getExchangeUrl: (host: string, groupId: string, assetId: string) => string;
20
+ export declare const getAllGatewaysUrl: (organizationId: string, environmentId: string) => string;
21
+ export declare const getGatewayDescriptionUrl: (organizationId: string, environmentId: string, gatewayId: string) => string;
22
+ export declare const getGatewayStatusUrl: (organizationId: string, environmentId: string, gatewayId: string) => string;
23
+ export declare const getPrivateSpaceUrl: (organizationId: string, environmentId: string) => string;
24
+ export declare const getTargetSpaceMetadataUrl: (organizationId: string, targetSpaceId: string) => string;
25
+ export declare const getGatewayVersionsUrl: () => string;
26
+ export declare const getAllDomainsUrl: (organizationId: string, environmentId: string, targetPrivateSpaceId: string) => string;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * URI utility functions for API endpoints
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getAllDomainsUrl = exports.getGatewayVersionsUrl = exports.getTargetSpaceMetadataUrl = exports.getPrivateSpaceUrl = exports.getGatewayStatusUrl = exports.getGatewayDescriptionUrl = exports.getAllGatewaysUrl = exports.getExchangeUrl = exports.getAssetInfoUri = exports.getPublishAssetUri = exports.getAssetExistsUri = void 0;
7
+ /**
8
+ * Get the URI for checking if an asset exists in exchange
9
+ */
10
+ const getAssetExistsUri = (groupId, assetId, version) => `/exchange/api/v2/assets/${groupId}/${assetId}/${version}`;
11
+ exports.getAssetExistsUri = getAssetExistsUri;
12
+ /**
13
+ * Get the URI for publishing an asset to exchange
14
+ */
15
+ const getPublishAssetUri = (groupId, assetId, version) => `/exchange/api/v2/organizations/${groupId}/assets/${groupId}/${assetId}/${version}`;
16
+ exports.getPublishAssetUri = getPublishAssetUri;
17
+ /**
18
+ * Get the URI for getting asset information from exchange
19
+ */
20
+ const getAssetInfoUri = (groupId, assetId) => `/exchange/api/v2/assets/${groupId}/${assetId}/asset`;
21
+ exports.getAssetInfoUri = getAssetInfoUri;
22
+ /**
23
+ * Get the exchange URL for an asset
24
+ */
25
+ const getExchangeUrl = (host, groupId, assetId) => `https://${host}/exchange/${groupId}/${assetId}`;
26
+ exports.getExchangeUrl = getExchangeUrl;
27
+ const getAllGatewaysUrl = (organizationId, environmentId) => `/gatewaymanager/api/v1/organizations/${organizationId}/environments/${environmentId}/gateways`;
28
+ exports.getAllGatewaysUrl = getAllGatewaysUrl;
29
+ const getGatewayDescriptionUrl = (organizationId, environmentId, gatewayId) => `/gatewaymanager/api/v1/organizations/${organizationId}/environments/${environmentId}/gateways/${gatewayId}`;
30
+ exports.getGatewayDescriptionUrl = getGatewayDescriptionUrl;
31
+ const getGatewayStatusUrl = (organizationId, environmentId, gatewayId) => `/gatewaymanager/xapi/v1/organizations/${organizationId}/environments/${environmentId}/gateways/${gatewayId}`;
32
+ exports.getGatewayStatusUrl = getGatewayStatusUrl;
33
+ const getPrivateSpaceUrl = (organizationId, environmentId) => `/gatewaymanager/xapi/v1/organizations/${organizationId}/environments/${environmentId}/gateways/targets`;
34
+ exports.getPrivateSpaceUrl = getPrivateSpaceUrl;
35
+ const getTargetSpaceMetadataUrl = (organizationId, targetSpaceId) => `/runtimefabric/api/organizations/${organizationId}/targets/${targetSpaceId}`;
36
+ exports.getTargetSpaceMetadataUrl = getTargetSpaceMetadataUrl;
37
+ const getGatewayVersionsUrl = () => `/gatewaymanager/xapi/v1/gateway/versions`;
38
+ exports.getGatewayVersionsUrl = getGatewayVersionsUrl;
39
+ const getAllDomainsUrl = (organizationId, environmentId, targetPrivateSpaceId) => `/runtimefabric/api/organizations/${organizationId}/targets/${targetPrivateSpaceId}/environments/${environmentId}/domains?sendAppUniqueId=true`;
40
+ exports.getAllDomainsUrl = getAllDomainsUrl;
41
+ //# sourceMappingURL=uris.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uris.js","sourceRoot":"","sources":["../../src/utils/uris.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH;;GAEG;AACI,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAE,OAAe,EAAE,OAAe,EAAU,EAAE,CAC7F,2BAA2B,OAAO,IAAI,OAAO,IAAI,OAAO,EAAE,CAAA;AAD/C,QAAA,iBAAiB,qBAC8B;AAE5D;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,OAAe,EAAE,OAAe,EAAU,EAAE,CAC9F,kCAAkC,OAAO,WAAW,OAAO,IAAI,OAAO,IAAI,OAAO,EAAE,CAAA;AADxE,QAAA,kBAAkB,sBACsD;AA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E,CACtH,oCAAoC,cAAc,YAAY,oBAAoB,iBAAiB,aAAa,+BAA+B,CAAA;AADpI,QAAA,gBAAgB,oBACoH"}
@@ -0,0 +1,6 @@
1
+ import { Variable, Variables } from '../types/types';
2
+ export declare const VariablesHelper: {
3
+ flattenVariables(variables: Variables, prefix?: string): {
4
+ [key: string]: Variable;
5
+ };
6
+ };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VariablesHelper = void 0;
4
+ exports.VariablesHelper = {
5
+ flattenVariables(variables, prefix) {
6
+ let collectedVariables = {};
7
+ if (!variables) {
8
+ return collectedVariables;
9
+ }
10
+ for (const [key, value] of Object.entries(variables)) {
11
+ const fullKey = prefix ? `${prefix}.${key}` : key;
12
+ if (typeof value === 'object' && value !== null && 'description' in value) {
13
+ collectedVariables[fullKey] = value;
14
+ }
15
+ else if (typeof value === 'object' && value !== null) {
16
+ collectedVariables = { ...this.flattenVariables(value, fullKey), ...collectedVariables };
17
+ }
18
+ }
19
+ return collectedVariables;
20
+ },
21
+ };
22
+ //# sourceMappingURL=variables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variables.js","sourceRoot":"","sources":["../../src/utils/variables.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAG;IAC7B,gBAAgB,CAAC,SAAoB,EAAE,MAAe;QACpD,IAAI,kBAAkB,GAAiC,EAAE,CAAA;QACzD,IAAI,CAAC,SAAS,EAAE;YACd,OAAO,kBAAkB,CAAA;SAC1B;QAED,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YACpD,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;YACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,aAAa,IAAI,KAAK,EAAE;gBACzE,kBAAkB,CAAC,OAAO,CAAC,GAAG,KAAK,CAAA;aACpC;iBAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE;gBACtD,kBAAkB,GAAG,EAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAkB,EAAE,OAAO,CAAC,EAAE,GAAG,kBAAkB,EAAC,CAAA;aACpG;SACF;QAED,OAAO,kBAAkB,CAAA;IAC3B,CAAC;CACF,CAAA"}