@twintag/twintag-core 0.2.273-fix-scanner-update-aabb5127ad55f92c0b23856d484b6dd62cbde0fb → 0.2.274-fix-sdk-epsilon-6f790382a40201ca742cb007f9a464edb3f0f148

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.274-fix-sdk-epsilon-6f790382a40201ca742cb007f9a464edb3f0f148';
210
210
 
211
211
  class TwintagErrorValue {
212
212
  }
@@ -1584,6 +1584,17 @@ var BagType;
1584
1584
  BagType["Owner"] = "owner";
1585
1585
  })(BagType || (BagType = {}));
1586
1586
 
1587
+ function log(message, data) {
1588
+ if (this.config && this.config.debug) {
1589
+ if (data) {
1590
+ console.log(message + ': ', data);
1591
+ }
1592
+ else {
1593
+ console.log(message);
1594
+ }
1595
+ }
1596
+ }
1597
+
1587
1598
  /**
1588
1599
  * A epsilon class to execute the epsilon
1589
1600
  */
@@ -1596,20 +1607,24 @@ class Epsilon {
1596
1607
  *
1597
1608
  * @internal
1598
1609
  */
1599
- constructor(viewId, client, debug) {
1610
+ constructor(viewId, options) {
1600
1611
  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;
1612
+ this._client = (options === null || options === void 0 ? void 0 : options.client) || new Client();
1608
1613
  if (!this.view) {
1609
1614
  this.view = new View(this.viewId);
1610
1615
  }
1611
- if (!this.folders || ((_a = this.folders) === null || _a === void 0 ? void 0 : _a.length) === 0) {
1612
- this.folders = await this.view.list();
1616
+ if (options) {
1617
+ const { host = undefined, adminHost = undefined, debug = false } = options;
1618
+ if (host) {
1619
+ environment.host = host;
1620
+ }
1621
+ if (adminHost) {
1622
+ environment.adminHost = adminHost;
1623
+ }
1624
+ if (debug) {
1625
+ this._client.debug = debug;
1626
+ this._debug = debug;
1627
+ }
1613
1628
  }
1614
1629
  }
1615
1630
  /**
@@ -1622,9 +1637,18 @@ class Epsilon {
1622
1637
  */
1623
1638
  async execute(fileName, requestOptions, offlineOptions) {
1624
1639
  var _a;
1625
- const url = await this.getEpsilonFileURL(fileName);
1640
+ const url = `${environment.host}/api/v1/views/${this.viewId}/${fileName}.epsilon.js/run`;
1626
1641
  const headers = new Headers(requestOptions.headers);
1627
1642
  const data = await ((_a = this.view) === null || _a === void 0 ? void 0 : _a.data());
1643
+ if (this._debug) {
1644
+ log('epsilon execute', {
1645
+ url,
1646
+ headers,
1647
+ data,
1648
+ requestOptions,
1649
+ offlineOptions,
1650
+ });
1651
+ }
1628
1652
  headers.append('Authorization', 'Bearer ' + data.authToken);
1629
1653
  headers.append('Content-Type', 'application/json');
1630
1654
  const request = {
@@ -1641,6 +1665,13 @@ class Epsilon {
1641
1665
  }
1642
1666
  const [res, err] = await this._client.do(url, request, __offlineOptions);
1643
1667
  if (err) {
1668
+ if (this._debug) {
1669
+ log('epsilon execute', {
1670
+ url,
1671
+ request,
1672
+ __offlineOptions,
1673
+ });
1674
+ }
1644
1675
  err.setMessage(`failed to execute epsilon: ${err.message}`);
1645
1676
  throw err;
1646
1677
  }
@@ -1652,21 +1683,6 @@ class Epsilon {
1652
1683
  }
1653
1684
  return res;
1654
1685
  }
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
1686
  }
1671
1687
 
1672
1688
  /******************************************************************************
@@ -2,4 +2,4 @@
2
2
  /**
3
3
  * The library version.
4
4
  */
5
- export const VERSION = '0.2.273-fix-scanner-update-aabb5127ad55f92c0b23856d484b6dd62cbde0fb';
5
+ export const VERSION = '0.2.274-fix-sdk-epsilon-6f790382a40201ca742cb007f9a464edb3f0f148';
@@ -223,7 +223,7 @@ class IndexedDbService {
223
223
  /**
224
224
  * The SDK version.
225
225
  */
226
- const VERSION = '0.0.0-VERSION';
226
+ const VERSION = '0.2.274-fix-sdk-epsilon-6f790382a40201ca742cb007f9a464edb3f0f148';
227
227
 
228
228
  class TwintagErrorValue {
229
229
  }
@@ -1601,6 +1601,17 @@ var BagType;
1601
1601
  BagType["Owner"] = "owner";
1602
1602
  })(BagType || (BagType = {}));
1603
1603
 
1604
+ function log(message, data) {
1605
+ if (this.config && this.config.debug) {
1606
+ if (data) {
1607
+ console.log(message + ': ', data);
1608
+ }
1609
+ else {
1610
+ console.log(message);
1611
+ }
1612
+ }
1613
+ }
1614
+
1604
1615
  /**
1605
1616
  * A epsilon class to execute the epsilon
1606
1617
  */
@@ -1613,20 +1624,24 @@ class Epsilon {
1613
1624
  *
1614
1625
  * @internal
1615
1626
  */
1616
- constructor(viewId, client, debug) {
1627
+ constructor(viewId, options) {
1617
1628
  this.viewId = viewId;
1618
- this._client = client || new Client();
1619
- if (debug) {
1620
- this._client.debug = this._debug = debug;
1621
- }
1622
- }
1623
- async setDefaults() {
1624
- var _a;
1629
+ this._client = (options === null || options === void 0 ? void 0 : options.client) || new Client();
1625
1630
  if (!this.view) {
1626
1631
  this.view = new View(this.viewId);
1627
1632
  }
1628
- if (!this.folders || ((_a = this.folders) === null || _a === void 0 ? void 0 : _a.length) === 0) {
1629
- this.folders = await this.view.list();
1633
+ if (options) {
1634
+ const { host = undefined, adminHost = undefined, debug = false } = options;
1635
+ if (host) {
1636
+ environment.host = host;
1637
+ }
1638
+ if (adminHost) {
1639
+ environment.adminHost = adminHost;
1640
+ }
1641
+ if (debug) {
1642
+ this._client.debug = debug;
1643
+ this._debug = debug;
1644
+ }
1630
1645
  }
1631
1646
  }
1632
1647
  /**
@@ -1639,9 +1654,18 @@ class Epsilon {
1639
1654
  */
1640
1655
  async execute(fileName, requestOptions, offlineOptions) {
1641
1656
  var _a;
1642
- const url = await this.getEpsilonFileURL(fileName);
1657
+ const url = `${environment.host}/api/v1/views/${this.viewId}/${fileName}.epsilon.js/run`;
1643
1658
  const headers = new Headers(requestOptions.headers);
1644
1659
  const data = await ((_a = this.view) === null || _a === void 0 ? void 0 : _a.data());
1660
+ if (this._debug) {
1661
+ log('epsilon execute', {
1662
+ url,
1663
+ headers,
1664
+ data,
1665
+ requestOptions,
1666
+ offlineOptions,
1667
+ });
1668
+ }
1645
1669
  headers.append('Authorization', 'Bearer ' + data.authToken);
1646
1670
  headers.append('Content-Type', 'application/json');
1647
1671
  const request = {
@@ -1658,6 +1682,13 @@ class Epsilon {
1658
1682
  }
1659
1683
  const [res, err] = await this._client.do(url, request, __offlineOptions);
1660
1684
  if (err) {
1685
+ if (this._debug) {
1686
+ log('epsilon execute', {
1687
+ url,
1688
+ request,
1689
+ __offlineOptions,
1690
+ });
1691
+ }
1661
1692
  err.setMessage(`failed to execute epsilon: ${err.message}`);
1662
1693
  throw err;
1663
1694
  }
@@ -1669,21 +1700,6 @@ class Epsilon {
1669
1700
  }
1670
1701
  return res;
1671
1702
  }
1672
- async getEpsilonFileURL(fileName) {
1673
- var _a, _b;
1674
- if (!this.folders || ((_a = this.folders) === null || _a === void 0 ? void 0 : _a.length) === 0)
1675
- await this.setDefaults();
1676
- const virtualFile = (_b = this.folders) === null || _b === void 0 ? void 0 : _b.filter((result) => {
1677
- return result.Name === fileName;
1678
- });
1679
- if (virtualFile && virtualFile[0])
1680
- return (environment.host +
1681
- '/api/v1/views/' +
1682
- virtualFile[0].TemplateBagId +
1683
- '/files/' +
1684
- virtualFile[0].FileQid);
1685
- return '';
1686
- }
1687
1703
  }
1688
1704
 
1689
1705
  /******************************************************************************
@@ -202,7 +202,7 @@ class IndexedDbService {
202
202
  /**
203
203
  * The SDK version.
204
204
  */
205
- const VERSION = '0.0.0-VERSION';
205
+ const VERSION = '0.2.274-fix-sdk-epsilon-6f790382a40201ca742cb007f9a464edb3f0f148';
206
206
 
207
207
  class TwintagErrorValue {
208
208
  }
@@ -1580,6 +1580,17 @@ var BagType;
1580
1580
  BagType["Owner"] = "owner";
1581
1581
  })(BagType || (BagType = {}));
1582
1582
 
1583
+ function log(message, data) {
1584
+ if (this.config && this.config.debug) {
1585
+ if (data) {
1586
+ console.log(message + ': ', data);
1587
+ }
1588
+ else {
1589
+ console.log(message);
1590
+ }
1591
+ }
1592
+ }
1593
+
1583
1594
  /**
1584
1595
  * A epsilon class to execute the epsilon
1585
1596
  */
@@ -1592,20 +1603,24 @@ class Epsilon {
1592
1603
  *
1593
1604
  * @internal
1594
1605
  */
1595
- constructor(viewId, client, debug) {
1606
+ constructor(viewId, options) {
1596
1607
  this.viewId = viewId;
1597
- this._client = client || new Client();
1598
- if (debug) {
1599
- this._client.debug = this._debug = debug;
1600
- }
1601
- }
1602
- async setDefaults() {
1603
- var _a;
1608
+ this._client = (options === null || options === void 0 ? void 0 : options.client) || new Client();
1604
1609
  if (!this.view) {
1605
1610
  this.view = new View(this.viewId);
1606
1611
  }
1607
- if (!this.folders || ((_a = this.folders) === null || _a === void 0 ? void 0 : _a.length) === 0) {
1608
- this.folders = await this.view.list();
1612
+ if (options) {
1613
+ const { host = undefined, adminHost = undefined, debug = false } = options;
1614
+ if (host) {
1615
+ environment.host = host;
1616
+ }
1617
+ if (adminHost) {
1618
+ environment.adminHost = adminHost;
1619
+ }
1620
+ if (debug) {
1621
+ this._client.debug = debug;
1622
+ this._debug = debug;
1623
+ }
1609
1624
  }
1610
1625
  }
1611
1626
  /**
@@ -1618,9 +1633,18 @@ class Epsilon {
1618
1633
  */
1619
1634
  async execute(fileName, requestOptions, offlineOptions) {
1620
1635
  var _a;
1621
- const url = await this.getEpsilonFileURL(fileName);
1636
+ const url = `${environment.host}/api/v1/views/${this.viewId}/${fileName}.epsilon.js/run`;
1622
1637
  const headers = new Headers(requestOptions.headers);
1623
1638
  const data = await ((_a = this.view) === null || _a === void 0 ? void 0 : _a.data());
1639
+ if (this._debug) {
1640
+ log('epsilon execute', {
1641
+ url,
1642
+ headers,
1643
+ data,
1644
+ requestOptions,
1645
+ offlineOptions,
1646
+ });
1647
+ }
1624
1648
  headers.append('Authorization', 'Bearer ' + data.authToken);
1625
1649
  headers.append('Content-Type', 'application/json');
1626
1650
  const request = {
@@ -1637,6 +1661,13 @@ class Epsilon {
1637
1661
  }
1638
1662
  const [res, err] = await this._client.do(url, request, __offlineOptions);
1639
1663
  if (err) {
1664
+ if (this._debug) {
1665
+ log('epsilon execute', {
1666
+ url,
1667
+ request,
1668
+ __offlineOptions,
1669
+ });
1670
+ }
1640
1671
  err.setMessage(`failed to execute epsilon: ${err.message}`);
1641
1672
  throw err;
1642
1673
  }
@@ -1648,21 +1679,6 @@ class Epsilon {
1648
1679
  }
1649
1680
  return res;
1650
1681
  }
1651
- async getEpsilonFileURL(fileName) {
1652
- var _a, _b;
1653
- if (!this.folders || ((_a = this.folders) === null || _a === void 0 ? void 0 : _a.length) === 0)
1654
- await this.setDefaults();
1655
- const virtualFile = (_b = this.folders) === null || _b === void 0 ? void 0 : _b.filter((result) => {
1656
- return result.Name === fileName;
1657
- });
1658
- if (virtualFile && virtualFile[0])
1659
- return (environment.host +
1660
- '/api/v1/views/' +
1661
- virtualFile[0].TemplateBagId +
1662
- '/files/' +
1663
- virtualFile[0].FileQid);
1664
- return '';
1665
- }
1666
1682
  }
1667
1683
 
1668
1684
  /******************************************************************************