@corsair-dev/kickbox 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 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,32 @@
1
- # Temporary Holding Version
1
+ # @corsair-dev/kickbox
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Kickbox plugin for Corsair: verify a single email address for deliverability, role, free and disposable flags, typo suggestions and a Sendex quality score, and check whether a domain is a known disposable one.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @corsair-dev/kickbox
9
+ ```
10
+
11
+ ## Endpoints
12
+
13
+ | Operation | Operation ID | Risk | Description |
14
+ |-----------|--------------|------|-------------|
15
+ | `verify.disposable` | `kickbox.api.verify.disposable` | `read` | Check whether an address or domain is a known disposable one. Free, and answered by Kickbox’s open service |
16
+ | `verify.verify` | `kickbox.api.verify.verify` | `read` | Verify one address and get its verdict (deliverable, undeliverable, risky, unknown), the reason, role and free flags, a typo suggestion and a Sendex quality score. Spends one verification credit |
17
+
18
+ ## Auth
19
+
20
+ Auth: API key. Corsair prompts your tenant for credentials on first use.
21
+
22
+ ## Webhooks
23
+
24
+ No webhooks.
25
+
26
+ ## Reference
27
+
28
+ Full docs, types, and examples: https://docs.corsair.dev/plugins/kickbox
29
+
30
+ ## License
31
+
32
+ Apache-2.0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=api.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.test.d.ts","sourceRoot":"","sources":["../api.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Two hosts, because the disposable check is a different service:
3
+ *
4
+ * - `api.kickbox.com/v2/verify` takes the key and verifies one address.
5
+ * - `open.kickbox.com/v1/disposable/:address` is free and keyless, which is why
6
+ * it is on its own host.
7
+ *
8
+ * An EU-only account is served from `api.eu.kickbox.com`, so the host is a
9
+ * plugin option rather than a constant.
10
+ */
11
+ export declare const KICKBOX_API_BASE = "https://api.kickbox.com";
12
+ export declare const KICKBOX_EU_API_BASE = "https://api.eu.kickbox.com";
13
+ export declare const KICKBOX_OPEN_BASE = "https://open.kickbox.com";
14
+ /** The free disposable check's path on the open host. */
15
+ export declare const KICKBOX_DISPOSABLE_PATH = "/v1/disposable/";
16
+ /**
17
+ * Kickbox answers a failure with the same envelope as a success:
18
+ * `{ success: false, code, message }`, where `code` is an upper-case string
19
+ * such as `FORBIDDEN` rather than a status. A spent balance has no code.
20
+ */
21
+ export declare function readFailure(body: unknown): {
22
+ success?: boolean;
23
+ code?: string;
24
+ message?: string;
25
+ };
26
+ /**
27
+ * A Kickbox failure that is not an HTTP error: a `200` with
28
+ * `{ success: false }`, or a request that got no answer.
29
+ *
30
+ * Kickbox answers `200` with `{ success: false }` for a refused key or a spent
31
+ * balance, so a caller that trusted the status alone would read a failure as a
32
+ * verification result with every field missing. The client throws on that
33
+ * body instead.
34
+ *
35
+ * An HTTP error stays core's `ApiError` (see `sanitizeApiError`).
36
+ */
37
+ export declare class KickboxAPIError extends Error {
38
+ readonly status?: number;
39
+ /** Kickbox's own code, such as `FORBIDDEN` or `INSUFFICIENT_BALANCE`. */
40
+ readonly code?: string;
41
+ /** Milliseconds from a Retry-After header, when Kickbox sent one. */
42
+ readonly retryAfter?: number;
43
+ /** The HTTP method of the failed request. */
44
+ readonly method?: string;
45
+ readonly transport: boolean;
46
+ readonly timedOut: boolean;
47
+ /**
48
+ * True when the request went to the paid verification host. A dropped or
49
+ * timed-out paid request may still have been charged, so it is not replayed.
50
+ */
51
+ readonly paid: boolean;
52
+ constructor(message: string, options?: {
53
+ cause?: Error;
54
+ status?: number;
55
+ code?: string;
56
+ retryAfter?: number;
57
+ method?: string;
58
+ transport?: boolean;
59
+ timedOut?: boolean;
60
+ paid?: boolean;
61
+ });
62
+ get isRateLimit(): boolean;
63
+ /** A refused or missing key. A spent balance is also a 403, but not this. */
64
+ get isAuthError(): boolean;
65
+ /** The account has run out of verification credits, which no retry fixes. */
66
+ get isQuotaError(): boolean;
67
+ /** The address or domain was refused before any lookup. */
68
+ get isValidationError(): boolean;
69
+ }
70
+ /**
71
+ * The status and Kickbox's code on an error of either kind, for handlers and
72
+ * callers.
73
+ */
74
+ export declare function kickboxErrorStatus(error: unknown): number | undefined;
75
+ export declare function kickboxErrorCode(error: unknown): string | undefined;
76
+ /** The account has run out of verification credits, which no retry fixes. */
77
+ export declare function isKickboxQuotaError(error: unknown): boolean;
78
+ /** A refused or missing key. A spent balance is also a 403, but not this. */
79
+ export declare function isKickboxAuthError(error: unknown): boolean;
80
+ /**
81
+ * True when the request went to the paid verification host. A paid request
82
+ * that failed may still have been charged, so it is never replayed.
83
+ */
84
+ export declare function isPaidKickboxRequest(error: unknown): boolean;
85
+ /** The message Kickbox sent, with its code in front. */
86
+ export declare function describeKickboxError(status: number | undefined, body: unknown, fallback: string): string;
87
+ export type KickboxQueryValue = string | number | boolean;
88
+ export type KickboxRequest = {
89
+ method: 'GET';
90
+ /** The base to send to, which differs between the keyed and open services. */
91
+ base: string;
92
+ path: string;
93
+ query?: Record<string, KickboxQueryValue | undefined>;
94
+ };
95
+ /** Encodes one path segment. */
96
+ export declare function segment(value: string): string;
97
+ export declare function makeKickboxRequest(apiKey: string, { method, base, path, query }: KickboxRequest): Promise<unknown>;
98
+ /** Drops the keys whose value is undefined, so a query carries only what was asked for. */
99
+ export declare function definedQuery(query: Record<string, KickboxQueryValue | undefined>): Record<string, KickboxQueryValue>;
100
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAC1D,eAAO,MAAM,mBAAmB,+BAA+B,CAAC;AAChE,eAAO,MAAM,iBAAiB,6BAA6B,CAAC;AAC5D,yDAAyD;AACzD,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AAQzD;;;;GAIG;AAEH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG;IAC3C,OAAO,CA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"mappings":""}
@@ -0,0 +1,35 @@
1
+ import type { z } from 'zod';
2
+ import type { KickboxContext } from '..';
3
+ import type { KickboxRequest } 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.
8
+ *
9
+ * An address is personal data, so the log carries the domain and the result but
10
+ * never the address itself.
11
+ */
12
+ export declare function call<Input extends z.ZodType, Output extends z.ZodType>(ctx: KickboxContext, operation: {
13
+ event: string;
14
+ input: Input;
15
+ output: Output;
16
+ }, rawInput: unknown, toRequest: (parsed: z.output<Input>) => KickboxRequest, options?: {
17
+ shape?: (raw: unknown, parsed: z.output<Input>) => unknown;
18
+ log?: (parsed: z.output<Input>, result: z.output<Output>) => LogFields;
19
+ }): Promise<z.output<Output>>;
20
+ /**
21
+ * The domain half of an address, for a log line that omits the local part. A
22
+ * bare domain, which `verify.disposable` accepts, is already the domain.
23
+ * Anything that is not a hostname gives undefined, so text a caller passed by
24
+ * mistake (a name, a local part) never reaches the event log.
25
+ */
26
+ export declare function domainOf(address: string): string | undefined;
27
+ /**
28
+ * The disposable check is free and keyless, but a key is still required to
29
+ * reach an endpoint at all: `core/endpoints/bind.ts` resolves the account key
30
+ * before it invokes anything, so an operation cannot run without one. The open
31
+ * host is used so no credit is spent and the key never travels to it.
32
+ */
33
+ export declare const OPEN_BASE = "https://open.kickbox.com";
34
+ export {};
35
+ //# 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,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhD,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;AAEvE;;;;;;GAMG;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,EAE1D,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,cAAc,EACtD,OAAO,GAAE;IAGR,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC;IAC3D,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;CAClE,GACJ,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAc3B;AAMD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI5D;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,6BAAoB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import * as Verify from './verify';
2
+ export { Verify };
3
+ export * from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../endpoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { z } from 'zod';
2
+ /** The four results Kickbox assigns to an address. */
3
+ export declare const KICKBOX_RESULTS: readonly ["deliverable", "undeliverable", "risky", "unknown"];
4
+ /**
5
+ * The reasons Kickbox publishes. It may add another, so the output keeps the
6
+ * field a plain string rather than failing a read on an unknown one.
7
+ */
8
+ export declare const KICKBOX_REASONS: readonly ["invalid_email", "invalid_domain", "rejected_email", "accepted_email", "low_quality", "low_deliverability", "no_connect", "timeout", "invalid_smtp", "unavailable_smtp", "unexpected_error"];
9
+ declare const VerifyInputSchema: z.ZodObject<{
10
+ email: z.ZodString;
11
+ timeout: z.ZodOptional<z.ZodNumber>;
12
+ }, z.core.$strip>;
13
+ export type VerifyInput = z.input<typeof VerifyInputSchema>;
14
+ declare const VerifyResponseSchema: z.ZodObject<{
15
+ result: z.ZodUnion<readonly [z.ZodEnum<{
16
+ unknown: "unknown";
17
+ deliverable: "deliverable";
18
+ undeliverable: "undeliverable";
19
+ risky: "risky";
20
+ }>, z.ZodString]>;
21
+ reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
+ role: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
23
+ free: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
24
+ disposable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
25
+ accept_all: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
26
+ did_you_mean: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
+ sendex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
28
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ user: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ success: z.ZodLiteral<true>;
32
+ message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ }, z.core.$loose>;
34
+ export type VerifyResponse = z.infer<typeof VerifyResponseSchema>;
35
+ declare const DisposableInputSchema: z.ZodObject<{
36
+ address: z.ZodString;
37
+ }, z.core.$strip>;
38
+ export type DisposableInput = z.input<typeof DisposableInputSchema>;
39
+ declare const DisposableResponseSchema: z.ZodObject<{
40
+ disposable: z.ZodBoolean;
41
+ }, z.core.$loose>;
42
+ export type DisposableResponse = z.infer<typeof DisposableResponseSchema>;
43
+ export type KickboxEndpointInputs = {
44
+ verify: VerifyInput;
45
+ disposable: DisposableInput;
46
+ };
47
+ export type KickboxEndpointOutputs = {
48
+ verify: VerifyResponse;
49
+ disposable: DisposableResponse;
50
+ };
51
+ export declare const KickboxEndpointInputSchemas: {
52
+ readonly verify: z.ZodObject<{
53
+ email: z.ZodString;
54
+ timeout: z.ZodOptional<z.ZodNumber>;
55
+ }, z.core.$strip>;
56
+ readonly disposable: z.ZodObject<{
57
+ address: z.ZodString;
58
+ }, z.core.$strip>;
59
+ };
60
+ export declare const KickboxEndpointOutputSchemas: {
61
+ readonly verify: z.ZodObject<{
62
+ result: z.ZodUnion<readonly [z.ZodEnum<{
63
+ unknown: "unknown";
64
+ deliverable: "deliverable";
65
+ undeliverable: "undeliverable";
66
+ risky: "risky";
67
+ }>, z.ZodString]>;
68
+ reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
+ role: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
70
+ free: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
71
+ disposable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
72
+ accept_all: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
73
+ did_you_mean: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
+ sendex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
75
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
+ user: z.ZodOptional<z.ZodNullable<z.ZodString>>;
77
+ domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
78
+ success: z.ZodLiteral<true>;
79
+ message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
80
+ }, z.core.$loose>;
81
+ readonly disposable: z.ZodObject<{
82
+ disposable: z.ZodBoolean;
83
+ }, z.core.$loose>;
84
+ };
85
+ export {};
86
+ //# 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;AAOxB,sDAAsD;AACtD,eAAO,MAAM,eAAe,+DAKlB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,eAAe,wMAYlB,CAAC;AAIX,QAAA,MAAM,iBAAiB;;;iBAgBrB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;iBA8CjB,CAAC;AAEV,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAIlE,QAAA,MAAM,qBAAqB;;iBAOzB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,QAAA,MAAM,wBAAwB;;iBAMrB,CAAC;AAEV,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAI1E,MAAM,MAAM,qBAAqB,GAAG;IACnC,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,eAAe,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACpC,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,kBAAkB,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;CAG9B,CAAC;AAEX,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;CAG/B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { KickboxEndpoints } from '..';
2
+ export declare const verify: KickboxEndpoints['verify'];
3
+ export declare const disposable: KickboxEndpoints['disposable'];
4
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../endpoints/verify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAoB3C,eAAO,MAAM,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAuB5C,CAAC;AAKH,eAAO,MAAM,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAepD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=endpoints.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.test.d.ts","sourceRoot":"","sources":["../endpoints.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,58 @@
1
+ import type { CorsairErrorHandler } from 'corsair/core';
2
+ export declare const errorHandlers: {
3
+ QUOTA_ERROR: {
4
+ match: (error: Error) => boolean;
5
+ handler: () => Promise<{
6
+ maxRetries: number;
7
+ }>;
8
+ };
9
+ RATE_LIMIT_ERROR: {
10
+ match: (error: Error) => boolean;
11
+ handler: (error: Error) => Promise<{
12
+ maxRetries: number;
13
+ headersRetryAfterMs: number | undefined;
14
+ retryStrategy: "exponential_backoff";
15
+ }>;
16
+ };
17
+ AUTH_ERROR: {
18
+ match: (error: Error) => boolean;
19
+ handler: () => Promise<{
20
+ maxRetries: number;
21
+ }>;
22
+ };
23
+ VALIDATION_ERROR: {
24
+ match: (error: Error) => boolean;
25
+ handler: () => Promise<{
26
+ maxRetries: number;
27
+ }>;
28
+ };
29
+ SERVER_ERROR: {
30
+ match: (error: Error) => boolean;
31
+ handler: (error: Error) => Promise<{
32
+ maxRetries: number;
33
+ retryStrategy: "exponential_backoff";
34
+ }>;
35
+ };
36
+ TIMEOUT_ERROR: {
37
+ match: (error: Error) => boolean;
38
+ handler: (error: Error) => Promise<{
39
+ maxRetries: number;
40
+ retryStrategy: "linear_2s";
41
+ }>;
42
+ };
43
+ NETWORK_ERROR: {
44
+ match: (error: Error) => boolean;
45
+ handler: (error: Error) => Promise<{
46
+ maxRetries: number;
47
+ retryStrategy: "exponential_backoff";
48
+ }>;
49
+ };
50
+ DEFAULT: {
51
+ match: () => true;
52
+ handler: () => Promise<{
53
+ maxRetries: number;
54
+ }>;
55
+ };
56
+ };
57
+ export declare function mergeErrorHandlers(builtin: CorsairErrorHandler, user: CorsairErrorHandler | undefined): CorsairErrorHandler;
58
+ //# 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;AAkBxD,eAAO,MAAM,aAAa;;uBAMT,KAAK;;;;;;uBAML,KAAK;yBACG,KAAK;;;;;;;uBAab,KAAK;;;;;;uBAML,KAAK;;;;;;uBAWL,KAAK;yBACG,KAAK;;;;;;uBAUb,KAAK;yBACG,KAAK;;;;;;uBAMb,KAAK;yBAEG,KAAK;;;;;;;;;;;CASC,CAAC;AAMhC,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,mBAAmB,GAAG,SAAS,GACnC,mBAAmB,CAWrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=error-handlers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handlers.test.d.ts","sourceRoot":"","sources":["../error-handlers.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,73 @@
1
+ import type { BindEndpoints, CorsairEndpoint, CorsairErrorHandler, CorsairPlugin, CorsairPluginContext, KeyBuilderContext, PickAuth, PluginPermissionsConfig } from 'corsair/core';
2
+ import type { KickboxEndpointInputs, KickboxEndpointOutputs } from './endpoints/types';
3
+ import { KickboxSchema } from './schema';
4
+ export type KickboxPluginOptions = {
5
+ authType?: PickAuth<'api_key'>;
6
+ key?: string;
7
+ /**
8
+ * `eu` sends verification to `api.eu.kickbox.com`, which is where an EU-only
9
+ * account is served. Defaults to the standard host.
10
+ */
11
+ region?: 'us' | 'eu';
12
+ hooks?: InternalKickboxPlugin['hooks'];
13
+ errorHandlers?: CorsairErrorHandler;
14
+ permissions?: PluginPermissionsConfig<typeof kickboxEndpointsNested>;
15
+ };
16
+ export type KickboxContext = CorsairPluginContext<typeof KickboxSchema, KickboxPluginOptions>;
17
+ export type KickboxKeyBuilderContext = KeyBuilderContext<KickboxPluginOptions>;
18
+ export type KickboxBoundEndpoints = BindEndpoints<typeof kickboxEndpointsNested>;
19
+ type KickboxEndpoint<K extends keyof KickboxEndpointOutputs> = CorsairEndpoint<KickboxContext, KickboxEndpointInputs[K], KickboxEndpointOutputs[K]>;
20
+ export type KickboxEndpoints = {
21
+ verify: KickboxEndpoint<'verify'>;
22
+ disposable: KickboxEndpoint<'disposable'>;
23
+ };
24
+ declare const kickboxEndpointsNested: {
25
+ readonly verify: {
26
+ readonly verify: KickboxEndpoint<"verify">;
27
+ readonly disposable: KickboxEndpoint<"disposable">;
28
+ };
29
+ };
30
+ export declare const kickboxEndpointSchemas: {
31
+ readonly 'verify.verify': {
32
+ readonly input: import("zod").ZodObject<{
33
+ email: import("zod").ZodString;
34
+ timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
35
+ }, import("zod/v4/core").$strip>;
36
+ readonly output: import("zod").ZodObject<{
37
+ result: import("zod").ZodUnion<readonly [import("zod").ZodEnum<{
38
+ unknown: "unknown";
39
+ deliverable: "deliverable";
40
+ undeliverable: "undeliverable";
41
+ risky: "risky";
42
+ }>, import("zod").ZodString]>;
43
+ reason: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
44
+ role: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
45
+ free: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
46
+ disposable: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
47
+ accept_all: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
48
+ did_you_mean: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
49
+ sendex: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
50
+ email: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
51
+ user: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
52
+ domain: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
53
+ success: import("zod").ZodLiteral<true>;
54
+ message: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
55
+ }, import("zod/v4/core").$loose>;
56
+ };
57
+ readonly 'verify.disposable': {
58
+ readonly input: import("zod").ZodObject<{
59
+ address: import("zod").ZodString;
60
+ }, import("zod/v4/core").$strip>;
61
+ readonly output: import("zod").ZodObject<{
62
+ disposable: import("zod").ZodBoolean;
63
+ }, import("zod/v4/core").$loose>;
64
+ };
65
+ };
66
+ declare const defaultAuthType: "api_key";
67
+ export type BaseKickboxPlugin<T extends KickboxPluginOptions> = CorsairPlugin<'kickbox', typeof KickboxSchema, typeof kickboxEndpointsNested, {}, T, typeof defaultAuthType>;
68
+ export type InternalKickboxPlugin = BaseKickboxPlugin<KickboxPluginOptions>;
69
+ export type ExternalKickboxPlugin<T extends KickboxPluginOptions> = BaseKickboxPlugin<T>;
70
+ export declare function kickbox<const T extends KickboxPluginOptions>(incomingOptions?: KickboxPluginOptions & T): ExternalKickboxPlugin<T>;
71
+ export { isKickboxAuthError, isKickboxQuotaError, isPaidKickboxRequest, KickboxAPIError, kickboxErrorCode, kickboxErrorStatus, } from './client';
72
+ export type { DisposableInput, DisposableResponse, KickboxEndpointInputs, KickboxEndpointOutputs, VerifyInput, VerifyResponse, } from './endpoints/types';
73
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,sBAAsB;;;;;CAKlB,CAAC;AAEX,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWlC,CAAC;AAEF,QAAA,MAAM,eAAe,EAAG,SAAkB,CAAC;AAiB3C,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,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,UAAU,CAAC;AAElB,YAAY,EACX,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,WAAW,EACX,cAAc,GACd,MAAM,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ var L=Object.defineProperty;var q=(e,t)=>{for(var n in t)L(e,n,{get:t[n],enumerable:!0})};import{AuthMissingError as te}from"corsair/core";var b={};q(b,{disposable:()=>Y,verify:()=>J});import{asRecord as N}from"corsair/core";import{ApiError as f,request as H}from"corsair/http";var _="https://api.kickbox.com",C="https://api.eu.kickbox.com",x="https://open.kickbox.com",h="/v1/disposable/",V=35e3;function y(e){let t=N(e),n=a=>{let p=t?.[a];return typeof p=="string"&&p.length>0?p:void 0},i=t?.success,r=n("message"),s=n("code")??(r&&/insufficient balance/i.test(r)?"INSUFFICIENT_BALANCE":void 0);return{success:typeof i=="boolean"?i:void 0,code:s,message:r}}var z={enabled:!0,maxRetries:0,initialRetryDelay:1e3,backoffMultiplier:2,headerNames:{retryAfter:"retry-after"}},c=class extends Error{status;code;retryAfter;method;transport;timedOut;paid;constructor(t,n={}){super(t,n.cause?{cause:n.cause}:void 0),this.name="KickboxAPIError",this.status=n.status,this.code=n.code,this.retryAfter=n.retryAfter,this.method=n.method,this.transport=n.transport??!1,this.timedOut=n.timedOut??!1,this.paid=n.paid??!1}get isRateLimit(){return this.status===429}get isAuthError(){return this.isQuotaError?!1:this.status===401||this.status===403||this.code==="FORBIDDEN"}get isQuotaError(){return this.code==="INSUFFICIENT_BALANCE"}get isValidationError(){return this.status===400||this.status===422}};function k(e){if(e instanceof f||e instanceof c)return e.status}function g(e){if(e instanceof f)return y(e.body).code;if(e instanceof c)return e.code}function E(e){return g(e)==="INSUFFICIENT_BALANCE"}function K(e){if(E(e))return!1;let t=k(e);return t===401||t===403||g(e)==="FORBIDDEN"}function R(e){return e instanceof c?e.paid:e instanceof f?!e.request.url.startsWith(h):!1}function A(e){return e.replace(/([?&]email=)[^&#]*/g,"$1[REDACTED]").replace(/(\/v1\/disposable\/)[^?#]*/,"$1[REDACTED]")}function U(e){let t=y(e.body),n=Object.fromEntries(Object.entries({success:t.success,code:t.code}).filter(([,s])=>s!==void 0)),i=[e.status,t.code].filter(s=>s!==void 0).join(" "),r=e.request.query?Object.fromEntries(Object.entries(e.request.query).map(([s,a])=>[s,s==="email"?"[REDACTED]":a])):void 0;return new f({...e.request,url:A(e.request.url),...r?{query:r}:{}},{url:A(e.url),ok:!1,status:e.status,statusText:e.statusText,body:n},`Kickbox ${i}: request failed`,{retryAfter:e.retryAfter,rateLimitReset:e.rateLimitReset,rateLimitRemaining:e.rateLimitRemaining,rateLimitLimit:e.rateLimitLimit})}function F(e,t,n){let i=y(t),r=i.message??n,s=[e,i.code].filter(a=>a!==void 0).join(" ");return s?`Kickbox ${s}: ${r}`:r}function T(e){return encodeURIComponent(e)}async function S(e,{method:t,base:n,path:i,query:r}){let s={BASE:n,VERSION:"2.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",TIMEOUT:V,HEADERS:{Accept:"application/json"}},a=n!==x,p={method:t,url:i,query:r};try{let u=await H(s,p,{rateLimitConfig:z}),m=y(u);if(m.success===!1)throw new c(F(void 0,u,"Kickbox refused the request"),{status:200,code:m.code,method:t,paid:a});return u}catch(u){throw u instanceof c?u:u instanceof f?U(u):u instanceof Error||u instanceof DOMException?new c(u.message,{cause:u,method:t,transport:!0,timedOut:u.name==="TimeoutError",paid:a}):new c("Unknown Kickbox error",{method:t,transport:!0,paid:a})}}function v(e){return Object.fromEntries(Object.entries(e).filter(t=>t[1]!==void 0))}import{logEventFromContext as j}from"corsair/core";async function O(e,t,n,i,r={}){let s=t.input.parse(n??{}),a=await S(e.key,i(s)),p=t.output.parse(r.shape?r.shape(a,s):a);return await j(e,`kickbox.${t.event}`,r.log?.(s,p)??{},"completed"),p}var M=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/;function P(e){let t=e.lastIndexOf("@"),n=(t===-1?e:e.slice(t+1)).toLowerCase();return M.test(n)?n:void 0}import{z as o}from"zod";var Q=["deliverable","undeliverable","risky","unknown"];var X=o.object({email:o.string().min(3).describe("The address to verify. It is URL-encoded for you. Send a syntactically bad one to have Kickbox report `invalid_email` rather than rejecting it here."),timeout:o.number().int().min(1).max(3e4).optional().describe("How long Kickbox may spend on the SMTP check, in milliseconds. Defaults to 6000, and 30000 is the ceiling.")}),$=o.object({result:o.union([o.enum(Q),o.string()]).describe("`deliverable`, `undeliverable`, `risky` or `unknown`."),reason:o.string().nullish().describe("Why the result came out as it did, such as `accepted_email` or `rejected_email`."),role:o.boolean().nullish().describe("True for a role address such as `support@example.com`."),free:o.boolean().nullish().describe("True for a free provider such as gmail.com."),disposable:o.boolean().nullish().describe("True when the domain is a known disposable one."),accept_all:o.boolean().nullish().describe("True when the domain accepts every address it is offered."),did_you_mean:o.string().nullish().describe("A suggested spelling when Kickbox spotted a likely typo."),sendex:o.number().nullish().describe("A quality score from 0 (no quality) to 1 (perfect)."),email:o.string().nullish().describe("The address in normalized lower case."),user:o.string().nullish(),domain:o.string().nullish(),success:o.literal(!0),message:o.string().nullish()}).loose(),W=o.object({address:o.string().min(3).describe("An email address or a bare domain, such as `mailinator.com`. It is URL-encoded for you.")}),G=o.object({disposable:o.boolean().describe("True when the domain is a known disposable one.")}).loose(),d={verify:X,disposable:W},l={verify:$,disposable:G};function Z(e){return e==="eu"?C:_}var J=(e,t)=>O(e,{event:"verify.verify",input:d.verify,output:l.verify},t,({email:n,timeout:i})=>({method:"GET",base:Z(e.options.region),path:"/v2/verify",query:v({email:n,apikey:e.key,timeout:i})}),{log:(n,i)=>({domain:i.domain??void 0,result:i.result,reason:i.reason??void 0})}),Y=(e,t)=>O(e,{event:"verify.disposable",input:d.disposable,output:l.disposable},t,({address:n})=>({method:"GET",base:x,path:`${h}${T(n)}`}),{log:({address:n})=>({domain:P(n)})});import{ApiError as ee}from"corsair/http";function I(e){return k(e)}var w={QUOTA_ERROR:{match:e=>E(e),handler:async()=>({maxRetries:0})},RATE_LIMIT_ERROR:{match:e=>I(e)===429,handler:async e=>({maxRetries:2,headersRetryAfterMs:e instanceof ee||e instanceof c?e.retryAfter:void 0,retryStrategy:"exponential_backoff"})},AUTH_ERROR:{match:e=>K(e),handler:async()=>({maxRetries:0})},VALIDATION_ERROR:{match:e=>{let t=I(e);return e.name==="ZodError"||t===400||t===422},handler:async()=>({maxRetries:0})},SERVER_ERROR:{match:e=>(I(e)??0)>=500,handler:async e=>({maxRetries:R(e)?0:2,retryStrategy:"exponential_backoff"})},TIMEOUT_ERROR:{match:e=>e instanceof c&&e.timedOut,handler:async e=>({maxRetries:e instanceof c&&e.paid?0:1,retryStrategy:"linear_2s"})},NETWORK_ERROR:{match:e=>e instanceof c&&e.transport,handler:async e=>({maxRetries:e instanceof c&&e.paid?0:2,retryStrategy:"exponential_backoff"})},DEFAULT:{match:()=>!0,handler:async()=>({maxRetries:0})}};function B(e,t){if(!t)return e;let{DEFAULT:n,...i}=e,{DEFAULT:r,...s}=t,a={...s};for(let[u,m]of Object.entries(i))u in a||(a[u]=m);let p=r??n;return p&&(a.DEFAULT=p),a}var D={version:"1.0.0",entities:{}};var ne={verify:{verify:b.verify,disposable:b.disposable}},oe={"verify.verify":{input:d.verify,output:l.verify},"verify.disposable":{input:d.disposable,output:l.disposable}},ie="api_key",re={"verify.verify":{riskLevel:"read",description:"Verify one address and get its verdict (deliverable, undeliverable, risky, unknown), the reason, role and free flags, a typo suggestion and a Sendex quality score. Spends one verification credit"},"verify.disposable":{riskLevel:"read",description:"Check whether an address or domain is a known disposable one. Free, and answered by Kickbox\u2019s open service"}};function Te(e={}){let t={...e,authType:e.authType??ie};return{id:"kickbox",schema:D,options:t,hooks:t.hooks,endpoints:ne,webhooks:{},endpointMeta:re,endpointSchemas:oe,pluginWebhookMatcher:()=>!1,errorHandlers:B(w,t.errorHandlers),keyBuilder:async(n,i)=>{if(i==="endpoint"&&t.key)return t.key;if(i==="endpoint"&&n.authType==="api_key"){let r=await n.keys.get_api_key();if(r)return r}throw new te("kickbox",n.authType??"api_key")}}}export{c as KickboxAPIError,K as isKickboxAuthError,E as isKickboxQuotaError,R as isPaidKickboxRequest,Te as kickbox,oe as kickboxEndpointSchemas,g as kickboxErrorCode,k as kickboxErrorStatus};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=plugin.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.test.d.ts","sourceRoot":"","sources":["../plugin.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=retry.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.test.d.ts","sourceRoot":"","sources":["../retry.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export declare const KickboxSchema: {
2
+ readonly version: "1.0.0";
3
+ readonly entities: {};
4
+ };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../schema/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;CAGhB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../schema.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,78 @@
1
+ export declare const deliverable: {
2
+ result: string;
3
+ reason: string;
4
+ role: boolean;
5
+ free: boolean;
6
+ disposable: boolean;
7
+ accept_all: boolean;
8
+ did_you_mean: null;
9
+ sendex: number;
10
+ email: string;
11
+ user: string;
12
+ domain: string;
13
+ success: boolean;
14
+ message: null;
15
+ };
16
+ export declare const undeliverable: {
17
+ result: string;
18
+ reason: string;
19
+ role: boolean;
20
+ free: boolean;
21
+ disposable: boolean;
22
+ accept_all: boolean;
23
+ did_you_mean: string;
24
+ sendex: number;
25
+ email: string;
26
+ user: string;
27
+ domain: string;
28
+ success: boolean;
29
+ message: null;
30
+ };
31
+ export declare const risky: {
32
+ result: string;
33
+ reason: string;
34
+ role: boolean;
35
+ free: boolean;
36
+ disposable: boolean;
37
+ accept_all: boolean;
38
+ did_you_mean: null;
39
+ sendex: number;
40
+ email: string;
41
+ user: string;
42
+ domain: string;
43
+ success: boolean;
44
+ message: null;
45
+ };
46
+ export declare const disposableHost: {
47
+ disposable: boolean;
48
+ };
49
+ export declare const notDisposableHost: {
50
+ disposable: boolean;
51
+ };
52
+ /** The 403 body Kickbox sends for a key it does not recognise. */
53
+ export declare const invalidKey: {
54
+ success: boolean;
55
+ code: string;
56
+ message: string;
57
+ };
58
+ /** The 200 that still says the key is refused, which is the trap. */
59
+ export declare const refusedKeyOn200: {
60
+ success: boolean;
61
+ code: string;
62
+ message: string;
63
+ };
64
+ /**
65
+ * A spent balance, as the live API sends it: a 403 with no `code`, only the
66
+ * message (sandbox key, `insufficient-balance@example.com`, 11-14).
67
+ */
68
+ export declare const insufficientBalance: {
69
+ success: boolean;
70
+ message: string;
71
+ };
72
+ /** An address Kickbox will not accept. */
73
+ export declare const badRequest: {
74
+ success: boolean;
75
+ code: string;
76
+ message: string;
77
+ };
78
+ //# sourceMappingURL=test-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-fixtures.d.ts","sourceRoot":"","sources":["../test-fixtures.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;CAcvB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;CAczB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;CAcjB,CAAC;AAEF,eAAO,MAAM,cAAc;;CAAuB,CAAC;AACnD,eAAO,MAAM,iBAAiB;;CAAwB,CAAC;AAEvD,kEAAkE;AAClE,eAAO,MAAM,UAAU;;;;CAItB,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,eAAe;;;;CAI3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC;AAEF,0CAA0C;AAC1C,eAAO,MAAM,UAAU;;;;CAItB,CAAC"}
@@ -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/kickbox",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Kickbox plugin for Corsair: verify a single email address for deliverability, role, free and disposable flags, typo suggestions and a Sendex quality score, and check whether a domain is a known disposable one.",
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.0",
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.184"
28
+ },
29
+ "keywords": [
30
+ "corsair",
31
+ "kickbox",
32
+ "plugin",
33
+ "email-verification",
34
+ "deliverability"
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/kickbox"
45
+ },
46
+ "homepage": "https://docs.corsair.dev/plugins/kickbox",
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
  }