@verdocs/web-sdk 1.0.15 → 1.0.19
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/dist/cjs/{Content-986f7a13.js → Content-1d98b2f3.js} +297 -17
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/css-shim-88cc6900.js +6 -0
- package/dist/cjs/document-status-indicator.cjs.entry.js +1 -1
- package/dist/cjs/dom-95afd968.js +75 -0
- package/dist/cjs/dropdown-menu.cjs.entry.js +191 -4
- package/dist/cjs/index-0b9c3c7d.js +3064 -0
- package/dist/cjs/loader.cjs.js +19 -3
- package/dist/cjs/org-popup.cjs.entry.js +1 -1
- package/dist/cjs/pdf-viewer.cjs.entry.js +87 -6
- package/dist/cjs/search-box.cjs.entry.js +19 -7
- package/dist/cjs/search-embed.cjs.entry.js +1 -1
- package/dist/cjs/search-quick-functions.cjs.entry.js +1 -1
- package/dist/cjs/search-recent.cjs.entry.js +2 -2
- package/dist/cjs/search-saved.cjs.entry.js +2 -2
- package/dist/cjs/search-starred.cjs.entry.js +1 -1
- package/dist/cjs/search-tabs.cjs.entry.js +1 -1
- package/dist/cjs/shadow-css-71d0f821.js +391 -0
- package/dist/cjs/tags-indicator.cjs.entry.js +1 -1
- package/dist/cjs/template-card.cjs.entry.js +1 -1
- package/dist/cjs/toggle-icon-buttons.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-web-sdk.cjs.js +113 -5
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/elements/search-box/search-box.css +4 -0
- package/dist/collection/components/elements/search-box/search-box.js +73 -14
- package/dist/collection/components/elements/search-box/search-box.stories.js +3 -1
- package/dist/custom-elements/index.js +597 -34
- package/dist/docs.json +40 -5
- package/dist/esm/{Content-386637c8.js → Content-0d614ff3.js} +297 -17
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/css-shim-c64026cd.js +4 -0
- package/dist/esm/document-status-indicator.entry.js +1 -1
- package/dist/esm/dom-a712b575.js +73 -0
- package/dist/esm/dropdown-menu.entry.js +191 -4
- package/dist/esm/index-81ec66c1.js +3027 -0
- package/dist/esm/loader.js +19 -3
- package/dist/esm/org-popup.entry.js +1 -1
- package/dist/esm/pdf-viewer.entry.js +87 -6
- package/dist/esm/search-box.entry.js +19 -7
- package/dist/esm/search-embed.entry.js +1 -1
- package/dist/esm/search-quick-functions.entry.js +1 -1
- package/dist/esm/search-recent.entry.js +2 -2
- package/dist/esm/search-saved.entry.js +2 -2
- package/dist/esm/search-starred.entry.js +1 -1
- package/dist/esm/search-tabs.entry.js +1 -1
- package/dist/esm/shadow-css-1e16431b.js +389 -0
- package/dist/esm/tags-indicator.entry.js +1 -1
- package/dist/esm/template-card.entry.js +1 -1
- package/dist/esm/toggle-icon-buttons.entry.js +1 -1
- package/dist/esm/verdocs-web-sdk.js +113 -5
- package/dist/esm-es5/Content-0d614ff3.js +1 -0
- package/dist/esm-es5/app-globals-0f993ce5.js +1 -0
- package/dist/esm-es5/css-shim-c64026cd.js +1 -0
- package/dist/esm-es5/document-status-indicator.entry.js +1 -1
- package/dist/esm-es5/dom-a712b575.js +21 -0
- package/dist/esm-es5/dropdown-menu.entry.js +1 -1
- package/dist/esm-es5/index-81ec66c1.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/org-popup.entry.js +1 -1
- package/dist/esm-es5/pdf-viewer.entry.js +2 -2
- package/dist/esm-es5/search-box.entry.js +1 -1
- package/dist/esm-es5/search-embed.entry.js +1 -1
- package/dist/esm-es5/search-quick-functions.entry.js +1 -1
- package/dist/esm-es5/search-recent.entry.js +1 -1
- package/dist/esm-es5/search-saved.entry.js +1 -1
- package/dist/esm-es5/search-starred.entry.js +1 -1
- package/dist/esm-es5/search-tabs.entry.js +1 -1
- package/dist/esm-es5/shadow-css-1e16431b.js +12 -0
- package/dist/esm-es5/tags-indicator.entry.js +1 -1
- package/dist/esm-es5/template-card.entry.js +1 -1
- package/dist/esm-es5/toggle-icon-buttons.entry.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/elements/search-box/search-box.d.ts +20 -5
- package/dist/types/components/elements/search-box/search-box.stories.d.ts +3 -1
- package/dist/types/components.d.ts +23 -1
- package/dist/verdocs-web-sdk/Content-0d614ff3.js +2175 -0
- package/dist/verdocs-web-sdk/Content-42ddf5ec.system.js +1 -0
- package/dist/verdocs-web-sdk/app-globals-0f993ce5.js +3 -0
- package/dist/verdocs-web-sdk/app-globals-497eb362.system.js +1 -0
- package/dist/verdocs-web-sdk/css-shim-0e9af51a.system.js +1 -0
- package/dist/verdocs-web-sdk/css-shim-c64026cd.js +4 -0
- package/dist/verdocs-web-sdk/document-status-indicator.entry.js +55 -0
- package/dist/verdocs-web-sdk/document-status-indicator.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/dom-a712b575.js +73 -0
- package/dist/verdocs-web-sdk/dom-f6327147.system.js +21 -0
- package/dist/verdocs-web-sdk/dropdown-menu.entry.js +1990 -0
- package/dist/verdocs-web-sdk/dropdown-menu.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/index-46cb292b.system.js +1 -0
- package/dist/verdocs-web-sdk/index-81ec66c1.js +3027 -0
- package/dist/verdocs-web-sdk/index.esm.js +1 -0
- package/dist/verdocs-web-sdk/{p-50ea2036.system.js → index.system.js} +0 -0
- package/dist/verdocs-web-sdk/org-popup.entry.js +21 -0
- package/dist/verdocs-web-sdk/org-popup.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/pdf-viewer.entry.js +13754 -0
- package/dist/verdocs-web-sdk/pdf-viewer.system.entry.js +23 -0
- package/dist/verdocs-web-sdk/search-box.entry.js +46 -0
- package/dist/verdocs-web-sdk/search-box.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/search-embed.entry.js +15 -0
- package/dist/verdocs-web-sdk/search-embed.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/search-quick-functions.entry.js +27 -0
- package/dist/verdocs-web-sdk/search-quick-functions.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/search-recent.entry.js +35 -0
- package/dist/verdocs-web-sdk/search-recent.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/search-saved.entry.js +35 -0
- package/dist/verdocs-web-sdk/search-saved.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/search-starred.entry.js +42 -0
- package/dist/verdocs-web-sdk/search-starred.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/search-tabs.entry.js +16 -0
- package/dist/verdocs-web-sdk/search-tabs.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/shadow-css-1e16431b.js +389 -0
- package/dist/verdocs-web-sdk/shadow-css-ef154fe4.system.js +13 -0
- package/dist/verdocs-web-sdk/tags-indicator.entry.js +16 -0
- package/dist/verdocs-web-sdk/tags-indicator.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/template-card.entry.js +24 -0
- package/dist/verdocs-web-sdk/template-card.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/toggle-icon-buttons.entry.js +28 -0
- package/dist/verdocs-web-sdk/toggle-icon-buttons.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.css +12 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +125 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.js +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.system.js +1 -0
- package/package.json +5 -5
- package/dist/cjs/index-e2fb537e.js +0 -1631
- package/dist/custom-elements.json +0 -266
- package/dist/esm/index-183a8995.js +0 -1602
- package/dist/esm-es5/Content-386637c8.js +0 -1
- package/dist/esm-es5/index-183a8995.js +0 -1
- package/dist/verdocs-web-sdk/p-153879ad.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-1d1bc463.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-29cb7cbc.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-2cec77cf.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-32a5788a.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-33f73371.system.js +0 -1
- package/dist/verdocs-web-sdk/p-349248f0.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-36082c90.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-3a032151.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-3cc8281f.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-440d8a73.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-4d4e090f.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-55660c24.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-63107dd5.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-6b569aa1.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-6e033b90.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-6ee008ff.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-7ab216be.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-7d10b067.system.entry.js +0 -23
- package/dist/verdocs-web-sdk/p-89be87e5.js +0 -1
- package/dist/verdocs-web-sdk/p-92e7863c.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-99ebfee7.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-9af63b8a.system.js +0 -1
- package/dist/verdocs-web-sdk/p-9da35744.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-b3d5601a.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-b466e003.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-bb99a203.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-cbc784a6.system.js +0 -1
- package/dist/verdocs-web-sdk/p-cf030985.js +0 -1
- package/dist/verdocs-web-sdk/p-d73f486f.entry.js +0 -23
- package/dist/verdocs-web-sdk/p-dea09611.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-e34538bd.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-e59eda0c.system.entry.js +0 -1
|
@@ -0,0 +1,2175 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var bind = 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
|
+
};
|
|
12
|
+
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
// utils is a library of generic helper functions non-specific to axios
|
|
18
|
+
|
|
19
|
+
var toString = Object.prototype.toString;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Determine if a value is an Array
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} val The value to test
|
|
25
|
+
* @returns {boolean} True if value is an Array, otherwise false
|
|
26
|
+
*/
|
|
27
|
+
function isArray(val) {
|
|
28
|
+
return toString.call(val) === '[object Array]';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Determine if a value is undefined
|
|
33
|
+
*
|
|
34
|
+
* @param {Object} val The value to test
|
|
35
|
+
* @returns {boolean} True if the value is undefined, otherwise false
|
|
36
|
+
*/
|
|
37
|
+
function isUndefined(val) {
|
|
38
|
+
return typeof val === 'undefined';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Determine if a value is a Buffer
|
|
43
|
+
*
|
|
44
|
+
* @param {Object} val The value to test
|
|
45
|
+
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
46
|
+
*/
|
|
47
|
+
function isBuffer(val) {
|
|
48
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
49
|
+
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Determine if a value is an ArrayBuffer
|
|
54
|
+
*
|
|
55
|
+
* @param {Object} val The value to test
|
|
56
|
+
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
57
|
+
*/
|
|
58
|
+
function isArrayBuffer(val) {
|
|
59
|
+
return toString.call(val) === '[object ArrayBuffer]';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Determine if a value is a FormData
|
|
64
|
+
*
|
|
65
|
+
* @param {Object} val The value to test
|
|
66
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
|
67
|
+
*/
|
|
68
|
+
function isFormData(val) {
|
|
69
|
+
return (typeof FormData !== 'undefined') && (val instanceof FormData);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Determine if a value is a view on an ArrayBuffer
|
|
74
|
+
*
|
|
75
|
+
* @param {Object} val The value to test
|
|
76
|
+
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
|
77
|
+
*/
|
|
78
|
+
function isArrayBufferView(val) {
|
|
79
|
+
var result;
|
|
80
|
+
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
|
81
|
+
result = ArrayBuffer.isView(val);
|
|
82
|
+
} else {
|
|
83
|
+
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Determine if a value is a String
|
|
90
|
+
*
|
|
91
|
+
* @param {Object} val The value to test
|
|
92
|
+
* @returns {boolean} True if value is a String, otherwise false
|
|
93
|
+
*/
|
|
94
|
+
function isString(val) {
|
|
95
|
+
return typeof val === 'string';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Determine if a value is a Number
|
|
100
|
+
*
|
|
101
|
+
* @param {Object} val The value to test
|
|
102
|
+
* @returns {boolean} True if value is a Number, otherwise false
|
|
103
|
+
*/
|
|
104
|
+
function isNumber(val) {
|
|
105
|
+
return typeof val === 'number';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Determine if a value is an Object
|
|
110
|
+
*
|
|
111
|
+
* @param {Object} val The value to test
|
|
112
|
+
* @returns {boolean} True if value is an Object, otherwise false
|
|
113
|
+
*/
|
|
114
|
+
function isObject(val) {
|
|
115
|
+
return val !== null && typeof val === 'object';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Determine if a value is a plain Object
|
|
120
|
+
*
|
|
121
|
+
* @param {Object} val The value to test
|
|
122
|
+
* @return {boolean} True if value is a plain Object, otherwise false
|
|
123
|
+
*/
|
|
124
|
+
function isPlainObject(val) {
|
|
125
|
+
if (toString.call(val) !== '[object Object]') {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
var prototype = Object.getPrototypeOf(val);
|
|
130
|
+
return prototype === null || prototype === Object.prototype;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Determine if a value is a Date
|
|
135
|
+
*
|
|
136
|
+
* @param {Object} val The value to test
|
|
137
|
+
* @returns {boolean} True if value is a Date, otherwise false
|
|
138
|
+
*/
|
|
139
|
+
function isDate(val) {
|
|
140
|
+
return toString.call(val) === '[object Date]';
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Determine if a value is a File
|
|
145
|
+
*
|
|
146
|
+
* @param {Object} val The value to test
|
|
147
|
+
* @returns {boolean} True if value is a File, otherwise false
|
|
148
|
+
*/
|
|
149
|
+
function isFile(val) {
|
|
150
|
+
return toString.call(val) === '[object File]';
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Determine if a value is a Blob
|
|
155
|
+
*
|
|
156
|
+
* @param {Object} val The value to test
|
|
157
|
+
* @returns {boolean} True if value is a Blob, otherwise false
|
|
158
|
+
*/
|
|
159
|
+
function isBlob(val) {
|
|
160
|
+
return toString.call(val) === '[object Blob]';
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Determine if a value is a Function
|
|
165
|
+
*
|
|
166
|
+
* @param {Object} val The value to test
|
|
167
|
+
* @returns {boolean} True if value is a Function, otherwise false
|
|
168
|
+
*/
|
|
169
|
+
function isFunction(val) {
|
|
170
|
+
return toString.call(val) === '[object Function]';
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Determine if a value is a Stream
|
|
175
|
+
*
|
|
176
|
+
* @param {Object} val The value to test
|
|
177
|
+
* @returns {boolean} True if value is a Stream, otherwise false
|
|
178
|
+
*/
|
|
179
|
+
function isStream(val) {
|
|
180
|
+
return isObject(val) && isFunction(val.pipe);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Determine if a value is a URLSearchParams object
|
|
185
|
+
*
|
|
186
|
+
* @param {Object} val The value to test
|
|
187
|
+
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
188
|
+
*/
|
|
189
|
+
function isURLSearchParams(val) {
|
|
190
|
+
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Trim excess whitespace off the beginning and end of a string
|
|
195
|
+
*
|
|
196
|
+
* @param {String} str The String to trim
|
|
197
|
+
* @returns {String} The String freed of excess whitespace
|
|
198
|
+
*/
|
|
199
|
+
function trim(str) {
|
|
200
|
+
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Determine if we're running in a standard browser environment
|
|
205
|
+
*
|
|
206
|
+
* This allows axios to run in a web worker, and react-native.
|
|
207
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
208
|
+
*
|
|
209
|
+
* web workers:
|
|
210
|
+
* typeof window -> undefined
|
|
211
|
+
* typeof document -> undefined
|
|
212
|
+
*
|
|
213
|
+
* react-native:
|
|
214
|
+
* navigator.product -> 'ReactNative'
|
|
215
|
+
* nativescript
|
|
216
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
|
217
|
+
*/
|
|
218
|
+
function isStandardBrowserEnv() {
|
|
219
|
+
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
|
|
220
|
+
navigator.product === 'NativeScript' ||
|
|
221
|
+
navigator.product === 'NS')) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
return (
|
|
225
|
+
typeof window !== 'undefined' &&
|
|
226
|
+
typeof document !== 'undefined'
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Iterate over an Array or an Object invoking a function for each item.
|
|
232
|
+
*
|
|
233
|
+
* If `obj` is an Array callback will be called passing
|
|
234
|
+
* the value, index, and complete array for each item.
|
|
235
|
+
*
|
|
236
|
+
* If 'obj' is an Object callback will be called passing
|
|
237
|
+
* the value, key, and complete object for each property.
|
|
238
|
+
*
|
|
239
|
+
* @param {Object|Array} obj The object to iterate
|
|
240
|
+
* @param {Function} fn The callback to invoke for each item
|
|
241
|
+
*/
|
|
242
|
+
function forEach(obj, fn) {
|
|
243
|
+
// Don't bother if no value provided
|
|
244
|
+
if (obj === null || typeof obj === 'undefined') {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Force an array if not already something iterable
|
|
249
|
+
if (typeof obj !== 'object') {
|
|
250
|
+
/*eslint no-param-reassign:0*/
|
|
251
|
+
obj = [obj];
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (isArray(obj)) {
|
|
255
|
+
// Iterate over array values
|
|
256
|
+
for (var i = 0, l = obj.length; i < l; i++) {
|
|
257
|
+
fn.call(null, obj[i], i, obj);
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
// Iterate over object keys
|
|
261
|
+
for (var key in obj) {
|
|
262
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
263
|
+
fn.call(null, obj[key], key, obj);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Accepts varargs expecting each argument to be an object, then
|
|
271
|
+
* immutably merges the properties of each object and returns result.
|
|
272
|
+
*
|
|
273
|
+
* When multiple objects contain the same key the later object in
|
|
274
|
+
* the arguments list will take precedence.
|
|
275
|
+
*
|
|
276
|
+
* Example:
|
|
277
|
+
*
|
|
278
|
+
* ```js
|
|
279
|
+
* var result = merge({foo: 123}, {foo: 456});
|
|
280
|
+
* console.log(result.foo); // outputs 456
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* @param {Object} obj1 Object to merge
|
|
284
|
+
* @returns {Object} Result of all merge properties
|
|
285
|
+
*/
|
|
286
|
+
function merge(/* obj1, obj2, obj3, ... */) {
|
|
287
|
+
var result = {};
|
|
288
|
+
function assignValue(val, key) {
|
|
289
|
+
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
|
290
|
+
result[key] = merge(result[key], val);
|
|
291
|
+
} else if (isPlainObject(val)) {
|
|
292
|
+
result[key] = merge({}, val);
|
|
293
|
+
} else if (isArray(val)) {
|
|
294
|
+
result[key] = val.slice();
|
|
295
|
+
} else {
|
|
296
|
+
result[key] = val;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
301
|
+
forEach(arguments[i], assignValue);
|
|
302
|
+
}
|
|
303
|
+
return result;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Extends object a by mutably adding to it the properties of object b.
|
|
308
|
+
*
|
|
309
|
+
* @param {Object} a The object to be extended
|
|
310
|
+
* @param {Object} b The object to copy properties from
|
|
311
|
+
* @param {Object} thisArg The object to bind function to
|
|
312
|
+
* @return {Object} The resulting value of object a
|
|
313
|
+
*/
|
|
314
|
+
function extend(a, b, thisArg) {
|
|
315
|
+
forEach(b, function assignValue(val, key) {
|
|
316
|
+
if (thisArg && typeof val === 'function') {
|
|
317
|
+
a[key] = bind(val, thisArg);
|
|
318
|
+
} else {
|
|
319
|
+
a[key] = val;
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
return a;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
327
|
+
*
|
|
328
|
+
* @param {string} content with BOM
|
|
329
|
+
* @return {string} content value without BOM
|
|
330
|
+
*/
|
|
331
|
+
function stripBOM(content) {
|
|
332
|
+
if (content.charCodeAt(0) === 0xFEFF) {
|
|
333
|
+
content = content.slice(1);
|
|
334
|
+
}
|
|
335
|
+
return content;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
var utils = {
|
|
339
|
+
isArray: isArray,
|
|
340
|
+
isArrayBuffer: isArrayBuffer,
|
|
341
|
+
isBuffer: isBuffer,
|
|
342
|
+
isFormData: isFormData,
|
|
343
|
+
isArrayBufferView: isArrayBufferView,
|
|
344
|
+
isString: isString,
|
|
345
|
+
isNumber: isNumber,
|
|
346
|
+
isObject: isObject,
|
|
347
|
+
isPlainObject: isPlainObject,
|
|
348
|
+
isUndefined: isUndefined,
|
|
349
|
+
isDate: isDate,
|
|
350
|
+
isFile: isFile,
|
|
351
|
+
isBlob: isBlob,
|
|
352
|
+
isFunction: isFunction,
|
|
353
|
+
isStream: isStream,
|
|
354
|
+
isURLSearchParams: isURLSearchParams,
|
|
355
|
+
isStandardBrowserEnv: isStandardBrowserEnv,
|
|
356
|
+
forEach: forEach,
|
|
357
|
+
merge: merge,
|
|
358
|
+
extend: extend,
|
|
359
|
+
trim: trim,
|
|
360
|
+
stripBOM: stripBOM
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
'use strict';
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
function encode(val) {
|
|
368
|
+
return encodeURIComponent(val).
|
|
369
|
+
replace(/%3A/gi, ':').
|
|
370
|
+
replace(/%24/g, '$').
|
|
371
|
+
replace(/%2C/gi, ',').
|
|
372
|
+
replace(/%20/g, '+').
|
|
373
|
+
replace(/%5B/gi, '[').
|
|
374
|
+
replace(/%5D/gi, ']');
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Build a URL by appending params to the end
|
|
379
|
+
*
|
|
380
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
381
|
+
* @param {object} [params] The params to be appended
|
|
382
|
+
* @returns {string} The formatted url
|
|
383
|
+
*/
|
|
384
|
+
var buildURL = function buildURL(url, params, paramsSerializer) {
|
|
385
|
+
/*eslint no-param-reassign:0*/
|
|
386
|
+
if (!params) {
|
|
387
|
+
return url;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
var serializedParams;
|
|
391
|
+
if (paramsSerializer) {
|
|
392
|
+
serializedParams = paramsSerializer(params);
|
|
393
|
+
} else if (utils.isURLSearchParams(params)) {
|
|
394
|
+
serializedParams = params.toString();
|
|
395
|
+
} else {
|
|
396
|
+
var parts = [];
|
|
397
|
+
|
|
398
|
+
utils.forEach(params, function serialize(val, key) {
|
|
399
|
+
if (val === null || typeof val === 'undefined') {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (utils.isArray(val)) {
|
|
404
|
+
key = key + '[]';
|
|
405
|
+
} else {
|
|
406
|
+
val = [val];
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
utils.forEach(val, function parseValue(v) {
|
|
410
|
+
if (utils.isDate(v)) {
|
|
411
|
+
v = v.toISOString();
|
|
412
|
+
} else if (utils.isObject(v)) {
|
|
413
|
+
v = JSON.stringify(v);
|
|
414
|
+
}
|
|
415
|
+
parts.push(encode(key) + '=' + encode(v));
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
serializedParams = parts.join('&');
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
if (serializedParams) {
|
|
423
|
+
var hashmarkIndex = url.indexOf('#');
|
|
424
|
+
if (hashmarkIndex !== -1) {
|
|
425
|
+
url = url.slice(0, hashmarkIndex);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
return url;
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
'use strict';
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
function InterceptorManager() {
|
|
439
|
+
this.handlers = [];
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Add a new interceptor to the stack
|
|
444
|
+
*
|
|
445
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
446
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
447
|
+
*
|
|
448
|
+
* @return {Number} An ID used to remove interceptor later
|
|
449
|
+
*/
|
|
450
|
+
InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
|
|
451
|
+
this.handlers.push({
|
|
452
|
+
fulfilled: fulfilled,
|
|
453
|
+
rejected: rejected,
|
|
454
|
+
synchronous: options ? options.synchronous : false,
|
|
455
|
+
runWhen: options ? options.runWhen : null
|
|
456
|
+
});
|
|
457
|
+
return this.handlers.length - 1;
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Remove an interceptor from the stack
|
|
462
|
+
*
|
|
463
|
+
* @param {Number} id The ID that was returned by `use`
|
|
464
|
+
*/
|
|
465
|
+
InterceptorManager.prototype.eject = function eject(id) {
|
|
466
|
+
if (this.handlers[id]) {
|
|
467
|
+
this.handlers[id] = null;
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Iterate over all the registered interceptors
|
|
473
|
+
*
|
|
474
|
+
* This method is particularly useful for skipping over any
|
|
475
|
+
* interceptors that may have become `null` calling `eject`.
|
|
476
|
+
*
|
|
477
|
+
* @param {Function} fn The function to call for each interceptor
|
|
478
|
+
*/
|
|
479
|
+
InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
480
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
481
|
+
if (h !== null) {
|
|
482
|
+
fn(h);
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
var InterceptorManager_1 = InterceptorManager;
|
|
488
|
+
|
|
489
|
+
'use strict';
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
|
|
494
|
+
utils.forEach(headers, function processHeader(value, name) {
|
|
495
|
+
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
|
496
|
+
headers[normalizedName] = value;
|
|
497
|
+
delete headers[name];
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
'use strict';
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Update an Error with the specified config, error code, and response.
|
|
506
|
+
*
|
|
507
|
+
* @param {Error} error The error to update.
|
|
508
|
+
* @param {Object} config The config.
|
|
509
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
510
|
+
* @param {Object} [request] The request.
|
|
511
|
+
* @param {Object} [response] The response.
|
|
512
|
+
* @returns {Error} The error.
|
|
513
|
+
*/
|
|
514
|
+
var enhanceError = function enhanceError(error, config, code, request, response) {
|
|
515
|
+
error.config = config;
|
|
516
|
+
if (code) {
|
|
517
|
+
error.code = code;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
error.request = request;
|
|
521
|
+
error.response = response;
|
|
522
|
+
error.isAxiosError = true;
|
|
523
|
+
|
|
524
|
+
error.toJSON = function toJSON() {
|
|
525
|
+
return {
|
|
526
|
+
// Standard
|
|
527
|
+
message: this.message,
|
|
528
|
+
name: this.name,
|
|
529
|
+
// Microsoft
|
|
530
|
+
description: this.description,
|
|
531
|
+
number: this.number,
|
|
532
|
+
// Mozilla
|
|
533
|
+
fileName: this.fileName,
|
|
534
|
+
lineNumber: this.lineNumber,
|
|
535
|
+
columnNumber: this.columnNumber,
|
|
536
|
+
stack: this.stack,
|
|
537
|
+
// Axios
|
|
538
|
+
config: this.config,
|
|
539
|
+
code: this.code
|
|
540
|
+
};
|
|
541
|
+
};
|
|
542
|
+
return error;
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
'use strict';
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
551
|
+
*
|
|
552
|
+
* @param {string} message The error message.
|
|
553
|
+
* @param {Object} config The config.
|
|
554
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
555
|
+
* @param {Object} [request] The request.
|
|
556
|
+
* @param {Object} [response] The response.
|
|
557
|
+
* @returns {Error} The created error.
|
|
558
|
+
*/
|
|
559
|
+
var createError = function createError(message, config, code, request, response) {
|
|
560
|
+
var error = new Error(message);
|
|
561
|
+
return enhanceError(error, config, code, request, response);
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
'use strict';
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Resolve or reject a Promise based on response status.
|
|
570
|
+
*
|
|
571
|
+
* @param {Function} resolve A function that resolves the promise.
|
|
572
|
+
* @param {Function} reject A function that rejects the promise.
|
|
573
|
+
* @param {object} response The response.
|
|
574
|
+
*/
|
|
575
|
+
var settle = function settle(resolve, reject, response) {
|
|
576
|
+
var validateStatus = response.config.validateStatus;
|
|
577
|
+
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
578
|
+
resolve(response);
|
|
579
|
+
} else {
|
|
580
|
+
reject(createError(
|
|
581
|
+
'Request failed with status code ' + response.status,
|
|
582
|
+
response.config,
|
|
583
|
+
null,
|
|
584
|
+
response.request,
|
|
585
|
+
response
|
|
586
|
+
));
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
'use strict';
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
var cookies = (
|
|
595
|
+
utils.isStandardBrowserEnv() ?
|
|
596
|
+
|
|
597
|
+
// Standard browser envs support document.cookie
|
|
598
|
+
(function standardBrowserEnv() {
|
|
599
|
+
return {
|
|
600
|
+
write: function write(name, value, expires, path, domain, secure) {
|
|
601
|
+
var cookie = [];
|
|
602
|
+
cookie.push(name + '=' + encodeURIComponent(value));
|
|
603
|
+
|
|
604
|
+
if (utils.isNumber(expires)) {
|
|
605
|
+
cookie.push('expires=' + new Date(expires).toGMTString());
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (utils.isString(path)) {
|
|
609
|
+
cookie.push('path=' + path);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
if (utils.isString(domain)) {
|
|
613
|
+
cookie.push('domain=' + domain);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
if (secure === true) {
|
|
617
|
+
cookie.push('secure');
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
document.cookie = cookie.join('; ');
|
|
621
|
+
},
|
|
622
|
+
|
|
623
|
+
read: function read(name) {
|
|
624
|
+
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
625
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
|
626
|
+
},
|
|
627
|
+
|
|
628
|
+
remove: function remove(name) {
|
|
629
|
+
this.write(name, '', Date.now() - 86400000);
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
})() :
|
|
633
|
+
|
|
634
|
+
// Non standard browser env (web workers, react-native) lack needed support.
|
|
635
|
+
(function nonStandardBrowserEnv() {
|
|
636
|
+
return {
|
|
637
|
+
write: function write() {},
|
|
638
|
+
read: function read() { return null; },
|
|
639
|
+
remove: function remove() {}
|
|
640
|
+
};
|
|
641
|
+
})()
|
|
642
|
+
);
|
|
643
|
+
|
|
644
|
+
'use strict';
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Determines whether the specified URL is absolute
|
|
648
|
+
*
|
|
649
|
+
* @param {string} url The URL to test
|
|
650
|
+
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
651
|
+
*/
|
|
652
|
+
var isAbsoluteURL = function isAbsoluteURL(url) {
|
|
653
|
+
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
654
|
+
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
655
|
+
// by any combination of letters, digits, plus, period, or hyphen.
|
|
656
|
+
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
'use strict';
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Creates a new URL by combining the specified URLs
|
|
663
|
+
*
|
|
664
|
+
* @param {string} baseURL The base URL
|
|
665
|
+
* @param {string} relativeURL The relative URL
|
|
666
|
+
* @returns {string} The combined URL
|
|
667
|
+
*/
|
|
668
|
+
var combineURLs = function combineURLs(baseURL, relativeURL) {
|
|
669
|
+
return relativeURL
|
|
670
|
+
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
671
|
+
: baseURL;
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
'use strict';
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
681
|
+
* only when the requestedURL is not already an absolute URL.
|
|
682
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
683
|
+
*
|
|
684
|
+
* @param {string} baseURL The base URL
|
|
685
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
|
686
|
+
* @returns {string} The combined full path
|
|
687
|
+
*/
|
|
688
|
+
var buildFullPath = function buildFullPath(baseURL, requestedURL) {
|
|
689
|
+
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
690
|
+
return combineURLs(baseURL, requestedURL);
|
|
691
|
+
}
|
|
692
|
+
return requestedURL;
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
'use strict';
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
// Headers whose duplicates are ignored by node
|
|
700
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
701
|
+
var ignoreDuplicateOf = [
|
|
702
|
+
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
703
|
+
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
704
|
+
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
705
|
+
'referer', 'retry-after', 'user-agent'
|
|
706
|
+
];
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Parse headers into an object
|
|
710
|
+
*
|
|
711
|
+
* ```
|
|
712
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
713
|
+
* Content-Type: application/json
|
|
714
|
+
* Connection: keep-alive
|
|
715
|
+
* Transfer-Encoding: chunked
|
|
716
|
+
* ```
|
|
717
|
+
*
|
|
718
|
+
* @param {String} headers Headers needing to be parsed
|
|
719
|
+
* @returns {Object} Headers parsed into an object
|
|
720
|
+
*/
|
|
721
|
+
var parseHeaders = function parseHeaders(headers) {
|
|
722
|
+
var parsed = {};
|
|
723
|
+
var key;
|
|
724
|
+
var val;
|
|
725
|
+
var i;
|
|
726
|
+
|
|
727
|
+
if (!headers) { return parsed; }
|
|
728
|
+
|
|
729
|
+
utils.forEach(headers.split('\n'), function parser(line) {
|
|
730
|
+
i = line.indexOf(':');
|
|
731
|
+
key = utils.trim(line.substr(0, i)).toLowerCase();
|
|
732
|
+
val = utils.trim(line.substr(i + 1));
|
|
733
|
+
|
|
734
|
+
if (key) {
|
|
735
|
+
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
if (key === 'set-cookie') {
|
|
739
|
+
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
|
740
|
+
} else {
|
|
741
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
|
|
746
|
+
return parsed;
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
'use strict';
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
var isURLSameOrigin = (
|
|
754
|
+
utils.isStandardBrowserEnv() ?
|
|
755
|
+
|
|
756
|
+
// Standard browser envs have full support of the APIs needed to test
|
|
757
|
+
// whether the request URL is of the same origin as current location.
|
|
758
|
+
(function standardBrowserEnv() {
|
|
759
|
+
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
760
|
+
var urlParsingNode = document.createElement('a');
|
|
761
|
+
var originURL;
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Parse a URL to discover it's components
|
|
765
|
+
*
|
|
766
|
+
* @param {String} url The URL to be parsed
|
|
767
|
+
* @returns {Object}
|
|
768
|
+
*/
|
|
769
|
+
function resolveURL(url) {
|
|
770
|
+
var href = url;
|
|
771
|
+
|
|
772
|
+
if (msie) {
|
|
773
|
+
// IE needs attribute set twice to normalize properties
|
|
774
|
+
urlParsingNode.setAttribute('href', href);
|
|
775
|
+
href = urlParsingNode.href;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
urlParsingNode.setAttribute('href', href);
|
|
779
|
+
|
|
780
|
+
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
|
781
|
+
return {
|
|
782
|
+
href: urlParsingNode.href,
|
|
783
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
|
784
|
+
host: urlParsingNode.host,
|
|
785
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
|
786
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
|
787
|
+
hostname: urlParsingNode.hostname,
|
|
788
|
+
port: urlParsingNode.port,
|
|
789
|
+
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
|
790
|
+
urlParsingNode.pathname :
|
|
791
|
+
'/' + urlParsingNode.pathname
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
originURL = resolveURL(window.location.href);
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Determine if a URL shares the same origin as the current location
|
|
799
|
+
*
|
|
800
|
+
* @param {String} requestURL The URL to test
|
|
801
|
+
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
802
|
+
*/
|
|
803
|
+
return function isURLSameOrigin(requestURL) {
|
|
804
|
+
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
805
|
+
return (parsed.protocol === originURL.protocol &&
|
|
806
|
+
parsed.host === originURL.host);
|
|
807
|
+
};
|
|
808
|
+
})() :
|
|
809
|
+
|
|
810
|
+
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
811
|
+
(function nonStandardBrowserEnv() {
|
|
812
|
+
return function isURLSameOrigin() {
|
|
813
|
+
return true;
|
|
814
|
+
};
|
|
815
|
+
})()
|
|
816
|
+
);
|
|
817
|
+
|
|
818
|
+
'use strict';
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
var xhr = function xhrAdapter(config) {
|
|
830
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
831
|
+
var requestData = config.data;
|
|
832
|
+
var requestHeaders = config.headers;
|
|
833
|
+
var responseType = config.responseType;
|
|
834
|
+
|
|
835
|
+
if (utils.isFormData(requestData)) {
|
|
836
|
+
delete requestHeaders['Content-Type']; // Let the browser set it
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
var request = new XMLHttpRequest();
|
|
840
|
+
|
|
841
|
+
// HTTP basic authentication
|
|
842
|
+
if (config.auth) {
|
|
843
|
+
var username = config.auth.username || '';
|
|
844
|
+
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
845
|
+
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
849
|
+
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
850
|
+
|
|
851
|
+
// Set the request timeout in MS
|
|
852
|
+
request.timeout = config.timeout;
|
|
853
|
+
|
|
854
|
+
function onloadend() {
|
|
855
|
+
if (!request) {
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
// Prepare the response
|
|
859
|
+
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
|
860
|
+
var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
861
|
+
request.responseText : request.response;
|
|
862
|
+
var response = {
|
|
863
|
+
data: responseData,
|
|
864
|
+
status: request.status,
|
|
865
|
+
statusText: request.statusText,
|
|
866
|
+
headers: responseHeaders,
|
|
867
|
+
config: config,
|
|
868
|
+
request: request
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
settle(resolve, reject, response);
|
|
872
|
+
|
|
873
|
+
// Clean up request
|
|
874
|
+
request = null;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
if ('onloadend' in request) {
|
|
878
|
+
// Use onloadend if available
|
|
879
|
+
request.onloadend = onloadend;
|
|
880
|
+
} else {
|
|
881
|
+
// Listen for ready state to emulate onloadend
|
|
882
|
+
request.onreadystatechange = function handleLoad() {
|
|
883
|
+
if (!request || request.readyState !== 4) {
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
// The request errored out and we didn't get a response, this will be
|
|
888
|
+
// handled by onerror instead
|
|
889
|
+
// With one exception: request that using file: protocol, most browsers
|
|
890
|
+
// will return status as 0 even though it's a successful request
|
|
891
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
// readystate handler is calling before onerror or ontimeout handlers,
|
|
895
|
+
// so we should call onloadend on the next 'tick'
|
|
896
|
+
setTimeout(onloadend);
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
901
|
+
request.onabort = function handleAbort() {
|
|
902
|
+
if (!request) {
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
reject(createError('Request aborted', config, 'ECONNABORTED', request));
|
|
907
|
+
|
|
908
|
+
// Clean up request
|
|
909
|
+
request = null;
|
|
910
|
+
};
|
|
911
|
+
|
|
912
|
+
// Handle low level network errors
|
|
913
|
+
request.onerror = function handleError() {
|
|
914
|
+
// Real errors are hidden from us by the browser
|
|
915
|
+
// onerror should only fire if it's a network error
|
|
916
|
+
reject(createError('Network Error', config, null, request));
|
|
917
|
+
|
|
918
|
+
// Clean up request
|
|
919
|
+
request = null;
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
// Handle timeout
|
|
923
|
+
request.ontimeout = function handleTimeout() {
|
|
924
|
+
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
|
925
|
+
if (config.timeoutErrorMessage) {
|
|
926
|
+
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
927
|
+
}
|
|
928
|
+
reject(createError(
|
|
929
|
+
timeoutErrorMessage,
|
|
930
|
+
config,
|
|
931
|
+
config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
|
932
|
+
request));
|
|
933
|
+
|
|
934
|
+
// Clean up request
|
|
935
|
+
request = null;
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
// Add xsrf header
|
|
939
|
+
// This is only done if running in a standard browser environment.
|
|
940
|
+
// Specifically not if we're in a web worker, or react-native.
|
|
941
|
+
if (utils.isStandardBrowserEnv()) {
|
|
942
|
+
// Add xsrf header
|
|
943
|
+
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
|
|
944
|
+
cookies.read(config.xsrfCookieName) :
|
|
945
|
+
undefined;
|
|
946
|
+
|
|
947
|
+
if (xsrfValue) {
|
|
948
|
+
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// Add headers to the request
|
|
953
|
+
if ('setRequestHeader' in request) {
|
|
954
|
+
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
|
955
|
+
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
|
|
956
|
+
// Remove Content-Type if data is undefined
|
|
957
|
+
delete requestHeaders[key];
|
|
958
|
+
} else {
|
|
959
|
+
// Otherwise add header to the request
|
|
960
|
+
request.setRequestHeader(key, val);
|
|
961
|
+
}
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
// Add withCredentials to request if needed
|
|
966
|
+
if (!utils.isUndefined(config.withCredentials)) {
|
|
967
|
+
request.withCredentials = !!config.withCredentials;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
// Add responseType to request if needed
|
|
971
|
+
if (responseType && responseType !== 'json') {
|
|
972
|
+
request.responseType = config.responseType;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// Handle progress if needed
|
|
976
|
+
if (typeof config.onDownloadProgress === 'function') {
|
|
977
|
+
request.addEventListener('progress', config.onDownloadProgress);
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
// Not all browsers support upload events
|
|
981
|
+
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
982
|
+
request.upload.addEventListener('progress', config.onUploadProgress);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
if (config.cancelToken) {
|
|
986
|
+
// Handle cancellation
|
|
987
|
+
config.cancelToken.promise.then(function onCanceled(cancel) {
|
|
988
|
+
if (!request) {
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
request.abort();
|
|
993
|
+
reject(cancel);
|
|
994
|
+
// Clean up request
|
|
995
|
+
request = null;
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
if (!requestData) {
|
|
1000
|
+
requestData = null;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
// Send the request
|
|
1004
|
+
request.send(requestData);
|
|
1005
|
+
});
|
|
1006
|
+
};
|
|
1007
|
+
|
|
1008
|
+
'use strict';
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
var DEFAULT_CONTENT_TYPE = {
|
|
1015
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
1016
|
+
};
|
|
1017
|
+
|
|
1018
|
+
function setContentTypeIfUnset(headers, value) {
|
|
1019
|
+
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
|
1020
|
+
headers['Content-Type'] = value;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
function getDefaultAdapter() {
|
|
1025
|
+
var adapter;
|
|
1026
|
+
if (typeof XMLHttpRequest !== 'undefined') {
|
|
1027
|
+
// For browsers use XHR adapter
|
|
1028
|
+
adapter = xhr;
|
|
1029
|
+
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
|
1030
|
+
// For node use HTTP adapter
|
|
1031
|
+
adapter = xhr;
|
|
1032
|
+
}
|
|
1033
|
+
return adapter;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
1037
|
+
if (utils.isString(rawValue)) {
|
|
1038
|
+
try {
|
|
1039
|
+
(parser || JSON.parse)(rawValue);
|
|
1040
|
+
return utils.trim(rawValue);
|
|
1041
|
+
} catch (e) {
|
|
1042
|
+
if (e.name !== 'SyntaxError') {
|
|
1043
|
+
throw e;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
var defaults = {
|
|
1052
|
+
|
|
1053
|
+
transitional: {
|
|
1054
|
+
silentJSONParsing: true,
|
|
1055
|
+
forcedJSONParsing: true,
|
|
1056
|
+
clarifyTimeoutError: false
|
|
1057
|
+
},
|
|
1058
|
+
|
|
1059
|
+
adapter: getDefaultAdapter(),
|
|
1060
|
+
|
|
1061
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
1062
|
+
normalizeHeaderName(headers, 'Accept');
|
|
1063
|
+
normalizeHeaderName(headers, 'Content-Type');
|
|
1064
|
+
|
|
1065
|
+
if (utils.isFormData(data) ||
|
|
1066
|
+
utils.isArrayBuffer(data) ||
|
|
1067
|
+
utils.isBuffer(data) ||
|
|
1068
|
+
utils.isStream(data) ||
|
|
1069
|
+
utils.isFile(data) ||
|
|
1070
|
+
utils.isBlob(data)
|
|
1071
|
+
) {
|
|
1072
|
+
return data;
|
|
1073
|
+
}
|
|
1074
|
+
if (utils.isArrayBufferView(data)) {
|
|
1075
|
+
return data.buffer;
|
|
1076
|
+
}
|
|
1077
|
+
if (utils.isURLSearchParams(data)) {
|
|
1078
|
+
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
1079
|
+
return data.toString();
|
|
1080
|
+
}
|
|
1081
|
+
if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
|
|
1082
|
+
setContentTypeIfUnset(headers, 'application/json');
|
|
1083
|
+
return stringifySafely(data);
|
|
1084
|
+
}
|
|
1085
|
+
return data;
|
|
1086
|
+
}],
|
|
1087
|
+
|
|
1088
|
+
transformResponse: [function transformResponse(data) {
|
|
1089
|
+
var transitional = this.transitional;
|
|
1090
|
+
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
1091
|
+
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1092
|
+
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
|
1093
|
+
|
|
1094
|
+
if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
|
|
1095
|
+
try {
|
|
1096
|
+
return JSON.parse(data);
|
|
1097
|
+
} catch (e) {
|
|
1098
|
+
if (strictJSONParsing) {
|
|
1099
|
+
if (e.name === 'SyntaxError') {
|
|
1100
|
+
throw enhanceError(e, this, 'E_JSON_PARSE');
|
|
1101
|
+
}
|
|
1102
|
+
throw e;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
return data;
|
|
1108
|
+
}],
|
|
1109
|
+
|
|
1110
|
+
/**
|
|
1111
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
1112
|
+
* timeout is not created.
|
|
1113
|
+
*/
|
|
1114
|
+
timeout: 0,
|
|
1115
|
+
|
|
1116
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
1117
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
1118
|
+
|
|
1119
|
+
maxContentLength: -1,
|
|
1120
|
+
maxBodyLength: -1,
|
|
1121
|
+
|
|
1122
|
+
validateStatus: function validateStatus(status) {
|
|
1123
|
+
return status >= 200 && status < 300;
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
|
|
1127
|
+
defaults.headers = {
|
|
1128
|
+
common: {
|
|
1129
|
+
'Accept': 'application/json, text/plain, */*'
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1133
|
+
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
|
1134
|
+
defaults.headers[method] = {};
|
|
1135
|
+
});
|
|
1136
|
+
|
|
1137
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
1138
|
+
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
1139
|
+
});
|
|
1140
|
+
|
|
1141
|
+
var defaults_1 = defaults;
|
|
1142
|
+
|
|
1143
|
+
'use strict';
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Transform the data for a request or a response
|
|
1150
|
+
*
|
|
1151
|
+
* @param {Object|String} data The data to be transformed
|
|
1152
|
+
* @param {Array} headers The headers for the request or response
|
|
1153
|
+
* @param {Array|Function} fns A single function or Array of functions
|
|
1154
|
+
* @returns {*} The resulting transformed data
|
|
1155
|
+
*/
|
|
1156
|
+
var transformData = function transformData(data, headers, fns) {
|
|
1157
|
+
var context = this || defaults_1;
|
|
1158
|
+
/*eslint no-param-reassign:0*/
|
|
1159
|
+
utils.forEach(fns, function transform(fn) {
|
|
1160
|
+
data = fn.call(context, data, headers);
|
|
1161
|
+
});
|
|
1162
|
+
|
|
1163
|
+
return data;
|
|
1164
|
+
};
|
|
1165
|
+
|
|
1166
|
+
'use strict';
|
|
1167
|
+
|
|
1168
|
+
var isCancel = function isCancel(value) {
|
|
1169
|
+
return !!(value && value.__CANCEL__);
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
'use strict';
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* Throws a `Cancel` if cancellation has been requested.
|
|
1181
|
+
*/
|
|
1182
|
+
function throwIfCancellationRequested(config) {
|
|
1183
|
+
if (config.cancelToken) {
|
|
1184
|
+
config.cancelToken.throwIfRequested();
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
/**
|
|
1189
|
+
* Dispatch a request to the server using the configured adapter.
|
|
1190
|
+
*
|
|
1191
|
+
* @param {object} config The config that is to be used for the request
|
|
1192
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
1193
|
+
*/
|
|
1194
|
+
var dispatchRequest = function dispatchRequest(config) {
|
|
1195
|
+
throwIfCancellationRequested(config);
|
|
1196
|
+
|
|
1197
|
+
// Ensure headers exist
|
|
1198
|
+
config.headers = config.headers || {};
|
|
1199
|
+
|
|
1200
|
+
// Transform request data
|
|
1201
|
+
config.data = transformData.call(
|
|
1202
|
+
config,
|
|
1203
|
+
config.data,
|
|
1204
|
+
config.headers,
|
|
1205
|
+
config.transformRequest
|
|
1206
|
+
);
|
|
1207
|
+
|
|
1208
|
+
// Flatten headers
|
|
1209
|
+
config.headers = utils.merge(
|
|
1210
|
+
config.headers.common || {},
|
|
1211
|
+
config.headers[config.method] || {},
|
|
1212
|
+
config.headers
|
|
1213
|
+
);
|
|
1214
|
+
|
|
1215
|
+
utils.forEach(
|
|
1216
|
+
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
1217
|
+
function cleanHeaderConfig(method) {
|
|
1218
|
+
delete config.headers[method];
|
|
1219
|
+
}
|
|
1220
|
+
);
|
|
1221
|
+
|
|
1222
|
+
var adapter = config.adapter || defaults_1.adapter;
|
|
1223
|
+
|
|
1224
|
+
return adapter(config).then(function onAdapterResolution(response) {
|
|
1225
|
+
throwIfCancellationRequested(config);
|
|
1226
|
+
|
|
1227
|
+
// Transform response data
|
|
1228
|
+
response.data = transformData.call(
|
|
1229
|
+
config,
|
|
1230
|
+
response.data,
|
|
1231
|
+
response.headers,
|
|
1232
|
+
config.transformResponse
|
|
1233
|
+
);
|
|
1234
|
+
|
|
1235
|
+
return response;
|
|
1236
|
+
}, function onAdapterRejection(reason) {
|
|
1237
|
+
if (!isCancel(reason)) {
|
|
1238
|
+
throwIfCancellationRequested(config);
|
|
1239
|
+
|
|
1240
|
+
// Transform response data
|
|
1241
|
+
if (reason && reason.response) {
|
|
1242
|
+
reason.response.data = transformData.call(
|
|
1243
|
+
config,
|
|
1244
|
+
reason.response.data,
|
|
1245
|
+
reason.response.headers,
|
|
1246
|
+
config.transformResponse
|
|
1247
|
+
);
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
return Promise.reject(reason);
|
|
1252
|
+
});
|
|
1253
|
+
};
|
|
1254
|
+
|
|
1255
|
+
'use strict';
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* Config-specific merge-function which creates a new config-object
|
|
1261
|
+
* by merging two configuration objects together.
|
|
1262
|
+
*
|
|
1263
|
+
* @param {Object} config1
|
|
1264
|
+
* @param {Object} config2
|
|
1265
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
|
1266
|
+
*/
|
|
1267
|
+
var mergeConfig = function mergeConfig(config1, config2) {
|
|
1268
|
+
// eslint-disable-next-line no-param-reassign
|
|
1269
|
+
config2 = config2 || {};
|
|
1270
|
+
var config = {};
|
|
1271
|
+
|
|
1272
|
+
var valueFromConfig2Keys = ['url', 'method', 'data'];
|
|
1273
|
+
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
|
|
1274
|
+
var defaultToConfig2Keys = [
|
|
1275
|
+
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
|
1276
|
+
'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
|
1277
|
+
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
|
|
1278
|
+
'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
|
|
1279
|
+
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
|
1280
|
+
];
|
|
1281
|
+
var directMergeKeys = ['validateStatus'];
|
|
1282
|
+
|
|
1283
|
+
function getMergedValue(target, source) {
|
|
1284
|
+
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
1285
|
+
return utils.merge(target, source);
|
|
1286
|
+
} else if (utils.isPlainObject(source)) {
|
|
1287
|
+
return utils.merge({}, source);
|
|
1288
|
+
} else if (utils.isArray(source)) {
|
|
1289
|
+
return source.slice();
|
|
1290
|
+
}
|
|
1291
|
+
return source;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
function mergeDeepProperties(prop) {
|
|
1295
|
+
if (!utils.isUndefined(config2[prop])) {
|
|
1296
|
+
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
|
1297
|
+
} else if (!utils.isUndefined(config1[prop])) {
|
|
1298
|
+
config[prop] = getMergedValue(undefined, config1[prop]);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
|
|
1303
|
+
if (!utils.isUndefined(config2[prop])) {
|
|
1304
|
+
config[prop] = getMergedValue(undefined, config2[prop]);
|
|
1305
|
+
}
|
|
1306
|
+
});
|
|
1307
|
+
|
|
1308
|
+
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
|
1309
|
+
|
|
1310
|
+
utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
|
|
1311
|
+
if (!utils.isUndefined(config2[prop])) {
|
|
1312
|
+
config[prop] = getMergedValue(undefined, config2[prop]);
|
|
1313
|
+
} else if (!utils.isUndefined(config1[prop])) {
|
|
1314
|
+
config[prop] = getMergedValue(undefined, config1[prop]);
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
|
|
1318
|
+
utils.forEach(directMergeKeys, function merge(prop) {
|
|
1319
|
+
if (prop in config2) {
|
|
1320
|
+
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
|
1321
|
+
} else if (prop in config1) {
|
|
1322
|
+
config[prop] = getMergedValue(undefined, config1[prop]);
|
|
1323
|
+
}
|
|
1324
|
+
});
|
|
1325
|
+
|
|
1326
|
+
var axiosKeys = valueFromConfig2Keys
|
|
1327
|
+
.concat(mergeDeepPropertiesKeys)
|
|
1328
|
+
.concat(defaultToConfig2Keys)
|
|
1329
|
+
.concat(directMergeKeys);
|
|
1330
|
+
|
|
1331
|
+
var otherKeys = Object
|
|
1332
|
+
.keys(config1)
|
|
1333
|
+
.concat(Object.keys(config2))
|
|
1334
|
+
.filter(function filterAxiosKeys(key) {
|
|
1335
|
+
return axiosKeys.indexOf(key) === -1;
|
|
1336
|
+
});
|
|
1337
|
+
|
|
1338
|
+
utils.forEach(otherKeys, mergeDeepProperties);
|
|
1339
|
+
|
|
1340
|
+
return config;
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
const _from = "axios@^0.21.1";
|
|
1344
|
+
const _id = "axios@0.21.4";
|
|
1345
|
+
const _inBundle = false;
|
|
1346
|
+
const _integrity = "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==";
|
|
1347
|
+
const _location = "/axios";
|
|
1348
|
+
const _phantomChildren = {
|
|
1349
|
+
};
|
|
1350
|
+
const _requested = {
|
|
1351
|
+
type: "range",
|
|
1352
|
+
registry: true,
|
|
1353
|
+
raw: "axios@^0.21.1",
|
|
1354
|
+
name: "axios",
|
|
1355
|
+
escapedName: "axios",
|
|
1356
|
+
rawSpec: "^0.21.1",
|
|
1357
|
+
saveSpec: null,
|
|
1358
|
+
fetchSpec: "^0.21.1"
|
|
1359
|
+
};
|
|
1360
|
+
const _requiredBy = [
|
|
1361
|
+
"/@verdocs/js-sdk"
|
|
1362
|
+
];
|
|
1363
|
+
const _resolved = "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz";
|
|
1364
|
+
const _shasum = "c67b90dc0568e5c1cf2b0b858c43ba28e2eda575";
|
|
1365
|
+
const _spec = "axios@^0.21.1";
|
|
1366
|
+
const _where = "/Users/chad/projects/verdocs/web-sdk/verdocs-web-sdk/node_modules/@verdocs/js-sdk";
|
|
1367
|
+
const author = {
|
|
1368
|
+
name: "Matt Zabriskie"
|
|
1369
|
+
};
|
|
1370
|
+
const browser = {
|
|
1371
|
+
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
|
|
1372
|
+
};
|
|
1373
|
+
const bugs = {
|
|
1374
|
+
url: "https://github.com/axios/axios/issues"
|
|
1375
|
+
};
|
|
1376
|
+
const bundleDependencies = false;
|
|
1377
|
+
const bundlesize = [
|
|
1378
|
+
{
|
|
1379
|
+
path: "./dist/axios.min.js",
|
|
1380
|
+
threshold: "5kB"
|
|
1381
|
+
}
|
|
1382
|
+
];
|
|
1383
|
+
const dependencies = {
|
|
1384
|
+
"follow-redirects": "^1.14.0"
|
|
1385
|
+
};
|
|
1386
|
+
const deprecated = false;
|
|
1387
|
+
const description = "Promise based HTTP client for the browser and node.js";
|
|
1388
|
+
const devDependencies = {
|
|
1389
|
+
coveralls: "^3.0.0",
|
|
1390
|
+
"es6-promise": "^4.2.4",
|
|
1391
|
+
grunt: "^1.3.0",
|
|
1392
|
+
"grunt-banner": "^0.6.0",
|
|
1393
|
+
"grunt-cli": "^1.2.0",
|
|
1394
|
+
"grunt-contrib-clean": "^1.1.0",
|
|
1395
|
+
"grunt-contrib-watch": "^1.0.0",
|
|
1396
|
+
"grunt-eslint": "^23.0.0",
|
|
1397
|
+
"grunt-karma": "^4.0.0",
|
|
1398
|
+
"grunt-mocha-test": "^0.13.3",
|
|
1399
|
+
"grunt-ts": "^6.0.0-beta.19",
|
|
1400
|
+
"grunt-webpack": "^4.0.2",
|
|
1401
|
+
"istanbul-instrumenter-loader": "^1.0.0",
|
|
1402
|
+
"jasmine-core": "^2.4.1",
|
|
1403
|
+
karma: "^6.3.2",
|
|
1404
|
+
"karma-chrome-launcher": "^3.1.0",
|
|
1405
|
+
"karma-firefox-launcher": "^2.1.0",
|
|
1406
|
+
"karma-jasmine": "^1.1.1",
|
|
1407
|
+
"karma-jasmine-ajax": "^0.1.13",
|
|
1408
|
+
"karma-safari-launcher": "^1.0.0",
|
|
1409
|
+
"karma-sauce-launcher": "^4.3.6",
|
|
1410
|
+
"karma-sinon": "^1.0.5",
|
|
1411
|
+
"karma-sourcemap-loader": "^0.3.8",
|
|
1412
|
+
"karma-webpack": "^4.0.2",
|
|
1413
|
+
"load-grunt-tasks": "^3.5.2",
|
|
1414
|
+
minimist: "^1.2.0",
|
|
1415
|
+
mocha: "^8.2.1",
|
|
1416
|
+
sinon: "^4.5.0",
|
|
1417
|
+
"terser-webpack-plugin": "^4.2.3",
|
|
1418
|
+
typescript: "^4.0.5",
|
|
1419
|
+
"url-search-params": "^0.10.0",
|
|
1420
|
+
webpack: "^4.44.2",
|
|
1421
|
+
"webpack-dev-server": "^3.11.0"
|
|
1422
|
+
};
|
|
1423
|
+
const homepage = "https://axios-http.com";
|
|
1424
|
+
const jsdelivr = "dist/axios.min.js";
|
|
1425
|
+
const keywords = [
|
|
1426
|
+
"xhr",
|
|
1427
|
+
"http",
|
|
1428
|
+
"ajax",
|
|
1429
|
+
"promise",
|
|
1430
|
+
"node"
|
|
1431
|
+
];
|
|
1432
|
+
const license = "MIT";
|
|
1433
|
+
const main = "index.js";
|
|
1434
|
+
const name = "axios";
|
|
1435
|
+
const repository = {
|
|
1436
|
+
type: "git",
|
|
1437
|
+
url: "git+https://github.com/axios/axios.git"
|
|
1438
|
+
};
|
|
1439
|
+
const scripts = {
|
|
1440
|
+
build: "NODE_ENV=production grunt build",
|
|
1441
|
+
coveralls: "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
|
1442
|
+
examples: "node ./examples/server.js",
|
|
1443
|
+
fix: "eslint --fix lib/**/*.js",
|
|
1444
|
+
postversion: "git push && git push --tags",
|
|
1445
|
+
preversion: "npm test",
|
|
1446
|
+
start: "node ./sandbox/server.js",
|
|
1447
|
+
test: "grunt test",
|
|
1448
|
+
version: "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"
|
|
1449
|
+
};
|
|
1450
|
+
const typings = "./index.d.ts";
|
|
1451
|
+
const unpkg = "dist/axios.min.js";
|
|
1452
|
+
const version = "0.21.4";
|
|
1453
|
+
const pkg = {
|
|
1454
|
+
_from: _from,
|
|
1455
|
+
_id: _id,
|
|
1456
|
+
_inBundle: _inBundle,
|
|
1457
|
+
_integrity: _integrity,
|
|
1458
|
+
_location: _location,
|
|
1459
|
+
_phantomChildren: _phantomChildren,
|
|
1460
|
+
_requested: _requested,
|
|
1461
|
+
_requiredBy: _requiredBy,
|
|
1462
|
+
_resolved: _resolved,
|
|
1463
|
+
_shasum: _shasum,
|
|
1464
|
+
_spec: _spec,
|
|
1465
|
+
_where: _where,
|
|
1466
|
+
author: author,
|
|
1467
|
+
browser: browser,
|
|
1468
|
+
bugs: bugs,
|
|
1469
|
+
bundleDependencies: bundleDependencies,
|
|
1470
|
+
bundlesize: bundlesize,
|
|
1471
|
+
dependencies: dependencies,
|
|
1472
|
+
deprecated: deprecated,
|
|
1473
|
+
description: description,
|
|
1474
|
+
devDependencies: devDependencies,
|
|
1475
|
+
homepage: homepage,
|
|
1476
|
+
jsdelivr: jsdelivr,
|
|
1477
|
+
keywords: keywords,
|
|
1478
|
+
license: license,
|
|
1479
|
+
main: main,
|
|
1480
|
+
name: name,
|
|
1481
|
+
repository: repository,
|
|
1482
|
+
scripts: scripts,
|
|
1483
|
+
typings: typings,
|
|
1484
|
+
unpkg: unpkg,
|
|
1485
|
+
version: version
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1488
|
+
'use strict';
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
|
|
1492
|
+
var validators$1 = {};
|
|
1493
|
+
|
|
1494
|
+
// eslint-disable-next-line func-names
|
|
1495
|
+
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
|
|
1496
|
+
validators$1[type] = function validator(thing) {
|
|
1497
|
+
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
|
1498
|
+
};
|
|
1499
|
+
});
|
|
1500
|
+
|
|
1501
|
+
var deprecatedWarnings = {};
|
|
1502
|
+
var currentVerArr = pkg.version.split('.');
|
|
1503
|
+
|
|
1504
|
+
/**
|
|
1505
|
+
* Compare package versions
|
|
1506
|
+
* @param {string} version
|
|
1507
|
+
* @param {string?} thanVersion
|
|
1508
|
+
* @returns {boolean}
|
|
1509
|
+
*/
|
|
1510
|
+
function isOlderVersion(version, thanVersion) {
|
|
1511
|
+
var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;
|
|
1512
|
+
var destVer = version.split('.');
|
|
1513
|
+
for (var i = 0; i < 3; i++) {
|
|
1514
|
+
if (pkgVersionArr[i] > destVer[i]) {
|
|
1515
|
+
return true;
|
|
1516
|
+
} else if (pkgVersionArr[i] < destVer[i]) {
|
|
1517
|
+
return false;
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
return false;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
/**
|
|
1524
|
+
* Transitional option validator
|
|
1525
|
+
* @param {function|boolean?} validator
|
|
1526
|
+
* @param {string?} version
|
|
1527
|
+
* @param {string} message
|
|
1528
|
+
* @returns {function}
|
|
1529
|
+
*/
|
|
1530
|
+
validators$1.transitional = function transitional(validator, version, message) {
|
|
1531
|
+
var isDeprecated = version && isOlderVersion(version);
|
|
1532
|
+
|
|
1533
|
+
function formatMessage(opt, desc) {
|
|
1534
|
+
return '[Axios v' + pkg.version + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
// eslint-disable-next-line func-names
|
|
1538
|
+
return function(value, opt, opts) {
|
|
1539
|
+
if (validator === false) {
|
|
1540
|
+
throw new Error(formatMessage(opt, ' has been removed in ' + version));
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
if (isDeprecated && !deprecatedWarnings[opt]) {
|
|
1544
|
+
deprecatedWarnings[opt] = true;
|
|
1545
|
+
// eslint-disable-next-line no-console
|
|
1546
|
+
console.warn(
|
|
1547
|
+
formatMessage(
|
|
1548
|
+
opt,
|
|
1549
|
+
' has been deprecated since v' + version + ' and will be removed in the near future'
|
|
1550
|
+
)
|
|
1551
|
+
);
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
return validator ? validator(value, opt, opts) : true;
|
|
1555
|
+
};
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
/**
|
|
1559
|
+
* Assert object's properties type
|
|
1560
|
+
* @param {object} options
|
|
1561
|
+
* @param {object} schema
|
|
1562
|
+
* @param {boolean?} allowUnknown
|
|
1563
|
+
*/
|
|
1564
|
+
|
|
1565
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
1566
|
+
if (typeof options !== 'object') {
|
|
1567
|
+
throw new TypeError('options must be an object');
|
|
1568
|
+
}
|
|
1569
|
+
var keys = Object.keys(options);
|
|
1570
|
+
var i = keys.length;
|
|
1571
|
+
while (i-- > 0) {
|
|
1572
|
+
var opt = keys[i];
|
|
1573
|
+
var validator = schema[opt];
|
|
1574
|
+
if (validator) {
|
|
1575
|
+
var value = options[opt];
|
|
1576
|
+
var result = value === undefined || validator(value, opt, options);
|
|
1577
|
+
if (result !== true) {
|
|
1578
|
+
throw new TypeError('option ' + opt + ' must be ' + result);
|
|
1579
|
+
}
|
|
1580
|
+
continue;
|
|
1581
|
+
}
|
|
1582
|
+
if (allowUnknown !== true) {
|
|
1583
|
+
throw Error('Unknown option ' + opt);
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
var validator = {
|
|
1589
|
+
isOlderVersion: isOlderVersion,
|
|
1590
|
+
assertOptions: assertOptions,
|
|
1591
|
+
validators: validators$1
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
'use strict';
|
|
1595
|
+
|
|
1596
|
+
|
|
1597
|
+
|
|
1598
|
+
|
|
1599
|
+
|
|
1600
|
+
|
|
1601
|
+
|
|
1602
|
+
|
|
1603
|
+
var validators = validator.validators;
|
|
1604
|
+
/**
|
|
1605
|
+
* Create a new instance of Axios
|
|
1606
|
+
*
|
|
1607
|
+
* @param {Object} instanceConfig The default config for the instance
|
|
1608
|
+
*/
|
|
1609
|
+
function Axios(instanceConfig) {
|
|
1610
|
+
this.defaults = instanceConfig;
|
|
1611
|
+
this.interceptors = {
|
|
1612
|
+
request: new InterceptorManager_1(),
|
|
1613
|
+
response: new InterceptorManager_1()
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* Dispatch a request
|
|
1619
|
+
*
|
|
1620
|
+
* @param {Object} config The config specific for this request (merged with this.defaults)
|
|
1621
|
+
*/
|
|
1622
|
+
Axios.prototype.request = function request(config) {
|
|
1623
|
+
/*eslint no-param-reassign:0*/
|
|
1624
|
+
// Allow for axios('example/url'[, config]) a la fetch API
|
|
1625
|
+
if (typeof config === 'string') {
|
|
1626
|
+
config = arguments[1] || {};
|
|
1627
|
+
config.url = arguments[0];
|
|
1628
|
+
} else {
|
|
1629
|
+
config = config || {};
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
config = mergeConfig(this.defaults, config);
|
|
1633
|
+
|
|
1634
|
+
// Set config.method
|
|
1635
|
+
if (config.method) {
|
|
1636
|
+
config.method = config.method.toLowerCase();
|
|
1637
|
+
} else if (this.defaults.method) {
|
|
1638
|
+
config.method = this.defaults.method.toLowerCase();
|
|
1639
|
+
} else {
|
|
1640
|
+
config.method = 'get';
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
var transitional = config.transitional;
|
|
1644
|
+
|
|
1645
|
+
if (transitional !== undefined) {
|
|
1646
|
+
validator.assertOptions(transitional, {
|
|
1647
|
+
silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'),
|
|
1648
|
+
forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'),
|
|
1649
|
+
clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0')
|
|
1650
|
+
}, false);
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
// filter out skipped interceptors
|
|
1654
|
+
var requestInterceptorChain = [];
|
|
1655
|
+
var synchronousRequestInterceptors = true;
|
|
1656
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
1657
|
+
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
1662
|
+
|
|
1663
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
1664
|
+
});
|
|
1665
|
+
|
|
1666
|
+
var responseInterceptorChain = [];
|
|
1667
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
1668
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
1669
|
+
});
|
|
1670
|
+
|
|
1671
|
+
var promise;
|
|
1672
|
+
|
|
1673
|
+
if (!synchronousRequestInterceptors) {
|
|
1674
|
+
var chain = [dispatchRequest, undefined];
|
|
1675
|
+
|
|
1676
|
+
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
|
1677
|
+
chain = chain.concat(responseInterceptorChain);
|
|
1678
|
+
|
|
1679
|
+
promise = Promise.resolve(config);
|
|
1680
|
+
while (chain.length) {
|
|
1681
|
+
promise = promise.then(chain.shift(), chain.shift());
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
return promise;
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
|
|
1688
|
+
var newConfig = config;
|
|
1689
|
+
while (requestInterceptorChain.length) {
|
|
1690
|
+
var onFulfilled = requestInterceptorChain.shift();
|
|
1691
|
+
var onRejected = requestInterceptorChain.shift();
|
|
1692
|
+
try {
|
|
1693
|
+
newConfig = onFulfilled(newConfig);
|
|
1694
|
+
} catch (error) {
|
|
1695
|
+
onRejected(error);
|
|
1696
|
+
break;
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
try {
|
|
1701
|
+
promise = dispatchRequest(newConfig);
|
|
1702
|
+
} catch (error) {
|
|
1703
|
+
return Promise.reject(error);
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
while (responseInterceptorChain.length) {
|
|
1707
|
+
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
return promise;
|
|
1711
|
+
};
|
|
1712
|
+
|
|
1713
|
+
Axios.prototype.getUri = function getUri(config) {
|
|
1714
|
+
config = mergeConfig(this.defaults, config);
|
|
1715
|
+
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
|
|
1716
|
+
};
|
|
1717
|
+
|
|
1718
|
+
// Provide aliases for supported request methods
|
|
1719
|
+
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
1720
|
+
/*eslint func-names:0*/
|
|
1721
|
+
Axios.prototype[method] = function(url, config) {
|
|
1722
|
+
return this.request(mergeConfig(config || {}, {
|
|
1723
|
+
method: method,
|
|
1724
|
+
url: url,
|
|
1725
|
+
data: (config || {}).data
|
|
1726
|
+
}));
|
|
1727
|
+
};
|
|
1728
|
+
});
|
|
1729
|
+
|
|
1730
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
1731
|
+
/*eslint func-names:0*/
|
|
1732
|
+
Axios.prototype[method] = function(url, data, config) {
|
|
1733
|
+
return this.request(mergeConfig(config || {}, {
|
|
1734
|
+
method: method,
|
|
1735
|
+
url: url,
|
|
1736
|
+
data: data
|
|
1737
|
+
}));
|
|
1738
|
+
};
|
|
1739
|
+
});
|
|
1740
|
+
|
|
1741
|
+
var Axios_1 = Axios;
|
|
1742
|
+
|
|
1743
|
+
'use strict';
|
|
1744
|
+
|
|
1745
|
+
/**
|
|
1746
|
+
* A `Cancel` is an object that is thrown when an operation is canceled.
|
|
1747
|
+
*
|
|
1748
|
+
* @class
|
|
1749
|
+
* @param {string=} message The message.
|
|
1750
|
+
*/
|
|
1751
|
+
function Cancel(message) {
|
|
1752
|
+
this.message = message;
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
Cancel.prototype.toString = function toString() {
|
|
1756
|
+
return 'Cancel' + (this.message ? ': ' + this.message : '');
|
|
1757
|
+
};
|
|
1758
|
+
|
|
1759
|
+
Cancel.prototype.__CANCEL__ = true;
|
|
1760
|
+
|
|
1761
|
+
var Cancel_1 = Cancel;
|
|
1762
|
+
|
|
1763
|
+
'use strict';
|
|
1764
|
+
|
|
1765
|
+
|
|
1766
|
+
|
|
1767
|
+
/**
|
|
1768
|
+
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
1769
|
+
*
|
|
1770
|
+
* @class
|
|
1771
|
+
* @param {Function} executor The executor function.
|
|
1772
|
+
*/
|
|
1773
|
+
function CancelToken(executor) {
|
|
1774
|
+
if (typeof executor !== 'function') {
|
|
1775
|
+
throw new TypeError('executor must be a function.');
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
var resolvePromise;
|
|
1779
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
1780
|
+
resolvePromise = resolve;
|
|
1781
|
+
});
|
|
1782
|
+
|
|
1783
|
+
var token = this;
|
|
1784
|
+
executor(function cancel(message) {
|
|
1785
|
+
if (token.reason) {
|
|
1786
|
+
// Cancellation has already been requested
|
|
1787
|
+
return;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
token.reason = new Cancel_1(message);
|
|
1791
|
+
resolvePromise(token.reason);
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
/**
|
|
1796
|
+
* Throws a `Cancel` if cancellation has been requested.
|
|
1797
|
+
*/
|
|
1798
|
+
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
1799
|
+
if (this.reason) {
|
|
1800
|
+
throw this.reason;
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1803
|
+
|
|
1804
|
+
/**
|
|
1805
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
1806
|
+
* cancels the `CancelToken`.
|
|
1807
|
+
*/
|
|
1808
|
+
CancelToken.source = function source() {
|
|
1809
|
+
var cancel;
|
|
1810
|
+
var token = new CancelToken(function executor(c) {
|
|
1811
|
+
cancel = c;
|
|
1812
|
+
});
|
|
1813
|
+
return {
|
|
1814
|
+
token: token,
|
|
1815
|
+
cancel: cancel
|
|
1816
|
+
};
|
|
1817
|
+
};
|
|
1818
|
+
|
|
1819
|
+
var CancelToken_1 = CancelToken;
|
|
1820
|
+
|
|
1821
|
+
'use strict';
|
|
1822
|
+
|
|
1823
|
+
/**
|
|
1824
|
+
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
|
1825
|
+
*
|
|
1826
|
+
* Common use case would be to use `Function.prototype.apply`.
|
|
1827
|
+
*
|
|
1828
|
+
* ```js
|
|
1829
|
+
* function f(x, y, z) {}
|
|
1830
|
+
* var args = [1, 2, 3];
|
|
1831
|
+
* f.apply(null, args);
|
|
1832
|
+
* ```
|
|
1833
|
+
*
|
|
1834
|
+
* With `spread` this example can be re-written.
|
|
1835
|
+
*
|
|
1836
|
+
* ```js
|
|
1837
|
+
* spread(function(x, y, z) {})([1, 2, 3]);
|
|
1838
|
+
* ```
|
|
1839
|
+
*
|
|
1840
|
+
* @param {Function} callback
|
|
1841
|
+
* @returns {Function}
|
|
1842
|
+
*/
|
|
1843
|
+
var spread = function spread(callback) {
|
|
1844
|
+
return function wrap(arr) {
|
|
1845
|
+
return callback.apply(null, arr);
|
|
1846
|
+
};
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1849
|
+
'use strict';
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Determines whether the payload is an error thrown by Axios
|
|
1853
|
+
*
|
|
1854
|
+
* @param {*} payload The value to test
|
|
1855
|
+
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
1856
|
+
*/
|
|
1857
|
+
var isAxiosError = function isAxiosError(payload) {
|
|
1858
|
+
return (typeof payload === 'object') && (payload.isAxiosError === true);
|
|
1859
|
+
};
|
|
1860
|
+
|
|
1861
|
+
'use strict';
|
|
1862
|
+
|
|
1863
|
+
|
|
1864
|
+
|
|
1865
|
+
|
|
1866
|
+
|
|
1867
|
+
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* Create an instance of Axios
|
|
1871
|
+
*
|
|
1872
|
+
* @param {Object} defaultConfig The default config for the instance
|
|
1873
|
+
* @return {Axios} A new instance of Axios
|
|
1874
|
+
*/
|
|
1875
|
+
function createInstance(defaultConfig) {
|
|
1876
|
+
var context = new Axios_1(defaultConfig);
|
|
1877
|
+
var instance = bind(Axios_1.prototype.request, context);
|
|
1878
|
+
|
|
1879
|
+
// Copy axios.prototype to instance
|
|
1880
|
+
utils.extend(instance, Axios_1.prototype, context);
|
|
1881
|
+
|
|
1882
|
+
// Copy context to instance
|
|
1883
|
+
utils.extend(instance, context);
|
|
1884
|
+
|
|
1885
|
+
return instance;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
// Create the default instance to be exported
|
|
1889
|
+
var axios$1 = createInstance(defaults_1);
|
|
1890
|
+
|
|
1891
|
+
// Expose Axios class to allow class inheritance
|
|
1892
|
+
axios$1.Axios = Axios_1;
|
|
1893
|
+
|
|
1894
|
+
// Factory for creating new instances
|
|
1895
|
+
axios$1.create = function create(instanceConfig) {
|
|
1896
|
+
return createInstance(mergeConfig(axios$1.defaults, instanceConfig));
|
|
1897
|
+
};
|
|
1898
|
+
|
|
1899
|
+
// Expose Cancel & CancelToken
|
|
1900
|
+
axios$1.Cancel = Cancel_1;
|
|
1901
|
+
axios$1.CancelToken = CancelToken_1;
|
|
1902
|
+
axios$1.isCancel = isCancel;
|
|
1903
|
+
|
|
1904
|
+
// Expose all/spread
|
|
1905
|
+
axios$1.all = function all(promises) {
|
|
1906
|
+
return Promise.all(promises);
|
|
1907
|
+
};
|
|
1908
|
+
axios$1.spread = spread;
|
|
1909
|
+
|
|
1910
|
+
// Expose isAxiosError
|
|
1911
|
+
axios$1.isAxiosError = isAxiosError;
|
|
1912
|
+
|
|
1913
|
+
var axios_1 = axios$1;
|
|
1914
|
+
|
|
1915
|
+
// Allow use of default import syntax in TypeScript
|
|
1916
|
+
var _default = axios$1;
|
|
1917
|
+
axios_1.default = _default;
|
|
1918
|
+
|
|
1919
|
+
var axios = axios_1;
|
|
1920
|
+
|
|
1921
|
+
"use strict";
|
|
1922
|
+
// This file provides a polyfill for managing globals in both NodeJS and browser environments. This is
|
|
1923
|
+
// an anti-pattern we'd hoped to avoid, but we have several projects dependending on one common library
|
|
1924
|
+
// (this js-sdk) and we want that library to provide a common endpoint to all callers (so authentication
|
|
1925
|
+
// tokens only need to be tracked in one place). The trouble is, one of those libraries is based on
|
|
1926
|
+
// StencilJS and is compiling its modules into Web Components. Because of how module resolution works,
|
|
1927
|
+
// when those Components load js-sdk they get a separate instance. Without messy options like having to
|
|
1928
|
+
// pass raw data from the caller to each Component, or pass around references to a common Endpoint, they
|
|
1929
|
+
// have no way to access authenticated sessions unless we make the Endpoint a true global.
|
|
1930
|
+
//
|
|
1931
|
+
// @credit https://github.com/medikoo/es5-ext/blob/master/global.js
|
|
1932
|
+
// @credit https://mathiasbynens.be/notes/globalthis
|
|
1933
|
+
var naiveFallback = function () {
|
|
1934
|
+
if (typeof self === 'object' && self)
|
|
1935
|
+
return self;
|
|
1936
|
+
if (typeof window === 'object' && window)
|
|
1937
|
+
return window;
|
|
1938
|
+
throw new Error('Unable to resolve global `this`');
|
|
1939
|
+
};
|
|
1940
|
+
var globalThis_1 = (function () {
|
|
1941
|
+
if (this)
|
|
1942
|
+
return this;
|
|
1943
|
+
// Unexpected strict mode (may happen if e.g. bundled into ESM module)
|
|
1944
|
+
// Fallback to standard globalThis if available
|
|
1945
|
+
if (typeof globalThis === 'object' && globalThis)
|
|
1946
|
+
return globalThis;
|
|
1947
|
+
// Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
|
|
1948
|
+
// In all ES5+ engines global object inherits from Object.prototype
|
|
1949
|
+
// (if you approached one that doesn't please report)
|
|
1950
|
+
try {
|
|
1951
|
+
Object.defineProperty(Object.prototype, '__global__', {
|
|
1952
|
+
get: function () {
|
|
1953
|
+
return this;
|
|
1954
|
+
},
|
|
1955
|
+
configurable: true,
|
|
1956
|
+
});
|
|
1957
|
+
}
|
|
1958
|
+
catch (error) {
|
|
1959
|
+
// Unfortunate case of updates to Object.prototype being restricted
|
|
1960
|
+
// via preventExtensions, seal or freeze
|
|
1961
|
+
return naiveFallback();
|
|
1962
|
+
}
|
|
1963
|
+
try {
|
|
1964
|
+
// Safari case (window.__global__ works, but __global__ does not)
|
|
1965
|
+
if (!__global__)
|
|
1966
|
+
return naiveFallback();
|
|
1967
|
+
return __global__;
|
|
1968
|
+
}
|
|
1969
|
+
finally {
|
|
1970
|
+
delete Object.prototype.__global__;
|
|
1971
|
+
}
|
|
1972
|
+
})();
|
|
1973
|
+
|
|
1974
|
+
/**
|
|
1975
|
+
* The Transport Endpoint is a global singleton used to call Verdocs APIs. There can only be one Endpoint per application, and
|
|
1976
|
+
* its configuration settings are shared for all callers.
|
|
1977
|
+
*
|
|
1978
|
+
* @module
|
|
1979
|
+
*/
|
|
1980
|
+
var DEFAULTS = {
|
|
1981
|
+
baseURL: 'https://api.verdocs.com/',
|
|
1982
|
+
timeout: 3000,
|
|
1983
|
+
headers: { 'X-Client-ID': 'NONE' },
|
|
1984
|
+
};
|
|
1985
|
+
// @credit https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/
|
|
1986
|
+
// Also see globalThis for comments about why we're doing this in the first place.
|
|
1987
|
+
var ENDPOINT_KEY = Symbol.for('verdocs-api-endpoint');
|
|
1988
|
+
if (!globalThis_1[ENDPOINT_KEY]) {
|
|
1989
|
+
globalThis_1[ENDPOINT_KEY] = axios.create(DEFAULTS);
|
|
1990
|
+
}
|
|
1991
|
+
var endpoint = globalThis_1[ENDPOINT_KEY];
|
|
1992
|
+
var requestLogger = function (r) {
|
|
1993
|
+
// tslint:disable-next-line
|
|
1994
|
+
console.log("[JS-SDK] " + r.method.toUpperCase() + " " + r.baseURL + r.url, r.data ? JSON.stringify(r.data) : '');
|
|
1995
|
+
return r;
|
|
1996
|
+
};
|
|
1997
|
+
/**
|
|
1998
|
+
* Set the auth token that will be used for Verdocs API calls.
|
|
1999
|
+
*
|
|
2000
|
+
* ```typescript
|
|
2001
|
+
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
2002
|
+
*
|
|
2003
|
+
* Transport.setAuthorization(accessToken);
|
|
2004
|
+
* ```
|
|
2005
|
+
*/
|
|
2006
|
+
var setAuthorization = function (accessToken) {
|
|
2007
|
+
if (accessToken) {
|
|
2008
|
+
endpoint.defaults.headers.Authorization = "Bearer " + accessToken;
|
|
2009
|
+
}
|
|
2010
|
+
else {
|
|
2011
|
+
delete endpoint.defaults.headers.Authorization;
|
|
2012
|
+
}
|
|
2013
|
+
};
|
|
2014
|
+
/**
|
|
2015
|
+
* Set the Client ID for Verdocs API calls.
|
|
2016
|
+
*
|
|
2017
|
+
* ```typescript
|
|
2018
|
+
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
2019
|
+
*
|
|
2020
|
+
* Transport.setClientID('1234);
|
|
2021
|
+
* ```
|
|
2022
|
+
*/
|
|
2023
|
+
var setClientID = function (clientID) {
|
|
2024
|
+
endpoint.defaults.headers['X-Client-ID'] = clientID;
|
|
2025
|
+
};
|
|
2026
|
+
/**
|
|
2027
|
+
* Set the base URL for API calls. This defaults to https://api.verdocs.com/ and should only be changed after consultation with
|
|
2028
|
+
* Verdocs Developer Support (e.g. to access a private API endpoint).
|
|
2029
|
+
*
|
|
2030
|
+
* ```typescript
|
|
2031
|
+
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
2032
|
+
*
|
|
2033
|
+
* Transport.setBaseUrl('https://my-private-api.verdocs.com');
|
|
2034
|
+
* ```
|
|
2035
|
+
*/
|
|
2036
|
+
var setBaseUrl = function (baseUrl) {
|
|
2037
|
+
endpoint.defaults.baseURL = baseUrl;
|
|
2038
|
+
};
|
|
2039
|
+
/**
|
|
2040
|
+
* Set the timeout for API calls in milliseconds. 2000-4000ms is recommended for most purposes. 3000ms is the default.
|
|
2041
|
+
*
|
|
2042
|
+
* ```typescript
|
|
2043
|
+
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
2044
|
+
*
|
|
2045
|
+
* Transport.setTimeout(3000);
|
|
2046
|
+
* ```
|
|
2047
|
+
*/
|
|
2048
|
+
var setTimeout$1 = function (timeout) {
|
|
2049
|
+
endpoint.defaults.timeout = timeout;
|
|
2050
|
+
};
|
|
2051
|
+
/**
|
|
2052
|
+
* Enable or disable request logging. This may expose sensitive data in the console log, so it should only be used for debugging.
|
|
2053
|
+
*
|
|
2054
|
+
* ```typescript
|
|
2055
|
+
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
2056
|
+
*
|
|
2057
|
+
* Transport.logRequests(true);
|
|
2058
|
+
* ```
|
|
2059
|
+
*/
|
|
2060
|
+
var requestLoggerId = null;
|
|
2061
|
+
var logRequests = function (enable) {
|
|
2062
|
+
if (enable && requestLoggerId === null) {
|
|
2063
|
+
requestLoggerId = endpoint.interceptors.request.use(requestLogger);
|
|
2064
|
+
}
|
|
2065
|
+
else if (!enable && requestLoggerId !== null) {
|
|
2066
|
+
endpoint.interceptors.request.eject(requestLoggerId);
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
/**
|
|
2070
|
+
* Helper to get the endpoint for direct access to HTTP functions.
|
|
2071
|
+
*
|
|
2072
|
+
* ```typescript
|
|
2073
|
+
* import {Transport} from '@verdocs/js-sdk/HTTP';
|
|
2074
|
+
*
|
|
2075
|
+
* console.log('Current timeout', Transport.getEndpoint().defaults.timeout);
|
|
2076
|
+
* ```
|
|
2077
|
+
*/
|
|
2078
|
+
var getEndpoint = function () {
|
|
2079
|
+
return endpoint;
|
|
2080
|
+
};
|
|
2081
|
+
|
|
2082
|
+
/**
|
|
2083
|
+
* Verdocs provides a range of search functions to help find and retrieve content. This module provides generic functions intended
|
|
2084
|
+
* to locate items across all content types. More specific retrievals may be performed using the various "list" endpoints within
|
|
2085
|
+
* each collection (e.g. {@link Documents.Documents.searchDocuments} or {@link Templates.Templates.searchTemplates}).
|
|
2086
|
+
*
|
|
2087
|
+
* @module
|
|
2088
|
+
*/
|
|
2089
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2090
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2091
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2092
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2093
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2094
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2095
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2096
|
+
});
|
|
2097
|
+
};
|
|
2098
|
+
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
2099
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
2100
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
2101
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
2102
|
+
function step(op) {
|
|
2103
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
2104
|
+
while (_) try {
|
|
2105
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2106
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
2107
|
+
switch (op[0]) {
|
|
2108
|
+
case 0: case 1: t = op; break;
|
|
2109
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
2110
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
2111
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
2112
|
+
default:
|
|
2113
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
2114
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
2115
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
2116
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
2117
|
+
if (t[2]) _.ops.pop();
|
|
2118
|
+
_.trys.pop(); continue;
|
|
2119
|
+
}
|
|
2120
|
+
op = body.call(thisArg, _);
|
|
2121
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
2122
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2123
|
+
}
|
|
2124
|
+
};
|
|
2125
|
+
/**
|
|
2126
|
+
* Retrieve recent and saved searches. Note that result counts will be limited to a maximum of 20 entries for each
|
|
2127
|
+
* type but this may be expanded in the future. Client UI's should self-limit display counts as needed.
|
|
2128
|
+
*
|
|
2129
|
+
* ```typescript
|
|
2130
|
+
* import {Content} from '@verdocs/js-sdk/Search';
|
|
2131
|
+
*
|
|
2132
|
+
* const {recent, saved} = await Content.getSearchHistory();
|
|
2133
|
+
* ```
|
|
2134
|
+
*/
|
|
2135
|
+
var getSearchHistory = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2136
|
+
return __generator(this, function (_a) {
|
|
2137
|
+
return [2 /*return*/, getEndpoint()
|
|
2138
|
+
.get('/search/history')
|
|
2139
|
+
.then(function (r) { return r.data; })];
|
|
2140
|
+
});
|
|
2141
|
+
}); };
|
|
2142
|
+
/**
|
|
2143
|
+
* Save a search. If a name is re-used, that saved search will be overwritten with the new parameters.
|
|
2144
|
+
*
|
|
2145
|
+
* ```typescript
|
|
2146
|
+
* import {Content} from '@verdocs/js-sdk/Search';
|
|
2147
|
+
*
|
|
2148
|
+
* const entry = await Documents.saveSearch('W9 Forms', {q: 'w9', type: 'template});
|
|
2149
|
+
* ```
|
|
2150
|
+
*/
|
|
2151
|
+
var saveSearch = function (name, params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2152
|
+
return __generator(this, function (_a) {
|
|
2153
|
+
return [2 /*return*/, getEndpoint()
|
|
2154
|
+
.post('/search/saved', { name: name, params: params })
|
|
2155
|
+
.then(function (r) { return r.data; })];
|
|
2156
|
+
});
|
|
2157
|
+
}); };
|
|
2158
|
+
/**
|
|
2159
|
+
* Search for documents matching various criteria.
|
|
2160
|
+
*
|
|
2161
|
+
* ```typescript
|
|
2162
|
+
* import {Content} from '@verdocs/js-sdk/Search';
|
|
2163
|
+
*
|
|
2164
|
+
* const {result, page, total} = await Documents.search({ ... });
|
|
2165
|
+
* ```
|
|
2166
|
+
*/
|
|
2167
|
+
var searchContent = function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2168
|
+
return __generator(this, function (_a) {
|
|
2169
|
+
return [2 /*return*/, getEndpoint()
|
|
2170
|
+
.post('/search/content')
|
|
2171
|
+
.then(function (r) { return r.data; })];
|
|
2172
|
+
});
|
|
2173
|
+
}); };
|
|
2174
|
+
|
|
2175
|
+
export { getSearchHistory as g };
|