@axiom-lattice/client-sdk 2.1.61 → 2.1.64

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/dist/index.mjs CHANGED
@@ -2616,6 +2616,22 @@ var AbstractClient = class {
2616
2616
  if (!response.data)
2617
2617
  throw new ApiError("Failed to complete task", 500);
2618
2618
  return response.data;
2619
+ },
2620
+ workItems: {
2621
+ list: async (taskId, params) => {
2622
+ const searchParams = new URLSearchParams();
2623
+ if (params?.action)
2624
+ searchParams.set("action", params.action);
2625
+ if (params?.limit)
2626
+ searchParams.set("limit", String(params.limit));
2627
+ if (params?.offset)
2628
+ searchParams.set("offset", String(params.offset));
2629
+ const qs = searchParams.toString();
2630
+ const response = await this.makeRequest(
2631
+ `/api/tasks/${taskId}/work-items${qs ? `?${qs}` : ""}`
2632
+ );
2633
+ return response.data;
2634
+ }
2619
2635
  }
2620
2636
  };
2621
2637
  this.menu = {
@@ -3060,13 +3076,17 @@ var _Client = class extends AbstractClient {
3060
3076
  try {
3061
3077
  const fullUrl = url.startsWith("http") ? url : `${this.config.baseURL}${url}`;
3062
3078
  const workspaceHeaders = _Client.getWorkspaceHeaders();
3079
+ const mergedHeaders = {
3080
+ ...this.headers,
3081
+ ...workspaceHeaders,
3082
+ ...options.headers || {}
3083
+ };
3084
+ if (options.body instanceof FormData) {
3085
+ delete mergedHeaders["Content-Type"];
3086
+ }
3063
3087
  const response = await fetch(fullUrl, {
3064
3088
  ...options,
3065
- headers: {
3066
- ...this.headers,
3067
- ...workspaceHeaders,
3068
- ...options.headers || {}
3069
- },
3089
+ headers: mergedHeaders,
3070
3090
  signal: controller.signal
3071
3091
  });
3072
3092
  return await this.handleResponse(response);
@@ -3146,7 +3166,12 @@ var _Client = class extends AbstractClient {
3146
3166
  headers: requestHeaders
3147
3167
  };
3148
3168
  if (options?.body) {
3149
- requestOptions.body = JSON.stringify(options.body);
3169
+ if (options.body instanceof FormData) {
3170
+ requestOptions.body = options.body;
3171
+ delete requestHeaders["Content-Type"];
3172
+ } else {
3173
+ requestOptions.body = JSON.stringify(options.body);
3174
+ }
3150
3175
  }
3151
3176
  return this.fetchWithTimeout(url, requestOptions);
3152
3177
  }