@jjrawlins/cdk-iam-policy-builder-helper 0.0.4 → 0.0.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.
Files changed (54) hide show
  1. package/.jsii +210 -62
  2. package/.mergify.yml +60 -0
  3. package/jjrawlinscdkiampolicybuilderhelper/jsii/jsii.go +2 -2
  4. package/jjrawlinscdkiampolicybuilderhelper/version +1 -1
  5. package/lib/constructs/Actions.d.ts +799 -61
  6. package/lib/constructs/Actions.js +800 -62
  7. package/methods_list.txt +19274 -0
  8. package/node_modules/axios/CHANGELOG.md +257 -0
  9. package/node_modules/axios/README.md +71 -87
  10. package/node_modules/axios/dist/axios.js +303 -235
  11. package/node_modules/axios/dist/axios.js.map +1 -1
  12. package/node_modules/axios/dist/axios.min.js +2 -1
  13. package/node_modules/axios/dist/axios.min.js.map +1 -1
  14. package/node_modules/axios/dist/browser/axios.cjs +230 -177
  15. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  16. package/node_modules/axios/dist/esm/axios.js +230 -177
  17. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  18. package/node_modules/axios/dist/esm/axios.min.js +2 -1
  19. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  20. package/node_modules/axios/dist/node/axios.cjs +268 -187
  21. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  22. package/node_modules/axios/index.d.cts +22 -6
  23. package/node_modules/axios/index.d.ts +14 -4
  24. package/node_modules/axios/lib/adapters/fetch.js +22 -22
  25. package/node_modules/axios/lib/adapters/http.js +7 -7
  26. package/node_modules/axios/lib/cancel/CancelToken.js +14 -0
  27. package/node_modules/axios/lib/core/Axios.js +20 -6
  28. package/node_modules/axios/lib/core/AxiosError.js +5 -2
  29. package/node_modules/axios/lib/core/AxiosHeaders.js +15 -3
  30. package/node_modules/axios/lib/core/buildFullPath.js +3 -2
  31. package/node_modules/axios/lib/core/mergeConfig.js +6 -6
  32. package/node_modules/axios/lib/env/data.js +1 -1
  33. package/node_modules/axios/lib/helpers/buildURL.js +7 -1
  34. package/node_modules/axios/lib/helpers/composeSignals.js +31 -29
  35. package/node_modules/axios/lib/helpers/formDataToStream.js +6 -5
  36. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +12 -65
  37. package/node_modules/axios/lib/helpers/resolveConfig.js +1 -1
  38. package/node_modules/axios/lib/helpers/throttle.js +1 -1
  39. package/node_modules/axios/lib/helpers/toFormData.js +4 -0
  40. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +4 -3
  41. package/node_modules/axios/lib/helpers/trackStream.js +25 -5
  42. package/node_modules/axios/lib/helpers/validator.js +8 -0
  43. package/node_modules/axios/lib/platform/common/utils.js +5 -4
  44. package/node_modules/axios/lib/platform/node/index.js +26 -0
  45. package/node_modules/axios/lib/utils.js +48 -28
  46. package/node_modules/axios/package.json +14 -5
  47. package/node_modules/form-data/CHANGELOG.md +601 -0
  48. package/node_modules/form-data/{Readme.md → README.md} +34 -37
  49. package/node_modules/form-data/lib/browser.js +3 -1
  50. package/node_modules/form-data/lib/form_data.js +126 -135
  51. package/node_modules/form-data/lib/populate.js +5 -5
  52. package/node_modules/form-data/package.json +24 -16
  53. package/package.json +15 -10
  54. package/node_modules/axios/SECURITY.md +0 -6
@@ -1,3 +1,5 @@
1
+ 'use strict';
2
+
1
3
  var CombinedStream = require('combined-stream');
2
4
  var util = require('util');
3
5
  var path = require('path');
@@ -6,24 +8,20 @@ var https = require('https');
6
8
  var parseUrl = require('url').parse;
7
9
  var fs = require('fs');
8
10
  var Stream = require('stream').Stream;
11
+ var crypto = require('crypto');
9
12
  var mime = require('mime-types');
10
13
  var asynckit = require('asynckit');
11
14
  var setToStringTag = require('es-set-tostringtag');
15
+ var hasOwn = require('hasown');
12
16
  var populate = require('./populate.js');
13
17
 
14
- // Public API
15
- module.exports = FormData;
16
-
17
- // make it a Stream
18
- util.inherits(FormData, CombinedStream);
19
-
20
18
  /**
21
19
  * Create readable "multipart/form-data" streams.
22
20
  * Can be used to submit forms
23
21
  * and file uploads to other web applications.
24
22
  *
25
23
  * @constructor
26
- * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
24
+ * @param {object} options - Properties to be added/overriden for FormData and CombinedStream
27
25
  */
28
26
  function FormData(options) {
29
27
  if (!(this instanceof FormData)) {
@@ -36,35 +34,39 @@ function FormData(options) {
36
34
 
37
35
  CombinedStream.call(this);
38
36
 
39
- options = options || {};
40
- for (var option in options) {
37
+ options = options || {}; // eslint-disable-line no-param-reassign
38
+ for (var option in options) { // eslint-disable-line no-restricted-syntax
41
39
  this[option] = options[option];
42
40
  }
43
41
  }
44
42
 
43
+ // make it a Stream
44
+ util.inherits(FormData, CombinedStream);
45
+
45
46
  FormData.LINE_BREAK = '\r\n';
46
47
  FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
47
48
 
48
- FormData.prototype.append = function(field, value, options) {
49
-
50
- options = options || {};
49
+ FormData.prototype.append = function (field, value, options) {
50
+ options = options || {}; // eslint-disable-line no-param-reassign
51
51
 
52
52
  // allow filename as single option
53
- if (typeof options == 'string') {
54
- options = {filename: options};
53
+ if (typeof options === 'string') {
54
+ options = { filename: options }; // eslint-disable-line no-param-reassign
55
55
  }
56
56
 
57
57
  var append = CombinedStream.prototype.append.bind(this);
58
58
 
59
59
  // all that streamy business can't handle numbers
60
- if (typeof value == 'number') {
61
- value = '' + value;
60
+ if (typeof value === 'number' || value == null) {
61
+ value = String(value); // eslint-disable-line no-param-reassign
62
62
  }
63
63
 
64
64
  // https://github.com/felixge/node-form-data/issues/38
65
65
  if (Array.isArray(value)) {
66
- // Please convert your array into string
67
- // the way web server expects it
66
+ /*
67
+ * Please convert your array into string
68
+ * the way web server expects it
69
+ */
68
70
  this._error(new Error('Arrays are not supported.'));
69
71
  return;
70
72
  }
@@ -80,15 +82,17 @@ FormData.prototype.append = function(field, value, options) {
80
82
  this._trackLength(header, value, options);
81
83
  };
82
84
 
83
- FormData.prototype._trackLength = function(header, value, options) {
85
+ FormData.prototype._trackLength = function (header, value, options) {
84
86
  var valueLength = 0;
85
87
 
86
- // used w/ getLengthSync(), when length is known.
87
- // e.g. for streaming directly from a remote server,
88
- // w/ a known file a size, and not wanting to wait for
89
- // incoming file to finish to get its size.
88
+ /*
89
+ * used w/ getLengthSync(), when length is known.
90
+ * e.g. for streaming directly from a remote server,
91
+ * w/ a known file a size, and not wanting to wait for
92
+ * incoming file to finish to get its size.
93
+ */
90
94
  if (options.knownLength != null) {
91
- valueLength += +options.knownLength;
95
+ valueLength += Number(options.knownLength);
92
96
  } else if (Buffer.isBuffer(value)) {
93
97
  valueLength = value.length;
94
98
  } else if (typeof value === 'string') {
@@ -98,12 +102,10 @@ FormData.prototype._trackLength = function(header, value, options) {
98
102
  this._valueLength += valueLength;
99
103
 
100
104
  // @check why add CRLF? does this account for custom/multiple CRLFs?
101
- this._overheadLength +=
102
- Buffer.byteLength(header) +
103
- FormData.LINE_BREAK.length;
105
+ this._overheadLength += Buffer.byteLength(header) + FormData.LINE_BREAK.length;
104
106
 
105
107
  // empty or either doesn't have path or not an http response or not a stream
106
- if (!value || ( !value.path && !(value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) && !(value instanceof Stream))) {
108
+ if (!value || (!value.path && !(value.readable && hasOwn(value, 'httpVersion')) && !(value instanceof Stream))) {
107
109
  return;
108
110
  }
109
111
 
@@ -113,9 +115,8 @@ FormData.prototype._trackLength = function(header, value, options) {
113
115
  }
114
116
  };
115
117
 
116
- FormData.prototype._lengthRetriever = function(value, callback) {
117
- if (Object.prototype.hasOwnProperty.call(value, 'fd')) {
118
-
118
+ FormData.prototype._lengthRetriever = function (value, callback) {
119
+ if (hasOwn(value, 'fd')) {
119
120
  // take read range into a account
120
121
  // `end` = Infinity –> read file till the end
121
122
  //
@@ -124,54 +125,52 @@ FormData.prototype._lengthRetriever = function(value, callback) {
124
125
  // Fix it when node fixes it.
125
126
  // https://github.com/joyent/node/issues/7819
126
127
  if (value.end != undefined && value.end != Infinity && value.start != undefined) {
127
-
128
128
  // when end specified
129
129
  // no need to calculate range
130
130
  // inclusive, starts with 0
131
- callback(null, value.end + 1 - (value.start ? value.start : 0));
131
+ callback(null, value.end + 1 - (value.start ? value.start : 0)); // eslint-disable-line callback-return
132
132
 
133
- // not that fast snoopy
133
+ // not that fast snoopy
134
134
  } else {
135
135
  // still need to fetch file size from fs
136
- fs.stat(value.path, function(err, stat) {
137
-
138
- var fileSize;
139
-
136
+ fs.stat(value.path, function (err, stat) {
140
137
  if (err) {
141
138
  callback(err);
142
139
  return;
143
140
  }
144
141
 
145
142
  // update final size based on the range options
146
- fileSize = stat.size - (value.start ? value.start : 0);
143
+ var fileSize = stat.size - (value.start ? value.start : 0);
147
144
  callback(null, fileSize);
148
145
  });
149
146
  }
150
147
 
151
- // or http response
152
- } else if (Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
153
- callback(null, +value.headers['content-length']);
148
+ // or http response
149
+ } else if (hasOwn(value, 'httpVersion')) {
150
+ callback(null, Number(value.headers['content-length'])); // eslint-disable-line callback-return
154
151
 
155
- // or request stream http://github.com/mikeal/request
156
- } else if (Object.prototype.hasOwnProperty.call(value, 'httpModule')) {
152
+ // or request stream http://github.com/mikeal/request
153
+ } else if (hasOwn(value, 'httpModule')) {
157
154
  // wait till response come back
158
- value.on('response', function(response) {
155
+ value.on('response', function (response) {
159
156
  value.pause();
160
- callback(null, +response.headers['content-length']);
157
+ callback(null, Number(response.headers['content-length']));
161
158
  });
162
159
  value.resume();
163
160
 
164
- // something else
161
+ // something else
165
162
  } else {
166
- callback('Unknown stream');
163
+ callback('Unknown stream'); // eslint-disable-line callback-return
167
164
  }
168
165
  };
169
166
 
170
- FormData.prototype._multiPartHeader = function(field, value, options) {
171
- // custom header specified (as string)?
172
- // it becomes responsible for boundary
173
- // (e.g. to handle extra CRLFs on .NET servers)
174
- if (typeof options.header == 'string') {
167
+ FormData.prototype._multiPartHeader = function (field, value, options) {
168
+ /*
169
+ * custom header specified (as string)?
170
+ * it becomes responsible for boundary
171
+ * (e.g. to handle extra CRLFs on .NET servers)
172
+ */
173
+ if (typeof options.header === 'string') {
175
174
  return options.header;
176
175
  }
177
176
 
@@ -179,7 +178,7 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
179
178
  var contentType = this._getContentType(value, options);
180
179
 
181
180
  var contents = '';
182
- var headers = {
181
+ var headers = {
183
182
  // add custom disposition as third element or keep it two elements if not
184
183
  'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
185
184
  // if no content type. allow it to be empty array
@@ -187,18 +186,18 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
187
186
  };
188
187
 
189
188
  // allow custom headers.
190
- if (typeof options.header == 'object') {
189
+ if (typeof options.header === 'object') {
191
190
  populate(headers, options.header);
192
191
  }
193
192
 
194
193
  var header;
195
- for (var prop in headers) {
196
- if (Object.prototype.hasOwnProperty.call(headers, prop)) {
194
+ for (var prop in headers) { // eslint-disable-line no-restricted-syntax
195
+ if (hasOwn(headers, prop)) {
197
196
  header = headers[prop];
198
197
 
199
198
  // skip nullish headers.
200
199
  if (header == null) {
201
- continue;
200
+ continue; // eslint-disable-line no-restricted-syntax, no-continue
202
201
  }
203
202
 
204
203
  // convert all headers to arrays.
@@ -216,49 +215,45 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
216
215
  return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
217
216
  };
218
217
 
219
- FormData.prototype._getContentDisposition = function(value, options) {
220
-
221
- var filename
222
- , contentDisposition
223
- ;
218
+ FormData.prototype._getContentDisposition = function (value, options) { // eslint-disable-line consistent-return
219
+ var filename;
224
220
 
225
221
  if (typeof options.filepath === 'string') {
226
222
  // custom filepath for relative paths
227
223
  filename = path.normalize(options.filepath).replace(/\\/g, '/');
228
- } else if (options.filename || value.name || value.path) {
229
- // custom filename take precedence
230
- // formidable and the browser add a name property
231
- // fs- and request- streams have path property
232
- filename = path.basename(options.filename || value.name || value.path);
233
- } else if (value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
224
+ } else if (options.filename || (value && (value.name || value.path))) {
225
+ /*
226
+ * custom filename take precedence
227
+ * formidable and the browser add a name property
228
+ * fs- and request- streams have path property
229
+ */
230
+ filename = path.basename(options.filename || (value && (value.name || value.path)));
231
+ } else if (value && value.readable && hasOwn(value, 'httpVersion')) {
234
232
  // or try http response
235
233
  filename = path.basename(value.client._httpMessage.path || '');
236
234
  }
237
235
 
238
236
  if (filename) {
239
- contentDisposition = 'filename="' + filename + '"';
237
+ return 'filename="' + filename + '"';
240
238
  }
241
-
242
- return contentDisposition;
243
239
  };
244
240
 
245
- FormData.prototype._getContentType = function(value, options) {
246
-
241
+ FormData.prototype._getContentType = function (value, options) {
247
242
  // use custom content-type above all
248
243
  var contentType = options.contentType;
249
244
 
250
245
  // or try `name` from formidable, browser
251
- if (!contentType && value.name) {
246
+ if (!contentType && value && value.name) {
252
247
  contentType = mime.lookup(value.name);
253
248
  }
254
249
 
255
250
  // or try `path` from fs-, request- streams
256
- if (!contentType && value.path) {
251
+ if (!contentType && value && value.path) {
257
252
  contentType = mime.lookup(value.path);
258
253
  }
259
254
 
260
255
  // or if it's http-reponse
261
- if (!contentType && value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
256
+ if (!contentType && value && value.readable && hasOwn(value, 'httpVersion')) {
262
257
  contentType = value.headers['content-type'];
263
258
  }
264
259
 
@@ -268,18 +263,18 @@ FormData.prototype._getContentType = function(value, options) {
268
263
  }
269
264
 
270
265
  // fallback to the default content type if `value` is not simple value
271
- if (!contentType && typeof value == 'object') {
266
+ if (!contentType && value && typeof value === 'object') {
272
267
  contentType = FormData.DEFAULT_CONTENT_TYPE;
273
268
  }
274
269
 
275
270
  return contentType;
276
271
  };
277
272
 
278
- FormData.prototype._multiPartFooter = function() {
279
- return function(next) {
273
+ FormData.prototype._multiPartFooter = function () {
274
+ return function (next) {
280
275
  var footer = FormData.LINE_BREAK;
281
276
 
282
- var lastPart = (this._streams.length === 0);
277
+ var lastPart = this._streams.length === 0;
283
278
  if (lastPart) {
284
279
  footer += this._lastBoundary();
285
280
  }
@@ -288,18 +283,18 @@ FormData.prototype._multiPartFooter = function() {
288
283
  }.bind(this);
289
284
  };
290
285
 
291
- FormData.prototype._lastBoundary = function() {
286
+ FormData.prototype._lastBoundary = function () {
292
287
  return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
293
288
  };
294
289
 
295
- FormData.prototype.getHeaders = function(userHeaders) {
290
+ FormData.prototype.getHeaders = function (userHeaders) {
296
291
  var header;
297
292
  var formHeaders = {
298
293
  'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
299
294
  };
300
295
 
301
- for (header in userHeaders) {
302
- if (Object.prototype.hasOwnProperty.call(userHeaders, header)) {
296
+ for (header in userHeaders) { // eslint-disable-line no-restricted-syntax
297
+ if (hasOwn(userHeaders, header)) {
303
298
  formHeaders[header.toLowerCase()] = userHeaders[header];
304
299
  }
305
300
  }
@@ -307,11 +302,14 @@ FormData.prototype.getHeaders = function(userHeaders) {
307
302
  return formHeaders;
308
303
  };
309
304
 
310
- FormData.prototype.setBoundary = function(boundary) {
305
+ FormData.prototype.setBoundary = function (boundary) {
306
+ if (typeof boundary !== 'string') {
307
+ throw new TypeError('FormData boundary must be a string');
308
+ }
311
309
  this._boundary = boundary;
312
310
  };
313
311
 
314
- FormData.prototype.getBoundary = function() {
312
+ FormData.prototype.getBoundary = function () {
315
313
  if (!this._boundary) {
316
314
  this._generateBoundary();
317
315
  }
@@ -319,60 +317,55 @@ FormData.prototype.getBoundary = function() {
319
317
  return this._boundary;
320
318
  };
321
319
 
322
- FormData.prototype.getBuffer = function() {
323
- var dataBuffer = new Buffer.alloc(0);
320
+ FormData.prototype.getBuffer = function () {
321
+ var dataBuffer = new Buffer.alloc(0); // eslint-disable-line new-cap
324
322
  var boundary = this.getBoundary();
325
323
 
326
324
  // Create the form content. Add Line breaks to the end of data.
327
325
  for (var i = 0, len = this._streams.length; i < len; i++) {
328
326
  if (typeof this._streams[i] !== 'function') {
329
-
330
327
  // Add content to the buffer.
331
- if(Buffer.isBuffer(this._streams[i])) {
332
- dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]);
333
- }else {
334
- dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]);
328
+ if (Buffer.isBuffer(this._streams[i])) {
329
+ dataBuffer = Buffer.concat([dataBuffer, this._streams[i]]);
330
+ } else {
331
+ dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i])]);
335
332
  }
336
333
 
337
334
  // Add break after content.
338
- if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) {
339
- dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] );
335
+ if (typeof this._streams[i] !== 'string' || this._streams[i].substring(2, boundary.length + 2) !== boundary) {
336
+ dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData.LINE_BREAK)]);
340
337
  }
341
338
  }
342
339
  }
343
340
 
344
341
  // Add the footer and return the Buffer object.
345
- return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] );
342
+ return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
346
343
  };
347
344
 
348
- FormData.prototype._generateBoundary = function() {
345
+ FormData.prototype._generateBoundary = function () {
349
346
  // This generates a 50 character boundary similar to those used by Firefox.
350
- // They are optimized for boyer-moore parsing.
351
- var boundary = '--------------------------';
352
- for (var i = 0; i < 24; i++) {
353
- boundary += Math.floor(Math.random() * 10).toString(16);
354
- }
355
347
 
356
- this._boundary = boundary;
348
+ // They are optimized for boyer-moore parsing.
349
+ this._boundary = '--------------------------' + crypto.randomBytes(12).toString('hex');
357
350
  };
358
351
 
359
352
  // Note: getLengthSync DOESN'T calculate streams length
360
- // As workaround one can calculate file size manually
361
- // and add it as knownLength option
362
- FormData.prototype.getLengthSync = function() {
353
+ // As workaround one can calculate file size manually and add it as knownLength option
354
+ FormData.prototype.getLengthSync = function () {
363
355
  var knownLength = this._overheadLength + this._valueLength;
364
356
 
365
- // Don't get confused, there are 3 "internal" streams for each keyval pair
366
- // so it basically checks if there is any value added to the form
357
+ // Don't get confused, there are 3 "internal" streams for each keyval pair so it basically checks if there is any value added to the form
367
358
  if (this._streams.length) {
368
359
  knownLength += this._lastBoundary().length;
369
360
  }
370
361
 
371
362
  // https://github.com/form-data/form-data/issues/40
372
363
  if (!this.hasKnownLength()) {
373
- // Some async length retrievers are present
374
- // therefore synchronous length calculation is false.
375
- // Please use getLength(callback) to get proper length
364
+ /*
365
+ * Some async length retrievers are present
366
+ * therefore synchronous length calculation is false.
367
+ * Please use getLength(callback) to get proper length
368
+ */
376
369
  this._error(new Error('Cannot calculate proper length in synchronous way.'));
377
370
  }
378
371
 
@@ -382,7 +375,7 @@ FormData.prototype.getLengthSync = function() {
382
375
  // Public API to check if length of added values is known
383
376
  // https://github.com/form-data/form-data/issues/196
384
377
  // https://github.com/form-data/form-data/issues/262
385
- FormData.prototype.hasKnownLength = function() {
378
+ FormData.prototype.hasKnownLength = function () {
386
379
  var hasKnownLength = true;
387
380
 
388
381
  if (this._valuesToMeasure.length) {
@@ -392,7 +385,7 @@ FormData.prototype.hasKnownLength = function() {
392
385
  return hasKnownLength;
393
386
  };
394
387
 
395
- FormData.prototype.getLength = function(cb) {
388
+ FormData.prototype.getLength = function (cb) {
396
389
  var knownLength = this._overheadLength + this._valueLength;
397
390
 
398
391
  if (this._streams.length) {
@@ -404,13 +397,13 @@ FormData.prototype.getLength = function(cb) {
404
397
  return;
405
398
  }
406
399
 
407
- asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
400
+ asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function (err, values) {
408
401
  if (err) {
409
402
  cb(err);
410
403
  return;
411
404
  }
412
405
 
413
- values.forEach(function(length) {
406
+ values.forEach(function (length) {
414
407
  knownLength += length;
415
408
  });
416
409
 
@@ -418,31 +411,26 @@ FormData.prototype.getLength = function(cb) {
418
411
  });
419
412
  };
420
413
 
421
- FormData.prototype.submit = function(params, cb) {
422
- var request
423
- , options
424
- , defaults = {method: 'post'}
425
- ;
414
+ FormData.prototype.submit = function (params, cb) {
415
+ var request;
416
+ var options;
417
+ var defaults = { method: 'post' };
426
418
 
427
- // parse provided url if it's string
428
- // or treat it as options object
429
- if (typeof params == 'string') {
430
-
431
- params = parseUrl(params);
419
+ // parse provided url if it's string or treat it as options object
420
+ if (typeof params === 'string') {
421
+ params = parseUrl(params); // eslint-disable-line no-param-reassign
422
+ /* eslint sort-keys: 0 */
432
423
  options = populate({
433
424
  port: params.port,
434
425
  path: params.pathname,
435
426
  host: params.hostname,
436
427
  protocol: params.protocol
437
428
  }, defaults);
438
-
439
- // use custom params
440
- } else {
441
-
429
+ } else { // use custom params
442
430
  options = populate(params, defaults);
443
431
  // if no port provided use default one
444
432
  if (!options.port) {
445
- options.port = options.protocol == 'https:' ? 443 : 80;
433
+ options.port = options.protocol === 'https:' ? 443 : 80;
446
434
  }
447
435
  }
448
436
 
@@ -450,14 +438,14 @@ FormData.prototype.submit = function(params, cb) {
450
438
  options.headers = this.getHeaders(params.headers);
451
439
 
452
440
  // https if specified, fallback to http in any other case
453
- if (options.protocol == 'https:') {
441
+ if (options.protocol === 'https:') {
454
442
  request = https.request(options);
455
443
  } else {
456
444
  request = http.request(options);
457
445
  }
458
446
 
459
447
  // get content length and fire away
460
- this.getLength(function(err, length) {
448
+ this.getLength(function (err, length) {
461
449
  if (err && err !== 'Unknown stream') {
462
450
  this._error(err);
463
451
  return;
@@ -476,7 +464,7 @@ FormData.prototype.submit = function(params, cb) {
476
464
  request.removeListener('error', callback);
477
465
  request.removeListener('response', onResponse);
478
466
 
479
- return cb.call(this, error, responce);
467
+ return cb.call(this, error, responce); // eslint-disable-line no-invalid-this
480
468
  };
481
469
 
482
470
  onResponse = callback.bind(this, null);
@@ -489,7 +477,7 @@ FormData.prototype.submit = function(params, cb) {
489
477
  return request;
490
478
  };
491
479
 
492
- FormData.prototype._error = function(err) {
480
+ FormData.prototype._error = function (err) {
493
481
  if (!this.error) {
494
482
  this.error = err;
495
483
  this.pause();
@@ -501,3 +489,6 @@ FormData.prototype.toString = function () {
501
489
  return '[object FormData]';
502
490
  };
503
491
  setToStringTag(FormData, 'FormData');
492
+
493
+ // Public API
494
+ module.exports = FormData;
@@ -1,9 +1,9 @@
1
- // populates missing values
2
- module.exports = function(dst, src) {
1
+ 'use strict';
3
2
 
4
- Object.keys(src).forEach(function(prop)
5
- {
6
- dst[prop] = dst[prop] || src[prop];
3
+ // populates missing values
4
+ module.exports = function (dst, src) {
5
+ Object.keys(src).forEach(function (prop) {
6
+ dst[prop] = dst[prop] || src[prop]; // eslint-disable-line no-param-reassign
7
7
  });
8
8
 
9
9
  return dst;
@@ -2,7 +2,7 @@
2
2
  "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",
3
3
  "name": "form-data",
4
4
  "description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
5
- "version": "4.0.2",
5
+ "version": "4.0.4",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git://github.com/form-data/form-data.git"
@@ -28,15 +28,14 @@
28
28
  "files": "pkgfiles --sort=name",
29
29
  "get-version": "node -e \"console.log(require('./package.json').version)\"",
30
30
  "update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md",
31
- "restore-readme": "mv README.md.bak README.md",
32
- "prepublish": "in-publish && npm run update-readme || not-in-publish",
33
- "postpublish": "npm run restore-readme"
31
+ "postupdate-readme": "mv README.md.bak READ.ME.md.bak",
32
+ "restore-readme": "mv READ.ME.md.bak README.md",
33
+ "prepublish": "not-in-publish || npm run prepublishOnly",
34
+ "prepack": "npm run update-readme",
35
+ "postpack": "npm run restore-readme",
36
+ "version": "auto-changelog && git add CHANGELOG.md",
37
+ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
34
38
  },
35
- "pre-commit": [
36
- "lint",
37
- "ci-test",
38
- "check"
39
- ],
40
39
  "engines": {
41
40
  "node": ">= 6"
42
41
  },
@@ -44,17 +43,17 @@
44
43
  "asynckit": "^0.4.0",
45
44
  "combined-stream": "^1.0.8",
46
45
  "es-set-tostringtag": "^2.1.0",
46
+ "hasown": "^2.0.2",
47
47
  "mime-types": "^2.1.12"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/combined-stream": "^1.0.6",
51
- "@types/mime-types": "^2.1.4",
52
- "@types/node": "^12.20.55",
50
+ "@ljharb/eslint-config": "^21.2.0",
51
+ "auto-changelog": "^2.5.0",
53
52
  "browserify": "^13.3.0",
54
53
  "browserify-istanbul": "^2.0.0",
55
54
  "coveralls": "^3.1.1",
56
55
  "cross-spawn": "^6.0.6",
57
- "eslint": "^6.8.0",
56
+ "eslint": "=8.8.0",
58
57
  "fake": "^0.2.2",
59
58
  "far": "^0.0.7",
60
59
  "formidable": "^1.2.6",
@@ -64,11 +63,20 @@
64
63
  "obake": "^0.1.2",
65
64
  "pkgfiles": "^2.3.2",
66
65
  "pre-commit": "^1.2.2",
66
+ "predict-v8-randomness": "^1.0.35",
67
67
  "puppeteer": "^1.20.0",
68
68
  "request": "~2.87.0",
69
69
  "rimraf": "^2.7.1",
70
- "tape": "^5.9.0",
71
- "typescript": "^3.9.10"
70
+ "semver": "^6.3.1",
71
+ "tape": "^5.9.0"
72
72
  },
73
- "license": "MIT"
73
+ "license": "MIT",
74
+ "auto-changelog": {
75
+ "output": "CHANGELOG.md",
76
+ "template": "keepachangelog",
77
+ "unreleased": false,
78
+ "commitLimit": false,
79
+ "backfillLimit": false,
80
+ "hideCredit": true
81
+ }
74
82
  }