@interopio/iocd-cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +96 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/apps.command.d.ts +3 -0
- package/dist/commands/apps.command.d.ts.map +1 -0
- package/dist/commands/apps.command.js +110 -0
- package/dist/commands/apps.command.js.map +1 -0
- package/dist/commands/components.command.d.ts +3 -0
- package/dist/commands/components.command.d.ts.map +1 -0
- package/dist/commands/components.command.js +116 -0
- package/dist/commands/components.command.js.map +1 -0
- package/dist/commands/create.command.d.ts +3 -0
- package/dist/commands/create.command.d.ts.map +1 -0
- package/dist/commands/create.command.js +19 -0
- package/dist/commands/create.command.js.map +1 -0
- package/dist/commands/dev.command.d.ts +4 -0
- package/dist/commands/dev.command.d.ts.map +1 -0
- package/dist/commands/dev.command.js +25 -0
- package/dist/commands/dev.command.js.map +1 -0
- package/dist/commands/installer.command.d.ts +3 -0
- package/dist/commands/installer.command.d.ts.map +1 -0
- package/dist/commands/installer.command.js +19 -0
- package/dist/commands/installer.command.js.map +1 -0
- package/dist/commands/license.command.d.ts +3 -0
- package/dist/commands/license.command.d.ts.map +1 -0
- package/dist/commands/license.command.js +23 -0
- package/dist/commands/license.command.js.map +1 -0
- package/dist/commands/modifications.command.d.ts +3 -0
- package/dist/commands/modifications.command.d.ts.map +1 -0
- package/dist/commands/modifications.command.js +28 -0
- package/dist/commands/modifications.command.js.map +1 -0
- package/dist/commands/setup.command.d.ts +4 -0
- package/dist/commands/setup.command.d.ts.map +1 -0
- package/dist/commands/setup.command.js +34 -0
- package/dist/commands/setup.command.js.map +1 -0
- package/dist/services/app-builder.service.d.ts +2 -0
- package/dist/services/app-builder.service.d.ts.map +1 -0
- package/dist/services/app-builder.service.js +3 -0
- package/dist/services/app-builder.service.js.map +1 -0
- package/dist/services/app.service.d.ts +74 -0
- package/dist/services/app.service.d.ts.map +1 -0
- package/dist/services/app.service.js +328 -0
- package/dist/services/app.service.js.map +1 -0
- package/dist/services/components/component.config.d.ts +11 -0
- package/dist/services/components/component.config.d.ts.map +1 -0
- package/dist/services/components/component.config.js +101 -0
- package/dist/services/components/component.config.js.map +1 -0
- package/dist/services/components/component.d.ts +12 -0
- package/dist/services/components/component.d.ts.map +1 -0
- package/dist/services/components/component.js +3 -0
- package/dist/services/components/component.js.map +1 -0
- package/dist/services/components/components.registry.d.ts +40 -0
- package/dist/services/components/components.registry.d.ts.map +1 -0
- package/dist/services/components/components.registry.js +72 -0
- package/dist/services/components/components.registry.js.map +1 -0
- package/dist/services/components/components.service.d.ts +20 -0
- package/dist/services/components/components.service.d.ts.map +1 -0
- package/dist/services/components/components.service.js +171 -0
- package/dist/services/components/components.service.js.map +1 -0
- package/dist/services/components/file.helper.d.ts +12 -0
- package/dist/services/components/file.helper.d.ts.map +1 -0
- package/dist/services/components/file.helper.js +124 -0
- package/dist/services/components/file.helper.js.map +1 -0
- package/dist/services/components/platform.utils.d.ts +72 -0
- package/dist/services/components/platform.utils.d.ts.map +1 -0
- package/dist/services/components/platform.utils.js +156 -0
- package/dist/services/components/platform.utils.js.map +1 -0
- package/dist/services/components/stores/github.store.d.ts +35 -0
- package/dist/services/components/stores/github.store.d.ts.map +1 -0
- package/dist/services/components/stores/github.store.js +157 -0
- package/dist/services/components/stores/github.store.js.map +1 -0
- package/dist/services/components/stores/local.store.d.ts +69 -0
- package/dist/services/components/stores/local.store.d.ts.map +1 -0
- package/dist/services/components/stores/local.store.js +300 -0
- package/dist/services/components/stores/local.store.js.map +1 -0
- package/dist/services/components/stores/s3.store.d.ts +98 -0
- package/dist/services/components/stores/s3.store.d.ts.map +1 -0
- package/dist/services/components/stores/s3.store.js +368 -0
- package/dist/services/components/stores/s3.store.js.map +1 -0
- package/dist/services/components/stores/store.d.ts +11 -0
- package/dist/services/components/stores/store.d.ts.map +1 -0
- package/dist/services/components/stores/store.js +3 -0
- package/dist/services/components/stores/store.js.map +1 -0
- package/dist/services/config/cli.config.d.ts +57 -0
- package/dist/services/config/cli.config.d.ts.map +1 -0
- package/dist/services/config/cli.config.js +3 -0
- package/dist/services/config/cli.config.js.map +1 -0
- package/dist/services/config/config.service.d.ts +14 -0
- package/dist/services/config/config.service.d.ts.map +1 -0
- package/dist/services/config/config.service.js +170 -0
- package/dist/services/config/config.service.js.map +1 -0
- package/dist/services/create.service.d.ts +58 -0
- package/dist/services/create.service.d.ts.map +1 -0
- package/dist/services/create.service.js +318 -0
- package/dist/services/create.service.js.map +1 -0
- package/dist/services/dev.service.d.ts +2 -0
- package/dist/services/dev.service.d.ts.map +1 -0
- package/dist/services/dev.service.js +78 -0
- package/dist/services/dev.service.js.map +1 -0
- package/dist/services/installer/electronBuilder.d.ts +2 -0
- package/dist/services/installer/electronBuilder.d.ts.map +1 -0
- package/dist/services/installer/electronBuilder.js +3 -0
- package/dist/services/installer/electronBuilder.js.map +1 -0
- package/dist/services/installer/electronForge.d.ts +2 -0
- package/dist/services/installer/electronForge.d.ts.map +1 -0
- package/dist/services/installer/electronForge.js +248 -0
- package/dist/services/installer/electronForge.js.map +1 -0
- package/dist/services/installer/installer.service.d.ts +5 -0
- package/dist/services/installer/installer.service.d.ts.map +1 -0
- package/dist/services/installer/installer.service.js +101 -0
- package/dist/services/installer/installer.service.js.map +1 -0
- package/dist/services/installer/macOS.helper.d.ts +3 -0
- package/dist/services/installer/macOS.helper.d.ts.map +1 -0
- package/dist/services/installer/macOS.helper.js +244 -0
- package/dist/services/installer/macOS.helper.js.map +1 -0
- package/dist/services/installer/prerequisites.d.ts +2 -0
- package/dist/services/installer/prerequisites.d.ts.map +1 -0
- package/dist/services/installer/prerequisites.js +73 -0
- package/dist/services/installer/prerequisites.js.map +1 -0
- package/dist/services/installer/windows.helper.d.ts +10 -0
- package/dist/services/installer/windows.helper.d.ts.map +1 -0
- package/dist/services/installer/windows.helper.js +394 -0
- package/dist/services/installer/windows.helper.js.map +1 -0
- package/dist/services/license.service.d.ts +7 -0
- package/dist/services/license.service.d.ts.map +1 -0
- package/dist/services/license.service.js +14 -0
- package/dist/services/license.service.js.map +1 -0
- package/dist/services/modifications/macOS.helper.d.ts +13 -0
- package/dist/services/modifications/macOS.helper.d.ts.map +1 -0
- package/dist/services/modifications/macOS.helper.js +274 -0
- package/dist/services/modifications/macOS.helper.js.map +1 -0
- package/dist/services/modifications/modifications.service.d.ts +2 -0
- package/dist/services/modifications/modifications.service.d.ts.map +1 -0
- package/dist/services/modifications/modifications.service.js +376 -0
- package/dist/services/modifications/modifications.service.js.map +1 -0
- package/dist/services/modifications/windows.helper.d.ts +2 -0
- package/dist/services/modifications/windows.helper.d.ts.map +1 -0
- package/dist/services/modifications/windows.helper.js +83 -0
- package/dist/services/modifications/windows.helper.js.map +1 -0
- package/dist/services/template.service.d.ts +116 -0
- package/dist/services/template.service.d.ts.map +1 -0
- package/dist/services/template.service.js +354 -0
- package/dist/services/template.service.js.map +1 -0
- package/dist/templates/auto-tests/README.md +31 -0
- package/dist/templates/auto-tests/playwright.config.js +19 -0
- package/dist/templates/auto-tests/template.json +12 -0
- package/dist/templates/auto-tests/tests/basic.test.js +15 -0
- package/dist/templates/ioconnect-desktop/.env.example +29 -0
- package/dist/templates/ioconnect-desktop/.github/workflows/build-installers.yml +170 -0
- package/dist/templates/ioconnect-desktop/LICENSE +0 -0
- package/dist/templates/ioconnect-desktop/README.md +0 -0
- package/dist/templates/ioconnect-desktop/config/mac-build/entitlements.mac.plist +44 -0
- package/dist/templates/ioconnect-desktop/config/win-build/template.nuspectemplate +33 -0
- package/dist/templates/ioconnect-desktop/forge.config.js +47 -0
- package/dist/templates/ioconnect-desktop/iocd.cli.config.json +45 -0
- package/dist/templates/ioconnect-desktop/modifications/iocd/assets/images/logo.icns +0 -0
- package/dist/templates/ioconnect-desktop/modifications/iocd/assets/images/logo.ico +0 -0
- package/dist/templates/ioconnect-desktop/modifications/iocd/assets/images/logo.png +0 -0
- package/dist/templates/ioconnect-desktop/modifications/iocd/config/system.json.merge +3 -0
- package/dist/templates/ioconnect-desktop/package.json +43 -0
- package/dist/templates/ioconnect-desktop/template.json +7 -0
- package/dist/templates/launchpad/apps/launchpad/.eslintrc.json +3 -0
- package/dist/templates/launchpad/apps/launchpad/config/iocd.app.def.dev.json +57 -0
- package/dist/templates/launchpad/apps/launchpad/config/iocd.app.def.prod.json +2 -0
- package/dist/templates/launchpad/apps/launchpad/config/iocd.system.dev.json +3 -0
- package/dist/templates/launchpad/apps/launchpad/config/iocd.system.prod.json +3 -0
- package/dist/templates/launchpad/apps/launchpad/index.html +16 -0
- package/dist/templates/launchpad/apps/launchpad/iocd.app.json +32 -0
- package/dist/templates/launchpad/apps/launchpad/package-lock.json +2778 -0
- package/dist/templates/launchpad/apps/launchpad/package.json +21 -0
- package/dist/templates/launchpad/apps/launchpad/public/favicon.ico +0 -0
- package/dist/templates/launchpad/apps/launchpad/src/app/app.tsx +39 -0
- package/dist/templates/launchpad/apps/launchpad/src/app/constants.ts +27 -0
- package/dist/templates/launchpad/apps/launchpad/src/components/logo.tsx +11 -0
- package/dist/templates/launchpad/apps/launchpad/src/components/main-context-menu.tsx +162 -0
- package/dist/templates/launchpad/apps/launchpad/src/components/notifications-button.tsx +44 -0
- package/dist/templates/launchpad/apps/launchpad/src/main.tsx +6 -0
- package/dist/templates/launchpad/apps/launchpad/src/styles.css +17 -0
- package/dist/templates/launchpad/apps/launchpad/tsconfig.json +10 -0
- package/dist/templates/launchpad/apps/launchpad/vite.config.ts +13 -0
- package/dist/templates/launchpad/template.json +12 -0
- package/dist/templates/splash-screen/apps/splash-screen/README.md +119 -0
- package/dist/templates/splash-screen/apps/splash-screen/config/system-dev.json +9 -0
- package/dist/templates/splash-screen/apps/splash-screen/config/system-prod.json +8 -0
- package/dist/templates/splash-screen/apps/splash-screen/index.html +55 -0
- package/dist/templates/splash-screen/apps/splash-screen/iocd.app.json +20 -0
- package/dist/templates/splash-screen/apps/splash-screen/package-lock.json +1059 -0
- package/dist/templates/splash-screen/apps/splash-screen/package.json +17 -0
- package/dist/templates/splash-screen/apps/splash-screen/public/assets/fonts/PTSans-Regular.ttf +0 -0
- package/dist/templates/splash-screen/apps/splash-screen/public/assets/images/logo-light.svg +85 -0
- package/dist/templates/splash-screen/apps/splash-screen/public/assets/images/splash-bg.png +0 -0
- package/dist/templates/splash-screen/apps/splash-screen/public/assets/styles/style.css +149 -0
- package/dist/templates/splash-screen/apps/splash-screen/public/assets/styles/style.css.map +1 -0
- package/dist/templates/splash-screen/apps/splash-screen/public/assets/styles/style.scss +90 -0
- package/dist/templates/splash-screen/apps/splash-screen/src/main.ts +93 -0
- package/dist/templates/splash-screen/apps/splash-screen/src/types.ts +28 -0
- package/dist/templates/splash-screen/apps/splash-screen/tsconfig.json +25 -0
- package/dist/templates/splash-screen/apps/splash-screen/vite.config.ts +27 -0
- package/dist/templates/splash-screen/template.json +12 -0
- package/dist/templates/web-groups/apps/web-groups/README.md +15 -0
- package/dist/templates/web-groups/apps/web-groups/config/web-group-dev.json +13 -0
- package/dist/templates/web-groups/apps/web-groups/config/web-group-prod.json +12 -0
- package/dist/templates/web-groups/apps/web-groups/index.html +18 -0
- package/dist/templates/web-groups/apps/web-groups/iocd.app.json +24 -0
- package/dist/templates/web-groups/apps/web-groups/package.json +28 -0
- package/dist/templates/web-groups/apps/web-groups/public/favicon.ico +0 -0
- package/dist/templates/web-groups/apps/web-groups/public/logo192.png +0 -0
- package/dist/templates/web-groups/apps/web-groups/public/logo512.png +0 -0
- package/dist/templates/web-groups/apps/web-groups/public/manifest.json +25 -0
- package/dist/templates/web-groups/apps/web-groups/public/robots.txt +3 -0
- package/dist/templates/web-groups/apps/web-groups/src/App.css +38 -0
- package/dist/templates/web-groups/apps/web-groups/src/App.tsx +11 -0
- package/dist/templates/web-groups/apps/web-groups/src/index.css +13 -0
- package/dist/templates/web-groups/apps/web-groups/src/index.tsx +25 -0
- package/dist/templates/web-groups/apps/web-groups/src/logo.svg +1 -0
- package/dist/templates/web-groups/apps/web-groups/src/reportWebVitals.ts +15 -0
- package/dist/templates/web-groups/apps/web-groups/tsconfig.json +26 -0
- package/dist/templates/web-groups/apps/web-groups/vite.config.ts +8 -0
- package/dist/templates/web-groups/template.json +12 -0
- package/dist/templates/workspaces/apps/workspaces/README.md +15 -0
- package/dist/templates/workspaces/apps/workspaces/config/workspaces-dev.json +21 -0
- package/dist/templates/workspaces/apps/workspaces/config/workspaces-prod.json +20 -0
- package/dist/templates/workspaces/apps/workspaces/index.html +17 -0
- package/dist/templates/workspaces/apps/workspaces/iocd.app.json +24 -0
- package/dist/templates/workspaces/apps/workspaces/package.json +29 -0
- package/dist/templates/workspaces/apps/workspaces/public/favicon.ico +0 -0
- package/dist/templates/workspaces/apps/workspaces/public/logo192.png +0 -0
- package/dist/templates/workspaces/apps/workspaces/public/logo512.png +0 -0
- package/dist/templates/workspaces/apps/workspaces/public/manifest.json +25 -0
- package/dist/templates/workspaces/apps/workspaces/public/robots.txt +3 -0
- package/dist/templates/workspaces/apps/workspaces/src/AddWindowButton.tsx +33 -0
- package/dist/templates/workspaces/apps/workspaces/src/AfterTabs.tsx +27 -0
- package/dist/templates/workspaces/apps/workspaces/src/App.css +38 -0
- package/dist/templates/workspaces/apps/workspaces/src/App.tsx +103 -0
- package/dist/templates/workspaces/apps/workspaces/src/GroupHeaderButtons.tsx +9 -0
- package/dist/templates/workspaces/apps/workspaces/src/index.css +4 -0
- package/dist/templates/workspaces/apps/workspaces/src/index.tsx +28 -0
- package/dist/templates/workspaces/apps/workspaces/src/logo.svg +7 -0
- package/dist/templates/workspaces/apps/workspaces/src/reportWebVitals.ts +15 -0
- package/dist/templates/workspaces/apps/workspaces/src/setupTests.ts +5 -0
- package/dist/templates/workspaces/apps/workspaces/src/useAddWindowButtonVisible.tsx +30 -0
- package/dist/templates/workspaces/apps/workspaces/tsconfig.json +26 -0
- package/dist/templates/workspaces/apps/workspaces/vite.config.ts +8 -0
- package/dist/templates/workspaces/template.json +12 -0
- package/dist/tools/rcedit-x64.exe +0 -0
- package/dist/utils/colors.d.ts +57 -0
- package/dist/utils/colors.d.ts.map +1 -0
- package/dist/utils/colors.js +151 -0
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/deep.merge.d.ts +5 -0
- package/dist/utils/deep.merge.d.ts.map +1 -0
- package/dist/utils/deep.merge.js +27 -0
- package/dist/utils/deep.merge.js.map +1 -0
- package/dist/utils/electron.builder.config.helper.d.ts +6 -0
- package/dist/utils/electron.builder.config.helper.d.ts.map +1 -0
- package/dist/utils/electron.builder.config.helper.js +25 -0
- package/dist/utils/electron.builder.config.helper.js.map +1 -0
- package/dist/utils/ensure.iocd.exists.d.ts +2 -0
- package/dist/utils/ensure.iocd.exists.d.ts.map +1 -0
- package/dist/utils/ensure.iocd.exists.js +27 -0
- package/dist/utils/ensure.iocd.exists.js.map +1 -0
- package/dist/utils/error.handler.d.ts +30 -0
- package/dist/utils/error.handler.d.ts.map +1 -0
- package/dist/utils/error.handler.js +104 -0
- package/dist/utils/error.handler.js.map +1 -0
- package/dist/utils/file.d.ts +10 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +40 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/find.package.dir.d.ts +2 -0
- package/dist/utils/find.package.dir.d.ts.map +1 -0
- package/dist/utils/find.package.dir.js +23 -0
- package/dist/utils/find.package.dir.js.map +1 -0
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +184 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/nextSteps.d.ts +2 -0
- package/dist/utils/nextSteps.d.ts.map +1 -0
- package/dist/utils/nextSteps.js +44 -0
- package/dist/utils/nextSteps.js.map +1 -0
- package/dist/utils/pacakge.json.helper.d.ts +9 -0
- package/dist/utils/pacakge.json.helper.d.ts.map +1 -0
- package/dist/utils/pacakge.json.helper.js +71 -0
- package/dist/utils/pacakge.json.helper.js.map +1 -0
- package/dist/utils/path.d.ts +19 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +81 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/version.d.ts +2 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +16 -0
- package/dist/utils/version.js.map +1 -0
- package/package.json +69 -0
- package/tools/rcedit-x64.exe +0 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocalComponentsStore = void 0;
|
|
4
|
+
const logger_1 = require("../../../utils/logger");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const error_handler_1 = require("../../../utils/error.handler");
|
|
8
|
+
const platform_utils_1 = require("../platform.utils");
|
|
9
|
+
/**
|
|
10
|
+
* Local Components Store implementation
|
|
11
|
+
*
|
|
12
|
+
* This store reads components from a local directory following the same structure as the S3 store.
|
|
13
|
+
* Expected directory structure:
|
|
14
|
+
*
|
|
15
|
+
* componentsDirectory/
|
|
16
|
+
* ├── component1/
|
|
17
|
+
* │ ├── v1.0.0/
|
|
18
|
+
* │ │ ├── component1-v1.0.0-win32.zip
|
|
19
|
+
* │ │ ├── component1-v1.0.0-darwin.dmg
|
|
20
|
+
* │ │ └── component1-v1.0.0-darwin-arm64.dmg
|
|
21
|
+
* │ └── v1.1.0/
|
|
22
|
+
* │ ├── component1-v1.1.0-win32.zip
|
|
23
|
+
* │ └── component1-v1.1.0-darwin.dmg
|
|
24
|
+
* └── component2/
|
|
25
|
+
* └── v2.0.0/
|
|
26
|
+
* └── component2-v2.0.0-win32.zip
|
|
27
|
+
*
|
|
28
|
+
* Legacy support is maintained for flat file structures in the root directory.
|
|
29
|
+
*/
|
|
30
|
+
class LocalComponentsStore {
|
|
31
|
+
logger = logger_1.Logger.getInstance();
|
|
32
|
+
componentsDirectory;
|
|
33
|
+
constructor(componentsDirectory) {
|
|
34
|
+
this.componentsDirectory = (0, path_1.resolve)(componentsDirectory);
|
|
35
|
+
this.validateDirectory();
|
|
36
|
+
}
|
|
37
|
+
getInfo() {
|
|
38
|
+
return `Local Components Store (${this.componentsDirectory})`;
|
|
39
|
+
}
|
|
40
|
+
async getAll() {
|
|
41
|
+
this.logger.debug(`Scanning local components directory: ${this.componentsDirectory}`);
|
|
42
|
+
if (!(0, fs_1.existsSync)(this.componentsDirectory)) {
|
|
43
|
+
this.logger.warn(`Components directory does not exist: ${this.componentsDirectory}`);
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
const components = [];
|
|
47
|
+
try {
|
|
48
|
+
const componentDirs = (0, fs_1.readdirSync)(this.componentsDirectory);
|
|
49
|
+
for (const componentName of componentDirs) {
|
|
50
|
+
const componentPath = (0, path_1.join)(this.componentsDirectory, componentName);
|
|
51
|
+
// Skip hidden directories and files
|
|
52
|
+
if (componentName.startsWith('.')) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const stat = (0, fs_1.statSync)(componentPath);
|
|
57
|
+
if (stat.isDirectory()) {
|
|
58
|
+
// Scan for version directories inside component directory
|
|
59
|
+
const versionComponents = await this.scanComponentVersions(componentPath, componentName);
|
|
60
|
+
components.push(...versionComponents);
|
|
61
|
+
}
|
|
62
|
+
else if (stat.isFile() && this.isSupportedPackageFile(componentName)) {
|
|
63
|
+
// Legacy support: Handle single package files in root directory
|
|
64
|
+
this.logger.warn(`Found legacy component file in root: ${componentName}. Consider moving to component/version structure.`);
|
|
65
|
+
const component = await this.createComponentFromFile(componentPath, componentName);
|
|
66
|
+
if (component) {
|
|
67
|
+
components.push(component);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
this.logger.warn(`Failed to process component ${componentName}: ${error}`);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
this.logger.debug(`Found ${components.length} components in local store`);
|
|
77
|
+
return components;
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
this.logger.error(`Failed to scan components directory: ${error}`);
|
|
81
|
+
throw new Error(`Failed to read local components: ${error}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async download(name, version) {
|
|
85
|
+
this.logger.debug(`Downloading component ${name}@${version} from local store`);
|
|
86
|
+
const componentPath = (0, path_1.join)(this.componentsDirectory, name);
|
|
87
|
+
if (!(0, fs_1.existsSync)(componentPath)) {
|
|
88
|
+
throw new error_handler_1.CLIError(`Component ${name} not found in local store at path: ${componentPath}`);
|
|
89
|
+
}
|
|
90
|
+
const components = await this.scanComponentVersions(componentPath, name);
|
|
91
|
+
// filter out based on the current platform
|
|
92
|
+
const currentPlatform = platform_utils_1.ComponentPlatformUtils.getCurrentPlatform();
|
|
93
|
+
const platformMatches = components.filter(c => c.platform === currentPlatform);
|
|
94
|
+
if (platformMatches.length === 0) {
|
|
95
|
+
throw new error_handler_1.CLIError(`No versions of component ${name} found for current platform (${platform_utils_1.ComponentPlatformUtils.getCurrentPlatform()}) in local store.`, {
|
|
96
|
+
suggestions: [
|
|
97
|
+
`Check that the component ${name} has versions built for your platform (${platform_utils_1.ComponentPlatformUtils.getCurrentPlatform()})`,
|
|
98
|
+
`Available versions: ${components.map(c => `${c.version} (${c.platform})`).join(', ') || 'none'}`,
|
|
99
|
+
`Ensure your local store follows the structure: ${this.componentsDirectory}/${name}/v${version}/${name}-v${version}-${platform_utils_1.ComponentPlatformUtils.getCurrentPlatform()}.ext`
|
|
100
|
+
]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
// Find matching component, preferring current platform
|
|
104
|
+
let matchingComponent;
|
|
105
|
+
if (version === 'latest') {
|
|
106
|
+
matchingComponent = this.getLatestVersion(platformMatches);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
// Look for exact version match, preferring current platform
|
|
110
|
+
matchingComponent = platformMatches.find(c => c.name === name && c.version === version);
|
|
111
|
+
}
|
|
112
|
+
if (!matchingComponent) {
|
|
113
|
+
const availableVersions = components
|
|
114
|
+
.filter(c => c.name === name)
|
|
115
|
+
.map(c => `${c.version} (${c.platform})`)
|
|
116
|
+
.join(', ');
|
|
117
|
+
throw new error_handler_1.CLIError(`Component ${name}${version ? `@${version}` : ''} not found in local store. `, {
|
|
118
|
+
suggestions: [
|
|
119
|
+
`You are trying to install ${name}@${version} - check that the component name and version are correct`,
|
|
120
|
+
`Available versions: ${availableVersions || 'none'}`,
|
|
121
|
+
`Ensure your local store follows the structure: ${this.componentsDirectory}/${name}/v${version}/${name}-v${version}-${currentPlatform}.ext`
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
// Use downloadUrl as the file path for local components
|
|
126
|
+
const filePath = matchingComponent.downloadUrl;
|
|
127
|
+
if (!filePath || !(0, fs_1.existsSync)(filePath)) {
|
|
128
|
+
throw new Error(`Component file not found: ${filePath}`);
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
// Read the file as binary data
|
|
132
|
+
const data = (0, fs_1.readFileSync)(filePath);
|
|
133
|
+
this.logger.info(`Downloaded ${name}@${matchingComponent.version} (${matchingComponent.platform}) from local store`);
|
|
134
|
+
return {
|
|
135
|
+
name: matchingComponent.name,
|
|
136
|
+
data: data,
|
|
137
|
+
filename: (0, path_1.basename)(filePath)
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
this.logger.error(`Failed to read component file ${filePath}: ${error}`);
|
|
142
|
+
throw new Error(`Failed to download component: ${error}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Validate that the components directory exists and is accessible
|
|
147
|
+
*/
|
|
148
|
+
validateDirectory() {
|
|
149
|
+
if (!(0, fs_1.existsSync)(this.componentsDirectory)) {
|
|
150
|
+
throw new Error(`Components directory does not exist: ${this.componentsDirectory}`);
|
|
151
|
+
}
|
|
152
|
+
try {
|
|
153
|
+
const stat = (0, fs_1.statSync)(this.componentsDirectory);
|
|
154
|
+
if (!stat.isDirectory()) {
|
|
155
|
+
throw new Error(`Path is not a directory: ${this.componentsDirectory}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
throw new Error(`Cannot access components directory: ${this.componentsDirectory} (${error})`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Check if a file is a supported package format
|
|
164
|
+
*/
|
|
165
|
+
isSupportedPackageFile(filename) {
|
|
166
|
+
return platform_utils_1.ComponentPlatformUtils.isSupportedPackageFile(filename);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Create a Component object from a single package file (legacy support)
|
|
170
|
+
*/
|
|
171
|
+
async createComponentFromFile(filePath, filename) {
|
|
172
|
+
try {
|
|
173
|
+
const parsed = platform_utils_1.ComponentPlatformUtils.parseComponentFilename(filename);
|
|
174
|
+
if (!parsed) {
|
|
175
|
+
this.logger.debug(`Could not parse component info from filename: ${filename}`);
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
const component = {
|
|
179
|
+
name: parsed.name,
|
|
180
|
+
version: parsed.version,
|
|
181
|
+
platform: parsed.platform || platform_utils_1.ComponentPlatformUtils.getCurrentPlatform(),
|
|
182
|
+
downloadUrl: filePath // Store file path as download URL for local components
|
|
183
|
+
};
|
|
184
|
+
this.logger.debug(`Created component from file: ${component.name}@${component.version} (${component.platform})`);
|
|
185
|
+
return component;
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
this.logger.warn(`Failed to create component from file ${filePath}: ${error}`);
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Create a Component object from structured directory layout
|
|
194
|
+
* Expected filename format: componentName-vVersion-platform.ext
|
|
195
|
+
* Following S3 store structure: componentName/vVersion/componentName-vVersion-platform.ext
|
|
196
|
+
*/
|
|
197
|
+
async createStructuredComponent(filePath, filename, componentName, version) {
|
|
198
|
+
try {
|
|
199
|
+
const componentInfo = platform_utils_1.ComponentPlatformUtils.parseComponentFilename(filename);
|
|
200
|
+
const platform = componentInfo.platform;
|
|
201
|
+
if (componentInfo.name !== componentName || componentInfo.version !== version) {
|
|
202
|
+
this.logger.debug(`Filename does not match expected component/version: ${filename}, looking for ${componentName}@${version}, skipping...`);
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
const component = {
|
|
206
|
+
name: componentName,
|
|
207
|
+
version: version,
|
|
208
|
+
platform: platform || platform_utils_1.ComponentPlatformUtils.getCurrentPlatform(),
|
|
209
|
+
downloadUrl: filePath // Store file path as download URL for local components
|
|
210
|
+
};
|
|
211
|
+
this.logger.debug(`Created structured component: ${component.name}@${component.version} (${component.platform})`);
|
|
212
|
+
return component;
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
this.logger.error(`Failed to create structured component from file ${filePath}: ${error}`);
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Scan component directory for version subdirectories
|
|
221
|
+
* Expected structure: componentName/vX.Y.Z/componentName-vX.Y.Z-platform.ext
|
|
222
|
+
*/
|
|
223
|
+
async scanComponentVersions(componentPath, componentName) {
|
|
224
|
+
const components = [];
|
|
225
|
+
try {
|
|
226
|
+
const versionDirs = (0, fs_1.readdirSync)(componentPath);
|
|
227
|
+
for (const versionDir of versionDirs) {
|
|
228
|
+
// Skip hidden directories
|
|
229
|
+
if (versionDir.startsWith('.')) {
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
const versionPath = (0, path_1.join)(componentPath, versionDir);
|
|
233
|
+
const stat = (0, fs_1.statSync)(versionPath);
|
|
234
|
+
if (stat.isDirectory()) {
|
|
235
|
+
// Extract version from directory name (remove 'v' prefix if present)
|
|
236
|
+
const version = versionDir.startsWith('v') ? versionDir.substring(1) : versionDir;
|
|
237
|
+
// Scan for component files in version directory
|
|
238
|
+
const versionComponents = await this.scanVersionDirectory(versionPath, componentName, version);
|
|
239
|
+
components.push(...versionComponents);
|
|
240
|
+
}
|
|
241
|
+
else if (stat.isFile() && this.isSupportedPackageFile(versionDir)) {
|
|
242
|
+
// Legacy support: Handle files directly in component directory
|
|
243
|
+
this.logger.warn(`Found legacy component file in component directory: ${componentPath}/${versionDir}. Consider moving to version subdirectory.`);
|
|
244
|
+
const component = await this.createComponentFromFile(versionPath, versionDir);
|
|
245
|
+
if (component) {
|
|
246
|
+
component.name = componentName; // Override with directory name
|
|
247
|
+
components.push(component);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
this.logger.warn(`Failed to scan component versions directory ${componentPath}: ${error}`);
|
|
254
|
+
}
|
|
255
|
+
return components;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Scan version directory for component package files
|
|
259
|
+
* Expected structure: vX.Y.Z/componentName-vX.Y.Z-platform.ext
|
|
260
|
+
*/
|
|
261
|
+
async scanVersionDirectory(versionPath, componentName, version) {
|
|
262
|
+
const components = [];
|
|
263
|
+
try {
|
|
264
|
+
const files = (0, fs_1.readdirSync)(versionPath);
|
|
265
|
+
for (const filename of files) {
|
|
266
|
+
if (filename.startsWith('.')) {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const filePath = (0, path_1.join)(versionPath, filename);
|
|
270
|
+
const stat = (0, fs_1.statSync)(filePath);
|
|
271
|
+
if (stat.isFile() && this.isSupportedPackageFile(filename)) {
|
|
272
|
+
const component = await this.createStructuredComponent(filePath, filename, componentName, version);
|
|
273
|
+
if (component) {
|
|
274
|
+
components.push(component);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
this.logger.warn(`Failed to scan version directory ${versionPath}: ${error}`);
|
|
281
|
+
}
|
|
282
|
+
return components;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get the latest version from a list of components with the same name
|
|
286
|
+
* Simple string comparison - for proper semver, you'd want to use a semver library
|
|
287
|
+
*/
|
|
288
|
+
getLatestVersion(components) {
|
|
289
|
+
return components.reduce((latest, current) => {
|
|
290
|
+
// Simple string comparison - "latest" always wins, otherwise lexicographic
|
|
291
|
+
if (current.version === 'latest')
|
|
292
|
+
return current;
|
|
293
|
+
if (latest.version === 'latest')
|
|
294
|
+
return latest;
|
|
295
|
+
return current.version > latest.version ? current : latest;
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
exports.LocalComponentsStore = LocalComponentsStore;
|
|
300
|
+
//# sourceMappingURL=local.store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.store.js","sourceRoot":"","sources":["../../../../src/services/components/stores/local.store.ts"],"names":[],"mappings":";;;AAEA,kDAA+C;AAC/C,2BAAqE;AACrE,+BAA+C;AAC/C,gEAAwD;AACxD,sDAA2D;AAE3D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,oBAAoB;IACrB,MAAM,GAAG,eAAM,CAAC,WAAW,EAAE,CAAC;IAC9B,mBAAmB,CAAS;IAEpC,YAAY,mBAA2B;QACnC,IAAI,CAAC,mBAAmB,GAAG,IAAA,cAAO,EAAC,mBAAmB,CAAC,CAAC;QACxD,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IAED,OAAO;QACH,OAAO,2BAA2B,IAAI,CAAC,mBAAmB,GAAG,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,MAAM;QACR,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wCAAwC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC;QAEtF,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC,mBAAmB,CAAC,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AM,EAAE,OAAO,EAAE,EAAE;YACzC,2EAA2E;YAC3E,IAAI,OAAO,CAAC,OAAO,KAAK,QAAQ;gBAAE,OAAO,OAAO,CAAC;YACjD,IAAI,MAAM,CAAC,OAAO,KAAK,QAAQ;gBAAE,OAAO,MAAM,CAAC;YAE/C,OAAO,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC;CAGJ;AA/TD,oDA+TC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ComponentsStore } from './store';
|
|
2
|
+
import { Component } from '../component';
|
|
3
|
+
/**
|
|
4
|
+
* S3 Components Store implementation
|
|
5
|
+
*
|
|
6
|
+
* This store downloads components from an AWS S3 bucket.
|
|
7
|
+
* It expects components to be organized in the bucket with the following structure:
|
|
8
|
+
*
|
|
9
|
+
* bucket/
|
|
10
|
+
* ├── component1/
|
|
11
|
+
* │ ├── v1.0.0/
|
|
12
|
+
* │ │ ├── component1-v1.0.0-win32.zip
|
|
13
|
+
* │ │ ├── component1-v1.0.0-darwin.dmg
|
|
14
|
+
* │ │ └── component1-v1.0.0-darwin-arm64.dmg
|
|
15
|
+
* │ └── v1.1.0/
|
|
16
|
+
* │ ├── component1-v1.1.0-win32.zip
|
|
17
|
+
* │ └── component1-v1.1.0-darwin.dmg
|
|
18
|
+
* └── component2/
|
|
19
|
+
* └── v2.0.0/
|
|
20
|
+
* └── component2-v2.0.0-win32.zip
|
|
21
|
+
*
|
|
22
|
+
* Authentication is handled through AWS credentials (environment variables, IAM roles, etc.)
|
|
23
|
+
*/
|
|
24
|
+
export declare class S3ComponentsStore implements ComponentsStore {
|
|
25
|
+
private logger;
|
|
26
|
+
private bucketName;
|
|
27
|
+
private region;
|
|
28
|
+
private prefix;
|
|
29
|
+
private accessKeyId;
|
|
30
|
+
private secretAccessKey;
|
|
31
|
+
constructor(config: {
|
|
32
|
+
bucketName: string;
|
|
33
|
+
region: string;
|
|
34
|
+
prefix?: string;
|
|
35
|
+
accessKeyId?: string;
|
|
36
|
+
secretAccessKey?: string;
|
|
37
|
+
});
|
|
38
|
+
getInfo(): string;
|
|
39
|
+
getAll(): Promise<Component[]>;
|
|
40
|
+
download(name: string, version: string): Promise<{
|
|
41
|
+
name: string;
|
|
42
|
+
data: any;
|
|
43
|
+
filename: string;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Validate the S3 configuration
|
|
47
|
+
*/
|
|
48
|
+
private validateConfiguration;
|
|
49
|
+
/**
|
|
50
|
+
* List all objects in the S3 bucket
|
|
51
|
+
*/
|
|
52
|
+
private listAllObjects;
|
|
53
|
+
/**
|
|
54
|
+
* List objects in S3 bucket using ListObjectsV2 API
|
|
55
|
+
*/
|
|
56
|
+
private listObjectsV2;
|
|
57
|
+
/**
|
|
58
|
+
* Download an object from S3
|
|
59
|
+
*/
|
|
60
|
+
private downloadObject;
|
|
61
|
+
/**
|
|
62
|
+
* Find the S3 object key for a specific component and version
|
|
63
|
+
*/
|
|
64
|
+
private findComponentObject;
|
|
65
|
+
/**
|
|
66
|
+
* Parse S3 objects into Component array
|
|
67
|
+
*/
|
|
68
|
+
private parseS3ObjectsToComponents;
|
|
69
|
+
/**
|
|
70
|
+
* Parse component information from S3 object key
|
|
71
|
+
*/
|
|
72
|
+
private parseComponentFromKey;
|
|
73
|
+
/**
|
|
74
|
+
* Check if a key matches the current platform
|
|
75
|
+
*/
|
|
76
|
+
private matchesPlatform;
|
|
77
|
+
/**
|
|
78
|
+
* Extract version from S3 object key
|
|
79
|
+
*/
|
|
80
|
+
private extractVersionFromKey;
|
|
81
|
+
/**
|
|
82
|
+
* Extract filename from S3 object key
|
|
83
|
+
*/
|
|
84
|
+
private extractFilenameFromKey;
|
|
85
|
+
/**
|
|
86
|
+
* Build S3 API URL for a given object key
|
|
87
|
+
*/
|
|
88
|
+
private buildS3ApiUrl;
|
|
89
|
+
/**
|
|
90
|
+
* Create AWS Signature Version 4 authentication headers
|
|
91
|
+
*/
|
|
92
|
+
private createAuthHeaders;
|
|
93
|
+
/**
|
|
94
|
+
* Parse S3 ListObjects XML response
|
|
95
|
+
*/
|
|
96
|
+
private parseListObjectsResponse;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=s3.store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3.store.d.ts","sourceRoot":"","sources":["../../../../src/services/components/stores/s3.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAkBzC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,iBAAkB,YAAW,eAAe;IACrD,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,eAAe,CAAqB;gBAEhC,MAAM,EAAE;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC5B;IAUD,OAAO,IAAI,MAAM;IAKX,MAAM,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAoB9B,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;IA8CrG;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA2B7B;;OAEG;YACW,cAAc;IAiB5B;;OA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