@automate.ax/integration-contracts 0.115.6 → 0.116.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.
- package/dist/millionverifier/api.d.ts +62 -0
- package/dist/millionverifier/api.js +114 -0
- package/dist/millionverifier/events.d.ts +126 -0
- package/dist/millionverifier/events.js +103 -0
- package/dist/millionverifier/index.d.ts +77 -0
- package/dist/millionverifier/index.js +17 -0
- package/dist/millionverifier/schemas.d.ts +226 -0
- package/dist/millionverifier/schemas.js +188 -0
- package/dist/triggers.d.ts +2 -1
- package/package.json +8 -2
- package/src/millionverifier/api.ts +151 -0
- package/src/millionverifier/events.ts +110 -0
- package/src/millionverifier/index.ts +33 -0
- package/src/millionverifier/schemas.ts +207 -0
- package/src/triggers.ts +2 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
export declare const MILLIONVERIFIER_FILE_ID_SCHEMA: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
3
|
+
export declare const MILLIONVERIFIER_FILE_STATUS_SCHEMA: z.ZodEnum<{
|
|
4
|
+
error: "error";
|
|
5
|
+
paused: "paused";
|
|
6
|
+
canceled: "canceled";
|
|
7
|
+
finished: "finished";
|
|
8
|
+
inProgress: "inProgress";
|
|
9
|
+
inQueueToStart: "inQueueToStart";
|
|
10
|
+
}>;
|
|
11
|
+
export declare const MILLIONVERIFIER_FILE_SCHEMA: z.ZodObject<{
|
|
12
|
+
catchAll: z.ZodNumber;
|
|
13
|
+
createdAt: z.ZodString;
|
|
14
|
+
creditsRequired: z.ZodNumber;
|
|
15
|
+
disposable: z.ZodNumber;
|
|
16
|
+
error: z.ZodString;
|
|
17
|
+
estimatedTimeSeconds: z.ZodNumber;
|
|
18
|
+
fileId: z.ZodString;
|
|
19
|
+
fileName: z.ZodString;
|
|
20
|
+
invalid: z.ZodNumber;
|
|
21
|
+
ok: z.ZodNumber;
|
|
22
|
+
percent: z.ZodNumber;
|
|
23
|
+
reverify: z.ZodNumber;
|
|
24
|
+
status: z.ZodEnum<{
|
|
25
|
+
error: "error";
|
|
26
|
+
paused: "paused";
|
|
27
|
+
canceled: "canceled";
|
|
28
|
+
finished: "finished";
|
|
29
|
+
inProgress: "inProgress";
|
|
30
|
+
inQueueToStart: "inQueueToStart";
|
|
31
|
+
}>;
|
|
32
|
+
totalRows: z.ZodNumber;
|
|
33
|
+
uniqueEmails: z.ZodNumber;
|
|
34
|
+
unknown: z.ZodNumber;
|
|
35
|
+
unverified: z.ZodNumber;
|
|
36
|
+
updatedAt: z.ZodString;
|
|
37
|
+
verified: z.ZodNumber;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export declare const MILLIONVERIFIER_EMAIL_RESULT_SCHEMA: z.ZodEnum<{
|
|
40
|
+
unknown: "unknown";
|
|
41
|
+
error: "error";
|
|
42
|
+
invalid: "invalid";
|
|
43
|
+
ok: "ok";
|
|
44
|
+
catchAll: "catchAll";
|
|
45
|
+
disposable: "disposable";
|
|
46
|
+
unverified: "unverified";
|
|
47
|
+
}>;
|
|
48
|
+
export declare const MILLIONVERIFIER_EMAIL_VERIFICATION_SCHEMA: z.ZodObject<{
|
|
49
|
+
credits: z.ZodNumber;
|
|
50
|
+
didYouMean: z.ZodString;
|
|
51
|
+
email: z.ZodString;
|
|
52
|
+
error: z.ZodString;
|
|
53
|
+
executionTimeMilliseconds: z.ZodNumber;
|
|
54
|
+
free: z.ZodBoolean;
|
|
55
|
+
liveMode: z.ZodBoolean;
|
|
56
|
+
quality: z.ZodOptional<z.ZodEnum<{
|
|
57
|
+
good: "good";
|
|
58
|
+
bad: "bad";
|
|
59
|
+
risky: "risky";
|
|
60
|
+
}>>;
|
|
61
|
+
result: z.ZodEnum<{
|
|
62
|
+
unknown: "unknown";
|
|
63
|
+
error: "error";
|
|
64
|
+
invalid: "invalid";
|
|
65
|
+
ok: "ok";
|
|
66
|
+
catchAll: "catchAll";
|
|
67
|
+
disposable: "disposable";
|
|
68
|
+
unverified: "unverified";
|
|
69
|
+
}>;
|
|
70
|
+
resultCode: z.ZodNumber;
|
|
71
|
+
role: z.ZodBoolean;
|
|
72
|
+
subresult: z.ZodString;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export declare const MILLIONVERIFIER_CREDITS_SCHEMA: z.ZodObject<{
|
|
75
|
+
bulkCredits: z.ZodNumber;
|
|
76
|
+
credits: z.ZodNumber;
|
|
77
|
+
plan: z.ZodNumber;
|
|
78
|
+
renewingCredits: z.ZodNumber;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
export declare const MILLIONVERIFIER_FILE_WIRE_SCHEMA: z.ZodPipe<z.ZodObject<{
|
|
81
|
+
catch_all: z.ZodNumber;
|
|
82
|
+
createdate: z.ZodString;
|
|
83
|
+
credit: z.ZodNumber;
|
|
84
|
+
disposable: z.ZodNumber;
|
|
85
|
+
error: z.ZodString;
|
|
86
|
+
estimated_time_sec: z.ZodNumber;
|
|
87
|
+
file_id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
88
|
+
file_name: z.ZodString;
|
|
89
|
+
invalid: z.ZodNumber;
|
|
90
|
+
ok: z.ZodNumber;
|
|
91
|
+
percent: z.ZodNumber;
|
|
92
|
+
reverify: z.ZodNumber;
|
|
93
|
+
status: z.ZodEnum<{
|
|
94
|
+
error: "error";
|
|
95
|
+
in_progress: "in_progress";
|
|
96
|
+
paused: "paused";
|
|
97
|
+
canceled: "canceled";
|
|
98
|
+
finished: "finished";
|
|
99
|
+
in_queue_to_start: "in_queue_to_start";
|
|
100
|
+
}>;
|
|
101
|
+
total_rows: z.ZodNumber;
|
|
102
|
+
unique_emails: z.ZodNumber;
|
|
103
|
+
unknown: z.ZodNumber;
|
|
104
|
+
unverified: z.ZodNumber;
|
|
105
|
+
updated_at: z.ZodString;
|
|
106
|
+
verified: z.ZodNumber;
|
|
107
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
108
|
+
catchAll: number;
|
|
109
|
+
createdAt: string;
|
|
110
|
+
creditsRequired: number;
|
|
111
|
+
disposable: number;
|
|
112
|
+
error: string;
|
|
113
|
+
estimatedTimeSeconds: number;
|
|
114
|
+
fileId: string;
|
|
115
|
+
fileName: string;
|
|
116
|
+
invalid: number;
|
|
117
|
+
ok: number;
|
|
118
|
+
percent: number;
|
|
119
|
+
reverify: number;
|
|
120
|
+
status: "error" | "paused" | "canceled" | "finished" | "inProgress" | "inQueueToStart";
|
|
121
|
+
totalRows: number;
|
|
122
|
+
uniqueEmails: number;
|
|
123
|
+
unknown: number;
|
|
124
|
+
unverified: number;
|
|
125
|
+
updatedAt: string;
|
|
126
|
+
verified: number;
|
|
127
|
+
}, {
|
|
128
|
+
[x: string]: unknown;
|
|
129
|
+
catch_all: number;
|
|
130
|
+
createdate: string;
|
|
131
|
+
credit: number;
|
|
132
|
+
disposable: number;
|
|
133
|
+
error: string;
|
|
134
|
+
estimated_time_sec: number;
|
|
135
|
+
file_id: string;
|
|
136
|
+
file_name: string;
|
|
137
|
+
invalid: number;
|
|
138
|
+
ok: number;
|
|
139
|
+
percent: number;
|
|
140
|
+
reverify: number;
|
|
141
|
+
status: "error" | "in_progress" | "paused" | "canceled" | "finished" | "in_queue_to_start";
|
|
142
|
+
total_rows: number;
|
|
143
|
+
unique_emails: number;
|
|
144
|
+
unknown: number;
|
|
145
|
+
unverified: number;
|
|
146
|
+
updated_at: string;
|
|
147
|
+
verified: number;
|
|
148
|
+
}>>;
|
|
149
|
+
export declare const MILLIONVERIFIER_EMAIL_VERIFICATION_WIRE_SCHEMA: z.ZodPipe<z.ZodObject<{
|
|
150
|
+
credits: z.ZodNumber;
|
|
151
|
+
didyoumean: z.ZodString;
|
|
152
|
+
email: z.ZodString;
|
|
153
|
+
error: z.ZodString;
|
|
154
|
+
executiontime: z.ZodNumber;
|
|
155
|
+
free: z.ZodBoolean;
|
|
156
|
+
livemode: z.ZodBoolean;
|
|
157
|
+
quality: z.ZodOptional<z.ZodEnum<{
|
|
158
|
+
"": "";
|
|
159
|
+
good: "good";
|
|
160
|
+
bad: "bad";
|
|
161
|
+
risky: "risky";
|
|
162
|
+
}>>;
|
|
163
|
+
result: z.ZodEnum<{
|
|
164
|
+
"": "";
|
|
165
|
+
unknown: "unknown";
|
|
166
|
+
error: "error";
|
|
167
|
+
invalid: "invalid";
|
|
168
|
+
ok: "ok";
|
|
169
|
+
disposable: "disposable";
|
|
170
|
+
catch_all: "catch_all";
|
|
171
|
+
unverified: "unverified";
|
|
172
|
+
}>;
|
|
173
|
+
resultcode: z.ZodNumber;
|
|
174
|
+
role: z.ZodBoolean;
|
|
175
|
+
subresult: z.ZodString;
|
|
176
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
177
|
+
credits: number;
|
|
178
|
+
didYouMean: string;
|
|
179
|
+
email: string;
|
|
180
|
+
error: string;
|
|
181
|
+
executionTimeMilliseconds: number;
|
|
182
|
+
free: boolean;
|
|
183
|
+
liveMode: boolean;
|
|
184
|
+
result: "unknown" | "error" | "invalid" | "ok" | "catchAll" | "disposable" | "unverified";
|
|
185
|
+
resultCode: number;
|
|
186
|
+
role: boolean;
|
|
187
|
+
subresult: string;
|
|
188
|
+
quality?: "good" | "bad" | "risky" | undefined;
|
|
189
|
+
}, {
|
|
190
|
+
[x: string]: unknown;
|
|
191
|
+
credits: number;
|
|
192
|
+
didyoumean: string;
|
|
193
|
+
email: string;
|
|
194
|
+
error: string;
|
|
195
|
+
executiontime: number;
|
|
196
|
+
free: boolean;
|
|
197
|
+
livemode: boolean;
|
|
198
|
+
result: "" | "unknown" | "error" | "invalid" | "ok" | "disposable" | "catch_all" | "unverified";
|
|
199
|
+
resultcode: number;
|
|
200
|
+
role: boolean;
|
|
201
|
+
subresult: string;
|
|
202
|
+
quality?: "" | "good" | "bad" | "risky" | undefined;
|
|
203
|
+
}>>;
|
|
204
|
+
export declare const MILLIONVERIFIER_CREDITS_WIRE_SCHEMA: z.ZodPipe<z.ZodObject<{
|
|
205
|
+
bulk_credits: z.ZodNumber;
|
|
206
|
+
credits: z.ZodNumber;
|
|
207
|
+
plan: z.ZodNumber;
|
|
208
|
+
renewing_credits: z.ZodNumber;
|
|
209
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
210
|
+
bulkCredits: number;
|
|
211
|
+
credits: number;
|
|
212
|
+
plan: number;
|
|
213
|
+
renewingCredits: number;
|
|
214
|
+
}, {
|
|
215
|
+
[x: string]: unknown;
|
|
216
|
+
bulk_credits: number;
|
|
217
|
+
credits: number;
|
|
218
|
+
plan: number;
|
|
219
|
+
renewing_credits: number;
|
|
220
|
+
}>>;
|
|
221
|
+
/**
|
|
222
|
+
* Maps a public file status to MillionVerifier's query value.
|
|
223
|
+
*
|
|
224
|
+
* @param status - Public file status.
|
|
225
|
+
*/
|
|
226
|
+
export declare function toMillionVerifierFileStatus(status: z.output<typeof MILLIONVERIFIER_FILE_STATUS_SCHEMA>): "error" | "in_progress" | "paused" | "canceled" | "finished" | "in_queue_to_start";
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
export const MILLIONVERIFIER_FILE_ID_SCHEMA = z
|
|
3
|
+
.union([z.string().regex(/^\d+$/), z.number().int().positive()])
|
|
4
|
+
.transform(String);
|
|
5
|
+
export const MILLIONVERIFIER_FILE_STATUS_SCHEMA = z.enum([
|
|
6
|
+
"inProgress",
|
|
7
|
+
"error",
|
|
8
|
+
"finished",
|
|
9
|
+
"canceled",
|
|
10
|
+
"paused",
|
|
11
|
+
"inQueueToStart",
|
|
12
|
+
]);
|
|
13
|
+
export const MILLIONVERIFIER_FILE_SCHEMA = z.object({
|
|
14
|
+
catchAll: z.number().int().nonnegative(),
|
|
15
|
+
createdAt: z.string(),
|
|
16
|
+
creditsRequired: z.number().int().nonnegative(),
|
|
17
|
+
disposable: z.number().int().nonnegative(),
|
|
18
|
+
error: z.string(),
|
|
19
|
+
estimatedTimeSeconds: z.number().int().nonnegative(),
|
|
20
|
+
fileId: z.string(),
|
|
21
|
+
fileName: z.string(),
|
|
22
|
+
invalid: z.number().int().nonnegative(),
|
|
23
|
+
ok: z.number().int().nonnegative(),
|
|
24
|
+
percent: z.number().int().min(0).max(100),
|
|
25
|
+
reverify: z.number().int().nonnegative(),
|
|
26
|
+
status: MILLIONVERIFIER_FILE_STATUS_SCHEMA,
|
|
27
|
+
totalRows: z.number().int().nonnegative(),
|
|
28
|
+
uniqueEmails: z.number().int().nonnegative(),
|
|
29
|
+
unknown: z.number().int().nonnegative(),
|
|
30
|
+
unverified: z.number().int().nonnegative(),
|
|
31
|
+
updatedAt: z.string(),
|
|
32
|
+
verified: z.number().int().nonnegative(),
|
|
33
|
+
});
|
|
34
|
+
export const MILLIONVERIFIER_EMAIL_RESULT_SCHEMA = z.enum([
|
|
35
|
+
"unverified",
|
|
36
|
+
"ok",
|
|
37
|
+
"catchAll",
|
|
38
|
+
"unknown",
|
|
39
|
+
"error",
|
|
40
|
+
"disposable",
|
|
41
|
+
"invalid",
|
|
42
|
+
]);
|
|
43
|
+
export const MILLIONVERIFIER_EMAIL_VERIFICATION_SCHEMA = z.object({
|
|
44
|
+
credits: z.number().int().nonnegative(),
|
|
45
|
+
didYouMean: z.string(),
|
|
46
|
+
email: z.string(),
|
|
47
|
+
error: z.string(),
|
|
48
|
+
executionTimeMilliseconds: z.number().int().nonnegative(),
|
|
49
|
+
free: z.boolean(),
|
|
50
|
+
liveMode: z.boolean(),
|
|
51
|
+
quality: z.enum(["good", "bad", "risky"]).optional(),
|
|
52
|
+
result: MILLIONVERIFIER_EMAIL_RESULT_SCHEMA,
|
|
53
|
+
resultCode: z.number().int().min(0).max(6),
|
|
54
|
+
role: z.boolean(),
|
|
55
|
+
subresult: z.string(),
|
|
56
|
+
});
|
|
57
|
+
export const MILLIONVERIFIER_CREDITS_SCHEMA = z.object({
|
|
58
|
+
bulkCredits: z.number().int().nonnegative(),
|
|
59
|
+
credits: z.number().int().nonnegative(),
|
|
60
|
+
plan: z.number().int(),
|
|
61
|
+
renewingCredits: z.number().int().nonnegative(),
|
|
62
|
+
});
|
|
63
|
+
const PROVIDER_FILE_STATUS_SCHEMA = z.enum([
|
|
64
|
+
"in_progress",
|
|
65
|
+
"error",
|
|
66
|
+
"finished",
|
|
67
|
+
"canceled",
|
|
68
|
+
"paused",
|
|
69
|
+
"in_queue_to_start",
|
|
70
|
+
]);
|
|
71
|
+
export const MILLIONVERIFIER_FILE_WIRE_SCHEMA = z
|
|
72
|
+
.looseObject({
|
|
73
|
+
catch_all: z.number().int().nonnegative(),
|
|
74
|
+
createdate: z.string(),
|
|
75
|
+
credit: z.number().int().nonnegative(),
|
|
76
|
+
disposable: z.number().int().nonnegative(),
|
|
77
|
+
error: z.string(),
|
|
78
|
+
estimated_time_sec: z.number().int().nonnegative(),
|
|
79
|
+
file_id: z.union([z.string(), z.number()]).transform(String),
|
|
80
|
+
file_name: z.string(),
|
|
81
|
+
invalid: z.number().int().nonnegative(),
|
|
82
|
+
ok: z.number().int().nonnegative(),
|
|
83
|
+
percent: z.number().int().min(0).max(100),
|
|
84
|
+
reverify: z.number().int().nonnegative(),
|
|
85
|
+
status: PROVIDER_FILE_STATUS_SCHEMA,
|
|
86
|
+
total_rows: z.number().int().nonnegative(),
|
|
87
|
+
unique_emails: z.number().int().nonnegative(),
|
|
88
|
+
unknown: z.number().int().nonnegative(),
|
|
89
|
+
unverified: z.number().int().nonnegative(),
|
|
90
|
+
updated_at: z.string(),
|
|
91
|
+
verified: z.number().int().nonnegative(),
|
|
92
|
+
})
|
|
93
|
+
.transform((file) => MILLIONVERIFIER_FILE_SCHEMA.parse({
|
|
94
|
+
catchAll: file.catch_all,
|
|
95
|
+
createdAt: file.createdate,
|
|
96
|
+
creditsRequired: file.credit,
|
|
97
|
+
disposable: file.disposable,
|
|
98
|
+
error: file.error,
|
|
99
|
+
estimatedTimeSeconds: file.estimated_time_sec,
|
|
100
|
+
fileId: file.file_id,
|
|
101
|
+
fileName: file.file_name,
|
|
102
|
+
invalid: file.invalid,
|
|
103
|
+
ok: file.ok,
|
|
104
|
+
percent: file.percent,
|
|
105
|
+
reverify: file.reverify,
|
|
106
|
+
status: fromProviderFileStatus(file.status),
|
|
107
|
+
totalRows: file.total_rows,
|
|
108
|
+
uniqueEmails: file.unique_emails,
|
|
109
|
+
unknown: file.unknown,
|
|
110
|
+
unverified: file.unverified,
|
|
111
|
+
updatedAt: file.updated_at,
|
|
112
|
+
verified: file.verified,
|
|
113
|
+
}));
|
|
114
|
+
export const MILLIONVERIFIER_EMAIL_VERIFICATION_WIRE_SCHEMA = z
|
|
115
|
+
.looseObject({
|
|
116
|
+
credits: z.number().int().nonnegative(),
|
|
117
|
+
didyoumean: z.string(),
|
|
118
|
+
email: z.string(),
|
|
119
|
+
error: z.string(),
|
|
120
|
+
executiontime: z.number().int().nonnegative(),
|
|
121
|
+
free: z.boolean(),
|
|
122
|
+
livemode: z.boolean(),
|
|
123
|
+
quality: z.enum(["", "good", "bad", "risky"]).optional(),
|
|
124
|
+
result: z.enum([
|
|
125
|
+
"",
|
|
126
|
+
"unverified",
|
|
127
|
+
"ok",
|
|
128
|
+
"catch_all",
|
|
129
|
+
"unknown",
|
|
130
|
+
"error",
|
|
131
|
+
"disposable",
|
|
132
|
+
"invalid",
|
|
133
|
+
]),
|
|
134
|
+
resultcode: z.number().int().min(0).max(6),
|
|
135
|
+
role: z.boolean(),
|
|
136
|
+
subresult: z.string(),
|
|
137
|
+
})
|
|
138
|
+
.transform((result) => MILLIONVERIFIER_EMAIL_VERIFICATION_SCHEMA.parse({
|
|
139
|
+
credits: result.credits,
|
|
140
|
+
didYouMean: result.didyoumean,
|
|
141
|
+
email: result.email,
|
|
142
|
+
error: result.error,
|
|
143
|
+
executionTimeMilliseconds: result.executiontime,
|
|
144
|
+
free: result.free,
|
|
145
|
+
liveMode: result.livemode,
|
|
146
|
+
quality: result.quality || undefined,
|
|
147
|
+
result: result.result === "catch_all" ? "catchAll" : result.result || "error",
|
|
148
|
+
resultCode: result.resultcode,
|
|
149
|
+
role: result.role,
|
|
150
|
+
subresult: result.subresult,
|
|
151
|
+
}));
|
|
152
|
+
export const MILLIONVERIFIER_CREDITS_WIRE_SCHEMA = z
|
|
153
|
+
.looseObject({
|
|
154
|
+
bulk_credits: z.number().int().nonnegative(),
|
|
155
|
+
credits: z.number().int().nonnegative(),
|
|
156
|
+
plan: z.number().int(),
|
|
157
|
+
renewing_credits: z.number().int().nonnegative(),
|
|
158
|
+
})
|
|
159
|
+
.transform((credits) => MILLIONVERIFIER_CREDITS_SCHEMA.parse({
|
|
160
|
+
bulkCredits: credits.bulk_credits,
|
|
161
|
+
credits: credits.credits,
|
|
162
|
+
plan: credits.plan,
|
|
163
|
+
renewingCredits: credits.renewing_credits,
|
|
164
|
+
}));
|
|
165
|
+
/**
|
|
166
|
+
* Maps a provider file status to the public camelCase discriminator.
|
|
167
|
+
*
|
|
168
|
+
* @param status - Provider file status.
|
|
169
|
+
*/
|
|
170
|
+
function fromProviderFileStatus(status) {
|
|
171
|
+
if (status === "in_progress")
|
|
172
|
+
return "inProgress";
|
|
173
|
+
if (status === "in_queue_to_start")
|
|
174
|
+
return "inQueueToStart";
|
|
175
|
+
return status;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Maps a public file status to MillionVerifier's query value.
|
|
179
|
+
*
|
|
180
|
+
* @param status - Public file status.
|
|
181
|
+
*/
|
|
182
|
+
export function toMillionVerifierFileStatus(status) {
|
|
183
|
+
if (status === "inProgress")
|
|
184
|
+
return "in_progress";
|
|
185
|
+
if (status === "inQueueToStart")
|
|
186
|
+
return "in_queue_to_start";
|
|
187
|
+
return status;
|
|
188
|
+
}
|
package/dist/triggers.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { googleFormsTriggerContracts } from "./google-forms/index.js";
|
|
|
12
12
|
import type { googleMeetTriggerContracts } from "./google-meet/index.js";
|
|
13
13
|
import type { googleSheetsTriggerContracts } from "./google-sheets/index.js";
|
|
14
14
|
import type { linearTriggerContracts } from "./linear/index.js";
|
|
15
|
+
import type { millionVerifierTriggerContracts } from "./millionverifier/index.js";
|
|
15
16
|
import type { notionTriggerContracts } from "./notion/index.js";
|
|
16
17
|
import type { outlookTriggerContracts } from "./outlook/index.js";
|
|
17
18
|
import type { resendTriggerContracts } from "./resend/index.js";
|
|
@@ -23,7 +24,7 @@ import type { vercelTriggerContracts } from "./vercel/index.js";
|
|
|
23
24
|
import type { webflowTriggerContracts } from "./webflow/index.js";
|
|
24
25
|
import type { whatsappTriggerContracts } from "./whatsapp/index.js";
|
|
25
26
|
import type { z } from "zod";
|
|
26
|
-
export type TriggerContractMap = typeof airtableTriggerContracts & typeof automateTriggerContracts & typeof asanaTriggerContracts & typeof brevoTriggerContracts & typeof convexTriggerContracts & typeof closeTriggerContracts & typeof cloudflareTriggerContracts & typeof githubTriggerContracts & typeof gmailTriggerContracts & typeof googleCalendarTriggerContracts & typeof googleFormsTriggerContracts & typeof googleMeetTriggerContracts & typeof googleSheetsTriggerContracts & typeof linearTriggerContracts & typeof notionTriggerContracts & typeof outlookTriggerContracts & typeof resendTriggerContracts & typeof slackTriggerContracts & typeof stripeTriggerContracts & typeof teamsTriggerContracts & typeof trelloTriggerContracts & typeof vercelTriggerContracts & typeof webflowTriggerContracts & typeof whatsappTriggerContracts;
|
|
27
|
+
export type TriggerContractMap = typeof airtableTriggerContracts & typeof automateTriggerContracts & typeof asanaTriggerContracts & typeof brevoTriggerContracts & typeof convexTriggerContracts & typeof closeTriggerContracts & typeof cloudflareTriggerContracts & typeof githubTriggerContracts & typeof gmailTriggerContracts & typeof googleCalendarTriggerContracts & typeof googleFormsTriggerContracts & typeof googleMeetTriggerContracts & typeof googleSheetsTriggerContracts & typeof linearTriggerContracts & typeof millionVerifierTriggerContracts & typeof notionTriggerContracts & typeof outlookTriggerContracts & typeof resendTriggerContracts & typeof slackTriggerContracts & typeof stripeTriggerContracts & typeof teamsTriggerContracts & typeof trelloTriggerContracts & typeof vercelTriggerContracts & typeof webflowTriggerContracts & typeof whatsappTriggerContracts;
|
|
27
28
|
export type IntegrationTriggerType = keyof TriggerContractMap;
|
|
28
29
|
/** Canonical authoring configuration for one integration trigger type. */
|
|
29
30
|
export type TriggerConfig<TType extends IntegrationTriggerType> = z.input<TriggerContractMap[TType]["configSchema"]> extends Record<string, never> ? object : z.input<TriggerContractMap[TType]["configSchema"]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automate.ax/integration-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.116.0",
|
|
4
4
|
"description": "Shared integration payload contracts and provider primitives for Automate.ax.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"./github": "./src/github/index.ts",
|
|
34
34
|
"./jobnimbus": "./src/jobnimbus/index.ts",
|
|
35
35
|
"./linear": "./src/linear/index.ts",
|
|
36
|
+
"./millionverifier": "./src/millionverifier/index.ts",
|
|
36
37
|
"./notion": "./src/notion/index.ts",
|
|
37
38
|
"./outlook": "./src/outlook/index.ts",
|
|
38
39
|
"./resend": "./src/resend/index.ts",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
}
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@automate.ax/codec": "0.
|
|
55
|
+
"@automate.ax/codec": "0.116.0",
|
|
55
56
|
"@cfworker/json-schema": "^4.1.1",
|
|
56
57
|
"@googleapis/calendar": "^15.0.0",
|
|
57
58
|
"@googleapis/forms": "^6.0.1",
|
|
@@ -177,6 +178,11 @@
|
|
|
177
178
|
"types": "./dist/linear/index.d.ts",
|
|
178
179
|
"default": "./dist/linear/index.js"
|
|
179
180
|
},
|
|
181
|
+
"./millionverifier": {
|
|
182
|
+
"bun": "./src/millionverifier/index.ts",
|
|
183
|
+
"types": "./dist/millionverifier/index.d.ts",
|
|
184
|
+
"default": "./dist/millionverifier/index.js"
|
|
185
|
+
},
|
|
180
186
|
"./notion": {
|
|
181
187
|
"bun": "./src/notion/index.ts",
|
|
182
188
|
"types": "./dist/notion/index.d.ts",
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
|
|
3
|
+
const MILLIONVERIFIER_SECRET_SCHEMA = z.object({ apiKey: z.string().min(1) })
|
|
4
|
+
const MILLIONVERIFIER_ERROR_SCHEMA = z.looseObject({
|
|
5
|
+
error: z.string().optional(),
|
|
6
|
+
result: z.string().optional(),
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
/** Structured failure returned by MillionVerifier. */
|
|
10
|
+
export class MillionVerifierApiError extends Error {
|
|
11
|
+
/** Provider error classification or message. */
|
|
12
|
+
readonly code: string
|
|
13
|
+
|
|
14
|
+
/** API path that failed. */
|
|
15
|
+
readonly path: string
|
|
16
|
+
|
|
17
|
+
/** HTTP status returned by MillionVerifier. */
|
|
18
|
+
readonly status: number
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Creates a MillionVerifier provider error.
|
|
22
|
+
*
|
|
23
|
+
* @param options - Provider failure details.
|
|
24
|
+
* @param options.code - Provider error classification or message.
|
|
25
|
+
* @param options.path - API path that failed.
|
|
26
|
+
* @param options.status - HTTP status.
|
|
27
|
+
*/
|
|
28
|
+
constructor(options: { code: string; path: string; status: number }) {
|
|
29
|
+
super(`MillionVerifier ${options.path} failed: ${options.code}`)
|
|
30
|
+
this.name = "MillionVerifierApiError"
|
|
31
|
+
this.code = options.code
|
|
32
|
+
this.path = options.path
|
|
33
|
+
this.status = options.status
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Query values accepted by the MillionVerifier request helper. */
|
|
38
|
+
export type MillionVerifierQueryValue =
|
|
39
|
+
| boolean
|
|
40
|
+
| number
|
|
41
|
+
| readonly (number | string)[]
|
|
42
|
+
| string
|
|
43
|
+
| undefined
|
|
44
|
+
|
|
45
|
+
/** Options accepted by the authenticated MillionVerifier request helper. */
|
|
46
|
+
export interface MillionVerifierRequestOptions extends RequestInit {
|
|
47
|
+
/** Selects the real-time or bulk API origin and credential parameter. */
|
|
48
|
+
api: "bulk" | "single"
|
|
49
|
+
|
|
50
|
+
/** Query parameters appended to the request URL. */
|
|
51
|
+
query?: Record<string, MillionVerifierQueryValue>
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Creates an authenticated MillionVerifier HTTP client.
|
|
56
|
+
*
|
|
57
|
+
* @param secret - Resolved MillionVerifier integration secret.
|
|
58
|
+
*/
|
|
59
|
+
export function getMillionVerifierApi(secret: Record<string, unknown>) {
|
|
60
|
+
const { apiKey } = MILLIONVERIFIER_SECRET_SCHEMA.parse(secret)
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
/**
|
|
64
|
+
* Sends an authenticated request to a MillionVerifier API.
|
|
65
|
+
*
|
|
66
|
+
* @param path - Absolute-path provider endpoint.
|
|
67
|
+
* @param options - API selection, native fetch options, and query values.
|
|
68
|
+
*/
|
|
69
|
+
async request(path: string, options: MillionVerifierRequestOptions) {
|
|
70
|
+
const { api, query, ...requestInit } = options
|
|
71
|
+
const url = new URL(
|
|
72
|
+
path,
|
|
73
|
+
api === "single"
|
|
74
|
+
? "https://api.millionverifier.com"
|
|
75
|
+
: "https://bulkapi.millionverifier.com",
|
|
76
|
+
)
|
|
77
|
+
url.searchParams.set(api === "single" ? "api" : "key", apiKey)
|
|
78
|
+
for (const [key, value] of Object.entries(query ?? {})) {
|
|
79
|
+
if (value === undefined) continue
|
|
80
|
+
url.searchParams.set(
|
|
81
|
+
key,
|
|
82
|
+
Array.isArray(value) ? value.join(",") : String(value),
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const response = await fetch(url, requestInit)
|
|
87
|
+
if (!response.ok) {
|
|
88
|
+
throw new MillionVerifierApiError({
|
|
89
|
+
code: await providerError(response),
|
|
90
|
+
path,
|
|
91
|
+
status: response.status,
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
return response
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Parses a JSON response and rejects MillionVerifier logical errors.
|
|
101
|
+
*
|
|
102
|
+
* The provider returns HTTP 200 for authentication, credit, file, and filter
|
|
103
|
+
* failures, so callers must inspect every JSON body.
|
|
104
|
+
*
|
|
105
|
+
* @param response - Successful transport response.
|
|
106
|
+
* @param path - API path used in a structured failure.
|
|
107
|
+
* @param schema - Expected success payload.
|
|
108
|
+
* @param options - Parsing exceptions for complete resource payloads.
|
|
109
|
+
* @param options.acceptErrorFieldWhenValid - Accepts a schema-valid resource
|
|
110
|
+
* with provider error details.
|
|
111
|
+
*/
|
|
112
|
+
export async function parseMillionVerifierJson<TSchema extends z.ZodType>(
|
|
113
|
+
response: Response,
|
|
114
|
+
path: string,
|
|
115
|
+
schema: TSchema,
|
|
116
|
+
options?: { acceptErrorFieldWhenValid?: boolean },
|
|
117
|
+
): Promise<z.output<TSchema>> {
|
|
118
|
+
const value: unknown = await response.json()
|
|
119
|
+
if (options?.acceptErrorFieldWhenValid) {
|
|
120
|
+
const result = schema.safeParse(value)
|
|
121
|
+
if (result.success) return result.data
|
|
122
|
+
}
|
|
123
|
+
const failure = MILLIONVERIFIER_ERROR_SCHEMA.safeParse(value)
|
|
124
|
+
if (
|
|
125
|
+
failure.success &&
|
|
126
|
+
failure.data.error &&
|
|
127
|
+
failure.data.error.trim().length > 0
|
|
128
|
+
) {
|
|
129
|
+
throw new MillionVerifierApiError({
|
|
130
|
+
code: failure.data.error,
|
|
131
|
+
path,
|
|
132
|
+
status: response.status,
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
return schema.parse(value)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Extracts the most useful provider error from an unsuccessful response.
|
|
140
|
+
*
|
|
141
|
+
* @param response - Provider response to inspect.
|
|
142
|
+
*/
|
|
143
|
+
async function providerError(response: Response) {
|
|
144
|
+
const text = await response.text()
|
|
145
|
+
try {
|
|
146
|
+
const failure = MILLIONVERIFIER_ERROR_SCHEMA.parse(JSON.parse(text))
|
|
147
|
+
return failure.error || failure.result || `HTTP ${response.status}`
|
|
148
|
+
} catch {
|
|
149
|
+
return text.trim() || `HTTP ${response.status}`
|
|
150
|
+
}
|
|
151
|
+
}
|