n8n-nodes-outlook-subscription 0.1.7 → 0.1.9
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.
- package/dist/nodes/OutlookSubscription/OutlookSubscription.node.js +223 -45
- package/dist/nodes/OutlookSubscription/OutlookSubscription.node.js.map +1 -1
- package/dist/nodes/OutlookSubscriptionNotificationTrigger/OutlookSubscriptionNotificationTrigger.node.js +31 -5
- package/dist/nodes/OutlookSubscriptionNotificationTrigger/OutlookSubscriptionNotificationTrigger.node.js.map +1 -1
- package/dist/nodes/shared/graph.js +57 -20
- package/dist/nodes/shared/graph.js.map +1 -1
- package/package.json +2 -2
|
@@ -21,7 +21,7 @@ class OutlookSubscription {
|
|
|
21
21
|
credentials: [
|
|
22
22
|
{
|
|
23
23
|
name: "microsoftOutlookOAuth2Api",
|
|
24
|
-
required:
|
|
24
|
+
required: true,
|
|
25
25
|
},
|
|
26
26
|
],
|
|
27
27
|
properties: [
|
|
@@ -116,6 +116,19 @@ class OutlookSubscription {
|
|
|
116
116
|
placeholder: "AAMkAG...=",
|
|
117
117
|
description: "The ID of the draft message",
|
|
118
118
|
},
|
|
119
|
+
{
|
|
120
|
+
displayName: "Use Immutable ID",
|
|
121
|
+
name: "draftUseImmutableId",
|
|
122
|
+
type: "boolean",
|
|
123
|
+
default: false,
|
|
124
|
+
displayOptions: {
|
|
125
|
+
show: {
|
|
126
|
+
resource: ["draft"],
|
|
127
|
+
operation: ["delete", "send", "update"],
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
description: 'Whether the Draft ID input is an immutable ID. Adds the Microsoft Graph Prefer header IdType="ImmutableId".',
|
|
131
|
+
},
|
|
119
132
|
// ── Draft Create: fields ──
|
|
120
133
|
{
|
|
121
134
|
displayName: "Subject",
|
|
@@ -300,6 +313,19 @@ class OutlookSubscription {
|
|
|
300
313
|
placeholder: "AAMkAG...=",
|
|
301
314
|
description: "The ID of the draft to retrieve. Leave empty to list drafts.",
|
|
302
315
|
},
|
|
316
|
+
{
|
|
317
|
+
displayName: "Use Immutable ID",
|
|
318
|
+
name: "draftUseImmutableId",
|
|
319
|
+
type: "boolean",
|
|
320
|
+
default: false,
|
|
321
|
+
displayOptions: {
|
|
322
|
+
show: {
|
|
323
|
+
resource: ["draft"],
|
|
324
|
+
operation: ["get"],
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
description: 'Whether the Draft ID input is an immutable ID. Adds the Microsoft Graph Prefer header IdType="ImmutableId".',
|
|
328
|
+
},
|
|
303
329
|
{
|
|
304
330
|
displayName: "Options",
|
|
305
331
|
name: "draftGetOptions",
|
|
@@ -396,21 +422,28 @@ class OutlookSubscription {
|
|
|
396
422
|
displayName: "Convert Body to Markdown",
|
|
397
423
|
name: "bodyToMarkdown",
|
|
398
424
|
type: "boolean",
|
|
399
|
-
default:
|
|
400
|
-
description: "Whether to
|
|
425
|
+
default: true,
|
|
426
|
+
description: "Whether to add Markdown content while keeping the original HTML body content.",
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
displayName: "Return Immutable ID",
|
|
430
|
+
name: "returnImmutableId",
|
|
431
|
+
type: "boolean",
|
|
432
|
+
default: true,
|
|
433
|
+
description: "Whether to include immutableId alongside id using the Microsoft Graph translateExchangeIds endpoint.",
|
|
401
434
|
},
|
|
402
435
|
{
|
|
403
436
|
displayName: "List Attachments",
|
|
404
437
|
name: "listAttachments",
|
|
405
438
|
type: "boolean",
|
|
406
|
-
default:
|
|
439
|
+
default: true,
|
|
407
440
|
description: "Whether to fetch attachment metadata and include it as an array on the draft object",
|
|
408
441
|
},
|
|
409
442
|
{
|
|
410
443
|
displayName: "Download Attachments",
|
|
411
444
|
name: "downloadAttachments",
|
|
412
445
|
type: "boolean",
|
|
413
|
-
default:
|
|
446
|
+
default: true,
|
|
414
447
|
description: "Whether to download file attachment content as binary data (data_0, data_1, …). Automatically includes attachment metadata.",
|
|
415
448
|
},
|
|
416
449
|
],
|
|
@@ -724,6 +757,14 @@ class OutlookSubscription {
|
|
|
724
757
|
displayOptions: { show: { resource: ["attachment"] } },
|
|
725
758
|
placeholder: "AAMkAG...=",
|
|
726
759
|
},
|
|
760
|
+
{
|
|
761
|
+
displayName: "Use Immutable ID",
|
|
762
|
+
name: "useImmutableId",
|
|
763
|
+
type: "boolean",
|
|
764
|
+
default: false,
|
|
765
|
+
displayOptions: { show: { resource: ["attachment"] } },
|
|
766
|
+
description: 'Whether the Message ID input is an immutable ID. Adds the Microsoft Graph Prefer header IdType="ImmutableId".',
|
|
767
|
+
},
|
|
727
768
|
// For message resource: ops that require a specific message
|
|
728
769
|
{
|
|
729
770
|
displayName: "Message ID",
|
|
@@ -739,6 +780,19 @@ class OutlookSubscription {
|
|
|
739
780
|
},
|
|
740
781
|
placeholder: "AAMkAG...=",
|
|
741
782
|
},
|
|
783
|
+
{
|
|
784
|
+
displayName: "Use Immutable ID",
|
|
785
|
+
name: "useImmutableId",
|
|
786
|
+
type: "boolean",
|
|
787
|
+
default: false,
|
|
788
|
+
displayOptions: {
|
|
789
|
+
show: {
|
|
790
|
+
resource: ["message"],
|
|
791
|
+
operation: ["delete", "move", "reply", "replyAll", "patch"],
|
|
792
|
+
},
|
|
793
|
+
},
|
|
794
|
+
description: 'Whether the Message ID input is an immutable ID. Adds the Microsoft Graph Prefer header IdType="ImmutableId".',
|
|
795
|
+
},
|
|
742
796
|
// ── Attachment ID (download) ──
|
|
743
797
|
{
|
|
744
798
|
displayName: "Attachment ID",
|
|
@@ -766,6 +820,19 @@ class OutlookSubscription {
|
|
|
766
820
|
placeholder: "AAMkAG...=",
|
|
767
821
|
description: "ID of the message to retrieve. Leave empty to list messages.",
|
|
768
822
|
},
|
|
823
|
+
{
|
|
824
|
+
displayName: "Use Immutable ID",
|
|
825
|
+
name: "useImmutableId",
|
|
826
|
+
type: "boolean",
|
|
827
|
+
default: false,
|
|
828
|
+
displayOptions: {
|
|
829
|
+
show: {
|
|
830
|
+
resource: ["message"],
|
|
831
|
+
operation: ["get"],
|
|
832
|
+
},
|
|
833
|
+
},
|
|
834
|
+
description: 'Whether the Message ID input is an immutable ID. Adds the Microsoft Graph Prefer header IdType="ImmutableId".',
|
|
835
|
+
},
|
|
769
836
|
{
|
|
770
837
|
displayName: "Options",
|
|
771
838
|
name: "messageGetOptions",
|
|
@@ -903,21 +970,28 @@ class OutlookSubscription {
|
|
|
903
970
|
displayName: "Convert Body to Markdown",
|
|
904
971
|
name: "bodyToMarkdown",
|
|
905
972
|
type: "boolean",
|
|
906
|
-
default:
|
|
907
|
-
description: "Whether to
|
|
973
|
+
default: true,
|
|
974
|
+
description: "Whether to add Markdown content while keeping the original HTML body content. Only applied when the body field is returned and its contentType is html.",
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
displayName: "Return Immutable ID",
|
|
978
|
+
name: "returnImmutableId",
|
|
979
|
+
type: "boolean",
|
|
980
|
+
default: true,
|
|
981
|
+
description: "Whether to include immutableId alongside id using the Microsoft Graph translateExchangeIds endpoint.",
|
|
908
982
|
},
|
|
909
983
|
{
|
|
910
984
|
displayName: "List Attachments",
|
|
911
985
|
name: "listAttachments",
|
|
912
986
|
type: "boolean",
|
|
913
|
-
default:
|
|
987
|
+
default: true,
|
|
914
988
|
description: "Whether to fetch attachment metadata and include it as an array on the message object",
|
|
915
989
|
},
|
|
916
990
|
{
|
|
917
991
|
displayName: "Download Attachments",
|
|
918
992
|
name: "downloadAttachments",
|
|
919
993
|
type: "boolean",
|
|
920
|
-
default:
|
|
994
|
+
default: true,
|
|
921
995
|
description: "Whether to download file attachment content as binary data (data_0, data_1, …). Automatically includes attachment metadata.",
|
|
922
996
|
},
|
|
923
997
|
],
|
|
@@ -944,6 +1018,16 @@ class OutlookSubscription {
|
|
|
944
1018
|
placeholder: "AAMkAG...=",
|
|
945
1019
|
description: "ID of the sent message to retrieve. Leave empty to list sent items.",
|
|
946
1020
|
},
|
|
1021
|
+
{
|
|
1022
|
+
displayName: "Use Immutable ID",
|
|
1023
|
+
name: "sentItemUseImmutableId",
|
|
1024
|
+
type: "boolean",
|
|
1025
|
+
default: false,
|
|
1026
|
+
displayOptions: {
|
|
1027
|
+
show: { resource: ["sentItem"], operation: ["get"] },
|
|
1028
|
+
},
|
|
1029
|
+
description: 'Whether the Message ID input is an immutable ID. Adds the Microsoft Graph Prefer header IdType="ImmutableId".',
|
|
1030
|
+
},
|
|
947
1031
|
// ── Sent Item: Query Options ──
|
|
948
1032
|
{
|
|
949
1033
|
displayName: "Options",
|
|
@@ -1058,21 +1142,28 @@ class OutlookSubscription {
|
|
|
1058
1142
|
displayName: "Convert Body to Markdown",
|
|
1059
1143
|
name: "bodyToMarkdown",
|
|
1060
1144
|
type: "boolean",
|
|
1061
|
-
default:
|
|
1062
|
-
description: "Whether to
|
|
1145
|
+
default: true,
|
|
1146
|
+
description: "Whether to add Markdown content while keeping the original HTML body content.",
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
displayName: "Return Immutable ID",
|
|
1150
|
+
name: "returnImmutableId",
|
|
1151
|
+
type: "boolean",
|
|
1152
|
+
default: true,
|
|
1153
|
+
description: "Whether to include immutableId alongside id using the Microsoft Graph translateExchangeIds endpoint.",
|
|
1063
1154
|
},
|
|
1064
1155
|
{
|
|
1065
1156
|
displayName: "List Attachments",
|
|
1066
1157
|
name: "listAttachments",
|
|
1067
1158
|
type: "boolean",
|
|
1068
|
-
default:
|
|
1159
|
+
default: true,
|
|
1069
1160
|
description: "Whether to fetch attachment metadata and include it as an array on the sent item object",
|
|
1070
1161
|
},
|
|
1071
1162
|
{
|
|
1072
1163
|
displayName: "Download Attachments",
|
|
1073
1164
|
name: "downloadAttachments",
|
|
1074
1165
|
type: "boolean",
|
|
1075
|
-
default:
|
|
1166
|
+
default: true,
|
|
1076
1167
|
description: "Whether to download file attachment content as binary data (data_0, data_1, …). Automatically includes attachment metadata.",
|
|
1077
1168
|
},
|
|
1078
1169
|
],
|
|
@@ -1702,7 +1793,7 @@ class OutlookSubscription {
|
|
|
1702
1793
|
};
|
|
1703
1794
|
}
|
|
1704
1795
|
async execute() {
|
|
1705
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1796
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1706
1797
|
const items = this.getInputData();
|
|
1707
1798
|
const returnData = [];
|
|
1708
1799
|
const EXTENDED_PROP_PREFIX = "String {00020329-0000-0000-C000-000000000046} Name ";
|
|
@@ -1744,6 +1835,60 @@ class OutlookSubscription {
|
|
|
1744
1835
|
}
|
|
1745
1836
|
return out;
|
|
1746
1837
|
};
|
|
1838
|
+
const addImmutableIds = async (messages, config, idsAlreadyImmutable = false) => {
|
|
1839
|
+
const ids = messages
|
|
1840
|
+
.map((message) => String(message.id || "").trim())
|
|
1841
|
+
.filter(Boolean);
|
|
1842
|
+
if (ids.length === 0) {
|
|
1843
|
+
return messages;
|
|
1844
|
+
}
|
|
1845
|
+
if (idsAlreadyImmutable) {
|
|
1846
|
+
return messages.map((message) => {
|
|
1847
|
+
const id = String(message.id || "").trim();
|
|
1848
|
+
if (!id) {
|
|
1849
|
+
return message;
|
|
1850
|
+
}
|
|
1851
|
+
const { id: originalId, ...rest } = message;
|
|
1852
|
+
return originalId !== undefined && originalId !== null
|
|
1853
|
+
? {
|
|
1854
|
+
id: originalId,
|
|
1855
|
+
immutableId: id,
|
|
1856
|
+
...rest,
|
|
1857
|
+
}
|
|
1858
|
+
: {
|
|
1859
|
+
...message,
|
|
1860
|
+
immutableId: id,
|
|
1861
|
+
};
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
let immutableIdMap = {};
|
|
1865
|
+
try {
|
|
1866
|
+
immutableIdMap = await graph_1.getImmutableIdMap.call(this, config, ids);
|
|
1867
|
+
}
|
|
1868
|
+
catch {
|
|
1869
|
+
// Best-effort enrichment: if translation fails, keep base payload.
|
|
1870
|
+
return messages;
|
|
1871
|
+
}
|
|
1872
|
+
return messages.map((message) => {
|
|
1873
|
+
const id = String(message.id || "").trim();
|
|
1874
|
+
const immutableId = immutableIdMap[id];
|
|
1875
|
+
if (!immutableId) {
|
|
1876
|
+
return message;
|
|
1877
|
+
}
|
|
1878
|
+
const { id: originalId, ...rest } = message;
|
|
1879
|
+
if (originalId !== undefined && originalId !== null) {
|
|
1880
|
+
return {
|
|
1881
|
+
id: originalId,
|
|
1882
|
+
immutableId,
|
|
1883
|
+
...rest,
|
|
1884
|
+
};
|
|
1885
|
+
}
|
|
1886
|
+
return {
|
|
1887
|
+
...message,
|
|
1888
|
+
immutableId,
|
|
1889
|
+
};
|
|
1890
|
+
});
|
|
1891
|
+
};
|
|
1747
1892
|
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
1748
1893
|
try {
|
|
1749
1894
|
const resource = this.getNodeParameter("resource", itemIndex);
|
|
@@ -1948,21 +2093,28 @@ class OutlookSubscription {
|
|
|
1948
2093
|
.join(",")
|
|
1949
2094
|
: "";
|
|
1950
2095
|
const bodyToMarkdown = (_c = opts.bodyToMarkdown) !== null && _c !== void 0 ? _c : false;
|
|
2096
|
+
const returnImmutableId = (_d = opts.returnImmutableId) !== null && _d !== void 0 ? _d : false;
|
|
1951
2097
|
const listAttachments = Boolean(opts.listAttachments);
|
|
1952
2098
|
const downloadAttachments = Boolean(opts.downloadAttachments);
|
|
1953
2099
|
const msgId = this.getNodeParameter("messageId", itemIndex, "").trim();
|
|
2100
|
+
const useImmutableId = this.getNodeParameter("useImmutableId", itemIndex, false);
|
|
1954
2101
|
if (msgId) {
|
|
1955
2102
|
const qs = {};
|
|
1956
2103
|
if (expand)
|
|
1957
2104
|
qs.$expand = expand;
|
|
1958
2105
|
if (selectFields)
|
|
1959
2106
|
qs.$select = selectFields;
|
|
1960
|
-
const message = await graph_1.getMessage.call(this, config, msgId, Object.keys(qs).length > 0 ? qs : undefined);
|
|
1961
|
-
const
|
|
2107
|
+
const message = await graph_1.getMessage.call(this, config, msgId, Object.keys(qs).length > 0 ? qs : undefined, useImmutableId);
|
|
2108
|
+
const [messageWithImmutableId] = returnImmutableId
|
|
2109
|
+
? await addImmutableIds([message], config, useImmutableId)
|
|
2110
|
+
: [message];
|
|
2111
|
+
const resolved = dedupeExtendedProperties(bodyToMarkdown
|
|
2112
|
+
? (0, graph_1.convertBodyToMarkdown)(messageWithImmutableId)
|
|
2113
|
+
: messageWithImmutableId);
|
|
1962
2114
|
if (!(0, graph_1.evaluateMessageFilter)(messageFilter, resolved))
|
|
1963
2115
|
continue;
|
|
1964
2116
|
if (listAttachments || downloadAttachments) {
|
|
1965
|
-
const rawAttachments = await graph_1.listMessageAttachments.call(this, config, msgId);
|
|
2117
|
+
const rawAttachments = await graph_1.listMessageAttachments.call(this, config, msgId, useImmutableId);
|
|
1966
2118
|
const binaryData = {};
|
|
1967
2119
|
const attachmentsMeta = [];
|
|
1968
2120
|
let binaryIndex = 0;
|
|
@@ -2004,9 +2156,12 @@ class OutlookSubscription {
|
|
|
2004
2156
|
if (selectFields)
|
|
2005
2157
|
qs.$select = selectFields;
|
|
2006
2158
|
const messages = await graph_1.listMessages.call(this, config, folderIdOpt || undefined, qs, false);
|
|
2007
|
-
const
|
|
2008
|
-
? messages
|
|
2159
|
+
const withImmutableIds = returnImmutableId
|
|
2160
|
+
? await addImmutableIds(messages, config)
|
|
2009
2161
|
: messages;
|
|
2162
|
+
const mapped = bodyToMarkdown
|
|
2163
|
+
? withImmutableIds.map(graph_1.convertBodyToMarkdown)
|
|
2164
|
+
: withImmutableIds;
|
|
2010
2165
|
const filtered = mapped.filter((m) => (0, graph_1.evaluateMessageFilter)(messageFilter, m));
|
|
2011
2166
|
returnData.push(...this.helpers.returnJsonArray(filtered.map(dedupeExtendedProperties)));
|
|
2012
2167
|
}
|
|
@@ -2014,9 +2169,10 @@ class OutlookSubscription {
|
|
|
2014
2169
|
}
|
|
2015
2170
|
// All remaining message operations require a messageId
|
|
2016
2171
|
const messageId = this.getNodeParameter("messageId", itemIndex);
|
|
2172
|
+
const useImmutableId = this.getNodeParameter("useImmutableId", itemIndex, false);
|
|
2017
2173
|
// ── delete ──
|
|
2018
2174
|
if (operation === "delete") {
|
|
2019
|
-
await graph_1.deleteMessage.call(this, config, messageId);
|
|
2175
|
+
await graph_1.deleteMessage.call(this, config, messageId, useImmutableId);
|
|
2020
2176
|
returnData.push({
|
|
2021
2177
|
json: { success: true, operation: "delete", messageId },
|
|
2022
2178
|
});
|
|
@@ -2037,7 +2193,7 @@ class OutlookSubscription {
|
|
|
2037
2193
|
else {
|
|
2038
2194
|
destinationId = this.getNodeParameter("destinationFolderId", itemIndex, "");
|
|
2039
2195
|
}
|
|
2040
|
-
const moved = await graph_1.moveMessage.call(this, config, messageId, destinationId);
|
|
2196
|
+
const moved = await graph_1.moveMessage.call(this, config, messageId, destinationId, useImmutableId);
|
|
2041
2197
|
returnData.push({ json: moved });
|
|
2042
2198
|
continue;
|
|
2043
2199
|
}
|
|
@@ -2058,7 +2214,7 @@ class OutlookSubscription {
|
|
|
2058
2214
|
});
|
|
2059
2215
|
}
|
|
2060
2216
|
const replyInlineImagesCollection = this.getNodeParameter("replyInlineImages", itemIndex, {});
|
|
2061
|
-
const replyInlineImageEntries = (
|
|
2217
|
+
const replyInlineImageEntries = (_e = replyInlineImagesCollection.image) !== null && _e !== void 0 ? _e : [];
|
|
2062
2218
|
const replyInlineImages = [];
|
|
2063
2219
|
for (const entry of replyInlineImageEntries) {
|
|
2064
2220
|
const imgField = entry.binaryFieldName.trim() || "data";
|
|
@@ -2071,7 +2227,7 @@ class OutlookSubscription {
|
|
|
2071
2227
|
contentId: entry.contentId.trim() || imgField,
|
|
2072
2228
|
});
|
|
2073
2229
|
}
|
|
2074
|
-
await graph_1.replyToMessage.call(this, config, messageId, replyComment, replyBodyType, operation === "replyAll", replyAttachments.length > 0 ? replyAttachments : undefined, replyInlineImages.length > 0 ? replyInlineImages : undefined);
|
|
2230
|
+
await graph_1.replyToMessage.call(this, config, messageId, replyComment, replyBodyType, operation === "replyAll", replyAttachments.length > 0 ? replyAttachments : undefined, replyInlineImages.length > 0 ? replyInlineImages : undefined, useImmutableId);
|
|
2075
2231
|
returnData.push({
|
|
2076
2232
|
json: { success: true, operation, messageId },
|
|
2077
2233
|
});
|
|
@@ -2129,7 +2285,7 @@ class OutlookSubscription {
|
|
|
2129
2285
|
extendedPropertyIds.push(fullId);
|
|
2130
2286
|
if (p.type === "multi") {
|
|
2131
2287
|
// Parse comma-separated quoted strings: "a","b","c"
|
|
2132
|
-
const raw = (
|
|
2288
|
+
const raw = (_f = p.value) !== null && _f !== void 0 ? _f : "";
|
|
2133
2289
|
const values = Array.from(raw.matchAll(/"((?:[^"\\]|\\.)*)"/g), (m) => m[1]);
|
|
2134
2290
|
multiProps.push({ id: fullId, value: values });
|
|
2135
2291
|
}
|
|
@@ -2158,7 +2314,7 @@ class OutlookSubscription {
|
|
|
2158
2314
|
Object.assign(body, additionalBody);
|
|
2159
2315
|
}
|
|
2160
2316
|
const etag = this.getNodeParameter("ifMatchETag", itemIndex, "");
|
|
2161
|
-
const updated = await graph_1.updateMessage.call(this, config, messageId, body, etag || undefined);
|
|
2317
|
+
const updated = await graph_1.updateMessage.call(this, config, messageId, body, etag || undefined, useImmutableId);
|
|
2162
2318
|
if (extendedPropertyIds.length > 0) {
|
|
2163
2319
|
const quotedIds = extendedPropertyIds
|
|
2164
2320
|
.map((id) => id.replace(/'/g, "''"))
|
|
@@ -2168,7 +2324,7 @@ class OutlookSubscription {
|
|
|
2168
2324
|
$expand: `singleValueExtendedProperties($filter=${quotedIds}),` +
|
|
2169
2325
|
`multiValueExtendedProperties($filter=${quotedIds})`,
|
|
2170
2326
|
};
|
|
2171
|
-
const updatedWithExtended = await graph_1.getMessage.call(this, config, messageId, qs);
|
|
2327
|
+
const updatedWithExtended = await graph_1.getMessage.call(this, config, messageId, qs, useImmutableId);
|
|
2172
2328
|
returnData.push({
|
|
2173
2329
|
json: dedupeExtendedProperties(updatedWithExtended),
|
|
2174
2330
|
});
|
|
@@ -2203,7 +2359,7 @@ class OutlookSubscription {
|
|
|
2203
2359
|
});
|
|
2204
2360
|
}
|
|
2205
2361
|
const draftInlineImagesCollection = this.getNodeParameter("draftInlineImages", itemIndex, {});
|
|
2206
|
-
const draftInlineImageEntries = (
|
|
2362
|
+
const draftInlineImageEntries = (_g = draftInlineImagesCollection.image) !== null && _g !== void 0 ? _g : [];
|
|
2207
2363
|
const inlineImages = [];
|
|
2208
2364
|
for (const entry of draftInlineImageEntries) {
|
|
2209
2365
|
const imgField = entry.binaryFieldName.trim() || "data";
|
|
@@ -2252,22 +2408,29 @@ class OutlookSubscription {
|
|
|
2252
2408
|
.filter(Boolean)
|
|
2253
2409
|
.join(",")
|
|
2254
2410
|
: "";
|
|
2255
|
-
const bodyToMarkdown = (
|
|
2411
|
+
const bodyToMarkdown = (_h = opts.bodyToMarkdown) !== null && _h !== void 0 ? _h : false;
|
|
2412
|
+
const returnImmutableId = (_j = opts.returnImmutableId) !== null && _j !== void 0 ? _j : false;
|
|
2256
2413
|
const listAttachments = Boolean(opts.listAttachments);
|
|
2257
2414
|
const downloadAttachments = Boolean(opts.downloadAttachments);
|
|
2258
2415
|
const draftGetId = this.getNodeParameter("draftId", itemIndex, "").trim();
|
|
2416
|
+
const draftUseImmutableId = this.getNodeParameter("draftUseImmutableId", itemIndex, false);
|
|
2259
2417
|
if (draftGetId) {
|
|
2260
2418
|
const qs = {};
|
|
2261
2419
|
if (expand)
|
|
2262
2420
|
qs.$expand = expand;
|
|
2263
2421
|
if (selectFields)
|
|
2264
2422
|
qs.$select = selectFields;
|
|
2265
|
-
const message = await graph_1.getMessage.call(this, config, draftGetId, Object.keys(qs).length > 0 ? qs : undefined);
|
|
2266
|
-
const
|
|
2423
|
+
const message = await graph_1.getMessage.call(this, config, draftGetId, Object.keys(qs).length > 0 ? qs : undefined, draftUseImmutableId);
|
|
2424
|
+
const [messageWithImmutableId] = returnImmutableId
|
|
2425
|
+
? await addImmutableIds([message], config, draftUseImmutableId)
|
|
2426
|
+
: [message];
|
|
2427
|
+
const resolved = dedupeExtendedProperties(bodyToMarkdown
|
|
2428
|
+
? (0, graph_1.convertBodyToMarkdown)(messageWithImmutableId)
|
|
2429
|
+
: messageWithImmutableId);
|
|
2267
2430
|
if (!(0, graph_1.evaluateMessageFilter)(messageFilter, resolved))
|
|
2268
2431
|
continue;
|
|
2269
2432
|
if (listAttachments || downloadAttachments) {
|
|
2270
|
-
const rawAttachments = await graph_1.listMessageAttachments.call(this, config, draftGetId);
|
|
2433
|
+
const rawAttachments = await graph_1.listMessageAttachments.call(this, config, draftGetId, draftUseImmutableId);
|
|
2271
2434
|
const binaryData = {};
|
|
2272
2435
|
const attachmentsMeta = [];
|
|
2273
2436
|
let binaryIndex = 0;
|
|
@@ -2307,24 +2470,28 @@ class OutlookSubscription {
|
|
|
2307
2470
|
if (selectFields)
|
|
2308
2471
|
qs.$select = selectFields;
|
|
2309
2472
|
const messages = await graph_1.listMessages.call(this, config, "Drafts", qs, false);
|
|
2310
|
-
const
|
|
2311
|
-
? messages
|
|
2473
|
+
const withImmutableIds = returnImmutableId
|
|
2474
|
+
? await addImmutableIds(messages, config)
|
|
2312
2475
|
: messages;
|
|
2476
|
+
const mapped = bodyToMarkdown
|
|
2477
|
+
? withImmutableIds.map(graph_1.convertBodyToMarkdown)
|
|
2478
|
+
: withImmutableIds;
|
|
2313
2479
|
const filtered = mapped.filter((m) => (0, graph_1.evaluateMessageFilter)(messageFilter, m));
|
|
2314
2480
|
returnData.push(...this.helpers.returnJsonArray(filtered.map(dedupeExtendedProperties)));
|
|
2315
2481
|
}
|
|
2316
2482
|
continue;
|
|
2317
2483
|
}
|
|
2318
2484
|
const draftId = this.getNodeParameter("draftId", itemIndex);
|
|
2485
|
+
const draftUseImmutableId = this.getNodeParameter("draftUseImmutableId", itemIndex, false);
|
|
2319
2486
|
if (operation === "delete") {
|
|
2320
|
-
await graph_1.deleteMessage.call(this, config, draftId);
|
|
2487
|
+
await graph_1.deleteMessage.call(this, config, draftId, draftUseImmutableId);
|
|
2321
2488
|
returnData.push({
|
|
2322
2489
|
json: { success: true, operation: "delete", draftId },
|
|
2323
2490
|
});
|
|
2324
2491
|
continue;
|
|
2325
2492
|
}
|
|
2326
2493
|
if (operation === "send") {
|
|
2327
|
-
await graph_1.sendDraft.call(this, config, draftId);
|
|
2494
|
+
await graph_1.sendDraft.call(this, config, draftId, draftUseImmutableId);
|
|
2328
2495
|
returnData.push({
|
|
2329
2496
|
json: { success: true, operation: "send", draftId },
|
|
2330
2497
|
});
|
|
@@ -2364,7 +2531,7 @@ class OutlookSubscription {
|
|
|
2364
2531
|
}
|
|
2365
2532
|
if (f.importance)
|
|
2366
2533
|
body.importance = f.importance;
|
|
2367
|
-
let additionalBody = (
|
|
2534
|
+
let additionalBody = (_k = f.additionalBody) !== null && _k !== void 0 ? _k : "{}";
|
|
2368
2535
|
if (typeof additionalBody === "string") {
|
|
2369
2536
|
try {
|
|
2370
2537
|
additionalBody = JSON.parse(additionalBody);
|
|
@@ -2379,7 +2546,7 @@ class OutlookSubscription {
|
|
|
2379
2546
|
Object.assign(body, additionalBody);
|
|
2380
2547
|
}
|
|
2381
2548
|
const draftEtag = this.getNodeParameter("draftIfMatchETag", itemIndex, "").trim();
|
|
2382
|
-
const updated = await graph_1.updateMessage.call(this, config, draftId, body, draftEtag || undefined);
|
|
2549
|
+
const updated = await graph_1.updateMessage.call(this, config, draftId, body, draftEtag || undefined, draftUseImmutableId);
|
|
2383
2550
|
returnData.push({ json: updated });
|
|
2384
2551
|
continue;
|
|
2385
2552
|
}
|
|
@@ -2403,25 +2570,32 @@ class OutlookSubscription {
|
|
|
2403
2570
|
.filter(Boolean)
|
|
2404
2571
|
.join(",")
|
|
2405
2572
|
: "";
|
|
2406
|
-
const bodyToMarkdown = (
|
|
2573
|
+
const bodyToMarkdown = (_l = opts.bodyToMarkdown) !== null && _l !== void 0 ? _l : false;
|
|
2574
|
+
const returnImmutableId = (_m = opts.returnImmutableId) !== null && _m !== void 0 ? _m : false;
|
|
2407
2575
|
const listAttachments = Boolean(opts.listAttachments);
|
|
2408
2576
|
const downloadAttachments = Boolean(opts.downloadAttachments);
|
|
2409
2577
|
// Resolve the OData $filter to use: raw string wins, otherwise
|
|
2410
2578
|
// translate the visual filter to OData for server-side filtering.
|
|
2411
2579
|
const resolvedOdataFilter = rawOdataFilter || (0, graph_1.filterToOData)(messageFilter) || "";
|
|
2412
2580
|
const sentItemMessageId = this.getNodeParameter("sentItemMessageId", itemIndex, "").trim();
|
|
2581
|
+
const sentItemUseImmutableId = this.getNodeParameter("sentItemUseImmutableId", itemIndex, false);
|
|
2413
2582
|
if (sentItemMessageId) {
|
|
2414
2583
|
const qs = {};
|
|
2415
2584
|
if (expand)
|
|
2416
2585
|
qs.$expand = expand;
|
|
2417
2586
|
if (selectFields)
|
|
2418
2587
|
qs.$select = selectFields;
|
|
2419
|
-
const msg = await graph_1.getSentMessage.call(this, config, sentItemMessageId, Object.keys(qs).length > 0 ? qs : undefined);
|
|
2420
|
-
const
|
|
2588
|
+
const msg = await graph_1.getSentMessage.call(this, config, sentItemMessageId, Object.keys(qs).length > 0 ? qs : undefined, sentItemUseImmutableId);
|
|
2589
|
+
const [messageWithImmutableId] = returnImmutableId
|
|
2590
|
+
? await addImmutableIds([msg], config, sentItemUseImmutableId)
|
|
2591
|
+
: [msg];
|
|
2592
|
+
const resolved = dedupeExtendedProperties(bodyToMarkdown
|
|
2593
|
+
? (0, graph_1.convertBodyToMarkdown)(messageWithImmutableId)
|
|
2594
|
+
: messageWithImmutableId);
|
|
2421
2595
|
if (!(0, graph_1.evaluateMessageFilter)(messageFilter, resolved))
|
|
2422
2596
|
continue;
|
|
2423
2597
|
if (listAttachments || downloadAttachments) {
|
|
2424
|
-
const rawAttachments = await graph_1.listMessageAttachments.call(this, config, sentItemMessageId);
|
|
2598
|
+
const rawAttachments = await graph_1.listMessageAttachments.call(this, config, sentItemMessageId, sentItemUseImmutableId);
|
|
2425
2599
|
const binaryData = {};
|
|
2426
2600
|
const attachmentsMeta = [];
|
|
2427
2601
|
let binaryIndex = 0;
|
|
@@ -2463,9 +2637,12 @@ class OutlookSubscription {
|
|
|
2463
2637
|
if (resolvedOdataFilter)
|
|
2464
2638
|
qs.$filter = resolvedOdataFilter;
|
|
2465
2639
|
const messages = await graph_1.listSentMessages.call(this, config, qs, false);
|
|
2466
|
-
const
|
|
2467
|
-
? messages
|
|
2640
|
+
const withImmutableIds = returnImmutableId
|
|
2641
|
+
? await addImmutableIds(messages, config)
|
|
2468
2642
|
: messages;
|
|
2643
|
+
const mapped = bodyToMarkdown
|
|
2644
|
+
? withImmutableIds.map(graph_1.convertBodyToMarkdown)
|
|
2645
|
+
: withImmutableIds;
|
|
2469
2646
|
returnData.push(...this.helpers.returnJsonArray(mapped.map(dedupeExtendedProperties)));
|
|
2470
2647
|
}
|
|
2471
2648
|
continue;
|
|
@@ -2474,15 +2651,16 @@ class OutlookSubscription {
|
|
|
2474
2651
|
// ── ATTACHMENT ──
|
|
2475
2652
|
if (resource === "attachment") {
|
|
2476
2653
|
const messageId = this.getNodeParameter("messageId", itemIndex);
|
|
2654
|
+
const useImmutableId = this.getNodeParameter("useImmutableId", itemIndex, false);
|
|
2477
2655
|
const config = { mailboxMode: "current" };
|
|
2478
2656
|
if (operation === "list") {
|
|
2479
|
-
const attachments = await graph_1.listMessageAttachments.call(this, config, messageId);
|
|
2657
|
+
const attachments = await graph_1.listMessageAttachments.call(this, config, messageId, useImmutableId);
|
|
2480
2658
|
returnData.push(...this.helpers.returnJsonArray(attachments));
|
|
2481
2659
|
continue;
|
|
2482
2660
|
}
|
|
2483
2661
|
if (operation === "download") {
|
|
2484
2662
|
const attachmentId = this.getNodeParameter("attachmentId", itemIndex);
|
|
2485
|
-
const attachment = await graph_1.getAttachment.call(this, config, messageId, attachmentId);
|
|
2663
|
+
const attachment = await graph_1.getAttachment.call(this, config, messageId, attachmentId, useImmutableId);
|
|
2486
2664
|
const binaryPropertyName = "data";
|
|
2487
2665
|
const fileName = String(attachment.name || `attachment_${attachmentId}`);
|
|
2488
2666
|
const contentType = String(attachment.contentType || "application/octet-stream");
|