@thescaffold/jsx-core 0.2.21 → 0.2.30
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/jsx-core.cjs.development.js +323 -517
- package/jsx-core.cjs.development.js.map +1 -1
- package/jsx-core.cjs.production.min.js +1 -1
- package/jsx-core.cjs.production.min.js.map +1 -1
- package/jsx-core.esm.js +324 -518
- package/jsx-core.esm.js.map +1 -1
- package/package.json +3 -2
- package/storage/session.storage.d.ts +1 -1
- package/store/file.store.d.ts +3 -2
- package/store/store.d.ts +4 -0
|
@@ -48,306 +48,113 @@ function _extends() {
|
|
|
48
48
|
return n;
|
|
49
49
|
}, _extends.apply(null, arguments);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return o(a, "_invoke", {
|
|
86
|
-
value: makeInvokeMethod(t, r, c)
|
|
87
|
-
}), a;
|
|
88
|
-
}
|
|
89
|
-
function tryCatch(t, e, r) {
|
|
90
|
-
try {
|
|
91
|
-
return {
|
|
92
|
-
type: "normal",
|
|
93
|
-
arg: t.call(e, r)
|
|
94
|
-
};
|
|
95
|
-
} catch (t) {
|
|
96
|
-
return {
|
|
97
|
-
type: "throw",
|
|
98
|
-
arg: t
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
e.wrap = wrap;
|
|
103
|
-
var h = "suspendedStart",
|
|
104
|
-
l = "suspendedYield",
|
|
105
|
-
f = "executing",
|
|
106
|
-
s = "completed",
|
|
107
|
-
y = {};
|
|
108
|
-
function Generator() {}
|
|
109
|
-
function GeneratorFunction() {}
|
|
110
|
-
function GeneratorFunctionPrototype() {}
|
|
111
|
-
var p = {};
|
|
112
|
-
define(p, a, function () {
|
|
113
|
-
return this;
|
|
114
|
-
});
|
|
115
|
-
var d = Object.getPrototypeOf,
|
|
116
|
-
v = d && d(d(values([])));
|
|
117
|
-
v && v !== r && n.call(v, a) && (p = v);
|
|
118
|
-
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
119
|
-
function defineIteratorMethods(t) {
|
|
120
|
-
["next", "throw", "return"].forEach(function (e) {
|
|
121
|
-
define(t, e, function (t) {
|
|
122
|
-
return this._invoke(e, t);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function AsyncIterator(t, e) {
|
|
127
|
-
function invoke(r, o, i, a) {
|
|
128
|
-
var c = tryCatch(t[r], t, o);
|
|
129
|
-
if ("throw" !== c.type) {
|
|
130
|
-
var u = c.arg,
|
|
131
|
-
h = u.value;
|
|
132
|
-
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
133
|
-
invoke("next", t, i, a);
|
|
134
|
-
}, function (t) {
|
|
135
|
-
invoke("throw", t, i, a);
|
|
136
|
-
}) : e.resolve(h).then(function (t) {
|
|
137
|
-
u.value = t, i(u);
|
|
138
|
-
}, function (t) {
|
|
139
|
-
return invoke("throw", t, i, a);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
a(c.arg);
|
|
143
|
-
}
|
|
144
|
-
var r;
|
|
145
|
-
o(this, "_invoke", {
|
|
146
|
-
value: function (t, n) {
|
|
147
|
-
function callInvokeWithMethodAndArg() {
|
|
148
|
-
return new e(function (e, r) {
|
|
149
|
-
invoke(t, n, e, r);
|
|
150
|
-
});
|
|
51
|
+
function _regenerator() {
|
|
52
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
53
|
+
var e,
|
|
54
|
+
t,
|
|
55
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
56
|
+
n = r.iterator || "@@iterator",
|
|
57
|
+
o = r.toStringTag || "@@toStringTag";
|
|
58
|
+
function i(r, n, o, i) {
|
|
59
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
60
|
+
u = Object.create(c.prototype);
|
|
61
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
62
|
+
var i,
|
|
63
|
+
c,
|
|
64
|
+
u,
|
|
65
|
+
f = 0,
|
|
66
|
+
p = o || [],
|
|
67
|
+
y = !1,
|
|
68
|
+
G = {
|
|
69
|
+
p: 0,
|
|
70
|
+
n: 0,
|
|
71
|
+
v: e,
|
|
72
|
+
a: d,
|
|
73
|
+
f: d.bind(e, 4),
|
|
74
|
+
d: function (t, r) {
|
|
75
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
function d(r, n) {
|
|
79
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
80
|
+
var o,
|
|
81
|
+
i = p[t],
|
|
82
|
+
d = G.p,
|
|
83
|
+
l = i[2];
|
|
84
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
151
85
|
}
|
|
152
|
-
|
|
86
|
+
if (o || r > 1) return a;
|
|
87
|
+
throw y = !0, n;
|
|
153
88
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
89
|
+
return function (o, p, l) {
|
|
90
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
91
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
92
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
93
|
+
try {
|
|
94
|
+
if (f = 2, i) {
|
|
95
|
+
if (c || (o = "next"), t = i[o]) {
|
|
96
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
97
|
+
if (!t.done) return t;
|
|
98
|
+
u = t.value, c < 2 && (c = 0);
|
|
99
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
100
|
+
i = e;
|
|
101
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
102
|
+
} catch (t) {
|
|
103
|
+
i = e, c = 1, u = t;
|
|
104
|
+
} finally {
|
|
105
|
+
f = 1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
162
108
|
return {
|
|
163
109
|
value: t,
|
|
164
|
-
done:
|
|
110
|
+
done: y
|
|
165
111
|
};
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
var c = n.delegate;
|
|
169
|
-
if (c) {
|
|
170
|
-
var u = maybeInvokeDelegate(c, n);
|
|
171
|
-
if (u) {
|
|
172
|
-
if (u === y) continue;
|
|
173
|
-
return u;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
177
|
-
if (o === h) throw o = s, n.arg;
|
|
178
|
-
n.dispatchException(n.arg);
|
|
179
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
180
|
-
o = f;
|
|
181
|
-
var p = tryCatch(e, r, n);
|
|
182
|
-
if ("normal" === p.type) {
|
|
183
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
184
|
-
return {
|
|
185
|
-
value: p.arg,
|
|
186
|
-
done: n.done
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
function maybeInvokeDelegate(e, r) {
|
|
194
|
-
var n = r.method,
|
|
195
|
-
o = e.iterator[n];
|
|
196
|
-
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
197
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
198
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
199
|
-
var a = i.arg;
|
|
200
|
-
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
201
|
-
}
|
|
202
|
-
function pushTryEntry(t) {
|
|
203
|
-
var e = {
|
|
204
|
-
tryLoc: t[0]
|
|
205
|
-
};
|
|
206
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
207
|
-
}
|
|
208
|
-
function resetTryEntry(t) {
|
|
209
|
-
var e = t.completion || {};
|
|
210
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
211
|
-
}
|
|
212
|
-
function Context(t) {
|
|
213
|
-
this.tryEntries = [{
|
|
214
|
-
tryLoc: "root"
|
|
215
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
112
|
+
};
|
|
113
|
+
}(r, o, i), !0), u;
|
|
216
114
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return i.next = i;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
115
|
+
var a = {};
|
|
116
|
+
function Generator() {}
|
|
117
|
+
function GeneratorFunction() {}
|
|
118
|
+
function GeneratorFunctionPrototype() {}
|
|
119
|
+
t = Object.getPrototypeOf;
|
|
120
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
121
|
+
return this;
|
|
122
|
+
}), t),
|
|
123
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
124
|
+
function f(e) {
|
|
125
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
232
126
|
}
|
|
233
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype,
|
|
234
|
-
value: GeneratorFunctionPrototype,
|
|
235
|
-
configurable: !0
|
|
236
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
237
|
-
value: GeneratorFunction,
|
|
238
|
-
configurable: !0
|
|
239
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
240
|
-
var e = "function" == typeof t && t.constructor;
|
|
241
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
242
|
-
}, e.mark = function (t) {
|
|
243
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
244
|
-
}, e.awrap = function (t) {
|
|
245
|
-
return {
|
|
246
|
-
__await: t
|
|
247
|
-
};
|
|
248
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
249
|
-
return this;
|
|
250
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
251
|
-
void 0 === i && (i = Promise);
|
|
252
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
253
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
254
|
-
return t.done ? t.value : a.next();
|
|
255
|
-
});
|
|
256
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
127
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
257
128
|
return this;
|
|
258
|
-
}),
|
|
129
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
259
130
|
return "[object Generator]";
|
|
260
|
-
}),
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
return r.reverse(), function next() {
|
|
265
|
-
for (; r.length;) {
|
|
266
|
-
var t = r.pop();
|
|
267
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
268
|
-
}
|
|
269
|
-
return next.done = !0, next;
|
|
131
|
+
}), (_regenerator = function () {
|
|
132
|
+
return {
|
|
133
|
+
w: i,
|
|
134
|
+
m: f
|
|
270
135
|
};
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
function handle(n, o) {
|
|
286
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
287
|
-
}
|
|
288
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
289
|
-
var i = this.tryEntries[o],
|
|
290
|
-
a = i.completion;
|
|
291
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
292
|
-
if (i.tryLoc <= this.prev) {
|
|
293
|
-
var c = n.call(i, "catchLoc"),
|
|
294
|
-
u = n.call(i, "finallyLoc");
|
|
295
|
-
if (c && u) {
|
|
296
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
297
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
298
|
-
} else if (c) {
|
|
299
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
300
|
-
} else {
|
|
301
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
302
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
abrupt: function (t, e) {
|
|
308
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
309
|
-
var o = this.tryEntries[r];
|
|
310
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
311
|
-
var i = o;
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
316
|
-
var a = i ? i.completion : {};
|
|
317
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
318
|
-
},
|
|
319
|
-
complete: function (t, e) {
|
|
320
|
-
if ("throw" === t.type) throw t.arg;
|
|
321
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
322
|
-
},
|
|
323
|
-
finish: function (t) {
|
|
324
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
325
|
-
var r = this.tryEntries[e];
|
|
326
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
catch: function (t) {
|
|
330
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
331
|
-
var r = this.tryEntries[e];
|
|
332
|
-
if (r.tryLoc === t) {
|
|
333
|
-
var n = r.completion;
|
|
334
|
-
if ("throw" === n.type) {
|
|
335
|
-
var o = n.arg;
|
|
336
|
-
resetTryEntry(r);
|
|
337
|
-
}
|
|
338
|
-
return o;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
throw Error("illegal catch attempt");
|
|
342
|
-
},
|
|
343
|
-
delegateYield: function (e, r, n) {
|
|
344
|
-
return this.delegate = {
|
|
345
|
-
iterator: values(e),
|
|
346
|
-
resultName: r,
|
|
347
|
-
nextLoc: n
|
|
348
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
136
|
+
})();
|
|
137
|
+
}
|
|
138
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
139
|
+
var i = Object.defineProperty;
|
|
140
|
+
try {
|
|
141
|
+
i({}, "", {});
|
|
142
|
+
} catch (e) {
|
|
143
|
+
i = 0;
|
|
144
|
+
}
|
|
145
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
146
|
+
function o(r, n) {
|
|
147
|
+
_regeneratorDefine(e, r, function (e) {
|
|
148
|
+
return this._invoke(r, n, e);
|
|
149
|
+
});
|
|
349
150
|
}
|
|
350
|
-
|
|
151
|
+
r ? i ? i(e, r, {
|
|
152
|
+
value: n,
|
|
153
|
+
enumerable: !t,
|
|
154
|
+
configurable: !t,
|
|
155
|
+
writable: !t
|
|
156
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
157
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
351
158
|
}
|
|
352
159
|
|
|
353
160
|
var axios = /*#__PURE__*/require('axios');
|
|
@@ -370,12 +177,12 @@ var RequestService = /*#__PURE__*/function () {
|
|
|
370
177
|
};
|
|
371
178
|
var _proto = RequestService.prototype;
|
|
372
179
|
_proto.request = /*#__PURE__*/function () {
|
|
373
|
-
var _request = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
374
|
-
var _response$data$title, _response$data, _response$data$messag, _response$data2, _response$data$data, _response$data3, _request2, response, _response$data$title2, _response$data4, _response$data$messag2, _response$data5, _response$data$data2, _response$data6, _response;
|
|
375
|
-
return
|
|
376
|
-
while (1) switch (_context.
|
|
180
|
+
var _request = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(method, url, body, queries, headers) {
|
|
181
|
+
var _response$data$title, _response$data, _response$data$messag, _response$data2, _response$data$data, _response$data3, _request2, response, _response$data$title2, _response$data4, _response$data$messag2, _response$data5, _response$data$data2, _response$data6, _response, _t;
|
|
182
|
+
return _regenerator().w(function (_context) {
|
|
183
|
+
while (1) switch (_context.p = _context.n) {
|
|
377
184
|
case 0:
|
|
378
|
-
_context.
|
|
185
|
+
_context.p = 0;
|
|
379
186
|
_request2 = {
|
|
380
187
|
method: method,
|
|
381
188
|
url: url,
|
|
@@ -385,39 +192,38 @@ var RequestService = /*#__PURE__*/function () {
|
|
|
385
192
|
data: body,
|
|
386
193
|
params: queries
|
|
387
194
|
};
|
|
388
|
-
_context.
|
|
195
|
+
_context.n = 1;
|
|
389
196
|
return this.http.request(_request2, {
|
|
390
197
|
validateStatus: function validateStatus(status) {
|
|
391
198
|
return !(response.status < 200 || response.status > 299);
|
|
392
199
|
}
|
|
393
200
|
});
|
|
394
|
-
case
|
|
395
|
-
response = _context.
|
|
396
|
-
return _context.
|
|
397
|
-
case
|
|
398
|
-
_context.
|
|
399
|
-
|
|
400
|
-
if (!
|
|
401
|
-
_context.
|
|
201
|
+
case 1:
|
|
202
|
+
response = _context.v;
|
|
203
|
+
return _context.a(2, [true, response.status, (_response$data$title = (_response$data = response.data) == null ? void 0 : _response$data.title) != null ? _response$data$title : response.statusText, (_response$data$messag = (_response$data2 = response.data) == null ? void 0 : _response$data2.message) != null ? _response$data$messag : response.status + " - " + response.statusText, (_response$data$data = (_response$data3 = response.data) == null ? void 0 : _response$data3.data) != null ? _response$data$data : response.data]);
|
|
204
|
+
case 2:
|
|
205
|
+
_context.p = 2;
|
|
206
|
+
_t = _context.v;
|
|
207
|
+
if (!_t.response) {
|
|
208
|
+
_context.n = 3;
|
|
402
209
|
break;
|
|
403
210
|
}
|
|
404
211
|
// The request was made and the server responded with a status code
|
|
405
212
|
// that falls out of the range of 2xx
|
|
406
|
-
_response =
|
|
407
|
-
return _context.
|
|
408
|
-
case
|
|
409
|
-
if (!
|
|
410
|
-
_context.
|
|
213
|
+
_response = _t.response;
|
|
214
|
+
return _context.a(2, [false, _response.status, (_response$data$title2 = (_response$data4 = _response.data) == null ? void 0 : _response$data4.title) != null ? _response$data$title2 : _response.statusText, (_response$data$messag2 = (_response$data5 = _response.data) == null ? void 0 : _response$data5.message) != null ? _response$data$messag2 : _response.status + " - " + _response.statusText, (_response$data$data2 = (_response$data6 = _response.data) == null ? void 0 : _response$data6.data) != null ? _response$data$data2 : _response.data]);
|
|
215
|
+
case 3:
|
|
216
|
+
if (!_t.request) {
|
|
217
|
+
_context.n = 4;
|
|
411
218
|
break;
|
|
412
219
|
}
|
|
413
|
-
return _context.
|
|
414
|
-
case
|
|
415
|
-
return _context.
|
|
416
|
-
case
|
|
417
|
-
|
|
418
|
-
return _context.stop();
|
|
220
|
+
return _context.a(2, [false, 503, 'Service is Down', 'Unable to get any response from the ', _t]);
|
|
221
|
+
case 4:
|
|
222
|
+
return _context.a(2, [false, 403, 'Service is Down', 'Could not make the request, check and try again.', _t]);
|
|
223
|
+
case 5:
|
|
224
|
+
return _context.a(2);
|
|
419
225
|
}
|
|
420
|
-
}, _callee, this, [[0,
|
|
226
|
+
}, _callee, this, [[0, 2]]);
|
|
421
227
|
}));
|
|
422
228
|
function request(_x, _x2, _x3, _x4, _x5) {
|
|
423
229
|
return _request.apply(this, arguments);
|
|
@@ -425,34 +231,31 @@ var RequestService = /*#__PURE__*/function () {
|
|
|
425
231
|
return request;
|
|
426
232
|
}();
|
|
427
233
|
_proto.requestWithError = /*#__PURE__*/function () {
|
|
428
|
-
var _requestWithError = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
234
|
+
var _requestWithError = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(method, url, body, queries, headers) {
|
|
429
235
|
var _yield$this$request, status, httpStatus, title, message, response, _response$message;
|
|
430
|
-
return
|
|
431
|
-
while (1) switch (_context2.
|
|
236
|
+
return _regenerator().w(function (_context2) {
|
|
237
|
+
while (1) switch (_context2.n) {
|
|
432
238
|
case 0:
|
|
433
|
-
_context2.
|
|
239
|
+
_context2.n = 1;
|
|
434
240
|
return this.request(method, url, body, queries, headers);
|
|
435
|
-
case
|
|
436
|
-
_yield$this$request = _context2.
|
|
241
|
+
case 1:
|
|
242
|
+
_yield$this$request = _context2.v;
|
|
437
243
|
status = _yield$this$request[0];
|
|
438
244
|
httpStatus = _yield$this$request[1];
|
|
439
245
|
title = _yield$this$request[2];
|
|
440
246
|
message = _yield$this$request[3];
|
|
441
247
|
response = _yield$this$request[4];
|
|
442
248
|
if (!(status !== true)) {
|
|
443
|
-
_context2.
|
|
249
|
+
_context2.n = 2;
|
|
444
250
|
break;
|
|
445
251
|
}
|
|
446
252
|
throw new Error(httpStatus + ": " + title + " " + ((_response$message = response == null ? void 0 : response.message) != null ? _response$message : message));
|
|
447
|
-
case
|
|
448
|
-
return _context2.
|
|
449
|
-
case 11:
|
|
450
|
-
case "end":
|
|
451
|
-
return _context2.stop();
|
|
253
|
+
case 2:
|
|
254
|
+
return _context2.a(2, response);
|
|
452
255
|
}
|
|
453
256
|
}, _callee2, this);
|
|
454
257
|
}));
|
|
455
|
-
function requestWithError(_x6, _x7, _x8, _x9,
|
|
258
|
+
function requestWithError(_x6, _x7, _x8, _x9, _x0) {
|
|
456
259
|
return _requestWithError.apply(this, arguments);
|
|
457
260
|
}
|
|
458
261
|
return requestWithError;
|
|
@@ -509,34 +312,54 @@ var requestService = function requestService(interceptors) {
|
|
|
509
312
|
return RequestService.singleton(interceptors);
|
|
510
313
|
};
|
|
511
314
|
|
|
315
|
+
exports.StoreType = void 0;
|
|
316
|
+
(function (StoreType) {
|
|
317
|
+
StoreType["File"] = "file";
|
|
318
|
+
StoreType["Memory"] = "memory";
|
|
319
|
+
})(exports.StoreType || (exports.StoreType = {}));
|
|
320
|
+
exports.StoreFileType = void 0;
|
|
321
|
+
(function (StoreFileType) {
|
|
322
|
+
StoreFileType["JSON"] = "json";
|
|
323
|
+
StoreFileType["YAML"] = "yaml";
|
|
324
|
+
})(exports.StoreFileType || (exports.StoreFileType = {}));
|
|
325
|
+
|
|
326
|
+
var YAML = /*#__PURE__*/require('js-yaml');
|
|
512
327
|
var FileStore = /*#__PURE__*/function () {
|
|
513
|
-
function FileStore(path) {
|
|
328
|
+
function FileStore(path, type) {
|
|
329
|
+
if (type === void 0) {
|
|
330
|
+
type = exports.StoreFileType.JSON;
|
|
331
|
+
}
|
|
514
332
|
this.path = void 0;
|
|
333
|
+
this.type = exports.StoreFileType.JSON;
|
|
515
334
|
this.path = path;
|
|
335
|
+
this.type = type;
|
|
516
336
|
}
|
|
517
337
|
var _proto = FileStore.prototype;
|
|
518
338
|
_proto.save = /*#__PURE__*/function () {
|
|
519
|
-
var _save = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
520
|
-
var
|
|
521
|
-
return
|
|
522
|
-
while (1) switch (_context.
|
|
339
|
+
var _save = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(data) {
|
|
340
|
+
var fileData, _t;
|
|
341
|
+
return _regenerator().w(function (_context) {
|
|
342
|
+
while (1) switch (_context.p = _context.n) {
|
|
523
343
|
case 0:
|
|
524
|
-
_context.
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
344
|
+
_context.p = 0;
|
|
345
|
+
if (this.type === exports.StoreFileType.YAML) {
|
|
346
|
+
fileData = YAML.dump(data);
|
|
347
|
+
} else {
|
|
348
|
+
fileData = JSON.stringify(data, null, 2);
|
|
349
|
+
}
|
|
350
|
+
_context.n = 1;
|
|
351
|
+
return promises.writeFile(this.path, fileData, 'utf8');
|
|
352
|
+
case 1:
|
|
353
|
+
_context.n = 3;
|
|
530
354
|
break;
|
|
531
|
-
case
|
|
532
|
-
_context.
|
|
533
|
-
|
|
534
|
-
throw new Error("Failed to save data: " +
|
|
535
|
-
case
|
|
536
|
-
|
|
537
|
-
return _context.stop();
|
|
355
|
+
case 2:
|
|
356
|
+
_context.p = 2;
|
|
357
|
+
_t = _context.v;
|
|
358
|
+
throw new Error("Failed to save data: " + _t.message);
|
|
359
|
+
case 3:
|
|
360
|
+
return _context.a(2);
|
|
538
361
|
}
|
|
539
|
-
}, _callee, this, [[0,
|
|
362
|
+
}, _callee, this, [[0, 2]]);
|
|
540
363
|
}));
|
|
541
364
|
function save(_x) {
|
|
542
365
|
return _save.apply(this, arguments);
|
|
@@ -544,32 +367,40 @@ var FileStore = /*#__PURE__*/function () {
|
|
|
544
367
|
return save;
|
|
545
368
|
}();
|
|
546
369
|
_proto.retrieve = /*#__PURE__*/function () {
|
|
547
|
-
var _retrieve = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
548
|
-
var data;
|
|
549
|
-
return
|
|
550
|
-
while (1) switch (_context2.
|
|
370
|
+
var _retrieve = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
371
|
+
var data, _t2;
|
|
372
|
+
return _regenerator().w(function (_context2) {
|
|
373
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
551
374
|
case 0:
|
|
552
|
-
_context2.
|
|
553
|
-
_context2.
|
|
375
|
+
_context2.p = 0;
|
|
376
|
+
_context2.n = 1;
|
|
554
377
|
return promises.readFile(this.path, 'utf8');
|
|
378
|
+
case 1:
|
|
379
|
+
data = _context2.v;
|
|
380
|
+
if (!(this.type === exports.StoreFileType.YAML)) {
|
|
381
|
+
_context2.n = 2;
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
return _context2.a(2, YAML.load(data));
|
|
385
|
+
case 2:
|
|
386
|
+
return _context2.a(2, JSON.parse(data));
|
|
555
387
|
case 3:
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
case
|
|
559
|
-
_context2.
|
|
560
|
-
|
|
561
|
-
if (!(
|
|
562
|
-
_context2.
|
|
388
|
+
_context2.n = 6;
|
|
389
|
+
break;
|
|
390
|
+
case 4:
|
|
391
|
+
_context2.p = 4;
|
|
392
|
+
_t2 = _context2.v;
|
|
393
|
+
if (!(_t2.code === 'ENOENT')) {
|
|
394
|
+
_context2.n = 5;
|
|
563
395
|
break;
|
|
564
396
|
}
|
|
565
|
-
return _context2.
|
|
566
|
-
case
|
|
567
|
-
throw new Error("Failed to retrieve data: " +
|
|
568
|
-
case
|
|
569
|
-
|
|
570
|
-
return _context2.stop();
|
|
397
|
+
return _context2.a(2, null);
|
|
398
|
+
case 5:
|
|
399
|
+
throw new Error("Failed to retrieve data: " + _t2.message);
|
|
400
|
+
case 6:
|
|
401
|
+
return _context2.a(2);
|
|
571
402
|
}
|
|
572
|
-
}, _callee2, this, [[0,
|
|
403
|
+
}, _callee2, this, [[0, 4]]);
|
|
573
404
|
}));
|
|
574
405
|
function retrieve() {
|
|
575
406
|
return _retrieve.apply(this, arguments);
|
|
@@ -588,14 +419,13 @@ var MemoryStore = /*#__PURE__*/function () {
|
|
|
588
419
|
}
|
|
589
420
|
var _proto = MemoryStore.prototype;
|
|
590
421
|
_proto.save = /*#__PURE__*/function () {
|
|
591
|
-
var _save = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
592
|
-
return
|
|
593
|
-
while (1) switch (_context.
|
|
422
|
+
var _save = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(data) {
|
|
423
|
+
return _regenerator().w(function (_context) {
|
|
424
|
+
while (1) switch (_context.n) {
|
|
594
425
|
case 0:
|
|
595
426
|
this.storage[this.path] = data;
|
|
596
427
|
case 1:
|
|
597
|
-
|
|
598
|
-
return _context.stop();
|
|
428
|
+
return _context.a(2);
|
|
599
429
|
}
|
|
600
430
|
}, _callee, this);
|
|
601
431
|
}));
|
|
@@ -605,14 +435,11 @@ var MemoryStore = /*#__PURE__*/function () {
|
|
|
605
435
|
return save;
|
|
606
436
|
}();
|
|
607
437
|
_proto.retrieve = /*#__PURE__*/function () {
|
|
608
|
-
var _retrieve = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
609
|
-
return
|
|
610
|
-
while (1) switch (_context2.
|
|
438
|
+
var _retrieve = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
439
|
+
return _regenerator().w(function (_context2) {
|
|
440
|
+
while (1) switch (_context2.n) {
|
|
611
441
|
case 0:
|
|
612
|
-
return _context2.
|
|
613
|
-
case 1:
|
|
614
|
-
case "end":
|
|
615
|
-
return _context2.stop();
|
|
442
|
+
return _context2.a(2, this.storage[this.path]);
|
|
616
443
|
}
|
|
617
444
|
}, _callee2, this);
|
|
618
445
|
}));
|
|
@@ -624,12 +451,6 @@ var MemoryStore = /*#__PURE__*/function () {
|
|
|
624
451
|
return MemoryStore;
|
|
625
452
|
}();
|
|
626
453
|
|
|
627
|
-
exports.StoreType = void 0;
|
|
628
|
-
(function (StoreType) {
|
|
629
|
-
StoreType["File"] = "file";
|
|
630
|
-
StoreType["Memory"] = "memory";
|
|
631
|
-
})(exports.StoreType || (exports.StoreType = {}));
|
|
632
|
-
|
|
633
454
|
var LocalStorage = /*#__PURE__*/function () {
|
|
634
455
|
function LocalStorage(domain, path, storeType) {
|
|
635
456
|
if (storeType === void 0) {
|
|
@@ -643,6 +464,8 @@ var LocalStorage = /*#__PURE__*/function () {
|
|
|
643
464
|
this.store = new FileStore(path);
|
|
644
465
|
break;
|
|
645
466
|
case exports.StoreType.Memory:
|
|
467
|
+
this.store = new MemoryStore(path);
|
|
468
|
+
break;
|
|
646
469
|
default:
|
|
647
470
|
this.store = new MemoryStore(path);
|
|
648
471
|
break;
|
|
@@ -650,24 +473,22 @@ var LocalStorage = /*#__PURE__*/function () {
|
|
|
650
473
|
}
|
|
651
474
|
var _proto = LocalStorage.prototype;
|
|
652
475
|
_proto.getStorage = /*#__PURE__*/function () {
|
|
653
|
-
var _getStorage = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
654
|
-
|
|
655
|
-
|
|
476
|
+
var _getStorage = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
477
|
+
var _t;
|
|
478
|
+
return _regenerator().w(function (_context) {
|
|
479
|
+
while (1) switch (_context.n) {
|
|
656
480
|
case 0:
|
|
657
|
-
_context.
|
|
481
|
+
_context.n = 1;
|
|
658
482
|
return this.store.retrieve();
|
|
659
|
-
case
|
|
660
|
-
|
|
661
|
-
if (
|
|
662
|
-
_context.
|
|
483
|
+
case 1:
|
|
484
|
+
_t = _context.v;
|
|
485
|
+
if (_t) {
|
|
486
|
+
_context.n = 2;
|
|
663
487
|
break;
|
|
664
488
|
}
|
|
665
|
-
|
|
666
|
-
case
|
|
667
|
-
return _context.
|
|
668
|
-
case 6:
|
|
669
|
-
case "end":
|
|
670
|
-
return _context.stop();
|
|
489
|
+
_t = {};
|
|
490
|
+
case 2:
|
|
491
|
+
return _context.a(2, _t);
|
|
671
492
|
}
|
|
672
493
|
}, _callee, this);
|
|
673
494
|
}));
|
|
@@ -677,24 +498,23 @@ var LocalStorage = /*#__PURE__*/function () {
|
|
|
677
498
|
return getStorage;
|
|
678
499
|
}();
|
|
679
500
|
_proto.setItem = /*#__PURE__*/function () {
|
|
680
|
-
var _setItem = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
501
|
+
var _setItem = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(key, value) {
|
|
681
502
|
var storage;
|
|
682
|
-
return
|
|
683
|
-
while (1) switch (_context2.
|
|
503
|
+
return _regenerator().w(function (_context2) {
|
|
504
|
+
while (1) switch (_context2.n) {
|
|
684
505
|
case 0:
|
|
685
|
-
_context2.
|
|
506
|
+
_context2.n = 1;
|
|
686
507
|
return this.getStorage();
|
|
687
|
-
case
|
|
688
|
-
storage = _context2.
|
|
508
|
+
case 1:
|
|
509
|
+
storage = _context2.v;
|
|
689
510
|
if (!storage[this.domain]) {
|
|
690
511
|
storage[this.domain] = {};
|
|
691
512
|
}
|
|
692
513
|
storage[this.domain][key] = value;
|
|
693
|
-
_context2.
|
|
514
|
+
_context2.n = 2;
|
|
694
515
|
return this.store.save(storage);
|
|
695
|
-
case
|
|
696
|
-
|
|
697
|
-
return _context2.stop();
|
|
516
|
+
case 2:
|
|
517
|
+
return _context2.a(2);
|
|
698
518
|
}
|
|
699
519
|
}, _callee2, this);
|
|
700
520
|
}));
|
|
@@ -704,20 +524,17 @@ var LocalStorage = /*#__PURE__*/function () {
|
|
|
704
524
|
return setItem;
|
|
705
525
|
}();
|
|
706
526
|
_proto.getItem = /*#__PURE__*/function () {
|
|
707
|
-
var _getItem = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
527
|
+
var _getItem = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(key) {
|
|
708
528
|
var _storage$this$domain;
|
|
709
529
|
var storage;
|
|
710
|
-
return
|
|
711
|
-
while (1) switch (_context3.
|
|
530
|
+
return _regenerator().w(function (_context3) {
|
|
531
|
+
while (1) switch (_context3.n) {
|
|
712
532
|
case 0:
|
|
713
|
-
_context3.
|
|
533
|
+
_context3.n = 1;
|
|
714
534
|
return this.getStorage();
|
|
715
|
-
case
|
|
716
|
-
storage = _context3.
|
|
717
|
-
return _context3.
|
|
718
|
-
case 4:
|
|
719
|
-
case "end":
|
|
720
|
-
return _context3.stop();
|
|
535
|
+
case 1:
|
|
536
|
+
storage = _context3.v;
|
|
537
|
+
return _context3.a(2, ((_storage$this$domain = storage[this.domain]) == null ? void 0 : _storage$this$domain[key]) || null);
|
|
721
538
|
}
|
|
722
539
|
}, _callee3, this);
|
|
723
540
|
}));
|
|
@@ -727,19 +544,16 @@ var LocalStorage = /*#__PURE__*/function () {
|
|
|
727
544
|
return getItem;
|
|
728
545
|
}();
|
|
729
546
|
_proto.getAll = /*#__PURE__*/function () {
|
|
730
|
-
var _getAll = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
547
|
+
var _getAll = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
731
548
|
var storage;
|
|
732
|
-
return
|
|
733
|
-
while (1) switch (_context4.
|
|
549
|
+
return _regenerator().w(function (_context4) {
|
|
550
|
+
while (1) switch (_context4.n) {
|
|
734
551
|
case 0:
|
|
735
|
-
_context4.
|
|
552
|
+
_context4.n = 1;
|
|
736
553
|
return this.getStorage();
|
|
737
|
-
case
|
|
738
|
-
storage = _context4.
|
|
739
|
-
return _context4.
|
|
740
|
-
case 4:
|
|
741
|
-
case "end":
|
|
742
|
-
return _context4.stop();
|
|
554
|
+
case 1:
|
|
555
|
+
storage = _context4.v;
|
|
556
|
+
return _context4.a(2, storage[this.domain]);
|
|
743
557
|
}
|
|
744
558
|
}, _callee4, this);
|
|
745
559
|
}));
|
|
@@ -749,25 +563,24 @@ var LocalStorage = /*#__PURE__*/function () {
|
|
|
749
563
|
return getAll;
|
|
750
564
|
}();
|
|
751
565
|
_proto.removeItem = /*#__PURE__*/function () {
|
|
752
|
-
var _removeItem = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
566
|
+
var _removeItem = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(key) {
|
|
753
567
|
var storage;
|
|
754
|
-
return
|
|
755
|
-
while (1) switch (_context5.
|
|
568
|
+
return _regenerator().w(function (_context5) {
|
|
569
|
+
while (1) switch (_context5.n) {
|
|
756
570
|
case 0:
|
|
757
|
-
_context5.
|
|
571
|
+
_context5.n = 1;
|
|
758
572
|
return this.getStorage();
|
|
759
|
-
case
|
|
760
|
-
storage = _context5.
|
|
573
|
+
case 1:
|
|
574
|
+
storage = _context5.v;
|
|
761
575
|
if (!storage[this.domain]) {
|
|
762
|
-
_context5.
|
|
576
|
+
_context5.n = 2;
|
|
763
577
|
break;
|
|
764
578
|
}
|
|
765
579
|
delete storage[this.domain][key];
|
|
766
|
-
_context5.
|
|
580
|
+
_context5.n = 2;
|
|
767
581
|
return this.store.save(storage);
|
|
768
|
-
case
|
|
769
|
-
|
|
770
|
-
return _context5.stop();
|
|
582
|
+
case 2:
|
|
583
|
+
return _context5.a(2);
|
|
771
584
|
}
|
|
772
585
|
}, _callee5, this);
|
|
773
586
|
}));
|
|
@@ -777,25 +590,24 @@ var LocalStorage = /*#__PURE__*/function () {
|
|
|
777
590
|
return removeItem;
|
|
778
591
|
}();
|
|
779
592
|
_proto.clear = /*#__PURE__*/function () {
|
|
780
|
-
var _clear = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
593
|
+
var _clear = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
781
594
|
var storage;
|
|
782
|
-
return
|
|
783
|
-
while (1) switch (_context6.
|
|
595
|
+
return _regenerator().w(function (_context6) {
|
|
596
|
+
while (1) switch (_context6.n) {
|
|
784
597
|
case 0:
|
|
785
|
-
_context6.
|
|
598
|
+
_context6.n = 1;
|
|
786
599
|
return this.getStorage();
|
|
787
|
-
case
|
|
788
|
-
storage = _context6.
|
|
600
|
+
case 1:
|
|
601
|
+
storage = _context6.v;
|
|
789
602
|
if (!storage[this.domain]) {
|
|
790
|
-
_context6.
|
|
603
|
+
_context6.n = 2;
|
|
791
604
|
break;
|
|
792
605
|
}
|
|
793
606
|
delete storage[this.domain];
|
|
794
|
-
_context6.
|
|
607
|
+
_context6.n = 2;
|
|
795
608
|
return this.store.save(storage);
|
|
796
|
-
case
|
|
797
|
-
|
|
798
|
-
return _context6.stop();
|
|
609
|
+
case 2:
|
|
610
|
+
return _context6.a(2);
|
|
799
611
|
}
|
|
800
612
|
}, _callee6, this);
|
|
801
613
|
}));
|
|
@@ -809,6 +621,9 @@ var LocalStorage = /*#__PURE__*/function () {
|
|
|
809
621
|
|
|
810
622
|
var SessionStorage = /*#__PURE__*/function () {
|
|
811
623
|
function SessionStorage(domain, sessionId, path, storeType) {
|
|
624
|
+
if (storeType === void 0) {
|
|
625
|
+
storeType = exports.StoreType.Memory;
|
|
626
|
+
}
|
|
812
627
|
this.store = void 0;
|
|
813
628
|
this.domain = void 0;
|
|
814
629
|
this.sessionId = void 0;
|
|
@@ -819,6 +634,8 @@ var SessionStorage = /*#__PURE__*/function () {
|
|
|
819
634
|
this.store = new FileStore(path);
|
|
820
635
|
break;
|
|
821
636
|
case exports.StoreType.Memory:
|
|
637
|
+
this.store = new MemoryStore(path);
|
|
638
|
+
break;
|
|
822
639
|
default:
|
|
823
640
|
this.store = new MemoryStore(path);
|
|
824
641
|
break;
|
|
@@ -826,24 +643,22 @@ var SessionStorage = /*#__PURE__*/function () {
|
|
|
826
643
|
}
|
|
827
644
|
var _proto = SessionStorage.prototype;
|
|
828
645
|
_proto.getStorage = /*#__PURE__*/function () {
|
|
829
|
-
var _getStorage = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
830
|
-
|
|
831
|
-
|
|
646
|
+
var _getStorage = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
647
|
+
var _t;
|
|
648
|
+
return _regenerator().w(function (_context) {
|
|
649
|
+
while (1) switch (_context.n) {
|
|
832
650
|
case 0:
|
|
833
|
-
_context.
|
|
651
|
+
_context.n = 1;
|
|
834
652
|
return this.store.retrieve();
|
|
835
|
-
case
|
|
836
|
-
|
|
837
|
-
if (
|
|
838
|
-
_context.
|
|
653
|
+
case 1:
|
|
654
|
+
_t = _context.v;
|
|
655
|
+
if (_t) {
|
|
656
|
+
_context.n = 2;
|
|
839
657
|
break;
|
|
840
658
|
}
|
|
841
|
-
|
|
842
|
-
case
|
|
843
|
-
return _context.
|
|
844
|
-
case 6:
|
|
845
|
-
case "end":
|
|
846
|
-
return _context.stop();
|
|
659
|
+
_t = {};
|
|
660
|
+
case 2:
|
|
661
|
+
return _context.a(2, _t);
|
|
847
662
|
}
|
|
848
663
|
}, _callee, this);
|
|
849
664
|
}));
|
|
@@ -853,15 +668,15 @@ var SessionStorage = /*#__PURE__*/function () {
|
|
|
853
668
|
return getStorage;
|
|
854
669
|
}();
|
|
855
670
|
_proto.setItem = /*#__PURE__*/function () {
|
|
856
|
-
var _setItem = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
671
|
+
var _setItem = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(key, value) {
|
|
857
672
|
var storage;
|
|
858
|
-
return
|
|
859
|
-
while (1) switch (_context2.
|
|
673
|
+
return _regenerator().w(function (_context2) {
|
|
674
|
+
while (1) switch (_context2.n) {
|
|
860
675
|
case 0:
|
|
861
|
-
_context2.
|
|
676
|
+
_context2.n = 1;
|
|
862
677
|
return this.getStorage();
|
|
863
|
-
case
|
|
864
|
-
storage = _context2.
|
|
678
|
+
case 1:
|
|
679
|
+
storage = _context2.v;
|
|
865
680
|
if (!storage[this.domain]) {
|
|
866
681
|
storage[this.domain] = {};
|
|
867
682
|
}
|
|
@@ -869,11 +684,10 @@ var SessionStorage = /*#__PURE__*/function () {
|
|
|
869
684
|
storage[this.domain][this.sessionId] = {};
|
|
870
685
|
}
|
|
871
686
|
storage[this.domain][this.sessionId][key] = value;
|
|
872
|
-
_context2.
|
|
687
|
+
_context2.n = 2;
|
|
873
688
|
return this.store.save(storage);
|
|
874
|
-
case
|
|
875
|
-
|
|
876
|
-
return _context2.stop();
|
|
689
|
+
case 2:
|
|
690
|
+
return _context2.a(2);
|
|
877
691
|
}
|
|
878
692
|
}, _callee2, this);
|
|
879
693
|
}));
|
|
@@ -883,20 +697,17 @@ var SessionStorage = /*#__PURE__*/function () {
|
|
|
883
697
|
return setItem;
|
|
884
698
|
}();
|
|
885
699
|
_proto.getItem = /*#__PURE__*/function () {
|
|
886
|
-
var _getItem = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
700
|
+
var _getItem = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(key) {
|
|
887
701
|
var _storage$this$domain;
|
|
888
702
|
var storage;
|
|
889
|
-
return
|
|
890
|
-
while (1) switch (_context3.
|
|
703
|
+
return _regenerator().w(function (_context3) {
|
|
704
|
+
while (1) switch (_context3.n) {
|
|
891
705
|
case 0:
|
|
892
|
-
_context3.
|
|
706
|
+
_context3.n = 1;
|
|
893
707
|
return this.getStorage();
|
|
894
|
-
case
|
|
895
|
-
storage = _context3.
|
|
896
|
-
return _context3.
|
|
897
|
-
case 4:
|
|
898
|
-
case "end":
|
|
899
|
-
return _context3.stop();
|
|
708
|
+
case 1:
|
|
709
|
+
storage = _context3.v;
|
|
710
|
+
return _context3.a(2, ((_storage$this$domain = storage[this.domain]) == null || (_storage$this$domain = _storage$this$domain[this.sessionId]) == null ? void 0 : _storage$this$domain[key]) || null);
|
|
900
711
|
}
|
|
901
712
|
}, _callee3, this);
|
|
902
713
|
}));
|
|
@@ -906,20 +717,17 @@ var SessionStorage = /*#__PURE__*/function () {
|
|
|
906
717
|
return getItem;
|
|
907
718
|
}();
|
|
908
719
|
_proto.getAll = /*#__PURE__*/function () {
|
|
909
|
-
var _getAll = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
720
|
+
var _getAll = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
910
721
|
var _storage$this$domain2;
|
|
911
722
|
var storage;
|
|
912
|
-
return
|
|
913
|
-
while (1) switch (_context4.
|
|
723
|
+
return _regenerator().w(function (_context4) {
|
|
724
|
+
while (1) switch (_context4.n) {
|
|
914
725
|
case 0:
|
|
915
|
-
_context4.
|
|
726
|
+
_context4.n = 1;
|
|
916
727
|
return this.getStorage();
|
|
917
|
-
case
|
|
918
|
-
storage = _context4.
|
|
919
|
-
return _context4.
|
|
920
|
-
case 4:
|
|
921
|
-
case "end":
|
|
922
|
-
return _context4.stop();
|
|
728
|
+
case 1:
|
|
729
|
+
storage = _context4.v;
|
|
730
|
+
return _context4.a(2, ((_storage$this$domain2 = storage[this.domain]) == null ? void 0 : _storage$this$domain2[this.sessionId]) || null);
|
|
923
731
|
}
|
|
924
732
|
}, _callee4, this);
|
|
925
733
|
}));
|
|
@@ -929,26 +737,25 @@ var SessionStorage = /*#__PURE__*/function () {
|
|
|
929
737
|
return getAll;
|
|
930
738
|
}();
|
|
931
739
|
_proto.removeItem = /*#__PURE__*/function () {
|
|
932
|
-
var _removeItem = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
740
|
+
var _removeItem = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(key) {
|
|
933
741
|
var _storage$this$domain3;
|
|
934
742
|
var storage;
|
|
935
|
-
return
|
|
936
|
-
while (1) switch (_context5.
|
|
743
|
+
return _regenerator().w(function (_context5) {
|
|
744
|
+
while (1) switch (_context5.n) {
|
|
937
745
|
case 0:
|
|
938
|
-
_context5.
|
|
746
|
+
_context5.n = 1;
|
|
939
747
|
return this.getStorage();
|
|
940
|
-
case
|
|
941
|
-
storage = _context5.
|
|
748
|
+
case 1:
|
|
749
|
+
storage = _context5.v;
|
|
942
750
|
if (!((_storage$this$domain3 = storage[this.domain]) != null && _storage$this$domain3[this.sessionId])) {
|
|
943
|
-
_context5.
|
|
751
|
+
_context5.n = 2;
|
|
944
752
|
break;
|
|
945
753
|
}
|
|
946
754
|
delete storage[this.domain][this.sessionId][key];
|
|
947
|
-
_context5.
|
|
755
|
+
_context5.n = 2;
|
|
948
756
|
return this.store.save(storage);
|
|
949
|
-
case
|
|
950
|
-
|
|
951
|
-
return _context5.stop();
|
|
757
|
+
case 2:
|
|
758
|
+
return _context5.a(2);
|
|
952
759
|
}
|
|
953
760
|
}, _callee5, this);
|
|
954
761
|
}));
|
|
@@ -958,26 +765,25 @@ var SessionStorage = /*#__PURE__*/function () {
|
|
|
958
765
|
return removeItem;
|
|
959
766
|
}();
|
|
960
767
|
_proto.clear = /*#__PURE__*/function () {
|
|
961
|
-
var _clear = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
768
|
+
var _clear = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
962
769
|
var _storage$this$domain4;
|
|
963
770
|
var storage;
|
|
964
|
-
return
|
|
965
|
-
while (1) switch (_context6.
|
|
771
|
+
return _regenerator().w(function (_context6) {
|
|
772
|
+
while (1) switch (_context6.n) {
|
|
966
773
|
case 0:
|
|
967
|
-
_context6.
|
|
774
|
+
_context6.n = 1;
|
|
968
775
|
return this.getStorage();
|
|
969
|
-
case
|
|
970
|
-
storage = _context6.
|
|
776
|
+
case 1:
|
|
777
|
+
storage = _context6.v;
|
|
971
778
|
if (!((_storage$this$domain4 = storage[this.domain]) != null && _storage$this$domain4[this.sessionId])) {
|
|
972
|
-
_context6.
|
|
779
|
+
_context6.n = 2;
|
|
973
780
|
break;
|
|
974
781
|
}
|
|
975
782
|
delete storage[this.domain][this.sessionId];
|
|
976
|
-
_context6.
|
|
783
|
+
_context6.n = 2;
|
|
977
784
|
return this.store.save(storage);
|
|
978
|
-
case
|
|
979
|
-
|
|
980
|
-
return _context6.stop();
|
|
785
|
+
case 2:
|
|
786
|
+
return _context6.a(2);
|
|
981
787
|
}
|
|
982
788
|
}, _callee6, this);
|
|
983
789
|
}));
|