@digipair/skill-imap 0.57.4 → 0.57.6
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 +72 -51
- package/index.esm.js +77 -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,24 @@ 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
|
+
} catch (error) {
|
|
78
|
+
const skillLogger = require('@digipair/skill-logger');
|
|
79
|
+
skillLogger.addLog(context, 'ERROR', error.message);
|
|
80
|
+
}
|
|
66
81
|
}
|
|
67
82
|
});
|
|
68
83
|
client.on('error', async (data)=>{
|
|
69
84
|
try {
|
|
70
85
|
await engine.executePinsList(error, _extends({}, context, {
|
|
71
86
|
error: data,
|
|
72
|
-
imap:
|
|
87
|
+
imap: this
|
|
73
88
|
}));
|
|
74
89
|
} catch (error) {
|
|
75
90
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -80,7 +95,7 @@ let IMapService = class IMapService {
|
|
|
80
95
|
try {
|
|
81
96
|
await engine.executePinsList(exists, _extends({}, context, {
|
|
82
97
|
data,
|
|
83
|
-
imap:
|
|
98
|
+
imap: this
|
|
84
99
|
}));
|
|
85
100
|
} catch (error) {
|
|
86
101
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -91,7 +106,7 @@ let IMapService = class IMapService {
|
|
|
91
106
|
try {
|
|
92
107
|
await engine.executePinsList(expunge, _extends({}, context, {
|
|
93
108
|
data,
|
|
94
|
-
imap:
|
|
109
|
+
imap: this
|
|
95
110
|
}));
|
|
96
111
|
} catch (error) {
|
|
97
112
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -102,7 +117,7 @@ let IMapService = class IMapService {
|
|
|
102
117
|
try {
|
|
103
118
|
await engine.executePinsList(flags, _extends({}, context, {
|
|
104
119
|
data,
|
|
105
|
-
imap:
|
|
120
|
+
imap: this
|
|
106
121
|
}));
|
|
107
122
|
} catch (error) {
|
|
108
123
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -113,7 +128,7 @@ let IMapService = class IMapService {
|
|
|
113
128
|
try {
|
|
114
129
|
await engine.executePinsList(log, _extends({}, context, {
|
|
115
130
|
data,
|
|
116
|
-
imap:
|
|
131
|
+
imap: this
|
|
117
132
|
}));
|
|
118
133
|
} catch (error) {
|
|
119
134
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -124,7 +139,7 @@ let IMapService = class IMapService {
|
|
|
124
139
|
try {
|
|
125
140
|
await engine.executePinsList(mailboxClose, _extends({}, context, {
|
|
126
141
|
data,
|
|
127
|
-
imap:
|
|
142
|
+
imap: this
|
|
128
143
|
}));
|
|
129
144
|
} catch (error) {
|
|
130
145
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -135,7 +150,7 @@ let IMapService = class IMapService {
|
|
|
135
150
|
try {
|
|
136
151
|
await engine.executePinsList(mailboxOpen, _extends({}, context, {
|
|
137
152
|
data,
|
|
138
|
-
imap:
|
|
153
|
+
imap: this
|
|
139
154
|
}));
|
|
140
155
|
} catch (error) {
|
|
141
156
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -144,13 +159,13 @@ let IMapService = class IMapService {
|
|
|
144
159
|
});
|
|
145
160
|
try {
|
|
146
161
|
await engine.executePinsList(load, _extends({}, context, {
|
|
147
|
-
imap:
|
|
162
|
+
imap: this
|
|
148
163
|
}));
|
|
149
164
|
} catch (error) {
|
|
150
165
|
const skillLogger = require('@digipair/skill-logger');
|
|
151
166
|
skillLogger.addLog(context, 'ERROR', error.message);
|
|
152
167
|
}
|
|
153
|
-
return
|
|
168
|
+
return this;
|
|
154
169
|
}
|
|
155
170
|
async parseOne(params, _pinsSettingsList, context) {
|
|
156
171
|
const { client = context.imap, message, attachments = 'NONE' } = params;
|
|
@@ -163,123 +178,129 @@ let IMapService = class IMapService {
|
|
|
163
178
|
}
|
|
164
179
|
async search(params, _pinsSettingsList, context) {
|
|
165
180
|
const { client = context.imap, query, options = {} } = params;
|
|
166
|
-
return client.search(query, options);
|
|
181
|
+
return client.imap.search(query, options);
|
|
167
182
|
}
|
|
168
183
|
async getMailboxLock(params, _pinsSettingsList, context) {
|
|
169
184
|
const { client = context.imap, path = 'INBOX', options = {} } = params;
|
|
170
|
-
return client.getMailboxLock(path, options);
|
|
185
|
+
return client.imap.getMailboxLock(path, options);
|
|
171
186
|
}
|
|
172
187
|
async getQuota(params, _pinsSettingsList, context) {
|
|
173
188
|
const { client = context.imap, path } = params;
|
|
174
|
-
return client.getQuota(path);
|
|
189
|
+
return client.imap.getQuota(path);
|
|
175
190
|
}
|
|
176
191
|
async idle(params, _pinsSettingsList, context) {
|
|
177
192
|
const { client = context.imap } = params;
|
|
178
|
-
return client.idle();
|
|
193
|
+
return client.imap.idle();
|
|
179
194
|
}
|
|
180
195
|
async list(params, _pinsSettingsList, context) {
|
|
181
196
|
const { client = context.imap, options = {} } = params;
|
|
182
|
-
return client.list(options);
|
|
197
|
+
return client.imap.list(options);
|
|
183
198
|
}
|
|
184
199
|
async listTree(params, _pinsSettingsList, context) {
|
|
185
200
|
const { client = context.imap, options = {} } = params;
|
|
186
|
-
return client.listTree(options);
|
|
201
|
+
return client.imap.listTree(options);
|
|
187
202
|
}
|
|
188
203
|
async logout(params, _pinsSettingsList, context) {
|
|
189
204
|
const { client = context.imap } = params;
|
|
190
|
-
return client.logout();
|
|
205
|
+
return client.imap.logout();
|
|
191
206
|
}
|
|
192
207
|
async mailboxClose(params, _pinsSettingsList, context) {
|
|
193
208
|
const { client = context.imap } = params;
|
|
194
|
-
return client.mailboxClose();
|
|
209
|
+
return client.imap.mailboxClose();
|
|
195
210
|
}
|
|
196
211
|
async mailboxCreate(params, _pinsSettingsList, context) {
|
|
197
212
|
const { client = context.imap, path } = params;
|
|
198
|
-
return client.mailboxCreate(path);
|
|
213
|
+
return client.imap.mailboxCreate(path);
|
|
199
214
|
}
|
|
200
215
|
async mailboxDelete(params, _pinsSettingsList, context) {
|
|
201
216
|
const { client = context.imap, path } = params;
|
|
202
|
-
return client.mailboxDelete(path);
|
|
217
|
+
return client.imap.mailboxDelete(path);
|
|
203
218
|
}
|
|
204
219
|
async mailboxOpen(params, _pinsSettingsList, context) {
|
|
205
220
|
const { client = context.imap, path = 'INBOX', options = {} } = params;
|
|
206
|
-
return client.mailboxOpen(path, options);
|
|
221
|
+
return client.imap.mailboxOpen(path, options);
|
|
207
222
|
}
|
|
208
223
|
async mailboxRename(params, _pinsSettingsList, context) {
|
|
209
224
|
const { client = context.imap, path, newPath } = params;
|
|
210
|
-
return client.mailboxRename(path, newPath);
|
|
225
|
+
return client.imap.mailboxRename(path, newPath);
|
|
211
226
|
}
|
|
212
227
|
async mailboxSubscribe(params, _pinsSettingsList, context) {
|
|
213
228
|
const { client = context.imap, path } = params;
|
|
214
|
-
return client.mailboxSubscribe(path);
|
|
229
|
+
return client.imap.mailboxSubscribe(path);
|
|
215
230
|
}
|
|
216
231
|
async mailboxUnsubscribe(params, _pinsSettingsList, context) {
|
|
217
232
|
const { client = context.imap, path } = params;
|
|
218
|
-
return client.mailboxUnsubscribe(path);
|
|
233
|
+
return client.imap.mailboxUnsubscribe(path);
|
|
219
234
|
}
|
|
220
235
|
async messageCopy(params, _pinsSettingsList, context) {
|
|
221
236
|
const { client = context.imap, range, destination, options = {} } = params;
|
|
222
|
-
return client.messageCopy(range, destination, options);
|
|
237
|
+
return client.imap.messageCopy(range, destination, options);
|
|
223
238
|
}
|
|
224
239
|
async messageDelete(params, _pinsSettingsList, context) {
|
|
225
240
|
const { client = context.imap, range, options = {} } = params;
|
|
226
|
-
return client.messageDelete(range, options);
|
|
241
|
+
return client.imap.messageDelete(range, options);
|
|
227
242
|
}
|
|
228
243
|
async messageFlagsAdd(params, _pinsSettingsList, context) {
|
|
229
244
|
const { client = context.imap, range, flags, options = {} } = params;
|
|
230
|
-
return client.messageFlagsAdd(range, flags, options);
|
|
245
|
+
return client.imap.messageFlagsAdd(range, flags, options);
|
|
231
246
|
}
|
|
232
247
|
async messageFlagsRemove(params, _pinsSettingsList, context) {
|
|
233
248
|
const { client = context.imap, range, flags, options = {} } = params;
|
|
234
|
-
return client.messageFlagsRemove(range, flags, options);
|
|
249
|
+
return client.imap.messageFlagsRemove(range, flags, options);
|
|
235
250
|
}
|
|
236
251
|
async messageFlagsSet(params, _pinsSettingsList, context) {
|
|
237
252
|
const { client = context.imap, range, flags, options = {} } = params;
|
|
238
|
-
return client.messageFlagsSet(range, flags, options);
|
|
253
|
+
return client.imap.messageFlagsSet(range, flags, options);
|
|
239
254
|
}
|
|
240
255
|
async messageMove(params, _pinsSettingsList, context) {
|
|
241
256
|
const { client = context.imap, range, destination, options = {} } = params;
|
|
242
|
-
return client.messageMove(range, destination, options);
|
|
257
|
+
return client.imap.messageMove(range, destination, options);
|
|
243
258
|
}
|
|
244
259
|
async noop(params, _pinsSettingsList, context) {
|
|
245
260
|
const { client = context.imap } = params;
|
|
246
|
-
return client.noop();
|
|
261
|
+
return client.imap.noop();
|
|
247
262
|
}
|
|
248
263
|
async setFlagColor(params, _pinsSettingsList, context) {
|
|
249
264
|
const { client = context.imap, flag, color } = params;
|
|
250
|
-
return client.setFlagColor(flag, color);
|
|
265
|
+
return client.imap.setFlagColor(flag, color);
|
|
251
266
|
}
|
|
252
267
|
async status(params, _pinsSettingsList, context) {
|
|
253
268
|
const { client = context.imap, path, query } = params;
|
|
254
|
-
return client.status(path, query);
|
|
269
|
+
return client.imap.status(path, query);
|
|
255
270
|
}
|
|
256
271
|
async append(params, _pinsSettingsList, context) {
|
|
257
272
|
const { client = context.imap, path, content, flags = [], idate = Date.now() } = params;
|
|
258
|
-
return client.append(path, content, flags, idate);
|
|
273
|
+
return client.imap.append(path, content, flags, idate);
|
|
259
274
|
}
|
|
260
275
|
async close(params, _pinsSettingsList, context) {
|
|
261
276
|
const { client = context.imap } = params;
|
|
262
|
-
|
|
277
|
+
client.forceClose = true;
|
|
278
|
+
return client.imap.close();
|
|
263
279
|
}
|
|
264
280
|
async download(params, _pinsSettingsList, context) {
|
|
265
281
|
const { client = context.imap, range, part, options = {} } = params;
|
|
266
|
-
return client.download(range, part, options);
|
|
282
|
+
return client.imap.download(range, part, options);
|
|
267
283
|
}
|
|
268
284
|
async downloadMany(params, _pinsSettingsList, context) {
|
|
269
285
|
const { client = context.imap, range, parts, options = {} } = params;
|
|
270
|
-
return client.downloadMany(range, parts, options);
|
|
286
|
+
return client.imap.downloadMany(range, parts, options);
|
|
271
287
|
}
|
|
272
288
|
async fetch(params, _pinsSettingsList, context) {
|
|
273
289
|
const { client = context.imap, range, query, options = {} } = params;
|
|
274
|
-
return client.fetch(range, query, options);
|
|
290
|
+
return client.imap.fetch(range, query, options);
|
|
275
291
|
}
|
|
276
292
|
async fetchAll(params, _pinsSettingsList, context) {
|
|
277
293
|
const { client = context.imap, range, query, options = {} } = params;
|
|
278
|
-
return client.fetchAll(range, query, options);
|
|
294
|
+
return client.imap.fetchAll(range, query, options);
|
|
279
295
|
}
|
|
280
296
|
async fetchOne(params, _pinsSettingsList, context) {
|
|
281
297
|
const { client = context.imap, seq, query, options = {} } = params;
|
|
282
|
-
return client.fetchOne(seq, query, options);
|
|
298
|
+
return client.imap.fetchOne(seq, query, options);
|
|
299
|
+
}
|
|
300
|
+
constructor(){
|
|
301
|
+
this.retryCount = 0;
|
|
302
|
+
this.imap = null;
|
|
303
|
+
this.forceClose = false;
|
|
283
304
|
}
|
|
284
305
|
};
|
|
285
306
|
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, nextMatch = nextMatch1, i = i1, {
|
|
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, nextMatch = nextMatch1, i = i1, "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, nextMatch = nextMatch1, i = i1, "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, nextMatch = nextMatch1, i = i1, "continue";
|
|
23951
23951
|
}
|
|
23952
|
-
return
|
|
23952
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
|
|
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,24 @@ 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
|
+
} catch (error) {
|
|
28017
|
+
const skillLogger = require('@digipair/skill-logger');
|
|
28018
|
+
skillLogger.addLog(context, 'ERROR', error.message);
|
|
28019
|
+
}
|
|
28005
28020
|
}
|
|
28006
28021
|
});
|
|
28007
28022
|
client.on('error', async (data)=>{
|
|
28008
28023
|
try {
|
|
28009
28024
|
await executePinsList(error, _extends({}, context, {
|
|
28010
28025
|
error: data,
|
|
28011
|
-
imap:
|
|
28026
|
+
imap: this
|
|
28012
28027
|
}));
|
|
28013
28028
|
} catch (error) {
|
|
28014
28029
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28019,7 +28034,7 @@ let IMapService = class IMapService {
|
|
|
28019
28034
|
try {
|
|
28020
28035
|
await executePinsList(exists, _extends({}, context, {
|
|
28021
28036
|
data,
|
|
28022
|
-
imap:
|
|
28037
|
+
imap: this
|
|
28023
28038
|
}));
|
|
28024
28039
|
} catch (error) {
|
|
28025
28040
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28030,7 +28045,7 @@ let IMapService = class IMapService {
|
|
|
28030
28045
|
try {
|
|
28031
28046
|
await executePinsList(expunge, _extends({}, context, {
|
|
28032
28047
|
data,
|
|
28033
|
-
imap:
|
|
28048
|
+
imap: this
|
|
28034
28049
|
}));
|
|
28035
28050
|
} catch (error) {
|
|
28036
28051
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28041,7 +28056,7 @@ let IMapService = class IMapService {
|
|
|
28041
28056
|
try {
|
|
28042
28057
|
await executePinsList(flags, _extends({}, context, {
|
|
28043
28058
|
data,
|
|
28044
|
-
imap:
|
|
28059
|
+
imap: this
|
|
28045
28060
|
}));
|
|
28046
28061
|
} catch (error) {
|
|
28047
28062
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28052,7 +28067,7 @@ let IMapService = class IMapService {
|
|
|
28052
28067
|
try {
|
|
28053
28068
|
await executePinsList(log, _extends({}, context, {
|
|
28054
28069
|
data,
|
|
28055
|
-
imap:
|
|
28070
|
+
imap: this
|
|
28056
28071
|
}));
|
|
28057
28072
|
} catch (error) {
|
|
28058
28073
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28063,7 +28078,7 @@ let IMapService = class IMapService {
|
|
|
28063
28078
|
try {
|
|
28064
28079
|
await executePinsList(mailboxClose, _extends({}, context, {
|
|
28065
28080
|
data,
|
|
28066
|
-
imap:
|
|
28081
|
+
imap: this
|
|
28067
28082
|
}));
|
|
28068
28083
|
} catch (error) {
|
|
28069
28084
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28074,7 +28089,7 @@ let IMapService = class IMapService {
|
|
|
28074
28089
|
try {
|
|
28075
28090
|
await executePinsList(mailboxOpen, _extends({}, context, {
|
|
28076
28091
|
data,
|
|
28077
|
-
imap:
|
|
28092
|
+
imap: this
|
|
28078
28093
|
}));
|
|
28079
28094
|
} catch (error) {
|
|
28080
28095
|
const skillLogger = require('@digipair/skill-logger');
|
|
@@ -28083,13 +28098,13 @@ let IMapService = class IMapService {
|
|
|
28083
28098
|
});
|
|
28084
28099
|
try {
|
|
28085
28100
|
await executePinsList(load, _extends({}, context, {
|
|
28086
|
-
imap:
|
|
28101
|
+
imap: this
|
|
28087
28102
|
}));
|
|
28088
28103
|
} catch (error) {
|
|
28089
28104
|
const skillLogger = require('@digipair/skill-logger');
|
|
28090
28105
|
skillLogger.addLog(context, 'ERROR', error.message);
|
|
28091
28106
|
}
|
|
28092
|
-
return
|
|
28107
|
+
return this;
|
|
28093
28108
|
}
|
|
28094
28109
|
async parseOne(params, _pinsSettingsList, context) {
|
|
28095
28110
|
const { client = context.imap, message, attachments = 'NONE' } = params;
|
|
@@ -28102,123 +28117,129 @@ let IMapService = class IMapService {
|
|
|
28102
28117
|
}
|
|
28103
28118
|
async search(params, _pinsSettingsList, context) {
|
|
28104
28119
|
const { client = context.imap, query, options = {} } = params;
|
|
28105
|
-
return client.search(query, options);
|
|
28120
|
+
return client.imap.search(query, options);
|
|
28106
28121
|
}
|
|
28107
28122
|
async getMailboxLock(params, _pinsSettingsList, context) {
|
|
28108
28123
|
const { client = context.imap, path = 'INBOX', options = {} } = params;
|
|
28109
|
-
return client.getMailboxLock(path, options);
|
|
28124
|
+
return client.imap.getMailboxLock(path, options);
|
|
28110
28125
|
}
|
|
28111
28126
|
async getQuota(params, _pinsSettingsList, context) {
|
|
28112
28127
|
const { client = context.imap, path } = params;
|
|
28113
|
-
return client.getQuota(path);
|
|
28128
|
+
return client.imap.getQuota(path);
|
|
28114
28129
|
}
|
|
28115
28130
|
async idle(params, _pinsSettingsList, context) {
|
|
28116
28131
|
const { client = context.imap } = params;
|
|
28117
|
-
return client.idle();
|
|
28132
|
+
return client.imap.idle();
|
|
28118
28133
|
}
|
|
28119
28134
|
async list(params, _pinsSettingsList, context) {
|
|
28120
28135
|
const { client = context.imap, options = {} } = params;
|
|
28121
|
-
return client.list(options);
|
|
28136
|
+
return client.imap.list(options);
|
|
28122
28137
|
}
|
|
28123
28138
|
async listTree(params, _pinsSettingsList, context) {
|
|
28124
28139
|
const { client = context.imap, options = {} } = params;
|
|
28125
|
-
return client.listTree(options);
|
|
28140
|
+
return client.imap.listTree(options);
|
|
28126
28141
|
}
|
|
28127
28142
|
async logout(params, _pinsSettingsList, context) {
|
|
28128
28143
|
const { client = context.imap } = params;
|
|
28129
|
-
return client.logout();
|
|
28144
|
+
return client.imap.logout();
|
|
28130
28145
|
}
|
|
28131
28146
|
async mailboxClose(params, _pinsSettingsList, context) {
|
|
28132
28147
|
const { client = context.imap } = params;
|
|
28133
|
-
return client.mailboxClose();
|
|
28148
|
+
return client.imap.mailboxClose();
|
|
28134
28149
|
}
|
|
28135
28150
|
async mailboxCreate(params, _pinsSettingsList, context) {
|
|
28136
28151
|
const { client = context.imap, path } = params;
|
|
28137
|
-
return client.mailboxCreate(path);
|
|
28152
|
+
return client.imap.mailboxCreate(path);
|
|
28138
28153
|
}
|
|
28139
28154
|
async mailboxDelete(params, _pinsSettingsList, context) {
|
|
28140
28155
|
const { client = context.imap, path } = params;
|
|
28141
|
-
return client.mailboxDelete(path);
|
|
28156
|
+
return client.imap.mailboxDelete(path);
|
|
28142
28157
|
}
|
|
28143
28158
|
async mailboxOpen(params, _pinsSettingsList, context) {
|
|
28144
28159
|
const { client = context.imap, path = 'INBOX', options = {} } = params;
|
|
28145
|
-
return client.mailboxOpen(path, options);
|
|
28160
|
+
return client.imap.mailboxOpen(path, options);
|
|
28146
28161
|
}
|
|
28147
28162
|
async mailboxRename(params, _pinsSettingsList, context) {
|
|
28148
28163
|
const { client = context.imap, path, newPath } = params;
|
|
28149
|
-
return client.mailboxRename(path, newPath);
|
|
28164
|
+
return client.imap.mailboxRename(path, newPath);
|
|
28150
28165
|
}
|
|
28151
28166
|
async mailboxSubscribe(params, _pinsSettingsList, context) {
|
|
28152
28167
|
const { client = context.imap, path } = params;
|
|
28153
|
-
return client.mailboxSubscribe(path);
|
|
28168
|
+
return client.imap.mailboxSubscribe(path);
|
|
28154
28169
|
}
|
|
28155
28170
|
async mailboxUnsubscribe(params, _pinsSettingsList, context) {
|
|
28156
28171
|
const { client = context.imap, path } = params;
|
|
28157
|
-
return client.mailboxUnsubscribe(path);
|
|
28172
|
+
return client.imap.mailboxUnsubscribe(path);
|
|
28158
28173
|
}
|
|
28159
28174
|
async messageCopy(params, _pinsSettingsList, context) {
|
|
28160
28175
|
const { client = context.imap, range, destination, options = {} } = params;
|
|
28161
|
-
return client.messageCopy(range, destination, options);
|
|
28176
|
+
return client.imap.messageCopy(range, destination, options);
|
|
28162
28177
|
}
|
|
28163
28178
|
async messageDelete(params, _pinsSettingsList, context) {
|
|
28164
28179
|
const { client = context.imap, range, options = {} } = params;
|
|
28165
|
-
return client.messageDelete(range, options);
|
|
28180
|
+
return client.imap.messageDelete(range, options);
|
|
28166
28181
|
}
|
|
28167
28182
|
async messageFlagsAdd(params, _pinsSettingsList, context) {
|
|
28168
28183
|
const { client = context.imap, range, flags, options = {} } = params;
|
|
28169
|
-
return client.messageFlagsAdd(range, flags, options);
|
|
28184
|
+
return client.imap.messageFlagsAdd(range, flags, options);
|
|
28170
28185
|
}
|
|
28171
28186
|
async messageFlagsRemove(params, _pinsSettingsList, context) {
|
|
28172
28187
|
const { client = context.imap, range, flags, options = {} } = params;
|
|
28173
|
-
return client.messageFlagsRemove(range, flags, options);
|
|
28188
|
+
return client.imap.messageFlagsRemove(range, flags, options);
|
|
28174
28189
|
}
|
|
28175
28190
|
async messageFlagsSet(params, _pinsSettingsList, context) {
|
|
28176
28191
|
const { client = context.imap, range, flags, options = {} } = params;
|
|
28177
|
-
return client.messageFlagsSet(range, flags, options);
|
|
28192
|
+
return client.imap.messageFlagsSet(range, flags, options);
|
|
28178
28193
|
}
|
|
28179
28194
|
async messageMove(params, _pinsSettingsList, context) {
|
|
28180
28195
|
const { client = context.imap, range, destination, options = {} } = params;
|
|
28181
|
-
return client.messageMove(range, destination, options);
|
|
28196
|
+
return client.imap.messageMove(range, destination, options);
|
|
28182
28197
|
}
|
|
28183
28198
|
async noop(params, _pinsSettingsList, context) {
|
|
28184
28199
|
const { client = context.imap } = params;
|
|
28185
|
-
return client.noop();
|
|
28200
|
+
return client.imap.noop();
|
|
28186
28201
|
}
|
|
28187
28202
|
async setFlagColor(params, _pinsSettingsList, context) {
|
|
28188
28203
|
const { client = context.imap, flag, color } = params;
|
|
28189
|
-
return client.setFlagColor(flag, color);
|
|
28204
|
+
return client.imap.setFlagColor(flag, color);
|
|
28190
28205
|
}
|
|
28191
28206
|
async status(params, _pinsSettingsList, context) {
|
|
28192
28207
|
const { client = context.imap, path, query } = params;
|
|
28193
|
-
return client.status(path, query);
|
|
28208
|
+
return client.imap.status(path, query);
|
|
28194
28209
|
}
|
|
28195
28210
|
async append(params, _pinsSettingsList, context) {
|
|
28196
28211
|
const { client = context.imap, path, content, flags = [], idate = Date.now() } = params;
|
|
28197
|
-
return client.append(path, content, flags, idate);
|
|
28212
|
+
return client.imap.append(path, content, flags, idate);
|
|
28198
28213
|
}
|
|
28199
28214
|
async close(params, _pinsSettingsList, context) {
|
|
28200
28215
|
const { client = context.imap } = params;
|
|
28201
|
-
|
|
28216
|
+
client.forceClose = true;
|
|
28217
|
+
return client.imap.close();
|
|
28202
28218
|
}
|
|
28203
28219
|
async download(params, _pinsSettingsList, context) {
|
|
28204
28220
|
const { client = context.imap, range, part, options = {} } = params;
|
|
28205
|
-
return client.download(range, part, options);
|
|
28221
|
+
return client.imap.download(range, part, options);
|
|
28206
28222
|
}
|
|
28207
28223
|
async downloadMany(params, _pinsSettingsList, context) {
|
|
28208
28224
|
const { client = context.imap, range, parts, options = {} } = params;
|
|
28209
|
-
return client.downloadMany(range, parts, options);
|
|
28225
|
+
return client.imap.downloadMany(range, parts, options);
|
|
28210
28226
|
}
|
|
28211
28227
|
async fetch(params, _pinsSettingsList, context) {
|
|
28212
28228
|
const { client = context.imap, range, query, options = {} } = params;
|
|
28213
|
-
return client.fetch(range, query, options);
|
|
28229
|
+
return client.imap.fetch(range, query, options);
|
|
28214
28230
|
}
|
|
28215
28231
|
async fetchAll(params, _pinsSettingsList, context) {
|
|
28216
28232
|
const { client = context.imap, range, query, options = {} } = params;
|
|
28217
|
-
return client.fetchAll(range, query, options);
|
|
28233
|
+
return client.imap.fetchAll(range, query, options);
|
|
28218
28234
|
}
|
|
28219
28235
|
async fetchOne(params, _pinsSettingsList, context) {
|
|
28220
28236
|
const { client = context.imap, seq, query, options = {} } = params;
|
|
28221
|
-
return client.fetchOne(seq, query, options);
|
|
28237
|
+
return client.imap.fetchOne(seq, query, options);
|
|
28238
|
+
}
|
|
28239
|
+
constructor(){
|
|
28240
|
+
this.retryCount = 0;
|
|
28241
|
+
this.imap = null;
|
|
28242
|
+
this.forceClose = false;
|
|
28222
28243
|
}
|
|
28223
28244
|
};
|
|
28224
28245
|
const connect = (params, pinsSettingsList, context)=>new IMapService().connect(params, pinsSettingsList, context);
|