@automate.ax/integration-contracts 0.142.0 → 0.143.2

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.
@@ -83,7 +83,7 @@ export declare const CLICKUP_LIST_SCHEMA: z.ZodObject<{
83
83
  status: z.ZodString;
84
84
  type: z.ZodOptional<z.ZodString>;
85
85
  }, z.core.$strip>>>;
86
- taskCount: z.ZodOptional<z.ZodNullable<z.ZodString>>;
86
+ taskCount: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>, z.ZodTransform<string | undefined, string | number | null | undefined>>;
87
87
  }, z.core.$strip>;
88
88
  export declare const CLICKUP_CUSTOM_FIELD_SCHEMA: z.ZodObject<{
89
89
  id: z.ZodString;
@@ -296,7 +296,35 @@ export declare const CLICKUP_GOAL_SCHEMA: z.ZodObject<{
296
296
  percentCompleted: z.ZodOptional<z.ZodNumber>;
297
297
  private: z.ZodOptional<z.ZodBoolean>;
298
298
  teamId: z.ZodOptional<z.ZodString>;
299
- keyResults: z.ZodPrefault<z.ZodArray<z.ZodString>>;
299
+ keyResults: z.ZodPrefault<z.ZodArray<z.ZodObject<{
300
+ completed: z.ZodOptional<z.ZodBoolean>;
301
+ creator: z.ZodOptional<z.ZodNumber>;
302
+ current: z.ZodOptional<z.ZodNumber>;
303
+ dateCreated: z.ZodOptional<z.ZodString>;
304
+ goalId: z.ZodOptional<z.ZodString>;
305
+ goalPrettyId: z.ZodOptional<z.ZodString>;
306
+ id: z.ZodString;
307
+ lastAction: z.ZodOptional<z.ZodJSONSchema>;
308
+ name: z.ZodString;
309
+ owners: z.ZodPrefault<z.ZodArray<z.ZodObject<{
310
+ color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
311
+ email: z.ZodOptional<z.ZodEmail>;
312
+ id: z.ZodNumber;
313
+ initials: z.ZodOptional<z.ZodString>;
314
+ profilePicture: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
315
+ role: z.ZodOptional<z.ZodNumber>;
316
+ username: z.ZodString;
317
+ }, z.core.$strip>>>;
318
+ percentCompleted: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
319
+ subcategoryIds: z.ZodPrefault<z.ZodArray<z.ZodString>>;
320
+ stepsCurrent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
321
+ stepsEnd: z.ZodOptional<z.ZodNumber>;
322
+ stepsStart: z.ZodOptional<z.ZodNumber>;
323
+ taskIds: z.ZodPrefault<z.ZodArray<z.ZodString>>;
324
+ target: z.ZodOptional<z.ZodNumber>;
325
+ type: z.ZodOptional<z.ZodString>;
326
+ unit: z.ZodOptional<z.ZodString>;
327
+ }, z.core.$strip>>>;
300
328
  owners: z.ZodPrefault<z.ZodArray<z.ZodObject<{
301
329
  color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
302
330
  email: z.ZodOptional<z.ZodEmail>;
@@ -21,6 +21,11 @@ export const CLICKUP_STATUS_SCHEMA = z.object({
21
21
  status: z.string(),
22
22
  type: z.string().optional(),
23
23
  });
24
+ const CLICKUP_TASK_COUNT_SCHEMA = z
25
+ .union([z.string(), z.number()])
26
+ .nullable()
27
+ .optional()
28
+ .transform((value) => (value == null ? undefined : String(value)));
24
29
  export const CLICKUP_SPACE_SCHEMA = z.object({
25
30
  archived: z.boolean().prefault(false),
26
31
  color: z.string().nullable().optional(),
@@ -40,11 +45,7 @@ export const CLICKUP_FOLDER_SCHEMA = z.object({
40
45
  overrideStatuses: z.boolean().optional(),
41
46
  parentFolder: z.string().optional(),
42
47
  space: z.object({ id: z.string(), name: z.string().optional() }).optional(),
43
- taskCount: z
44
- .string()
45
- .nullable()
46
- .optional()
47
- .transform((value) => value ?? undefined),
48
+ taskCount: CLICKUP_TASK_COUNT_SCHEMA,
48
49
  });
49
50
  export const CLICKUP_LIST_SCHEMA = z.object({
50
51
  archived: z.boolean().optional(),
@@ -63,7 +64,7 @@ export const CLICKUP_LIST_SCHEMA = z.object({
63
64
  orderindex: z.number().optional(),
64
65
  space: z.object({ id: z.string(), name: z.string().optional() }).optional(),
65
66
  statuses: CLICKUP_STATUS_SCHEMA.array().prefault([]),
66
- taskCount: z.string().nullable().optional(),
67
+ taskCount: CLICKUP_TASK_COUNT_SCHEMA,
67
68
  });
68
69
  export const CLICKUP_CUSTOM_FIELD_SCHEMA = z.object({
69
70
  id: z.string(),
@@ -204,7 +205,7 @@ export const CLICKUP_GOAL_LIST_ITEM_SCHEMA = CLICKUP_GOAL_BASE_SCHEMA.extend({
204
205
  });
205
206
  /** Goal shape returned by get, create, and update endpoints. */
206
207
  export const CLICKUP_GOAL_SCHEMA = CLICKUP_GOAL_BASE_SCHEMA.extend({
207
- keyResults: z.string().array().prefault([]),
208
+ keyResults: CLICKUP_KEY_RESULT_SCHEMA.array().prefault([]),
208
209
  owners: CLICKUP_USER_SCHEMA.array().prefault([]),
209
210
  });
210
211
  export const CLICKUP_HISTORY_ITEM_SCHEMA = z.object({
@@ -714,6 +714,9 @@ export declare const CLOSEBOT_LIBRARY_FILE_SCHEMA: z.ZodObject<{
714
714
  uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
715
715
  uses: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
716
716
  }, z.core.$strip>;
717
+ export declare const CLOSEBOT_LIBRARY_FILE_CREATED_SCHEMA: z.ZodObject<{
718
+ id: z.ZodString;
719
+ }, z.core.$strip>;
717
720
  export declare const CLOSEBOT_LIBRARY_FILE_PREVIEW_SCHEMA: z.ZodObject<{
718
721
  chunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
719
722
  chunkIndex: z.ZodOptional<z.ZodNumber>;
@@ -733,6 +736,11 @@ export declare const CLOSEBOT_WEB_SCRAPE_PAGE_SCHEMA: z.ZodObject<{
733
736
  enabled: z.ZodOptional<z.ZodBoolean>;
734
737
  url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
735
738
  }, z.core.$strip>;
739
+ export declare const CLOSEBOT_WEB_SCRAPE_CREATED_SCHEMA: z.ZodObject<{
740
+ id: z.ZodString;
741
+ message: z.ZodString;
742
+ totalSize: z.ZodNumber;
743
+ }, z.core.$strip>;
736
744
  export declare const CLOSEBOT_BOT_VARIABLE_SCHEMA: z.ZodObject<{
737
745
  id: z.ZodNullable<z.ZodString>;
738
746
  name: z.ZodNullable<z.ZodString>;
@@ -403,6 +403,9 @@ export const CLOSEBOT_LIBRARY_FILE_SCHEMA = z.object({
403
403
  uri: OPTIONAL_STRING,
404
404
  uses: z.number().int().nullable().optional(),
405
405
  });
406
+ export const CLOSEBOT_LIBRARY_FILE_CREATED_SCHEMA = z.object({
407
+ id: CLOSEBOT_ID_SCHEMA,
408
+ });
406
409
  export const CLOSEBOT_LIBRARY_FILE_PREVIEW_SCHEMA = z.object({
407
410
  chunks: z
408
411
  .object({ chunkIndex: OPTIONAL_INTEGER, content: OPTIONAL_STRING })
@@ -423,6 +426,11 @@ export const CLOSEBOT_WEB_SCRAPE_PAGE_SCHEMA = z.object({
423
426
  enabled: OPTIONAL_BOOLEAN,
424
427
  url: OPTIONAL_STRING,
425
428
  });
429
+ export const CLOSEBOT_WEB_SCRAPE_CREATED_SCHEMA = z.object({
430
+ id: CLOSEBOT_ID_SCHEMA,
431
+ message: z.string(),
432
+ totalSize: z.number().int().nonnegative(),
433
+ });
426
434
  export const CLOSEBOT_BOT_VARIABLE_SCHEMA = z.object({
427
435
  id: z.string().nullable(),
428
436
  name: z.string().nullable(),
@@ -10,7 +10,7 @@ export declare const META_ADS_OAUTH_SECRET_SCHEMA: z.ZodObject<{
10
10
  declare const META_ERROR_SCHEMA: z.ZodObject<{
11
11
  code: z.ZodOptional<z.ZodNumber>;
12
12
  errorSubcode: z.ZodOptional<z.ZodNumber>;
13
- errorUserMessage: z.ZodOptional<z.ZodString>;
13
+ errorUserMsg: z.ZodOptional<z.ZodString>;
14
14
  fbtraceId: z.ZodOptional<z.ZodString>;
15
15
  isTransient: z.ZodOptional<z.ZodBoolean>;
16
16
  message: z.ZodString;
@@ -38,6 +38,7 @@ export declare class MetaAdsApiError extends Error {
38
38
  readonly appUsage?: string;
39
39
  readonly businessUseCaseUsage?: string;
40
40
  readonly code?: number;
41
+ readonly errorUserMessage?: string;
41
42
  readonly fbtraceId?: string;
42
43
  readonly isTransient: boolean;
43
44
  readonly adAccountUsage?: string;
@@ -11,7 +11,7 @@ export const META_ADS_OAUTH_SECRET_SCHEMA = z.object({
11
11
  const META_ERROR_SCHEMA = z.looseObject({
12
12
  code: z.number().optional(),
13
13
  errorSubcode: z.number().optional(),
14
- errorUserMessage: z.string().optional(),
14
+ errorUserMsg: z.string().optional(),
15
15
  fbtraceId: z.string().optional(),
16
16
  isTransient: z.boolean().optional(),
17
17
  message: z.string(),
@@ -38,6 +38,7 @@ export class MetaAdsApiError extends Error {
38
38
  appUsage;
39
39
  businessUseCaseUsage;
40
40
  code;
41
+ errorUserMessage;
41
42
  fbtraceId;
42
43
  isTransient;
43
44
  adAccountUsage;
@@ -57,8 +58,11 @@ export class MetaAdsApiError extends Error {
57
58
  */
58
59
  constructor(options) {
59
60
  const providerError = options.error;
60
- super(providerError?.message
61
- ? `Meta Ads API error (${providerError.code ?? options.status}): ${providerError.message}`
61
+ const providerMessage = providerError?.message
62
+ ? `${providerError.message}${providerError.errorUserMsg ? ` ${providerError.errorUserMsg}` : ""}`
63
+ : undefined;
64
+ super(providerMessage
65
+ ? `Meta Ads API error (${providerError?.code ?? options.status}): ${providerMessage}`
62
66
  : `Meta Ads API request failed with status ${options.status}.`);
63
67
  this.name = "MetaAdsApiError";
64
68
  this.adAccountUsage = options.adAccountUsage;
@@ -66,6 +70,7 @@ export class MetaAdsApiError extends Error {
66
70
  this.businessUseCaseUsage = options.businessUseCaseUsage;
67
71
  this.code = providerError?.code;
68
72
  this.errorSubcode = providerError?.errorSubcode;
73
+ this.errorUserMessage = providerError?.errorUserMsg;
69
74
  this.fbtraceId = providerError?.fbtraceId;
70
75
  this.isTransient = providerError?.isTransient ?? false;
71
76
  this.retryAfter = options.retryAfter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/integration-contracts",
3
- "version": "0.142.0",
3
+ "version": "0.143.2",
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.142.0",
68
+ "@automate.ax/codec": "0.143.2",
69
69
  "@cfworker/json-schema": "^4.1.1",
70
70
  "@googleapis/calendar": "^16.0.0",
71
71
  "@googleapis/forms": "^6.0.1",
@@ -25,6 +25,12 @@ export const CLICKUP_STATUS_SCHEMA = z.object({
25
25
  type: z.string().optional(),
26
26
  })
27
27
 
28
+ const CLICKUP_TASK_COUNT_SCHEMA = z
29
+ .union([z.string(), z.number()])
30
+ .nullable()
31
+ .optional()
32
+ .transform((value) => (value == null ? undefined : String(value)))
33
+
28
34
  export const CLICKUP_SPACE_SCHEMA = z.object({
29
35
  archived: z.boolean().prefault(false),
30
36
  color: z.string().nullable().optional(),
@@ -56,11 +62,7 @@ export const CLICKUP_FOLDER_SCHEMA: z.ZodType<{
56
62
  overrideStatuses: z.boolean().optional(),
57
63
  parentFolder: z.string().optional(),
58
64
  space: z.object({ id: z.string(), name: z.string().optional() }).optional(),
59
- taskCount: z
60
- .string()
61
- .nullable()
62
- .optional()
63
- .transform((value) => value ?? undefined),
65
+ taskCount: CLICKUP_TASK_COUNT_SCHEMA,
64
66
  })
65
67
 
66
68
  export const CLICKUP_LIST_SCHEMA = z.object({
@@ -80,7 +82,7 @@ export const CLICKUP_LIST_SCHEMA = z.object({
80
82
  orderindex: z.number().optional(),
81
83
  space: z.object({ id: z.string(), name: z.string().optional() }).optional(),
82
84
  statuses: CLICKUP_STATUS_SCHEMA.array().prefault([]),
83
- taskCount: z.string().nullable().optional(),
85
+ taskCount: CLICKUP_TASK_COUNT_SCHEMA,
84
86
  })
85
87
 
86
88
  export const CLICKUP_CUSTOM_FIELD_SCHEMA = z.object({
@@ -235,7 +237,7 @@ export const CLICKUP_GOAL_LIST_ITEM_SCHEMA = CLICKUP_GOAL_BASE_SCHEMA.extend({
235
237
 
236
238
  /** Goal shape returned by get, create, and update endpoints. */
237
239
  export const CLICKUP_GOAL_SCHEMA = CLICKUP_GOAL_BASE_SCHEMA.extend({
238
- keyResults: z.string().array().prefault([]),
240
+ keyResults: CLICKUP_KEY_RESULT_SCHEMA.array().prefault([]),
239
241
  owners: CLICKUP_USER_SCHEMA.array().prefault([]),
240
242
  })
241
243
 
@@ -450,6 +450,10 @@ export const CLOSEBOT_LIBRARY_FILE_SCHEMA = z.object({
450
450
  uses: z.number().int().nullable().optional(),
451
451
  })
452
452
 
453
+ export const CLOSEBOT_LIBRARY_FILE_CREATED_SCHEMA = z.object({
454
+ id: CLOSEBOT_ID_SCHEMA,
455
+ })
456
+
453
457
  export const CLOSEBOT_LIBRARY_FILE_PREVIEW_SCHEMA = z.object({
454
458
  chunks: z
455
459
  .object({ chunkIndex: OPTIONAL_INTEGER, content: OPTIONAL_STRING })
@@ -472,6 +476,12 @@ export const CLOSEBOT_WEB_SCRAPE_PAGE_SCHEMA = z.object({
472
476
  url: OPTIONAL_STRING,
473
477
  })
474
478
 
479
+ export const CLOSEBOT_WEB_SCRAPE_CREATED_SCHEMA = z.object({
480
+ id: CLOSEBOT_ID_SCHEMA,
481
+ message: z.string(),
482
+ totalSize: z.number().int().nonnegative(),
483
+ })
484
+
475
485
  export const CLOSEBOT_BOT_VARIABLE_SCHEMA = z.object({
476
486
  id: z.string().nullable(),
477
487
  name: z.string().nullable(),
@@ -13,7 +13,7 @@ export const META_ADS_OAUTH_SECRET_SCHEMA = z.object({
13
13
  const META_ERROR_SCHEMA = z.looseObject({
14
14
  code: z.number().optional(),
15
15
  errorSubcode: z.number().optional(),
16
- errorUserMessage: z.string().optional(),
16
+ errorUserMsg: z.string().optional(),
17
17
  fbtraceId: z.string().optional(),
18
18
  isTransient: z.boolean().optional(),
19
19
  message: z.string(),
@@ -62,6 +62,7 @@ export class MetaAdsApiError extends Error {
62
62
  readonly appUsage?: string
63
63
  readonly businessUseCaseUsage?: string
64
64
  readonly code?: number
65
+ readonly errorUserMessage?: string
65
66
  readonly fbtraceId?: string
66
67
  readonly isTransient: boolean
67
68
  readonly adAccountUsage?: string
@@ -89,9 +90,12 @@ export class MetaAdsApiError extends Error {
89
90
  status: number
90
91
  }) {
91
92
  const providerError = options.error
93
+ const providerMessage = providerError?.message
94
+ ? `${providerError.message}${providerError.errorUserMsg ? ` — ${providerError.errorUserMsg}` : ""}`
95
+ : undefined
92
96
  super(
93
- providerError?.message
94
- ? `Meta Ads API error (${providerError.code ?? options.status}): ${providerError.message}`
97
+ providerMessage
98
+ ? `Meta Ads API error (${providerError?.code ?? options.status}): ${providerMessage}`
95
99
  : `Meta Ads API request failed with status ${options.status}.`,
96
100
  )
97
101
  this.name = "MetaAdsApiError"
@@ -100,6 +104,7 @@ export class MetaAdsApiError extends Error {
100
104
  this.businessUseCaseUsage = options.businessUseCaseUsage
101
105
  this.code = providerError?.code
102
106
  this.errorSubcode = providerError?.errorSubcode
107
+ this.errorUserMessage = providerError?.errorUserMsg
103
108
  this.fbtraceId = providerError?.fbtraceId
104
109
  this.isTransient = providerError?.isTransient ?? false
105
110
  this.retryAfter = options.retryAfter