@open-workspace/email 0.4.1 → 0.4.2

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.
@@ -15,6 +15,13 @@
15
15
  "when": 1794379791382,
16
16
  "tag": "0001_mute_jack_flag",
17
17
  "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "6",
22
+ "when": 1794581335782,
23
+ "tag": "0002_good_komodo",
24
+ "breakpoints": true
18
25
  }
19
26
  ]
20
27
  }
@@ -1,12 +1,14 @@
1
1
  import journal from './meta/_journal.json';
2
2
  import m0000 from './0000_puzzling_dracula.sql';
3
3
  import m0001 from './0001_mute_jack_flag.sql';
4
+ import m0002 from './0002_good_komodo.sql';
4
5
 
5
6
  export default {
6
7
  journal,
7
8
  migrations: {
8
9
  m0000,
9
- m0001
10
+ m0001,
11
+ m0002
10
12
  }
11
13
  }
12
14
 
@@ -0,0 +1,2 @@
1
+ ALTER TABLE `push_subscriptions` ADD `session_id` text;--> statement-breakpoint
2
+ CREATE INDEX `push_subscriptions_session_idx` ON `push_subscriptions` (`session_id`);
@@ -0,0 +1,564 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "63092f02-08dd-4c6e-82ff-ad66a1642095",
5
+ "prevId": "3c9a9f87-017b-4419-8672-d798164a2460",
6
+ "tables": {
7
+ "blocked_senders": {
8
+ "name": "blocked_senders",
9
+ "columns": {
10
+ "pattern": {
11
+ "name": "pattern",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "created_by_user_id": {
18
+ "name": "created_by_user_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": false,
22
+ "autoincrement": false
23
+ },
24
+ "created_at": {
25
+ "name": "created_at",
26
+ "type": "integer",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ }
31
+ },
32
+ "indexes": {},
33
+ "foreignKeys": {
34
+ "blocked_senders_created_by_user_id_users_id_fk": {
35
+ "name": "blocked_senders_created_by_user_id_users_id_fk",
36
+ "tableFrom": "blocked_senders",
37
+ "tableTo": "users",
38
+ "columnsFrom": [
39
+ "created_by_user_id"
40
+ ],
41
+ "columnsTo": [
42
+ "id"
43
+ ],
44
+ "onDelete": "set null",
45
+ "onUpdate": "no action"
46
+ }
47
+ },
48
+ "compositePrimaryKeys": {},
49
+ "uniqueConstraints": {},
50
+ "checkConstraints": {}
51
+ },
52
+ "jmap_push_subscriptions": {
53
+ "name": "jmap_push_subscriptions",
54
+ "columns": {
55
+ "id": {
56
+ "name": "id",
57
+ "type": "text",
58
+ "primaryKey": true,
59
+ "notNull": true,
60
+ "autoincrement": false
61
+ },
62
+ "user_id": {
63
+ "name": "user_id",
64
+ "type": "text",
65
+ "primaryKey": false,
66
+ "notNull": true,
67
+ "autoincrement": false
68
+ },
69
+ "client_id": {
70
+ "name": "client_id",
71
+ "type": "text",
72
+ "primaryKey": false,
73
+ "notNull": true,
74
+ "autoincrement": false
75
+ },
76
+ "device_client_id": {
77
+ "name": "device_client_id",
78
+ "type": "text",
79
+ "primaryKey": false,
80
+ "notNull": true,
81
+ "autoincrement": false
82
+ },
83
+ "url": {
84
+ "name": "url",
85
+ "type": "text",
86
+ "primaryKey": false,
87
+ "notNull": true,
88
+ "autoincrement": false
89
+ },
90
+ "p256dh": {
91
+ "name": "p256dh",
92
+ "type": "text",
93
+ "primaryKey": false,
94
+ "notNull": false,
95
+ "autoincrement": false
96
+ },
97
+ "auth": {
98
+ "name": "auth",
99
+ "type": "text",
100
+ "primaryKey": false,
101
+ "notNull": false,
102
+ "autoincrement": false
103
+ },
104
+ "verification_code": {
105
+ "name": "verification_code",
106
+ "type": "text",
107
+ "primaryKey": false,
108
+ "notNull": true,
109
+ "autoincrement": false
110
+ },
111
+ "verified_at": {
112
+ "name": "verified_at",
113
+ "type": "integer",
114
+ "primaryKey": false,
115
+ "notNull": false,
116
+ "autoincrement": false
117
+ },
118
+ "expires_at": {
119
+ "name": "expires_at",
120
+ "type": "integer",
121
+ "primaryKey": false,
122
+ "notNull": true,
123
+ "autoincrement": false
124
+ },
125
+ "types_json": {
126
+ "name": "types_json",
127
+ "type": "text",
128
+ "primaryKey": false,
129
+ "notNull": false,
130
+ "autoincrement": false
131
+ },
132
+ "created_at": {
133
+ "name": "created_at",
134
+ "type": "integer",
135
+ "primaryKey": false,
136
+ "notNull": true,
137
+ "autoincrement": false
138
+ }
139
+ },
140
+ "indexes": {
141
+ "jmap_push_subscriptions_device_unique": {
142
+ "name": "jmap_push_subscriptions_device_unique",
143
+ "columns": [
144
+ "user_id",
145
+ "device_client_id"
146
+ ],
147
+ "isUnique": true
148
+ },
149
+ "jmap_push_subscriptions_expires_idx": {
150
+ "name": "jmap_push_subscriptions_expires_idx",
151
+ "columns": [
152
+ "expires_at"
153
+ ],
154
+ "isUnique": false
155
+ }
156
+ },
157
+ "foreignKeys": {
158
+ "jmap_push_subscriptions_client_id_user_id_oidc_grants_client_id_user_id_fk": {
159
+ "name": "jmap_push_subscriptions_client_id_user_id_oidc_grants_client_id_user_id_fk",
160
+ "tableFrom": "jmap_push_subscriptions",
161
+ "tableTo": "oidc_grants",
162
+ "columnsFrom": [
163
+ "client_id",
164
+ "user_id"
165
+ ],
166
+ "columnsTo": [
167
+ "client_id",
168
+ "user_id"
169
+ ],
170
+ "onDelete": "cascade",
171
+ "onUpdate": "no action"
172
+ }
173
+ },
174
+ "compositePrimaryKeys": {},
175
+ "uniqueConstraints": {},
176
+ "checkConstraints": {}
177
+ },
178
+ "mailbox_counts": {
179
+ "name": "mailbox_counts",
180
+ "columns": {
181
+ "mailbox_id": {
182
+ "name": "mailbox_id",
183
+ "type": "text",
184
+ "primaryKey": true,
185
+ "notNull": true,
186
+ "autoincrement": false
187
+ },
188
+ "incoming_count": {
189
+ "name": "incoming_count",
190
+ "type": "integer",
191
+ "primaryKey": false,
192
+ "notNull": true,
193
+ "autoincrement": false
194
+ },
195
+ "version": {
196
+ "name": "version",
197
+ "type": "integer",
198
+ "primaryKey": false,
199
+ "notNull": true,
200
+ "autoincrement": false
201
+ },
202
+ "updated_at": {
203
+ "name": "updated_at",
204
+ "type": "integer",
205
+ "primaryKey": false,
206
+ "notNull": true,
207
+ "autoincrement": false
208
+ }
209
+ },
210
+ "indexes": {},
211
+ "foreignKeys": {
212
+ "mailbox_counts_mailbox_id_mailboxes_id_fk": {
213
+ "name": "mailbox_counts_mailbox_id_mailboxes_id_fk",
214
+ "tableFrom": "mailbox_counts",
215
+ "tableTo": "mailboxes",
216
+ "columnsFrom": [
217
+ "mailbox_id"
218
+ ],
219
+ "columnsTo": [
220
+ "id"
221
+ ],
222
+ "onDelete": "cascade",
223
+ "onUpdate": "no action"
224
+ }
225
+ },
226
+ "compositePrimaryKeys": {},
227
+ "uniqueConstraints": {},
228
+ "checkConstraints": {}
229
+ },
230
+ "mailbox_notification_preferences": {
231
+ "name": "mailbox_notification_preferences",
232
+ "columns": {
233
+ "mailbox_id": {
234
+ "name": "mailbox_id",
235
+ "type": "text",
236
+ "primaryKey": false,
237
+ "notNull": true,
238
+ "autoincrement": false
239
+ },
240
+ "user_id": {
241
+ "name": "user_id",
242
+ "type": "text",
243
+ "primaryKey": false,
244
+ "notNull": true,
245
+ "autoincrement": false
246
+ },
247
+ "enabled": {
248
+ "name": "enabled",
249
+ "type": "integer",
250
+ "primaryKey": false,
251
+ "notNull": true,
252
+ "autoincrement": false,
253
+ "default": true
254
+ },
255
+ "updated_at": {
256
+ "name": "updated_at",
257
+ "type": "integer",
258
+ "primaryKey": false,
259
+ "notNull": true,
260
+ "autoincrement": false,
261
+ "default": "(unixepoch() * 1000)"
262
+ }
263
+ },
264
+ "indexes": {
265
+ "mailbox_notification_preferences_user_idx": {
266
+ "name": "mailbox_notification_preferences_user_idx",
267
+ "columns": [
268
+ "user_id"
269
+ ],
270
+ "isUnique": false
271
+ }
272
+ },
273
+ "foreignKeys": {
274
+ "mailbox_notification_preferences_mailbox_id_mailboxes_id_fk": {
275
+ "name": "mailbox_notification_preferences_mailbox_id_mailboxes_id_fk",
276
+ "tableFrom": "mailbox_notification_preferences",
277
+ "tableTo": "mailboxes",
278
+ "columnsFrom": [
279
+ "mailbox_id"
280
+ ],
281
+ "columnsTo": [
282
+ "id"
283
+ ],
284
+ "onDelete": "cascade",
285
+ "onUpdate": "no action"
286
+ },
287
+ "mailbox_notification_preferences_user_id_users_id_fk": {
288
+ "name": "mailbox_notification_preferences_user_id_users_id_fk",
289
+ "tableFrom": "mailbox_notification_preferences",
290
+ "tableTo": "users",
291
+ "columnsFrom": [
292
+ "user_id"
293
+ ],
294
+ "columnsTo": [
295
+ "id"
296
+ ],
297
+ "onDelete": "cascade",
298
+ "onUpdate": "no action"
299
+ }
300
+ },
301
+ "compositePrimaryKeys": {
302
+ "mailbox_notification_preferences_mailbox_id_user_id_pk": {
303
+ "columns": [
304
+ "mailbox_id",
305
+ "user_id"
306
+ ],
307
+ "name": "mailbox_notification_preferences_mailbox_id_user_id_pk"
308
+ }
309
+ },
310
+ "uniqueConstraints": {},
311
+ "checkConstraints": {}
312
+ },
313
+ "mailbox_read_counts": {
314
+ "name": "mailbox_read_counts",
315
+ "columns": {
316
+ "mailbox_id": {
317
+ "name": "mailbox_id",
318
+ "type": "text",
319
+ "primaryKey": false,
320
+ "notNull": true,
321
+ "autoincrement": false
322
+ },
323
+ "user_id": {
324
+ "name": "user_id",
325
+ "type": "text",
326
+ "primaryKey": false,
327
+ "notNull": true,
328
+ "autoincrement": false
329
+ },
330
+ "read_count": {
331
+ "name": "read_count",
332
+ "type": "integer",
333
+ "primaryKey": false,
334
+ "notNull": true,
335
+ "autoincrement": false
336
+ }
337
+ },
338
+ "indexes": {},
339
+ "foreignKeys": {
340
+ "mailbox_read_counts_mailbox_id_mailboxes_id_fk": {
341
+ "name": "mailbox_read_counts_mailbox_id_mailboxes_id_fk",
342
+ "tableFrom": "mailbox_read_counts",
343
+ "tableTo": "mailboxes",
344
+ "columnsFrom": [
345
+ "mailbox_id"
346
+ ],
347
+ "columnsTo": [
348
+ "id"
349
+ ],
350
+ "onDelete": "cascade",
351
+ "onUpdate": "no action"
352
+ }
353
+ },
354
+ "compositePrimaryKeys": {
355
+ "mailbox_read_counts_mailbox_id_user_id_pk": {
356
+ "columns": [
357
+ "mailbox_id",
358
+ "user_id"
359
+ ],
360
+ "name": "mailbox_read_counts_mailbox_id_user_id_pk"
361
+ }
362
+ },
363
+ "uniqueConstraints": {},
364
+ "checkConstraints": {}
365
+ },
366
+ "push_subscriptions": {
367
+ "name": "push_subscriptions",
368
+ "columns": {
369
+ "id": {
370
+ "name": "id",
371
+ "type": "text",
372
+ "primaryKey": true,
373
+ "notNull": true,
374
+ "autoincrement": false
375
+ },
376
+ "user_id": {
377
+ "name": "user_id",
378
+ "type": "text",
379
+ "primaryKey": false,
380
+ "notNull": true,
381
+ "autoincrement": false
382
+ },
383
+ "session_id": {
384
+ "name": "session_id",
385
+ "type": "text",
386
+ "primaryKey": false,
387
+ "notNull": false,
388
+ "autoincrement": false
389
+ },
390
+ "endpoint": {
391
+ "name": "endpoint",
392
+ "type": "text",
393
+ "primaryKey": false,
394
+ "notNull": true,
395
+ "autoincrement": false
396
+ },
397
+ "p256dh": {
398
+ "name": "p256dh",
399
+ "type": "text",
400
+ "primaryKey": false,
401
+ "notNull": true,
402
+ "autoincrement": false
403
+ },
404
+ "auth": {
405
+ "name": "auth",
406
+ "type": "text",
407
+ "primaryKey": false,
408
+ "notNull": true,
409
+ "autoincrement": false
410
+ },
411
+ "created_at": {
412
+ "name": "created_at",
413
+ "type": "integer",
414
+ "primaryKey": false,
415
+ "notNull": true,
416
+ "autoincrement": false,
417
+ "default": "(unixepoch() * 1000)"
418
+ },
419
+ "updated_at": {
420
+ "name": "updated_at",
421
+ "type": "integer",
422
+ "primaryKey": false,
423
+ "notNull": true,
424
+ "autoincrement": false,
425
+ "default": "(unixepoch() * 1000)"
426
+ }
427
+ },
428
+ "indexes": {
429
+ "push_subscriptions_endpoint_unique": {
430
+ "name": "push_subscriptions_endpoint_unique",
431
+ "columns": [
432
+ "endpoint"
433
+ ],
434
+ "isUnique": true
435
+ },
436
+ "push_subscriptions_user_idx": {
437
+ "name": "push_subscriptions_user_idx",
438
+ "columns": [
439
+ "user_id"
440
+ ],
441
+ "isUnique": false
442
+ },
443
+ "push_subscriptions_session_idx": {
444
+ "name": "push_subscriptions_session_idx",
445
+ "columns": [
446
+ "session_id"
447
+ ],
448
+ "isUnique": false
449
+ }
450
+ },
451
+ "foreignKeys": {
452
+ "push_subscriptions_user_id_users_id_fk": {
453
+ "name": "push_subscriptions_user_id_users_id_fk",
454
+ "tableFrom": "push_subscriptions",
455
+ "tableTo": "users",
456
+ "columnsFrom": [
457
+ "user_id"
458
+ ],
459
+ "columnsTo": [
460
+ "id"
461
+ ],
462
+ "onDelete": "cascade",
463
+ "onUpdate": "no action"
464
+ }
465
+ },
466
+ "compositePrimaryKeys": {},
467
+ "uniqueConstraints": {},
468
+ "checkConstraints": {}
469
+ },
470
+ "sender_reports": {
471
+ "name": "sender_reports",
472
+ "columns": {
473
+ "mailbox_id": {
474
+ "name": "mailbox_id",
475
+ "type": "text",
476
+ "primaryKey": false,
477
+ "notNull": true,
478
+ "autoincrement": false
479
+ },
480
+ "email_id": {
481
+ "name": "email_id",
482
+ "type": "text",
483
+ "primaryKey": false,
484
+ "notNull": true,
485
+ "autoincrement": false
486
+ },
487
+ "address": {
488
+ "name": "address",
489
+ "type": "text",
490
+ "primaryKey": false,
491
+ "notNull": true,
492
+ "autoincrement": false
493
+ },
494
+ "domain": {
495
+ "name": "domain",
496
+ "type": "text",
497
+ "primaryKey": false,
498
+ "notNull": true,
499
+ "autoincrement": false
500
+ },
501
+ "label": {
502
+ "name": "label",
503
+ "type": "text",
504
+ "primaryKey": false,
505
+ "notNull": true,
506
+ "autoincrement": false
507
+ },
508
+ "created_at": {
509
+ "name": "created_at",
510
+ "type": "integer",
511
+ "primaryKey": false,
512
+ "notNull": true,
513
+ "autoincrement": false
514
+ }
515
+ },
516
+ "indexes": {
517
+ "sender_reports_domain_idx": {
518
+ "name": "sender_reports_domain_idx",
519
+ "columns": [
520
+ "domain",
521
+ "address"
522
+ ],
523
+ "isUnique": false
524
+ }
525
+ },
526
+ "foreignKeys": {
527
+ "sender_reports_mailbox_id_mailboxes_id_fk": {
528
+ "name": "sender_reports_mailbox_id_mailboxes_id_fk",
529
+ "tableFrom": "sender_reports",
530
+ "tableTo": "mailboxes",
531
+ "columnsFrom": [
532
+ "mailbox_id"
533
+ ],
534
+ "columnsTo": [
535
+ "id"
536
+ ],
537
+ "onDelete": "cascade",
538
+ "onUpdate": "no action"
539
+ }
540
+ },
541
+ "compositePrimaryKeys": {
542
+ "sender_reports_mailbox_id_email_id_pk": {
543
+ "columns": [
544
+ "mailbox_id",
545
+ "email_id"
546
+ ],
547
+ "name": "sender_reports_mailbox_id_email_id_pk"
548
+ }
549
+ },
550
+ "uniqueConstraints": {},
551
+ "checkConstraints": {}
552
+ }
553
+ },
554
+ "views": {},
555
+ "enums": {},
556
+ "_meta": {
557
+ "schemas": {},
558
+ "tables": {},
559
+ "columns": {}
560
+ },
561
+ "internal": {
562
+ "indexes": {}
563
+ }
564
+ }
@@ -8,6 +8,13 @@
8
8
  "when": 1794374467122,
9
9
  "tag": "0000_dry_moon_knight",
10
10
  "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "6",
15
+ "when": 1794576500541,
16
+ "tag": "0001_overrated_ricochet",
17
+ "breakpoints": true
11
18
  }
12
19
  ]
13
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-workspace/email",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Team mail for OpenWorkspace: personal and shared inboxes, mailing lists, previews, safety, and AI.",
5
5
  "keywords": [
6
6
  "alchemy",
@@ -73,8 +73,8 @@
73
73
  "@alchemy.run/test": "2.0.0-beta.85",
74
74
  "@effect/platform-bun": "4.1.3",
75
75
  "@effect/platform-node": "4.1.3",
76
- "@open-workspace/core": "0.4.1",
77
- "@open-workspace/create": "0.4.1",
76
+ "@open-workspace/core": "0.4.2",
77
+ "@open-workspace/create": "0.4.2",
78
78
  "@types/bun": "1.4.4",
79
79
  "@types/html-to-text": "9.0.4",
80
80
  "@types/node": "26.6.6",
@@ -92,7 +92,7 @@
92
92
  },
93
93
  "peerDependencies": {
94
94
  "@alchemy.run/cloudflare": "2.0.0-beta.85",
95
- "@open-workspace/core": "0.4.1",
95
+ "@open-workspace/core": "0.4.2",
96
96
  "alchemy": "2.0.0-beta.85",
97
97
  "effect": "4.1.3"
98
98
  }
@@ -182,7 +182,12 @@ export function ConversationView({
182
182
  function handleSent(result: SentReply) {
183
183
  setReplySelection(null);
184
184
 
185
- if (result.detached) onOpenConversation(result.conversationId);
185
+ // A detached reply starts its own conversation, and a reply from mail kept
186
+ // out of its conversation as spam takes it back there: either way the
187
+ // open one is not where the reply is (it may be gone).
188
+ if (result.detached || result.conversationId !== conversationId) {
189
+ onOpenConversation(result.conversationId);
190
+ }
186
191
  }
187
192
 
188
193
  async function resend(message: MessageDetail) {
@@ -489,6 +489,7 @@ export function ReaderPane({ mail }: { mail: MailController }) {
489
489
  const senderActions = useSenderActions({
490
490
  mailbox,
491
491
  onLeaveConversation: mail.closeConversation,
492
+ onOpenConversation: (id, folder) => mail.openConversation(id, folder),
492
493
  });
493
494
 
494
495
  useSenderIntelFill(mailbox?.id, conversationId, conversationMessages);
@@ -166,7 +166,10 @@ function rewriteSrcset(
166
166
  if (!match) return "";
167
167
  const [, source = "", descriptor = ""] = match;
168
168
 
169
- if (!isRemoteHttpUrl(source)) return trimmed;
169
+ // Like `src`: a candidate that can't go through the proxy is dropped,
170
+ // so relative and protocol-relative URLs (`//host/x.png`) never load
171
+ // straight from the sender's server.
172
+ if (!isRemoteHttpUrl(source)) return "";
170
173
  const proxied = rewriteRemoteUrl(source);
171
174
 
172
175
  return proxied ? `${proxied}${descriptor}` : "";