@trops/dash-core 0.1.237 → 0.1.239
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.
- package/dist/electron/index.js +109 -4
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +170 -111
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +170 -111
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -26595,6 +26595,46 @@ mcpController$3.exports.refreshGoogleOAuthToken = refreshGoogleOAuthToken;
|
|
|
26595
26595
|
|
|
26596
26596
|
var mcpControllerExports = mcpController$3.exports;
|
|
26597
26597
|
|
|
26598
|
+
/**
|
|
26599
|
+
* Scoped package identity utilities.
|
|
26600
|
+
*
|
|
26601
|
+
* Follows npm convention: "@scope/name" for scoped packages, "name" for bare.
|
|
26602
|
+
*/
|
|
26603
|
+
|
|
26604
|
+
/**
|
|
26605
|
+
* Build a canonical package ID from scope + name.
|
|
26606
|
+
* @param {string|null} scope - e.g. "trops" or "@trops"
|
|
26607
|
+
* @param {string} name - bare package name
|
|
26608
|
+
* @returns {string} e.g. "@trops/slack" or "slack"
|
|
26609
|
+
*/
|
|
26610
|
+
function toPackageId$1(scope, name) {
|
|
26611
|
+
if (scope) {
|
|
26612
|
+
const normalized = scope.replace(/^@/, "");
|
|
26613
|
+
return `@${normalized}/${name}`;
|
|
26614
|
+
}
|
|
26615
|
+
return name;
|
|
26616
|
+
}
|
|
26617
|
+
|
|
26618
|
+
/**
|
|
26619
|
+
* Parse a package ID into scope + name.
|
|
26620
|
+
* @param {string} id - e.g. "@trops/slack" or "slack"
|
|
26621
|
+
* @returns {{ scope: string|null, name: string }}
|
|
26622
|
+
*/
|
|
26623
|
+
function parsePackageId(id) {
|
|
26624
|
+
if (id && id.startsWith("@")) {
|
|
26625
|
+
const slashIdx = id.indexOf("/");
|
|
26626
|
+
if (slashIdx !== -1) {
|
|
26627
|
+
return {
|
|
26628
|
+
scope: id.slice(1, slashIdx),
|
|
26629
|
+
name: id.slice(slashIdx + 1),
|
|
26630
|
+
};
|
|
26631
|
+
}
|
|
26632
|
+
}
|
|
26633
|
+
return { scope: null, name: id };
|
|
26634
|
+
}
|
|
26635
|
+
|
|
26636
|
+
var packageId = { toPackageId: toPackageId$1, parsePackageId };
|
|
26637
|
+
|
|
26598
26638
|
/**
|
|
26599
26639
|
* registryController.js
|
|
26600
26640
|
*
|
|
@@ -26609,6 +26649,7 @@ var mcpControllerExports = mcpController$3.exports;
|
|
|
26609
26649
|
|
|
26610
26650
|
const path$9 = require$$1$2;
|
|
26611
26651
|
const fs$5 = require$$0$3;
|
|
26652
|
+
const { toPackageId } = packageId;
|
|
26612
26653
|
|
|
26613
26654
|
// Default registry API base URL
|
|
26614
26655
|
const DEFAULT_REGISTRY_API_URL = "https://main.d919rwhuzp7rj.amplifyapp.com";
|
|
@@ -26926,10 +26967,18 @@ async function checkUpdates(installedWidgets = []) {
|
|
|
26926
26967
|
const updates = [];
|
|
26927
26968
|
|
|
26928
26969
|
for (const installed of installedWidgets) {
|
|
26929
|
-
const
|
|
26970
|
+
const installedId = installed.packageId || installed.name;
|
|
26971
|
+
const pkg = (index.packages || []).find((p) => {
|
|
26972
|
+
// Match by scoped ID (e.g. "@trops/slack" === "@trops/slack")
|
|
26973
|
+
const registryId = toPackageId(p.scope, p.name);
|
|
26974
|
+
if (registryId === installedId) return true;
|
|
26975
|
+
// Fallback: bare-name match for pre-migration entries
|
|
26976
|
+
if (p.name === installedId) return true;
|
|
26977
|
+
return false;
|
|
26978
|
+
});
|
|
26930
26979
|
if (pkg && pkg.version !== installed.version) {
|
|
26931
26980
|
updates.push({
|
|
26932
|
-
name:
|
|
26981
|
+
name: installed.name,
|
|
26933
26982
|
currentVersion: installed.version,
|
|
26934
26983
|
latestVersion: pkg.version,
|
|
26935
26984
|
downloadUrl: pkg.downloadUrl,
|
|
@@ -30933,6 +30982,7 @@ var schedulerController_1 = schedulerController$2;
|
|
|
30933
30982
|
const { app, ipcMain, BrowserWindow } = require$$0$2;
|
|
30934
30983
|
const { dynamicWidgetLoader } = dynamicWidgetLoaderExports;
|
|
30935
30984
|
const { compileWidget, findWidgetsDir } = widgetCompiler$1;
|
|
30985
|
+
const { toPackageId, parsePackageId } = packageId;
|
|
30936
30986
|
|
|
30937
30987
|
let WIDGETS_CACHE_DIR = null;
|
|
30938
30988
|
let REGISTRY_CONFIG_FILE = null;
|
|
@@ -31041,6 +31091,46 @@ var schedulerController_1 = schedulerController$2;
|
|
|
31041
31091
|
console.log(
|
|
31042
31092
|
`[WidgetRegistry] Loaded ${this.widgets.size} widgets from cache`,
|
|
31043
31093
|
);
|
|
31094
|
+
|
|
31095
|
+
// Migration: re-key bare-name entries that have scope metadata
|
|
31096
|
+
if (!registryData._scopeMigrated) {
|
|
31097
|
+
let migrated = false;
|
|
31098
|
+
const entries = Array.from(this.widgets.entries());
|
|
31099
|
+
for (const [key, entry] of entries) {
|
|
31100
|
+
if (entry.scope && !key.startsWith("@")) {
|
|
31101
|
+
const scopedId = toPackageId(entry.scope, key);
|
|
31102
|
+
|
|
31103
|
+
// Move folder from widgets/{name}/ to widgets/@{scope}/{name}/
|
|
31104
|
+
const oldPath = path.join(WIDGETS_CACHE_DIR, key);
|
|
31105
|
+
const newPath = path.join(
|
|
31106
|
+
WIDGETS_CACHE_DIR,
|
|
31107
|
+
...scopedId.split("/"),
|
|
31108
|
+
);
|
|
31109
|
+
if (fs.existsSync(oldPath) && !fs.existsSync(newPath)) {
|
|
31110
|
+
const scopeDir = path.dirname(newPath);
|
|
31111
|
+
if (!fs.existsSync(scopeDir)) {
|
|
31112
|
+
fs.mkdirSync(scopeDir, { recursive: true });
|
|
31113
|
+
}
|
|
31114
|
+
fs.renameSync(oldPath, newPath);
|
|
31115
|
+
console.log(
|
|
31116
|
+
`[WidgetRegistry] Migrated folder: ${key} → ${scopedId}`,
|
|
31117
|
+
);
|
|
31118
|
+
}
|
|
31119
|
+
|
|
31120
|
+
// Re-key in the Map
|
|
31121
|
+
entry.name = scopedId;
|
|
31122
|
+
entry.packageId = scopedId;
|
|
31123
|
+
entry.path = newPath;
|
|
31124
|
+
this.widgets.delete(key);
|
|
31125
|
+
this.widgets.set(scopedId, entry);
|
|
31126
|
+
migrated = true;
|
|
31127
|
+
}
|
|
31128
|
+
}
|
|
31129
|
+
if (migrated) {
|
|
31130
|
+
this.saveRegistry();
|
|
31131
|
+
console.log("[WidgetRegistry] Scope migration complete");
|
|
31132
|
+
}
|
|
31133
|
+
}
|
|
31044
31134
|
}
|
|
31045
31135
|
} catch (error) {
|
|
31046
31136
|
console.error("[WidgetRegistry] Error loading registry:", error);
|
|
@@ -31142,7 +31232,8 @@ var schedulerController_1 = schedulerController$2;
|
|
|
31142
31232
|
throw new Error(`Local path not found: ${resolvedPath}`);
|
|
31143
31233
|
}
|
|
31144
31234
|
|
|
31145
|
-
|
|
31235
|
+
// Scoped names (e.g. "@trops/slack") get nested dirs: widgets/@trops/slack/
|
|
31236
|
+
const widgetPath = path.join(WIDGETS_CACHE_DIR, ...widgetName.split("/"));
|
|
31146
31237
|
|
|
31147
31238
|
if (fs.existsSync(widgetPath)) {
|
|
31148
31239
|
fs.rmSync(widgetPath, { recursive: true });
|
|
@@ -31338,7 +31429,8 @@ var schedulerController_1 = schedulerController$2;
|
|
|
31338
31429
|
const buffer = await response.arrayBuffer();
|
|
31339
31430
|
const zip = new AdmZip(Buffer.from(buffer));
|
|
31340
31431
|
|
|
31341
|
-
|
|
31432
|
+
// Scoped names (e.g. "@trops/slack") get nested dirs: widgets/@trops/slack/
|
|
31433
|
+
const widgetPath = path.join(WIDGETS_CACHE_DIR, ...widgetName.split("/"));
|
|
31342
31434
|
|
|
31343
31435
|
if (fs.existsSync(widgetPath)) {
|
|
31344
31436
|
fs.rmSync(widgetPath, { recursive: true });
|
|
@@ -31432,6 +31524,9 @@ var schedulerController_1 = schedulerController$2;
|
|
|
31432
31524
|
widgetEntry.scope = config.scope;
|
|
31433
31525
|
}
|
|
31434
31526
|
|
|
31527
|
+
// Store canonical package ID for update matching
|
|
31528
|
+
widgetEntry.packageId = widgetName;
|
|
31529
|
+
|
|
31435
31530
|
this.widgets.set(widgetName, widgetEntry);
|
|
31436
31531
|
this.saveRegistry();
|
|
31437
31532
|
console.log(`[WidgetRegistry] Registered widget: ${widgetName}`);
|
|
@@ -31557,6 +31652,16 @@ var schedulerController_1 = schedulerController$2;
|
|
|
31557
31652
|
if (fs.existsSync(widget.path)) {
|
|
31558
31653
|
fs.rmSync(widget.path, { recursive: true });
|
|
31559
31654
|
}
|
|
31655
|
+
|
|
31656
|
+
// Clean up empty scope directory (e.g. widgets/@trops/ after removing @trops/slack)
|
|
31657
|
+
const { scope } = parsePackageId(widgetName);
|
|
31658
|
+
if (scope) {
|
|
31659
|
+
const scopeDir = path.join(WIDGETS_CACHE_DIR, `@${scope}`);
|
|
31660
|
+
if (fs.existsSync(scopeDir) && fs.readdirSync(scopeDir).length === 0) {
|
|
31661
|
+
fs.rmdirSync(scopeDir);
|
|
31662
|
+
}
|
|
31663
|
+
}
|
|
31664
|
+
|
|
31560
31665
|
this.widgets.delete(widgetName);
|
|
31561
31666
|
this.saveRegistry();
|
|
31562
31667
|
console.log(`[WidgetRegistry] Uninstalled widget: ${widgetName}`);
|