@interopio/iocd-cli 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/components.command.d.ts.map +1 -1
- package/dist/commands/components.command.js +21 -2
- package/dist/commands/components.command.js.map +1 -1
- package/dist/commands/license.command.d.ts.map +1 -1
- package/dist/commands/license.command.js +63 -11
- package/dist/commands/license.command.js.map +1 -1
- package/dist/services/components/component.d.ts +6 -1
- package/dist/services/components/component.d.ts.map +1 -1
- package/dist/services/components/components.registry.d.ts.map +1 -1
- package/dist/services/components/components.registry.js +7 -0
- package/dist/services/components/components.registry.js.map +1 -1
- package/dist/services/components/components.service.d.ts +2 -5
- package/dist/services/components/components.service.d.ts.map +1 -1
- package/dist/services/components/components.service.js +8 -11
- package/dist/services/components/components.service.js.map +1 -1
- package/dist/services/components/file.helper.js +2 -2
- package/dist/services/components/file.helper.js.map +1 -1
- package/dist/services/components/platform.utils.d.ts +92 -15
- package/dist/services/components/platform.utils.d.ts.map +1 -1
- package/dist/services/components/platform.utils.js +221 -35
- package/dist/services/components/platform.utils.js.map +1 -1
- package/dist/services/components/stores/github.store.d.ts +7 -9
- package/dist/services/components/stores/github.store.d.ts.map +1 -1
- package/dist/services/components/stores/github.store.js +58 -54
- package/dist/services/components/stores/github.store.js.map +1 -1
- package/dist/services/components/stores/local.store.d.ts +2 -2
- package/dist/services/components/stores/local.store.d.ts.map +1 -1
- package/dist/services/components/stores/local.store.js +6 -2
- package/dist/services/components/stores/local.store.js.map +1 -1
- package/dist/services/components/stores/s3.store.d.ts +2 -2
- package/dist/services/components/stores/s3.store.d.ts.map +1 -1
- package/dist/services/components/stores/s3.store.js +3 -1
- package/dist/services/components/stores/s3.store.js.map +1 -1
- package/dist/services/components/stores/store.d.ts +2 -2
- package/dist/services/components/stores/store.d.ts.map +1 -1
- package/dist/services/components/version.selector.d.ts +4 -0
- package/dist/services/components/version.selector.d.ts.map +1 -0
- package/dist/services/components/version.selector.js +52 -0
- package/dist/services/components/version.selector.js.map +1 -0
- package/dist/services/config/cli.config.d.ts +8 -3
- package/dist/services/config/cli.config.d.ts.map +1 -1
- package/dist/services/config/config.service.d.ts.map +1 -1
- package/dist/services/config/config.service.js +7 -3
- package/dist/services/config/config.service.js.map +1 -1
- package/dist/services/create.service.d.ts +1 -1
- package/dist/services/create.service.d.ts.map +1 -1
- package/dist/services/create.service.js +18 -15
- package/dist/services/create.service.js.map +1 -1
- package/dist/services/installer/installer.service.js +1 -1
- package/dist/services/installer/installer.service.js.map +1 -1
- package/dist/services/installer/macOS.helper.js +10 -2
- package/dist/services/installer/macOS.helper.js.map +1 -1
- package/dist/services/installer/prerequisites.js +3 -3
- package/dist/services/installer/prerequisites.js.map +1 -1
- package/dist/services/license.service.d.ts +101 -3
- package/dist/services/license.service.d.ts.map +1 -1
- package/dist/services/license.service.js +166 -6
- package/dist/services/license.service.js.map +1 -1
- package/dist/services/modifications/modifications.service.d.ts.map +1 -1
- package/dist/services/modifications/modifications.service.js +12 -4
- package/dist/services/modifications/modifications.service.js.map +1 -1
- package/dist/templates/ioconnect-desktop/forge.config.js +14 -4
- package/dist/templates/ioconnect-desktop/iocd.cli.config.json +11 -2
- package/dist/templates/ioconnect-desktop/package.json +0 -7
- package/package.json +3 -1
|
@@ -10,10 +10,16 @@ const path_1 = require("path");
|
|
|
10
10
|
* - Component filename parsing (both OS-specific and OS-agnostic)
|
|
11
11
|
* - Current platform detection
|
|
12
12
|
* - Component matching logic
|
|
13
|
+
* - Version parsing with build timestamp support
|
|
13
14
|
*
|
|
14
|
-
* Supports
|
|
15
|
-
* 1. OS-specific: <name
|
|
16
|
-
* 2. OS-agnostic: <name
|
|
15
|
+
* Supports component naming patterns:
|
|
16
|
+
* 1. OS-specific: <name>-<version>-<arch>-<platform>.ext (e.g., iocd-v10.0.0-build.123-darwin-arm64.dmg)
|
|
17
|
+
* 2. OS-agnostic: <name>-<version>.ext (e.g., webapp-v10.0.0-build.123.zip)
|
|
18
|
+
*
|
|
19
|
+
* Version formats supported:
|
|
20
|
+
* - v<X.Y.Z> (e.g., v10.0.0)
|
|
21
|
+
* - v<X.Y.Z>-build.<TIMESTAMP> (e.g., v10.0.0-build.20250927121929)
|
|
22
|
+
* - v<X.Y.Z.B> (e.g., v10.0.0.1)
|
|
17
23
|
*/
|
|
18
24
|
class ComponentPlatformUtils {
|
|
19
25
|
/**
|
|
@@ -32,14 +38,14 @@ class ComponentPlatformUtils {
|
|
|
32
38
|
return 'darwin';
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
35
|
-
* Parse component information from filename
|
|
41
|
+
* Parse component information from filename
|
|
36
42
|
*
|
|
37
|
-
* Supports
|
|
38
|
-
* - OS-specific: <component
|
|
39
|
-
* - OS-agnostic: <component
|
|
43
|
+
* Supports component patterns:
|
|
44
|
+
* - OS-specific: <component>-<version>-<arch>-<platform>.<ext>
|
|
45
|
+
* - OS-agnostic: <component>-<version>.<ext>
|
|
40
46
|
*
|
|
41
47
|
* @param filename The component filename to parse
|
|
42
|
-
* @returns Parsed component info
|
|
48
|
+
* @returns Parsed component info
|
|
43
49
|
* @throws Error if parsing fails
|
|
44
50
|
*/
|
|
45
51
|
static parseComponentFilename(filename) {
|
|
@@ -49,45 +55,106 @@ class ComponentPlatformUtils {
|
|
|
49
55
|
/**
|
|
50
56
|
* Parse component information from a name (not filename)
|
|
51
57
|
*
|
|
52
|
-
* Supports
|
|
53
|
-
* - OS-specific: <component
|
|
54
|
-
* - OS-
|
|
58
|
+
* Supports component patterns:
|
|
59
|
+
* - OS-specific with platform-arch: <component>-<version>-<platform>-<arch>
|
|
60
|
+
* - OS-specific with platform only: <component>-<version>-<platform>
|
|
61
|
+
* - OS-agnostic: <component>-<version>
|
|
55
62
|
*
|
|
56
|
-
* @param
|
|
57
|
-
* @returns Parsed component info
|
|
63
|
+
* @param name The component name to parse
|
|
64
|
+
* @returns Parsed component info
|
|
58
65
|
* @throws Error if parsing fails
|
|
59
66
|
*/
|
|
60
67
|
static parseComponentName(name) {
|
|
61
|
-
// Pattern 1: OS-specific format <component
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
// Pattern 1: OS-specific format with platform-arch order: <component>-<version>[-<platform>-<arch> OR .<platform>-<arch>]
|
|
69
|
+
// Examples:
|
|
70
|
+
// - iocd-v10.0.1-build.20250827150311-win32-x64 (dash separated)
|
|
71
|
+
// - iocd-v10.0.0-build.20250927121929.darwin-arm64 (dot separated after build)
|
|
72
|
+
// Must have EXACTLY 4 parts: component, version, platform, arch
|
|
73
|
+
const osSpecificPlatformArchPattern = /^(.+)-(v\d+\.\d+\.\d+(?:\.\d+)?(?:-build\.\d+)?)[\.-]([^-]+)-([^-.]+)$/;
|
|
74
|
+
const osSpecificPlatformArchMatch = name.match(osSpecificPlatformArchPattern);
|
|
75
|
+
if (osSpecificPlatformArchMatch) {
|
|
76
|
+
const [, componentName, version, platformPart, arch] = osSpecificPlatformArchMatch;
|
|
77
|
+
// Validate that this is actually a 4-part pattern by checking if arch looks like an architecture
|
|
78
|
+
const validArchs = ['x64', 'x86', 'arm64', 'ia32', 'arm'];
|
|
79
|
+
if (!validArchs.includes(arch.toLowerCase())) {
|
|
80
|
+
// This might be a platform-only pattern that got matched incorrectly, skip to next pattern
|
|
81
|
+
// Fall through to Pattern 2
|
|
70
82
|
}
|
|
71
|
-
else
|
|
72
|
-
|
|
83
|
+
else {
|
|
84
|
+
const versionInfo = this.parseVersionString(version);
|
|
85
|
+
// Map platform names that might not match our enum exactly
|
|
86
|
+
let platform;
|
|
87
|
+
if (platformPart === 'win32' || platformPart.startsWith('win')) {
|
|
88
|
+
platform = 'win32';
|
|
89
|
+
}
|
|
90
|
+
else if (platformPart === 'darwin' || platformPart.startsWith('mac') || platformPart.startsWith('osx')) {
|
|
91
|
+
platform = 'darwin';
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
platform = platformPart;
|
|
95
|
+
}
|
|
96
|
+
const result = {
|
|
97
|
+
name: componentName,
|
|
98
|
+
version: version,
|
|
99
|
+
baseVersion: versionInfo.baseVersion,
|
|
100
|
+
isOsSpecific: true,
|
|
101
|
+
platform: platform,
|
|
102
|
+
arch: arch
|
|
103
|
+
};
|
|
104
|
+
if (versionInfo.buildInfo) {
|
|
105
|
+
result.buildInfo = versionInfo.buildInfo;
|
|
106
|
+
}
|
|
107
|
+
if (versionInfo.buildNumber) {
|
|
108
|
+
result.buildNumber = versionInfo.buildNumber;
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
73
111
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
112
|
+
}
|
|
113
|
+
// Pattern 2: OS-specific format with platform only <component>-<version>[-<platform> OR .<platform>]
|
|
114
|
+
// Examples:
|
|
115
|
+
// - bbgv2-v2.0.0.1-win32 (dash separated)
|
|
116
|
+
// - myapp-v1.0.0-build.123-darwin (dash separated with build)
|
|
117
|
+
// - myapp-v1.0.0-build.123.darwin (dot separated after build)
|
|
118
|
+
const osSpecificPlatformOnlyPattern = /^(.+)-(v\d+\.\d+\.\d+(?:\.\d+)?(?:-build\.\d+)?)[\.-](darwin|win32)$/;
|
|
119
|
+
const osSpecificPlatformOnlyMatch = name.match(osSpecificPlatformOnlyPattern);
|
|
120
|
+
if (osSpecificPlatformOnlyMatch) {
|
|
121
|
+
const [, componentName, version, platform] = osSpecificPlatformOnlyMatch;
|
|
122
|
+
const versionInfo = this.parseVersionString(version);
|
|
123
|
+
const result = {
|
|
124
|
+
name: componentName,
|
|
125
|
+
version: version,
|
|
126
|
+
baseVersion: versionInfo.baseVersion,
|
|
77
127
|
isOsSpecific: true,
|
|
78
128
|
platform: platform
|
|
79
129
|
};
|
|
130
|
+
if (versionInfo.buildInfo) {
|
|
131
|
+
result.buildInfo = versionInfo.buildInfo;
|
|
132
|
+
}
|
|
133
|
+
if (versionInfo.buildNumber) {
|
|
134
|
+
result.buildNumber = versionInfo.buildNumber;
|
|
135
|
+
}
|
|
136
|
+
return result;
|
|
80
137
|
}
|
|
81
|
-
// Pattern
|
|
82
|
-
// e.g., webapp-
|
|
83
|
-
const osAgnosticPattern = /^(.+)-v
|
|
138
|
+
// Pattern 3: OS-agnostic format <component>-<version>
|
|
139
|
+
// e.g., webapp-v10.0.0-build.123 or webapp-v10.0.0
|
|
140
|
+
const osAgnosticPattern = /^(.+)-(v\d+\.\d+\.\d+(?:\.\d+)?(?:-build\.\d+)?)$/;
|
|
84
141
|
const osAgnosticMatch = name.match(osAgnosticPattern);
|
|
85
142
|
if (osAgnosticMatch) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
143
|
+
const [, componentName, version] = osAgnosticMatch;
|
|
144
|
+
const versionInfo = this.parseVersionString(version);
|
|
145
|
+
const result = {
|
|
146
|
+
name: componentName,
|
|
147
|
+
version: version,
|
|
148
|
+
baseVersion: versionInfo.baseVersion,
|
|
89
149
|
isOsSpecific: false
|
|
90
150
|
};
|
|
151
|
+
if (versionInfo.buildInfo) {
|
|
152
|
+
result.buildInfo = versionInfo.buildInfo;
|
|
153
|
+
}
|
|
154
|
+
if (versionInfo.buildNumber) {
|
|
155
|
+
result.buildNumber = versionInfo.buildNumber;
|
|
156
|
+
}
|
|
157
|
+
return result;
|
|
91
158
|
}
|
|
92
159
|
throw new Error(`${name} does not match expected component patterns.`);
|
|
93
160
|
}
|
|
@@ -130,8 +197,127 @@ class ComponentPlatformUtils {
|
|
|
130
197
|
return supportedExtensions.some(ext => lowerFilename.endsWith(ext));
|
|
131
198
|
}
|
|
132
199
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
200
|
+
* Parse version string to extract base version and build information
|
|
201
|
+
*
|
|
202
|
+
* @param version Version string (e.g., "v10.0.0-build.20250927121929")
|
|
203
|
+
* @returns Parsed version info
|
|
204
|
+
*/
|
|
205
|
+
static parseVersionString(version) {
|
|
206
|
+
// Remove 'v' prefix if present
|
|
207
|
+
const cleanVersion = version.startsWith('v') ? version.substring(1) : version;
|
|
208
|
+
// Check for build suffix
|
|
209
|
+
const buildMatch = cleanVersion.match(/^(\d+\.\d+\.\d+(?:\.\d+)?)-build\.(\d+)$/);
|
|
210
|
+
if (buildMatch) {
|
|
211
|
+
return {
|
|
212
|
+
baseVersion: buildMatch[1],
|
|
213
|
+
buildInfo: `build.${buildMatch[2]}`,
|
|
214
|
+
buildNumber: Number(buildMatch[2]),
|
|
215
|
+
timestamp: buildMatch[2]
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
// No build suffix
|
|
219
|
+
return {
|
|
220
|
+
baseVersion: cleanVersion
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Parse platform part to extract platform and architecture
|
|
225
|
+
*
|
|
226
|
+
* @param platformPart Platform string (e.g., "darwin-arm64", "win32", "darwin")
|
|
227
|
+
* @returns Parsed platform info
|
|
228
|
+
*/
|
|
229
|
+
static parsePlatformPart(platformPart) {
|
|
230
|
+
const parts = platformPart.toLowerCase().split('-');
|
|
231
|
+
if (parts.length === 1) {
|
|
232
|
+
// Simple platform (e.g., "darwin", "win32")
|
|
233
|
+
const platform = parts[0];
|
|
234
|
+
if (platform === 'darwin' || platform === 'win32') {
|
|
235
|
+
return { platform: platform };
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
else if (parts.length === 2) {
|
|
239
|
+
// Platform with arch (e.g., "darwin-arm64", "win32-x64")
|
|
240
|
+
const [platform, arch] = parts;
|
|
241
|
+
if (platform === 'darwin' || platform === 'win32') {
|
|
242
|
+
return {
|
|
243
|
+
platform: platform,
|
|
244
|
+
arch: arch
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
throw new Error(`Unable to parse platform part: ${platformPart}`);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Normalize version string by removing build suffix
|
|
252
|
+
*
|
|
253
|
+
* @param version Version string
|
|
254
|
+
* @returns Base version without build info
|
|
255
|
+
*/
|
|
256
|
+
static normalizeVersion(version) {
|
|
257
|
+
return this.parseVersionString(version).baseVersion;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Compare two version strings with build timestamp support
|
|
261
|
+
* Priority: non-build > newer build > older build
|
|
262
|
+
*
|
|
263
|
+
* @param a First version string
|
|
264
|
+
* @param b Second version string
|
|
265
|
+
* @returns -1 if a < b, 1 if a > b, 0 if equal
|
|
266
|
+
*/
|
|
267
|
+
static compareVersionsWithBuild(a, b) {
|
|
268
|
+
if (a === 'latest' && b === 'latest')
|
|
269
|
+
return 0;
|
|
270
|
+
if (a === 'latest')
|
|
271
|
+
return 1;
|
|
272
|
+
if (b === 'latest')
|
|
273
|
+
return -1;
|
|
274
|
+
const aInfo = this.parseVersionString(a);
|
|
275
|
+
const bInfo = this.parseVersionString(b);
|
|
276
|
+
// First compare base versions
|
|
277
|
+
const baseComparison = this.compareSemanticVersions(aInfo.baseVersion, bInfo.baseVersion);
|
|
278
|
+
if (baseComparison !== 0) {
|
|
279
|
+
return baseComparison;
|
|
280
|
+
}
|
|
281
|
+
// Base versions are equal, now consider build info
|
|
282
|
+
// Non-build versions are preferred over build versions
|
|
283
|
+
if (!aInfo.buildInfo && !bInfo.buildInfo)
|
|
284
|
+
return 0;
|
|
285
|
+
if (!aInfo.buildInfo && bInfo.buildInfo)
|
|
286
|
+
return 1; // a preferred (no build)
|
|
287
|
+
if (aInfo.buildInfo && !bInfo.buildInfo)
|
|
288
|
+
return -1; // b preferred (no build)
|
|
289
|
+
// Both have build info, compare timestamps (higher is newer)
|
|
290
|
+
if (aInfo.timestamp && bInfo.timestamp) {
|
|
291
|
+
const aTimestamp = parseInt(aInfo.timestamp);
|
|
292
|
+
const bTimestamp = parseInt(bInfo.timestamp);
|
|
293
|
+
return aTimestamp > bTimestamp ? 1 : aTimestamp < bTimestamp ? -1 : 0;
|
|
294
|
+
}
|
|
295
|
+
return 0;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Compare semantic version strings (X.Y.Z or X.Y.Z.B)
|
|
299
|
+
*
|
|
300
|
+
* @param a First version
|
|
301
|
+
* @param b Second version
|
|
302
|
+
* @returns -1 if a < b, 1 if a > b, 0 if equal
|
|
303
|
+
*/
|
|
304
|
+
static compareSemanticVersions(a, b) {
|
|
305
|
+
const aParts = a.split('.').map(Number);
|
|
306
|
+
const bParts = b.split('.').map(Number);
|
|
307
|
+
const maxLength = Math.max(aParts.length, bParts.length);
|
|
308
|
+
for (let i = 0; i < maxLength; i++) {
|
|
309
|
+
const aPart = aParts[i] || 0;
|
|
310
|
+
const bPart = bParts[i] || 0;
|
|
311
|
+
if (aPart > bPart)
|
|
312
|
+
return 1;
|
|
313
|
+
if (aPart < bPart)
|
|
314
|
+
return -1;
|
|
315
|
+
}
|
|
316
|
+
return 0;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Compare two version strings for sorting (backwards compatibility)
|
|
320
|
+
* For new build-aware comparison, use compareVersionsWithBuild()
|
|
135
321
|
*
|
|
136
322
|
* @param a First version string
|
|
137
323
|
* @param b Second version string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.utils.js","sourceRoot":"","sources":["../../../src/services/components/platform.utils.ts"],"names":[],"mappings":";;;AACA,+BAA6B;
|
|
1
|
+
{"version":3,"file":"platform.utils.js","sourceRoot":"","sources":["../../../src/services/components/platform.utils.ts"],"names":[],"mappings":";;;AACA,+BAA6B;AAkC7B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,sBAAsB;IAE/B;;OAEG;IACH,MAAM,CAAC,kBAAkB;QACrB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAClC,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACvB,OAAO,OAAO,CAAC;QACnB,CAAC;QACD,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACxB,uCAAuC;YACvC,OAAO,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AI,CAAC,KAAK,QAAQ;YAAE,OAAO,CAAC,CAAC,CAAC;QAE9B,kFAAkF;QAClF,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC;QACpB,OAAO,CAAC,CAAC;IACb,CAAC;CACJ;AA3VD,wDA2VC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentWithVersion } from "../component";
|
|
2
2
|
import { ComponentsStore } from "./store";
|
|
3
3
|
export declare class GitHubComponentsStore implements ComponentsStore {
|
|
4
4
|
private baseUrl;
|
|
5
|
-
private
|
|
5
|
+
private usePrereleases;
|
|
6
6
|
private logger;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
private cachedReleases;
|
|
8
|
+
constructor(repo?: string, usePrereleases?: boolean);
|
|
9
|
+
getAll(): Promise<ComponentWithVersion[]>;
|
|
9
10
|
download(name: string, version: string): Promise<{
|
|
10
11
|
name: string;
|
|
11
12
|
data: any;
|
|
@@ -15,13 +16,10 @@ export declare class GitHubComponentsStore implements ComponentsStore {
|
|
|
15
16
|
/**
|
|
16
17
|
* Find a specific release by component name and version
|
|
17
18
|
*/
|
|
18
|
-
private
|
|
19
|
-
/**
|
|
20
|
-
* Find the appropriate asset for the current platform
|
|
21
|
-
*/
|
|
22
|
-
private findAssetForPlatform;
|
|
19
|
+
private findComponent;
|
|
23
20
|
/**
|
|
24
21
|
* Get all releases without parsing them into components
|
|
22
|
+
* Will filter out pre-releases if usePrereleases is false
|
|
25
23
|
*/
|
|
26
24
|
private getAllReleases;
|
|
27
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.store.d.ts","sourceRoot":"","sources":["../../../../src/services/components/stores/github.store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"github.store.d.ts","sourceRoot":"","sources":["../../../../src/services/components/stores/github.store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAwB1C,qBAAa,qBAAsB,YAAW,eAAe;IACzD,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,cAAc,CAAqC;gBAE/C,IAAI,GAAE,MAA8C,EAAE,cAAc,GAAE,OAAe;IAK3F,MAAM,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAMzC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IA6B9F,OAAO;IAKd;;OAEG;YACW,aAAa;IAmC3B;;;OAGG;YACW,cAAc;IA2C5B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAgBtB,+DAA+D;IAC/D,OAAO,CAAC,aAAa;CA6BxB"}
|
|
@@ -4,17 +4,19 @@ exports.GitHubComponentsStore = void 0;
|
|
|
4
4
|
const error_handler_1 = require("../../../utils/error.handler");
|
|
5
5
|
const logger_1 = require("../../../utils/logger");
|
|
6
6
|
const platform_utils_1 = require("../platform.utils");
|
|
7
|
+
const version_selector_1 = require("../version.selector");
|
|
7
8
|
;
|
|
8
9
|
// The github release package name is in format {{component}}-{{version}}
|
|
9
10
|
// each release has multiple assets; each asset can be platform specific
|
|
10
11
|
// each release has a tag the same as the release name; this can be used to get a specific release
|
|
11
12
|
class GitHubComponentsStore {
|
|
12
13
|
baseUrl = '';
|
|
13
|
-
|
|
14
|
+
usePrereleases = false;
|
|
14
15
|
logger = logger_1.Logger.getInstance();
|
|
15
|
-
|
|
16
|
+
cachedReleases = null;
|
|
17
|
+
constructor(repo = "interopio/desktop-releases/releases", usePrereleases = false) {
|
|
16
18
|
this.baseUrl = `https://api.github.com/repos/${repo}`;
|
|
17
|
-
this.
|
|
19
|
+
this.usePrereleases = usePrereleases;
|
|
18
20
|
}
|
|
19
21
|
async getAll() {
|
|
20
22
|
const allReleases = await this.getAllReleases();
|
|
@@ -22,77 +24,65 @@ class GitHubComponentsStore {
|
|
|
22
24
|
}
|
|
23
25
|
async download(name, version) {
|
|
24
26
|
// Find the specific release and asset for this component
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
throw new Error(`No asset found for component in ${name}@${version} on platform '${platform_utils_1.ComponentPlatformUtils.getCurrentPlatform()}'`);
|
|
27
|
+
const targetComponent = await this.findComponent(name, version);
|
|
28
|
+
if (!targetComponent) {
|
|
29
|
+
throw new Error(`No component found for ${name}@${version}`);
|
|
29
30
|
}
|
|
30
31
|
// Download the asset
|
|
31
|
-
this.logger.
|
|
32
|
-
const response = await fetch(
|
|
32
|
+
this.logger.debug(`Downloading ${targetComponent.name} from ${targetComponent.downloadUrl}`);
|
|
33
|
+
const response = await fetch(targetComponent.downloadUrl);
|
|
33
34
|
if (!response.ok) {
|
|
34
35
|
throw new Error(`Failed to download asset: ${response.status} ${response.statusText}`);
|
|
35
36
|
}
|
|
36
37
|
// Get the data as buffer
|
|
37
38
|
const buffer = await response.arrayBuffer();
|
|
38
|
-
this.logger.info(`Downloaded ${name}@${version || 'latest'} (${
|
|
39
|
+
this.logger.info(`Downloaded ${name}@${version || 'latest'} (${targetComponent.name}) successfully!`);
|
|
39
40
|
return {
|
|
40
41
|
name: name,
|
|
41
42
|
data: new Uint8Array(buffer),
|
|
42
|
-
filename:
|
|
43
|
+
filename: targetComponent.filename
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
getInfo() {
|
|
46
|
-
|
|
47
|
+
const prereleaseStatus = this.usePrereleases ? "including pre-releases" : "stable releases only";
|
|
48
|
+
return `GitHub Releases Store: ${this.baseUrl} (${prereleaseStatus})`;
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
49
51
|
* Find a specific release by component name and version
|
|
50
52
|
*/
|
|
51
|
-
async
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
// Return the most recent release (first in the list)
|
|
60
|
-
return componentReleases[0];
|
|
53
|
+
async findComponent(componentName, version) {
|
|
54
|
+
// If no version specified, find the latest release for this component
|
|
55
|
+
const allReleases = await this.getAllReleases();
|
|
56
|
+
// filter out by component name
|
|
57
|
+
let componentReleases = allReleases.filter(release => release.tag_name.startsWith(`${componentName}-v`));
|
|
58
|
+
if (componentReleases.length === 0) {
|
|
59
|
+
const prereleaseNote = this.usePrereleases ? "" : " (pre-releases excluded - set usePrereleases: true to include them)";
|
|
60
|
+
throw new Error(`No releases found for component '${componentName}'${prereleaseNote}`);
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
throw new error_handler_1.CLIError(`Release not found for ${componentName} v${version} (was looking for tag: ${targetTag})`, {
|
|
70
|
-
suggestions: [
|
|
71
|
-
`You are trying to install ${componentName}@${version} - check that the component name and version are correct`,
|
|
72
|
-
`Use iocd components browse" to see available components and versions`
|
|
73
|
-
]
|
|
74
|
-
});
|
|
62
|
+
// filter out by platform
|
|
63
|
+
let components = this.parseReleases(componentReleases);
|
|
64
|
+
const selectedComponent = (0, version_selector_1.selectVersion)(version, components);
|
|
65
|
+
if (selectedComponent) {
|
|
66
|
+
this.logger.info(`Selected component: ${selectedComponent.name} ${selectedComponent.fullVersion} for platform ${selectedComponent.platform} ${selectedComponent.arch || ''}`);
|
|
67
|
+
return selectedComponent;
|
|
75
68
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this.logger.debug(`Finding asset for platform '${platform}' in release '${release.name}'. Assets available: ${release.assets.map(a => a.name).join(', ')}`);
|
|
82
|
-
// Filter assets that match the current platform or are OS-agnostic
|
|
83
|
-
const platformAssets = release.assets.filter(asset => {
|
|
84
|
-
return platform_utils_1.ComponentPlatformUtils.matchesCurrentPlatform(asset.name);
|
|
69
|
+
throw new error_handler_1.CLIError(`Component not found for ${componentName}@${version})`, {
|
|
70
|
+
suggestions: [
|
|
71
|
+
`You are trying to install ${componentName}@${version} - check that the component name and version are correct`,
|
|
72
|
+
`Use iocd components browse" to see available components and versions`
|
|
73
|
+
]
|
|
85
74
|
});
|
|
86
|
-
if (platformAssets.length === 0) {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
// Prefer more specific platform matches (the utility handles this internally)
|
|
90
|
-
return platformAssets[0];
|
|
91
75
|
}
|
|
92
76
|
/**
|
|
93
77
|
* Get all releases without parsing them into components
|
|
78
|
+
* Will filter out pre-releases if usePrereleases is false
|
|
94
79
|
*/
|
|
95
80
|
async getAllReleases() {
|
|
81
|
+
if (this.cachedReleases) {
|
|
82
|
+
this.logger.debug(`Using cached releases from GitHub`);
|
|
83
|
+
return this.cachedReleases;
|
|
84
|
+
}
|
|
85
|
+
this.logger.debug(`Fetching all releases from GitHub...`);
|
|
96
86
|
const allReleases = [];
|
|
97
87
|
let nextUrl = `${this.baseUrl}?per_page=100&page=1`;
|
|
98
88
|
while (nextUrl) {
|
|
@@ -112,7 +102,12 @@ class GitHubComponentsStore {
|
|
|
112
102
|
break;
|
|
113
103
|
}
|
|
114
104
|
}
|
|
115
|
-
|
|
105
|
+
// Filter out pre-releases if usePrereleases is false
|
|
106
|
+
const filteredReleases = this.usePrereleases
|
|
107
|
+
? allReleases
|
|
108
|
+
: allReleases.filter(release => !release.prerelease);
|
|
109
|
+
this.cachedReleases = filteredReleases;
|
|
110
|
+
return filteredReleases;
|
|
116
111
|
}
|
|
117
112
|
/**
|
|
118
113
|
* Extract the next page URL from the Link header
|
|
@@ -133,16 +128,25 @@ class GitHubComponentsStore {
|
|
|
133
128
|
}
|
|
134
129
|
/** Parse GitHub release information into component metadata */
|
|
135
130
|
parseReleases(releases) {
|
|
131
|
+
this.logger.debug(`Parsing ${releases.length} releases into components...`);
|
|
136
132
|
const components = [];
|
|
137
133
|
for (const release of releases) {
|
|
138
134
|
try {
|
|
139
|
-
|
|
135
|
+
this.logger.debug(`Processing release: ${release.name} (tag: ${release.tag_name})`);
|
|
136
|
+
const { name, baseVersion, version, buildNumber, platform, arch } = platform_utils_1.ComponentPlatformUtils.parseComponentName(release.tag_name);
|
|
140
137
|
for (const asset of release.assets) {
|
|
138
|
+
this.logger.debug(` Found asset: ${asset.name}`);
|
|
139
|
+
const assetInfo = platform_utils_1.ComponentPlatformUtils.parseComponentFilename(asset.name);
|
|
141
140
|
components.push({
|
|
142
141
|
name,
|
|
143
|
-
version,
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
version: baseVersion,
|
|
143
|
+
buildNumber: buildNumber,
|
|
144
|
+
fullVersion: version,
|
|
145
|
+
platform: assetInfo.platform || platform || platform_utils_1.ComponentPlatformUtils.getCurrentPlatform(),
|
|
146
|
+
arch: assetInfo.arch || arch || process.arch,
|
|
147
|
+
downloadUrl: asset.browser_download_url,
|
|
148
|
+
filename: asset.name,
|
|
149
|
+
prerelease: release.prerelease
|
|
146
150
|
});
|
|
147
151
|
}
|
|
148
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.store.js","sourceRoot":"","sources":["../../../../src/services/components/stores/github.store.ts"],"names":[],"mappings":";;;AAAA,gEAAwD;AACxD,kDAA+C;AAG/C,sDAA2D;
|
|
1
|
+
{"version":3,"file":"github.store.js","sourceRoot":"","sources":["../../../../src/services/components/stores/github.store.ts"],"names":[],"mappings":";;;AAAA,gEAAwD;AACxD,kDAA+C;AAG/C,sDAA2D;AAC3D,0DAAoD;AAiBnD,CAAC;AAEF,yEAAyE;AACzE,wEAAwE;AACxE,kGAAkG;AAClG,MA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Q,EAAE,IAAI,EAAE,GAAG,uCAAsB,CAAC,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAEhI,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;oBACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;oBAClD,MAAM,SAAS,GAAG,uCAAsB,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBAC5E,UAAU,CAAC,IAAI,CAAC;wBACZ,IAAI;wBACJ,OAAO,EAAE,WAAW;wBACpB,WAAW,EAAE,WAAW;wBACxB,WAAW,EAAE,OAAO;wBACpB,QAAQ,EAAE,SAAS,CAAC,QAAQ,IAAI,QAAQ,IAAI,uCAAsB,CAAC,kBAAkB,EAAE;wBACvF,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,IAAI,IAAI,OAAO,CAAC,IAAW;wBACnD,WAAW,EAAE,KAAK,CAAC,oBAAoB;wBACvC,QAAQ,EAAE,KAAK,CAAC,IAAI;wBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;qBACjC,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACX,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,8CAA8C,OAAO,CAAC,IAAI,YAAa,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;YACrH,CAAC;QACL,CAAC;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AA1LD,sDA0LC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentsStore } from './store';
|
|
2
|
-
import {
|
|
2
|
+
import { ComponentWithVersion } from '../component';
|
|
3
3
|
/**
|
|
4
4
|
* Local Components Store implementation
|
|
5
5
|
*
|
|
@@ -26,7 +26,7 @@ export declare class LocalComponentsStore implements ComponentsStore {
|
|
|
26
26
|
private componentsDirectory;
|
|
27
27
|
constructor(componentsDirectory: string);
|
|
28
28
|
getInfo(): string;
|
|
29
|
-
getAll(): Promise<
|
|
29
|
+
getAll(): Promise<ComponentWithVersion[]>;
|
|
30
30
|
download(name: string, version: string): Promise<{
|
|
31
31
|
name: string;
|
|
32
32
|
data: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.store.d.ts","sourceRoot":"","sources":["../../../../src/services/components/stores/local.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"local.store.d.ts","sourceRoot":"","sources":["../../../../src/services/components/stores/local.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAOpD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,oBAAqB,YAAW,eAAe;IACxD,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,mBAAmB,CAAS;gBAExB,mBAAmB,EAAE,MAAM;IAKvC,OAAO,IAAI,MAAM;IAIX,MAAM,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAmDzC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IA4ErG;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAezB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAI9B;;OAEG;YACW,uBAAuB;IA2BrC;;;;OAIG;YACW,yBAAyB;IA2BvC;;;OAGG;YACW,qBAAqB;IAwCnC;;;OAGG;YACW,oBAAoB;IAiClC;;;OAGG;IACH,OAAO,CAAC,gBAAgB;CAW3B"}
|
|
@@ -179,7 +179,9 @@ class LocalComponentsStore {
|
|
|
179
179
|
name: parsed.name,
|
|
180
180
|
version: parsed.version,
|
|
181
181
|
platform: parsed.platform || platform_utils_1.ComponentPlatformUtils.getCurrentPlatform(),
|
|
182
|
-
downloadUrl: filePath // Store file path as download URL for local components
|
|
182
|
+
downloadUrl: filePath, // Store file path as download URL for local components
|
|
183
|
+
filename: filename,
|
|
184
|
+
prerelease: false // Legacy files are assumed stable
|
|
183
185
|
};
|
|
184
186
|
this.logger.debug(`Created component from file: ${component.name}@${component.version} (${component.platform})`);
|
|
185
187
|
return component;
|
|
@@ -206,7 +208,9 @@ class LocalComponentsStore {
|
|
|
206
208
|
name: componentName,
|
|
207
209
|
version: version,
|
|
208
210
|
platform: platform || platform_utils_1.ComponentPlatformUtils.getCurrentPlatform(),
|
|
209
|
-
downloadUrl: filePath
|
|
211
|
+
downloadUrl: filePath,
|
|
212
|
+
filename: filename,
|
|
213
|
+
prerelease: false // Structured local files are assumed stable
|
|
210
214
|
};
|
|
211
215
|
this.logger.debug(`Created structured component: ${component.name}@${component.version} (${component.platform})`);
|
|
212
216
|
return component;
|