@xmobitea/gn-typescript-client 2.0.11 → 2.0.12

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.
@@ -11679,6 +11679,27 @@ var getGNReflectedDataType = function (prototype, propertyKey) {
11679
11679
  return GNMetadata_1.FieldDataType.Object;
11680
11680
  }
11681
11681
  };
11682
+ var getGNReflectedMetadata = function (prototype, propertyKey) {
11683
+ var t = Reflect.getMetadata("design:type", prototype, propertyKey);
11684
+ if (!t) {
11685
+ throw Error("Cannot get gn reflected data type for ".concat(prototype.constructor.name, ":").concat(propertyKey));
11686
+ }
11687
+ var answer = {
11688
+ fieldDataType: null,
11689
+ prototype: t.prototype
11690
+ };
11691
+ if (t.name == "Boolean")
11692
+ answer.fieldDataType = GNMetadata_1.FieldDataType.Boolean;
11693
+ else if (t.name == "Number")
11694
+ answer.fieldDataType = GNMetadata_1.FieldDataType.Number;
11695
+ else if (t.name == "String")
11696
+ answer.fieldDataType = GNMetadata_1.FieldDataType.String;
11697
+ else if (t.name == "Array")
11698
+ answer.fieldDataType = GNMetadata_1.FieldDataType.Array;
11699
+ else
11700
+ answer.fieldDataType = GNMetadata_1.FieldDataType.Object;
11701
+ return answer;
11702
+ };
11682
11703
  var initGNObjectMetadata = function (prototype) {
11683
11704
  if (prototype === Object.prototype) {
11684
11705
  return {};
@@ -11694,10 +11715,12 @@ var initGNObjectFieldMetadata = function (prototype, propertyKey) {
11694
11715
  var meta = (0, exports.initGNObjectMetadata)(prototype);
11695
11716
  var fieldIndex = meta.fields.findIndex(function (f) { return f.name === propertyKey; });
11696
11717
  if (fieldIndex < 0) {
11718
+ var gnReflectedMetadata = getGNReflectedMetadata(prototype, propertyKey);
11697
11719
  var field = {
11698
11720
  name: propertyKey,
11699
- fieldType: getGNReflectedDataType(prototype, propertyKey),
11700
- cls: prototype.constructor
11721
+ // fieldType: getGNReflectedDataType(prototype, propertyKey),
11722
+ fieldType: gnReflectedMetadata.fieldDataType,
11723
+ cls: gnReflectedMetadata.prototype.constructor
11701
11724
  };
11702
11725
  meta.fields.push(field);
11703
11726
  return field;