@wtfalch/email 0.20.0 → 0.24.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/README.md +67 -30
- package/dist/mailbox/index.d.ts +6 -2
- package/dist/mailbox/index.js +3 -1
- package/dist/mailbox/principals.d.ts +48 -0
- package/dist/mailbox/principals.js +111 -0
- package/dist/mailbox/rules.d.ts +102 -0
- package/dist/mailbox/rules.js +318 -0
- package/dist/mailbox/submit.d.ts +20 -1
- package/dist/mailbox/submit.js +125 -0
- package/dist/mailbox/types.d.ts +19 -0
- package/dist/mailbox/vacation.d.ts +4 -0
- package/dist/mailbox/vacation.js +118 -10
- package/dist/postmaster/apply.d.ts +20 -0
- package/dist/postmaster/apply.js +48 -1
- package/dist/postmaster/audit.d.ts +3 -0
- package/dist/postmaster/audit.js +1 -0
- package/dist/postmaster/index.d.ts +3 -2
- package/dist/postmaster/index.js +3 -2
- package/dist/postmaster/mail-copy.d.ts +12 -1
- package/dist/postmaster/mail-copy.js +2 -2
- package/dist/postmaster/mail-takeout.d.ts +31 -0
- package/dist/postmaster/mail-takeout.js +113 -0
- package/dist/postmaster/org-mail-export.d.ts +2 -2
- package/dist/postmaster/writes.d.ts +14 -1
- package/dist/postmaster/writes.js +17 -1
- package/package.json +1 -5
- package/dist/mailbox/fake/index.d.ts +0 -34
- package/dist/mailbox/fake/index.js +0 -85
- package/dist/mailbox/fake/mailbox.d.ts +0 -79
- package/dist/mailbox/fake/mailbox.js +0 -1235
- package/dist/mailbox/fake/sample.d.ts +0 -2
- package/dist/mailbox/fake/sample.js +0 -322
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A plausible inbox.
|
|
3
|
-
*
|
|
4
|
-
* Chosen to put every state a list view has to draw on the screen at once:
|
|
5
|
-
* unread and read, a thread with several messages, one with several *unread*
|
|
6
|
-
* messages, one with an attachment, several with attachments of different
|
|
7
|
-
* kinds, one flagged, one from a machine with no display name, one with no
|
|
8
|
-
* subject at all, one whose sender has no display name, one subject long
|
|
9
|
-
* enough to need truncating and one preview that is a single word. A sample
|
|
10
|
-
* that is five tidy one-line messages demonstrates a component that has never
|
|
11
|
-
* met mail.
|
|
12
|
-
*
|
|
13
|
-
* **It is long on purpose.** A list of four rows cannot show whether a row is
|
|
14
|
-
* the right height, whether the date groups earn their space, whether the
|
|
15
|
-
* scroll region behaves or whether the pager is reachable. Sixteen
|
|
16
|
-
* conversations spread over a fortnight can, and that is the shortest sample
|
|
17
|
-
* that can: relative time collapses at an hour, a day, a week and a year, and
|
|
18
|
-
* a fixture with nothing older than yesterday exercises one of the four.
|
|
19
|
-
*
|
|
20
|
-
* Times are minutes before the fake's fixed "now", so every screenshot of
|
|
21
|
-
* this is the same screenshot.
|
|
22
|
-
*/
|
|
23
|
-
const HOUR = 60;
|
|
24
|
-
const DAY = 24 * HOUR;
|
|
25
|
-
export const SAMPLE = [
|
|
26
|
-
{
|
|
27
|
-
mailbox: 'mb-inbox',
|
|
28
|
-
messages: [
|
|
29
|
-
{
|
|
30
|
-
from: { name: 'Charles Babbage', email: 'charles@example.com' },
|
|
31
|
-
subject: 'Engine schedule',
|
|
32
|
-
text: 'The mill is ready and the store is not. Can we push the demonstration to Thursday?',
|
|
33
|
-
agoMinutes: 12,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
mailbox: 'mb-inbox',
|
|
39
|
-
messages: [
|
|
40
|
-
{
|
|
41
|
-
from: { name: 'Luigi Menabrea', email: 'luigi@example.org' },
|
|
42
|
-
subject: 'Notes on the analytical engine, and a question about the notes',
|
|
43
|
-
text: 'I have finished the translation. The notes are now longer than the paper, which I suspect is the point.',
|
|
44
|
-
agoMinutes: 180,
|
|
45
|
-
seen: true,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
from: { name: 'Ada Lovelace', email: 'ada@example.com' },
|
|
49
|
-
subject: 'Re: Notes on the analytical engine, and a question about the notes',
|
|
50
|
-
text: 'Good. Keep them longer than the paper.',
|
|
51
|
-
agoMinutes: 90,
|
|
52
|
-
seen: true,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
from: { name: 'Luigi Menabrea', email: 'luigi@example.org' },
|
|
56
|
-
subject: 'Re: Notes on the analytical engine, and a question about the notes',
|
|
57
|
-
text: 'Then I will add the table of Bernoulli numbers as well.',
|
|
58
|
-
agoMinutes: 45,
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
mailbox: 'mb-inbox',
|
|
64
|
-
messages: [
|
|
65
|
-
{
|
|
66
|
-
from: { email: 'noreply@notifications.example.org' },
|
|
67
|
-
subject: 'Your monthly statement is ready',
|
|
68
|
-
text: 'Your statement for August is attached. This mailbox is not monitored.',
|
|
69
|
-
agoMinutes: 600,
|
|
70
|
-
seen: true,
|
|
71
|
-
attachments: [{ name: 'statement-august.pdf', type: 'application/pdf', size: 82_411 }],
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
mailbox: 'mb-inbox',
|
|
77
|
-
messages: [
|
|
78
|
-
{
|
|
79
|
-
from: { name: "Grace O'Brien", email: 'grace@example.net' },
|
|
80
|
-
subject: 'Punch cards — reorder before Friday',
|
|
81
|
-
text: 'We are down to two boxes. I have put the order together; it needs your signature.',
|
|
82
|
-
agoMinutes: 1_500,
|
|
83
|
-
flagged: true,
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
},
|
|
87
|
-
/* Two people going back and forth, none of it read: the case where the row
|
|
88
|
-
has to say "4" and the mailbox count has to say one, not four. */
|
|
89
|
-
{
|
|
90
|
-
mailbox: 'mb-inbox',
|
|
91
|
-
messages: [
|
|
92
|
-
{
|
|
93
|
-
from: { name: 'Mary Somerville', email: 'mary@example.org' },
|
|
94
|
-
subject: 'The Difference Engine chapter',
|
|
95
|
-
text: 'I have marked up the proofs. Three passages need a decision from you before Friday.',
|
|
96
|
-
agoMinutes: 5 * HOUR,
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
from: { name: 'Mary Somerville', email: 'mary@example.org' },
|
|
100
|
-
subject: 'Re: The Difference Engine chapter',
|
|
101
|
-
text: 'Ignore the second passage — I have resolved it myself.',
|
|
102
|
-
agoMinutes: 4 * HOUR,
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
from: { name: 'Charles Babbage', email: 'charles@example.com' },
|
|
106
|
-
subject: 'Re: The Difference Engine chapter',
|
|
107
|
-
text: 'The third passage is the one that matters. I would rather we said nothing than said it vaguely.',
|
|
108
|
-
agoMinutes: 3 * HOUR,
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
from: { name: 'Mary Somerville', email: 'mary@example.org' },
|
|
112
|
-
subject: 'Re: The Difference Engine chapter',
|
|
113
|
-
text: 'Agreed. Ada, you have the casting vote.',
|
|
114
|
-
agoMinutes: 2 * HOUR,
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
/* A message with no subject, which is a real thing that arrives and a real
|
|
119
|
-
way to make a list view draw an empty line. */
|
|
120
|
-
{
|
|
121
|
-
mailbox: 'mb-inbox',
|
|
122
|
-
messages: [
|
|
123
|
-
{
|
|
124
|
-
from: { name: 'Sophie Germain', email: 'sophie@example.fr' },
|
|
125
|
-
subject: '',
|
|
126
|
-
text: 'Yes.',
|
|
127
|
-
agoMinutes: 7 * HOUR,
|
|
128
|
-
seen: true,
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
mailbox: 'mb-inbox',
|
|
134
|
-
messages: [
|
|
135
|
-
{
|
|
136
|
-
from: { name: 'The Royal Society', email: 'events@royalsociety.example.org' },
|
|
137
|
-
subject: 'Invitation: demonstration of the analytical engine, 14 October',
|
|
138
|
-
text: 'You are invited to a demonstration. Papers are attached. Please reply with numbers by the end of the month.',
|
|
139
|
-
agoMinutes: 9 * HOUR,
|
|
140
|
-
attachments: [
|
|
141
|
-
{ name: 'programme.pdf', type: 'application/pdf', size: 214_882 },
|
|
142
|
-
{ name: 'directions.png', type: 'image/png', size: 48_120 },
|
|
143
|
-
],
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
mailbox: 'mb-inbox',
|
|
149
|
-
messages: [
|
|
150
|
-
{
|
|
151
|
-
from: { name: 'Augustus De Morgan', email: 'augustus@example.ac.uk' },
|
|
152
|
-
subject: 'A correction, and an apology for the correction',
|
|
153
|
-
text: 'The recurrence in your note 7 is right and my objection was not. I have written to the editor withdrawing it.',
|
|
154
|
-
agoMinutes: 26 * HOUR,
|
|
155
|
-
seen: true,
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
from: { name: 'Ada Lovelace', email: 'ada@example.com' },
|
|
159
|
-
subject: 'Re: A correction, and an apology for the correction',
|
|
160
|
-
text: 'No apology needed. The objection made the note better.',
|
|
161
|
-
agoMinutes: 25 * HOUR,
|
|
162
|
-
seen: true,
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
},
|
|
166
|
-
/* Only an HTML body, drawn in the sandboxed frame. It carries what a real
|
|
167
|
-
newsletter does -- a stylesheet, a table layout, a header image, a
|
|
168
|
-
tracking pixel, and a script that must not run -- so the frame, the
|
|
169
|
-
withheld-images bar and the sanitiser are all reachable from the list
|
|
170
|
-
rather than only from a unit test. */
|
|
171
|
-
{
|
|
172
|
-
mailbox: 'mb-inbox',
|
|
173
|
-
messages: [
|
|
174
|
-
{
|
|
175
|
-
from: { email: 'campaigns@marketing.example.com' },
|
|
176
|
-
subject: 'Your weekly digest, beautifully formatted',
|
|
177
|
-
text: '',
|
|
178
|
-
html: [
|
|
179
|
-
'<html><head><style>',
|
|
180
|
-
'.card{max-width:560px;margin:0 auto;background:#fff;border-radius:8px;padding:24px}',
|
|
181
|
-
'h1{font-family:Georgia,serif;color:#2b2118} .more{color:#8a5a00}',
|
|
182
|
-
'</style></head>',
|
|
183
|
-
'<body style="background:#f4f1ea;padding:16px" onload="alert(1)">',
|
|
184
|
-
'<table role="presentation" width="100%"><tr><td>',
|
|
185
|
-
'<div class="card">',
|
|
186
|
-
'<img src="https://images.marketing.example.com/header.png" width="512" height="96" alt="The week, in pictures">',
|
|
187
|
-
'<h1>This week</h1>',
|
|
188
|
-
'<p>Three essays on the Analytical Engine, and a letter from the mill.</p>',
|
|
189
|
-
'<p><a class="more" href="https://marketing.example.com/digest">Read it on the web</a></p>',
|
|
190
|
-
'<script>document.title = "ran"</script>',
|
|
191
|
-
'<img src="https://t.marketing.example.com/open.gif" width="1" height="1" alt="">',
|
|
192
|
-
'</div></td></tr></table></body></html>',
|
|
193
|
-
].join(''),
|
|
194
|
-
agoMinutes: 30 * HOUR,
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
mailbox: 'mb-inbox',
|
|
200
|
-
messages: [
|
|
201
|
-
{
|
|
202
|
-
from: { name: 'William King', email: 'william@example.com' },
|
|
203
|
-
subject: 'Ockham Park, the weekend',
|
|
204
|
-
text: 'The house is free from Friday. Bring the tables if you must, but not the mill.',
|
|
205
|
-
agoMinutes: 2 * DAY,
|
|
206
|
-
seen: true,
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
mailbox: 'mb-inbox',
|
|
212
|
-
messages: [
|
|
213
|
-
{
|
|
214
|
-
from: { name: 'Michael Faraday', email: 'michael@example.org' },
|
|
215
|
-
subject: 'Re: your question about the coil',
|
|
216
|
-
text: 'It is the rate of change, not the field. I have drawn it out, which is quicker than the sentence.',
|
|
217
|
-
agoMinutes: 3 * DAY,
|
|
218
|
-
seen: true,
|
|
219
|
-
attachments: [{ name: 'coil.svg', type: 'image/svg+xml', size: 4_902 }],
|
|
220
|
-
},
|
|
221
|
-
],
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
mailbox: 'mb-inbox',
|
|
225
|
-
messages: [
|
|
226
|
-
{
|
|
227
|
-
from: { email: 'security-noreply@accounts.example.net' },
|
|
228
|
-
subject: 'New sign-in from an unrecognised device',
|
|
229
|
-
text: 'A new sign-in was recorded. If this was you, no action is needed.',
|
|
230
|
-
agoMinutes: 4 * DAY,
|
|
231
|
-
seen: true,
|
|
232
|
-
},
|
|
233
|
-
],
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
mailbox: 'mb-inbox',
|
|
237
|
-
messages: [
|
|
238
|
-
{
|
|
239
|
-
from: { name: 'Anne Isabella Byron', email: 'annabella@example.com' },
|
|
240
|
-
subject: 'Sunday',
|
|
241
|
-
text: 'Come at four. There is nothing to discuss and I would like to discuss it at length.',
|
|
242
|
-
agoMinutes: 6 * DAY,
|
|
243
|
-
seen: true,
|
|
244
|
-
flagged: true,
|
|
245
|
-
},
|
|
246
|
-
],
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
mailbox: 'mb-inbox',
|
|
250
|
-
messages: [
|
|
251
|
-
{
|
|
252
|
-
from: { name: 'Joseph-Marie Jacquard', email: 'joseph@example.fr' },
|
|
253
|
-
subject: 'On the punched card mechanism, its failure modes in humid weather, and what I propose to do about the third of them before the demonstration',
|
|
254
|
-
text: 'The cards swell. Everything else in the list follows from the cards swelling, so I have started there.',
|
|
255
|
-
agoMinutes: 9 * DAY,
|
|
256
|
-
seen: true,
|
|
257
|
-
},
|
|
258
|
-
],
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
mailbox: 'mb-inbox',
|
|
262
|
-
messages: [
|
|
263
|
-
{
|
|
264
|
-
from: { name: 'Charles Wheatstone', email: 'charles.w@example.org' },
|
|
265
|
-
subject: 'Telegraph trial — results',
|
|
266
|
-
text: 'Twelve miles, no repeater, legible throughout. The full log is attached.',
|
|
267
|
-
agoMinutes: 14 * DAY,
|
|
268
|
-
seen: true,
|
|
269
|
-
attachments: [{ name: 'trial-log.csv', type: 'text/csv', size: 11_204 }],
|
|
270
|
-
},
|
|
271
|
-
],
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
mailbox: 'mb-inbox',
|
|
275
|
-
messages: [
|
|
276
|
-
{
|
|
277
|
-
from: { name: 'Ada Lovelace', email: 'ada@example.com' },
|
|
278
|
-
subject: 'Notes to myself: the Bernoulli table',
|
|
279
|
-
text: 'Start from the recurrence, not the closed form. The closed form is where the last three attempts went wrong.',
|
|
280
|
-
agoMinutes: 400 * DAY,
|
|
281
|
-
seen: true,
|
|
282
|
-
},
|
|
283
|
-
],
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
mailbox: 'mb-sent',
|
|
287
|
-
messages: [
|
|
288
|
-
{
|
|
289
|
-
from: { name: 'Ada Lovelace', email: 'ada@example.com' },
|
|
290
|
-
to: [{ name: 'Charles Babbage', email: 'charles@example.com' }],
|
|
291
|
-
subject: 'Thursday works',
|
|
292
|
-
text: 'Thursday works. I will bring the tables.',
|
|
293
|
-
agoMinutes: 5,
|
|
294
|
-
seen: true,
|
|
295
|
-
},
|
|
296
|
-
],
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
mailbox: 'mb-sent',
|
|
300
|
-
messages: [
|
|
301
|
-
{
|
|
302
|
-
from: { name: 'Ada Lovelace', email: 'ada@example.com' },
|
|
303
|
-
to: [{ name: 'Mary Somerville', email: 'mary@example.org' }],
|
|
304
|
-
subject: 'Re: The Difference Engine chapter',
|
|
305
|
-
text: 'Give me until tomorrow on the third passage.',
|
|
306
|
-
agoMinutes: 90,
|
|
307
|
-
seen: true,
|
|
308
|
-
},
|
|
309
|
-
],
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
mailbox: 'mb-junk',
|
|
313
|
-
messages: [
|
|
314
|
-
{
|
|
315
|
-
from: { email: 'winner@lottery.example' },
|
|
316
|
-
subject: 'YOU HAVE BEEN SELECTED',
|
|
317
|
-
text: 'Reply with your bank details to claim your prize.',
|
|
318
|
-
agoMinutes: 8 * HOUR,
|
|
319
|
-
},
|
|
320
|
-
],
|
|
321
|
-
},
|
|
322
|
-
];
|