@emailsherlock/node 0.2.1 → 0.3.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.
@@ -0,0 +1,181 @@
1
+ /**
2
+ * EmailSherlock API
3
+ * Verify one email address or a batch over HTTPS with an API key. Authenticate with the X-API-Key header. Billing is user-level credits; each call returns the remaining balance in the X-Credits-Remaining header. Sandbox: a key that starts with es_test_ runs in sandbox mode. It returns deterministic fixtured data on the same endpoints and response shape, never spends credits, and marks every response with X-Sandbox: true. The local part drives the verdict so you can test each branch: valid@, invalid@, catch-all@, disposable@, role@, unknown@ and pending@ pin a result (pending@ yields reason verification_pending, the deferred-batch outcome to retry later); ratelimit@ returns 429 and servererror@ returns 503 so you can exercise error handling. On the async jobs endpoint (POST /v1/verify/jobs), put async@ or slowjob@ in the batch and the sandbox reproduces the real submit-poll-complete lifecycle: the submit returns processing and the job completes after a few seconds, so you can build and test your polling loop before going live; without it, sandbox jobs complete immediately. Any other address maps to a stable result. Live keys start with es_live_. Full reference at https://emailsherlock.com/api/docs
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ export declare const BASE_PATH: string;
13
+ export interface ConfigurationParameters {
14
+ basePath?: string;
15
+ fetchApi?: FetchAPI;
16
+ middleware?: Middleware[];
17
+ queryParamsStringify?: (params: HTTPQuery) => string;
18
+ username?: string;
19
+ password?: string;
20
+ apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>);
21
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>);
22
+ headers?: HTTPHeaders;
23
+ credentials?: RequestCredentials;
24
+ }
25
+ export declare class Configuration {
26
+ private configuration;
27
+ constructor(configuration?: ConfigurationParameters);
28
+ set config(configuration: Configuration);
29
+ get basePath(): string;
30
+ get fetchApi(): FetchAPI | undefined;
31
+ get middleware(): Middleware[];
32
+ get queryParamsStringify(): (params: HTTPQuery) => string;
33
+ get username(): string | undefined;
34
+ get password(): string | undefined;
35
+ get apiKey(): ((name: string) => string | Promise<string>) | undefined;
36
+ get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined;
37
+ get headers(): HTTPHeaders | undefined;
38
+ get credentials(): RequestCredentials | undefined;
39
+ }
40
+ export declare const DefaultConfig: Configuration;
41
+ /**
42
+ * This is the base class for all generated API classes.
43
+ */
44
+ export declare class BaseAPI {
45
+ protected configuration: Configuration;
46
+ private static readonly jsonRegex;
47
+ private middleware;
48
+ constructor(configuration?: Configuration);
49
+ withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
50
+ withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
51
+ withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
52
+ /**
53
+ * Check if the given MIME is a JSON MIME.
54
+ * JSON MIME examples:
55
+ * application/json
56
+ * application/json; charset=UTF8
57
+ * APPLICATION/JSON
58
+ * application/vnd.company+json
59
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
60
+ * @return True if the given MIME is JSON, false otherwise.
61
+ */
62
+ protected isJsonMime(mime: string | null | undefined): boolean;
63
+ protected request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response>;
64
+ private createFetchParams;
65
+ private fetchApi;
66
+ /**
67
+ * Create a shallow clone of `this` by constructing a new instance
68
+ * and then shallow cloning data members.
69
+ */
70
+ private clone;
71
+ }
72
+ export declare class ResponseError extends Error {
73
+ response: Response;
74
+ name: "ResponseError";
75
+ constructor(response: Response, msg?: string);
76
+ }
77
+ export declare class FetchError extends Error {
78
+ cause: Error;
79
+ name: "FetchError";
80
+ constructor(cause: Error, msg?: string);
81
+ }
82
+ export declare class RequiredError extends Error {
83
+ field: string;
84
+ name: "RequiredError";
85
+ constructor(field: string, msg?: string);
86
+ }
87
+ export declare const COLLECTION_FORMATS: {
88
+ csv: string;
89
+ ssv: string;
90
+ tsv: string;
91
+ pipes: string;
92
+ };
93
+ export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
94
+ export type Json = any;
95
+ export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
96
+ export type HTTPHeaders = {
97
+ [key: string]: string;
98
+ };
99
+ export type HTTPQuery = {
100
+ [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery;
101
+ };
102
+ export type HTTPBody = Json | FormData | URLSearchParams;
103
+ export type HTTPRequestInit = {
104
+ headers?: HTTPHeaders;
105
+ method: HTTPMethod;
106
+ credentials?: RequestCredentials;
107
+ body?: HTTPBody;
108
+ };
109
+ export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
110
+ export type InitOverrideFunction = (requestContext: {
111
+ init: HTTPRequestInit;
112
+ context: RequestOpts;
113
+ }) => Promise<RequestInit>;
114
+ export interface FetchParams {
115
+ url: string;
116
+ init: RequestInit;
117
+ }
118
+ export interface RequestOpts {
119
+ path: string;
120
+ method: HTTPMethod;
121
+ headers: HTTPHeaders;
122
+ query?: HTTPQuery;
123
+ body?: HTTPBody;
124
+ }
125
+ export declare function querystring(params: HTTPQuery, prefix?: string): string;
126
+ export declare function exists(json: any, key: string): boolean;
127
+ export declare function canConsumeForm(consumes: Consume[]): boolean;
128
+ export interface Consume {
129
+ contentType: string;
130
+ }
131
+ export interface RequestContext {
132
+ fetch: FetchAPI;
133
+ url: string;
134
+ init: RequestInit;
135
+ }
136
+ export interface ResponseContext {
137
+ fetch: FetchAPI;
138
+ url: string;
139
+ init: RequestInit;
140
+ response: Response;
141
+ }
142
+ export interface ErrorContext {
143
+ fetch: FetchAPI;
144
+ url: string;
145
+ init: RequestInit;
146
+ error: unknown;
147
+ response?: Response;
148
+ }
149
+ export interface Middleware {
150
+ pre?(context: RequestContext): Promise<FetchParams | void>;
151
+ post?(context: ResponseContext): Promise<Response | void>;
152
+ onError?(context: ErrorContext): Promise<Response | void>;
153
+ }
154
+ export interface ApiResponse<T> {
155
+ raw: Response;
156
+ value(): Promise<T>;
157
+ }
158
+ export interface ResponseTransformer<T> {
159
+ (json: any): T;
160
+ }
161
+ export declare class JSONApiResponse<T> {
162
+ raw: Response;
163
+ private transformer;
164
+ constructor(raw: Response, transformer?: ResponseTransformer<T>);
165
+ value(): Promise<T>;
166
+ }
167
+ export declare class VoidApiResponse {
168
+ raw: Response;
169
+ constructor(raw: Response);
170
+ value(): Promise<void>;
171
+ }
172
+ export declare class BlobApiResponse {
173
+ raw: Response;
174
+ constructor(raw: Response);
175
+ value(): Promise<Blob>;
176
+ }
177
+ export declare class TextApiResponse {
178
+ raw: Response;
179
+ constructor(raw: Response);
180
+ value(): Promise<string>;
181
+ }
@@ -0,0 +1,341 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EmailSherlock API
5
+ * Verify one email address or a batch over HTTPS with an API key. Authenticate with the X-API-Key header. Billing is user-level credits; each call returns the remaining balance in the X-Credits-Remaining header. Sandbox: a key that starts with es_test_ runs in sandbox mode. It returns deterministic fixtured data on the same endpoints and response shape, never spends credits, and marks every response with X-Sandbox: true. The local part drives the verdict so you can test each branch: valid@, invalid@, catch-all@, disposable@, role@, unknown@ and pending@ pin a result (pending@ yields reason verification_pending, the deferred-batch outcome to retry later); ratelimit@ returns 429 and servererror@ returns 503 so you can exercise error handling. On the async jobs endpoint (POST /v1/verify/jobs), put async@ or slowjob@ in the batch and the sandbox reproduces the real submit-poll-complete lifecycle: the submit returns processing and the job completes after a few seconds, so you can build and test your polling loop before going live; without it, sandbox jobs complete immediately. Any other address maps to a stable result. Live keys start with es_live_. Full reference at https://emailsherlock.com/api/docs
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ export const BASE_PATH = "https://api.emailsherlock.com".replace(/\/+$/, "");
15
+ export class Configuration {
16
+ configuration;
17
+ constructor(configuration = {}) {
18
+ this.configuration = configuration;
19
+ }
20
+ set config(configuration) {
21
+ this.configuration = configuration;
22
+ }
23
+ get basePath() {
24
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
25
+ }
26
+ get fetchApi() {
27
+ return this.configuration.fetchApi;
28
+ }
29
+ get middleware() {
30
+ return this.configuration.middleware || [];
31
+ }
32
+ get queryParamsStringify() {
33
+ return this.configuration.queryParamsStringify || querystring;
34
+ }
35
+ get username() {
36
+ return this.configuration.username;
37
+ }
38
+ get password() {
39
+ return this.configuration.password;
40
+ }
41
+ get apiKey() {
42
+ const apiKey = this.configuration.apiKey;
43
+ if (apiKey) {
44
+ return typeof apiKey === 'function' ? apiKey : () => apiKey;
45
+ }
46
+ return undefined;
47
+ }
48
+ get accessToken() {
49
+ const accessToken = this.configuration.accessToken;
50
+ if (accessToken) {
51
+ return typeof accessToken === 'function' ? accessToken : async () => accessToken;
52
+ }
53
+ return undefined;
54
+ }
55
+ get headers() {
56
+ return this.configuration.headers;
57
+ }
58
+ get credentials() {
59
+ return this.configuration.credentials;
60
+ }
61
+ }
62
+ export const DefaultConfig = new Configuration();
63
+ /**
64
+ * This is the base class for all generated API classes.
65
+ */
66
+ export class BaseAPI {
67
+ configuration;
68
+ static jsonRegex = /^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$/i;
69
+ middleware;
70
+ constructor(configuration = DefaultConfig) {
71
+ this.configuration = configuration;
72
+ this.middleware = configuration.middleware;
73
+ }
74
+ withMiddleware(...middlewares) {
75
+ const next = this.clone();
76
+ next.middleware = next.middleware.concat(...middlewares);
77
+ return next;
78
+ }
79
+ withPreMiddleware(...preMiddlewares) {
80
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
81
+ return this.withMiddleware(...middlewares);
82
+ }
83
+ withPostMiddleware(...postMiddlewares) {
84
+ const middlewares = postMiddlewares.map((post) => ({ post }));
85
+ return this.withMiddleware(...middlewares);
86
+ }
87
+ /**
88
+ * Check if the given MIME is a JSON MIME.
89
+ * JSON MIME examples:
90
+ * application/json
91
+ * application/json; charset=UTF8
92
+ * APPLICATION/JSON
93
+ * application/vnd.company+json
94
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
95
+ * @return True if the given MIME is JSON, false otherwise.
96
+ */
97
+ isJsonMime(mime) {
98
+ if (!mime) {
99
+ return false;
100
+ }
101
+ return BaseAPI.jsonRegex.test(mime);
102
+ }
103
+ async request(context, initOverrides) {
104
+ const { url, init } = await this.createFetchParams(context, initOverrides);
105
+ const response = await this.fetchApi(url, init);
106
+ if (response && (response.status >= 200 && response.status < 300)) {
107
+ return response;
108
+ }
109
+ throw new ResponseError(response, 'Response returned an error code');
110
+ }
111
+ async createFetchParams(context, initOverrides) {
112
+ let url = this.configuration.basePath + context.path;
113
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
114
+ // only add the querystring to the URL if there are query parameters.
115
+ // this is done to avoid urls ending with a "?" character which buggy webservers
116
+ // do not handle correctly sometimes.
117
+ url += '?' + this.configuration.queryParamsStringify(context.query);
118
+ }
119
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
120
+ Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
121
+ const initOverrideFn = typeof initOverrides === "function"
122
+ ? initOverrides
123
+ : async () => initOverrides;
124
+ const initParams = {
125
+ method: context.method,
126
+ headers,
127
+ body: context.body,
128
+ credentials: this.configuration.credentials,
129
+ };
130
+ const overriddenInit = {
131
+ ...initParams,
132
+ ...(await initOverrideFn({
133
+ init: initParams,
134
+ context,
135
+ }))
136
+ };
137
+ let body;
138
+ if (isFormData(overriddenInit.body)
139
+ || (overriddenInit.body instanceof URLSearchParams)
140
+ || isBlob(overriddenInit.body)) {
141
+ body = overriddenInit.body;
142
+ }
143
+ else if (this.isJsonMime(headers['Content-Type'])) {
144
+ body = JSON.stringify(overriddenInit.body);
145
+ }
146
+ else {
147
+ body = overriddenInit.body;
148
+ }
149
+ const init = {
150
+ ...overriddenInit,
151
+ body
152
+ };
153
+ return { url, init };
154
+ }
155
+ fetchApi = async (url, init) => {
156
+ let fetchParams = { url, init };
157
+ for (const middleware of this.middleware) {
158
+ if (middleware.pre) {
159
+ fetchParams = await middleware.pre({
160
+ fetch: this.fetchApi,
161
+ ...fetchParams,
162
+ }) || fetchParams;
163
+ }
164
+ }
165
+ let response = undefined;
166
+ try {
167
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
168
+ }
169
+ catch (e) {
170
+ for (const middleware of this.middleware) {
171
+ if (middleware.onError) {
172
+ response = await middleware.onError({
173
+ fetch: this.fetchApi,
174
+ url: fetchParams.url,
175
+ init: fetchParams.init,
176
+ error: e,
177
+ response: response ? response.clone() : undefined,
178
+ }) || response;
179
+ }
180
+ }
181
+ if (response === undefined) {
182
+ if (e instanceof Error) {
183
+ throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
184
+ }
185
+ else {
186
+ throw e;
187
+ }
188
+ }
189
+ }
190
+ for (const middleware of this.middleware) {
191
+ if (middleware.post) {
192
+ response = await middleware.post({
193
+ fetch: this.fetchApi,
194
+ url: fetchParams.url,
195
+ init: fetchParams.init,
196
+ response: response.clone(),
197
+ }) || response;
198
+ }
199
+ }
200
+ return response;
201
+ };
202
+ /**
203
+ * Create a shallow clone of `this` by constructing a new instance
204
+ * and then shallow cloning data members.
205
+ */
206
+ clone() {
207
+ const constructor = this.constructor;
208
+ const next = new constructor(this.configuration);
209
+ next.middleware = this.middleware.slice();
210
+ return next;
211
+ }
212
+ }
213
+ ;
214
+ function isBlob(value) {
215
+ return typeof Blob !== 'undefined' && value instanceof Blob;
216
+ }
217
+ function isFormData(value) {
218
+ return typeof FormData !== "undefined" && value instanceof FormData;
219
+ }
220
+ export class ResponseError extends Error {
221
+ response;
222
+ name = "ResponseError";
223
+ constructor(response, msg) {
224
+ super(msg);
225
+ this.response = response;
226
+ // restore prototype chain
227
+ const actualProto = new.target.prototype;
228
+ if (Object.setPrototypeOf) {
229
+ Object.setPrototypeOf(this, actualProto);
230
+ }
231
+ }
232
+ }
233
+ export class FetchError extends Error {
234
+ cause;
235
+ name = "FetchError";
236
+ constructor(cause, msg) {
237
+ super(msg);
238
+ this.cause = cause;
239
+ // restore prototype chain
240
+ const actualProto = new.target.prototype;
241
+ if (Object.setPrototypeOf) {
242
+ Object.setPrototypeOf(this, actualProto);
243
+ }
244
+ }
245
+ }
246
+ export class RequiredError extends Error {
247
+ field;
248
+ name = "RequiredError";
249
+ constructor(field, msg) {
250
+ super(msg);
251
+ this.field = field;
252
+ // restore prototype chain
253
+ const actualProto = new.target.prototype;
254
+ if (Object.setPrototypeOf) {
255
+ Object.setPrototypeOf(this, actualProto);
256
+ }
257
+ }
258
+ }
259
+ export const COLLECTION_FORMATS = {
260
+ csv: ",",
261
+ ssv: " ",
262
+ tsv: "\t",
263
+ pipes: "|",
264
+ };
265
+ export function querystring(params, prefix = '') {
266
+ return Object.keys(params)
267
+ .map(key => querystringSingleKey(key, params[key], prefix))
268
+ .filter(part => part.length > 0)
269
+ .join('&');
270
+ }
271
+ function querystringSingleKey(key, value, keyPrefix = '') {
272
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
273
+ if (value instanceof Array) {
274
+ const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
275
+ .join(`&${encodeURIComponent(fullKey)}=`);
276
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
277
+ }
278
+ if (value instanceof Set) {
279
+ const valueAsArray = Array.from(value);
280
+ return querystringSingleKey(key, valueAsArray, keyPrefix);
281
+ }
282
+ if (value instanceof Date) {
283
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
284
+ }
285
+ if (value instanceof Object) {
286
+ return querystring(value, fullKey);
287
+ }
288
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
289
+ }
290
+ export function exists(json, key) {
291
+ const value = json[key];
292
+ return value !== null && value !== undefined;
293
+ }
294
+ export function canConsumeForm(consumes) {
295
+ for (const consume of consumes) {
296
+ if ('multipart/form-data' === consume.contentType) {
297
+ return true;
298
+ }
299
+ }
300
+ return false;
301
+ }
302
+ export class JSONApiResponse {
303
+ raw;
304
+ transformer;
305
+ constructor(raw, transformer = (jsonValue) => jsonValue) {
306
+ this.raw = raw;
307
+ this.transformer = transformer;
308
+ }
309
+ async value() {
310
+ return this.transformer(await this.raw.json());
311
+ }
312
+ }
313
+ export class VoidApiResponse {
314
+ raw;
315
+ constructor(raw) {
316
+ this.raw = raw;
317
+ }
318
+ async value() {
319
+ return undefined;
320
+ }
321
+ }
322
+ export class BlobApiResponse {
323
+ raw;
324
+ constructor(raw) {
325
+ this.raw = raw;
326
+ }
327
+ async value() {
328
+ return await this.raw.blob();
329
+ }
330
+ ;
331
+ }
332
+ export class TextApiResponse {
333
+ raw;
334
+ constructor(raw) {
335
+ this.raw = raw;
336
+ }
337
+ async value() {
338
+ return await this.raw.text();
339
+ }
340
+ ;
341
+ }
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- export { Emailsherlock, VerifyResource } from './client.js';
1
+ export { Emailsherlock, VerifyResource, GuardResource } from './client.js';
2
2
  export type { ClientOptions } from './client.js';
3
3
  export { VERSION } from './version.js';
4
4
  export { EmailsherlockError, AuthenticationError, ForbiddenError, InsufficientCreditsError, RateLimitError, ValidationError, ServiceUnavailableError, } from './errors.js';
5
- export { isVerifyResult, } from './types.js';
6
- export type { VerifyResult, VerifyVerdict, VerifyReason, VerifyDomain, Freshness, BatchItem, BatchItemError, BatchResponse, RateLimit, } from './types.js';
5
+ export { isVerifyResult } from './types.js';
6
+ export type { RateLimit } from './types.js';
7
+ export type { VerifyResultResponse, VerifyBatchResponse, VerifyBatchResponseResultsInner, VerifyJobResponse, VerifyJobResponseProgress, VerifyDomainResponse, VerifyDecisionResponse, BatchItemError, AccountStatusResponse, AccountStatusResponseCredits, AccountStatusResponseRateLimit, GuardEventsRequest, } from './generated/index.js';
7
8
  import { Emailsherlock } from './client.js';
8
9
  export default Emailsherlock;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { Emailsherlock, VerifyResource } from './client.js';
1
+ export { Emailsherlock, VerifyResource, GuardResource } from './client.js';
2
2
  export { VERSION } from './version.js';
3
3
  export { EmailsherlockError, AuthenticationError, ForbiddenError, InsufficientCreditsError, RateLimitError, ValidationError, ServiceUnavailableError, } from './errors.js';
4
- export { isVerifyResult, } from './types.js';
4
+ export { isVerifyResult } from './types.js';
5
5
  import { Emailsherlock } from './client.js';
6
6
  export default Emailsherlock;
package/dist/types.d.ts CHANGED
@@ -1,87 +1,13 @@
1
- /** The verdict for a single address. Mirrors the API `result` enum. */
2
- export type VerifyVerdict = 'valid' | 'invalid' | 'catch_all' | 'disposable' | 'role' | 'unknown';
3
- /** How recent the underlying data is. Mirrors the API `freshness` enum. */
4
- export type Freshness = 'fresh' | 'cached_recent' | 'cached_stale_refreshed';
5
- /** Why the verdict came out the way it did. Mirrors the API `reason` enum. */
6
- export type VerifyReason = 'bad_syntax' | 'no_mx' | 'mailbox_accepts' | 'mailbox_not_found' | 'disposable_provider' | 'role_address' | 'catch_all_domain' | 'greylisted' | 'smtp_timeout' | 'smtp_unreachable' | 'verification_pending';
7
- /** Domain-level intelligence for the verified address. Mirrors the wire JSON. */
8
- export interface VerifyDomain {
9
- /** The domain part of the address. */
10
- name: string;
11
- /** Host types such as freemail, disposable, custom, company, government, education, public, isp. */
12
- types: string[] | null;
13
- /** Domain trust score, 0-100, higher is better. */
14
- score: number | null;
15
- /** The domain publishes an SPF record. */
16
- spf: boolean | null;
17
- /** The domain publishes at least one DKIM key. */
18
- dkim: boolean | null;
19
- /** The domain publishes a DMARC record. */
20
- dmarc: boolean | null;
21
- /** none · quarantine · reject */
22
- dmarc_policy: 'none' | 'quarantine' | 'reject' | null;
23
- /** The domain publishes an MTA-STS policy. */
24
- mta_sts: boolean | null;
25
- /** The domain publishes a TLS-RPT record. */
26
- tls_rpt: boolean | null;
27
- /** The domain publishes a BIMI record. */
28
- bimi: boolean | null;
29
- /** The MX hosts publish DANE/TLSA records. */
30
- dane: boolean | null;
31
- /** Number of DNS blacklists currently listing the domain's mail IPs. */
32
- blacklists: number | null;
33
- /** secure · insecure · bogus */
34
- dnssec: 'secure' | 'insecure' | 'bogus' | null;
35
- /** The domain publishes a CAA record. */
36
- caa: boolean | null;
37
- }
38
- /** The result object returned for a verified address. Mirrors the wire JSON. */
39
- export interface VerifyResult {
40
- /** The address that was checked. */
41
- email: string;
42
- /** valid · invalid · catch_all · disposable · role · unknown */
43
- result: VerifyVerdict;
44
- /** The domain has reachable MX records. */
45
- mx: boolean;
46
- /** Throwaway / temporary-mail provider. */
47
- disposable: boolean;
48
- /** Role address such as info@ or sales@. */
49
- role: boolean;
50
- /** Host accepts mail for any local part. */
51
- catch_all: boolean;
52
- /** 0–1 confidence, higher is safer to send to. Null when the verdict is unknown. */
53
- score: number | null;
54
- /** fresh · cached_recent · cached_stale_refreshed */
55
- freshness: Freshness;
56
- /**
57
- * SMTP-proven deliverability: true only after an SMTP accept, false only on
58
- * a provable failure, null when unproven. Missing on older API versions.
59
- */
60
- deliverable?: boolean | null;
61
- /** Why the verdict came out the way it did. Missing on older API versions. */
62
- reason?: VerifyReason | null;
63
- /** The primary MX host for the domain. Missing on older API versions. */
64
- mx_record?: string | null;
65
- /** The address belongs to a free webmail provider. Missing on older API versions. */
66
- free_email?: boolean | null;
67
- /** When the check ran, ISO 8601. Missing on older API versions. */
68
- checked_at?: string | null;
69
- /** Domain-level intelligence. Missing on older API versions. */
70
- domain?: VerifyDomain | null;
71
- }
72
- /** A per-address failure inside a batch response. */
73
- export interface BatchItemError {
74
- email: string | null;
75
- error: 'invalid_email' | 'insufficient_credits' | 'verify_unavailable';
76
- }
77
- export type BatchItem = VerifyResult | BatchItemError;
78
- export interface BatchResponse {
79
- results: BatchItem[];
80
- }
81
- /** Type guard: did this batch item verify, or fail? */
82
- export declare function isVerifyResult(item: BatchItem): item is VerifyResult;
1
+ import type { VerifyResultResponse, VerifyBatchResponseResultsInner } from './generated/index.js';
2
+ /** Rate-limit window read from the X-RateLimit-* response headers. */
83
3
  export interface RateLimit {
84
4
  limit: number | null;
85
5
  remaining: number | null;
86
6
  reset: number | null;
87
7
  }
8
+ /**
9
+ * Type guard for a batch entry: did this address verify, or fail? A failed
10
+ * entry is a `BatchItemError` ({ email, error }); a verified one is a full
11
+ * `VerifyResultResponse`.
12
+ */
13
+ export declare function isVerifyResult(item: VerifyBatchResponseResultsInner): item is VerifyResultResponse;
package/dist/types.js CHANGED
@@ -1,4 +1,8 @@
1
- /** Type guard: did this batch item verify, or fail? */
1
+ /**
2
+ * Type guard for a batch entry: did this address verify, or fail? A failed
3
+ * entry is a `BatchItemError` ({ email, error }); a verified one is a full
4
+ * `VerifyResultResponse`.
5
+ */
2
6
  export function isVerifyResult(item) {
3
7
  return item.error === undefined;
4
8
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.2.1";
1
+ export declare const VERSION = "0.3.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.1';
1
+ export const VERSION = '0.3.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emailsherlock/node",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Official Node.js client for the EmailSherlock email-verification API.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",