polikolog 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/.idea/5lab.iml +12 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +10 -0
  3. package/.idea/jsLibraryMappings.xml +6 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/vcs.xml +6 -0
  6. package/06-02.js +48 -0
  7. package/06-03.js +22 -0
  8. package/06-04.js +22 -0
  9. package/index.html +41 -0
  10. package/m0603.js +28 -0
  11. package/mypackage/m0603.js +28 -0
  12. package/mypackage/node_modules/.package-lock.json +24 -0
  13. package/mypackage/node_modules/nodemailer/.gitattributes +6 -0
  14. package/mypackage/node_modules/nodemailer/.prettierrc.js +8 -0
  15. package/mypackage/node_modules/nodemailer/CHANGELOG.md +725 -0
  16. package/mypackage/node_modules/nodemailer/CODE_OF_CONDUCT.md +76 -0
  17. package/mypackage/node_modules/nodemailer/CONTRIBUTING.md +67 -0
  18. package/mypackage/node_modules/nodemailer/LICENSE +16 -0
  19. package/mypackage/node_modules/nodemailer/README.md +97 -0
  20. package/mypackage/node_modules/nodemailer/SECURITY.txt +22 -0
  21. package/mypackage/node_modules/nodemailer/lib/addressparser/index.js +313 -0
  22. package/mypackage/node_modules/nodemailer/lib/base64/index.js +142 -0
  23. package/mypackage/node_modules/nodemailer/lib/dkim/index.js +251 -0
  24. package/mypackage/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
  25. package/mypackage/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
  26. package/mypackage/node_modules/nodemailer/lib/dkim/sign.js +117 -0
  27. package/mypackage/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
  28. package/mypackage/node_modules/nodemailer/lib/fetch/index.js +274 -0
  29. package/mypackage/node_modules/nodemailer/lib/json-transport/index.js +82 -0
  30. package/mypackage/node_modules/nodemailer/lib/mail-composer/index.js +558 -0
  31. package/mypackage/node_modules/nodemailer/lib/mailer/index.js +427 -0
  32. package/mypackage/node_modules/nodemailer/lib/mailer/mail-message.js +315 -0
  33. package/mypackage/node_modules/nodemailer/lib/mime-funcs/index.js +625 -0
  34. package/mypackage/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2102 -0
  35. package/mypackage/node_modules/nodemailer/lib/mime-node/index.js +1290 -0
  36. package/mypackage/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
  37. package/mypackage/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
  38. package/mypackage/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
  39. package/mypackage/node_modules/nodemailer/lib/nodemailer.js +143 -0
  40. package/mypackage/node_modules/nodemailer/lib/qp/index.js +219 -0
  41. package/mypackage/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
  42. package/mypackage/node_modules/nodemailer/lib/ses-transport/index.js +349 -0
  43. package/mypackage/node_modules/nodemailer/lib/shared/index.js +638 -0
  44. package/mypackage/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
  45. package/mypackage/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
  46. package/mypackage/node_modules/nodemailer/lib/smtp-connection/index.js +1796 -0
  47. package/mypackage/node_modules/nodemailer/lib/smtp-pool/index.js +648 -0
  48. package/mypackage/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +253 -0
  49. package/mypackage/node_modules/nodemailer/lib/smtp-transport/index.js +416 -0
  50. package/mypackage/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
  51. package/mypackage/node_modules/nodemailer/lib/well-known/index.js +47 -0
  52. package/mypackage/node_modules/nodemailer/lib/well-known/services.json +286 -0
  53. package/mypackage/node_modules/nodemailer/lib/xoauth2/index.js +376 -0
  54. package/mypackage/node_modules/nodemailer/package.json +46 -0
  55. package/mypackage/node_modules/nodemailer/postinstall.js +101 -0
  56. package/mypackage/package.json +15 -0
  57. package/package.json +15 -0
@@ -0,0 +1,315 @@
1
+ 'use strict';
2
+
3
+ const shared = require('../shared');
4
+ const MimeNode = require('../mime-node');
5
+ const mimeFuncs = require('../mime-funcs');
6
+
7
+ class MailMessage {
8
+ constructor(mailer, data) {
9
+ this.mailer = mailer;
10
+ this.data = {};
11
+ this.message = null;
12
+
13
+ data = data || {};
14
+ let options = mailer.options || {};
15
+ let defaults = mailer._defaults || {};
16
+
17
+ Object.keys(data).forEach(key => {
18
+ this.data[key] = data[key];
19
+ });
20
+
21
+ this.data.headers = this.data.headers || {};
22
+
23
+ // apply defaults
24
+ Object.keys(defaults).forEach(key => {
25
+ if (!(key in this.data)) {
26
+ this.data[key] = defaults[key];
27
+ } else if (key === 'headers') {
28
+ // headers is a special case. Allow setting individual default headers
29
+ Object.keys(defaults.headers).forEach(key => {
30
+ if (!(key in this.data.headers)) {
31
+ this.data.headers[key] = defaults.headers[key];
32
+ }
33
+ });
34
+ }
35
+ });
36
+
37
+ // force specific keys from transporter options
38
+ ['disableFileAccess', 'disableUrlAccess', 'normalizeHeaderKey'].forEach(key => {
39
+ if (key in options) {
40
+ this.data[key] = options[key];
41
+ }
42
+ });
43
+ }
44
+
45
+ resolveContent(...args) {
46
+ return shared.resolveContent(...args);
47
+ }
48
+
49
+ resolveAll(callback) {
50
+ let keys = [
51
+ [this.data, 'html'],
52
+ [this.data, 'text'],
53
+ [this.data, 'watchHtml'],
54
+ [this.data, 'amp'],
55
+ [this.data, 'icalEvent']
56
+ ];
57
+
58
+ if (this.data.alternatives && this.data.alternatives.length) {
59
+ this.data.alternatives.forEach((alternative, i) => {
60
+ keys.push([this.data.alternatives, i]);
61
+ });
62
+ }
63
+
64
+ if (this.data.attachments && this.data.attachments.length) {
65
+ this.data.attachments.forEach((attachment, i) => {
66
+ if (!attachment.filename) {
67
+ attachment.filename = (attachment.path || attachment.href || '').split('/').pop().split('?').shift() || 'attachment-' + (i + 1);
68
+ if (attachment.filename.indexOf('.') < 0) {
69
+ attachment.filename += '.' + mimeFuncs.detectExtension(attachment.contentType);
70
+ }
71
+ }
72
+
73
+ if (!attachment.contentType) {
74
+ attachment.contentType = mimeFuncs.detectMimeType(attachment.filename || attachment.path || attachment.href || 'bin');
75
+ }
76
+
77
+ keys.push([this.data.attachments, i]);
78
+ });
79
+ }
80
+
81
+ let mimeNode = new MimeNode();
82
+
83
+ let addressKeys = ['from', 'to', 'cc', 'bcc', 'sender', 'replyTo'];
84
+
85
+ addressKeys.forEach(address => {
86
+ let value;
87
+ if (this.message) {
88
+ value = [].concat(mimeNode._parseAddresses(this.message.getHeader(address === 'replyTo' ? 'reply-to' : address)) || []);
89
+ } else if (this.data[address]) {
90
+ value = [].concat(mimeNode._parseAddresses(this.data[address]) || []);
91
+ }
92
+ if (value && value.length) {
93
+ this.data[address] = value;
94
+ } else if (address in this.data) {
95
+ this.data[address] = null;
96
+ }
97
+ });
98
+
99
+ let singleKeys = ['from', 'sender'];
100
+ singleKeys.forEach(address => {
101
+ if (this.data[address]) {
102
+ this.data[address] = this.data[address].shift();
103
+ }
104
+ });
105
+
106
+ let pos = 0;
107
+ let resolveNext = () => {
108
+ if (pos >= keys.length) {
109
+ return callback(null, this.data);
110
+ }
111
+ let args = keys[pos++];
112
+ if (!args[0] || !args[0][args[1]]) {
113
+ return resolveNext();
114
+ }
115
+ shared.resolveContent(...args, (err, value) => {
116
+ if (err) {
117
+ return callback(err);
118
+ }
119
+
120
+ let node = {
121
+ content: value
122
+ };
123
+ if (args[0][args[1]] && typeof args[0][args[1]] === 'object' && !Buffer.isBuffer(args[0][args[1]])) {
124
+ Object.keys(args[0][args[1]]).forEach(key => {
125
+ if (!(key in node) && !['content', 'path', 'href', 'raw'].includes(key)) {
126
+ node[key] = args[0][args[1]][key];
127
+ }
128
+ });
129
+ }
130
+
131
+ args[0][args[1]] = node;
132
+ resolveNext();
133
+ });
134
+ };
135
+
136
+ setImmediate(() => resolveNext());
137
+ }
138
+
139
+ normalize(callback) {
140
+ let envelope = this.data.envelope || this.message.getEnvelope();
141
+ let messageId = this.message.messageId();
142
+
143
+ this.resolveAll((err, data) => {
144
+ if (err) {
145
+ return callback(err);
146
+ }
147
+
148
+ data.envelope = envelope;
149
+ data.messageId = messageId;
150
+
151
+ ['html', 'text', 'watchHtml', 'amp'].forEach(key => {
152
+ if (data[key] && data[key].content) {
153
+ if (typeof data[key].content === 'string') {
154
+ data[key] = data[key].content;
155
+ } else if (Buffer.isBuffer(data[key].content)) {
156
+ data[key] = data[key].content.toString();
157
+ }
158
+ }
159
+ });
160
+
161
+ if (data.icalEvent && Buffer.isBuffer(data.icalEvent.content)) {
162
+ data.icalEvent.content = data.icalEvent.content.toString('base64');
163
+ data.icalEvent.encoding = 'base64';
164
+ }
165
+
166
+ if (data.alternatives && data.alternatives.length) {
167
+ data.alternatives.forEach(alternative => {
168
+ if (alternative && alternative.content && Buffer.isBuffer(alternative.content)) {
169
+ alternative.content = alternative.content.toString('base64');
170
+ alternative.encoding = 'base64';
171
+ }
172
+ });
173
+ }
174
+
175
+ if (data.attachments && data.attachments.length) {
176
+ data.attachments.forEach(attachment => {
177
+ if (attachment && attachment.content && Buffer.isBuffer(attachment.content)) {
178
+ attachment.content = attachment.content.toString('base64');
179
+ attachment.encoding = 'base64';
180
+ }
181
+ });
182
+ }
183
+
184
+ data.normalizedHeaders = {};
185
+ Object.keys(data.headers || {}).forEach(key => {
186
+ let value = [].concat(data.headers[key] || []).shift();
187
+ value = (value && value.value) || value;
188
+ if (value) {
189
+ if (['references', 'in-reply-to', 'message-id', 'content-id'].includes(key)) {
190
+ value = this.message._encodeHeaderValue(key, value);
191
+ }
192
+ data.normalizedHeaders[key] = value;
193
+ }
194
+ });
195
+
196
+ if (data.list && typeof data.list === 'object') {
197
+ let listHeaders = this._getListHeaders(data.list);
198
+ listHeaders.forEach(entry => {
199
+ data.normalizedHeaders[entry.key] = entry.value.map(val => (val && val.value) || val).join(', ');
200
+ });
201
+ }
202
+
203
+ if (data.references) {
204
+ data.normalizedHeaders.references = this.message._encodeHeaderValue('references', data.references);
205
+ }
206
+
207
+ if (data.inReplyTo) {
208
+ data.normalizedHeaders['in-reply-to'] = this.message._encodeHeaderValue('in-reply-to', data.inReplyTo);
209
+ }
210
+
211
+ return callback(null, data);
212
+ });
213
+ }
214
+
215
+ setMailerHeader() {
216
+ if (!this.message || !this.data.xMailer) {
217
+ return;
218
+ }
219
+ this.message.setHeader('X-Mailer', this.data.xMailer);
220
+ }
221
+
222
+ setPriorityHeaders() {
223
+ if (!this.message || !this.data.priority) {
224
+ return;
225
+ }
226
+ switch ((this.data.priority || '').toString().toLowerCase()) {
227
+ case 'high':
228
+ this.message.setHeader('X-Priority', '1 (Highest)');
229
+ this.message.setHeader('X-MSMail-Priority', 'High');
230
+ this.message.setHeader('Importance', 'High');
231
+ break;
232
+ case 'low':
233
+ this.message.setHeader('X-Priority', '5 (Lowest)');
234
+ this.message.setHeader('X-MSMail-Priority', 'Low');
235
+ this.message.setHeader('Importance', 'Low');
236
+ break;
237
+ default:
238
+ // do not add anything, since all messages are 'Normal' by default
239
+ }
240
+ }
241
+
242
+ setListHeaders() {
243
+ if (!this.message || !this.data.list || typeof this.data.list !== 'object') {
244
+ return;
245
+ }
246
+ // add optional List-* headers
247
+ if (this.data.list && typeof this.data.list === 'object') {
248
+ this._getListHeaders(this.data.list).forEach(listHeader => {
249
+ listHeader.value.forEach(value => {
250
+ this.message.addHeader(listHeader.key, value);
251
+ });
252
+ });
253
+ }
254
+ }
255
+
256
+ _getListHeaders(listData) {
257
+ // make sure an url looks like <protocol:url>
258
+ return Object.keys(listData).map(key => ({
259
+ key: 'list-' + key.toLowerCase().trim(),
260
+ value: [].concat(listData[key] || []).map(value => ({
261
+ prepared: true,
262
+ foldLines: true,
263
+ value: []
264
+ .concat(value || [])
265
+ .map(value => {
266
+ if (typeof value === 'string') {
267
+ value = {
268
+ url: value
269
+ };
270
+ }
271
+
272
+ if (value && value.url) {
273
+ if (key.toLowerCase().trim() === 'id') {
274
+ // List-ID: "comment" <domain>
275
+ let comment = value.comment || '';
276
+ if (mimeFuncs.isPlainText(comment)) {
277
+ comment = '"' + comment + '"';
278
+ } else {
279
+ comment = mimeFuncs.encodeWord(comment);
280
+ }
281
+
282
+ return (value.comment ? comment + ' ' : '') + this._formatListUrl(value.url).replace(/^<[^:]+\/{,2}/, '');
283
+ }
284
+
285
+ // List-*: <http://domain> (comment)
286
+ let comment = value.comment || '';
287
+ if (!mimeFuncs.isPlainText(comment)) {
288
+ comment = mimeFuncs.encodeWord(comment);
289
+ }
290
+
291
+ return this._formatListUrl(value.url) + (value.comment ? ' (' + comment + ')' : '');
292
+ }
293
+
294
+ return '';
295
+ })
296
+ .filter(value => value)
297
+ .join(', ')
298
+ }))
299
+ }));
300
+ }
301
+
302
+ _formatListUrl(url) {
303
+ url = url.replace(/[\s<]+|[\s>]+/g, '');
304
+ if (/^(https?|mailto|ftp):/.test(url)) {
305
+ return '<' + url + '>';
306
+ }
307
+ if (/^[^@]+@[^@]+$/.test(url)) {
308
+ return '<mailto:' + url + '>';
309
+ }
310
+
311
+ return '<http://' + url + '>';
312
+ }
313
+ }
314
+
315
+ module.exports = MailMessage;