@swimlane/turbine-sdk 1.2.0 → 2.0.0

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 (95) hide show
  1. package/LICENSE +5 -658
  2. package/README.md +784 -125
  3. package/bin/dev +17 -0
  4. package/bin/dev.cmd +3 -0
  5. package/bin/run +5 -0
  6. package/bin/run.cmd +3 -0
  7. package/lib/index.d.ts +1 -0
  8. package/lib/index.js +6 -0
  9. package/lib/index.js.map +1 -0
  10. package/oclif.manifest.json +1 -0
  11. package/package.json +98 -79
  12. package/dist/Sensor/BaseSensor.d.ts +0 -9
  13. package/dist/Sensor/BaseSensor.js +0 -10
  14. package/dist/Sensor/HttpSensorAgentInterface.d.ts +0 -21
  15. package/dist/Sensor/HttpSensorAgentInterface.js +0 -81
  16. package/dist/Sensor/MockSensorAgentInterface.d.ts +0 -22
  17. package/dist/Sensor/MockSensorAgentInterface.js +0 -76
  18. package/dist/Sensor/SensorAgentInterface.d.ts +0 -17
  19. package/dist/Sensor/SensorAgentInterface.js +0 -24
  20. package/dist/Sensor/SensorConfig.d.ts +0 -24
  21. package/dist/Sensor/SensorConfig.js +0 -3
  22. package/dist/Sensor/index.d.ts +0 -5
  23. package/dist/Sensor/index.js +0 -10
  24. package/dist/index.d.ts +0 -1
  25. package/dist/index.js +0 -7
  26. package/node_modules/axios/CHANGELOG.md +0 -348
  27. package/node_modules/axios/LICENSE +0 -19
  28. package/node_modules/axios/README.md +0 -684
  29. package/node_modules/axios/UPGRADE_GUIDE.md +0 -162
  30. package/node_modules/axios/dist/axios.js +0 -1668
  31. package/node_modules/axios/dist/axios.map +0 -1
  32. package/node_modules/axios/dist/axios.min.js +0 -9
  33. package/node_modules/axios/dist/axios.min.map +0 -1
  34. package/node_modules/axios/index.d.ts +0 -152
  35. package/node_modules/axios/index.js +0 -1
  36. package/node_modules/axios/lib/adapters/README.md +0 -37
  37. package/node_modules/axios/lib/adapters/http.js +0 -275
  38. package/node_modules/axios/lib/adapters/xhr.js +0 -174
  39. package/node_modules/axios/lib/axios.js +0 -53
  40. package/node_modules/axios/lib/cancel/Cancel.js +0 -19
  41. package/node_modules/axios/lib/cancel/CancelToken.js +0 -57
  42. package/node_modules/axios/lib/cancel/isCancel.js +0 -5
  43. package/node_modules/axios/lib/core/Axios.js +0 -86
  44. package/node_modules/axios/lib/core/InterceptorManager.js +0 -52
  45. package/node_modules/axios/lib/core/README.md +0 -7
  46. package/node_modules/axios/lib/core/createError.js +0 -18
  47. package/node_modules/axios/lib/core/dispatchRequest.js +0 -86
  48. package/node_modules/axios/lib/core/enhanceError.js +0 -42
  49. package/node_modules/axios/lib/core/mergeConfig.js +0 -51
  50. package/node_modules/axios/lib/core/settle.js +0 -25
  51. package/node_modules/axios/lib/core/transformData.js +0 -20
  52. package/node_modules/axios/lib/defaults.js +0 -98
  53. package/node_modules/axios/lib/helpers/README.md +0 -7
  54. package/node_modules/axios/lib/helpers/bind.js +0 -11
  55. package/node_modules/axios/lib/helpers/buildURL.js +0 -71
  56. package/node_modules/axios/lib/helpers/combineURLs.js +0 -14
  57. package/node_modules/axios/lib/helpers/cookies.js +0 -53
  58. package/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -24
  59. package/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -14
  60. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -68
  61. package/node_modules/axios/lib/helpers/normalizeHeaderName.js +0 -12
  62. package/node_modules/axios/lib/helpers/parseHeaders.js +0 -53
  63. package/node_modules/axios/lib/helpers/spread.js +0 -27
  64. package/node_modules/axios/lib/utils.js +0 -334
  65. package/node_modules/axios/package.json +0 -115
  66. package/node_modules/debug/.coveralls.yml +0 -1
  67. package/node_modules/debug/.eslintrc +0 -14
  68. package/node_modules/debug/.npmignore +0 -9
  69. package/node_modules/debug/.travis.yml +0 -20
  70. package/node_modules/debug/CHANGELOG.md +0 -395
  71. package/node_modules/debug/LICENSE +0 -19
  72. package/node_modules/debug/Makefile +0 -58
  73. package/node_modules/debug/README.md +0 -368
  74. package/node_modules/debug/karma.conf.js +0 -70
  75. package/node_modules/debug/node.js +0 -1
  76. package/node_modules/debug/package.json +0 -87
  77. package/node_modules/debug/src/browser.js +0 -195
  78. package/node_modules/debug/src/debug.js +0 -225
  79. package/node_modules/debug/src/index.js +0 -10
  80. package/node_modules/debug/src/node.js +0 -186
  81. package/node_modules/follow-redirects/LICENSE +0 -18
  82. package/node_modules/follow-redirects/README.md +0 -155
  83. package/node_modules/follow-redirects/http.js +0 -1
  84. package/node_modules/follow-redirects/https.js +0 -1
  85. package/node_modules/follow-redirects/index.js +0 -322
  86. package/node_modules/follow-redirects/package.json +0 -99
  87. package/node_modules/is-buffer/LICENSE +0 -21
  88. package/node_modules/is-buffer/README.md +0 -56
  89. package/node_modules/is-buffer/index.d.ts +0 -2
  90. package/node_modules/is-buffer/index.js +0 -11
  91. package/node_modules/is-buffer/package.json +0 -81
  92. package/node_modules/ms/index.js +0 -152
  93. package/node_modules/ms/license.md +0 -21
  94. package/node_modules/ms/package.json +0 -73
  95. package/node_modules/ms/readme.md +0 -51
@@ -1,19 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * A `Cancel` is an object that is thrown when an operation is canceled.
5
- *
6
- * @class
7
- * @param {string=} message The message.
8
- */
9
- function Cancel(message) {
10
- this.message = message;
11
- }
12
-
13
- Cancel.prototype.toString = function toString() {
14
- return 'Cancel' + (this.message ? ': ' + this.message : '');
15
- };
16
-
17
- Cancel.prototype.__CANCEL__ = true;
18
-
19
- module.exports = Cancel;
@@ -1,57 +0,0 @@
1
- 'use strict';
2
-
3
- var Cancel = require('./Cancel');
4
-
5
- /**
6
- * A `CancelToken` is an object that can be used to request cancellation of an operation.
7
- *
8
- * @class
9
- * @param {Function} executor The executor function.
10
- */
11
- function CancelToken(executor) {
12
- if (typeof executor !== 'function') {
13
- throw new TypeError('executor must be a function.');
14
- }
15
-
16
- var resolvePromise;
17
- this.promise = new Promise(function promiseExecutor(resolve) {
18
- resolvePromise = resolve;
19
- });
20
-
21
- var token = this;
22
- executor(function cancel(message) {
23
- if (token.reason) {
24
- // Cancellation has already been requested
25
- return;
26
- }
27
-
28
- token.reason = new Cancel(message);
29
- resolvePromise(token.reason);
30
- });
31
- }
32
-
33
- /**
34
- * Throws a `Cancel` if cancellation has been requested.
35
- */
36
- CancelToken.prototype.throwIfRequested = function throwIfRequested() {
37
- if (this.reason) {
38
- throw this.reason;
39
- }
40
- };
41
-
42
- /**
43
- * Returns an object that contains a new `CancelToken` and a function that, when called,
44
- * cancels the `CancelToken`.
45
- */
46
- CancelToken.source = function source() {
47
- var cancel;
48
- var token = new CancelToken(function executor(c) {
49
- cancel = c;
50
- });
51
- return {
52
- token: token,
53
- cancel: cancel
54
- };
55
- };
56
-
57
- module.exports = CancelToken;
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = function isCancel(value) {
4
- return !!(value && value.__CANCEL__);
5
- };
@@ -1,86 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./../utils');
4
- var buildURL = require('../helpers/buildURL');
5
- var InterceptorManager = require('./InterceptorManager');
6
- var dispatchRequest = require('./dispatchRequest');
7
- var mergeConfig = require('./mergeConfig');
8
-
9
- /**
10
- * Create a new instance of Axios
11
- *
12
- * @param {Object} instanceConfig The default config for the instance
13
- */
14
- function Axios(instanceConfig) {
15
- this.defaults = instanceConfig;
16
- this.interceptors = {
17
- request: new InterceptorManager(),
18
- response: new InterceptorManager()
19
- };
20
- }
21
-
22
- /**
23
- * Dispatch a request
24
- *
25
- * @param {Object} config The config specific for this request (merged with this.defaults)
26
- */
27
- Axios.prototype.request = function request(config) {
28
- /*eslint no-param-reassign:0*/
29
- // Allow for axios('example/url'[, config]) a la fetch API
30
- if (typeof config === 'string') {
31
- config = arguments[1] || {};
32
- config.url = arguments[0];
33
- } else {
34
- config = config || {};
35
- }
36
-
37
- config = mergeConfig(this.defaults, config);
38
- config.method = config.method ? config.method.toLowerCase() : 'get';
39
-
40
- // Hook up interceptors middleware
41
- var chain = [dispatchRequest, undefined];
42
- var promise = Promise.resolve(config);
43
-
44
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
45
- chain.unshift(interceptor.fulfilled, interceptor.rejected);
46
- });
47
-
48
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
49
- chain.push(interceptor.fulfilled, interceptor.rejected);
50
- });
51
-
52
- while (chain.length) {
53
- promise = promise.then(chain.shift(), chain.shift());
54
- }
55
-
56
- return promise;
57
- };
58
-
59
- Axios.prototype.getUri = function getUri(config) {
60
- config = mergeConfig(this.defaults, config);
61
- return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
62
- };
63
-
64
- // Provide aliases for supported request methods
65
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
66
- /*eslint func-names:0*/
67
- Axios.prototype[method] = function(url, config) {
68
- return this.request(utils.merge(config || {}, {
69
- method: method,
70
- url: url
71
- }));
72
- };
73
- });
74
-
75
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
76
- /*eslint func-names:0*/
77
- Axios.prototype[method] = function(url, data, config) {
78
- return this.request(utils.merge(config || {}, {
79
- method: method,
80
- url: url,
81
- data: data
82
- }));
83
- };
84
- });
85
-
86
- module.exports = Axios;
@@ -1,52 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./../utils');
4
-
5
- function InterceptorManager() {
6
- this.handlers = [];
7
- }
8
-
9
- /**
10
- * Add a new interceptor to the stack
11
- *
12
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
13
- * @param {Function} rejected The function to handle `reject` for a `Promise`
14
- *
15
- * @return {Number} An ID used to remove interceptor later
16
- */
17
- InterceptorManager.prototype.use = function use(fulfilled, rejected) {
18
- this.handlers.push({
19
- fulfilled: fulfilled,
20
- rejected: rejected
21
- });
22
- return this.handlers.length - 1;
23
- };
24
-
25
- /**
26
- * Remove an interceptor from the stack
27
- *
28
- * @param {Number} id The ID that was returned by `use`
29
- */
30
- InterceptorManager.prototype.eject = function eject(id) {
31
- if (this.handlers[id]) {
32
- this.handlers[id] = null;
33
- }
34
- };
35
-
36
- /**
37
- * Iterate over all the registered interceptors
38
- *
39
- * This method is particularly useful for skipping over any
40
- * interceptors that may have become `null` calling `eject`.
41
- *
42
- * @param {Function} fn The function to call for each interceptor
43
- */
44
- InterceptorManager.prototype.forEach = function forEach(fn) {
45
- utils.forEach(this.handlers, function forEachHandler(h) {
46
- if (h !== null) {
47
- fn(h);
48
- }
49
- });
50
- };
51
-
52
- module.exports = InterceptorManager;
@@ -1,7 +0,0 @@
1
- # axios // core
2
-
3
- The modules found in `core/` should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are:
4
-
5
- - Dispatching requests
6
- - Managing interceptors
7
- - Handling config
@@ -1,18 +0,0 @@
1
- 'use strict';
2
-
3
- var enhanceError = require('./enhanceError');
4
-
5
- /**
6
- * Create an Error with the specified message, config, error code, request and response.
7
- *
8
- * @param {string} message The error message.
9
- * @param {Object} config The config.
10
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
11
- * @param {Object} [request] The request.
12
- * @param {Object} [response] The response.
13
- * @returns {Error} The created error.
14
- */
15
- module.exports = function createError(message, config, code, request, response) {
16
- var error = new Error(message);
17
- return enhanceError(error, config, code, request, response);
18
- };
@@ -1,86 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./../utils');
4
- var transformData = require('./transformData');
5
- var isCancel = require('../cancel/isCancel');
6
- var defaults = require('../defaults');
7
- var isAbsoluteURL = require('./../helpers/isAbsoluteURL');
8
- var combineURLs = require('./../helpers/combineURLs');
9
-
10
- /**
11
- * Throws a `Cancel` if cancellation has been requested.
12
- */
13
- function throwIfCancellationRequested(config) {
14
- if (config.cancelToken) {
15
- config.cancelToken.throwIfRequested();
16
- }
17
- }
18
-
19
- /**
20
- * Dispatch a request to the server using the configured adapter.
21
- *
22
- * @param {object} config The config that is to be used for the request
23
- * @returns {Promise} The Promise to be fulfilled
24
- */
25
- module.exports = function dispatchRequest(config) {
26
- throwIfCancellationRequested(config);
27
-
28
- // Support baseURL config
29
- if (config.baseURL && !isAbsoluteURL(config.url)) {
30
- config.url = combineURLs(config.baseURL, config.url);
31
- }
32
-
33
- // Ensure headers exist
34
- config.headers = config.headers || {};
35
-
36
- // Transform request data
37
- config.data = transformData(
38
- config.data,
39
- config.headers,
40
- config.transformRequest
41
- );
42
-
43
- // Flatten headers
44
- config.headers = utils.merge(
45
- config.headers.common || {},
46
- config.headers[config.method] || {},
47
- config.headers || {}
48
- );
49
-
50
- utils.forEach(
51
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
52
- function cleanHeaderConfig(method) {
53
- delete config.headers[method];
54
- }
55
- );
56
-
57
- var adapter = config.adapter || defaults.adapter;
58
-
59
- return adapter(config).then(function onAdapterResolution(response) {
60
- throwIfCancellationRequested(config);
61
-
62
- // Transform response data
63
- response.data = transformData(
64
- response.data,
65
- response.headers,
66
- config.transformResponse
67
- );
68
-
69
- return response;
70
- }, function onAdapterRejection(reason) {
71
- if (!isCancel(reason)) {
72
- throwIfCancellationRequested(config);
73
-
74
- // Transform response data
75
- if (reason && reason.response) {
76
- reason.response.data = transformData(
77
- reason.response.data,
78
- reason.response.headers,
79
- config.transformResponse
80
- );
81
- }
82
- }
83
-
84
- return Promise.reject(reason);
85
- });
86
- };
@@ -1,42 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Update an Error with the specified config, error code, and response.
5
- *
6
- * @param {Error} error The error to update.
7
- * @param {Object} config The config.
8
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
9
- * @param {Object} [request] The request.
10
- * @param {Object} [response] The response.
11
- * @returns {Error} The error.
12
- */
13
- module.exports = function enhanceError(error, config, code, request, response) {
14
- error.config = config;
15
- if (code) {
16
- error.code = code;
17
- }
18
-
19
- error.request = request;
20
- error.response = response;
21
- error.isAxiosError = true;
22
-
23
- error.toJSON = function() {
24
- return {
25
- // Standard
26
- message: this.message,
27
- name: this.name,
28
- // Microsoft
29
- description: this.description,
30
- number: this.number,
31
- // Mozilla
32
- fileName: this.fileName,
33
- lineNumber: this.lineNumber,
34
- columnNumber: this.columnNumber,
35
- stack: this.stack,
36
- // Axios
37
- config: this.config,
38
- code: this.code
39
- };
40
- };
41
- return error;
42
- };
@@ -1,51 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('../utils');
4
-
5
- /**
6
- * Config-specific merge-function which creates a new config-object
7
- * by merging two configuration objects together.
8
- *
9
- * @param {Object} config1
10
- * @param {Object} config2
11
- * @returns {Object} New object resulting from merging config2 to config1
12
- */
13
- module.exports = function mergeConfig(config1, config2) {
14
- // eslint-disable-next-line no-param-reassign
15
- config2 = config2 || {};
16
- var config = {};
17
-
18
- utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {
19
- if (typeof config2[prop] !== 'undefined') {
20
- config[prop] = config2[prop];
21
- }
22
- });
23
-
24
- utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {
25
- if (utils.isObject(config2[prop])) {
26
- config[prop] = utils.deepMerge(config1[prop], config2[prop]);
27
- } else if (typeof config2[prop] !== 'undefined') {
28
- config[prop] = config2[prop];
29
- } else if (utils.isObject(config1[prop])) {
30
- config[prop] = utils.deepMerge(config1[prop]);
31
- } else if (typeof config1[prop] !== 'undefined') {
32
- config[prop] = config1[prop];
33
- }
34
- });
35
-
36
- utils.forEach([
37
- 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
38
- 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
39
- 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
40
- 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
41
- 'socketPath'
42
- ], function defaultToConfig2(prop) {
43
- if (typeof config2[prop] !== 'undefined') {
44
- config[prop] = config2[prop];
45
- } else if (typeof config1[prop] !== 'undefined') {
46
- config[prop] = config1[prop];
47
- }
48
- });
49
-
50
- return config;
51
- };
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- var createError = require('./createError');
4
-
5
- /**
6
- * Resolve or reject a Promise based on response status.
7
- *
8
- * @param {Function} resolve A function that resolves the promise.
9
- * @param {Function} reject A function that rejects the promise.
10
- * @param {object} response The response.
11
- */
12
- module.exports = function settle(resolve, reject, response) {
13
- var validateStatus = response.config.validateStatus;
14
- if (!validateStatus || validateStatus(response.status)) {
15
- resolve(response);
16
- } else {
17
- reject(createError(
18
- 'Request failed with status code ' + response.status,
19
- response.config,
20
- null,
21
- response.request,
22
- response
23
- ));
24
- }
25
- };
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./../utils');
4
-
5
- /**
6
- * Transform the data for a request or a response
7
- *
8
- * @param {Object|String} data The data to be transformed
9
- * @param {Array} headers The headers for the request or response
10
- * @param {Array|Function} fns A single function or Array of functions
11
- * @returns {*} The resulting transformed data
12
- */
13
- module.exports = function transformData(data, headers, fns) {
14
- /*eslint no-param-reassign:0*/
15
- utils.forEach(fns, function transform(fn) {
16
- data = fn(data, headers);
17
- });
18
-
19
- return data;
20
- };
@@ -1,98 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./utils');
4
- var normalizeHeaderName = require('./helpers/normalizeHeaderName');
5
-
6
- var DEFAULT_CONTENT_TYPE = {
7
- 'Content-Type': 'application/x-www-form-urlencoded'
8
- };
9
-
10
- function setContentTypeIfUnset(headers, value) {
11
- if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
12
- headers['Content-Type'] = value;
13
- }
14
- }
15
-
16
- function getDefaultAdapter() {
17
- var adapter;
18
- // Only Node.JS has a process variable that is of [[Class]] process
19
- if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
20
- // For node use HTTP adapter
21
- adapter = require('./adapters/http');
22
- } else if (typeof XMLHttpRequest !== 'undefined') {
23
- // For browsers use XHR adapter
24
- adapter = require('./adapters/xhr');
25
- }
26
- return adapter;
27
- }
28
-
29
- var defaults = {
30
- adapter: getDefaultAdapter(),
31
-
32
- transformRequest: [function transformRequest(data, headers) {
33
- normalizeHeaderName(headers, 'Accept');
34
- normalizeHeaderName(headers, 'Content-Type');
35
- if (utils.isFormData(data) ||
36
- utils.isArrayBuffer(data) ||
37
- utils.isBuffer(data) ||
38
- utils.isStream(data) ||
39
- utils.isFile(data) ||
40
- utils.isBlob(data)
41
- ) {
42
- return data;
43
- }
44
- if (utils.isArrayBufferView(data)) {
45
- return data.buffer;
46
- }
47
- if (utils.isURLSearchParams(data)) {
48
- setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
49
- return data.toString();
50
- }
51
- if (utils.isObject(data)) {
52
- setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
53
- return JSON.stringify(data);
54
- }
55
- return data;
56
- }],
57
-
58
- transformResponse: [function transformResponse(data) {
59
- /*eslint no-param-reassign:0*/
60
- if (typeof data === 'string') {
61
- try {
62
- data = JSON.parse(data);
63
- } catch (e) { /* Ignore */ }
64
- }
65
- return data;
66
- }],
67
-
68
- /**
69
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
70
- * timeout is not created.
71
- */
72
- timeout: 0,
73
-
74
- xsrfCookieName: 'XSRF-TOKEN',
75
- xsrfHeaderName: 'X-XSRF-TOKEN',
76
-
77
- maxContentLength: -1,
78
-
79
- validateStatus: function validateStatus(status) {
80
- return status >= 200 && status < 300;
81
- }
82
- };
83
-
84
- defaults.headers = {
85
- common: {
86
- 'Accept': 'application/json, text/plain, */*'
87
- }
88
- };
89
-
90
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
91
- defaults.headers[method] = {};
92
- });
93
-
94
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
95
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
96
- });
97
-
98
- module.exports = defaults;
@@ -1,7 +0,0 @@
1
- # axios // helpers
2
-
3
- The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like:
4
-
5
- - Browser polyfills
6
- - Managing cookies
7
- - Parsing HTTP headers
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = function bind(fn, thisArg) {
4
- return function wrap() {
5
- var args = new Array(arguments.length);
6
- for (var i = 0; i < args.length; i++) {
7
- args[i] = arguments[i];
8
- }
9
- return fn.apply(thisArg, args);
10
- };
11
- };
@@ -1,71 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./../utils');
4
-
5
- function encode(val) {
6
- return encodeURIComponent(val).
7
- replace(/%40/gi, '@').
8
- replace(/%3A/gi, ':').
9
- replace(/%24/g, '$').
10
- replace(/%2C/gi, ',').
11
- replace(/%20/g, '+').
12
- replace(/%5B/gi, '[').
13
- replace(/%5D/gi, ']');
14
- }
15
-
16
- /**
17
- * Build a URL by appending params to the end
18
- *
19
- * @param {string} url The base of the url (e.g., http://www.google.com)
20
- * @param {object} [params] The params to be appended
21
- * @returns {string} The formatted url
22
- */
23
- module.exports = function buildURL(url, params, paramsSerializer) {
24
- /*eslint no-param-reassign:0*/
25
- if (!params) {
26
- return url;
27
- }
28
-
29
- var serializedParams;
30
- if (paramsSerializer) {
31
- serializedParams = paramsSerializer(params);
32
- } else if (utils.isURLSearchParams(params)) {
33
- serializedParams = params.toString();
34
- } else {
35
- var parts = [];
36
-
37
- utils.forEach(params, function serialize(val, key) {
38
- if (val === null || typeof val === 'undefined') {
39
- return;
40
- }
41
-
42
- if (utils.isArray(val)) {
43
- key = key + '[]';
44
- } else {
45
- val = [val];
46
- }
47
-
48
- utils.forEach(val, function parseValue(v) {
49
- if (utils.isDate(v)) {
50
- v = v.toISOString();
51
- } else if (utils.isObject(v)) {
52
- v = JSON.stringify(v);
53
- }
54
- parts.push(encode(key) + '=' + encode(v));
55
- });
56
- });
57
-
58
- serializedParams = parts.join('&');
59
- }
60
-
61
- if (serializedParams) {
62
- var hashmarkIndex = url.indexOf('#');
63
- if (hashmarkIndex !== -1) {
64
- url = url.slice(0, hashmarkIndex);
65
- }
66
-
67
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
68
- }
69
-
70
- return url;
71
- };
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Creates a new URL by combining the specified URLs
5
- *
6
- * @param {string} baseURL The base URL
7
- * @param {string} relativeURL The relative URL
8
- * @returns {string} The combined URL
9
- */
10
- module.exports = function combineURLs(baseURL, relativeURL) {
11
- return relativeURL
12
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
13
- : baseURL;
14
- };