pst-extractor 1.9.0 → 1.10.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.
Files changed (59) hide show
  1. package/dist/ColumnDescriptor.class.d.ts +26 -26
  2. package/dist/ColumnDescriptor.class.js +51 -51
  3. package/dist/DescriptorIndexNode.class.d.ts +25 -26
  4. package/dist/DescriptorIndexNode.class.js +53 -53
  5. package/dist/LZFu.class.d.ts +11 -12
  6. package/dist/LZFu.class.js +95 -95
  7. package/dist/NodeInfo.class.d.ts +33 -33
  8. package/dist/NodeInfo.class.js +52 -52
  9. package/dist/NodeMap.class.d.ts +35 -35
  10. package/dist/NodeMap.class.js +86 -86
  11. package/dist/OffsetIndexItem.class.d.ts +23 -24
  12. package/dist/OffsetIndexItem.class.js +45 -45
  13. package/dist/OutlookProperties.d.ts +275 -275
  14. package/dist/OutlookProperties.js +281 -281
  15. package/dist/PSTActivity.class.d.ts +103 -103
  16. package/dist/PSTActivity.class.js +144 -144
  17. package/dist/PSTAppointment.class.d.ts +270 -271
  18. package/dist/PSTAppointment.class.js +376 -376
  19. package/dist/PSTAttachment.class.d.ts +172 -172
  20. package/dist/PSTAttachment.class.js +317 -317
  21. package/dist/PSTContact.class.d.ts +884 -884
  22. package/dist/PSTContact.class.js +1227 -1227
  23. package/dist/PSTDescriptorItem.class.d.ts +45 -46
  24. package/dist/PSTDescriptorItem.class.js +99 -99
  25. package/dist/PSTFile.class.d.ts +215 -216
  26. package/dist/PSTFile.class.js +818 -818
  27. package/dist/PSTFolder.class.d.ts +129 -129
  28. package/dist/PSTFolder.class.js +318 -310
  29. package/dist/PSTMessage.class.d.ts +788 -789
  30. package/dist/PSTMessage.class.js +1321 -1321
  31. package/dist/PSTMessageStore.class.d.ts +13 -13
  32. package/dist/PSTMessageStore.class.js +17 -17
  33. package/dist/PSTNodeInputStream.class.d.ts +122 -123
  34. package/dist/PSTNodeInputStream.class.js +514 -514
  35. package/dist/PSTObject.class.d.ts +133 -134
  36. package/dist/PSTObject.class.js +326 -326
  37. package/dist/PSTRecipient.class.d.ts +65 -65
  38. package/dist/PSTRecipient.class.js +103 -103
  39. package/dist/PSTTable.class.d.ts +52 -52
  40. package/dist/PSTTable.class.js +175 -175
  41. package/dist/PSTTable7C.class.d.ts +45 -45
  42. package/dist/PSTTable7C.class.js +281 -281
  43. package/dist/PSTTableBC.class.d.ts +31 -31
  44. package/dist/PSTTableBC.class.js +111 -111
  45. package/dist/PSTTableItem.class.d.ts +47 -48
  46. package/dist/PSTTableItem.class.js +124 -124
  47. package/dist/PSTTask.class.d.ts +146 -146
  48. package/dist/PSTTask.class.js +205 -205
  49. package/dist/PSTUtil.class.d.ts +134 -135
  50. package/dist/PSTUtil.class.js +795 -795
  51. package/dist/RecurrencePattern.class.d.ts +49 -50
  52. package/dist/RecurrencePattern.class.js +120 -120
  53. package/dist/index.d.ts +6 -6
  54. package/dist/index.js +15 -15
  55. package/example/package.json +6 -6
  56. package/example/yarn.lock +95 -44
  57. package/junit.xml +68 -68
  58. package/package.json +26 -26
  59. package/readme.md +1 -3
@@ -1,281 +1,281 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PSTTable7C = void 0;
7
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
- /* eslint-disable @typescript-eslint/camelcase */
9
- /* eslint-disable @typescript-eslint/no-unused-vars */
10
- const long_1 = __importDefault(require("long"));
11
- const PSTFile_class_1 = require("./PSTFile.class");
12
- const PSTTable_class_1 = require("./PSTTable.class");
13
- const PSTTableItem_class_1 = require("./PSTTableItem.class");
14
- const ColumnDescriptor_class_1 = require("./ColumnDescriptor.class");
15
- class PSTTable7C extends PSTTable_class_1.PSTTable {
16
- /**
17
- * Creates an instance of PSTTable7C ("Table Context").
18
- * @param {PSTNodeInputStream} pstNodeInputStream
19
- * @param {Map<number, PSTDescriptorItem>} subNodeDescriptorItems
20
- * @param {number} [entityToExtract]
21
- * @memberof PSTTable7C
22
- */
23
- constructor(pstNodeInputStream, subNodeDescriptorItems, entityToExtract) {
24
- super(pstNodeInputStream, subNodeDescriptorItems);
25
- this.items = [];
26
- this.numberOfDataSets = 0;
27
- this.BLOCK_SIZE = 8176;
28
- this.numColumns = 0;
29
- this.TCI_bm = 0;
30
- this.TCI_1b = 0;
31
- this.columnDescriptors = [];
32
- this.overrideCol = -1;
33
- if (this.tableTypeByte != 0x7c) {
34
- throw new Error('PSTTable7C::constructor unable to create PSTTable7C, table does not appear to be a 7c!');
35
- }
36
- // TCINFO header is in the hidUserRoot node
37
- const tcHeaderNode = this.getNodeInfo(this.hidUserRoot);
38
- if (!tcHeaderNode) {
39
- throw new Error('PSTTable7C::constructor tcHeaderNode is null');
40
- }
41
- // get the TCINFO header information
42
- let offset = 0;
43
- this.numColumns = tcHeaderNode
44
- .seekAndReadLong(long_1.default.fromNumber(offset + 1), 1)
45
- .toNumber();
46
- const TCI_4b = tcHeaderNode
47
- .seekAndReadLong(long_1.default.fromNumber(offset + 2), 2)
48
- .toNumber();
49
- const TCI_2b = tcHeaderNode
50
- .seekAndReadLong(long_1.default.fromNumber(offset + 4), 2)
51
- .toNumber();
52
- this.TCI_1b = tcHeaderNode
53
- .seekAndReadLong(long_1.default.fromNumber(offset + 6), 2)
54
- .toNumber();
55
- this.TCI_bm = tcHeaderNode
56
- .seekAndReadLong(long_1.default.fromNumber(offset + 8), 2)
57
- .toNumber();
58
- const hidRowIndex = tcHeaderNode
59
- .seekAndReadLong(long_1.default.fromNumber(offset + 10), 4)
60
- .toNumber();
61
- const hnidRows = tcHeaderNode
62
- .seekAndReadLong(long_1.default.fromNumber(offset + 14), 4)
63
- .toNumber();
64
- // 22... column descriptors
65
- offset += 22;
66
- if (this.numColumns != 0) {
67
- for (let col = 0; col < this.numColumns; ++col) {
68
- this.columnDescriptors[col] = new ColumnDescriptor_class_1.ColumnDescriptor(tcHeaderNode, offset);
69
- if (this.columnDescriptors[col].id === entityToExtract) {
70
- this.overrideCol = col;
71
- }
72
- offset += 8;
73
- }
74
- }
75
- // if we are asking for a specific column, only get that!
76
- if (this.overrideCol > -1) {
77
- this.numColumns = this.overrideCol + 1;
78
- }
79
- // Read the key table
80
- this.keyMap = new Map();
81
- const keyTableInfo = this.getNodeInfo(this.hidRoot);
82
- if (!keyTableInfo) {
83
- throw new Error('PSTTable7C::constructor keyTableInfo is null');
84
- }
85
- this.numberOfKeys = Math.trunc(keyTableInfo.length() / (this.sizeOfItemKey + this.sizeOfItemValue));
86
- offset = 0;
87
- for (let x = 0; x < this.numberOfKeys; x++) {
88
- const context = keyTableInfo
89
- .seekAndReadLong(long_1.default.fromNumber(offset), this.sizeOfItemKey)
90
- .toNumber();
91
- offset += this.sizeOfItemKey;
92
- const rowIndex = keyTableInfo
93
- .seekAndReadLong(long_1.default.fromNumber(offset), this.sizeOfItemValue)
94
- .toNumber();
95
- offset += this.sizeOfItemValue;
96
- this.keyMap.set(context, rowIndex);
97
- }
98
- // Read the Row Matrix
99
- const rowNodeInfo = this.getNodeInfo(hnidRows);
100
- if (!rowNodeInfo) {
101
- throw new Error('PSTTable7C::constructor rowNodeInfo is null');
102
- }
103
- this.rowNodeInfo = rowNodeInfo;
104
- const numberOfBlocks = Math.trunc(this.rowNodeInfo.length() / this.BLOCK_SIZE);
105
- const numberOfRowsPerBlock = Math.trunc(this.BLOCK_SIZE / this.TCI_bm);
106
- const blockPadding = this.BLOCK_SIZE - numberOfRowsPerBlock * this.TCI_bm;
107
- this.numberOfDataSets = Math.trunc(numberOfBlocks * numberOfRowsPerBlock +
108
- (this.rowNodeInfo.length() % this.BLOCK_SIZE) / this.TCI_bm);
109
- }
110
- /**
111
- * Get items from the table.
112
- * @param {number} [startAtRecord]
113
- * @param {number} [numberOfRecordsToReturn]
114
- * @returns {Map<number, PSTTableItem>[]}
115
- * @memberof PSTTable7C
116
- */
117
- getItems(startAtRecord, numberOfRecordsToReturn) {
118
- const itemList = [];
119
- let setLocalList = false;
120
- // okay, work out the number of records we have
121
- const numberOfBlocks = Math.trunc(this.rowNodeInfo.length() / this.BLOCK_SIZE);
122
- const numberOfRowsPerBlock = Math.trunc(this.BLOCK_SIZE / this.TCI_bm);
123
- const blockPadding = this.BLOCK_SIZE - numberOfRowsPerBlock * this.TCI_bm;
124
- this.numberOfDataSets = Math.trunc(numberOfBlocks * numberOfRowsPerBlock +
125
- (this.rowNodeInfo.length() % this.BLOCK_SIZE) / this.TCI_bm);
126
- if (startAtRecord === undefined) {
127
- numberOfRecordsToReturn = this.numberOfDataSets;
128
- startAtRecord = 0;
129
- setLocalList = true;
130
- }
131
- if (numberOfRecordsToReturn === undefined) {
132
- numberOfRecordsToReturn = 0;
133
- }
134
- // repeat the reading process for every dataset
135
- let currentValueArrayStart = Math.trunc(startAtRecord / numberOfRowsPerBlock) * this.BLOCK_SIZE +
136
- (startAtRecord % numberOfRowsPerBlock) * this.TCI_bm;
137
- if (numberOfRecordsToReturn > this.rowCount - startAtRecord) {
138
- numberOfRecordsToReturn = this.rowCount - startAtRecord;
139
- }
140
- let dataSetNumber = 0;
141
- for (let rowCounter = 0; rowCounter < numberOfRecordsToReturn; rowCounter++) {
142
- const currentItem = new Map();
143
- // add on some padding for block boundries?
144
- if (this.rowNodeInfo.pstNodeInputStream.pstFile.pstFileType ==
145
- PSTFile_class_1.PSTFile.PST_TYPE_ANSI) {
146
- if (currentValueArrayStart >= this.BLOCK_SIZE) {
147
- currentValueArrayStart =
148
- currentValueArrayStart +
149
- 4 * (currentValueArrayStart / this.BLOCK_SIZE);
150
- }
151
- if (this.rowNodeInfo.startOffset + currentValueArrayStart + this.TCI_1b >
152
- this.rowNodeInfo.pstNodeInputStream.length.toNumber()) {
153
- continue;
154
- }
155
- }
156
- else {
157
- if (currentValueArrayStart % this.BLOCK_SIZE >
158
- this.BLOCK_SIZE - this.TCI_bm) {
159
- // adjust!
160
- currentValueArrayStart += blockPadding;
161
- if (currentValueArrayStart + this.TCI_bm >
162
- this.rowNodeInfo.length()) {
163
- continue;
164
- }
165
- }
166
- }
167
- const bitmap = Buffer.alloc((this.numColumns + 7) / 8);
168
- this.rowNodeInfo.pstNodeInputStream.seek(long_1.default.fromNumber(this.rowNodeInfo.startOffset + currentValueArrayStart + this.TCI_1b));
169
- this.rowNodeInfo.pstNodeInputStream.readCompletely(bitmap);
170
- const id = this.rowNodeInfo.seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart), 4);
171
- // Put into the item map as PidTagLtpRowId (0x67F2)
172
- let item = new PSTTableItem_class_1.PSTTableItem();
173
- item.itemIndex = -1;
174
- item.entryValueType = 3;
175
- item.entryType = long_1.default.fromNumber(0x67f2);
176
- item.entryValueReference = id.toNumber();
177
- item.isExternalValueReference = true;
178
- currentItem.set(item.entryType.toNumber(), item);
179
- let col = 0;
180
- if (this.overrideCol > -1) {
181
- col = this.overrideCol - 1;
182
- }
183
- while (col < this.numColumns - 1) {
184
- col++;
185
- // Does this column exist for this row?
186
- const bitIndex = Math.trunc(this.columnDescriptors[col].iBit / 8);
187
- const bit = this.columnDescriptors[col].iBit % 8;
188
- if (bitIndex >= bitmap.length || (bitmap[bitIndex] & (1 << bit)) == 0) {
189
- // Column doesn't exist
190
- continue;
191
- }
192
- item = new PSTTableItem_class_1.PSTTableItem();
193
- item.itemIndex = col;
194
- item.entryValueType = this.columnDescriptors[col].type;
195
- item.entryType = long_1.default.fromNumber(this.columnDescriptors[col].id);
196
- item.entryValueReference = 0;
197
- switch (this.columnDescriptors[col].cbData) {
198
- case 1: // Single byte data
199
- item.entryValueReference =
200
- this.rowNodeInfo
201
- .seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 1)
202
- .toNumber() & 0xff;
203
- item.isExternalValueReference = true;
204
- break;
205
- case 2: // Two byte data
206
- item.entryValueReference =
207
- this.rowNodeInfo
208
- .seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 2)
209
- .toNumber() & 0xffff;
210
- item.isExternalValueReference = true;
211
- break;
212
- case 8: // 8 byte data
213
- item.data = Buffer.alloc(8);
214
- this.rowNodeInfo.pstNodeInputStream.seek(long_1.default.fromNumber(this.rowNodeInfo.startOffset +
215
- currentValueArrayStart +
216
- this.columnDescriptors[col].ibData));
217
- this.rowNodeInfo.pstNodeInputStream.readCompletely(item.data);
218
- break;
219
- default:
220
- // Four byte data
221
- item.entryValueReference = this.rowNodeInfo
222
- .seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 4)
223
- .toNumber();
224
- if (this.columnDescriptors[col].type == 0x0003 ||
225
- this.columnDescriptors[col].type == 0x0004 ||
226
- this.columnDescriptors[col].type == 0x000a) {
227
- // True 32bit data
228
- item.isExternalValueReference = true;
229
- break;
230
- }
231
- // Variable length data so it's an hnid
232
- if ((item.entryValueReference & 0x1f) != 0) {
233
- // Some kind of external reference...
234
- item.isExternalValueReference = true;
235
- break;
236
- }
237
- if (item.entryValueReference == 0) {
238
- item.data = Buffer.alloc(0);
239
- break;
240
- }
241
- else {
242
- const entryInfo = this.getNodeInfo(item.entryValueReference);
243
- if (entryInfo) {
244
- item.data = Buffer.alloc(entryInfo.length());
245
- entryInfo.pstNodeInputStream.seek(long_1.default.fromNumber(entryInfo.startOffset));
246
- entryInfo.pstNodeInputStream.readCompletely(item.data);
247
- }
248
- }
249
- break;
250
- }
251
- currentItem.set(item.entryType.toNumber(), item);
252
- }
253
- itemList[dataSetNumber] = currentItem;
254
- dataSetNumber++;
255
- currentValueArrayStart += this.TCI_bm;
256
- }
257
- // console.log('PSTTable7C::getItems number of items = ' + itemList.length);
258
- if (setLocalList) {
259
- this.items = itemList;
260
- }
261
- return itemList;
262
- }
263
- /**
264
- * Get the number of rows.
265
- * @readonly
266
- * @type {number}
267
- * @memberof PSTTable7C
268
- */
269
- get rowCount() {
270
- return this.numberOfDataSets;
271
- }
272
- /**
273
- * JSON stringify the object properties.
274
- * @returns {string}
275
- * @memberof PSTTable7C
276
- */
277
- toJSON() {
278
- return this;
279
- }
280
- }
281
- exports.PSTTable7C = PSTTable7C;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PSTTable7C = void 0;
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ /* eslint-disable @typescript-eslint/camelcase */
9
+ /* eslint-disable @typescript-eslint/no-unused-vars */
10
+ const long_1 = __importDefault(require("long"));
11
+ const PSTFile_class_1 = require("./PSTFile.class");
12
+ const PSTTable_class_1 = require("./PSTTable.class");
13
+ const PSTTableItem_class_1 = require("./PSTTableItem.class");
14
+ const ColumnDescriptor_class_1 = require("./ColumnDescriptor.class");
15
+ class PSTTable7C extends PSTTable_class_1.PSTTable {
16
+ /**
17
+ * Creates an instance of PSTTable7C ("Table Context").
18
+ * @param {PSTNodeInputStream} pstNodeInputStream
19
+ * @param {Map<number, PSTDescriptorItem>} subNodeDescriptorItems
20
+ * @param {number} [entityToExtract]
21
+ * @memberof PSTTable7C
22
+ */
23
+ constructor(pstNodeInputStream, subNodeDescriptorItems, entityToExtract) {
24
+ super(pstNodeInputStream, subNodeDescriptorItems);
25
+ this.items = [];
26
+ this.numberOfDataSets = 0;
27
+ this.BLOCK_SIZE = 8176;
28
+ this.numColumns = 0;
29
+ this.TCI_bm = 0;
30
+ this.TCI_1b = 0;
31
+ this.columnDescriptors = [];
32
+ this.overrideCol = -1;
33
+ if (this.tableTypeByte != 0x7c) {
34
+ throw new Error('PSTTable7C::constructor unable to create PSTTable7C, table does not appear to be a 7c!');
35
+ }
36
+ // TCINFO header is in the hidUserRoot node
37
+ const tcHeaderNode = this.getNodeInfo(this.hidUserRoot);
38
+ if (!tcHeaderNode) {
39
+ throw new Error('PSTTable7C::constructor tcHeaderNode is null');
40
+ }
41
+ // get the TCINFO header information
42
+ let offset = 0;
43
+ this.numColumns = tcHeaderNode
44
+ .seekAndReadLong(long_1.default.fromNumber(offset + 1), 1)
45
+ .toNumber();
46
+ const TCI_4b = tcHeaderNode
47
+ .seekAndReadLong(long_1.default.fromNumber(offset + 2), 2)
48
+ .toNumber();
49
+ const TCI_2b = tcHeaderNode
50
+ .seekAndReadLong(long_1.default.fromNumber(offset + 4), 2)
51
+ .toNumber();
52
+ this.TCI_1b = tcHeaderNode
53
+ .seekAndReadLong(long_1.default.fromNumber(offset + 6), 2)
54
+ .toNumber();
55
+ this.TCI_bm = tcHeaderNode
56
+ .seekAndReadLong(long_1.default.fromNumber(offset + 8), 2)
57
+ .toNumber();
58
+ const hidRowIndex = tcHeaderNode
59
+ .seekAndReadLong(long_1.default.fromNumber(offset + 10), 4)
60
+ .toNumber();
61
+ const hnidRows = tcHeaderNode
62
+ .seekAndReadLong(long_1.default.fromNumber(offset + 14), 4)
63
+ .toNumber();
64
+ // 22... column descriptors
65
+ offset += 22;
66
+ if (this.numColumns != 0) {
67
+ for (let col = 0; col < this.numColumns; ++col) {
68
+ this.columnDescriptors[col] = new ColumnDescriptor_class_1.ColumnDescriptor(tcHeaderNode, offset);
69
+ if (this.columnDescriptors[col].id === entityToExtract) {
70
+ this.overrideCol = col;
71
+ }
72
+ offset += 8;
73
+ }
74
+ }
75
+ // if we are asking for a specific column, only get that!
76
+ if (this.overrideCol > -1) {
77
+ this.numColumns = this.overrideCol + 1;
78
+ }
79
+ // Read the key table
80
+ this.keyMap = new Map();
81
+ const keyTableInfo = this.getNodeInfo(this.hidRoot);
82
+ if (!keyTableInfo) {
83
+ throw new Error('PSTTable7C::constructor keyTableInfo is null');
84
+ }
85
+ this.numberOfKeys = Math.trunc(keyTableInfo.length() / (this.sizeOfItemKey + this.sizeOfItemValue));
86
+ offset = 0;
87
+ for (let x = 0; x < this.numberOfKeys; x++) {
88
+ const context = keyTableInfo
89
+ .seekAndReadLong(long_1.default.fromNumber(offset), this.sizeOfItemKey)
90
+ .toNumber();
91
+ offset += this.sizeOfItemKey;
92
+ const rowIndex = keyTableInfo
93
+ .seekAndReadLong(long_1.default.fromNumber(offset), this.sizeOfItemValue)
94
+ .toNumber();
95
+ offset += this.sizeOfItemValue;
96
+ this.keyMap.set(context, rowIndex);
97
+ }
98
+ // Read the Row Matrix
99
+ const rowNodeInfo = this.getNodeInfo(hnidRows);
100
+ if (!rowNodeInfo) {
101
+ throw new Error('PSTTable7C::constructor rowNodeInfo is null');
102
+ }
103
+ this.rowNodeInfo = rowNodeInfo;
104
+ const numberOfBlocks = Math.trunc(this.rowNodeInfo.length() / this.BLOCK_SIZE);
105
+ const numberOfRowsPerBlock = Math.trunc(this.BLOCK_SIZE / this.TCI_bm);
106
+ const blockPadding = this.BLOCK_SIZE - numberOfRowsPerBlock * this.TCI_bm;
107
+ this.numberOfDataSets = Math.trunc(numberOfBlocks * numberOfRowsPerBlock +
108
+ (this.rowNodeInfo.length() % this.BLOCK_SIZE) / this.TCI_bm);
109
+ }
110
+ /**
111
+ * Get items from the table.
112
+ * @param {number} [startAtRecord]
113
+ * @param {number} [numberOfRecordsToReturn]
114
+ * @returns {Map<number, PSTTableItem>[]}
115
+ * @memberof PSTTable7C
116
+ */
117
+ getItems(startAtRecord, numberOfRecordsToReturn) {
118
+ const itemList = [];
119
+ let setLocalList = false;
120
+ // okay, work out the number of records we have
121
+ const numberOfBlocks = Math.trunc(this.rowNodeInfo.length() / this.BLOCK_SIZE);
122
+ const numberOfRowsPerBlock = Math.trunc(this.BLOCK_SIZE / this.TCI_bm);
123
+ const blockPadding = this.BLOCK_SIZE - numberOfRowsPerBlock * this.TCI_bm;
124
+ this.numberOfDataSets = Math.trunc(numberOfBlocks * numberOfRowsPerBlock +
125
+ (this.rowNodeInfo.length() % this.BLOCK_SIZE) / this.TCI_bm);
126
+ if (startAtRecord === undefined) {
127
+ numberOfRecordsToReturn = this.numberOfDataSets;
128
+ startAtRecord = 0;
129
+ setLocalList = true;
130
+ }
131
+ if (numberOfRecordsToReturn === undefined) {
132
+ numberOfRecordsToReturn = 0;
133
+ }
134
+ // repeat the reading process for every dataset
135
+ let currentValueArrayStart = Math.trunc(startAtRecord / numberOfRowsPerBlock) * this.BLOCK_SIZE +
136
+ (startAtRecord % numberOfRowsPerBlock) * this.TCI_bm;
137
+ if (numberOfRecordsToReturn > this.rowCount - startAtRecord) {
138
+ numberOfRecordsToReturn = this.rowCount - startAtRecord;
139
+ }
140
+ let dataSetNumber = 0;
141
+ for (let rowCounter = 0; rowCounter < numberOfRecordsToReturn; rowCounter++) {
142
+ const currentItem = new Map();
143
+ // add on some padding for block boundries?
144
+ if (this.rowNodeInfo.pstNodeInputStream.pstFile.pstFileType ==
145
+ PSTFile_class_1.PSTFile.PST_TYPE_ANSI) {
146
+ if (currentValueArrayStart >= this.BLOCK_SIZE) {
147
+ currentValueArrayStart =
148
+ currentValueArrayStart +
149
+ 4 * (currentValueArrayStart / this.BLOCK_SIZE);
150
+ }
151
+ if (this.rowNodeInfo.startOffset + currentValueArrayStart + this.TCI_1b >
152
+ this.rowNodeInfo.pstNodeInputStream.length.toNumber()) {
153
+ continue;
154
+ }
155
+ }
156
+ else {
157
+ if (currentValueArrayStart % this.BLOCK_SIZE >
158
+ this.BLOCK_SIZE - this.TCI_bm) {
159
+ // adjust!
160
+ currentValueArrayStart += blockPadding;
161
+ if (currentValueArrayStart + this.TCI_bm >
162
+ this.rowNodeInfo.length()) {
163
+ continue;
164
+ }
165
+ }
166
+ }
167
+ const bitmap = Buffer.alloc((this.numColumns + 7) / 8);
168
+ this.rowNodeInfo.pstNodeInputStream.seek(long_1.default.fromNumber(this.rowNodeInfo.startOffset + currentValueArrayStart + this.TCI_1b));
169
+ this.rowNodeInfo.pstNodeInputStream.readCompletely(bitmap);
170
+ const id = this.rowNodeInfo.seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart), 4);
171
+ // Put into the item map as PidTagLtpRowId (0x67F2)
172
+ let item = new PSTTableItem_class_1.PSTTableItem();
173
+ item.itemIndex = -1;
174
+ item.entryValueType = 3;
175
+ item.entryType = long_1.default.fromNumber(0x67f2);
176
+ item.entryValueReference = id.toNumber();
177
+ item.isExternalValueReference = true;
178
+ currentItem.set(item.entryType.toNumber(), item);
179
+ let col = 0;
180
+ if (this.overrideCol > -1) {
181
+ col = this.overrideCol - 1;
182
+ }
183
+ while (col < this.numColumns - 1) {
184
+ col++;
185
+ // Does this column exist for this row?
186
+ const bitIndex = Math.trunc(this.columnDescriptors[col].iBit / 8);
187
+ const bit = this.columnDescriptors[col].iBit % 8;
188
+ if (bitIndex >= bitmap.length || (bitmap[bitIndex] & (1 << bit)) == 0) {
189
+ // Column doesn't exist
190
+ continue;
191
+ }
192
+ item = new PSTTableItem_class_1.PSTTableItem();
193
+ item.itemIndex = col;
194
+ item.entryValueType = this.columnDescriptors[col].type;
195
+ item.entryType = long_1.default.fromNumber(this.columnDescriptors[col].id);
196
+ item.entryValueReference = 0;
197
+ switch (this.columnDescriptors[col].cbData) {
198
+ case 1: // Single byte data
199
+ item.entryValueReference =
200
+ this.rowNodeInfo
201
+ .seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 1)
202
+ .toNumber() & 0xff;
203
+ item.isExternalValueReference = true;
204
+ break;
205
+ case 2: // Two byte data
206
+ item.entryValueReference =
207
+ this.rowNodeInfo
208
+ .seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 2)
209
+ .toNumber() & 0xffff;
210
+ item.isExternalValueReference = true;
211
+ break;
212
+ case 8: // 8 byte data
213
+ item.data = Buffer.alloc(8);
214
+ this.rowNodeInfo.pstNodeInputStream.seek(long_1.default.fromNumber(this.rowNodeInfo.startOffset +
215
+ currentValueArrayStart +
216
+ this.columnDescriptors[col].ibData));
217
+ this.rowNodeInfo.pstNodeInputStream.readCompletely(item.data);
218
+ break;
219
+ default:
220
+ // Four byte data
221
+ item.entryValueReference = this.rowNodeInfo
222
+ .seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 4)
223
+ .toNumber();
224
+ if (this.columnDescriptors[col].type == 0x0003 ||
225
+ this.columnDescriptors[col].type == 0x0004 ||
226
+ this.columnDescriptors[col].type == 0x000a) {
227
+ // True 32bit data
228
+ item.isExternalValueReference = true;
229
+ break;
230
+ }
231
+ // Variable length data so it's an hnid
232
+ if ((item.entryValueReference & 0x1f) != 0) {
233
+ // Some kind of external reference...
234
+ item.isExternalValueReference = true;
235
+ break;
236
+ }
237
+ if (item.entryValueReference == 0) {
238
+ item.data = Buffer.alloc(0);
239
+ break;
240
+ }
241
+ else {
242
+ const entryInfo = this.getNodeInfo(item.entryValueReference);
243
+ if (entryInfo) {
244
+ item.data = Buffer.alloc(entryInfo.length());
245
+ entryInfo.pstNodeInputStream.seek(long_1.default.fromNumber(entryInfo.startOffset));
246
+ entryInfo.pstNodeInputStream.readCompletely(item.data);
247
+ }
248
+ }
249
+ break;
250
+ }
251
+ currentItem.set(item.entryType.toNumber(), item);
252
+ }
253
+ itemList[dataSetNumber] = currentItem;
254
+ dataSetNumber++;
255
+ currentValueArrayStart += this.TCI_bm;
256
+ }
257
+ // console.log('PSTTable7C::getItems number of items = ' + itemList.length);
258
+ if (setLocalList) {
259
+ this.items = itemList;
260
+ }
261
+ return itemList;
262
+ }
263
+ /**
264
+ * Get the number of rows.
265
+ * @readonly
266
+ * @type {number}
267
+ * @memberof PSTTable7C
268
+ */
269
+ get rowCount() {
270
+ return this.numberOfDataSets;
271
+ }
272
+ /**
273
+ * JSON stringify the object properties.
274
+ * @returns {string}
275
+ * @memberof PSTTable7C
276
+ */
277
+ toJSON() {
278
+ return this;
279
+ }
280
+ }
281
+ exports.PSTTable7C = PSTTable7C;
@@ -1,31 +1,31 @@
1
- import { PSTNodeInputStream } from './PSTNodeInputStream.class';
2
- import { PSTTable } from './PSTTable.class';
3
- import { PSTTableItem } from './PSTTableItem.class';
4
- export declare class PSTTableBC extends PSTTable {
5
- private items;
6
- private isDescNotYetInitiated;
7
- /**
8
- * Creates an instance of PSTTableBC ("Property Context").
9
- * @param {PSTNodeInputStream} pstNodeInputStream
10
- * @memberof PSTTableBC
11
- */
12
- constructor(pstNodeInputStream: PSTNodeInputStream);
13
- /**
14
- * Get the items parsed out of this table.
15
- * @returns {Map<number, PSTTableItem>}
16
- * @memberof PSTTableBC
17
- */
18
- getItems(): Map<number, PSTTableItem>;
19
- /**
20
- * JSON stringify the items list.
21
- * @returns {string}
22
- * @memberof PSTTable7C
23
- */
24
- itemsJSON(): string;
25
- /**
26
- * JSON stringify the object properties.
27
- * @returns {string}
28
- * @memberof PSTTable7C
29
- */
30
- toJSON(): any;
31
- }
1
+ import { PSTNodeInputStream } from './PSTNodeInputStream.class';
2
+ import { PSTTable } from './PSTTable.class';
3
+ import { PSTTableItem } from './PSTTableItem.class';
4
+ export declare class PSTTableBC extends PSTTable {
5
+ private items;
6
+ private isDescNotYetInitiated;
7
+ /**
8
+ * Creates an instance of PSTTableBC ("Property Context").
9
+ * @param {PSTNodeInputStream} pstNodeInputStream
10
+ * @memberof PSTTableBC
11
+ */
12
+ constructor(pstNodeInputStream: PSTNodeInputStream);
13
+ /**
14
+ * Get the items parsed out of this table.
15
+ * @returns {Map<number, PSTTableItem>}
16
+ * @memberof PSTTableBC
17
+ */
18
+ getItems(): Map<number, PSTTableItem>;
19
+ /**
20
+ * JSON stringify the items list.
21
+ * @returns {string}
22
+ * @memberof PSTTable7C
23
+ */
24
+ itemsJSON(): string;
25
+ /**
26
+ * JSON stringify the object properties.
27
+ * @returns {string}
28
+ * @memberof PSTTable7C
29
+ */
30
+ toJSON(): any;
31
+ }