@corsair-dev/mailsso 0.0.0-stage → 0.1.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/LICENSE +191 -0
- package/README.md +32 -2
- package/dist/api.test.d.ts +2 -0
- package/dist/api.test.d.ts.map +1 -0
- package/dist/client.d.ts +75 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.test.d.ts +2 -0
- package/dist/client.test.d.ts.map +1 -0
- package/dist/endpoints/call.d.ts +19 -0
- package/dist/endpoints/call.d.ts.map +1 -0
- package/dist/endpoints/index.d.ts +4 -0
- package/dist/endpoints/index.d.ts.map +1 -0
- package/dist/endpoints/types.d.ts +247 -0
- package/dist/endpoints/types.d.ts.map +1 -0
- package/dist/endpoints/validations.d.ts +5 -0
- package/dist/endpoints/validations.d.ts.map +1 -0
- package/dist/endpoints.test.d.ts +2 -0
- package/dist/endpoints.test.d.ts.map +1 -0
- package/dist/error-handlers.d.ts +60 -0
- package/dist/error-handlers.d.ts.map +1 -0
- package/dist/error-handlers.test.d.ts +2 -0
- package/dist/error-handlers.test.d.ts.map +1 -0
- package/dist/index.d.ts +132 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/jobs.test.d.ts +2 -0
- package/dist/jobs.test.d.ts.map +1 -0
- package/dist/plugin.test.d.ts +2 -0
- package/dist/plugin.test.d.ts.map +1 -0
- package/dist/requests.test.d.ts +2 -0
- package/dist/requests.test.d.ts.map +1 -0
- package/dist/retry.test.d.ts +2 -0
- package/dist/retry.test.d.ts.map +1 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema.test.d.ts +2 -0
- package/dist/schema.test.d.ts.map +1 -0
- package/dist/test-fixtures.d.ts +199 -0
- package/dist/test-fixtures.d.ts.map +1 -0
- package/dist/test-helpers.d.ts +17 -0
- package/dist/test-helpers.d.ts.map +1 -0
- package/dist/tsup.config.d.ts +3 -0
- package/dist/tsup.config.d.ts.map +1 -0
- package/package.json +50 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(which shall not include Communications that are clearly marked or
|
|
39
|
+
otherwise designated in writing by the copyright owner as "Not a Work").
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution".
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright (c) 2026 Corsair
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @corsair-dev/mailsso
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Mails.so email validation plugin for Corsair: validate one address or a batch, and read a batch job back. The plugin does not handle webhooks, because Mails.so sends none.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @corsair-dev/mailsso
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Endpoints
|
|
12
|
+
|
|
13
|
+
| Operation | Operation ID | Risk | Description |
|
|
14
|
+
|-----------|--------------|------|-------------|
|
|
15
|
+
| `validations.batch` | `mailsso.api.validations.batch` | `write` | Start a batch validation job for at least 2 different email addresses; needs a paid Mails.so plan, and the job cannot be deleted through the API. It returns the job at once with no results: follow it with validations.getBatch until status is completed (it reads processing meanwhile). |
|
|
16
|
+
| `validations.getBatch` | `mailsso.api.validations.getBatch` | `read` | Read a batch validation job by id: status processing while it runs, and once completed the counts per result and the validation of every address |
|
|
17
|
+
| `validations.single` | `mailsso.api.validations.single` | `read` | Validate one email address: deliverability result and reason, a 0-100 score, and format, domain, MX, block-list, catch-all, generic, disposable and free-provider checks |
|
|
18
|
+
|
|
19
|
+
## Auth
|
|
20
|
+
|
|
21
|
+
Auth: API key. Corsair prompts your tenant for credentials on first use.
|
|
22
|
+
|
|
23
|
+
## Webhooks
|
|
24
|
+
|
|
25
|
+
No webhooks.
|
|
26
|
+
|
|
27
|
+
## Reference
|
|
28
|
+
|
|
29
|
+
Full docs, types, and examples: https://docs.corsair.dev/plugins/mailsso
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
Apache-2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.test.d.ts","sourceRoot":"","sources":["../api.test.ts"],"names":[],"mappings":""}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export declare const MAILSSO_API_BASE = "https://api.mails.so";
|
|
2
|
+
/** An untyped response body: each endpoint's zod output schema gives it a shape. */
|
|
3
|
+
export type MailssoBody = unknown;
|
|
4
|
+
/**
|
|
5
|
+
* Mails.so answers failures as `{ data: null, error: '<message>' }`, and the
|
|
6
|
+
* batch routes add `error_code` (for example `BATCH_TOO_SMALL`). A request that
|
|
7
|
+
* succeeds can still carry a non-null `error`, so a 2xx body is checked too.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MailssoAPIError extends Error {
|
|
10
|
+
readonly status?: number;
|
|
11
|
+
/** The provider's `error_code`, when the body carries one. */
|
|
12
|
+
readonly code?: string;
|
|
13
|
+
/** Milliseconds from a Retry-After header, when Mails.so sent one. */
|
|
14
|
+
readonly retryAfter?: number;
|
|
15
|
+
/** The HTTP method of the failed request. */
|
|
16
|
+
readonly method?: string;
|
|
17
|
+
/** True when the request failed before any response arrived. */
|
|
18
|
+
readonly transport: boolean;
|
|
19
|
+
constructor(message: string, options?: {
|
|
20
|
+
cause?: Error;
|
|
21
|
+
status?: number;
|
|
22
|
+
code?: string;
|
|
23
|
+
retryAfter?: number;
|
|
24
|
+
method?: string;
|
|
25
|
+
transport?: boolean;
|
|
26
|
+
});
|
|
27
|
+
/** True for a 429. */
|
|
28
|
+
get isRateLimit(): boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Mails.so documents batch validation as paid-plan only (a free account with
|
|
32
|
+
* credits ran one in our live test). The documented refusal is
|
|
33
|
+
* `Paid subscription required to use list validations`, a 401,
|
|
34
|
+
* so it is told apart from a bad key by its message and never retried.
|
|
35
|
+
*/
|
|
36
|
+
export declare class MailssoSubscriptionRequiredError extends MailssoAPIError {
|
|
37
|
+
constructor(message: string, options?: ConstructorParameters<typeof MailssoAPIError>[1]);
|
|
38
|
+
}
|
|
39
|
+
export type MailssoQuery = Record<string, string | number | boolean | undefined>;
|
|
40
|
+
export type MailssoRequest = {
|
|
41
|
+
method: 'GET' | 'POST';
|
|
42
|
+
path: string;
|
|
43
|
+
query?: MailssoQuery;
|
|
44
|
+
body?: Record<string, string[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Set on the batch status read only: a running job answers 202 with a
|
|
47
|
+
* non-null `error` that is not a failure (see readJobInProgress).
|
|
48
|
+
*/
|
|
49
|
+
allowInProgress?: boolean;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* While a batch job runs, GET /v1/batch/{id} answers HTTP 202 with
|
|
53
|
+
* `{ data: { id, created_at, status: 'processing' }, error: 'Job is still
|
|
54
|
+
* processing' }`. That non-null `error` is a progress note, not a failure.
|
|
55
|
+
*
|
|
56
|
+
* The exception is limited to that exact note: a real failure can also carry
|
|
57
|
+
* `data.id` and `status: 'processing'` (for example an error raised while a job
|
|
58
|
+
* is mid-flight), and treating every message as progress would leave the caller
|
|
59
|
+
* polling a job that has already failed.
|
|
60
|
+
*/
|
|
61
|
+
export declare const JOB_IN_PROGRESS_MESSAGE = "Job is still processing";
|
|
62
|
+
/**
|
|
63
|
+
* Reads the job out of the progress note, or `undefined` when the body is
|
|
64
|
+
* anything else.
|
|
65
|
+
*
|
|
66
|
+
* The note has to match exactly (`JOB_IN_PROGRESS_MESSAGE` *and* a job id
|
|
67
|
+
* *and* `status: 'processing'`): a real failure can carry the same data, and
|
|
68
|
+
* treating it as progress would leave the caller polling a job that has
|
|
69
|
+
* already failed.
|
|
70
|
+
*/
|
|
71
|
+
export declare function readJobInProgress(body: MailssoBody): MailssoBody | undefined;
|
|
72
|
+
/** Encodes one path segment. */
|
|
73
|
+
export declare function segment(value: string | number): string;
|
|
74
|
+
export declare function makeMailssoRequest(apiKey: string, { method, path, query, body, allowInProgress }: MailssoRequest): Promise<MailssoBody>;
|
|
75
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AAevD,oFAAoF;AACpF,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;AAclC;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,6CAA6C;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;gBAG3B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QACR,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,OAAO,CAAC;KACf;IAYP,sBAAsB;IACtB,IAAI,WAAW,IAAI,OAAO,CAEzB;CACD;AAED;;;;;GAKG;AACH,qBAAa,gCAAiC,SAAQ,eAAe;gBAEnE,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,qBAAqB,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAM;CAK/D;AAWD,MAAM,MAAM,YAAY,GAAG,MAAM,CAChC,MAAM,EACN,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CACrC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAChC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAEjE;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,CAQ5E;AAED,gCAAgC;AAChC,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAEtD;AAID,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,MAAM,EACd,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,cAAc,GAC5D,OAAO,CAAC,WAAW,CAAC,CA2DtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.test.d.ts","sourceRoot":"","sources":["../client.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { MailssoContext } from '..';
|
|
3
|
+
import type { MailssoBody, MailssoRequest } from '../client';
|
|
4
|
+
type LogFields = Record<string, string | number | boolean | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Validates the input, sends the request, shapes and validates the response,
|
|
7
|
+
* then logs the event. Inputs are not logged, because they hold email
|
|
8
|
+
* addresses; `log` picks the safe fields.
|
|
9
|
+
*/
|
|
10
|
+
export declare function call<Input extends z.ZodType, Output extends z.ZodType>(ctx: MailssoContext, operation: {
|
|
11
|
+
event: string;
|
|
12
|
+
input: Input;
|
|
13
|
+
output: Output;
|
|
14
|
+
}, rawInput: MailssoBody, toRequest: (parsed: z.output<Input>) => MailssoRequest, options?: {
|
|
15
|
+
shape?: (raw: MailssoBody) => MailssoBody;
|
|
16
|
+
log?: (result: z.output<Output>) => LogFields;
|
|
17
|
+
}): Promise<z.output<Output>>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../endpoints/call.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG7D,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;AAEvE;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM,SAAS,CAAC,CAAC,OAAO,EAC3E,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC1D,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,cAAc,EACtD,OAAO,GAAE;IACR,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,WAAW,CAAC;IAC1C,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;CACzC,GACJ,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAc3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../endpoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const ValidationsSingleInputSchema: z.ZodObject<{
|
|
3
|
+
email: z.ZodString;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export type ValidationsSingleInput = z.input<typeof ValidationsSingleInputSchema>;
|
|
6
|
+
declare const ValidationsBatchInputSchema: z.ZodObject<{
|
|
7
|
+
emails: z.ZodArray<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type ValidationsBatchInput = z.input<typeof ValidationsBatchInputSchema>;
|
|
10
|
+
declare const ValidationsGetBatchInputSchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodGUID;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type ValidationsGetBatchInput = z.input<typeof ValidationsGetBatchInputSchema>;
|
|
14
|
+
/**
|
|
15
|
+
* One validated address. Both validations.single and each entry of a batch's
|
|
16
|
+
* `emails` use it. `result` and `reason` stay plain strings so a value
|
|
17
|
+
* Mails.so adds later does not fail a call that already succeeded; the
|
|
18
|
+
* documented results are deliverable, undeliverable, risky and a fourth for
|
|
19
|
+
* checks that could not finish.
|
|
20
|
+
*/
|
|
21
|
+
export declare const MailssoEmailValidationSchema: z.ZodObject<{
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
email: z.ZodString;
|
|
24
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
did_you_mean: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
|
+
mx_record: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
30
|
+
isv_format: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
31
|
+
isv_domain: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
32
|
+
isv_mx: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
33
|
+
isv_noblock: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
34
|
+
isv_nocatchall: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
35
|
+
isv_nogeneric: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
36
|
+
is_disposable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
37
|
+
is_free: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
38
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
39
|
+
result: z.ZodString;
|
|
40
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
+
}, z.core.$loose>;
|
|
42
|
+
export type MailssoEmailValidation = z.output<typeof MailssoEmailValidationSchema>;
|
|
43
|
+
declare const ValidationsBatchOutputSchema: z.ZodObject<{
|
|
44
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
created_at: z.ZodString;
|
|
48
|
+
updated_at: z.ZodString;
|
|
49
|
+
deleted_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
finished_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
+
archived_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
user_id: z.ZodString;
|
|
53
|
+
size: z.ZodNumber;
|
|
54
|
+
progress: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
|
+
duration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
56
|
+
duplicates: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
57
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
file_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
file_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
+
skip_emails: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
61
|
+
}, z.core.$loose>;
|
|
62
|
+
export type ValidationsBatchResponse = z.output<typeof ValidationsBatchOutputSchema>;
|
|
63
|
+
/**
|
|
64
|
+
* Status values of a batch job, as seen live: `pending` in the answer to the
|
|
65
|
+
* POST, `processing` while the status read reports it running, and `completed`
|
|
66
|
+
* once finished. Mails.so documents no failed status, so the job declaration in
|
|
67
|
+
* index.ts lists none; a stuck job shows as a status that stays running with
|
|
68
|
+
* `finished_at` still null.
|
|
69
|
+
*/
|
|
70
|
+
export declare const BATCH_STATUSES: {
|
|
71
|
+
readonly running: readonly ["pending", "processing"];
|
|
72
|
+
readonly done: readonly ["completed"];
|
|
73
|
+
};
|
|
74
|
+
declare const ValidationsGetBatchOutputSchema: z.ZodObject<{
|
|
75
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
|
+
size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
|
+
status: z.ZodString;
|
|
79
|
+
stats: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNumber>>>;
|
|
80
|
+
emails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
81
|
+
id: z.ZodString;
|
|
82
|
+
email: z.ZodString;
|
|
83
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
84
|
+
domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
85
|
+
did_you_mean: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
86
|
+
mx_record: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
87
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
88
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
89
|
+
isv_format: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
90
|
+
isv_domain: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
91
|
+
isv_mx: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
92
|
+
isv_noblock: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
93
|
+
isv_nocatchall: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
94
|
+
isv_nogeneric: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
95
|
+
is_disposable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
96
|
+
is_free: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
97
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
result: z.ZodString;
|
|
99
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
|
+
}, z.core.$loose>>>>;
|
|
101
|
+
id: z.ZodString;
|
|
102
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
+
created_at: z.ZodString;
|
|
104
|
+
deleted_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
105
|
+
finished_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
|
+
archived_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
107
|
+
progress: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
108
|
+
duration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
109
|
+
duplicates: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
110
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
111
|
+
file_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
112
|
+
file_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
+
skip_emails: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
114
|
+
}, z.core.$loose>;
|
|
115
|
+
export type ValidationsGetBatchResponse = z.output<typeof ValidationsGetBatchOutputSchema>;
|
|
116
|
+
export type ValidationsSingleResponse = MailssoEmailValidation;
|
|
117
|
+
/** The `{ data, error }` envelope Mails.so wraps a single validation in. */
|
|
118
|
+
export declare const MailssoSingleEnvelopeSchema: z.ZodObject<{
|
|
119
|
+
data: z.ZodObject<{
|
|
120
|
+
id: z.ZodString;
|
|
121
|
+
email: z.ZodString;
|
|
122
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
123
|
+
domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
124
|
+
did_you_mean: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
125
|
+
mx_record: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
126
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
127
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
128
|
+
isv_format: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
129
|
+
isv_domain: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
130
|
+
isv_mx: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
131
|
+
isv_noblock: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
132
|
+
isv_nocatchall: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
133
|
+
isv_nogeneric: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
134
|
+
is_disposable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
135
|
+
is_free: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
136
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
137
|
+
result: z.ZodString;
|
|
138
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
139
|
+
}, z.core.$loose>;
|
|
140
|
+
error: z.ZodOptional<z.ZodNull>;
|
|
141
|
+
}, z.core.$loose>;
|
|
142
|
+
export type MailssoEndpointInputs = {
|
|
143
|
+
validationsSingle: ValidationsSingleInput;
|
|
144
|
+
validationsBatch: ValidationsBatchInput;
|
|
145
|
+
validationsGetBatch: ValidationsGetBatchInput;
|
|
146
|
+
};
|
|
147
|
+
export type MailssoEndpointOutputs = {
|
|
148
|
+
validationsSingle: ValidationsSingleResponse;
|
|
149
|
+
validationsBatch: ValidationsBatchResponse;
|
|
150
|
+
validationsGetBatch: ValidationsGetBatchResponse;
|
|
151
|
+
};
|
|
152
|
+
export declare const MailssoEndpointInputSchemas: {
|
|
153
|
+
readonly validationsSingle: z.ZodObject<{
|
|
154
|
+
email: z.ZodString;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
readonly validationsBatch: z.ZodObject<{
|
|
157
|
+
emails: z.ZodArray<z.ZodString>;
|
|
158
|
+
}, z.core.$strip>;
|
|
159
|
+
readonly validationsGetBatch: z.ZodObject<{
|
|
160
|
+
id: z.ZodGUID;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
};
|
|
163
|
+
export declare const MailssoEndpointOutputSchemas: {
|
|
164
|
+
readonly validationsSingle: z.ZodObject<{
|
|
165
|
+
id: z.ZodString;
|
|
166
|
+
email: z.ZodString;
|
|
167
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
168
|
+
domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
169
|
+
did_you_mean: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
170
|
+
mx_record: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
171
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
172
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
173
|
+
isv_format: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
174
|
+
isv_domain: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
175
|
+
isv_mx: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
176
|
+
isv_noblock: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
177
|
+
isv_nocatchall: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
178
|
+
isv_nogeneric: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
179
|
+
is_disposable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
180
|
+
is_free: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
181
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
182
|
+
result: z.ZodString;
|
|
183
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
184
|
+
}, z.core.$loose>;
|
|
185
|
+
readonly validationsBatch: z.ZodObject<{
|
|
186
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
id: z.ZodString;
|
|
188
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
|
+
created_at: z.ZodString;
|
|
190
|
+
updated_at: z.ZodString;
|
|
191
|
+
deleted_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
192
|
+
finished_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
193
|
+
archived_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
194
|
+
user_id: z.ZodString;
|
|
195
|
+
size: z.ZodNumber;
|
|
196
|
+
progress: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
197
|
+
duration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
198
|
+
duplicates: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
199
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
200
|
+
file_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
201
|
+
file_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
202
|
+
skip_emails: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
203
|
+
}, z.core.$loose>;
|
|
204
|
+
readonly validationsGetBatch: z.ZodObject<{
|
|
205
|
+
updated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
206
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
207
|
+
size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
208
|
+
status: z.ZodString;
|
|
209
|
+
stats: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNumber>>>;
|
|
210
|
+
emails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
211
|
+
id: z.ZodString;
|
|
212
|
+
email: z.ZodString;
|
|
213
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
214
|
+
domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
215
|
+
did_you_mean: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
216
|
+
mx_record: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
217
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
218
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
219
|
+
isv_format: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
220
|
+
isv_domain: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
221
|
+
isv_mx: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
222
|
+
isv_noblock: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
223
|
+
isv_nocatchall: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
224
|
+
isv_nogeneric: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
225
|
+
is_disposable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
226
|
+
is_free: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
227
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
228
|
+
result: z.ZodString;
|
|
229
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
230
|
+
}, z.core.$loose>>>>;
|
|
231
|
+
id: z.ZodString;
|
|
232
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
233
|
+
created_at: z.ZodString;
|
|
234
|
+
deleted_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
235
|
+
finished_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
236
|
+
archived_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
237
|
+
progress: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
238
|
+
duration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
239
|
+
duplicates: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
240
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
241
|
+
file_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
242
|
+
file_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
243
|
+
skip_emails: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
244
|
+
}, z.core.$loose>;
|
|
245
|
+
};
|
|
246
|
+
export {};
|
|
247
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../endpoints/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,QAAA,MAAM,4BAA4B;;iBAOhC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,4BAA4B,CACnC,CAAC;AAEF,QAAA,MAAM,2BAA2B;;iBAU/B,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,QAAA,MAAM,8BAA8B;;iBAMlC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,8BAA8B,CACrC,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;iBA0DhC,CAAC;AAEV,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAC5C,OAAO,4BAA4B,CACnC,CAAC;AA6CF,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;iBAQzB,CAAC;AAEV,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAC9C,OAAO,4BAA4B,CACnC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAIX,QAAA,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwB5B,CAAC;AAEV,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CACjD,OAAO,+BAA+B,CACtC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAE/D,4EAA4E;AAC5E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;iBAK/B,CAAC;AAEV,MAAM,MAAM,qBAAqB,GAAG;IACnC,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C,gBAAgB,EAAE,qBAAqB,CAAC;IACxC,mBAAmB,EAAE,wBAAwB,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACpC,iBAAiB,EAAE,yBAAyB,CAAC;IAC7C,gBAAgB,EAAE,wBAAwB,CAAC;IAC3C,mBAAmB,EAAE,2BAA2B,CAAC;CACjD,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;CAI9B,CAAC;AAEX,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAI/B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { MailssoEndpoints } from '..';
|
|
2
|
+
export declare const single: MailssoEndpoints['validationsSingle'];
|
|
3
|
+
export declare const batch: MailssoEndpoints['validationsBatch'];
|
|
4
|
+
export declare const getBatch: MailssoEndpoints['validationsGetBatch'];
|
|
5
|
+
//# sourceMappingURL=validations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validations.d.ts","sourceRoot":"","sources":["../../endpoints/validations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAS3C,eAAO,MAAM,MAAM,EAAE,gBAAgB,CAAC,mBAAmB,CAuBvD,CAAC;AAKH,eAAO,MAAM,KAAK,EAAE,gBAAgB,CAAC,kBAAkB,CAqBrD,CAAC;AAEH,eAAO,MAAM,QAAQ,EAAE,gBAAgB,CAAC,qBAAqB,CAwB3D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints.test.d.ts","sourceRoot":"","sources":["../endpoints.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { CorsairErrorHandler } from 'corsair/core';
|
|
2
|
+
import { MailssoSubscriptionRequiredError } from './client';
|
|
3
|
+
export declare const errorHandlers: {
|
|
4
|
+
SUBSCRIPTION_REQUIRED_ERROR: {
|
|
5
|
+
match: (error: Error) => error is MailssoSubscriptionRequiredError;
|
|
6
|
+
handler: () => Promise<{
|
|
7
|
+
maxRetries: number;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
RATE_LIMIT_ERROR: {
|
|
11
|
+
match: (error: Error) => boolean;
|
|
12
|
+
handler: (error: Error) => Promise<{
|
|
13
|
+
maxRetries: number;
|
|
14
|
+
headersRetryAfterMs: number | undefined;
|
|
15
|
+
retryStrategy: "exponential_backoff";
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
AUTH_ERROR: {
|
|
19
|
+
match: (error: Error) => boolean;
|
|
20
|
+
handler: () => Promise<{
|
|
21
|
+
maxRetries: number;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
VALIDATION_ERROR: {
|
|
25
|
+
match: (error: Error) => boolean;
|
|
26
|
+
handler: () => Promise<{
|
|
27
|
+
maxRetries: number;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
SERVER_ERROR: {
|
|
31
|
+
match: (error: Error) => boolean;
|
|
32
|
+
handler: () => Promise<{
|
|
33
|
+
maxRetries: number;
|
|
34
|
+
retryStrategy: "exponential_backoff";
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
NETWORK_ERROR: {
|
|
38
|
+
match: (error: Error) => boolean;
|
|
39
|
+
handler: () => Promise<{
|
|
40
|
+
maxRetries: number;
|
|
41
|
+
retryStrategy: "exponential_backoff";
|
|
42
|
+
}>;
|
|
43
|
+
};
|
|
44
|
+
DEFAULT: {
|
|
45
|
+
match: () => true;
|
|
46
|
+
handler: () => Promise<{
|
|
47
|
+
maxRetries: number;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Merges a caller's handlers over the builtins, keeping `DEFAULT` last.
|
|
53
|
+
*
|
|
54
|
+
* Core runs the first handler whose `match` passes, in key order, and `DEFAULT`
|
|
55
|
+
* matches everything. Caller keys go first so a handler for a status no builtin
|
|
56
|
+
* covers is reached before `DEFAULT` claims it; a caller `DEFAULT` replaces the
|
|
57
|
+
* builtin one, and the builtin `DEFAULT` is only used when the caller has none.
|
|
58
|
+
*/
|
|
59
|
+
export declare function mergeErrorHandlers(builtin: CorsairErrorHandler, user: CorsairErrorHandler | undefined): CorsairErrorHandler;
|
|
60
|
+
//# sourceMappingURL=error-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handlers.d.ts","sourceRoot":"","sources":["../error-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAmB,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAU7E,eAAO,MAAM,aAAa;;uBAIT,KAAK;;;;;;uBAML,KAAK;yBAEG,KAAK;;;;;;;uBASb,KAAK;;;;;;uBAML,KAAK;;;;;;uBASL,KAAK;;;;;;;uBAYL,KAAK;;;;;;;;;;;;CAaS,CAAC;AAEhC;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,mBAAmB,GAAG,SAAS,GACnC,mBAAmB,CAWrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handlers.test.d.ts","sourceRoot":"","sources":["../error-handlers.test.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { BindEndpoints, CorsairEndpoint, CorsairErrorHandler, CorsairPlugin, CorsairPluginContext, KeyBuilderContext, PickAuth, PluginPermissionsConfig } from 'corsair/core';
|
|
2
|
+
import type { MailssoEndpointInputs, MailssoEndpointOutputs } from './endpoints/types';
|
|
3
|
+
import { MailssoSchema } from './schema';
|
|
4
|
+
export type MailssoPluginOptions = {
|
|
5
|
+
authType?: PickAuth<'api_key'>;
|
|
6
|
+
key?: string;
|
|
7
|
+
hooks?: InternalMailssoPlugin['hooks'];
|
|
8
|
+
errorHandlers?: CorsairErrorHandler;
|
|
9
|
+
permissions?: PluginPermissionsConfig<typeof mailssoEndpointsNested>;
|
|
10
|
+
};
|
|
11
|
+
export type MailssoContext = CorsairPluginContext<typeof MailssoSchema, MailssoPluginOptions>;
|
|
12
|
+
export type MailssoKeyBuilderContext = KeyBuilderContext<MailssoPluginOptions>;
|
|
13
|
+
export type MailssoBoundEndpoints = BindEndpoints<typeof mailssoEndpointsNested>;
|
|
14
|
+
type MailssoEndpoint<K extends keyof MailssoEndpointOutputs> = CorsairEndpoint<MailssoContext, MailssoEndpointInputs[K], MailssoEndpointOutputs[K]>;
|
|
15
|
+
export type MailssoEndpoints = {
|
|
16
|
+
validationsSingle: MailssoEndpoint<'validationsSingle'>;
|
|
17
|
+
validationsBatch: MailssoEndpoint<'validationsBatch'>;
|
|
18
|
+
validationsGetBatch: MailssoEndpoint<'validationsGetBatch'>;
|
|
19
|
+
};
|
|
20
|
+
declare const mailssoEndpointsNested: {
|
|
21
|
+
readonly validations: {
|
|
22
|
+
readonly single: MailssoEndpoint<"validationsSingle">;
|
|
23
|
+
readonly batch: MailssoEndpoint<"validationsBatch">;
|
|
24
|
+
readonly getBatch: MailssoEndpoint<"validationsGetBatch">;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const mailssoEndpointSchemas: {
|
|
28
|
+
readonly 'validations.single': {
|
|
29
|
+
readonly input: import("zod").ZodObject<{
|
|
30
|
+
email: import("zod").ZodString;
|
|
31
|
+
}, import("zod/v4/core").$strip>;
|
|
32
|
+
readonly output: import("zod").ZodObject<{
|
|
33
|
+
id: import("zod").ZodString;
|
|
34
|
+
email: import("zod").ZodString;
|
|
35
|
+
username: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
36
|
+
domain: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
37
|
+
did_you_mean: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
38
|
+
mx_record: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
39
|
+
provider: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
40
|
+
score: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
41
|
+
isv_format: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
42
|
+
isv_domain: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
43
|
+
isv_mx: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
44
|
+
isv_noblock: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
45
|
+
isv_nocatchall: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
46
|
+
isv_nogeneric: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
47
|
+
is_disposable: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
48
|
+
is_free: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
49
|
+
avatar: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
50
|
+
result: import("zod").ZodString;
|
|
51
|
+
reason: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
52
|
+
}, import("zod/v4/core").$loose>;
|
|
53
|
+
};
|
|
54
|
+
readonly 'validations.batch': {
|
|
55
|
+
readonly input: import("zod").ZodObject<{
|
|
56
|
+
emails: import("zod").ZodArray<import("zod").ZodString>;
|
|
57
|
+
}, import("zod/v4/core").$strip>;
|
|
58
|
+
readonly output: import("zod").ZodObject<{
|
|
59
|
+
status: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
60
|
+
id: import("zod").ZodString;
|
|
61
|
+
name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
62
|
+
created_at: import("zod").ZodString;
|
|
63
|
+
updated_at: import("zod").ZodString;
|
|
64
|
+
deleted_at: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
65
|
+
finished_at: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
66
|
+
archived_at: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
67
|
+
user_id: import("zod").ZodString;
|
|
68
|
+
size: import("zod").ZodNumber;
|
|
69
|
+
progress: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
70
|
+
duration: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
71
|
+
duplicates: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
72
|
+
type: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
73
|
+
file_type: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
74
|
+
file_key: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
75
|
+
skip_emails: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
76
|
+
}, import("zod/v4/core").$loose>;
|
|
77
|
+
};
|
|
78
|
+
readonly 'validations.getBatch': {
|
|
79
|
+
readonly input: import("zod").ZodObject<{
|
|
80
|
+
id: import("zod").ZodGUID;
|
|
81
|
+
}, import("zod/v4/core").$strip>;
|
|
82
|
+
readonly output: import("zod").ZodObject<{
|
|
83
|
+
updated_at: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
84
|
+
user_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
85
|
+
size: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
86
|
+
status: import("zod").ZodString;
|
|
87
|
+
stats: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodNumber>>>;
|
|
88
|
+
emails: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodArray<import("zod").ZodObject<{
|
|
89
|
+
id: import("zod").ZodString;
|
|
90
|
+
email: import("zod").ZodString;
|
|
91
|
+
username: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
92
|
+
domain: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
93
|
+
did_you_mean: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
94
|
+
mx_record: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
95
|
+
provider: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
96
|
+
score: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
97
|
+
isv_format: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
98
|
+
isv_domain: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
99
|
+
isv_mx: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
100
|
+
isv_noblock: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
101
|
+
isv_nocatchall: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
102
|
+
isv_nogeneric: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
103
|
+
is_disposable: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
104
|
+
is_free: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
105
|
+
avatar: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
106
|
+
result: import("zod").ZodString;
|
|
107
|
+
reason: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
108
|
+
}, import("zod/v4/core").$loose>>>>;
|
|
109
|
+
id: import("zod").ZodString;
|
|
110
|
+
name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
111
|
+
created_at: import("zod").ZodString;
|
|
112
|
+
deleted_at: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
113
|
+
finished_at: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
114
|
+
archived_at: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
115
|
+
progress: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
116
|
+
duration: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
117
|
+
duplicates: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
|
|
118
|
+
type: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
119
|
+
file_type: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
120
|
+
file_key: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
121
|
+
skip_emails: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
122
|
+
}, import("zod/v4/core").$loose>;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
declare const defaultAuthType: "api_key";
|
|
126
|
+
export type BaseMailssoPlugin<T extends MailssoPluginOptions> = CorsairPlugin<'mailsso', typeof MailssoSchema, typeof mailssoEndpointsNested, {}, T, typeof defaultAuthType>;
|
|
127
|
+
export type InternalMailssoPlugin = BaseMailssoPlugin<MailssoPluginOptions>;
|
|
128
|
+
export type ExternalMailssoPlugin<T extends MailssoPluginOptions> = BaseMailssoPlugin<T>;
|
|
129
|
+
export declare function mailsso<const T extends MailssoPluginOptions>(incomingOptions?: MailssoPluginOptions & T): ExternalMailssoPlugin<T>;
|
|
130
|
+
export { MailssoAPIError, MailssoSubscriptionRequiredError, } from './client';
|
|
131
|
+
export type { MailssoEmailValidation, MailssoEndpointInputs, MailssoEndpointOutputs, ValidationsBatchInput, ValidationsBatchResponse, ValidationsGetBatchInput, ValidationsGetBatchResponse, ValidationsSingleInput, ValidationsSingleResponse, } from './endpoints/types';
|
|
132
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,QAAQ,EACR,uBAAuB,EAGvB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EACX,qBAAqB,EACrB,sBAAsB,EACtB,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,MAAM,oBAAoB,GAAG;IAClC,QAAQ,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACvC,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,WAAW,CAAC,EAAE,uBAAuB,CAAC,OAAO,sBAAsB,CAAC,CAAC;CACrE,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAChD,OAAO,aAAa,EACpB,oBAAoB,CACpB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;AAE/E,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAChD,OAAO,sBAAsB,CAC7B,CAAC;AAEF,KAAK,eAAe,CAAC,CAAC,SAAS,MAAM,sBAAsB,IAAI,eAAe,CAC7E,cAAc,EACd,qBAAqB,CAAC,CAAC,CAAC,EACxB,sBAAsB,CAAC,CAAC,CAAC,CACzB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC9B,iBAAiB,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAC;IACxD,gBAAgB,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;IACtD,mBAAmB,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;CAC5D,CAAC;AAEF,QAAA,MAAM,sBAAsB;;;;;;CAMlB,CAAC;AAEX,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAelC,CAAC;AAEF,QAAA,MAAM,eAAe,EAAG,SAAkB,CAAC;AAqC3C,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,oBAAoB,IAAI,aAAa,CAC5E,SAAS,EACT,OAAO,aAAa,EACpB,OAAO,sBAAsB,EAC7B,EAAE,EACF,CAAC,EACD,OAAO,eAAe,CACtB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;AAE5E,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,oBAAoB,IAC/D,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAEtB,wBAAgB,OAAO,CAAC,KAAK,CAAC,CAAC,SAAS,oBAAoB,EAC3D,eAAe,GAAE,oBAAoB,GAAG,CAAkC,GACxE,qBAAqB,CAAC,CAAC,CAAC,CA6B1B;AAED,OAAO,EACN,eAAe,EACf,gCAAgC,GAChC,MAAM,UAAU,CAAC;AAElB,YAAY,EACX,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,2BAA2B,EAC3B,sBAAsB,EACtB,yBAAyB,GACzB,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var k=Object.defineProperty;var C=(e,i)=>{for(var s in i)k(e,s,{get:i[s],enumerable:!0})};import{AuthMissingError as $}from"corsair/core";var m={};C(m,{batch:()=>W,getBatch:()=>J,single:()=>K});import{asRecord as M}from"corsair/core";import{ApiError as B,request as V}from"corsair/http";var j="https://api.mails.so",G={maxRetries:0,enabled:!0,initialRetryDelay:1e3,backoffMultiplier:2,headerNames:{retryAfter:"retry-after"}},H=/paid subscription/i;function g(e,i){let s=M(e)?.[i];return typeof s=="string"&&s.length>0?s:void 0}var n=class extends Error{status;code;retryAfter;method;transport;constructor(i,s={}){super(i,s.cause?{cause:s.cause}:void 0),this.name="MailssoAPIError";let a=s.cause instanceof B?s.cause:void 0;this.status=s.status??a?.status,this.code=s.code??g(a?.body,"error_code"),this.retryAfter=s.retryAfter??a?.retryAfter,this.method=s.method??a?.request.method,this.transport=s.transport??!1}get isRateLimit(){return this.status===429}},h=class extends n{constructor(i,s={}){super(i,s),this.name="MailssoSubscriptionRequiredError"}};function x(e,i){return H.test(e)?new h(e,i):new n(e,i)}var L="Job is still processing";function v(e){let i=M(e),s=M(i?.data);if(g(i,"error")===L)return typeof s?.id=="string"&&s.status==="processing"?s:void 0}function R(e){return encodeURIComponent(String(e))}async function I(e,{method:i,path:s,query:a,body:o,allowInProgress:f}){let r={BASE:j,VERSION:"1.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",HEADERS:{Accept:"application/json","x-mails-api-key":e}},u={method:i,url:s,query:a,body:o,mediaType:o===void 0?void 0:"application/json"},d;try{d=await V(r,u,{rateLimitConfig:G})}catch(l){throw l instanceof B?x(g(l.body,"error")??`Mails.so ${l.status}: ${l.message}`,{cause:l}):l instanceof Error||l instanceof DOMException?new n(l.message,{cause:l,method:i,transport:!0}):new n("Unknown Mails.so error",{method:i,transport:!0})}let y=g(d,"error");if(y!==void 0&&!(f&&v(d)!==void 0))throw x(y,{status:200,method:i,code:g(d,"error_code")});return d}import{logEventFromContext as N}from"corsair/core";async function E(e,i,s,a,o={}){let f=i.input.parse(s),r=await I(e.key,a(f)),u=i.output.parse(o.shape?o.shape(r):r);return await N(e,`mailsso.${i.event}`,o.log?.(u)??{},"completed"),u}import{z as t}from"zod";var q=t.object({email:t.string().min(1).describe("The email address to validate. A malformed address is not an error: Mails.so answers it as undeliverable with reason invalid_format.")}),z=t.object({emails:t.array(t.string().min(1)).min(2).refine(e=>new Set(e).size>=2,{message:"A batch needs at least 2 different emails"}).describe("The addresses to validate. Mails.so refuses a batch with fewer than 2 different addresses (use validations.single for one).")}),D=t.object({id:t.guid().describe("The batch job id returned by validations.batch, for example 3aace594-f454-42e4-9cb3-198b6253320c.")}),S=t.object({id:t.string().describe("Id of the validation"),email:t.string().describe("The address that was validated"),username:t.string().nullish().describe("The part of the address before the @"),domain:t.string().nullish().describe("The part of the address after the @"),did_you_mean:t.string().nullish().describe("A suggested correction when the domain looks misspelled"),mx_record:t.string().nullish().describe("Mail server of the domain"),provider:t.string().nullish().describe("Mailbox provider, for example google_workspace"),score:t.number().nullish().describe("Overall validity score, 0 to 100"),isv_format:t.boolean().nullish().describe("The format is valid"),isv_domain:t.boolean().nullish().describe("The domain is valid"),isv_mx:t.boolean().nullish().describe("The MX record is valid; null when it was not checked"),isv_noblock:t.boolean().nullish().describe("Not on a block list"),isv_nocatchall:t.boolean().nullish().describe("The domain does not accept every address (not catch-all)"),isv_nogeneric:t.boolean().nullish().describe("Not a generic role address such as info@ or admin@"),is_disposable:t.boolean().nullish().describe("The address belongs to a disposable email service"),is_free:t.boolean().nullish().describe("The address belongs to a free email provider"),avatar:t.string().nullish().describe("Avatar URL, when one was found"),result:t.string().describe("Overall verdict: deliverable, undeliverable, risky, or a fourth value for checks that could not finish"),reason:t.string().nullish().describe("Why Mails.so reached that verdict, for example accepted_email, invalid_domain, invalid_format or catch_all")}).loose(),b={id:t.string().describe("Id of the batch job"),name:t.string().nullish().describe("Name of the batch job, often empty"),created_at:t.string().describe("When the job was created, ISO 8601"),updated_at:t.string().describe("When the job last changed, ISO 8601"),deleted_at:t.string().nullish().describe("When the job was deleted, if it was"),finished_at:t.string().nullish().describe("When the job finished; null while it is still running"),archived_at:t.string().nullish().describe("When the job was archived, if it was"),user_id:t.string().describe("Id of the account that started the job"),size:t.number().describe("Number of addresses in the batch"),progress:t.number().nullish().describe("Progress counter reported by Mails.so"),duration:t.number().nullish().describe("How long the job took"),duplicates:t.number().nullish().describe("Number of duplicate addresses"),type:t.string().nullish().describe("Kind of job; list for a batch"),file_type:t.string().nullish().describe("Set by Mails.so; empty on batches started with this plugin"),file_key:t.string().nullish().describe("Set by Mails.so; empty on batches started with this plugin"),skip_emails:t.boolean().nullish().describe("Set by Mails.so; true on batches started with this plugin")},U=t.object({...b,status:t.string().nullish().describe("Job status; pending right after the job is created")}).loose(),_={running:["pending","processing"],done:["completed"]},F=t.object({...b,updated_at:b.updated_at.nullish(),user_id:b.user_id.nullish(),size:b.size.nullish(),status:t.string().describe("Job status: processing while running, completed when finished"),stats:t.record(t.string(),t.number()).nullish().describe("Counts for a finished job: the total, one per verdict, and one per reason"),emails:t.array(S).nullish().describe("One validation result per address; present on completed jobs, so treat it as absent while the job is processing")}).loose(),T=t.object({data:S,error:t.null().optional()}).loose(),c={validationsSingle:q,validationsBatch:z,validationsGetBatch:D},p={validationsSingle:S,validationsBatch:U,validationsGetBatch:F};var K=(e,i)=>E(e,{event:"validations.single",input:c.validationsSingle,output:p.validationsSingle},i,({email:s})=>({method:"GET",path:"/v1/validate",query:{email:s}}),{shape:s=>T.parse(s).data,log:({result:s,reason:a,score:o})=>({result:s,reason:a??void 0,score:o??void 0})}),W=(e,i)=>E(e,{event:"validations.batch",input:c.validationsBatch,output:p.validationsBatch},i,({emails:s})=>({method:"POST",path:"/v1/batch",body:{emails:s}}),{log:({id:s,size:a,status:o})=>({batchId:s,size:a,status:o??void 0})}),J=(e,i)=>E(e,{event:"validations.getBatch",input:c.validationsGetBatch,output:p.validationsGetBatch},i,({id:s})=>({method:"GET",path:`/v1/batch/${R(s)}`,allowInProgress:!0}),{shape:s=>v(s)??s,log:({id:s,status:a,size:o})=>({batchId:s,status:a,size:o??void 0})});function O(e){return e instanceof n?e.status:void 0}var P={SUBSCRIPTION_REQUIRED_ERROR:{match:e=>e instanceof h,handler:async()=>({maxRetries:0})},RATE_LIMIT_ERROR:{match:e=>e instanceof n&&e.isRateLimit,handler:async e=>({maxRetries:3,headersRetryAfterMs:e instanceof n?e.retryAfter:void 0,retryStrategy:"exponential_backoff"})},AUTH_ERROR:{match:e=>O(e)===401,handler:async()=>({maxRetries:0})},VALIDATION_ERROR:{match:e=>{let i=O(e);return e.name==="ZodError"||i===400||i===404},handler:async()=>({maxRetries:0})},SERVER_ERROR:{match:e=>e instanceof n&&e.method==="GET"&&(e.status??0)>=500,handler:async()=>({maxRetries:2,retryStrategy:"exponential_backoff"})},NETWORK_ERROR:{match:e=>e instanceof n&&e.transport&&e.method==="GET",handler:async()=>({maxRetries:2,retryStrategy:"exponential_backoff"})},DEFAULT:{match:()=>!0,handler:async()=>({maxRetries:0})}};function A(e,i){if(!i)return e;let{DEFAULT:s,...a}=i,{DEFAULT:o,...f}=e,r={...a};for(let[d,y]of Object.entries(f))d in r||(r[d]=y);let u=s??o;return u&&(r.DEFAULT=u),r}var w={version:"1.0.0",entities:{}};var Q={validations:{single:m.single,batch:m.batch,getBatch:m.getBatch}},Z={"validations.single":{input:c.validationsSingle,output:p.validationsSingle},"validations.batch":{input:c.validationsBatch,output:p.validationsBatch},"validations.getBatch":{input:c.validationsGetBatch,output:p.validationsGetBatch}},X="api_key",Y={idPath:"id",status:{op:"validations.getBatch",idArg:"id",statusPath:"status",done:_.done,failed:[]}},ee={"validations.single":{riskLevel:"read",description:"Validate one email address: deliverability result and reason, a 0-100 score, and format, domain, MX, block-list, catch-all, generic, disposable and free-provider checks"},"validations.batch":{riskLevel:"write",description:"Start a batch validation job for at least 2 different email addresses; Mails.so documents it as paid-plan only, but a free account with credits ran batches in our test, and an account without access gets MailssoSubscriptionRequiredError. The job cannot be deleted through the API. It returns the job at once with no results: follow it with validations.getBatch until status is completed (it reads processing meanwhile).",job:Y},"validations.getBatch":{riskLevel:"read",description:"Read a batch validation job by id: status processing while it runs, and once completed the counts per result and the validation of every address"}};function xe(e={}){let i={...e,authType:e.authType??X};return{id:"mailsso",schema:w,options:i,hooks:i.hooks,endpoints:Q,webhooks:{},endpointMeta:ee,endpointSchemas:Z,pluginWebhookMatcher:()=>!1,errorHandlers:A(P,i.errorHandlers),keyBuilder:async(s,a)=>{if(a==="endpoint"&&i.key)return i.key;if(a==="endpoint"&&s.authType==="api_key"){let o=await s.keys.get_api_key();if(o)return o}throw new $("mailsso",s.authType??"api_key")}}}export{n as MailssoAPIError,h as MailssoSubscriptionRequiredError,xe as mailsso,Z as mailssoEndpointSchemas};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.test.d.ts","sourceRoot":"","sources":["../jobs.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.test.d.ts","sourceRoot":"","sources":["../plugin.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requests.test.d.ts","sourceRoot":"","sources":["../requests.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.test.d.ts","sourceRoot":"","sources":["../retry.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../schema/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;CAGhB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../schema.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/** GET /v1/validate?email=test@example.com */
|
|
2
|
+
export declare const singleUndeliverableFixture: {
|
|
3
|
+
data: {
|
|
4
|
+
id: string;
|
|
5
|
+
email: string;
|
|
6
|
+
username: string;
|
|
7
|
+
domain: string;
|
|
8
|
+
did_you_mean: null;
|
|
9
|
+
mx_record: null;
|
|
10
|
+
provider: null;
|
|
11
|
+
score: number;
|
|
12
|
+
isv_format: boolean;
|
|
13
|
+
isv_domain: boolean;
|
|
14
|
+
isv_mx: boolean;
|
|
15
|
+
isv_noblock: boolean;
|
|
16
|
+
isv_nocatchall: boolean;
|
|
17
|
+
isv_nogeneric: boolean;
|
|
18
|
+
is_disposable: boolean;
|
|
19
|
+
is_free: boolean;
|
|
20
|
+
avatar: null;
|
|
21
|
+
result: string;
|
|
22
|
+
reason: string;
|
|
23
|
+
};
|
|
24
|
+
error: null;
|
|
25
|
+
};
|
|
26
|
+
/** GET /v1/validate?email=hello@mails.so */
|
|
27
|
+
export declare const singleRiskyFixture: {
|
|
28
|
+
data: {
|
|
29
|
+
id: string;
|
|
30
|
+
email: string;
|
|
31
|
+
username: string;
|
|
32
|
+
domain: string;
|
|
33
|
+
did_you_mean: string;
|
|
34
|
+
mx_record: string;
|
|
35
|
+
provider: string;
|
|
36
|
+
score: number;
|
|
37
|
+
isv_format: boolean;
|
|
38
|
+
isv_domain: boolean;
|
|
39
|
+
isv_mx: boolean;
|
|
40
|
+
isv_noblock: boolean;
|
|
41
|
+
isv_nocatchall: boolean;
|
|
42
|
+
isv_nogeneric: boolean;
|
|
43
|
+
is_disposable: boolean;
|
|
44
|
+
is_free: boolean;
|
|
45
|
+
avatar: null;
|
|
46
|
+
result: string;
|
|
47
|
+
reason: string;
|
|
48
|
+
};
|
|
49
|
+
error: null;
|
|
50
|
+
};
|
|
51
|
+
/** GET /v1/validate?email=notanemail: 200, not an error. */
|
|
52
|
+
export declare const singleInvalidFormatFixture: {
|
|
53
|
+
data: {
|
|
54
|
+
id: string;
|
|
55
|
+
email: string;
|
|
56
|
+
username: null;
|
|
57
|
+
domain: null;
|
|
58
|
+
did_you_mean: null;
|
|
59
|
+
mx_record: null;
|
|
60
|
+
provider: null;
|
|
61
|
+
score: number;
|
|
62
|
+
isv_format: boolean;
|
|
63
|
+
isv_domain: boolean;
|
|
64
|
+
isv_mx: boolean;
|
|
65
|
+
isv_noblock: boolean;
|
|
66
|
+
isv_nocatchall: boolean;
|
|
67
|
+
isv_nogeneric: boolean;
|
|
68
|
+
is_disposable: boolean;
|
|
69
|
+
is_free: boolean;
|
|
70
|
+
avatar: null;
|
|
71
|
+
result: string;
|
|
72
|
+
reason: string;
|
|
73
|
+
};
|
|
74
|
+
error: null;
|
|
75
|
+
};
|
|
76
|
+
export declare const batchJobId = "d50cc2f6-2c0a-4742-a0fa-f764240d5f77";
|
|
77
|
+
/** POST /v1/batch with two emails: a bare job object, no envelope. */
|
|
78
|
+
export declare const batchCreatedFixture: {
|
|
79
|
+
id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
created_at: string;
|
|
82
|
+
updated_at: string;
|
|
83
|
+
deleted_at: null;
|
|
84
|
+
finished_at: null;
|
|
85
|
+
archived_at: null;
|
|
86
|
+
user: null;
|
|
87
|
+
user_id: string;
|
|
88
|
+
size: number;
|
|
89
|
+
progress: number;
|
|
90
|
+
status: string;
|
|
91
|
+
duration: null;
|
|
92
|
+
duplicates: number;
|
|
93
|
+
type: string;
|
|
94
|
+
file_type: string;
|
|
95
|
+
file_key: string;
|
|
96
|
+
skip_emails: boolean;
|
|
97
|
+
};
|
|
98
|
+
/** GET /v1/batch/{id} a second after the POST above. */
|
|
99
|
+
export declare const batchCompletedFixture: {
|
|
100
|
+
id: string;
|
|
101
|
+
name: string;
|
|
102
|
+
created_at: string;
|
|
103
|
+
updated_at: string;
|
|
104
|
+
deleted_at: null;
|
|
105
|
+
finished_at: string;
|
|
106
|
+
archived_at: null;
|
|
107
|
+
user: null;
|
|
108
|
+
user_id: string;
|
|
109
|
+
size: number;
|
|
110
|
+
progress: number;
|
|
111
|
+
status: string;
|
|
112
|
+
duration: number;
|
|
113
|
+
duplicates: number;
|
|
114
|
+
type: string;
|
|
115
|
+
file_type: string;
|
|
116
|
+
file_key: string;
|
|
117
|
+
skip_emails: boolean;
|
|
118
|
+
stats: {
|
|
119
|
+
total: number;
|
|
120
|
+
deliverable: number;
|
|
121
|
+
undeliverable: number;
|
|
122
|
+
risky: number;
|
|
123
|
+
unknown: number;
|
|
124
|
+
invalid_format: number;
|
|
125
|
+
invalid_domain: number;
|
|
126
|
+
invalid_smtp: number;
|
|
127
|
+
rejected_email: number;
|
|
128
|
+
catch_all: number;
|
|
129
|
+
disposable: number;
|
|
130
|
+
timeout: number;
|
|
131
|
+
no_connect: number;
|
|
132
|
+
other: number;
|
|
133
|
+
};
|
|
134
|
+
emails: {
|
|
135
|
+
id: string;
|
|
136
|
+
email: string;
|
|
137
|
+
username: string;
|
|
138
|
+
domain: string;
|
|
139
|
+
did_you_mean: null;
|
|
140
|
+
mx_record: null;
|
|
141
|
+
provider: null;
|
|
142
|
+
score: number;
|
|
143
|
+
isv_format: boolean;
|
|
144
|
+
isv_domain: boolean;
|
|
145
|
+
isv_mx: boolean;
|
|
146
|
+
isv_noblock: boolean;
|
|
147
|
+
isv_nocatchall: boolean;
|
|
148
|
+
isv_nogeneric: boolean;
|
|
149
|
+
is_disposable: boolean;
|
|
150
|
+
is_free: boolean;
|
|
151
|
+
avatar: null;
|
|
152
|
+
result: string;
|
|
153
|
+
reason: string;
|
|
154
|
+
}[];
|
|
155
|
+
};
|
|
156
|
+
/** 401 on GET /v1/validate, with a missing or wrong key. */
|
|
157
|
+
export declare const unauthorizedBody: {
|
|
158
|
+
data: null;
|
|
159
|
+
error: string;
|
|
160
|
+
};
|
|
161
|
+
/** 400 on POST /v1/batch with one email, or the same email twice. */
|
|
162
|
+
export declare const batchTooSmallBody: {
|
|
163
|
+
data: null;
|
|
164
|
+
error: string;
|
|
165
|
+
error_code: string;
|
|
166
|
+
};
|
|
167
|
+
/** 400 on POST /v1/batch with `emails` that is not an array. */
|
|
168
|
+
export declare const invalidBodyBody: {
|
|
169
|
+
data: null;
|
|
170
|
+
error: string;
|
|
171
|
+
};
|
|
172
|
+
/** 404 on GET /v1/batch/{id} for an id that is a UUID but not a job. */
|
|
173
|
+
export declare const jobMissingBody: {
|
|
174
|
+
data: null;
|
|
175
|
+
error: string;
|
|
176
|
+
};
|
|
177
|
+
/** 400 on GET /v1/batch/{id} for an id that is not a UUID. */
|
|
178
|
+
export declare const invalidJobIdBody: {
|
|
179
|
+
data: null;
|
|
180
|
+
error: string;
|
|
181
|
+
};
|
|
182
|
+
/** The plan error the docs show on POST /v1/batch for a free key. */
|
|
183
|
+
export declare const subscriptionRequiredBody: {
|
|
184
|
+
data: null;
|
|
185
|
+
error: string;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* GET /v1/batch/{id} while the job runs: HTTP 202, and a non-null `error` that
|
|
189
|
+
* is a progress note, not a failure. The docs do not mention it.
|
|
190
|
+
*/
|
|
191
|
+
export declare const batchProcessingFixture: {
|
|
192
|
+
data: {
|
|
193
|
+
created_at: string;
|
|
194
|
+
id: string;
|
|
195
|
+
status: string;
|
|
196
|
+
};
|
|
197
|
+
error: string;
|
|
198
|
+
};
|
|
199
|
+
//# sourceMappingURL=test-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-fixtures.d.ts","sourceRoot":"","sources":["../test-fixtures.ts"],"names":[],"mappings":"AAKA,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;CAuBtC,CAAC;AAEF,4CAA4C;AAC5C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;CAuB9B,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;CAuBtC,CAAC;AAEF,eAAO,MAAM,UAAU,yCAAyC,CAAC;AAEjE,sEAAsE;AACtE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;CAmB/B,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+EjC,CAAC;AAIF,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB;;;CAAwC,CAAC;AAEtE,qEAAqE;AACrE,eAAO,MAAM,iBAAiB;;;;CAK7B,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,eAAe;;;CAG3B,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,cAAc;;;CAAkD,CAAC;AAE9E,8DAA8D;AAC9D,eAAO,MAAM,gBAAgB;;;CAA0C,CAAC;AAExE,qEAAqE;AACrE,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MailssoContext } from './index';
|
|
2
|
+
export declare const API_KEY = "mails-secret-test-key";
|
|
3
|
+
/** Any JSON value, so a test body needs no loose type. */
|
|
4
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
5
|
+
[key: string]: JsonValue;
|
|
6
|
+
};
|
|
7
|
+
export declare function jsonResponse(body: JsonValue, status?: number, headers?: Record<string, string>): Response;
|
|
8
|
+
/** What a rejected promise carries. */
|
|
9
|
+
export type Caught = unknown;
|
|
10
|
+
export declare function captureError<T>(promise: Promise<T>): Promise<Caught>;
|
|
11
|
+
/**
|
|
12
|
+
* A context with the two members the endpoints read: `key`, and
|
|
13
|
+
* `$getAccountId` for the event log (the log writer tolerates a missing
|
|
14
|
+
* database). retry.test.ts runs the same endpoints through createCorsair.
|
|
15
|
+
*/
|
|
16
|
+
export declare function makeContext(key?: string): MailssoContext;
|
|
17
|
+
//# sourceMappingURL=test-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../test-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,OAAO,0BAA0B,CAAC;AAE/C,0DAA0D;AAC1D,MAAM,MAAM,SAAS,GAClB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEhC,wBAAgB,YAAY,CAC3B,IAAI,EAAE,SAAS,EACf,MAAM,SAAM,EACZ,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAClC,QAAQ,CAKV;AAED,uCAAuC;AACvC,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC;AAE7B,wBAAsB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAK1E;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,SAAU,GAAG,cAAc,CAMzD"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: import("tsup").Options | import("tsup").Options[] | ((overrideOptions: import("tsup").Options) => import("tsup").Options | import("tsup").Options[] | Promise<import("tsup").Options | import("tsup").Options[]>);
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=tsup.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsup.config.d.ts","sourceRoot":"","sources":["../tsup.config.ts"],"names":[],"mappings":";AAEA,wBAYG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corsair-dev/mailsso",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Mails.so email validation plugin for Corsair: validate one address or a batch, and read a batch job back. The plugin does not handle webhooks, because Mails.so sends none.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"dev-source": "./index.ts",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"corsair": ">=0.1.158",
|
|
18
|
+
"zod": "^4.1.13"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/jest": "^29.5.14",
|
|
22
|
+
"jest": "^29.7.0",
|
|
23
|
+
"ts-jest": "^29.4.9",
|
|
24
|
+
"tsup": "^8.0.1",
|
|
25
|
+
"typescript": "^5.9.3",
|
|
26
|
+
"zod": "^4.1.13",
|
|
27
|
+
"corsair": "0.1.169"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"corsair",
|
|
31
|
+
"mailsso",
|
|
32
|
+
"mails.so",
|
|
33
|
+
"email validation",
|
|
34
|
+
"plugin"
|
|
35
|
+
],
|
|
36
|
+
"author": "Corsair (https://corsair.dev)",
|
|
37
|
+
"license": "Apache-2.0",
|
|
38
|
+
"files": [
|
|
39
|
+
"dist"
|
|
40
|
+
],
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/corsairdev/corsair.git",
|
|
44
|
+
"directory": "packages/mailsso"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://docs.corsair.dev/plugins/mailsso",
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "rm -rf dist && tsc --build --force && tsup",
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"test": "jest",
|
|
51
|
+
"test:live": "jest --testPathIgnorePatterns=/node_modules/ --testPathPattern=api\\.test\\.ts"
|
|
52
|
+
}
|
|
6
53
|
}
|