@geekmidas/emailkit 10.0.0-alpha.99 → 10.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 +42 -0
- package/dist/client-BkN5BGeJ.mjs +58 -0
- package/dist/client-BkN5BGeJ.mjs.map +1 -0
- package/dist/client-BrzAoy26.d.mts +21 -0
- package/dist/client-BrzAoy26.d.mts.map +1 -0
- package/dist/client-CGKPzbG7.d.cts +21 -0
- package/dist/client-CGKPzbG7.d.cts.map +1 -0
- package/dist/client-sZNHPYYg.cjs +92 -0
- package/dist/client-sZNHPYYg.cjs.map +1 -0
- package/dist/client.cjs +3 -124
- package/dist/client.d.cts +3 -23
- package/dist/client.d.mts +3 -23
- package/dist/client.mjs +2 -99
- package/dist/index.cjs +3 -9
- package/dist/index.d.cts +3 -5
- package/dist/index.d.mts +3 -5
- package/dist/index.mjs +3 -4
- package/dist/types-CLVcanCB.d.cts +83 -0
- package/dist/types-CLVcanCB.d.cts.map +1 -0
- package/dist/types-FrE6exSX.d.mts +83 -0
- package/dist/types-FrE6exSX.d.mts.map +1 -0
- package/dist/types.d.cts +2 -88
- package/dist/types.d.mts +2 -88
- package/dist/types.mjs +0 -1
- package/package.json +9 -25
- package/src/__tests__/client.spec.ts +372 -0
- package/src/__tests__/client.spec.tsx +185 -0
- package/src/client.ts +90 -0
- package/src/index.ts +11 -0
- package/src/types.ts +99 -0
- package/tsconfig.json +10 -0
- package/dist/client.cjs.map +0 -1
- package/dist/client.d.cts.map +0 -1
- package/dist/client.d.mts.map +0 -1
- package/dist/client.mjs.map +0 -1
- package/dist/errors.cjs +0 -53
- package/dist/errors.cjs.map +0 -1
- package/dist/errors.d.cts +0 -39
- package/dist/errors.d.cts.map +0 -1
- package/dist/errors.d.mts +0 -39
- package/dist/errors.d.mts.map +0 -1
- package/dist/errors.mjs +0 -50
- package/dist/errors.mjs.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts.map +0 -1
- package/dist/url.cjs +0 -61
- package/dist/url.cjs.map +0 -1
- package/dist/url.d.cts +0 -16
- package/dist/url.d.cts.map +0 -1
- package/dist/url.d.mts +0 -16
- package/dist/url.d.mts.map +0 -1
- package/dist/url.mjs +0 -60
- package/dist/url.mjs.map +0 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Address } from "nodemailer/lib/mailer";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
interface EmailOptions {
|
|
6
|
+
from: string | Address;
|
|
7
|
+
to: string | string[] | Address[];
|
|
8
|
+
cc?: string | string[] | Address[];
|
|
9
|
+
bcc?: string | string[] | Address[];
|
|
10
|
+
subject: string;
|
|
11
|
+
replyTo?: string | Address;
|
|
12
|
+
attachments?: Attachment[];
|
|
13
|
+
}
|
|
14
|
+
interface Attachment {
|
|
15
|
+
filename: string;
|
|
16
|
+
content?: string | Buffer;
|
|
17
|
+
path?: string;
|
|
18
|
+
contentType?: string;
|
|
19
|
+
cid?: string;
|
|
20
|
+
}
|
|
21
|
+
interface PlainEmailOptions extends EmailOptions {
|
|
22
|
+
text?: string;
|
|
23
|
+
html?: string;
|
|
24
|
+
}
|
|
25
|
+
type SendOptions = Omit<PlainEmailOptions, 'from'> & {
|
|
26
|
+
from?: string | Address;
|
|
27
|
+
};
|
|
28
|
+
interface SMTPConfig {
|
|
29
|
+
host: string;
|
|
30
|
+
port: number;
|
|
31
|
+
secure?: boolean;
|
|
32
|
+
auth?: {
|
|
33
|
+
user: string;
|
|
34
|
+
pass: string;
|
|
35
|
+
};
|
|
36
|
+
tls?: {
|
|
37
|
+
rejectUnauthorized?: boolean;
|
|
38
|
+
servername?: string;
|
|
39
|
+
};
|
|
40
|
+
pool?: boolean;
|
|
41
|
+
maxConnections?: number;
|
|
42
|
+
maxMessages?: number;
|
|
43
|
+
rateLimit?: number;
|
|
44
|
+
logger?: boolean;
|
|
45
|
+
debug?: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface SendResult {
|
|
48
|
+
messageId: string;
|
|
49
|
+
accepted: string[];
|
|
50
|
+
rejected: string[];
|
|
51
|
+
response: string;
|
|
52
|
+
}
|
|
53
|
+
type EmailTemplate<T = any> = (props: T) => ReactElement;
|
|
54
|
+
type TemplateProps<T> = T extends EmailTemplate<infer P> ? P : never;
|
|
55
|
+
type TemplateRecord = Record<string, EmailTemplate<any>>;
|
|
56
|
+
type TemplateNames<T extends TemplateRecord> = keyof T;
|
|
57
|
+
type TemplatePropsFor<T extends TemplateRecord, K extends TemplateNames<T>> = TemplateProps<T[K]>;
|
|
58
|
+
interface EmailClientConfig<T extends TemplateRecord = TemplateRecord> {
|
|
59
|
+
smtp: SMTPConfig;
|
|
60
|
+
templates: T;
|
|
61
|
+
dkim?: {
|
|
62
|
+
domainName: string;
|
|
63
|
+
keySelector: string;
|
|
64
|
+
privateKey: string;
|
|
65
|
+
};
|
|
66
|
+
defaults: {
|
|
67
|
+
from?: string | Address;
|
|
68
|
+
replyTo?: string | Address;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
interface EmailClient<T extends TemplateRecord = TemplateRecord> {
|
|
72
|
+
send(options: SendOptions): Promise<SendResult>;
|
|
73
|
+
sendTemplate<K extends TemplateNames<T>>(template: K, options: SendOptions & {
|
|
74
|
+
props: TemplatePropsFor<T, K>;
|
|
75
|
+
}): Promise<SendResult>;
|
|
76
|
+
verify(): Promise<boolean>;
|
|
77
|
+
close(): Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=types.d.ts.map
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
export { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplateProps, TemplatePropsFor, TemplateRecord };
|
|
83
|
+
//# sourceMappingURL=types-CLVcanCB.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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OAAA,EAEb,WAFa,GAAA;IACZ,KAAA,EAEF,gBAFE,CAEe,CAFf,EAEkB,CAFlB,CAAA;EAAC,CAAA,CAAA,EAIT,OAHO,CAGC,UAHD,CAAA;EAAW,MACK,EAAA,EAGhB,OAHgB,CAAA,OAAA,CAAA;EAAC,KAAE,EAAA,EAIpB,OAJoB,CAAA,IAAA,CAAA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Address } from "nodemailer/lib/mailer";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
interface EmailOptions {
|
|
6
|
+
from: string | Address;
|
|
7
|
+
to: string | string[] | Address[];
|
|
8
|
+
cc?: string | string[] | Address[];
|
|
9
|
+
bcc?: string | string[] | Address[];
|
|
10
|
+
subject: string;
|
|
11
|
+
replyTo?: string | Address;
|
|
12
|
+
attachments?: Attachment[];
|
|
13
|
+
}
|
|
14
|
+
interface Attachment {
|
|
15
|
+
filename: string;
|
|
16
|
+
content?: string | Buffer;
|
|
17
|
+
path?: string;
|
|
18
|
+
contentType?: string;
|
|
19
|
+
cid?: string;
|
|
20
|
+
}
|
|
21
|
+
interface PlainEmailOptions extends EmailOptions {
|
|
22
|
+
text?: string;
|
|
23
|
+
html?: string;
|
|
24
|
+
}
|
|
25
|
+
type SendOptions = Omit<PlainEmailOptions, 'from'> & {
|
|
26
|
+
from?: string | Address;
|
|
27
|
+
};
|
|
28
|
+
interface SMTPConfig {
|
|
29
|
+
host: string;
|
|
30
|
+
port: number;
|
|
31
|
+
secure?: boolean;
|
|
32
|
+
auth?: {
|
|
33
|
+
user: string;
|
|
34
|
+
pass: string;
|
|
35
|
+
};
|
|
36
|
+
tls?: {
|
|
37
|
+
rejectUnauthorized?: boolean;
|
|
38
|
+
servername?: string;
|
|
39
|
+
};
|
|
40
|
+
pool?: boolean;
|
|
41
|
+
maxConnections?: number;
|
|
42
|
+
maxMessages?: number;
|
|
43
|
+
rateLimit?: number;
|
|
44
|
+
logger?: boolean;
|
|
45
|
+
debug?: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface SendResult {
|
|
48
|
+
messageId: string;
|
|
49
|
+
accepted: string[];
|
|
50
|
+
rejected: string[];
|
|
51
|
+
response: string;
|
|
52
|
+
}
|
|
53
|
+
type EmailTemplate<T = any> = (props: T) => ReactElement;
|
|
54
|
+
type TemplateProps<T> = T extends EmailTemplate<infer P> ? P : never;
|
|
55
|
+
type TemplateRecord = Record<string, EmailTemplate<any>>;
|
|
56
|
+
type TemplateNames<T extends TemplateRecord> = keyof T;
|
|
57
|
+
type TemplatePropsFor<T extends TemplateRecord, K extends TemplateNames<T>> = TemplateProps<T[K]>;
|
|
58
|
+
interface EmailClientConfig<T extends TemplateRecord = TemplateRecord> {
|
|
59
|
+
smtp: SMTPConfig;
|
|
60
|
+
templates: T;
|
|
61
|
+
dkim?: {
|
|
62
|
+
domainName: string;
|
|
63
|
+
keySelector: string;
|
|
64
|
+
privateKey: string;
|
|
65
|
+
};
|
|
66
|
+
defaults: {
|
|
67
|
+
from?: string | Address;
|
|
68
|
+
replyTo?: string | Address;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
interface EmailClient<T extends TemplateRecord = TemplateRecord> {
|
|
72
|
+
send(options: SendOptions): Promise<SendResult>;
|
|
73
|
+
sendTemplate<K extends TemplateNames<T>>(template: K, options: SendOptions & {
|
|
74
|
+
props: TemplatePropsFor<T, K>;
|
|
75
|
+
}): Promise<SendResult>;
|
|
76
|
+
verify(): Promise<boolean>;
|
|
77
|
+
close(): Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=types.d.ts.map
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
export { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplateProps, TemplatePropsFor, TemplateRecord };
|
|
83
|
+
//# sourceMappingURL=types-FrE6ex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Ad,CAAA,CAAA,CAAA,QAAA,EACZ,CADY,EAAA,OAAA,EAEb,WAFa,GAAA;IACZ,KAAA,EAEF,gBAFE,CAEe,CAFf,EAEkB,CAFlB,CAAA;EAAC,CAAA,CAAA,EAIT,OAHO,CAGC,UAHD,CAAA;EAAW,MACK,EAAA,EAGhB,OAHgB,CAAA,OAAA,CAAA;EAAC,KAAE,EAAA,EAIpB,OAJoB,CAAA,IAAA,CAAA"}
|
package/dist/types.d.cts
CHANGED
|
@@ -1,88 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/types.d.ts
|
|
4
|
-
type Address = Mail.Address;
|
|
5
|
-
export interface EmailOptions {
|
|
6
|
-
from: string | Address;
|
|
7
|
-
to: string | string[] | Address[];
|
|
8
|
-
cc?: string | string[] | Address[];
|
|
9
|
-
bcc?: string | string[] | Address[];
|
|
10
|
-
subject: string;
|
|
11
|
-
replyTo?: string | Address;
|
|
12
|
-
attachments?: Attachment[];
|
|
13
|
-
}
|
|
14
|
-
export interface Attachment {
|
|
15
|
-
filename: string;
|
|
16
|
-
content?: string | Buffer;
|
|
17
|
-
path?: string;
|
|
18
|
-
contentType?: string;
|
|
19
|
-
cid?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface PlainEmailOptions extends EmailOptions {
|
|
22
|
-
text?: string;
|
|
23
|
-
html?: string;
|
|
24
|
-
}
|
|
25
|
-
export type SendOptions = Omit<PlainEmailOptions, 'from'> & {
|
|
26
|
-
from?: string | Address;
|
|
27
|
-
};
|
|
28
|
-
export interface SMTPConfig {
|
|
29
|
-
host: string;
|
|
30
|
-
port: number;
|
|
31
|
-
secure?: boolean;
|
|
32
|
-
auth?: {
|
|
33
|
-
user: string;
|
|
34
|
-
pass: string;
|
|
35
|
-
};
|
|
36
|
-
tls?: {
|
|
37
|
-
rejectUnauthorized?: boolean;
|
|
38
|
-
servername?: string;
|
|
39
|
-
};
|
|
40
|
-
pool?: boolean;
|
|
41
|
-
maxConnections?: number;
|
|
42
|
-
maxMessages?: number;
|
|
43
|
-
rateLimit?: number;
|
|
44
|
-
logger?: boolean;
|
|
45
|
-
debug?: boolean;
|
|
46
|
-
}
|
|
47
|
-
export interface SendResult {
|
|
48
|
-
messageId: string;
|
|
49
|
-
accepted: string[];
|
|
50
|
-
rejected: string[];
|
|
51
|
-
/**
|
|
52
|
-
* The transport's reply, where it made one.
|
|
53
|
-
*
|
|
54
|
-
* Optional because nodemailer types it that way: not every transport answers
|
|
55
|
-
* with a response line, and the previous `string` was a promise this could
|
|
56
|
-
* not keep. Defaulting it to `''` would have kept the shape by inventing a
|
|
57
|
-
* reply that never arrived.
|
|
58
|
-
*/
|
|
59
|
-
response?: string;
|
|
60
|
-
}
|
|
61
|
-
export type EmailTemplate<T = any> = (props: T) => ReactElement;
|
|
62
|
-
export type TemplateProps<T> = T extends EmailTemplate<infer P> ? P : never;
|
|
63
|
-
export type TemplateRecord = Record<string, EmailTemplate<any>>;
|
|
64
|
-
export type TemplateNames<T extends TemplateRecord> = keyof T;
|
|
65
|
-
export type TemplatePropsFor<T extends TemplateRecord, K extends TemplateNames<T>> = TemplateProps<T[K]>;
|
|
66
|
-
export interface EmailClientConfig<T extends TemplateRecord = TemplateRecord> {
|
|
67
|
-
smtp: SMTPConfig;
|
|
68
|
-
templates: T;
|
|
69
|
-
dkim?: {
|
|
70
|
-
domainName: string;
|
|
71
|
-
keySelector: string;
|
|
72
|
-
privateKey: string;
|
|
73
|
-
};
|
|
74
|
-
defaults: {
|
|
75
|
-
from?: string | Address;
|
|
76
|
-
replyTo?: string | Address;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
export interface EmailClient<T extends TemplateRecord = TemplateRecord> {
|
|
80
|
-
send(options: SendOptions): Promise<SendResult>;
|
|
81
|
-
sendTemplate<K extends TemplateNames<T>>(template: K, options: SendOptions & {
|
|
82
|
-
props: TemplatePropsFor<T, K>;
|
|
83
|
-
}): Promise<SendResult>;
|
|
84
|
-
verify(): Promise<boolean>;
|
|
85
|
-
close(): Promise<void>;
|
|
86
|
-
}
|
|
87
|
-
//#endregion
|
|
88
|
-
//# sourceMappingURL=types.d.cts.map
|
|
1
|
+
import { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplateProps, TemplatePropsFor, TemplateRecord } from "./types-CLVcanCB.cjs";
|
|
2
|
+
export { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplateProps, TemplatePropsFor, TemplateRecord };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,88 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/types.d.ts
|
|
4
|
-
type Address = Mail.Address;
|
|
5
|
-
export interface EmailOptions {
|
|
6
|
-
from: string | Address;
|
|
7
|
-
to: string | string[] | Address[];
|
|
8
|
-
cc?: string | string[] | Address[];
|
|
9
|
-
bcc?: string | string[] | Address[];
|
|
10
|
-
subject: string;
|
|
11
|
-
replyTo?: string | Address;
|
|
12
|
-
attachments?: Attachment[];
|
|
13
|
-
}
|
|
14
|
-
export interface Attachment {
|
|
15
|
-
filename: string;
|
|
16
|
-
content?: string | Buffer;
|
|
17
|
-
path?: string;
|
|
18
|
-
contentType?: string;
|
|
19
|
-
cid?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface PlainEmailOptions extends EmailOptions {
|
|
22
|
-
text?: string;
|
|
23
|
-
html?: string;
|
|
24
|
-
}
|
|
25
|
-
export type SendOptions = Omit<PlainEmailOptions, 'from'> & {
|
|
26
|
-
from?: string | Address;
|
|
27
|
-
};
|
|
28
|
-
export interface SMTPConfig {
|
|
29
|
-
host: string;
|
|
30
|
-
port: number;
|
|
31
|
-
secure?: boolean;
|
|
32
|
-
auth?: {
|
|
33
|
-
user: string;
|
|
34
|
-
pass: string;
|
|
35
|
-
};
|
|
36
|
-
tls?: {
|
|
37
|
-
rejectUnauthorized?: boolean;
|
|
38
|
-
servername?: string;
|
|
39
|
-
};
|
|
40
|
-
pool?: boolean;
|
|
41
|
-
maxConnections?: number;
|
|
42
|
-
maxMessages?: number;
|
|
43
|
-
rateLimit?: number;
|
|
44
|
-
logger?: boolean;
|
|
45
|
-
debug?: boolean;
|
|
46
|
-
}
|
|
47
|
-
export interface SendResult {
|
|
48
|
-
messageId: string;
|
|
49
|
-
accepted: string[];
|
|
50
|
-
rejected: string[];
|
|
51
|
-
/**
|
|
52
|
-
* The transport's reply, where it made one.
|
|
53
|
-
*
|
|
54
|
-
* Optional because nodemailer types it that way: not every transport answers
|
|
55
|
-
* with a response line, and the previous `string` was a promise this could
|
|
56
|
-
* not keep. Defaulting it to `''` would have kept the shape by inventing a
|
|
57
|
-
* reply that never arrived.
|
|
58
|
-
*/
|
|
59
|
-
response?: string;
|
|
60
|
-
}
|
|
61
|
-
export type EmailTemplate<T = any> = (props: T) => ReactElement;
|
|
62
|
-
export type TemplateProps<T> = T extends EmailTemplate<infer P> ? P : never;
|
|
63
|
-
export type TemplateRecord = Record<string, EmailTemplate<any>>;
|
|
64
|
-
export type TemplateNames<T extends TemplateRecord> = keyof T;
|
|
65
|
-
export type TemplatePropsFor<T extends TemplateRecord, K extends TemplateNames<T>> = TemplateProps<T[K]>;
|
|
66
|
-
export interface EmailClientConfig<T extends TemplateRecord = TemplateRecord> {
|
|
67
|
-
smtp: SMTPConfig;
|
|
68
|
-
templates: T;
|
|
69
|
-
dkim?: {
|
|
70
|
-
domainName: string;
|
|
71
|
-
keySelector: string;
|
|
72
|
-
privateKey: string;
|
|
73
|
-
};
|
|
74
|
-
defaults: {
|
|
75
|
-
from?: string | Address;
|
|
76
|
-
replyTo?: string | Address;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
export interface EmailClient<T extends TemplateRecord = TemplateRecord> {
|
|
80
|
-
send(options: SendOptions): Promise<SendResult>;
|
|
81
|
-
sendTemplate<K extends TemplateNames<T>>(template: K, options: SendOptions & {
|
|
82
|
-
props: TemplatePropsFor<T, K>;
|
|
83
|
-
}): Promise<SendResult>;
|
|
84
|
-
verify(): Promise<boolean>;
|
|
85
|
-
close(): Promise<void>;
|
|
86
|
-
}
|
|
87
|
-
//#endregion
|
|
88
|
-
//# sourceMappingURL=types.d.mts.map
|
|
1
|
+
import { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplateProps, TemplatePropsFor, TemplateRecord } from "./types-FrE6exSX.mjs";
|
|
2
|
+
export { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplateProps, TemplatePropsFor, TemplateRecord };
|
package/dist/types.mjs
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/emailkit",
|
|
3
|
-
"version": "10.0.0
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Type-safe email client with SMTP support and React templates",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"import": {
|
|
10
|
-
"types": "./dist/index.d.mts",
|
|
11
|
-
"default": "./dist/index.mjs"
|
|
12
|
-
},
|
|
13
|
-
"require": {
|
|
14
|
-
"types": "./dist/index.d.cts",
|
|
15
|
-
"default": "./dist/index.cjs"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
8
|
"./*": {
|
|
19
9
|
"import": {
|
|
20
10
|
"types": "./dist/*.d.mts",
|
|
@@ -26,9 +16,6 @@
|
|
|
26
16
|
}
|
|
27
17
|
}
|
|
28
18
|
},
|
|
29
|
-
"files": [
|
|
30
|
-
"dist"
|
|
31
|
-
],
|
|
32
19
|
"repository": {
|
|
33
20
|
"type": "git",
|
|
34
21
|
"url": "https://github.com/geekmidas/toolbox"
|
|
@@ -38,25 +25,22 @@
|
|
|
38
25
|
"access": "public"
|
|
39
26
|
},
|
|
40
27
|
"dependencies": {
|
|
41
|
-
"
|
|
42
|
-
"nodemailer": "~10.0.10"
|
|
28
|
+
"nodemailer": "^6.9.7"
|
|
43
29
|
},
|
|
44
30
|
"devDependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"@types/
|
|
47
|
-
"@types/react": "
|
|
48
|
-
"
|
|
49
|
-
"typescript": "
|
|
31
|
+
"@types/nodemailer": "^6.4.14",
|
|
32
|
+
"@types/react": "^18.2.0",
|
|
33
|
+
"@types/react-dom": "^18.2.0",
|
|
34
|
+
"tsdown": "^0.2.17",
|
|
35
|
+
"typescript": "^5.8.2",
|
|
36
|
+
"vitest": "^2.1.8"
|
|
50
37
|
},
|
|
51
38
|
"peerDependencies": {
|
|
52
39
|
"react": ">=18.0.0",
|
|
53
40
|
"react-dom": ">=18.0.0",
|
|
54
|
-
"@react-email/components": "
|
|
41
|
+
"@react-email/components": "~1.0.1"
|
|
55
42
|
},
|
|
56
43
|
"engines": {
|
|
57
44
|
"node": ">=22.0.0"
|
|
58
|
-
},
|
|
59
|
-
"scripts": {
|
|
60
|
-
"build": "tsdown --config ../../tsdown.config.ts --filter ."
|
|
61
45
|
}
|
|
62
46
|
}
|