@digipair/skill-imap 0.57.4 → 0.57.5
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/index.cjs.js +74 -51
- package/index.esm.js +79 -56
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -19,10 +19,10 @@ function _extends() {
|
|
|
19
19
|
|
|
20
20
|
let IMapService = class IMapService {
|
|
21
21
|
async parse(client, message, attachments) {
|
|
22
|
-
var _message_bodyStructure_childNodes;
|
|
23
|
-
const contents = await client.downloadMany(message.seq.toString(), ((_message_bodyStructure_childNodes = message.bodyStructure.childNodes) == null ? void 0 : _message_bodyStructure_childNodes.map((node)=>node.part)) || [
|
|
22
|
+
var _message_bodyStructure_childNodes, _client_imap;
|
|
23
|
+
const contents = await ((_client_imap = client.imap) == null ? void 0 : _client_imap.downloadMany(message.seq.toString(), ((_message_bodyStructure_childNodes = message.bodyStructure.childNodes) == null ? void 0 : _message_bodyStructure_childNodes.map((node)=>node.part)) || [
|
|
24
24
|
'1'
|
|
25
|
-
]);
|
|
25
|
+
]));
|
|
26
26
|
const contentTextKey = Object.keys(contents).find((key)=>{
|
|
27
27
|
var _message_bodyStructure_childNodes_find, _message_bodyStructure_childNodes;
|
|
28
28
|
return message.bodyStructure.type === 'text/plain' || contents[key].meta.contentType === 'text/plain' && !((_message_bodyStructure_childNodes = message.bodyStructure.childNodes) == null ? void 0 : (_message_bodyStructure_childNodes_find = _message_bodyStructure_childNodes.find((node)=>node.part === key)) == null ? void 0 : _message_bodyStructure_childNodes_find.disposition);
|
|
@@ -45,10 +45,21 @@ let IMapService = class IMapService {
|
|
|
45
45
|
}
|
|
46
46
|
return result;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
reconnect(params, pinsSettingsList, context) {
|
|
49
|
+
if (this.retryCount >= this.maxRetries) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
setTimeout(()=>{
|
|
53
|
+
this.retryCount++;
|
|
54
|
+
this.retryInterval *= 2; // Double l'intervalle entre les tentatives
|
|
55
|
+
this.connect(params, pinsSettingsList, context);
|
|
56
|
+
}, this.retryInterval);
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
async connect(params, pinsSettingsList, context) {
|
|
49
60
|
var _context_protected;
|
|
50
61
|
const { config, load = [], close = [], error = [], exists = [], expunge = [], flags = [], log = [], mailboxClose = [], mailboxOpen = [] } = params;
|
|
51
|
-
const client = new imapflow.ImapFlow(_extends({
|
|
62
|
+
const client = this.imap = new imapflow.ImapFlow(_extends({
|
|
52
63
|
logger: false
|
|
53
64
|
}, config));
|
|
54
65
|
await client.connect();
|
|
@@ -56,20 +67,26 @@ let IMapService = class IMapService {
|
|
|
56
67
|
client.logout();
|
|
57
68
|
});
|
|
58
69
|
client.on('close', async ()=>{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
this.imap = null;
|
|
71
|
+
const reconnect = this.forceClose ? false : this.reconnect(params, pinsSettingsList, context);
|
|
72
|
+
if (!reconnect) {
|
|
73
|
+
try {
|
|
74
|
+
await engine.executePinsList(close, _extends({}, context, {
|
|
75
|
+
imap: this
|
|
76
|
+
}));
|
|
77
|
+
const skillProcess = require('@digipair/skill-process');
|
|
78
|
+
skillProcess.remove(context.protected.processId);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
const skillLogger = require('@digipair/skill-logger');
|
|
81
|
+
skillLogger.addLog(context, 'ERROR', error.message);
|
|
82
|
+
}
|
|
66
83
|
}
|
|
67
84
|
});
|
|
68
85
|
client.on('error', async (data)=>{
|
|
69
86
|
try {
|
|
70
87
|
await engine.executePinsList(error, _extends({}, context, {
|
|
71
88
|
error: data,
|
|
72
|
-
imap:
|
|
89
|
+
imap: this
|
|
73
90
|
}));
|
|
74
91
|
} catch (error) {
|
|
75
92
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -80,7 +97,7 @@ let IMapService = class IMapService {
|
|
|
80
97
|
try {
|
|
81
98
|
await engine.executePinsList(exists, _extends({}, context, {
|
|
82
99
|
data,
|
|
83
|
-
imap:
|
|
100
|
+
imap: this
|
|
84
101
|
}));
|
|
85
102
|
} catch (error) {
|
|
86
103
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -91,7 +108,7 @@ let IMapService = class IMapService {
|
|
|
91
108
|
try {
|
|
92
109
|
await engine.executePinsList(expunge, _extends({}, context, {
|
|
93
110
|
data,
|
|
94
|
-
imap:
|
|
111
|
+
imap: this
|
|
95
112
|
}));
|
|
96
113
|
} catch (error) {
|
|
97
114
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -102,7 +119,7 @@ let IMapService = class IMapService {
|
|
|
102
119
|
try {
|
|
103
120
|
await engine.executePinsList(flags, _extends({}, context, {
|
|
104
121
|
data,
|
|
105
|
-
imap:
|
|
122
|
+
imap: this
|
|
106
123
|
}));
|
|
107
124
|
} catch (error) {
|
|
108
125
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -113,7 +130,7 @@ let IMapService = class IMapService {
|
|
|
113
130
|
try {
|
|
114
131
|
await engine.executePinsList(log, _extends({}, context, {
|
|
115
132
|
data,
|
|
116
|
-
imap:
|
|
133
|
+
imap: this
|
|
117
134
|
}));
|
|
118
135
|
} catch (error) {
|
|
119
136
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -124,7 +141,7 @@ let IMapService = class IMapService {
|
|
|
124
141
|
try {
|
|
125
142
|
await engine.executePinsList(mailboxClose, _extends({}, context, {
|
|
126
143
|
data,
|
|
127
|
-
imap:
|
|
144
|
+
imap: this
|
|
128
145
|
}));
|
|
129
146
|
} catch (error) {
|
|
130
147
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -135,7 +152,7 @@ let IMapService = class IMapService {
|
|
|
135
152
|
try {
|
|
136
153
|
await engine.executePinsList(mailboxOpen, _extends({}, context, {
|
|
137
154
|
data,
|
|
138
|
-
imap:
|
|
155
|
+
imap: this
|
|
139
156
|
}));
|
|
140
157
|
} catch (error) {
|
|
141
158
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -144,13 +161,13 @@ let IMapService = class IMapService {
|
|
|
144
161
|
});
|
|
145
162
|
try {
|
|
146
163
|
await engine.executePinsList(load, _extends({}, context, {
|
|
147
|
-
imap:
|
|
164
|
+
imap: this
|
|
148
165
|
}));
|
|
149
166
|
} catch (error) {
|
|
150
167
|
const skillLogger = require('@digipair/skill-logger');
|
|
151
168
|
skillLogger.addLog(context, 'ERROR', error.message);
|
|
152
169
|
}
|
|
153
|
-
return
|
|
170
|
+
return this;
|
|
154
171
|
}
|
|
155
172
|
async parseOne(params, _pinsSettingsList, context) {
|
|
156
173
|
const { client = context.imap, message, attachments = 'NONE' } = params;
|
|
@@ -163,123 +180,129 @@ let IMapService = class IMapService {
|
|
|
163
180
|
}
|
|
164
181
|
async search(params, _pinsSettingsList, context) {
|
|
165
182
|
const { client = context.imap, query, options = {} } = params;
|
|
166
|
-
return client.search(query, options);
|
|
183
|
+
return client.imap.search(query, options);
|
|
167
184
|
}
|
|
168
185
|
async getMailboxLock(params, _pinsSettingsList, context) {
|
|
169
186
|
const { client = context.imap, path = 'INBOX', options = {} } = params;
|
|
170
|
-
return client.getMailboxLock(path, options);
|
|
187
|
+
return client.imap.getMailboxLock(path, options);
|
|
171
188
|
}
|
|
172
189
|
async getQuota(params, _pinsSettingsList, context) {
|
|
173
190
|
const { client = context.imap, path } = params;
|
|
174
|
-
return client.getQuota(path);
|
|
191
|
+
return client.imap.getQuota(path);
|
|
175
192
|
}
|
|
176
193
|
async idle(params, _pinsSettingsList, context) {
|
|
177
194
|
const { client = context.imap } = params;
|
|
178
|
-
return client.idle();
|
|
195
|
+
return client.imap.idle();
|
|
179
196
|
}
|
|
180
197
|
async list(params, _pinsSettingsList, context) {
|
|
181
198
|
const { client = context.imap, options = {} } = params;
|
|
182
|
-
return client.list(options);
|
|
199
|
+
return client.imap.list(options);
|
|
183
200
|
}
|
|
184
201
|
async listTree(params, _pinsSettingsList, context) {
|
|
185
202
|
const { client = context.imap, options = {} } = params;
|
|
186
|
-
return client.listTree(options);
|
|
203
|
+
return client.imap.listTree(options);
|
|
187
204
|
}
|
|
188
205
|
async logout(params, _pinsSettingsList, context) {
|
|
189
206
|
const { client = context.imap } = params;
|
|
190
|
-
return client.logout();
|
|
207
|
+
return client.imap.logout();
|
|
191
208
|
}
|
|
192
209
|
async mailboxClose(params, _pinsSettingsList, context) {
|
|
193
210
|
const { client = context.imap } = params;
|
|
194
|
-
return client.mailboxClose();
|
|
211
|
+
return client.imap.mailboxClose();
|
|
195
212
|
}
|
|
196
213
|
async mailboxCreate(params, _pinsSettingsList, context) {
|
|
197
214
|
const { client = context.imap, path } = params;
|
|
198
|
-
return client.mailboxCreate(path);
|
|
215
|
+
return client.imap.mailboxCreate(path);
|
|
199
216
|
}
|
|
200
217
|
async mailboxDelete(params, _pinsSettingsList, context) {
|
|
201
218
|
const { client = context.imap, path } = params;
|
|
202
|
-
return client.mailboxDelete(path);
|
|
219
|
+
return client.imap.mailboxDelete(path);
|
|
203
220
|
}
|
|
204
221
|
async mailboxOpen(params, _pinsSettingsList, context) {
|
|
205
222
|
const { client = context.imap, path = 'INBOX', options = {} } = params;
|
|
206
|
-
return client.mailboxOpen(path, options);
|
|
223
|
+
return client.imap.mailboxOpen(path, options);
|
|
207
224
|
}
|
|
208
225
|
async mailboxRename(params, _pinsSettingsList, context) {
|
|
209
226
|
const { client = context.imap, path, newPath } = params;
|
|
210
|
-
return client.mailboxRename(path, newPath);
|
|
227
|
+
return client.imap.mailboxRename(path, newPath);
|
|
211
228
|
}
|
|
212
229
|
async mailboxSubscribe(params, _pinsSettingsList, context) {
|
|
213
230
|
const { client = context.imap, path } = params;
|
|
214
|
-
return client.mailboxSubscribe(path);
|
|
231
|
+
return client.imap.mailboxSubscribe(path);
|
|
215
232
|
}
|
|
216
233
|
async mailboxUnsubscribe(params, _pinsSettingsList, context) {
|
|
217
234
|
const { client = context.imap, path } = params;
|
|
218
|
-
return client.mailboxUnsubscribe(path);
|
|
235
|
+
return client.imap.mailboxUnsubscribe(path);
|
|
219
236
|
}
|
|
220
237
|
async messageCopy(params, _pinsSettingsList, context) {
|
|
221
238
|
const { client = context.imap, range, destination, options = {} } = params;
|
|
222
|
-
return client.messageCopy(range, destination, options);
|
|
239
|
+
return client.imap.messageCopy(range, destination, options);
|
|
223
240
|
}
|
|
224
241
|
async messageDelete(params, _pinsSettingsList, context) {
|
|
225
242
|
const { client = context.imap, range, options = {} } = params;
|
|
226
|
-
return client.messageDelete(range, options);
|
|
243
|
+
return client.imap.messageDelete(range, options);
|
|
227
244
|
}
|
|
228
245
|
async messageFlagsAdd(params, _pinsSettingsList, context) {
|
|
229
246
|
const { client = context.imap, range, flags, options = {} } = params;
|
|
230
|
-
return client.messageFlagsAdd(range, flags, options);
|
|
247
|
+
return client.imap.messageFlagsAdd(range, flags, options);
|
|
231
248
|
}
|
|
232
249
|
async messageFlagsRemove(params, _pinsSettingsList, context) {
|
|
233
250
|
const { client = context.imap, range, flags, options = {} } = params;
|
|
234
|
-
return client.messageFlagsRemove(range, flags, options);
|
|
251
|
+
return client.imap.messageFlagsRemove(range, flags, options);
|
|
235
252
|
}
|
|
236
253
|
async messageFlagsSet(params, _pinsSettingsList, context) {
|
|
237
254
|
const { client = context.imap, range, flags, options = {} } = params;
|
|
238
|
-
return client.messageFlagsSet(range, flags, options);
|
|
255
|
+
return client.imap.messageFlagsSet(range, flags, options);
|
|
239
256
|
}
|
|
240
257
|
async messageMove(params, _pinsSettingsList, context) {
|
|
241
258
|
const { client = context.imap, range, destination, options = {} } = params;
|
|
242
|
-
return client.messageMove(range, destination, options);
|
|
259
|
+
return client.imap.messageMove(range, destination, options);
|
|
243
260
|
}
|
|
244
261
|
async noop(params, _pinsSettingsList, context) {
|
|
245
262
|
const { client = context.imap } = params;
|
|
246
|
-
return client.noop();
|
|
263
|
+
return client.imap.noop();
|
|
247
264
|
}
|
|
248
265
|
async setFlagColor(params, _pinsSettingsList, context) {
|
|
249
266
|
const { client = context.imap, flag, color } = params;
|
|
250
|
-
return client.setFlagColor(flag, color);
|
|
267
|
+
return client.imap.setFlagColor(flag, color);
|
|
251
268
|
}
|
|
252
269
|
async status(params, _pinsSettingsList, context) {
|
|
253
270
|
const { client = context.imap, path, query } = params;
|
|
254
|
-
return client.status(path, query);
|
|
271
|
+
return client.imap.status(path, query);
|
|
255
272
|
}
|
|
256
273
|
async append(params, _pinsSettingsList, context) {
|
|
257
274
|
const { client = context.imap, path, content, flags = [], idate = Date.now() } = params;
|
|
258
|
-
return client.append(path, content, flags, idate);
|
|
275
|
+
return client.imap.append(path, content, flags, idate);
|
|
259
276
|
}
|
|
260
277
|
async close(params, _pinsSettingsList, context) {
|
|
261
278
|
const { client = context.imap } = params;
|
|
262
|
-
|
|
279
|
+
client.forceClose = true;
|
|
280
|
+
return client.imap.close();
|
|
263
281
|
}
|
|
264
282
|
async download(params, _pinsSettingsList, context) {
|
|
265
283
|
const { client = context.imap, range, part, options = {} } = params;
|
|
266
|
-
return client.download(range, part, options);
|
|
284
|
+
return client.imap.download(range, part, options);
|
|
267
285
|
}
|
|
268
286
|
async downloadMany(params, _pinsSettingsList, context) {
|
|
269
287
|
const { client = context.imap, range, parts, options = {} } = params;
|
|
270
|
-
return client.downloadMany(range, parts, options);
|
|
288
|
+
return client.imap.downloadMany(range, parts, options);
|
|
271
289
|
}
|
|
272
290
|
async fetch(params, _pinsSettingsList, context) {
|
|
273
291
|
const { client = context.imap, range, query, options = {} } = params;
|
|
274
|
-
return client.fetch(range, query, options);
|
|
292
|
+
return client.imap.fetch(range, query, options);
|
|
275
293
|
}
|
|
276
294
|
async fetchAll(params, _pinsSettingsList, context) {
|
|
277
295
|
const { client = context.imap, range, query, options = {} } = params;
|
|
278
|
-
return client.fetchAll(range, query, options);
|
|
296
|
+
return client.imap.fetchAll(range, query, options);
|
|
279
297
|
}
|
|
280
298
|
async fetchOne(params, _pinsSettingsList, context) {
|
|
281
299
|
const { client = context.imap, seq, query, options = {} } = params;
|
|
282
|
-
return client.fetchOne(seq, query, options);
|
|
300
|
+
return client.imap.fetchOne(seq, query, options);
|
|
301
|
+
}
|
|
302
|
+
constructor(){
|
|
303
|
+
this.retryCount = 0;
|
|
304
|
+
this.imap = null;
|
|
305
|
+
this.forceClose = false;
|
|
283
306
|
}
|
|
284
307
|
};
|
|
285
308
|
const connect = (params, pinsSettingsList, context)=>new IMapService().connect(params, pinsSettingsList, context);
|
package/index.esm.js
CHANGED
|
@@ -23902,14 +23902,14 @@ function indent(str, spaces) {
|
|
|
23902
23902
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
|
23903
23903
|
// match is required
|
|
23904
23904
|
if (!match) {
|
|
23905
|
-
return
|
|
23905
|
+
return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
|
|
23906
23906
|
v: nextMatch1
|
|
23907
23907
|
};
|
|
23908
23908
|
}
|
|
23909
23909
|
var token = match.token, offset = match.offset;
|
|
23910
23910
|
i1 += offset;
|
|
23911
23911
|
if (token === " ") {
|
|
23912
|
-
return
|
|
23912
|
+
return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
|
|
23913
23913
|
}
|
|
23914
23914
|
tokens1 = _to_consumable_array$1(tokens1).concat([
|
|
23915
23915
|
token
|
|
@@ -23928,7 +23928,7 @@ function indent(str, spaces) {
|
|
|
23928
23928
|
if (contextKeys.some(function(el) {
|
|
23929
23929
|
return el.startsWith(name);
|
|
23930
23930
|
})) {
|
|
23931
|
-
return
|
|
23931
|
+
return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
|
|
23932
23932
|
}
|
|
23933
23933
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23934
23934
|
return el === name;
|
|
@@ -23947,9 +23947,9 @@ function indent(str, spaces) {
|
|
|
23947
23947
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23948
23948
|
return el.startsWith(name);
|
|
23949
23949
|
})) {
|
|
23950
|
-
return
|
|
23950
|
+
return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
|
|
23951
23951
|
}
|
|
23952
|
-
return
|
|
23952
|
+
return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
|
|
23953
23953
|
v: nextMatch1
|
|
23954
23954
|
};
|
|
23955
23955
|
};
|
|
@@ -27958,10 +27958,10 @@ const preparePinsSettings = async (settings, context)=>{
|
|
|
27958
27958
|
|
|
27959
27959
|
let IMapService = class IMapService {
|
|
27960
27960
|
async parse(client, message, attachments) {
|
|
27961
|
-
var _message_bodyStructure_childNodes;
|
|
27962
|
-
const contents = await client.downloadMany(message.seq.toString(), ((_message_bodyStructure_childNodes = message.bodyStructure.childNodes) == null ? void 0 : _message_bodyStructure_childNodes.map((node)=>node.part)) || [
|
|
27961
|
+
var _message_bodyStructure_childNodes, _client_imap;
|
|
27962
|
+
const contents = await ((_client_imap = client.imap) == null ? void 0 : _client_imap.downloadMany(message.seq.toString(), ((_message_bodyStructure_childNodes = message.bodyStructure.childNodes) == null ? void 0 : _message_bodyStructure_childNodes.map((node)=>node.part)) || [
|
|
27963
27963
|
'1'
|
|
27964
|
-
]);
|
|
27964
|
+
]));
|
|
27965
27965
|
const contentTextKey = Object.keys(contents).find((key)=>{
|
|
27966
27966
|
var _message_bodyStructure_childNodes_find, _message_bodyStructure_childNodes;
|
|
27967
27967
|
return message.bodyStructure.type === 'text/plain' || contents[key].meta.contentType === 'text/plain' && !((_message_bodyStructure_childNodes = message.bodyStructure.childNodes) == null ? void 0 : (_message_bodyStructure_childNodes_find = _message_bodyStructure_childNodes.find((node)=>node.part === key)) == null ? void 0 : _message_bodyStructure_childNodes_find.disposition);
|
|
@@ -27984,10 +27984,21 @@ let IMapService = class IMapService {
|
|
|
27984
27984
|
}
|
|
27985
27985
|
return result;
|
|
27986
27986
|
}
|
|
27987
|
-
|
|
27987
|
+
reconnect(params, pinsSettingsList, context) {
|
|
27988
|
+
if (this.retryCount >= this.maxRetries) {
|
|
27989
|
+
return false;
|
|
27990
|
+
}
|
|
27991
|
+
setTimeout(()=>{
|
|
27992
|
+
this.retryCount++;
|
|
27993
|
+
this.retryInterval *= 2; // Double l'intervalle entre les tentatives
|
|
27994
|
+
this.connect(params, pinsSettingsList, context);
|
|
27995
|
+
}, this.retryInterval);
|
|
27996
|
+
return true;
|
|
27997
|
+
}
|
|
27998
|
+
async connect(params, pinsSettingsList, context) {
|
|
27988
27999
|
var _context_protected;
|
|
27989
28000
|
const { config, load = [], close = [], error = [], exists = [], expunge = [], flags = [], log = [], mailboxClose = [], mailboxOpen = [] } = params;
|
|
27990
|
-
const client = new ImapFlow(_extends({
|
|
28001
|
+
const client = this.imap = new ImapFlow(_extends({
|
|
27991
28002
|
logger: false
|
|
27992
28003
|
}, config));
|
|
27993
28004
|
await client.connect();
|
|
@@ -27995,20 +28006,26 @@ let IMapService = class IMapService {
|
|
|
27995
28006
|
client.logout();
|
|
27996
28007
|
});
|
|
27997
28008
|
client.on('close', async ()=>{
|
|
27998
|
-
|
|
27999
|
-
|
|
28000
|
-
|
|
28001
|
-
|
|
28002
|
-
|
|
28003
|
-
|
|
28004
|
-
|
|
28009
|
+
this.imap = null;
|
|
28010
|
+
const reconnect = this.forceClose ? false : this.reconnect(params, pinsSettingsList, context);
|
|
28011
|
+
if (!reconnect) {
|
|
28012
|
+
try {
|
|
28013
|
+
await executePinsList(close, _extends({}, context, {
|
|
28014
|
+
imap: this
|
|
28015
|
+
}));
|
|
28016
|
+
const skillProcess = require('@digipair/skill-process');
|
|
28017
|
+
skillProcess.remove(context.protected.processId);
|
|
28018
|
+
} catch (error) {
|
|
28019
|
+
const skillLogger = require('@digipair/skill-logger');
|
|
28020
|
+
skillLogger.addLog(context, 'ERROR', error.message);
|
|
28021
|
+
}
|
|
28005
28022
|
}
|
|
28006
28023
|
});
|
|
28007
28024
|
client.on('error', async (data)=>{
|
|
28008
28025
|
try {
|
|
28009
28026
|
await executePinsList(error, _extends({}, context, {
|
|
28010
28027
|
error: data,
|
|
28011
|
-
imap:
|
|
28028
|
+
imap: this
|
|
28012
28029
|
}));
|
|
28013
28030
|
} catch (error) {
|
|
28014
28031
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28019,7 +28036,7 @@ let IMapService = class IMapService {
|
|
|
28019
28036
|
try {
|
|
28020
28037
|
await executePinsList(exists, _extends({}, context, {
|
|
28021
28038
|
data,
|
|
28022
|
-
imap:
|
|
28039
|
+
imap: this
|
|
28023
28040
|
}));
|
|
28024
28041
|
} catch (error) {
|
|
28025
28042
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28030,7 +28047,7 @@ let IMapService = class IMapService {
|
|
|
28030
28047
|
try {
|
|
28031
28048
|
await executePinsList(expunge, _extends({}, context, {
|
|
28032
28049
|
data,
|
|
28033
|
-
imap:
|
|
28050
|
+
imap: this
|
|
28034
28051
|
}));
|
|
28035
28052
|
} catch (error) {
|
|
28036
28053
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28041,7 +28058,7 @@ let IMapService = class IMapService {
|
|
|
28041
28058
|
try {
|
|
28042
28059
|
await executePinsList(flags, _extends({}, context, {
|
|
28043
28060
|
data,
|
|
28044
|
-
imap:
|
|
28061
|
+
imap: this
|
|
28045
28062
|
}));
|
|
28046
28063
|
} catch (error) {
|
|
28047
28064
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28052,7 +28069,7 @@ let IMapService = class IMapService {
|
|
|
28052
28069
|
try {
|
|
28053
28070
|
await executePinsList(log, _extends({}, context, {
|
|
28054
28071
|
data,
|
|
28055
|
-
imap:
|
|
28072
|
+
imap: this
|
|
28056
28073
|
}));
|
|
28057
28074
|
} catch (error) {
|
|
28058
28075
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28063,7 +28080,7 @@ let IMapService = class IMapService {
|
|
|
28063
28080
|
try {
|
|
28064
28081
|
await executePinsList(mailboxClose, _extends({}, context, {
|
|
28065
28082
|
data,
|
|
28066
|
-
imap:
|
|
28083
|
+
imap: this
|
|
28067
28084
|
}));
|
|
28068
28085
|
} catch (error) {
|
|
28069
28086
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28074,7 +28091,7 @@ let IMapService = class IMapService {
|
|
|
28074
28091
|
try {
|
|
28075
28092
|
await executePinsList(mailboxOpen, _extends({}, context, {
|
|
28076
28093
|
data,
|
|
28077
|
-
imap:
|
|
28094
|
+
imap: this
|
|
28078
28095
|
}));
|
|
28079
28096
|
} catch (error) {
|
|
28080
28097
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28083,13 +28100,13 @@ let IMapService = class IMapService {
|
|
|
28083
28100
|
});
|
|
28084
28101
|
try {
|
|
28085
28102
|
await executePinsList(load, _extends({}, context, {
|
|
28086
|
-
imap:
|
|
28103
|
+
imap: this
|
|
28087
28104
|
}));
|
|
28088
28105
|
} catch (error) {
|
|
28089
28106
|
const skillLogger = require('@digipair/skill-logger');
|
|
28090
28107
|
skillLogger.addLog(context, 'ERROR', error.message);
|
|
28091
28108
|
}
|
|
28092
|
-
return
|
|
28109
|
+
return this;
|
|
28093
28110
|
}
|
|
28094
28111
|
async parseOne(params, _pinsSettingsList, context) {
|
|
28095
28112
|
const { client = context.imap, message, attachments = 'NONE' } = params;
|
|
@@ -28102,123 +28119,129 @@ let IMapService = class IMapService {
|
|
|
28102
28119
|
}
|
|
28103
28120
|
async search(params, _pinsSettingsList, context) {
|
|
28104
28121
|
const { client = context.imap, query, options = {} } = params;
|
|
28105
|
-
return client.search(query, options);
|
|
28122
|
+
return client.imap.search(query, options);
|
|
28106
28123
|
}
|
|
28107
28124
|
async getMailboxLock(params, _pinsSettingsList, context) {
|
|
28108
28125
|
const { client = context.imap, path = 'INBOX', options = {} } = params;
|
|
28109
|
-
return client.getMailboxLock(path, options);
|
|
28126
|
+
return client.imap.getMailboxLock(path, options);
|
|
28110
28127
|
}
|
|
28111
28128
|
async getQuota(params, _pinsSettingsList, context) {
|
|
28112
28129
|
const { client = context.imap, path } = params;
|
|
28113
|
-
return client.getQuota(path);
|
|
28130
|
+
return client.imap.getQuota(path);
|
|
28114
28131
|
}
|
|
28115
28132
|
async idle(params, _pinsSettingsList, context) {
|
|
28116
28133
|
const { client = context.imap } = params;
|
|
28117
|
-
return client.idle();
|
|
28134
|
+
return client.imap.idle();
|
|
28118
28135
|
}
|
|
28119
28136
|
async list(params, _pinsSettingsList, context) {
|
|
28120
28137
|
const { client = context.imap, options = {} } = params;
|
|
28121
|
-
return client.list(options);
|
|
28138
|
+
return client.imap.list(options);
|
|
28122
28139
|
}
|
|
28123
28140
|
async listTree(params, _pinsSettingsList, context) {
|
|
28124
28141
|
const { client = context.imap, options = {} } = params;
|
|
28125
|
-
return client.listTree(options);
|
|
28142
|
+
return client.imap.listTree(options);
|
|
28126
28143
|
}
|
|
28127
28144
|
async logout(params, _pinsSettingsList, context) {
|
|
28128
28145
|
const { client = context.imap } = params;
|
|
28129
|
-
return client.logout();
|
|
28146
|
+
return client.imap.logout();
|
|
28130
28147
|
}
|
|
28131
28148
|
async mailboxClose(params, _pinsSettingsList, context) {
|
|
28132
28149
|
const { client = context.imap } = params;
|
|
28133
|
-
return client.mailboxClose();
|
|
28150
|
+
return client.imap.mailboxClose();
|
|
28134
28151
|
}
|
|
28135
28152
|
async mailboxCreate(params, _pinsSettingsList, context) {
|
|
28136
28153
|
const { client = context.imap, path } = params;
|
|
28137
|
-
return client.mailboxCreate(path);
|
|
28154
|
+
return client.imap.mailboxCreate(path);
|
|
28138
28155
|
}
|
|
28139
28156
|
async mailboxDelete(params, _pinsSettingsList, context) {
|
|
28140
28157
|
const { client = context.imap, path } = params;
|
|
28141
|
-
return client.mailboxDelete(path);
|
|
28158
|
+
return client.imap.mailboxDelete(path);
|
|
28142
28159
|
}
|
|
28143
28160
|
async mailboxOpen(params, _pinsSettingsList, context) {
|
|
28144
28161
|
const { client = context.imap, path = 'INBOX', options = {} } = params;
|
|
28145
|
-
return client.mailboxOpen(path, options);
|
|
28162
|
+
return client.imap.mailboxOpen(path, options);
|
|
28146
28163
|
}
|
|
28147
28164
|
async mailboxRename(params, _pinsSettingsList, context) {
|
|
28148
28165
|
const { client = context.imap, path, newPath } = params;
|
|
28149
|
-
return client.mailboxRename(path, newPath);
|
|
28166
|
+
return client.imap.mailboxRename(path, newPath);
|
|
28150
28167
|
}
|
|
28151
28168
|
async mailboxSubscribe(params, _pinsSettingsList, context) {
|
|
28152
28169
|
const { client = context.imap, path } = params;
|
|
28153
|
-
return client.mailboxSubscribe(path);
|
|
28170
|
+
return client.imap.mailboxSubscribe(path);
|
|
28154
28171
|
}
|
|
28155
28172
|
async mailboxUnsubscribe(params, _pinsSettingsList, context) {
|
|
28156
28173
|
const { client = context.imap, path } = params;
|
|
28157
|
-
return client.mailboxUnsubscribe(path);
|
|
28174
|
+
return client.imap.mailboxUnsubscribe(path);
|
|
28158
28175
|
}
|
|
28159
28176
|
async messageCopy(params, _pinsSettingsList, context) {
|
|
28160
28177
|
const { client = context.imap, range, destination, options = {} } = params;
|
|
28161
|
-
return client.messageCopy(range, destination, options);
|
|
28178
|
+
return client.imap.messageCopy(range, destination, options);
|
|
28162
28179
|
}
|
|
28163
28180
|
async messageDelete(params, _pinsSettingsList, context) {
|
|
28164
28181
|
const { client = context.imap, range, options = {} } = params;
|
|
28165
|
-
return client.messageDelete(range, options);
|
|
28182
|
+
return client.imap.messageDelete(range, options);
|
|
28166
28183
|
}
|
|
28167
28184
|
async messageFlagsAdd(params, _pinsSettingsList, context) {
|
|
28168
28185
|
const { client = context.imap, range, flags, options = {} } = params;
|
|
28169
|
-
return client.messageFlagsAdd(range, flags, options);
|
|
28186
|
+
return client.imap.messageFlagsAdd(range, flags, options);
|
|
28170
28187
|
}
|
|
28171
28188
|
async messageFlagsRemove(params, _pinsSettingsList, context) {
|
|
28172
28189
|
const { client = context.imap, range, flags, options = {} } = params;
|
|
28173
|
-
return client.messageFlagsRemove(range, flags, options);
|
|
28190
|
+
return client.imap.messageFlagsRemove(range, flags, options);
|
|
28174
28191
|
}
|
|
28175
28192
|
async messageFlagsSet(params, _pinsSettingsList, context) {
|
|
28176
28193
|
const { client = context.imap, range, flags, options = {} } = params;
|
|
28177
|
-
return client.messageFlagsSet(range, flags, options);
|
|
28194
|
+
return client.imap.messageFlagsSet(range, flags, options);
|
|
28178
28195
|
}
|
|
28179
28196
|
async messageMove(params, _pinsSettingsList, context) {
|
|
28180
28197
|
const { client = context.imap, range, destination, options = {} } = params;
|
|
28181
|
-
return client.messageMove(range, destination, options);
|
|
28198
|
+
return client.imap.messageMove(range, destination, options);
|
|
28182
28199
|
}
|
|
28183
28200
|
async noop(params, _pinsSettingsList, context) {
|
|
28184
28201
|
const { client = context.imap } = params;
|
|
28185
|
-
return client.noop();
|
|
28202
|
+
return client.imap.noop();
|
|
28186
28203
|
}
|
|
28187
28204
|
async setFlagColor(params, _pinsSettingsList, context) {
|
|
28188
28205
|
const { client = context.imap, flag, color } = params;
|
|
28189
|
-
return client.setFlagColor(flag, color);
|
|
28206
|
+
return client.imap.setFlagColor(flag, color);
|
|
28190
28207
|
}
|
|
28191
28208
|
async status(params, _pinsSettingsList, context) {
|
|
28192
28209
|
const { client = context.imap, path, query } = params;
|
|
28193
|
-
return client.status(path, query);
|
|
28210
|
+
return client.imap.status(path, query);
|
|
28194
28211
|
}
|
|
28195
28212
|
async append(params, _pinsSettingsList, context) {
|
|
28196
28213
|
const { client = context.imap, path, content, flags = [], idate = Date.now() } = params;
|
|
28197
|
-
return client.append(path, content, flags, idate);
|
|
28214
|
+
return client.imap.append(path, content, flags, idate);
|
|
28198
28215
|
}
|
|
28199
28216
|
async close(params, _pinsSettingsList, context) {
|
|
28200
28217
|
const { client = context.imap } = params;
|
|
28201
|
-
|
|
28218
|
+
client.forceClose = true;
|
|
28219
|
+
return client.imap.close();
|
|
28202
28220
|
}
|
|
28203
28221
|
async download(params, _pinsSettingsList, context) {
|
|
28204
28222
|
const { client = context.imap, range, part, options = {} } = params;
|
|
28205
|
-
return client.download(range, part, options);
|
|
28223
|
+
return client.imap.download(range, part, options);
|
|
28206
28224
|
}
|
|
28207
28225
|
async downloadMany(params, _pinsSettingsList, context) {
|
|
28208
28226
|
const { client = context.imap, range, parts, options = {} } = params;
|
|
28209
|
-
return client.downloadMany(range, parts, options);
|
|
28227
|
+
return client.imap.downloadMany(range, parts, options);
|
|
28210
28228
|
}
|
|
28211
28229
|
async fetch(params, _pinsSettingsList, context) {
|
|
28212
28230
|
const { client = context.imap, range, query, options = {} } = params;
|
|
28213
|
-
return client.fetch(range, query, options);
|
|
28231
|
+
return client.imap.fetch(range, query, options);
|
|
28214
28232
|
}
|
|
28215
28233
|
async fetchAll(params, _pinsSettingsList, context) {
|
|
28216
28234
|
const { client = context.imap, range, query, options = {} } = params;
|
|
28217
|
-
return client.fetchAll(range, query, options);
|
|
28235
|
+
return client.imap.fetchAll(range, query, options);
|
|
28218
28236
|
}
|
|
28219
28237
|
async fetchOne(params, _pinsSettingsList, context) {
|
|
28220
28238
|
const { client = context.imap, seq, query, options = {} } = params;
|
|
28221
|
-
return client.fetchOne(seq, query, options);
|
|
28239
|
+
return client.imap.fetchOne(seq, query, options);
|
|
28240
|
+
}
|
|
28241
|
+
constructor(){
|
|
28242
|
+
this.retryCount = 0;
|
|
28243
|
+
this.imap = null;
|
|
28244
|
+
this.forceClose = false;
|
|
28222
28245
|
}
|
|
28223
28246
|
};
|
|
28224
28247
|
const connect = (params, pinsSettingsList, context)=>new IMapService().connect(params, pinsSettingsList, context);
|