@qubit-ltd/common-decorator 3.10.0 → 3.10.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.
@@ -1608,7 +1608,6 @@ function ofValueImpl(Class, value) {
1608
1608
  * The default instance of the specified class, or a new instance will be
1609
1609
  * created if it does not exist.
1610
1610
  * @author Haixing Hu
1611
- * @private
1612
1611
  */
1613
1612
  function getDefaultInstance(Class) {
1614
1613
  if (Class.prototype === Object.prototype) {
@@ -1810,7 +1809,6 @@ function getFieldMetadata(metadata, field, key) {
1810
1809
  * @return {function|null}
1811
1810
  * the element type of the specified field of the object, or `null` if the
1812
1811
  * field element type cannot be inferred.
1813
- * @private
1814
1812
  * @author Haixing Hu
1815
1813
  */
1816
1814
  function getFieldElementType(Class, field) {
@@ -1878,7 +1876,6 @@ function getFieldElementType(Class, field) {
1878
1876
  * @return {function|undefined}
1879
1877
  * the type of the specified field of the object, or `undefined` if the field
1880
1878
  * type cannot be inferred.
1881
- * @private
1882
1879
  * @author Haixing Hu
1883
1880
  */
1884
1881
  function getFieldType(Class, field) {
@@ -1933,7 +1930,6 @@ function getFieldType(Class, field) {
1933
1930
  * @return {string}
1934
1931
  * The corresponding key of the source object.
1935
1932
  * @author Haixing Hu
1936
- * @private
1937
1933
  */
1938
1934
  function getSourceField(targetField, options) {
1939
1935
  if ((options === null || options === void 0 ? void 0 : options.convertNaming) === true) {
@@ -12063,8 +12059,15 @@ function Model(Class, context) {
12063
12059
  * @name Model#toJSON
12064
12060
  * @memberof Model
12065
12061
  */
12066
- Class.prototype.toJSON = function toJSON(key) {
12067
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
12062
+ Class.prototype.toJSON = function toJSON() {
12063
+ var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
12064
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12065
+ if (_typeof(key) === 'object') {
12066
+ // if the key is an object, it means that the `toJSON()` method is called
12067
+ // directly with the only argument `options`, so the `key` is the `options`
12068
+ options = key;
12069
+ key = '';
12070
+ }
12068
12071
  return toJsonImpl(this, key, _objectSpread$1(_objectSpread$1({}, options), {}, {
12069
12072
  skipRootToJSON: true
12070
12073
  }));
@@ -12122,7 +12125,7 @@ function Model(Class, context) {
12122
12125
  * @memberof Model
12123
12126
  */
12124
12127
  Class.prototype.toJsonString = function toJsonString() {
12125
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
12128
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12126
12129
  return toJsonStringImpl(Class, this, options);
12127
12130
  };
12128
12131
  }
@@ -13319,6 +13322,10 @@ exports.createArray = createArray;
13319
13322
  exports.createPage = createPage;
13320
13323
  exports.defaultNormalizer = defaultNormalizer;
13321
13324
  exports.enumNormalizer = enumNormalizer;
13325
+ exports.getDefaultInstance = getDefaultInstance;
13326
+ exports.getFieldElementType = getFieldElementType;
13327
+ exports.getFieldType = getFieldType;
13328
+ exports.getSourceField = getSourceField;
13322
13329
  exports.isEnumClass = isEnumClass;
13323
13330
  exports.isEnumerator = isEnumerator;
13324
13331
  exports.normalize = normalize;