@bernierllc/sender-identity-verification 1.6.1 → 3.0.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/CHANGELOG.md +28 -0
- package/__tests__/error-handling.test.ts +36 -21
- package/dist/SenderIdentityVerification.js +13 -4
- package/dist/errors.d.ts +28 -16
- package/dist/errors.js +18 -23
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -2
- package/dist/providers/SendGridProvider.js +1 -0
- package/package.json +2 -2
- package/src/errors.ts +46 -20
- package/src/index.ts +8 -1
- package/tsconfig.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,34 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.0.0](https://github.com/bernierllc/tools/compare/@bernierllc/sender-identity-verification@1.6.1...@bernierllc/sender-identity-verification@3.0.0) (2026-05-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
* feat(sender-identity-verification)!: migrate to ES2022 error.cause ([5c56769](https://github.com/bernierllc/tools/commit/5c56769cf5ad33b4f14ea54510b6e1e4479cdf1a))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
* SenderErrorCode enum removed; use the new
|
|
15
|
+
SenderVerificationErrorCode string-literal union (e.g. 'SENDER_NOT_FOUND')
|
|
16
|
+
instead. SenderVerificationError constructor signature changed from
|
|
17
|
+
(message, code, details) to (message, options?) where options is
|
|
18
|
+
{ cause?, code?, context? }. The details field is replaced by context;
|
|
19
|
+
former details payloads should be passed as context: { details: ... }.
|
|
20
|
+
Underlying errors must chain via options.cause and are read back through
|
|
21
|
+
native error.cause. handleSenderError continues to populate
|
|
22
|
+
errors: [error.code] since code is now a string literal.
|
|
23
|
+
|
|
24
|
+
External consumer sweep found no other package importing SenderErrorCode
|
|
25
|
+
or SenderVerificationError; only the in-package test file required
|
|
26
|
+
updates. Coverage gap in SenderIdentityVerification.ts is pre-existing
|
|
27
|
+
baseline (verified via git stash) and unrelated to this change; errors.ts
|
|
28
|
+
itself remains at 100% coverage.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
6
34
|
## [1.6.1](https://github.com/bernierllc/tools/compare/@bernierllc/sender-identity-verification@1.6.0...@bernierllc/sender-identity-verification@1.6.1) (2026-05-20)
|
|
7
35
|
|
|
8
36
|
**Note:** Version bump only for package @bernierllc/sender-identity-verification
|
|
@@ -6,7 +6,7 @@ The client may use and modify this code *only within the scope of the project it
|
|
|
6
6
|
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { SenderVerificationError,
|
|
9
|
+
import { SenderVerificationError, handleSenderError } from '../src/errors';
|
|
10
10
|
import { SenderIdentityVerification } from '../src/SenderIdentityVerification';
|
|
11
11
|
import { SenderIdentityConfig } from '../src/config';
|
|
12
12
|
import { EmailProvider, SenderStatus } from '../src/types';
|
|
@@ -35,36 +35,51 @@ describe('Error Handling Tests', () => {
|
|
|
35
35
|
it('should create error with code and message', () => {
|
|
36
36
|
const error = new SenderVerificationError(
|
|
37
37
|
'Sender not found',
|
|
38
|
-
|
|
38
|
+
{ code: 'SENDER_NOT_FOUND' }
|
|
39
39
|
);
|
|
40
40
|
|
|
41
41
|
expect(error.name).toBe('SenderVerificationError');
|
|
42
42
|
expect(error.message).toBe('Sender not found');
|
|
43
|
-
expect(error.code).toBe(
|
|
44
|
-
expect(error.
|
|
43
|
+
expect(error.code).toBe('SENDER_NOT_FOUND');
|
|
44
|
+
expect(error.context).toBeUndefined();
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
it('should create error with details', () => {
|
|
47
|
+
it('should create error with context (details)', () => {
|
|
48
48
|
const error = new SenderVerificationError(
|
|
49
49
|
'Verification failed',
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
{
|
|
51
|
+
code: 'VERIFICATION_FAILED',
|
|
52
|
+
context: { details: { attempts: 3, senderId: '123' } }
|
|
53
|
+
}
|
|
52
54
|
);
|
|
53
55
|
|
|
54
|
-
expect(error.code).toBe(
|
|
55
|
-
expect(error.
|
|
56
|
+
expect(error.code).toBe('VERIFICATION_FAILED');
|
|
57
|
+
expect(error.context).toEqual({ details: { attempts: 3, senderId: '123' } });
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should default code to SENDER_VERIFICATION_ERROR when omitted', () => {
|
|
61
|
+
const error = new SenderVerificationError('generic failure');
|
|
62
|
+
expect(error.code).toBe('SENDER_VERIFICATION_ERROR');
|
|
56
63
|
});
|
|
57
64
|
|
|
58
|
-
it('should
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
expect(
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
it('should preserve native ES2022 cause chain', () => {
|
|
66
|
+
const root = new Error('socket hang up');
|
|
67
|
+
const error = new SenderVerificationError('Provider call failed', {
|
|
68
|
+
code: 'PROVIDER_ERROR',
|
|
69
|
+
cause: root
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
expect(error.cause).toBe(root);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should preserve context when provided', () => {
|
|
76
|
+
const ctx = { senderId: 'abc', attempts: 5 };
|
|
77
|
+
const error = new SenderVerificationError('locked', {
|
|
78
|
+
code: 'SENDER_LOCKED',
|
|
79
|
+
context: ctx
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
expect(error.context).toBe(ctx);
|
|
68
83
|
});
|
|
69
84
|
});
|
|
70
85
|
|
|
@@ -72,14 +87,14 @@ describe('Error Handling Tests', () => {
|
|
|
72
87
|
it('should handle SenderVerificationError', () => {
|
|
73
88
|
const error = new SenderVerificationError(
|
|
74
89
|
'Sender locked',
|
|
75
|
-
|
|
90
|
+
{ code: 'SENDER_LOCKED' }
|
|
76
91
|
);
|
|
77
92
|
|
|
78
93
|
const result = handleSenderError(error);
|
|
79
94
|
|
|
80
95
|
expect(result.success).toBe(false);
|
|
81
96
|
expect(result.error).toBe('Sender locked');
|
|
82
|
-
expect(result.errors).toContain(
|
|
97
|
+
expect(result.errors).toContain('SENDER_LOCKED');
|
|
83
98
|
});
|
|
84
99
|
|
|
85
100
|
it('should handle generic Error', () => {
|
|
@@ -55,12 +55,21 @@ const email_sender_manager_1 = require("@bernierllc/email-sender-manager");
|
|
|
55
55
|
* service falls back to the legacy in-memory store.
|
|
56
56
|
*/
|
|
57
57
|
class SenderIdentityVerification {
|
|
58
|
+
config;
|
|
59
|
+
// Legacy in-memory store — used only when no senderManager is configured
|
|
60
|
+
senders = new Map();
|
|
61
|
+
// Provider plugin registry (keyed by providerId)
|
|
62
|
+
providerPlugins = new Map();
|
|
63
|
+
// Core persistence layer (optional, new path)
|
|
64
|
+
senderManager;
|
|
65
|
+
emailSender;
|
|
66
|
+
domainVerification;
|
|
67
|
+
cryptoUtils;
|
|
68
|
+
logger;
|
|
69
|
+
emailValidator;
|
|
70
|
+
neverhub;
|
|
58
71
|
constructor(config) {
|
|
59
72
|
this.config = config;
|
|
60
|
-
// Legacy in-memory store — used only when no senderManager is configured
|
|
61
|
-
this.senders = new Map();
|
|
62
|
-
// Provider plugin registry (keyed by providerId)
|
|
63
|
-
this.providerPlugins = new Map();
|
|
64
73
|
// Initialize domain verification from config if provided
|
|
65
74
|
if (config.domainVerificationConfig?.instance) {
|
|
66
75
|
this.domainVerification = config.domainVerificationConfig.instance;
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,27 +1,39 @@
|
|
|
1
1
|
import { SenderIdentityResult } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Typed error code union for sender-identity-verification errors.
|
|
4
|
+
*
|
|
5
|
+
* Replaces the previous `SenderErrorCode` enum (removed in 2.0.0).
|
|
6
|
+
* Consumers should use the string literal directly, e.g. `'SENDER_NOT_FOUND'`.
|
|
4
7
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
export type SenderVerificationErrorCode = 'SENDER_VERIFICATION_ERROR' | 'SENDER_NOT_FOUND' | 'SENDER_ALREADY_EXISTS' | 'SENDER_LOCKED' | 'VERIFICATION_EXPIRED' | 'VERIFICATION_FAILED' | 'DOMAIN_NOT_VERIFIED' | 'PROVIDER_ERROR' | 'INVALID_EMAIL' | 'RATE_LIMIT_EXCEEDED';
|
|
9
|
+
/**
|
|
10
|
+
* Options bag accepted by `SenderVerificationError`.
|
|
11
|
+
*
|
|
12
|
+
* - `cause`: chained underlying error (ES2022 Error.cause).
|
|
13
|
+
* - `code`: a typed error code from {@link SenderVerificationErrorCode}.
|
|
14
|
+
* - `context`: arbitrary structured context — senderId/details/etc.
|
|
15
|
+
* The legacy `details` ctor argument is now stored under `context.details`.
|
|
16
|
+
*/
|
|
17
|
+
export interface SenderVerificationErrorOptions {
|
|
18
|
+
cause?: Error;
|
|
19
|
+
code?: SenderVerificationErrorCode;
|
|
20
|
+
context?: Record<string, unknown>;
|
|
15
21
|
}
|
|
16
22
|
/**
|
|
17
|
-
* Custom error class for sender verification errors
|
|
23
|
+
* Custom error class for sender verification errors.
|
|
24
|
+
*
|
|
25
|
+
* Uses native ES2022 `Error.cause` for error chaining — read the underlying
|
|
26
|
+
* error via `error.cause`. Structured fields (senderId, details, etc.) live
|
|
27
|
+
* on `error.context` since 2.0.0.
|
|
18
28
|
*/
|
|
19
29
|
export declare class SenderVerificationError extends Error {
|
|
20
|
-
code:
|
|
21
|
-
|
|
22
|
-
constructor(message: string,
|
|
30
|
+
readonly code: SenderVerificationErrorCode;
|
|
31
|
+
readonly context?: Record<string, unknown>;
|
|
32
|
+
constructor(message: string, options?: SenderVerificationErrorOptions);
|
|
23
33
|
}
|
|
24
34
|
/**
|
|
25
|
-
* Error handling wrapper
|
|
35
|
+
* Error handling wrapper — converts arbitrary errors to a
|
|
36
|
+
* `SenderIdentityResult<never>` envelope. Reads `error.code` (now a string
|
|
37
|
+
* literal under the new union) to populate `errors`.
|
|
26
38
|
*/
|
|
27
39
|
export declare function handleSenderError(error: unknown): SenderIdentityResult<never>;
|
package/dist/errors.js
CHANGED
|
@@ -7,38 +7,33 @@ The client may use and modify this code *only within the scope of the project it
|
|
|
7
7
|
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.SenderVerificationError =
|
|
10
|
+
exports.SenderVerificationError = void 0;
|
|
11
11
|
exports.handleSenderError = handleSenderError;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
(
|
|
17
|
-
|
|
18
|
-
SenderErrorCode["SENDER_ALREADY_EXISTS"] = "SENDER_ALREADY_EXISTS";
|
|
19
|
-
SenderErrorCode["SENDER_LOCKED"] = "SENDER_LOCKED";
|
|
20
|
-
SenderErrorCode["VERIFICATION_EXPIRED"] = "VERIFICATION_EXPIRED";
|
|
21
|
-
SenderErrorCode["VERIFICATION_FAILED"] = "VERIFICATION_FAILED";
|
|
22
|
-
SenderErrorCode["DOMAIN_NOT_VERIFIED"] = "DOMAIN_NOT_VERIFIED";
|
|
23
|
-
SenderErrorCode["PROVIDER_ERROR"] = "PROVIDER_ERROR";
|
|
24
|
-
SenderErrorCode["INVALID_EMAIL"] = "INVALID_EMAIL";
|
|
25
|
-
SenderErrorCode["RATE_LIMIT_EXCEEDED"] = "RATE_LIMIT_EXCEEDED";
|
|
26
|
-
})(SenderErrorCode || (exports.SenderErrorCode = SenderErrorCode = {}));
|
|
27
|
-
/**
|
|
28
|
-
* Custom error class for sender verification errors
|
|
13
|
+
* Custom error class for sender verification errors.
|
|
14
|
+
*
|
|
15
|
+
* Uses native ES2022 `Error.cause` for error chaining — read the underlying
|
|
16
|
+
* error via `error.cause`. Structured fields (senderId, details, etc.) live
|
|
17
|
+
* on `error.context` since 2.0.0.
|
|
29
18
|
*/
|
|
30
19
|
class SenderVerificationError extends Error {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
code;
|
|
21
|
+
context;
|
|
22
|
+
constructor(message, options) {
|
|
23
|
+
super(message, options?.cause ? { cause: options.cause } : undefined);
|
|
35
24
|
this.name = 'SenderVerificationError';
|
|
36
|
-
|
|
25
|
+
this.code = options?.code ?? 'SENDER_VERIFICATION_ERROR';
|
|
26
|
+
if (options?.context !== undefined) {
|
|
27
|
+
this.context = options.context;
|
|
28
|
+
}
|
|
29
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
37
30
|
}
|
|
38
31
|
}
|
|
39
32
|
exports.SenderVerificationError = SenderVerificationError;
|
|
40
33
|
/**
|
|
41
|
-
* Error handling wrapper
|
|
34
|
+
* Error handling wrapper — converts arbitrary errors to a
|
|
35
|
+
* `SenderIdentityResult<never>` envelope. Reads `error.code` (now a string
|
|
36
|
+
* literal under the new union) to populate `errors`.
|
|
42
37
|
*/
|
|
43
38
|
function handleSenderError(error) {
|
|
44
39
|
if (error instanceof SenderVerificationError) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { SenderIdentityVerification } from './SenderIdentityVerification.js';
|
|
2
2
|
export { SenderIdentityConfig, loadConfigFromEnv } from './config.js';
|
|
3
|
-
export { SenderVerificationError,
|
|
3
|
+
export { SenderVerificationError, handleSenderError } from './errors.js';
|
|
4
|
+
export type { SenderVerificationErrorCode, SenderVerificationErrorOptions } from './errors.js';
|
|
4
5
|
export { SenderIdentity, SenderStatus, EmailProvider, CreateSenderInput, UpdateSenderInput, VerificationResult, ComplianceCheckResult, ListSendersOptions, SenderIdentityResult, DomainVerificationStatus, IEmailDomainVerification } from './types.js';
|
|
5
6
|
export { getManualInstructions, isManualVerificationProvider } from './manual-instructions.js';
|
|
6
7
|
export type { ManualVerificationInstruction } from './manual-instructions.js';
|
package/dist/index.js
CHANGED
|
@@ -7,14 +7,13 @@ The client may use and modify this code *only within the scope of the project it
|
|
|
7
7
|
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.isManualVerificationProvider = exports.getManualInstructions = exports.EmailProvider = exports.SenderStatus = exports.handleSenderError = exports.
|
|
10
|
+
exports.isManualVerificationProvider = exports.getManualInstructions = exports.EmailProvider = exports.SenderStatus = exports.handleSenderError = exports.SenderVerificationError = exports.loadConfigFromEnv = exports.SenderIdentityVerification = void 0;
|
|
11
11
|
var SenderIdentityVerification_js_1 = require("./SenderIdentityVerification.js");
|
|
12
12
|
Object.defineProperty(exports, "SenderIdentityVerification", { enumerable: true, get: function () { return SenderIdentityVerification_js_1.SenderIdentityVerification; } });
|
|
13
13
|
var config_js_1 = require("./config.js");
|
|
14
14
|
Object.defineProperty(exports, "loadConfigFromEnv", { enumerable: true, get: function () { return config_js_1.loadConfigFromEnv; } });
|
|
15
15
|
var errors_js_1 = require("./errors.js");
|
|
16
16
|
Object.defineProperty(exports, "SenderVerificationError", { enumerable: true, get: function () { return errors_js_1.SenderVerificationError; } });
|
|
17
|
-
Object.defineProperty(exports, "SenderErrorCode", { enumerable: true, get: function () { return errors_js_1.SenderErrorCode; } });
|
|
18
17
|
Object.defineProperty(exports, "handleSenderError", { enumerable: true, get: function () { return errors_js_1.handleSenderError; } });
|
|
19
18
|
var types_js_1 = require("./types.js");
|
|
20
19
|
Object.defineProperty(exports, "SenderStatus", { enumerable: true, get: function () { return types_js_1.SenderStatus; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bernierllc/sender-identity-verification",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Individual sender email address verification service for email production compliance",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"author": "Bernier LLC",
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@bernierllc/email-sender": "5.7.0",
|
|
23
22
|
"@bernierllc/crypto-utils": "1.4.0",
|
|
23
|
+
"@bernierllc/email-sender": "5.7.0",
|
|
24
24
|
"@bernierllc/email-sender-manager": "1.6.0",
|
|
25
25
|
"@bernierllc/logger": "1.7.0",
|
|
26
26
|
"@bernierllc/neverhub-adapter": "0.4.0",
|
package/src/errors.ts
CHANGED
|
@@ -9,37 +9,63 @@ Redistribution or use in other products or commercial offerings is not permitted
|
|
|
9
9
|
import { SenderIdentityResult } from './types.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Typed error code union for sender-identity-verification errors.
|
|
13
|
+
*
|
|
14
|
+
* Replaces the previous `SenderErrorCode` enum (removed in 2.0.0).
|
|
15
|
+
* Consumers should use the string literal directly, e.g. `'SENDER_NOT_FOUND'`.
|
|
13
16
|
*/
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
export type SenderVerificationErrorCode =
|
|
18
|
+
| 'SENDER_VERIFICATION_ERROR'
|
|
19
|
+
| 'SENDER_NOT_FOUND'
|
|
20
|
+
| 'SENDER_ALREADY_EXISTS'
|
|
21
|
+
| 'SENDER_LOCKED'
|
|
22
|
+
| 'VERIFICATION_EXPIRED'
|
|
23
|
+
| 'VERIFICATION_FAILED'
|
|
24
|
+
| 'DOMAIN_NOT_VERIFIED'
|
|
25
|
+
| 'PROVIDER_ERROR'
|
|
26
|
+
| 'INVALID_EMAIL'
|
|
27
|
+
| 'RATE_LIMIT_EXCEEDED';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Options bag accepted by `SenderVerificationError`.
|
|
31
|
+
*
|
|
32
|
+
* - `cause`: chained underlying error (ES2022 Error.cause).
|
|
33
|
+
* - `code`: a typed error code from {@link SenderVerificationErrorCode}.
|
|
34
|
+
* - `context`: arbitrary structured context — senderId/details/etc.
|
|
35
|
+
* The legacy `details` ctor argument is now stored under `context.details`.
|
|
36
|
+
*/
|
|
37
|
+
export interface SenderVerificationErrorOptions {
|
|
38
|
+
cause?: Error;
|
|
39
|
+
code?: SenderVerificationErrorCode;
|
|
40
|
+
context?: Record<string, unknown>;
|
|
24
41
|
}
|
|
25
42
|
|
|
26
43
|
/**
|
|
27
|
-
* Custom error class for sender verification errors
|
|
44
|
+
* Custom error class for sender verification errors.
|
|
45
|
+
*
|
|
46
|
+
* Uses native ES2022 `Error.cause` for error chaining — read the underlying
|
|
47
|
+
* error via `error.cause`. Structured fields (senderId, details, etc.) live
|
|
48
|
+
* on `error.context` since 2.0.0.
|
|
28
49
|
*/
|
|
29
50
|
export class SenderVerificationError extends Error {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
super(message);
|
|
51
|
+
public readonly code: SenderVerificationErrorCode;
|
|
52
|
+
public readonly context?: Record<string, unknown>;
|
|
53
|
+
|
|
54
|
+
constructor(message: string, options?: SenderVerificationErrorOptions) {
|
|
55
|
+
super(message, options?.cause ? { cause: options.cause } : undefined);
|
|
36
56
|
this.name = 'SenderVerificationError';
|
|
37
|
-
|
|
57
|
+
this.code = options?.code ?? 'SENDER_VERIFICATION_ERROR';
|
|
58
|
+
if (options?.context !== undefined) {
|
|
59
|
+
this.context = options.context;
|
|
60
|
+
}
|
|
61
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
38
62
|
}
|
|
39
63
|
}
|
|
40
64
|
|
|
41
65
|
/**
|
|
42
|
-
* Error handling wrapper
|
|
66
|
+
* Error handling wrapper — converts arbitrary errors to a
|
|
67
|
+
* `SenderIdentityResult<never>` envelope. Reads `error.code` (now a string
|
|
68
|
+
* literal under the new union) to populate `errors`.
|
|
43
69
|
*/
|
|
44
70
|
export function handleSenderError(error: unknown): SenderIdentityResult<never> {
|
|
45
71
|
if (error instanceof SenderVerificationError) {
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,14 @@ Redistribution or use in other products or commercial offerings is not permitted
|
|
|
8
8
|
|
|
9
9
|
export { SenderIdentityVerification } from './SenderIdentityVerification.js';
|
|
10
10
|
export { SenderIdentityConfig, loadConfigFromEnv } from './config.js';
|
|
11
|
-
export {
|
|
11
|
+
export {
|
|
12
|
+
SenderVerificationError,
|
|
13
|
+
handleSenderError
|
|
14
|
+
} from './errors.js';
|
|
15
|
+
export type {
|
|
16
|
+
SenderVerificationErrorCode,
|
|
17
|
+
SenderVerificationErrorOptions
|
|
18
|
+
} from './errors.js';
|
|
12
19
|
export {
|
|
13
20
|
SenderIdentity,
|
|
14
21
|
SenderStatus,
|