@azrico/webobject 1.4.67 → 1.4.68

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.
@@ -6,6 +6,7 @@ export type deltaParams = {
6
6
  useDelta?: boolean;
7
7
  allProperties?: boolean;
8
8
  extraProperties?: boolean;
9
+ needId?: boolean;
9
10
  applyFilter?: boolean;
10
11
  };
11
12
  export declare class WebObject extends SimpleObject {
@@ -200,7 +200,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
200
200
  return (_get_deltaObject = _get_deltaObject || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(p) {
201
201
  var _this2 = this,
202
202
  _parseObj;
203
- var final_object, isChild, useDelta, allProperties, chkChangables, useExtraProps, dlt, allkeys, changableKeys, functionProps, index, fp, parseObj, _iterator, _step, key, tempusers;
203
+ var final_object, isChild, useDelta, allProperties, needId, chkChangables, useExtraProps, dlt, allkeys, changableKeys, functionProps, index, fp, parseObj, _iterator, _step, key, tempusers;
204
204
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
205
205
  while (1) switch (_context5.prev = _context5.next) {
206
206
  case 0:
@@ -271,7 +271,8 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
271
271
  final_object = {}; //@ts-ignore
272
272
  isChild = Boolean(p.isChild || p.ischild); //@ts-ignore
273
273
  useDelta = this.__use_delta || Boolean(p.useDelta || p.usedelta); //@ts-ignore
274
- allProperties = Boolean(p.allProperties || p.allproperties);
274
+ allProperties = Boolean(p.allProperties || p.allproperties); //@ts-ignore
275
+ needId = Boolean(p.needId || p.needid);
275
276
  chkChangables = this.__changeables != null || this.__unchangeables != null;
276
277
  useExtraProps = Boolean(p.extraProperties); //child objects usually dont update their __delta, so we read info from all of its properties
277
278
  dlt = allProperties || !useDelta && isChild && chkChangables ? _objectSpread({}, this.allproperties) : _objectSpread({}, this.__delta);
@@ -282,13 +283,13 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
282
283
  ignoreProtected: allProperties
283
284
  });
284
285
  }) : allkeys;
285
- _context5.next = 13;
286
+ _context5.next = 14;
286
287
  return _convert["default"].applyFormats({
287
288
  inputobject: dlt,
288
289
  formats: (0, _object.object_getStatic)(this, "__formatList"),
289
290
  changableKeys: changableKeys
290
291
  });
291
- case 13:
292
+ case 14:
292
293
  /* -------------------------------------------------------------------------- */
293
294
  /* __functionProperties */
294
295
  /* -------------------------------------------------------------------------- */
@@ -303,42 +304,44 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
303
304
  /* parse all changableKeys */
304
305
  /* -------------------------------------------------------------------------- */
305
306
  _iterator = _createForOfIteratorHelper(changableKeys);
306
- _context5.prev = 16;
307
+ _context5.prev = 17;
307
308
  _iterator.s();
308
- case 18:
309
+ case 19:
309
310
  if ((_step = _iterator.n()).done) {
310
- _context5.next = 25;
311
+ _context5.next = 26;
311
312
  break;
312
313
  }
313
314
  key = _step.value;
314
- _context5.next = 22;
315
+ _context5.next = 23;
315
316
  return parseObj(dlt[key]);
316
- case 22:
317
- final_object[key] = _context5.sent;
318
317
  case 23:
319
- _context5.next = 18;
318
+ final_object[key] = _context5.sent;
319
+ case 24:
320
+ _context5.next = 19;
320
321
  break;
321
- case 25:
322
- _context5.next = 30;
322
+ case 26:
323
+ _context5.next = 31;
323
324
  break;
324
- case 27:
325
- _context5.prev = 27;
326
- _context5.t0 = _context5["catch"](16);
325
+ case 28:
326
+ _context5.prev = 28;
327
+ _context5.t0 = _context5["catch"](17);
327
328
  _iterator.e(_context5.t0);
328
- case 30:
329
- _context5.prev = 30;
329
+ case 31:
330
+ _context5.prev = 31;
330
331
  _iterator.f();
331
- return _context5.finish(30);
332
- case 33:
332
+ return _context5.finish(31);
333
+ case 34:
333
334
  /* -------------------------------------------------------------------------- */
334
335
  /* add id properties */
335
336
  /* -------------------------------------------------------------------------- */
336
337
  if (allProperties) {
337
- final_object["_id"] = this.getID();
338
- final_object["_index_key"] = this["_index_key"];
339
- final_object["_index_value"] = this.getIndex();
340
338
  final_object["_created_date"] = this["_created_date"];
341
339
  }
340
+ if (allProperties || needId) {
341
+ if (this["_index_key"]) final_object["_index_key"] = this["_index_key"];
342
+ if (this.getIndex()) final_object["_index_value"] = this.getIndex();
343
+ if (this.getID()) final_object["_id"] = this.getID();
344
+ }
342
345
  /* -------------------------------------------------------------------------- */
343
346
  /* fix _user property */
344
347
  /* -------------------------------------------------------------------------- */
@@ -350,11 +353,11 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
350
353
  final_object["_users"] = (0, _object.wrap_array)(tempusers);
351
354
  }
352
355
  return _context5.abrupt("return", final_object);
353
- case 36:
356
+ case 38:
354
357
  case "end":
355
358
  return _context5.stop();
356
359
  }
357
- }, _callee5, this, [[16, 27, 30, 33]]);
360
+ }, _callee5, this, [[17, 28, 31, 34]]);
358
361
  }))).apply(this, arguments);
359
362
  } /* --------------------------------- Getters -------------------------------- */
360
363
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.67",
3
+ "version": "1.4.68",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",