mail-parser-wasm 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -2
- package/mail_parser_wasm.d.ts +26 -3
- package/mail_parser_wasm_bg.js +219 -24
- package/mail_parser_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/mail_parser_wasm.d.ts
CHANGED
@@ -7,15 +7,38 @@
|
|
7
7
|
export function parse_message(raw_message: string): MessageResult;
|
8
8
|
/**
|
9
9
|
*/
|
10
|
+
export class AttachmentResult {
|
11
|
+
free(): void;
|
12
|
+
/**
|
13
|
+
*/
|
14
|
+
readonly content: Uint8Array;
|
15
|
+
/**
|
16
|
+
*/
|
17
|
+
readonly content_id: string;
|
18
|
+
/**
|
19
|
+
*/
|
20
|
+
readonly content_type: string;
|
21
|
+
/**
|
22
|
+
*/
|
23
|
+
readonly filename: string;
|
24
|
+
}
|
25
|
+
/**
|
26
|
+
*/
|
10
27
|
export class MessageResult {
|
11
28
|
free(): void;
|
12
29
|
/**
|
13
30
|
*/
|
14
|
-
readonly
|
31
|
+
readonly attachments: (AttachmentResult)[];
|
32
|
+
/**
|
33
|
+
*/
|
34
|
+
readonly body_html: string;
|
35
|
+
/**
|
36
|
+
*/
|
37
|
+
readonly sender: string;
|
15
38
|
/**
|
16
39
|
*/
|
17
|
-
readonly
|
40
|
+
readonly subject: string;
|
18
41
|
/**
|
19
42
|
*/
|
20
|
-
readonly
|
43
|
+
readonly text: string;
|
21
44
|
}
|
package/mail_parser_wasm_bg.js
CHANGED
@@ -24,6 +24,21 @@ function getStringFromWasm0(ptr, len) {
|
|
24
24
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
25
25
|
}
|
26
26
|
|
27
|
+
const heap = new Array(128).fill(undefined);
|
28
|
+
|
29
|
+
heap.push(undefined, null, true, false);
|
30
|
+
|
31
|
+
let heap_next = heap.length;
|
32
|
+
|
33
|
+
function addHeapObject(obj) {
|
34
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
35
|
+
const idx = heap_next;
|
36
|
+
heap_next = heap[idx];
|
37
|
+
|
38
|
+
heap[idx] = obj;
|
39
|
+
return idx;
|
40
|
+
}
|
41
|
+
|
27
42
|
let cachedInt32Memory0 = null;
|
28
43
|
|
29
44
|
function getInt32Memory0() {
|
@@ -33,6 +48,45 @@ function getInt32Memory0() {
|
|
33
48
|
return cachedInt32Memory0;
|
34
49
|
}
|
35
50
|
|
51
|
+
function getArrayU8FromWasm0(ptr, len) {
|
52
|
+
ptr = ptr >>> 0;
|
53
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
54
|
+
}
|
55
|
+
|
56
|
+
let cachedUint32Memory0 = null;
|
57
|
+
|
58
|
+
function getUint32Memory0() {
|
59
|
+
if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
|
60
|
+
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
61
|
+
}
|
62
|
+
return cachedUint32Memory0;
|
63
|
+
}
|
64
|
+
|
65
|
+
function getObject(idx) { return heap[idx]; }
|
66
|
+
|
67
|
+
function dropObject(idx) {
|
68
|
+
if (idx < 132) return;
|
69
|
+
heap[idx] = heap_next;
|
70
|
+
heap_next = idx;
|
71
|
+
}
|
72
|
+
|
73
|
+
function takeObject(idx) {
|
74
|
+
const ret = getObject(idx);
|
75
|
+
dropObject(idx);
|
76
|
+
return ret;
|
77
|
+
}
|
78
|
+
|
79
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
80
|
+
ptr = ptr >>> 0;
|
81
|
+
const mem = getUint32Memory0();
|
82
|
+
const slice = mem.subarray(ptr / 4, ptr / 4 + len);
|
83
|
+
const result = [];
|
84
|
+
for (let i = 0; i < slice.length; i++) {
|
85
|
+
result.push(takeObject(slice[i]));
|
86
|
+
}
|
87
|
+
return result;
|
88
|
+
}
|
89
|
+
|
36
90
|
let WASM_VECTOR_LEN = 0;
|
37
91
|
|
38
92
|
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
|
@@ -101,6 +155,107 @@ export function parse_message(raw_message) {
|
|
101
155
|
return MessageResult.__wrap(ret);
|
102
156
|
}
|
103
157
|
|
158
|
+
const AttachmentResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
159
|
+
? { register: () => {}, unregister: () => {} }
|
160
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_attachmentresult_free(ptr >>> 0));
|
161
|
+
/**
|
162
|
+
*/
|
163
|
+
export class AttachmentResult {
|
164
|
+
|
165
|
+
static __wrap(ptr) {
|
166
|
+
ptr = ptr >>> 0;
|
167
|
+
const obj = Object.create(AttachmentResult.prototype);
|
168
|
+
obj.__wbg_ptr = ptr;
|
169
|
+
AttachmentResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
170
|
+
return obj;
|
171
|
+
}
|
172
|
+
|
173
|
+
__destroy_into_raw() {
|
174
|
+
const ptr = this.__wbg_ptr;
|
175
|
+
this.__wbg_ptr = 0;
|
176
|
+
AttachmentResultFinalization.unregister(this);
|
177
|
+
return ptr;
|
178
|
+
}
|
179
|
+
|
180
|
+
free() {
|
181
|
+
const ptr = this.__destroy_into_raw();
|
182
|
+
wasm.__wbg_attachmentresult_free(ptr);
|
183
|
+
}
|
184
|
+
/**
|
185
|
+
* @returns {string}
|
186
|
+
*/
|
187
|
+
get content_id() {
|
188
|
+
let deferred1_0;
|
189
|
+
let deferred1_1;
|
190
|
+
try {
|
191
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
192
|
+
wasm.attachmentresult_content_id(retptr, this.__wbg_ptr);
|
193
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
194
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
195
|
+
deferred1_0 = r0;
|
196
|
+
deferred1_1 = r1;
|
197
|
+
return getStringFromWasm0(r0, r1);
|
198
|
+
} finally {
|
199
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
200
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
201
|
+
}
|
202
|
+
}
|
203
|
+
/**
|
204
|
+
* @returns {string}
|
205
|
+
*/
|
206
|
+
get content_type() {
|
207
|
+
let deferred1_0;
|
208
|
+
let deferred1_1;
|
209
|
+
try {
|
210
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
211
|
+
wasm.attachmentresult_content_type(retptr, this.__wbg_ptr);
|
212
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
213
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
214
|
+
deferred1_0 = r0;
|
215
|
+
deferred1_1 = r1;
|
216
|
+
return getStringFromWasm0(r0, r1);
|
217
|
+
} finally {
|
218
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
219
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
220
|
+
}
|
221
|
+
}
|
222
|
+
/**
|
223
|
+
* @returns {string}
|
224
|
+
*/
|
225
|
+
get filename() {
|
226
|
+
let deferred1_0;
|
227
|
+
let deferred1_1;
|
228
|
+
try {
|
229
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
230
|
+
wasm.attachmentresult_filename(retptr, this.__wbg_ptr);
|
231
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
232
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
233
|
+
deferred1_0 = r0;
|
234
|
+
deferred1_1 = r1;
|
235
|
+
return getStringFromWasm0(r0, r1);
|
236
|
+
} finally {
|
237
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
238
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
239
|
+
}
|
240
|
+
}
|
241
|
+
/**
|
242
|
+
* @returns {Uint8Array}
|
243
|
+
*/
|
244
|
+
get content() {
|
245
|
+
try {
|
246
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
247
|
+
wasm.attachmentresult_content(retptr, this.__wbg_ptr);
|
248
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
249
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
250
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
251
|
+
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
252
|
+
return v1;
|
253
|
+
} finally {
|
254
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
255
|
+
}
|
256
|
+
}
|
257
|
+
}
|
258
|
+
|
104
259
|
const MessageResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
105
260
|
? { register: () => {}, unregister: () => {} }
|
106
261
|
: new FinalizationRegistry(ptr => wasm.__wbg_messageresult_free(ptr >>> 0));
|
@@ -128,57 +283,92 @@ export class MessageResult {
|
|
128
283
|
wasm.__wbg_messageresult_free(ptr);
|
129
284
|
}
|
130
285
|
/**
|
131
|
-
* @returns {string
|
286
|
+
* @returns {string}
|
132
287
|
*/
|
133
288
|
get sender() {
|
289
|
+
let deferred1_0;
|
290
|
+
let deferred1_1;
|
134
291
|
try {
|
135
292
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
136
|
-
wasm.
|
293
|
+
wasm.attachmentresult_content_id(retptr, this.__wbg_ptr);
|
137
294
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
138
295
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
143
|
-
}
|
144
|
-
return v1;
|
296
|
+
deferred1_0 = r0;
|
297
|
+
deferred1_1 = r1;
|
298
|
+
return getStringFromWasm0(r0, r1);
|
145
299
|
} finally {
|
146
300
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
301
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
147
302
|
}
|
148
303
|
}
|
149
304
|
/**
|
150
|
-
* @returns {string
|
305
|
+
* @returns {string}
|
151
306
|
*/
|
152
307
|
get subject() {
|
308
|
+
let deferred1_0;
|
309
|
+
let deferred1_1;
|
153
310
|
try {
|
154
311
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
155
|
-
wasm.
|
312
|
+
wasm.attachmentresult_content_type(retptr, this.__wbg_ptr);
|
156
313
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
157
314
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
162
|
-
}
|
163
|
-
return v1;
|
315
|
+
deferred1_0 = r0;
|
316
|
+
deferred1_1 = r1;
|
317
|
+
return getStringFromWasm0(r0, r1);
|
164
318
|
} finally {
|
165
319
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
320
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
166
321
|
}
|
167
322
|
}
|
168
323
|
/**
|
169
|
-
* @returns {string
|
324
|
+
* @returns {string}
|
170
325
|
*/
|
171
|
-
get
|
326
|
+
get body_html() {
|
327
|
+
let deferred1_0;
|
328
|
+
let deferred1_1;
|
172
329
|
try {
|
173
330
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
174
|
-
wasm.
|
331
|
+
wasm.attachmentresult_filename(retptr, this.__wbg_ptr);
|
175
332
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
176
333
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
334
|
+
deferred1_0 = r0;
|
335
|
+
deferred1_1 = r1;
|
336
|
+
return getStringFromWasm0(r0, r1);
|
337
|
+
} finally {
|
338
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
339
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
340
|
+
}
|
341
|
+
}
|
342
|
+
/**
|
343
|
+
* @returns {string}
|
344
|
+
*/
|
345
|
+
get text() {
|
346
|
+
let deferred1_0;
|
347
|
+
let deferred1_1;
|
348
|
+
try {
|
349
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
350
|
+
wasm.messageresult_text(retptr, this.__wbg_ptr);
|
351
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
352
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
353
|
+
deferred1_0 = r0;
|
354
|
+
deferred1_1 = r1;
|
355
|
+
return getStringFromWasm0(r0, r1);
|
356
|
+
} finally {
|
357
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
358
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
359
|
+
}
|
360
|
+
}
|
361
|
+
/**
|
362
|
+
* @returns {(AttachmentResult)[]}
|
363
|
+
*/
|
364
|
+
get attachments() {
|
365
|
+
try {
|
366
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
367
|
+
wasm.messageresult_attachments(retptr, this.__wbg_ptr);
|
368
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
369
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
370
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
371
|
+
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
182
372
|
return v1;
|
183
373
|
} finally {
|
184
374
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
@@ -186,6 +376,11 @@ export class MessageResult {
|
|
186
376
|
}
|
187
377
|
}
|
188
378
|
|
379
|
+
export function __wbg_attachmentresult_new(arg0) {
|
380
|
+
const ret = AttachmentResult.__wrap(arg0);
|
381
|
+
return addHeapObject(ret);
|
382
|
+
};
|
383
|
+
|
189
384
|
export function __wbindgen_throw(arg0, arg1) {
|
190
385
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
191
386
|
};
|
package/mail_parser_wasm_bg.wasm
CHANGED
Binary file
|