notu 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/notu.js +1225 -1225
- package/dist/notu.umd.cjs +5 -5
- package/package.json +1 -1
package/dist/notu.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => (__defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value), value);
|
|
4
|
+
class ModelWithState {
|
|
5
5
|
constructor() {
|
|
6
|
-
|
|
6
|
+
__publicField(this, "state", "NEW");
|
|
7
7
|
}
|
|
8
8
|
new() {
|
|
9
9
|
return this.state = "NEW", this;
|
|
@@ -29,32 +29,32 @@ class I {
|
|
|
29
29
|
get isDeleted() {
|
|
30
30
|
return this.state == "DELETED";
|
|
31
31
|
}
|
|
32
|
-
validate(
|
|
32
|
+
validate(throwError = !1) {
|
|
33
33
|
return !0;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
class
|
|
36
|
+
class Attr extends ModelWithState {
|
|
37
37
|
constructor() {
|
|
38
38
|
super(...arguments);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
__publicField(this, "id", 0);
|
|
40
|
+
__publicField(this, "_name", "");
|
|
41
|
+
__publicField(this, "_type", "TEXT");
|
|
42
|
+
__publicField(this, "_spaceId", 0);
|
|
43
|
+
__publicField(this, "_space", null);
|
|
44
44
|
}
|
|
45
45
|
get name() {
|
|
46
46
|
return this._name;
|
|
47
47
|
}
|
|
48
|
-
set name(
|
|
49
|
-
|
|
48
|
+
set name(value) {
|
|
49
|
+
value !== this._name && (this._name = value, this.isClean && this.dirty());
|
|
50
50
|
}
|
|
51
51
|
get type() {
|
|
52
52
|
return this._type;
|
|
53
53
|
}
|
|
54
|
-
set type(
|
|
54
|
+
set type(value) {
|
|
55
55
|
if (!this.isNew)
|
|
56
56
|
throw Error("Cannot change an attribute's type once it has been created.");
|
|
57
|
-
this._type =
|
|
57
|
+
this._type = value;
|
|
58
58
|
}
|
|
59
59
|
get isText() {
|
|
60
60
|
return this.type == "TEXT";
|
|
@@ -83,25 +83,25 @@ class Rt extends I {
|
|
|
83
83
|
get spaceId() {
|
|
84
84
|
return this._spaceId;
|
|
85
85
|
}
|
|
86
|
-
set spaceId(
|
|
87
|
-
var
|
|
88
|
-
|
|
86
|
+
set spaceId(value) {
|
|
87
|
+
var _a;
|
|
88
|
+
value !== this._spaceId && (this._spaceId = value, value !== ((_a = this.space) == null ? void 0 : _a.id) && (this._space = null), this.isClean && this.dirty());
|
|
89
89
|
}
|
|
90
90
|
get space() {
|
|
91
91
|
return this._space;
|
|
92
92
|
}
|
|
93
|
-
set space(
|
|
94
|
-
this._space =
|
|
93
|
+
set space(value) {
|
|
94
|
+
this._space = value, this.spaceId = (value == null ? void 0 : value.id) ?? 0;
|
|
95
95
|
}
|
|
96
96
|
duplicate() {
|
|
97
|
-
const
|
|
98
|
-
return
|
|
97
|
+
const output = new Attr();
|
|
98
|
+
return output.id = this.id, output.name = this.name, output.type = this.type, output.space = this.space, output;
|
|
99
99
|
}
|
|
100
|
-
validate(
|
|
101
|
-
let
|
|
102
|
-
if (this.spaceId <= 0 ?
|
|
103
|
-
throw Error(
|
|
104
|
-
return
|
|
100
|
+
validate(throwError = !1) {
|
|
101
|
+
let output = null;
|
|
102
|
+
if (this.spaceId <= 0 ? output = "Note spaceId must be greater than zero." : !this.isNew && this.id <= 0 && (output = "Attr id must be greater than zero if in non-new state."), throwError && output != null)
|
|
103
|
+
throw Error(output);
|
|
104
|
+
return output == null;
|
|
105
105
|
}
|
|
106
106
|
get defaultValue() {
|
|
107
107
|
switch (this.type) {
|
|
@@ -116,13 +116,13 @@ class Rt extends I {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
class
|
|
120
|
-
constructor(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (!
|
|
119
|
+
class Environment {
|
|
120
|
+
constructor(client) {
|
|
121
|
+
__publicField(this, "_client", null);
|
|
122
|
+
__publicField(this, "_spaces", []);
|
|
123
|
+
if (!client)
|
|
124
124
|
throw Error("Client must be set on Environment constructor");
|
|
125
|
-
this._client =
|
|
125
|
+
this._client = client;
|
|
126
126
|
}
|
|
127
127
|
get client() {
|
|
128
128
|
return this._client;
|
|
@@ -133,254 +133,254 @@ class gn {
|
|
|
133
133
|
async loadSpaces() {
|
|
134
134
|
return this._spaces = await this.client.getSpaces(), this.spaces;
|
|
135
135
|
}
|
|
136
|
-
async saveSpace(
|
|
137
|
-
return await this.client.saveSpace(
|
|
136
|
+
async saveSpace(space) {
|
|
137
|
+
return await this.client.saveSpace(space);
|
|
138
138
|
}
|
|
139
|
-
async getNotes(
|
|
140
|
-
return await this.client.getNotes(
|
|
139
|
+
async getNotes(query, spaceId) {
|
|
140
|
+
return await this.client.getNotes(query, spaceId);
|
|
141
141
|
}
|
|
142
|
-
async getNoteCount(
|
|
143
|
-
return await this.client.getNoteCount(
|
|
142
|
+
async getNoteCount(query, spaceId) {
|
|
143
|
+
return await this.client.getNoteCount(query, spaceId);
|
|
144
144
|
}
|
|
145
|
-
async saveNote(
|
|
146
|
-
return (await this.client.saveNotes([
|
|
145
|
+
async saveNote(note) {
|
|
146
|
+
return (await this.client.saveNotes([note]))[0];
|
|
147
147
|
}
|
|
148
|
-
async saveNotes(
|
|
149
|
-
return await this.client.saveNotes(
|
|
148
|
+
async saveNotes(notes) {
|
|
149
|
+
return await this.client.saveNotes(notes);
|
|
150
150
|
}
|
|
151
|
-
async customJob(
|
|
152
|
-
return await this.client.customJob(
|
|
151
|
+
async customJob(name, data) {
|
|
152
|
+
return await this.client.customJob(name, data);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function bind(fn, thisArg) {
|
|
156
156
|
return function() {
|
|
157
|
-
return
|
|
157
|
+
return fn.apply(thisArg, arguments);
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
-
const { toString
|
|
161
|
-
const
|
|
162
|
-
return
|
|
163
|
-
})(/* @__PURE__ */ Object.create(null)),
|
|
164
|
-
function
|
|
165
|
-
return
|
|
160
|
+
const { toString } = Object.prototype, { getPrototypeOf } = Object, kindOf = ((cache) => (thing) => {
|
|
161
|
+
const str = toString.call(thing);
|
|
162
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
163
|
+
})(/* @__PURE__ */ Object.create(null)), kindOfTest = (type) => (type = type.toLowerCase(), (thing) => kindOf(thing) === type), typeOfTest = (type) => (thing) => typeof thing === type, { isArray } = Array, isUndefined = typeOfTest("undefined");
|
|
164
|
+
function isBuffer(val) {
|
|
165
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
166
166
|
}
|
|
167
|
-
const
|
|
168
|
-
function
|
|
169
|
-
let
|
|
170
|
-
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ?
|
|
167
|
+
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
168
|
+
function isArrayBufferView(val) {
|
|
169
|
+
let result;
|
|
170
|
+
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? result = ArrayBuffer.isView(val) : result = val && val.buffer && isArrayBuffer(val.buffer), result;
|
|
171
171
|
}
|
|
172
|
-
const
|
|
173
|
-
if (
|
|
172
|
+
const isString = typeOfTest("string"), isFunction = typeOfTest("function"), isNumber = typeOfTest("number"), isObject = (thing) => thing !== null && typeof thing == "object", isBoolean = (thing) => thing === !0 || thing === !1, isPlainObject = (val) => {
|
|
173
|
+
if (kindOf(val) !== "object")
|
|
174
174
|
return !1;
|
|
175
|
-
const
|
|
176
|
-
return (
|
|
177
|
-
},
|
|
178
|
-
let
|
|
179
|
-
return
|
|
180
|
-
|
|
181
|
-
},
|
|
182
|
-
function
|
|
183
|
-
if (
|
|
175
|
+
const prototype2 = getPrototypeOf(val);
|
|
176
|
+
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
177
|
+
}, isDate = kindOfTest("Date"), isFile = kindOfTest("File"), isBlob = kindOfTest("Blob"), isFileList = kindOfTest("FileList"), isStream = (val) => isObject(val) && isFunction(val.pipe), isFormData = (thing) => {
|
|
178
|
+
let kind;
|
|
179
|
+
return thing && (typeof FormData == "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
180
|
+
kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
|
|
181
|
+
}, isURLSearchParams = kindOfTest("URLSearchParams"), trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
182
|
+
function forEach(obj, fn, { allOwnKeys = !1 } = {}) {
|
|
183
|
+
if (obj === null || typeof obj > "u")
|
|
184
184
|
return;
|
|
185
|
-
let
|
|
186
|
-
if (typeof
|
|
187
|
-
for (
|
|
188
|
-
|
|
185
|
+
let i, l;
|
|
186
|
+
if (typeof obj != "object" && (obj = [obj]), isArray(obj))
|
|
187
|
+
for (i = 0, l = obj.length; i < l; i++)
|
|
188
|
+
fn.call(null, obj[i], i, obj);
|
|
189
189
|
else {
|
|
190
|
-
const
|
|
191
|
-
let
|
|
192
|
-
for (
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
function
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
let
|
|
200
|
-
for (;
|
|
201
|
-
if (
|
|
202
|
-
return
|
|
190
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj), len = keys.length;
|
|
191
|
+
let key;
|
|
192
|
+
for (i = 0; i < len; i++)
|
|
193
|
+
key = keys[i], fn.call(null, obj[key], key, obj);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function findKey(obj, key) {
|
|
197
|
+
key = key.toLowerCase();
|
|
198
|
+
const keys = Object.keys(obj);
|
|
199
|
+
let i = keys.length, _key;
|
|
200
|
+
for (; i-- > 0; )
|
|
201
|
+
if (_key = keys[i], key === _key.toLowerCase())
|
|
202
|
+
return _key;
|
|
203
203
|
return null;
|
|
204
204
|
}
|
|
205
|
-
const
|
|
206
|
-
function
|
|
207
|
-
const { caseless
|
|
208
|
-
const
|
|
209
|
-
|
|
205
|
+
const _global = (() => typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global)(), isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
206
|
+
function merge() {
|
|
207
|
+
const { caseless } = isContextDefined(this) && this || {}, result = {}, assignValue = (val, key) => {
|
|
208
|
+
const targetKey = caseless && findKey(result, key) || key;
|
|
209
|
+
isPlainObject(result[targetKey]) && isPlainObject(val) ? result[targetKey] = merge(result[targetKey], val) : isPlainObject(val) ? result[targetKey] = merge({}, val) : isArray(val) ? result[targetKey] = val.slice() : result[targetKey] = val;
|
|
210
210
|
};
|
|
211
|
-
for (let
|
|
212
|
-
arguments[
|
|
213
|
-
return
|
|
214
|
-
}
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
}, { allOwnKeys
|
|
218
|
-
|
|
219
|
-
value:
|
|
220
|
-
}),
|
|
221
|
-
},
|
|
222
|
-
let
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
225
|
-
return
|
|
211
|
+
for (let i = 0, l = arguments.length; i < l; i++)
|
|
212
|
+
arguments[i] && forEach(arguments[i], assignValue);
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
const extend = (a, b, thisArg, { allOwnKeys } = {}) => (forEach(b, (val, key) => {
|
|
216
|
+
thisArg && isFunction(val) ? a[key] = bind(val, thisArg) : a[key] = val;
|
|
217
|
+
}, { allOwnKeys }), a), stripBOM = (content) => (content.charCodeAt(0) === 65279 && (content = content.slice(1)), content), inherits = (constructor, superConstructor, props, descriptors2) => {
|
|
218
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors2), constructor.prototype.constructor = constructor, Object.defineProperty(constructor, "super", {
|
|
219
|
+
value: superConstructor.prototype
|
|
220
|
+
}), props && Object.assign(constructor.prototype, props);
|
|
221
|
+
}, toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
|
|
222
|
+
let props, i, prop;
|
|
223
|
+
const merged = {};
|
|
224
|
+
if (destObj = destObj || {}, sourceObj == null)
|
|
225
|
+
return destObj;
|
|
226
226
|
do {
|
|
227
|
-
for (
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
} while (
|
|
231
|
-
return
|
|
232
|
-
},
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
return
|
|
236
|
-
},
|
|
237
|
-
if (!
|
|
227
|
+
for (props = Object.getOwnPropertyNames(sourceObj), i = props.length; i-- > 0; )
|
|
228
|
+
prop = props[i], (!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop] && (destObj[prop] = sourceObj[prop], merged[prop] = !0);
|
|
229
|
+
sourceObj = filter2 !== !1 && getPrototypeOf(sourceObj);
|
|
230
|
+
} while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
231
|
+
return destObj;
|
|
232
|
+
}, endsWith = (str, searchString, position) => {
|
|
233
|
+
str = String(str), (position === void 0 || position > str.length) && (position = str.length), position -= searchString.length;
|
|
234
|
+
const lastIndex = str.indexOf(searchString, position);
|
|
235
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
236
|
+
}, toArray = (thing) => {
|
|
237
|
+
if (!thing)
|
|
238
238
|
return null;
|
|
239
|
-
if (
|
|
240
|
-
return
|
|
241
|
-
let
|
|
242
|
-
if (!
|
|
239
|
+
if (isArray(thing))
|
|
240
|
+
return thing;
|
|
241
|
+
let i = thing.length;
|
|
242
|
+
if (!isNumber(i))
|
|
243
243
|
return null;
|
|
244
|
-
const
|
|
245
|
-
for (;
|
|
246
|
-
|
|
247
|
-
return
|
|
248
|
-
},
|
|
249
|
-
const
|
|
250
|
-
let
|
|
251
|
-
for (; (
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
let
|
|
257
|
-
const
|
|
258
|
-
for (; (
|
|
259
|
-
|
|
260
|
-
return
|
|
261
|
-
},
|
|
244
|
+
const arr = new Array(i);
|
|
245
|
+
for (; i-- > 0; )
|
|
246
|
+
arr[i] = thing[i];
|
|
247
|
+
return arr;
|
|
248
|
+
}, isTypedArray = ((TypedArray) => (thing) => TypedArray && thing instanceof TypedArray)(typeof Uint8Array < "u" && getPrototypeOf(Uint8Array)), forEachEntry = (obj, fn) => {
|
|
249
|
+
const iterator = (obj && obj[Symbol.iterator]).call(obj);
|
|
250
|
+
let result;
|
|
251
|
+
for (; (result = iterator.next()) && !result.done; ) {
|
|
252
|
+
const pair = result.value;
|
|
253
|
+
fn.call(obj, pair[0], pair[1]);
|
|
254
|
+
}
|
|
255
|
+
}, matchAll = (regExp, str) => {
|
|
256
|
+
let matches;
|
|
257
|
+
const arr = [];
|
|
258
|
+
for (; (matches = regExp.exec(str)) !== null; )
|
|
259
|
+
arr.push(matches);
|
|
260
|
+
return arr;
|
|
261
|
+
}, isHTMLForm = kindOfTest("HTMLFormElement"), toCamelCase = (str) => str.toLowerCase().replace(
|
|
262
262
|
/[-_\s]([a-z\d])(\w*)/g,
|
|
263
|
-
function(
|
|
264
|
-
return
|
|
265
|
-
}
|
|
266
|
-
),
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
let
|
|
270
|
-
(
|
|
271
|
-
}), Object.defineProperties(
|
|
272
|
-
},
|
|
273
|
-
|
|
274
|
-
if (
|
|
263
|
+
function(m, p1, p2) {
|
|
264
|
+
return p1.toUpperCase() + p2;
|
|
265
|
+
}
|
|
266
|
+
), hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype), isRegExp = kindOfTest("RegExp"), reduceDescriptors = (obj, reducer) => {
|
|
267
|
+
const descriptors2 = Object.getOwnPropertyDescriptors(obj), reducedDescriptors = {};
|
|
268
|
+
forEach(descriptors2, (descriptor, name) => {
|
|
269
|
+
let ret;
|
|
270
|
+
(ret = reducer(descriptor, name, obj)) !== !1 && (reducedDescriptors[name] = ret || descriptor);
|
|
271
|
+
}), Object.defineProperties(obj, reducedDescriptors);
|
|
272
|
+
}, freezeMethods = (obj) => {
|
|
273
|
+
reduceDescriptors(obj, (descriptor, name) => {
|
|
274
|
+
if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1)
|
|
275
275
|
return !1;
|
|
276
|
-
const
|
|
277
|
-
if (
|
|
278
|
-
if (
|
|
279
|
-
|
|
276
|
+
const value = obj[name];
|
|
277
|
+
if (isFunction(value)) {
|
|
278
|
+
if (descriptor.enumerable = !1, "writable" in descriptor) {
|
|
279
|
+
descriptor.writable = !1;
|
|
280
280
|
return;
|
|
281
281
|
}
|
|
282
|
-
|
|
283
|
-
throw Error("Can not rewrite read-only method '" +
|
|
282
|
+
descriptor.set || (descriptor.set = () => {
|
|
283
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
});
|
|
287
|
-
},
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
287
|
+
}, toObjectSet = (arrayOrString, delimiter) => {
|
|
288
|
+
const obj = {}, define = (arr) => {
|
|
289
|
+
arr.forEach((value) => {
|
|
290
|
+
obj[value] = !0;
|
|
291
291
|
});
|
|
292
292
|
};
|
|
293
|
-
return
|
|
294
|
-
},
|
|
295
|
-
},
|
|
296
|
-
DIGIT
|
|
297
|
-
ALPHA
|
|
298
|
-
ALPHA_DIGIT:
|
|
299
|
-
},
|
|
300
|
-
let
|
|
301
|
-
const { length
|
|
302
|
-
for (;
|
|
303
|
-
|
|
304
|
-
return
|
|
293
|
+
return isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)), obj;
|
|
294
|
+
}, noop = () => {
|
|
295
|
+
}, toFiniteNumber = (value, defaultValue) => (value = +value, Number.isFinite(value) ? value : defaultValue), ALPHA = "abcdefghijklmnopqrstuvwxyz", DIGIT = "0123456789", ALPHABET = {
|
|
296
|
+
DIGIT,
|
|
297
|
+
ALPHA,
|
|
298
|
+
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
299
|
+
}, generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
300
|
+
let str = "";
|
|
301
|
+
const { length } = alphabet;
|
|
302
|
+
for (; size--; )
|
|
303
|
+
str += alphabet[Math.random() * length | 0];
|
|
304
|
+
return str;
|
|
305
305
|
};
|
|
306
|
-
function
|
|
307
|
-
return !!(
|
|
306
|
+
function isSpecCompliantForm(thing) {
|
|
307
|
+
return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]);
|
|
308
308
|
}
|
|
309
|
-
const
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
312
|
-
if (
|
|
309
|
+
const toJSONObject = (obj) => {
|
|
310
|
+
const stack = new Array(10), visit = (source, i) => {
|
|
311
|
+
if (isObject(source)) {
|
|
312
|
+
if (stack.indexOf(source) >= 0)
|
|
313
313
|
return;
|
|
314
|
-
if (!("toJSON" in
|
|
315
|
-
|
|
316
|
-
const
|
|
317
|
-
return
|
|
318
|
-
const
|
|
319
|
-
!
|
|
320
|
-
}),
|
|
314
|
+
if (!("toJSON" in source)) {
|
|
315
|
+
stack[i] = source;
|
|
316
|
+
const target = isArray(source) ? [] : {};
|
|
317
|
+
return forEach(source, (value, key) => {
|
|
318
|
+
const reducedValue = visit(value, i + 1);
|
|
319
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
320
|
+
}), stack[i] = void 0, target;
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
return
|
|
323
|
+
return source;
|
|
324
324
|
};
|
|
325
|
-
return
|
|
326
|
-
},
|
|
327
|
-
isArray
|
|
328
|
-
isArrayBuffer
|
|
329
|
-
isBuffer
|
|
330
|
-
isFormData
|
|
331
|
-
isArrayBufferView
|
|
332
|
-
isString
|
|
333
|
-
isNumber
|
|
334
|
-
isBoolean
|
|
335
|
-
isObject
|
|
336
|
-
isPlainObject
|
|
337
|
-
isUndefined
|
|
338
|
-
isDate
|
|
339
|
-
isFile
|
|
340
|
-
isBlob
|
|
341
|
-
isRegExp
|
|
342
|
-
isFunction
|
|
343
|
-
isStream
|
|
344
|
-
isURLSearchParams
|
|
345
|
-
isTypedArray
|
|
346
|
-
isFileList
|
|
347
|
-
forEach
|
|
348
|
-
merge
|
|
349
|
-
extend
|
|
350
|
-
trim
|
|
351
|
-
stripBOM
|
|
352
|
-
inherits
|
|
353
|
-
toFlatObject
|
|
354
|
-
kindOf
|
|
355
|
-
kindOfTest
|
|
356
|
-
endsWith
|
|
357
|
-
toArray
|
|
358
|
-
forEachEntry
|
|
359
|
-
matchAll
|
|
360
|
-
isHTMLForm
|
|
361
|
-
hasOwnProperty
|
|
362
|
-
hasOwnProp:
|
|
325
|
+
return visit(obj, 0);
|
|
326
|
+
}, isAsyncFn = kindOfTest("AsyncFunction"), isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch), utils = {
|
|
327
|
+
isArray,
|
|
328
|
+
isArrayBuffer,
|
|
329
|
+
isBuffer,
|
|
330
|
+
isFormData,
|
|
331
|
+
isArrayBufferView,
|
|
332
|
+
isString,
|
|
333
|
+
isNumber,
|
|
334
|
+
isBoolean,
|
|
335
|
+
isObject,
|
|
336
|
+
isPlainObject,
|
|
337
|
+
isUndefined,
|
|
338
|
+
isDate,
|
|
339
|
+
isFile,
|
|
340
|
+
isBlob,
|
|
341
|
+
isRegExp,
|
|
342
|
+
isFunction,
|
|
343
|
+
isStream,
|
|
344
|
+
isURLSearchParams,
|
|
345
|
+
isTypedArray,
|
|
346
|
+
isFileList,
|
|
347
|
+
forEach,
|
|
348
|
+
merge,
|
|
349
|
+
extend,
|
|
350
|
+
trim,
|
|
351
|
+
stripBOM,
|
|
352
|
+
inherits,
|
|
353
|
+
toFlatObject,
|
|
354
|
+
kindOf,
|
|
355
|
+
kindOfTest,
|
|
356
|
+
endsWith,
|
|
357
|
+
toArray,
|
|
358
|
+
forEachEntry,
|
|
359
|
+
matchAll,
|
|
360
|
+
isHTMLForm,
|
|
361
|
+
hasOwnProperty,
|
|
362
|
+
hasOwnProp: hasOwnProperty,
|
|
363
363
|
// an alias to avoid ESLint no-prototype-builtins detection
|
|
364
|
-
reduceDescriptors
|
|
365
|
-
freezeMethods
|
|
366
|
-
toObjectSet
|
|
367
|
-
toCamelCase
|
|
368
|
-
noop
|
|
369
|
-
toFiniteNumber
|
|
370
|
-
findKey
|
|
371
|
-
global:
|
|
372
|
-
isContextDefined
|
|
373
|
-
ALPHABET
|
|
374
|
-
generateString
|
|
375
|
-
isSpecCompliantForm
|
|
376
|
-
toJSONObject
|
|
377
|
-
isAsyncFn
|
|
378
|
-
isThenable
|
|
364
|
+
reduceDescriptors,
|
|
365
|
+
freezeMethods,
|
|
366
|
+
toObjectSet,
|
|
367
|
+
toCamelCase,
|
|
368
|
+
noop,
|
|
369
|
+
toFiniteNumber,
|
|
370
|
+
findKey,
|
|
371
|
+
global: _global,
|
|
372
|
+
isContextDefined,
|
|
373
|
+
ALPHABET,
|
|
374
|
+
generateString,
|
|
375
|
+
isSpecCompliantForm,
|
|
376
|
+
toJSONObject,
|
|
377
|
+
isAsyncFn,
|
|
378
|
+
isThenable
|
|
379
379
|
};
|
|
380
|
-
function
|
|
381
|
-
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message =
|
|
380
|
+
function AxiosError(message, code, config, request, response) {
|
|
381
|
+
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = message, this.name = "AxiosError", code && (this.code = code), config && (this.config = config), request && (this.request = request), response && (this.response = response);
|
|
382
382
|
}
|
|
383
|
-
|
|
383
|
+
utils.inherits(AxiosError, Error, {
|
|
384
384
|
toJSON: function() {
|
|
385
385
|
return {
|
|
386
386
|
// Standard
|
|
@@ -395,13 +395,13 @@ a.inherits(g, Error, {
|
|
|
395
395
|
columnNumber: this.columnNumber,
|
|
396
396
|
stack: this.stack,
|
|
397
397
|
// Axios
|
|
398
|
-
config:
|
|
398
|
+
config: utils.toJSONObject(this.config),
|
|
399
399
|
code: this.code,
|
|
400
400
|
status: this.response && this.response.status ? this.response.status : null
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
403
|
});
|
|
404
|
-
const
|
|
404
|
+
const prototype$1 = AxiosError.prototype, descriptors = {};
|
|
405
405
|
[
|
|
406
406
|
"ERR_BAD_OPTION_VALUE",
|
|
407
407
|
"ERR_BAD_OPTION",
|
|
@@ -416,99 +416,99 @@ const Pt = g.prototype, Dt = {};
|
|
|
416
416
|
"ERR_NOT_SUPPORT",
|
|
417
417
|
"ERR_INVALID_URL"
|
|
418
418
|
// eslint-disable-next-line func-names
|
|
419
|
-
].forEach((
|
|
420
|
-
|
|
419
|
+
].forEach((code) => {
|
|
420
|
+
descriptors[code] = { value: code };
|
|
421
421
|
});
|
|
422
|
-
Object.defineProperties(
|
|
423
|
-
Object.defineProperty(
|
|
424
|
-
|
|
425
|
-
const
|
|
426
|
-
return
|
|
427
|
-
return
|
|
428
|
-
}, (
|
|
422
|
+
Object.defineProperties(AxiosError, descriptors);
|
|
423
|
+
Object.defineProperty(prototype$1, "isAxiosError", { value: !0 });
|
|
424
|
+
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
425
|
+
const axiosError = Object.create(prototype$1);
|
|
426
|
+
return utils.toFlatObject(error, axiosError, function(obj) {
|
|
427
|
+
return obj !== Error.prototype;
|
|
428
|
+
}, (prop) => prop !== "isAxiosError"), AxiosError.call(axiosError, error.message, code, config, request, response), axiosError.cause = error, axiosError.name = error.name, customProps && Object.assign(axiosError, customProps), axiosError;
|
|
429
429
|
};
|
|
430
|
-
const
|
|
431
|
-
function
|
|
432
|
-
return
|
|
430
|
+
const httpAdapter = null;
|
|
431
|
+
function isVisitable(thing) {
|
|
432
|
+
return utils.isPlainObject(thing) || utils.isArray(thing);
|
|
433
433
|
}
|
|
434
|
-
function
|
|
435
|
-
return
|
|
434
|
+
function removeBrackets(key) {
|
|
435
|
+
return utils.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
436
436
|
}
|
|
437
|
-
function
|
|
438
|
-
return
|
|
439
|
-
return
|
|
440
|
-
}).join(
|
|
437
|
+
function renderKey(path, key, dots) {
|
|
438
|
+
return path ? path.concat(key).map(function(token, i) {
|
|
439
|
+
return token = removeBrackets(token), !dots && i ? "[" + token + "]" : token;
|
|
440
|
+
}).join(dots ? "." : "") : key;
|
|
441
441
|
}
|
|
442
|
-
function
|
|
443
|
-
return
|
|
442
|
+
function isFlatArray(arr) {
|
|
443
|
+
return utils.isArray(arr) && !arr.some(isVisitable);
|
|
444
444
|
}
|
|
445
|
-
const
|
|
446
|
-
return /^is[A-Z]/.test(
|
|
445
|
+
const predicates = utils.toFlatObject(utils, {}, null, function(prop) {
|
|
446
|
+
return /^is[A-Z]/.test(prop);
|
|
447
447
|
});
|
|
448
|
-
function
|
|
449
|
-
if (!
|
|
448
|
+
function toFormData(obj, formData, options) {
|
|
449
|
+
if (!utils.isObject(obj))
|
|
450
450
|
throw new TypeError("target must be an object");
|
|
451
|
-
|
|
451
|
+
formData = formData || new FormData(), options = utils.toFlatObject(options, {
|
|
452
452
|
metaTokens: !0,
|
|
453
453
|
dots: !1,
|
|
454
454
|
indexes: !1
|
|
455
|
-
}, !1, function(
|
|
456
|
-
return !
|
|
455
|
+
}, !1, function(option, source) {
|
|
456
|
+
return !utils.isUndefined(source[option]);
|
|
457
457
|
});
|
|
458
|
-
const
|
|
459
|
-
if (!
|
|
458
|
+
const metaTokens = options.metaTokens, visitor = options.visitor || defaultVisitor, dots = options.dots, indexes = options.indexes, useBlob = (options.Blob || typeof Blob < "u" && Blob) && utils.isSpecCompliantForm(formData);
|
|
459
|
+
if (!utils.isFunction(visitor))
|
|
460
460
|
throw new TypeError("visitor must be a function");
|
|
461
|
-
function
|
|
462
|
-
if (
|
|
461
|
+
function convertValue(value) {
|
|
462
|
+
if (value === null)
|
|
463
463
|
return "";
|
|
464
|
-
if (
|
|
465
|
-
return
|
|
466
|
-
if (!
|
|
467
|
-
throw new
|
|
468
|
-
return
|
|
469
|
-
}
|
|
470
|
-
function
|
|
471
|
-
let
|
|
472
|
-
if (
|
|
473
|
-
if (
|
|
474
|
-
|
|
475
|
-
else if (
|
|
476
|
-
return
|
|
477
|
-
!(
|
|
464
|
+
if (utils.isDate(value))
|
|
465
|
+
return value.toISOString();
|
|
466
|
+
if (!useBlob && utils.isBlob(value))
|
|
467
|
+
throw new AxiosError("Blob is not supported. Use a Buffer instead.");
|
|
468
|
+
return utils.isArrayBuffer(value) || utils.isTypedArray(value) ? useBlob && typeof Blob == "function" ? new Blob([value]) : Buffer.from(value) : value;
|
|
469
|
+
}
|
|
470
|
+
function defaultVisitor(value, key, path) {
|
|
471
|
+
let arr = value;
|
|
472
|
+
if (value && !path && typeof value == "object") {
|
|
473
|
+
if (utils.endsWith(key, "{}"))
|
|
474
|
+
key = metaTokens ? key : key.slice(0, -2), value = JSON.stringify(value);
|
|
475
|
+
else if (utils.isArray(value) && isFlatArray(value) || (utils.isFileList(value) || utils.endsWith(key, "[]")) && (arr = utils.toArray(value)))
|
|
476
|
+
return key = removeBrackets(key), arr.forEach(function(el, index) {
|
|
477
|
+
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
478
478
|
// eslint-disable-next-line no-nested-ternary
|
|
479
|
-
|
|
480
|
-
|
|
479
|
+
indexes === !0 ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
|
|
480
|
+
convertValue(el)
|
|
481
481
|
);
|
|
482
482
|
}), !1;
|
|
483
483
|
}
|
|
484
|
-
return
|
|
484
|
+
return isVisitable(value) ? !0 : (formData.append(renderKey(path, key, dots), convertValue(value)), !1);
|
|
485
485
|
}
|
|
486
|
-
const
|
|
487
|
-
defaultVisitor
|
|
488
|
-
convertValue
|
|
489
|
-
isVisitable
|
|
486
|
+
const stack = [], exposedHelpers = Object.assign(predicates, {
|
|
487
|
+
defaultVisitor,
|
|
488
|
+
convertValue,
|
|
489
|
+
isVisitable
|
|
490
490
|
});
|
|
491
|
-
function
|
|
492
|
-
if (!
|
|
493
|
-
if (
|
|
494
|
-
throw Error("Circular reference detected in " +
|
|
495
|
-
|
|
496
|
-
(!(
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
)) === !0 &&
|
|
503
|
-
}),
|
|
491
|
+
function build(value, path) {
|
|
492
|
+
if (!utils.isUndefined(value)) {
|
|
493
|
+
if (stack.indexOf(value) !== -1)
|
|
494
|
+
throw Error("Circular reference detected in " + path.join("."));
|
|
495
|
+
stack.push(value), utils.forEach(value, function(el, key) {
|
|
496
|
+
(!(utils.isUndefined(el) || el === null) && visitor.call(
|
|
497
|
+
formData,
|
|
498
|
+
el,
|
|
499
|
+
utils.isString(key) ? key.trim() : key,
|
|
500
|
+
path,
|
|
501
|
+
exposedHelpers
|
|
502
|
+
)) === !0 && build(el, path ? path.concat(key) : [key]);
|
|
503
|
+
}), stack.pop();
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
if (!
|
|
506
|
+
if (!utils.isObject(obj))
|
|
507
507
|
throw new TypeError("data must be an object");
|
|
508
|
-
return
|
|
508
|
+
return build(obj), formData;
|
|
509
509
|
}
|
|
510
|
-
function
|
|
511
|
-
const
|
|
510
|
+
function encode$1(str) {
|
|
511
|
+
const charMap = {
|
|
512
512
|
"!": "%21",
|
|
513
513
|
"'": "%27",
|
|
514
514
|
"(": "%28",
|
|
@@ -517,40 +517,40 @@ function ft(e) {
|
|
|
517
517
|
"%20": "+",
|
|
518
518
|
"%00": "\0"
|
|
519
519
|
};
|
|
520
|
-
return encodeURIComponent(
|
|
521
|
-
return
|
|
520
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function(match) {
|
|
521
|
+
return charMap[match];
|
|
522
522
|
});
|
|
523
523
|
}
|
|
524
|
-
function
|
|
525
|
-
this._pairs = [],
|
|
524
|
+
function AxiosURLSearchParams(params, options) {
|
|
525
|
+
this._pairs = [], params && toFormData(params, this, options);
|
|
526
526
|
}
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
this._pairs.push([
|
|
527
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
528
|
+
prototype.append = function(name, value) {
|
|
529
|
+
this._pairs.push([name, value]);
|
|
530
530
|
};
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
return
|
|
534
|
-
} :
|
|
535
|
-
return this._pairs.map(function(
|
|
536
|
-
return
|
|
531
|
+
prototype.toString = function(encoder) {
|
|
532
|
+
const _encode = encoder ? function(value) {
|
|
533
|
+
return encoder.call(this, value, encode$1);
|
|
534
|
+
} : encode$1;
|
|
535
|
+
return this._pairs.map(function(pair) {
|
|
536
|
+
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
537
537
|
}, "").join("&");
|
|
538
538
|
};
|
|
539
|
-
function
|
|
540
|
-
return encodeURIComponent(
|
|
539
|
+
function encode(val) {
|
|
540
|
+
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
541
541
|
}
|
|
542
|
-
function
|
|
543
|
-
if (!
|
|
544
|
-
return
|
|
545
|
-
const
|
|
546
|
-
let
|
|
547
|
-
if (
|
|
548
|
-
const
|
|
549
|
-
|
|
542
|
+
function buildURL(url, params, options) {
|
|
543
|
+
if (!params)
|
|
544
|
+
return url;
|
|
545
|
+
const _encode = options && options.encode || encode, serializeFn = options && options.serialize;
|
|
546
|
+
let serializedParams;
|
|
547
|
+
if (serializeFn ? serializedParams = serializeFn(params, options) : serializedParams = utils.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode), serializedParams) {
|
|
548
|
+
const hashmarkIndex = url.indexOf("#");
|
|
549
|
+
hashmarkIndex !== -1 && (url = url.slice(0, hashmarkIndex)), url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
550
550
|
}
|
|
551
|
-
return
|
|
551
|
+
return url;
|
|
552
552
|
}
|
|
553
|
-
class
|
|
553
|
+
class InterceptorManager {
|
|
554
554
|
constructor() {
|
|
555
555
|
this.handlers = [];
|
|
556
556
|
}
|
|
@@ -562,12 +562,12 @@ class Be {
|
|
|
562
562
|
*
|
|
563
563
|
* @return {Number} An ID used to remove interceptor later
|
|
564
564
|
*/
|
|
565
|
-
use(
|
|
565
|
+
use(fulfilled, rejected, options) {
|
|
566
566
|
return this.handlers.push({
|
|
567
|
-
fulfilled
|
|
568
|
-
rejected
|
|
569
|
-
synchronous:
|
|
570
|
-
runWhen:
|
|
567
|
+
fulfilled,
|
|
568
|
+
rejected,
|
|
569
|
+
synchronous: options ? options.synchronous : !1,
|
|
570
|
+
runWhen: options ? options.runWhen : null
|
|
571
571
|
}), this.handlers.length - 1;
|
|
572
572
|
}
|
|
573
573
|
/**
|
|
@@ -577,8 +577,8 @@ class Be {
|
|
|
577
577
|
*
|
|
578
578
|
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
579
579
|
*/
|
|
580
|
-
eject(
|
|
581
|
-
this.handlers[
|
|
580
|
+
eject(id) {
|
|
581
|
+
this.handlers[id] && (this.handlers[id] = null);
|
|
582
582
|
}
|
|
583
583
|
/**
|
|
584
584
|
* Clear all interceptors from the stack
|
|
@@ -598,114 +598,114 @@ class Be {
|
|
|
598
598
|
*
|
|
599
599
|
* @returns {void}
|
|
600
600
|
*/
|
|
601
|
-
forEach(
|
|
602
|
-
|
|
603
|
-
|
|
601
|
+
forEach(fn) {
|
|
602
|
+
utils.forEach(this.handlers, function(h) {
|
|
603
|
+
h !== null && fn(h);
|
|
604
604
|
});
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
|
-
const
|
|
607
|
+
const InterceptorManager$1 = InterceptorManager, transitionalDefaults = {
|
|
608
608
|
silentJSONParsing: !0,
|
|
609
609
|
forcedJSONParsing: !0,
|
|
610
610
|
clarifyTimeoutError: !1
|
|
611
|
-
},
|
|
612
|
-
let
|
|
613
|
-
return typeof navigator < "u" && ((
|
|
614
|
-
})(),
|
|
615
|
-
self instanceof WorkerGlobalScope && typeof self.importScripts == "function")(),
|
|
611
|
+
}, URLSearchParams$1 = typeof URLSearchParams < "u" ? URLSearchParams : AxiosURLSearchParams, FormData$1 = typeof FormData < "u" ? FormData : null, Blob$1 = typeof Blob < "u" ? Blob : null, isStandardBrowserEnv = (() => {
|
|
612
|
+
let product;
|
|
613
|
+
return typeof navigator < "u" && ((product = navigator.product) === "ReactNative" || product === "NativeScript" || product === "NS") ? !1 : typeof window < "u" && typeof document < "u";
|
|
614
|
+
})(), isStandardBrowserWebWorkerEnv = (() => typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
615
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function")(), platform = {
|
|
616
616
|
isBrowser: !0,
|
|
617
617
|
classes: {
|
|
618
|
-
URLSearchParams:
|
|
619
|
-
FormData:
|
|
620
|
-
Blob:
|
|
618
|
+
URLSearchParams: URLSearchParams$1,
|
|
619
|
+
FormData: FormData$1,
|
|
620
|
+
Blob: Blob$1
|
|
621
621
|
},
|
|
622
|
-
isStandardBrowserEnv
|
|
623
|
-
isStandardBrowserWebWorkerEnv
|
|
622
|
+
isStandardBrowserEnv,
|
|
623
|
+
isStandardBrowserWebWorkerEnv,
|
|
624
624
|
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
625
625
|
};
|
|
626
|
-
function
|
|
627
|
-
return
|
|
628
|
-
visitor: function(
|
|
629
|
-
return
|
|
626
|
+
function toURLEncodedForm(data, options) {
|
|
627
|
+
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
628
|
+
visitor: function(value, key, path, helpers) {
|
|
629
|
+
return platform.isNode && utils.isBuffer(value) ? (this.append(key, value.toString("base64")), !1) : helpers.defaultVisitor.apply(this, arguments);
|
|
630
630
|
}
|
|
631
|
-
},
|
|
631
|
+
}, options));
|
|
632
632
|
}
|
|
633
|
-
function
|
|
634
|
-
return
|
|
633
|
+
function parsePropPath(name) {
|
|
634
|
+
return utils.matchAll(/\w+|\[(\w*)]/g, name).map((match) => match[0] === "[]" ? "" : match[1] || match[0]);
|
|
635
635
|
}
|
|
636
|
-
function
|
|
637
|
-
const
|
|
638
|
-
let s;
|
|
639
|
-
const r = t.length;
|
|
636
|
+
function arrayToObject(arr) {
|
|
637
|
+
const obj = {}, keys = Object.keys(arr);
|
|
640
638
|
let i;
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
639
|
+
const len = keys.length;
|
|
640
|
+
let key;
|
|
641
|
+
for (i = 0; i < len; i++)
|
|
642
|
+
key = keys[i], obj[key] = arr[key];
|
|
643
|
+
return obj;
|
|
644
|
+
}
|
|
645
|
+
function formDataToJSON(formData) {
|
|
646
|
+
function buildPath(path, value, target, index) {
|
|
647
|
+
let name = path[index++];
|
|
648
|
+
const isNumericKey = Number.isFinite(+name), isLast = index >= path.length;
|
|
649
|
+
return name = !name && utils.isArray(target) ? target.length : name, isLast ? (utils.hasOwnProp(target, name) ? target[name] = [target[name], value] : target[name] = value, !isNumericKey) : ((!target[name] || !utils.isObject(target[name])) && (target[name] = []), buildPath(path, value, target[name], index) && utils.isArray(target[name]) && (target[name] = arrayToObject(target[name])), !isNumericKey);
|
|
650
|
+
}
|
|
651
|
+
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
|
652
|
+
const obj = {};
|
|
653
|
+
return utils.forEachEntry(formData, (name, value) => {
|
|
654
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
655
|
+
}), obj;
|
|
656
656
|
}
|
|
657
657
|
return null;
|
|
658
658
|
}
|
|
659
|
-
function
|
|
660
|
-
if (
|
|
659
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
660
|
+
if (utils.isString(rawValue))
|
|
661
661
|
try {
|
|
662
|
-
return (
|
|
663
|
-
} catch (
|
|
664
|
-
if (
|
|
665
|
-
throw
|
|
662
|
+
return (parser || JSON.parse)(rawValue), utils.trim(rawValue);
|
|
663
|
+
} catch (e) {
|
|
664
|
+
if (e.name !== "SyntaxError")
|
|
665
|
+
throw e;
|
|
666
666
|
}
|
|
667
|
-
return (
|
|
667
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
668
668
|
}
|
|
669
|
-
const
|
|
670
|
-
transitional:
|
|
669
|
+
const defaults = {
|
|
670
|
+
transitional: transitionalDefaults,
|
|
671
671
|
adapter: ["xhr", "http"],
|
|
672
|
-
transformRequest: [function(
|
|
673
|
-
const
|
|
674
|
-
if (
|
|
675
|
-
return
|
|
676
|
-
if (
|
|
677
|
-
return
|
|
678
|
-
if (
|
|
679
|
-
return
|
|
680
|
-
if (
|
|
681
|
-
return
|
|
682
|
-
let
|
|
683
|
-
if (
|
|
684
|
-
if (
|
|
685
|
-
return
|
|
686
|
-
if ((
|
|
687
|
-
const
|
|
688
|
-
return
|
|
689
|
-
|
|
690
|
-
|
|
672
|
+
transformRequest: [function(data, headers) {
|
|
673
|
+
const contentType = headers.getContentType() || "", hasJSONContentType = contentType.indexOf("application/json") > -1, isObjectPayload = utils.isObject(data);
|
|
674
|
+
if (isObjectPayload && utils.isHTMLForm(data) && (data = new FormData(data)), utils.isFormData(data))
|
|
675
|
+
return hasJSONContentType && hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
676
|
+
if (utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data))
|
|
677
|
+
return data;
|
|
678
|
+
if (utils.isArrayBufferView(data))
|
|
679
|
+
return data.buffer;
|
|
680
|
+
if (utils.isURLSearchParams(data))
|
|
681
|
+
return headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), data.toString();
|
|
682
|
+
let isFileList2;
|
|
683
|
+
if (isObjectPayload) {
|
|
684
|
+
if (contentType.indexOf("application/x-www-form-urlencoded") > -1)
|
|
685
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
686
|
+
if ((isFileList2 = utils.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
687
|
+
const _FormData = this.env && this.env.FormData;
|
|
688
|
+
return toFormData(
|
|
689
|
+
isFileList2 ? { "files[]": data } : data,
|
|
690
|
+
_FormData && new _FormData(),
|
|
691
691
|
this.formSerializer
|
|
692
692
|
);
|
|
693
693
|
}
|
|
694
694
|
}
|
|
695
|
-
return
|
|
695
|
+
return isObjectPayload || hasJSONContentType ? (headers.setContentType("application/json", !1), stringifySafely(data)) : data;
|
|
696
696
|
}],
|
|
697
|
-
transformResponse: [function(
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
const
|
|
697
|
+
transformResponse: [function(data) {
|
|
698
|
+
const transitional2 = this.transitional || defaults.transitional, forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing, JSONRequested = this.responseType === "json";
|
|
699
|
+
if (data && utils.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
700
|
+
const strictJSONParsing = !(transitional2 && transitional2.silentJSONParsing) && JSONRequested;
|
|
701
701
|
try {
|
|
702
|
-
return JSON.parse(
|
|
703
|
-
} catch (
|
|
704
|
-
if (
|
|
705
|
-
throw
|
|
702
|
+
return JSON.parse(data);
|
|
703
|
+
} catch (e) {
|
|
704
|
+
if (strictJSONParsing)
|
|
705
|
+
throw e.name === "SyntaxError" ? AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response) : e;
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
return
|
|
708
|
+
return data;
|
|
709
709
|
}],
|
|
710
710
|
/**
|
|
711
711
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
@@ -717,11 +717,11 @@ const st = {
|
|
|
717
717
|
maxContentLength: -1,
|
|
718
718
|
maxBodyLength: -1,
|
|
719
719
|
env: {
|
|
720
|
-
FormData:
|
|
721
|
-
Blob:
|
|
720
|
+
FormData: platform.classes.FormData,
|
|
721
|
+
Blob: platform.classes.Blob
|
|
722
722
|
},
|
|
723
|
-
validateStatus: function(
|
|
724
|
-
return
|
|
723
|
+
validateStatus: function(status) {
|
|
724
|
+
return status >= 200 && status < 300;
|
|
725
725
|
},
|
|
726
726
|
headers: {
|
|
727
727
|
common: {
|
|
@@ -730,10 +730,10 @@ const st = {
|
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
732
|
};
|
|
733
|
-
|
|
734
|
-
|
|
733
|
+
utils.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
|
|
734
|
+
defaults.headers[method] = {};
|
|
735
735
|
});
|
|
736
|
-
const
|
|
736
|
+
const defaults$1 = defaults, ignoreDuplicateOf = utils.toObjectSet([
|
|
737
737
|
"age",
|
|
738
738
|
"authorization",
|
|
739
739
|
"content-length",
|
|
@@ -751,213 +751,213 @@ const rt = st, qe = a.toObjectSet([
|
|
|
751
751
|
"referer",
|
|
752
752
|
"retry-after",
|
|
753
753
|
"user-agent"
|
|
754
|
-
]),
|
|
755
|
-
const
|
|
756
|
-
let
|
|
757
|
-
return
|
|
758
|
-
`).forEach(function(
|
|
759
|
-
|
|
760
|
-
}),
|
|
761
|
-
},
|
|
762
|
-
function
|
|
763
|
-
return
|
|
764
|
-
}
|
|
765
|
-
function
|
|
766
|
-
return
|
|
767
|
-
}
|
|
768
|
-
function
|
|
769
|
-
const
|
|
770
|
-
let
|
|
771
|
-
for (;
|
|
772
|
-
|
|
773
|
-
return
|
|
774
|
-
}
|
|
775
|
-
const
|
|
776
|
-
function
|
|
777
|
-
if (
|
|
778
|
-
return
|
|
779
|
-
if (
|
|
780
|
-
if (
|
|
781
|
-
return
|
|
782
|
-
if (
|
|
783
|
-
return
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
function
|
|
787
|
-
return
|
|
788
|
-
}
|
|
789
|
-
function
|
|
790
|
-
const
|
|
791
|
-
["get", "set", "has"].forEach((
|
|
792
|
-
Object.defineProperty(
|
|
793
|
-
value: function(
|
|
794
|
-
return this[
|
|
754
|
+
]), parseHeaders = (rawHeaders) => {
|
|
755
|
+
const parsed = {};
|
|
756
|
+
let key, val, i;
|
|
757
|
+
return rawHeaders && rawHeaders.split(`
|
|
758
|
+
`).forEach(function(line) {
|
|
759
|
+
i = line.indexOf(":"), key = line.substring(0, i).trim().toLowerCase(), val = line.substring(i + 1).trim(), !(!key || parsed[key] && ignoreDuplicateOf[key]) && (key === "set-cookie" ? parsed[key] ? parsed[key].push(val) : parsed[key] = [val] : parsed[key] = parsed[key] ? parsed[key] + ", " + val : val);
|
|
760
|
+
}), parsed;
|
|
761
|
+
}, $internals = Symbol("internals");
|
|
762
|
+
function normalizeHeader(header) {
|
|
763
|
+
return header && String(header).trim().toLowerCase();
|
|
764
|
+
}
|
|
765
|
+
function normalizeValue(value) {
|
|
766
|
+
return value === !1 || value == null ? value : utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
767
|
+
}
|
|
768
|
+
function parseTokens(str) {
|
|
769
|
+
const tokens = /* @__PURE__ */ Object.create(null), tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
770
|
+
let match;
|
|
771
|
+
for (; match = tokensRE.exec(str); )
|
|
772
|
+
tokens[match[1]] = match[2];
|
|
773
|
+
return tokens;
|
|
774
|
+
}
|
|
775
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
776
|
+
function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
777
|
+
if (utils.isFunction(filter2))
|
|
778
|
+
return filter2.call(this, value, header);
|
|
779
|
+
if (isHeaderNameFilter && (value = header), !!utils.isString(value)) {
|
|
780
|
+
if (utils.isString(filter2))
|
|
781
|
+
return value.indexOf(filter2) !== -1;
|
|
782
|
+
if (utils.isRegExp(filter2))
|
|
783
|
+
return filter2.test(value);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
function formatHeader(header) {
|
|
787
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => char.toUpperCase() + str);
|
|
788
|
+
}
|
|
789
|
+
function buildAccessors(obj, header) {
|
|
790
|
+
const accessorName = utils.toCamelCase(" " + header);
|
|
791
|
+
["get", "set", "has"].forEach((methodName) => {
|
|
792
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
793
|
+
value: function(arg1, arg2, arg3) {
|
|
794
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
795
795
|
},
|
|
796
796
|
configurable: !0
|
|
797
797
|
});
|
|
798
798
|
});
|
|
799
799
|
}
|
|
800
|
-
class
|
|
801
|
-
constructor(
|
|
802
|
-
|
|
800
|
+
class AxiosHeaders {
|
|
801
|
+
constructor(headers) {
|
|
802
|
+
headers && this.set(headers);
|
|
803
803
|
}
|
|
804
|
-
set(
|
|
805
|
-
const
|
|
806
|
-
function
|
|
807
|
-
const
|
|
808
|
-
if (!
|
|
804
|
+
set(header, valueOrRewrite, rewrite) {
|
|
805
|
+
const self2 = this;
|
|
806
|
+
function setHeader(_value, _header, _rewrite) {
|
|
807
|
+
const lHeader = normalizeHeader(_header);
|
|
808
|
+
if (!lHeader)
|
|
809
809
|
throw new Error("header name must be a non-empty string");
|
|
810
|
-
const
|
|
811
|
-
(!
|
|
810
|
+
const key = utils.findKey(self2, lHeader);
|
|
811
|
+
(!key || self2[key] === void 0 || _rewrite === !0 || _rewrite === void 0 && self2[key] !== !1) && (self2[key || _header] = normalizeValue(_value));
|
|
812
812
|
}
|
|
813
|
-
const
|
|
814
|
-
return
|
|
815
|
-
}
|
|
816
|
-
get(
|
|
817
|
-
if (
|
|
818
|
-
const
|
|
819
|
-
if (
|
|
820
|
-
const
|
|
821
|
-
if (!
|
|
822
|
-
return
|
|
823
|
-
if (
|
|
824
|
-
return
|
|
825
|
-
if (
|
|
826
|
-
return
|
|
827
|
-
if (
|
|
828
|
-
return
|
|
813
|
+
const setHeaders = (headers, _rewrite) => utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
814
|
+
return utils.isPlainObject(header) || header instanceof this.constructor ? setHeaders(header, valueOrRewrite) : utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header) ? setHeaders(parseHeaders(header), valueOrRewrite) : header != null && setHeader(valueOrRewrite, header, rewrite), this;
|
|
815
|
+
}
|
|
816
|
+
get(header, parser) {
|
|
817
|
+
if (header = normalizeHeader(header), header) {
|
|
818
|
+
const key = utils.findKey(this, header);
|
|
819
|
+
if (key) {
|
|
820
|
+
const value = this[key];
|
|
821
|
+
if (!parser)
|
|
822
|
+
return value;
|
|
823
|
+
if (parser === !0)
|
|
824
|
+
return parseTokens(value);
|
|
825
|
+
if (utils.isFunction(parser))
|
|
826
|
+
return parser.call(this, value, key);
|
|
827
|
+
if (utils.isRegExp(parser))
|
|
828
|
+
return parser.exec(value);
|
|
829
829
|
throw new TypeError("parser must be boolean|regexp|function");
|
|
830
830
|
}
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
|
-
has(
|
|
834
|
-
if (
|
|
835
|
-
const
|
|
836
|
-
return !!(
|
|
833
|
+
has(header, matcher) {
|
|
834
|
+
if (header = normalizeHeader(header), header) {
|
|
835
|
+
const key = utils.findKey(this, header);
|
|
836
|
+
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
837
837
|
}
|
|
838
838
|
return !1;
|
|
839
839
|
}
|
|
840
|
-
delete(
|
|
841
|
-
const
|
|
842
|
-
let
|
|
843
|
-
function
|
|
844
|
-
if (
|
|
845
|
-
const
|
|
846
|
-
|
|
840
|
+
delete(header, matcher) {
|
|
841
|
+
const self2 = this;
|
|
842
|
+
let deleted = !1;
|
|
843
|
+
function deleteHeader(_header) {
|
|
844
|
+
if (_header = normalizeHeader(_header), _header) {
|
|
845
|
+
const key = utils.findKey(self2, _header);
|
|
846
|
+
key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher)) && (delete self2[key], deleted = !0);
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
|
-
return
|
|
850
|
-
}
|
|
851
|
-
clear(
|
|
852
|
-
const
|
|
853
|
-
let
|
|
854
|
-
for (;
|
|
855
|
-
const
|
|
856
|
-
(!
|
|
849
|
+
return utils.isArray(header) ? header.forEach(deleteHeader) : deleteHeader(header), deleted;
|
|
850
|
+
}
|
|
851
|
+
clear(matcher) {
|
|
852
|
+
const keys = Object.keys(this);
|
|
853
|
+
let i = keys.length, deleted = !1;
|
|
854
|
+
for (; i--; ) {
|
|
855
|
+
const key = keys[i];
|
|
856
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher, !0)) && (delete this[key], deleted = !0);
|
|
857
857
|
}
|
|
858
|
-
return
|
|
859
|
-
}
|
|
860
|
-
normalize(
|
|
861
|
-
const
|
|
862
|
-
return
|
|
863
|
-
const
|
|
864
|
-
if (
|
|
865
|
-
|
|
858
|
+
return deleted;
|
|
859
|
+
}
|
|
860
|
+
normalize(format) {
|
|
861
|
+
const self2 = this, headers = {};
|
|
862
|
+
return utils.forEach(this, (value, header) => {
|
|
863
|
+
const key = utils.findKey(headers, header);
|
|
864
|
+
if (key) {
|
|
865
|
+
self2[key] = normalizeValue(value), delete self2[header];
|
|
866
866
|
return;
|
|
867
867
|
}
|
|
868
|
-
const
|
|
869
|
-
|
|
868
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
869
|
+
normalized !== header && delete self2[header], self2[normalized] = normalizeValue(value), headers[normalized] = !0;
|
|
870
870
|
}), this;
|
|
871
871
|
}
|
|
872
|
-
concat(...
|
|
873
|
-
return this.constructor.concat(this, ...
|
|
872
|
+
concat(...targets) {
|
|
873
|
+
return this.constructor.concat(this, ...targets);
|
|
874
874
|
}
|
|
875
|
-
toJSON(
|
|
876
|
-
const
|
|
877
|
-
return
|
|
878
|
-
|
|
879
|
-
}),
|
|
875
|
+
toJSON(asStrings) {
|
|
876
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
877
|
+
return utils.forEach(this, (value, header) => {
|
|
878
|
+
value != null && value !== !1 && (obj[header] = asStrings && utils.isArray(value) ? value.join(", ") : value);
|
|
879
|
+
}), obj;
|
|
880
880
|
}
|
|
881
881
|
[Symbol.iterator]() {
|
|
882
882
|
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
883
883
|
}
|
|
884
884
|
toString() {
|
|
885
|
-
return Object.entries(this.toJSON()).map(([
|
|
885
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join(`
|
|
886
886
|
`);
|
|
887
887
|
}
|
|
888
888
|
get [Symbol.toStringTag]() {
|
|
889
889
|
return "AxiosHeaders";
|
|
890
890
|
}
|
|
891
|
-
static from(
|
|
892
|
-
return
|
|
891
|
+
static from(thing) {
|
|
892
|
+
return thing instanceof this ? thing : new this(thing);
|
|
893
893
|
}
|
|
894
|
-
static concat(
|
|
895
|
-
const
|
|
896
|
-
return
|
|
894
|
+
static concat(first, ...targets) {
|
|
895
|
+
const computed = new this(first);
|
|
896
|
+
return targets.forEach((target) => computed.set(target)), computed;
|
|
897
897
|
}
|
|
898
|
-
static accessor(
|
|
899
|
-
const
|
|
898
|
+
static accessor(header) {
|
|
899
|
+
const accessors = (this[$internals] = this[$internals] = {
|
|
900
900
|
accessors: {}
|
|
901
|
-
}).accessors,
|
|
902
|
-
function
|
|
903
|
-
const
|
|
904
|
-
|
|
901
|
+
}).accessors, prototype2 = this.prototype;
|
|
902
|
+
function defineAccessor(_header) {
|
|
903
|
+
const lHeader = normalizeHeader(_header);
|
|
904
|
+
accessors[lHeader] || (buildAccessors(prototype2, _header), accessors[lHeader] = !0);
|
|
905
905
|
}
|
|
906
|
-
return
|
|
906
|
+
return utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header), this;
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
let
|
|
909
|
+
AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
910
|
+
utils.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
911
|
+
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
912
912
|
return {
|
|
913
|
-
get: () =>
|
|
914
|
-
set(
|
|
915
|
-
this[
|
|
913
|
+
get: () => value,
|
|
914
|
+
set(headerValue) {
|
|
915
|
+
this[mapped] = headerValue;
|
|
916
916
|
}
|
|
917
917
|
};
|
|
918
918
|
});
|
|
919
|
-
|
|
920
|
-
const
|
|
921
|
-
function
|
|
922
|
-
const
|
|
923
|
-
let
|
|
924
|
-
return
|
|
925
|
-
|
|
926
|
-
}),
|
|
927
|
-
}
|
|
928
|
-
function
|
|
929
|
-
return !!(
|
|
930
|
-
}
|
|
931
|
-
function
|
|
932
|
-
|
|
933
|
-
}
|
|
934
|
-
|
|
919
|
+
utils.freezeMethods(AxiosHeaders);
|
|
920
|
+
const AxiosHeaders$1 = AxiosHeaders;
|
|
921
|
+
function transformData(fns, response) {
|
|
922
|
+
const config = this || defaults$1, context = response || config, headers = AxiosHeaders$1.from(context.headers);
|
|
923
|
+
let data = context.data;
|
|
924
|
+
return utils.forEach(fns, function(fn) {
|
|
925
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
|
|
926
|
+
}), headers.normalize(), data;
|
|
927
|
+
}
|
|
928
|
+
function isCancel(value) {
|
|
929
|
+
return !!(value && value.__CANCEL__);
|
|
930
|
+
}
|
|
931
|
+
function CanceledError(message, config, request) {
|
|
932
|
+
AxiosError.call(this, message ?? "canceled", AxiosError.ERR_CANCELED, config, request), this.name = "CanceledError";
|
|
933
|
+
}
|
|
934
|
+
utils.inherits(CanceledError, AxiosError, {
|
|
935
935
|
__CANCEL__: !0
|
|
936
936
|
});
|
|
937
|
-
function
|
|
938
|
-
const
|
|
939
|
-
!
|
|
940
|
-
"Request failed with status code " +
|
|
941
|
-
[
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
937
|
+
function settle(resolve, reject, response) {
|
|
938
|
+
const validateStatus2 = response.config.validateStatus;
|
|
939
|
+
!response.status || !validateStatus2 || validateStatus2(response.status) ? resolve(response) : reject(new AxiosError(
|
|
940
|
+
"Request failed with status code " + response.status,
|
|
941
|
+
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
942
|
+
response.config,
|
|
943
|
+
response.request,
|
|
944
|
+
response
|
|
945
945
|
));
|
|
946
946
|
}
|
|
947
|
-
const
|
|
947
|
+
const cookies = platform.isStandardBrowserEnv ? (
|
|
948
948
|
// Standard browser envs support document.cookie
|
|
949
949
|
function() {
|
|
950
950
|
return {
|
|
951
|
-
write: function(
|
|
952
|
-
const
|
|
953
|
-
|
|
951
|
+
write: function(name, value, expires, path, domain, secure) {
|
|
952
|
+
const cookie = [];
|
|
953
|
+
cookie.push(name + "=" + encodeURIComponent(value)), utils.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString()), utils.isString(path) && cookie.push("path=" + path), utils.isString(domain) && cookie.push("domain=" + domain), secure === !0 && cookie.push("secure"), document.cookie = cookie.join("; ");
|
|
954
954
|
},
|
|
955
|
-
read: function(
|
|
956
|
-
const
|
|
957
|
-
return
|
|
955
|
+
read: function(name) {
|
|
956
|
+
const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
|
|
957
|
+
return match ? decodeURIComponent(match[3]) : null;
|
|
958
958
|
},
|
|
959
|
-
remove: function(
|
|
960
|
-
this.write(
|
|
959
|
+
remove: function(name) {
|
|
960
|
+
this.write(name, "", Date.now() - 864e5);
|
|
961
961
|
}
|
|
962
962
|
};
|
|
963
963
|
}()
|
|
@@ -975,37 +975,37 @@ const Qe = S.isStandardBrowserEnv ? (
|
|
|
975
975
|
};
|
|
976
976
|
}()
|
|
977
977
|
);
|
|
978
|
-
function
|
|
979
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(
|
|
978
|
+
function isAbsoluteURL(url) {
|
|
979
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
980
980
|
}
|
|
981
|
-
function
|
|
982
|
-
return
|
|
981
|
+
function combineURLs(baseURL, relativeURL) {
|
|
982
|
+
return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
983
983
|
}
|
|
984
|
-
function
|
|
985
|
-
return
|
|
984
|
+
function buildFullPath(baseURL, requestedURL) {
|
|
985
|
+
return baseURL && !isAbsoluteURL(requestedURL) ? combineURLs(baseURL, requestedURL) : requestedURL;
|
|
986
986
|
}
|
|
987
|
-
const
|
|
987
|
+
const isURLSameOrigin = platform.isStandardBrowserEnv ? (
|
|
988
988
|
// Standard browser envs have full support of the APIs needed to test
|
|
989
989
|
// whether the request URL is of the same origin as current location.
|
|
990
990
|
function() {
|
|
991
|
-
const
|
|
992
|
-
let
|
|
993
|
-
function
|
|
994
|
-
let
|
|
995
|
-
return
|
|
996
|
-
href:
|
|
997
|
-
protocol:
|
|
998
|
-
host:
|
|
999
|
-
search:
|
|
1000
|
-
hash:
|
|
1001
|
-
hostname:
|
|
1002
|
-
port:
|
|
1003
|
-
pathname:
|
|
991
|
+
const msie = /(msie|trident)/i.test(navigator.userAgent), urlParsingNode = document.createElement("a");
|
|
992
|
+
let originURL;
|
|
993
|
+
function resolveURL(url) {
|
|
994
|
+
let href = url;
|
|
995
|
+
return msie && (urlParsingNode.setAttribute("href", href), href = urlParsingNode.href), urlParsingNode.setAttribute("href", href), {
|
|
996
|
+
href: urlParsingNode.href,
|
|
997
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
|
|
998
|
+
host: urlParsingNode.host,
|
|
999
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
|
|
1000
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
|
|
1001
|
+
hostname: urlParsingNode.hostname,
|
|
1002
|
+
port: urlParsingNode.port,
|
|
1003
|
+
pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
|
|
1004
1004
|
};
|
|
1005
1005
|
}
|
|
1006
|
-
return
|
|
1007
|
-
const
|
|
1008
|
-
return
|
|
1006
|
+
return originURL = resolveURL(window.location.href), function(requestURL) {
|
|
1007
|
+
const parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
|
|
1008
|
+
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
|
|
1009
1009
|
};
|
|
1010
1010
|
}()
|
|
1011
1011
|
) : (
|
|
@@ -1016,294 +1016,294 @@ const ve = S.isStandardBrowserEnv ? (
|
|
|
1016
1016
|
};
|
|
1017
1017
|
}()
|
|
1018
1018
|
);
|
|
1019
|
-
function
|
|
1020
|
-
const
|
|
1021
|
-
return
|
|
1022
|
-
}
|
|
1023
|
-
function
|
|
1024
|
-
|
|
1025
|
-
const
|
|
1026
|
-
let
|
|
1027
|
-
return
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1030
|
-
let
|
|
1031
|
-
for (;
|
|
1032
|
-
|
|
1033
|
-
if (
|
|
1019
|
+
function parseProtocol(url) {
|
|
1020
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
1021
|
+
return match && match[1] || "";
|
|
1022
|
+
}
|
|
1023
|
+
function speedometer(samplesCount, min) {
|
|
1024
|
+
samplesCount = samplesCount || 10;
|
|
1025
|
+
const bytes = new Array(samplesCount), timestamps = new Array(samplesCount);
|
|
1026
|
+
let head = 0, tail = 0, firstSampleTS;
|
|
1027
|
+
return min = min !== void 0 ? min : 1e3, function(chunkLength) {
|
|
1028
|
+
const now = Date.now(), startedAt = timestamps[tail];
|
|
1029
|
+
firstSampleTS || (firstSampleTS = now), bytes[head] = chunkLength, timestamps[head] = now;
|
|
1030
|
+
let i = tail, bytesCount = 0;
|
|
1031
|
+
for (; i !== head; )
|
|
1032
|
+
bytesCount += bytes[i++], i = i % samplesCount;
|
|
1033
|
+
if (head = (head + 1) % samplesCount, head === tail && (tail = (tail + 1) % samplesCount), now - firstSampleTS < min)
|
|
1034
1034
|
return;
|
|
1035
|
-
const
|
|
1036
|
-
return
|
|
1035
|
+
const passed = startedAt && now - startedAt;
|
|
1036
|
+
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
1037
1037
|
};
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1040
|
-
let
|
|
1041
|
-
const
|
|
1042
|
-
return (
|
|
1043
|
-
const
|
|
1044
|
-
|
|
1045
|
-
const
|
|
1046
|
-
loaded
|
|
1047
|
-
total
|
|
1048
|
-
progress:
|
|
1049
|
-
bytes:
|
|
1050
|
-
rate:
|
|
1051
|
-
estimated:
|
|
1052
|
-
event:
|
|
1039
|
+
function progressEventReducer(listener, isDownloadStream) {
|
|
1040
|
+
let bytesNotified = 0;
|
|
1041
|
+
const _speedometer = speedometer(50, 250);
|
|
1042
|
+
return (e) => {
|
|
1043
|
+
const loaded = e.loaded, total = e.lengthComputable ? e.total : void 0, progressBytes = loaded - bytesNotified, rate = _speedometer(progressBytes), inRange = loaded <= total;
|
|
1044
|
+
bytesNotified = loaded;
|
|
1045
|
+
const data = {
|
|
1046
|
+
loaded,
|
|
1047
|
+
total,
|
|
1048
|
+
progress: total ? loaded / total : void 0,
|
|
1049
|
+
bytes: progressBytes,
|
|
1050
|
+
rate: rate || void 0,
|
|
1051
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
|
|
1052
|
+
event: e
|
|
1053
1053
|
};
|
|
1054
|
-
|
|
1054
|
+
data[isDownloadStream ? "download" : "upload"] = !0, listener(data);
|
|
1055
1055
|
};
|
|
1056
1056
|
}
|
|
1057
|
-
const
|
|
1058
|
-
return new Promise(function(
|
|
1059
|
-
let
|
|
1060
|
-
const
|
|
1061
|
-
let
|
|
1062
|
-
function
|
|
1063
|
-
|
|
1057
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest < "u", xhrAdapter = isXHRAdapterSupported && function(config) {
|
|
1058
|
+
return new Promise(function(resolve, reject) {
|
|
1059
|
+
let requestData = config.data;
|
|
1060
|
+
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize(), responseType = config.responseType;
|
|
1061
|
+
let onCanceled;
|
|
1062
|
+
function done() {
|
|
1063
|
+
config.cancelToken && config.cancelToken.unsubscribe(onCanceled), config.signal && config.signal.removeEventListener("abort", onCanceled);
|
|
1064
1064
|
}
|
|
1065
|
-
let
|
|
1066
|
-
|
|
1067
|
-
let
|
|
1068
|
-
if (
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1065
|
+
let contentType;
|
|
1066
|
+
utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv ? requestHeaders.setContentType(!1) : requestHeaders.getContentType(/^\s*multipart\/form-data/) ? utils.isString(contentType = requestHeaders.getContentType()) && requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, "$1")) : requestHeaders.setContentType("multipart/form-data"));
|
|
1067
|
+
let request = new XMLHttpRequest();
|
|
1068
|
+
if (config.auth) {
|
|
1069
|
+
const username = config.auth.username || "", password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : "";
|
|
1070
|
+
requestHeaders.set("Authorization", "Basic " + btoa(username + ":" + password));
|
|
1071
1071
|
}
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
function
|
|
1075
|
-
if (!
|
|
1072
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
1073
|
+
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), !0), request.timeout = config.timeout;
|
|
1074
|
+
function onloadend() {
|
|
1075
|
+
if (!request)
|
|
1076
1076
|
return;
|
|
1077
|
-
const
|
|
1078
|
-
"getAllResponseHeaders" in
|
|
1079
|
-
),
|
|
1080
|
-
data: !
|
|
1081
|
-
status:
|
|
1082
|
-
statusText:
|
|
1083
|
-
headers:
|
|
1084
|
-
config
|
|
1085
|
-
request
|
|
1077
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
1078
|
+
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
|
|
1079
|
+
), response = {
|
|
1080
|
+
data: !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response,
|
|
1081
|
+
status: request.status,
|
|
1082
|
+
statusText: request.statusText,
|
|
1083
|
+
headers: responseHeaders,
|
|
1084
|
+
config,
|
|
1085
|
+
request
|
|
1086
1086
|
};
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
}, function(
|
|
1090
|
-
|
|
1091
|
-
},
|
|
1087
|
+
settle(function(value) {
|
|
1088
|
+
resolve(value), done();
|
|
1089
|
+
}, function(err) {
|
|
1090
|
+
reject(err), done();
|
|
1091
|
+
}, response), request = null;
|
|
1092
1092
|
}
|
|
1093
|
-
if ("onloadend" in
|
|
1094
|
-
!
|
|
1095
|
-
},
|
|
1096
|
-
|
|
1097
|
-
},
|
|
1098
|
-
|
|
1099
|
-
},
|
|
1100
|
-
let
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
)),
|
|
1108
|
-
},
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1093
|
+
if ("onloadend" in request ? request.onloadend = onloadend : request.onreadystatechange = function() {
|
|
1094
|
+
!request || request.readyState !== 4 || request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0) || setTimeout(onloadend);
|
|
1095
|
+
}, request.onabort = function() {
|
|
1096
|
+
request && (reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request)), request = null);
|
|
1097
|
+
}, request.onerror = function() {
|
|
1098
|
+
reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request)), request = null;
|
|
1099
|
+
}, request.ontimeout = function() {
|
|
1100
|
+
let timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
|
|
1101
|
+
const transitional2 = config.transitional || transitionalDefaults;
|
|
1102
|
+
config.timeoutErrorMessage && (timeoutErrorMessage = config.timeoutErrorMessage), reject(new AxiosError(
|
|
1103
|
+
timeoutErrorMessage,
|
|
1104
|
+
transitional2.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
1105
|
+
config,
|
|
1106
|
+
request
|
|
1107
|
+
)), request = null;
|
|
1108
|
+
}, platform.isStandardBrowserEnv) {
|
|
1109
|
+
const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
|
1110
|
+
xsrfValue && requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
|
1111
1111
|
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
}),
|
|
1115
|
-
|
|
1116
|
-
},
|
|
1117
|
-
const
|
|
1118
|
-
if (
|
|
1119
|
-
|
|
1112
|
+
requestData === void 0 && requestHeaders.setContentType(null), "setRequestHeader" in request && utils.forEach(requestHeaders.toJSON(), function(val, key) {
|
|
1113
|
+
request.setRequestHeader(key, val);
|
|
1114
|
+
}), utils.isUndefined(config.withCredentials) || (request.withCredentials = !!config.withCredentials), responseType && responseType !== "json" && (request.responseType = config.responseType), typeof config.onDownloadProgress == "function" && request.addEventListener("progress", progressEventReducer(config.onDownloadProgress, !0)), typeof config.onUploadProgress == "function" && request.upload && request.upload.addEventListener("progress", progressEventReducer(config.onUploadProgress)), (config.cancelToken || config.signal) && (onCanceled = (cancel) => {
|
|
1115
|
+
request && (reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel), request.abort(), request = null);
|
|
1116
|
+
}, config.cancelToken && config.cancelToken.subscribe(onCanceled), config.signal && (config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled)));
|
|
1117
|
+
const protocol = parseProtocol(fullPath);
|
|
1118
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
1119
|
+
reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
|
|
1120
1120
|
return;
|
|
1121
1121
|
}
|
|
1122
|
-
|
|
1122
|
+
request.send(requestData || null);
|
|
1123
1123
|
});
|
|
1124
|
-
},
|
|
1125
|
-
http:
|
|
1126
|
-
xhr:
|
|
1124
|
+
}, knownAdapters = {
|
|
1125
|
+
http: httpAdapter,
|
|
1126
|
+
xhr: xhrAdapter
|
|
1127
1127
|
};
|
|
1128
|
-
|
|
1129
|
-
if (
|
|
1128
|
+
utils.forEach(knownAdapters, (fn, value) => {
|
|
1129
|
+
if (fn) {
|
|
1130
1130
|
try {
|
|
1131
|
-
Object.defineProperty(
|
|
1131
|
+
Object.defineProperty(fn, "name", { value });
|
|
1132
1132
|
} catch {
|
|
1133
1133
|
}
|
|
1134
|
-
Object.defineProperty(
|
|
1134
|
+
Object.defineProperty(fn, "adapterName", { value });
|
|
1135
1135
|
}
|
|
1136
1136
|
});
|
|
1137
|
-
const
|
|
1138
|
-
getAdapter: (
|
|
1139
|
-
|
|
1140
|
-
const { length
|
|
1141
|
-
let
|
|
1142
|
-
const
|
|
1143
|
-
for (let i = 0; i <
|
|
1144
|
-
|
|
1145
|
-
let
|
|
1146
|
-
if (
|
|
1147
|
-
throw new
|
|
1148
|
-
if (
|
|
1137
|
+
const renderReason = (reason) => `- ${reason}`, isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === !1, adapters = {
|
|
1138
|
+
getAdapter: (adapters2) => {
|
|
1139
|
+
adapters2 = utils.isArray(adapters2) ? adapters2 : [adapters2];
|
|
1140
|
+
const { length } = adapters2;
|
|
1141
|
+
let nameOrAdapter, adapter;
|
|
1142
|
+
const rejectedReasons = {};
|
|
1143
|
+
for (let i = 0; i < length; i++) {
|
|
1144
|
+
nameOrAdapter = adapters2[i];
|
|
1145
|
+
let id;
|
|
1146
|
+
if (adapter = nameOrAdapter, !isResolvedHandle(nameOrAdapter) && (adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()], adapter === void 0))
|
|
1147
|
+
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
1148
|
+
if (adapter)
|
|
1149
1149
|
break;
|
|
1150
|
-
|
|
1150
|
+
rejectedReasons[id || "#" + i] = adapter;
|
|
1151
1151
|
}
|
|
1152
|
-
if (!
|
|
1153
|
-
const
|
|
1154
|
-
([
|
|
1152
|
+
if (!adapter) {
|
|
1153
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
1154
|
+
([id, state]) => `adapter ${id} ` + (state === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1155
1155
|
);
|
|
1156
|
-
let
|
|
1157
|
-
` +
|
|
1158
|
-
`) : " " +
|
|
1159
|
-
throw new
|
|
1160
|
-
"There is no suitable adapter to dispatch the request " +
|
|
1156
|
+
let s = length ? reasons.length > 1 ? `since :
|
|
1157
|
+
` + reasons.map(renderReason).join(`
|
|
1158
|
+
`) : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
1159
|
+
throw new AxiosError(
|
|
1160
|
+
"There is no suitable adapter to dispatch the request " + s,
|
|
1161
1161
|
"ERR_NOT_SUPPORT"
|
|
1162
1162
|
);
|
|
1163
1163
|
}
|
|
1164
|
-
return
|
|
1164
|
+
return adapter;
|
|
1165
1165
|
},
|
|
1166
|
-
adapters:
|
|
1166
|
+
adapters: knownAdapters
|
|
1167
1167
|
};
|
|
1168
|
-
function
|
|
1169
|
-
if (
|
|
1170
|
-
throw new
|
|
1171
|
-
}
|
|
1172
|
-
function
|
|
1173
|
-
return
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
), ["post", "put", "patch"].indexOf(
|
|
1177
|
-
return
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
),
|
|
1182
|
-
}, function(
|
|
1183
|
-
return
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
),
|
|
1168
|
+
function throwIfCancellationRequested(config) {
|
|
1169
|
+
if (config.cancelToken && config.cancelToken.throwIfRequested(), config.signal && config.signal.aborted)
|
|
1170
|
+
throw new CanceledError(null, config);
|
|
1171
|
+
}
|
|
1172
|
+
function dispatchRequest(config) {
|
|
1173
|
+
return throwIfCancellationRequested(config), config.headers = AxiosHeaders$1.from(config.headers), config.data = transformData.call(
|
|
1174
|
+
config,
|
|
1175
|
+
config.transformRequest
|
|
1176
|
+
), ["post", "put", "patch"].indexOf(config.method) !== -1 && config.headers.setContentType("application/x-www-form-urlencoded", !1), adapters.getAdapter(config.adapter || defaults$1.adapter)(config).then(function(response) {
|
|
1177
|
+
return throwIfCancellationRequested(config), response.data = transformData.call(
|
|
1178
|
+
config,
|
|
1179
|
+
config.transformResponse,
|
|
1180
|
+
response
|
|
1181
|
+
), response.headers = AxiosHeaders$1.from(response.headers), response;
|
|
1182
|
+
}, function(reason) {
|
|
1183
|
+
return isCancel(reason) || (throwIfCancellationRequested(config), reason && reason.response && (reason.response.data = transformData.call(
|
|
1184
|
+
config,
|
|
1185
|
+
config.transformResponse,
|
|
1186
|
+
reason.response
|
|
1187
|
+
), reason.response.headers = AxiosHeaders$1.from(reason.response.headers))), Promise.reject(reason);
|
|
1188
1188
|
});
|
|
1189
1189
|
}
|
|
1190
|
-
const
|
|
1191
|
-
function
|
|
1192
|
-
|
|
1193
|
-
const
|
|
1194
|
-
function
|
|
1195
|
-
return
|
|
1196
|
-
}
|
|
1197
|
-
function
|
|
1198
|
-
if (
|
|
1199
|
-
if (!
|
|
1200
|
-
return
|
|
1190
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
|
|
1191
|
+
function mergeConfig(config1, config2) {
|
|
1192
|
+
config2 = config2 || {};
|
|
1193
|
+
const config = {};
|
|
1194
|
+
function getMergedValue(target, source, caseless) {
|
|
1195
|
+
return utils.isPlainObject(target) && utils.isPlainObject(source) ? utils.merge.call({ caseless }, target, source) : utils.isPlainObject(source) ? utils.merge({}, source) : utils.isArray(source) ? source.slice() : source;
|
|
1196
|
+
}
|
|
1197
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
1198
|
+
if (utils.isUndefined(b)) {
|
|
1199
|
+
if (!utils.isUndefined(a))
|
|
1200
|
+
return getMergedValue(void 0, a, caseless);
|
|
1201
1201
|
} else
|
|
1202
|
-
return
|
|
1202
|
+
return getMergedValue(a, b, caseless);
|
|
1203
1203
|
}
|
|
1204
|
-
function
|
|
1205
|
-
if (!
|
|
1206
|
-
return
|
|
1204
|
+
function valueFromConfig2(a, b) {
|
|
1205
|
+
if (!utils.isUndefined(b))
|
|
1206
|
+
return getMergedValue(void 0, b);
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1209
|
-
if (
|
|
1210
|
-
if (!
|
|
1211
|
-
return
|
|
1208
|
+
function defaultToConfig2(a, b) {
|
|
1209
|
+
if (utils.isUndefined(b)) {
|
|
1210
|
+
if (!utils.isUndefined(a))
|
|
1211
|
+
return getMergedValue(void 0, a);
|
|
1212
1212
|
} else
|
|
1213
|
-
return
|
|
1214
|
-
}
|
|
1215
|
-
function
|
|
1216
|
-
if (
|
|
1217
|
-
return
|
|
1218
|
-
if (
|
|
1219
|
-
return
|
|
1220
|
-
}
|
|
1221
|
-
const
|
|
1222
|
-
url:
|
|
1223
|
-
method:
|
|
1224
|
-
data:
|
|
1225
|
-
baseURL:
|
|
1226
|
-
transformRequest:
|
|
1227
|
-
transformResponse:
|
|
1228
|
-
paramsSerializer:
|
|
1229
|
-
timeout:
|
|
1230
|
-
timeoutMessage:
|
|
1231
|
-
withCredentials:
|
|
1232
|
-
adapter:
|
|
1233
|
-
responseType:
|
|
1234
|
-
xsrfCookieName:
|
|
1235
|
-
xsrfHeaderName:
|
|
1236
|
-
onUploadProgress:
|
|
1237
|
-
onDownloadProgress:
|
|
1238
|
-
decompress:
|
|
1239
|
-
maxContentLength:
|
|
1240
|
-
maxBodyLength:
|
|
1241
|
-
beforeRedirect:
|
|
1242
|
-
transport:
|
|
1243
|
-
httpAgent:
|
|
1244
|
-
httpsAgent:
|
|
1245
|
-
cancelToken:
|
|
1246
|
-
socketPath:
|
|
1247
|
-
responseEncoding:
|
|
1248
|
-
validateStatus:
|
|
1249
|
-
headers: (
|
|
1213
|
+
return getMergedValue(void 0, b);
|
|
1214
|
+
}
|
|
1215
|
+
function mergeDirectKeys(a, b, prop) {
|
|
1216
|
+
if (prop in config2)
|
|
1217
|
+
return getMergedValue(a, b);
|
|
1218
|
+
if (prop in config1)
|
|
1219
|
+
return getMergedValue(void 0, a);
|
|
1220
|
+
}
|
|
1221
|
+
const mergeMap = {
|
|
1222
|
+
url: valueFromConfig2,
|
|
1223
|
+
method: valueFromConfig2,
|
|
1224
|
+
data: valueFromConfig2,
|
|
1225
|
+
baseURL: defaultToConfig2,
|
|
1226
|
+
transformRequest: defaultToConfig2,
|
|
1227
|
+
transformResponse: defaultToConfig2,
|
|
1228
|
+
paramsSerializer: defaultToConfig2,
|
|
1229
|
+
timeout: defaultToConfig2,
|
|
1230
|
+
timeoutMessage: defaultToConfig2,
|
|
1231
|
+
withCredentials: defaultToConfig2,
|
|
1232
|
+
adapter: defaultToConfig2,
|
|
1233
|
+
responseType: defaultToConfig2,
|
|
1234
|
+
xsrfCookieName: defaultToConfig2,
|
|
1235
|
+
xsrfHeaderName: defaultToConfig2,
|
|
1236
|
+
onUploadProgress: defaultToConfig2,
|
|
1237
|
+
onDownloadProgress: defaultToConfig2,
|
|
1238
|
+
decompress: defaultToConfig2,
|
|
1239
|
+
maxContentLength: defaultToConfig2,
|
|
1240
|
+
maxBodyLength: defaultToConfig2,
|
|
1241
|
+
beforeRedirect: defaultToConfig2,
|
|
1242
|
+
transport: defaultToConfig2,
|
|
1243
|
+
httpAgent: defaultToConfig2,
|
|
1244
|
+
httpsAgent: defaultToConfig2,
|
|
1245
|
+
cancelToken: defaultToConfig2,
|
|
1246
|
+
socketPath: defaultToConfig2,
|
|
1247
|
+
responseEncoding: defaultToConfig2,
|
|
1248
|
+
validateStatus: mergeDirectKeys,
|
|
1249
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), !0)
|
|
1250
1250
|
};
|
|
1251
|
-
return
|
|
1252
|
-
const
|
|
1253
|
-
|
|
1254
|
-
}),
|
|
1255
|
-
}
|
|
1256
|
-
const
|
|
1257
|
-
["object", "boolean", "number", "function", "string", "symbol"].forEach((
|
|
1258
|
-
|
|
1259
|
-
return typeof
|
|
1251
|
+
return utils.forEach(Object.keys(Object.assign({}, config1, config2)), function(prop) {
|
|
1252
|
+
const merge2 = mergeMap[prop] || mergeDeepProperties, configValue = merge2(config1[prop], config2[prop], prop);
|
|
1253
|
+
utils.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
1254
|
+
}), config;
|
|
1255
|
+
}
|
|
1256
|
+
const VERSION = "1.5.1", validators$1 = {};
|
|
1257
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
1258
|
+
validators$1[type] = function(thing) {
|
|
1259
|
+
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
1260
1260
|
};
|
|
1261
1261
|
});
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1264
|
-
function
|
|
1265
|
-
return "[Axios v" +
|
|
1266
|
-
}
|
|
1267
|
-
return (
|
|
1268
|
-
if (
|
|
1269
|
-
throw new
|
|
1270
|
-
|
|
1271
|
-
|
|
1262
|
+
const deprecatedWarnings = {};
|
|
1263
|
+
validators$1.transitional = function(validator2, version, message) {
|
|
1264
|
+
function formatMessage(opt, desc) {
|
|
1265
|
+
return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
1266
|
+
}
|
|
1267
|
+
return (value, opt, opts) => {
|
|
1268
|
+
if (validator2 === !1)
|
|
1269
|
+
throw new AxiosError(
|
|
1270
|
+
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
|
1271
|
+
AxiosError.ERR_DEPRECATED
|
|
1272
1272
|
);
|
|
1273
|
-
return
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
" has been deprecated since v" +
|
|
1273
|
+
return version && !deprecatedWarnings[opt] && (deprecatedWarnings[opt] = !0, console.warn(
|
|
1274
|
+
formatMessage(
|
|
1275
|
+
opt,
|
|
1276
|
+
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
1277
1277
|
)
|
|
1278
|
-
)),
|
|
1278
|
+
)), validator2 ? validator2(value, opt, opts) : !0;
|
|
1279
1279
|
};
|
|
1280
1280
|
};
|
|
1281
|
-
function
|
|
1282
|
-
if (typeof
|
|
1283
|
-
throw new
|
|
1284
|
-
const
|
|
1285
|
-
let
|
|
1286
|
-
for (;
|
|
1287
|
-
const
|
|
1288
|
-
if (
|
|
1289
|
-
const
|
|
1290
|
-
if (
|
|
1291
|
-
throw new
|
|
1281
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
1282
|
+
if (typeof options != "object")
|
|
1283
|
+
throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1284
|
+
const keys = Object.keys(options);
|
|
1285
|
+
let i = keys.length;
|
|
1286
|
+
for (; i-- > 0; ) {
|
|
1287
|
+
const opt = keys[i], validator2 = schema[opt];
|
|
1288
|
+
if (validator2) {
|
|
1289
|
+
const value = options[opt], result = value === void 0 || validator2(value, opt, options);
|
|
1290
|
+
if (result !== !0)
|
|
1291
|
+
throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1292
1292
|
continue;
|
|
1293
1293
|
}
|
|
1294
|
-
if (
|
|
1295
|
-
throw new
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
const
|
|
1299
|
-
assertOptions
|
|
1300
|
-
validators:
|
|
1301
|
-
},
|
|
1302
|
-
class
|
|
1303
|
-
constructor(
|
|
1304
|
-
this.defaults =
|
|
1305
|
-
request: new
|
|
1306
|
-
response: new
|
|
1294
|
+
if (allowUnknown !== !0)
|
|
1295
|
+
throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
const validator = {
|
|
1299
|
+
assertOptions,
|
|
1300
|
+
validators: validators$1
|
|
1301
|
+
}, validators = validator.validators;
|
|
1302
|
+
class Axios {
|
|
1303
|
+
constructor(instanceConfig) {
|
|
1304
|
+
this.defaults = instanceConfig, this.interceptors = {
|
|
1305
|
+
request: new InterceptorManager$1(),
|
|
1306
|
+
response: new InterceptorManager$1()
|
|
1307
1307
|
};
|
|
1308
1308
|
}
|
|
1309
1309
|
/**
|
|
@@ -1314,122 +1314,122 @@ class z {
|
|
|
1314
1314
|
*
|
|
1315
1315
|
* @returns {Promise} The Promise to be fulfilled
|
|
1316
1316
|
*/
|
|
1317
|
-
request(
|
|
1318
|
-
typeof
|
|
1319
|
-
const { transitional:
|
|
1320
|
-
|
|
1321
|
-
silentJSONParsing:
|
|
1322
|
-
forcedJSONParsing:
|
|
1323
|
-
clarifyTimeoutError:
|
|
1324
|
-
}, !1),
|
|
1325
|
-
serialize:
|
|
1326
|
-
} :
|
|
1327
|
-
encode:
|
|
1328
|
-
serialize:
|
|
1329
|
-
}, !0)),
|
|
1330
|
-
let
|
|
1331
|
-
|
|
1332
|
-
|
|
1317
|
+
request(configOrUrl, config) {
|
|
1318
|
+
typeof configOrUrl == "string" ? (config = config || {}, config.url = configOrUrl) : config = configOrUrl || {}, config = mergeConfig(this.defaults, config);
|
|
1319
|
+
const { transitional: transitional2, paramsSerializer, headers } = config;
|
|
1320
|
+
transitional2 !== void 0 && validator.assertOptions(transitional2, {
|
|
1321
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
1322
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
1323
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
1324
|
+
}, !1), paramsSerializer != null && (utils.isFunction(paramsSerializer) ? config.paramsSerializer = {
|
|
1325
|
+
serialize: paramsSerializer
|
|
1326
|
+
} : validator.assertOptions(paramsSerializer, {
|
|
1327
|
+
encode: validators.function,
|
|
1328
|
+
serialize: validators.function
|
|
1329
|
+
}, !0)), config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
|
1330
|
+
let contextHeaders = headers && utils.merge(
|
|
1331
|
+
headers.common,
|
|
1332
|
+
headers[config.method]
|
|
1333
1333
|
);
|
|
1334
|
-
|
|
1334
|
+
headers && utils.forEach(
|
|
1335
1335
|
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
1336
|
-
(
|
|
1337
|
-
delete
|
|
1336
|
+
(method) => {
|
|
1337
|
+
delete headers[method];
|
|
1338
1338
|
}
|
|
1339
|
-
),
|
|
1340
|
-
const
|
|
1341
|
-
let
|
|
1342
|
-
this.interceptors.request.forEach(function(
|
|
1343
|
-
typeof
|
|
1339
|
+
), config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
1340
|
+
const requestInterceptorChain = [];
|
|
1341
|
+
let synchronousRequestInterceptors = !0;
|
|
1342
|
+
this.interceptors.request.forEach(function(interceptor) {
|
|
1343
|
+
typeof interceptor.runWhen == "function" && interceptor.runWhen(config) === !1 || (synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous, requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected));
|
|
1344
1344
|
});
|
|
1345
|
-
const
|
|
1346
|
-
this.interceptors.response.forEach(function(
|
|
1347
|
-
|
|
1345
|
+
const responseInterceptorChain = [];
|
|
1346
|
+
this.interceptors.response.forEach(function(interceptor) {
|
|
1347
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
1348
1348
|
});
|
|
1349
|
-
let
|
|
1350
|
-
if (!
|
|
1351
|
-
const
|
|
1352
|
-
for (
|
|
1353
|
-
|
|
1354
|
-
return
|
|
1349
|
+
let promise, i = 0, len;
|
|
1350
|
+
if (!synchronousRequestInterceptors) {
|
|
1351
|
+
const chain = [dispatchRequest.bind(this), void 0];
|
|
1352
|
+
for (chain.unshift.apply(chain, requestInterceptorChain), chain.push.apply(chain, responseInterceptorChain), len = chain.length, promise = Promise.resolve(config); i < len; )
|
|
1353
|
+
promise = promise.then(chain[i++], chain[i++]);
|
|
1354
|
+
return promise;
|
|
1355
1355
|
}
|
|
1356
|
-
|
|
1357
|
-
let
|
|
1358
|
-
for (
|
|
1359
|
-
const
|
|
1356
|
+
len = requestInterceptorChain.length;
|
|
1357
|
+
let newConfig = config;
|
|
1358
|
+
for (i = 0; i < len; ) {
|
|
1359
|
+
const onFulfilled = requestInterceptorChain[i++], onRejected = requestInterceptorChain[i++];
|
|
1360
1360
|
try {
|
|
1361
|
-
|
|
1362
|
-
} catch (
|
|
1363
|
-
|
|
1361
|
+
newConfig = onFulfilled(newConfig);
|
|
1362
|
+
} catch (error) {
|
|
1363
|
+
onRejected.call(this, error);
|
|
1364
1364
|
break;
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
1367
|
try {
|
|
1368
|
-
|
|
1369
|
-
} catch (
|
|
1370
|
-
return Promise.reject(
|
|
1368
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
1369
|
+
} catch (error) {
|
|
1370
|
+
return Promise.reject(error);
|
|
1371
1371
|
}
|
|
1372
|
-
for (
|
|
1373
|
-
|
|
1374
|
-
return
|
|
1375
|
-
}
|
|
1376
|
-
getUri(
|
|
1377
|
-
|
|
1378
|
-
const
|
|
1379
|
-
return
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
return this.request(
|
|
1385
|
-
method
|
|
1386
|
-
url
|
|
1387
|
-
data: (
|
|
1372
|
+
for (i = 0, len = responseInterceptorChain.length; i < len; )
|
|
1373
|
+
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
1374
|
+
return promise;
|
|
1375
|
+
}
|
|
1376
|
+
getUri(config) {
|
|
1377
|
+
config = mergeConfig(this.defaults, config);
|
|
1378
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
1379
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
utils.forEach(["delete", "get", "head", "options"], function(method) {
|
|
1383
|
+
Axios.prototype[method] = function(url, config) {
|
|
1384
|
+
return this.request(mergeConfig(config || {}, {
|
|
1385
|
+
method,
|
|
1386
|
+
url,
|
|
1387
|
+
data: (config || {}).data
|
|
1388
1388
|
}));
|
|
1389
1389
|
};
|
|
1390
1390
|
});
|
|
1391
|
-
|
|
1392
|
-
function
|
|
1393
|
-
return function(
|
|
1394
|
-
return this.request(
|
|
1395
|
-
method
|
|
1396
|
-
headers:
|
|
1391
|
+
utils.forEach(["post", "put", "patch"], function(method) {
|
|
1392
|
+
function generateHTTPMethod(isForm) {
|
|
1393
|
+
return function(url, data, config) {
|
|
1394
|
+
return this.request(mergeConfig(config || {}, {
|
|
1395
|
+
method,
|
|
1396
|
+
headers: isForm ? {
|
|
1397
1397
|
"Content-Type": "multipart/form-data"
|
|
1398
1398
|
} : {},
|
|
1399
|
-
url
|
|
1400
|
-
data
|
|
1399
|
+
url,
|
|
1400
|
+
data
|
|
1401
1401
|
}));
|
|
1402
1402
|
};
|
|
1403
1403
|
}
|
|
1404
|
-
|
|
1404
|
+
Axios.prototype[method] = generateHTTPMethod(), Axios.prototype[method + "Form"] = generateHTTPMethod(!0);
|
|
1405
1405
|
});
|
|
1406
|
-
const
|
|
1407
|
-
class
|
|
1408
|
-
constructor(
|
|
1409
|
-
if (typeof
|
|
1406
|
+
const Axios$1 = Axios;
|
|
1407
|
+
class CancelToken {
|
|
1408
|
+
constructor(executor) {
|
|
1409
|
+
if (typeof executor != "function")
|
|
1410
1410
|
throw new TypeError("executor must be a function.");
|
|
1411
|
-
let
|
|
1412
|
-
this.promise = new Promise(function(
|
|
1413
|
-
|
|
1411
|
+
let resolvePromise;
|
|
1412
|
+
this.promise = new Promise(function(resolve) {
|
|
1413
|
+
resolvePromise = resolve;
|
|
1414
1414
|
});
|
|
1415
|
-
const
|
|
1416
|
-
this.promise.then((
|
|
1417
|
-
if (!
|
|
1415
|
+
const token = this;
|
|
1416
|
+
this.promise.then((cancel) => {
|
|
1417
|
+
if (!token._listeners)
|
|
1418
1418
|
return;
|
|
1419
|
-
let i =
|
|
1419
|
+
let i = token._listeners.length;
|
|
1420
1420
|
for (; i-- > 0; )
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
}), this.promise.then = (
|
|
1424
|
-
let
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1427
|
-
}).then(
|
|
1428
|
-
return
|
|
1429
|
-
|
|
1430
|
-
},
|
|
1431
|
-
},
|
|
1432
|
-
|
|
1421
|
+
token._listeners[i](cancel);
|
|
1422
|
+
token._listeners = null;
|
|
1423
|
+
}), this.promise.then = (onfulfilled) => {
|
|
1424
|
+
let _resolve;
|
|
1425
|
+
const promise = new Promise((resolve) => {
|
|
1426
|
+
token.subscribe(resolve), _resolve = resolve;
|
|
1427
|
+
}).then(onfulfilled);
|
|
1428
|
+
return promise.cancel = function() {
|
|
1429
|
+
token.unsubscribe(_resolve);
|
|
1430
|
+
}, promise;
|
|
1431
|
+
}, executor(function(message, config, request) {
|
|
1432
|
+
token.reason || (token.reason = new CanceledError(message, config, request), resolvePromise(token.reason));
|
|
1433
1433
|
});
|
|
1434
1434
|
}
|
|
1435
1435
|
/**
|
|
@@ -1442,46 +1442,46 @@ class ot {
|
|
|
1442
1442
|
/**
|
|
1443
1443
|
* Subscribe to the cancel signal
|
|
1444
1444
|
*/
|
|
1445
|
-
subscribe(
|
|
1445
|
+
subscribe(listener) {
|
|
1446
1446
|
if (this.reason) {
|
|
1447
|
-
|
|
1447
|
+
listener(this.reason);
|
|
1448
1448
|
return;
|
|
1449
1449
|
}
|
|
1450
|
-
this._listeners ? this._listeners.push(
|
|
1450
|
+
this._listeners ? this._listeners.push(listener) : this._listeners = [listener];
|
|
1451
1451
|
}
|
|
1452
1452
|
/**
|
|
1453
1453
|
* Unsubscribe from the cancel signal
|
|
1454
1454
|
*/
|
|
1455
|
-
unsubscribe(
|
|
1455
|
+
unsubscribe(listener) {
|
|
1456
1456
|
if (!this._listeners)
|
|
1457
1457
|
return;
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1458
|
+
const index = this._listeners.indexOf(listener);
|
|
1459
|
+
index !== -1 && this._listeners.splice(index, 1);
|
|
1460
1460
|
}
|
|
1461
1461
|
/**
|
|
1462
1462
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
1463
1463
|
* cancels the `CancelToken`.
|
|
1464
1464
|
*/
|
|
1465
1465
|
static source() {
|
|
1466
|
-
let
|
|
1466
|
+
let cancel;
|
|
1467
1467
|
return {
|
|
1468
|
-
token: new
|
|
1469
|
-
|
|
1468
|
+
token: new CancelToken(function(c) {
|
|
1469
|
+
cancel = c;
|
|
1470
1470
|
}),
|
|
1471
|
-
cancel
|
|
1471
|
+
cancel
|
|
1472
1472
|
};
|
|
1473
1473
|
}
|
|
1474
1474
|
}
|
|
1475
|
-
const
|
|
1476
|
-
function
|
|
1477
|
-
return function(
|
|
1478
|
-
return
|
|
1475
|
+
const CancelToken$1 = CancelToken;
|
|
1476
|
+
function spread(callback) {
|
|
1477
|
+
return function(arr) {
|
|
1478
|
+
return callback.apply(null, arr);
|
|
1479
1479
|
};
|
|
1480
1480
|
}
|
|
1481
|
-
function
|
|
1482
|
-
return
|
|
1481
|
+
function isAxiosError(payload) {
|
|
1482
|
+
return utils.isObject(payload) && payload.isAxiosError === !0;
|
|
1483
1483
|
}
|
|
1484
|
-
const
|
|
1484
|
+
const HttpStatusCode = {
|
|
1485
1485
|
Continue: 100,
|
|
1486
1486
|
SwitchingProtocols: 101,
|
|
1487
1487
|
Processing: 102,
|
|
@@ -1546,46 +1546,46 @@ const v = {
|
|
|
1546
1546
|
NotExtended: 510,
|
|
1547
1547
|
NetworkAuthenticationRequired: 511
|
|
1548
1548
|
};
|
|
1549
|
-
Object.entries(
|
|
1550
|
-
|
|
1549
|
+
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
1550
|
+
HttpStatusCode[value] = key;
|
|
1551
1551
|
});
|
|
1552
|
-
const
|
|
1553
|
-
function
|
|
1554
|
-
const
|
|
1555
|
-
return
|
|
1556
|
-
return
|
|
1557
|
-
},
|
|
1558
|
-
}
|
|
1559
|
-
const
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
return Promise.all(
|
|
1552
|
+
const HttpStatusCode$1 = HttpStatusCode;
|
|
1553
|
+
function createInstance(defaultConfig) {
|
|
1554
|
+
const context = new Axios$1(defaultConfig), instance = bind(Axios$1.prototype.request, context);
|
|
1555
|
+
return utils.extend(instance, Axios$1.prototype, context, { allOwnKeys: !0 }), utils.extend(instance, context, null, { allOwnKeys: !0 }), instance.create = function(instanceConfig) {
|
|
1556
|
+
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
|
1557
|
+
}, instance;
|
|
1558
|
+
}
|
|
1559
|
+
const axios = createInstance(defaults$1);
|
|
1560
|
+
axios.Axios = Axios$1;
|
|
1561
|
+
axios.CanceledError = CanceledError;
|
|
1562
|
+
axios.CancelToken = CancelToken$1;
|
|
1563
|
+
axios.isCancel = isCancel;
|
|
1564
|
+
axios.VERSION = VERSION;
|
|
1565
|
+
axios.toFormData = toFormData;
|
|
1566
|
+
axios.AxiosError = AxiosError;
|
|
1567
|
+
axios.Cancel = axios.CanceledError;
|
|
1568
|
+
axios.all = function(promises) {
|
|
1569
|
+
return Promise.all(promises);
|
|
1570
1570
|
};
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
const
|
|
1580
|
-
class
|
|
1581
|
-
constructor(
|
|
1582
|
-
|
|
1583
|
-
|
|
1571
|
+
axios.spread = spread;
|
|
1572
|
+
axios.isAxiosError = isAxiosError;
|
|
1573
|
+
axios.mergeConfig = mergeConfig;
|
|
1574
|
+
axios.AxiosHeaders = AxiosHeaders$1;
|
|
1575
|
+
axios.formToJSON = (thing) => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
1576
|
+
axios.getAdapter = adapters.getAdapter;
|
|
1577
|
+
axios.HttpStatusCode = HttpStatusCode$1;
|
|
1578
|
+
axios.default = axios;
|
|
1579
|
+
const axios$1 = axios;
|
|
1580
|
+
class HttpClient {
|
|
1581
|
+
constructor(url, httpRequester = null) {
|
|
1582
|
+
__publicField(this, "_url", null);
|
|
1583
|
+
__publicField(this, "_token", null);
|
|
1584
1584
|
//Added for testing support
|
|
1585
|
-
|
|
1586
|
-
if (!
|
|
1585
|
+
__publicField(this, "_httpRequester");
|
|
1586
|
+
if (!url)
|
|
1587
1587
|
throw Error("Endpoint URL must be passed in to NotuClient constructor");
|
|
1588
|
-
this._url =
|
|
1588
|
+
this._url = url, this._httpRequester = httpRequester ?? axios$1;
|
|
1589
1589
|
}
|
|
1590
1590
|
get url() {
|
|
1591
1591
|
return this._url;
|
|
@@ -1593,21 +1593,21 @@ class wn {
|
|
|
1593
1593
|
get token() {
|
|
1594
1594
|
return this._token;
|
|
1595
1595
|
}
|
|
1596
|
-
set token(
|
|
1597
|
-
this._token =
|
|
1596
|
+
set token(value) {
|
|
1597
|
+
this._token = value;
|
|
1598
1598
|
}
|
|
1599
|
-
async login(
|
|
1599
|
+
async login(username, password) {
|
|
1600
1600
|
try {
|
|
1601
|
-
const
|
|
1601
|
+
const result = await this._httpRequester({
|
|
1602
1602
|
method: "post",
|
|
1603
1603
|
url: (this.url + "/login").replace("//", "/"),
|
|
1604
|
-
data: { username
|
|
1604
|
+
data: { username, password }
|
|
1605
1605
|
});
|
|
1606
|
-
return this._token =
|
|
1607
|
-
} catch (
|
|
1608
|
-
if (
|
|
1606
|
+
return this._token = result.data, { success: !0, error: null, token: result.data };
|
|
1607
|
+
} catch (ex) {
|
|
1608
|
+
if (ex.response.status == 401)
|
|
1609
1609
|
return { success: !1, error: "Invalid username & password.", token: null };
|
|
1610
|
-
throw
|
|
1610
|
+
throw ex;
|
|
1611
1611
|
}
|
|
1612
1612
|
}
|
|
1613
1613
|
async getSpaces() {
|
|
@@ -1619,272 +1619,272 @@ class wn {
|
|
|
1619
1619
|
}
|
|
1620
1620
|
})).data;
|
|
1621
1621
|
}
|
|
1622
|
-
async saveSpace(
|
|
1622
|
+
async saveSpace(space) {
|
|
1623
1623
|
return (await this._httpRequester({
|
|
1624
1624
|
method: "post",
|
|
1625
1625
|
url: (this.url + "/spaces").replace("//", "/"),
|
|
1626
|
-
data:
|
|
1626
|
+
data: space,
|
|
1627
1627
|
headers: {
|
|
1628
1628
|
Authorization: "Bearer " + this.token
|
|
1629
1629
|
}
|
|
1630
1630
|
})).data;
|
|
1631
1631
|
}
|
|
1632
|
-
async getNotes(
|
|
1632
|
+
async getNotes(query, spaceId) {
|
|
1633
1633
|
return (await this._httpRequester({
|
|
1634
1634
|
method: "get",
|
|
1635
1635
|
url: (this.url + "/notes").replace("//", "/"),
|
|
1636
|
-
data: { query
|
|
1636
|
+
data: { query, spaceId },
|
|
1637
1637
|
headers: {
|
|
1638
1638
|
Authorization: "Bearer " + this.token
|
|
1639
1639
|
}
|
|
1640
1640
|
})).data;
|
|
1641
1641
|
}
|
|
1642
|
-
async getNoteCount(
|
|
1642
|
+
async getNoteCount(query, spaceId) {
|
|
1643
1643
|
return (await this._httpRequester({
|
|
1644
1644
|
method: "get",
|
|
1645
1645
|
url: (this.url + "/notes").replace("//", "/"),
|
|
1646
|
-
data: { query
|
|
1646
|
+
data: { query, spaceId },
|
|
1647
1647
|
headers: {
|
|
1648
1648
|
Authorization: "Bearer " + this.token
|
|
1649
1649
|
}
|
|
1650
1650
|
})).data;
|
|
1651
1651
|
}
|
|
1652
|
-
async saveNotes(
|
|
1652
|
+
async saveNotes(notes) {
|
|
1653
1653
|
return (await this._httpRequester({
|
|
1654
1654
|
method: "post",
|
|
1655
1655
|
url: (this.url + "/notes").replace("//", "/"),
|
|
1656
|
-
data: { notes
|
|
1656
|
+
data: { notes },
|
|
1657
1657
|
headers: {
|
|
1658
1658
|
Authorization: "Bearer " + this.token
|
|
1659
1659
|
}
|
|
1660
1660
|
})).data;
|
|
1661
1661
|
}
|
|
1662
|
-
async customJob(
|
|
1662
|
+
async customJob(name, data) {
|
|
1663
1663
|
return (await this._httpRequester({
|
|
1664
1664
|
method: "post",
|
|
1665
1665
|
url: (this.url + "customjob").replace("//", "/"),
|
|
1666
|
-
data: { name
|
|
1666
|
+
data: { name, data },
|
|
1667
1667
|
headers: {
|
|
1668
1668
|
Authorization: "Bearer " + this.token
|
|
1669
1669
|
}
|
|
1670
1670
|
})).data;
|
|
1671
1671
|
}
|
|
1672
1672
|
}
|
|
1673
|
-
class
|
|
1673
|
+
class NoteAttr extends ModelWithState {
|
|
1674
1674
|
constructor() {
|
|
1675
1675
|
super(...arguments);
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1676
|
+
__publicField(this, "_noteId", 0);
|
|
1677
|
+
__publicField(this, "_note", null);
|
|
1678
|
+
__publicField(this, "_attrId", 0);
|
|
1679
|
+
__publicField(this, "_attr", null);
|
|
1680
|
+
__publicField(this, "_value", null);
|
|
1681
|
+
__publicField(this, "_tagId", null);
|
|
1682
|
+
__publicField(this, "_tag", null);
|
|
1683
1683
|
}
|
|
1684
1684
|
get noteId() {
|
|
1685
1685
|
return this._noteId;
|
|
1686
1686
|
}
|
|
1687
|
-
set noteId(
|
|
1688
|
-
var
|
|
1689
|
-
|
|
1687
|
+
set noteId(value) {
|
|
1688
|
+
var _a;
|
|
1689
|
+
value !== this._noteId && (this._noteId = value, value !== ((_a = this.note) == null ? void 0 : _a.id) && (this._note = null), this.isClean && this.dirty());
|
|
1690
1690
|
}
|
|
1691
1691
|
get note() {
|
|
1692
1692
|
return this._note;
|
|
1693
1693
|
}
|
|
1694
|
-
set note(
|
|
1695
|
-
this._note =
|
|
1694
|
+
set note(value) {
|
|
1695
|
+
this._note = value, this.noteId = (value == null ? void 0 : value.id) ?? 0;
|
|
1696
1696
|
}
|
|
1697
1697
|
get attrId() {
|
|
1698
1698
|
return this._attrId;
|
|
1699
1699
|
}
|
|
1700
|
-
set attrId(
|
|
1701
|
-
var
|
|
1702
|
-
|
|
1700
|
+
set attrId(value) {
|
|
1701
|
+
var _a;
|
|
1702
|
+
value !== this._attrId && (this._attrId = value, value !== ((_a = this.attr) == null ? void 0 : _a.id) && (this._attr = null), this.isClean && this.dirty());
|
|
1703
1703
|
}
|
|
1704
1704
|
get attr() {
|
|
1705
1705
|
return this._attr;
|
|
1706
1706
|
}
|
|
1707
|
-
set attr(
|
|
1708
|
-
const
|
|
1709
|
-
this._attr =
|
|
1707
|
+
set attr(newAttr) {
|
|
1708
|
+
const oldAttr = this._attr;
|
|
1709
|
+
this._attr = newAttr, newAttr ? (!oldAttr || newAttr.type != oldAttr.type) && (this.value = newAttr.defaultValue) : this.value = null, this.attrId = (newAttr == null ? void 0 : newAttr.id) ?? 0;
|
|
1710
1710
|
}
|
|
1711
1711
|
get value() {
|
|
1712
1712
|
return this._value;
|
|
1713
1713
|
}
|
|
1714
|
-
set value(
|
|
1715
|
-
|
|
1714
|
+
set value(newVal) {
|
|
1715
|
+
newVal != this._value && (this._value = newVal, this.isClean && this.dirty());
|
|
1716
1716
|
}
|
|
1717
1717
|
get tagId() {
|
|
1718
1718
|
return this._tagId;
|
|
1719
1719
|
}
|
|
1720
|
-
set tagId(
|
|
1721
|
-
var
|
|
1722
|
-
|
|
1720
|
+
set tagId(value) {
|
|
1721
|
+
var _a;
|
|
1722
|
+
value !== this._tagId && (this._tagId = value, value !== ((_a = this.tag) == null ? void 0 : _a.id) && (this._tag = null), this.isClean && this.dirty());
|
|
1723
1723
|
}
|
|
1724
1724
|
get tag() {
|
|
1725
1725
|
return this._tag;
|
|
1726
1726
|
}
|
|
1727
|
-
set tag(
|
|
1728
|
-
this._tag =
|
|
1727
|
+
set tag(value) {
|
|
1728
|
+
this._tag = value, this.tagId = (value == null ? void 0 : value.id) ?? null;
|
|
1729
1729
|
}
|
|
1730
1730
|
duplicate() {
|
|
1731
|
-
const
|
|
1732
|
-
return
|
|
1731
|
+
const output = new NoteAttr();
|
|
1732
|
+
return output.noteId = this.noteId, output.note = this.note, output.attrId = this.attrId, output.attr = this.attr, output.tagId = this.tagId, output.tag = this.tag, output.value = this.value, output;
|
|
1733
1733
|
}
|
|
1734
|
-
validate(
|
|
1735
|
-
let
|
|
1736
|
-
if (this.noteId <= 0 && !this.isNew ?
|
|
1737
|
-
throw Error(
|
|
1738
|
-
return
|
|
1734
|
+
validate(throwError = !1) {
|
|
1735
|
+
let output = null;
|
|
1736
|
+
if (this.noteId <= 0 && !this.isNew ? output = "NoteAttr noteId must be greater than zero" : this.attrId <= 0 && (output = "NoteAttr attrId must be greater than zero"), throwError && output != null)
|
|
1737
|
+
throw Error(output);
|
|
1738
|
+
return output == null;
|
|
1739
1739
|
}
|
|
1740
1740
|
}
|
|
1741
|
-
class
|
|
1741
|
+
class NoteTag extends ModelWithState {
|
|
1742
1742
|
constructor() {
|
|
1743
1743
|
super(...arguments);
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1744
|
+
__publicField(this, "_noteId", 0);
|
|
1745
|
+
__publicField(this, "_note", null);
|
|
1746
|
+
__publicField(this, "_tagId", 0);
|
|
1747
|
+
__publicField(this, "_tag", null);
|
|
1748
1748
|
}
|
|
1749
1749
|
get noteId() {
|
|
1750
1750
|
return this._noteId;
|
|
1751
1751
|
}
|
|
1752
|
-
set noteId(
|
|
1753
|
-
var
|
|
1754
|
-
|
|
1752
|
+
set noteId(value) {
|
|
1753
|
+
var _a;
|
|
1754
|
+
value !== this._noteId && (this._noteId = value, value !== ((_a = this.note) == null ? void 0 : _a.id) && (this._note = null), this.isClean && this.dirty());
|
|
1755
1755
|
}
|
|
1756
1756
|
get note() {
|
|
1757
1757
|
return this._note;
|
|
1758
1758
|
}
|
|
1759
|
-
set note(
|
|
1760
|
-
this._note =
|
|
1759
|
+
set note(value) {
|
|
1760
|
+
this._note = value, this.noteId = (value == null ? void 0 : value.id) ?? 0;
|
|
1761
1761
|
}
|
|
1762
1762
|
get tagId() {
|
|
1763
1763
|
return this._tagId;
|
|
1764
1764
|
}
|
|
1765
|
-
set tagId(
|
|
1766
|
-
var
|
|
1767
|
-
|
|
1765
|
+
set tagId(value) {
|
|
1766
|
+
var _a;
|
|
1767
|
+
value !== this._tagId && (this._tagId = value, value !== ((_a = this.tag) == null ? void 0 : _a.id) && (this._tag = null), this.isClean && this.dirty());
|
|
1768
1768
|
}
|
|
1769
1769
|
get tag() {
|
|
1770
1770
|
return this._tag;
|
|
1771
1771
|
}
|
|
1772
|
-
set tag(
|
|
1773
|
-
this._tag =
|
|
1772
|
+
set tag(value) {
|
|
1773
|
+
this._tag = value, this.tagId = (value == null ? void 0 : value.id) ?? 0;
|
|
1774
1774
|
}
|
|
1775
1775
|
get attrs() {
|
|
1776
|
-
return this.note.attrs.filter((
|
|
1776
|
+
return this.note.attrs.filter((x) => x.tagId == this.tagId);
|
|
1777
1777
|
}
|
|
1778
|
-
addAttr(
|
|
1778
|
+
addAttr(attr) {
|
|
1779
1779
|
if (!this.note)
|
|
1780
1780
|
throw new Error("Cannot call addAttr on NoteTag where note property has not been set");
|
|
1781
|
-
const
|
|
1782
|
-
return
|
|
1781
|
+
const na = this.note.addAttr(attr);
|
|
1782
|
+
return na.tag = this.tag, na;
|
|
1783
1783
|
}
|
|
1784
1784
|
duplicate() {
|
|
1785
|
-
const
|
|
1786
|
-
return
|
|
1785
|
+
const output = new NoteTag();
|
|
1786
|
+
return output.noteId = this.noteId, output.tagId = this.tagId, output;
|
|
1787
1787
|
}
|
|
1788
|
-
validate(
|
|
1789
|
-
let
|
|
1790
|
-
if (this.noteId <= 0 && !this.isNew ?
|
|
1791
|
-
throw Error(
|
|
1792
|
-
return
|
|
1788
|
+
validate(throwError = !1) {
|
|
1789
|
+
let output = null;
|
|
1790
|
+
if (this.noteId <= 0 && !this.isNew ? output = "NoteTag noteId must be greater than zero" : this.tagId <= 0 ? output = "NoteTag tagId must be greater than zero" : this.noteId == this.tagId && (output = "NoteTag cannot link a note to its own tag"), throwError && output != null)
|
|
1791
|
+
throw Error(output);
|
|
1792
|
+
return output == null;
|
|
1793
1793
|
}
|
|
1794
1794
|
}
|
|
1795
|
-
class
|
|
1796
|
-
constructor(
|
|
1795
|
+
class Tag extends ModelWithState {
|
|
1796
|
+
constructor(name = "") {
|
|
1797
1797
|
super();
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
this._name =
|
|
1798
|
+
__publicField(this, "_id", 0);
|
|
1799
|
+
__publicField(this, "_name", "");
|
|
1800
|
+
__publicField(this, "_color", null);
|
|
1801
|
+
this._name = name;
|
|
1802
1802
|
}
|
|
1803
1803
|
get id() {
|
|
1804
1804
|
return this._id;
|
|
1805
1805
|
}
|
|
1806
|
-
set id(
|
|
1807
|
-
|
|
1806
|
+
set id(value) {
|
|
1807
|
+
value !== this._id && (this._id = value, this.isClean && this.dirty());
|
|
1808
1808
|
}
|
|
1809
1809
|
get name() {
|
|
1810
1810
|
return this._name;
|
|
1811
1811
|
}
|
|
1812
|
-
set name(
|
|
1813
|
-
|
|
1812
|
+
set name(value) {
|
|
1813
|
+
value !== this._name && (this._name = value, this.isClean && this.dirty());
|
|
1814
1814
|
}
|
|
1815
1815
|
get color() {
|
|
1816
1816
|
return this._color;
|
|
1817
1817
|
}
|
|
1818
|
-
set color(
|
|
1819
|
-
|
|
1818
|
+
set color(value) {
|
|
1819
|
+
value !== this._color && (this._color = value, this.isClean && this.dirty());
|
|
1820
1820
|
}
|
|
1821
1821
|
duplicate() {
|
|
1822
|
-
const
|
|
1823
|
-
return
|
|
1822
|
+
const output = new Tag();
|
|
1823
|
+
return output.id = this.id, output.name = this.name, output.state = this.state, output;
|
|
1824
1824
|
}
|
|
1825
|
-
validate(
|
|
1826
|
-
let
|
|
1827
|
-
if (!this.isNew && this.id <= 0 ?
|
|
1828
|
-
throw Error(
|
|
1829
|
-
return
|
|
1825
|
+
validate(throwError = !1) {
|
|
1826
|
+
let output = null;
|
|
1827
|
+
if (!this.isNew && this.id <= 0 ? output = "Tag id must be greater than zero if in non-new state." : !this.name || !/^[a-zA-Z][a-zA-Z0-9 ]*[a-zA-Z0-9]?$/.test(this.name) ? output = "Tag name is invalid, must only contain letters, numbers, and spaces, starting with a letter" : this.color && !/^#?[A-z0-9]{6}$/.test(this.color) && (output = "Tag color is invalid, must be a 6 character hexadecimal."), throwError && output != null)
|
|
1828
|
+
throw Error(output);
|
|
1829
|
+
return output == null;
|
|
1830
1830
|
}
|
|
1831
1831
|
}
|
|
1832
|
-
class
|
|
1832
|
+
class Note extends ModelWithState {
|
|
1833
1833
|
constructor() {
|
|
1834
1834
|
super(...arguments);
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1835
|
+
__publicField(this, "id", 0);
|
|
1836
|
+
__publicField(this, "_date", /* @__PURE__ */ new Date());
|
|
1837
|
+
__publicField(this, "_text", "");
|
|
1838
|
+
__publicField(this, "_archived", !1);
|
|
1839
|
+
__publicField(this, "_spaceId", 0);
|
|
1840
|
+
__publicField(this, "_space", null);
|
|
1841
|
+
__publicField(this, "_ownTag", null);
|
|
1842
|
+
__publicField(this, "_tags", []);
|
|
1843
|
+
__publicField(this, "_attrs", []);
|
|
1844
1844
|
}
|
|
1845
1845
|
get date() {
|
|
1846
1846
|
return this._date;
|
|
1847
1847
|
}
|
|
1848
|
-
set date(
|
|
1849
|
-
|
|
1848
|
+
set date(value) {
|
|
1849
|
+
value !== this._date && (this._date = value, this.isClean && this.dirty());
|
|
1850
1850
|
}
|
|
1851
1851
|
get text() {
|
|
1852
1852
|
return this._text;
|
|
1853
1853
|
}
|
|
1854
|
-
set text(
|
|
1855
|
-
|
|
1854
|
+
set text(value) {
|
|
1855
|
+
value !== this._text && (this._text = value, this.isClean && this.dirty());
|
|
1856
1856
|
}
|
|
1857
1857
|
get archived() {
|
|
1858
1858
|
return this._archived;
|
|
1859
1859
|
}
|
|
1860
|
-
set archived(
|
|
1861
|
-
|
|
1860
|
+
set archived(value) {
|
|
1861
|
+
value !== this._archived && (this._archived = value, this.isClean && this.dirty());
|
|
1862
1862
|
}
|
|
1863
1863
|
get spaceId() {
|
|
1864
1864
|
return this._spaceId;
|
|
1865
1865
|
}
|
|
1866
|
-
set spaceId(
|
|
1867
|
-
var
|
|
1868
|
-
|
|
1866
|
+
set spaceId(value) {
|
|
1867
|
+
var _a;
|
|
1868
|
+
value !== this._spaceId && (this._spaceId = value, value !== ((_a = this.space) == null ? void 0 : _a.id) && (this._space = null), this.isClean && this.dirty());
|
|
1869
1869
|
}
|
|
1870
1870
|
get space() {
|
|
1871
1871
|
return this._space;
|
|
1872
1872
|
}
|
|
1873
|
-
set space(
|
|
1874
|
-
this._space =
|
|
1873
|
+
set space(value) {
|
|
1874
|
+
this._space = value, this.spaceId = (value == null ? void 0 : value.id) ?? 0;
|
|
1875
1875
|
}
|
|
1876
1876
|
get ownTag() {
|
|
1877
1877
|
return this._ownTag;
|
|
1878
1878
|
}
|
|
1879
|
-
setOwnTag(
|
|
1880
|
-
if (typeof
|
|
1881
|
-
this.ownTag == null && (this._ownTag = new
|
|
1879
|
+
setOwnTag(tag) {
|
|
1880
|
+
if (typeof tag == "string")
|
|
1881
|
+
this.ownTag == null && (this._ownTag = new Tag()), this.ownTag.name = tag, this.ownTag.id = this.id;
|
|
1882
1882
|
else {
|
|
1883
1883
|
if (this.ownTag)
|
|
1884
1884
|
throw new Error("Note has already had its tag set. If you would like to change the tag name, call setTag with just a string specifying the new tag name.");
|
|
1885
|
-
if (
|
|
1885
|
+
if (tag.id != 0 && tag.id != this.id)
|
|
1886
1886
|
throw new Error("Attempted to set tag to note with non-matching ID. Added tag id must either match the note id, which indicates that the tag has already been added to the note. Otherwise the tag id must be zero, indicating that the tag still needs to be added.");
|
|
1887
|
-
this._ownTag =
|
|
1887
|
+
this._ownTag = tag;
|
|
1888
1888
|
}
|
|
1889
1889
|
return this;
|
|
1890
1890
|
}
|
|
@@ -1894,167 +1894,167 @@ class qt extends I {
|
|
|
1894
1894
|
get tags() {
|
|
1895
1895
|
return this._tags;
|
|
1896
1896
|
}
|
|
1897
|
-
addTag(
|
|
1898
|
-
if (
|
|
1897
|
+
addTag(tag) {
|
|
1898
|
+
if (tag.isDeleted)
|
|
1899
1899
|
throw Error("Cannot add a tag marked as deleted to a note");
|
|
1900
|
-
if (
|
|
1900
|
+
if (tag.isNew)
|
|
1901
1901
|
throw Error("Cannot add a tag that hasn't yet been saved to a note");
|
|
1902
|
-
if (
|
|
1902
|
+
if (tag.id == this.id)
|
|
1903
1903
|
throw Error("Note cannot add its own tag as a linked tag");
|
|
1904
|
-
let
|
|
1905
|
-
return
|
|
1904
|
+
let nt = this.tags.find((x) => x.tagId == tag.id);
|
|
1905
|
+
return nt ? (nt.isDeleted && nt.dirty(), nt) : (nt = new NoteTag(), nt.note = this, nt.tag = tag, this._tags.push(nt), nt);
|
|
1906
1906
|
}
|
|
1907
|
-
removeTag(
|
|
1908
|
-
const
|
|
1909
|
-
return
|
|
1907
|
+
removeTag(tag) {
|
|
1908
|
+
const nt = this.tags.find((x) => x.tagId == tag.id);
|
|
1909
|
+
return nt ? (nt.isNew ? this._tags = this._tags.filter((x) => x !== nt) : nt.delete(), this) : this;
|
|
1910
1910
|
}
|
|
1911
1911
|
get attrs() {
|
|
1912
1912
|
return this._attrs;
|
|
1913
1913
|
}
|
|
1914
|
-
addAttr(
|
|
1915
|
-
if (
|
|
1914
|
+
addAttr(attr) {
|
|
1915
|
+
if (attr.isDeleted)
|
|
1916
1916
|
throw Error("Cannot add an attribute marked as deleted to a note");
|
|
1917
|
-
if (
|
|
1917
|
+
if (attr.isNew)
|
|
1918
1918
|
throw Error("Cannot add an attribute that hasn't yet been saved to a note");
|
|
1919
|
-
let
|
|
1920
|
-
return
|
|
1919
|
+
let na = this.attrs.find((x) => x.attrId == attr.id);
|
|
1920
|
+
return na ? (na.isDeleted && na.dirty(), na) : (na = new NoteAttr(), na.note = this, na.attr = attr, this._attrs.push(na), na);
|
|
1921
1921
|
}
|
|
1922
|
-
removeAttr(
|
|
1923
|
-
const
|
|
1924
|
-
return
|
|
1922
|
+
removeAttr(attr) {
|
|
1923
|
+
const na = this.attrs.find((x) => x.attrId == attr.id);
|
|
1924
|
+
return na ? (na.isNew ? this._attrs = this._attrs.filter((x) => x !== na) : na.delete(), this) : this;
|
|
1925
1925
|
}
|
|
1926
1926
|
duplicate() {
|
|
1927
|
-
const
|
|
1928
|
-
return
|
|
1929
|
-
}
|
|
1930
|
-
validate(
|
|
1931
|
-
let
|
|
1932
|
-
if (this.spaceId <= 0 ?
|
|
1933
|
-
throw Error(
|
|
1934
|
-
if (this.ownTag && !this.ownTag.validate(
|
|
1927
|
+
const output = new Note();
|
|
1928
|
+
return output.id = this.id, output.date = this.date, output.text = this.text, output.archived = this.archived, output.space = this.space, output.state = this.state, output;
|
|
1929
|
+
}
|
|
1930
|
+
validate(throwError = !1) {
|
|
1931
|
+
let output = null;
|
|
1932
|
+
if (this.spaceId <= 0 ? output = "Note spaceId must be greater than zero." : !this.isNew && this.id <= 0 && (output = "Note id must be greater than zero if in non-new state."), throwError && output != null)
|
|
1933
|
+
throw Error(output);
|
|
1934
|
+
if (this.ownTag && !this.ownTag.validate(throwError))
|
|
1935
1935
|
return !1;
|
|
1936
|
-
for (const
|
|
1937
|
-
if (!
|
|
1936
|
+
for (const nt of this.tags)
|
|
1937
|
+
if (!nt.validate(throwError))
|
|
1938
1938
|
return !1;
|
|
1939
|
-
for (const
|
|
1940
|
-
if (!
|
|
1939
|
+
for (const na of this.attrs)
|
|
1940
|
+
if (!na.validate(throwError))
|
|
1941
1941
|
return !1;
|
|
1942
|
-
return
|
|
1942
|
+
return output == null;
|
|
1943
1943
|
}
|
|
1944
1944
|
}
|
|
1945
|
-
class
|
|
1945
|
+
class ParsedQuery {
|
|
1946
1946
|
constructor() {
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1947
|
+
__publicField(this, "where", null);
|
|
1948
|
+
__publicField(this, "order", null);
|
|
1949
|
+
__publicField(this, "tags", []);
|
|
1950
|
+
__publicField(this, "attrs", []);
|
|
1951
1951
|
}
|
|
1952
1952
|
}
|
|
1953
|
-
class
|
|
1953
|
+
class ParsedTag {
|
|
1954
1954
|
constructor() {
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1955
|
+
__publicField(this, "space", null);
|
|
1956
|
+
__publicField(this, "name", null);
|
|
1957
|
+
__publicField(this, "searchDepth", 0);
|
|
1958
|
+
__publicField(this, "strictSearchDepth", !0);
|
|
1959
|
+
__publicField(this, "includeOwner", !1);
|
|
1960
1960
|
}
|
|
1961
1961
|
}
|
|
1962
|
-
class
|
|
1962
|
+
class ParsedAttr {
|
|
1963
1963
|
constructor() {
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1964
|
+
__publicField(this, "space", null);
|
|
1965
|
+
__publicField(this, "name", null);
|
|
1966
|
+
__publicField(this, "exists", !1);
|
|
1967
|
+
__publicField(this, "tagNameFilters", null);
|
|
1968
1968
|
}
|
|
1969
1969
|
}
|
|
1970
|
-
function
|
|
1971
|
-
const
|
|
1972
|
-
return
|
|
1970
|
+
function parseQuery(query) {
|
|
1971
|
+
const output = splitQuery(query);
|
|
1972
|
+
return output.where = identifyTags(output.where, output), output.order = identifyTags(output.order, output), output.where = identifyAttrs(output.where, output), output.order = identifyAttrs(output.order, output), output;
|
|
1973
1973
|
}
|
|
1974
|
-
function
|
|
1975
|
-
|
|
1976
|
-
const
|
|
1977
|
-
return
|
|
1974
|
+
function splitQuery(query) {
|
|
1975
|
+
query = " " + query + " ";
|
|
1976
|
+
const output = new ParsedQuery(), orderByIndex = query.toUpperCase().indexOf(" ORDER BY ");
|
|
1977
|
+
return orderByIndex < 0 ? output.where = query.trim() : (output.where = query.substring(0, orderByIndex).trim(), output.order = query.substring(orderByIndex + 10).trim()), output.where == "" && (output.where = null), output;
|
|
1978
1978
|
}
|
|
1979
|
-
function
|
|
1980
|
-
const
|
|
1979
|
+
function identifyTags(query, parsedQuery) {
|
|
1980
|
+
const regexes = [
|
|
1981
1981
|
/(#+\??~?|~)([\w\d]+\.)?([\w\d]+)/,
|
|
1982
1982
|
//Single word tags and space names
|
|
1983
1983
|
/(#+\??~?|~)\[([\w\d\s]+\.)?([\w\d\s]+)\]/
|
|
1984
1984
|
//Multi-word tags and space names wrapped in []
|
|
1985
1985
|
];
|
|
1986
|
-
for (const
|
|
1986
|
+
for (const regex of regexes)
|
|
1987
1987
|
for (; ; ) {
|
|
1988
|
-
const
|
|
1989
|
-
if (!
|
|
1988
|
+
const match = regex.exec(query);
|
|
1989
|
+
if (!match)
|
|
1990
1990
|
break;
|
|
1991
|
-
const
|
|
1992
|
-
|
|
1993
|
-
const
|
|
1994
|
-
|
|
1991
|
+
const hashPrefix = match[1], parsedTag = new ParsedTag();
|
|
1992
|
+
parsedTag.space = match[2] ? match[2].substring(0, match[2].length - 1) : null, parsedTag.name = match[3], parsedTag.includeOwner = hashPrefix.includes("~"), parsedTag.searchDepth = (hashPrefix.match(/#/g) || []).length, parsedTag.strictSearchDepth = !hashPrefix.includes("?");
|
|
1993
|
+
const fullMatch = match[0], matchStart = query.indexOf(fullMatch), matchEnd = matchStart + fullMatch.length;
|
|
1994
|
+
query = query.substring(0, matchStart) + `{tag${parsedQuery.tags.length}}` + query.substring(matchEnd), parsedQuery.tags.push(parsedTag);
|
|
1995
1995
|
}
|
|
1996
|
-
return
|
|
1996
|
+
return query;
|
|
1997
1997
|
}
|
|
1998
|
-
function
|
|
1999
|
-
const
|
|
1998
|
+
function identifyAttrs(query, parsedQuery) {
|
|
1999
|
+
const regexes = [
|
|
2000
2000
|
/@([\w\d]+\.(?!Exists\(|On\())?([\w\d]+)/,
|
|
2001
2001
|
/@\[([\w\d\s]+\.)?([\w\d\s]+)\]/
|
|
2002
2002
|
];
|
|
2003
|
-
for (const
|
|
2003
|
+
for (const regex of regexes)
|
|
2004
2004
|
for (; ; ) {
|
|
2005
|
-
const
|
|
2006
|
-
if (!
|
|
2005
|
+
const match = regex.exec(query);
|
|
2006
|
+
if (!match)
|
|
2007
2007
|
break;
|
|
2008
|
-
const
|
|
2009
|
-
|
|
2010
|
-
const
|
|
2011
|
-
let
|
|
2012
|
-
if (
|
|
2013
|
-
let
|
|
2014
|
-
if (
|
|
2008
|
+
const parsedAttr = new ParsedAttr();
|
|
2009
|
+
parsedAttr.space = match[1] ? match[1].substring(0, match[1].length - 1) : null, parsedAttr.name = match[2];
|
|
2010
|
+
const matchStart = query.indexOf(match[0]);
|
|
2011
|
+
let matchEnd = matchStart + match[0].length;
|
|
2012
|
+
if (query.substring(matchEnd, matchEnd + 9) == ".Exists()" && (parsedAttr.exists = !0, matchEnd += 9), query.substring(matchEnd, matchEnd + 4) == ".On(") {
|
|
2013
|
+
let tagFilterStart = matchEnd + 4;
|
|
2014
|
+
if (matchEnd = query.indexOf(")", tagFilterStart), matchEnd < 0)
|
|
2015
2015
|
throw Error("Unclosed bracket detected");
|
|
2016
|
-
let
|
|
2017
|
-
const
|
|
2018
|
-
for (let
|
|
2019
|
-
|
|
2020
|
-
|
|
2016
|
+
let tagNameFilters = query.substring(tagFilterStart, matchEnd).split("|");
|
|
2017
|
+
const dummyParsedQuery = new ParsedQuery();
|
|
2018
|
+
for (let tagNameFilter of tagNameFilters)
|
|
2019
|
+
tagNameFilter.startsWith("~") || (tagNameFilter = "~" + tagNameFilter), identifyTags(tagNameFilter, dummyParsedQuery);
|
|
2020
|
+
parsedAttr.tagNameFilters = dummyParsedQuery.tags, matchEnd++;
|
|
2021
2021
|
}
|
|
2022
|
-
|
|
2022
|
+
query = query.substring(0, matchStart) + `{attr${parsedQuery.attrs.length}}` + query.substring(matchEnd), parsedQuery.attrs.push(parsedAttr);
|
|
2023
2023
|
}
|
|
2024
|
-
return
|
|
2024
|
+
return query;
|
|
2025
2025
|
}
|
|
2026
|
-
class
|
|
2027
|
-
constructor(
|
|
2026
|
+
class Space extends ModelWithState {
|
|
2027
|
+
constructor(name = "") {
|
|
2028
2028
|
super();
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
this._name =
|
|
2029
|
+
__publicField(this, "id", 0);
|
|
2030
|
+
__publicField(this, "_name", "");
|
|
2031
|
+
this._name = name;
|
|
2032
2032
|
}
|
|
2033
2033
|
get name() {
|
|
2034
2034
|
return this._name;
|
|
2035
2035
|
}
|
|
2036
|
-
set name(
|
|
2037
|
-
|
|
2036
|
+
set name(value) {
|
|
2037
|
+
value !== this._name && (this._name = value, this.isClean && this.dirty());
|
|
2038
2038
|
}
|
|
2039
2039
|
duplicate() {
|
|
2040
|
-
const
|
|
2041
|
-
return
|
|
2040
|
+
const output = new Space();
|
|
2041
|
+
return output.id = this.id, output.name = this.name, output.state = this.state, output;
|
|
2042
2042
|
}
|
|
2043
|
-
validate(
|
|
2044
|
-
let
|
|
2045
|
-
if (!this.isNew && this.id <= 0 && (
|
|
2046
|
-
throw Error(
|
|
2047
|
-
return
|
|
2043
|
+
validate(throwError = !1) {
|
|
2044
|
+
let output = null;
|
|
2045
|
+
if (!this.isNew && this.id <= 0 && (output = "Space id must be greater than zero if in non-new state."), throwError && output != null)
|
|
2046
|
+
throw Error(output);
|
|
2047
|
+
return output == null;
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
2050
|
export {
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2051
|
+
Attr,
|
|
2052
|
+
Environment,
|
|
2053
|
+
HttpClient,
|
|
2054
|
+
Note,
|
|
2055
|
+
NoteAttr,
|
|
2056
|
+
NoteTag,
|
|
2057
|
+
Space,
|
|
2058
|
+
Tag,
|
|
2059
|
+
parseQuery
|
|
2060
2060
|
};
|