@trops/dash-core 0.1.355 → 0.1.357
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 +168 -0
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +80 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +80 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -650,6 +650,8 @@ function requireDashboardConfigEvents () {
|
|
|
650
650
|
const DASHBOARD_CONFIG_PUBLISH_PREVIEW = "dashboard-config-publish-preview";
|
|
651
651
|
const DASHBOARD_CONFIG_SELECT_FILE = "dashboard-config-select-file";
|
|
652
652
|
const DASHBOARD_CONFIG_INSTALL_PROGRESS = "dashboard-config-install-progress";
|
|
653
|
+
const DASHBOARD_CONFIG_COLLECT_DEPENDENCIES =
|
|
654
|
+
"dashboard-config-collect-dependencies";
|
|
653
655
|
|
|
654
656
|
dashboardConfigEvents$1 = {
|
|
655
657
|
DASHBOARD_CONFIG_EXPORT,
|
|
@@ -663,6 +665,7 @@ function requireDashboardConfigEvents () {
|
|
|
663
665
|
DASHBOARD_CONFIG_PUBLISH_PREVIEW,
|
|
664
666
|
DASHBOARD_CONFIG_SELECT_FILE,
|
|
665
667
|
DASHBOARD_CONFIG_INSTALL_PROGRESS,
|
|
668
|
+
DASHBOARD_CONFIG_COLLECT_DEPENDENCIES,
|
|
666
669
|
};
|
|
667
670
|
return dashboardConfigEvents$1;
|
|
668
671
|
}
|
|
@@ -62999,8 +63002,34 @@ function checkApiCompatibility(providers = [], appCapabilities = []) {
|
|
|
62999
63002
|
};
|
|
63000
63003
|
}
|
|
63001
63004
|
|
|
63005
|
+
/**
|
|
63006
|
+
* Collect unique component names across a workspace's main layout, every
|
|
63007
|
+
* page layout, and the sidebar layout. Matches what a user actually sees
|
|
63008
|
+
* on screen — `collectComponentNames` only walks a single layout array
|
|
63009
|
+
* and misses widgets placed on non-active pages or in the sidebar.
|
|
63010
|
+
*
|
|
63011
|
+
* @param {Object} workspace - Workspace object ({layout, pages, sidebarLayout})
|
|
63012
|
+
* @returns {string[]} Unique component names
|
|
63013
|
+
*/
|
|
63014
|
+
function collectComponentNamesFromWorkspace$1(workspace) {
|
|
63015
|
+
const names = new Set();
|
|
63016
|
+
const pushAll = (layout) => {
|
|
63017
|
+
if (!Array.isArray(layout)) return;
|
|
63018
|
+
for (const n of collectComponentNames$1(layout)) names.add(n);
|
|
63019
|
+
};
|
|
63020
|
+
|
|
63021
|
+
pushAll(workspace?.layout);
|
|
63022
|
+
pushAll(workspace?.sidebarLayout);
|
|
63023
|
+
if (Array.isArray(workspace?.pages)) {
|
|
63024
|
+
for (const page of workspace.pages) pushAll(page?.layout);
|
|
63025
|
+
}
|
|
63026
|
+
|
|
63027
|
+
return Array.from(names);
|
|
63028
|
+
}
|
|
63029
|
+
|
|
63002
63030
|
var dashboardConfigUtils$1 = {
|
|
63003
63031
|
collectComponentNames: collectComponentNames$1,
|
|
63032
|
+
collectComponentNamesFromWorkspace: collectComponentNamesFromWorkspace$1,
|
|
63004
63033
|
extractEventWiring: extractEventWiring$1,
|
|
63005
63034
|
buildWidgetDependencies: buildWidgetDependencies$1,
|
|
63006
63035
|
buildProviderRequirements: buildProviderRequirements$1,
|
|
@@ -63700,6 +63729,7 @@ const {
|
|
|
63700
63729
|
} = dashboardConfigValidator$1;
|
|
63701
63730
|
const {
|
|
63702
63731
|
collectComponentNames,
|
|
63732
|
+
collectComponentNamesFromWorkspace,
|
|
63703
63733
|
extractEventWiring,
|
|
63704
63734
|
buildWidgetDependencies,
|
|
63705
63735
|
buildProviderRequirements,
|
|
@@ -64711,6 +64741,120 @@ async function checkCompatibility$1(dashboardWidgets, widgetRegistry = null) {
|
|
|
64711
64741
|
);
|
|
64712
64742
|
}
|
|
64713
64743
|
|
|
64744
|
+
/**
|
|
64745
|
+
* Collect enriched dependency info for a workspace — widgets + theme.
|
|
64746
|
+
*
|
|
64747
|
+
* Read-only. Used by the batch-publish dialog to build its dependency
|
|
64748
|
+
* table. Resolves local state (scope, name, version from each widget's
|
|
64749
|
+
* package.json, and packageDir for later zipping). Does NOT query the
|
|
64750
|
+
* registry — that's the caller's job (see registry resolve endpoint).
|
|
64751
|
+
*
|
|
64752
|
+
* @param {string} appId - Application identifier
|
|
64753
|
+
* @param {number|string} workspaceId - Workspace ID
|
|
64754
|
+
* @param {Object} widgetRegistry - WidgetRegistry instance
|
|
64755
|
+
* @param {Object} options - { componentConfigs?: Object }
|
|
64756
|
+
* @returns {Promise<Object>} { success, widgets, theme }
|
|
64757
|
+
*/
|
|
64758
|
+
async function collectDashboardDependencies$1(
|
|
64759
|
+
appId,
|
|
64760
|
+
workspaceId,
|
|
64761
|
+
widgetRegistry = null,
|
|
64762
|
+
options = {},
|
|
64763
|
+
) {
|
|
64764
|
+
try {
|
|
64765
|
+
// 1. Read workspace
|
|
64766
|
+
const filename = path$1.join(
|
|
64767
|
+
app$1.getPath("userData"),
|
|
64768
|
+
appName$1,
|
|
64769
|
+
appId,
|
|
64770
|
+
configFilename,
|
|
64771
|
+
);
|
|
64772
|
+
const workspacesArray = getFileContents$1(filename);
|
|
64773
|
+
const workspace = workspacesArray.find(
|
|
64774
|
+
(w) => w.id === workspaceId || w.id === Number(workspaceId),
|
|
64775
|
+
);
|
|
64776
|
+
|
|
64777
|
+
if (!workspace) {
|
|
64778
|
+
return {
|
|
64779
|
+
success: false,
|
|
64780
|
+
error: `Workspace not found: ${workspaceId}`,
|
|
64781
|
+
};
|
|
64782
|
+
}
|
|
64783
|
+
|
|
64784
|
+
// 2. Collect component names from main + pages + sidebar layouts
|
|
64785
|
+
const componentNames = collectComponentNamesFromWorkspace(workspace);
|
|
64786
|
+
|
|
64787
|
+
// 3. Resolve widget refs (scope, packageName, widgetName, version)
|
|
64788
|
+
const deps = buildWidgetDependencies(
|
|
64789
|
+
componentNames,
|
|
64790
|
+
widgetRegistry,
|
|
64791
|
+
options.componentConfigs || null,
|
|
64792
|
+
);
|
|
64793
|
+
|
|
64794
|
+
// 4. Enrich with packageDir + componentNames-in-package (from registry)
|
|
64795
|
+
// so the caller can zip and publish each widget.
|
|
64796
|
+
const installedWidgets = widgetRegistry ? widgetRegistry.getWidgets() : [];
|
|
64797
|
+
|
|
64798
|
+
const widgets = deps.map((dep) => {
|
|
64799
|
+
// Find the installed widget whose componentNames contains this dep's widgetName
|
|
64800
|
+
const match = installedWidgets.find(
|
|
64801
|
+
(w) =>
|
|
64802
|
+
(w.componentNames && w.componentNames.includes(dep.widgetName)) ||
|
|
64803
|
+
(w.scope === dep.scope &&
|
|
64804
|
+
(w.name === dep.packageName ||
|
|
64805
|
+
w.packageId === `${dep.scope}/${dep.packageName}`)),
|
|
64806
|
+
);
|
|
64807
|
+
|
|
64808
|
+
return {
|
|
64809
|
+
scope: dep.scope || null,
|
|
64810
|
+
packageName: dep.packageName,
|
|
64811
|
+
widgetName: dep.widgetName,
|
|
64812
|
+
component: dep.widgetName,
|
|
64813
|
+
localVersion: dep.version,
|
|
64814
|
+
packageDir: match?.path || null,
|
|
64815
|
+
packageId: match?.packageId || null,
|
|
64816
|
+
author: dep.author || "",
|
|
64817
|
+
hasLocalPackage: !!match?.path,
|
|
64818
|
+
};
|
|
64819
|
+
});
|
|
64820
|
+
|
|
64821
|
+
// 5. Resolve theme (if workspace has one)
|
|
64822
|
+
let theme = null;
|
|
64823
|
+
if (workspace.themeKey) {
|
|
64824
|
+
try {
|
|
64825
|
+
const themeResult = themeController$2.listThemesForApplication(
|
|
64826
|
+
null,
|
|
64827
|
+
appId,
|
|
64828
|
+
);
|
|
64829
|
+
const themeData = themeResult?.themes?.[workspace.themeKey];
|
|
64830
|
+
if (themeData) {
|
|
64831
|
+
const registryMeta = themeData._registryMeta || {};
|
|
64832
|
+
theme = {
|
|
64833
|
+
themeKey: workspace.themeKey,
|
|
64834
|
+
scope: registryMeta.scope || null,
|
|
64835
|
+
name: registryMeta.name || workspace.themeKey,
|
|
64836
|
+
localVersion: registryMeta.version || null,
|
|
64837
|
+
hasRegistryMeta: !!themeData._registryMeta,
|
|
64838
|
+
};
|
|
64839
|
+
}
|
|
64840
|
+
} catch (err) {
|
|
64841
|
+
console.warn(
|
|
64842
|
+
"[dashboardConfig] Could not resolve theme for dependencies:",
|
|
64843
|
+
err.message,
|
|
64844
|
+
);
|
|
64845
|
+
}
|
|
64846
|
+
}
|
|
64847
|
+
|
|
64848
|
+
return { success: true, widgets, theme };
|
|
64849
|
+
} catch (error) {
|
|
64850
|
+
console.error(
|
|
64851
|
+
"[dashboardConfig] collectDashboardDependencies failed:",
|
|
64852
|
+
error,
|
|
64853
|
+
);
|
|
64854
|
+
return { success: false, error: error.message };
|
|
64855
|
+
}
|
|
64856
|
+
}
|
|
64857
|
+
|
|
64714
64858
|
/**
|
|
64715
64859
|
* Prepare a dashboard for publishing to the registry.
|
|
64716
64860
|
*
|
|
@@ -65179,6 +65323,7 @@ var dashboardConfigController$1 = {
|
|
|
65179
65323
|
installDashboardFromRegistry: installDashboardFromRegistry$1,
|
|
65180
65324
|
checkCompatibility: checkCompatibility$1,
|
|
65181
65325
|
prepareDashboardForPublish: prepareDashboardForPublish$1,
|
|
65326
|
+
collectDashboardDependencies: collectDashboardDependencies$1,
|
|
65182
65327
|
getDashboardPreview: getDashboardPreview$1,
|
|
65183
65328
|
checkDashboardUpdatesForApp: checkDashboardUpdatesForApp$1,
|
|
65184
65329
|
getProviderSetupManifest: getProviderSetupManifest$1,
|
|
@@ -71497,6 +71642,7 @@ const {
|
|
|
71497
71642
|
installDashboardFromRegistry,
|
|
71498
71643
|
checkCompatibility,
|
|
71499
71644
|
prepareDashboardForPublish,
|
|
71645
|
+
collectDashboardDependencies,
|
|
71500
71646
|
getDashboardPreview,
|
|
71501
71647
|
checkDashboardUpdatesForApp,
|
|
71502
71648
|
getProviderSetupManifest,
|
|
@@ -71593,6 +71739,7 @@ var controller = {
|
|
|
71593
71739
|
installDashboardFromRegistry,
|
|
71594
71740
|
checkCompatibility,
|
|
71595
71741
|
prepareDashboardForPublish,
|
|
71742
|
+
collectDashboardDependencies,
|
|
71596
71743
|
getDashboardPreview,
|
|
71597
71744
|
checkDashboardUpdatesForApp,
|
|
71598
71745
|
getProviderSetupManifest,
|
|
@@ -73128,6 +73275,7 @@ const {
|
|
|
73128
73275
|
DASHBOARD_CONFIG_PROVIDER_SETUP,
|
|
73129
73276
|
DASHBOARD_CONFIG_PUBLISH_PREVIEW,
|
|
73130
73277
|
DASHBOARD_CONFIG_INSTALL_PROGRESS,
|
|
73278
|
+
DASHBOARD_CONFIG_COLLECT_DEPENDENCIES,
|
|
73131
73279
|
} = events$8;
|
|
73132
73280
|
|
|
73133
73281
|
const dashboardConfigApi$2 = {
|
|
@@ -73212,6 +73360,25 @@ const dashboardConfigApi$2 = {
|
|
|
73212
73360
|
options,
|
|
73213
73361
|
}),
|
|
73214
73362
|
|
|
73363
|
+
/**
|
|
73364
|
+
* Collect enriched widget + theme dependency info for a workspace.
|
|
73365
|
+
* Used by the batch-publish dialog to build its dependency table.
|
|
73366
|
+
*
|
|
73367
|
+
* Returns local state only — the caller is responsible for enriching
|
|
73368
|
+
* with registry state (ownership, latest published version, visibility).
|
|
73369
|
+
*
|
|
73370
|
+
* @param {string} appId - Application identifier
|
|
73371
|
+
* @param {number|string} workspaceId - Workspace ID
|
|
73372
|
+
* @param {Object} options - { componentConfigs?: Object }
|
|
73373
|
+
* @returns {Promise<Object>} { success, widgets, theme }
|
|
73374
|
+
*/
|
|
73375
|
+
collectDashboardDependencies: (appId, workspaceId, options = {}) =>
|
|
73376
|
+
ipcRenderer$9.invoke(DASHBOARD_CONFIG_COLLECT_DEPENDENCIES, {
|
|
73377
|
+
appId,
|
|
73378
|
+
workspaceId,
|
|
73379
|
+
options,
|
|
73380
|
+
}),
|
|
73381
|
+
|
|
73215
73382
|
/**
|
|
73216
73383
|
* Get a preview of a dashboard package from the registry.
|
|
73217
73384
|
* Returns structured preview data and compatibility report.
|
|
@@ -74876,6 +75043,7 @@ function createMainApi$1(extensions = {}) {
|
|
|
74876
75043
|
publish: (eventType, content) => {
|
|
74877
75044
|
ipcRenderer.send("widget-event:publish", { eventType, content });
|
|
74878
75045
|
},
|
|
75046
|
+
getLastEvents: () => ipcRenderer.invoke("widget-event:get-last-events"),
|
|
74879
75047
|
},
|
|
74880
75048
|
|
|
74881
75049
|
// Merge template-specific extensions
|