@automate.ax/integration-contracts 0.143.9 → 0.144.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.
@@ -1,6 +1,8 @@
1
1
  import * as z from "zod";
2
2
  const GOOGLE_ADS_API_ORIGIN = "https://googleads.googleapis.com";
3
3
  const GOOGLE_ADS_API_VERSION = "v25";
4
+ const GOOGLE_DATA_MANAGER_API_ORIGIN = "https://datamanager.googleapis.com";
5
+ const GOOGLE_DATA_MANAGER_API_VERSION = "v1";
4
6
  export const GOOGLE_ADS_CUSTOMER_ID_SCHEMA = z
5
7
  .string()
6
8
  .trim()
@@ -14,6 +16,10 @@ export const GOOGLE_ADS_SECRET_SCHEMA = z.object({
14
16
  developerToken: z.string().min(1),
15
17
  tokenType: z.string().min(1),
16
18
  });
19
+ export const GOOGLE_DATA_MANAGER_SECRET_SCHEMA = z.object({
20
+ accessToken: z.string().min(1),
21
+ tokenType: z.string().min(1),
22
+ });
17
23
  const GOOGLE_ADS_FAILURE_SCHEMA = z.looseObject({
18
24
  error: z
19
25
  .looseObject({
@@ -90,6 +96,51 @@ export function getGoogleAdsApi(secret) {
90
96
  },
91
97
  };
92
98
  }
99
+ /** Creates an authenticated Google Data Manager v1 REST client. */
100
+ /** @param secret - Resolved Google OAuth credentials. */
101
+ export function getGoogleDataManagerApi(secret) {
102
+ const credentials = GOOGLE_DATA_MANAGER_SECRET_SCHEMA.parse(secret);
103
+ return {
104
+ async request(path, options) {
105
+ const normalizedPath = path.replace(/^\/+/, "");
106
+ if (!normalizedPath ||
107
+ normalizedPath.includes("://") ||
108
+ normalizedPath.includes("\\")) {
109
+ throw new TypeError("Google Data Manager API paths must be relative.");
110
+ }
111
+ const url = new URL(`${GOOGLE_DATA_MANAGER_API_VERSION}/${normalizedPath}`, `${GOOGLE_DATA_MANAGER_API_ORIGIN}/`);
112
+ if (url.origin !== GOOGLE_DATA_MANAGER_API_ORIGIN) {
113
+ throw new TypeError("Google Data Manager API paths must remain on datamanager.googleapis.com.");
114
+ }
115
+ const headers = new Headers({
116
+ Accept: "application/json",
117
+ Authorization: `Bearer ${credentials.accessToken}`,
118
+ });
119
+ if (options.body !== undefined) {
120
+ headers.set("Content-Type", "application/json");
121
+ }
122
+ const response = await fetch(url, {
123
+ body: options.body === undefined ? undefined : JSON.stringify(options.body),
124
+ headers,
125
+ method: options.method ?? (options.body === undefined ? "GET" : "POST"),
126
+ });
127
+ const payload = parseGoogleAdsJson(await response.text());
128
+ if (!response.ok) {
129
+ const failure = GOOGLE_ADS_FAILURE_SCHEMA.safeParse(payload);
130
+ throw new GoogleAdsApiError({
131
+ message: failure.success ? failure.data.error?.message : undefined,
132
+ providerStatus: failure.success
133
+ ? failure.data.error?.status
134
+ : undefined,
135
+ requestId: response.headers.get("request-id") ?? undefined,
136
+ retryAfter: response.headers.get("retry-after") ?? undefined,
137
+ status: response.status,
138
+ });
139
+ }
140
+ return options.responseSchema.parse(payload);
141
+ },
142
+ };
143
+ }
93
144
  /** Normalizes a Google Ads customer ID for paths and headers. */
94
145
  /** @param value - Dashed or compact 10-digit customer ID. */
95
146
  export function normalizeGoogleAdsCustomerId(value) {
@@ -3,16 +3,16 @@ export declare const MILLIONVERIFIER_FILE_ID_SCHEMA: z.ZodPipe<z.ZodUnion<readon
3
3
  export declare const MILLIONVERIFIER_FILE_STATUS_SCHEMA: z.ZodEnum<{
4
4
  unknown: "unknown";
5
5
  error: "error";
6
- paused: "paused";
7
6
  canceled: "canceled";
7
+ paused: "paused";
8
8
  finished: "finished";
9
9
  inProgress: "inProgress";
10
10
  inQueueToStart: "inQueueToStart";
11
11
  }>;
12
12
  export declare const MILLIONVERIFIER_FILE_FILTER_STATUS_SCHEMA: z.ZodEnum<{
13
13
  error: "error";
14
- paused: "paused";
15
14
  canceled: "canceled";
15
+ paused: "paused";
16
16
  finished: "finished";
17
17
  inProgress: "inProgress";
18
18
  inQueueToStart: "inQueueToStart";
@@ -33,8 +33,8 @@ export declare const MILLIONVERIFIER_FILE_SCHEMA: z.ZodObject<{
33
33
  status: z.ZodEnum<{
34
34
  unknown: "unknown";
35
35
  error: "error";
36
- paused: "paused";
37
36
  canceled: "canceled";
37
+ paused: "paused";
38
38
  finished: "finished";
39
39
  inProgress: "inProgress";
40
40
  inQueueToStart: "inQueueToStart";
@@ -104,8 +104,8 @@ export declare const MILLIONVERIFIER_FILE_WIRE_SCHEMA: z.ZodPipe<z.ZodObject<{
104
104
  unknown: "unknown";
105
105
  error: "error";
106
106
  in_progress: "in_progress";
107
- paused: "paused";
108
107
  canceled: "canceled";
108
+ paused: "paused";
109
109
  finished: "finished";
110
110
  in_queue_to_start: "in_queue_to_start";
111
111
  }>;
@@ -128,7 +128,7 @@ export declare const MILLIONVERIFIER_FILE_WIRE_SCHEMA: z.ZodPipe<z.ZodObject<{
128
128
  ok: number;
129
129
  percent: number;
130
130
  reverify: number;
131
- status: "unknown" | "error" | "paused" | "canceled" | "finished" | "inProgress" | "inQueueToStart";
131
+ status: "unknown" | "error" | "canceled" | "paused" | "finished" | "inProgress" | "inQueueToStart";
132
132
  totalRows: number;
133
133
  uniqueEmails: number;
134
134
  unknown: number;
@@ -149,7 +149,7 @@ export declare const MILLIONVERIFIER_FILE_WIRE_SCHEMA: z.ZodPipe<z.ZodObject<{
149
149
  ok: number;
150
150
  percent: number;
151
151
  reverify: number;
152
- status: "unknown" | "error" | "in_progress" | "paused" | "canceled" | "finished" | "in_queue_to_start";
152
+ status: "unknown" | "error" | "in_progress" | "canceled" | "paused" | "finished" | "in_queue_to_start";
153
153
  total_rows: number;
154
154
  unique_emails: number;
155
155
  unknown: number;
@@ -234,4 +234,4 @@ export declare const MILLIONVERIFIER_CREDITS_WIRE_SCHEMA: z.ZodPipe<z.ZodObject<
234
234
  *
235
235
  * @param status - Public file status.
236
236
  */
237
- export declare function toMillionVerifierFileStatus(status: z.output<typeof MILLIONVERIFIER_FILE_FILTER_STATUS_SCHEMA>): "error" | "in_progress" | "paused" | "canceled" | "finished" | "in_queue_to_start";
237
+ export declare function toMillionVerifierFileStatus(status: z.output<typeof MILLIONVERIFIER_FILE_FILTER_STATUS_SCHEMA>): "error" | "in_progress" | "canceled" | "paused" | "finished" | "in_queue_to_start";
@@ -1,12 +1,12 @@
1
1
  import * as z from "zod";
2
2
  export declare const RESEND_EMAIL_STATUS_SCHEMA: z.ZodEnum<{
3
3
  failed: "failed";
4
+ canceled: "canceled";
4
5
  sent: "sent";
5
6
  delivered: "delivered";
6
7
  clicked: "clicked";
7
8
  opened: "opened";
8
9
  scheduled: "scheduled";
9
- canceled: "canceled";
10
10
  queued: "queued";
11
11
  suppressed: "suppressed";
12
12
  bounced: "bounced";
@@ -76,12 +76,12 @@ export declare const RESEND_EMAIL_SUMMARY_WIRE_SCHEMA: z.ZodObject<{
76
76
  id: z.ZodString;
77
77
  last_event: z.ZodEnum<{
78
78
  failed: "failed";
79
+ canceled: "canceled";
79
80
  sent: "sent";
80
81
  delivered: "delivered";
81
82
  clicked: "clicked";
82
83
  opened: "opened";
83
84
  scheduled: "scheduled";
84
- canceled: "canceled";
85
85
  queued: "queued";
86
86
  suppressed: "suppressed";
87
87
  bounced: "bounced";
@@ -103,12 +103,12 @@ export declare const RESEND_EMAIL_SUMMARY_SCHEMA: z.ZodPipe<z.ZodObject<{
103
103
  id: z.ZodString;
104
104
  last_event: z.ZodEnum<{
105
105
  failed: "failed";
106
+ canceled: "canceled";
106
107
  sent: "sent";
107
108
  delivered: "delivered";
108
109
  clicked: "clicked";
109
110
  opened: "opened";
110
111
  scheduled: "scheduled";
111
- canceled: "canceled";
112
112
  queued: "queued";
113
113
  suppressed: "suppressed";
114
114
  bounced: "bounced";
@@ -123,7 +123,7 @@ export declare const RESEND_EMAIL_SUMMARY_SCHEMA: z.ZodPipe<z.ZodObject<{
123
123
  topic_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
124
  }, z.core.$strip>, z.ZodTransform<{
125
125
  createdAt: string;
126
- lastEvent: "failed" | "sent" | "delivered" | "clicked" | "opened" | "scheduled" | "canceled" | "queued" | "suppressed" | "bounced" | "complained" | "delivery_delayed";
126
+ lastEvent: "failed" | "canceled" | "sent" | "delivered" | "clicked" | "opened" | "scheduled" | "queued" | "suppressed" | "bounced" | "complained" | "delivery_delayed";
127
127
  messageId: string | null | undefined;
128
128
  replyTo: string[] | null | undefined;
129
129
  scheduledAt: string | null | undefined;
@@ -138,7 +138,7 @@ export declare const RESEND_EMAIL_SUMMARY_SCHEMA: z.ZodPipe<z.ZodObject<{
138
138
  created_at: string;
139
139
  from: string;
140
140
  id: string;
141
- last_event: "failed" | "sent" | "delivered" | "clicked" | "opened" | "scheduled" | "canceled" | "queued" | "suppressed" | "bounced" | "complained" | "delivery_delayed";
141
+ last_event: "failed" | "canceled" | "sent" | "delivered" | "clicked" | "opened" | "scheduled" | "queued" | "suppressed" | "bounced" | "complained" | "delivery_delayed";
142
142
  subject: string;
143
143
  to: string[];
144
144
  bcc?: string[] | null | undefined;
@@ -154,12 +154,12 @@ export declare const RESEND_EMAIL_WIRE_SCHEMA: z.ZodObject<{
154
154
  id: z.ZodString;
155
155
  last_event: z.ZodEnum<{
156
156
  failed: "failed";
157
+ canceled: "canceled";
157
158
  sent: "sent";
158
159
  delivered: "delivered";
159
160
  clicked: "clicked";
160
161
  opened: "opened";
161
162
  scheduled: "scheduled";
162
- canceled: "canceled";
163
163
  queued: "queued";
164
164
  suppressed: "suppressed";
165
165
  bounced: "bounced";
@@ -188,12 +188,12 @@ export declare const RESEND_EMAIL_SCHEMA: z.ZodPipe<z.ZodObject<{
188
188
  id: z.ZodString;
189
189
  last_event: z.ZodEnum<{
190
190
  failed: "failed";
191
+ canceled: "canceled";
191
192
  sent: "sent";
192
193
  delivered: "delivered";
193
194
  clicked: "clicked";
194
195
  opened: "opened";
195
196
  scheduled: "scheduled";
196
- canceled: "canceled";
197
197
  queued: "queued";
198
198
  suppressed: "suppressed";
199
199
  bounced: "bounced";
@@ -217,7 +217,7 @@ export declare const RESEND_EMAIL_SCHEMA: z.ZodPipe<z.ZodObject<{
217
217
  text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
218
218
  }, z.core.$strip>, z.ZodTransform<{
219
219
  createdAt: string;
220
- lastEvent: "failed" | "sent" | "delivered" | "clicked" | "opened" | "scheduled" | "canceled" | "queued" | "suppressed" | "bounced" | "complained" | "delivery_delayed";
220
+ lastEvent: "failed" | "canceled" | "sent" | "delivered" | "clicked" | "opened" | "scheduled" | "queued" | "suppressed" | "bounced" | "complained" | "delivery_delayed";
221
221
  messageId: string | null | undefined;
222
222
  replyTo: string[] | null | undefined;
223
223
  scheduledAt: string | null | undefined;
@@ -239,7 +239,7 @@ export declare const RESEND_EMAIL_SCHEMA: z.ZodPipe<z.ZodObject<{
239
239
  created_at: string;
240
240
  from: string;
241
241
  id: string;
242
- last_event: "failed" | "sent" | "delivered" | "clicked" | "opened" | "scheduled" | "canceled" | "queued" | "suppressed" | "bounced" | "complained" | "delivery_delayed";
242
+ last_event: "failed" | "canceled" | "sent" | "delivered" | "clicked" | "opened" | "scheduled" | "queued" | "suppressed" | "bounced" | "complained" | "delivery_delayed";
243
243
  subject: string;
244
244
  to: string[];
245
245
  object: "email";