@trops/dash-core 0.1.367 → 0.1.368

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.
@@ -64977,6 +64977,7 @@ async function getDashboardPublishPlan$1(
64977
64977
  ) {
64978
64978
  try {
64979
64979
  const { resolvePackages } = registryApiController$3;
64980
+ const { getRegistryProfile } = registryAuthController$2;
64980
64981
 
64981
64982
  const deps = await collectDashboardDependencies$1(
64982
64983
  appId,
@@ -64988,19 +64989,35 @@ async function getDashboardPublishPlan$1(
64988
64989
  return { success: false, error: deps.error };
64989
64990
  }
64990
64991
 
64991
- // Dedupe by scope/name many components can share the same package,
64992
- // and there's no point sending duplicate refs to the registry.
64992
+ // Local scopes (e.g. `@ai-built/…` for AI-generated widgets) differ
64993
+ // from the registry scope widgets always publish under the caller's
64994
+ // username. Resolve against the caller's scope so "exists / owned /
64995
+ // latest version" reflect reality.
64996
+ const profile = await getRegistryProfile().catch(() => null);
64997
+ const callerScope = profile?.username || null;
64998
+
64999
+ const publishScopeFor = (w) => {
65000
+ if (!w.scope || !w.packageName) return null;
65001
+ return callerScope || w.scope;
65002
+ };
65003
+
65004
+ // Dedupe by publish-scope/name — many components share the same
65005
+ // package, and duplicate refs waste registry calls.
64993
65006
  const refs = [];
64994
65007
  const seenRefs = new Set();
64995
65008
  for (const w of deps.widgets) {
64996
- if (!w.scope || !w.packageName) continue;
64997
- const key = `${w.scope}/${w.packageName}`;
65009
+ const scope = publishScopeFor(w);
65010
+ if (!scope || !w.packageName) continue;
65011
+ const key = `${scope}/${w.packageName}`;
64998
65012
  if (seenRefs.has(key)) continue;
64999
65013
  seenRefs.add(key);
65000
- refs.push({ scope: w.scope, name: w.packageName });
65014
+ refs.push({ scope, name: w.packageName });
65001
65015
  }
65002
65016
  if (deps.theme && deps.theme.scope && deps.theme.name) {
65003
- refs.push({ scope: deps.theme.scope, name: deps.theme.name });
65017
+ refs.push({
65018
+ scope: callerScope || deps.theme.scope,
65019
+ name: deps.theme.name,
65020
+ });
65004
65021
  }
65005
65022
 
65006
65023
  let registryError = null;
@@ -65017,22 +65034,28 @@ async function getDashboardPublishPlan$1(
65017
65034
  }
65018
65035
 
65019
65036
  const widgets = deps.widgets.map((w) => {
65037
+ const publishScope = publishScopeFor(w);
65020
65038
  const key =
65021
- w.scope && w.packageName ? `${w.scope}/${w.packageName}` : null;
65039
+ publishScope && w.packageName
65040
+ ? `${publishScope}/${w.packageName}`
65041
+ : null;
65022
65042
  return {
65023
65043
  ...w,
65044
+ publishScope,
65024
65045
  registry: key ? resolvedByKey.get(key) || null : null,
65025
65046
  };
65026
65047
  });
65027
65048
 
65028
65049
  let theme = null;
65029
65050
  if (deps.theme) {
65051
+ const themeScope = callerScope || deps.theme.scope;
65030
65052
  const key =
65031
- deps.theme.scope && deps.theme.name
65032
- ? `${deps.theme.scope}/${deps.theme.name}`
65053
+ themeScope && deps.theme.name
65054
+ ? `${themeScope}/${deps.theme.name}`
65033
65055
  : null;
65034
65056
  theme = {
65035
65057
  ...deps.theme,
65058
+ publishScope: themeScope,
65036
65059
  registry: key ? resolvedByKey.get(key) || null : null,
65037
65060
  };
65038
65061
  }
@@ -65041,6 +65064,7 @@ async function getDashboardPublishPlan$1(
65041
65064
  success: true,
65042
65065
  widgets,
65043
65066
  theme,
65067
+ callerScope,
65044
65068
  ...(registryError ? { registryError } : {}),
65045
65069
  };
65046
65070
  } catch (error) {