@automate.ax/integration-contracts 0.143.2 → 0.143.5

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.
@@ -214,11 +214,11 @@ export declare const CLICKUP_TIME_ENTRY_SCHEMA: z.ZodObject<{
214
214
  tags: z.ZodPrefault<z.ZodArray<z.ZodJSONSchema>>;
215
215
  taskLocation: z.ZodOptional<z.ZodObject<{
216
216
  folderId: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
217
- folderName: z.ZodString;
217
+ folderName: z.ZodOptional<z.ZodString>;
218
218
  listId: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
219
- listName: z.ZodString;
219
+ listName: z.ZodOptional<z.ZodString>;
220
220
  spaceId: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
221
- spaceName: z.ZodString;
221
+ spaceName: z.ZodOptional<z.ZodString>;
222
222
  }, z.core.$strip>>;
223
223
  taskTags: z.ZodPrefault<z.ZodArray<z.ZodObject<{
224
224
  creator: z.ZodOptional<z.ZodNumber>;
@@ -144,11 +144,11 @@ export const CLICKUP_TIME_ENTRY_SCHEMA = z.object({
144
144
  taskLocation: z
145
145
  .object({
146
146
  folderId: z.union([z.number(), z.string()]).transform(String),
147
- folderName: z.string(),
147
+ folderName: z.string().optional(),
148
148
  listId: z.union([z.number(), z.string()]).transform(String),
149
- listName: z.string(),
149
+ listName: z.string().optional(),
150
150
  spaceId: z.union([z.number(), z.string()]).transform(String),
151
- spaceName: z.string(),
151
+ spaceName: z.string().optional(),
152
152
  })
153
153
  .optional(),
154
154
  taskTags: z
@@ -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.5",
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.5",
69
69
  "@cfworker/json-schema": "^4.1.1",
70
70
  "@googleapis/calendar": "^16.0.0",
71
71
  "@googleapis/forms": "^6.0.1",
@@ -172,11 +172,11 @@ export const CLICKUP_TIME_ENTRY_SCHEMA = z.object({
172
172
  taskLocation: z
173
173
  .object({
174
174
  folderId: z.union([z.number(), z.string()]).transform(String),
175
- folderName: z.string(),
175
+ folderName: z.string().optional(),
176
176
  listId: z.union([z.number(), z.string()]).transform(String),
177
- listName: z.string(),
177
+ listName: z.string().optional(),
178
178
  spaceId: z.union([z.number(), z.string()]).transform(String),
179
- spaceName: z.string(),
179
+ spaceName: z.string().optional(),
180
180
  })
181
181
  .optional(),
182
182
  taskTags: z
@@ -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())