@trops/dash-core 0.1.57 → 0.1.59

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/index.js CHANGED
@@ -7214,6 +7214,38 @@ var ProviderForm = function ProviderForm(_ref) {
7214
7214
  },
7215
7215
  placeholder: "Enter ".concat(fieldConfig.displayName.toLowerCase()),
7216
7216
  className: errors[fieldName] ? "border-red-500" : ""
7217
+ }), fieldConfig.type === "file" && /*#__PURE__*/jsxRuntime.jsxs("div", {
7218
+ className: "flex gap-2",
7219
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
7220
+ className: "flex-1",
7221
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
7222
+ value: formData[fieldName] || "",
7223
+ onChange: function onChange(value) {
7224
+ return handleInputChange(fieldName, value);
7225
+ },
7226
+ placeholder: "Select a file...",
7227
+ className: errors[fieldName] ? "border-red-500" : ""
7228
+ })
7229
+ }), /*#__PURE__*/jsxRuntime.jsx("button", {
7230
+ onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
7231
+ var filepath;
7232
+ return _regeneratorRuntime.wrap(function (_context) {
7233
+ while (1) switch (_context.prev = _context.next) {
7234
+ case 0:
7235
+ _context.next = 1;
7236
+ return window.mainApi.dialog.chooseFile(true, ["json"]);
7237
+ case 1:
7238
+ filepath = _context.sent;
7239
+ if (filepath) handleInputChange(fieldName, filepath);
7240
+ case 2:
7241
+ case "end":
7242
+ return _context.stop();
7243
+ }
7244
+ }, _callee);
7245
+ })),
7246
+ className: "px-3 py-1.5 text-sm rounded bg-white/10 hover:bg-white/20 transition-colors",
7247
+ children: "Browse"
7248
+ })]
7217
7249
  }), errors[fieldName] && /*#__PURE__*/jsxRuntime.jsx("p", {
7218
7250
  className: "text-sm text-red-500 dark:text-red-400",
7219
7251
  children: errors[fieldName]
@@ -26572,6 +26604,10 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
26572
26604
  isEditMode = _ref2$isEditMode === void 0 ? false : _ref2$isEditMode,
26573
26605
  _ref2$initialName = _ref2.initialName,
26574
26606
  initialName = _ref2$initialName === void 0 ? "" : _ref2$initialName,
26607
+ _ref2$initialProvider = _ref2.initialProviderType,
26608
+ initialProviderType = _ref2$initialProvider === void 0 ? "custom" : _ref2$initialProvider,
26609
+ _ref2$initialCredenti = _ref2.initialCredentialSchema,
26610
+ initialCredentialSchema = _ref2$initialCredenti === void 0 ? {} : _ref2$initialCredenti,
26575
26611
  _ref2$initialTranspor = _ref2.initialTransport,
26576
26612
  initialTransport = _ref2$initialTranspor === void 0 ? "stdio" : _ref2$initialTranspor,
26577
26613
  _ref2$initialCommand = _ref2.initialCommand,
@@ -26584,8 +26620,8 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
26584
26620
  initialUrl = _ref2$initialUrl === void 0 ? "" : _ref2$initialUrl,
26585
26621
  _ref2$initialHeaderRo = _ref2.initialHeaderRows,
26586
26622
  initialHeaderRows = _ref2$initialHeaderRo === void 0 ? [] : _ref2$initialHeaderRo,
26587
- _ref2$initialCredenti = _ref2.initialCredentials,
26588
- initialCredentials = _ref2$initialCredenti === void 0 ? {} : _ref2$initialCredenti;
26623
+ _ref2$initialCredenti2 = _ref2.initialCredentials,
26624
+ initialCredentials = _ref2$initialCredenti2 === void 0 ? {} : _ref2$initialCredenti2;
26589
26625
  var appContext = React.useContext(AppContext);
26590
26626
  var dashApi = appContext === null || appContext === void 0 ? void 0 : appContext.dashApi;
26591
26627
 
@@ -26677,8 +26713,8 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
26677
26713
 
26678
26714
  // Derive credential fields from the live mcpConfig
26679
26715
  var formFields = React.useMemo(function () {
26680
- return deriveFormFields(mcpConfig, {});
26681
- }, [mcpConfig]);
26716
+ return deriveFormFields(mcpConfig, initialCredentialSchema);
26717
+ }, [mcpConfig, initialCredentialSchema]);
26682
26718
 
26683
26719
  // --- envMapping row handlers ---
26684
26720
  var addEnvRow = function addEnvRow() {
@@ -26854,11 +26890,11 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
26854
26890
  url: result.url,
26855
26891
  headerRows: result.headerRows
26856
26892
  });
26857
- onSave(name, "custom", result.credentialData, config);
26893
+ onSave(name, initialProviderType, result.credentialData, config);
26858
26894
  return;
26859
26895
  }
26860
26896
  if (!validateForm()) return;
26861
- onSave(providerName.trim(), "custom", credentialData, mcpConfig);
26897
+ onSave(providerName.trim(), initialProviderType, credentialData, mcpConfig);
26862
26898
  };
26863
26899
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
26864
26900
  className: "flex flex-col flex-1 min-h-0",
@@ -28149,9 +28185,14 @@ var ProvidersSection = function ProvidersSection(_ref) {
28149
28185
  });
28150
28186
  } else if (isEditingMcp && selectedName && selectedProvider) {
28151
28187
  var mc = selectedProvider.mcpConfig || {};
28188
+ var editCatalogEntry = catalog.find(function (entry) {
28189
+ return entry.id === selectedProvider.type;
28190
+ });
28152
28191
  detailContent = /*#__PURE__*/jsxRuntime.jsx(CustomMcpServerForm, {
28153
28192
  isEditMode: true,
28154
28193
  initialName: selectedName,
28194
+ initialProviderType: selectedProvider.type || "custom",
28195
+ initialCredentialSchema: (editCatalogEntry === null || editCatalogEntry === void 0 ? void 0 : editCatalogEntry.credentialSchema) || {},
28155
28196
  initialTransport: mc.transport || "stdio",
28156
28197
  initialCommand: mc.command || "",
28157
28198
  initialArgs: (mc.args || []).join(" "),