@automate.ax/integration-contracts 0.139.2 → 0.142.0

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.
Files changed (50) hide show
  1. package/dist/clickup/api.d.ts +76 -0
  2. package/dist/clickup/api.js +195 -0
  3. package/dist/clickup/index.d.ts +1921 -0
  4. package/dist/clickup/index.js +91 -0
  5. package/dist/clickup/schemas.d.ts +477 -0
  6. package/dist/clickup/schemas.js +286 -0
  7. package/dist/closebot/api.d.ts +39 -0
  8. package/dist/closebot/api.js +117 -0
  9. package/dist/closebot/index.d.ts +2 -0
  10. package/dist/closebot/index.js +2 -0
  11. package/dist/closebot/schemas.d.ts +775 -0
  12. package/dist/closebot/schemas.js +469 -0
  13. package/dist/google-ads/api.d.ts +40 -0
  14. package/dist/google-ads/api.js +109 -0
  15. package/dist/google-ads/events.d.ts +1155 -0
  16. package/dist/google-ads/events.js +96 -0
  17. package/dist/google-ads/index.d.ts +3 -0
  18. package/dist/google-ads/index.js +3 -0
  19. package/dist/google-ads/schemas.d.ts +756 -0
  20. package/dist/google-ads/schemas.js +249 -0
  21. package/dist/google-drive/index.d.ts +6 -6
  22. package/dist/linear/schemas.d.ts +3 -3
  23. package/dist/meta-ads/api.d.ts +90 -0
  24. package/dist/meta-ads/api.js +260 -0
  25. package/dist/meta-ads/events.d.ts +391 -0
  26. package/dist/meta-ads/events.js +193 -0
  27. package/dist/meta-ads/index.d.ts +3 -0
  28. package/dist/meta-ads/index.js +3 -0
  29. package/dist/meta-ads/schemas.d.ts +184 -0
  30. package/dist/meta-ads/schemas.js +181 -0
  31. package/dist/notion/schemas.d.ts +84 -84
  32. package/dist/teams/index.d.ts +20 -20
  33. package/dist/teams/schemas.d.ts +5 -5
  34. package/dist/triggers.d.ts +4 -1
  35. package/package.json +27 -3
  36. package/src/clickup/api.ts +270 -0
  37. package/src/clickup/index.ts +108 -0
  38. package/src/clickup/schemas.ts +324 -0
  39. package/src/closebot/api.ts +157 -0
  40. package/src/closebot/index.ts +2 -0
  41. package/src/closebot/schemas.ts +521 -0
  42. package/src/google-ads/api.ts +151 -0
  43. package/src/google-ads/events.ts +131 -0
  44. package/src/google-ads/index.ts +3 -0
  45. package/src/google-ads/schemas.ts +270 -0
  46. package/src/meta-ads/api.ts +327 -0
  47. package/src/meta-ads/events.ts +218 -0
  48. package/src/meta-ads/index.ts +3 -0
  49. package/src/meta-ads/schemas.ts +206 -0
  50. package/src/triggers.ts +6 -0
@@ -0,0 +1,131 @@
1
+ import type * as z from "zod"
2
+ import {
3
+ GOOGLE_ADS_CHANGE_EVENT_PAYLOAD_SCHEMA,
4
+ GOOGLE_ADS_CHANGE_TRIGGER_CONFIG_SCHEMA,
5
+ } from "./schemas"
6
+
7
+ const changeContract = {
8
+ configSchema: GOOGLE_ADS_CHANGE_TRIGGER_CONFIG_SCHEMA,
9
+ eventSchema: GOOGLE_ADS_CHANGE_EVENT_PAYLOAD_SCHEMA,
10
+ }
11
+
12
+ export const googleAdsTriggerContracts = {
13
+ "googleAds.adGroup.created": changeContract,
14
+ "googleAds.adGroup.removed": changeContract,
15
+ "googleAds.adGroup.updated": changeContract,
16
+ "googleAds.adGroupAd.created": changeContract,
17
+ "googleAds.adGroupAd.removed": changeContract,
18
+ "googleAds.adGroupAd.updated": changeContract,
19
+ "googleAds.adGroupAsset.created": changeContract,
20
+ "googleAds.adGroupAsset.removed": changeContract,
21
+ "googleAds.adGroupAsset.updated": changeContract,
22
+ "googleAds.asset.created": changeContract,
23
+ "googleAds.asset.removed": changeContract,
24
+ "googleAds.asset.updated": changeContract,
25
+ "googleAds.campaign.created": changeContract,
26
+ "googleAds.campaign.removed": changeContract,
27
+ "googleAds.campaign.updated": changeContract,
28
+ "googleAds.campaignAsset.created": changeContract,
29
+ "googleAds.campaignAsset.removed": changeContract,
30
+ "googleAds.campaignAsset.updated": changeContract,
31
+ "googleAds.campaignBudget.created": changeContract,
32
+ "googleAds.campaignBudget.removed": changeContract,
33
+ "googleAds.campaignBudget.updated": changeContract,
34
+ "googleAds.change": changeContract,
35
+ } as const
36
+
37
+ export type GoogleAdsEventType = keyof typeof googleAdsTriggerContracts
38
+
39
+ /**
40
+ * Returns the broad and optional semantic event types for one change.
41
+ *
42
+ * @param event - Normalized Google Ads change event.
43
+ */
44
+ export function getGoogleAdsChangeEventTypes(
45
+ event: z.output<typeof GOOGLE_ADS_CHANGE_EVENT_PAYLOAD_SCHEMA>,
46
+ ): GoogleAdsEventType[] {
47
+ const semanticType = getSemanticEventType(
48
+ event.event.changeResourceType,
49
+ event.event.resourceChangeOperation,
50
+ )
51
+ return semanticType
52
+ ? ["googleAds.change", semanticType]
53
+ : ["googleAds.change"]
54
+ }
55
+
56
+ /**
57
+ * Maps provider resource and operation enums to public event types.
58
+ *
59
+ * @param resource - Provider change resource enum.
60
+ * @param operation - Provider mutation operation.
61
+ */
62
+ function getSemanticEventType(
63
+ resource: z.output<
64
+ typeof GOOGLE_ADS_CHANGE_EVENT_PAYLOAD_SCHEMA
65
+ >["event"]["changeResourceType"],
66
+ operation: z.output<
67
+ typeof GOOGLE_ADS_CHANGE_EVENT_PAYLOAD_SCHEMA
68
+ >["event"]["resourceChangeOperation"],
69
+ ): GoogleAdsEventType | undefined {
70
+ if (operation === "UNSPECIFIED" || operation === "UNKNOWN") return undefined
71
+ switch (resource) {
72
+ case "AD_GROUP":
73
+ return (
74
+ {
75
+ CREATE: "googleAds.adGroup.created",
76
+ REMOVE: "googleAds.adGroup.removed",
77
+ UPDATE: "googleAds.adGroup.updated",
78
+ } as const
79
+ )[operation]
80
+ case "AD_GROUP_AD":
81
+ return (
82
+ {
83
+ CREATE: "googleAds.adGroupAd.created",
84
+ REMOVE: "googleAds.adGroupAd.removed",
85
+ UPDATE: "googleAds.adGroupAd.updated",
86
+ } as const
87
+ )[operation]
88
+ case "AD_GROUP_ASSET":
89
+ return (
90
+ {
91
+ CREATE: "googleAds.adGroupAsset.created",
92
+ REMOVE: "googleAds.adGroupAsset.removed",
93
+ UPDATE: "googleAds.adGroupAsset.updated",
94
+ } as const
95
+ )[operation]
96
+ case "ASSET":
97
+ return (
98
+ {
99
+ CREATE: "googleAds.asset.created",
100
+ REMOVE: "googleAds.asset.removed",
101
+ UPDATE: "googleAds.asset.updated",
102
+ } as const
103
+ )[operation]
104
+ case "CAMPAIGN":
105
+ return (
106
+ {
107
+ CREATE: "googleAds.campaign.created",
108
+ REMOVE: "googleAds.campaign.removed",
109
+ UPDATE: "googleAds.campaign.updated",
110
+ } as const
111
+ )[operation]
112
+ case "CAMPAIGN_ASSET":
113
+ return (
114
+ {
115
+ CREATE: "googleAds.campaignAsset.created",
116
+ REMOVE: "googleAds.campaignAsset.removed",
117
+ UPDATE: "googleAds.campaignAsset.updated",
118
+ } as const
119
+ )[operation]
120
+ case "CAMPAIGN_BUDGET":
121
+ return (
122
+ {
123
+ CREATE: "googleAds.campaignBudget.created",
124
+ REMOVE: "googleAds.campaignBudget.removed",
125
+ UPDATE: "googleAds.campaignBudget.updated",
126
+ } as const
127
+ )[operation]
128
+ default:
129
+ return undefined
130
+ }
131
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./api"
2
+ export * from "./events"
3
+ export * from "./schemas"
@@ -0,0 +1,270 @@
1
+ import * as z from "zod"
2
+ import { GOOGLE_ADS_CUSTOMER_ID_SCHEMA } from "./api"
3
+
4
+ const DECIMAL_STRING_SCHEMA = z.string().regex(/^\d+$/)
5
+ const GOOGLE_ADS_STATUS_SCHEMA = z.enum([
6
+ "UNSPECIFIED",
7
+ "UNKNOWN",
8
+ "ENABLED",
9
+ "PAUSED",
10
+ "REMOVED",
11
+ ])
12
+
13
+ export const GOOGLE_ADS_CUSTOMER_SCHEMA = z
14
+ .object({
15
+ autoTaggingEnabled: z.boolean().optional(),
16
+ currencyCode: z.string().optional(),
17
+ descriptiveName: z.string().optional(),
18
+ id: DECIMAL_STRING_SCHEMA.optional(),
19
+ manager: z.boolean().optional(),
20
+ resourceName: z.string(),
21
+ testAccount: z.boolean().optional(),
22
+ timeZone: z.string().optional(),
23
+ })
24
+ .catchall(z.json())
25
+
26
+ export const GOOGLE_ADS_CUSTOMER_CLIENT_SCHEMA = z
27
+ .object({
28
+ clientCustomer: z.string(),
29
+ currencyCode: z.string().optional(),
30
+ descriptiveName: z.string().optional(),
31
+ hidden: z.boolean().optional(),
32
+ id: DECIMAL_STRING_SCHEMA.optional(),
33
+ level: z.string().optional(),
34
+ manager: z.boolean().optional(),
35
+ resourceName: z.string(),
36
+ testAccount: z.boolean().optional(),
37
+ timeZone: z.string().optional(),
38
+ })
39
+ .catchall(z.json())
40
+
41
+ export const GOOGLE_ADS_CAMPAIGN_SCHEMA = z
42
+ .object({
43
+ advertisingChannelSubType: z.string().optional(),
44
+ advertisingChannelType: z.string().optional(),
45
+ campaignBudget: z.string().optional(),
46
+ endDateTime: z.string().optional(),
47
+ id: DECIMAL_STRING_SCHEMA.optional(),
48
+ name: z.string().optional(),
49
+ resourceName: z.string(),
50
+ servingStatus: z.string().optional(),
51
+ startDateTime: z.string().optional(),
52
+ status: GOOGLE_ADS_STATUS_SCHEMA.optional(),
53
+ })
54
+ .catchall(z.json())
55
+
56
+ export const GOOGLE_ADS_CAMPAIGN_BUDGET_SCHEMA = z
57
+ .object({
58
+ amountMicros: DECIMAL_STRING_SCHEMA.optional(),
59
+ deliveryMethod: z.string().optional(),
60
+ explicitlyShared: z.boolean().optional(),
61
+ id: DECIMAL_STRING_SCHEMA.optional(),
62
+ name: z.string().optional(),
63
+ resourceName: z.string(),
64
+ status: z.string().optional(),
65
+ totalAmountMicros: DECIMAL_STRING_SCHEMA.optional(),
66
+ })
67
+ .catchall(z.json())
68
+
69
+ export const GOOGLE_ADS_AD_GROUP_SCHEMA = z
70
+ .object({
71
+ campaign: z.string().optional(),
72
+ cpcBidMicros: DECIMAL_STRING_SCHEMA.optional(),
73
+ id: DECIMAL_STRING_SCHEMA.optional(),
74
+ name: z.string().optional(),
75
+ resourceName: z.string(),
76
+ status: GOOGLE_ADS_STATUS_SCHEMA.optional(),
77
+ targetCpaMicros: DECIMAL_STRING_SCHEMA.optional(),
78
+ type: z.string().optional(),
79
+ })
80
+ .catchall(z.json())
81
+
82
+ export const GOOGLE_ADS_AD_SCHEMA = z
83
+ .object({
84
+ finalUrls: z.string().array().optional(),
85
+ id: DECIMAL_STRING_SCHEMA.optional(),
86
+ name: z.string().optional(),
87
+ resourceName: z.string(),
88
+ responsiveSearchAd: z
89
+ .object({
90
+ descriptions: z
91
+ .object({ text: z.string() })
92
+ .catchall(z.json())
93
+ .array()
94
+ .optional(),
95
+ headlines: z
96
+ .object({ text: z.string() })
97
+ .catchall(z.json())
98
+ .array()
99
+ .optional(),
100
+ path1: z.string().optional(),
101
+ path2: z.string().optional(),
102
+ })
103
+ .catchall(z.json())
104
+ .optional(),
105
+ type: z.string().optional(),
106
+ })
107
+ .catchall(z.json())
108
+
109
+ export const GOOGLE_ADS_AD_GROUP_AD_SCHEMA = z
110
+ .object({
111
+ ad: GOOGLE_ADS_AD_SCHEMA.optional(),
112
+ adGroup: z.string().optional(),
113
+ policySummary: z.record(z.string(), z.json()).optional(),
114
+ resourceName: z.string(),
115
+ status: GOOGLE_ADS_STATUS_SCHEMA.optional(),
116
+ })
117
+ .catchall(z.json())
118
+
119
+ export const GOOGLE_ADS_ASSET_SCHEMA = z
120
+ .object({
121
+ id: DECIMAL_STRING_SCHEMA.optional(),
122
+ name: z.string().optional(),
123
+ resourceName: z.string(),
124
+ type: z.string().optional(),
125
+ })
126
+ .catchall(z.json())
127
+
128
+ export const GOOGLE_ADS_CONVERSION_ACTION_SCHEMA = z
129
+ .object({
130
+ category: z.string().optional(),
131
+ clickThroughLookbackWindowDays: z.string().optional(),
132
+ countingType: z.string().optional(),
133
+ id: DECIMAL_STRING_SCHEMA.optional(),
134
+ name: z.string().optional(),
135
+ primaryForGoal: z.boolean().optional(),
136
+ resourceName: z.string(),
137
+ status: z
138
+ .enum(["UNSPECIFIED", "UNKNOWN", "ENABLED", "REMOVED", "HIDDEN"])
139
+ .optional(),
140
+ type: z.string().optional(),
141
+ valueSettings: z
142
+ .object({
143
+ alwaysUseDefaultValue: z.boolean().optional(),
144
+ defaultCurrencyCode: z.string().optional(),
145
+ defaultValue: z.number().optional(),
146
+ })
147
+ .catchall(z.json())
148
+ .optional(),
149
+ })
150
+ .catchall(z.json())
151
+
152
+ export const GOOGLE_ADS_AUDIENCE_SCHEMA = z
153
+ .object({
154
+ description: z.string().optional(),
155
+ dimensions: z.json().array().optional(),
156
+ id: DECIMAL_STRING_SCHEMA.optional(),
157
+ name: z.string().optional(),
158
+ resourceName: z.string(),
159
+ status: GOOGLE_ADS_STATUS_SCHEMA.optional(),
160
+ })
161
+ .catchall(z.json())
162
+
163
+ export const GOOGLE_ADS_USER_LIST_SCHEMA = z
164
+ .object({
165
+ description: z.string().optional(),
166
+ id: DECIMAL_STRING_SCHEMA.optional(),
167
+ membershipLifeSpan: z.string().optional(),
168
+ membershipStatus: z.string().optional(),
169
+ name: z.string().optional(),
170
+ resourceName: z.string(),
171
+ sizeForDisplay: DECIMAL_STRING_SCHEMA.optional(),
172
+ sizeForSearch: DECIMAL_STRING_SCHEMA.optional(),
173
+ type: z.string().optional(),
174
+ })
175
+ .catchall(z.json())
176
+
177
+ export const GOOGLE_ADS_SEARCH_ROW_SCHEMA = z
178
+ .object({
179
+ adGroup: GOOGLE_ADS_AD_GROUP_SCHEMA.optional(),
180
+ adGroupAd: GOOGLE_ADS_AD_GROUP_AD_SCHEMA.optional(),
181
+ asset: GOOGLE_ADS_ASSET_SCHEMA.optional(),
182
+ audience: GOOGLE_ADS_AUDIENCE_SCHEMA.optional(),
183
+ campaign: GOOGLE_ADS_CAMPAIGN_SCHEMA.optional(),
184
+ campaignBudget: GOOGLE_ADS_CAMPAIGN_BUDGET_SCHEMA.optional(),
185
+ conversionAction: GOOGLE_ADS_CONVERSION_ACTION_SCHEMA.optional(),
186
+ customer: GOOGLE_ADS_CUSTOMER_SCHEMA.optional(),
187
+ customerClient: GOOGLE_ADS_CUSTOMER_CLIENT_SCHEMA.optional(),
188
+ metrics: z.record(z.string(), z.json()).optional(),
189
+ segments: z.record(z.string(), z.json()).optional(),
190
+ userList: GOOGLE_ADS_USER_LIST_SCHEMA.optional(),
191
+ })
192
+ .catchall(z.json())
193
+
194
+ export const GOOGLE_ADS_SEARCH_PAGE_SCHEMA = z.object({
195
+ fieldMask: z.string().optional(),
196
+ nextPageToken: z.string().optional(),
197
+ queryResourceConsumption: z.string().optional(),
198
+ results: GOOGLE_ADS_SEARCH_ROW_SCHEMA.array().prefault([]),
199
+ summaryRow: GOOGLE_ADS_SEARCH_ROW_SCHEMA.optional(),
200
+ totalResultsCount: DECIMAL_STRING_SCHEMA.optional(),
201
+ })
202
+
203
+ export const GOOGLE_ADS_MUTATE_RESULT_SCHEMA = z.object({
204
+ resourceName: z.string(),
205
+ })
206
+
207
+ export const GOOGLE_ADS_MUTATE_RESPONSE_SCHEMA = z.object({
208
+ results: GOOGLE_ADS_MUTATE_RESULT_SCHEMA.array(),
209
+ })
210
+
211
+ export const GOOGLE_ADS_CUSTOMER_CONTEXT_SCHEMA = z.object({
212
+ customerId: GOOGLE_ADS_CUSTOMER_ID_SCHEMA,
213
+ loginCustomerId: GOOGLE_ADS_CUSTOMER_ID_SCHEMA.optional(),
214
+ })
215
+
216
+ export const GOOGLE_ADS_CHANGE_RESOURCE_TYPE_SCHEMA = z.enum([
217
+ "UNSPECIFIED",
218
+ "UNKNOWN",
219
+ "AD",
220
+ "AD_GROUP",
221
+ "AD_GROUP_AD",
222
+ "AD_GROUP_ASSET",
223
+ "AD_GROUP_BID_MODIFIER",
224
+ "AD_GROUP_CRITERION",
225
+ "AD_GROUP_FEED",
226
+ "ASSET",
227
+ "ASSET_SET",
228
+ "ASSET_SET_ASSET",
229
+ "CAMPAIGN",
230
+ "CAMPAIGN_ASSET",
231
+ "CAMPAIGN_ASSET_SET",
232
+ "CAMPAIGN_BUDGET",
233
+ "CAMPAIGN_CRITERION",
234
+ "CAMPAIGN_FEED",
235
+ "CUSTOMER_ASSET",
236
+ "FEED",
237
+ "FEED_ITEM",
238
+ ])
239
+
240
+ export const GOOGLE_ADS_CHANGE_EVENT_SCHEMA = z.object({
241
+ adGroup: z.string().optional(),
242
+ asset: z.string().optional(),
243
+ campaign: z.string().optional(),
244
+ changeDateTime: z.string(),
245
+ changeResourceName: z.string(),
246
+ changeResourceType: GOOGLE_ADS_CHANGE_RESOURCE_TYPE_SCHEMA,
247
+ changedFields: z.string().optional(),
248
+ clientType: z.string().optional(),
249
+ newResource: z.record(z.string(), z.json()).optional(),
250
+ oldResource: z.record(z.string(), z.json()).optional(),
251
+ resourceChangeOperation: z.enum([
252
+ "UNSPECIFIED",
253
+ "UNKNOWN",
254
+ "CREATE",
255
+ "UPDATE",
256
+ "REMOVE",
257
+ ]),
258
+ resourceName: z.string(),
259
+ userEmail: z.string().optional(),
260
+ })
261
+
262
+ export const GOOGLE_ADS_CHANGE_TRIGGER_CONFIG_SCHEMA = z.object({
263
+ customerId: GOOGLE_ADS_CUSTOMER_ID_SCHEMA,
264
+ loginCustomerId: GOOGLE_ADS_CUSTOMER_ID_SCHEMA.optional(),
265
+ })
266
+
267
+ export const GOOGLE_ADS_CHANGE_EVENT_PAYLOAD_SCHEMA = z.object({
268
+ customerId: GOOGLE_ADS_CUSTOMER_ID_SCHEMA,
269
+ event: GOOGLE_ADS_CHANGE_EVENT_SCHEMA,
270
+ })