@daeda/mcp-pro 0.1.9 → 0.1.10

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.
Files changed (2) hide show
  1. package/dist/index.js +43 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2088,7 +2088,7 @@ var makeDatabaseLive = (portalId, encryptionKey) => Layer2.scoped(
2088
2088
  ),
2089
2089
  catch: (e) => new DatabaseError({ message: `Failed to set metadata: ${key}`, cause: e })
2090
2090
  });
2091
- const replaceMetadataTable = (tableName, columns) => Effect20.tryPromise({
2091
+ const replacePluginTable = (tableName, columns) => Effect20.tryPromise({
2092
2092
  try: async () => {
2093
2093
  const name = sanitizeTableName(tableName);
2094
2094
  if (!pluginTableNames.has(name)) {
@@ -2168,7 +2168,7 @@ var makeDatabaseLive = (portalId, encryptionKey) => Layer2.scoped(
2168
2168
  getRecordCounts,
2169
2169
  getMetadata,
2170
2170
  setMetadata,
2171
- replaceMetadataTable
2171
+ replacePluginTable
2172
2172
  };
2173
2173
  })
2174
2174
  )
@@ -2437,6 +2437,44 @@ import { Effect as Effect23, pipe as pipe17 } from "effect";
2437
2437
  var logStderr6 = (message) => Effect23.sync(() => console.error(message));
2438
2438
  var PLUGIN_ERROR_KEY = (name) => `plugin_error:${name}`;
2439
2439
  var SCHEMA_VERSION_KEY = (name) => `schema_version:plugin:${name}`;
2440
+ var extractMessage = (value) => {
2441
+ if (typeof value === "string") {
2442
+ const trimmed = value.trim();
2443
+ return trimmed.length > 0 ? trimmed : null;
2444
+ }
2445
+ if (value instanceof Error) {
2446
+ const trimmed = value.message.trim();
2447
+ return trimmed.length > 0 ? trimmed : null;
2448
+ }
2449
+ if (typeof value === "object" && value !== null && "message" in value) {
2450
+ const candidate = value.message;
2451
+ if (typeof candidate === "string") {
2452
+ const trimmed = candidate.trim();
2453
+ return trimmed.length > 0 ? trimmed : null;
2454
+ }
2455
+ }
2456
+ return null;
2457
+ };
2458
+ var formatPluginError = (error, pluginName) => {
2459
+ const messages = [];
2460
+ let current = error;
2461
+ for (let depth = 0; depth < 8 && current !== null && current !== void 0; depth += 1) {
2462
+ const message = extractMessage(current);
2463
+ if (message) {
2464
+ messages.push(message);
2465
+ }
2466
+ if (typeof current === "object" && current !== null && "cause" in current) {
2467
+ current = current.cause;
2468
+ continue;
2469
+ }
2470
+ break;
2471
+ }
2472
+ const unique = Array.from(new Set(messages));
2473
+ if (unique.length === 0) {
2474
+ return `Unknown plugin sync error (${pluginName})`;
2475
+ }
2476
+ return unique.slice(0, 3).join(" | ");
2477
+ };
2440
2478
  var syncMessagePlugin = (ws, db, portalState, portalId, plugin) => pipe17(
2441
2479
  db.getMetadata(`last_synced:plugin:${plugin.name}`),
2442
2480
  Effect23.map((raw) => raw ? new Date(raw) : null),
@@ -2453,7 +2491,7 @@ var syncMessagePlugin = (ws, db, portalState, portalId, plugin) => pipe17(
2453
2491
  (payload) => pipe17(
2454
2492
  Effect23.sync(() => plugin.payloadSchema.safeParse(payload)),
2455
2493
  Effect23.flatMap(
2456
- (parsed) => parsed.success ? plugin.storePayload(db.replaceMetadataTable, parsed.data) : Effect23.fail(
2494
+ (parsed) => parsed.success ? plugin.storePayload(db.replacePluginTable, parsed.data) : Effect23.fail(
2457
2495
  new Error(
2458
2496
  `Plugin payload validation failed for ${plugin.name}: ${parsed.error.message}`
2459
2497
  )
@@ -2473,7 +2511,7 @@ var syncMessagePlugin = (ws, db, portalState, portalId, plugin) => pipe17(
2473
2511
  );
2474
2512
  }),
2475
2513
  Effect23.catchAll((error) => {
2476
- const message = error instanceof Error ? error.message : String(error);
2514
+ const message = formatPluginError(error, plugin.name);
2477
2515
  return pipe17(
2478
2516
  db.setMetadata(PLUGIN_ERROR_KEY(plugin.name), message),
2479
2517
  Effect23.catchAll(() => Effect23.void),
@@ -2540,7 +2578,7 @@ var syncAllMessagePlugins = (ws, db, portalState, portalId) => pipe17(
2540
2578
  () => Effect23.forEach(
2541
2579
  getMessagePlugins(),
2542
2580
  (plugin) => syncMessagePlugin(ws, db, portalState, portalId, plugin),
2543
- { concurrency: 3 }
2581
+ { concurrency: 1 }
2544
2582
  )
2545
2583
  ),
2546
2584
  Effect23.asVoid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daeda/mcp-pro",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "MCP server for HubSpot CRM — sync, query, and manage your portal data",
5
5
  "type": "module",
6
6
  "bin": {