@krainovsd/js-helpers 0.14.13 → 0.15.1
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/lib/cjs/index.cjs +477 -264
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/constants/api.js +1 -2
- package/lib/esm/constants/api.js.map +1 -1
- package/lib/esm/index.js +16 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/lib/api/core.js +2 -2
- package/lib/esm/lib/api/middlewares/index.js +4 -10
- package/lib/esm/lib/api/middlewares/index.js.map +1 -1
- package/lib/esm/lib/api/middlewares/{auth-no-refresh-middleware.js → oauth-middleware.js} +20 -7
- package/lib/esm/lib/api/middlewares/oauth-middleware.js.map +1 -0
- package/lib/esm/lib/api/{auth → oauth}/token.js +41 -79
- package/lib/esm/lib/api/oauth/token.js.map +1 -0
- package/lib/esm/lib/api/oauth/user.js.map +1 -0
- package/lib/esm/lib/browser/copy-to-clipboard.js +37 -0
- package/lib/esm/lib/browser/copy-to-clipboard.js.map +1 -0
- package/lib/esm/lib/browser/download-file.js +1 -1
- package/lib/esm/lib/browser/extract-queries.js +21 -0
- package/lib/esm/lib/browser/extract-queries.js.map +1 -0
- package/lib/esm/lib/lodash/clone-deep.js +62 -0
- package/lib/esm/lib/lodash/clone-deep.js.map +1 -0
- package/lib/esm/lib/lodash/debounce.js +32 -0
- package/lib/esm/lib/lodash/debounce.js.map +1 -0
- package/lib/esm/lib/lodash/difference-by.js +18 -0
- package/lib/esm/lib/lodash/difference-by.js.map +1 -0
- package/lib/esm/lib/lodash/difference-with.js +18 -0
- package/lib/esm/lib/lodash/difference-with.js.map +1 -0
- package/lib/esm/lib/lodash/difference.js +18 -0
- package/lib/esm/lib/lodash/difference.js.map +1 -0
- package/lib/esm/lib/lodash/get-by-path.js.map +1 -0
- package/lib/esm/lib/lodash/is-equal.js +46 -0
- package/lib/esm/lib/lodash/is-equal.js.map +1 -0
- package/lib/esm/lib/lodash/set-by-path.js.map +1 -0
- package/lib/esm/lib/lodash/throttle.js +22 -0
- package/lib/esm/lib/lodash/throttle.js.map +1 -0
- package/lib/esm/lib/lodash/type.js +10 -0
- package/lib/esm/lib/lodash/type.js.map +1 -0
- package/lib/esm/lib/typings/is-primitive.js +7 -0
- package/lib/esm/lib/typings/is-primitive.js.map +1 -0
- package/lib/esm/lib/utils/declination.js +14 -0
- package/lib/esm/lib/utils/declination.js.map +1 -0
- package/lib/esm/lib/utils/sync-object-values.js +2 -2
- package/lib/esm/lib/utils/sync-object-values.js.map +1 -1
- package/lib/index.d.ts +61 -38
- package/package.json +1 -1
- package/lib/esm/lib/api/auth/token.js.map +0 -1
- package/lib/esm/lib/api/auth/user.js.map +0 -1
- package/lib/esm/lib/api/middlewares/auth-middleware.js +0 -57
- package/lib/esm/lib/api/middlewares/auth-middleware.js.map +0 -1
- package/lib/esm/lib/api/middlewares/auth-no-refresh-middleware.js.map +0 -1
- package/lib/esm/lib/utils/get-by-path.js.map +0 -1
- package/lib/esm/lib/utils/set-by-path.js.map +0 -1
- /package/lib/esm/lib/api/{auth → oauth}/user.js +0 -0
- /package/lib/esm/lib/{utils → lodash}/get-by-path.js +0 -0
- /package/lib/esm/lib/{utils → lodash}/set-by-path.js +0 -0
package/lib/cjs/index.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const get = require('lodash/get');
|
|
6
5
|
const dayjs = require('dayjs');
|
|
7
6
|
const todayPlugin = require('dayjs/plugin/isToday');
|
|
8
7
|
const tomorrowPlugin = require('dayjs/plugin/isTomorrow');
|
|
9
8
|
const yesterdayPlugin = require('dayjs/plugin/isYesterday');
|
|
9
|
+
const get = require('lodash/get');
|
|
10
10
|
const set = require('lodash/set');
|
|
11
11
|
|
|
12
12
|
const DATE_TYPES = {
|
|
@@ -19,8 +19,7 @@ const DATE_TYPES = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const API_MIDDLEWARES = {
|
|
22
|
-
|
|
23
|
-
AuthNoRefresh: "authNoRefresh",
|
|
22
|
+
Oauth: "oauth",
|
|
24
23
|
Logger: "logger",
|
|
25
24
|
};
|
|
26
25
|
const POST_API_MIDDLEWARES = {
|
|
@@ -71,61 +70,6 @@ const waitUntil = (condition, checkInterval = 100) => {
|
|
|
71
70
|
});
|
|
72
71
|
};
|
|
73
72
|
|
|
74
|
-
function checkType(value, condition) {
|
|
75
|
-
if (condition) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function isArray(value) {
|
|
82
|
-
return Boolean(value && Array.isArray(value));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function isBoolean(value) {
|
|
86
|
-
return typeof value === "boolean";
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function isNumber(value) {
|
|
90
|
-
return typeof value === "number" && !Number.isNaN(value);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function isString(value) {
|
|
94
|
-
return typeof value === "string";
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function isId(value) {
|
|
98
|
-
return isNumber(value) || isString(value);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function isNull(value) {
|
|
102
|
-
return value === null;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function isNullable(value) {
|
|
106
|
-
return typeof value === "undefined" || value === null;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function isObject(value) {
|
|
110
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function isUndefined(value) {
|
|
114
|
-
return typeof value === "undefined";
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function isDate(value) {
|
|
118
|
-
if (value instanceof Date)
|
|
119
|
-
return !Number.isNaN(value.valueOf());
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function getByPath(data, path, defaultValue) {
|
|
124
|
-
if ((!isObject(data) && !isArray(data)) || !isString(path))
|
|
125
|
-
return defaultValue;
|
|
126
|
-
return get(data, path, defaultValue);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
73
|
function dateDifference({ firstDate, float = false, secondDate = new Date(), type, }) {
|
|
130
74
|
const first = dayjs(firstDate);
|
|
131
75
|
return first.diff(secondDate, type, float);
|
|
@@ -222,6 +166,60 @@ function isYesterday(date) {
|
|
|
222
166
|
}
|
|
223
167
|
}
|
|
224
168
|
|
|
169
|
+
function checkType(value, condition) {
|
|
170
|
+
if (condition) {
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function isArray(value) {
|
|
177
|
+
return Boolean(value && Array.isArray(value));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function isBoolean(value) {
|
|
181
|
+
return typeof value === "boolean";
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function isNumber(value) {
|
|
185
|
+
return typeof value === "number" && !Number.isNaN(value);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function isString(value) {
|
|
189
|
+
return typeof value === "string";
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function isId(value) {
|
|
193
|
+
return isNumber(value) || isString(value);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function isNull(value) {
|
|
197
|
+
return value === null;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function isNullable(value) {
|
|
201
|
+
return typeof value === "undefined" || value === null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function isObject(value) {
|
|
205
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function isUndefined(value) {
|
|
209
|
+
return typeof value === "undefined";
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function isDate(value) {
|
|
213
|
+
if (value instanceof Date)
|
|
214
|
+
return !Number.isNaN(value.valueOf());
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function isPrimitive(value) {
|
|
219
|
+
const type = typeof value;
|
|
220
|
+
return value == undefined || (type != "object" && type != "function");
|
|
221
|
+
}
|
|
222
|
+
|
|
225
223
|
function dateFormat(date, format) {
|
|
226
224
|
const correctDate = new Date(date);
|
|
227
225
|
if (!isDate(correctDate))
|
|
@@ -274,17 +272,6 @@ function fieldViewFormat(field, type = "string") {
|
|
|
274
272
|
}
|
|
275
273
|
}
|
|
276
274
|
|
|
277
|
-
function setByPath(data, path, value) {
|
|
278
|
-
try {
|
|
279
|
-
if (!isObject(data) && !isArray(data))
|
|
280
|
-
throw new Error("bad data");
|
|
281
|
-
set(data, path, value);
|
|
282
|
-
}
|
|
283
|
-
catch (error) {
|
|
284
|
-
console.warn(error);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
275
|
function jsonParse(json) {
|
|
289
276
|
if (!isString(json))
|
|
290
277
|
return null;
|
|
@@ -356,6 +343,23 @@ function arrayToMapByKey(array, key) {
|
|
|
356
343
|
return map;
|
|
357
344
|
}
|
|
358
345
|
|
|
346
|
+
function getByPath(data, path, defaultValue) {
|
|
347
|
+
if ((!isObject(data) && !isArray(data)) || !isString(path))
|
|
348
|
+
return defaultValue;
|
|
349
|
+
return get(data, path, defaultValue);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function setByPath(data, path, value) {
|
|
353
|
+
try {
|
|
354
|
+
if (!isObject(data) && !isArray(data))
|
|
355
|
+
throw new Error("bad data");
|
|
356
|
+
set(data, path, value);
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
console.warn(error);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
359
363
|
function syncObjectValues(oldObj, newObj, exception = []) {
|
|
360
364
|
for (const field in newObj) {
|
|
361
365
|
if (exception.includes(field))
|
|
@@ -667,6 +671,18 @@ function createLocalIdGenerator() {
|
|
|
667
671
|
};
|
|
668
672
|
}
|
|
669
673
|
|
|
674
|
+
function declination(value, words) {
|
|
675
|
+
value = Math.abs(value) % 100;
|
|
676
|
+
const num = value % 10;
|
|
677
|
+
if (value > 10 && value < 20)
|
|
678
|
+
return words[2];
|
|
679
|
+
if (num > 1 && num < 5)
|
|
680
|
+
return words[1];
|
|
681
|
+
if (num == 1)
|
|
682
|
+
return words[0];
|
|
683
|
+
return words[2];
|
|
684
|
+
}
|
|
685
|
+
|
|
670
686
|
function downloadFile({ data, fileName, mimeType }) {
|
|
671
687
|
if (!IS_BROWSER && !IS_JEST)
|
|
672
688
|
return null;
|
|
@@ -1242,93 +1258,179 @@ function execAnimation(element, className, autoCloseDelay = 700) {
|
|
|
1242
1258
|
});
|
|
1243
1259
|
}
|
|
1244
1260
|
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
if (!token || !expires || Date.now() > +expires) {
|
|
1251
|
-
token = await (options.tokenRequest ? options.tokenRequest() : getAuthToken(options));
|
|
1252
|
-
if (isNull(token)) {
|
|
1253
|
-
return void window.location.replace(typeof options.oauthUrl === "function" ? options.oauthUrl() : options.oauthUrl);
|
|
1254
|
-
}
|
|
1255
|
-
if (isUndefined(token)) {
|
|
1256
|
-
return void window.location.replace(typeof options.errorUrl === "function" ? options.errorUrl() : options.errorUrl);
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
return token;
|
|
1260
|
-
}
|
|
1261
|
-
async function getAuthToken(options) {
|
|
1262
|
-
let status = 0;
|
|
1263
|
-
try {
|
|
1264
|
-
const response = await fetch(options.authTokenUrl, {
|
|
1265
|
-
method: "GET",
|
|
1266
|
-
});
|
|
1267
|
-
status = response.status;
|
|
1268
|
-
if (!response.ok) {
|
|
1269
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
1261
|
+
function copyToClipboard(textToCopy) {
|
|
1262
|
+
return new Promise((resolve) => {
|
|
1263
|
+
if (!IS_BROWSER && !IS_JEST) {
|
|
1264
|
+
resolve(false);
|
|
1265
|
+
return;
|
|
1270
1266
|
}
|
|
1271
|
-
const result = (await response.json());
|
|
1272
1267
|
try {
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1268
|
+
if (navigator.clipboard && window.isSecureContext) {
|
|
1269
|
+
navigator.clipboard
|
|
1270
|
+
.writeText(textToCopy)
|
|
1271
|
+
.then(() => resolve(true))
|
|
1272
|
+
.catch(() => resolve(false));
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
const textArea = document.createElement("textarea");
|
|
1276
|
+
textArea.value = textToCopy;
|
|
1277
|
+
textArea.style.position = "fixed";
|
|
1278
|
+
textArea.style.left = "-999999px";
|
|
1279
|
+
textArea.style.top = "-999999px";
|
|
1280
|
+
document.body.appendChild(textArea);
|
|
1281
|
+
textArea.focus();
|
|
1282
|
+
textArea.select();
|
|
1283
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1284
|
+
const result = document.execCommand("copy");
|
|
1285
|
+
textArea.remove();
|
|
1286
|
+
resolve(result);
|
|
1277
1287
|
}
|
|
1278
1288
|
catch {
|
|
1279
|
-
|
|
1289
|
+
resolve(false);
|
|
1280
1290
|
}
|
|
1281
|
-
}
|
|
1282
|
-
catch {
|
|
1283
|
-
if (status >= 500)
|
|
1284
|
-
return undefined;
|
|
1285
|
-
return null;
|
|
1286
|
-
}
|
|
1291
|
+
});
|
|
1287
1292
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1293
|
+
|
|
1294
|
+
function extractQueries() {
|
|
1295
|
+
const queryMap = {};
|
|
1296
|
+
if (!IS_BROWSER && !IS_JEST)
|
|
1297
|
+
return queryMap;
|
|
1298
|
+
const queryString = document.location.search;
|
|
1299
|
+
queryString
|
|
1300
|
+
.replace(/^\?/, "")
|
|
1301
|
+
.split("&")
|
|
1302
|
+
.forEach((query) => {
|
|
1303
|
+
const [key, value] = query.split("=", 2);
|
|
1304
|
+
queryMap[key] ??= [];
|
|
1305
|
+
const prev = queryMap[key];
|
|
1306
|
+
prev.push(value);
|
|
1307
|
+
});
|
|
1308
|
+
return queryMap;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
const RESPONSE_DATA_SYMBOL = Symbol("response data");
|
|
1312
|
+
|
|
1313
|
+
function generateConsoleMiddleware(options = {}) {
|
|
1314
|
+
return (request) => {
|
|
1315
|
+
return new Promise((resolve) => {
|
|
1316
|
+
if ((options.filter &&
|
|
1317
|
+
!options.filter(request)) ||
|
|
1318
|
+
(options.filterHeaders && !options.filterHeaders(request.headers)) ||
|
|
1319
|
+
(options.filterMethod && !options.filterMethod(request.method)) ||
|
|
1320
|
+
(options.filterParams && !options.filterParams(request.params)) ||
|
|
1321
|
+
(options.filterPath && !options.filterPath(request.path))) {
|
|
1322
|
+
resolve(true);
|
|
1323
|
+
return;
|
|
1324
|
+
}
|
|
1325
|
+
// eslint-disable-next-line no-console
|
|
1326
|
+
console.log(request);
|
|
1327
|
+
resolve(true);
|
|
1328
|
+
});
|
|
1329
|
+
};
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
function generateConsolePostMiddleware(options = {}) {
|
|
1333
|
+
return (response) => {
|
|
1334
|
+
return new Promise((resolve) => {
|
|
1335
|
+
void (async function logger() {
|
|
1336
|
+
try {
|
|
1337
|
+
if (!response ||
|
|
1338
|
+
(options.filter && !options.filter(response)) ||
|
|
1339
|
+
(options.filterStatus && !options.filterStatus(response.status)) ||
|
|
1340
|
+
(options.filterUrl && !options.filterUrl(response.url)) ||
|
|
1341
|
+
(options.filterHeaders && !options.filterHeaders(response.headers))) {
|
|
1342
|
+
resolve(true);
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
const contentType = response.headers.get("content-type");
|
|
1346
|
+
let result;
|
|
1347
|
+
if (contentType?.includes?.("text")) {
|
|
1348
|
+
result = await response.text();
|
|
1349
|
+
}
|
|
1350
|
+
else if (contentType?.includes?.("json")) {
|
|
1351
|
+
result = await response.json();
|
|
1352
|
+
}
|
|
1353
|
+
else {
|
|
1354
|
+
result = await response.blob();
|
|
1355
|
+
}
|
|
1356
|
+
Object.defineProperty(response, RESPONSE_DATA_SYMBOL, {
|
|
1357
|
+
value: result,
|
|
1358
|
+
writable: false,
|
|
1359
|
+
enumerable: false,
|
|
1360
|
+
configurable: true,
|
|
1361
|
+
});
|
|
1362
|
+
console.log({
|
|
1363
|
+
url: response.url,
|
|
1364
|
+
status: response.status,
|
|
1365
|
+
headers: response.headers,
|
|
1366
|
+
body: result,
|
|
1367
|
+
});
|
|
1368
|
+
resolve(true);
|
|
1369
|
+
}
|
|
1370
|
+
catch {
|
|
1371
|
+
if (response) {
|
|
1372
|
+
console.log({ url: response.url, status: response.status, headers: response.headers });
|
|
1373
|
+
}
|
|
1374
|
+
resolve(true);
|
|
1375
|
+
}
|
|
1376
|
+
})().finally(() => {
|
|
1377
|
+
resolve(true);
|
|
1378
|
+
});
|
|
1379
|
+
});
|
|
1298
1380
|
};
|
|
1299
1381
|
}
|
|
1300
|
-
|
|
1301
|
-
|
|
1382
|
+
|
|
1383
|
+
let waiting = false;
|
|
1384
|
+
async function getOauthTokenFromOtherWindow(options) {
|
|
1385
|
+
await waitUntil(() => waiting);
|
|
1386
|
+
const expires = localStorage.getItem(options.expiresTokenStorageName);
|
|
1387
|
+
if (expires != undefined && !Number.isNaN(+expires) && Date.now() < +expires)
|
|
1388
|
+
return;
|
|
1389
|
+
waiting = true;
|
|
1302
1390
|
const url = new URL(typeof options.refreshTokenWindowUrl === "function"
|
|
1303
1391
|
? options.refreshTokenWindowUrl()
|
|
1304
1392
|
: (options.refreshTokenWindowUrl ?? window.origin));
|
|
1305
1393
|
url.searchParams.append(options.onlyRefreshTokenWindowQueryName, "true");
|
|
1306
1394
|
let windowInstance = window.open(url.toString(), "_blank", "width=800,height=600,left=100,top=100");
|
|
1307
|
-
windowInstance ??= window.open(url.toString());
|
|
1308
|
-
if (
|
|
1395
|
+
windowInstance ??= window.open(url.toString(), "_blank");
|
|
1396
|
+
if (windowInstance) {
|
|
1397
|
+
const channel = new BroadcastChannel(options.onlyRefreshTokenWindowQueryName);
|
|
1398
|
+
const windowCloseObserver = setInterval(() => {
|
|
1399
|
+
if (windowInstance.closed) {
|
|
1400
|
+
if (waiting) {
|
|
1401
|
+
waiting = false;
|
|
1402
|
+
channel.close();
|
|
1403
|
+
clearInterval(windowCloseObserver);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}, options.closeObserveInterval ?? 500);
|
|
1407
|
+
channel.onmessage = () => {
|
|
1408
|
+
if (waiting) {
|
|
1409
|
+
waiting = false;
|
|
1410
|
+
channel.close();
|
|
1411
|
+
clearInterval(windowCloseObserver);
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
setTimeout(() => {
|
|
1415
|
+
if (waiting) {
|
|
1416
|
+
waiting = false;
|
|
1417
|
+
channel.close();
|
|
1418
|
+
clearInterval(windowCloseObserver);
|
|
1419
|
+
}
|
|
1420
|
+
if (windowInstance && !windowInstance.closed) {
|
|
1421
|
+
windowInstance.close();
|
|
1422
|
+
}
|
|
1423
|
+
}, options.wait ?? 15000);
|
|
1424
|
+
}
|
|
1425
|
+
else {
|
|
1309
1426
|
if (options.onWindowOpenError)
|
|
1310
1427
|
options.onWindowOpenError();
|
|
1428
|
+
waiting = false;
|
|
1311
1429
|
return;
|
|
1312
1430
|
}
|
|
1313
|
-
const channel = new BroadcastChannel(options.onlyRefreshTokenWindowQueryName);
|
|
1314
|
-
channel.onmessage = () => {
|
|
1315
|
-
if (waiting) {
|
|
1316
|
-
waiting = false;
|
|
1317
|
-
channel.close();
|
|
1318
|
-
}
|
|
1319
|
-
};
|
|
1320
|
-
setTimeout(() => {
|
|
1321
|
-
if (waiting) {
|
|
1322
|
-
waiting = false;
|
|
1323
|
-
channel.close();
|
|
1324
|
-
}
|
|
1325
|
-
if (windowInstance && !windowInstance.closed) {
|
|
1326
|
-
windowInstance.close();
|
|
1327
|
-
}
|
|
1328
|
-
}, 15000);
|
|
1329
1431
|
await waitUntil(() => waiting);
|
|
1330
1432
|
}
|
|
1331
|
-
function
|
|
1433
|
+
function getOauthToken(options) {
|
|
1332
1434
|
let expires = localStorage.getItem(options.expiresTokenStorageName);
|
|
1333
1435
|
if (!expires || Number.isNaN(+expires) || Date.now() > +expires)
|
|
1334
1436
|
expires = null;
|
|
@@ -1409,50 +1511,8 @@ async function getAuthUser(options) {
|
|
|
1409
1511
|
}
|
|
1410
1512
|
}
|
|
1411
1513
|
|
|
1412
|
-
let isFetchingAccessToken$1 = false;
|
|
1413
|
-
const generateAuthMiddleWare = (options) => async (request) => {
|
|
1414
|
-
if (!options.authTokenUrl ||
|
|
1415
|
-
!options.oauthUrl ||
|
|
1416
|
-
!options.expiresTokenStorageName ||
|
|
1417
|
-
!options.tokenStorageName ||
|
|
1418
|
-
!options.pathToTokenExpires ||
|
|
1419
|
-
!options.pathToToken ||
|
|
1420
|
-
!options.errorUrl) {
|
|
1421
|
-
throw new Error("Auth middleware hasn't required options");
|
|
1422
|
-
}
|
|
1423
|
-
const isSameOrigin = !startWith(request.path, "http");
|
|
1424
|
-
if (request.token) {
|
|
1425
|
-
if (!isSameOrigin)
|
|
1426
|
-
request.headers = {
|
|
1427
|
-
...request.headers,
|
|
1428
|
-
Authorization: `Bearer ${request.token}`,
|
|
1429
|
-
};
|
|
1430
|
-
return;
|
|
1431
|
-
}
|
|
1432
|
-
if (isFetchingAccessToken$1)
|
|
1433
|
-
await waitUntil(() => isFetchingAccessToken$1);
|
|
1434
|
-
const expires = localStorage.getItem(options.expiresTokenStorageName);
|
|
1435
|
-
let token = localStorage.getItem(options.tokenStorageName);
|
|
1436
|
-
if (!expires || Date.now() > +expires || !token) {
|
|
1437
|
-
isFetchingAccessToken$1 = true;
|
|
1438
|
-
token = await (options.tokenRequest ? options.tokenRequest() : getAuthToken(options));
|
|
1439
|
-
isFetchingAccessToken$1 = false;
|
|
1440
|
-
if (isNull(token)) {
|
|
1441
|
-
return void window.location.replace(typeof options.oauthUrl === "function" ? options.oauthUrl() : options.oauthUrl);
|
|
1442
|
-
}
|
|
1443
|
-
if (isUndefined(token)) {
|
|
1444
|
-
return void window.location.replace(typeof options.errorUrl === "function" ? options.errorUrl() : options.errorUrl);
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
if (!isSameOrigin)
|
|
1448
|
-
request.headers = {
|
|
1449
|
-
...request.headers,
|
|
1450
|
-
Authorization: `Bearer ${token}`,
|
|
1451
|
-
};
|
|
1452
|
-
};
|
|
1453
|
-
|
|
1454
1514
|
let isFetchingAccessToken = false;
|
|
1455
|
-
const
|
|
1515
|
+
const generateOauthMiddleware = (options) => async (request) => {
|
|
1456
1516
|
if (!options.oauthUrl || !options.expiresTokenStorageName || !options.errorUrl) {
|
|
1457
1517
|
throw new Error("Auth middleware hasn't required options");
|
|
1458
1518
|
}
|
|
@@ -1468,12 +1528,25 @@ const generateAuthNoRefreshMiddleWare = (options) => async (request) => {
|
|
|
1468
1528
|
if (isFetchingAccessToken)
|
|
1469
1529
|
await waitUntil(() => isFetchingAccessToken);
|
|
1470
1530
|
const expires = localStorage.getItem(options.expiresTokenStorageName);
|
|
1531
|
+
let token;
|
|
1471
1532
|
if (!expires || Number.isNaN(+expires) || Date.now() > +expires) {
|
|
1472
1533
|
isFetchingAccessToken = true;
|
|
1473
|
-
await (
|
|
1534
|
+
await getOauthTokenFromOtherWindow({
|
|
1535
|
+
onlyRefreshTokenWindowQueryName: options.onlyRefreshTokenWindowQueryName,
|
|
1536
|
+
onWindowOpenError: options.onWindowOpenError,
|
|
1537
|
+
refreshTokenWindowUrl: options.refreshTokenWindowUrl,
|
|
1538
|
+
wait: options.wait,
|
|
1539
|
+
expiresTokenStorageName: options.expiresTokenStorageName,
|
|
1540
|
+
closeObserveInterval: options.closeObserveInterval,
|
|
1541
|
+
});
|
|
1542
|
+
if (options.tokenRequest) {
|
|
1543
|
+
token = await options.tokenRequest();
|
|
1544
|
+
if (token != undefined && options.tokenStorageName) {
|
|
1545
|
+
localStorage.setItem(options.tokenStorageName, token);
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1474
1548
|
isFetchingAccessToken = false;
|
|
1475
1549
|
}
|
|
1476
|
-
const token = options.tokenStorageName ? localStorage.getItem(options.tokenStorageName) : null;
|
|
1477
1550
|
if (!isSameOrigin && token)
|
|
1478
1551
|
request.headers = {
|
|
1479
1552
|
...request.headers,
|
|
@@ -1481,88 +1554,13 @@ const generateAuthNoRefreshMiddleWare = (options) => async (request) => {
|
|
|
1481
1554
|
};
|
|
1482
1555
|
};
|
|
1483
1556
|
|
|
1484
|
-
function generateConsoleMiddleware(options = {}) {
|
|
1485
|
-
return (request) => {
|
|
1486
|
-
return new Promise((resolve) => {
|
|
1487
|
-
if ((options.filter &&
|
|
1488
|
-
!options.filter(request)) ||
|
|
1489
|
-
(options.filterHeaders && !options.filterHeaders(request.headers)) ||
|
|
1490
|
-
(options.filterMethod && !options.filterMethod(request.method)) ||
|
|
1491
|
-
(options.filterParams && !options.filterParams(request.params)) ||
|
|
1492
|
-
(options.filterPath && !options.filterPath(request.path))) {
|
|
1493
|
-
resolve(true);
|
|
1494
|
-
return;
|
|
1495
|
-
}
|
|
1496
|
-
// eslint-disable-next-line no-console
|
|
1497
|
-
console.log(request);
|
|
1498
|
-
resolve(true);
|
|
1499
|
-
});
|
|
1500
|
-
};
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
|
-
function generateConsolePostMiddleware(options = {}) {
|
|
1504
|
-
return (response) => {
|
|
1505
|
-
return new Promise((resolve) => {
|
|
1506
|
-
void (async function logger() {
|
|
1507
|
-
try {
|
|
1508
|
-
if (!response ||
|
|
1509
|
-
(options.filter && !options.filter(response)) ||
|
|
1510
|
-
(options.filterStatus && !options.filterStatus(response.status)) ||
|
|
1511
|
-
(options.filterUrl && !options.filterUrl(response.url)) ||
|
|
1512
|
-
(options.filterHeaders && !options.filterHeaders(response.headers))) {
|
|
1513
|
-
resolve(true);
|
|
1514
|
-
return;
|
|
1515
|
-
}
|
|
1516
|
-
const contentType = response.headers.get("content-type");
|
|
1517
|
-
let result;
|
|
1518
|
-
if (contentType?.includes?.("text")) {
|
|
1519
|
-
result = await response.text();
|
|
1520
|
-
}
|
|
1521
|
-
else if (contentType?.includes?.("json")) {
|
|
1522
|
-
result = await response.json();
|
|
1523
|
-
}
|
|
1524
|
-
else {
|
|
1525
|
-
result = await response.blob();
|
|
1526
|
-
}
|
|
1527
|
-
Object.defineProperty(response, RESPONSE_DATA_SYMBOL, {
|
|
1528
|
-
value: result,
|
|
1529
|
-
writable: false,
|
|
1530
|
-
enumerable: false,
|
|
1531
|
-
configurable: true,
|
|
1532
|
-
});
|
|
1533
|
-
console.log({
|
|
1534
|
-
url: response.url,
|
|
1535
|
-
status: response.status,
|
|
1536
|
-
headers: response.headers,
|
|
1537
|
-
body: result,
|
|
1538
|
-
});
|
|
1539
|
-
resolve(true);
|
|
1540
|
-
}
|
|
1541
|
-
catch {
|
|
1542
|
-
if (response) {
|
|
1543
|
-
console.log({ url: response.url, status: response.status, headers: response.headers });
|
|
1544
|
-
}
|
|
1545
|
-
resolve(true);
|
|
1546
|
-
}
|
|
1547
|
-
})().finally(() => {
|
|
1548
|
-
resolve(true);
|
|
1549
|
-
});
|
|
1550
|
-
});
|
|
1551
|
-
};
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
1557
|
function generateMiddlewares(activeMiddlewares, middlewareOptions, customMiddlewares) {
|
|
1555
1558
|
const selectedMiddlewares = customMiddlewares;
|
|
1556
1559
|
for (const key of activeMiddlewares) {
|
|
1557
1560
|
switch (key) {
|
|
1558
|
-
case API_MIDDLEWARES.
|
|
1559
|
-
if (middlewareOptions.
|
|
1560
|
-
selectedMiddlewares.push(
|
|
1561
|
-
continue;
|
|
1562
|
-
}
|
|
1563
|
-
case API_MIDDLEWARES.AuthNoRefresh: {
|
|
1564
|
-
if (middlewareOptions.authNoRefresh && (IS_BROWSER || IS_JEST))
|
|
1565
|
-
selectedMiddlewares.push(generateAuthNoRefreshMiddleWare(middlewareOptions.authNoRefresh));
|
|
1561
|
+
case API_MIDDLEWARES.Oauth: {
|
|
1562
|
+
if (middlewareOptions.oauth && (IS_BROWSER || IS_JEST))
|
|
1563
|
+
selectedMiddlewares.push(generateOauthMiddleware(middlewareOptions.oauth));
|
|
1566
1564
|
continue;
|
|
1567
1565
|
}
|
|
1568
1566
|
case API_MIDDLEWARES.Logger: {
|
|
@@ -1865,6 +1863,211 @@ function getRandomColor() {
|
|
|
1865
1863
|
return `#${randomColor.padStart(6, "0")}`;
|
|
1866
1864
|
}
|
|
1867
1865
|
|
|
1866
|
+
function type(value) {
|
|
1867
|
+
return value === null
|
|
1868
|
+
? "Null"
|
|
1869
|
+
: value === undefined
|
|
1870
|
+
? "Undefined"
|
|
1871
|
+
: Object.prototype.toString.call(value).slice(8, -1);
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
1875
|
+
function cloneDeep(value, map) {
|
|
1876
|
+
map ??= new Map();
|
|
1877
|
+
// this avoids the slower switch with a quick if decision removing some milliseconds in each run.
|
|
1878
|
+
if (isPrimitive(value)) {
|
|
1879
|
+
return value;
|
|
1880
|
+
}
|
|
1881
|
+
function copy(copiedValue) {
|
|
1882
|
+
// Check for circular and same references on the object graph and return its corresponding clone.
|
|
1883
|
+
const cachedCopy = map.get(value);
|
|
1884
|
+
if (cachedCopy) {
|
|
1885
|
+
return cachedCopy;
|
|
1886
|
+
}
|
|
1887
|
+
map.set(value, copiedValue);
|
|
1888
|
+
for (const key in value) {
|
|
1889
|
+
if (Object.hasOwn(value, key)) {
|
|
1890
|
+
copiedValue[key] = cloneDeep(value[key], map);
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
return copiedValue;
|
|
1894
|
+
}
|
|
1895
|
+
switch (type(value)) {
|
|
1896
|
+
case "Object":
|
|
1897
|
+
return copy(Object.create(Object.getPrototypeOf(value)));
|
|
1898
|
+
case "Array":
|
|
1899
|
+
return copy(Array(value.length));
|
|
1900
|
+
case "Date":
|
|
1901
|
+
return new Date(value.valueOf());
|
|
1902
|
+
case "RegExp":
|
|
1903
|
+
return cloneRegExp(value);
|
|
1904
|
+
case "Int8Array":
|
|
1905
|
+
case "Uint8Array":
|
|
1906
|
+
case "Uint8ClampedArray":
|
|
1907
|
+
case "Int16Array":
|
|
1908
|
+
case "Uint16Array":
|
|
1909
|
+
case "Int32Array":
|
|
1910
|
+
case "Uint32Array":
|
|
1911
|
+
case "Float32Array":
|
|
1912
|
+
case "Float64Array":
|
|
1913
|
+
case "BigInt64Array":
|
|
1914
|
+
case "BigUint64Array":
|
|
1915
|
+
return value.slice();
|
|
1916
|
+
default:
|
|
1917
|
+
return value;
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
function cloneRegExp(pattern) {
|
|
1921
|
+
return new RegExp(pattern.source, pattern.flags
|
|
1922
|
+
? pattern.flags
|
|
1923
|
+
: (pattern.global ? "g" : "") +
|
|
1924
|
+
(pattern.ignoreCase ? "i" : "") +
|
|
1925
|
+
(pattern.multiline ? "m" : "") +
|
|
1926
|
+
(pattern.sticky ? "y" : "") +
|
|
1927
|
+
(pattern.unicode ? "u" : "") +
|
|
1928
|
+
(pattern.dotAll ? "s" : ""));
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1932
|
+
function debounce({ delay }, func) {
|
|
1933
|
+
let timer;
|
|
1934
|
+
let active = true;
|
|
1935
|
+
const debounced = (...args) => {
|
|
1936
|
+
if (active) {
|
|
1937
|
+
clearTimeout(timer);
|
|
1938
|
+
timer = setTimeout(() => {
|
|
1939
|
+
if (active) {
|
|
1940
|
+
func(...args);
|
|
1941
|
+
}
|
|
1942
|
+
timer = undefined;
|
|
1943
|
+
}, delay);
|
|
1944
|
+
}
|
|
1945
|
+
else {
|
|
1946
|
+
func(...args);
|
|
1947
|
+
}
|
|
1948
|
+
};
|
|
1949
|
+
debounced.isPending = () => {
|
|
1950
|
+
return timer !== undefined;
|
|
1951
|
+
};
|
|
1952
|
+
debounced.cancel = () => {
|
|
1953
|
+
active = false;
|
|
1954
|
+
};
|
|
1955
|
+
debounced.flush = (...args) => {
|
|
1956
|
+
func(...args);
|
|
1957
|
+
};
|
|
1958
|
+
return debounced;
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
function difference(first, second) {
|
|
1962
|
+
let idx = 0;
|
|
1963
|
+
const out = [];
|
|
1964
|
+
const toFilterOut = new Set();
|
|
1965
|
+
for (let i = 0; i < second.length; i += 1) {
|
|
1966
|
+
toFilterOut.add(second[i]);
|
|
1967
|
+
}
|
|
1968
|
+
while (idx < first.length) {
|
|
1969
|
+
if (!toFilterOut.has(first[idx])) {
|
|
1970
|
+
out[out.length] = first[idx];
|
|
1971
|
+
}
|
|
1972
|
+
idx += 1;
|
|
1973
|
+
}
|
|
1974
|
+
return out;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
function differenceBy(first, second, key) {
|
|
1978
|
+
let idx = 0;
|
|
1979
|
+
const out = [];
|
|
1980
|
+
const toFilterOut = new Set();
|
|
1981
|
+
for (let i = 0; i < second.length; i += 1) {
|
|
1982
|
+
toFilterOut.add(second[i][key]);
|
|
1983
|
+
}
|
|
1984
|
+
while (idx < first.length) {
|
|
1985
|
+
if (!toFilterOut.has(first[idx][key])) {
|
|
1986
|
+
out.push(first[idx]);
|
|
1987
|
+
}
|
|
1988
|
+
idx += 1;
|
|
1989
|
+
}
|
|
1990
|
+
return out;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
function differenceWith(first, second, extractPrimitive) {
|
|
1994
|
+
let idx = 0;
|
|
1995
|
+
const out = [];
|
|
1996
|
+
const toFilterOut = new Set();
|
|
1997
|
+
for (let i = 0; i < second.length; i += 1) {
|
|
1998
|
+
toFilterOut.add(extractPrimitive(second[i]));
|
|
1999
|
+
}
|
|
2000
|
+
while (idx < first.length) {
|
|
2001
|
+
if (!toFilterOut.has(extractPrimitive(first[idx]))) {
|
|
2002
|
+
out.push(first[idx]);
|
|
2003
|
+
}
|
|
2004
|
+
idx += 1;
|
|
2005
|
+
}
|
|
2006
|
+
return out;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
function isEqual(aVal, bVal) {
|
|
2010
|
+
if (aVal === bVal)
|
|
2011
|
+
return true;
|
|
2012
|
+
if (aVal == undefined ||
|
|
2013
|
+
bVal == undefined ||
|
|
2014
|
+
typeof aVal !== "object" ||
|
|
2015
|
+
typeof bVal !== "object") {
|
|
2016
|
+
return aVal === bVal;
|
|
2017
|
+
}
|
|
2018
|
+
if (aVal instanceof Date && bVal instanceof Date) {
|
|
2019
|
+
return aVal.getTime() === bVal.getTime();
|
|
2020
|
+
}
|
|
2021
|
+
if (aVal instanceof RegExp && bVal instanceof RegExp) {
|
|
2022
|
+
return aVal.toString() === bVal.toString();
|
|
2023
|
+
}
|
|
2024
|
+
if (aVal.constructor !== bVal.constructor) {
|
|
2025
|
+
return false;
|
|
2026
|
+
}
|
|
2027
|
+
if (Array.isArray(aVal) && Array.isArray(bVal)) {
|
|
2028
|
+
if (aVal.length !== bVal.length)
|
|
2029
|
+
return false;
|
|
2030
|
+
for (let i = 0; i < aVal.length; i++) {
|
|
2031
|
+
if (!isEqual(aVal[i], bVal[i]))
|
|
2032
|
+
return false;
|
|
2033
|
+
}
|
|
2034
|
+
return true;
|
|
2035
|
+
}
|
|
2036
|
+
if (isObject(aVal) && isObject(bVal)) {
|
|
2037
|
+
const keysA = Object.keys(aVal);
|
|
2038
|
+
const keysB = Object.keys(bVal);
|
|
2039
|
+
if (keysA.length !== keysB.length)
|
|
2040
|
+
return false;
|
|
2041
|
+
for (const key of keysA) {
|
|
2042
|
+
if (!keysB.includes(key))
|
|
2043
|
+
return false;
|
|
2044
|
+
if (!isEqual(aVal[key], bVal[key]))
|
|
2045
|
+
return false;
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
return true;
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2052
|
+
function throttle({ interval }, func) {
|
|
2053
|
+
let ready = true;
|
|
2054
|
+
let timer;
|
|
2055
|
+
const throttled = (...args) => {
|
|
2056
|
+
if (!ready)
|
|
2057
|
+
return;
|
|
2058
|
+
func(...args);
|
|
2059
|
+
ready = false;
|
|
2060
|
+
timer = setTimeout(() => {
|
|
2061
|
+
ready = true;
|
|
2062
|
+
timer = undefined;
|
|
2063
|
+
}, interval);
|
|
2064
|
+
};
|
|
2065
|
+
throttled.isThrottled = () => {
|
|
2066
|
+
return timer !== undefined;
|
|
2067
|
+
};
|
|
2068
|
+
return throttled;
|
|
2069
|
+
}
|
|
2070
|
+
|
|
1868
2071
|
exports.API_MIDDLEWARES = API_MIDDLEWARES;
|
|
1869
2072
|
exports.COLOR_FORMATS = COLOR_FORMATS;
|
|
1870
2073
|
exports.DATE_TYPES = DATE_TYPES;
|
|
@@ -1880,24 +2083,32 @@ exports.ResponseError = ResponseError;
|
|
|
1880
2083
|
exports.arrayToMapByKey = arrayToMapByKey;
|
|
1881
2084
|
exports.buildQueryString = buildQueryString;
|
|
1882
2085
|
exports.checkType = checkType;
|
|
2086
|
+
exports.cloneDeep = cloneDeep;
|
|
2087
|
+
exports.copyToClipboard = copyToClipboard;
|
|
1883
2088
|
exports.createGlobalId = createGlobalId;
|
|
1884
2089
|
exports.createLocalIdGenerator = createLocalIdGenerator;
|
|
1885
2090
|
exports.createRequestClientInstance = createRequestClientInstance;
|
|
1886
2091
|
exports.createURLWithParams = createURLWithParams;
|
|
1887
2092
|
exports.dateDifference = dateDifference;
|
|
1888
2093
|
exports.dateFormat = dateFormat;
|
|
2094
|
+
exports.debounce = debounce;
|
|
2095
|
+
exports.declination = declination;
|
|
2096
|
+
exports.difference = difference;
|
|
2097
|
+
exports.differenceBy = differenceBy;
|
|
2098
|
+
exports.differenceWith = differenceWith;
|
|
1889
2099
|
exports.downloadFile = downloadFile;
|
|
1890
2100
|
exports.downloadJson = downloadJson;
|
|
1891
2101
|
exports.execAnimation = execAnimation;
|
|
2102
|
+
exports.extractQueries = extractQueries;
|
|
1892
2103
|
exports.fieldViewFormat = fieldViewFormat;
|
|
1893
|
-
exports.getAuthToken = getAuthToken;
|
|
1894
|
-
exports.getAuthTokenNoRefresh = getAuthTokenNoRefresh;
|
|
1895
2104
|
exports.getAuthUser = getAuthUser;
|
|
1896
2105
|
exports.getByPath = getByPath;
|
|
1897
2106
|
exports.getCallerFunctionName = getCallerFunctionName;
|
|
1898
2107
|
exports.getColorFormat = getColorFormat;
|
|
1899
2108
|
exports.getDateByRules = getDateByRules;
|
|
1900
2109
|
exports.getFileNameFromHeader = getFileNameFromHeader;
|
|
2110
|
+
exports.getOauthToken = getOauthToken;
|
|
2111
|
+
exports.getOauthTokenFromOtherWindow = getOauthTokenFromOtherWindow;
|
|
1901
2112
|
exports.getQueryValues = getQueryValues;
|
|
1902
2113
|
exports.getRandomColor = getRandomColor;
|
|
1903
2114
|
exports.getToday = getToday;
|
|
@@ -1907,11 +2118,13 @@ exports.getYesterday = getYesterday;
|
|
|
1907
2118
|
exports.isArray = isArray;
|
|
1908
2119
|
exports.isBoolean = isBoolean;
|
|
1909
2120
|
exports.isDate = isDate;
|
|
2121
|
+
exports.isEqual = isEqual;
|
|
1910
2122
|
exports.isId = isId;
|
|
1911
2123
|
exports.isNull = isNull;
|
|
1912
2124
|
exports.isNullable = isNullable;
|
|
1913
2125
|
exports.isNumber = isNumber;
|
|
1914
2126
|
exports.isObject = isObject;
|
|
2127
|
+
exports.isPrimitive = isPrimitive;
|
|
1915
2128
|
exports.isString = isString;
|
|
1916
2129
|
exports.isToday = isToday;
|
|
1917
2130
|
exports.isTomorrow = isTomorrow;
|
|
@@ -1928,6 +2141,7 @@ exports.speedTest = speedTest;
|
|
|
1928
2141
|
exports.startWith = startWith;
|
|
1929
2142
|
exports.syncObjectValues = syncObjectValues;
|
|
1930
2143
|
exports.takeOpacityColors = takeOpacityColors;
|
|
2144
|
+
exports.throttle = throttle;
|
|
1931
2145
|
exports.transformHEXtoRGB = transformHEXtoRGB;
|
|
1932
2146
|
exports.transformRGBAtoRGB = transformRGBAtoRGB;
|
|
1933
2147
|
exports.transformRGBtoRGBA = transformRGBtoRGBA;
|
|
@@ -1936,8 +2150,7 @@ exports.transformToDayjs = transformToDayjs;
|
|
|
1936
2150
|
exports.transformToNumber = transformToNumber;
|
|
1937
2151
|
exports.translit = translit;
|
|
1938
2152
|
exports.trimUrl = trimUrl;
|
|
1939
|
-
exports.
|
|
1940
|
-
exports.updateAuthTokenNoRefresh = updateAuthTokenNoRefresh;
|
|
2153
|
+
exports.type = type;
|
|
1941
2154
|
exports.updateAuthUser = updateAuthUser;
|
|
1942
2155
|
exports.wait = wait;
|
|
1943
2156
|
exports.waitUntil = waitUntil;
|