@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,286 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PSTAttachment = void 0;
13
+ /* eslint-disable @typescript-eslint/no-explicit-any */
14
+ const OutlookProperties_1 = require("./OutlookProperties");
15
+ const PropertyTypeObject_1 = require("./PropertyTypeObject");
16
+ const PSTObject_class_1 = require("./PSTObject.class");
17
+ // Class containing attachment information.
18
+ class PSTAttachment extends PSTObject_class_1.PSTObject {
19
+ /**
20
+ * Creates an instance of PSTAttachment.
21
+ * @internal
22
+ * @param {PSTFile} rootProvider
23
+ * @param {Map<number, PSTDescriptorItem>} localDescriptorItems
24
+ * @memberof PSTAttachment
25
+ */
26
+ constructor(rootProvider, node, subNode, propertyFinder) {
27
+ super(rootProvider, node, subNode, propertyFinder);
28
+ }
29
+ /**
30
+ * The PR_ATTACH_SIZE property contains the sum, in bytes, of the sizes of all properties on an attachment.
31
+ * https://msdn.microsoft.com/en-us/library/gg156074(v=winembedded.70).aspx
32
+ * @readonly
33
+ * @type {number}
34
+ * @memberof PSTAttachment
35
+ */
36
+ get size() {
37
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_SIZE);
38
+ }
39
+ /**
40
+ * Contains the creation date and time of a message.
41
+ * https://msdn.microsoft.com/en-us/library/office/cc765677.aspx
42
+ * @readonly
43
+ * @type {Date}
44
+ * @memberof PSTAttachment
45
+ */
46
+ get creationTime() {
47
+ return this.getDateItem(OutlookProperties_1.OutlookProperties.PR_CREATION_TIME);
48
+ }
49
+ /**
50
+ * Contains the date and time when the object or subobject was last modified.
51
+ * https://msdn.microsoft.com/en-us/library/office/cc815689.aspx
52
+ * @readonly
53
+ * @type {Date}
54
+ * @memberof PSTAttachment
55
+ */
56
+ get modificationTime() {
57
+ return this.getDateItem(OutlookProperties_1.OutlookProperties.PR_LAST_MODIFICATION_TIME);
58
+ }
59
+ /**
60
+ * Get an embedded message.
61
+ * @readonly
62
+ * @type {PSTMessage}
63
+ * @memberof PSTAttachment
64
+ */
65
+ getEmbeddedPSTMessage() {
66
+ var _a, _b;
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ const attachMethod = (_a = this._propertyFinder.findByKey(0x3705)) === null || _a === void 0 ? void 0 : _a.value;
69
+ try {
70
+ if (true
71
+ && typeof attachMethod === 'number'
72
+ && attachMethod == PSTAttachment.ATTACHMENT_METHOD_EMBEDDED) {
73
+ const attachDataBinary = (_b = this._propertyFinder.findByKey(0x3701)) === null || _b === void 0 ? void 0 : _b.value;
74
+ if (false) { }
75
+ else if (attachDataBinary instanceof ArrayBuffer) {
76
+ // PT_BINARY
77
+ throw new Error("Currently getEmbeddedPSTMessage and ATTACHMENT_METHOD_EMBEDDED need attachDataBinary to be PT_OBJECT");
78
+ }
79
+ else if (attachDataBinary instanceof PropertyTypeObject_1.PropertyTypeObject) {
80
+ const { subNodeId } = attachDataBinary;
81
+ const subNode = yield this._subNode.getChildBy(subNodeId);
82
+ if (subNode === undefined) {
83
+ throw new Error(`childNodeId=0x${subNodeId.toString(16)}`
84
+ + ` of ${this._subNode} not found`);
85
+ }
86
+ return yield this._rootProvider.getItemOf(this._node, subNode, undefined);
87
+ }
88
+ }
89
+ }
90
+ catch (err) {
91
+ console.error('PSTAttachment::embeddedPSTMessage createAppropriatePSTMessageObject failed\n' +
92
+ err);
93
+ throw err;
94
+ }
95
+ return null;
96
+ });
97
+ }
98
+ /**
99
+ * Get attachment content as binary data
100
+ */
101
+ get fileData() {
102
+ const attachmentDataObject = this._propertyFinder.findByKey(OutlookProperties_1.OutlookProperties.PR_ATTACH_DATA_BIN);
103
+ if (attachmentDataObject !== undefined) {
104
+ const { value } = attachmentDataObject;
105
+ if (value instanceof ArrayBuffer) {
106
+ return value;
107
+ }
108
+ }
109
+ return undefined;
110
+ }
111
+ /**
112
+ * Size of the attachment file itself.
113
+ * https://msdn.microsoft.com/en-us/library/gg154634(v=winembedded.70).aspx
114
+ * @readonly
115
+ * @type {number}
116
+ * @memberof PSTAttachment
117
+ */
118
+ get filesize() {
119
+ const attachmentDataObject = this._propertyFinder.findByKey(OutlookProperties_1.OutlookProperties.PR_ATTACH_DATA_BIN);
120
+ if (attachmentDataObject !== undefined) {
121
+ const { value } = attachmentDataObject;
122
+ if (value instanceof ArrayBuffer) {
123
+ return value.byteLength;
124
+ }
125
+ else if (value instanceof PropertyTypeObject_1.PropertyTypeObject) {
126
+ return value.size;
127
+ }
128
+ }
129
+ return 0;
130
+ }
131
+ /**
132
+ * Contains an attachment's base file name and extension, excluding path.
133
+ * https://msdn.microsoft.com/en-us/library/office/cc842517.aspx
134
+ * @readonly
135
+ * @type {string}
136
+ * @memberof PSTAttachment
137
+ */
138
+ get filename() {
139
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_FILENAME);
140
+ }
141
+ /**
142
+ * Contains a MAPI-defined constant representing the way the contents of an attachment can be accessed.
143
+ * https://msdn.microsoft.com/en-us/library/office/cc815439.aspx
144
+ * @readonly
145
+ * @type {number}
146
+ * @memberof PSTAttachment
147
+ */
148
+ get attachMethod() {
149
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_METHOD);
150
+ }
151
+ /**
152
+ * Contains a number that uniquely identifies the attachment within its parent message.
153
+ * https://msdn.microsoft.com/en-us/library/office/cc841969.aspx
154
+ * @readonly
155
+ * @type {number}
156
+ * @memberof PSTAttachment
157
+ */
158
+ get attachNum() {
159
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_NUM);
160
+ }
161
+ /**
162
+ * Contains an attachment's long filename and extension, excluding path.
163
+ * https://msdn.microsoft.com/en-us/library/office/cc842157.aspx
164
+ * @readonly
165
+ * @type {string}
166
+ * @memberof PSTAttachment
167
+ */
168
+ get longFilename() {
169
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_LONG_FILENAME);
170
+ }
171
+ /**
172
+ * Contains an attachment's fully-qualified path and filename.
173
+ * https://msdn.microsoft.com/en-us/library/office/cc839889.aspx
174
+ * @readonly
175
+ * @type {string}
176
+ * @memberof PSTAttachment
177
+ */
178
+ get pathname() {
179
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_PATHNAME);
180
+ }
181
+ /**
182
+ * Contains an offset, in characters, to use in rendering an attachment within the main message text.
183
+ * https://msdn.microsoft.com/en-us/library/office/cc842381.aspx
184
+ * @readonly
185
+ * @type {number}
186
+ * @memberof PSTAttachment
187
+ */
188
+ get renderingPosition() {
189
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_RENDERING_POSITION);
190
+ }
191
+ /**
192
+ * Contains an attachment's fully-qualified long path and filename.
193
+ * https://msdn.microsoft.com/en-us/library/office/cc815443.aspx
194
+ * @readonly
195
+ * @type {string}
196
+ * @memberof PSTAttachment
197
+ */
198
+ get longPathname() {
199
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_LONG_PATHNAME);
200
+ }
201
+ /**
202
+ * Contains formatting information about a Multipurpose Internet Mail Extensions (MIME) attachment.
203
+ * https://msdn.microsoft.com/en-us/library/office/cc842516.aspx
204
+ * @readonly
205
+ * @type {string}
206
+ * @memberof PSTAttachment
207
+ */
208
+ get mimeTag() {
209
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_MIME_TAG);
210
+ }
211
+ /**
212
+ * Contains the MIME sequence number of a MIME message attachment.
213
+ * https://msdn.microsoft.com/en-us/library/office/cc963256.aspx
214
+ * @readonly
215
+ * @type {number}
216
+ * @memberof PSTAttachment
217
+ */
218
+ get mimeSequence() {
219
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_MIME_SEQUENCE);
220
+ }
221
+ /**
222
+ * Contains the content identification header of a Multipurpose Internet Mail Extensions (MIME) message attachment.
223
+ * https://msdn.microsoft.com/en-us/library/office/cc765868.aspx
224
+ * @readonly
225
+ * @type {string}
226
+ * @memberof PSTAttachment
227
+ */
228
+ get contentId() {
229
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_CONTENT_ID);
230
+ }
231
+ /**
232
+ * Indicates that this attachment is not available to HTML rendering applications and should be ignored in Multipurpose Internet Mail Extensions (MIME) processing.
233
+ * https://msdn.microsoft.com/en-us/library/office/cc765876.aspx
234
+ * @readonly
235
+ * @type {boolean}
236
+ * @memberof PSTAttachment
237
+ */
238
+ get isAttachmentInvisibleInHtml() {
239
+ const actionFlag = this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_FLAGS);
240
+ return (actionFlag & 0x1) > 0;
241
+ }
242
+ /**
243
+ * Indicates that this attachment is not available to applications rendering in Rich Text Format (RTF) and should be ignored by MAPI.
244
+ * https://msdn.microsoft.com/en-us/library/office/cc765876.aspx
245
+ * @readonly
246
+ * @type {boolean}
247
+ * @memberof PSTAttachment
248
+ */
249
+ get isAttachmentInvisibleInRTF() {
250
+ const actionFlag = this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_FLAGS);
251
+ return (actionFlag & 0x2) > 0;
252
+ }
253
+ /**
254
+ * JSON stringify the object properties.
255
+ * @returns {string}
256
+ * @memberof PSTAttachment
257
+ */
258
+ toJSON() {
259
+ const clone = Object.assign({
260
+ size: this.size,
261
+ creationTime: this.creationTime,
262
+ modificationTime: this.modificationTime,
263
+ filename: this.filename,
264
+ attachMethod: this.attachMethod,
265
+ attachNum: this.attachNum,
266
+ longFilename: this.longFilename,
267
+ pathname: this.pathname,
268
+ renderingPosition: this.renderingPosition,
269
+ longPathname: this.longPathname,
270
+ mimeTag: this.mimeTag,
271
+ mimeSequence: this.mimeSequence,
272
+ contentId: this.contentId,
273
+ isAttachmentInvisibleInHtml: this.isAttachmentInvisibleInHtml,
274
+ isAttachmentInvisibleInRTF: this.isAttachmentInvisibleInRTF,
275
+ }, this);
276
+ return clone;
277
+ }
278
+ }
279
+ exports.PSTAttachment = PSTAttachment;
280
+ PSTAttachment.ATTACHMENT_METHOD_NONE = 0;
281
+ PSTAttachment.ATTACHMENT_METHOD_BY_VALUE = 1;
282
+ PSTAttachment.ATTACHMENT_METHOD_BY_REFERENCE = 2;
283
+ PSTAttachment.ATTACHMENT_METHOD_BY_REFERENCE_RESOLVE = 3;
284
+ PSTAttachment.ATTACHMENT_METHOD_BY_REFERENCE_ONLY = 4;
285
+ PSTAttachment.ATTACHMENT_METHOD_EMBEDDED = 5;
286
+ PSTAttachment.ATTACHMENT_METHOD_OLE = 6;