@trops/dash-core 0.1.133 → 0.1.134

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.
@@ -10440,7 +10440,7 @@ function getAuthStatus$1() {
10440
10440
  *
10441
10441
  * @returns {Promise<Object|null>} User profile or null
10442
10442
  */
10443
- async function getRegistryProfile$1() {
10443
+ async function getRegistryProfile$2() {
10444
10444
  const stored = getStoredToken$1();
10445
10445
  if (!stored) return null;
10446
10446
 
@@ -10615,7 +10615,7 @@ var registryAuthController$1 = {
10615
10615
  pollForToken: pollForToken$1,
10616
10616
  getStoredToken: getStoredToken$1,
10617
10617
  getAuthStatus: getAuthStatus$1,
10618
- getRegistryProfile: getRegistryProfile$1,
10618
+ getRegistryProfile: getRegistryProfile$2,
10619
10619
  updateRegistryProfile: updateRegistryProfile$1,
10620
10620
  getRegistryPackages: getRegistryPackages$1,
10621
10621
  updateRegistryPackage: updateRegistryPackage$1,
@@ -10734,7 +10734,10 @@ const AdmZip$1 = require$$3$3;
10734
10734
  const themeController$2 = themeController_1;
10735
10735
  const registryController$1 = registryController$2;
10736
10736
  const registryApiController$1 = registryApiController$2;
10737
- const { getAuthStatus } = registryAuthController$1;
10737
+ const {
10738
+ getAuthStatus,
10739
+ getRegistryProfile: getRegistryProfile$1,
10740
+ } = registryAuthController$1;
10738
10741
 
10739
10742
  /**
10740
10743
  * Sanitize a name for use as a filename (lowercase, hyphens only).
@@ -10824,7 +10827,10 @@ async function prepareThemeForPublish$1(win, appId, themeKey, options = {}) {
10824
10827
  // Read the theme data
10825
10828
  const themesResult = themeController$2.listThemesForApplication(win, appId);
10826
10829
  if (themesResult.error) {
10827
- return { success: false, error: "Failed to read themes: " + themesResult.message };
10830
+ return {
10831
+ success: false,
10832
+ error: "Failed to read themes: " + themesResult.message,
10833
+ };
10828
10834
  }
10829
10835
 
10830
10836
  const themeData = themesResult.themes[themeKey];
@@ -10832,16 +10838,24 @@ async function prepareThemeForPublish$1(win, appId, themeKey, options = {}) {
10832
10838
  return { success: false, error: `Theme "${themeKey}" not found` };
10833
10839
  }
10834
10840
 
10835
- // Get auth status for scope
10841
+ // Get auth status and profile for scope
10836
10842
  const auth = getAuthStatus();
10837
- const scope = auth.profile?.username || options.scope || "";
10838
- if (!scope) {
10843
+ if (!auth.authenticated) {
10839
10844
  return {
10840
10845
  success: false,
10841
10846
  error: "Not authenticated with registry",
10842
10847
  authRequired: true,
10843
10848
  };
10844
10849
  }
10850
+ const profile = await getRegistryProfile$1();
10851
+ const scope = profile?.username || options.scope || "";
10852
+ if (!scope) {
10853
+ return {
10854
+ success: false,
10855
+ error: "Could not determine registry username",
10856
+ authRequired: true,
10857
+ };
10858
+ }
10845
10859
 
10846
10860
  // Generate manifest
10847
10861
  const manifest = generateThemeRegistryManifest(themeData, themeKey, {
@@ -10851,10 +10865,15 @@ async function prepareThemeForPublish$1(win, appId, themeKey, options = {}) {
10851
10865
  });
10852
10866
 
10853
10867
  // Validate colors
10854
- if (!manifest.colors.primary || !manifest.colors.secondary || !manifest.colors.tertiary) {
10868
+ if (
10869
+ !manifest.colors.primary ||
10870
+ !manifest.colors.secondary ||
10871
+ !manifest.colors.tertiary
10872
+ ) {
10855
10873
  return {
10856
10874
  success: false,
10857
- error: "Theme must have primary, secondary, and tertiary colors defined",
10875
+ error:
10876
+ "Theme must have primary, secondary, and tertiary colors defined",
10858
10877
  };
10859
10878
  }
10860
10879
 
@@ -10895,7 +10914,10 @@ async function prepareThemeForPublish$1(win, appId, themeKey, options = {}) {
10895
10914
  filePath,
10896
10915
  manifest,
10897
10916
  );
10898
- console.log("[ThemeRegistryController] Registry publish result:", registryResult);
10917
+ console.log(
10918
+ "[ThemeRegistryController] Registry publish result:",
10919
+ registryResult,
10920
+ );
10899
10921
  }
10900
10922
 
10901
10923
  return {
@@ -10905,7 +10927,10 @@ async function prepareThemeForPublish$1(win, appId, themeKey, options = {}) {
10905
10927
  registryResult,
10906
10928
  };
10907
10929
  } catch (err) {
10908
- console.error("[ThemeRegistryController] Error preparing theme for publish:", err);
10930
+ console.error(
10931
+ "[ThemeRegistryController] Error preparing theme for publish:",
10932
+ err,
10933
+ );
10909
10934
  return { success: false, error: err.message };
10910
10935
  }
10911
10936
  }
@@ -10926,7 +10951,10 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
10926
10951
  // Look up the package
10927
10952
  const pkg = await registryController$1.getPackage(packageName);
10928
10953
  if (!pkg) {
10929
- return { success: false, error: `Theme package "${packageName}" not found in registry` };
10954
+ return {
10955
+ success: false,
10956
+ error: `Theme package "${packageName}" not found in registry`,
10957
+ };
10930
10958
  }
10931
10959
 
10932
10960
  // Resolve download URL
@@ -10945,7 +10973,10 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
10945
10973
  return { success: false, error: "Download URL must use HTTPS" };
10946
10974
  }
10947
10975
 
10948
- console.log("[ThemeRegistryController] Downloading theme from:", downloadUrl);
10976
+ console.log(
10977
+ "[ThemeRegistryController] Downloading theme from:",
10978
+ downloadUrl,
10979
+ );
10949
10980
 
10950
10981
  // Download the ZIP
10951
10982
  const response = await fetch(downloadUrl);
@@ -10968,11 +10999,17 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
10968
10999
  );
10969
11000
 
10970
11001
  if (!themeEntry) {
10971
- return { success: false, error: "ZIP does not contain a .theme.json file" };
11002
+ return {
11003
+ success: false,
11004
+ error: "ZIP does not contain a .theme.json file",
11005
+ };
10972
11006
  }
10973
11007
 
10974
11008
  // Validate entry path (security: prevent path traversal)
10975
- if (themeEntry.entryName.includes("..") || path$2.isAbsolute(themeEntry.entryName)) {
11009
+ if (
11010
+ themeEntry.entryName.includes("..") ||
11011
+ path$2.isAbsolute(themeEntry.entryName)
11012
+ ) {
10976
11013
  return { success: false, error: "Invalid file path in ZIP" };
10977
11014
  }
10978
11015
 
@@ -10982,7 +11019,10 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
10982
11019
  try {
10983
11020
  themeData = JSON.parse(themeJson);
10984
11021
  } catch (parseErr) {
10985
- return { success: false, error: "Invalid JSON in theme file: " + parseErr.message };
11022
+ return {
11023
+ success: false,
11024
+ error: "Invalid JSON in theme file: " + parseErr.message,
11025
+ };
10986
11026
  }
10987
11027
 
10988
11028
  // Add registry metadata
@@ -11004,7 +11044,10 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
11004
11044
  );
11005
11045
 
11006
11046
  if (saveResult.error) {
11007
- return { success: false, error: "Failed to save theme: " + saveResult.message };
11047
+ return {
11048
+ success: false,
11049
+ error: "Failed to save theme: " + saveResult.message,
11050
+ };
11008
11051
  }
11009
11052
 
11010
11053
  console.log("[ThemeRegistryController] Theme installed:", themeKey);
@@ -11032,7 +11075,10 @@ function getThemePublishPreview$1(appId, themeKey) {
11032
11075
  try {
11033
11076
  const themesResult = themeController$2.listThemesForApplication(null, appId);
11034
11077
  if (themesResult.error) {
11035
- return { success: false, error: "Failed to read themes: " + themesResult.message };
11078
+ return {
11079
+ success: false,
11080
+ error: "Failed to read themes: " + themesResult.message,
11081
+ };
11036
11082
  }
11037
11083
 
11038
11084
  const themeData = themesResult.themes[themeKey];