@trops/dash-core 0.1.363 → 0.1.365

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.
@@ -471,6 +471,7 @@ const REGISTRY_CHECK_UPDATES = "registry:check-updates";
471
471
  const REGISTRY_SEARCH_DASHBOARDS = "registry:search-dashboards";
472
472
  const REGISTRY_SEARCH_THEMES = "registry:search-themes";
473
473
  const REGISTRY_PUBLISH_WIDGET = "registry:publish-widget";
474
+ const REGISTRY_INSPECT_WIDGET_PACKAGE = "registry:inspect-widget-package";
474
475
 
475
476
  var registryEvents$1 = {
476
477
  REGISTRY_FETCH_INDEX,
@@ -480,6 +481,7 @@ var registryEvents$1 = {
480
481
  REGISTRY_SEARCH_DASHBOARDS,
481
482
  REGISTRY_SEARCH_THEMES,
482
483
  REGISTRY_PUBLISH_WIDGET,
484
+ REGISTRY_INSPECT_WIDGET_PACKAGE,
483
485
  };
484
486
 
485
487
  /**
@@ -71993,9 +71995,13 @@ async function prepareWidgetForPublish$1(appId, packageId, options = {}) {
71993
71995
  };
71994
71996
  }
71995
71997
  const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
71998
+ // Scope resolution: the caller's registry username always wins. The
71999
+ // package.json may use a local naming convention (e.g. `@ai-built/…`
72000
+ // for AI-generated widgets) but the registry only allows publishing
72001
+ // under the authenticated user's scope. `options.scope` is honored
72002
+ // only if explicitly provided (e.g. for future org publishing).
71996
72003
  const parsedName = parsePackageName(pkgJson.name || "");
71997
- const resolvedScope =
71998
- options.scope || parsedName.scope || widget.scope || callerScope;
72004
+ const resolvedScope = options.scope || callerScope;
71999
72005
 
72000
72006
  // 4. Compute + persist new version
72001
72007
  const previousVersion = pkgJson.version || "1.0.0";
@@ -72087,8 +72093,67 @@ async function prepareWidgetForPublish$1(appId, packageId, options = {}) {
72087
72093
  }
72088
72094
  }
72089
72095
 
72096
+ /**
72097
+ * Inspect a locally-installed widget package and return a summary of
72098
+ * metadata the publish UI can display — package.json fields, the
72099
+ * caller's scope, and the list of component widgets the package exposes.
72100
+ *
72101
+ * @param {string} packageId - Widget packageId (e.g. "@scope/name")
72102
+ * @returns {Promise<Object>} { success, packageId, scope, name, version, displayName, description, components: [...] }
72103
+ */
72104
+ async function inspectWidgetPackage$1(packageId) {
72105
+ try {
72106
+ const registry = widgetRegistryModule.getWidgetRegistry();
72107
+ const widget = registry.getWidget(packageId);
72108
+ if (!widget || !widget.path) {
72109
+ return {
72110
+ success: false,
72111
+ error: `Widget package not found locally: ${packageId}`,
72112
+ };
72113
+ }
72114
+
72115
+ let pkgJson = {};
72116
+ const pkgJsonPath = path.join(widget.path, "package.json");
72117
+ if (fs.existsSync(pkgJsonPath)) {
72118
+ try {
72119
+ pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
72120
+ } catch {
72121
+ /* ignore */
72122
+ }
72123
+ }
72124
+ const parsed = parsePackageName(pkgJson.name || packageId);
72125
+
72126
+ let widgetConfigs = widget.widgets || [];
72127
+ if (!widgetConfigs.length) {
72128
+ widgetConfigs = await scanWidgetConfigs(widget.path);
72129
+ }
72130
+
72131
+ const components = widgetConfigs.map((cfg) => ({
72132
+ name: cfg.component || cfg.name,
72133
+ displayName: cfg.name || cfg.component,
72134
+ description: cfg.description || "",
72135
+ icon: cfg.icon || "square",
72136
+ }));
72137
+
72138
+ return {
72139
+ success: true,
72140
+ packageId,
72141
+ localScope: parsed.scope || widget.scope || null,
72142
+ name: parsed.name,
72143
+ version: pkgJson.version || widget.version || null,
72144
+ displayName: pkgJson.displayName || widget.displayName || parsed.name,
72145
+ description: pkgJson.description || widget.description || "",
72146
+ path: widget.path,
72147
+ components,
72148
+ };
72149
+ } catch (err) {
72150
+ return { success: false, error: err.message };
72151
+ }
72152
+ }
72153
+
72090
72154
  var widgetRegistryController = {
72091
72155
  prepareWidgetForPublish: prepareWidgetForPublish$1,
72156
+ inspectWidgetPackage: inspectWidgetPackage$1,
72092
72157
  };
72093
72158
 
72094
72159
  /**
@@ -72201,7 +72266,10 @@ const {
72201
72266
  installThemeFromRegistry,
72202
72267
  getThemePublishPreview,
72203
72268
  } = themeRegistryController$1;
72204
- const { prepareWidgetForPublish } = widgetRegistryController;
72269
+ const {
72270
+ prepareWidgetForPublish,
72271
+ inspectWidgetPackage,
72272
+ } = widgetRegistryController;
72205
72273
  const {
72206
72274
  assignRoles,
72207
72275
  matchTailwindFamily,
@@ -72290,6 +72358,7 @@ var controller = {
72290
72358
  installThemeFromRegistry,
72291
72359
  getThemePublishPreview,
72292
72360
  prepareWidgetForPublish,
72361
+ inspectWidgetPackage,
72293
72362
  assignRoles,
72294
72363
  matchTailwindFamily,
72295
72364
  generateThemeFromPalette,
@@ -73414,6 +73483,25 @@ const registryApi$2 = {
73414
73483
  throw error;
73415
73484
  }
73416
73485
  },
73486
+
73487
+ /**
73488
+ * Inspect a locally-installed widget package and return its metadata
73489
+ * + list of component widgets. Used by the publish modal to show
73490
+ * "what's getting published" before the user hits Publish.
73491
+ *
73492
+ * @param {string} packageId - Widget packageId (e.g. "@scope/name")
73493
+ * @returns {Promise<Object>} { success, packageId, localScope, name, version, displayName, description, components: [{name, displayName, description, icon}] }
73494
+ */
73495
+ inspectWidgetPackage: async (packageId) => {
73496
+ try {
73497
+ return await ipcRenderer$h.invoke("registry:inspect-widget-package", {
73498
+ packageId,
73499
+ });
73500
+ } catch (error) {
73501
+ console.error("[RegistryApi] Error inspecting package:", error);
73502
+ throw error;
73503
+ }
73504
+ },
73417
73505
  };
73418
73506
 
73419
73507
  var registryApi_1 = registryApi$2;