@twintag/twintag-core 0.2.274-fix-sdk-epsilon-e94c4df1523b746d22ba77839dbd528a55593a8f → 0.2.274-fix-sdk-epsilon-61992d282eaf364c7a0ee5e6c9769ff0e03e80d1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/twintag-offline-support.cjs.entry.js +87 -61
- package/dist/collection/components/twintag-offline-support/local-data.service.js +5 -5
- package/dist/collection/components/twintag-offline-support/twintag-offline-support.js +10 -9
- package/dist/collection/version.js +1 -1
- package/dist/components/twintag-offline-support.js +87 -61
- package/dist/esm/twintag-offline-support.entry.js +87 -61
- package/dist/stencil-web-components/{p-bb6d1221.entry.js → p-329d550e.entry.js} +1 -1
- package/dist/stencil-web-components/stencil-web-components.esm.js +1 -1
- package/dist/types/drone/src/libs/stencil-web-components/.stencil/libs/twintag-sdk/src/lib/epsilon.d.ts +7 -7
- package/dist/types/drone/src/libs/stencil-web-components/.stencil/libs/twintag-sdk/src/lib/version.d.ts +1 -1
- package/dist/types/drone/src/libs/stencil-web-components/.stencil/libs/twintag-sdk/src/lib/view.d.ts +19 -19
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/twintag-sdk/src/lib/environment.js +4 -4
- package/twintag-sdk/src/lib/epsilon.js +14 -10
- package/twintag-sdk/src/lib/version.js +1 -1
- package/twintag-sdk/src/lib/view.js +53 -32
|
@@ -206,7 +206,7 @@ class IndexedDbService {
|
|
|
206
206
|
/**
|
|
207
207
|
* The SDK version.
|
|
208
208
|
*/
|
|
209
|
-
const VERSION = '0.2.274-fix-sdk-epsilon-
|
|
209
|
+
const VERSION = '0.2.274-fix-sdk-epsilon-61992d282eaf364c7a0ee5e6c9769ff0e03e80d1';
|
|
210
210
|
|
|
211
211
|
class TwintagErrorValue {
|
|
212
212
|
}
|
|
@@ -395,10 +395,10 @@ class Environment {
|
|
|
395
395
|
var _a, _b;
|
|
396
396
|
if (!this.autoDetect)
|
|
397
397
|
return;
|
|
398
|
-
if (typeof window !== 'undefined'
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
398
|
+
if (typeof window !== 'undefined' &&
|
|
399
|
+
(window === null || window === void 0 ? void 0 : window.origin) !== undefined &&
|
|
400
|
+
((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.hostname) !== 'localhost' &&
|
|
401
|
+
((_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.hostname) !== '127.0.0.1') {
|
|
402
402
|
this._host = window.origin;
|
|
403
403
|
}
|
|
404
404
|
const base = new URL(this._host);
|
|
@@ -1035,7 +1035,13 @@ class View {
|
|
|
1035
1035
|
this._base.setToken(token);
|
|
1036
1036
|
}
|
|
1037
1037
|
fileURL(obj, qid, op, useCachingHost = false) {
|
|
1038
|
-
let url = (useCachingHost && this._base._useCaching
|
|
1038
|
+
let url = (useCachingHost && this._base._useCaching
|
|
1039
|
+
? environment.cachingHost
|
|
1040
|
+
: environment.host) +
|
|
1041
|
+
'/api/v1/views/' +
|
|
1042
|
+
this._base._qid +
|
|
1043
|
+
'/' +
|
|
1044
|
+
obj;
|
|
1039
1045
|
if (qid) {
|
|
1040
1046
|
url += '/' + qid;
|
|
1041
1047
|
}
|
|
@@ -1074,7 +1080,7 @@ class View {
|
|
|
1074
1080
|
mode: 420,
|
|
1075
1081
|
name: name ? name : f.name,
|
|
1076
1082
|
size: f.size,
|
|
1077
|
-
parent: parent ? parent : null
|
|
1083
|
+
parent: parent ? parent : null,
|
|
1078
1084
|
};
|
|
1079
1085
|
let url = await this.fileURLUpload('files');
|
|
1080
1086
|
const client = await this._base.client();
|
|
@@ -1140,7 +1146,10 @@ class View {
|
|
|
1140
1146
|
// TODO: support name & fileInfo
|
|
1141
1147
|
const url = this.fileURL('web', name);
|
|
1142
1148
|
const client = await this._base.client();
|
|
1143
|
-
const [res, err] = await client.do(url, {
|
|
1149
|
+
const [res, err] = await client.do(url, {
|
|
1150
|
+
method: 'get',
|
|
1151
|
+
headers: { 'Content-Type': 'application/octet-stream' },
|
|
1152
|
+
}, networkOnly(), true, true);
|
|
1144
1153
|
if (err) {
|
|
1145
1154
|
err.setMessage(`failed to download file from twintag`);
|
|
1146
1155
|
throw err;
|
|
@@ -1270,7 +1279,7 @@ class View {
|
|
|
1270
1279
|
rights: rights,
|
|
1271
1280
|
isCanocical: 1,
|
|
1272
1281
|
},
|
|
1273
|
-
bagStorageQid: this._base._data.bagQid
|
|
1282
|
+
bagStorageQid: this._base._data.bagQid,
|
|
1274
1283
|
};
|
|
1275
1284
|
const client = await this._base.client();
|
|
1276
1285
|
const [data, err] = await client.put(url, viewReq);
|
|
@@ -1309,12 +1318,12 @@ class View {
|
|
|
1309
1318
|
*/
|
|
1310
1319
|
async addFolder(folderName, folderParent) {
|
|
1311
1320
|
if (folderName.trim().length === 0) {
|
|
1312
|
-
throw new Error(
|
|
1321
|
+
throw new Error('Invalid folder name.');
|
|
1313
1322
|
}
|
|
1314
1323
|
const url = this.fileURL('folders');
|
|
1315
1324
|
const body = {
|
|
1316
1325
|
name: folderName,
|
|
1317
|
-
parent: folderParent ? folderParent : null
|
|
1326
|
+
parent: folderParent ? folderParent : null,
|
|
1318
1327
|
};
|
|
1319
1328
|
const client = await this._base.client();
|
|
1320
1329
|
const [res, err] = await client.put(url, body);
|
|
@@ -1350,7 +1359,7 @@ class View {
|
|
|
1350
1359
|
*/
|
|
1351
1360
|
async getMetadata(lang) {
|
|
1352
1361
|
let url = this.fileURL('data/metadata', undefined, undefined, true);
|
|
1353
|
-
url += lang ? `?language=${
|
|
1362
|
+
url += lang ? `?language=${lang === 'all' ? '*' : lang}` : '';
|
|
1354
1363
|
const client = await this._base.client();
|
|
1355
1364
|
const [res, err] = await client.get(url);
|
|
1356
1365
|
if (err) {
|
|
@@ -1371,7 +1380,9 @@ class View {
|
|
|
1371
1380
|
async setMetadata(data) {
|
|
1372
1381
|
const url = this.fileURL('data/metadata');
|
|
1373
1382
|
const client = await this._base.client();
|
|
1374
|
-
const [res, err] = await client.put(url, data, networkOnly(), {
|
|
1383
|
+
const [res, err] = await client.put(url, data, networkOnly(), {
|
|
1384
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1385
|
+
});
|
|
1375
1386
|
if (err) {
|
|
1376
1387
|
err.setMessage(`failed to set metadata to twintag`);
|
|
1377
1388
|
throw err;
|
|
@@ -1415,7 +1426,9 @@ class View {
|
|
|
1415
1426
|
async setData(objectApiName, data) {
|
|
1416
1427
|
const url = this.fileURL('data/' + objectApiName);
|
|
1417
1428
|
const client = await this._base.client();
|
|
1418
|
-
const [res, err] = await client.put(url, data, networkOnly(), {
|
|
1429
|
+
const [res, err] = await client.put(url, data, networkOnly(), {
|
|
1430
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1431
|
+
});
|
|
1419
1432
|
if (err) {
|
|
1420
1433
|
err.setMessage(`failed to set data to twintag object: ${objectApiName}`);
|
|
1421
1434
|
throw err;
|
|
@@ -1434,7 +1447,9 @@ class View {
|
|
|
1434
1447
|
async object(objectApiName) {
|
|
1435
1448
|
const client = await this._base.client();
|
|
1436
1449
|
const data = await this._base.data();
|
|
1437
|
-
if (!data.data.project ||
|
|
1450
|
+
if (!data.data.project ||
|
|
1451
|
+
!data.data.project.projectId ||
|
|
1452
|
+
data.data.project.projectId === '') {
|
|
1438
1453
|
throw new Error(`view not tagged to any project`);
|
|
1439
1454
|
}
|
|
1440
1455
|
return new ListObject(objectApiName, client, data.id, '', this._base._useCaching);
|
|
@@ -1479,7 +1494,9 @@ class View {
|
|
|
1479
1494
|
}
|
|
1480
1495
|
channel = channel ? channel : 'email';
|
|
1481
1496
|
const url = this._base.viewURL() + '/notification?type=' + channel;
|
|
1482
|
-
const [res, err] = await client.post(url, body, networkOnly(), {
|
|
1497
|
+
const [res, err] = await client.post(url, body, networkOnly(), {
|
|
1498
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1499
|
+
});
|
|
1483
1500
|
if (err) {
|
|
1484
1501
|
err.setMessage('failed to notify to all subcribers of twintag');
|
|
1485
1502
|
throw err;
|
|
@@ -1487,25 +1504,25 @@ class View {
|
|
|
1487
1504
|
return res;
|
|
1488
1505
|
}
|
|
1489
1506
|
/**
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1507
|
+
* Sends email to the registered users of the view.
|
|
1508
|
+
*
|
|
1509
|
+
* @param request message to be sent.
|
|
1510
|
+
*
|
|
1511
|
+
* Example:
|
|
1512
|
+
* ```js
|
|
1513
|
+
* await viewObj.sendFeedback({content: 'This is test content'})
|
|
1514
|
+
* ```
|
|
1515
|
+
*
|
|
1516
|
+
* You can further customize email body by passing {@link FeedbackRequest}:
|
|
1517
|
+
* ```js
|
|
1518
|
+
* await viewObj.sendFeedback({
|
|
1519
|
+
* content: 'This is test content',
|
|
1520
|
+
* subject: "custom email subject",
|
|
1521
|
+
* email: 'email';
|
|
1522
|
+
* })
|
|
1523
|
+
* ```
|
|
1524
|
+
* @category Notification
|
|
1525
|
+
*/
|
|
1509
1526
|
async sendFeedback(request) {
|
|
1510
1527
|
const client = await this._base.client();
|
|
1511
1528
|
let body;
|
|
@@ -1518,7 +1535,9 @@ class View {
|
|
|
1518
1535
|
body = request;
|
|
1519
1536
|
}
|
|
1520
1537
|
const url = this._base.viewURL() + '/feedback';
|
|
1521
|
-
const [res, err] = await client.put(url, body, networkOnly(), {
|
|
1538
|
+
const [res, err] = await client.put(url, body, networkOnly(), {
|
|
1539
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1540
|
+
});
|
|
1522
1541
|
if (err) {
|
|
1523
1542
|
err.setMessage(`failed to submit feedback`);
|
|
1524
1543
|
throw err;
|
|
@@ -1550,7 +1569,9 @@ class View {
|
|
|
1550
1569
|
const client = await this._base.client();
|
|
1551
1570
|
await this._base.data();
|
|
1552
1571
|
const url = this._base.viewURL() + `/notification?type=customEmail`;
|
|
1553
|
-
const [res, err] = await client.post(url, request, networkOnly(), {
|
|
1572
|
+
const [res, err] = await client.post(url, request, networkOnly(), {
|
|
1573
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1574
|
+
});
|
|
1554
1575
|
if (err) {
|
|
1555
1576
|
err.setMessage('failed to notify to all subcribers of twintag through custom email');
|
|
1556
1577
|
throw err;
|
|
@@ -1613,7 +1634,7 @@ class Epsilon {
|
|
|
1613
1634
|
this.view = new View(this.viewId);
|
|
1614
1635
|
}
|
|
1615
1636
|
if (options) {
|
|
1616
|
-
const { host = undefined, adminHost = undefined, debug = false } = options;
|
|
1637
|
+
const { host = undefined, adminHost = undefined, debug = false, } = options;
|
|
1617
1638
|
if (host) {
|
|
1618
1639
|
environment.host = host;
|
|
1619
1640
|
}
|
|
@@ -1627,13 +1648,13 @@ class Epsilon {
|
|
|
1627
1648
|
}
|
|
1628
1649
|
}
|
|
1629
1650
|
/**
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1651
|
+
* Execute an epsilon.
|
|
1652
|
+
*
|
|
1653
|
+
* @param fileName name of epsilon file.
|
|
1654
|
+
* @param requestOptions object
|
|
1655
|
+
* @param offlineOptions object of type OfflineOptions (optional)
|
|
1656
|
+
*
|
|
1657
|
+
*/
|
|
1637
1658
|
async execute(fileName, requestOptions, offlineOptions) {
|
|
1638
1659
|
var _a;
|
|
1639
1660
|
const url = `${environment.host}/api/v1/views/${this.viewId}/${fileName}.epsilon.js/run`;
|
|
@@ -1674,8 +1695,12 @@ class Epsilon {
|
|
|
1674
1695
|
err.setMessage(`failed to execute epsilon: ${err.message}`);
|
|
1675
1696
|
throw err;
|
|
1676
1697
|
}
|
|
1677
|
-
if (typeof window !== 'undefined' &&
|
|
1678
|
-
|
|
1698
|
+
if (typeof window !== 'undefined' &&
|
|
1699
|
+
offlineOptions &&
|
|
1700
|
+
offlineOptions.handledOnline &&
|
|
1701
|
+
offlineOptions.affected) {
|
|
1702
|
+
const offlineSupportHandler = window
|
|
1703
|
+
.twintagOfflineSupport;
|
|
1679
1704
|
if (offlineSupportHandler) {
|
|
1680
1705
|
offlineSupportHandler.cacheSDObjects(offlineOptions.affected);
|
|
1681
1706
|
}
|
|
@@ -18454,7 +18479,7 @@ class OfflineDataService {
|
|
|
18454
18479
|
const epsilonFileName = this.config.epsilonFileName;
|
|
18455
18480
|
const epsilon = new Epsilon(viewId);
|
|
18456
18481
|
if (offlineObjects && offlineObjects !== '*') {
|
|
18457
|
-
objectsToCache = this.config.offlineObjects.filter(offObj => offlineObjects.includes(offObj.objectName));
|
|
18482
|
+
objectsToCache = this.config.offlineObjects.filter((offObj) => offlineObjects.includes(offObj.objectName));
|
|
18458
18483
|
}
|
|
18459
18484
|
else {
|
|
18460
18485
|
objectsToCache = [...this.config.offlineObjects];
|
|
@@ -18462,7 +18487,7 @@ class OfflineDataService {
|
|
|
18462
18487
|
for (const obj of objectsToCache) {
|
|
18463
18488
|
const requestOptions = {
|
|
18464
18489
|
action: 'getSDObject',
|
|
18465
|
-
params: obj
|
|
18490
|
+
params: obj,
|
|
18466
18491
|
};
|
|
18467
18492
|
try {
|
|
18468
18493
|
objData = await epsilon.execute(epsilonFileName, requestOptions);
|
|
@@ -18513,8 +18538,8 @@ class OfflineDataService {
|
|
|
18513
18538
|
}
|
|
18514
18539
|
const pathParts = urlPath.split('/');
|
|
18515
18540
|
// console.log(pathParts)
|
|
18516
|
-
const viewsIndex = pathParts.findIndex(p => p === 'views');
|
|
18517
|
-
const dataIndex = pathParts.findIndex(p => p === 'data');
|
|
18541
|
+
const viewsIndex = pathParts.findIndex((p) => p === 'views');
|
|
18542
|
+
const dataIndex = pathParts.findIndex((p) => p === 'data');
|
|
18518
18543
|
const viewOrProject = viewsIndex > -1 ? 'view' : 'project';
|
|
18519
18544
|
objectName = pathParts[dataIndex + 1];
|
|
18520
18545
|
if (viewsIndex > -1) {
|
|
@@ -18537,7 +18562,7 @@ class OfflineDataService {
|
|
|
18537
18562
|
viewId: viewId,
|
|
18538
18563
|
instanceId: instanceId,
|
|
18539
18564
|
queryParams: queryParams,
|
|
18540
|
-
projectId: projectId
|
|
18565
|
+
projectId: projectId,
|
|
18541
18566
|
};
|
|
18542
18567
|
}
|
|
18543
18568
|
log(message, data) {
|
|
@@ -18607,7 +18632,9 @@ const TwintagOfflineSupport = class {
|
|
|
18607
18632
|
}
|
|
18608
18633
|
componentDidLoad() {
|
|
18609
18634
|
// console.log(this.config);
|
|
18610
|
-
if (this.config &&
|
|
18635
|
+
if (this.config &&
|
|
18636
|
+
this.config.offlineObjects &&
|
|
18637
|
+
this.config.offlineObjects.length > 0) {
|
|
18611
18638
|
this.cacheSDObjects();
|
|
18612
18639
|
}
|
|
18613
18640
|
}
|
|
@@ -18652,7 +18679,7 @@ const TwintagOfflineSupport = class {
|
|
|
18652
18679
|
request.args.headers = __headersClone;
|
|
18653
18680
|
}
|
|
18654
18681
|
if (request.offlineOptions && request.offlineOptions.uuid) {
|
|
18655
|
-
if (this.pendingRequests.find(r => r.offlineOptions.uuid === request.offlineOptions.uuid)) {
|
|
18682
|
+
if (this.pendingRequests.find((r) => r.offlineOptions.uuid === request.offlineOptions.uuid)) {
|
|
18656
18683
|
return; //request is already in the list, probably a failed retry
|
|
18657
18684
|
}
|
|
18658
18685
|
}
|
|
@@ -18677,13 +18704,13 @@ const TwintagOfflineSupport = class {
|
|
|
18677
18704
|
project: { apiKey: '' },
|
|
18678
18705
|
bag: { id: '' },
|
|
18679
18706
|
request: {
|
|
18680
|
-
body
|
|
18707
|
+
body,
|
|
18681
18708
|
},
|
|
18682
|
-
clientContext: true
|
|
18709
|
+
clientContext: true,
|
|
18683
18710
|
};
|
|
18684
18711
|
const ep = new this.config.epsilonClass(requestEvent);
|
|
18685
18712
|
this.log('Executing epsilon request locally', requestEvent);
|
|
18686
|
-
return await ep.serve();
|
|
18713
|
+
return (await ep.serve());
|
|
18687
18714
|
}
|
|
18688
18715
|
async processAllPendingRequests() {
|
|
18689
18716
|
if (!this.onLine) {
|
|
@@ -18727,8 +18754,7 @@ const TwintagOfflineSupport = class {
|
|
|
18727
18754
|
try {
|
|
18728
18755
|
await IndexedDbService.delete(request.offlineOptions.uuid, OFFLINEREQUESTSTORE);
|
|
18729
18756
|
}
|
|
18730
|
-
catch (e) {
|
|
18731
|
-
}
|
|
18757
|
+
catch (e) { }
|
|
18732
18758
|
this.pendingRequests = await IndexedDbService.getAll(OFFLINEREQUESTSTORE);
|
|
18733
18759
|
}
|
|
18734
18760
|
else {
|
|
@@ -18756,12 +18782,12 @@ const TwintagOfflineSupport = class {
|
|
|
18756
18782
|
this.offlineRequestsChanged.emit({
|
|
18757
18783
|
action,
|
|
18758
18784
|
request,
|
|
18759
|
-
pendingRequests: [...this.pendingRequests]
|
|
18785
|
+
pendingRequests: [...this.pendingRequests],
|
|
18760
18786
|
});
|
|
18761
18787
|
}
|
|
18762
18788
|
isEpsilonRequest(url) {
|
|
18763
18789
|
const pathParts = url.split('/');
|
|
18764
|
-
return pathParts.find(p => p === 'files') !== undefined;
|
|
18790
|
+
return pathParts.find((p) => p === 'files') !== undefined;
|
|
18765
18791
|
}
|
|
18766
18792
|
async cacheSDObjects(offlineObjects) {
|
|
18767
18793
|
if (!this.onLine) {
|
|
@@ -23,7 +23,7 @@ export class OfflineDataService {
|
|
|
23
23
|
const epsilonFileName = this.config.epsilonFileName;
|
|
24
24
|
const epsilon = new Epsilon(viewId);
|
|
25
25
|
if (offlineObjects && offlineObjects !== '*') {
|
|
26
|
-
objectsToCache = this.config.offlineObjects.filter(offObj => offlineObjects.includes(offObj.objectName));
|
|
26
|
+
objectsToCache = this.config.offlineObjects.filter((offObj) => offlineObjects.includes(offObj.objectName));
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
29
|
objectsToCache = [...this.config.offlineObjects];
|
|
@@ -31,7 +31,7 @@ export class OfflineDataService {
|
|
|
31
31
|
for (const obj of objectsToCache) {
|
|
32
32
|
const requestOptions = {
|
|
33
33
|
action: 'getSDObject',
|
|
34
|
-
params: obj
|
|
34
|
+
params: obj,
|
|
35
35
|
};
|
|
36
36
|
try {
|
|
37
37
|
objData = await epsilon.execute(epsilonFileName, requestOptions);
|
|
@@ -82,8 +82,8 @@ export class OfflineDataService {
|
|
|
82
82
|
}
|
|
83
83
|
const pathParts = urlPath.split('/');
|
|
84
84
|
// console.log(pathParts)
|
|
85
|
-
const viewsIndex = pathParts.findIndex(p => p === 'views');
|
|
86
|
-
const dataIndex = pathParts.findIndex(p => p === 'data');
|
|
85
|
+
const viewsIndex = pathParts.findIndex((p) => p === 'views');
|
|
86
|
+
const dataIndex = pathParts.findIndex((p) => p === 'data');
|
|
87
87
|
const viewOrProject = viewsIndex > -1 ? 'view' : 'project';
|
|
88
88
|
objectName = pathParts[dataIndex + 1];
|
|
89
89
|
if (viewsIndex > -1) {
|
|
@@ -106,7 +106,7 @@ export class OfflineDataService {
|
|
|
106
106
|
viewId: viewId,
|
|
107
107
|
instanceId: instanceId,
|
|
108
108
|
queryParams: queryParams,
|
|
109
|
-
projectId: projectId
|
|
109
|
+
projectId: projectId,
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
log(message, data) {
|
|
@@ -53,7 +53,9 @@ export class TwintagOfflineSupport {
|
|
|
53
53
|
}
|
|
54
54
|
componentDidLoad() {
|
|
55
55
|
// console.log(this.config);
|
|
56
|
-
if (this.config &&
|
|
56
|
+
if (this.config &&
|
|
57
|
+
this.config.offlineObjects &&
|
|
58
|
+
this.config.offlineObjects.length > 0) {
|
|
57
59
|
this.cacheSDObjects();
|
|
58
60
|
}
|
|
59
61
|
}
|
|
@@ -98,7 +100,7 @@ export class TwintagOfflineSupport {
|
|
|
98
100
|
request.args.headers = __headersClone;
|
|
99
101
|
}
|
|
100
102
|
if (request.offlineOptions && request.offlineOptions.uuid) {
|
|
101
|
-
if (this.pendingRequests.find(r => r.offlineOptions.uuid === request.offlineOptions.uuid)) {
|
|
103
|
+
if (this.pendingRequests.find((r) => r.offlineOptions.uuid === request.offlineOptions.uuid)) {
|
|
102
104
|
return; //request is already in the list, probably a failed retry
|
|
103
105
|
}
|
|
104
106
|
}
|
|
@@ -123,13 +125,13 @@ export class TwintagOfflineSupport {
|
|
|
123
125
|
project: { apiKey: '' },
|
|
124
126
|
bag: { id: '' },
|
|
125
127
|
request: {
|
|
126
|
-
body
|
|
128
|
+
body,
|
|
127
129
|
},
|
|
128
|
-
clientContext: true
|
|
130
|
+
clientContext: true,
|
|
129
131
|
};
|
|
130
132
|
const ep = new this.config.epsilonClass(requestEvent);
|
|
131
133
|
this.log('Executing epsilon request locally', requestEvent);
|
|
132
|
-
return await ep.serve();
|
|
134
|
+
return (await ep.serve());
|
|
133
135
|
}
|
|
134
136
|
async processAllPendingRequests() {
|
|
135
137
|
if (!this.onLine) {
|
|
@@ -173,8 +175,7 @@ export class TwintagOfflineSupport {
|
|
|
173
175
|
try {
|
|
174
176
|
await IndexedDbService.delete(request.offlineOptions.uuid, OFFLINEREQUESTSTORE);
|
|
175
177
|
}
|
|
176
|
-
catch (e) {
|
|
177
|
-
}
|
|
178
|
+
catch (e) { }
|
|
178
179
|
this.pendingRequests = await IndexedDbService.getAll(OFFLINEREQUESTSTORE);
|
|
179
180
|
}
|
|
180
181
|
else {
|
|
@@ -202,12 +203,12 @@ export class TwintagOfflineSupport {
|
|
|
202
203
|
this.offlineRequestsChanged.emit({
|
|
203
204
|
action,
|
|
204
205
|
request,
|
|
205
|
-
pendingRequests: [...this.pendingRequests]
|
|
206
|
+
pendingRequests: [...this.pendingRequests],
|
|
206
207
|
});
|
|
207
208
|
}
|
|
208
209
|
isEpsilonRequest(url) {
|
|
209
210
|
const pathParts = url.split('/');
|
|
210
|
-
return pathParts.find(p => p === 'files') !== undefined;
|
|
211
|
+
return pathParts.find((p) => p === 'files') !== undefined;
|
|
211
212
|
}
|
|
212
213
|
async cacheSDObjects(offlineObjects) {
|
|
213
214
|
if (!this.onLine) {
|