@vllnt/convex-email 0.1.0-canary.ad66628 → 0.1.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/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/component.d.ts +7 -7
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/_generated/server.d.ts +12 -0
- package/dist/component/_generated/server.d.ts.map +1 -1
- package/dist/component/_generated/server.js +2 -0
- package/dist/component/_generated/server.js.map +1 -1
- package/dist/component/convex.config.d.ts.map +1 -1
- package/dist/component/crons.d.ts.map +1 -1
- package/dist/component/mutations.d.ts +7 -7
- package/dist/component/mutations.d.ts.map +1 -1
- package/dist/component/mutations.js +12 -5
- package/dist/component/mutations.js.map +1 -1
- package/dist/component/queries.d.ts +7 -7
- package/dist/component/schema.d.ts +13 -13
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/validators.d.ts +12 -12
- package/dist/shared.d.ts +1 -0
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +1 -0
- package/dist/shared.js.map +1 -1
- package/dist/smtp/send.js.map +1 -1
- package/package.json +19 -16
- package/src/component/_generated/component.ts +7 -7
- package/src/component/_generated/server.ts +13 -0
- package/src/component/mutations.ts +12 -5
- package/src/jmap/send.test.ts +119 -50
- package/src/shared.ts +1 -0
- package/src/smtp/send.test.ts +49 -28
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,MAAM,EACP,MAAM,YAAY,CAAC;AAGpB;;;;GAIG;AACH,K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AAM,CAAA;KAAO,GACjC,OAAO,CAAC,IAAI,CAAC,CAKf;IAED;;;;;OAKG;IACH,UAAU,CACR,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAK3B;IAED,kFAAkF;IAC5E,GAAG,CACP,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAGvC;IAED;;;OAGG;IACG,YAAY,CAChB,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,aAAa,EACrB,cAAc,EAAE,iBAAiB,GAChC,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAMlD;IAED;;;;;OAKG;IACH,KAAK,CACH,GAAG,EAAE,cAAc,EACnB,IAAI,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAC7C,OAAO,CAAC,MAAM,CAAC,CAKjB;CACF;AAED,YAAY,EACV,YAAY,EACZ,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,MAAM,GACP,CAAC"}
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAqGzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,KAAK;IAKG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,cAAc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G,CACP,GAAgB,EAChB,SAAiB;QAEjB,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QAC1E,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAY,CAChB,GAAgB,EAChB,MAAqB,EACrB,cAAiC;QAEjC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,EAAE;YACrE,MAAM;YACN,cAAc;SACf,CAAC,CAAC;QACH,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;IACvE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CACH,GAAmB,EACnB,IAAI,GAAwC,EAAE;QAE9C,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE;YACrD,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,mBAAmB;SACzC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -33,6 +33,13 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
33
33
|
deduplicated: boolean;
|
|
34
34
|
messageId: string;
|
|
35
35
|
}, Name>;
|
|
36
|
+
markFailed: FunctionReference<"mutation", "internal", {
|
|
37
|
+
error?: string;
|
|
38
|
+
messageId: string;
|
|
39
|
+
}, {
|
|
40
|
+
retried: boolean;
|
|
41
|
+
status: "queued" | "failed";
|
|
42
|
+
}, Name>;
|
|
36
43
|
markSending: FunctionReference<"mutation", "internal", {
|
|
37
44
|
messageId: string;
|
|
38
45
|
}, {
|
|
@@ -42,13 +49,6 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
42
49
|
messageId: string;
|
|
43
50
|
providerId?: string;
|
|
44
51
|
}, null, Name>;
|
|
45
|
-
markFailed: FunctionReference<"mutation", "internal", {
|
|
46
|
-
error?: string;
|
|
47
|
-
messageId: string;
|
|
48
|
-
}, {
|
|
49
|
-
retried: boolean;
|
|
50
|
-
status: "queued" | "failed";
|
|
51
|
-
}, Name>;
|
|
52
52
|
prune: FunctionReference<"mutation", "internal", {
|
|
53
53
|
batch: number;
|
|
54
54
|
before?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3E;IACE,SAAS,EAAE;QACT,OAAO,EAAE,iBAAiB,CACxB,UAAU,EACV,UAAU,EACV;YACE,IAAI,EAAE,MAAM,CAAC;YACb,cAAc,CAAC,EAAE,MAAM,CAAC;YACxB,WAAW,EAAE,MAAM,CAAC;YACpB,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,CAAC,EAAE,GAAG,CAAC;YACd,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,EAAE,EAAE,MAAM,CAAC;YACX,SAAS,EAAE,MAAM,CAAC;SACnB,EACD;YAAE,YAAY,EAAE,OAAO,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAE,EAC5C,IAAI,CACL,CAAC;QACF,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["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AAC;YAChB,IAAI,EAAE,KAAK,CAAC;gBACV,QAAQ,EAAE,MAAM,CAAC;gBACjB,SAAS,EAAE,MAAM,CAAC;gBAClB,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,IAAI,EAAE,MAAM,CAAC;gBACb,cAAc,CAAC,EAAE,MAAM,CAAC;gBACxB,WAAW,EAAE,MAAM,CAAC;gBACpB,SAAS,EAAE,MAAM,CAAC;gBAClB,OAAO,CAAC,EAAE,GAAG,CAAC;gBACd,UAAU,CAAC,EAAE,MAAM,CAAC;gBACpB,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;gBACjD,UAAU,CAAC,EAAE,MAAM,CAAC;gBACpB,EAAE,EAAE,MAAM,CAAC;gBACX,SAAS,EAAE,MAAM,CAAC;gBAClB,SAAS,EAAE,MAAM,CAAC;aACnB,CAAC,CAAC;YACH,UAAU,CAAC,EAAE,kBAAkB,GAAG,eAAe,GAAG,IAAI,CAAC;YACzD,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;SAC7B,EACD,IAAI,CACL,CAAC;KACH,CAAC;CACH,CAAC"}
|
|
@@ -8,6 +8,16 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { ActionBuilder, HttpActionBuilder, MutationBuilder, QueryBuilder, GenericActionCtx, GenericMutationCtx, GenericQueryCtx, GenericDatabaseReader, GenericDatabaseWriter } from "convex/server";
|
|
10
10
|
import type { DataModel } from "./dataModel.js";
|
|
11
|
+
/**
|
|
12
|
+
* Typesafe environment variables.
|
|
13
|
+
*
|
|
14
|
+
* This includes platform-provided env vars and any variables declared in
|
|
15
|
+
* `convex.config.ts`.
|
|
16
|
+
*/
|
|
17
|
+
type Env = {
|
|
18
|
+
readonly CONVEX_CLOUD_URL: string;
|
|
19
|
+
readonly CONVEX_SITE_URL: string;
|
|
20
|
+
};
|
|
11
21
|
/**
|
|
12
22
|
* Define a query in this Convex app's public API.
|
|
13
23
|
*
|
|
@@ -75,6 +85,7 @@ export declare const internalAction: ActionBuilder<DataModel, "internal">;
|
|
|
75
85
|
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
76
86
|
*/
|
|
77
87
|
export declare const httpAction: HttpActionBuilder;
|
|
88
|
+
export declare const env: Env;
|
|
78
89
|
/**
|
|
79
90
|
* A set of services for use within Convex query functions.
|
|
80
91
|
*
|
|
@@ -118,4 +129,5 @@ export type DatabaseReader = GenericDatabaseReader<DataModel>;
|
|
|
118
129
|
* for the guarantees Convex provides your functions.
|
|
119
130
|
*/
|
|
120
131
|
export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
|
|
132
|
+
export {};
|
|
121
133
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AAUvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAgB,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,CACxC,CAAC;AAEvB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAmB,CAAC;AAE9E;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,SAAS,EAAE,UAAU,CAC3C,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,EAAE,aAAa,CAAC,SAA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MAAM,UAAU,EAAE,iBAAqC,CAAC;AAC/D,eAAO,MAAM,GAAG,EAAE,GACJ,CAAC;AAEf;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAExD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -75,4 +75,6 @@ export const internalAction = internalActionGeneric;
|
|
|
75
75
|
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
76
76
|
*/
|
|
77
77
|
export const httpAction = httpActionGeneric;
|
|
78
|
+
export const env = globalThis
|
|
79
|
+
.process.env;
|
|
78
80
|
//# sourceMappingURL=server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAaH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAaH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAcvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAsC,YAAY,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GACxB,oBAAoB,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAyC,eAAe,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,uBAAuB,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAuC,aAAa,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GACzB,qBAAqB,CAAC;AAExB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB,iBAAiB,CAAC;AAC/D,MAAM,CAAC,MAAM,GAAG,GAAS,UAAmD;KACzE,OAAO,CAAC,GAAG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,sDAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,sDAA2B,CAAC;eAM5B,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crons.d.ts","sourceRoot":"","sources":["../../src/component/crons.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"crons.d.ts","sourceRoot":"","sources":["../../src/component/crons.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;aAAK,KAAK,EAAE,EAAE;CAAW,CAAC;AAErD,uEAAuE;AACvE,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,QAAA,MAAM,KAAK,+BAAa,CAAC;eAMV,KAAK"}
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
* can never produce a duplicate send.
|
|
17
17
|
*/
|
|
18
18
|
export declare const enqueue: import("convex/server").RegisteredMutation<"public", {
|
|
19
|
-
|
|
20
|
-
subjectRef?: string | undefined;
|
|
19
|
+
from: string;
|
|
21
20
|
idempotencyKey?: string | undefined;
|
|
21
|
+
maxAttempts: number;
|
|
22
22
|
messageId: string;
|
|
23
|
+
payload?: any;
|
|
24
|
+
subjectRef?: string | undefined;
|
|
23
25
|
to: string;
|
|
24
|
-
from: string;
|
|
25
26
|
transport: string;
|
|
26
|
-
maxAttempts: number;
|
|
27
27
|
}, Promise<{
|
|
28
28
|
messageId: string;
|
|
29
29
|
deduplicated: boolean;
|
|
@@ -56,8 +56,8 @@ export declare const markSending: import("convex/server").RegisteredMutation<"pu
|
|
|
56
56
|
* `failed` (a final state may not be transitioned out of).
|
|
57
57
|
*/
|
|
58
58
|
export declare const markSent: import("convex/server").RegisteredMutation<"public", {
|
|
59
|
-
providerId?: string | undefined;
|
|
60
59
|
messageId: string;
|
|
60
|
+
providerId?: string | undefined;
|
|
61
61
|
}, Promise<null>>;
|
|
62
62
|
/**
|
|
63
63
|
* Record a failed send attempt, recording the host-supplied `error`. The outcome
|
|
@@ -75,7 +75,7 @@ export declare const markFailed: import("convex/server").RegisteredMutation<"pub
|
|
|
75
75
|
error?: string | undefined;
|
|
76
76
|
messageId: string;
|
|
77
77
|
}, Promise<{
|
|
78
|
-
status: "
|
|
78
|
+
status: "failed" | "queued";
|
|
79
79
|
retried: boolean;
|
|
80
80
|
}>>;
|
|
81
81
|
/**
|
|
@@ -89,7 +89,7 @@ export declare const markFailed: import("convex/server").RegisteredMutation<"pub
|
|
|
89
89
|
* are never pruned.
|
|
90
90
|
*/
|
|
91
91
|
export declare const prune: import("convex/server").RegisteredMutation<"public", {
|
|
92
|
-
before?: number | undefined;
|
|
93
92
|
batch: number;
|
|
93
|
+
before?: number | undefined;
|
|
94
94
|
}, Promise<number>>;
|
|
95
95
|
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;GAqDlB,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW;;;;GAmCtB,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ;;;iBAgCnB,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU;;;;;;GA8BrB,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK;;;mBA2ChB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ConvexError, v } from "convex/values";
|
|
2
2
|
import { api } from "./_generated/api";
|
|
3
3
|
import { mutation } from "./_generated/server";
|
|
4
|
+
import { DEFAULT_RETENTION_MS, MAX_PRUNE_BATCH } from "../shared";
|
|
4
5
|
import { jsonValue } from "./validators";
|
|
5
6
|
/**
|
|
6
7
|
* Enqueue an outbound message and return its id immediately — the durable queue
|
|
@@ -107,7 +108,7 @@ export const markSending = mutation({
|
|
|
107
108
|
});
|
|
108
109
|
}
|
|
109
110
|
const attempts = msg.attempts + 1;
|
|
110
|
-
await ctx.db.patch(msg._id, {
|
|
111
|
+
await ctx.db.patch("messages", msg._id, {
|
|
111
112
|
status: "sending",
|
|
112
113
|
attempts,
|
|
113
114
|
updatedAt: Date.now(),
|
|
@@ -149,7 +150,7 @@ export const markSent = mutation({
|
|
|
149
150
|
message: `message "${args.messageId}" is already failed and cannot transition`,
|
|
150
151
|
});
|
|
151
152
|
}
|
|
152
|
-
await ctx.db.patch(msg._id, {
|
|
153
|
+
await ctx.db.patch("messages", msg._id, {
|
|
153
154
|
status: "sent",
|
|
154
155
|
providerId: args.providerId,
|
|
155
156
|
error: undefined,
|
|
@@ -192,7 +193,7 @@ export const markFailed = mutation({
|
|
|
192
193
|
}
|
|
193
194
|
const retried = msg.attempts < msg.maxAttempts;
|
|
194
195
|
const status = retried ? "queued" : "failed";
|
|
195
|
-
await ctx.db.patch(msg._id, {
|
|
196
|
+
await ctx.db.patch("messages", msg._id, {
|
|
196
197
|
status,
|
|
197
198
|
error: args.error,
|
|
198
199
|
updatedAt: Date.now(),
|
|
@@ -214,7 +215,13 @@ export const prune = mutation({
|
|
|
214
215
|
args: { before: v.optional(v.number()), batch: v.number() },
|
|
215
216
|
returns: v.number(),
|
|
216
217
|
handler: async (ctx, args) => {
|
|
217
|
-
|
|
218
|
+
if (!Number.isFinite(args.batch) || !Number.isInteger(args.batch) || args.batch < 1 || args.batch > MAX_PRUNE_BATCH) {
|
|
219
|
+
throw new ConvexError({ code: "INVALID_BATCH", message: `batch must be an integer between 1 and ${MAX_PRUNE_BATCH}` });
|
|
220
|
+
}
|
|
221
|
+
if (args.before !== undefined && !Number.isFinite(args.before)) {
|
|
222
|
+
throw new ConvexError({ code: "INVALID_BEFORE", message: "before must be finite" });
|
|
223
|
+
}
|
|
224
|
+
const before = args.before ?? Date.now() - DEFAULT_RETENTION_MS;
|
|
218
225
|
// Both terminal states, queried explicitly (no query-in-loop): sent first,
|
|
219
226
|
// then failed for whatever batch budget remains.
|
|
220
227
|
const sent = await ctx.db
|
|
@@ -228,7 +235,7 @@ export const prune = mutation({
|
|
|
228
235
|
.take(args.batch - sent.length)
|
|
229
236
|
: [];
|
|
230
237
|
for (const row of [...sent, ...failed]) {
|
|
231
|
-
await ctx.db.delete(row._id);
|
|
238
|
+
await ctx.db.delete("messages", row._id);
|
|
232
239
|
}
|
|
233
240
|
const removed = sent.length + failed.length;
|
|
234
241
|
if (removed === args.batch) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.js","source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AM,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;YACvC,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAE5C,IAAI,OAAO,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;YAC3B,MAAM,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE;gBACnD,MAAM;gBACN,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -6,7 +6,7 @@ export declare const get: import("convex/server").RegisteredQuery<"public", {
|
|
|
6
6
|
to: string;
|
|
7
7
|
from: string;
|
|
8
8
|
transport: string;
|
|
9
|
-
status: "
|
|
9
|
+
status: "failed" | "queued" | "sending" | "sent";
|
|
10
10
|
payload: any;
|
|
11
11
|
subjectRef: string | undefined;
|
|
12
12
|
idempotencyKey: string | undefined;
|
|
@@ -25,7 +25,6 @@ export declare const get: import("convex/server").RegisteredQuery<"public", {
|
|
|
25
25
|
* history reactively.
|
|
26
26
|
*/
|
|
27
27
|
export declare const listByStatus: import("convex/server").RegisteredQuery<"public", {
|
|
28
|
-
status: "queued" | "sending" | "sent" | "failed";
|
|
29
28
|
paginationOpts: {
|
|
30
29
|
id?: number;
|
|
31
30
|
endCursor?: string | null;
|
|
@@ -34,13 +33,18 @@ export declare const listByStatus: import("convex/server").RegisteredQuery<"publ
|
|
|
34
33
|
numItems: number;
|
|
35
34
|
cursor: string | null;
|
|
36
35
|
};
|
|
36
|
+
status: "failed" | "queued" | "sending" | "sent";
|
|
37
37
|
}, Promise<{
|
|
38
|
+
isDone: boolean;
|
|
39
|
+
continueCursor: import("convex/server").Cursor;
|
|
40
|
+
splitCursor?: import("convex/server").Cursor | null;
|
|
41
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
38
42
|
page: {
|
|
39
43
|
messageId: string;
|
|
40
44
|
to: string;
|
|
41
45
|
from: string;
|
|
42
46
|
transport: string;
|
|
43
|
-
status: "
|
|
47
|
+
status: "failed" | "queued" | "sending" | "sent";
|
|
44
48
|
payload: any;
|
|
45
49
|
subjectRef: string | undefined;
|
|
46
50
|
idempotencyKey: string | undefined;
|
|
@@ -51,9 +55,5 @@ export declare const listByStatus: import("convex/server").RegisteredQuery<"publ
|
|
|
51
55
|
createdAt: number;
|
|
52
56
|
updatedAt: number;
|
|
53
57
|
}[];
|
|
54
|
-
isDone: boolean;
|
|
55
|
-
continueCursor: import("convex/server").Cursor;
|
|
56
|
-
splitCursor?: import("convex/server").Cursor | null;
|
|
57
|
-
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
58
58
|
}>>;
|
|
59
59
|
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -13,26 +13,26 @@
|
|
|
13
13
|
*/
|
|
14
14
|
declare const _default: import("convex/server").SchemaDefinition<{
|
|
15
15
|
messages: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
idempotencyKey?: string | undefined;
|
|
19
|
-
providerId?: string | undefined;
|
|
16
|
+
attempts: number;
|
|
17
|
+
createdAt: number;
|
|
20
18
|
error?: string | undefined;
|
|
19
|
+
from: string;
|
|
20
|
+
idempotencyKey?: string | undefined;
|
|
21
|
+
maxAttempts: number;
|
|
21
22
|
messageId: string;
|
|
23
|
+
payload?: any;
|
|
24
|
+
providerId?: string | undefined;
|
|
25
|
+
status: "failed" | "queued" | "sending" | "sent";
|
|
26
|
+
subjectRef?: string | undefined;
|
|
22
27
|
to: string;
|
|
23
|
-
from: string;
|
|
24
28
|
transport: string;
|
|
25
|
-
maxAttempts: number;
|
|
26
|
-
status: "queued" | "sending" | "sent" | "failed";
|
|
27
|
-
attempts: number;
|
|
28
|
-
createdAt: number;
|
|
29
29
|
updatedAt: number;
|
|
30
30
|
}, {
|
|
31
31
|
messageId: import("convex/values").VString<string, "required">;
|
|
32
32
|
to: import("convex/values").VString<string, "required">;
|
|
33
33
|
from: import("convex/values").VString<string, "required">;
|
|
34
34
|
transport: import("convex/values").VString<string, "required">;
|
|
35
|
-
status: import("convex/values").VUnion<"
|
|
35
|
+
status: import("convex/values").VUnion<"failed" | "queued" | "sending" | "sent", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"sending", "required">, import("convex/values").VLiteral<"sent", "required">, import("convex/values").VLiteral<"failed", "required">], "required", never>;
|
|
36
36
|
payload: import("convex/values").VAny<any, "optional", string>;
|
|
37
37
|
subjectRef: import("convex/values").VString<string | undefined, "optional">;
|
|
38
38
|
idempotencyKey: import("convex/values").VString<string | undefined, "optional">;
|
|
@@ -42,12 +42,12 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
42
42
|
error: import("convex/values").VString<string | undefined, "optional">;
|
|
43
43
|
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
44
44
|
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
45
|
-
}, "required", "
|
|
46
|
-
by_message_id: ["messageId", "_creationTime"];
|
|
45
|
+
}, "required", "attempts" | "createdAt" | "error" | "from" | "idempotencyKey" | "maxAttempts" | "messageId" | "payload" | "providerId" | "status" | "subjectRef" | "to" | "transport" | "updatedAt" | `payload.${string}`>, {
|
|
47
46
|
by_idempotency_key: ["idempotencyKey", "_creationTime"];
|
|
47
|
+
by_message_id: ["messageId", "_creationTime"];
|
|
48
48
|
by_status: ["status", "createdAt", "_creationTime"];
|
|
49
|
-
by_subject: ["subjectRef", "createdAt", "_creationTime"];
|
|
50
49
|
by_status_updated: ["status", "updatedAt", "_creationTime"];
|
|
50
|
+
by_subject: ["subjectRef", "createdAt", "_creationTime"];
|
|
51
51
|
}, {}, {}>;
|
|
52
52
|
}, true>;
|
|
53
53
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const jsonValue: import("convex/values").VAny<any, "required", string>;
|
|
14
14
|
/** The four lifecycle states a message moves through. */
|
|
15
|
-
export declare const messageStatus: import("convex/values").VUnion<"
|
|
15
|
+
export declare const messageStatus: import("convex/values").VUnion<"failed" | "queued" | "sending" | "sent", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"sending", "required">, import("convex/values").VLiteral<"sent", "required">, import("convex/values").VLiteral<"failed", "required">], "required", never>;
|
|
16
16
|
/**
|
|
17
17
|
* Public projection of a message returned by {@link get}. `payload` is opaque
|
|
18
18
|
* host data; `transport` names the host-configured adapter the message is routed
|
|
@@ -21,26 +21,26 @@ export declare const messageStatus: import("convex/values").VUnion<"queued" | "s
|
|
|
21
21
|
* reason recorded on a failed attempt.
|
|
22
22
|
*/
|
|
23
23
|
export declare const messageView: import("convex/values").VObject<{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
idempotencyKey?: string | undefined;
|
|
27
|
-
providerId?: string | undefined;
|
|
24
|
+
attempts: number;
|
|
25
|
+
createdAt: number;
|
|
28
26
|
error?: string | undefined;
|
|
27
|
+
from: string;
|
|
28
|
+
idempotencyKey?: string | undefined;
|
|
29
|
+
maxAttempts: number;
|
|
29
30
|
messageId: string;
|
|
31
|
+
payload?: any;
|
|
32
|
+
providerId?: string | undefined;
|
|
33
|
+
status: "failed" | "queued" | "sending" | "sent";
|
|
34
|
+
subjectRef?: string | undefined;
|
|
30
35
|
to: string;
|
|
31
|
-
from: string;
|
|
32
36
|
transport: string;
|
|
33
|
-
maxAttempts: number;
|
|
34
|
-
status: "queued" | "sending" | "sent" | "failed";
|
|
35
|
-
attempts: number;
|
|
36
|
-
createdAt: number;
|
|
37
37
|
updatedAt: number;
|
|
38
38
|
}, {
|
|
39
39
|
messageId: import("convex/values").VString<string, "required">;
|
|
40
40
|
to: import("convex/values").VString<string, "required">;
|
|
41
41
|
from: import("convex/values").VString<string, "required">;
|
|
42
42
|
transport: import("convex/values").VString<string, "required">;
|
|
43
|
-
status: import("convex/values").VUnion<"
|
|
43
|
+
status: import("convex/values").VUnion<"failed" | "queued" | "sending" | "sent", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"sending", "required">, import("convex/values").VLiteral<"sent", "required">, import("convex/values").VLiteral<"failed", "required">], "required", never>;
|
|
44
44
|
payload: import("convex/values").VAny<any, "optional", string>;
|
|
45
45
|
subjectRef: import("convex/values").VString<string | undefined, "optional">;
|
|
46
46
|
idempotencyKey: import("convex/values").VString<string | undefined, "optional">;
|
|
@@ -50,5 +50,5 @@ export declare const messageView: import("convex/values").VObject<{
|
|
|
50
50
|
error: import("convex/values").VString<string | undefined, "optional">;
|
|
51
51
|
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
52
52
|
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
53
|
-
}, "required", "
|
|
53
|
+
}, "required", "attempts" | "createdAt" | "error" | "from" | "idempotencyKey" | "maxAttempts" | "messageId" | "payload" | "providerId" | "status" | "subjectRef" | "to" | "transport" | "updatedAt" | `payload.${string}`>;
|
|
54
54
|
//# sourceMappingURL=validators.d.ts.map
|
package/dist/shared.d.ts
CHANGED
|
@@ -29,4 +29,5 @@ export declare const DEFAULT_MAX_ATTEMPTS = 5;
|
|
|
29
29
|
export declare const DEFAULT_RETENTION_MS = 2592000000;
|
|
30
30
|
/** Default page size for a `prune` pass before the sweep self-reschedules. */
|
|
31
31
|
export declare const DEFAULT_PRUNE_BATCH = 200;
|
|
32
|
+
export declare const MAX_PRUNE_BATCH = 500;
|
|
32
33
|
//# sourceMappingURL=shared.d.ts.map
|
package/dist/shared.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,YAAI,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAEjF,yCAAyC;AACzC,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,aAAa,CAGvD,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,aAAgB,CAAC;AAElD,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,eAAe,MAAM,CAAC"}
|
package/dist/shared.js
CHANGED
|
@@ -30,4 +30,5 @@ export const DEFAULT_MAX_ATTEMPTS = 5;
|
|
|
30
30
|
export const DEFAULT_RETENTION_MS = 2_592_000_000;
|
|
31
31
|
/** Default page size for a `prune` pass before the sweep self-reschedules. */
|
|
32
32
|
export const DEFAULT_PRUNE_BATCH = 200;
|
|
33
|
+
export const MAX_PRUNE_BATCH = 500;
|
|
33
34
|
//# sourceMappingURL=shared.js.map
|
package/dist/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAKjF,iFAAiF;AACjF,MAAM,CAAC,MAAM,iBAAiB,GAA+B,IAAI,GAAG,CAAC;IACnE,MAAM;IACN,QAAQ;CACT,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAElD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC"}
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAKjF,iFAAiF;AACjF,MAAM,CAAC,MAAM,iBAAiB,GAA+B,IAAI,GAAG,CAAC;IACnE,MAAM;IACN,QAAQ;CACT,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAElD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC"}
|
package/dist/smtp/send.js.map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QACxB,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,SAAS,SAAS,CAAC,KAAmC;IACpD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;AAC3D,CAAC;AAED,oFAAoF;AACpF,SAAS,YAAY,CAAC,IAAkB;IACtC,OAAO;QACL,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;QAC/B,QAAQ,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;QAC9C,QAAQ,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;KAC/C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,SAAwB,EACxB,OAAoB,EACpB,MAAM,GAA6B,EAAE;IAErC,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vllnt/convex-email",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Durable, transport-agnostic outbound transactional email queue — enqueue, retry, idempotent send, and per-message delivery status as a Convex component",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"module": "./dist/client/index.js",
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsc --project ./tsconfig.build.json",
|
|
46
|
-
"build:codegen": "pnpm
|
|
46
|
+
"build:codegen": "pnpm codegen && pnpm build",
|
|
47
47
|
"build:clean": "rm -rf dist *.tsbuildinfo && pnpm build:codegen",
|
|
48
48
|
"typecheck": "tsc --noEmit",
|
|
49
49
|
"typecheck:ci": "tsc --noEmit --project tsconfig.ci.json",
|
|
50
|
-
"lint": "eslint .",
|
|
50
|
+
"lint": "pnpm check:agents && eslint .",
|
|
51
51
|
"test": "vitest run --passWithNoTests",
|
|
52
52
|
"test:watch": "vitest --typecheck --clearScreen false",
|
|
53
53
|
"test:coverage": "vitest run --coverage --coverage.reporter=text",
|
|
@@ -55,11 +55,12 @@
|
|
|
55
55
|
"preversion": "pnpm install --frozen-lockfile && pnpm build && pnpm test:coverage && pnpm typecheck && pnpm generate:llms",
|
|
56
56
|
"prepublishOnly": "npm whoami || npm login",
|
|
57
57
|
"alpha": "npm version prerelease --preid alpha && npm publish --tag alpha && git push --follow-tags",
|
|
58
|
-
"release": "npm version patch && npm publish && git push --follow-tags"
|
|
58
|
+
"release": "npm version patch && npm publish && git push --follow-tags",
|
|
59
|
+
"check:agents": "node -e \"const f=require('node:fs');if(!f.existsSync('AGENTS.md')||f.existsSync('CLAUDE.md')||f.existsSync('.claude'))process.exit(1)\"",
|
|
60
|
+
"codegen": "pnpm convex codegen --component-dir ./src/component"
|
|
59
61
|
},
|
|
60
|
-
"dependencies": {},
|
|
61
62
|
"peerDependencies": {
|
|
62
|
-
"convex": "^1.
|
|
63
|
+
"convex": "^1.45.0",
|
|
63
64
|
"nodemailer": "^8.0.4"
|
|
64
65
|
},
|
|
65
66
|
"peerDependenciesMeta": {
|
|
@@ -70,16 +71,18 @@
|
|
|
70
71
|
"devDependencies": {
|
|
71
72
|
"@edge-runtime/vm": "^5.0.0",
|
|
72
73
|
"@types/nodemailer": "^8.0.1",
|
|
73
|
-
"@
|
|
74
|
-
"@
|
|
75
|
-
"@vllnt/
|
|
76
|
-
"
|
|
77
|
-
"convex
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
74
|
+
"@typescript/native": "npm:typescript@7.0.2",
|
|
75
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
76
|
+
"@vllnt/eslint-config": "2.0.0",
|
|
77
|
+
"@vllnt/typescript": "2.0.0",
|
|
78
|
+
"convex": "^1.45.0",
|
|
79
|
+
"convex-test": "^0.0.56",
|
|
80
|
+
"eslint": "^9.39.5",
|
|
81
|
+
"nodemailer": "^9.1.0",
|
|
82
|
+
"prettier": "^3.9.6",
|
|
83
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
84
|
+
"vite": "^8.2.2",
|
|
85
|
+
"vitest": "^4.1.11"
|
|
83
86
|
},
|
|
84
87
|
"homepage": "https://github.com/vllnt/convex-email#readme",
|
|
85
88
|
"bugs": {
|
|
@@ -40,6 +40,13 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
40
40
|
{ deduplicated: boolean; messageId: string },
|
|
41
41
|
Name
|
|
42
42
|
>;
|
|
43
|
+
markFailed: FunctionReference<
|
|
44
|
+
"mutation",
|
|
45
|
+
"internal",
|
|
46
|
+
{ error?: string; messageId: string },
|
|
47
|
+
{ retried: boolean; status: "queued" | "failed" },
|
|
48
|
+
Name
|
|
49
|
+
>;
|
|
43
50
|
markSending: FunctionReference<
|
|
44
51
|
"mutation",
|
|
45
52
|
"internal",
|
|
@@ -54,13 +61,6 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
54
61
|
null,
|
|
55
62
|
Name
|
|
56
63
|
>;
|
|
57
|
-
markFailed: FunctionReference<
|
|
58
|
-
"mutation",
|
|
59
|
-
"internal",
|
|
60
|
-
{ error?: string; messageId: string },
|
|
61
|
-
{ retried: boolean; status: "queued" | "failed" },
|
|
62
|
-
Name
|
|
63
|
-
>;
|
|
64
64
|
prune: FunctionReference<
|
|
65
65
|
"mutation",
|
|
66
66
|
"internal",
|
|
@@ -30,6 +30,17 @@ import {
|
|
|
30
30
|
} from "convex/server";
|
|
31
31
|
import type { DataModel } from "./dataModel.js";
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Typesafe environment variables.
|
|
35
|
+
*
|
|
36
|
+
* This includes platform-provided env vars and any variables declared in
|
|
37
|
+
* `convex.config.ts`.
|
|
38
|
+
*/
|
|
39
|
+
type Env = {
|
|
40
|
+
readonly CONVEX_CLOUD_URL: string;
|
|
41
|
+
readonly CONVEX_SITE_URL: string;
|
|
42
|
+
};
|
|
43
|
+
|
|
33
44
|
/**
|
|
34
45
|
* Define a query in this Convex app's public API.
|
|
35
46
|
*
|
|
@@ -106,6 +117,8 @@ export const internalAction: ActionBuilder<DataModel, "internal"> =
|
|
|
106
117
|
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
107
118
|
*/
|
|
108
119
|
export const httpAction: HttpActionBuilder = httpActionGeneric;
|
|
120
|
+
export const env: Env = (globalThis as unknown as { process: { env: Env } })
|
|
121
|
+
.process.env;
|
|
109
122
|
|
|
110
123
|
/**
|
|
111
124
|
* A set of services for use within Convex query functions.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ConvexError, v } from "convex/values";
|
|
2
2
|
import { api } from "./_generated/api";
|
|
3
3
|
import { mutation } from "./_generated/server";
|
|
4
|
+
import { DEFAULT_RETENTION_MS, MAX_PRUNE_BATCH } from "../shared";
|
|
4
5
|
import { jsonValue } from "./validators";
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -114,7 +115,7 @@ export const markSending = mutation({
|
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
const attempts = msg.attempts + 1;
|
|
117
|
-
await ctx.db.patch(msg._id, {
|
|
118
|
+
await ctx.db.patch("messages", msg._id, {
|
|
118
119
|
status: "sending",
|
|
119
120
|
attempts,
|
|
120
121
|
updatedAt: Date.now(),
|
|
@@ -158,7 +159,7 @@ export const markSent = mutation({
|
|
|
158
159
|
});
|
|
159
160
|
}
|
|
160
161
|
|
|
161
|
-
await ctx.db.patch(msg._id, {
|
|
162
|
+
await ctx.db.patch("messages", msg._id, {
|
|
162
163
|
status: "sent",
|
|
163
164
|
providerId: args.providerId,
|
|
164
165
|
error: undefined,
|
|
@@ -203,7 +204,7 @@ export const markFailed = mutation({
|
|
|
203
204
|
|
|
204
205
|
const retried = msg.attempts < msg.maxAttempts;
|
|
205
206
|
const status = retried ? ("queued" as const) : ("failed" as const);
|
|
206
|
-
await ctx.db.patch(msg._id, {
|
|
207
|
+
await ctx.db.patch("messages", msg._id, {
|
|
207
208
|
status,
|
|
208
209
|
error: args.error,
|
|
209
210
|
updatedAt: Date.now(),
|
|
@@ -226,7 +227,13 @@ export const prune = mutation({
|
|
|
226
227
|
args: { before: v.optional(v.number()), batch: v.number() },
|
|
227
228
|
returns: v.number(),
|
|
228
229
|
handler: async (ctx, args) => {
|
|
229
|
-
|
|
230
|
+
if (!Number.isFinite(args.batch) || !Number.isInteger(args.batch) || args.batch < 1 || args.batch > MAX_PRUNE_BATCH) {
|
|
231
|
+
throw new ConvexError({ code: "INVALID_BATCH", message: `batch must be an integer between 1 and ${MAX_PRUNE_BATCH}` });
|
|
232
|
+
}
|
|
233
|
+
if (args.before !== undefined && !Number.isFinite(args.before)) {
|
|
234
|
+
throw new ConvexError({ code: "INVALID_BEFORE", message: "before must be finite" });
|
|
235
|
+
}
|
|
236
|
+
const before = args.before ?? Date.now() - DEFAULT_RETENTION_MS;
|
|
230
237
|
|
|
231
238
|
// Both terminal states, queried explicitly (no query-in-loop): sent first,
|
|
232
239
|
// then failed for whatever batch budget remains.
|
|
@@ -247,7 +254,7 @@ export const prune = mutation({
|
|
|
247
254
|
: [];
|
|
248
255
|
|
|
249
256
|
for (const row of [...sent, ...failed]) {
|
|
250
|
-
await ctx.db.delete(row._id);
|
|
257
|
+
await ctx.db.delete("messages", row._id);
|
|
251
258
|
}
|
|
252
259
|
const removed = sent.length + failed.length;
|
|
253
260
|
|
package/src/jmap/send.test.ts
CHANGED
|
@@ -8,7 +8,12 @@ import {
|
|
|
8
8
|
sendViaJmap,
|
|
9
9
|
validateJmapConfig,
|
|
10
10
|
} from "./send.js";
|
|
11
|
-
import type {
|
|
11
|
+
import type {
|
|
12
|
+
JmapConfig,
|
|
13
|
+
JmapFetch,
|
|
14
|
+
JmapRequestInit,
|
|
15
|
+
JmapResponse,
|
|
16
|
+
} from "./types.js";
|
|
12
17
|
|
|
13
18
|
const CONFIG: JmapConfig = {
|
|
14
19
|
endpoint: "https://mail.example.com/jmap",
|
|
@@ -19,7 +24,10 @@ const CONFIG: JmapConfig = {
|
|
|
19
24
|
};
|
|
20
25
|
|
|
21
26
|
/** A canned JMAP HTTP response. */
|
|
22
|
-
function res(
|
|
27
|
+
function res(
|
|
28
|
+
body: unknown,
|
|
29
|
+
init?: { ok?: boolean; status?: number },
|
|
30
|
+
): JmapResponse {
|
|
23
31
|
return {
|
|
24
32
|
ok: init?.ok ?? true,
|
|
25
33
|
status: init?.status ?? 200,
|
|
@@ -38,7 +46,9 @@ function queueFetch(responses: JmapResponse[]): {
|
|
|
38
46
|
calls.push({ url, init });
|
|
39
47
|
const next = responses[i];
|
|
40
48
|
i += 1;
|
|
41
|
-
return
|
|
49
|
+
return next === undefined
|
|
50
|
+
? Promise.reject(new Error("No queued JMAP response"))
|
|
51
|
+
: Promise.resolve(next);
|
|
42
52
|
};
|
|
43
53
|
return { fetchFn, calls };
|
|
44
54
|
}
|
|
@@ -84,6 +94,8 @@ describe("validateJmapConfig", () => {
|
|
|
84
94
|
});
|
|
85
95
|
|
|
86
96
|
describe("buildEmailCreate", () => {
|
|
97
|
+
const BUILD_CONFIG = { mailboxId: "mb1" };
|
|
98
|
+
|
|
87
99
|
test("builds a multipart/alternative body when text and html are both set", () => {
|
|
88
100
|
const { email, envelope } = buildEmailCreate(
|
|
89
101
|
{
|
|
@@ -118,7 +130,7 @@ describe("buildEmailCreate", () => {
|
|
|
118
130
|
test("builds an html-only body and omits subject/replyTo/headers when absent", () => {
|
|
119
131
|
const { email } = buildEmailCreate(
|
|
120
132
|
{ to: "to@x.com", from: "f@x.com", html: "<p>h</p>" },
|
|
121
|
-
|
|
133
|
+
BUILD_CONFIG,
|
|
122
134
|
);
|
|
123
135
|
expect((email.bodyStructure as { type: string }).type).toBe("text/html");
|
|
124
136
|
expect(email.bodyValues).toEqual({ html: { value: "<p>h</p>" } });
|
|
@@ -130,7 +142,7 @@ describe("buildEmailCreate", () => {
|
|
|
130
142
|
test("builds a text-only body", () => {
|
|
131
143
|
const { email } = buildEmailCreate(
|
|
132
144
|
{ to: "to@x.com", from: "f@x.com", text: "plain" },
|
|
133
|
-
|
|
145
|
+
BUILD_CONFIG,
|
|
134
146
|
);
|
|
135
147
|
expect((email.bodyStructure as { type: string }).type).toBe("text/plain");
|
|
136
148
|
expect(email.bodyValues).toEqual({ text: { value: "plain" } });
|
|
@@ -139,7 +151,7 @@ describe("buildEmailCreate", () => {
|
|
|
139
151
|
test("falls back to config.from and splits a comma-separated recipient list", () => {
|
|
140
152
|
const { email, envelope } = buildEmailCreate(
|
|
141
153
|
{ to: "a@x.com, b@x.com ,c@x.com", text: "x" },
|
|
142
|
-
{ from: "cfg@x.com" },
|
|
154
|
+
{ ...BUILD_CONFIG, from: "cfg@x.com" },
|
|
143
155
|
);
|
|
144
156
|
expect(email.from).toEqual([{ email: "cfg@x.com" }]);
|
|
145
157
|
expect(email.to).toEqual([
|
|
@@ -151,52 +163,63 @@ describe("buildEmailCreate", () => {
|
|
|
151
163
|
});
|
|
152
164
|
|
|
153
165
|
test("rejects an empty or non-string `to`", () => {
|
|
154
|
-
expect(() => buildEmailCreate({ to: "", text: "x" }, { from: "f@x.com" })).toThrow(
|
|
155
|
-
/`to`/,
|
|
156
|
-
);
|
|
157
166
|
expect(() =>
|
|
158
|
-
buildEmailCreate(
|
|
167
|
+
buildEmailCreate(
|
|
168
|
+
{ to: "", text: "x" },
|
|
169
|
+
{ ...BUILD_CONFIG, from: "f@x.com" },
|
|
170
|
+
),
|
|
171
|
+
).toThrow(/`to`/);
|
|
172
|
+
expect(() =>
|
|
173
|
+
buildEmailCreate(
|
|
174
|
+
{ to: 5 as unknown as string, text: "x" },
|
|
175
|
+
{ ...BUILD_CONFIG, from: "f@x.com" },
|
|
176
|
+
),
|
|
159
177
|
).toThrow(/`to`/);
|
|
160
178
|
});
|
|
161
179
|
|
|
162
180
|
test("rejects a missing from (neither message nor config)", () => {
|
|
163
|
-
expect(() => buildEmailCreate({ to: "t@x.com", text: "x" }, {})).toThrow(/`from`/);
|
|
164
181
|
expect(() =>
|
|
165
|
-
buildEmailCreate({ to: "t@x.com",
|
|
182
|
+
buildEmailCreate({ to: "t@x.com", text: "x" }, BUILD_CONFIG),
|
|
183
|
+
).toThrow(/`from`/);
|
|
184
|
+
expect(() =>
|
|
185
|
+
buildEmailCreate({ to: "t@x.com", from: " ", text: "x" }, BUILD_CONFIG),
|
|
166
186
|
).toThrow(/`from`/);
|
|
167
187
|
});
|
|
168
188
|
|
|
169
189
|
test("rejects a body with neither text nor html", () => {
|
|
170
|
-
expect(() =>
|
|
171
|
-
|
|
172
|
-
);
|
|
190
|
+
expect(() =>
|
|
191
|
+
buildEmailCreate({ to: "t@x.com", from: "f@x.com" }, BUILD_CONFIG),
|
|
192
|
+
).toThrow(/text.*html/);
|
|
173
193
|
});
|
|
174
194
|
|
|
175
195
|
test("rejects a recipient list that resolves to no addresses", () => {
|
|
176
196
|
expect(() =>
|
|
177
|
-
buildEmailCreate(
|
|
197
|
+
buildEmailCreate(
|
|
198
|
+
{ to: " , , ", from: "f@x.com", text: "x" },
|
|
199
|
+
BUILD_CONFIG,
|
|
200
|
+
),
|
|
178
201
|
).toThrow(/at least one address/);
|
|
179
202
|
});
|
|
180
203
|
|
|
181
204
|
test("rejects CRLF injection in from, to, replyTo, subject, and headers", () => {
|
|
182
205
|
const base = { to: "t@x.com", from: "f@x.com", text: "x" };
|
|
183
|
-
expect(() => buildEmailCreate({ ...base, from: "f@x.com\r\nX" }, {})).toThrow(
|
|
184
|
-
/`from`/,
|
|
185
|
-
);
|
|
186
|
-
expect(() => buildEmailCreate({ ...base, to: "t@x.com\nBcc: e" }, {})).toThrow(
|
|
187
|
-
/`to`/,
|
|
188
|
-
);
|
|
189
206
|
expect(() =>
|
|
190
|
-
buildEmailCreate({ ...base,
|
|
207
|
+
buildEmailCreate({ ...base, from: "f@x.com\r\nX" }, BUILD_CONFIG),
|
|
208
|
+
).toThrow(/`from`/);
|
|
209
|
+
expect(() =>
|
|
210
|
+
buildEmailCreate({ ...base, to: "t@x.com\nBcc: e" }, BUILD_CONFIG),
|
|
211
|
+
).toThrow(/`to`/);
|
|
212
|
+
expect(() =>
|
|
213
|
+
buildEmailCreate({ ...base, replyTo: "r@x.com\rX" }, BUILD_CONFIG),
|
|
191
214
|
).toThrow(/`replyTo`/);
|
|
192
215
|
expect(() =>
|
|
193
|
-
buildEmailCreate({ ...base, subject: "Hi\r\nInjected" },
|
|
216
|
+
buildEmailCreate({ ...base, subject: "Hi\r\nInjected" }, BUILD_CONFIG),
|
|
194
217
|
).toThrow(/`subject`/);
|
|
195
218
|
expect(() =>
|
|
196
|
-
buildEmailCreate({ ...base, headers: { "X-A\nB": "v" } },
|
|
219
|
+
buildEmailCreate({ ...base, headers: { "X-A\nB": "v" } }, BUILD_CONFIG),
|
|
197
220
|
).toThrow(/headers/);
|
|
198
221
|
expect(() =>
|
|
199
|
-
buildEmailCreate({ ...base, headers: { "X-A": "v\r\nC" } },
|
|
222
|
+
buildEmailCreate({ ...base, headers: { "X-A": "v\r\nC" } }, BUILD_CONFIG),
|
|
200
223
|
).toThrow(/headers/);
|
|
201
224
|
});
|
|
202
225
|
});
|
|
@@ -212,13 +235,16 @@ describe("buildSubmitRequest", () => {
|
|
|
212
235
|
"urn:ietf:params:jmap:mail",
|
|
213
236
|
"urn:ietf:params:jmap:submission",
|
|
214
237
|
]);
|
|
215
|
-
const [emailCall, subCall] = req.methodCalls as
|
|
216
|
-
[string, Record<string, unknown>, string]
|
|
217
|
-
|
|
238
|
+
const [emailCall, subCall] = req.methodCalls as [
|
|
239
|
+
[string, Record<string, unknown>, string],
|
|
240
|
+
[string, Record<string, unknown>, string],
|
|
241
|
+
];
|
|
218
242
|
expect(emailCall[0]).toBe("Email/set");
|
|
219
243
|
expect(emailCall[1].accountId).toBe("acc1");
|
|
220
244
|
expect(subCall[0]).toBe("EmailSubmission/set");
|
|
221
|
-
const create = subCall[1].create as {
|
|
245
|
+
const create = subCall[1].create as {
|
|
246
|
+
sub: { emailId: string; identityId: string };
|
|
247
|
+
};
|
|
222
248
|
expect(create.sub.emailId).toBe("#draft");
|
|
223
249
|
expect(create.sub.identityId).toBe("id1");
|
|
224
250
|
});
|
|
@@ -241,7 +267,10 @@ describe("parseSubmitResponse", () => {
|
|
|
241
267
|
["EmailSubmission/set", { created: { sub: { id: "S1" } } }, "1"],
|
|
242
268
|
],
|
|
243
269
|
};
|
|
244
|
-
expect(parseSubmitResponse(body)).toEqual({
|
|
270
|
+
expect(parseSubmitResponse(body)).toEqual({
|
|
271
|
+
messageId: "S1",
|
|
272
|
+
emailId: "E1",
|
|
273
|
+
});
|
|
245
274
|
});
|
|
246
275
|
|
|
247
276
|
test("throws on a non-object response", () => {
|
|
@@ -254,7 +283,9 @@ describe("parseSubmitResponse", () => {
|
|
|
254
283
|
|
|
255
284
|
test("throws on a method-level error (with and without a type)", () => {
|
|
256
285
|
expect(() =>
|
|
257
|
-
parseSubmitResponse({
|
|
286
|
+
parseSubmitResponse({
|
|
287
|
+
methodResponses: [["error", { type: "unknownMethod" }, "0"]],
|
|
288
|
+
}),
|
|
258
289
|
).toThrow(/unknownMethod/);
|
|
259
290
|
expect(() =>
|
|
260
291
|
parseSubmitResponse({ methodResponses: [["error", {}, "0"]] }),
|
|
@@ -267,7 +298,9 @@ describe("parseSubmitResponse", () => {
|
|
|
267
298
|
test("throws when Email/set or EmailSubmission/set is missing", () => {
|
|
268
299
|
expect(() =>
|
|
269
300
|
parseSubmitResponse({
|
|
270
|
-
methodResponses: [
|
|
301
|
+
methodResponses: [
|
|
302
|
+
["Email/set", { created: { draft: { id: "E1" } } }, "0"],
|
|
303
|
+
],
|
|
271
304
|
}),
|
|
272
305
|
).toThrow(/missing Email\/set or EmailSubmission\/set/);
|
|
273
306
|
});
|
|
@@ -296,7 +329,11 @@ describe("parseSubmitResponse", () => {
|
|
|
296
329
|
parseSubmitResponse({
|
|
297
330
|
methodResponses: [
|
|
298
331
|
["Email/set", { created: { draft: { id: "E1" } } }, "0"],
|
|
299
|
-
[
|
|
332
|
+
[
|
|
333
|
+
"EmailSubmission/set",
|
|
334
|
+
{ notCreated: { sub: { type: "forbidden" } } },
|
|
335
|
+
"1",
|
|
336
|
+
],
|
|
300
337
|
],
|
|
301
338
|
}),
|
|
302
339
|
).toThrow(/EmailSubmission not created \(forbidden\)/);
|
|
@@ -340,25 +377,35 @@ describe("sendViaJmap (injected fetch)", () => {
|
|
|
340
377
|
);
|
|
341
378
|
expect(result).toEqual({ messageId: "S1", emailId: "E1" });
|
|
342
379
|
expect(calls).toHaveLength(1);
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
expect(
|
|
380
|
+
const [call] = calls;
|
|
381
|
+
if (call === undefined) throw new Error("Expected one JMAP request");
|
|
382
|
+
expect(call.url).toBe(CONFIG.endpoint);
|
|
383
|
+
expect(call.init.method).toBe("POST");
|
|
384
|
+
expect(call.init.headers.Authorization).toBe("Bearer tok");
|
|
346
385
|
});
|
|
347
386
|
|
|
348
387
|
test("throws on a non-2xx HTTP status", async () => {
|
|
349
388
|
const { fetchFn } = queueFetch([res(null, { ok: false, status: 401 })]);
|
|
350
389
|
await expect(
|
|
351
|
-
sendViaJmap(
|
|
390
|
+
sendViaJmap(
|
|
391
|
+
fetchFn,
|
|
392
|
+
{ to: "t@x.com", from: "f@x.com", text: "x" },
|
|
393
|
+
CONFIG,
|
|
394
|
+
),
|
|
352
395
|
).rejects.toThrow(/HTTP 401/);
|
|
353
396
|
});
|
|
354
397
|
|
|
355
398
|
test("rejects an invalid config before any fetch", async () => {
|
|
356
399
|
const { fetchFn, calls } = queueFetch([res(sendOkBody())]);
|
|
357
400
|
await expect(
|
|
358
|
-
sendViaJmap(
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
401
|
+
sendViaJmap(
|
|
402
|
+
fetchFn,
|
|
403
|
+
{ to: "t@x.com", from: "f@x.com", text: "x" },
|
|
404
|
+
{
|
|
405
|
+
...CONFIG,
|
|
406
|
+
endpoint: "",
|
|
407
|
+
},
|
|
408
|
+
),
|
|
362
409
|
).rejects.toThrow(/endpoint/);
|
|
363
410
|
expect(calls).toHaveLength(0);
|
|
364
411
|
});
|
|
@@ -394,7 +441,8 @@ describe("discoverJmapSession", () => {
|
|
|
394
441
|
],
|
|
395
442
|
],
|
|
396
443
|
});
|
|
397
|
-
const mailboxesBody = (list: unknown) =>
|
|
444
|
+
const mailboxesBody = (list: unknown) =>
|
|
445
|
+
res({ methodResponses: [["Mailbox/get", { list }, "0"]] });
|
|
398
446
|
|
|
399
447
|
test("resolves endpoint, account, sent mailbox, and identity by `from`", async () => {
|
|
400
448
|
const { fetchFn } = queueFetch([
|
|
@@ -426,7 +474,10 @@ describe("discoverJmapSession", () => {
|
|
|
426
474
|
identitiesOk(),
|
|
427
475
|
mailboxesBody([{ id: "mbDrafts", role: "drafts" }]),
|
|
428
476
|
]);
|
|
429
|
-
const cfg = await discoverJmapSession(fetchFn, {
|
|
477
|
+
const cfg = await discoverJmapSession(fetchFn, {
|
|
478
|
+
sessionUrl,
|
|
479
|
+
token: "tok",
|
|
480
|
+
});
|
|
430
481
|
expect(cfg.identityId).toBe("idA");
|
|
431
482
|
expect(cfg.from).toBe("a@x.com");
|
|
432
483
|
expect(cfg.mailboxId).toBe("mbDrafts");
|
|
@@ -476,7 +527,9 @@ describe("discoverJmapSession", () => {
|
|
|
476
527
|
});
|
|
477
528
|
|
|
478
529
|
test("throws when there is no primary mail account (missing or empty)", async () => {
|
|
479
|
-
const { fetchFn: f1 } = queueFetch([
|
|
530
|
+
const { fetchFn: f1 } = queueFetch([
|
|
531
|
+
res({ apiUrl: "u", primaryAccounts: {} }),
|
|
532
|
+
]);
|
|
480
533
|
await expect(
|
|
481
534
|
discoverJmapSession(f1, { sessionUrl, token: "tok" }),
|
|
482
535
|
).rejects.toThrow(/no primary mail account/);
|
|
@@ -487,7 +540,10 @@ describe("discoverJmapSession", () => {
|
|
|
487
540
|
});
|
|
488
541
|
|
|
489
542
|
test("throws on a failed Identity/get HTTP request", async () => {
|
|
490
|
-
const { fetchFn } = queueFetch([
|
|
543
|
+
const { fetchFn } = queueFetch([
|
|
544
|
+
sessionOk(),
|
|
545
|
+
res(null, { ok: false, status: 500 }),
|
|
546
|
+
]);
|
|
491
547
|
await expect(
|
|
492
548
|
discoverJmapSession(fetchFn, { sessionUrl, token: "tok" }),
|
|
493
549
|
).rejects.toThrow(/HTTP 500/);
|
|
@@ -515,7 +571,11 @@ describe("discoverJmapSession", () => {
|
|
|
515
571
|
await expect(
|
|
516
572
|
discoverJmapSession(f1, { sessionUrl, token: "tok" }),
|
|
517
573
|
).rejects.toThrow(/malformed/);
|
|
518
|
-
const { fetchFn: f2 } = queueFetch([
|
|
574
|
+
const { fetchFn: f2 } = queueFetch([
|
|
575
|
+
sessionOk(),
|
|
576
|
+
identitiesOk(),
|
|
577
|
+
mailboxesBody([]),
|
|
578
|
+
]);
|
|
519
579
|
await expect(
|
|
520
580
|
discoverJmapSession(f2, { sessionUrl, token: "tok" }),
|
|
521
581
|
).rejects.toThrow(/no sent or drafts mailbox/);
|
|
@@ -543,7 +603,10 @@ describe("discoverJmapSession", () => {
|
|
|
543
603
|
}),
|
|
544
604
|
mailboxesBody([99, { role: "sent" }, { id: "mbReal", role: "sent" }]),
|
|
545
605
|
]);
|
|
546
|
-
const cfg = await discoverJmapSession(fetchFn, {
|
|
606
|
+
const cfg = await discoverJmapSession(fetchFn, {
|
|
607
|
+
sessionUrl,
|
|
608
|
+
token: "tok",
|
|
609
|
+
});
|
|
547
610
|
expect(cfg.identityId).toBe("idOk");
|
|
548
611
|
expect(cfg.mailboxId).toBe("mbReal");
|
|
549
612
|
});
|
|
@@ -553,13 +616,19 @@ describe("createJmapSender", () => {
|
|
|
553
616
|
test("binds the config + fetch and sends one message", async () => {
|
|
554
617
|
const { fetchFn, calls } = queueFetch([res(sendOkBody("E1", "S1"))]);
|
|
555
618
|
const send = createJmapSender(CONFIG, fetchFn);
|
|
556
|
-
const result = await send({
|
|
619
|
+
const result = await send({
|
|
620
|
+
to: "to@x.com",
|
|
621
|
+
from: "f@x.com",
|
|
622
|
+
html: "<p>h</p>",
|
|
623
|
+
});
|
|
557
624
|
expect(result).toEqual({ messageId: "S1", emailId: "E1" });
|
|
558
625
|
expect(calls).toHaveLength(1);
|
|
559
626
|
});
|
|
560
627
|
|
|
561
628
|
test("throws eagerly on an invalid config", () => {
|
|
562
629
|
const { fetchFn } = queueFetch([]);
|
|
563
|
-
expect(() => createJmapSender({ ...CONFIG, token: "" }, fetchFn)).toThrow(
|
|
630
|
+
expect(() => createJmapSender({ ...CONFIG, token: "" }, fetchFn)).toThrow(
|
|
631
|
+
/token/,
|
|
632
|
+
);
|
|
564
633
|
});
|
|
565
634
|
});
|
package/src/shared.ts
CHANGED
package/src/smtp/send.test.ts
CHANGED
|
@@ -56,7 +56,9 @@ describe("validateSmtpConfig", () => {
|
|
|
56
56
|
|
|
57
57
|
test("rejects an out-of-range, non-integer, or non-number port", () => {
|
|
58
58
|
expect(() => validateSmtpConfig({ host: "h", port: 0 })).toThrow(/port/);
|
|
59
|
-
expect(() => validateSmtpConfig({ host: "h", port: 70000 })).toThrow(
|
|
59
|
+
expect(() => validateSmtpConfig({ host: "h", port: 70000 })).toThrow(
|
|
60
|
+
/port/,
|
|
61
|
+
);
|
|
60
62
|
expect(() => validateSmtpConfig({ host: "h", port: 5.5 })).toThrow(/port/);
|
|
61
63
|
expect(() =>
|
|
62
64
|
validateSmtpConfig({ host: "h", port: "25" as unknown as number }),
|
|
@@ -107,7 +109,10 @@ describe("toMailOptions", () => {
|
|
|
107
109
|
});
|
|
108
110
|
|
|
109
111
|
test("falls back to config.from when the message omits from", () => {
|
|
110
|
-
const opts = toMailOptions(
|
|
112
|
+
const opts = toMailOptions(
|
|
113
|
+
{ to: "to@x.com", text: "t" },
|
|
114
|
+
{ from: "cfg@x.com" },
|
|
115
|
+
);
|
|
111
116
|
expect(opts.from).toBe("cfg@x.com");
|
|
112
117
|
});
|
|
113
118
|
|
|
@@ -119,21 +124,24 @@ describe("toMailOptions", () => {
|
|
|
119
124
|
});
|
|
120
125
|
|
|
121
126
|
test("rejects a missing from (neither message nor config supplies one)", () => {
|
|
122
|
-
expect(() => toMailOptions({ to: "to@x.com", text: "t" }, {})).toThrow(
|
|
127
|
+
expect(() => toMailOptions({ to: "to@x.com", text: "t" }, {})).toThrow(
|
|
128
|
+
/`from`/,
|
|
129
|
+
);
|
|
123
130
|
expect(() =>
|
|
124
131
|
toMailOptions({ to: "to@x.com", from: " ", text: "t" }, {}),
|
|
125
132
|
).toThrow(/`from`/);
|
|
126
133
|
});
|
|
127
134
|
|
|
128
135
|
test("rejects a body with neither text nor html", () => {
|
|
129
|
-
expect(() =>
|
|
130
|
-
|
|
131
|
-
);
|
|
136
|
+
expect(() =>
|
|
137
|
+
toMailOptions({ to: "to@x.com", from: "f@x.com" }, {}),
|
|
138
|
+
).toThrow(/text.*html/);
|
|
132
139
|
});
|
|
133
140
|
|
|
134
141
|
test("accepts an html-only and a text-only body", () => {
|
|
135
142
|
expect(
|
|
136
|
-
toMailOptions({ to: "t@x.com", from: "f@x.com", html: "<p>x</p>" }, {})
|
|
143
|
+
toMailOptions({ to: "t@x.com", from: "f@x.com", html: "<p>x</p>" }, {})
|
|
144
|
+
.html,
|
|
137
145
|
).toBe("<p>x</p>");
|
|
138
146
|
expect(
|
|
139
147
|
toMailOptions({ to: "t@x.com", from: "f@x.com", text: "x" }, {}).text,
|
|
@@ -142,15 +150,15 @@ describe("toMailOptions", () => {
|
|
|
142
150
|
|
|
143
151
|
test("rejects CRLF injection in to, from, replyTo, subject, and headers", () => {
|
|
144
152
|
const base = { to: "t@x.com", from: "f@x.com", text: "x" };
|
|
145
|
-
expect(() => toMailOptions({ ...base, to: "t@x.com\r\nBCC: e" }, {})).toThrow(
|
|
146
|
-
/`to`/,
|
|
147
|
-
);
|
|
148
|
-
expect(() =>
|
|
149
|
-
toMailOptions({ ...base, from: "f@x.com\nDATA" }, {}),
|
|
150
|
-
).toThrow(/`from`/);
|
|
151
153
|
expect(() =>
|
|
152
|
-
toMailOptions({ ...base,
|
|
153
|
-
).toThrow(/`
|
|
154
|
+
toMailOptions({ ...base, to: "t@x.com\r\nBCC: e" }, {}),
|
|
155
|
+
).toThrow(/`to`/);
|
|
156
|
+
expect(() => toMailOptions({ ...base, from: "f@x.com\nDATA" }, {})).toThrow(
|
|
157
|
+
/`from`/,
|
|
158
|
+
);
|
|
159
|
+
expect(() => toMailOptions({ ...base, replyTo: "r@x.com\rX" }, {})).toThrow(
|
|
160
|
+
/`replyTo`/,
|
|
161
|
+
);
|
|
154
162
|
expect(() =>
|
|
155
163
|
toMailOptions({ ...base, subject: "Hi\r\nInjected" }, {}),
|
|
156
164
|
).toThrow(/`subject`/);
|
|
@@ -163,7 +171,10 @@ describe("toMailOptions", () => {
|
|
|
163
171
|
});
|
|
164
172
|
|
|
165
173
|
test("accepts a clean message with optional fields omitted", () => {
|
|
166
|
-
const opts = toMailOptions(
|
|
174
|
+
const opts = toMailOptions(
|
|
175
|
+
{ to: "t@x.com", from: "f@x.com", text: "x" },
|
|
176
|
+
{},
|
|
177
|
+
);
|
|
167
178
|
expect(opts.subject).toBeUndefined();
|
|
168
179
|
expect(opts.replyTo).toBeUndefined();
|
|
169
180
|
expect(opts.headers).toBeUndefined();
|
|
@@ -188,8 +199,10 @@ describe("sendViaSmtp (injected transport)", () => {
|
|
|
188
199
|
rejected: [],
|
|
189
200
|
});
|
|
190
201
|
expect(calls).toHaveLength(1);
|
|
191
|
-
|
|
192
|
-
|
|
202
|
+
const [call] = calls;
|
|
203
|
+
if (call === undefined) throw new Error("Expected one SMTP request");
|
|
204
|
+
expect(call.from).toBe("no-reply@app.com");
|
|
205
|
+
expect(call.to).toBe("to@x.com");
|
|
193
206
|
});
|
|
194
207
|
|
|
195
208
|
test("flattens object-form accepted/rejected address entries", async () => {
|
|
@@ -198,27 +211,35 @@ describe("sendViaSmtp (injected transport)", () => {
|
|
|
198
211
|
accepted: [{ address: "ok@x.com" }, "two@x.com"],
|
|
199
212
|
rejected: [{ address: "no@x.com" }],
|
|
200
213
|
});
|
|
201
|
-
const result = await sendViaSmtp(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
214
|
+
const result = await sendViaSmtp(transport, {
|
|
215
|
+
to: "ok@x.com",
|
|
216
|
+
from: "f@x.com",
|
|
217
|
+
text: "x",
|
|
218
|
+
});
|
|
205
219
|
expect(result.accepted).toEqual(["ok@x.com", "two@x.com"]);
|
|
206
220
|
expect(result.rejected).toEqual(["no@x.com"]);
|
|
207
221
|
});
|
|
208
222
|
|
|
209
223
|
test("defaults messageId to '' and accepted/rejected to [] when absent", async () => {
|
|
210
224
|
const { transport } = fakeTransport({});
|
|
211
|
-
const result = await sendViaSmtp(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
225
|
+
const result = await sendViaSmtp(transport, {
|
|
226
|
+
to: "t@x.com",
|
|
227
|
+
from: "f@x.com",
|
|
228
|
+
text: "x",
|
|
229
|
+
});
|
|
215
230
|
expect(result).toEqual({ messageId: "", accepted: [], rejected: [] });
|
|
216
231
|
});
|
|
217
232
|
|
|
218
233
|
test("uses the default empty config when none is passed", async () => {
|
|
219
234
|
const { transport, calls } = fakeTransport({ messageId: "x" });
|
|
220
|
-
await sendViaSmtp(transport, {
|
|
221
|
-
|
|
235
|
+
await sendViaSmtp(transport, {
|
|
236
|
+
to: "t@x.com",
|
|
237
|
+
from: "msg@x.com",
|
|
238
|
+
text: "x",
|
|
239
|
+
});
|
|
240
|
+
const [call] = calls;
|
|
241
|
+
if (call === undefined) throw new Error("Expected one SMTP request");
|
|
242
|
+
expect(call.from).toBe("msg@x.com");
|
|
222
243
|
});
|
|
223
244
|
|
|
224
245
|
test("propagates a transport send failure to the caller", async () => {
|