pulsemcp-cms-admin-mcp-server 0.4.3 → 0.4.4
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/build/shared/src/pulsemcp-admin-client/lib/create-post.js +7 -1
- package/build/shared/src/pulsemcp-admin-client/lib/save-mcp-implementation.js +7 -1
- package/build/shared/src/pulsemcp-admin-client/lib/send-email.js +8 -5
- package/build/shared/src/pulsemcp-admin-client/lib/update-post.js +7 -1
- package/package.json +1 -1
- package/shared/pulsemcp-admin-client/lib/create-post.js +7 -1
- package/shared/pulsemcp-admin-client/lib/save-mcp-implementation.js +7 -1
- package/shared/pulsemcp-admin-client/lib/send-email.js +8 -5
- package/shared/pulsemcp-admin-client/lib/update-post.js +7 -1
|
@@ -65,7 +65,13 @@ export async function createPost(apiKey, baseUrl, params) {
|
|
|
65
65
|
}
|
|
66
66
|
if (response.status === 422) {
|
|
67
67
|
const errorData = (await response.json());
|
|
68
|
-
|
|
68
|
+
// Handle both array format and single error string format from Rails
|
|
69
|
+
// Also handle empty arrays - an empty array should fall back to the default message
|
|
70
|
+
const errors = errorData.errors && errorData.errors.length > 0
|
|
71
|
+
? errorData.errors
|
|
72
|
+
: errorData.error
|
|
73
|
+
? [errorData.error]
|
|
74
|
+
: ['Unknown validation error'];
|
|
69
75
|
throw new Error(`Validation failed: ${errors.join(', ')}`);
|
|
70
76
|
}
|
|
71
77
|
throw new Error(`Failed to create post: ${response.status} ${response.statusText}`);
|
|
@@ -154,7 +154,13 @@ export async function saveMCPImplementation(apiKey, baseUrl, id, params) {
|
|
|
154
154
|
}
|
|
155
155
|
if (response.status === 422) {
|
|
156
156
|
const errorData = (await response.json());
|
|
157
|
-
|
|
157
|
+
// Handle both array format and single error string format from Rails
|
|
158
|
+
// Also handle empty arrays - an empty array should fall back to the default message
|
|
159
|
+
const errors = errorData.errors && errorData.errors.length > 0
|
|
160
|
+
? errorData.errors
|
|
161
|
+
: errorData.error
|
|
162
|
+
? [errorData.error]
|
|
163
|
+
: ['Unknown validation error'];
|
|
158
164
|
throw new Error(`Validation failed: ${errors.join(', ')}`);
|
|
159
165
|
}
|
|
160
166
|
throw new Error(`Failed to save MCP implementation: ${response.status} ${response.statusText}`);
|
|
@@ -25,16 +25,19 @@ export async function sendEmail(apiKey, baseUrl, params) {
|
|
|
25
25
|
let errorMessage;
|
|
26
26
|
try {
|
|
27
27
|
const errorData = JSON.parse(errorBody);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
// Handle both array format and single error string format from Rails
|
|
29
|
+
// Also handle empty arrays - an empty array should fall back to checking other fields
|
|
30
|
+
if (Array.isArray(errorData.errors) && errorData.errors.length > 0) {
|
|
31
|
+
errorMessage = errorData.errors.join(', ');
|
|
32
|
+
}
|
|
33
|
+
else if (errorData.errors && typeof errorData.errors === 'object') {
|
|
34
|
+
errorMessage = JSON.stringify(errorData.errors);
|
|
32
35
|
}
|
|
33
36
|
else if (errorData.error) {
|
|
34
37
|
errorMessage = errorData.error;
|
|
35
38
|
}
|
|
36
39
|
else {
|
|
37
|
-
errorMessage = errorBody;
|
|
40
|
+
errorMessage = errorBody || 'Unknown validation error';
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
catch {
|
|
@@ -71,7 +71,13 @@ export async function updatePost(apiKey, baseUrl, slug, params) {
|
|
|
71
71
|
}
|
|
72
72
|
if (response.status === 422) {
|
|
73
73
|
const errorData = (await response.json());
|
|
74
|
-
|
|
74
|
+
// Handle both array format and single error string format from Rails
|
|
75
|
+
// Also handle empty arrays - an empty array should fall back to the default message
|
|
76
|
+
const errors = errorData.errors && errorData.errors.length > 0
|
|
77
|
+
? errorData.errors
|
|
78
|
+
: errorData.error
|
|
79
|
+
? [errorData.error]
|
|
80
|
+
: ['Unknown validation error'];
|
|
75
81
|
throw new Error(`Validation failed: ${errors.join(', ')}`);
|
|
76
82
|
}
|
|
77
83
|
throw new Error(`Failed to update post: ${response.status} ${response.statusText}`);
|
package/package.json
CHANGED
|
@@ -65,7 +65,13 @@ export async function createPost(apiKey, baseUrl, params) {
|
|
|
65
65
|
}
|
|
66
66
|
if (response.status === 422) {
|
|
67
67
|
const errorData = (await response.json());
|
|
68
|
-
|
|
68
|
+
// Handle both array format and single error string format from Rails
|
|
69
|
+
// Also handle empty arrays - an empty array should fall back to the default message
|
|
70
|
+
const errors = errorData.errors && errorData.errors.length > 0
|
|
71
|
+
? errorData.errors
|
|
72
|
+
: errorData.error
|
|
73
|
+
? [errorData.error]
|
|
74
|
+
: ['Unknown validation error'];
|
|
69
75
|
throw new Error(`Validation failed: ${errors.join(', ')}`);
|
|
70
76
|
}
|
|
71
77
|
throw new Error(`Failed to create post: ${response.status} ${response.statusText}`);
|
|
@@ -154,7 +154,13 @@ export async function saveMCPImplementation(apiKey, baseUrl, id, params) {
|
|
|
154
154
|
}
|
|
155
155
|
if (response.status === 422) {
|
|
156
156
|
const errorData = (await response.json());
|
|
157
|
-
|
|
157
|
+
// Handle both array format and single error string format from Rails
|
|
158
|
+
// Also handle empty arrays - an empty array should fall back to the default message
|
|
159
|
+
const errors = errorData.errors && errorData.errors.length > 0
|
|
160
|
+
? errorData.errors
|
|
161
|
+
: errorData.error
|
|
162
|
+
? [errorData.error]
|
|
163
|
+
: ['Unknown validation error'];
|
|
158
164
|
throw new Error(`Validation failed: ${errors.join(', ')}`);
|
|
159
165
|
}
|
|
160
166
|
throw new Error(`Failed to save MCP implementation: ${response.status} ${response.statusText}`);
|
|
@@ -25,16 +25,19 @@ export async function sendEmail(apiKey, baseUrl, params) {
|
|
|
25
25
|
let errorMessage;
|
|
26
26
|
try {
|
|
27
27
|
const errorData = JSON.parse(errorBody);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
// Handle both array format and single error string format from Rails
|
|
29
|
+
// Also handle empty arrays - an empty array should fall back to checking other fields
|
|
30
|
+
if (Array.isArray(errorData.errors) && errorData.errors.length > 0) {
|
|
31
|
+
errorMessage = errorData.errors.join(', ');
|
|
32
|
+
}
|
|
33
|
+
else if (errorData.errors && typeof errorData.errors === 'object') {
|
|
34
|
+
errorMessage = JSON.stringify(errorData.errors);
|
|
32
35
|
}
|
|
33
36
|
else if (errorData.error) {
|
|
34
37
|
errorMessage = errorData.error;
|
|
35
38
|
}
|
|
36
39
|
else {
|
|
37
|
-
errorMessage = errorBody;
|
|
40
|
+
errorMessage = errorBody || 'Unknown validation error';
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
catch {
|
|
@@ -71,7 +71,13 @@ export async function updatePost(apiKey, baseUrl, slug, params) {
|
|
|
71
71
|
}
|
|
72
72
|
if (response.status === 422) {
|
|
73
73
|
const errorData = (await response.json());
|
|
74
|
-
|
|
74
|
+
// Handle both array format and single error string format from Rails
|
|
75
|
+
// Also handle empty arrays - an empty array should fall back to the default message
|
|
76
|
+
const errors = errorData.errors && errorData.errors.length > 0
|
|
77
|
+
? errorData.errors
|
|
78
|
+
: errorData.error
|
|
79
|
+
? [errorData.error]
|
|
80
|
+
: ['Unknown validation error'];
|
|
75
81
|
throw new Error(`Validation failed: ${errors.join(', ')}`);
|
|
76
82
|
}
|
|
77
83
|
throw new Error(`Failed to update post: ${response.status} ${response.statusText}`);
|