@samva/email-sdk 0.9.0 → 0.11.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/README.md +7 -3
- package/dist/index.d.mts +3 -5
- package/dist/index.mjs +4 -6
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# `@samva/email-sdk`
|
|
2
2
|
|
|
3
3
|
Provider-owned Samva community adapter for
|
|
4
|
-
[Email SDK](https://email-sdk.dev). It targets `@opencoredev/email-sdk@^
|
|
5
|
-
and `samva@^0.
|
|
4
|
+
[Email SDK](https://email-sdk.dev). It targets `@opencoredev/email-sdk@^3.0.1`
|
|
5
|
+
and `samva@^0.27.0`.
|
|
6
6
|
|
|
7
7
|
This adapter is maintained by Samva as a community integration; it is not an
|
|
8
8
|
official built-in Email SDK adapter.
|
|
@@ -10,7 +10,7 @@ official built-in Email SDK adapter.
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
|
-
bun add @samva/email-sdk @opencoredev/email-sdk samva
|
|
13
|
+
bun add @samva/email-sdk @opencoredev/email-sdk@^3.0.1 samva
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Register the adapter
|
|
@@ -84,6 +84,10 @@ Successful sends return `{ adapter: "samva", id, raw }`. `raw` is the Samva
|
|
|
84
84
|
`MessageReceipt`, including its wait reason and skipped recipients. A queued
|
|
85
85
|
receipt is not a final delivery claim.
|
|
86
86
|
|
|
87
|
+
`FromAddressRequiredError` is reported as `delivery: "not_sent"` and is not
|
|
88
|
+
retryable. Configure a default sender or pass an explicit `from`; fallback can
|
|
89
|
+
then follow Email SDK's policy for a known rejection.
|
|
90
|
+
|
|
87
91
|
Unsupported or lossy input throws `EmailValidationError` without calling
|
|
88
92
|
Samva. API and transport failures become a redacted `EmailAdapterError` with
|
|
89
93
|
status and `x-request-id` when available. Retryability is enabled for statuses
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EmailAdapter, EmailPlugin } from "@opencoredev/email-sdk";
|
|
2
2
|
import { SamvaClient } from "samva";
|
|
3
|
-
//#region src/samva.d.ts
|
|
4
3
|
/** Factory options for the provider-owned Samva community adapter. */
|
|
5
4
|
type SamvaAdapterOptions = {
|
|
6
5
|
/** Samva API key. Required unless `client` is injected. */
|
|
@@ -19,9 +18,8 @@ type SamvaSendResult = Awaited<ReturnType<SamvaClient["email"]["send"]>>;
|
|
|
19
18
|
/** The literal Email SDK adapter type returned by {@link samva}. */
|
|
20
19
|
type SamvaEmailAdapter = EmailAdapter<"samva", SamvaClient, SamvaSendResult>;
|
|
21
20
|
/** Create an Email SDK adapter backed by the Samva Promise client. */
|
|
22
|
-
declare function samva(options: SamvaAdapterOptions): SamvaEmailAdapter;
|
|
21
|
+
export declare function samva(options: SamvaAdapterOptions): SamvaEmailAdapter;
|
|
23
22
|
/** Register a single Samva adapter through Email SDK's plugin interface. */
|
|
24
|
-
declare function samvaPlugin(options: SamvaAdapterOptions): EmailPlugin;
|
|
25
|
-
|
|
26
|
-
export { type SamvaAdapterOptions, type SamvaEmailAdapter, type SamvaSendResult, samva, samvaPlugin };
|
|
23
|
+
export declare function samvaPlugin(options: SamvaAdapterOptions): EmailPlugin;
|
|
24
|
+
export type { SamvaAdapterOptions, SamvaEmailAdapter, SamvaSendResult };
|
|
27
25
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { EmailAdapterError, EmailValidationError } from "@opencoredev/email-sdk";
|
|
2
2
|
import { createClient } from "samva";
|
|
3
|
-
|
|
3
|
+
// src/failures.ts
|
|
4
4
|
const knownNotSentTags = /* @__PURE__ */ new Set([
|
|
5
5
|
"ConflictError",
|
|
6
6
|
"DeliveryUnavailableError",
|
|
7
7
|
"EmailChannelError",
|
|
8
8
|
"FlagDisabledError",
|
|
9
9
|
"ForbiddenError",
|
|
10
|
+
"FromAddressRequiredError",
|
|
10
11
|
"OnboardingReviewRequiredError",
|
|
11
12
|
"PaymentRequiredError",
|
|
12
13
|
"RateLimitedError",
|
|
@@ -61,8 +62,7 @@ function toEmailAdapterError(error) {
|
|
|
61
62
|
delivery: deliveryOf(record)
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
//#region src/message.ts
|
|
65
|
+
// src/message.ts
|
|
66
66
|
const ordinaryEmail = /^[^\s@<>,]+@[^\s@<>,]+$/;
|
|
67
67
|
function validationError(field, detail) {
|
|
68
68
|
return new EmailValidationError(`Samva cannot send email with ${field}: ${detail}.`);
|
|
@@ -183,8 +183,7 @@ async function toSamvaMessage(message) {
|
|
|
183
183
|
...attachments.length === 0 ? {} : { attachments }
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
-
|
|
187
|
-
//#region src/samva.ts
|
|
186
|
+
// src/samva.ts
|
|
188
187
|
const capabilities = {
|
|
189
188
|
repeatedHeaders: false,
|
|
190
189
|
idempotency: "native",
|
|
@@ -247,7 +246,6 @@ function samvaPlugin(options) {
|
|
|
247
246
|
adapters: [samva(options)]
|
|
248
247
|
};
|
|
249
248
|
}
|
|
250
|
-
//#endregion
|
|
251
249
|
export { samva, samvaPlugin };
|
|
252
250
|
|
|
253
251
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@samva/email-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Samva community adapter for Email SDK.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -39,19 +39,19 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
|
-
"build": "tsdown src/index.ts --format esm --dts --
|
|
42
|
+
"build": "tsdown src/index.ts --format esm --dts --deps.never-bundle samva --deps.never-bundle @opencoredev/email-sdk",
|
|
43
43
|
"prepack": "bun run build",
|
|
44
|
-
"dev": "tsdown src/index.ts --format esm --dts --watch --
|
|
44
|
+
"dev": "tsdown src/index.ts --format esm --dts --watch --deps.never-bundle samva --deps.never-bundle @opencoredev/email-sdk",
|
|
45
45
|
"typecheck": "tsgo --noEmit",
|
|
46
46
|
"test": "vitest run --config vitest.config.ts"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@opencoredev/email-sdk": "^
|
|
50
|
-
"samva": "0.
|
|
49
|
+
"@opencoredev/email-sdk": "^3.0.1",
|
|
50
|
+
"samva": "0.27.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@opencoredev/email-sdk": "^
|
|
54
|
-
"samva": "^0.
|
|
53
|
+
"@opencoredev/email-sdk": "^3.0.1",
|
|
54
|
+
"samva": "^0.27.0"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=22"
|