@geekmidas/emailkit 9.0.2 → 10.0.0-alpha.1
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/dist/{client-BrzAoy26.d.mts → client-LvoMlKEk.d.mts} +2 -2
- package/dist/{client-BrzAoy26.d.mts.map → client-LvoMlKEk.d.mts.map} +1 -1
- package/dist/client.d.mts +2 -2
- package/dist/errors-6difZDw0.cjs +68 -0
- package/dist/errors-6difZDw0.cjs.map +1 -0
- package/dist/errors-Ba3cEHPO.mjs +50 -0
- package/dist/errors-Ba3cEHPO.mjs.map +1 -0
- package/dist/errors-ZllQgZ9Y.d.mts +41 -0
- package/dist/errors-ZllQgZ9Y.d.mts.map +1 -0
- package/dist/errors-xJ88z_5r.d.cts +41 -0
- package/dist/errors-xJ88z_5r.d.cts.map +1 -0
- package/dist/errors.cjs +5 -0
- package/dist/errors.d.cts +2 -0
- package/dist/errors.d.mts +2 -0
- package/dist/errors.mjs +3 -0
- package/dist/index.cjs +7 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.mts +5 -3
- package/dist/index.mjs +3 -1
- package/dist/{types-FrE6exSX.d.mts → types-BE4Kh3y6.d.mts} +1 -1
- package/dist/{types-FrE6exSX.d.mts.map → types-BE4Kh3y6.d.mts.map} +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/url-B8QqBrMt.mjs +49 -0
- package/dist/url-B8QqBrMt.mjs.map +1 -0
- package/dist/url-Cd5VhxhW.d.mts +20 -0
- package/dist/url-Cd5VhxhW.d.mts.map +1 -0
- package/dist/url-Cf508-Ji.d.cts +20 -0
- package/dist/url-Cf508-Ji.d.cts.map +1 -0
- package/dist/url-GT3jLGq-.cjs +54 -0
- package/dist/url-GT3jLGq-.cjs.map +1 -0
- package/dist/url.cjs +4 -0
- package/dist/url.d.cts +3 -0
- package/dist/url.d.mts +3 -0
- package/dist/url.mjs +4 -0
- package/package.json +15 -4
- package/CHANGELOG.md +0 -40
- package/src/__tests__/client.spec.ts +0 -372
- package/src/__tests__/client.spec.tsx +0 -185
- package/src/client.ts +0 -90
- package/src/index.ts +0 -11
- package/src/types.ts +0 -99
- package/tsconfig.json +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmailClient, EmailClientConfig, SendOptions, SendResult, TemplateNames, TemplatePropsFor, TemplateRecord } from "./types-
|
|
1
|
+
import { EmailClient, EmailClientConfig, SendOptions, SendResult, TemplateNames, TemplatePropsFor, TemplateRecord } from "./types-BE4Kh3y6.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/client.d.ts
|
|
4
4
|
declare class SMTPClient<T extends TemplateRecord> implements EmailClient<T> {
|
|
@@ -18,4 +18,4 @@ declare function createEmailClient<T extends TemplateRecord>(config: EmailClient
|
|
|
18
18
|
|
|
19
19
|
//#endregion
|
|
20
20
|
export { SMTPClient, createEmailClient };
|
|
21
|
-
//# sourceMappingURL=client-
|
|
21
|
+
//# sourceMappingURL=client-LvoMlKEk.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-
|
|
1
|
+
{"version":3,"file":"client-LvoMlKEk.d.mts","names":[],"sources":["../src/client.ts"],"sourcesContent":[],"mappings":";;;cAYa,qBAAqB,2BAA2B,YAAY;;EAA5D,QAAA,MAAU;EAAA,WAAA,CAAA,MAAA,EAIF,iBAJE,CAIgB,CAJhB,CAAA;EAAA,IAAW,CAAA,OAAA,EASb,WATa,CAAA,EASC,OATD,CASS,UATT,CAAA;EAAc,YAAyB,CAAA,UAmC3C,aAnC2C,CAmC7B,CAnC6B,CAAA,CAAA,CAAA,QAAA,EAoC7D,CApC6D,EAAA,OAAA,EAqC9D,IArC8D,CAqCzD,WArCyD,EAAA,UAAA,CAAA,GAAA;IAIlC,KAAA,EAkC7B,gBAlC6B,CAkCZ,CAlCY,EAkCT,CAlCS,CAAA;EAAC,CAAA,CAAA,EAoCpC,OApCiB,CAoCT,UApCS,CAAA;EAAiB,MAKjB,CAAA,CAAA,EA8CJ,OA9CI,CAAA,OAAA,CAAA;EAAW,KAAW,CAAA,CAAA,EAuD3B,OAvD2B,CAAA,IAAA,CAAA;EAAU,gBAAlB,CAAA,CAAA,EA2Dd,aA3Dc,CA2DA,CA3DA,CAAA,EAAA;;AA0BL,iBAsCd,iBAtCc,CAAA,UAsCc,cAtCd,CAAA,CAAA,MAAA,EAuCrB,iBAvCqB,CAuCH,CAvCG,CAAA,CAAA,EAwC3B,UAxC2B,CAwChB,CAxCgB,CAAA"}
|
package/dist/client.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./types-
|
|
2
|
-
import { SMTPClient, createEmailClient } from "./client-
|
|
1
|
+
import "./types-BE4Kh3y6.mjs";
|
|
2
|
+
import { SMTPClient, createEmailClient } from "./client-LvoMlKEk.mjs";
|
|
3
3
|
export { SMTPClient, createEmailClient };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/errors.ts
|
|
3
|
+
/**
|
|
4
|
+
* Email URL errors.
|
|
5
|
+
*
|
|
6
|
+
* Every provider is reached over SMTP, so there are only two problems a URL can
|
|
7
|
+
* have: it is not a URL, or it names a scheme this transport cannot speak. Both
|
|
8
|
+
* carry the offending value as a field.
|
|
9
|
+
*
|
|
10
|
+
* Messages state the rule, which is constant, and never interpolate the value.
|
|
11
|
+
* An interpolated message cannot be matched on, reads differently every time it
|
|
12
|
+
* is thrown, and carries user input into every log line that touches it — and a
|
|
13
|
+
* mail URL's userinfo is a credential, which makes that leak a real one here.
|
|
14
|
+
*/
|
|
15
|
+
/** Base for anything wrong with an email URL, so callers may catch broadly. */
|
|
16
|
+
var EmailUrlError = class extends Error {
|
|
17
|
+
/** The URL that could not be used. Carries credentials — do not log it. */
|
|
18
|
+
url;
|
|
19
|
+
constructor(url, message) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.url = url;
|
|
22
|
+
this.name = new.target.name;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/** The string is not a URL at all. */
|
|
26
|
+
var MalformedEmailUrl = class extends EmailUrlError {
|
|
27
|
+
constructor(url) {
|
|
28
|
+
super(url, "Not a valid URL");
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* A URL, but naming a scheme that is not SMTP.
|
|
33
|
+
*
|
|
34
|
+
* Almost always `ses://` or `resend://` — a provider written where a protocol
|
|
35
|
+
* belongs. Mail is delivered over SMTP whoever is delivering it, so the provider
|
|
36
|
+
* shows up as the URL's host and credentials, never as its scheme.
|
|
37
|
+
*/
|
|
38
|
+
var UnsupportedEmailScheme = class extends EmailUrlError {
|
|
39
|
+
/** The scheme the URL carried, e.g. `'ses:'`. */
|
|
40
|
+
actual;
|
|
41
|
+
/** The schemes this transport speaks. */
|
|
42
|
+
expected = ["smtp:", "smtps:"];
|
|
43
|
+
constructor(url, actual) {
|
|
44
|
+
super(url, "Email URL scheme must be smtp: or smtps:");
|
|
45
|
+
this.actual = actual;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
Object.defineProperty(exports, 'EmailUrlError', {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () {
|
|
53
|
+
return EmailUrlError;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, 'MalformedEmailUrl', {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () {
|
|
59
|
+
return MalformedEmailUrl;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, 'UnsupportedEmailScheme', {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function () {
|
|
65
|
+
return UnsupportedEmailScheme;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=errors-6difZDw0.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-6difZDw0.cjs","names":["url: string","message: string","actual: string"],"sources":["../src/errors.ts"],"sourcesContent":["/**\n * Email URL errors.\n *\n * Every provider is reached over SMTP, so there are only two problems a URL can\n * have: it is not a URL, or it names a scheme this transport cannot speak. Both\n * carry the offending value as a field.\n *\n * Messages state the rule, which is constant, and never interpolate the value.\n * An interpolated message cannot be matched on, reads differently every time it\n * is thrown, and carries user input into every log line that touches it — and a\n * mail URL's userinfo is a credential, which makes that leak a real one here.\n */\n\n/** Base for anything wrong with an email URL, so callers may catch broadly. */\nexport abstract class EmailUrlError extends Error {\n\t/** The URL that could not be used. Carries credentials — do not log it. */\n\treadonly url: string;\n\n\tconstructor(url: string, message: string) {\n\t\tsuper(message);\n\t\tthis.url = url;\n\t\tthis.name = new.target.name;\n\t}\n}\n\n/** The string is not a URL at all. */\nexport class MalformedEmailUrl extends EmailUrlError {\n\tconstructor(url: string) {\n\t\tsuper(url, 'Not a valid URL');\n\t}\n}\n\n/**\n * A URL, but naming a scheme that is not SMTP.\n *\n * Almost always `ses://` or `resend://` — a provider written where a protocol\n * belongs. Mail is delivered over SMTP whoever is delivering it, so the provider\n * shows up as the URL's host and credentials, never as its scheme.\n */\nexport class UnsupportedEmailScheme extends EmailUrlError {\n\t/** The scheme the URL carried, e.g. `'ses:'`. */\n\treadonly actual: string;\n\t/** The schemes this transport speaks. */\n\treadonly expected: readonly string[] = ['smtp:', 'smtps:'];\n\n\tconstructor(url: string, actual: string) {\n\t\tsuper(url, 'Email URL scheme must be smtp: or smtps:');\n\t\tthis.actual = actual;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,IAAsB,gBAAtB,cAA4C,MAAM;;CAEjD,AAAS;CAET,YAAYA,KAAaC,SAAiB;AACzC,QAAM,QAAQ;AACd,OAAK,MAAM;AACX,OAAK,OAAO,IAAI,OAAO;CACvB;AACD;;AAGD,IAAa,oBAAb,cAAuC,cAAc;CACpD,YAAYD,KAAa;AACxB,QAAM,KAAK,kBAAkB;CAC7B;AACD;;;;;;;;AASD,IAAa,yBAAb,cAA4C,cAAc;;CAEzD,AAAS;;CAET,AAAS,WAA8B,CAAC,SAAS,QAAS;CAE1D,YAAYA,KAAaE,QAAgB;AACxC,QAAM,KAAK,2CAA2C;AACtD,OAAK,SAAS;CACd;AACD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/errors.ts
|
|
2
|
+
/**
|
|
3
|
+
* Email URL errors.
|
|
4
|
+
*
|
|
5
|
+
* Every provider is reached over SMTP, so there are only two problems a URL can
|
|
6
|
+
* have: it is not a URL, or it names a scheme this transport cannot speak. Both
|
|
7
|
+
* carry the offending value as a field.
|
|
8
|
+
*
|
|
9
|
+
* Messages state the rule, which is constant, and never interpolate the value.
|
|
10
|
+
* An interpolated message cannot be matched on, reads differently every time it
|
|
11
|
+
* is thrown, and carries user input into every log line that touches it — and a
|
|
12
|
+
* mail URL's userinfo is a credential, which makes that leak a real one here.
|
|
13
|
+
*/
|
|
14
|
+
/** Base for anything wrong with an email URL, so callers may catch broadly. */
|
|
15
|
+
var EmailUrlError = class extends Error {
|
|
16
|
+
/** The URL that could not be used. Carries credentials — do not log it. */
|
|
17
|
+
url;
|
|
18
|
+
constructor(url, message) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.url = url;
|
|
21
|
+
this.name = new.target.name;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
/** The string is not a URL at all. */
|
|
25
|
+
var MalformedEmailUrl = class extends EmailUrlError {
|
|
26
|
+
constructor(url) {
|
|
27
|
+
super(url, "Not a valid URL");
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A URL, but naming a scheme that is not SMTP.
|
|
32
|
+
*
|
|
33
|
+
* Almost always `ses://` or `resend://` — a provider written where a protocol
|
|
34
|
+
* belongs. Mail is delivered over SMTP whoever is delivering it, so the provider
|
|
35
|
+
* shows up as the URL's host and credentials, never as its scheme.
|
|
36
|
+
*/
|
|
37
|
+
var UnsupportedEmailScheme = class extends EmailUrlError {
|
|
38
|
+
/** The scheme the URL carried, e.g. `'ses:'`. */
|
|
39
|
+
actual;
|
|
40
|
+
/** The schemes this transport speaks. */
|
|
41
|
+
expected = ["smtp:", "smtps:"];
|
|
42
|
+
constructor(url, actual) {
|
|
43
|
+
super(url, "Email URL scheme must be smtp: or smtps:");
|
|
44
|
+
this.actual = actual;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { EmailUrlError, MalformedEmailUrl, UnsupportedEmailScheme };
|
|
50
|
+
//# sourceMappingURL=errors-Ba3cEHPO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-Ba3cEHPO.mjs","names":["url: string","message: string","actual: string"],"sources":["../src/errors.ts"],"sourcesContent":["/**\n * Email URL errors.\n *\n * Every provider is reached over SMTP, so there are only two problems a URL can\n * have: it is not a URL, or it names a scheme this transport cannot speak. Both\n * carry the offending value as a field.\n *\n * Messages state the rule, which is constant, and never interpolate the value.\n * An interpolated message cannot be matched on, reads differently every time it\n * is thrown, and carries user input into every log line that touches it — and a\n * mail URL's userinfo is a credential, which makes that leak a real one here.\n */\n\n/** Base for anything wrong with an email URL, so callers may catch broadly. */\nexport abstract class EmailUrlError extends Error {\n\t/** The URL that could not be used. Carries credentials — do not log it. */\n\treadonly url: string;\n\n\tconstructor(url: string, message: string) {\n\t\tsuper(message);\n\t\tthis.url = url;\n\t\tthis.name = new.target.name;\n\t}\n}\n\n/** The string is not a URL at all. */\nexport class MalformedEmailUrl extends EmailUrlError {\n\tconstructor(url: string) {\n\t\tsuper(url, 'Not a valid URL');\n\t}\n}\n\n/**\n * A URL, but naming a scheme that is not SMTP.\n *\n * Almost always `ses://` or `resend://` — a provider written where a protocol\n * belongs. Mail is delivered over SMTP whoever is delivering it, so the provider\n * shows up as the URL's host and credentials, never as its scheme.\n */\nexport class UnsupportedEmailScheme extends EmailUrlError {\n\t/** The scheme the URL carried, e.g. `'ses:'`. */\n\treadonly actual: string;\n\t/** The schemes this transport speaks. */\n\treadonly expected: readonly string[] = ['smtp:', 'smtps:'];\n\n\tconstructor(url: string, actual: string) {\n\t\tsuper(url, 'Email URL scheme must be smtp: or smtps:');\n\t\tthis.actual = actual;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,IAAsB,gBAAtB,cAA4C,MAAM;;CAEjD,AAAS;CAET,YAAYA,KAAaC,SAAiB;AACzC,QAAM,QAAQ;AACd,OAAK,MAAM;AACX,OAAK,OAAO,IAAI,OAAO;CACvB;AACD;;AAGD,IAAa,oBAAb,cAAuC,cAAc;CACpD,YAAYD,KAAa;AACxB,QAAM,KAAK,kBAAkB;CAC7B;AACD;;;;;;;;AASD,IAAa,yBAAb,cAA4C,cAAc;;CAEzD,AAAS;;CAET,AAAS,WAA8B,CAAC,SAAS,QAAS;CAE1D,YAAYA,KAAaE,QAAgB;AACxC,QAAM,KAAK,2CAA2C;AACtD,OAAK,SAAS;CACd;AACD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/errors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Email URL errors.
|
|
4
|
+
*
|
|
5
|
+
* Every provider is reached over SMTP, so there are only two problems a URL can
|
|
6
|
+
* have: it is not a URL, or it names a scheme this transport cannot speak. Both
|
|
7
|
+
* carry the offending value as a field.
|
|
8
|
+
*
|
|
9
|
+
* Messages state the rule, which is constant, and never interpolate the value.
|
|
10
|
+
* An interpolated message cannot be matched on, reads differently every time it
|
|
11
|
+
* is thrown, and carries user input into every log line that touches it — and a
|
|
12
|
+
* mail URL's userinfo is a credential, which makes that leak a real one here.
|
|
13
|
+
*/
|
|
14
|
+
/** Base for anything wrong with an email URL, so callers may catch broadly. */
|
|
15
|
+
declare abstract class EmailUrlError extends Error {
|
|
16
|
+
/** The URL that could not be used. Carries credentials — do not log it. */
|
|
17
|
+
readonly url: string;
|
|
18
|
+
constructor(url: string, message: string);
|
|
19
|
+
}
|
|
20
|
+
/** The string is not a URL at all. */
|
|
21
|
+
declare class MalformedEmailUrl extends EmailUrlError {
|
|
22
|
+
constructor(url: string);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A URL, but naming a scheme that is not SMTP.
|
|
26
|
+
*
|
|
27
|
+
* Almost always `ses://` or `resend://` — a provider written where a protocol
|
|
28
|
+
* belongs. Mail is delivered over SMTP whoever is delivering it, so the provider
|
|
29
|
+
* shows up as the URL's host and credentials, never as its scheme.
|
|
30
|
+
*/
|
|
31
|
+
declare class UnsupportedEmailScheme extends EmailUrlError {
|
|
32
|
+
/** The scheme the URL carried, e.g. `'ses:'`. */
|
|
33
|
+
readonly actual: string;
|
|
34
|
+
/** The schemes this transport speaks. */
|
|
35
|
+
readonly expected: readonly string[];
|
|
36
|
+
constructor(url: string, actual: string);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
39
|
+
//#endregion
|
|
40
|
+
export { EmailUrlError, MalformedEmailUrl, UnsupportedEmailScheme };
|
|
41
|
+
//# sourceMappingURL=errors-ZllQgZ9Y.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-ZllQgZ9Y.d.mts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;AAcA;AAYA;AAaA;;;;;;;;;;uBAzBsB,aAAA,SAAsB,KAAK;;;;;;cAYpC,iBAAA,SAA0B,aAAa;;;;;;;;;;cAavC,sBAAA,SAA+B,aAAa"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/errors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Email URL errors.
|
|
4
|
+
*
|
|
5
|
+
* Every provider is reached over SMTP, so there are only two problems a URL can
|
|
6
|
+
* have: it is not a URL, or it names a scheme this transport cannot speak. Both
|
|
7
|
+
* carry the offending value as a field.
|
|
8
|
+
*
|
|
9
|
+
* Messages state the rule, which is constant, and never interpolate the value.
|
|
10
|
+
* An interpolated message cannot be matched on, reads differently every time it
|
|
11
|
+
* is thrown, and carries user input into every log line that touches it — and a
|
|
12
|
+
* mail URL's userinfo is a credential, which makes that leak a real one here.
|
|
13
|
+
*/
|
|
14
|
+
/** Base for anything wrong with an email URL, so callers may catch broadly. */
|
|
15
|
+
declare abstract class EmailUrlError extends Error {
|
|
16
|
+
/** The URL that could not be used. Carries credentials — do not log it. */
|
|
17
|
+
readonly url: string;
|
|
18
|
+
constructor(url: string, message: string);
|
|
19
|
+
}
|
|
20
|
+
/** The string is not a URL at all. */
|
|
21
|
+
declare class MalformedEmailUrl extends EmailUrlError {
|
|
22
|
+
constructor(url: string);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A URL, but naming a scheme that is not SMTP.
|
|
26
|
+
*
|
|
27
|
+
* Almost always `ses://` or `resend://` — a provider written where a protocol
|
|
28
|
+
* belongs. Mail is delivered over SMTP whoever is delivering it, so the provider
|
|
29
|
+
* shows up as the URL's host and credentials, never as its scheme.
|
|
30
|
+
*/
|
|
31
|
+
declare class UnsupportedEmailScheme extends EmailUrlError {
|
|
32
|
+
/** The scheme the URL carried, e.g. `'ses:'`. */
|
|
33
|
+
readonly actual: string;
|
|
34
|
+
/** The schemes this transport speaks. */
|
|
35
|
+
readonly expected: readonly string[];
|
|
36
|
+
constructor(url: string, actual: string);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
39
|
+
//#endregion
|
|
40
|
+
export { EmailUrlError, MalformedEmailUrl, UnsupportedEmailScheme };
|
|
41
|
+
//# sourceMappingURL=errors-xJ88z_5r.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-xJ88z_5r.d.cts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;AAcA;AAYA;AAaA;;;;;;;;;;uBAzBsB,aAAA,SAAsB,KAAK;;;;;;cAYpC,iBAAA,SAA0B,aAAa;;;;;;;;;;cAavC,sBAAA,SAA+B,aAAa"}
|
package/dist/errors.cjs
ADDED
package/dist/errors.mjs
ADDED
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
const require_client = require('./client-sZNHPYYg.cjs');
|
|
2
|
+
const require_errors = require('./errors-6difZDw0.cjs');
|
|
3
|
+
const require_url = require('./url-GT3jLGq-.cjs');
|
|
2
4
|
|
|
5
|
+
exports.EmailUrlError = require_errors.EmailUrlError;
|
|
6
|
+
exports.MalformedEmailUrl = require_errors.MalformedEmailUrl;
|
|
3
7
|
exports.SMTPClient = require_client.SMTPClient;
|
|
4
|
-
exports.
|
|
8
|
+
exports.UnsupportedEmailScheme = require_errors.UnsupportedEmailScheme;
|
|
9
|
+
exports.createEmailClient = require_client.createEmailClient;
|
|
10
|
+
exports.parseEmailUrl = require_url.parseEmailUrl;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendResult } from "./types-CLVcanCB.cjs";
|
|
1
|
+
import { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplatePropsFor, TemplateRecord } from "./types-CLVcanCB.cjs";
|
|
2
2
|
import { SMTPClient, createEmailClient } from "./client-CGKPzbG7.cjs";
|
|
3
|
-
|
|
3
|
+
import { EmailUrlError, MalformedEmailUrl, UnsupportedEmailScheme } from "./errors-xJ88z_5r.cjs";
|
|
4
|
+
import { parseEmailUrl } from "./url-Cf508-Ji.cjs";
|
|
5
|
+
export { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, EmailUrlError, MalformedEmailUrl, PlainEmailOptions, SMTPClient, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplatePropsFor, TemplateRecord, UnsupportedEmailScheme, createEmailClient, parseEmailUrl };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendResult } from "./types-
|
|
2
|
-
import { SMTPClient, createEmailClient } from "./client-
|
|
3
|
-
|
|
1
|
+
import { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplatePropsFor, TemplateRecord } from "./types-BE4Kh3y6.mjs";
|
|
2
|
+
import { SMTPClient, createEmailClient } from "./client-LvoMlKEk.mjs";
|
|
3
|
+
import { EmailUrlError, MalformedEmailUrl, UnsupportedEmailScheme } from "./errors-ZllQgZ9Y.mjs";
|
|
4
|
+
import { parseEmailUrl } from "./url-Cd5VhxhW.mjs";
|
|
5
|
+
export { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, EmailUrlError, MalformedEmailUrl, PlainEmailOptions, SMTPClient, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplatePropsFor, TemplateRecord, UnsupportedEmailScheme, createEmailClient, parseEmailUrl };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { SMTPClient, createEmailClient } from "./client-BkN5BGeJ.mjs";
|
|
2
|
+
import { EmailUrlError, MalformedEmailUrl, UnsupportedEmailScheme } from "./errors-Ba3cEHPO.mjs";
|
|
3
|
+
import { parseEmailUrl } from "./url-B8QqBrMt.mjs";
|
|
2
4
|
|
|
3
|
-
export { SMTPClient, createEmailClient };
|
|
5
|
+
export { EmailUrlError, MalformedEmailUrl, SMTPClient, UnsupportedEmailScheme, createEmailClient, parseEmailUrl };
|
|
@@ -80,4 +80,4 @@ interface EmailClient<T extends TemplateRecord = TemplateRecord> {
|
|
|
80
80
|
|
|
81
81
|
//#endregion
|
|
82
82
|
export { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplateProps, TemplatePropsFor, TemplateRecord };
|
|
83
|
-
//# sourceMappingURL=types-
|
|
83
|
+
//# sourceMappingURL=types-BE4Kh3y6.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-BE4Kh3y6.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":"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"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplateProps, TemplatePropsFor, TemplateRecord } from "./types-
|
|
1
|
+
import { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplateProps, TemplatePropsFor, TemplateRecord } from "./types-BE4Kh3y6.mjs";
|
|
2
2
|
export { Attachment, EmailClient, EmailClientConfig, EmailOptions, EmailTemplate, PlainEmailOptions, SMTPConfig, SendOptions, SendResult, TemplateNames, TemplateProps, TemplatePropsFor, TemplateRecord };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { MalformedEmailUrl, UnsupportedEmailScheme } from "./errors-Ba3cEHPO.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/url.ts
|
|
4
|
+
/**
|
|
5
|
+
* The port to use when the URL names none.
|
|
6
|
+
*
|
|
7
|
+
* 587 is submission-with-STARTTLS, which is what SES, Resend, and Postmark all
|
|
8
|
+
* document; 465 is implicit TLS, which is what `smtps://` means.
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_PORT = {
|
|
11
|
+
"smtp:": 587,
|
|
12
|
+
"smtps:": 465
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Build an SMTP transport config from a `<NAME>_URL`.
|
|
16
|
+
*
|
|
17
|
+
* `smtps://` sets `secure`, which is nodemailer's flag for implicit TLS on
|
|
18
|
+
* connect rather than STARTTLS after `EHLO` — the distinction 465 and 587 carry,
|
|
19
|
+
* and the reason the scheme is worth having rather than inferring from the port.
|
|
20
|
+
*
|
|
21
|
+
* @example parseEmailUrl('smtp://mailpit:1025')
|
|
22
|
+
* @example parseEmailUrl('smtps://AKIA…:…@email-smtp.eu-west-1.amazonaws.com:465')
|
|
23
|
+
* @example parseEmailUrl('smtp://resend:re_123@smtp.resend.com:587')
|
|
24
|
+
*/
|
|
25
|
+
function parseEmailUrl(url) {
|
|
26
|
+
let parsed;
|
|
27
|
+
try {
|
|
28
|
+
parsed = new URL(url);
|
|
29
|
+
} catch {
|
|
30
|
+
throw new MalformedEmailUrl(url);
|
|
31
|
+
}
|
|
32
|
+
if (parsed.protocol !== "smtp:" && parsed.protocol !== "smtps:") throw new UnsupportedEmailScheme(url, parsed.protocol);
|
|
33
|
+
const secure = parsed.protocol === "smtps:";
|
|
34
|
+
const config = {
|
|
35
|
+
host: parsed.hostname,
|
|
36
|
+
port: parsed.port ? Number(parsed.port) : DEFAULT_PORT[parsed.protocol],
|
|
37
|
+
secure
|
|
38
|
+
};
|
|
39
|
+
if (parsed.username) config.auth = {
|
|
40
|
+
user: decodeURIComponent(parsed.username),
|
|
41
|
+
pass: decodeURIComponent(parsed.password)
|
|
42
|
+
};
|
|
43
|
+
if (parsed.searchParams.get("insecure") === "true") config.tls = { rejectUnauthorized: false };
|
|
44
|
+
return config;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { parseEmailUrl };
|
|
49
|
+
//# sourceMappingURL=url-B8QqBrMt.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-B8QqBrMt.mjs","names":["url: string","parsed: URL","config: SMTPConfig"],"sources":["../src/url.ts"],"sourcesContent":["/**\n * `smtp://` — the one URL shape an email construct ever provides.\n *\n * Every provider is reached the same way: Mailpit locally, SES through its SMTP\n * interface, Resend and Postmark through theirs. So there is no scheme-keyed\n * driver registry here as there is in `@geekmidas/storage` — one transport, one\n * parser, and the client never branches on who is delivering the mail.\n *\n * What varies between providers is confined to the URL: host, port, and\n * credentials. That is what lets the same handler source run against Mailpit and\n * against SES without a conditional.\n */\n\nimport { MalformedEmailUrl, UnsupportedEmailScheme } from './errors';\nimport type { SMTPConfig } from './types';\n\n/**\n * The port to use when the URL names none.\n *\n * 587 is submission-with-STARTTLS, which is what SES, Resend, and Postmark all\n * document; 465 is implicit TLS, which is what `smtps://` means.\n */\nconst DEFAULT_PORT = { 'smtp:': 587, 'smtps:': 465 } as const;\n\n/**\n * Build an SMTP transport config from a `<NAME>_URL`.\n *\n * `smtps://` sets `secure`, which is nodemailer's flag for implicit TLS on\n * connect rather than STARTTLS after `EHLO` — the distinction 465 and 587 carry,\n * and the reason the scheme is worth having rather than inferring from the port.\n *\n * @example parseEmailUrl('smtp://mailpit:1025')\n * @example parseEmailUrl('smtps://AKIA…:…@email-smtp.eu-west-1.amazonaws.com:465')\n * @example parseEmailUrl('smtp://resend:re_123@smtp.resend.com:587')\n */\nexport function parseEmailUrl(url: string): SMTPConfig {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(url);\n\t} catch {\n\t\tthrow new MalformedEmailUrl(url);\n\t}\n\n\tif (parsed.protocol !== 'smtp:' && parsed.protocol !== 'smtps:') {\n\t\tthrow new UnsupportedEmailScheme(url, parsed.protocol);\n\t}\n\n\tconst secure = parsed.protocol === 'smtps:';\n\tconst config: SMTPConfig = {\n\t\thost: parsed.hostname,\n\t\tport: parsed.port ? Number(parsed.port) : DEFAULT_PORT[parsed.protocol],\n\t\tsecure,\n\t};\n\n\t// Mailpit accepts mail unauthenticated, so credentials are optional rather\n\t// than required — omitting `auth` entirely is what nodemailer expects, where\n\t// empty strings would be sent as a real (failing) AUTH exchange.\n\tif (parsed.username) {\n\t\tconfig.auth = {\n\t\t\tuser: decodeURIComponent(parsed.username),\n\t\t\tpass: decodeURIComponent(parsed.password),\n\t\t};\n\t}\n\n\t// Local containers present a self-signed certificate. Rather than have every\n\t// project set this, read it off the URL — the adapter that knows it is\n\t// pointing at a container is the one that can say so.\n\tif (parsed.searchParams.get('insecure') === 'true') {\n\t\tconfig.tls = { rejectUnauthorized: false };\n\t}\n\n\treturn config;\n}\n"],"mappings":";;;;;;;;;AAsBA,MAAM,eAAe;CAAE,SAAS;CAAK,UAAU;AAAK;;;;;;;;;;;;AAapD,SAAgB,cAAcA,KAAyB;CACtD,IAAIC;AACJ,KAAI;AACH,WAAS,IAAI,IAAI;CACjB,QAAO;AACP,QAAM,IAAI,kBAAkB;CAC5B;AAED,KAAI,OAAO,aAAa,WAAW,OAAO,aAAa,SACtD,OAAM,IAAI,uBAAuB,KAAK,OAAO;CAG9C,MAAM,SAAS,OAAO,aAAa;CACnC,MAAMC,SAAqB;EAC1B,MAAM,OAAO;EACb,MAAM,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG,aAAa,OAAO;EAC9D;CACA;AAKD,KAAI,OAAO,SACV,QAAO,OAAO;EACb,MAAM,mBAAmB,OAAO,SAAS;EACzC,MAAM,mBAAmB,OAAO,SAAS;CACzC;AAMF,KAAI,OAAO,aAAa,IAAI,WAAW,KAAK,OAC3C,QAAO,MAAM,EAAE,oBAAoB,MAAO;AAG3C,QAAO;AACP"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SMTPConfig } from "./types-BE4Kh3y6.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/url.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Build an SMTP transport config from a `<NAME>_URL`.
|
|
7
|
+
*
|
|
8
|
+
* `smtps://` sets `secure`, which is nodemailer's flag for implicit TLS on
|
|
9
|
+
* connect rather than STARTTLS after `EHLO` — the distinction 465 and 587 carry,
|
|
10
|
+
* and the reason the scheme is worth having rather than inferring from the port.
|
|
11
|
+
*
|
|
12
|
+
* @example parseEmailUrl('smtp://mailpit:1025')
|
|
13
|
+
* @example parseEmailUrl('smtps://AKIA…:…@email-smtp.eu-west-1.amazonaws.com:465')
|
|
14
|
+
* @example parseEmailUrl('smtp://resend:re_123@smtp.resend.com:587')
|
|
15
|
+
*/
|
|
16
|
+
declare function parseEmailUrl(url: string): SMTPConfig;
|
|
17
|
+
//# sourceMappingURL=url.d.ts.map
|
|
18
|
+
//#endregion
|
|
19
|
+
export { parseEmailUrl };
|
|
20
|
+
//# sourceMappingURL=url-Cd5VhxhW.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-Cd5VhxhW.d.mts","names":[],"sources":["../src/url.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;iBAmCgB,aAAA,eAA4B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SMTPConfig } from "./types-CLVcanCB.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/url.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Build an SMTP transport config from a `<NAME>_URL`.
|
|
7
|
+
*
|
|
8
|
+
* `smtps://` sets `secure`, which is nodemailer's flag for implicit TLS on
|
|
9
|
+
* connect rather than STARTTLS after `EHLO` — the distinction 465 and 587 carry,
|
|
10
|
+
* and the reason the scheme is worth having rather than inferring from the port.
|
|
11
|
+
*
|
|
12
|
+
* @example parseEmailUrl('smtp://mailpit:1025')
|
|
13
|
+
* @example parseEmailUrl('smtps://AKIA…:…@email-smtp.eu-west-1.amazonaws.com:465')
|
|
14
|
+
* @example parseEmailUrl('smtp://resend:re_123@smtp.resend.com:587')
|
|
15
|
+
*/
|
|
16
|
+
declare function parseEmailUrl(url: string): SMTPConfig;
|
|
17
|
+
//# sourceMappingURL=url.d.ts.map
|
|
18
|
+
//#endregion
|
|
19
|
+
export { parseEmailUrl };
|
|
20
|
+
//# sourceMappingURL=url-Cf508-Ji.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-Cf508-Ji.d.cts","names":[],"sources":["../src/url.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;iBAmCgB,aAAA,eAA4B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const require_errors = require('./errors-6difZDw0.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/url.ts
|
|
4
|
+
/**
|
|
5
|
+
* The port to use when the URL names none.
|
|
6
|
+
*
|
|
7
|
+
* 587 is submission-with-STARTTLS, which is what SES, Resend, and Postmark all
|
|
8
|
+
* document; 465 is implicit TLS, which is what `smtps://` means.
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_PORT = {
|
|
11
|
+
"smtp:": 587,
|
|
12
|
+
"smtps:": 465
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Build an SMTP transport config from a `<NAME>_URL`.
|
|
16
|
+
*
|
|
17
|
+
* `smtps://` sets `secure`, which is nodemailer's flag for implicit TLS on
|
|
18
|
+
* connect rather than STARTTLS after `EHLO` — the distinction 465 and 587 carry,
|
|
19
|
+
* and the reason the scheme is worth having rather than inferring from the port.
|
|
20
|
+
*
|
|
21
|
+
* @example parseEmailUrl('smtp://mailpit:1025')
|
|
22
|
+
* @example parseEmailUrl('smtps://AKIA…:…@email-smtp.eu-west-1.amazonaws.com:465')
|
|
23
|
+
* @example parseEmailUrl('smtp://resend:re_123@smtp.resend.com:587')
|
|
24
|
+
*/
|
|
25
|
+
function parseEmailUrl(url) {
|
|
26
|
+
let parsed;
|
|
27
|
+
try {
|
|
28
|
+
parsed = new URL(url);
|
|
29
|
+
} catch {
|
|
30
|
+
throw new require_errors.MalformedEmailUrl(url);
|
|
31
|
+
}
|
|
32
|
+
if (parsed.protocol !== "smtp:" && parsed.protocol !== "smtps:") throw new require_errors.UnsupportedEmailScheme(url, parsed.protocol);
|
|
33
|
+
const secure = parsed.protocol === "smtps:";
|
|
34
|
+
const config = {
|
|
35
|
+
host: parsed.hostname,
|
|
36
|
+
port: parsed.port ? Number(parsed.port) : DEFAULT_PORT[parsed.protocol],
|
|
37
|
+
secure
|
|
38
|
+
};
|
|
39
|
+
if (parsed.username) config.auth = {
|
|
40
|
+
user: decodeURIComponent(parsed.username),
|
|
41
|
+
pass: decodeURIComponent(parsed.password)
|
|
42
|
+
};
|
|
43
|
+
if (parsed.searchParams.get("insecure") === "true") config.tls = { rejectUnauthorized: false };
|
|
44
|
+
return config;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
Object.defineProperty(exports, 'parseEmailUrl', {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return parseEmailUrl;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=url-GT3jLGq-.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-GT3jLGq-.cjs","names":["url: string","parsed: URL","MalformedEmailUrl","UnsupportedEmailScheme","config: SMTPConfig"],"sources":["../src/url.ts"],"sourcesContent":["/**\n * `smtp://` — the one URL shape an email construct ever provides.\n *\n * Every provider is reached the same way: Mailpit locally, SES through its SMTP\n * interface, Resend and Postmark through theirs. So there is no scheme-keyed\n * driver registry here as there is in `@geekmidas/storage` — one transport, one\n * parser, and the client never branches on who is delivering the mail.\n *\n * What varies between providers is confined to the URL: host, port, and\n * credentials. That is what lets the same handler source run against Mailpit and\n * against SES without a conditional.\n */\n\nimport { MalformedEmailUrl, UnsupportedEmailScheme } from './errors';\nimport type { SMTPConfig } from './types';\n\n/**\n * The port to use when the URL names none.\n *\n * 587 is submission-with-STARTTLS, which is what SES, Resend, and Postmark all\n * document; 465 is implicit TLS, which is what `smtps://` means.\n */\nconst DEFAULT_PORT = { 'smtp:': 587, 'smtps:': 465 } as const;\n\n/**\n * Build an SMTP transport config from a `<NAME>_URL`.\n *\n * `smtps://` sets `secure`, which is nodemailer's flag for implicit TLS on\n * connect rather than STARTTLS after `EHLO` — the distinction 465 and 587 carry,\n * and the reason the scheme is worth having rather than inferring from the port.\n *\n * @example parseEmailUrl('smtp://mailpit:1025')\n * @example parseEmailUrl('smtps://AKIA…:…@email-smtp.eu-west-1.amazonaws.com:465')\n * @example parseEmailUrl('smtp://resend:re_123@smtp.resend.com:587')\n */\nexport function parseEmailUrl(url: string): SMTPConfig {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(url);\n\t} catch {\n\t\tthrow new MalformedEmailUrl(url);\n\t}\n\n\tif (parsed.protocol !== 'smtp:' && parsed.protocol !== 'smtps:') {\n\t\tthrow new UnsupportedEmailScheme(url, parsed.protocol);\n\t}\n\n\tconst secure = parsed.protocol === 'smtps:';\n\tconst config: SMTPConfig = {\n\t\thost: parsed.hostname,\n\t\tport: parsed.port ? Number(parsed.port) : DEFAULT_PORT[parsed.protocol],\n\t\tsecure,\n\t};\n\n\t// Mailpit accepts mail unauthenticated, so credentials are optional rather\n\t// than required — omitting `auth` entirely is what nodemailer expects, where\n\t// empty strings would be sent as a real (failing) AUTH exchange.\n\tif (parsed.username) {\n\t\tconfig.auth = {\n\t\t\tuser: decodeURIComponent(parsed.username),\n\t\t\tpass: decodeURIComponent(parsed.password),\n\t\t};\n\t}\n\n\t// Local containers present a self-signed certificate. Rather than have every\n\t// project set this, read it off the URL — the adapter that knows it is\n\t// pointing at a container is the one that can say so.\n\tif (parsed.searchParams.get('insecure') === 'true') {\n\t\tconfig.tls = { rejectUnauthorized: false };\n\t}\n\n\treturn config;\n}\n"],"mappings":";;;;;;;;;AAsBA,MAAM,eAAe;CAAE,SAAS;CAAK,UAAU;AAAK;;;;;;;;;;;;AAapD,SAAgB,cAAcA,KAAyB;CACtD,IAAIC;AACJ,KAAI;AACH,WAAS,IAAI,IAAI;CACjB,QAAO;AACP,QAAM,IAAIC,iCAAkB;CAC5B;AAED,KAAI,OAAO,aAAa,WAAW,OAAO,aAAa,SACtD,OAAM,IAAIC,sCAAuB,KAAK,OAAO;CAG9C,MAAM,SAAS,OAAO,aAAa;CACnC,MAAMC,SAAqB;EAC1B,MAAM,OAAO;EACb,MAAM,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG,aAAa,OAAO;EAC9D;CACA;AAKD,KAAI,OAAO,SACV,QAAO,OAAO;EACb,MAAM,mBAAmB,OAAO,SAAS;EACzC,MAAM,mBAAmB,OAAO,SAAS;CACzC;AAMF,KAAI,OAAO,aAAa,IAAI,WAAW,KAAK,OAC3C,QAAO,MAAM,EAAE,oBAAoB,MAAO;AAG3C,QAAO;AACP"}
|
package/dist/url.cjs
ADDED
package/dist/url.d.cts
ADDED
package/dist/url.d.mts
ADDED
package/dist/url.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/emailkit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0-alpha.1",
|
|
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
|
+
},
|
|
8
18
|
"./*": {
|
|
9
19
|
"import": {
|
|
10
20
|
"types": "./dist/*.d.mts",
|
|
@@ -16,6 +26,9 @@
|
|
|
16
26
|
}
|
|
17
27
|
}
|
|
18
28
|
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
19
32
|
"repository": {
|
|
20
33
|
"type": "git",
|
|
21
34
|
"url": "https://github.com/geekmidas/toolbox"
|
|
@@ -31,9 +44,7 @@
|
|
|
31
44
|
"@types/nodemailer": "^6.4.14",
|
|
32
45
|
"@types/react": "^18.2.0",
|
|
33
46
|
"@types/react-dom": "^18.2.0",
|
|
34
|
-
"
|
|
35
|
-
"typescript": "^5.8.2",
|
|
36
|
-
"vitest": "^2.1.8"
|
|
47
|
+
"typescript": "^5.8.2"
|
|
37
48
|
},
|
|
38
49
|
"peerDependencies": {
|
|
39
50
|
"react": ">=18.0.0",
|
package/CHANGELOG.md
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# @geekmidas/emailkit
|
|
2
|
-
|
|
3
|
-
## 9.0.2
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- [#12](https://github.com/geekmidas/toolbox/pull/12) [`d53863a`](https://github.com/geekmidas/toolbox/commit/d53863a84db2e4ab5420e08f79128b637043fc42) Thanks [@geekmidas](https://github.com/geekmidas)! - Align every published package on a single version and keep them in step.
|
|
8
|
-
|
|
9
|
-
All packages now share one version, enforced by a changesets `fixed` group. The
|
|
10
|
-
baseline is 9.0.1 — @geekmidas/client's published version — so nothing moves
|
|
11
|
-
backwards; this release takes the whole set to 9.0.2 together.
|
|
12
|
-
|
|
13
|
-
Independent versions made "which version of the docs applies to me"
|
|
14
|
-
unanswerable: a reader on constructs@7 and cli@2 was on no version at all. One
|
|
15
|
-
number per release makes versioned documentation possible, and lets 9 freeze as
|
|
16
|
-
the current paradigm while the constructs rework is developed against it.
|
|
17
|
-
|
|
18
|
-
Every release now publishes every package, and a major anywhere is a major
|
|
19
|
-
everywhere. Peer ranges get simpler in return.
|
|
20
|
-
|
|
21
|
-
## 1.0.2
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- 🐛 [#11](https://github.com/geekmidas/toolbox/pull/11) [`40f4dc0`](https://github.com/geekmidas/toolbox/commit/40f4dc095911b2223a255029d8f776caf7781309) Thanks [@geekmidas](https://github.com/geekmidas)! - Patch release across all packages to realign published versions with the
|
|
26
|
-
registry. The previous release only published the four packages that had
|
|
27
|
-
version bumps; the remaining packages failed with "cannot publish over the
|
|
28
|
-
previously published versions" because their versions were unchanged.
|
|
29
|
-
|
|
30
|
-
## 1.0.1
|
|
31
|
-
|
|
32
|
-
### Patch Changes
|
|
33
|
-
|
|
34
|
-
- 🐛 [`d70c6c0`](https://github.com/geekmidas/toolbox/commit/d70c6c0aeb8a79da2473ac77dbd8255a4a2f5651) Thanks [@geekmidas](https://github.com/geekmidas)! - Fix `package.json` exports so TypeScript declarations resolve correctly under NodeNext/Bundler module resolution. Each subpath export now nests `types` inside its `import`/`require` condition, pointing at the `.d.mts` and `.d.cts` files that `tsdown` actually emits (previously the exports referenced non-existent `.d.ts` files, causing type-resolution failures for consumers). Both ESM (`.mjs`) and CJS (`.cjs`) runtime entry points are preserved. Additionally, `@geekmidas/ui` had `import` paths pointing at `.js` files that were never emitted — those are corrected to `.mjs`.
|
|
35
|
-
|
|
36
|
-
## 1.0.0
|
|
37
|
-
|
|
38
|
-
### Major Changes
|
|
39
|
-
|
|
40
|
-
- [`ff7b115`](https://github.com/geekmidas/toolbox/commit/ff7b11599f60f84ac6cdc73714c853ecf786b2e8) Thanks [@geekmidas](https://github.com/geekmidas)! - Version 1 Stable release
|