@growth-labs/mailer 0.3.0 → 0.4.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.
Files changed (54) hide show
  1. package/dist/index.d.ts +1 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +0 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/options.d.ts +24 -14
  6. package/dist/options.d.ts.map +1 -1
  7. package/dist/options.js +4 -0
  8. package/dist/options.js.map +1 -1
  9. package/dist/queue/consumer.d.ts +1 -6
  10. package/dist/queue/consumer.d.ts.map +1 -1
  11. package/dist/queue/consumer.js +46 -14
  12. package/dist/queue/consumer.js.map +1 -1
  13. package/dist/routes/track-click.js +1 -1
  14. package/dist/routes/track-click.js.map +1 -1
  15. package/dist/routes/track-open.js +1 -1
  16. package/dist/routes/track-open.js.map +1 -1
  17. package/dist/schema/index.d.ts +3 -0
  18. package/dist/schema/index.d.ts.map +1 -0
  19. package/dist/schema/index.js +3 -0
  20. package/dist/schema/index.js.map +1 -0
  21. package/dist/schema/sends.d.ts +312 -0
  22. package/dist/schema/sends.d.ts.map +1 -0
  23. package/dist/schema/sends.js +26 -0
  24. package/dist/schema/sends.js.map +1 -0
  25. package/dist/schema/subscribers.d.ts +253 -0
  26. package/dist/schema/subscribers.d.ts.map +1 -0
  27. package/dist/schema/subscribers.js +21 -0
  28. package/dist/schema/subscribers.js.map +1 -0
  29. package/dist/types.d.ts +30 -0
  30. package/dist/types.d.ts.map +1 -1
  31. package/dist/utils/bounce.d.ts.map +1 -1
  32. package/dist/utils/bounce.js +2 -1
  33. package/dist/utils/bounce.js.map +1 -1
  34. package/dist/utils/send.d.ts +7 -4
  35. package/dist/utils/send.d.ts.map +1 -1
  36. package/dist/utils/send.js +24 -9
  37. package/dist/utils/send.js.map +1 -1
  38. package/dist/utils/subscribers.js +1 -1
  39. package/dist/utils/subscribers.js.map +1 -1
  40. package/package.json +12 -4
  41. package/src/index.ts +2 -1
  42. package/src/options.ts +6 -0
  43. package/src/queue/consumer.ts +73 -20
  44. package/src/routes/track-click.ts +1 -1
  45. package/src/routes/track-open.ts +1 -1
  46. package/src/schema/index.ts +2 -0
  47. package/src/schema/sends.ts +30 -0
  48. package/src/schema/subscribers.ts +25 -0
  49. package/src/types.ts +37 -0
  50. package/src/utils/bounce.ts +2 -1
  51. package/src/utils/send.ts +43 -12
  52. package/src/utils/subscribers.ts +1 -1
  53. package/src/virtual.d.ts +4 -0
  54. package/src/schema.ts +0 -56
@@ -0,0 +1,312 @@
1
+ export declare const emailSends: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
2
+ name: "gl_email_sends";
3
+ schema: undefined;
4
+ columns: {
5
+ id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
6
+ name: "id";
7
+ tableName: "gl_email_sends";
8
+ dataType: "string";
9
+ columnType: "SQLiteText";
10
+ data: string;
11
+ driverParam: string;
12
+ notNull: true;
13
+ hasDefault: false;
14
+ isPrimaryKey: true;
15
+ isAutoincrement: false;
16
+ hasRuntimeDefault: false;
17
+ enumValues: [string, ...string[]];
18
+ baseColumn: never;
19
+ identity: undefined;
20
+ generated: undefined;
21
+ }, {}, {
22
+ length: number | undefined;
23
+ }>;
24
+ subscriberId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
25
+ name: "subscriber_id";
26
+ tableName: "gl_email_sends";
27
+ dataType: "string";
28
+ columnType: "SQLiteText";
29
+ data: string;
30
+ driverParam: string;
31
+ notNull: true;
32
+ hasDefault: false;
33
+ isPrimaryKey: false;
34
+ isAutoincrement: false;
35
+ hasRuntimeDefault: false;
36
+ enumValues: [string, ...string[]];
37
+ baseColumn: never;
38
+ identity: undefined;
39
+ generated: undefined;
40
+ }, {}, {
41
+ length: number | undefined;
42
+ }>;
43
+ campaignId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
44
+ name: "campaign_id";
45
+ tableName: "gl_email_sends";
46
+ dataType: "string";
47
+ columnType: "SQLiteText";
48
+ data: string;
49
+ driverParam: string;
50
+ notNull: false;
51
+ hasDefault: false;
52
+ isPrimaryKey: false;
53
+ isAutoincrement: false;
54
+ hasRuntimeDefault: false;
55
+ enumValues: [string, ...string[]];
56
+ baseColumn: never;
57
+ identity: undefined;
58
+ generated: undefined;
59
+ }, {}, {
60
+ length: number | undefined;
61
+ }>;
62
+ email: import("drizzle-orm/sqlite-core").SQLiteColumn<{
63
+ name: "email";
64
+ tableName: "gl_email_sends";
65
+ dataType: "string";
66
+ columnType: "SQLiteText";
67
+ data: string;
68
+ driverParam: string;
69
+ notNull: true;
70
+ hasDefault: false;
71
+ isPrimaryKey: false;
72
+ isAutoincrement: false;
73
+ hasRuntimeDefault: false;
74
+ enumValues: [string, ...string[]];
75
+ baseColumn: never;
76
+ identity: undefined;
77
+ generated: undefined;
78
+ }, {}, {
79
+ length: number | undefined;
80
+ }>;
81
+ subject: import("drizzle-orm/sqlite-core").SQLiteColumn<{
82
+ name: "subject";
83
+ tableName: "gl_email_sends";
84
+ dataType: "string";
85
+ columnType: "SQLiteText";
86
+ data: string;
87
+ driverParam: string;
88
+ notNull: true;
89
+ hasDefault: false;
90
+ isPrimaryKey: false;
91
+ isAutoincrement: false;
92
+ hasRuntimeDefault: false;
93
+ enumValues: [string, ...string[]];
94
+ baseColumn: never;
95
+ identity: undefined;
96
+ generated: undefined;
97
+ }, {}, {
98
+ length: number | undefined;
99
+ }>;
100
+ type: import("drizzle-orm/sqlite-core").SQLiteColumn<{
101
+ name: "type";
102
+ tableName: "gl_email_sends";
103
+ dataType: "string";
104
+ columnType: "SQLiteText";
105
+ data: string;
106
+ driverParam: string;
107
+ notNull: true;
108
+ hasDefault: false;
109
+ isPrimaryKey: false;
110
+ isAutoincrement: false;
111
+ hasRuntimeDefault: false;
112
+ enumValues: [string, ...string[]];
113
+ baseColumn: never;
114
+ identity: undefined;
115
+ generated: undefined;
116
+ }, {}, {
117
+ length: number | undefined;
118
+ }>;
119
+ status: import("drizzle-orm/sqlite-core").SQLiteColumn<{
120
+ name: "status";
121
+ tableName: "gl_email_sends";
122
+ dataType: "string";
123
+ columnType: "SQLiteText";
124
+ data: string;
125
+ driverParam: string;
126
+ notNull: true;
127
+ hasDefault: true;
128
+ isPrimaryKey: false;
129
+ isAutoincrement: false;
130
+ hasRuntimeDefault: false;
131
+ enumValues: [string, ...string[]];
132
+ baseColumn: never;
133
+ identity: undefined;
134
+ generated: undefined;
135
+ }, {}, {
136
+ length: number | undefined;
137
+ }>;
138
+ sentAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
139
+ name: "sent_at";
140
+ tableName: "gl_email_sends";
141
+ dataType: "string";
142
+ columnType: "SQLiteText";
143
+ data: string;
144
+ driverParam: string;
145
+ notNull: false;
146
+ hasDefault: false;
147
+ isPrimaryKey: false;
148
+ isAutoincrement: false;
149
+ hasRuntimeDefault: false;
150
+ enumValues: [string, ...string[]];
151
+ baseColumn: never;
152
+ identity: undefined;
153
+ generated: undefined;
154
+ }, {}, {
155
+ length: number | undefined;
156
+ }>;
157
+ deliveredAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
158
+ name: "delivered_at";
159
+ tableName: "gl_email_sends";
160
+ dataType: "string";
161
+ columnType: "SQLiteText";
162
+ data: string;
163
+ driverParam: string;
164
+ notNull: false;
165
+ hasDefault: false;
166
+ isPrimaryKey: false;
167
+ isAutoincrement: false;
168
+ hasRuntimeDefault: false;
169
+ enumValues: [string, ...string[]];
170
+ baseColumn: never;
171
+ identity: undefined;
172
+ generated: undefined;
173
+ }, {}, {
174
+ length: number | undefined;
175
+ }>;
176
+ openedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
177
+ name: "opened_at";
178
+ tableName: "gl_email_sends";
179
+ dataType: "string";
180
+ columnType: "SQLiteText";
181
+ data: string;
182
+ driverParam: string;
183
+ notNull: false;
184
+ hasDefault: false;
185
+ isPrimaryKey: false;
186
+ isAutoincrement: false;
187
+ hasRuntimeDefault: false;
188
+ enumValues: [string, ...string[]];
189
+ baseColumn: never;
190
+ identity: undefined;
191
+ generated: undefined;
192
+ }, {}, {
193
+ length: number | undefined;
194
+ }>;
195
+ clickedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
196
+ name: "clicked_at";
197
+ tableName: "gl_email_sends";
198
+ dataType: "string";
199
+ columnType: "SQLiteText";
200
+ data: string;
201
+ driverParam: string;
202
+ notNull: false;
203
+ hasDefault: false;
204
+ isPrimaryKey: false;
205
+ isAutoincrement: false;
206
+ hasRuntimeDefault: false;
207
+ enumValues: [string, ...string[]];
208
+ baseColumn: never;
209
+ identity: undefined;
210
+ generated: undefined;
211
+ }, {}, {
212
+ length: number | undefined;
213
+ }>;
214
+ bouncedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
215
+ name: "bounced_at";
216
+ tableName: "gl_email_sends";
217
+ dataType: "string";
218
+ columnType: "SQLiteText";
219
+ data: string;
220
+ driverParam: string;
221
+ notNull: false;
222
+ hasDefault: false;
223
+ isPrimaryKey: false;
224
+ isAutoincrement: false;
225
+ hasRuntimeDefault: false;
226
+ enumValues: [string, ...string[]];
227
+ baseColumn: never;
228
+ identity: undefined;
229
+ generated: undefined;
230
+ }, {}, {
231
+ length: number | undefined;
232
+ }>;
233
+ bounceType: import("drizzle-orm/sqlite-core").SQLiteColumn<{
234
+ name: "bounce_type";
235
+ tableName: "gl_email_sends";
236
+ dataType: "string";
237
+ columnType: "SQLiteText";
238
+ data: string;
239
+ driverParam: string;
240
+ notNull: false;
241
+ hasDefault: false;
242
+ isPrimaryKey: false;
243
+ isAutoincrement: false;
244
+ hasRuntimeDefault: false;
245
+ enumValues: [string, ...string[]];
246
+ baseColumn: never;
247
+ identity: undefined;
248
+ generated: undefined;
249
+ }, {}, {
250
+ length: number | undefined;
251
+ }>;
252
+ complainedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
253
+ name: "complained_at";
254
+ tableName: "gl_email_sends";
255
+ dataType: "string";
256
+ columnType: "SQLiteText";
257
+ data: string;
258
+ driverParam: string;
259
+ notNull: false;
260
+ hasDefault: false;
261
+ isPrimaryKey: false;
262
+ isAutoincrement: false;
263
+ hasRuntimeDefault: false;
264
+ enumValues: [string, ...string[]];
265
+ baseColumn: never;
266
+ identity: undefined;
267
+ generated: undefined;
268
+ }, {}, {
269
+ length: number | undefined;
270
+ }>;
271
+ trackingId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
272
+ name: "tracking_id";
273
+ tableName: "gl_email_sends";
274
+ dataType: "string";
275
+ columnType: "SQLiteText";
276
+ data: string;
277
+ driverParam: string;
278
+ notNull: true;
279
+ hasDefault: false;
280
+ isPrimaryKey: false;
281
+ isAutoincrement: false;
282
+ hasRuntimeDefault: false;
283
+ enumValues: [string, ...string[]];
284
+ baseColumn: never;
285
+ identity: undefined;
286
+ generated: undefined;
287
+ }, {}, {
288
+ length: number | undefined;
289
+ }>;
290
+ createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
291
+ name: "created_at";
292
+ tableName: "gl_email_sends";
293
+ dataType: "string";
294
+ columnType: "SQLiteText";
295
+ data: string;
296
+ driverParam: string;
297
+ notNull: true;
298
+ hasDefault: false;
299
+ isPrimaryKey: false;
300
+ isAutoincrement: false;
301
+ hasRuntimeDefault: false;
302
+ enumValues: [string, ...string[]];
303
+ baseColumn: never;
304
+ identity: undefined;
305
+ generated: undefined;
306
+ }, {}, {
307
+ length: number | undefined;
308
+ }>;
309
+ };
310
+ dialect: "sqlite";
311
+ }>;
312
+ //# sourceMappingURL=sends.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sends.d.ts","sourceRoot":"","sources":["../../src/schema/sends.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BtB,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { index, sqliteTable, text } from 'drizzle-orm/sqlite-core';
2
+ export const emailSends = sqliteTable('gl_email_sends', {
3
+ id: text('id').primaryKey(),
4
+ subscriberId: text('subscriber_id').notNull(),
5
+ campaignId: text('campaign_id'),
6
+ email: text('email').notNull(),
7
+ subject: text('subject').notNull(),
8
+ type: text('type').notNull(),
9
+ status: text('status').notNull().default('queued'),
10
+ sentAt: text('sent_at'),
11
+ deliveredAt: text('delivered_at'),
12
+ openedAt: text('opened_at'),
13
+ clickedAt: text('clicked_at'),
14
+ bouncedAt: text('bounced_at'),
15
+ bounceType: text('bounce_type'),
16
+ complainedAt: text('complained_at'),
17
+ trackingId: text('tracking_id').notNull().unique(),
18
+ createdAt: text('created_at').notNull(),
19
+ }, (table) => [
20
+ index('idx_sends_subscriber').on(table.subscriberId),
21
+ index('idx_sends_campaign').on(table.campaignId),
22
+ index('idx_sends_tracking').on(table.trackingId),
23
+ index('idx_sends_status').on(table.status),
24
+ index('idx_sends_type_created').on(table.type, table.createdAt),
25
+ ]);
26
+ //# sourceMappingURL=sends.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sends.js","sourceRoot":"","sources":["../../src/schema/sends.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAElE,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CACpC,gBAAgB,EAChB;IACC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE;IAC7C,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC;IAC/B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE;IAC9B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE;IAClC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;IAC5B,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;IAClD,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC;IACvB,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC;IACjC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC;IAC3B,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;IAC7B,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;IAC7B,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC;IAC/B,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC;IACnC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE;IAClD,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;CACvC,EACD,CAAC,KAAK,EAAE,EAAE,CAAC;IACV,KAAK,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC;IACpD,KAAK,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC;IAChD,KAAK,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC;IAChD,KAAK,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;IAC1C,KAAK,CAAC,wBAAwB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;CAC/D,CACD,CAAA"}
@@ -0,0 +1,253 @@
1
+ export declare const subscribers: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
2
+ name: "gl_subscribers";
3
+ schema: undefined;
4
+ columns: {
5
+ id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
6
+ name: "id";
7
+ tableName: "gl_subscribers";
8
+ dataType: "string";
9
+ columnType: "SQLiteText";
10
+ data: string;
11
+ driverParam: string;
12
+ notNull: true;
13
+ hasDefault: false;
14
+ isPrimaryKey: true;
15
+ isAutoincrement: false;
16
+ hasRuntimeDefault: false;
17
+ enumValues: [string, ...string[]];
18
+ baseColumn: never;
19
+ identity: undefined;
20
+ generated: undefined;
21
+ }, {}, {
22
+ length: number | undefined;
23
+ }>;
24
+ email: import("drizzle-orm/sqlite-core").SQLiteColumn<{
25
+ name: "email";
26
+ tableName: "gl_subscribers";
27
+ dataType: "string";
28
+ columnType: "SQLiteText";
29
+ data: string;
30
+ driverParam: string;
31
+ notNull: true;
32
+ hasDefault: false;
33
+ isPrimaryKey: false;
34
+ isAutoincrement: false;
35
+ hasRuntimeDefault: false;
36
+ enumValues: [string, ...string[]];
37
+ baseColumn: never;
38
+ identity: undefined;
39
+ generated: undefined;
40
+ }, {}, {
41
+ length: number | undefined;
42
+ }>;
43
+ name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
44
+ name: "name";
45
+ tableName: "gl_subscribers";
46
+ dataType: "string";
47
+ columnType: "SQLiteText";
48
+ data: string;
49
+ driverParam: string;
50
+ notNull: false;
51
+ hasDefault: false;
52
+ isPrimaryKey: false;
53
+ isAutoincrement: false;
54
+ hasRuntimeDefault: false;
55
+ enumValues: [string, ...string[]];
56
+ baseColumn: never;
57
+ identity: undefined;
58
+ generated: undefined;
59
+ }, {}, {
60
+ length: number | undefined;
61
+ }>;
62
+ status: import("drizzle-orm/sqlite-core").SQLiteColumn<{
63
+ name: "status";
64
+ tableName: "gl_subscribers";
65
+ dataType: "string";
66
+ columnType: "SQLiteText";
67
+ data: string;
68
+ driverParam: string;
69
+ notNull: true;
70
+ hasDefault: true;
71
+ isPrimaryKey: false;
72
+ isAutoincrement: false;
73
+ hasRuntimeDefault: false;
74
+ enumValues: [string, ...string[]];
75
+ baseColumn: never;
76
+ identity: undefined;
77
+ generated: undefined;
78
+ }, {}, {
79
+ length: number | undefined;
80
+ }>;
81
+ preferences: import("drizzle-orm/sqlite-core").SQLiteColumn<{
82
+ name: "preferences";
83
+ tableName: "gl_subscribers";
84
+ dataType: "string";
85
+ columnType: "SQLiteText";
86
+ data: string;
87
+ driverParam: string;
88
+ notNull: true;
89
+ hasDefault: true;
90
+ isPrimaryKey: false;
91
+ isAutoincrement: false;
92
+ hasRuntimeDefault: false;
93
+ enumValues: [string, ...string[]];
94
+ baseColumn: never;
95
+ identity: undefined;
96
+ generated: undefined;
97
+ }, {}, {
98
+ length: number | undefined;
99
+ }>;
100
+ source: import("drizzle-orm/sqlite-core").SQLiteColumn<{
101
+ name: "source";
102
+ tableName: "gl_subscribers";
103
+ dataType: "string";
104
+ columnType: "SQLiteText";
105
+ data: string;
106
+ driverParam: string;
107
+ notNull: true;
108
+ hasDefault: false;
109
+ isPrimaryKey: false;
110
+ isAutoincrement: false;
111
+ hasRuntimeDefault: false;
112
+ enumValues: [string, ...string[]];
113
+ baseColumn: never;
114
+ identity: undefined;
115
+ generated: undefined;
116
+ }, {}, {
117
+ length: number | undefined;
118
+ }>;
119
+ attribution: import("drizzle-orm/sqlite-core").SQLiteColumn<{
120
+ name: "attribution";
121
+ tableName: "gl_subscribers";
122
+ dataType: "string";
123
+ columnType: "SQLiteText";
124
+ data: string;
125
+ driverParam: string;
126
+ notNull: false;
127
+ hasDefault: false;
128
+ isPrimaryKey: false;
129
+ isAutoincrement: false;
130
+ hasRuntimeDefault: false;
131
+ enumValues: [string, ...string[]];
132
+ baseColumn: never;
133
+ identity: undefined;
134
+ generated: undefined;
135
+ }, {}, {
136
+ length: number | undefined;
137
+ }>;
138
+ softBounceCount: import("drizzle-orm/sqlite-core").SQLiteColumn<{
139
+ name: "soft_bounce_count";
140
+ tableName: "gl_subscribers";
141
+ dataType: "number";
142
+ columnType: "SQLiteInteger";
143
+ data: number;
144
+ driverParam: number;
145
+ notNull: true;
146
+ hasDefault: true;
147
+ isPrimaryKey: false;
148
+ isAutoincrement: false;
149
+ hasRuntimeDefault: false;
150
+ enumValues: undefined;
151
+ baseColumn: never;
152
+ identity: undefined;
153
+ generated: undefined;
154
+ }, {}, {}>;
155
+ subscribedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
156
+ name: "subscribed_at";
157
+ tableName: "gl_subscribers";
158
+ dataType: "string";
159
+ columnType: "SQLiteText";
160
+ data: string;
161
+ driverParam: string;
162
+ notNull: true;
163
+ hasDefault: false;
164
+ isPrimaryKey: false;
165
+ isAutoincrement: false;
166
+ hasRuntimeDefault: false;
167
+ enumValues: [string, ...string[]];
168
+ baseColumn: never;
169
+ identity: undefined;
170
+ generated: undefined;
171
+ }, {}, {
172
+ length: number | undefined;
173
+ }>;
174
+ confirmedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
175
+ name: "confirmed_at";
176
+ tableName: "gl_subscribers";
177
+ dataType: "string";
178
+ columnType: "SQLiteText";
179
+ data: string;
180
+ driverParam: string;
181
+ notNull: false;
182
+ hasDefault: false;
183
+ isPrimaryKey: false;
184
+ isAutoincrement: false;
185
+ hasRuntimeDefault: false;
186
+ enumValues: [string, ...string[]];
187
+ baseColumn: never;
188
+ identity: undefined;
189
+ generated: undefined;
190
+ }, {}, {
191
+ length: number | undefined;
192
+ }>;
193
+ unsubscribedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
194
+ name: "unsubscribed_at";
195
+ tableName: "gl_subscribers";
196
+ dataType: "string";
197
+ columnType: "SQLiteText";
198
+ data: string;
199
+ driverParam: string;
200
+ notNull: false;
201
+ hasDefault: false;
202
+ isPrimaryKey: false;
203
+ isAutoincrement: false;
204
+ hasRuntimeDefault: false;
205
+ enumValues: [string, ...string[]];
206
+ baseColumn: never;
207
+ identity: undefined;
208
+ generated: undefined;
209
+ }, {}, {
210
+ length: number | undefined;
211
+ }>;
212
+ createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
213
+ name: "created_at";
214
+ tableName: "gl_subscribers";
215
+ dataType: "string";
216
+ columnType: "SQLiteText";
217
+ data: string;
218
+ driverParam: string;
219
+ notNull: true;
220
+ hasDefault: false;
221
+ isPrimaryKey: false;
222
+ isAutoincrement: false;
223
+ hasRuntimeDefault: false;
224
+ enumValues: [string, ...string[]];
225
+ baseColumn: never;
226
+ identity: undefined;
227
+ generated: undefined;
228
+ }, {}, {
229
+ length: number | undefined;
230
+ }>;
231
+ updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
232
+ name: "updated_at";
233
+ tableName: "gl_subscribers";
234
+ dataType: "string";
235
+ columnType: "SQLiteText";
236
+ data: string;
237
+ driverParam: string;
238
+ notNull: true;
239
+ hasDefault: false;
240
+ isPrimaryKey: false;
241
+ isAutoincrement: false;
242
+ hasRuntimeDefault: false;
243
+ enumValues: [string, ...string[]];
244
+ baseColumn: never;
245
+ identity: undefined;
246
+ generated: undefined;
247
+ }, {}, {
248
+ length: number | undefined;
249
+ }>;
250
+ };
251
+ dialect: "sqlite";
252
+ }>;
253
+ //# sourceMappingURL=subscribers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscribers.d.ts","sourceRoot":"","sources":["../../src/schema/subscribers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBvB,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { index, integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
2
+ export const subscribers = sqliteTable('gl_subscribers', {
3
+ id: text('id').primaryKey(),
4
+ email: text('email').notNull().unique(),
5
+ name: text('name'),
6
+ status: text('status').notNull().default('pending'),
7
+ preferences: text('preferences').notNull().default('[]'),
8
+ source: text('source').notNull(),
9
+ attribution: text('attribution'),
10
+ softBounceCount: integer('soft_bounce_count').notNull().default(0),
11
+ subscribedAt: text('subscribed_at').notNull(),
12
+ confirmedAt: text('confirmed_at'),
13
+ unsubscribedAt: text('unsubscribed_at'),
14
+ createdAt: text('created_at').notNull(),
15
+ updatedAt: text('updated_at').notNull(),
16
+ }, (table) => [
17
+ index('idx_subscribers_status').on(table.status),
18
+ index('idx_subscribers_email').on(table.email),
19
+ index('idx_subscribers_subscribed_at').on(table.subscribedAt),
20
+ ]);
21
+ //# sourceMappingURL=subscribers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscribers.js","sourceRoot":"","sources":["../../src/schema/subscribers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAE3E,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CACrC,gBAAgB,EAChB;IACC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE;IACvC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAClB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;IACnD,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACxD,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE;IAChC,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC;IAChC,eAAe,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAClE,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE;IAC7C,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC;IACjC,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC;IACvC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACvC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;CACvC,EACD,CAAC,KAAK,EAAE,EAAE,CAAC;IACV,KAAK,CAAC,wBAAwB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;IAChD,KAAK,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;IAC9C,KAAK,CAAC,+BAA+B,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC;CAC7D,CACD,CAAA"}
package/dist/types.d.ts CHANGED
@@ -28,6 +28,7 @@ export interface SubscriberFilter {
28
28
  source?: string[];
29
29
  }
30
30
  export interface EmailQueueMessage {
31
+ siteId: string;
31
32
  type: 'transactional' | 'campaign' | 'digest';
32
33
  recipients: QueueRecipient[];
33
34
  subject: string;
@@ -37,6 +38,35 @@ export interface EmailQueueMessage {
37
38
  headers?: Record<string, string>;
38
39
  campaignId?: string;
39
40
  }
41
+ /**
42
+ * Per-site config override applied at consumer time. Returned from
43
+ * SiteConfigLookup. All fields are optional — only the ones present
44
+ * will override the consumer's resolved options for that message.
45
+ *
46
+ * Bindings (d1Binding, queueBinding, senderBinding) and route paths
47
+ * are NOT overridable per-site; they're realm-wide.
48
+ */
49
+ export interface SiteMailerConfig {
50
+ siteUrl?: string;
51
+ unsubscribePath?: string;
52
+ preferencesPath?: string;
53
+ senderName?: string;
54
+ fromAddress?: string;
55
+ replyTo?: string;
56
+ signingSecret?: string;
57
+ brand?: {
58
+ logoUrl?: string;
59
+ primaryColor?: string;
60
+ accentColor?: string;
61
+ footerText?: string;
62
+ };
63
+ }
64
+ /**
65
+ * Per-message lookup, called by the realm consumer with the message's
66
+ * `siteId`. Returns the per-site config to apply, or `null` to skip the
67
+ * override and use the consumer's options as-is.
68
+ */
69
+ export type SiteConfigLookup = (siteId: string, env: Record<string, unknown>) => Promise<SiteMailerConfig | null>;
40
70
  export interface QueueRecipient {
41
71
  email: string;
42
72
  subscriberId: string;