@azrico/webobject 1.5.33 → 1.5.35
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.
|
@@ -195,7 +195,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
195
195
|
case 12:
|
|
196
196
|
usepath = _context2.sent;
|
|
197
197
|
if ((0, _object.object_isEmpty)(deltaObject)) {
|
|
198
|
-
_context2.next =
|
|
198
|
+
_context2.next = 25;
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
canSaveResult = this.canSave(deltaObject);
|
|
@@ -211,43 +211,39 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
211
211
|
return _global.gfunc.run_action(putAction, usepath, deltaObject);
|
|
212
212
|
case 21:
|
|
213
213
|
resultObject = _context2.sent;
|
|
214
|
-
this.setSaveResult(resultObject, "auto");
|
|
215
|
-
|
|
216
|
-
console.error("bad save result : ", resultObject);
|
|
217
|
-
WebObject.addError(this, "Save result is not valid", "the response from server was not a valid saveresult object !", true);
|
|
218
|
-
}
|
|
219
|
-
_context2.next = 27;
|
|
214
|
+
this.setSaveResult(resultObject, "auto", true);
|
|
215
|
+
_context2.next = 26;
|
|
220
216
|
break;
|
|
221
|
-
case
|
|
217
|
+
case 25:
|
|
222
218
|
/* nothing to save */
|
|
223
219
|
this.setSaveResult(null, "nothing");
|
|
224
|
-
case
|
|
220
|
+
case 26:
|
|
225
221
|
if (!this.isSaved) {
|
|
226
|
-
_context2.next =
|
|
222
|
+
_context2.next = 30;
|
|
227
223
|
break;
|
|
228
224
|
}
|
|
229
|
-
_context2.next =
|
|
225
|
+
_context2.next = 29;
|
|
230
226
|
return this.onSave();
|
|
231
|
-
case
|
|
227
|
+
case 29:
|
|
232
228
|
return _context2.abrupt("return", this.getSaveResult());
|
|
233
|
-
case
|
|
234
|
-
_context2.prev =
|
|
229
|
+
case 30:
|
|
230
|
+
_context2.prev = 30;
|
|
235
231
|
if (!this.manager) {
|
|
236
|
-
_context2.next =
|
|
232
|
+
_context2.next = 36;
|
|
237
233
|
break;
|
|
238
234
|
}
|
|
239
|
-
_context2.next =
|
|
235
|
+
_context2.next = 34;
|
|
240
236
|
return this.manager.setOption("saving", false);
|
|
241
|
-
case
|
|
242
|
-
_context2.next =
|
|
237
|
+
case 34:
|
|
238
|
+
_context2.next = 36;
|
|
243
239
|
return this.manager.setOption("loading", false);
|
|
240
|
+
case 36:
|
|
241
|
+
return _context2.finish(30);
|
|
244
242
|
case 37:
|
|
245
|
-
return _context2.finish(31);
|
|
246
|
-
case 38:
|
|
247
243
|
case "end":
|
|
248
244
|
return _context2.stop();
|
|
249
245
|
}
|
|
250
|
-
}, _callee2, this, [[0,,
|
|
246
|
+
}, _callee2, this, [[0,, 30, 37]]);
|
|
251
247
|
}));
|
|
252
248
|
function Save() {
|
|
253
249
|
return _Save.apply(this, arguments);
|
|
@@ -1474,14 +1474,11 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1474
1474
|
var sub = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1475
1475
|
if ((0, _object.object_isEmpty)(result_object)) return false;
|
|
1476
1476
|
switch (_typeof(result_object)) {
|
|
1477
|
-
case "
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
return this.isResultValid(result_object);
|
|
1481
|
-
} catch (_unused) {
|
|
1477
|
+
case "object":
|
|
1478
|
+
/* ----------------------------- result is error ---------------------------- */
|
|
1479
|
+
if (result_object instanceof Error) {
|
|
1482
1480
|
return false;
|
|
1483
1481
|
}
|
|
1484
|
-
case "object":
|
|
1485
1482
|
/* --------- maybe website sends the result as array with 1 element --------- */
|
|
1486
1483
|
if (Array.isArray(result_object)) {
|
|
1487
1484
|
if (sub) return false; //avoid going too deep
|
|
@@ -1495,6 +1492,13 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1495
1492
|
return (0, _object.object_equals)(result_object.expected, result_object.result);
|
|
1496
1493
|
}
|
|
1497
1494
|
return !(0, _string.string_isEmpty)(this.getID(result_object));
|
|
1495
|
+
case "string":
|
|
1496
|
+
try {
|
|
1497
|
+
result_object = JSON.parse(result_object);
|
|
1498
|
+
return this.isResultValid(result_object);
|
|
1499
|
+
} catch (_unused) {
|
|
1500
|
+
return false;
|
|
1501
|
+
}
|
|
1498
1502
|
case "number":
|
|
1499
1503
|
return result_object > 0;
|
|
1500
1504
|
case "boolean":
|