@trops/dash-core 0.1.90 → 0.1.92
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/electron/index.js +207 -0
- package/dist/electron/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -592,6 +592,8 @@ const DASHBOARD_CONFIG_INSTALL$1 = "dashboard-config-install";
|
|
|
592
592
|
const DASHBOARD_CONFIG_COMPATIBILITY$1 = "dashboard-config-compatibility";
|
|
593
593
|
const DASHBOARD_CONFIG_PUBLISH$1 = "dashboard-config-publish";
|
|
594
594
|
const DASHBOARD_CONFIG_PREVIEW$1 = "dashboard-config-preview";
|
|
595
|
+
const DASHBOARD_CONFIG_CHECK_UPDATES$1 = "dashboard-config-check-updates";
|
|
596
|
+
const DASHBOARD_CONFIG_PROVIDER_SETUP$1 = "dashboard-config-provider-setup";
|
|
595
597
|
|
|
596
598
|
var dashboardConfigEvents$1 = {
|
|
597
599
|
DASHBOARD_CONFIG_EXPORT: DASHBOARD_CONFIG_EXPORT$1,
|
|
@@ -600,6 +602,8 @@ var dashboardConfigEvents$1 = {
|
|
|
600
602
|
DASHBOARD_CONFIG_COMPATIBILITY: DASHBOARD_CONFIG_COMPATIBILITY$1,
|
|
601
603
|
DASHBOARD_CONFIG_PUBLISH: DASHBOARD_CONFIG_PUBLISH$1,
|
|
602
604
|
DASHBOARD_CONFIG_PREVIEW: DASHBOARD_CONFIG_PREVIEW$1,
|
|
605
|
+
DASHBOARD_CONFIG_CHECK_UPDATES: DASHBOARD_CONFIG_CHECK_UPDATES$1,
|
|
606
|
+
DASHBOARD_CONFIG_PROVIDER_SETUP: DASHBOARD_CONFIG_PROVIDER_SETUP$1,
|
|
603
607
|
};
|
|
604
608
|
|
|
605
609
|
/**
|
|
@@ -8551,6 +8555,104 @@ function buildDashboardPreview(source) {
|
|
|
8551
8555
|
return preview;
|
|
8552
8556
|
}
|
|
8553
8557
|
|
|
8558
|
+
/**
|
|
8559
|
+
* Check installed dashboards for available updates in the registry.
|
|
8560
|
+
*
|
|
8561
|
+
* Compares the `_dashboardConfig.installedVersion` of each workspace
|
|
8562
|
+
* against the current version in the registry.
|
|
8563
|
+
*
|
|
8564
|
+
* @param {Array} workspaces - All workspaces from workspaces.json
|
|
8565
|
+
* @param {Array} registryPackages - Packages from registry index
|
|
8566
|
+
* @returns {Array} Update records with workspace info and version comparison
|
|
8567
|
+
*/
|
|
8568
|
+
function checkDashboardUpdates(workspaces = [], registryPackages = []) {
|
|
8569
|
+
const registryByName = new Map();
|
|
8570
|
+
for (const pkg of registryPackages) {
|
|
8571
|
+
if (pkg.name && (pkg.type || "widget") === "dashboard") {
|
|
8572
|
+
registryByName.set(pkg.name, pkg);
|
|
8573
|
+
}
|
|
8574
|
+
}
|
|
8575
|
+
|
|
8576
|
+
const updates = [];
|
|
8577
|
+
|
|
8578
|
+
for (const ws of workspaces) {
|
|
8579
|
+
const config = ws._dashboardConfig;
|
|
8580
|
+
if (!config || !config.registryPackage) continue;
|
|
8581
|
+
|
|
8582
|
+
const registryPkg = registryByName.get(config.registryPackage);
|
|
8583
|
+
if (!registryPkg) continue;
|
|
8584
|
+
|
|
8585
|
+
const installedVersion = config.installedVersion || "0.0.0";
|
|
8586
|
+
const latestVersion = registryPkg.version || "0.0.0";
|
|
8587
|
+
|
|
8588
|
+
if (installedVersion !== latestVersion) {
|
|
8589
|
+
updates.push({
|
|
8590
|
+
workspaceId: ws.id,
|
|
8591
|
+
workspaceName: ws.name || ws.label || "",
|
|
8592
|
+
registryPackage: config.registryPackage,
|
|
8593
|
+
installedVersion,
|
|
8594
|
+
latestVersion,
|
|
8595
|
+
importedAt: config.importedAt || null,
|
|
8596
|
+
});
|
|
8597
|
+
}
|
|
8598
|
+
}
|
|
8599
|
+
|
|
8600
|
+
return updates;
|
|
8601
|
+
}
|
|
8602
|
+
|
|
8603
|
+
/**
|
|
8604
|
+
* Build a provider setup manifest for a dashboard's requirements.
|
|
8605
|
+
* Compares required providers against configured providers,
|
|
8606
|
+
* returning status (configured/needs-setup) for each.
|
|
8607
|
+
*
|
|
8608
|
+
* @param {Array} requiredProviders - Provider requirements from dashboard config
|
|
8609
|
+
* @param {Array} configuredProviders - User's configured providers (from providerController)
|
|
8610
|
+
* @returns {Object} Setup manifest with per-provider status
|
|
8611
|
+
*/
|
|
8612
|
+
function buildProviderSetupManifest(
|
|
8613
|
+
requiredProviders = [],
|
|
8614
|
+
configuredProviders = [],
|
|
8615
|
+
) {
|
|
8616
|
+
const configuredByType = new Map();
|
|
8617
|
+
for (const p of configuredProviders) {
|
|
8618
|
+
const key = p.type || p.name || "";
|
|
8619
|
+
if (key) {
|
|
8620
|
+
configuredByType.set(key.toLowerCase(), p);
|
|
8621
|
+
}
|
|
8622
|
+
}
|
|
8623
|
+
|
|
8624
|
+
const providers = requiredProviders.map((req) => {
|
|
8625
|
+
const typeKey = (req.type || "").toLowerCase();
|
|
8626
|
+
const configured = configuredByType.get(typeKey);
|
|
8627
|
+
|
|
8628
|
+
return {
|
|
8629
|
+
type: req.type || "",
|
|
8630
|
+
providerClass: req.providerClass || "",
|
|
8631
|
+
required: req.required !== false,
|
|
8632
|
+
usedBy: req.usedBy || [],
|
|
8633
|
+
status: configured ? "configured" : "needs-setup",
|
|
8634
|
+
configuredProvider: configured || null,
|
|
8635
|
+
};
|
|
8636
|
+
});
|
|
8637
|
+
|
|
8638
|
+
const configuredCount = providers.filter(
|
|
8639
|
+
(p) => p.status === "configured",
|
|
8640
|
+
).length;
|
|
8641
|
+
const needsSetupCount = providers.filter(
|
|
8642
|
+
(p) => p.status === "needs-setup",
|
|
8643
|
+
).length;
|
|
8644
|
+
|
|
8645
|
+
return {
|
|
8646
|
+
allConfigured: needsSetupCount === 0,
|
|
8647
|
+
summary: {
|
|
8648
|
+
total: providers.length,
|
|
8649
|
+
configured: configuredCount,
|
|
8650
|
+
needsSetup: needsSetupCount,
|
|
8651
|
+
},
|
|
8652
|
+
providers,
|
|
8653
|
+
};
|
|
8654
|
+
}
|
|
8655
|
+
|
|
8554
8656
|
var dashboardConfigUtils$1 = {
|
|
8555
8657
|
collectComponentNames: collectComponentNames$1,
|
|
8556
8658
|
extractEventWiring: extractEventWiring$1,
|
|
@@ -8560,6 +8662,8 @@ var dashboardConfigUtils$1 = {
|
|
|
8560
8662
|
checkDashboardCompatibility,
|
|
8561
8663
|
generateRegistryManifest,
|
|
8562
8664
|
buildDashboardPreview,
|
|
8665
|
+
checkDashboardUpdates,
|
|
8666
|
+
buildProviderSetupManifest,
|
|
8563
8667
|
};
|
|
8564
8668
|
|
|
8565
8669
|
var widgetRegistry$1 = {exports: {}};
|
|
@@ -10299,6 +10403,8 @@ async function processDashboardConfig(
|
|
|
10299
10403
|
importedAt: new Date().toISOString(),
|
|
10300
10404
|
originalAuthor: dashboardConfig.author,
|
|
10301
10405
|
schemaVersion: dashboardConfig.schemaVersion,
|
|
10406
|
+
registryPackage: options.registryPackage || null,
|
|
10407
|
+
installedVersion: options.installedVersion || null,
|
|
10302
10408
|
};
|
|
10303
10409
|
|
|
10304
10410
|
// Save workspace to workspaces.json
|
|
@@ -10455,6 +10561,8 @@ async function installDashboardFromRegistry$1(
|
|
|
10455
10561
|
widgetRegistry,
|
|
10456
10562
|
{
|
|
10457
10563
|
source: "registry",
|
|
10564
|
+
registryPackage: packageName,
|
|
10565
|
+
installedVersion: registryPkg.version || null,
|
|
10458
10566
|
},
|
|
10459
10567
|
);
|
|
10460
10568
|
} catch (error) {
|
|
@@ -10726,6 +10834,75 @@ async function getDashboardPreview$1(packageName, widgetRegistry = null) {
|
|
|
10726
10834
|
};
|
|
10727
10835
|
}
|
|
10728
10836
|
|
|
10837
|
+
/**
|
|
10838
|
+
* Check installed dashboards for available updates.
|
|
10839
|
+
* Reads workspaces, finds those installed from the registry,
|
|
10840
|
+
* and compares versions against the current registry index.
|
|
10841
|
+
*
|
|
10842
|
+
* @param {string} appId - Application identifier
|
|
10843
|
+
* @returns {Promise<Object>} Result with updates array
|
|
10844
|
+
*/
|
|
10845
|
+
async function checkDashboardUpdatesForApp$1(appId) {
|
|
10846
|
+
const { checkDashboardUpdates } = dashboardConfigUtils$1;
|
|
10847
|
+
const { fetchRegistryIndex } = registryController$1;
|
|
10848
|
+
|
|
10849
|
+
try {
|
|
10850
|
+
const filename = path.join(
|
|
10851
|
+
app.getPath("userData"),
|
|
10852
|
+
appName,
|
|
10853
|
+
appId,
|
|
10854
|
+
configFilename,
|
|
10855
|
+
);
|
|
10856
|
+
const workspaces = getFileContents(filename) || [];
|
|
10857
|
+
|
|
10858
|
+
const index = await fetchRegistryIndex();
|
|
10859
|
+
const registryPackages = index.packages || [];
|
|
10860
|
+
|
|
10861
|
+
const updates = checkDashboardUpdates(workspaces, registryPackages);
|
|
10862
|
+
|
|
10863
|
+
return {
|
|
10864
|
+
success: true,
|
|
10865
|
+
updates,
|
|
10866
|
+
totalInstalled: workspaces.filter((w) => w._dashboardConfig?.registryPackage).length,
|
|
10867
|
+
};
|
|
10868
|
+
} catch (error) {
|
|
10869
|
+
console.error(
|
|
10870
|
+
"[DashboardConfigController] Error checking dashboard updates:",
|
|
10871
|
+
error,
|
|
10872
|
+
);
|
|
10873
|
+
return {
|
|
10874
|
+
success: false,
|
|
10875
|
+
error: error.message,
|
|
10876
|
+
updates: [],
|
|
10877
|
+
};
|
|
10878
|
+
}
|
|
10879
|
+
}
|
|
10880
|
+
|
|
10881
|
+
/**
|
|
10882
|
+
* Get a provider setup manifest for a dashboard's requirements.
|
|
10883
|
+
* Compares required providers against the user's configured providers.
|
|
10884
|
+
*
|
|
10885
|
+
* @param {string} appId - Application identifier
|
|
10886
|
+
* @param {Array} requiredProviders - Provider requirements from dashboard config
|
|
10887
|
+
* @returns {Object} Setup manifest with per-provider status
|
|
10888
|
+
*/
|
|
10889
|
+
function getProviderSetupManifest$1(appId, requiredProviders = []) {
|
|
10890
|
+
const { buildProviderSetupManifest } = dashboardConfigUtils$1;
|
|
10891
|
+
const { listProviders } = requireProviderController();
|
|
10892
|
+
|
|
10893
|
+
let configuredProviders = [];
|
|
10894
|
+
try {
|
|
10895
|
+
configuredProviders = listProviders(null, appId) || [];
|
|
10896
|
+
} catch (err) {
|
|
10897
|
+
console.warn(
|
|
10898
|
+
"[DashboardConfigController] Could not list providers:",
|
|
10899
|
+
err.message,
|
|
10900
|
+
);
|
|
10901
|
+
}
|
|
10902
|
+
|
|
10903
|
+
return buildProviderSetupManifest(requiredProviders, configuredProviders);
|
|
10904
|
+
}
|
|
10905
|
+
|
|
10729
10906
|
var dashboardConfigController$1 = {
|
|
10730
10907
|
exportDashboardConfig: exportDashboardConfig$1,
|
|
10731
10908
|
importDashboardConfig: importDashboardConfig$1,
|
|
@@ -10733,6 +10910,8 @@ var dashboardConfigController$1 = {
|
|
|
10733
10910
|
checkCompatibility: checkCompatibility$1,
|
|
10734
10911
|
prepareDashboardForPublish: prepareDashboardForPublish$1,
|
|
10735
10912
|
getDashboardPreview: getDashboardPreview$1,
|
|
10913
|
+
checkDashboardUpdatesForApp: checkDashboardUpdatesForApp$1,
|
|
10914
|
+
getProviderSetupManifest: getProviderSetupManifest$1,
|
|
10736
10915
|
};
|
|
10737
10916
|
|
|
10738
10917
|
/**
|
|
@@ -10828,6 +11007,8 @@ const {
|
|
|
10828
11007
|
checkCompatibility,
|
|
10829
11008
|
prepareDashboardForPublish,
|
|
10830
11009
|
getDashboardPreview,
|
|
11010
|
+
checkDashboardUpdatesForApp,
|
|
11011
|
+
getProviderSetupManifest,
|
|
10831
11012
|
} = dashboardConfigController$1;
|
|
10832
11013
|
|
|
10833
11014
|
var controller = {
|
|
@@ -10877,6 +11058,8 @@ var controller = {
|
|
|
10877
11058
|
checkCompatibility,
|
|
10878
11059
|
prepareDashboardForPublish,
|
|
10879
11060
|
getDashboardPreview,
|
|
11061
|
+
checkDashboardUpdatesForApp,
|
|
11062
|
+
getProviderSetupManifest,
|
|
10880
11063
|
};
|
|
10881
11064
|
|
|
10882
11065
|
const { ipcRenderer: ipcRenderer$i } = require$$0$1;
|
|
@@ -12259,6 +12442,8 @@ const {
|
|
|
12259
12442
|
DASHBOARD_CONFIG_COMPATIBILITY,
|
|
12260
12443
|
DASHBOARD_CONFIG_PUBLISH,
|
|
12261
12444
|
DASHBOARD_CONFIG_PREVIEW,
|
|
12445
|
+
DASHBOARD_CONFIG_CHECK_UPDATES,
|
|
12446
|
+
DASHBOARD_CONFIG_PROVIDER_SETUP,
|
|
12262
12447
|
} = events$8;
|
|
12263
12448
|
|
|
12264
12449
|
const dashboardConfigApi$2 = {
|
|
@@ -12342,6 +12527,28 @@ const dashboardConfigApi$2 = {
|
|
|
12342
12527
|
*/
|
|
12343
12528
|
getDashboardPreview: (packageName) =>
|
|
12344
12529
|
ipcRenderer$1.invoke(DASHBOARD_CONFIG_PREVIEW, { packageName }),
|
|
12530
|
+
|
|
12531
|
+
/**
|
|
12532
|
+
* Check installed dashboards for available updates.
|
|
12533
|
+
*
|
|
12534
|
+
* @param {string} appId - Application identifier
|
|
12535
|
+
* @returns {Promise<Object>} Result with updates array
|
|
12536
|
+
*/
|
|
12537
|
+
checkDashboardUpdates: (appId) =>
|
|
12538
|
+
ipcRenderer$1.invoke(DASHBOARD_CONFIG_CHECK_UPDATES, { appId }),
|
|
12539
|
+
|
|
12540
|
+
/**
|
|
12541
|
+
* Get provider setup manifest for a dashboard's requirements.
|
|
12542
|
+
*
|
|
12543
|
+
* @param {string} appId - Application identifier
|
|
12544
|
+
* @param {Array} requiredProviders - Provider requirements from dashboard config
|
|
12545
|
+
* @returns {Promise<Object>} Setup manifest with per-provider status
|
|
12546
|
+
*/
|
|
12547
|
+
getProviderSetupManifest: (appId, requiredProviders) =>
|
|
12548
|
+
ipcRenderer$1.invoke(DASHBOARD_CONFIG_PROVIDER_SETUP, {
|
|
12549
|
+
appId,
|
|
12550
|
+
requiredProviders,
|
|
12551
|
+
}),
|
|
12345
12552
|
};
|
|
12346
12553
|
|
|
12347
12554
|
var dashboardConfigApi_1 = dashboardConfigApi$2;
|