@automate.ax/integration-contracts 0.143.2 → 0.143.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.
@@ -136,10 +136,18 @@ export function getMetaAdsApi(account) {
136
136
  url.searchParams.set(toSnakeCase(name), Array.isArray(value) ? value.join(",") : String(value));
137
137
  }
138
138
  }
139
- const body = options.body === undefined ? undefined : toFormData(options.body);
139
+ const jsonBody = options.method === "PATCH" && options.body !== undefined;
140
+ const body = options.body === undefined
141
+ ? undefined
142
+ : jsonBody
143
+ ? JSON.stringify(toMeta(options.body))
144
+ : toFormData(options.body);
140
145
  const response = await fetch(url, {
141
146
  body,
142
- headers: { Authorization: `Bearer ${accessToken}` },
147
+ headers: {
148
+ Authorization: `Bearer ${accessToken}`,
149
+ ...(jsonBody && { "Content-Type": "application/json" }),
150
+ },
143
151
  method: options.method ?? (body ? "POST" : "GET"),
144
152
  });
145
153
  const payload = parseJson(await response.text());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/integration-contracts",
3
- "version": "0.143.2",
3
+ "version": "0.143.4",
4
4
  "description": "Shared integration payload contracts and provider primitives for Automate.ax.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "@anthropic-ai/sdk": "0.123.0",
68
- "@automate.ax/codec": "0.143.2",
68
+ "@automate.ax/codec": "0.143.4",
69
69
  "@cfworker/json-schema": "^4.1.1",
70
70
  "@googleapis/calendar": "^16.0.0",
71
71
  "@googleapis/forms": "^6.0.1",
@@ -194,11 +194,19 @@ export function getMetaAdsApi(account: MetaAdsResolvedAccount) {
194
194
  )
195
195
  }
196
196
  }
197
+ const jsonBody = options.method === "PATCH" && options.body !== undefined
197
198
  const body =
198
- options.body === undefined ? undefined : toFormData(options.body)
199
+ options.body === undefined
200
+ ? undefined
201
+ : jsonBody
202
+ ? JSON.stringify(toMeta(options.body))
203
+ : toFormData(options.body)
199
204
  const response = await fetch(url, {
200
205
  body,
201
- headers: { Authorization: `Bearer ${accessToken}` },
206
+ headers: {
207
+ Authorization: `Bearer ${accessToken}`,
208
+ ...(jsonBody && { "Content-Type": "application/json" }),
209
+ },
202
210
  method: options.method ?? (body ? "POST" : "GET"),
203
211
  })
204
212
  const payload = parseJson(await response.text())