@hiraokahypertools/pst-extractor 0.1.0-alpha.1

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 (90) hide show
  1. package/dist/BTHeap.d.ts +15 -0
  2. package/dist/BTHeap.js +76 -0
  3. package/dist/CollectionAsyncProvider.d.ts +15 -0
  4. package/dist/CollectionAsyncProvider.js +44 -0
  5. package/dist/KeyedDelay.d.ts +8 -0
  6. package/dist/KeyedDelay.js +37 -0
  7. package/dist/LZFu.class.d.ts +12 -0
  8. package/dist/LZFu.class.js +95 -0
  9. package/dist/NodeMap.class.d.ts +35 -0
  10. package/dist/NodeMap.class.js +86 -0
  11. package/dist/OutlookProperties.d.ts +278 -0
  12. package/dist/OutlookProperties.js +284 -0
  13. package/dist/PAUtil.d.ts +17 -0
  14. package/dist/PAUtil.js +145 -0
  15. package/dist/PHNodeHeap.d.ts +16 -0
  16. package/dist/PHNodeHeap.js +2 -0
  17. package/dist/PHNodeHeapReader.d.ts +6 -0
  18. package/dist/PHNodeHeapReader.js +5 -0
  19. package/dist/PHUtil.d.ts +6 -0
  20. package/dist/PHUtil.js +103 -0
  21. package/dist/PLMisc.d.ts +8 -0
  22. package/dist/PLMisc.js +16 -0
  23. package/dist/PLNode.d.ts +11 -0
  24. package/dist/PLNode.js +5 -0
  25. package/dist/PLStore.d.ts +9 -0
  26. package/dist/PLStore.js +5 -0
  27. package/dist/PLSubNode.d.ts +8 -0
  28. package/dist/PLSubNode.js +5 -0
  29. package/dist/PLUtil.d.ts +29 -0
  30. package/dist/PLUtil.js +683 -0
  31. package/dist/PSTActivity.class.d.ts +103 -0
  32. package/dist/PSTActivity.class.js +144 -0
  33. package/dist/PSTAppointment.class.d.ts +275 -0
  34. package/dist/PSTAppointment.class.js +381 -0
  35. package/dist/PSTAttachment.class.d.ts +168 -0
  36. package/dist/PSTAttachment.class.js +286 -0
  37. package/dist/PSTContact.class.d.ts +900 -0
  38. package/dist/PSTContact.class.js +1253 -0
  39. package/dist/PSTFile.class.d.ts +144 -0
  40. package/dist/PSTFile.class.js +221 -0
  41. package/dist/PSTFolder.class.d.ts +111 -0
  42. package/dist/PSTFolder.class.js +269 -0
  43. package/dist/PSTMessage.class.d.ts +773 -0
  44. package/dist/PSTMessage.class.js +1264 -0
  45. package/dist/PSTMessageStore.class.d.ts +16 -0
  46. package/dist/PSTMessageStore.class.js +18 -0
  47. package/dist/PSTObject.class.d.ts +107 -0
  48. package/dist/PSTObject.class.js +208 -0
  49. package/dist/PSTOpts.d.ts +24 -0
  50. package/dist/PSTOpts.js +2 -0
  51. package/dist/PSTRecipient.class.d.ts +68 -0
  52. package/dist/PSTRecipient.class.js +105 -0
  53. package/dist/PSTTask.class.d.ts +146 -0
  54. package/dist/PSTTask.class.js +206 -0
  55. package/dist/PSTUtil.class.d.ts +134 -0
  56. package/dist/PSTUtil.class.js +804 -0
  57. package/dist/Property.d.ts +38 -0
  58. package/dist/Property.js +2 -0
  59. package/dist/PropertyContext.d.ts +6 -0
  60. package/dist/PropertyContext.js +2 -0
  61. package/dist/PropertyContextUtil.d.ts +4 -0
  62. package/dist/PropertyContextUtil.js +77 -0
  63. package/dist/PropertyTypeObject.d.ts +12 -0
  64. package/dist/PropertyTypeObject.js +21 -0
  65. package/dist/PropertyValueResolver.d.ts +4 -0
  66. package/dist/PropertyValueResolver.js +2 -0
  67. package/dist/PropertyValueResolverV1.d.ts +7 -0
  68. package/dist/PropertyValueResolverV1.js +253 -0
  69. package/dist/RawProperty.d.ts +8 -0
  70. package/dist/RawProperty.js +2 -0
  71. package/dist/RecurrencePattern.class.d.ts +50 -0
  72. package/dist/RecurrencePattern.class.js +120 -0
  73. package/dist/RootProvider.d.ts +12 -0
  74. package/dist/RootProvider.js +2 -0
  75. package/dist/SingleAsyncProvider.d.ts +5 -0
  76. package/dist/SingleAsyncProvider.js +30 -0
  77. package/dist/TableContext.d.ts +4 -0
  78. package/dist/TableContext.js +2 -0
  79. package/dist/TableContextUtil.d.ts +4 -0
  80. package/dist/TableContextUtil.js +147 -0
  81. package/dist/TableRow.d.ts +6 -0
  82. package/dist/TableRow.js +2 -0
  83. package/dist/index.d.ts +15 -0
  84. package/dist/index.js +28 -0
  85. package/dist/msftUuidStringify.d.ts +17 -0
  86. package/dist/msftUuidStringify.js +48 -0
  87. package/dist/openPstFile.d.ts +19 -0
  88. package/dist/openPstFile.js +67 -0
  89. package/package.json +105 -0
  90. package/readme.md +16 -0
@@ -0,0 +1,804 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.PSTUtil = void 0;
16
+ /* eslint-disable @typescript-eslint/no-explicit-any */
17
+ const long_1 = __importDefault(require("long"));
18
+ const PSTAppointment_class_1 = require("./PSTAppointment.class");
19
+ const PSTContact_class_1 = require("./PSTContact.class");
20
+ const PSTMessage_class_1 = require("./PSTMessage.class");
21
+ const PSTTask_class_1 = require("./PSTTask.class");
22
+ const PSTActivity_class_1 = require("./PSTActivity.class");
23
+ const iconv_lite_1 = __importDefault(require("iconv-lite"));
24
+ const PHUtil_1 = require("./PHUtil");
25
+ const PropertyContextUtil_1 = require("./PropertyContextUtil");
26
+ const PAUtil_1 = require("./PAUtil");
27
+ /**
28
+ * Utility functions for PST components
29
+ * @export
30
+ * @class PSTUtil
31
+ */
32
+ class PSTUtil {
33
+ /**
34
+ * Convert little endian bytes to long
35
+ * @static
36
+ * @param {Buffer} data
37
+ * @param {number} [start]
38
+ * @param {number} [end]
39
+ * @returns {long}
40
+ * @memberof PSTUtil
41
+ */
42
+ static convertLittleEndianBytesToLong(data, start, end) {
43
+ if (!start) {
44
+ start = 0;
45
+ }
46
+ if (!end) {
47
+ end = data.length;
48
+ }
49
+ let offset = long_1.default.fromNumber(data[end - 1] & 0xff);
50
+ let tmpLongValue;
51
+ for (let x = end - 2; x >= start; x--) {
52
+ offset = offset.shiftLeft(8);
53
+ tmpLongValue = long_1.default.fromNumber(data[x] & 0xff);
54
+ offset = offset.xor(tmpLongValue);
55
+ }
56
+ return offset;
57
+ }
58
+ /**
59
+ * Convert big endian bytes to long
60
+ * @static
61
+ * @param {Buffer} data
62
+ * @param {number} [start]
63
+ * @param {number} [end]
64
+ * @returns {long}
65
+ * @memberof PSTUtil
66
+ */
67
+ static convertBigEndianBytesToLong(data, start, end) {
68
+ if (!start) {
69
+ start = 0;
70
+ }
71
+ if (!end) {
72
+ end = data.length;
73
+ }
74
+ let offset = long_1.default.ZERO;
75
+ for (let x = start; x < end; ++x) {
76
+ offset = offset.shiftLeft(8);
77
+ const tmpLongValue = long_1.default.fromNumber(data[x] & 0xff);
78
+ offset = offset.xor(tmpLongValue);
79
+ }
80
+ return offset;
81
+ }
82
+ /**
83
+ * Handle strings using codepages.
84
+ * @static
85
+ * @param {number} propertyId
86
+ * @returns
87
+ * @memberof PSTUtil
88
+ */
89
+ static getInternetCodePageCharset(propertyId) {
90
+ return this.codePages.get(propertyId);
91
+ }
92
+ /**
93
+ * Create JS string from buffer.
94
+ * @static
95
+ * @param {Buffer} data
96
+ * @param {number} stringType
97
+ * @param {string} codepage
98
+ * @returns
99
+ * @memberof PSTUtil
100
+ */
101
+ static createJavascriptString(data, stringType, codepage = 'utf8') {
102
+ // TODO - codepage is not used...
103
+ try {
104
+ if (stringType == 0x1f) {
105
+ // convert and trim any nulls
106
+ return data.toString('utf16le').replace(/\0/g, '');
107
+ }
108
+ else {
109
+ return iconv_lite_1.default.decode(data, codepage).toString();
110
+ }
111
+ }
112
+ catch (err) {
113
+ console.error('PSTUtil::createJavascriptString Unable to decode string\n' + err);
114
+ throw err;
115
+ }
116
+ return '';
117
+ }
118
+ /**
119
+ * Copy from one array to another
120
+ * @static
121
+ * @param {Buffer} src
122
+ * @param {number} srcPos
123
+ * @param {Buffer} dest
124
+ * @param {number} destPos
125
+ * @param {number} length
126
+ * @memberof PSTUtil
127
+ */
128
+ static arraycopy(src, srcPos, dest, destPos, length) {
129
+ // TODO FIX THIS - TOO SLOW?
130
+ let s = srcPos;
131
+ let d = destPos;
132
+ let i = 0;
133
+ while (i++ < length) {
134
+ dest[d++] = src[s++];
135
+ }
136
+ }
137
+ /**
138
+ * Decode a lump of data that has been encrypted with the compressible encryption
139
+ * @static
140
+ * @param {Buffer} data
141
+ * @returns {Buffer}
142
+ * @memberof PSTUtil
143
+ */
144
+ static decode(data) {
145
+ let temp;
146
+ for (let x = 0; x < data.length; x++) {
147
+ temp = data[x] & 0xff;
148
+ data[x] = this.compEnc[temp];
149
+ }
150
+ return data;
151
+ }
152
+ /**
153
+ * Decode a lump of data that has been encrypted with the compressible encryption
154
+ * @static
155
+ * @param {Buffer} data
156
+ * @returns {Buffer}
157
+ * @memberof PSTUtil
158
+ */
159
+ static decodeArray(data) {
160
+ let temp;
161
+ for (let x = 0; x < data.length; x++) {
162
+ temp = data[x] & 0xff;
163
+ data[x] = this.compEnc[temp];
164
+ }
165
+ return data;
166
+ }
167
+ /**
168
+ * Creates object based on message class
169
+ * https://msdn.microsoft.com/en-us/vba/outlook-vba/articles/item-types-and-message-classes
170
+ * @static
171
+ * @param {PSTFile} rootProvider
172
+ * @param {DescriptorIndexNode} folderIndexNode
173
+ * @param {PSTTableBC} table
174
+ * @param {Map<number, PSTDescriptorItem>} localDescriptorItems
175
+ * @returns {PSTMessage}
176
+ * @memberof PSTUtil
177
+ */
178
+ static createAppropriatePSTMessageObject(rootProvider, node, subNode, resolver, propertyFinderDelegation) {
179
+ return __awaiter(this, void 0, void 0, function* () {
180
+ if (propertyFinderDelegation === undefined) {
181
+ const heap = yield (0, PHUtil_1.getHeapFrom)(subNode);
182
+ const pc = yield (0, PropertyContextUtil_1.getPropertyContext)(heap, resolver);
183
+ const propList = yield pc.list();
184
+ propertyFinderDelegation = (0, PAUtil_1.createPropertyFinder)(propList);
185
+ }
186
+ const propertyFinder = propertyFinderDelegation;
187
+ const item = propertyFinder.findByKey(0x001a);
188
+ let messageClass = '';
189
+ if (item !== undefined && typeof item.value === 'string') {
190
+ messageClass = item.value;
191
+ }
192
+ switch (messageClass) {
193
+ case 'IPM.Note':
194
+ case 'IPM.Note.SMIME.MultipartSigned':
195
+ case 'IPM.Note.Agenda':
196
+ // email message
197
+ const msg = new PSTMessage_class_1.PSTMessage(rootProvider, node, subNode, propertyFinder);
198
+ // Log.debug1(msg.body);
199
+ // Log.debug1(msg.numberOfRecipients.toString());
200
+ // Log.debug1(msg.colorCategories.toString());
201
+ // Log.debug1(JSON.stringify(msg, null, 2));
202
+ return msg;
203
+ case 'IPM.Appointment':
204
+ case 'IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}':
205
+ case 'IPM.Schedule.Meeting.Canceled':
206
+ case 'IPM.Schedule.Meeting.Resp.Pos':
207
+ case 'IPM.Schedule.Meeting.Resp.Tent':
208
+ case 'IPM.Schedule.Meeting.Notification.Forward':
209
+ case 'IPM.Schedule.Meeting.Resp.Neg':
210
+ // appointment
211
+ // messageClass.startsWith('IPM.Schedule.Meeting')
212
+ const apt = new PSTAppointment_class_1.PSTAppointment(rootProvider, node, subNode, propertyFinder);
213
+ // Log.debug1(JSON.stringify(msg, null, 2));
214
+ return apt;
215
+ case 'IPM.Contact':
216
+ // contact
217
+ const contact = new PSTContact_class_1.PSTContact(rootProvider, node, subNode, propertyFinder);
218
+ // Log.debug1(JSON.stringify(msg, null, 2));
219
+ return contact;
220
+ case 'IPM.Task':
221
+ // task
222
+ const task = new PSTTask_class_1.PSTTask(rootProvider, node, subNode, propertyFinder);
223
+ // Log.debug1(JSON.stringify(msg, null, 2));
224
+ return task;
225
+ case 'IPM.Activity':
226
+ // journal entry
227
+ const activity = new PSTActivity_class_1.PSTActivity(rootProvider, node, subNode, propertyFinder);
228
+ // Log.debug1(JSON.stringify(msg, null, 2));
229
+ return activity;
230
+ case 'IPM.Post.Rss':
231
+ // debugger;
232
+ // Rss Feed
233
+ const rss = new PSTMessage_class_1.PSTMessage(rootProvider, node, subNode, propertyFinder);
234
+ // Log.debug1(JSON.stringify(msg, null, 2));
235
+ return rss;
236
+ case 'IPM.DistList':
237
+ // debugger;
238
+ // Distribution list
239
+ const dl = new PSTMessage_class_1.PSTMessage(rootProvider, node, subNode, propertyFinder);
240
+ // Log.debug1(JSON.stringify(msg, null, 2));
241
+ return dl;
242
+ // return new PSTDistList(theFile, folderIndexNode, table, localDescriptorItems);
243
+ case 'IPM.Note.Rules.OofTemplate.Microsoft':
244
+ // debugger;
245
+ // Out of Office rule
246
+ const oof = new PSTMessage_class_1.PSTMessage(rootProvider, node, subNode, propertyFinder);
247
+ // Log.debug1(JSON.stringify(msg, null, 2));
248
+ return oof;
249
+ case 'IPM.Schedule.Meeting.Request':
250
+ // Meeting request
251
+ const meetReq = new PSTMessage_class_1.PSTMessage(rootProvider, node, subNode, propertyFinder);
252
+ // Log.debug1(JSON.stringify(msg, null, 2));
253
+ return meetReq;
254
+ case 'REPORT.IPM.Note.NDR':
255
+ // Receipt of non-delivery
256
+ const ndr = new PSTMessage_class_1.PSTMessage(rootProvider, node, subNode, propertyFinder);
257
+ // Log.debug1(JSON.stringify(msg, null, 2));
258
+ return ndr;
259
+ case 'IPM.StickyNote':
260
+ // Sticky note
261
+ const sticky = new PSTMessage_class_1.PSTMessage(rootProvider, node, subNode, propertyFinder);
262
+ // Log.debug1(JSON.stringify(msg, null, 2));
263
+ return sticky;
264
+ case 'REPORT.IPM.Note.IPNRN':
265
+ // Read receipt
266
+ // debugger;
267
+ // console.log('PSTUtil::createAppropriatePSTMessageObject REPORT.IPM.Note.IPNRN');
268
+ return new PSTMessage_class_1.PSTMessage(rootProvider, node, subNode, propertyFinder);
269
+ case 'REPORT.IPM.Note.IPNNRN':
270
+ // Not-read notification
271
+ // debugger;
272
+ // console.log('PSTUtil::createAppropriatePSTMessageObject REPORT.IPM.Note.IPNNRN');
273
+ return new PSTMessage_class_1.PSTMessage(rootProvider, node, subNode, propertyFinder);
274
+ case 'IPM.Schedule.Meeting.Request':
275
+ // Meeting request
276
+ // debugger;
277
+ // console.log('PSTUtil::createAppropriatePSTMessageObject IPM.Schedule.Meeting.Request');
278
+ return new PSTMessage_class_1.PSTMessage(rootProvider, node, subNode, propertyFinder);
279
+ case 'REPORT.IPM.Note.DR':
280
+ // Delivery receipt
281
+ // debugger;
282
+ // console.log('PSTUtil::createAppropriatePSTMessageObject REPORT.IPM.Note.DR');
283
+ return new PSTMessage_class_1.PSTMessage(rootProvider, node, subNode, propertyFinder);
284
+ default:
285
+ console.error('PSTUtil::createAppropriatePSTMessageObject unknown message type: ' +
286
+ messageClass);
287
+ }
288
+ return new PSTMessage_class_1.PSTMessage(rootProvider, node, subNode, propertyFinder);
289
+ });
290
+ }
291
+ /**
292
+ * Converts a Windows FILETIME into a {@link Date}. The Windows FILETIME structure holds a date and time associated with a
293
+ * file. The structure identifies a 64-bit integer specifying the number of 100-nanosecond intervals which have passed since
294
+ * January 1, 1601. This 64-bit value is split into the two double words stored in the structure.
295
+ *
296
+ * @static
297
+ * @param {long} hi
298
+ * @param {long} low
299
+ * @returns {Date}
300
+ * @memberof PSTUtil
301
+ */
302
+ static filetimeToDate(hi, low) {
303
+ const h = hi.shiftLeft(32);
304
+ const l = low.and(0xffffffff);
305
+ const filetime = h.or(l);
306
+ const msSince16010101 = filetime.divide(1000 * 10);
307
+ const epochDiff = long_1.default.fromValue('11644473600000');
308
+ const msSince19700101 = msSince16010101.subtract(epochDiff);
309
+ return new Date(msSince19700101.toNumber());
310
+ }
311
+ }
312
+ exports.PSTUtil = PSTUtil;
313
+ // substitution table for the compressible encryption type.
314
+ PSTUtil.compEnc = [
315
+ 0x47,
316
+ 0xf1,
317
+ 0xb4,
318
+ 0xe6,
319
+ 0x0b,
320
+ 0x6a,
321
+ 0x72,
322
+ 0x48,
323
+ 0x85,
324
+ 0x4e,
325
+ 0x9e,
326
+ 0xeb,
327
+ 0xe2,
328
+ 0xf8,
329
+ 0x94,
330
+ 0x53,
331
+ 0xe0,
332
+ 0xbb,
333
+ 0xa0,
334
+ 0x02,
335
+ 0xe8,
336
+ 0x5a,
337
+ 0x09,
338
+ 0xab,
339
+ 0xdb,
340
+ 0xe3,
341
+ 0xba,
342
+ 0xc6,
343
+ 0x7c,
344
+ 0xc3,
345
+ 0x10,
346
+ 0xdd,
347
+ 0x39,
348
+ 0x05,
349
+ 0x96,
350
+ 0x30,
351
+ 0xf5,
352
+ 0x37,
353
+ 0x60,
354
+ 0x82,
355
+ 0x8c,
356
+ 0xc9,
357
+ 0x13,
358
+ 0x4a,
359
+ 0x6b,
360
+ 0x1d,
361
+ 0xf3,
362
+ 0xfb,
363
+ 0x8f,
364
+ 0x26,
365
+ 0x97,
366
+ 0xca,
367
+ 0x91,
368
+ 0x17,
369
+ 0x01,
370
+ 0xc4,
371
+ 0x32,
372
+ 0x2d,
373
+ 0x6e,
374
+ 0x31,
375
+ 0x95,
376
+ 0xff,
377
+ 0xd9,
378
+ 0x23,
379
+ 0xd1,
380
+ 0x00,
381
+ 0x5e,
382
+ 0x79,
383
+ 0xdc,
384
+ 0x44,
385
+ 0x3b,
386
+ 0x1a,
387
+ 0x28,
388
+ 0xc5,
389
+ 0x61,
390
+ 0x57,
391
+ 0x20,
392
+ 0x90,
393
+ 0x3d,
394
+ 0x83,
395
+ 0xb9,
396
+ 0x43,
397
+ 0xbe,
398
+ 0x67,
399
+ 0xd2,
400
+ 0x46,
401
+ 0x42,
402
+ 0x76,
403
+ 0xc0,
404
+ 0x6d,
405
+ 0x5b,
406
+ 0x7e,
407
+ 0xb2,
408
+ 0x0f,
409
+ 0x16,
410
+ 0x29,
411
+ 0x3c,
412
+ 0xa9,
413
+ 0x03,
414
+ 0x54,
415
+ 0x0d,
416
+ 0xda,
417
+ 0x5d,
418
+ 0xdf,
419
+ 0xf6,
420
+ 0xb7,
421
+ 0xc7,
422
+ 0x62,
423
+ 0xcd,
424
+ 0x8d,
425
+ 0x06,
426
+ 0xd3,
427
+ 0x69,
428
+ 0x5c,
429
+ 0x86,
430
+ 0xd6,
431
+ 0x14,
432
+ 0xf7,
433
+ 0xa5,
434
+ 0x66,
435
+ 0x75,
436
+ 0xac,
437
+ 0xb1,
438
+ 0xe9,
439
+ 0x45,
440
+ 0x21,
441
+ 0x70,
442
+ 0x0c,
443
+ 0x87,
444
+ 0x9f,
445
+ 0x74,
446
+ 0xa4,
447
+ 0x22,
448
+ 0x4c,
449
+ 0x6f,
450
+ 0xbf,
451
+ 0x1f,
452
+ 0x56,
453
+ 0xaa,
454
+ 0x2e,
455
+ 0xb3,
456
+ 0x78,
457
+ 0x33,
458
+ 0x50,
459
+ 0xb0,
460
+ 0xa3,
461
+ 0x92,
462
+ 0xbc,
463
+ 0xcf,
464
+ 0x19,
465
+ 0x1c,
466
+ 0xa7,
467
+ 0x63,
468
+ 0xcb,
469
+ 0x1e,
470
+ 0x4d,
471
+ 0x3e,
472
+ 0x4b,
473
+ 0x1b,
474
+ 0x9b,
475
+ 0x4f,
476
+ 0xe7,
477
+ 0xf0,
478
+ 0xee,
479
+ 0xad,
480
+ 0x3a,
481
+ 0xb5,
482
+ 0x59,
483
+ 0x04,
484
+ 0xea,
485
+ 0x40,
486
+ 0x55,
487
+ 0x25,
488
+ 0x51,
489
+ 0xe5,
490
+ 0x7a,
491
+ 0x89,
492
+ 0x38,
493
+ 0x68,
494
+ 0x52,
495
+ 0x7b,
496
+ 0xfc,
497
+ 0x27,
498
+ 0xae,
499
+ 0xd7,
500
+ 0xbd,
501
+ 0xfa,
502
+ 0x07,
503
+ 0xf4,
504
+ 0xcc,
505
+ 0x8e,
506
+ 0x5f,
507
+ 0xef,
508
+ 0x35,
509
+ 0x9c,
510
+ 0x84,
511
+ 0x2b,
512
+ 0x15,
513
+ 0xd5,
514
+ 0x77,
515
+ 0x34,
516
+ 0x49,
517
+ 0xb6,
518
+ 0x12,
519
+ 0x0a,
520
+ 0x7f,
521
+ 0x71,
522
+ 0x88,
523
+ 0xfd,
524
+ 0x9d,
525
+ 0x18,
526
+ 0x41,
527
+ 0x7d,
528
+ 0x93,
529
+ 0xd8,
530
+ 0x58,
531
+ 0x2c,
532
+ 0xce,
533
+ 0xfe,
534
+ 0x24,
535
+ 0xaf,
536
+ 0xde,
537
+ 0xb8,
538
+ 0x36,
539
+ 0xc8,
540
+ 0xa1,
541
+ 0x80,
542
+ 0xa6,
543
+ 0x99,
544
+ 0x98,
545
+ 0xa8,
546
+ 0x2f,
547
+ 0x0e,
548
+ 0x81,
549
+ 0x65,
550
+ 0x73,
551
+ 0xe4,
552
+ 0xc2,
553
+ 0xa2,
554
+ 0x8a,
555
+ 0xd4,
556
+ 0xe1,
557
+ 0x11,
558
+ 0xd0,
559
+ 0x08,
560
+ 0x8b,
561
+ 0x2a,
562
+ 0xf2,
563
+ 0xed,
564
+ 0x9a,
565
+ 0x64,
566
+ 0x3f,
567
+ 0xc1,
568
+ 0x6c,
569
+ 0xf9,
570
+ 0xec,
571
+ ];
572
+ PSTUtil.codePages = new Map([
573
+ [28596, 'iso-8859-6'],
574
+ [1256, 'windows-1256'],
575
+ [28594, 'iso-8859-4'],
576
+ [1257, 'windows-1257'],
577
+ [28592, 'iso-8859-2'],
578
+ [1250, 'windows-1250'],
579
+ [936, 'gb2312'],
580
+ [52936, 'hz-gb-2312'],
581
+ [54936, 'gb18030'],
582
+ [950, 'big5'],
583
+ [28595, 'iso-8859-5'],
584
+ [20866, 'koi8-r'],
585
+ [21866, 'koi8-u'],
586
+ [1251, 'windows-1251'],
587
+ [28597, 'iso-8859-7'],
588
+ [1253, 'windows-1253'],
589
+ [38598, 'iso-8859-8-i'],
590
+ [1255, 'windows-1255'],
591
+ [51932, 'euc-jp'],
592
+ [50220, 'iso-2022-jp'],
593
+ [50221, 'csISO2022JP'],
594
+ [932, 'iso-2022-jp'],
595
+ [949, 'ks_c_5601-1987'],
596
+ [51949, 'euc-kr'],
597
+ [28593, 'iso-8859-3'],
598
+ [28605, 'iso-8859-15'],
599
+ [874, 'windows-874'],
600
+ [28599, 'iso-8859-9'],
601
+ [1254, 'windows-1254'],
602
+ [65000, 'utf-7'],
603
+ [65001, 'utf-8'],
604
+ [20127, 'us-ascii'],
605
+ [1258, 'windows-1258'],
606
+ [28591, 'iso-8859-1'],
607
+ [1252, 'Windows-1252'],
608
+ ]);
609
+ // maps hex codes to names for properties
610
+ PSTUtil.propertyName = new Map([
611
+ [0x0002, 'PidTagAlternateRecipientAllowed'],
612
+ [0x0003, 'PidTagNameidStreamEntry'],
613
+ [0x0004, 'PidTagNameidStreamString'],
614
+ [0x0017, 'PidTagImportance'],
615
+ [0x001a, 'PidTagMessageClass'],
616
+ [0x0023, 'PidTagOriginatorDeliveryReportRequested'],
617
+ [0x0026, 'PidTagPriority'],
618
+ [0x0029, 'PidLidOldWhenStartWhole'],
619
+ [0x002b, 'PidTagRecipientReassignmentProhibited'],
620
+ [0x002e, 'PidTagOriginalSensitivity'],
621
+ [0x0036, 'PidTagSensitivity'],
622
+ [0x0037, 'PidTagSubject'],
623
+ [0x0039, 'PidTagClientSubmitTime'],
624
+ [0x003b, 'PidTagSentRepresentingSearchKey'],
625
+ [0x003f, 'PidTagReceivedByEntryId'],
626
+ [0x0040, 'PidTagReceivedByName'],
627
+ [0x0041, 'PidTagSentRepresentingEntryId'],
628
+ [0x0042, 'PidTagSentRepresentingName'],
629
+ [0x0043, 'PidTagReceivedRepresentingEntryId'],
630
+ [0x0044, 'PidTagReceivedRepresentingName'],
631
+ [0x004d, 'PidTagOriginalAuthorName'],
632
+ [0x0052, 'PidTagReceivedRepresentingSearchKey'],
633
+ [0x0057, 'PidTagMessageToMe'],
634
+ [0x0058, 'PidTagMessageCcMe'],
635
+ [0x0060, 'PidTagStartDate'],
636
+ [0x0061, 'PidTagEndDate'],
637
+ [0x0062, 'PidTagOwnerAppointmentId'],
638
+ [0x0063, 'PidTagResponseRequested'],
639
+ [0x0064, 'PidTagSentRepresentingAddressType'],
640
+ [0x0065, 'PidTagSentRepresentingEmailAddress'],
641
+ [0x0070, 'PidTagConversationTopic'],
642
+ [0x0071, 'PidTagConversationIndex'],
643
+ [0x0075, 'PidTagReceivedByAddressType'],
644
+ [0x0076, 'PidTagReceivedByEmailAddress'],
645
+ [0x0077, 'PidTagReceivedRepresentingAddressType'],
646
+ [0x0078, 'PidTagReceivedRepresentingEmailAddress'],
647
+ [0x007d, 'PidTagTransportMessageHeaders'],
648
+ [0x0c15, 'PidTagRecipientType'],
649
+ [0x0c17, 'PidTagReplyRequested'],
650
+ [0x0c19, 'PidTagSenderEntryId'],
651
+ [0x0c1a, 'PidTagSenderName'],
652
+ [0x0c1d, 'PidTagSenderSearchKey'],
653
+ [0x0c1e, 'PidTagSenderAddressType'],
654
+ [0x0c1f, 'PidTagSenderEmailAddress'],
655
+ [0x0e01, 'PidTagDeleteAfterSubmit'],
656
+ [0x0e02, 'PidTagDisplayBcc'],
657
+ [0x0e03, 'PidTagDisplayCc'],
658
+ [0x0e04, 'PidTagDisplayTo'],
659
+ [0x0e06, 'PidTagMessageDeliveryTime'],
660
+ [0x0e07, 'PidTagMessageFlags'],
661
+ [0x0e08, 'PidTagMessageSize'],
662
+ [0x0e0f, 'PidTagResponsibility'],
663
+ [0x0e20, 'PidTagAttachSize'],
664
+ [0x0e23, 'PidTagInternetArticleNumber'],
665
+ [0x0e38, 'PidTagReplFlags'],
666
+ [0x0e62, 'PidTagUrlCompNameSet'],
667
+ [0x0e79, 'PidTagTrustSender'],
668
+ [0x0ff9, 'PidTagRecordKey'],
669
+ [0x0ffe, 'PidTagObjectType'],
670
+ [0x0fff, 'PidTagEntryId'],
671
+ [0x1000, 'PidTagBody'],
672
+ [0x1009, 'PidTagRtfCompressed'],
673
+ [0x1013, 'PidTagBodyHtml'],
674
+ [0x1035, 'PidTagInternetMessageId'],
675
+ [0x1039, 'PidTagInternetReferences'],
676
+ [0x1042, 'PidTagInReplyToId'],
677
+ [0x1080, 'PidTagIconIndex'],
678
+ [0x1081, 'PidTagLastVerbExecuted'],
679
+ [0x1082, 'PidTagLastVerbExecutionTime'],
680
+ [0x1096, 'PidTagBlockStatus'],
681
+ [0x10c3, 'PidTagICalendarStartTime'],
682
+ [0x10c4, 'PidTagICalendarEndTime'],
683
+ [0x10f2, 'Unknown_10F2'],
684
+ [0x10f3, 'PidTagUrlCompName'],
685
+ [0x10f4, 'PidTagAttributeHidden'],
686
+ [0x10f5, 'PidTagAttributeSystem'],
687
+ [0x10f6, 'PidTagAttributeReadOnly'],
688
+ [0x3001, 'PidTagDisplayName'],
689
+ [0x3002, 'PidTagAddressType'],
690
+ [0x3003, 'PidTagEmailAddress'],
691
+ [0x3007, 'PidTagCreationTime'],
692
+ [0x3008, 'PidTagLastModificationTime'],
693
+ [0x300b, 'PidTagSearchKey'],
694
+ [0x3701, 'PidTagAttachDataBinary'],
695
+ [0x3702, 'PidTagAttachEncoding'],
696
+ [0x3703, 'PidTagAttachExtension'],
697
+ [0x3704, 'PidTagAttachFilename'],
698
+ [0x3705, 'PidTagAttachMethod'],
699
+ [0x3709, 'PidTagAttachRendering'],
700
+ [0x370b, 'PidTagRenderingPosition'],
701
+ [0x370e, 'PidTagAttachMimeTag'],
702
+ [0x370a, 'PidTagAttachTag'],
703
+ [0x3712, 'PidTagAttachContentId'],
704
+ [0x3714, 'PidTagAttachFlags'],
705
+ [0x3900, 'PidTagDisplayType'],
706
+ [0x39fe, 'PidTagPrimarySmtpAddress'],
707
+ [0x39ff, 'PidTag7BitDisplayName'],
708
+ [0x3a00, 'PidTagAccount'],
709
+ [0x3a08, 'PidTagBusinessTelephoneNumber'],
710
+ [0x3a20, 'PidTagTransmittableDisplayName'],
711
+ [0x3a40, 'PidTagSendRichInfo'],
712
+ [0x3a70, 'PidTagUserX509Certificate'],
713
+ [0x3a71, 'PidTagSendInternetEncoding'],
714
+ [0x3fde, 'PidTagInternetCodepage'],
715
+ [0x3ff1, 'PidTagMessageLocaleId'],
716
+ [0x3ffd, 'PidTagMessageCodepage'],
717
+ [0x3ff9, 'PidTagCreatorName'],
718
+ [0x4019, 'PidTagSenderFlags'],
719
+ [0x401a, 'PidTagSentRepresentingFlags'],
720
+ [0x401b, 'PidTagReceivedByFlags'],
721
+ [0x401c, 'PidTagReceivedRepresentingFlags'],
722
+ [0x403e, 'Unknown_403E'],
723
+ [0x4a08, 'Unknown_4A08'],
724
+ [0x5902, 'PidTagInternetMailOverrideFormat'],
725
+ [0x5909, 'PidTagMessageEditorFormat'],
726
+ [0x5fde, 'PidTagRecipientResourceState'],
727
+ [0x5fdf, 'PidTagRecipientOrder'],
728
+ [0x5feb, 'Unknown_5FEB'],
729
+ [0x5fef, 'Unknown_5FEF'],
730
+ [0x5ff2, 'Unknown_5FF2'],
731
+ [0x5ff5, 'Unknown_5FF5'],
732
+ [0x5ff6, 'PidTagRecipientDisplayName'],
733
+ [0x5ff7, 'PidTagRecipientEntryId'],
734
+ [0x5ffb, 'PidTagRecipientTrackStatusTime'],
735
+ [0x5ffd, 'PidTagRecipientFlags'],
736
+ [0x5fff, 'PidTagRecipientTrackStatus'],
737
+ [0x6001, 'PidTagNickname'],
738
+ [0x6610, 'Unknown_6610'],
739
+ [0x6614, 'Unknown_6614'],
740
+ [0x6617, 'Unknown_6617'],
741
+ [0x6619, 'PidTagUserEntryId'],
742
+ [0x6743, 'Unknown_6743'],
743
+ [0x6744, 'Unknown_6744'],
744
+ [0x67f2, 'PidTagLtpRowId'],
745
+ [0x67f3, 'PidTagLtpRowVer'],
746
+ [0x67f4, 'Unknown_67F4'],
747
+ [0x7ffa, 'PidTagAttachmentLinkId'],
748
+ [0x7ffb, 'PidTagExceptionStartTime'],
749
+ [0x7ffc, 'PidTagExceptionEndTime'],
750
+ [0x7ffd, 'PidTagAttachmentFlags'],
751
+ [0x7ffe, 'PidTagAttachmentHidden'],
752
+ [0x7fff, 'PidTagAttachmentContactPhoto'],
753
+ [0x3ffa, 'PidTagLastModifiedName_W'],
754
+ [0x3ffb, 'PidTagLastModifierEntryId'],
755
+ ]);
756
+ // Heap node
757
+ PSTUtil.NID_TYPE_HID = 0x00;
758
+ // Internal node (section 2.4.1)
759
+ PSTUtil.NID_TYPE_INTERNAL = 0x01;
760
+ // Normal Folder object (PC)
761
+ PSTUtil.NID_TYPE_NORMAL_FOLDER = 0x02;
762
+ // Search Folder object (PC)
763
+ PSTUtil.NID_TYPE_SEARCH_FOLDER = 0x03;
764
+ // Normal Message object (PC)
765
+ PSTUtil.NID_TYPE_NORMAL_MESSAGE = 0x04;
766
+ // Attachment object (PC)
767
+ PSTUtil.NID_TYPE_ATTACHMENT = 0x05;
768
+ // Queue of changed objects for search Folder objects
769
+ PSTUtil.NID_TYPE_SEARCH_UPDATE_QUEUE = 0x06;
770
+ // Defines the search criteria for a search folder object
771
+ PSTUtil.NID_TYPE_SEARCH_CRITERIA_OBJECT = 0x07;
772
+ // Folder associated info (FAI) message object (PC)
773
+ PSTUtil.NID_TYPE_ASSOC_MESSAGE = 0x08;
774
+ // Internal, persisted view-related
775
+ PSTUtil.NID_TYPE_CONTENTS_TABLE_INDEX = 0x0a;
776
+ // Receive Folder object (Inbox)
777
+ PSTUtil.NID_TYPE_RECEIVE_FOLDER_TABLE = 0x0b;
778
+ // Outbound queue (Outbox)
779
+ PSTUtil.NID_TYPE_OUTGOING_QUEUE_TABLE = 0x0c;
780
+ // Hierarchy table (TC)
781
+ PSTUtil.NID_TYPE_HIERARCHY_TABLE = 0x0d;
782
+ // Contents table (TC)
783
+ PSTUtil.NID_TYPE_CONTENTS_TABLE = 0x0e;
784
+ // FAI contents table (TC)
785
+ PSTUtil.NID_TYPE_ASSOC_CONTENTS_TABLE = 0x0f;
786
+ // Contents table (TC) of a search folder object
787
+ PSTUtil.NID_TYPE_SEARCH_CONTENTS_TABLE = 0x10;
788
+ // Attachment table (TC)
789
+ PSTUtil.NID_TYPE_ATTACHMENT_TABLE = 0x11;
790
+ // Recipient table (TC)
791
+ PSTUtil.NID_TYPE_RECIPIENT_TABLE = 0x12;
792
+ // Internal, persisted view-related
793
+ PSTUtil.NID_TYPE_SEARCH_TABLE_INDEX = 0x13;
794
+ // LTP
795
+ PSTUtil.NID_TYPE_LTP = 0x1f;
796
+ /**
797
+ * Determine if character is alphanumeric
798
+ *
799
+ * @static
800
+ * @memberof PSTUtil
801
+ */
802
+ PSTUtil.isAlphaNumeric = (ch) => {
803
+ return ch.match(/^[a-z0-9]+$/i) !== null;
804
+ };