@jd-data-limited/easy-fm 3.0.0 → 3.0.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/package.json +1 -1
- package/src/index.js +27 -17
- package/src/index.ts +0 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1220,7 +1220,7 @@ export class Database extends EventEmitter {
|
|
|
1220
1220
|
});
|
|
1221
1221
|
});
|
|
1222
1222
|
}
|
|
1223
|
-
script(name, parameter) {
|
|
1223
|
+
script(name, parameter = "") {
|
|
1224
1224
|
return { name, parameter };
|
|
1225
1225
|
}
|
|
1226
1226
|
_tokenExpired() {
|
|
@@ -1457,21 +1457,32 @@ export class RecordBase extends EventEmitter {
|
|
|
1457
1457
|
});
|
|
1458
1458
|
}));
|
|
1459
1459
|
}
|
|
1460
|
-
commit(extraBody
|
|
1461
|
-
fieldData: undefined
|
|
1462
|
-
}) {
|
|
1460
|
+
commit(extraBody) {
|
|
1463
1461
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
1464
1462
|
let data = this.toObject();
|
|
1465
1463
|
delete data.recordId;
|
|
1466
1464
|
delete data.modId;
|
|
1465
|
+
if (extraBody.scripts.after) {
|
|
1466
|
+
data["script"] = extraBody.scripts.after.name;
|
|
1467
|
+
if (extraBody.scripts.after.parameter)
|
|
1468
|
+
data["param"] = extraBody.scripts.after.parameter;
|
|
1469
|
+
}
|
|
1470
|
+
if (extraBody.scripts.prerequest) {
|
|
1471
|
+
data["script"] = extraBody.scripts.after.name;
|
|
1472
|
+
if (extraBody.scripts.prerequest.parameter)
|
|
1473
|
+
data["param"] = extraBody.scripts.prerequest.parameter;
|
|
1474
|
+
}
|
|
1475
|
+
if (extraBody.scripts.presort) {
|
|
1476
|
+
data["script"] = extraBody.scripts.presort.name;
|
|
1477
|
+
if (extraBody.scripts.presort.parameter)
|
|
1478
|
+
data["param"] = extraBody.scripts.presort.parameter;
|
|
1479
|
+
}
|
|
1467
1480
|
if (this.recordId === -1) {
|
|
1468
1481
|
// This is a new LayoutRecord
|
|
1469
|
-
for (let item of Object.keys(data))
|
|
1470
|
-
extraBody[item] = data[item];
|
|
1471
1482
|
this.layout.database.apiRequest(`${this.layout.endpoint}/records`, {
|
|
1472
1483
|
port: 443,
|
|
1473
1484
|
method: "POST",
|
|
1474
|
-
body: JSON.stringify(
|
|
1485
|
+
body: JSON.stringify(data)
|
|
1475
1486
|
})
|
|
1476
1487
|
.then(res => {
|
|
1477
1488
|
if (typeof res.response.scriptError !== "undefined" && res.response.scriptError !== '0') {
|
|
@@ -1491,13 +1502,12 @@ export class RecordBase extends EventEmitter {
|
|
|
1491
1502
|
});
|
|
1492
1503
|
return;
|
|
1493
1504
|
}
|
|
1494
|
-
for (let item of Object.keys(data))
|
|
1495
|
-
extraBody[item] = data[item];
|
|
1505
|
+
// for (let item of Object.keys(data)) extraBody[item] = data[item]
|
|
1496
1506
|
console.log(extraBody.portalData);
|
|
1497
1507
|
this.layout.database.apiRequest(this.endpoint, {
|
|
1498
1508
|
port: 443,
|
|
1499
1509
|
method: "PATCH",
|
|
1500
|
-
body: JSON.stringify(
|
|
1510
|
+
body: JSON.stringify(data)
|
|
1501
1511
|
})
|
|
1502
1512
|
.then(res => {
|
|
1503
1513
|
if (typeof res.response.scriptError !== "undefined" && res.response.scriptError !== '0') {
|
|
@@ -1785,7 +1795,7 @@ export class PortalRecord extends RecordBase {
|
|
|
1785
1795
|
super._onSave();
|
|
1786
1796
|
this.portal.record._onSave();
|
|
1787
1797
|
}
|
|
1788
|
-
commit(extraBody
|
|
1798
|
+
commit(extraBody) {
|
|
1789
1799
|
return this.portal.record.commit(extraBody);
|
|
1790
1800
|
}
|
|
1791
1801
|
toObject(fieldFilter) {
|
|
@@ -1868,18 +1878,18 @@ export class RecordGetRange extends RecordGetOperation {
|
|
|
1868
1878
|
if (extraBody.scripts) {
|
|
1869
1879
|
if (extraBody.scripts.prerequest) {
|
|
1870
1880
|
params.push("script.prerequest=" + extraBody.scripts.prerequest.name);
|
|
1871
|
-
if (extraBody.scripts.prerequest.
|
|
1872
|
-
params.push("script.prerequest.param=" + extraBody.scripts.prerequest.
|
|
1881
|
+
if (extraBody.scripts.prerequest.parameter)
|
|
1882
|
+
params.push("script.prerequest.param=" + extraBody.scripts.prerequest.parameter);
|
|
1873
1883
|
}
|
|
1874
1884
|
if (extraBody.scripts.presort) {
|
|
1875
1885
|
params.push("script.presort=" + extraBody.scripts.presort.name);
|
|
1876
|
-
if (extraBody.scripts.presort.
|
|
1877
|
-
params.push("script.presort.param=" + extraBody.scripts.presort.
|
|
1886
|
+
if (extraBody.scripts.presort.parameter)
|
|
1887
|
+
params.push("script.presort.param=" + extraBody.scripts.presort.parameter);
|
|
1878
1888
|
}
|
|
1879
1889
|
if (extraBody.scripts.after) {
|
|
1880
1890
|
params.push("script=" + extraBody.scripts.after.name);
|
|
1881
|
-
if (extraBody.scripts.after.
|
|
1882
|
-
params.push("script.param=" + extraBody.scripts.after.
|
|
1891
|
+
if (extraBody.scripts.after.parameter)
|
|
1892
|
+
params.push("script.param=" + extraBody.scripts.after.parameter);
|
|
1883
1893
|
}
|
|
1884
1894
|
}
|
|
1885
1895
|
if (params.length === 0)
|
package/src/index.ts
CHANGED
|
@@ -1678,7 +1678,6 @@ export class RecordBase extends EventEmitter {
|
|
|
1678
1678
|
}
|
|
1679
1679
|
|
|
1680
1680
|
// for (let item of Object.keys(data)) extraBody[item] = data[item]
|
|
1681
|
-
console.log((extraBody as any).portalData)
|
|
1682
1681
|
this.layout.database.apiRequest(this.endpoint, {
|
|
1683
1682
|
port: 443,
|
|
1684
1683
|
method: "PATCH",
|