@geekmidas/emailkit 0.0.1 → 0.0.3
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 +0 -1
- package/dist/__tests__/client.spec.cjs +38 -13106
- package/dist/__tests__/client.spec.mjs +15 -13087
- package/dist/{client-7k6es7pg.cjs → client-Dc4Thg_P.cjs} +31 -3
- package/dist/client.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/package.json +1 -1
- package/src/client.ts +3 -5
- package/src/types.ts +7 -4
- package/dist/chunk-CUT6urMc.cjs +0 -30
- package/dist/magic-string.es-BGRTPV9O.mjs +0 -1014
- package/dist/magic-string.es-BrLHy2bw.cjs +0 -1015
- package/dist/templates.cjs +0 -176
- package/dist/templates.mjs +0 -171
- package/src/templates.tsx +0 -182
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
const nodemailer = __toESM(require("nodemailer"));
|
|
25
|
+
const react_dom_server = __toESM(require("react-dom/server"));
|
|
4
26
|
|
|
5
27
|
//#region src/client.ts
|
|
6
28
|
var SMTPClient = class {
|
|
@@ -60,6 +82,12 @@ Object.defineProperty(exports, 'SMTPClient', {
|
|
|
60
82
|
return SMTPClient;
|
|
61
83
|
}
|
|
62
84
|
});
|
|
85
|
+
Object.defineProperty(exports, '__toESM', {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () {
|
|
88
|
+
return __toESM;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
63
91
|
Object.defineProperty(exports, 'createEmailClient', {
|
|
64
92
|
enumerable: true,
|
|
65
93
|
get: function () {
|
package/dist/client.cjs
CHANGED
package/dist/index.cjs
CHANGED
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -4,16 +4,14 @@ import type {
|
|
|
4
4
|
EmailClient,
|
|
5
5
|
EmailClientConfig,
|
|
6
6
|
EmailOptions,
|
|
7
|
-
|
|
7
|
+
SendOptions,
|
|
8
8
|
SendResult,
|
|
9
9
|
TemplateNames,
|
|
10
10
|
TemplatePropsFor,
|
|
11
11
|
TemplateRecord,
|
|
12
12
|
} from './types';
|
|
13
13
|
|
|
14
|
-
export class SMTPClient<T extends TemplateRecord>
|
|
15
|
-
implements EmailClient<T>
|
|
16
|
-
{
|
|
14
|
+
export class SMTPClient<T extends TemplateRecord> implements EmailClient<T> {
|
|
17
15
|
private transporter: Transporter;
|
|
18
16
|
private config: EmailClientConfig<T>;
|
|
19
17
|
|
|
@@ -22,7 +20,7 @@ export class SMTPClient<T extends TemplateRecord>
|
|
|
22
20
|
this.transporter = nodemailer.createTransport(config.smtp as any);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
async send(options:
|
|
23
|
+
async send(options: SendOptions): Promise<SendResult> {
|
|
26
24
|
const mailOptions = {
|
|
27
25
|
...this.config.defaults,
|
|
28
26
|
...options,
|
package/src/types.ts
CHANGED
|
@@ -24,6 +24,9 @@ export interface PlainEmailOptions extends EmailOptions {
|
|
|
24
24
|
html?: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
export type SendOptions = Omit<PlainEmailOptions, 'from'> & {
|
|
28
|
+
from?: string | Address;
|
|
29
|
+
};
|
|
27
30
|
|
|
28
31
|
export interface SMTPConfig {
|
|
29
32
|
host: string;
|
|
@@ -45,7 +48,6 @@ export interface SMTPConfig {
|
|
|
45
48
|
debug?: boolean;
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
|
|
49
51
|
export interface SendResult {
|
|
50
52
|
messageId: string;
|
|
51
53
|
accepted: string[];
|
|
@@ -75,17 +77,18 @@ export type TemplatePropsFor<
|
|
|
75
77
|
export interface EmailClientConfig<T extends TemplateRecord = TemplateRecord> {
|
|
76
78
|
smtp: SMTPConfig;
|
|
77
79
|
templates: T;
|
|
78
|
-
defaults
|
|
80
|
+
defaults: {
|
|
79
81
|
from?: string | Address;
|
|
80
82
|
replyTo?: string | Address;
|
|
81
83
|
};
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
export interface EmailClient<T extends TemplateRecord = TemplateRecord> {
|
|
85
|
-
send(options:
|
|
87
|
+
send(options: SendOptions): Promise<SendResult>;
|
|
86
88
|
sendTemplate<K extends TemplateNames<T>>(
|
|
87
89
|
template: K,
|
|
88
|
-
options: Omit<EmailOptions, '
|
|
90
|
+
options: Omit<EmailOptions, 'from'> & {
|
|
91
|
+
from?: string | Address;
|
|
89
92
|
props: TemplatePropsFor<T, K>;
|
|
90
93
|
},
|
|
91
94
|
): Promise<SendResult>;
|
package/dist/chunk-CUT6urMc.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
|
|
25
|
-
Object.defineProperty(exports, '__toESM', {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return __toESM;
|
|
29
|
-
}
|
|
30
|
-
});
|