@azrico/webobject 1.4.54 → 1.4.56
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,39 +206,39 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
206
206
|
value: function () {
|
|
207
207
|
var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(p) {
|
|
208
208
|
var _this2 = this;
|
|
209
|
-
var final_object, isChild, useDelta, allProperties, chkChangables, useExtraProps, dlt, allkeys, changableKeys,
|
|
210
|
-
return _regeneratorRuntime().wrap(function _callee5$(
|
|
211
|
-
while (1) switch (
|
|
209
|
+
var final_object, isChild, useDelta, allProperties, chkChangables, useExtraProps, dlt, allkeys, changableKeys, functionProps, index, fp, formats, simpleProps, _loop, formatname, parseObj, _parseObj, _iterator, _step, key, tempusers;
|
|
210
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context6) {
|
|
211
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
212
212
|
case 0:
|
|
213
213
|
_parseObj = function _parseObj3() {
|
|
214
214
|
_parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(obj) {
|
|
215
215
|
var newobj_dlt;
|
|
216
|
-
return _regeneratorRuntime().wrap(function _callee4$(
|
|
217
|
-
while (1) switch (
|
|
216
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context5) {
|
|
217
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
218
218
|
case 0:
|
|
219
219
|
if (!(obj == null)) {
|
|
220
|
-
|
|
220
|
+
_context5.next = 2;
|
|
221
221
|
break;
|
|
222
222
|
}
|
|
223
|
-
return
|
|
223
|
+
return _context5.abrupt("return", undefined);
|
|
224
224
|
case 2:
|
|
225
225
|
if (!Array.isArray(obj)) {
|
|
226
|
-
|
|
226
|
+
_context5.next = 6;
|
|
227
227
|
break;
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
_context5.next = 5;
|
|
230
230
|
return Promise.all(obj.map( /*#__PURE__*/function () {
|
|
231
231
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(r) {
|
|
232
|
-
return _regeneratorRuntime().wrap(function _callee3$(
|
|
233
|
-
while (1) switch (
|
|
232
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context4) {
|
|
233
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
234
234
|
case 0:
|
|
235
|
-
|
|
235
|
+
_context4.next = 2;
|
|
236
236
|
return parseObj(r);
|
|
237
237
|
case 2:
|
|
238
|
-
return
|
|
238
|
+
return _context4.abrupt("return", _context4.sent);
|
|
239
239
|
case 3:
|
|
240
240
|
case "end":
|
|
241
|
-
return
|
|
241
|
+
return _context4.stop();
|
|
242
242
|
}
|
|
243
243
|
}, _callee3);
|
|
244
244
|
}));
|
|
@@ -247,30 +247,30 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
247
247
|
};
|
|
248
248
|
}()));
|
|
249
249
|
case 5:
|
|
250
|
-
return
|
|
250
|
+
return _context5.abrupt("return", _context5.sent);
|
|
251
251
|
case 6:
|
|
252
252
|
if (!(obj instanceof WebObject && typeof obj.get_deltaObject === "function")) {
|
|
253
|
-
|
|
253
|
+
_context5.next = 15;
|
|
254
254
|
break;
|
|
255
255
|
}
|
|
256
|
-
|
|
256
|
+
_context5.next = 9;
|
|
257
257
|
return obj.get_deltaObject(_objectSpread(_objectSpread({}, p), {}, {
|
|
258
258
|
isChild: true
|
|
259
259
|
}));
|
|
260
260
|
case 9:
|
|
261
|
-
newobj_dlt =
|
|
261
|
+
newobj_dlt = _context5.sent;
|
|
262
262
|
if ((0, _object.object_isEmpty)(newobj_dlt)) {
|
|
263
|
-
|
|
263
|
+
_context5.next = 14;
|
|
264
264
|
break;
|
|
265
265
|
}
|
|
266
|
-
return
|
|
266
|
+
return _context5.abrupt("return", newobj_dlt);
|
|
267
267
|
case 14:
|
|
268
|
-
return
|
|
268
|
+
return _context5.abrupt("return", obj);
|
|
269
269
|
case 15:
|
|
270
|
-
return
|
|
270
|
+
return _context5.abrupt("return", obj);
|
|
271
271
|
case 16:
|
|
272
272
|
case "end":
|
|
273
|
-
return
|
|
273
|
+
return _context5.stop();
|
|
274
274
|
}
|
|
275
275
|
}, _callee4);
|
|
276
276
|
}));
|
|
@@ -294,6 +294,9 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
294
294
|
ignoreProtected: allProperties
|
|
295
295
|
});
|
|
296
296
|
}) : allkeys;
|
|
297
|
+
/* -------------------------------------------------------------------------- */
|
|
298
|
+
/* __functionProperties */
|
|
299
|
+
/* -------------------------------------------------------------------------- */
|
|
297
300
|
functionProps = (0, _object.object_getStatic)(this, "__functionProperties");
|
|
298
301
|
if (Array.isArray(functionProps)) {
|
|
299
302
|
for (index = 0; index < functionProps.length; index++) {
|
|
@@ -301,40 +304,101 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
301
304
|
if (dlt[fp]) dlt[fp] = (0, _object.fn_eval_this)(this, dlt[fp]);
|
|
302
305
|
}
|
|
303
306
|
}
|
|
307
|
+
/* -------------------------------------------------------------------------- */
|
|
308
|
+
/* __formatList */
|
|
309
|
+
/* -------------------------------------------------------------------------- */
|
|
310
|
+
formats = (0, _object.object_getStatic)(this, "__formatList");
|
|
311
|
+
if (!formats) {
|
|
312
|
+
_context6.next = 26;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
simpleProps = (0, _object.wrap_array)(formats.simple);
|
|
316
|
+
delete formats.simple;
|
|
317
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop(formatname) {
|
|
318
|
+
var formatKeys;
|
|
319
|
+
return _regeneratorRuntime().wrap(function _loop$(_context3) {
|
|
320
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
321
|
+
case 0:
|
|
322
|
+
formatKeys = formats[formatname];
|
|
323
|
+
if (Array.isArray(formatKeys)) {
|
|
324
|
+
formatKeys.forEach(function (fk) {
|
|
325
|
+
if (typeof dlt[fk] !== "string") return;
|
|
326
|
+
dlt[fk] = (0, _string.string_do)(formatname, dlt[fk]);
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
case 2:
|
|
330
|
+
case "end":
|
|
331
|
+
return _context3.stop();
|
|
332
|
+
}
|
|
333
|
+
}, _loop);
|
|
334
|
+
});
|
|
335
|
+
_context6.t0 = _regeneratorRuntime().keys(formats);
|
|
336
|
+
case 20:
|
|
337
|
+
if ((_context6.t1 = _context6.t0()).done) {
|
|
338
|
+
_context6.next = 25;
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
formatname = _context6.t1.value;
|
|
342
|
+
return _context6.delegateYield(_loop(formatname), "t2", 23);
|
|
343
|
+
case 23:
|
|
344
|
+
_context6.next = 20;
|
|
345
|
+
break;
|
|
346
|
+
case 25:
|
|
347
|
+
/* -------------------------------------------------------------------------- */
|
|
348
|
+
/* __simpleProperties */
|
|
349
|
+
/* -------------------------------------------------------------------------- */
|
|
350
|
+
if (Array.isArray(simpleProps)) {
|
|
351
|
+
simpleProps.forEach(function (sp) {
|
|
352
|
+
if (dlt[sp] == null) return;
|
|
353
|
+
var oldValue = dlt[sp];
|
|
354
|
+
var newKey = "simple_" + sp;
|
|
355
|
+
var newValue = typeof oldValue === "string" ? (0, _string.convert_to_simple_string)(oldValue) : undefined;
|
|
356
|
+
dlt[newKey] = newValue;
|
|
357
|
+
//make sure we include this key in delta!
|
|
358
|
+
changableKeys.push(newKey);
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
case 26:
|
|
304
362
|
_iterator = _createForOfIteratorHelper(changableKeys);
|
|
305
|
-
|
|
363
|
+
_context6.prev = 27;
|
|
306
364
|
_iterator.s();
|
|
307
|
-
case
|
|
365
|
+
case 29:
|
|
308
366
|
if ((_step = _iterator.n()).done) {
|
|
309
|
-
|
|
367
|
+
_context6.next = 36;
|
|
310
368
|
break;
|
|
311
369
|
}
|
|
312
370
|
key = _step.value;
|
|
313
|
-
|
|
371
|
+
_context6.next = 33;
|
|
314
372
|
return parseObj(dlt[key]);
|
|
315
|
-
case
|
|
316
|
-
final_object[key] =
|
|
317
|
-
case
|
|
318
|
-
|
|
373
|
+
case 33:
|
|
374
|
+
final_object[key] = _context6.sent;
|
|
375
|
+
case 34:
|
|
376
|
+
_context6.next = 29;
|
|
319
377
|
break;
|
|
320
|
-
case
|
|
321
|
-
|
|
378
|
+
case 36:
|
|
379
|
+
_context6.next = 41;
|
|
322
380
|
break;
|
|
323
|
-
case
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
_iterator.e(
|
|
327
|
-
case
|
|
328
|
-
|
|
381
|
+
case 38:
|
|
382
|
+
_context6.prev = 38;
|
|
383
|
+
_context6.t3 = _context6["catch"](27);
|
|
384
|
+
_iterator.e(_context6.t3);
|
|
385
|
+
case 41:
|
|
386
|
+
_context6.prev = 41;
|
|
329
387
|
_iterator.f();
|
|
330
|
-
return
|
|
331
|
-
case
|
|
388
|
+
return _context6.finish(41);
|
|
389
|
+
case 44:
|
|
390
|
+
/* -------------------------------------------------------------------------- */
|
|
391
|
+
/* add id properties */
|
|
392
|
+
/* -------------------------------------------------------------------------- */
|
|
332
393
|
if (allProperties) {
|
|
333
394
|
final_object["_id"] = this.getID();
|
|
334
395
|
final_object["_index_key"] = this["_index_key"];
|
|
335
396
|
final_object["_index_value"] = this.getIndex();
|
|
336
397
|
final_object["_created_date"] = this["_created_date"];
|
|
337
398
|
}
|
|
399
|
+
/* -------------------------------------------------------------------------- */
|
|
400
|
+
/* fix _user property */
|
|
401
|
+
/* -------------------------------------------------------------------------- */
|
|
338
402
|
if (final_object["_users"]) {
|
|
339
403
|
tempusers = final_object["_users"];
|
|
340
404
|
if (typeof tempusers === "string") tempusers = tempusers.split(",").filter(function (s) {
|
|
@@ -342,22 +406,12 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
342
406
|
});
|
|
343
407
|
final_object["_users"] = (0, _object.wrap_array)(tempusers);
|
|
344
408
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
simpleProps.forEach(function (sp) {
|
|
348
|
-
if (final_object[sp] == null) return;
|
|
349
|
-
var oldValue = final_object[sp];
|
|
350
|
-
var newKey = "simple_" + sp;
|
|
351
|
-
var newValue = typeof oldValue === "string" ? (0, _string.convert_to_simple_string)(oldValue) : undefined;
|
|
352
|
-
final_object[newKey] = newValue;
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
return _context5.abrupt("return", final_object);
|
|
356
|
-
case 37:
|
|
409
|
+
return _context6.abrupt("return", final_object);
|
|
410
|
+
case 47:
|
|
357
411
|
case "end":
|
|
358
|
-
return
|
|
412
|
+
return _context6.stop();
|
|
359
413
|
}
|
|
360
|
-
}, _callee5, this, [[
|
|
414
|
+
}, _callee5, this, [[27, 38, 41, 44]]);
|
|
361
415
|
}));
|
|
362
416
|
function get_deltaObject(_x) {
|
|
363
417
|
return _get_deltaObject.apply(this, arguments);
|
|
@@ -388,21 +442,21 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
388
442
|
var _len,
|
|
389
443
|
p,
|
|
390
444
|
_key,
|
|
391
|
-
|
|
392
|
-
return _regeneratorRuntime().wrap(function _callee6$(
|
|
393
|
-
while (1) switch (
|
|
445
|
+
_args7 = arguments;
|
|
446
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context7) {
|
|
447
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
394
448
|
case 0:
|
|
395
449
|
this.isDeleted = true;
|
|
396
|
-
for (_len =
|
|
397
|
-
p[_key] =
|
|
450
|
+
for (_len = _args7.length, p = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
451
|
+
p[_key] = _args7[_key];
|
|
398
452
|
}
|
|
399
|
-
|
|
453
|
+
_context7.next = 4;
|
|
400
454
|
return (_this$manager = this.manager) === null || _this$manager === void 0 ? void 0 : _this$manager.onDelete.apply(_this$manager, p);
|
|
401
455
|
case 4:
|
|
402
|
-
return
|
|
456
|
+
return _context7.abrupt("return", _context7.sent);
|
|
403
457
|
case 5:
|
|
404
458
|
case "end":
|
|
405
|
-
return
|
|
459
|
+
return _context7.stop();
|
|
406
460
|
}
|
|
407
461
|
}, _callee6, this);
|
|
408
462
|
}));
|
|
@@ -419,21 +473,21 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
419
473
|
var _len2,
|
|
420
474
|
p,
|
|
421
475
|
_key2,
|
|
422
|
-
|
|
423
|
-
return _regeneratorRuntime().wrap(function _callee7$(
|
|
424
|
-
while (1) switch (
|
|
476
|
+
_args8 = arguments;
|
|
477
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context8) {
|
|
478
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
425
479
|
case 0:
|
|
426
480
|
this.isDeleted = false;
|
|
427
|
-
for (_len2 =
|
|
428
|
-
p[_key2] =
|
|
481
|
+
for (_len2 = _args8.length, p = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
482
|
+
p[_key2] = _args8[_key2];
|
|
429
483
|
}
|
|
430
|
-
|
|
484
|
+
_context8.next = 4;
|
|
431
485
|
return (_this$manager2 = this.manager) === null || _this$manager2 === void 0 ? void 0 : _this$manager2.onLoad.apply(_this$manager2, p);
|
|
432
486
|
case 4:
|
|
433
|
-
return
|
|
487
|
+
return _context8.abrupt("return", _context8.sent);
|
|
434
488
|
case 5:
|
|
435
489
|
case "end":
|
|
436
|
-
return
|
|
490
|
+
return _context8.stop();
|
|
437
491
|
}
|
|
438
492
|
}, _callee7, this);
|
|
439
493
|
}));
|
|
@@ -452,38 +506,38 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
452
506
|
_len3,
|
|
453
507
|
p,
|
|
454
508
|
_key3,
|
|
455
|
-
|
|
456
|
-
return _regeneratorRuntime().wrap(function _callee8$(
|
|
457
|
-
while (1) switch (
|
|
509
|
+
_args9 = arguments;
|
|
510
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context9) {
|
|
511
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
458
512
|
case 0:
|
|
459
513
|
if (!this.isSaved) {
|
|
460
|
-
|
|
514
|
+
_context9.next = 7;
|
|
461
515
|
break;
|
|
462
516
|
}
|
|
463
517
|
this.apply_changes();
|
|
464
518
|
srObject = this.getSaveResult(true);
|
|
465
519
|
if (!this.saveResultHasID(srObject)) {
|
|
466
|
-
|
|
520
|
+
_context9.next = 7;
|
|
467
521
|
break;
|
|
468
522
|
}
|
|
469
523
|
/* -------------------------------------------------------------------------- */
|
|
470
524
|
WebObject.LoadIdsFromSaveResult(this, srObject);
|
|
471
|
-
|
|
525
|
+
_context9.next = 7;
|
|
472
526
|
return (_this$manager3 = this.manager) === null || _this$manager3 === void 0 ? void 0 : _this$manager3.event_run("on_id_change");
|
|
473
527
|
case 7:
|
|
474
|
-
for (_len3 =
|
|
475
|
-
p[_key3] =
|
|
528
|
+
for (_len3 = _args9.length, p = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
529
|
+
p[_key3] = _args9[_key3];
|
|
476
530
|
}
|
|
477
|
-
|
|
531
|
+
_context9.next = 10;
|
|
478
532
|
return (_this$manager4 = this.manager) === null || _this$manager4 === void 0 ? void 0 : _this$manager4.onSave.apply(_this$manager4, p);
|
|
479
533
|
case 10:
|
|
480
|
-
|
|
534
|
+
_context9.next = 12;
|
|
481
535
|
return this.onAfterSave();
|
|
482
536
|
case 12:
|
|
483
|
-
return
|
|
537
|
+
return _context9.abrupt("return", true);
|
|
484
538
|
case 13:
|
|
485
539
|
case "end":
|
|
486
|
-
return
|
|
540
|
+
return _context9.stop();
|
|
487
541
|
}
|
|
488
542
|
}, _callee8, this);
|
|
489
543
|
}));
|
|
@@ -500,20 +554,20 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
500
554
|
var _len4,
|
|
501
555
|
p,
|
|
502
556
|
_key4,
|
|
503
|
-
|
|
504
|
-
return _regeneratorRuntime().wrap(function _callee9$(
|
|
505
|
-
while (1) switch (
|
|
557
|
+
_args10 = arguments;
|
|
558
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context10) {
|
|
559
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
506
560
|
case 0:
|
|
507
|
-
for (_len4 =
|
|
508
|
-
p[_key4] =
|
|
561
|
+
for (_len4 = _args10.length, p = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
562
|
+
p[_key4] = _args10[_key4];
|
|
509
563
|
}
|
|
510
|
-
|
|
564
|
+
_context10.next = 3;
|
|
511
565
|
return (_this$manager5 = this.manager) === null || _this$manager5 === void 0 ? void 0 : _this$manager5.onAfterSave.apply(_this$manager5, p);
|
|
512
566
|
case 3:
|
|
513
|
-
return
|
|
567
|
+
return _context10.abrupt("return", true);
|
|
514
568
|
case 4:
|
|
515
569
|
case "end":
|
|
516
|
-
return
|
|
570
|
+
return _context10.stop();
|
|
517
571
|
}
|
|
518
572
|
}, _callee9, this);
|
|
519
573
|
}));
|
|
@@ -545,20 +599,20 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
545
599
|
var _len5,
|
|
546
600
|
p,
|
|
547
601
|
_key5,
|
|
548
|
-
|
|
549
|
-
return _regeneratorRuntime().wrap(function _callee10$(
|
|
550
|
-
while (1) switch (
|
|
602
|
+
_args11 = arguments;
|
|
603
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context11) {
|
|
604
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
551
605
|
case 0:
|
|
552
|
-
for (_len5 =
|
|
553
|
-
p[_key5] =
|
|
606
|
+
for (_len5 = _args11.length, p = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
607
|
+
p[_key5] = _args11[_key5];
|
|
554
608
|
}
|
|
555
|
-
|
|
609
|
+
_context11.next = 3;
|
|
556
610
|
return (_this$manager6 = this.manager) === null || _this$manager6 === void 0 ? void 0 : _this$manager6.onNew.apply(_this$manager6, p);
|
|
557
611
|
case 3:
|
|
558
|
-
return
|
|
612
|
+
return _context11.abrupt("return", _context11.sent);
|
|
559
613
|
case 4:
|
|
560
614
|
case "end":
|
|
561
|
-
return
|
|
615
|
+
return _context11.stop();
|
|
562
616
|
}
|
|
563
617
|
}, _callee10, this);
|
|
564
618
|
}));
|
|
@@ -640,11 +694,11 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
640
694
|
_item,
|
|
641
695
|
_index2,
|
|
642
696
|
_item2,
|
|
643
|
-
|
|
644
|
-
return _regeneratorRuntime().wrap(function _callee11$(
|
|
645
|
-
while (1) switch (
|
|
697
|
+
_args12 = arguments;
|
|
698
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context12) {
|
|
699
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
646
700
|
case 0:
|
|
647
|
-
extraOptions =
|
|
701
|
+
extraOptions = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
|
|
648
702
|
if (!extraOptions) extraOptions = {};
|
|
649
703
|
chunks = (0, _object.array_chunks)(itemList, (_extraOptions$chunksi = extraOptions.chunksize) !== null && _extraOptions$chunksi !== void 0 ? _extraOptions$chunksi : 50);
|
|
650
704
|
delete extraOptions.chunksize;
|
|
@@ -652,7 +706,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
652
706
|
index = 0;
|
|
653
707
|
case 6:
|
|
654
708
|
if (!(index < chunks.length)) {
|
|
655
|
-
|
|
709
|
+
_context12.next = 36;
|
|
656
710
|
break;
|
|
657
711
|
}
|
|
658
712
|
items_to_save = chunks[index];
|
|
@@ -660,79 +714,79 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
660
714
|
k = 0;
|
|
661
715
|
case 10:
|
|
662
716
|
if (!(k < items_to_save.length)) {
|
|
663
|
-
|
|
717
|
+
_context12.next = 19;
|
|
664
718
|
break;
|
|
665
719
|
}
|
|
666
720
|
item = items_to_save[k];
|
|
667
|
-
|
|
721
|
+
_context12.next = 14;
|
|
668
722
|
return item.get_deltaObject();
|
|
669
723
|
case 14:
|
|
670
|
-
dlt =
|
|
724
|
+
dlt = _context12.sent;
|
|
671
725
|
save_array.push(item.isNew ? _objectSpread({}, dlt) : _objectSpread({
|
|
672
726
|
_id: item.getID()
|
|
673
727
|
}, dlt));
|
|
674
728
|
case 16:
|
|
675
729
|
k++;
|
|
676
|
-
|
|
730
|
+
_context12.next = 10;
|
|
677
731
|
break;
|
|
678
732
|
case 19:
|
|
679
|
-
|
|
733
|
+
_context12.next = 21;
|
|
680
734
|
return _global.gfunc.run_action("post", putAddress, _objectSpread({
|
|
681
735
|
__save_list: WebObject.zipSaveList(save_array)
|
|
682
736
|
}, extraOptions));
|
|
683
737
|
case 21:
|
|
684
|
-
resultObject =
|
|
738
|
+
resultObject = _context12.sent;
|
|
685
739
|
if (!Array.isArray(resultObject)) {
|
|
686
|
-
|
|
740
|
+
_context12.next = 33;
|
|
687
741
|
break;
|
|
688
742
|
}
|
|
689
743
|
_index = 0;
|
|
690
744
|
case 24:
|
|
691
745
|
if (!(_index < Math.min(resultObject.length, items_to_save.length))) {
|
|
692
|
-
|
|
746
|
+
_context12.next = 33;
|
|
693
747
|
break;
|
|
694
748
|
}
|
|
695
749
|
res = resultObject[_index];
|
|
696
750
|
_item = items_to_save[_index];
|
|
697
751
|
_item.setSaveResult(res);
|
|
698
|
-
|
|
752
|
+
_context12.next = 30;
|
|
699
753
|
return _item.onSave();
|
|
700
754
|
case 30:
|
|
701
755
|
_index++;
|
|
702
|
-
|
|
756
|
+
_context12.next = 24;
|
|
703
757
|
break;
|
|
704
758
|
case 33:
|
|
705
759
|
index++;
|
|
706
|
-
|
|
760
|
+
_context12.next = 6;
|
|
707
761
|
break;
|
|
708
762
|
case 36:
|
|
709
763
|
_index2 = 0;
|
|
710
764
|
case 37:
|
|
711
765
|
if (!(_index2 < itemList.length)) {
|
|
712
|
-
|
|
766
|
+
_context12.next = 46;
|
|
713
767
|
break;
|
|
714
768
|
}
|
|
715
769
|
_item2 = itemList[_index2];
|
|
716
770
|
if (_item2.isSaved) {
|
|
717
|
-
|
|
771
|
+
_context12.next = 41;
|
|
718
772
|
break;
|
|
719
773
|
}
|
|
720
|
-
return
|
|
774
|
+
return _context12.abrupt("return", false);
|
|
721
775
|
case 41:
|
|
722
776
|
if (!(_item2.getSaveResultType() != "normal")) {
|
|
723
|
-
|
|
777
|
+
_context12.next = 43;
|
|
724
778
|
break;
|
|
725
779
|
}
|
|
726
|
-
return
|
|
780
|
+
return _context12.abrupt("return", false);
|
|
727
781
|
case 43:
|
|
728
782
|
_index2++;
|
|
729
|
-
|
|
783
|
+
_context12.next = 37;
|
|
730
784
|
break;
|
|
731
785
|
case 46:
|
|
732
|
-
return
|
|
786
|
+
return _context12.abrupt("return", true);
|
|
733
787
|
case 47:
|
|
734
788
|
case "end":
|
|
735
|
-
return
|
|
789
|
+
return _context12.stop();
|
|
736
790
|
}
|
|
737
791
|
}, _callee11, this);
|
|
738
792
|
}));
|
|
@@ -793,53 +847,53 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
793
847
|
fetchID,
|
|
794
848
|
res,
|
|
795
849
|
params,
|
|
796
|
-
|
|
797
|
-
return _regeneratorRuntime().wrap(function _callee12$(
|
|
798
|
-
while (1) switch (
|
|
850
|
+
_args13 = arguments;
|
|
851
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context13) {
|
|
852
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
799
853
|
case 0:
|
|
800
|
-
for (_len6 =
|
|
801
|
-
p[_key6] =
|
|
854
|
+
for (_len6 = _args13.length, p = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
855
|
+
p[_key6] = _args13[_key6];
|
|
802
856
|
}
|
|
803
857
|
search = p.shift();
|
|
804
858
|
readonly = p.shift();
|
|
805
859
|
fetchID = p.shift();
|
|
806
860
|
if (!(0, _object.object_isEmpty)(search)) {
|
|
807
|
-
|
|
861
|
+
_context13.next = 6;
|
|
808
862
|
break;
|
|
809
863
|
}
|
|
810
|
-
return
|
|
864
|
+
return _context13.abrupt("return", undefined);
|
|
811
865
|
case 6:
|
|
812
866
|
params = {};
|
|
813
867
|
params.context = readonly ? "view" : "edit";
|
|
814
|
-
|
|
815
|
-
|
|
868
|
+
_context13.t0 = _typeof(search);
|
|
869
|
+
_context13.next = _context13.t0 === "string" ? 11 : _context13.t0 === "number" ? 11 : _context13.t0 === "object" ? 19 : 19;
|
|
816
870
|
break;
|
|
817
871
|
case 11:
|
|
818
872
|
search = String(search);
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
873
|
+
_context13.t1 = this;
|
|
874
|
+
_context13.t2 = this;
|
|
875
|
+
_context13.next = 16;
|
|
822
876
|
return _global.gfunc.run_action("get", this.__web_path + "/" + search, params, {
|
|
823
877
|
fetchID: fetchID
|
|
824
878
|
});
|
|
825
879
|
case 16:
|
|
826
|
-
|
|
827
|
-
res =
|
|
828
|
-
return
|
|
880
|
+
_context13.t3 = _context13.sent;
|
|
881
|
+
res = _context13.t1.ensure.call(_context13.t1, _context13.t2, _context13.t3);
|
|
882
|
+
return _context13.abrupt("break", 25);
|
|
829
883
|
case 19:
|
|
830
|
-
|
|
831
|
-
|
|
884
|
+
_context13.t4 = _object.object_first;
|
|
885
|
+
_context13.next = 22;
|
|
832
886
|
return this.get_list(search, readonly, fetchID);
|
|
833
887
|
case 22:
|
|
834
|
-
|
|
835
|
-
res = (0,
|
|
836
|
-
return
|
|
888
|
+
_context13.t5 = _context13.sent;
|
|
889
|
+
res = (0, _context13.t4)(_context13.t5);
|
|
890
|
+
return _context13.abrupt("break", 25);
|
|
837
891
|
case 25:
|
|
838
892
|
WebObject.setReadonly(res, readonly);
|
|
839
|
-
return
|
|
893
|
+
return _context13.abrupt("return", res);
|
|
840
894
|
case 27:
|
|
841
895
|
case "end":
|
|
842
|
-
return
|
|
896
|
+
return _context13.stop();
|
|
843
897
|
}
|
|
844
898
|
}, _callee12, this);
|
|
845
899
|
}));
|
|
@@ -865,30 +919,30 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
865
919
|
result_items,
|
|
866
920
|
selftype,
|
|
867
921
|
res,
|
|
868
|
-
|
|
869
|
-
return _regeneratorRuntime().wrap(function _callee13$(
|
|
870
|
-
while (1) switch (
|
|
922
|
+
_args14 = arguments;
|
|
923
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context14) {
|
|
924
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
871
925
|
case 0:
|
|
872
|
-
for (_len7 =
|
|
873
|
-
p[_key7] =
|
|
926
|
+
for (_len7 = _args14.length, p = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
927
|
+
p[_key7] = _args14[_key7];
|
|
874
928
|
}
|
|
875
929
|
search = p.shift();
|
|
876
930
|
readonly = p.shift();
|
|
877
931
|
fetchID = p.shift();
|
|
878
932
|
if (!search) search = {};
|
|
879
|
-
|
|
933
|
+
_context14.next = 7;
|
|
880
934
|
return _global.gfunc.run_action("get", this.__web_path, search, {
|
|
881
935
|
fetchID: fetchID
|
|
882
936
|
});
|
|
883
937
|
case 7:
|
|
884
|
-
result_items =
|
|
938
|
+
result_items = _context14.sent;
|
|
885
939
|
selftype = this.prototype;
|
|
886
940
|
res = WebObject.map_rowindex(WebObject.mapto(selftype, result_items, readonly));
|
|
887
941
|
WebObject.setReadonly(res, readonly);
|
|
888
|
-
return
|
|
942
|
+
return _context14.abrupt("return", res);
|
|
889
943
|
case 12:
|
|
890
944
|
case "end":
|
|
891
|
-
return
|
|
945
|
+
return _context14.stop();
|
|
892
946
|
}
|
|
893
947
|
}, _callee13, this);
|
|
894
948
|
}));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { strAction } from "@azrico/string";
|
|
1
2
|
import { MapableObject } from "./MapableObject";
|
|
2
3
|
import ObjectManager from "./ObjectManager";
|
|
3
4
|
export type saveResultType = "normal" | "nothing" | "error" | "canceled";
|
|
@@ -13,7 +14,9 @@ export declare class SimpleObject extends MapableObject {
|
|
|
13
14
|
static readonly __changeables?: string[];
|
|
14
15
|
static readonly __protectedProperties?: string[];
|
|
15
16
|
static readonly __functionProperties?: string[];
|
|
16
|
-
static readonly
|
|
17
|
+
static readonly __formatList?: {
|
|
18
|
+
[Property in strAction]?: string[];
|
|
19
|
+
};
|
|
17
20
|
static readonly __extraProperties?: string[];
|
|
18
21
|
static readonly __childTypes?: any[];
|
|
19
22
|
static readonly __importColumns?: string[];
|
|
@@ -1084,7 +1084,7 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
1084
1084
|
key: "delete_cache",
|
|
1085
1085
|
value: function delete_cache() {
|
|
1086
1086
|
if (!this.__cache_name) return;
|
|
1087
|
-
_global.gcache.
|
|
1087
|
+
_global.gcache.delete_session_cache(this.__cache_name);
|
|
1088
1088
|
}
|
|
1089
1089
|
}, {
|
|
1090
1090
|
key: "get_canModify",
|
|
@@ -1175,8 +1175,8 @@ _defineProperty(SimpleObject, "__changeables", void 0);
|
|
|
1175
1175
|
_defineProperty(SimpleObject, "__protectedProperties", void 0);
|
|
1176
1176
|
//these properties will be evaluated when needed
|
|
1177
1177
|
_defineProperty(SimpleObject, "__functionProperties", void 0);
|
|
1178
|
-
//
|
|
1179
|
-
_defineProperty(SimpleObject, "
|
|
1178
|
+
//apply these string formats
|
|
1179
|
+
_defineProperty(SimpleObject, "__formatList", void 0);
|
|
1180
1180
|
//these properties usually are not directly changed and sometimes are included in deltaObject
|
|
1181
1181
|
_defineProperty(SimpleObject, "__extraProperties", void 0);
|
|
1182
1182
|
//types for children can be used when importing children
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azrico/webobject",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.56",
|
|
4
4
|
"description": "Stateful object",
|
|
5
5
|
"author": "Azrideus",
|
|
6
6
|
"license": "MIT",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@azrico/event": "^1.2.16",
|
|
73
|
-
"@azrico/global": "^1.3.
|
|
74
|
-
"@azrico/object": "^1.4.
|
|
75
|
-
"@azrico/string": "^1.2.
|
|
73
|
+
"@azrico/global": "^1.3.44",
|
|
74
|
+
"@azrico/object": "^1.4.69",
|
|
75
|
+
"@azrico/string": "^1.2.65",
|
|
76
76
|
"@azrico/types": "^1.0.1",
|
|
77
77
|
"@azrico/uid": "^1.0.5"
|
|
78
78
|
}
|