pulsemcp-cms-admin-mcp-server 0.9.11 → 0.9.12

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.
@@ -21,7 +21,8 @@ export function extractExamId(line) {
21
21
  */
22
22
  export function extractStatus(line) {
23
23
  const data = line.data;
24
- return data?.status || line.status || 'unknown';
24
+ const result = data?.result;
25
+ return (result?.status || data?.status || line.status || 'unknown');
25
26
  }
26
27
  /**
27
28
  * Maximum number of results to keep on disk. Oldest results are evicted
@@ -3,7 +3,7 @@ export async function uploadImage(apiKey, baseUrl, postSlug, fileName, fileData)
3
3
  // Create form data for multipart upload
4
4
  const formData = new FormData();
5
5
  // Create a blob from the buffer
6
- const blob = new Blob([fileData], { type: 'image/png' }); // Default to PNG, adjust as needed
6
+ const blob = new Blob([new Uint8Array(fileData)], { type: 'image/png' });
7
7
  // Add file to form data
8
8
  formData.append('file', blob, fileName);
9
9
  // Add folder and filepath as documented in the API
@@ -67,9 +67,16 @@ Typical usage:
67
67
  const targetType = typeMap[validatedArgs.section];
68
68
  lines = lines.filter((line) => line.type === targetType);
69
69
  }
70
- // Filter by mirror_id
70
+ // Filter by mirror_id — check both top-level and data.mirror_id
71
+ // since the backend nests mirror_id inside the data payload.
71
72
  if (validatedArgs.mirror_id !== undefined) {
72
- lines = lines.filter((line) => line.type !== 'exam_result' || line.mirror_id === validatedArgs.mirror_id);
73
+ lines = lines.filter((line) => {
74
+ if (line.type !== 'exam_result')
75
+ return true;
76
+ const data = line.data;
77
+ const mirrorId = line.mirror_id ?? data?.mirror_id;
78
+ return mirrorId === validatedArgs.mirror_id;
79
+ });
73
80
  }
74
81
  let content = `**Exam Result Details**\n\n`;
75
82
  content += `Result ID: ${stored.result_id}\n`;
@@ -131,13 +131,15 @@ Use cases:
131
131
  }
132
132
  break;
133
133
  }
134
- case 'summary':
134
+ case 'summary': {
135
+ const summaryData = line.data;
135
136
  content += `\n**Summary**\n`;
136
- content += ` Total: ${line.total || 0}\n`;
137
- content += ` Passed: ${line.passed || 0}\n`;
138
- content += ` Failed: ${line.failed || 0}\n`;
139
- content += ` Skipped: ${line.skipped || 0}\n`;
137
+ content += ` Total: ${summaryData?.total_exams ?? line.total ?? 0}\n`;
138
+ content += ` Passed: ${summaryData?.successful ?? line.passed ?? 0}\n`;
139
+ content += ` Failed: ${summaryData?.failed ?? line.failed ?? 0}\n`;
140
+ content += ` Skipped: ${summaryData?.skipped ?? line.skipped ?? 0}\n`;
140
141
  break;
142
+ }
141
143
  case 'error':
142
144
  content += `\n**Error**: ${line.message || line.error || JSON.stringify(line)}\n`;
143
145
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pulsemcp-cms-admin-mcp-server",
3
- "version": "0.9.11",
3
+ "version": "0.9.12",
4
4
  "description": "Local implementation of PulseMCP CMS Admin MCP server",
5
5
  "mcpName": "com.pulsemcp.servers/pulsemcp-cms-admin",
6
6
  "main": "build/index.js",
@@ -21,7 +21,8 @@ export function extractExamId(line) {
21
21
  */
22
22
  export function extractStatus(line) {
23
23
  const data = line.data;
24
- return data?.status || line.status || 'unknown';
24
+ const result = data?.result;
25
+ return (result?.status || data?.status || line.status || 'unknown');
25
26
  }
26
27
  /**
27
28
  * Maximum number of results to keep on disk. Oldest results are evicted
@@ -3,7 +3,7 @@ export async function uploadImage(apiKey, baseUrl, postSlug, fileName, fileData)
3
3
  // Create form data for multipart upload
4
4
  const formData = new FormData();
5
5
  // Create a blob from the buffer
6
- const blob = new Blob([fileData], { type: 'image/png' }); // Default to PNG, adjust as needed
6
+ const blob = new Blob([new Uint8Array(fileData)], { type: 'image/png' });
7
7
  // Add file to form data
8
8
  formData.append('file', blob, fileName);
9
9
  // Add folder and filepath as documented in the API
@@ -67,9 +67,16 @@ Typical usage:
67
67
  const targetType = typeMap[validatedArgs.section];
68
68
  lines = lines.filter((line) => line.type === targetType);
69
69
  }
70
- // Filter by mirror_id
70
+ // Filter by mirror_id — check both top-level and data.mirror_id
71
+ // since the backend nests mirror_id inside the data payload.
71
72
  if (validatedArgs.mirror_id !== undefined) {
72
- lines = lines.filter((line) => line.type !== 'exam_result' || line.mirror_id === validatedArgs.mirror_id);
73
+ lines = lines.filter((line) => {
74
+ if (line.type !== 'exam_result')
75
+ return true;
76
+ const data = line.data;
77
+ const mirrorId = line.mirror_id ?? data?.mirror_id;
78
+ return mirrorId === validatedArgs.mirror_id;
79
+ });
73
80
  }
74
81
  let content = `**Exam Result Details**\n\n`;
75
82
  content += `Result ID: ${stored.result_id}\n`;
@@ -131,13 +131,15 @@ Use cases:
131
131
  }
132
132
  break;
133
133
  }
134
- case 'summary':
134
+ case 'summary': {
135
+ const summaryData = line.data;
135
136
  content += `\n**Summary**\n`;
136
- content += ` Total: ${line.total || 0}\n`;
137
- content += ` Passed: ${line.passed || 0}\n`;
138
- content += ` Failed: ${line.failed || 0}\n`;
139
- content += ` Skipped: ${line.skipped || 0}\n`;
137
+ content += ` Total: ${summaryData?.total_exams ?? line.total ?? 0}\n`;
138
+ content += ` Passed: ${summaryData?.successful ?? line.passed ?? 0}\n`;
139
+ content += ` Failed: ${summaryData?.failed ?? line.failed ?? 0}\n`;
140
+ content += ` Skipped: ${summaryData?.skipped ?? line.skipped ?? 0}\n`;
140
141
  break;
142
+ }
141
143
  case 'error':
142
144
  content += `\n**Error**: ${line.message || line.error || JSON.stringify(line)}\n`;
143
145
  break;