@twintag/twintag-core 0.2.274 → 0.2.275

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.
@@ -206,7 +206,7 @@ class IndexedDbService {
206
206
  /**
207
207
  * The SDK version.
208
208
  */
209
- const VERSION = '0.0.0-VERSION';
209
+ const VERSION = '0.2.275';
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
- && (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") {
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);
@@ -991,7 +991,6 @@ class View {
991
991
  */
992
992
  constructor(qid, clientContext) {
993
993
  this._base = new TwintagBase(qid, clientContext || false);
994
- this.clientContext = clientContext;
995
994
  }
996
995
  get qid() {
997
996
  return this._base._qid;
@@ -1036,7 +1035,13 @@ class View {
1036
1035
  this._base.setToken(token);
1037
1036
  }
1038
1037
  fileURL(obj, qid, op, useCachingHost = false) {
1039
- let url = (useCachingHost && this._base._useCaching ? environment.cachingHost : environment.host) + '/api/v1/views/' + this._base._qid + '/' + obj;
1038
+ let url = (useCachingHost && this._base._useCaching
1039
+ ? environment.cachingHost
1040
+ : environment.host) +
1041
+ '/api/v1/views/' +
1042
+ this._base._qid +
1043
+ '/' +
1044
+ obj;
1040
1045
  if (qid) {
1041
1046
  url += '/' + qid;
1042
1047
  }
@@ -1075,7 +1080,7 @@ class View {
1075
1080
  mode: 420,
1076
1081
  name: name ? name : f.name,
1077
1082
  size: f.size,
1078
- parent: parent ? parent : null
1083
+ parent: parent ? parent : null,
1079
1084
  };
1080
1085
  let url = await this.fileURLUpload('files');
1081
1086
  const client = await this._base.client();
@@ -1141,7 +1146,10 @@ class View {
1141
1146
  // TODO: support name & fileInfo
1142
1147
  const url = this.fileURL('web', name);
1143
1148
  const client = await this._base.client();
1144
- const [res, err] = await client.do(url, { method: 'get', headers: { 'Content-Type': 'application/octet-stream' } }, networkOnly(), true, true);
1149
+ const [res, err] = await client.do(url, {
1150
+ method: 'get',
1151
+ headers: { 'Content-Type': 'application/octet-stream' },
1152
+ }, networkOnly(), true, true);
1145
1153
  if (err) {
1146
1154
  err.setMessage(`failed to download file from twintag`);
1147
1155
  throw err;
@@ -1271,7 +1279,7 @@ class View {
1271
1279
  rights: rights,
1272
1280
  isCanocical: 1,
1273
1281
  },
1274
- bagStorageQid: this._base._data.bagQid
1282
+ bagStorageQid: this._base._data.bagQid,
1275
1283
  };
1276
1284
  const client = await this._base.client();
1277
1285
  const [data, err] = await client.put(url, viewReq);
@@ -1310,12 +1318,12 @@ class View {
1310
1318
  */
1311
1319
  async addFolder(folderName, folderParent) {
1312
1320
  if (folderName.trim().length === 0) {
1313
- throw new Error("Invalid folder name.");
1321
+ throw new Error('Invalid folder name.');
1314
1322
  }
1315
1323
  const url = this.fileURL('folders');
1316
1324
  const body = {
1317
1325
  name: folderName,
1318
- parent: folderParent ? folderParent : null
1326
+ parent: folderParent ? folderParent : null,
1319
1327
  };
1320
1328
  const client = await this._base.client();
1321
1329
  const [res, err] = await client.put(url, body);
@@ -1351,7 +1359,7 @@ class View {
1351
1359
  */
1352
1360
  async getMetadata(lang) {
1353
1361
  let url = this.fileURL('data/metadata', undefined, undefined, true);
1354
- url += lang ? `?language=${(lang === 'all' ? '*' : lang)}` : '';
1362
+ url += lang ? `?language=${lang === 'all' ? '*' : lang}` : '';
1355
1363
  const client = await this._base.client();
1356
1364
  const [res, err] = await client.get(url);
1357
1365
  if (err) {
@@ -1372,7 +1380,9 @@ class View {
1372
1380
  async setMetadata(data) {
1373
1381
  const url = this.fileURL('data/metadata');
1374
1382
  const client = await this._base.client();
1375
- const [res, err] = await client.put(url, data, networkOnly(), { headers: { 'Content-Type': 'application/json' } });
1383
+ const [res, err] = await client.put(url, data, networkOnly(), {
1384
+ headers: { 'Content-Type': 'application/json' },
1385
+ });
1376
1386
  if (err) {
1377
1387
  err.setMessage(`failed to set metadata to twintag`);
1378
1388
  throw err;
@@ -1416,7 +1426,9 @@ class View {
1416
1426
  async setData(objectApiName, data) {
1417
1427
  const url = this.fileURL('data/' + objectApiName);
1418
1428
  const client = await this._base.client();
1419
- const [res, err] = await client.put(url, data, networkOnly(), { headers: { 'Content-Type': 'application/json' } });
1429
+ const [res, err] = await client.put(url, data, networkOnly(), {
1430
+ headers: { 'Content-Type': 'application/json' },
1431
+ });
1420
1432
  if (err) {
1421
1433
  err.setMessage(`failed to set data to twintag object: ${objectApiName}`);
1422
1434
  throw err;
@@ -1435,7 +1447,9 @@ class View {
1435
1447
  async object(objectApiName) {
1436
1448
  const client = await this._base.client();
1437
1449
  const data = await this._base.data();
1438
- if (!data.data.project || !data.data.project.projectId || data.data.project.projectId === '') {
1450
+ if (!data.data.project ||
1451
+ !data.data.project.projectId ||
1452
+ data.data.project.projectId === '') {
1439
1453
  throw new Error(`view not tagged to any project`);
1440
1454
  }
1441
1455
  return new ListObject(objectApiName, client, data.id, '', this._base._useCaching);
@@ -1480,7 +1494,9 @@ class View {
1480
1494
  }
1481
1495
  channel = channel ? channel : 'email';
1482
1496
  const url = this._base.viewURL() + '/notification?type=' + channel;
1483
- const [res, err] = await client.post(url, body, networkOnly(), { headers: { 'Content-Type': 'application/json' } });
1497
+ const [res, err] = await client.post(url, body, networkOnly(), {
1498
+ headers: { 'Content-Type': 'application/json' },
1499
+ });
1484
1500
  if (err) {
1485
1501
  err.setMessage('failed to notify to all subcribers of twintag');
1486
1502
  throw err;
@@ -1488,25 +1504,25 @@ class View {
1488
1504
  return res;
1489
1505
  }
1490
1506
  /**
1491
- * Sends email to the registered users of the view.
1492
- *
1493
- * @param request message to be sent.
1494
- *
1495
- * Example:
1496
- * ```js
1497
- * await viewObj.sendFeedback({content: 'This is test content'})
1498
- * ```
1499
- *
1500
- * You can further customize email body by passing {@link FeedbackRequest}:
1501
- * ```js
1502
- * await viewObj.sendFeedback({
1503
- * content: 'This is test content',
1504
- * subject: "custom email subject",
1505
- * email: 'email';
1506
- * })
1507
- * ```
1508
- * @category Notification
1509
- */
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
+ */
1510
1526
  async sendFeedback(request) {
1511
1527
  const client = await this._base.client();
1512
1528
  let body;
@@ -1519,7 +1535,9 @@ class View {
1519
1535
  body = request;
1520
1536
  }
1521
1537
  const url = this._base.viewURL() + '/feedback';
1522
- const [res, err] = await client.put(url, body, networkOnly(), { headers: { 'Content-Type': 'application/json' } });
1538
+ const [res, err] = await client.put(url, body, networkOnly(), {
1539
+ headers: { 'Content-Type': 'application/json' },
1540
+ });
1523
1541
  if (err) {
1524
1542
  err.setMessage(`failed to submit feedback`);
1525
1543
  throw err;
@@ -1551,7 +1569,9 @@ class View {
1551
1569
  const client = await this._base.client();
1552
1570
  await this._base.data();
1553
1571
  const url = this._base.viewURL() + `/notification?type=customEmail`;
1554
- const [res, err] = await client.post(url, request, networkOnly(), { headers: { 'Content-Type': 'application/json' } });
1572
+ const [res, err] = await client.post(url, request, networkOnly(), {
1573
+ headers: { 'Content-Type': 'application/json' },
1574
+ });
1555
1575
  if (err) {
1556
1576
  err.setMessage('failed to notify to all subcribers of twintag through custom email');
1557
1577
  throw err;
@@ -1584,6 +1604,17 @@ var BagType;
1584
1604
  BagType["Owner"] = "owner";
1585
1605
  })(BagType || (BagType = {}));
1586
1606
 
1607
+ function log(message, data) {
1608
+ if (this.config && this.config.debug) {
1609
+ if (data) {
1610
+ console.log(message + ': ', data);
1611
+ }
1612
+ else {
1613
+ console.log(message);
1614
+ }
1615
+ }
1616
+ }
1617
+
1587
1618
  /**
1588
1619
  * A epsilon class to execute the epsilon
1589
1620
  */
@@ -1596,35 +1627,48 @@ class Epsilon {
1596
1627
  *
1597
1628
  * @internal
1598
1629
  */
1599
- constructor(viewId, client, debug) {
1630
+ constructor(viewId, options) {
1600
1631
  this.viewId = viewId;
1601
- this._client = client || new Client();
1602
- if (debug) {
1603
- this._client.debug = this._debug = debug;
1604
- }
1605
- }
1606
- async setDefaults() {
1607
- var _a;
1632
+ this._client = (options === null || options === void 0 ? void 0 : options.client) || new Client();
1608
1633
  if (!this.view) {
1609
1634
  this.view = new View(this.viewId);
1610
1635
  }
1611
- if (!this.folders || ((_a = this.folders) === null || _a === void 0 ? void 0 : _a.length) === 0) {
1612
- this.folders = await this.view.list();
1636
+ if (options) {
1637
+ const { host = undefined, adminHost = undefined, debug = false, } = options;
1638
+ if (host) {
1639
+ environment.host = host;
1640
+ }
1641
+ if (adminHost) {
1642
+ environment.adminHost = adminHost;
1643
+ }
1644
+ if (debug) {
1645
+ this._client.debug = debug;
1646
+ this._debug = debug;
1647
+ }
1613
1648
  }
1614
1649
  }
1615
1650
  /**
1616
- * Execute an epsilon.
1617
- *
1618
- * @param fileName name of epsilon file.
1619
- * @param requestOptions object
1620
- * @param offlineOptions object of type OfflineOptions (optional)
1621
- *
1622
- */
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
+ */
1623
1658
  async execute(fileName, requestOptions, offlineOptions) {
1624
1659
  var _a;
1625
- const url = await this.getEpsilonFileURL(fileName);
1660
+ const url = `${environment.host}/api/v1/views/${this.viewId}/${fileName}.epsilon.js/run`;
1626
1661
  const headers = new Headers(requestOptions.headers);
1627
1662
  const data = await ((_a = this.view) === null || _a === void 0 ? void 0 : _a.data());
1663
+ if (this._debug) {
1664
+ log('epsilon execute', {
1665
+ url,
1666
+ headers,
1667
+ data,
1668
+ requestOptions,
1669
+ offlineOptions,
1670
+ });
1671
+ }
1628
1672
  headers.append('Authorization', 'Bearer ' + data.authToken);
1629
1673
  headers.append('Content-Type', 'application/json');
1630
1674
  const request = {
@@ -1641,32 +1685,28 @@ class Epsilon {
1641
1685
  }
1642
1686
  const [res, err] = await this._client.do(url, request, __offlineOptions);
1643
1687
  if (err) {
1688
+ if (this._debug) {
1689
+ log('epsilon execute', {
1690
+ url,
1691
+ request,
1692
+ __offlineOptions,
1693
+ });
1694
+ }
1644
1695
  err.setMessage(`failed to execute epsilon: ${err.message}`);
1645
1696
  throw err;
1646
1697
  }
1647
- if (typeof window !== 'undefined' && offlineOptions && offlineOptions.handledOnline && offlineOptions.affected) {
1648
- const offlineSupportHandler = window.twintagOfflineSupport;
1698
+ if (typeof window !== 'undefined' &&
1699
+ offlineOptions &&
1700
+ offlineOptions.handledOnline &&
1701
+ offlineOptions.affected) {
1702
+ const offlineSupportHandler = window
1703
+ .twintagOfflineSupport;
1649
1704
  if (offlineSupportHandler) {
1650
1705
  offlineSupportHandler.cacheSDObjects(offlineOptions.affected);
1651
1706
  }
1652
1707
  }
1653
1708
  return res;
1654
1709
  }
1655
- async getEpsilonFileURL(fileName) {
1656
- var _a, _b;
1657
- if (!this.folders || ((_a = this.folders) === null || _a === void 0 ? void 0 : _a.length) === 0)
1658
- await this.setDefaults();
1659
- const virtualFile = (_b = this.folders) === null || _b === void 0 ? void 0 : _b.filter((result) => {
1660
- return result.Name === fileName;
1661
- });
1662
- if (virtualFile && virtualFile[0])
1663
- return (environment.host +
1664
- '/api/v1/views/' +
1665
- virtualFile[0].TemplateBagId +
1666
- '/files/' +
1667
- virtualFile[0].FileQid);
1668
- return '';
1669
- }
1670
1710
  }
1671
1711
 
1672
1712
  /******************************************************************************
@@ -18439,7 +18479,7 @@ class OfflineDataService {
18439
18479
  const epsilonFileName = this.config.epsilonFileName;
18440
18480
  const epsilon = new Epsilon(viewId);
18441
18481
  if (offlineObjects && offlineObjects !== '*') {
18442
- objectsToCache = this.config.offlineObjects.filter(offObj => offlineObjects.includes(offObj.objectName));
18482
+ objectsToCache = this.config.offlineObjects.filter((offObj) => offlineObjects.includes(offObj.objectName));
18443
18483
  }
18444
18484
  else {
18445
18485
  objectsToCache = [...this.config.offlineObjects];
@@ -18447,7 +18487,7 @@ class OfflineDataService {
18447
18487
  for (const obj of objectsToCache) {
18448
18488
  const requestOptions = {
18449
18489
  action: 'getSDObject',
18450
- params: obj
18490
+ params: obj,
18451
18491
  };
18452
18492
  try {
18453
18493
  objData = await epsilon.execute(epsilonFileName, requestOptions);
@@ -18480,7 +18520,11 @@ class OfflineDataService {
18480
18520
  return [{}, undefined];
18481
18521
  }
18482
18522
  getRequestArgsFromUrl(url) {
18483
- let viewId, objectName, projectId, instanceId, queryParams;
18523
+ let viewId;
18524
+ let objectName;
18525
+ let projectId;
18526
+ let instanceId;
18527
+ let queryParams;
18484
18528
  let splitUrlAndQueryArgs = url.split('?');
18485
18529
  const urlPath = splitUrlAndQueryArgs[0];
18486
18530
  if (splitUrlAndQueryArgs.length > 1) {
@@ -18494,8 +18538,8 @@ class OfflineDataService {
18494
18538
  }
18495
18539
  const pathParts = urlPath.split('/');
18496
18540
  // console.log(pathParts)
18497
- const viewsIndex = pathParts.findIndex(p => p === 'views');
18498
- const dataIndex = pathParts.findIndex(p => p === 'data');
18541
+ const viewsIndex = pathParts.findIndex((p) => p === 'views');
18542
+ const dataIndex = pathParts.findIndex((p) => p === 'data');
18499
18543
  const viewOrProject = viewsIndex > -1 ? 'view' : 'project';
18500
18544
  objectName = pathParts[dataIndex + 1];
18501
18545
  if (viewsIndex > -1) {
@@ -18518,7 +18562,7 @@ class OfflineDataService {
18518
18562
  viewId: viewId,
18519
18563
  instanceId: instanceId,
18520
18564
  queryParams: queryParams,
18521
- projectId: projectId
18565
+ projectId: projectId,
18522
18566
  };
18523
18567
  }
18524
18568
  log(message, data) {
@@ -18588,7 +18632,9 @@ const TwintagOfflineSupport = class {
18588
18632
  }
18589
18633
  componentDidLoad() {
18590
18634
  // console.log(this.config);
18591
- if (this.config && this.config.offlineObjects && this.config.offlineObjects.length > 0) {
18635
+ if (this.config &&
18636
+ this.config.offlineObjects &&
18637
+ this.config.offlineObjects.length > 0) {
18592
18638
  this.cacheSDObjects();
18593
18639
  }
18594
18640
  }
@@ -18633,7 +18679,7 @@ const TwintagOfflineSupport = class {
18633
18679
  request.args.headers = __headersClone;
18634
18680
  }
18635
18681
  if (request.offlineOptions && request.offlineOptions.uuid) {
18636
- if (this.pendingRequests.find(r => r.offlineOptions.uuid === request.offlineOptions.uuid)) {
18682
+ if (this.pendingRequests.find((r) => r.offlineOptions.uuid === request.offlineOptions.uuid)) {
18637
18683
  return; //request is already in the list, probably a failed retry
18638
18684
  }
18639
18685
  }
@@ -18658,13 +18704,13 @@ const TwintagOfflineSupport = class {
18658
18704
  project: { apiKey: '' },
18659
18705
  bag: { id: '' },
18660
18706
  request: {
18661
- body
18707
+ body,
18662
18708
  },
18663
- clientContext: true
18709
+ clientContext: true,
18664
18710
  };
18665
18711
  const ep = new this.config.epsilonClass(requestEvent);
18666
18712
  this.log('Executing epsilon request locally', requestEvent);
18667
- return await ep.serve();
18713
+ return (await ep.serve());
18668
18714
  }
18669
18715
  async processAllPendingRequests() {
18670
18716
  if (!this.onLine) {
@@ -18702,14 +18748,13 @@ const TwintagOfflineSupport = class {
18702
18748
  });
18703
18749
  request.args.headers = headers;
18704
18750
  }
18705
- const [resp, err] = await retryRequest(request);
18751
+ const [, err] = await retryRequest(request);
18706
18752
  if (!err) {
18707
18753
  actionResult = 'processed_success';
18708
18754
  try {
18709
18755
  await IndexedDbService.delete(request.offlineOptions.uuid, OFFLINEREQUESTSTORE);
18710
18756
  }
18711
- catch (e) {
18712
- }
18757
+ catch (e) { }
18713
18758
  this.pendingRequests = await IndexedDbService.getAll(OFFLINEREQUESTSTORE);
18714
18759
  }
18715
18760
  else {
@@ -18737,12 +18782,12 @@ const TwintagOfflineSupport = class {
18737
18782
  this.offlineRequestsChanged.emit({
18738
18783
  action,
18739
18784
  request,
18740
- pendingRequests: [...this.pendingRequests]
18785
+ pendingRequests: [...this.pendingRequests],
18741
18786
  });
18742
18787
  }
18743
18788
  isEpsilonRequest(url) {
18744
18789
  const pathParts = url.split('/');
18745
- return pathParts.find(p => p === 'files') !== undefined;
18790
+ return pathParts.find((p) => p === 'files') !== undefined;
18746
18791
  }
18747
18792
  async cacheSDObjects(offlineObjects) {
18748
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);
@@ -64,7 +64,11 @@ export class OfflineDataService {
64
64
  return [{}, undefined];
65
65
  }
66
66
  getRequestArgsFromUrl(url) {
67
- let viewId, objectName, projectId, instanceId, queryParams;
67
+ let viewId;
68
+ let objectName;
69
+ let projectId;
70
+ let instanceId;
71
+ let queryParams;
68
72
  let splitUrlAndQueryArgs = url.split('?');
69
73
  const urlPath = splitUrlAndQueryArgs[0];
70
74
  if (splitUrlAndQueryArgs.length > 1) {
@@ -78,8 +82,8 @@ export class OfflineDataService {
78
82
  }
79
83
  const pathParts = urlPath.split('/');
80
84
  // console.log(pathParts)
81
- const viewsIndex = pathParts.findIndex(p => p === 'views');
82
- const dataIndex = pathParts.findIndex(p => p === 'data');
85
+ const viewsIndex = pathParts.findIndex((p) => p === 'views');
86
+ const dataIndex = pathParts.findIndex((p) => p === 'data');
83
87
  const viewOrProject = viewsIndex > -1 ? 'view' : 'project';
84
88
  objectName = pathParts[dataIndex + 1];
85
89
  if (viewsIndex > -1) {
@@ -102,7 +106,7 @@ export class OfflineDataService {
102
106
  viewId: viewId,
103
107
  instanceId: instanceId,
104
108
  queryParams: queryParams,
105
- projectId: projectId
109
+ projectId: projectId,
106
110
  };
107
111
  }
108
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 && this.config.offlineObjects && this.config.offlineObjects.length > 0) {
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) {
@@ -167,14 +169,13 @@ export class TwintagOfflineSupport {
167
169
  });
168
170
  request.args.headers = headers;
169
171
  }
170
- const [resp, err] = await retryRequest(request);
172
+ const [, err] = await retryRequest(request);
171
173
  if (!err) {
172
174
  actionResult = 'processed_success';
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) {
@@ -2,4 +2,4 @@
2
2
  /**
3
3
  * The library version.
4
4
  */
5
- export const VERSION = '0.2.274';
5
+ export const VERSION = '0.2.275';