@trops/dash-core 0.1.105 → 0.1.106
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 +90 -4
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +129 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +161 -61
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -6077,6 +6077,7 @@ async function fetchRegistryIndex(forceRefresh = false) {
|
|
|
6077
6077
|
* @param {string} filters.tag - Filter by tag
|
|
6078
6078
|
* @param {string} filters.type - Filter by package type ("widget" or "dashboard")
|
|
6079
6079
|
* @param {string[]} filters.compatibleWidgets - Only return dashboards whose required widgets are all in this list
|
|
6080
|
+
* @param {string[]} filters.appCapabilities - Only return packages whose required API providers are all in this list
|
|
6080
6081
|
* @returns {Promise<Object>} { packages: [...], totalWidgets: number }
|
|
6081
6082
|
*/
|
|
6082
6083
|
async function searchRegistry$1(query = "", filters = {}) {
|
|
@@ -6157,6 +6158,37 @@ async function searchRegistry$1(query = "", filters = {}) {
|
|
|
6157
6158
|
});
|
|
6158
6159
|
}
|
|
6159
6160
|
|
|
6161
|
+
// Apply API capability filter — only return packages whose required
|
|
6162
|
+
// "api" providers are all present in the app's capability set
|
|
6163
|
+
if (filters.appCapabilities && filters.appCapabilities.length) {
|
|
6164
|
+
const capSet = new Set(
|
|
6165
|
+
filters.appCapabilities.map((c) => c.toLowerCase()),
|
|
6166
|
+
);
|
|
6167
|
+
packages = packages.filter((pkg) => {
|
|
6168
|
+
// Collect all "api" provider requirements from package-level and widget-level providers
|
|
6169
|
+
const apiProviders = [];
|
|
6170
|
+
|
|
6171
|
+
// Package-level providers
|
|
6172
|
+
for (const p of pkg.providers || []) {
|
|
6173
|
+
if (p.providerClass === "api" && p.required !== false) {
|
|
6174
|
+
apiProviders.push(p.type);
|
|
6175
|
+
}
|
|
6176
|
+
}
|
|
6177
|
+
|
|
6178
|
+
// Widget-level providers
|
|
6179
|
+
for (const w of pkg.widgets || []) {
|
|
6180
|
+
for (const p of w.providers || []) {
|
|
6181
|
+
if (p.providerClass === "api" && p.required !== false) {
|
|
6182
|
+
apiProviders.push(p.type);
|
|
6183
|
+
}
|
|
6184
|
+
}
|
|
6185
|
+
}
|
|
6186
|
+
|
|
6187
|
+
// Package is compatible if all required API namespaces are present
|
|
6188
|
+
return apiProviders.every((api) => capSet.has(api.toLowerCase()));
|
|
6189
|
+
});
|
|
6190
|
+
}
|
|
6191
|
+
|
|
6160
6192
|
// Count total widgets across matched packages
|
|
6161
6193
|
const totalWidgets = packages.reduce(
|
|
6162
6194
|
(sum, pkg) => sum + (pkg.widgets || []).length,
|
|
@@ -7828,10 +7860,11 @@ var properties = {
|
|
|
7828
7860
|
},
|
|
7829
7861
|
providerClass: {
|
|
7830
7862
|
type: "string",
|
|
7831
|
-
description: "Provider class: credential or
|
|
7863
|
+
description: "Provider class: credential, mcp, or api",
|
|
7832
7864
|
"enum": [
|
|
7833
7865
|
"credential",
|
|
7834
|
-
"mcp"
|
|
7866
|
+
"mcp",
|
|
7867
|
+
"api"
|
|
7835
7868
|
]
|
|
7836
7869
|
},
|
|
7837
7870
|
required: {
|
|
@@ -7853,6 +7886,11 @@ var properties = {
|
|
|
7853
7886
|
"default": [
|
|
7854
7887
|
]
|
|
7855
7888
|
},
|
|
7889
|
+
appOrigin: {
|
|
7890
|
+
type: "string",
|
|
7891
|
+
description: "Originating app package name (from package.json). Informational — indicates which app this dashboard was built for.",
|
|
7892
|
+
maxLength: 200
|
|
7893
|
+
},
|
|
7856
7894
|
eventWiring: {
|
|
7857
7895
|
type: "array",
|
|
7858
7896
|
description: "Pre-configured event connections between widgets",
|
|
@@ -8053,7 +8091,7 @@ function validateDashboardConfig$1(config) {
|
|
|
8053
8091
|
if (!Array.isArray(config.providers)) {
|
|
8054
8092
|
errors.push(`"providers" must be an array`);
|
|
8055
8093
|
} else {
|
|
8056
|
-
const validClasses = ["credential", "mcp"];
|
|
8094
|
+
const validClasses = ["credential", "mcp", "api"];
|
|
8057
8095
|
for (let i = 0; i < config.providers.length; i++) {
|
|
8058
8096
|
const p = config.providers[i];
|
|
8059
8097
|
if (typeof p !== "object" || p === null) {
|
|
@@ -8065,7 +8103,7 @@ function validateDashboardConfig$1(config) {
|
|
|
8065
8103
|
}
|
|
8066
8104
|
if (!validClasses.includes(p.providerClass)) {
|
|
8067
8105
|
errors.push(
|
|
8068
|
-
`"providers[${i}].providerClass" must be "credential" or "
|
|
8106
|
+
`"providers[${i}].providerClass" must be "credential", "mcp", or "api", got "${p.providerClass}"`,
|
|
8069
8107
|
);
|
|
8070
8108
|
}
|
|
8071
8109
|
if ("usedBy" in p && !Array.isArray(p.usedBy)) {
|
|
@@ -8075,6 +8113,15 @@ function validateDashboardConfig$1(config) {
|
|
|
8075
8113
|
}
|
|
8076
8114
|
}
|
|
8077
8115
|
|
|
8116
|
+
// appOrigin (optional)
|
|
8117
|
+
if ("appOrigin" in config) {
|
|
8118
|
+
if (typeof config.appOrigin !== "string") {
|
|
8119
|
+
errors.push(`"appOrigin" must be a string`);
|
|
8120
|
+
} else if (config.appOrigin.length > 200) {
|
|
8121
|
+
errors.push(`"appOrigin" must be 200 characters or fewer`);
|
|
8122
|
+
}
|
|
8123
|
+
}
|
|
8124
|
+
|
|
8078
8125
|
// eventWiring (optional)
|
|
8079
8126
|
if ("eventWiring" in config) {
|
|
8080
8127
|
if (!Array.isArray(config.eventWiring)) {
|
|
@@ -8511,6 +8558,7 @@ function checkDashboardCompatibility(
|
|
|
8511
8558
|
* @param {string} options.githubUser - GitHub username / org for the package scope
|
|
8512
8559
|
* @param {string} options.category - Registry category (default: "general")
|
|
8513
8560
|
* @param {string} options.repository - Repository URL (optional)
|
|
8561
|
+
* @param {string} options.appOrigin - Originating app package name (optional)
|
|
8514
8562
|
* @returns {Object} Registry manifest object
|
|
8515
8563
|
*/
|
|
8516
8564
|
function generateRegistryManifest(dashboardConfig, options = {}) {
|
|
@@ -8550,6 +8598,10 @@ function generateRegistryManifest(dashboardConfig, options = {}) {
|
|
|
8550
8598
|
eventWiring: dashboardConfig.eventWiring || [],
|
|
8551
8599
|
};
|
|
8552
8600
|
|
|
8601
|
+
if (options.appOrigin || dashboardConfig.appOrigin) {
|
|
8602
|
+
manifest.appOrigin = options.appOrigin || dashboardConfig.appOrigin;
|
|
8603
|
+
}
|
|
8604
|
+
|
|
8553
8605
|
return manifest;
|
|
8554
8606
|
}
|
|
8555
8607
|
|
|
@@ -8592,6 +8644,7 @@ function buildDashboardPreview(source) {
|
|
|
8592
8644
|
required: p.required !== false,
|
|
8593
8645
|
usedBy: p.usedBy || [],
|
|
8594
8646
|
})),
|
|
8647
|
+
appOrigin: source.appOrigin || null,
|
|
8595
8648
|
summary: {
|
|
8596
8649
|
widgetCount: (source.widgets || []).length,
|
|
8597
8650
|
eventCount: (source.eventWiring || []).length,
|
|
@@ -8706,6 +8759,38 @@ function buildProviderSetupManifest(
|
|
|
8706
8759
|
};
|
|
8707
8760
|
}
|
|
8708
8761
|
|
|
8762
|
+
/**
|
|
8763
|
+
* Check API compatibility of a package against the app's capabilities.
|
|
8764
|
+
* Extracts providers with providerClass "api" and checks whether
|
|
8765
|
+
* each required API namespace is present in the app's capability set.
|
|
8766
|
+
*
|
|
8767
|
+
* @param {Array} providers - Provider requirements (from widget config or package manifest)
|
|
8768
|
+
* @param {string[]} appCapabilities - API namespaces the app exposes (e.g., Object.keys(window.mainApi))
|
|
8769
|
+
* @returns {Object} Compatibility report
|
|
8770
|
+
*/
|
|
8771
|
+
function checkApiCompatibility(providers = [], appCapabilities = []) {
|
|
8772
|
+
const capSet = new Set(appCapabilities.map((c) => c.toLowerCase()));
|
|
8773
|
+
|
|
8774
|
+
const apiProviders = providers.filter((p) => p.providerClass === "api");
|
|
8775
|
+
|
|
8776
|
+
if (apiProviders.length === 0) {
|
|
8777
|
+
return { compatible: true, missingApis: [], requiredApis: [] };
|
|
8778
|
+
}
|
|
8779
|
+
|
|
8780
|
+
const requiredApis = apiProviders
|
|
8781
|
+
.filter((p) => p.required !== false)
|
|
8782
|
+
.map((p) => p.type);
|
|
8783
|
+
const missingApis = requiredApis.filter(
|
|
8784
|
+
(api) => !capSet.has(api.toLowerCase()),
|
|
8785
|
+
);
|
|
8786
|
+
|
|
8787
|
+
return {
|
|
8788
|
+
compatible: missingApis.length === 0,
|
|
8789
|
+
missingApis,
|
|
8790
|
+
requiredApis,
|
|
8791
|
+
};
|
|
8792
|
+
}
|
|
8793
|
+
|
|
8709
8794
|
var dashboardConfigUtils$1 = {
|
|
8710
8795
|
collectComponentNames: collectComponentNames$1,
|
|
8711
8796
|
extractEventWiring: extractEventWiring$1,
|
|
@@ -8717,6 +8802,7 @@ var dashboardConfigUtils$1 = {
|
|
|
8717
8802
|
buildDashboardPreview,
|
|
8718
8803
|
checkDashboardUpdates,
|
|
8719
8804
|
buildProviderSetupManifest,
|
|
8805
|
+
checkApiCompatibility,
|
|
8720
8806
|
};
|
|
8721
8807
|
|
|
8722
8808
|
var widgetRegistry$1 = {exports: {}};
|