@vairix/admin-mcp 1.2.0 → 1.2.1

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/api.d.ts CHANGED
@@ -42,7 +42,3 @@ export declare function deleteHour(id: string): Promise<{
42
42
  success: boolean;
43
43
  message: string;
44
44
  }>;
45
- export declare function batchDeleteHours(ids: string[]): Promise<{
46
- success: boolean;
47
- message: string;
48
- }>;
package/build/api.js CHANGED
@@ -235,29 +235,12 @@ export async function createHour(params) {
235
235
  };
236
236
  }
237
237
  export async function deleteHour(id) {
238
- await apiDelete(`/admin/daily_hours/${id}`);
239
- return { success: true, message: `Hour entry ${id} deleted` };
240
- }
241
- export async function batchDeleteHours(ids) {
242
- const s = await session();
243
- const form = await fetchFormData();
244
- const params = new URLSearchParams();
245
- params.set("authenticity_token", form.csrfFormToken);
246
- params.set("batch_action", "destroy");
247
- for (const id of ids) {
248
- params.append("collection_selection[]", id);
249
- }
250
- const res = await fetch(`${BASE_URL}/admin/daily_hours/batch_action`, {
251
- method: "POST",
252
- headers: {
253
- "Content-Type": "application/x-www-form-urlencoded",
254
- Cookie: s.cookies,
255
- },
256
- body: params.toString(),
257
- redirect: "manual",
258
- });
259
- if (res.status === 302 || res.status === 303) {
260
- return { success: true, message: `${ids.length} entries deleted` };
238
+ const res = await apiDelete(`/admin/daily_hours/${id}`);
239
+ if (res.status === 302 || res.status === 303 || res.status === 200) {
240
+ return { success: true, message: `Hour entry ${id} deleted` };
261
241
  }
262
- return { success: false, message: `Batch delete failed (status ${res.status})` };
242
+ return {
243
+ success: false,
244
+ message: `Failed to delete entry ${id}: status ${res.status}`,
245
+ };
263
246
  }
package/build/index.js CHANGED
@@ -332,14 +332,17 @@ server.tool("delete_hours", "Delete one or more hour entries by ID. Get IDs from
332
332
  ]).pipe(z.array(z.string()).min(1)).describe("Entry IDs to delete. Example: ['182353'] or ['182353','182351','182350']"),
333
333
  }, { destructiveHint: true, openWorldHint: true }, async ({ ids }) => {
334
334
  try {
335
- const results = await Promise.all(ids.map((id) => deleteHour(id).then(() => id).catch((e) => `${id}: ${e instanceof Error ? e.message : e}`)));
336
- const deleted = results.filter((r) => !r.includes(":"));
337
- const failed = results.filter((r) => r.includes(":"));
335
+ const results = await Promise.all(ids.map((id) => deleteHour(id).catch((e) => ({
336
+ success: false,
337
+ message: `${id}: ${e instanceof Error ? e.message : e}`,
338
+ }))));
339
+ const deleted = results.filter((r) => r.success);
340
+ const failed = results.filter((r) => !r.success);
338
341
  const parts = [];
339
342
  if (deleted.length)
340
343
  parts.push(`${deleted.length} entries deleted`);
341
344
  if (failed.length)
342
- parts.push(`Failed: ${failed.join(", ")}`);
345
+ parts.push(`Failed: ${failed.map((r) => r.message).join(", ")}`);
343
346
  return { content: [{ type: "text", text: parts.join(". ") }], ...(failed.length ? { isError: true } : {}) };
344
347
  }
345
348
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vairix/admin-mcp",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "MCP server for Vairix Admin - automate time tracking with Claude",
5
5
  "type": "module",
6
6
  "bin": "./build/index.js",