@socialgouv/archimail-pst-extractor
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -0,1 +1,2 @@ | ||
export { stringify as emlStringify, EmlStringifyOptions } from "./eml/builder"; | ||
export { PSTActivity } from "./PSTActivity"; | ||
@@ -2,0 +3,0 @@ export { PSTAppointment } from "./PSTAppointment"; |
@@ -26,3 +26,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PSTUtil = exports.PSTTask = exports.PSTRecipient = exports.PSTObject = exports.PSTMessage = exports.PSTFolder = exports.PSTFile = exports.PSTContact = exports.PSTAttachment = exports.PSTAppointment = exports.PSTActivity = void 0; | ||
exports.PSTUtil = exports.PSTTask = exports.PSTRecipient = exports.PSTObject = exports.PSTMessage = exports.PSTFolder = exports.PSTFile = exports.PSTContact = exports.PSTAttachment = exports.PSTAppointment = exports.PSTActivity = exports.emlStringify = void 0; | ||
var builder_1 = require("./eml/builder"); | ||
Object.defineProperty(exports, "emlStringify", { enumerable: true, get: function () { return builder_1.stringify; } }); | ||
var PSTActivity_1 = require("./PSTActivity"); | ||
@@ -29,0 +31,0 @@ Object.defineProperty(exports, "PSTActivity", { enumerable: true, get: function () { return PSTActivity_1.PSTActivity; } }); |
@@ -28,5 +28,7 @@ export declare enum OutlookProperties { | ||
PR_SENT_REPRESENTING_EMAIL_ADDRESS = 101, | ||
PR_SENT_REPRESENTING_SMTP_ADDRESS = 23810, | ||
PR_CONVERSATION_TOPIC = 112, | ||
PR_RECEIVED_BY_ADDRTYPE = 117, | ||
PR_RECEIVED_BY_EMAIL_ADDRESS = 118, | ||
PR_RECEIVED_BY_SMTP_ADDRESS = 23815, | ||
PR_TRANSPORT_MESSAGE_HEADERS = 125, | ||
@@ -53,2 +55,3 @@ PR_MESSAGE_FLAGS = 3591, | ||
PR_RCVD_REPRESENTING_EMAIL_ADDRESS = 120, | ||
PR_RCVD_REPRESENTING_SMTP_ADDRESS = 23816, | ||
PR_REPLY_REQUESTED = 3095, | ||
@@ -55,0 +58,0 @@ PR_SENDER_ENTRYID = 3097, |
@@ -34,5 +34,7 @@ "use strict"; | ||
OutlookProperties[OutlookProperties["PR_SENT_REPRESENTING_EMAIL_ADDRESS"] = 101] = "PR_SENT_REPRESENTING_EMAIL_ADDRESS"; | ||
OutlookProperties[OutlookProperties["PR_SENT_REPRESENTING_SMTP_ADDRESS"] = 23810] = "PR_SENT_REPRESENTING_SMTP_ADDRESS"; | ||
OutlookProperties[OutlookProperties["PR_CONVERSATION_TOPIC"] = 112] = "PR_CONVERSATION_TOPIC"; | ||
OutlookProperties[OutlookProperties["PR_RECEIVED_BY_ADDRTYPE"] = 117] = "PR_RECEIVED_BY_ADDRTYPE"; | ||
OutlookProperties[OutlookProperties["PR_RECEIVED_BY_EMAIL_ADDRESS"] = 118] = "PR_RECEIVED_BY_EMAIL_ADDRESS"; | ||
OutlookProperties[OutlookProperties["PR_RECEIVED_BY_SMTP_ADDRESS"] = 23815] = "PR_RECEIVED_BY_SMTP_ADDRESS"; | ||
OutlookProperties[OutlookProperties["PR_TRANSPORT_MESSAGE_HEADERS"] = 125] = "PR_TRANSPORT_MESSAGE_HEADERS"; | ||
@@ -59,2 +61,3 @@ OutlookProperties[OutlookProperties["PR_MESSAGE_FLAGS"] = 3591] = "PR_MESSAGE_FLAGS"; | ||
OutlookProperties[OutlookProperties["PR_RCVD_REPRESENTING_EMAIL_ADDRESS"] = 120] = "PR_RCVD_REPRESENTING_EMAIL_ADDRESS"; | ||
OutlookProperties[OutlookProperties["PR_RCVD_REPRESENTING_SMTP_ADDRESS"] = 23816] = "PR_RCVD_REPRESENTING_SMTP_ADDRESS"; | ||
OutlookProperties[OutlookProperties["PR_REPLY_REQUESTED"] = 3095] = "PR_REPLY_REQUESTED"; | ||
@@ -61,0 +64,0 @@ OutlookProperties[OutlookProperties["PR_SENDER_ENTRYID"] = 3097] = "PR_SENDER_ENTRYID"; |
/// <reference types="node" /> | ||
import long from "long"; | ||
import type { DescriptorIndexNode } from "./DescriptorIndexNode"; | ||
import type { EmlStringifyOptions } from "./eml/builder"; | ||
import { PSTAttachment } from "./PSTAttachment"; | ||
@@ -42,2 +43,4 @@ import type { PSTDescriptorItem } from "./PSTDescriptorItem"; | ||
toJSON(): unknown; | ||
toEML(options?: EmlStringifyOptions): string; | ||
getRecipientsFromDisplay(display: "bcc" | "cc" | "to"): PSTRecipient[]; | ||
/** | ||
@@ -204,2 +207,7 @@ * The message is marked as having been read. | ||
/** | ||
* Contains the Simple Mail Transport Protocol (SMTP) email address for the messaging user who is represented by the sender. | ||
* https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagsentrepresentingsmtpaddress-canonical-property | ||
*/ | ||
get sentRepresentingSmtpAddress(): string; | ||
/** | ||
* Contains the topic of the first message in a conversation thread. | ||
@@ -220,2 +228,6 @@ * https://technet.microsoft.com/en-us/windows/cc839841 | ||
/** | ||
* Contains the SMTP address for the messaging user who receives the message. | ||
*/ | ||
get receivedBySmtpAddress(): string; | ||
/** | ||
* Contains transport-specific message envelope information. | ||
@@ -325,2 +337,6 @@ * https://technet.microsoft.com/en-us/library/cc815628 | ||
/** | ||
* Received representing SMTP address. | ||
*/ | ||
get rcvdRepresentingSmtpAddress(): string; | ||
/** | ||
* Contains TRUE if a message sender requests a reply from a recipient. | ||
@@ -327,0 +343,0 @@ * https://msdn.microsoft.com/en-us/library/office/cc815286.aspx |
@@ -9,2 +9,3 @@ "use strict"; | ||
const _1 = require("."); | ||
const builder_1 = require("./eml/builder"); | ||
const LZFu_1 = require("./LZFu"); | ||
@@ -211,2 +212,49 @@ const OutlookProperties_1 = require("./OutlookProperties"); | ||
} | ||
toEML(options) { | ||
var _a; | ||
const attachments = []; | ||
for (let i = 0; i < this.numberOfAttachments; i++) { | ||
const att = this.getAttachment(i); | ||
const data = Buffer.allocUnsafe(8176); | ||
(_a = att.fileInputStream) === null || _a === void 0 ? void 0 : _a.readCompletely(data); | ||
attachments.push({ | ||
cid: att.contentId, | ||
contentType: att.mimeTag, | ||
data, | ||
filename: att.longFilename, | ||
inline: att.renderingPosition > -1, | ||
name: att.displayName, | ||
}); | ||
} | ||
return (0, builder_1.stringify)({ | ||
attachments, | ||
cc: this.getRecipientsFromDisplay("cc").map((recipient) => ({ | ||
email: (recipient.smtpAddress || recipient.emailAddress).toLowerCase(), | ||
name: recipient.recipientDisplayName, | ||
})), | ||
from: { | ||
email: (this.senderSmtpEmailAddress || this.senderEmailAddress).toLowerCase(), | ||
name: this.senderName, | ||
}, | ||
html: this.bodyHTML, | ||
subject: this.subject, | ||
text: this.body, | ||
to: this.getRecipientsFromDisplay("to").map((recipient) => ({ | ||
email: (recipient.smtpAddress || recipient.emailAddress).toLowerCase(), | ||
name: recipient.recipientDisplayName, | ||
})), | ||
}, options); | ||
} | ||
getRecipientsFromDisplay(display) { | ||
return (display === "cc" | ||
? this.displayCC | ||
: display === "bcc" | ||
? this.displayBCC | ||
: this.displayTo) | ||
.split(";") | ||
.map((name) => name.trim()) | ||
.filter(Boolean) | ||
.map((name) => this.getRecipients().find((recipient) => recipient.displayName === name)) | ||
.filter(Boolean); | ||
} | ||
/** | ||
@@ -551,2 +599,9 @@ * The message is marked as having been read. | ||
/** | ||
* Contains the Simple Mail Transport Protocol (SMTP) email address for the messaging user who is represented by the sender. | ||
* https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagsentrepresentingsmtpaddress-canonical-property | ||
*/ | ||
get sentRepresentingSmtpAddress() { | ||
return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_SENT_REPRESENTING_SMTP_ADDRESS); | ||
} | ||
/** | ||
* Contains the topic of the first message in a conversation thread. | ||
@@ -573,2 +628,8 @@ * https://technet.microsoft.com/en-us/windows/cc839841 | ||
/** | ||
* Contains the SMTP address for the messaging user who receives the message. | ||
*/ | ||
get receivedBySmtpAddress() { | ||
return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_RECEIVED_BY_SMTP_ADDRESS); | ||
} | ||
/** | ||
* Contains transport-specific message envelope information. | ||
@@ -720,2 +781,8 @@ * https://technet.microsoft.com/en-us/library/cc815628 | ||
/** | ||
* Received representing SMTP address. | ||
*/ | ||
get rcvdRepresentingSmtpAddress() { | ||
return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_RCVD_REPRESENTING_SMTP_ADDRESS); | ||
} | ||
/** | ||
* Contains TRUE if a message sender requests a reply from a recipient. | ||
@@ -722,0 +789,0 @@ * https://msdn.microsoft.com/en-us/library/office/cc815286.aspx |
@@ -53,3 +53,3 @@ /// <reference types="node" /> | ||
*/ | ||
export declare const createJavascriptString: (data: Buffer, stringType: number, _codepage?: string) => string; | ||
export declare const createJavascriptString: (data: Buffer, stringType: number, codepage?: string) => string; | ||
/** | ||
@@ -56,0 +56,0 @@ * Copy from one array to another |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.createAppropriatePSTMessageObject = exports.detectAndLoadPSTObject = exports.filetimeToDate = exports.decode = exports.isAlphaNumeric = exports.arraycopy = exports.createJavascriptString = exports.getInternetCodePageCharset = exports.convertBigEndianBytesToLong = exports.convertLittleEndianBytesToLong = exports.NID_TYPE_LTP = exports.NID_TYPE_SEARCH_TABLE_INDEX = exports.NID_TYPE_RECIPIENT_TABLE = exports.NID_TYPE_ATTACHMENT_TABLE = exports.NID_TYPE_SEARCH_CONTENTS_TABLE = exports.NID_TYPE_ASSOC_CONTENTS_TABLE = exports.NID_TYPE_CONTENTS_TABLE = exports.NID_TYPE_HIERARCHY_TABLE = exports.NID_TYPE_OUTGOING_QUEUE_TABLE = exports.NID_TYPE_RECEIVE_FOLDER_TABLE = exports.NID_TYPE_CONTENTS_TABLE_INDEX = exports.NID_TYPE_ASSOC_MESSAGE = exports.NID_TYPE_SEARCH_CRITERIA_OBJECT = exports.NID_TYPE_SEARCH_UPDATE_QUEUE = exports.NID_TYPE_ATTACHMENT = exports.NID_TYPE_NORMAL_MESSAGE = exports.NID_TYPE_SEARCH_FOLDER = exports.NID_TYPE_NORMAL_FOLDER = exports.NID_TYPE_INTERNAL = exports.NID_TYPE_HID = exports.propertyName = exports.codePages = exports.compEnc = void 0; | ||
const iconv_lite_1 = __importDefault(require("iconv-lite")); | ||
const long_1 = __importDefault(require("long")); | ||
@@ -316,4 +317,3 @@ const _1 = require("."); | ||
*/ | ||
const createJavascriptString = (data, stringType, _codepage) => { | ||
// TODO - codepage is not used... | ||
const createJavascriptString = (data, stringType, codepage = "utf-8") => { | ||
try { | ||
@@ -324,2 +324,5 @@ if (stringType === 0x1f) { | ||
} | ||
else { | ||
return iconv_lite_1.default.decode(data, codepage).toString(); | ||
} | ||
} | ||
@@ -326,0 +329,0 @@ catch (err) { |
{ | ||
"name": "@socialgouv/archimail-pst-extractor", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Extract objects from MS Outlook/Exchange PST files", | ||
@@ -41,2 +41,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"iconv-lite": "^0.6.3", | ||
"long": "^5.1.0", | ||
@@ -43,0 +44,0 @@ "uuid-parse": "^1.1.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96110773
97
10831
3
+ Addediconv-lite@^0.6.3
+ Addediconv-lite@0.6.3(transitive)
+ Addedsafer-buffer@2.1.2(transitive)