@trops/dash-core 0.1.98 → 0.1.101

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.
@@ -5945,9 +5945,8 @@ var mcpControllerExports = mcpController$3.exports;
5945
5945
  const path$8 = require$$1$1;
5946
5946
  const fs$5 = require$$2;
5947
5947
 
5948
- // Default registry URL (GitHub Pages)
5949
- const DEFAULT_REGISTRY_URL =
5950
- "https://trops.github.io/dash-registry/registry-index.json";
5948
+ // Default registry API base URL
5949
+ const DEFAULT_REGISTRY_API_URL = "https://registry.trops.dev";
5951
5950
 
5952
5951
  // Cache TTL: 5 minutes
5953
5952
  const CACHE_TTL_MS = 5 * 60 * 1000;
@@ -5993,7 +5992,7 @@ async function fetchRegistryIndex(forceRefresh = false) {
5993
5992
  let indexData;
5994
5993
 
5995
5994
  if (isDev()) {
5996
- // In dev mode, load from local test file
5995
+ // In dev mode, try local test file first
5997
5996
  const testPath = getTestRegistryPath();
5998
5997
  if (fs$5.existsSync(testPath)) {
5999
5998
  console.log(
@@ -6003,13 +6002,10 @@ async function fetchRegistryIndex(forceRefresh = false) {
6003
6002
  const raw = fs$5.readFileSync(testPath, "utf8");
6004
6003
  indexData = JSON.parse(raw);
6005
6004
  } else {
6006
- console.warn(
6007
- "[RegistryController] Test registry not found at:",
6008
- testPath,
6009
- "— falling back to remote registry",
6010
- );
6005
+ // Fall back to API (supports DASH_REGISTRY_URL as full-URL override)
6011
6006
  const registryUrl =
6012
- process.env.DASH_REGISTRY_URL || DEFAULT_REGISTRY_URL;
6007
+ process.env.DASH_REGISTRY_URL ||
6008
+ `${process.env.DASH_REGISTRY_API_URL || DEFAULT_REGISTRY_API_URL}/api/packages`;
6013
6009
  console.log(
6014
6010
  "[RegistryController] Fetching registry from:",
6015
6011
  registryUrl,
@@ -6023,8 +6019,10 @@ async function fetchRegistryIndex(forceRefresh = false) {
6023
6019
  indexData = await response.json();
6024
6020
  }
6025
6021
  } else {
6026
- // In production, fetch from remote URL
6027
- const registryUrl = process.env.DASH_REGISTRY_URL || DEFAULT_REGISTRY_URL;
6022
+ // In production, fetch from API
6023
+ const registryUrl =
6024
+ process.env.DASH_REGISTRY_URL ||
6025
+ `${process.env.DASH_REGISTRY_API_URL || DEFAULT_REGISTRY_API_URL}/api/packages`;
6028
6026
  console.log("[RegistryController] Fetching registry from:", registryUrl);
6029
6027
 
6030
6028
  const response = await fetch(registryUrl);
@@ -6036,6 +6034,14 @@ async function fetchRegistryIndex(forceRefresh = false) {
6036
6034
  indexData = await response.json();
6037
6035
  }
6038
6036
 
6037
+ // Normalize: ensure `version` exists on each package (API uses `latestVersion`)
6038
+ if (indexData.packages) {
6039
+ indexData.packages = indexData.packages.map((pkg) => ({
6040
+ ...pkg,
6041
+ version: pkg.version || pkg.latestVersion || "0.0.0",
6042
+ }));
6043
+ }
6044
+
6039
6045
  // Cache the result
6040
6046
  cachedIndex = indexData;
6041
6047
  cacheTimestamp = now;