@jd-data-limited/easy-fm 3.0.1 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jd-data-limited/easy-fm",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "dependencies": {
5
5
  "@types/btoa": "^1.2.3",
6
6
  "@types/events": "^3.0.0",
package/src/index.js CHANGED
@@ -1384,6 +1384,7 @@ export class RecordBase extends EventEmitter {
1384
1384
  return !!this.fields.find(i => i.edited);
1385
1385
  }
1386
1386
  processPortalData(portalData) {
1387
+ this.portals = [];
1387
1388
  for (let item of Object.keys(portalData)) {
1388
1389
  let _portal = new Portal(this, item);
1389
1390
  _portal.records = portalData[item].map(item => {
@@ -1457,7 +1458,7 @@ export class RecordBase extends EventEmitter {
1457
1458
  });
1458
1459
  }));
1459
1460
  }
1460
- commit(extraBody) {
1461
+ commit(extraBody = {}) {
1461
1462
  return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1462
1463
  let data = this.toObject();
1463
1464
  delete data.recordId;
@@ -1503,7 +1504,6 @@ export class RecordBase extends EventEmitter {
1503
1504
  return;
1504
1505
  }
1505
1506
  // for (let item of Object.keys(data)) extraBody[item] = data[item]
1506
- console.log(extraBody.portalData);
1507
1507
  this.layout.database.apiRequest(this.endpoint, {
1508
1508
  port: 443,
1509
1509
  method: "PATCH",
@@ -1795,7 +1795,7 @@ export class PortalRecord extends RecordBase {
1795
1795
  super._onSave();
1796
1796
  this.portal.record._onSave();
1797
1797
  }
1798
- commit(extraBody) {
1798
+ commit(extraBody = {}) {
1799
1799
  return this.portal.record.commit(extraBody);
1800
1800
  }
1801
1801
  toObject(fieldFilter) {
package/src/index.ts CHANGED
@@ -1554,6 +1554,7 @@ export class RecordBase extends EventEmitter {
1554
1554
  }
1555
1555
 
1556
1556
  protected processPortalData(portalData): void {
1557
+ this.portals = []
1557
1558
  for (let item of Object.keys(portalData)) {
1558
1559
  let _portal = new Portal(this, item)
1559
1560
  _portal.records = portalData[item].map(item => {
@@ -1630,7 +1631,7 @@ export class RecordBase extends EventEmitter {
1630
1631
  })
1631
1632
  }
1632
1633
 
1633
- commit(extraBody: extraBodyOptions): Promise<RecordBase | FMError> {
1634
+ commit(extraBody: extraBodyOptions = {}): Promise<RecordBase | FMError> {
1634
1635
  return new Promise(async (resolve, reject) => {
1635
1636
  let data = this.toObject()
1636
1637
  delete data.recordId
@@ -2013,7 +2014,7 @@ export class PortalRecord extends RecordBase {
2013
2014
  this.portal.record._onSave()
2014
2015
  }
2015
2016
 
2016
- commit(extraBody: extraBodyOptions) {
2017
+ commit(extraBody: extraBodyOptions = {}) {
2017
2018
  return this.portal.record.commit(extraBody)
2018
2019
  }
2019
2020