@enfyra/mcp-server 0.1.61 → 0.1.62

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.
@@ -1,6 +1,10 @@
1
1
  export type SequentialBatchFailure = {
2
2
  index: number;
3
- error: string;
3
+ error: {
4
+ code: 'authorization_failed' | 'conflict' | 'request_failed' | 'request_timeout';
5
+ message: string;
6
+ statusCode?: number;
7
+ };
4
8
  };
5
9
  export type SequentialBatchResult<TResult> = {
6
10
  status: 'completed';
@@ -1,5 +1,16 @@
1
- function errorMessage(error) {
2
- return error instanceof Error ? error.message : String(error);
1
+ function summarizeError(error) {
2
+ const message = error instanceof Error ? error.message : String(error);
3
+ const statusCode = Number(message.match(/API error \((\d{3})\)/)?.[1]);
4
+ if (/timeout/i.test(message)) {
5
+ return { code: 'request_timeout', message: 'The request timed out before Enfyra confirmed the write.' };
6
+ }
7
+ if (statusCode === 401 || statusCode === 403) {
8
+ return { code: 'authorization_failed', message: 'Enfyra rejected this write because the current token is not authorized.', statusCode };
9
+ }
10
+ if (statusCode === 409 || /duplicate key|unique constraint|\bconflict\b/i.test(message)) {
11
+ return { code: 'conflict', message: 'The record conflicts with an existing record. Inspect the table unique constraints before retrying.', statusCode };
12
+ }
13
+ return { code: 'request_failed', message: 'Enfyra rejected this write. Inspect the target record and retry only after resolving the validation error.', ...(Number.isFinite(statusCode) ? { statusCode } : {}) };
3
14
  }
4
15
  export async function executeSequentialBatch(items, execute) {
5
16
  const completed = [];
@@ -13,7 +24,7 @@ export async function executeSequentialBatch(items, execute) {
13
24
  completed,
14
25
  failure: {
15
26
  index,
16
- error: errorMessage(error),
27
+ error: summarizeError(error),
17
28
  },
18
29
  remainingIndexes: items.slice(index + 1).map((_, remainingIndex) => index + remainingIndex + 1),
19
30
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sequential-batch.js","sourceRoot":"","sources":["../../src/lib/sequential-batch.ts"],"names":[],"mappings":"AAiBA,SAAS,YAAY,CAAC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AAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,EAAE,CAAC,KAAK,GAAG,cAAc,GAAG,CAAC,CAAC;aAChG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AAC5C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfyra/mcp-server",
3
- "version": "0.1.61",
3
+ "version": "0.1.62",
4
4
  "description": "MCP server for Enfyra - manage Enfyra instances from MCP-compatible coding tools",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@4.17.0",