@quatrain/core 0.5.3 → 0.5.6

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.
@@ -221,10 +221,18 @@ class DataObject {
221
221
  const value = prop.val();
222
222
  Reflect.set(data, key, value
223
223
  ? objectsAsReferences && !(value instanceof ObjectUri_1.ObjectUri)
224
- ? value.core.asReference() //toReference()
225
- : value.toJSON()
224
+ ? value.core.asReference()
225
+ : value.toJSON
226
+ ? value.toJSON()
227
+ : value
226
228
  : null);
227
229
  break;
230
+ case 'BooleanProperty':
231
+ Reflect.set(data, key, Boolean(prop.val()));
232
+ break;
233
+ case 'ArrayProperty':
234
+ Reflect.set(data, key, prop.val() || []);
235
+ break;
228
236
  default:
229
237
  Reflect.set(data, key, prop.val() || null);
230
238
  }
@@ -10,5 +10,6 @@ export declare class Property {
10
10
  static TYPE_HASH: string;
11
11
  static TYPE_DATETIME: string;
12
12
  static TYPE_ARRAY: string;
13
+ static TYPE_MAP: string;
13
14
  static factory<P extends BasePropertyType>(params: P, parent: DataObjectClass<any>): BaseProperty;
14
15
  }
@@ -11,6 +11,7 @@ const NumberProperty_1 = require("./NumberProperty");
11
11
  const ObjectProperty_1 = require("./ObjectProperty");
12
12
  const CollectionProperty_1 = require("./CollectionProperty");
13
13
  const ArrayProperty_1 = require("./ArrayProperty");
14
+ const MapProperty_1 = require("./MapProperty");
14
15
  class Property {
15
16
  static factory(params, parent) {
16
17
  params.parent = parent;
@@ -38,6 +39,8 @@ class Property {
38
39
  return new CollectionProperty_1.CollectionProperty(params);
39
40
  case ArrayProperty_1.ArrayProperty.TYPE:
40
41
  return new ArrayProperty_1.ArrayProperty(params);
42
+ case MapProperty_1.MapProperty.TYPE:
43
+ return new MapProperty_1.MapProperty(params);
41
44
  default:
42
45
  throw new Error(`Unknown property type ${params.type}`);
43
46
  }
@@ -53,3 +56,4 @@ Property.TYPE_BOOLEAN = 'boolean';
53
56
  Property.TYPE_HASH = 'hash';
54
57
  Property.TYPE_DATETIME = 'datetime';
55
58
  Property.TYPE_ARRAY = 'array';
59
+ Property.TYPE_MAP = 'map';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/core",
3
- "version": "0.5.3",
3
+ "version": "0.5.6",
4
4
  "description": "Core objects for business apps",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",