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