@dbg-riskit/common 12.3.0 → 13.0.3
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/dbg-riskit-common.d.ts +1 -0
- package/docs/README.md +1 -11
- package/{esm2015/dbg-riskit-common.js → esm2020/dbg-riskit-common.mjs} +0 -0
- package/{esm2015/lib/auth.types.js → esm2020/lib/auth.types.mjs} +0 -0
- package/{esm2015/lib/base64.js → esm2020/lib/base64.mjs} +5 -5
- package/esm2020/lib/common.functions.mjs +43 -0
- package/{esm2015/lib/common.types.js → esm2020/lib/common.types.mjs} +0 -0
- package/{esm2015/lib/date.utils.js → esm2020/lib/date.utils.mjs} +0 -0
- package/{esm2015/lib/error.types.js → esm2020/lib/error.types.mjs} +0 -0
- package/{esm2015/lib/file.types.js → esm2020/lib/file.types.mjs} +0 -0
- package/{esm2015/lib/global.js → esm2020/lib/global.mjs} +0 -0
- package/{esm2015/lib/indexeddb/indexed.db.array.subject.js → esm2020/lib/indexeddb/indexed.db.array.subject.mjs} +0 -0
- package/{esm2015/lib/indexeddb/indexed.db.store.js → esm2020/lib/indexeddb/indexed.db.store.mjs} +0 -0
- package/{esm2015/lib/indexeddb/indexed.db.subject.js → esm2020/lib/indexeddb/indexed.db.subject.mjs} +0 -0
- package/{esm2015/lib/indexeddb/polyfill.js → esm2020/lib/indexeddb/polyfill.mjs} +2 -2
- package/{esm2015/lib/indexeddb/request.wrappers.js → esm2020/lib/indexeddb/request.wrappers.mjs} +1 -1
- package/{esm2015/lib/indexeddb/subject.subscription.js → esm2020/lib/indexeddb/subject.subscription.mjs} +1 -1
- package/{esm2015/lib/logger.js → esm2020/lib/logger.mjs} +0 -0
- package/{esm2015/lib/random.js → esm2020/lib/random.mjs} +0 -0
- package/{esm2015/lib/replay.subject.ext.js → esm2020/lib/replay.subject.ext.mjs} +1 -1
- package/esm2020/lib/rxjs.utils.mjs +16 -0
- package/esm2020/lib/storage.mjs +84 -0
- package/{esm2015/lib/string.utils.js → esm2020/lib/string.utils.mjs} +0 -0
- package/{esm2015/lib/uid.utils.js → esm2020/lib/uid.utils.mjs} +0 -0
- package/{esm2015/lib/user.info.js → esm2020/lib/user.info.mjs} +0 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
- package/fesm2015/{dbg-riskit-common.js → dbg-riskit-common.mjs} +6 -8
- package/fesm2015/dbg-riskit-common.mjs.map +1 -0
- package/fesm2020/dbg-riskit-common.mjs +748 -0
- package/fesm2020/dbg-riskit-common.mjs.map +1 -0
- package/lib/indexeddb/polyfill.d.ts +1 -1
- package/package.json +20 -8
- package/bundles/dbg-riskit-common.umd.js +0 -1174
- package/bundles/dbg-riskit-common.umd.js.map +0 -1
- package/dbg-riskit-common.metadata.json +0 -1
- package/esm2015/lib/common.functions.js +0 -43
- package/esm2015/lib/rxjs.utils.js +0 -16
- package/esm2015/lib/storage.js +0 -86
- package/fesm2015/dbg-riskit-common.js.map +0 -1
|
@@ -1,1174 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs/operators'), require('rxjs')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@dbg-riskit/common', ['exports', 'rxjs/operators', 'rxjs'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["dbg-riskit"] = global["dbg-riskit"] || {}, global["dbg-riskit"].common = {}), global.rxjs.operators, global.rxjs));
|
|
5
|
-
})(this, (function (exports, operators, rxjs) { 'use strict';
|
|
6
|
-
|
|
7
|
-
var globalContainer = {};
|
|
8
|
-
if (typeof global !== 'undefined') {
|
|
9
|
-
globalContainer = global;
|
|
10
|
-
}
|
|
11
|
-
if (typeof window !== 'undefined') {
|
|
12
|
-
globalContainer = window;
|
|
13
|
-
}
|
|
14
|
-
var globalScope = globalContainer;
|
|
15
|
-
|
|
16
|
-
exports.AuthTokenType = void 0;
|
|
17
|
-
(function (AuthTokenType) {
|
|
18
|
-
AuthTokenType[AuthTokenType["NONE"] = 0] = "NONE";
|
|
19
|
-
AuthTokenType[AuthTokenType["API"] = 1] = "API";
|
|
20
|
-
AuthTokenType[AuthTokenType["AUTH"] = 2] = "AUTH";
|
|
21
|
-
})(exports.AuthTokenType || (exports.AuthTokenType = {}));
|
|
22
|
-
|
|
23
|
-
exports.ObservableEventType = void 0;
|
|
24
|
-
(function (ObservableEventType) {
|
|
25
|
-
/**
|
|
26
|
-
* A progress event was received.
|
|
27
|
-
*/
|
|
28
|
-
ObservableEventType[ObservableEventType["Progress"] = 0] = "Progress";
|
|
29
|
-
/**
|
|
30
|
-
* A result event was received.
|
|
31
|
-
*/
|
|
32
|
-
ObservableEventType[ObservableEventType["Result"] = 1] = "Result";
|
|
33
|
-
})(exports.ObservableEventType || (exports.ObservableEventType = {}));
|
|
34
|
-
function isEventObject(unknown) {
|
|
35
|
-
return (typeof unknown === 'object'
|
|
36
|
-
&& unknown != null
|
|
37
|
-
&& 'type' in unknown);
|
|
38
|
-
}
|
|
39
|
-
function extractResult() {
|
|
40
|
-
return function (observable) { return observable.pipe(operators.filter(function (event) { return event.type === exports.ObservableEventType.Result; }), operators.map(function (event) {
|
|
41
|
-
var resultEvent = event;
|
|
42
|
-
return resultEvent.result;
|
|
43
|
-
})); };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
var ErrorType = /** @class */ (function () {
|
|
47
|
-
function ErrorType() {
|
|
48
|
-
}
|
|
49
|
-
ErrorType.prototype.isError = function () {
|
|
50
|
-
return this === ErrorType.ERROR;
|
|
51
|
-
};
|
|
52
|
-
ErrorType.prototype.isNetworkError = function () {
|
|
53
|
-
return this === ErrorType.NETWORK;
|
|
54
|
-
};
|
|
55
|
-
ErrorType.prototype.isRequestError = function () {
|
|
56
|
-
return this === ErrorType.REQUEST;
|
|
57
|
-
};
|
|
58
|
-
ErrorType.prototype.isAuthError = function () {
|
|
59
|
-
return this === ErrorType.AUTH;
|
|
60
|
-
};
|
|
61
|
-
return ErrorType;
|
|
62
|
-
}());
|
|
63
|
-
ErrorType.NETWORK = new ErrorType();
|
|
64
|
-
ErrorType.REQUEST = new ErrorType();
|
|
65
|
-
ErrorType.AUTH = new ErrorType();
|
|
66
|
-
ErrorType.ERROR = new ErrorType();
|
|
67
|
-
|
|
68
|
-
var CONTENT_TYPE = {
|
|
69
|
-
APPLICATION_FORM: 'application/x-www-form-urlencoded',
|
|
70
|
-
APPLICATION_FORM_DATA: 'multipart/form-data',
|
|
71
|
-
APPLICATION_JSON: 'application/json',
|
|
72
|
-
TEXT_CSV: 'text/csv;charset=utf-8;',
|
|
73
|
-
TEXT_JAVASCRIPT: 'text/javascript',
|
|
74
|
-
TEXT_CSS: 'text/css',
|
|
75
|
-
TEXT_PLAIN: 'text/plain'
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
function toString(value) {
|
|
79
|
-
if (value == null) {
|
|
80
|
-
return '';
|
|
81
|
-
}
|
|
82
|
-
switch (typeof value) {
|
|
83
|
-
case 'string':
|
|
84
|
-
return value;
|
|
85
|
-
case 'boolean':
|
|
86
|
-
return value ? 'true' : 'false';
|
|
87
|
-
case 'number':
|
|
88
|
-
return value.toString(10);
|
|
89
|
-
case 'object':
|
|
90
|
-
return value.toString();
|
|
91
|
-
case 'bigint':
|
|
92
|
-
return value.toString();
|
|
93
|
-
case 'function':
|
|
94
|
-
return value.toString();
|
|
95
|
-
default:
|
|
96
|
-
return String(value);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
var DateUtils = /** @class */ (function () {
|
|
101
|
-
function DateUtils() {
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Converts UTC timestamp to Date object.
|
|
105
|
-
*
|
|
106
|
-
* @param utcTimestamp Value in milliseconds since midnight, January 1, 1970 UTC.
|
|
107
|
-
* @return Date object.
|
|
108
|
-
*/
|
|
109
|
-
DateUtils.utcTimestampToDate = function (utcTimestamp) {
|
|
110
|
-
var date = new Date(0);
|
|
111
|
-
date.setUTCMilliseconds(utcTimestamp);
|
|
112
|
-
return date;
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Converts Date object to UTC timestamp.
|
|
116
|
-
*
|
|
117
|
-
* @param date Date object.
|
|
118
|
-
* @return Value in milliseconds since midnight, January 1, 1970 UTC.
|
|
119
|
-
*/
|
|
120
|
-
DateUtils.toUTCTimestamp = function (date) {
|
|
121
|
-
return date.valueOf();
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Converts date represented as number in form yyyyMMdd to Date object.
|
|
125
|
-
*
|
|
126
|
-
* @param businessDate Date represented as number in form yyyyMMdd.
|
|
127
|
-
* @return Date object.
|
|
128
|
-
*/
|
|
129
|
-
DateUtils.parseBusinessDay = function (businessDate) {
|
|
130
|
-
var bdate = toString(businessDate);
|
|
131
|
-
var year = parseInt(bdate.substr(0, 4), 10);
|
|
132
|
-
var month = parseInt(bdate.substr(4, 2), 10);
|
|
133
|
-
var day = parseInt(bdate.substr(6, 2), 10);
|
|
134
|
-
return new Date(year, month - 1, day);
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Converts Date object to date represented as number in form yyyyMMdd.
|
|
138
|
-
*
|
|
139
|
-
* @param date Date object.
|
|
140
|
-
* @return Date represented as number in form yyyyMMdd.
|
|
141
|
-
*/
|
|
142
|
-
DateUtils.toBusinessDay = function (date) {
|
|
143
|
-
return date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate();
|
|
144
|
-
};
|
|
145
|
-
return DateUtils;
|
|
146
|
-
}());
|
|
147
|
-
|
|
148
|
-
/*! *****************************************************************************
|
|
149
|
-
Copyright (c) Microsoft Corporation.
|
|
150
|
-
|
|
151
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
152
|
-
purpose with or without fee is hereby granted.
|
|
153
|
-
|
|
154
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
155
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
156
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
157
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
158
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
159
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
160
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
161
|
-
***************************************************************************** */
|
|
162
|
-
/* global Reflect, Promise */
|
|
163
|
-
var extendStatics = function (d, b) {
|
|
164
|
-
extendStatics = Object.setPrototypeOf ||
|
|
165
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
166
|
-
function (d, b) { for (var p in b)
|
|
167
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
168
|
-
d[p] = b[p]; };
|
|
169
|
-
return extendStatics(d, b);
|
|
170
|
-
};
|
|
171
|
-
function __extends(d, b) {
|
|
172
|
-
if (typeof b !== "function" && b !== null)
|
|
173
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
174
|
-
extendStatics(d, b);
|
|
175
|
-
function __() { this.constructor = d; }
|
|
176
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
177
|
-
}
|
|
178
|
-
var __assign = function () {
|
|
179
|
-
__assign = Object.assign || function __assign(t) {
|
|
180
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
181
|
-
s = arguments[i];
|
|
182
|
-
for (var p in s)
|
|
183
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
184
|
-
t[p] = s[p];
|
|
185
|
-
}
|
|
186
|
-
return t;
|
|
187
|
-
};
|
|
188
|
-
return __assign.apply(this, arguments);
|
|
189
|
-
};
|
|
190
|
-
function __rest(s, e) {
|
|
191
|
-
var t = {};
|
|
192
|
-
for (var p in s)
|
|
193
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
194
|
-
t[p] = s[p];
|
|
195
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
196
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
197
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
198
|
-
t[p[i]] = s[p[i]];
|
|
199
|
-
}
|
|
200
|
-
return t;
|
|
201
|
-
}
|
|
202
|
-
function __decorate(decorators, target, key, desc) {
|
|
203
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
204
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
205
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
206
|
-
else
|
|
207
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
208
|
-
if (d = decorators[i])
|
|
209
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
210
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
211
|
-
}
|
|
212
|
-
function __param(paramIndex, decorator) {
|
|
213
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
214
|
-
}
|
|
215
|
-
function __metadata(metadataKey, metadataValue) {
|
|
216
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
217
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
218
|
-
}
|
|
219
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
220
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
221
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
222
|
-
function fulfilled(value) { try {
|
|
223
|
-
step(generator.next(value));
|
|
224
|
-
}
|
|
225
|
-
catch (e) {
|
|
226
|
-
reject(e);
|
|
227
|
-
} }
|
|
228
|
-
function rejected(value) { try {
|
|
229
|
-
step(generator["throw"](value));
|
|
230
|
-
}
|
|
231
|
-
catch (e) {
|
|
232
|
-
reject(e);
|
|
233
|
-
} }
|
|
234
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
235
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
function __generator(thisArg, body) {
|
|
239
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
240
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
241
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
242
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
243
|
-
function step(op) {
|
|
244
|
-
if (f)
|
|
245
|
-
throw new TypeError("Generator is already executing.");
|
|
246
|
-
while (_)
|
|
247
|
-
try {
|
|
248
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
249
|
-
return t;
|
|
250
|
-
if (y = 0, t)
|
|
251
|
-
op = [op[0] & 2, t.value];
|
|
252
|
-
switch (op[0]) {
|
|
253
|
-
case 0:
|
|
254
|
-
case 1:
|
|
255
|
-
t = op;
|
|
256
|
-
break;
|
|
257
|
-
case 4:
|
|
258
|
-
_.label++;
|
|
259
|
-
return { value: op[1], done: false };
|
|
260
|
-
case 5:
|
|
261
|
-
_.label++;
|
|
262
|
-
y = op[1];
|
|
263
|
-
op = [0];
|
|
264
|
-
continue;
|
|
265
|
-
case 7:
|
|
266
|
-
op = _.ops.pop();
|
|
267
|
-
_.trys.pop();
|
|
268
|
-
continue;
|
|
269
|
-
default:
|
|
270
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
271
|
-
_ = 0;
|
|
272
|
-
continue;
|
|
273
|
-
}
|
|
274
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
275
|
-
_.label = op[1];
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
278
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
279
|
-
_.label = t[1];
|
|
280
|
-
t = op;
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
if (t && _.label < t[2]) {
|
|
284
|
-
_.label = t[2];
|
|
285
|
-
_.ops.push(op);
|
|
286
|
-
break;
|
|
287
|
-
}
|
|
288
|
-
if (t[2])
|
|
289
|
-
_.ops.pop();
|
|
290
|
-
_.trys.pop();
|
|
291
|
-
continue;
|
|
292
|
-
}
|
|
293
|
-
op = body.call(thisArg, _);
|
|
294
|
-
}
|
|
295
|
-
catch (e) {
|
|
296
|
-
op = [6, e];
|
|
297
|
-
y = 0;
|
|
298
|
-
}
|
|
299
|
-
finally {
|
|
300
|
-
f = t = 0;
|
|
301
|
-
}
|
|
302
|
-
if (op[0] & 5)
|
|
303
|
-
throw op[1];
|
|
304
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
308
|
-
if (k2 === undefined)
|
|
309
|
-
k2 = k;
|
|
310
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
311
|
-
}) : (function (o, m, k, k2) {
|
|
312
|
-
if (k2 === undefined)
|
|
313
|
-
k2 = k;
|
|
314
|
-
o[k2] = m[k];
|
|
315
|
-
});
|
|
316
|
-
function __exportStar(m, o) {
|
|
317
|
-
for (var p in m)
|
|
318
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
319
|
-
__createBinding(o, m, p);
|
|
320
|
-
}
|
|
321
|
-
function __values(o) {
|
|
322
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
323
|
-
if (m)
|
|
324
|
-
return m.call(o);
|
|
325
|
-
if (o && typeof o.length === "number")
|
|
326
|
-
return {
|
|
327
|
-
next: function () {
|
|
328
|
-
if (o && i >= o.length)
|
|
329
|
-
o = void 0;
|
|
330
|
-
return { value: o && o[i++], done: !o };
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
334
|
-
}
|
|
335
|
-
function __read(o, n) {
|
|
336
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
337
|
-
if (!m)
|
|
338
|
-
return o;
|
|
339
|
-
var i = m.call(o), r, ar = [], e;
|
|
340
|
-
try {
|
|
341
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
342
|
-
ar.push(r.value);
|
|
343
|
-
}
|
|
344
|
-
catch (error) {
|
|
345
|
-
e = { error: error };
|
|
346
|
-
}
|
|
347
|
-
finally {
|
|
348
|
-
try {
|
|
349
|
-
if (r && !r.done && (m = i["return"]))
|
|
350
|
-
m.call(i);
|
|
351
|
-
}
|
|
352
|
-
finally {
|
|
353
|
-
if (e)
|
|
354
|
-
throw e.error;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return ar;
|
|
358
|
-
}
|
|
359
|
-
/** @deprecated */
|
|
360
|
-
function __spread() {
|
|
361
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
362
|
-
ar = ar.concat(__read(arguments[i]));
|
|
363
|
-
return ar;
|
|
364
|
-
}
|
|
365
|
-
/** @deprecated */
|
|
366
|
-
function __spreadArrays() {
|
|
367
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
368
|
-
s += arguments[i].length;
|
|
369
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
370
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
371
|
-
r[k] = a[j];
|
|
372
|
-
return r;
|
|
373
|
-
}
|
|
374
|
-
function __spreadArray(to, from, pack) {
|
|
375
|
-
if (pack || arguments.length === 2)
|
|
376
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
377
|
-
if (ar || !(i in from)) {
|
|
378
|
-
if (!ar)
|
|
379
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
380
|
-
ar[i] = from[i];
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
384
|
-
}
|
|
385
|
-
function __await(v) {
|
|
386
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
387
|
-
}
|
|
388
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
389
|
-
if (!Symbol.asyncIterator)
|
|
390
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
391
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
392
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
393
|
-
function verb(n) { if (g[n])
|
|
394
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
395
|
-
function resume(n, v) { try {
|
|
396
|
-
step(g[n](v));
|
|
397
|
-
}
|
|
398
|
-
catch (e) {
|
|
399
|
-
settle(q[0][3], e);
|
|
400
|
-
} }
|
|
401
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
402
|
-
function fulfill(value) { resume("next", value); }
|
|
403
|
-
function reject(value) { resume("throw", value); }
|
|
404
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
405
|
-
resume(q[0][0], q[0][1]); }
|
|
406
|
-
}
|
|
407
|
-
function __asyncDelegator(o) {
|
|
408
|
-
var i, p;
|
|
409
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
410
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
411
|
-
}
|
|
412
|
-
function __asyncValues(o) {
|
|
413
|
-
if (!Symbol.asyncIterator)
|
|
414
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
415
|
-
var m = o[Symbol.asyncIterator], i;
|
|
416
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
417
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
418
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
419
|
-
}
|
|
420
|
-
function __makeTemplateObject(cooked, raw) {
|
|
421
|
-
if (Object.defineProperty) {
|
|
422
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
423
|
-
}
|
|
424
|
-
else {
|
|
425
|
-
cooked.raw = raw;
|
|
426
|
-
}
|
|
427
|
-
return cooked;
|
|
428
|
-
}
|
|
429
|
-
;
|
|
430
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
431
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
432
|
-
}) : function (o, v) {
|
|
433
|
-
o["default"] = v;
|
|
434
|
-
};
|
|
435
|
-
function __importStar(mod) {
|
|
436
|
-
if (mod && mod.__esModule)
|
|
437
|
-
return mod;
|
|
438
|
-
var result = {};
|
|
439
|
-
if (mod != null)
|
|
440
|
-
for (var k in mod)
|
|
441
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
442
|
-
__createBinding(result, mod, k);
|
|
443
|
-
__setModuleDefault(result, mod);
|
|
444
|
-
return result;
|
|
445
|
-
}
|
|
446
|
-
function __importDefault(mod) {
|
|
447
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
448
|
-
}
|
|
449
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
450
|
-
if (kind === "a" && !f)
|
|
451
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
452
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
453
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
454
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
455
|
-
}
|
|
456
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
457
|
-
if (kind === "m")
|
|
458
|
-
throw new TypeError("Private method is not writable");
|
|
459
|
-
if (kind === "a" && !f)
|
|
460
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
461
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
462
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
463
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
var indexedDB = ('indexedDB' in globalScope && globalScope.indexedDB)
|
|
467
|
-
|| ('mozIndexedDB' in globalScope && globalScope.mozIndexedDB)
|
|
468
|
-
|| ('webkitIndexedDB' in globalScope && globalScope.webkitIndexedDB)
|
|
469
|
-
|| ('msIndexedDB' in globalScope && globalScope.msIndexedDB);
|
|
470
|
-
|
|
471
|
-
function requestToObservable(request, result, tearDown) {
|
|
472
|
-
return new rxjs.Observable(function (subscriber) {
|
|
473
|
-
request.onsuccess = function (ev) {
|
|
474
|
-
subscriber.next(result(ev));
|
|
475
|
-
subscriber.complete();
|
|
476
|
-
};
|
|
477
|
-
request.onerror = function () {
|
|
478
|
-
subscriber.error('IndexedDB request failed.');
|
|
479
|
-
};
|
|
480
|
-
return function () {
|
|
481
|
-
subscriber.complete();
|
|
482
|
-
if (tearDown) {
|
|
483
|
-
if (typeof tearDown.unsubscribe === 'function') {
|
|
484
|
-
tearDown.unsubscribe();
|
|
485
|
-
}
|
|
486
|
-
else if (typeof tearDown === 'function') {
|
|
487
|
-
tearDown();
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
};
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
function cursorRequestToStream(request, tx, result, tearDown) {
|
|
494
|
-
return new rxjs.Observable(function (subscriber) {
|
|
495
|
-
var running = true;
|
|
496
|
-
request.onsuccess = function (ev) {
|
|
497
|
-
var cursor = ev.target.result;
|
|
498
|
-
// If the cursor is pointing at something, ask for the data
|
|
499
|
-
if (cursor == null) {
|
|
500
|
-
subscriber.complete();
|
|
501
|
-
}
|
|
502
|
-
else {
|
|
503
|
-
if (running) {
|
|
504
|
-
subscriber.next(result(cursor));
|
|
505
|
-
// Move on to the next object in store
|
|
506
|
-
cursor.continue();
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
subscriber.complete();
|
|
510
|
-
tx.abort();
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
request.onerror = function () {
|
|
515
|
-
subscriber.error('Failed to load data from IndexedDB.');
|
|
516
|
-
};
|
|
517
|
-
tx.oncomplete = function () {
|
|
518
|
-
subscriber.complete();
|
|
519
|
-
};
|
|
520
|
-
return function () {
|
|
521
|
-
running = false;
|
|
522
|
-
if (tearDown) {
|
|
523
|
-
if (typeof tearDown.unsubscribe === 'function') {
|
|
524
|
-
tearDown.unsubscribe();
|
|
525
|
-
}
|
|
526
|
-
else if (typeof tearDown === 'function') {
|
|
527
|
-
tearDown();
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
var IndexedDbStore = /** @class */ (function () {
|
|
535
|
-
function IndexedDbStore(dbName, key, version) {
|
|
536
|
-
this.dbName = dbName;
|
|
537
|
-
this.key = key;
|
|
538
|
-
this.version = version;
|
|
539
|
-
this._bakValue = [];
|
|
540
|
-
}
|
|
541
|
-
Object.defineProperty(IndexedDbStore.prototype, "indexedDB", {
|
|
542
|
-
get: function () {
|
|
543
|
-
var _this = this;
|
|
544
|
-
var request = indexedDB.open(this.dbName, this.version || 1);
|
|
545
|
-
var db;
|
|
546
|
-
var close = false;
|
|
547
|
-
request.onupgradeneeded = function (ev) {
|
|
548
|
-
db = ev.target.result;
|
|
549
|
-
var params = { autoIncrement: true };
|
|
550
|
-
if (_this.key != null) {
|
|
551
|
-
params = { keyPath: toString(_this.key) };
|
|
552
|
-
}
|
|
553
|
-
db.createObjectStore(_this.dbName, params);
|
|
554
|
-
if (close) {
|
|
555
|
-
db.close();
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
return requestToObservable(request, function (ev) {
|
|
559
|
-
db = ev.target.result;
|
|
560
|
-
if (close) {
|
|
561
|
-
db.close();
|
|
562
|
-
}
|
|
563
|
-
return db;
|
|
564
|
-
}, function () {
|
|
565
|
-
close = true;
|
|
566
|
-
if (db) {
|
|
567
|
-
db.close();
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
|
-
},
|
|
571
|
-
enumerable: false,
|
|
572
|
-
configurable: true
|
|
573
|
-
});
|
|
574
|
-
IndexedDbStore.prototype.add = function (value) {
|
|
575
|
-
return this.bulkAdd([value]).pipe(operators.map(function (savedValue) { return savedValue ? savedValue[0] : null; }));
|
|
576
|
-
};
|
|
577
|
-
IndexedDbStore.prototype.bulkAdd = function (value) {
|
|
578
|
-
var _this = this;
|
|
579
|
-
if (!indexedDB) {
|
|
580
|
-
this._bakValue = this._bakValue.concat(value);
|
|
581
|
-
return rxjs.of(this._bakValue);
|
|
582
|
-
}
|
|
583
|
-
return this.readWriteStore.pipe(operators.switchMap(function (store) {
|
|
584
|
-
return _this._saveBulk(store, value);
|
|
585
|
-
}));
|
|
586
|
-
};
|
|
587
|
-
IndexedDbStore.prototype.replace = function (value) {
|
|
588
|
-
return this.bulkReplace([value]).pipe(operators.map(function (savedValue) { return savedValue ? savedValue[0] : null; }));
|
|
589
|
-
};
|
|
590
|
-
IndexedDbStore.prototype.bulkReplace = function (value) {
|
|
591
|
-
var _this = this;
|
|
592
|
-
if (!indexedDB) {
|
|
593
|
-
this._bakValue = value;
|
|
594
|
-
return rxjs.of(this._bakValue);
|
|
595
|
-
}
|
|
596
|
-
return this._clear().pipe(operators.switchMap(function (store) {
|
|
597
|
-
return _this._saveBulk(store, value);
|
|
598
|
-
}));
|
|
599
|
-
};
|
|
600
|
-
IndexedDbStore.prototype.clear = function () {
|
|
601
|
-
if (!indexedDB) {
|
|
602
|
-
this._bakValue = [];
|
|
603
|
-
return rxjs.of(void 0);
|
|
604
|
-
}
|
|
605
|
-
return this._clear().pipe(operators.map(function () { return void 0; }));
|
|
606
|
-
};
|
|
607
|
-
Object.defineProperty(IndexedDbStore.prototype, "readWriteStore", {
|
|
608
|
-
get: function () {
|
|
609
|
-
var _this = this;
|
|
610
|
-
return this.indexedDB.pipe(operators.map(function (db) {
|
|
611
|
-
var tx = db.transaction(_this.dbName, 'readwrite');
|
|
612
|
-
return tx.objectStore(_this.dbName);
|
|
613
|
-
}));
|
|
614
|
-
},
|
|
615
|
-
enumerable: false,
|
|
616
|
-
configurable: true
|
|
617
|
-
});
|
|
618
|
-
IndexedDbStore.prototype._clear = function () {
|
|
619
|
-
return this.readWriteStore.pipe(operators.switchMap(function (store) {
|
|
620
|
-
var request = store.clear();
|
|
621
|
-
return requestToObservable(request, function () { return store; });
|
|
622
|
-
}));
|
|
623
|
-
};
|
|
624
|
-
IndexedDbStore.prototype._saveBulk = function (store, items) {
|
|
625
|
-
return rxjs.defer(function () {
|
|
626
|
-
var requests = [rxjs.of(null)];
|
|
627
|
-
if (items != null) {
|
|
628
|
-
items.forEach(function (item) {
|
|
629
|
-
requests.push(requestToObservable(store.add(item), function () { return null; }));
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
|
-
return rxjs.zip.apply(void 0, __spreadArray([], __read(requests)));
|
|
633
|
-
}).pipe(operators.map(function () {
|
|
634
|
-
return items;
|
|
635
|
-
}));
|
|
636
|
-
};
|
|
637
|
-
Object.defineProperty(IndexedDbStore.prototype, "all", {
|
|
638
|
-
get: function () {
|
|
639
|
-
var _this = this;
|
|
640
|
-
if (!indexedDB) {
|
|
641
|
-
return rxjs.of(this._bakValue);
|
|
642
|
-
}
|
|
643
|
-
return this.indexedDB.pipe(operators.switchMap(function (db) { return new rxjs.Observable(function (subscriber) {
|
|
644
|
-
var tx = db.transaction(_this.dbName, 'readonly');
|
|
645
|
-
var store = tx.objectStore(_this.dbName);
|
|
646
|
-
var req = store.openCursor();
|
|
647
|
-
var items = [];
|
|
648
|
-
return cursorRequestToStream(req, tx, function (cursor) {
|
|
649
|
-
return cursor.value;
|
|
650
|
-
})
|
|
651
|
-
.subscribe(function (item) { return items.push(item); }, function (err) {
|
|
652
|
-
subscriber.error(err);
|
|
653
|
-
}, function () {
|
|
654
|
-
subscriber.next(items);
|
|
655
|
-
subscriber.complete();
|
|
656
|
-
});
|
|
657
|
-
}); }));
|
|
658
|
-
},
|
|
659
|
-
enumerable: false,
|
|
660
|
-
configurable: true
|
|
661
|
-
});
|
|
662
|
-
return IndexedDbStore;
|
|
663
|
-
}());
|
|
664
|
-
|
|
665
|
-
/**
|
|
666
|
-
* We need this JSDoc comment for affecting ESDoc.
|
|
667
|
-
*/
|
|
668
|
-
var SubjectSubscription = /** @class */ (function (_super) {
|
|
669
|
-
__extends(SubjectSubscription, _super);
|
|
670
|
-
function SubjectSubscription(subject, subscriber) {
|
|
671
|
-
var _this = _super.call(this) || this;
|
|
672
|
-
_this.subject = subject;
|
|
673
|
-
_this.subscriber = subscriber;
|
|
674
|
-
_this.closed = false;
|
|
675
|
-
return _this;
|
|
676
|
-
}
|
|
677
|
-
SubjectSubscription.prototype.unsubscribe = function () {
|
|
678
|
-
if (this.closed || this.subject == null) {
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
this.closed = true;
|
|
682
|
-
var subject = this.subject;
|
|
683
|
-
var observers = subject.observers;
|
|
684
|
-
this.subject = null;
|
|
685
|
-
if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
|
|
686
|
-
return;
|
|
687
|
-
}
|
|
688
|
-
var subscriberIndex = observers.indexOf(this.subscriber);
|
|
689
|
-
if (subscriberIndex !== -1) {
|
|
690
|
-
observers.splice(subscriberIndex, 1);
|
|
691
|
-
}
|
|
692
|
-
};
|
|
693
|
-
return SubjectSubscription;
|
|
694
|
-
}(rxjs.Subscription));
|
|
695
|
-
|
|
696
|
-
var IndexedDBReplaySubject = /** @class */ (function (_super) {
|
|
697
|
-
__extends(IndexedDBReplaySubject, _super);
|
|
698
|
-
function IndexedDBReplaySubject(dbName, key, version) {
|
|
699
|
-
var _this = _super.call(this) || this;
|
|
700
|
-
_this.storage = new IndexedDbStore(dbName, key, version);
|
|
701
|
-
return _this;
|
|
702
|
-
}
|
|
703
|
-
Object.defineProperty(IndexedDBReplaySubject.prototype, "hasData", {
|
|
704
|
-
get: function () {
|
|
705
|
-
return this.lastValue.pipe(operators.map(function (val) {
|
|
706
|
-
return val != null;
|
|
707
|
-
}));
|
|
708
|
-
},
|
|
709
|
-
enumerable: false,
|
|
710
|
-
configurable: true
|
|
711
|
-
});
|
|
712
|
-
Object.defineProperty(IndexedDBReplaySubject.prototype, "lastValue", {
|
|
713
|
-
get: function () {
|
|
714
|
-
return this.storage.all.pipe(operators.map(function (value) { return value ? value[0] : null; }));
|
|
715
|
-
},
|
|
716
|
-
enumerable: false,
|
|
717
|
-
configurable: true
|
|
718
|
-
});
|
|
719
|
-
IndexedDBReplaySubject.prototype.next = function (value) {
|
|
720
|
-
var _this = this;
|
|
721
|
-
this.storage.replace(value).subscribe(function (storedValue) {
|
|
722
|
-
if (storedValue != null) {
|
|
723
|
-
_this._next(storedValue);
|
|
724
|
-
}
|
|
725
|
-
}, function (err) {
|
|
726
|
-
_super.prototype.error.call(_this, err);
|
|
727
|
-
});
|
|
728
|
-
};
|
|
729
|
-
IndexedDBReplaySubject.prototype._next = function (value) {
|
|
730
|
-
_super.prototype.next.call(this, value);
|
|
731
|
-
};
|
|
732
|
-
IndexedDBReplaySubject.prototype._subscribe = function (subscriber) {
|
|
733
|
-
var _this = this;
|
|
734
|
-
var subscription;
|
|
735
|
-
switch (true) {
|
|
736
|
-
case this.closed:
|
|
737
|
-
throw new rxjs.ObjectUnsubscribedError();
|
|
738
|
-
case this.hasError:
|
|
739
|
-
case this.isStopped:
|
|
740
|
-
subscription = rxjs.Subscription.EMPTY;
|
|
741
|
-
break;
|
|
742
|
-
default:
|
|
743
|
-
this.observers.push(subscriber);
|
|
744
|
-
subscription = new SubjectSubscription(this, subscriber);
|
|
745
|
-
}
|
|
746
|
-
var result = new rxjs.Subscription();
|
|
747
|
-
result.add(subscription);
|
|
748
|
-
result.add(this.lastValue.subscribe(function (value) {
|
|
749
|
-
if (value != null) {
|
|
750
|
-
subscriber.next(value);
|
|
751
|
-
}
|
|
752
|
-
if (_this.hasError) {
|
|
753
|
-
subscriber.error(_this.thrownError);
|
|
754
|
-
}
|
|
755
|
-
else if (_this.isStopped) {
|
|
756
|
-
subscriber.complete();
|
|
757
|
-
}
|
|
758
|
-
}, function (err) {
|
|
759
|
-
subscriber.error(err);
|
|
760
|
-
}));
|
|
761
|
-
return result;
|
|
762
|
-
};
|
|
763
|
-
return IndexedDBReplaySubject;
|
|
764
|
-
}(rxjs.Subject));
|
|
765
|
-
|
|
766
|
-
var IndexedDBArrayReplaySubject = /** @class */ (function (_super) {
|
|
767
|
-
__extends(IndexedDBArrayReplaySubject, _super);
|
|
768
|
-
function IndexedDBArrayReplaySubject(partitionSize, dbName, version) {
|
|
769
|
-
var _this = _super.call(this, dbName, null, version) || this;
|
|
770
|
-
_this.partitionSize = partitionSize;
|
|
771
|
-
return _this;
|
|
772
|
-
}
|
|
773
|
-
Object.defineProperty(IndexedDBArrayReplaySubject.prototype, "lastValue", {
|
|
774
|
-
get: function () {
|
|
775
|
-
return this.storage.all.pipe(operators.map(function (items) {
|
|
776
|
-
if (!items || items.length === 0) {
|
|
777
|
-
return null;
|
|
778
|
-
}
|
|
779
|
-
return items.reduce(function (result, subItems) {
|
|
780
|
-
return result.concat(subItems);
|
|
781
|
-
}, []);
|
|
782
|
-
}));
|
|
783
|
-
},
|
|
784
|
-
enumerable: false,
|
|
785
|
-
configurable: true
|
|
786
|
-
});
|
|
787
|
-
IndexedDBArrayReplaySubject.prototype.next = function (value) {
|
|
788
|
-
var _this = this;
|
|
789
|
-
var rows = [];
|
|
790
|
-
for (var i = 0; i <= value.length / this.partitionSize; i++) {
|
|
791
|
-
rows[i] = value.slice(i * this.partitionSize, (i + 1) * this.partitionSize);
|
|
792
|
-
}
|
|
793
|
-
this.storage.bulkReplace(rows).subscribe(function () {
|
|
794
|
-
_this._next(value);
|
|
795
|
-
}, function (err) {
|
|
796
|
-
_super.prototype.error.call(_this, err);
|
|
797
|
-
});
|
|
798
|
-
};
|
|
799
|
-
return IndexedDBArrayReplaySubject;
|
|
800
|
-
}(IndexedDBReplaySubject));
|
|
801
|
-
|
|
802
|
-
var ReplaySubjectExt = /** @class */ (function (_super) {
|
|
803
|
-
__extends(ReplaySubjectExt, _super);
|
|
804
|
-
function ReplaySubjectExt(bufferSize, windowTime, scheduler) {
|
|
805
|
-
var _this = _super.call(this, bufferSize, windowTime, scheduler) || this;
|
|
806
|
-
_this._hasData = false;
|
|
807
|
-
_this.oldNext = _this.next;
|
|
808
|
-
_this.next = _this.nextAndStoreValue;
|
|
809
|
-
return _this;
|
|
810
|
-
}
|
|
811
|
-
ReplaySubjectExt.prototype.nextAndStoreValue = function (value) {
|
|
812
|
-
this._lastValue = value;
|
|
813
|
-
this._hasData = true;
|
|
814
|
-
this.oldNext(value);
|
|
815
|
-
};
|
|
816
|
-
Object.defineProperty(ReplaySubjectExt.prototype, "hasData", {
|
|
817
|
-
get: function () {
|
|
818
|
-
return this._hasData;
|
|
819
|
-
},
|
|
820
|
-
enumerable: false,
|
|
821
|
-
configurable: true
|
|
822
|
-
});
|
|
823
|
-
Object.defineProperty(ReplaySubjectExt.prototype, "lastValue", {
|
|
824
|
-
get: function () {
|
|
825
|
-
return this._lastValue;
|
|
826
|
-
},
|
|
827
|
-
enumerable: false,
|
|
828
|
-
configurable: true
|
|
829
|
-
});
|
|
830
|
-
return ReplaySubjectExt;
|
|
831
|
-
}(rxjs.ReplaySubject));
|
|
832
|
-
|
|
833
|
-
function retry(logger, maxRetryAttempts, scalingDuration) {
|
|
834
|
-
if (maxRetryAttempts === void 0) { maxRetryAttempts = 5; }
|
|
835
|
-
if (scalingDuration === void 0) { scalingDuration = 1000; }
|
|
836
|
-
return operators.retryWhen((function (errors) { return errors.pipe(operators.mergeMap(function (error, i) {
|
|
837
|
-
var retryAttempt = i + 1;
|
|
838
|
-
// if maximum number of retries have been met
|
|
839
|
-
// or response is a status code we don't wish to retry, throw error
|
|
840
|
-
if (retryAttempt >= maxRetryAttempts) {
|
|
841
|
-
return rxjs.throwError(error);
|
|
842
|
-
}
|
|
843
|
-
logger.info("Attempt " + retryAttempt + ": retrying in " + retryAttempt * scalingDuration + "ms");
|
|
844
|
-
// retry after 1s, 2s, etc...
|
|
845
|
-
return rxjs.timer(retryAttempt * scalingDuration);
|
|
846
|
-
}), operators.finalize(function () { return logger.info('We are done!'); })); }));
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
var KEY_PREFIX = 'auto-ws';
|
|
850
|
-
function LocalStorage(key, keyPrefix) {
|
|
851
|
-
if (keyPrefix === void 0) { keyPrefix = KEY_PREFIX; }
|
|
852
|
-
return _WebStorage(localStorage, key, keyPrefix);
|
|
853
|
-
}
|
|
854
|
-
function SessionStorage(key, keyPrefix) {
|
|
855
|
-
if (keyPrefix === void 0) { keyPrefix = KEY_PREFIX; }
|
|
856
|
-
return _WebStorage(sessionStorage, key, keyPrefix);
|
|
857
|
-
}
|
|
858
|
-
var _WebStorage = function (webStorage, key, keyPrefix) {
|
|
859
|
-
return function (target, propertyName) {
|
|
860
|
-
var storageKey = key || propertyName;
|
|
861
|
-
var objectKey = Symbol("__" + WebStorageUtility.generateStorageKey(storageKey, keyPrefix));
|
|
862
|
-
Object.defineProperty(target, propertyName, {
|
|
863
|
-
configurable: true,
|
|
864
|
-
get: function () {
|
|
865
|
-
if (this[objectKey]) {
|
|
866
|
-
return this[objectKey];
|
|
867
|
-
}
|
|
868
|
-
this[objectKey] = WebStorageUtility.get(webStorage, storageKey, keyPrefix);
|
|
869
|
-
return this[objectKey];
|
|
870
|
-
},
|
|
871
|
-
set: function (newValue) {
|
|
872
|
-
this[objectKey] = newValue;
|
|
873
|
-
if (newValue == null) {
|
|
874
|
-
WebStorageUtility.remove(webStorage, storageKey, keyPrefix);
|
|
875
|
-
}
|
|
876
|
-
else {
|
|
877
|
-
WebStorageUtility.set(webStorage, storageKey, keyPrefix, newValue);
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
});
|
|
881
|
-
};
|
|
882
|
-
};
|
|
883
|
-
var ɵ0 = _WebStorage;
|
|
884
|
-
var WebStorageUtility = /** @class */ (function () {
|
|
885
|
-
function WebStorageUtility() {
|
|
886
|
-
}
|
|
887
|
-
WebStorageUtility.generateStorageKey = function (key, keyPrefix) {
|
|
888
|
-
return keyPrefix + "_" + key;
|
|
889
|
-
};
|
|
890
|
-
WebStorageUtility.get = function (storage, key, keyPrefix) {
|
|
891
|
-
var storageKey = WebStorageUtility.generateStorageKey(key, keyPrefix);
|
|
892
|
-
try {
|
|
893
|
-
var value = storage.getItem(storageKey);
|
|
894
|
-
return WebStorageUtility.getGettable(value);
|
|
895
|
-
}
|
|
896
|
-
catch (e) {
|
|
897
|
-
this.clear(storage, storageKey);
|
|
898
|
-
return null;
|
|
899
|
-
}
|
|
900
|
-
};
|
|
901
|
-
WebStorageUtility.set = function (storage, key, keyPrefix, value) {
|
|
902
|
-
var storageKey = WebStorageUtility.generateStorageKey(key, keyPrefix);
|
|
903
|
-
try {
|
|
904
|
-
storage.setItem(storageKey, WebStorageUtility.getSettable(value));
|
|
905
|
-
}
|
|
906
|
-
catch (e) {
|
|
907
|
-
this.clear(storage, storageKey);
|
|
908
|
-
}
|
|
909
|
-
};
|
|
910
|
-
WebStorageUtility.clear = function (storage, storageKey) {
|
|
911
|
-
try {
|
|
912
|
-
storage.removeItem(storageKey);
|
|
913
|
-
}
|
|
914
|
-
catch (e) {
|
|
915
|
-
// Just catch and ignore
|
|
916
|
-
}
|
|
917
|
-
};
|
|
918
|
-
WebStorageUtility.remove = function (storage, key, keyPrefix) {
|
|
919
|
-
var storageKey = WebStorageUtility.generateStorageKey(key, keyPrefix);
|
|
920
|
-
this.clear(storage, storageKey);
|
|
921
|
-
};
|
|
922
|
-
WebStorageUtility.getSettable = function (value) {
|
|
923
|
-
return typeof value === 'string' ? value : JSON.stringify(value);
|
|
924
|
-
};
|
|
925
|
-
WebStorageUtility.getGettable = function (value) {
|
|
926
|
-
if (value == null) {
|
|
927
|
-
return null;
|
|
928
|
-
}
|
|
929
|
-
try {
|
|
930
|
-
return JSON.parse(value);
|
|
931
|
-
}
|
|
932
|
-
catch (e) {
|
|
933
|
-
return value;
|
|
934
|
-
}
|
|
935
|
-
};
|
|
936
|
-
return WebStorageUtility;
|
|
937
|
-
}());
|
|
938
|
-
|
|
939
|
-
var crypto = ('crypto' in globalScope && globalScope.crypto)
|
|
940
|
-
|| ('msCrypto' in globalScope && globalScope.msCrypto)
|
|
941
|
-
|| null;
|
|
942
|
-
function secureRandom() {
|
|
943
|
-
if (crypto && typeof crypto.getRandomValues === 'function') {
|
|
944
|
-
var array = new Uint16Array(1);
|
|
945
|
-
crypto.getRandomValues(array);
|
|
946
|
-
return array[0] / 65535; // Max Uint16 is 65535
|
|
947
|
-
}
|
|
948
|
-
return Math.random();
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
var UIDUtils = /** @class */ (function () {
|
|
952
|
-
function UIDUtils() {
|
|
953
|
-
}
|
|
954
|
-
UIDUtils.computeUID = function () {
|
|
955
|
-
var data = [];
|
|
956
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
957
|
-
data[_i] = arguments[_i];
|
|
958
|
-
}
|
|
959
|
-
if (data && data.length) {
|
|
960
|
-
return data.map(function (value) {
|
|
961
|
-
if (value == null) {
|
|
962
|
-
return '';
|
|
963
|
-
}
|
|
964
|
-
return toString(value).replace('\.', '');
|
|
965
|
-
}).join('-');
|
|
966
|
-
}
|
|
967
|
-
return UIDUtils.generateUID();
|
|
968
|
-
};
|
|
969
|
-
UIDUtils.generateUID = function () {
|
|
970
|
-
var s4 = function () {
|
|
971
|
-
return Math.floor((1 + secureRandom()) * 0x10000)
|
|
972
|
-
.toString(16)
|
|
973
|
-
.substring(1);
|
|
974
|
-
};
|
|
975
|
-
return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
|
|
976
|
-
};
|
|
977
|
-
return UIDUtils;
|
|
978
|
-
}());
|
|
979
|
-
|
|
980
|
-
var BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
981
|
-
var atobAvailable = 'atob' in globalScope && typeof globalScope.atob === 'function';
|
|
982
|
-
var btoaAvailable = 'btoa' in globalScope && typeof globalScope.btoa === 'function';
|
|
983
|
-
// credits for decoder goes to https://github.com/atk
|
|
984
|
-
function base64decode(str) {
|
|
985
|
-
var source = str
|
|
986
|
-
.replace(/-/g, '+')
|
|
987
|
-
.replace(/_/g, '/');
|
|
988
|
-
// Add padding if missing
|
|
989
|
-
switch (source.length % 4) {
|
|
990
|
-
case 0:
|
|
991
|
-
break;
|
|
992
|
-
case 2:
|
|
993
|
-
source += '==';
|
|
994
|
-
break;
|
|
995
|
-
case 3:
|
|
996
|
-
source += '=';
|
|
997
|
-
break;
|
|
998
|
-
default:
|
|
999
|
-
throw new Error('Illegal base64 string!');
|
|
1000
|
-
}
|
|
1001
|
-
var output = '';
|
|
1002
|
-
if (atobAvailable) {
|
|
1003
|
-
output = atob(str);
|
|
1004
|
-
}
|
|
1005
|
-
else {
|
|
1006
|
-
source = source.replace(/=+$/, '');
|
|
1007
|
-
if (source.length % 4 === 1) {
|
|
1008
|
-
throw new Error('\'atob\' failed: The string to be decoded is not correctly encoded.');
|
|
1009
|
-
}
|
|
1010
|
-
/* tslint:disable:no-bitwise no-conditional-assignment */
|
|
1011
|
-
for (
|
|
1012
|
-
// initialize result and counters
|
|
1013
|
-
var bc = 0, bs = 0, buffer = void 0, idx = 0;
|
|
1014
|
-
// get next character
|
|
1015
|
-
buffer = source.charAt(idx++);
|
|
1016
|
-
// character found in table? initialize bit storage and add its ascii value;
|
|
1017
|
-
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
|
|
1018
|
-
// and if not first of each 4 characters,
|
|
1019
|
-
// convert the first 8 bits to one ascii character
|
|
1020
|
-
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
|
|
1021
|
-
// try to find character in table (0-63, not found => -1)
|
|
1022
|
-
buffer = BASE64_CHARS.indexOf(buffer);
|
|
1023
|
-
}
|
|
1024
|
-
/* tslint:enable */
|
|
1025
|
-
}
|
|
1026
|
-
// https://developer.mozilla.org/en/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem
|
|
1027
|
-
return decodeURIComponent(Array.prototype.map.call(output, function (c) {
|
|
1028
|
-
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
1029
|
-
}).join(''));
|
|
1030
|
-
}
|
|
1031
|
-
function base64encode(buffer) {
|
|
1032
|
-
var arrayBuffer;
|
|
1033
|
-
if (typeof buffer === 'string') {
|
|
1034
|
-
if (btoaAvailable) {
|
|
1035
|
-
return btoa(buffer);
|
|
1036
|
-
}
|
|
1037
|
-
arrayBuffer = string2buffer(buffer);
|
|
1038
|
-
}
|
|
1039
|
-
else {
|
|
1040
|
-
arrayBuffer = buffer;
|
|
1041
|
-
}
|
|
1042
|
-
var base64 = '';
|
|
1043
|
-
var bytes = new Uint8Array(arrayBuffer);
|
|
1044
|
-
var byteLength = bytes.byteLength;
|
|
1045
|
-
var byteRemainder = byteLength % 3;
|
|
1046
|
-
var mainLength = byteLength - byteRemainder;
|
|
1047
|
-
var a;
|
|
1048
|
-
var b;
|
|
1049
|
-
var c;
|
|
1050
|
-
var d;
|
|
1051
|
-
var chunk;
|
|
1052
|
-
// tslint:disable:no-bitwise
|
|
1053
|
-
// Main loop deals with bytes in chunks of 3
|
|
1054
|
-
for (var i = 0; i < mainLength; i = i + 3) {
|
|
1055
|
-
// Combine the three bytes into a single integer
|
|
1056
|
-
chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
|
|
1057
|
-
// Use bitmasks to extract 6-bit segments from the triplet
|
|
1058
|
-
a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18
|
|
1059
|
-
b = (chunk & 258048) >> 12; // 258048 = (2^6 - 1) << 12
|
|
1060
|
-
c = (chunk & 4032) >> 6; // 4032 = (2^6 - 1) << 6
|
|
1061
|
-
d = chunk & 63; // 63 = 2^6 - 1
|
|
1062
|
-
// Convert the raw binary segments to the appropriate ASCII encoding
|
|
1063
|
-
base64 += BASE64_CHARS[a] + BASE64_CHARS[b] + BASE64_CHARS[c] + BASE64_CHARS[d];
|
|
1064
|
-
}
|
|
1065
|
-
// Deal with the remaining bytes and padding
|
|
1066
|
-
if (byteRemainder === 1) {
|
|
1067
|
-
chunk = bytes[mainLength];
|
|
1068
|
-
a = (chunk & 252) >> 2; // 252 = (2^6 - 1) << 2
|
|
1069
|
-
// Set the 4 least significant bits to zero
|
|
1070
|
-
b = (chunk & 3) << 4; // 3 = 2^2 - 1
|
|
1071
|
-
base64 += BASE64_CHARS[a] + BASE64_CHARS[b] + "==";
|
|
1072
|
-
}
|
|
1073
|
-
else if (byteRemainder === 2) {
|
|
1074
|
-
chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1];
|
|
1075
|
-
a = (chunk & 64512) >> 10; // 64512 = (2^6 - 1) << 10
|
|
1076
|
-
b = (chunk & 1008) >> 4; // 1008 = (2^6 - 1) << 4
|
|
1077
|
-
// Set the 2 least significant bits to zero
|
|
1078
|
-
c = (chunk & 15) << 2; // 15 = 2^4 - 1
|
|
1079
|
-
base64 += BASE64_CHARS[a] + BASE64_CHARS[b] + BASE64_CHARS[c] + "=";
|
|
1080
|
-
}
|
|
1081
|
-
// tslint:enable
|
|
1082
|
-
return base64;
|
|
1083
|
-
}
|
|
1084
|
-
function string2buffer(source) {
|
|
1085
|
-
var encoder = 'TextEncoder' in globalScope ? new TextEncoder() : {
|
|
1086
|
-
encode: function (str) {
|
|
1087
|
-
return Uint8Array.from(Array.prototype.slice.apply(str), function (char) { return char.codePointAt(0) || 0; });
|
|
1088
|
-
}
|
|
1089
|
-
};
|
|
1090
|
-
return encoder.encode(source);
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
var Logger = /** @class */ (function () {
|
|
1094
|
-
function Logger() {
|
|
1095
|
-
}
|
|
1096
|
-
return Logger;
|
|
1097
|
-
}());
|
|
1098
|
-
|
|
1099
|
-
function deepClone(obj) {
|
|
1100
|
-
return obj && JSON.parse(JSON.stringify(obj));
|
|
1101
|
-
}
|
|
1102
|
-
function isObject(obj) {
|
|
1103
|
-
return typeof obj === 'object' && obj != null;
|
|
1104
|
-
}
|
|
1105
|
-
// tslint:enable
|
|
1106
|
-
function deepEqual(x, y, ignoreArrayOrderOrPaths, ignoreArrayOrder) {
|
|
1107
|
-
if (ignoreArrayOrderOrPaths === void 0) { ignoreArrayOrderOrPaths = []; }
|
|
1108
|
-
if (ignoreArrayOrder === void 0) { ignoreArrayOrder = false; }
|
|
1109
|
-
var ignorePaths = [];
|
|
1110
|
-
if (typeof ignoreArrayOrderOrPaths === 'boolean') {
|
|
1111
|
-
ignoreArrayOrder = ignoreArrayOrderOrPaths;
|
|
1112
|
-
}
|
|
1113
|
-
else if (Array.isArray(ignoreArrayOrderOrPaths)) {
|
|
1114
|
-
ignorePaths = ignoreArrayOrderOrPaths;
|
|
1115
|
-
}
|
|
1116
|
-
return deepEqualImpl(x, y, '', ignorePaths, ignoreArrayOrder);
|
|
1117
|
-
}
|
|
1118
|
-
function deepEqualImpl(x, y, parentPath, ignorePaths, ignoreArrayOrder) {
|
|
1119
|
-
if (x === y) {
|
|
1120
|
-
return true;
|
|
1121
|
-
}
|
|
1122
|
-
if (Array.isArray(x) && Array.isArray(y) && ignoreArrayOrder) {
|
|
1123
|
-
x = x.slice().sort();
|
|
1124
|
-
y = y.slice().sort();
|
|
1125
|
-
}
|
|
1126
|
-
if (isObject(x) && isObject(y)) {
|
|
1127
|
-
var xObj_1 = x;
|
|
1128
|
-
var yObj_1 = y;
|
|
1129
|
-
var xKeys = Object.keys(xObj_1).filter(function (key) { return ignorePaths.indexOf(parentPath + "." + key) === -1; });
|
|
1130
|
-
var yKeys = Object.keys(yObj_1).filter(function (key) { return ignorePaths.indexOf(parentPath + "." + key) === -1; });
|
|
1131
|
-
if (xKeys.length !== yKeys.length) {
|
|
1132
|
-
return false;
|
|
1133
|
-
}
|
|
1134
|
-
return xKeys.every(function (key) {
|
|
1135
|
-
if (!(key in yObj_1)) {
|
|
1136
|
-
return false;
|
|
1137
|
-
}
|
|
1138
|
-
return deepEqualImpl(xObj_1[key], yObj_1[key], parentPath + "." + key, ignorePaths, ignoreArrayOrder);
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
return false;
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
/**
|
|
1145
|
-
* Generated bundle index. Do not edit.
|
|
1146
|
-
*/
|
|
1147
|
-
|
|
1148
|
-
exports.CONTENT_TYPE = CONTENT_TYPE;
|
|
1149
|
-
exports.DateUtils = DateUtils;
|
|
1150
|
-
exports.ErrorType = ErrorType;
|
|
1151
|
-
exports.IndexedDBArrayReplaySubject = IndexedDBArrayReplaySubject;
|
|
1152
|
-
exports.IndexedDBReplaySubject = IndexedDBReplaySubject;
|
|
1153
|
-
exports.IndexedDbStore = IndexedDbStore;
|
|
1154
|
-
exports.LocalStorage = LocalStorage;
|
|
1155
|
-
exports.Logger = Logger;
|
|
1156
|
-
exports.ReplaySubjectExt = ReplaySubjectExt;
|
|
1157
|
-
exports.SessionStorage = SessionStorage;
|
|
1158
|
-
exports.UIDUtils = UIDUtils;
|
|
1159
|
-
exports.base64decode = base64decode;
|
|
1160
|
-
exports.base64encode = base64encode;
|
|
1161
|
-
exports.deepClone = deepClone;
|
|
1162
|
-
exports.deepEqual = deepEqual;
|
|
1163
|
-
exports.extractResult = extractResult;
|
|
1164
|
-
exports.globalScope = globalScope;
|
|
1165
|
-
exports.isEventObject = isEventObject;
|
|
1166
|
-
exports.retry = retry;
|
|
1167
|
-
exports.secureRandom = secureRandom;
|
|
1168
|
-
exports.string2buffer = string2buffer;
|
|
1169
|
-
exports.toString = toString;
|
|
1170
|
-
|
|
1171
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1172
|
-
|
|
1173
|
-
}));
|
|
1174
|
-
//# sourceMappingURL=dbg-riskit-common.umd.js.map
|