@trops/dash-core 0.1.103 → 0.1.105

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.
@@ -594,6 +594,7 @@ const DASHBOARD_CONFIG_PUBLISH$1 = "dashboard-config-publish";
594
594
  const DASHBOARD_CONFIG_PREVIEW$1 = "dashboard-config-preview";
595
595
  const DASHBOARD_CONFIG_CHECK_UPDATES$1 = "dashboard-config-check-updates";
596
596
  const DASHBOARD_CONFIG_PROVIDER_SETUP$1 = "dashboard-config-provider-setup";
597
+ const DASHBOARD_CONFIG_PUBLISH_PREVIEW$1 = "dashboard-config-publish-preview";
597
598
 
598
599
  var dashboardConfigEvents$1 = {
599
600
  DASHBOARD_CONFIG_EXPORT: DASHBOARD_CONFIG_EXPORT$1,
@@ -604,6 +605,7 @@ var dashboardConfigEvents$1 = {
604
605
  DASHBOARD_CONFIG_PREVIEW: DASHBOARD_CONFIG_PREVIEW$1,
605
606
  DASHBOARD_CONFIG_CHECK_UPDATES: DASHBOARD_CONFIG_CHECK_UPDATES$1,
606
607
  DASHBOARD_CONFIG_PROVIDER_SETUP: DASHBOARD_CONFIG_PROVIDER_SETUP$1,
608
+ DASHBOARD_CONFIG_PUBLISH_PREVIEW: DASHBOARD_CONFIG_PUBLISH_PREVIEW$1,
607
609
  };
608
610
 
609
611
  /**
@@ -11072,9 +11074,20 @@ async function prepareDashboardForPublish$1(
11072
11074
  let missingFromRegistry = [];
11073
11075
  if (!registryCheckFailed) {
11074
11076
  const registryNames = new Set(registryPackages.map((p) => p.name));
11075
- missingFromRegistry = widgets
11076
- .filter((w) => w.required !== false && !registryNames.has(w.package))
11077
- .map((w) => w.package);
11077
+ const missingWidgets = widgets.filter(
11078
+ (w) => w.required !== false && !registryNames.has(w.package),
11079
+ );
11080
+ const grouped = {};
11081
+ for (const w of missingWidgets) {
11082
+ if (!grouped[w.package]) grouped[w.package] = [];
11083
+ const widgetName = w.id.includes(".") ? w.id.split(".")[1] : w.id;
11084
+ if (!grouped[w.package].includes(widgetName)) {
11085
+ grouped[w.package].push(widgetName);
11086
+ }
11087
+ }
11088
+ missingFromRegistry = Object.entries(grouped).map(
11089
+ ([pkg, widgetNames]) => ({ package: pkg, widgets: widgetNames }),
11090
+ );
11078
11091
  }
11079
11092
 
11080
11093
  // 6. Generate registry manifest
@@ -11287,6 +11300,52 @@ function getProviderSetupManifest$1(appId, requiredProviders = []) {
11287
11300
  return buildProviderSetupManifest(requiredProviders, configuredProviders);
11288
11301
  }
11289
11302
 
11303
+ /**
11304
+ * Get a publish preview for a dashboard workspace.
11305
+ * Returns widget/layout info without creating a ZIP or uploading.
11306
+ *
11307
+ * @param {string} appId - Application identifier
11308
+ * @param {number|string} workspaceId - Workspace to preview
11309
+ * @param {Object} widgetRegistry - WidgetRegistry instance (optional)
11310
+ * @returns {Object} Preview with dashboardName, widgetCount, widgets, componentNames
11311
+ */
11312
+ function getDashboardPublishPreview$1(appId, workspaceId, widgetRegistry = null) {
11313
+ try {
11314
+ const filename = path$1.join(
11315
+ app$1.getPath("userData"),
11316
+ appName$1,
11317
+ appId,
11318
+ configFilename,
11319
+ );
11320
+ const workspacesArray = getFileContents$1(filename);
11321
+ const workspace = workspacesArray.find(
11322
+ (w) => w.id === workspaceId || w.id === Number(workspaceId),
11323
+ );
11324
+
11325
+ if (!workspace) {
11326
+ return { success: false, error: `Workspace not found: ${workspaceId}` };
11327
+ }
11328
+
11329
+ const layout = workspace.layout || [];
11330
+ const componentNames = collectComponentNames(layout);
11331
+ const widgets = buildWidgetDependencies(componentNames, widgetRegistry);
11332
+
11333
+ return {
11334
+ success: true,
11335
+ dashboardName: workspace.name || workspace.label || "Dashboard",
11336
+ widgetCount: componentNames.length,
11337
+ widgets: widgets.map((w) => ({ name: w.name, package: w.package })),
11338
+ componentNames: [...componentNames],
11339
+ };
11340
+ } catch (error) {
11341
+ console.error(
11342
+ "[DashboardConfigController] Error getting publish preview:",
11343
+ error,
11344
+ );
11345
+ return { success: false, error: error.message };
11346
+ }
11347
+ }
11348
+
11290
11349
  var dashboardConfigController$1 = {
11291
11350
  exportDashboardConfig: exportDashboardConfig$1,
11292
11351
  importDashboardConfig: importDashboardConfig$1,
@@ -11296,6 +11355,7 @@ var dashboardConfigController$1 = {
11296
11355
  getDashboardPreview: getDashboardPreview$1,
11297
11356
  checkDashboardUpdatesForApp: checkDashboardUpdatesForApp$1,
11298
11357
  getProviderSetupManifest: getProviderSetupManifest$1,
11358
+ getDashboardPublishPreview: getDashboardPublishPreview$1,
11299
11359
  };
11300
11360
 
11301
11361
  /**
@@ -11551,6 +11611,7 @@ const {
11551
11611
  getDashboardPreview,
11552
11612
  checkDashboardUpdatesForApp,
11553
11613
  getProviderSetupManifest,
11614
+ getDashboardPublishPreview,
11554
11615
  } = dashboardConfigController$1;
11555
11616
  const {
11556
11617
  initiateDeviceFlow,
@@ -11621,6 +11682,7 @@ var controller = {
11621
11682
  getDashboardPreview,
11622
11683
  checkDashboardUpdatesForApp,
11623
11684
  getProviderSetupManifest,
11685
+ getDashboardPublishPreview,
11624
11686
  saveDashboardRating,
11625
11687
  getDashboardRating,
11626
11688
  listDashboardRatings,
@@ -13018,6 +13080,7 @@ const {
13018
13080
  DASHBOARD_CONFIG_PREVIEW,
13019
13081
  DASHBOARD_CONFIG_CHECK_UPDATES,
13020
13082
  DASHBOARD_CONFIG_PROVIDER_SETUP,
13083
+ DASHBOARD_CONFIG_PUBLISH_PREVIEW,
13021
13084
  } = events$8;
13022
13085
 
13023
13086
  const dashboardConfigApi$2 = {
@@ -13123,6 +13186,20 @@ const dashboardConfigApi$2 = {
13123
13186
  appId,
13124
13187
  requiredProviders,
13125
13188
  }),
13189
+
13190
+ /**
13191
+ * Get a publish preview for a dashboard workspace.
13192
+ * Returns widget names and package info without creating a ZIP or uploading.
13193
+ *
13194
+ * @param {string} appId - Application identifier
13195
+ * @param {number|string} workspaceId - Workspace to preview
13196
+ * @returns {Promise<Object>} Preview with dashboardName, widgetCount, widgets, componentNames
13197
+ */
13198
+ getPublishPreview: (appId, workspaceId) =>
13199
+ ipcRenderer$3.invoke(DASHBOARD_CONFIG_PUBLISH_PREVIEW, {
13200
+ appId,
13201
+ workspaceId,
13202
+ }),
13126
13203
  };
13127
13204
 
13128
13205
  var dashboardConfigApi_1 = dashboardConfigApi$2;