@quatrain/core 0.1.10 → 0.3.0

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.
Files changed (66) hide show
  1. package/lib/Core.d.ts +3 -1
  2. package/lib/Core.js +2 -2
  3. package/lib/backends/AbstractAdapter.d.ts +11 -9
  4. package/lib/backends/MockAdapter.d.ts +16 -9
  5. package/lib/backends/MockAdapter.js +87 -22
  6. package/lib/backends/Query.d.ts +11 -3
  7. package/lib/backends/Query.js +30 -4
  8. package/lib/components/AbstractObject.d.ts +9 -9
  9. package/lib/components/AbstractObject.js +2 -2
  10. package/lib/components/BaseObject.d.ts +10 -11
  11. package/lib/components/BaseObject.js +42 -33
  12. package/lib/components/BaseObjectProperties.d.ts +5 -6
  13. package/lib/components/BaseObjectProperties.js +12 -9
  14. package/lib/components/DataObject.d.ts +21 -16
  15. package/lib/components/DataObject.js +35 -18
  16. package/lib/components/Entity.d.ts +6 -0
  17. package/lib/components/Entity.js +26 -0
  18. package/lib/components/EntityProperties.d.ts +1 -0
  19. package/lib/components/EntityProperties.js +12 -0
  20. package/lib/components/ObjectUri.d.ts +4 -1
  21. package/lib/components/ObjectUri.js +7 -4
  22. package/lib/components/User.d.ts +4 -4
  23. package/lib/components/User.js +20 -50
  24. package/lib/components/UserProperties.d.ts +1 -0
  25. package/lib/components/UserProperties.js +59 -0
  26. package/lib/components/index.d.ts +6 -3
  27. package/lib/components/index.js +5 -2
  28. package/lib/components/types/AbstractObjectClass.d.ts +6 -0
  29. package/lib/components/types/AbstractObjectClass.js +2 -0
  30. package/lib/components/types/BaseObjectClass.d.ts +6 -0
  31. package/lib/components/types/BaseObjectClass.js +2 -0
  32. package/lib/components/types/DataObjectClass.d.ts +21 -0
  33. package/lib/components/types/DataObjectClass.js +2 -0
  34. package/lib/components/types/EntityClass.d.ts +3 -0
  35. package/lib/components/types/EntityClass.js +2 -0
  36. package/lib/components/types/UserClass.d.ts +3 -0
  37. package/lib/components/types/UserClass.js +2 -0
  38. package/lib/properties/ArrayProperty.d.ts +2 -0
  39. package/lib/properties/ArrayProperty.js +22 -4
  40. package/lib/properties/BaseProperty.d.ts +5 -4
  41. package/lib/properties/BaseProperty.js +1 -0
  42. package/lib/properties/BooleanProperty.d.ts +2 -1
  43. package/lib/properties/BooleanProperty.js +3 -2
  44. package/lib/properties/CollectionProperty.d.ts +29 -0
  45. package/lib/properties/CollectionProperty.js +62 -0
  46. package/lib/properties/DateTimeProperty.d.ts +1 -0
  47. package/lib/properties/DateTimeProperty.js +1 -0
  48. package/lib/properties/EnumProperty.d.ts +1 -0
  49. package/lib/properties/EnumProperty.js +1 -0
  50. package/lib/properties/HashProperty.d.ts +1 -0
  51. package/lib/properties/HashProperty.js +1 -0
  52. package/lib/properties/MapProperty.d.ts +8 -0
  53. package/lib/properties/MapProperty.js +17 -0
  54. package/lib/properties/NumberProperty.d.ts +1 -0
  55. package/lib/properties/NumberProperty.js +1 -0
  56. package/lib/properties/ObjectProperty.d.ts +4 -7
  57. package/lib/properties/ObjectProperty.js +4 -1
  58. package/lib/properties/Property.d.ts +3 -7
  59. package/lib/properties/Property.js +13 -15
  60. package/lib/properties/StringProperty.d.ts +6 -0
  61. package/lib/properties/StringProperty.js +13 -7
  62. package/lib/properties/index.d.ts +4 -2
  63. package/lib/properties/index.js +5 -1
  64. package/lib/properties/types/PropertyClassType.d.ts +4 -2
  65. package/lib/properties/types/PropertyTypes.d.ts +4 -1
  66. package/package.json +3 -1
@@ -1,6 +1,7 @@
1
- import { BaseProperty, BasePropertyType } from './';
1
+ import { BaseProperty, BasePropertyType } from './BaseProperty';
2
2
  export interface BooleanPropertyType extends BasePropertyType {
3
3
  }
4
4
  export declare class BooleanProperty extends BaseProperty {
5
+ static TYPE: string;
5
6
  set(value: boolean): this;
6
7
  }
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BooleanProperty = void 0;
4
- const _1 = require("./");
5
- class BooleanProperty extends _1.BaseProperty {
4
+ const BaseProperty_1 = require("./BaseProperty");
5
+ class BooleanProperty extends BaseProperty_1.BaseProperty {
6
6
  set(value) {
7
7
  return super.set(value);
8
8
  }
9
9
  }
10
10
  exports.BooleanProperty = BooleanProperty;
11
+ BooleanProperty.TYPE = 'boolean';
@@ -0,0 +1,29 @@
1
+ import { BaseProperty, BasePropertyType } from './BaseProperty';
2
+ import { Query, Filter } from '../backends';
3
+ import { DataObject, ObjectUri } from '../components';
4
+ import { returnAs } from '../backends/Query';
5
+ export interface CollectionPropertyType extends BasePropertyType {
6
+ instanceOf?: Function | string | Object;
7
+ backend?: string;
8
+ parentKey?: string;
9
+ }
10
+ export declare class CollectionProperty extends BaseProperty {
11
+ static TYPE: string;
12
+ protected _value: Array<any> | Array<DataObject> | Array<ObjectUri> | undefined;
13
+ protected _instanceOf: any;
14
+ protected _backend: undefined;
15
+ protected _parentKey: string;
16
+ protected _query: Query<any> | undefined;
17
+ protected _filters: Filter[] | Filter | undefined;
18
+ constructor(config: CollectionPropertyType);
19
+ set(value: Array<any>): this;
20
+ /**
21
+ * get objects matching collection class and filters
22
+ * in the requested format
23
+ * @param filters
24
+ * @returns
25
+ */
26
+ get(filters?: Filter[] | undefined): Query<any>;
27
+ val(transform?: returnAs): Promise<Array<any> | Array<DataObject> | Array<ObjectUri>>;
28
+ toJSON(): any[] | ObjectUri[] | DataObject[] | undefined;
29
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CollectionProperty = void 0;
13
+ const BaseProperty_1 = require("./BaseProperty");
14
+ const backends_1 = require("../backends");
15
+ const Core_1 = require("../Core");
16
+ const Query_1 = require("../backends/Query");
17
+ class CollectionProperty extends BaseProperty_1.BaseProperty {
18
+ constructor(config) {
19
+ var _a, _b;
20
+ super(config);
21
+ this._value = undefined;
22
+ this._query = undefined;
23
+ this._filters = undefined;
24
+ this._instanceOf = config.instanceOf;
25
+ this._backend = config.backend
26
+ ? Core_1.Core.getBackend(config.backend)
27
+ : undefined;
28
+ this._parentKey =
29
+ config.parentKey || ((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a.uri) === null || _b === void 0 ? void 0 : _b.collection) || 'unknown';
30
+ }
31
+ set(value) {
32
+ return super.set(value);
33
+ }
34
+ /**
35
+ * get objects matching collection class and filters
36
+ * in the requested format
37
+ * @param filters
38
+ * @returns
39
+ */
40
+ get(filters = undefined) {
41
+ if (!this._query || this._filters !== filters) {
42
+ this._query = new backends_1.Query(this._instanceOf);
43
+ if (this._parent) {
44
+ this._query.where(this._parentKey, this._parent.uri);
45
+ }
46
+ if (filters) {
47
+ this._query.filters = filters;
48
+ }
49
+ }
50
+ return this._query;
51
+ }
52
+ val(transform = Query_1.returnAs.AS_DATAOBJECTS) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ return yield this.get().execute(transform, this._backend);
55
+ });
56
+ }
57
+ toJSON() {
58
+ return this._value;
59
+ }
60
+ }
61
+ exports.CollectionProperty = CollectionProperty;
62
+ CollectionProperty.TYPE = 'collection';
@@ -3,6 +3,7 @@ export interface DateTimePropertyType extends BasePropertyType {
3
3
  timezone?: string;
4
4
  }
5
5
  export declare class DateTimeProperty extends BaseProperty {
6
+ static TYPE: string;
6
7
  protected _timezone: string;
7
8
  constructor(config: DateTimePropertyType);
8
9
  set(value: string | Date): this;
@@ -15,3 +15,4 @@ class DateTimeProperty extends BaseProperty_1.BaseProperty {
15
15
  }
16
16
  }
17
17
  exports.DateTimeProperty = DateTimeProperty;
18
+ DateTimeProperty.TYPE = 'datetime';
@@ -3,6 +3,7 @@ export interface EnumPropertyType extends BasePropertyType {
3
3
  values?: string[];
4
4
  }
5
5
  export declare class EnumProperty extends BaseProperty {
6
+ static TYPE: string;
6
7
  protected _values: string[];
7
8
  constructor(config: EnumPropertyType);
8
9
  set(value: string): this;
@@ -16,3 +16,4 @@ class EnumProperty extends BaseProperty_1.BaseProperty {
16
16
  }
17
17
  }
18
18
  exports.EnumProperty = EnumProperty;
19
+ EnumProperty.TYPE = 'enum';
@@ -6,6 +6,7 @@ export interface HashPropertyType extends StringPropertyType {
6
6
  prefixed?: boolean;
7
7
  }
8
8
  export declare class HashProperty extends StringProperty {
9
+ static TYPE: string;
9
10
  static ALGORITHM_MD5: string;
10
11
  static ALGORITHM_SHA1: string;
11
12
  static ALGORITHM_SHA256: string;
@@ -42,6 +42,7 @@ class HashProperty extends StringProperty_1.StringProperty {
42
42
  }
43
43
  }
44
44
  exports.HashProperty = HashProperty;
45
+ HashProperty.TYPE = 'hash';
45
46
  HashProperty.ALGORITHM_MD5 = 'md5';
46
47
  HashProperty.ALGORITHM_SHA1 = 'sha1';
47
48
  HashProperty.ALGORITHM_SHA256 = 'sha256';
@@ -0,0 +1,8 @@
1
+ import { BaseProperty, BasePropertyType } from './BaseProperty';
2
+ export interface MapPropertyType extends BasePropertyType {
3
+ }
4
+ export declare class MapProperty extends BaseProperty {
5
+ static TYPE: string;
6
+ set(value: any): this;
7
+ toJSON(): {};
8
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MapProperty = void 0;
4
+ const BaseProperty_1 = require("./BaseProperty");
5
+ class MapProperty extends BaseProperty_1.BaseProperty {
6
+ set(value) {
7
+ if (typeof value !== 'object') {
8
+ throw new Error(`value ${JSON.stringify(value)} is not an object`);
9
+ }
10
+ return super.set(value);
11
+ }
12
+ toJSON() {
13
+ return this._value ? JSON.stringify(this._value) : {};
14
+ }
15
+ }
16
+ exports.MapProperty = MapProperty;
17
+ MapProperty.TYPE = 'map';
@@ -11,6 +11,7 @@ export interface NumberPropertyType extends BasePropertyType {
11
11
  precision?: number;
12
12
  }
13
13
  export declare class NumberProperty extends BaseProperty {
14
+ static TYPE: string;
14
15
  static TYPE_SIGNED: string;
15
16
  static TYPE_UNSIGNED: string;
16
17
  static TYPE_INTEGER: string;
@@ -67,6 +67,7 @@ class NumberProperty extends BaseProperty_1.BaseProperty {
67
67
  }
68
68
  }
69
69
  exports.NumberProperty = NumberProperty;
70
+ NumberProperty.TYPE = 'number';
70
71
  NumberProperty.TYPE_SIGNED = 'signed';
71
72
  NumberProperty.TYPE_UNSIGNED = 'unsigned';
72
73
  NumberProperty.TYPE_INTEGER = 'integer';
@@ -1,16 +1,13 @@
1
- import { BaseObject } from '../components';
1
+ import { BaseObjectClass } from '../components/types/BaseObjectClass';
2
2
  import { BaseProperty, BasePropertyType } from './BaseProperty';
3
3
  export interface ObjectPropertyType extends BasePropertyType {
4
4
  instanceOf?: Function | string | Object;
5
5
  }
6
6
  export declare class ObjectProperty extends BaseProperty {
7
- _value: BaseObject | undefined;
7
+ static TYPE: string;
8
+ _value: BaseObjectClass | undefined;
8
9
  _instanceOf: Function | string | Object;
9
10
  constructor(config: ObjectPropertyType);
10
11
  set(value: any): this;
11
- toJSON(): {
12
- label: any;
13
- ref: string;
14
- uri: string;
15
- } | undefined;
12
+ toJSON(): any;
16
13
  }
@@ -19,7 +19,10 @@ class ObjectProperty extends BaseProperty_1.BaseProperty {
19
19
  return super.set(value);
20
20
  }
21
21
  toJSON() {
22
- return this._value && this._value.dataObject ? this._value.dataObject.toReference() : undefined;
22
+ return this._value && this._value.dataObject
23
+ ? this._value.dataObject.toReference()
24
+ : undefined;
23
25
  }
24
26
  }
25
27
  exports.ObjectProperty = ObjectProperty;
28
+ ObjectProperty.TYPE = 'object';
@@ -1,4 +1,4 @@
1
- import { DataObject } from '../components/DataObject';
1
+ import { DataObjectClass } from '../components/types/DataObjectClass';
2
2
  import { BaseProperty, BasePropertyType } from './BaseProperty';
3
3
  export declare class Property {
4
4
  static TYPE_ANY: string;
@@ -9,10 +9,6 @@ export declare class Property {
9
9
  static TYPE_BOOLEAN: string;
10
10
  static TYPE_HASH: string;
11
11
  static TYPE_DATETIME: string;
12
- static ALLOW_SPACES: string;
13
- static ALLOW_LETTERS: string;
14
- static ALLOW_DIGITS: string;
15
- static ALLOW_STRINGS: string;
16
- static ALLOW_NUMBERS: string;
17
- static factory<P extends BasePropertyType>(params: P, parent: DataObject): BaseProperty;
12
+ static TYPE_ARRAY: string;
13
+ static factory<P extends BasePropertyType>(params: P, parent: DataObjectClass): BaseProperty;
18
14
  }
@@ -6,30 +6,32 @@ const BooleanProperty_1 = require("./BooleanProperty");
6
6
  const DateTimeProperty_1 = require("./DateTimeProperty");
7
7
  const EnumProperty_1 = require("./EnumProperty");
8
8
  const HashProperty_1 = require("./HashProperty");
9
- const ObjectProperty_1 = require("./ObjectProperty");
10
9
  const StringProperty_1 = require("./StringProperty");
11
10
  const NumberProperty_1 = require("./NumberProperty");
11
+ const ObjectProperty_1 = require("./ObjectProperty");
12
+ const CollectionProperty_1 = require("./CollectionProperty");
12
13
  class Property {
13
14
  static factory(params, parent) {
14
15
  params.parent = parent;
15
- // console.log(`Creating ${params.type} property named ${params.name}`)
16
16
  switch (params.type) {
17
- case Property.TYPE_ANY:
17
+ case BaseProperty_1.BaseProperty.TYPE:
18
18
  return new BaseProperty_1.BaseProperty(params);
19
- case Property.TYPE_STRING:
19
+ case StringProperty_1.StringProperty.TYPE:
20
20
  return new StringProperty_1.StringProperty(params);
21
- case Property.TYPE_NUMBER:
21
+ case NumberProperty_1.NumberProperty.TYPE:
22
22
  return new NumberProperty_1.NumberProperty(params);
23
- case Property.TYPE_OBJECT:
23
+ case ObjectProperty_1.ObjectProperty.TYPE:
24
24
  return new ObjectProperty_1.ObjectProperty(params);
25
- case Property.TYPE_ENUM:
25
+ case EnumProperty_1.EnumProperty.TYPE:
26
26
  return new EnumProperty_1.EnumProperty(params);
27
- case Property.TYPE_BOOLEAN:
27
+ case BooleanProperty_1.BooleanProperty.TYPE:
28
28
  return new BooleanProperty_1.BooleanProperty(params);
29
- case Property.TYPE_HASH:
29
+ case HashProperty_1.HashProperty.TYPE:
30
30
  return new HashProperty_1.HashProperty(params);
31
- case Property.TYPE_DATETIME:
31
+ case DateTimeProperty_1.DateTimeProperty.TYPE:
32
32
  return new DateTimeProperty_1.DateTimeProperty(params);
33
+ case CollectionProperty_1.CollectionProperty.TYPE:
34
+ return new CollectionProperty_1.CollectionProperty(params);
33
35
  default:
34
36
  throw new Error(`Unknown property type ${params.type}`);
35
37
  }
@@ -44,8 +46,4 @@ Property.TYPE_ENUM = 'enum';
44
46
  Property.TYPE_BOOLEAN = 'boolean';
45
47
  Property.TYPE_HASH = 'hash';
46
48
  Property.TYPE_DATETIME = 'datetime';
47
- Property.ALLOW_SPACES = 'spaces';
48
- Property.ALLOW_LETTERS = 'letters';
49
- Property.ALLOW_DIGITS = 'digits';
50
- Property.ALLOW_STRINGS = 'strings';
51
- Property.ALLOW_NUMBERS = 'numbers';
49
+ Property.TYPE_ARRAY = 'array';
@@ -8,8 +8,14 @@ export interface StringPropertyType extends BasePropertyType {
8
8
  allowPattern?: String;
9
9
  }
10
10
  export declare class StringProperty extends BaseProperty {
11
+ static TYPE: string;
11
12
  static TRANSFORM_UCASE: string;
12
13
  static TRANSFORM_LCASE: string;
14
+ static ALLOW_SPACES: string;
15
+ static ALLOW_LETTERS: string;
16
+ static ALLOW_DIGITS: string;
17
+ static ALLOW_STRINGS: string;
18
+ static ALLOW_NUMBERS: string;
13
19
  protected _minLength: number;
14
20
  protected _maxLength: number;
15
21
  protected _value: string | undefined;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StringProperty = void 0;
4
- const Property_1 = require("./Property");
4
+ //import { Property } from './Property'
5
5
  const BaseProperty_1 = require("./BaseProperty");
6
6
  class StringProperty extends BaseProperty_1.BaseProperty {
7
7
  constructor(config) {
@@ -15,25 +15,25 @@ class StringProperty extends BaseProperty_1.BaseProperty {
15
15
  this.minLength = config.minLength || 0;
16
16
  this.maxLength = config.maxLength || 0;
17
17
  if (this._enable(config.allowSpaces)) {
18
- this._allows.push(Property_1.Property.ALLOW_SPACES);
18
+ this._allows.push(StringProperty.ALLOW_SPACES);
19
19
  }
20
20
  if (this._enable(config.allowDigits)) {
21
- this._allows.push(Property_1.Property.ALLOW_DIGITS);
21
+ this._allows.push(StringProperty.ALLOW_DIGITS);
22
22
  }
23
23
  if (this._enable(config.allowLetters)) {
24
- this._allows.push(Property_1.Property.ALLOW_LETTERS);
24
+ this._allows.push(StringProperty.ALLOW_LETTERS);
25
25
  }
26
26
  }
27
27
  set(value) {
28
- if (this._allows.includes(Property_1.Property.ALLOW_DIGITS) === false &&
28
+ if (this._allows.includes(StringProperty.ALLOW_DIGITS) === false &&
29
29
  /\d/.test(value)) {
30
30
  throw new Error(`Digits are not allowed in value`);
31
31
  }
32
- if (this._allows.includes(Property_1.Property.ALLOW_SPACES) === false &&
32
+ if (this._allows.includes(StringProperty.ALLOW_SPACES) === false &&
33
33
  /\s/g.test(value)) {
34
34
  throw new Error(`Spaces are not allowed in value`);
35
35
  }
36
- if (this._allows.includes(Property_1.Property.ALLOW_LETTERS) === false &&
36
+ if (this._allows.includes(StringProperty.ALLOW_LETTERS) === false &&
37
37
  /[a-zA-Z]/.test(value)) {
38
38
  throw new Error(`Letters are not allowed in value`);
39
39
  }
@@ -69,5 +69,11 @@ class StringProperty extends BaseProperty_1.BaseProperty {
69
69
  }
70
70
  }
71
71
  exports.StringProperty = StringProperty;
72
+ StringProperty.TYPE = 'string';
72
73
  StringProperty.TRANSFORM_UCASE = 'upper';
73
74
  StringProperty.TRANSFORM_LCASE = 'lower';
75
+ StringProperty.ALLOW_SPACES = 'spaces';
76
+ StringProperty.ALLOW_LETTERS = 'letters';
77
+ StringProperty.ALLOW_DIGITS = 'digits';
78
+ StringProperty.ALLOW_STRINGS = 'strings';
79
+ StringProperty.ALLOW_NUMBERS = 'numbers';
@@ -8,9 +8,11 @@ import { EnumProperty, EnumPropertyType } from './EnumProperty';
8
8
  import { BooleanProperty, BooleanPropertyType } from './BooleanProperty';
9
9
  import { DateTimeProperty, DateTimePropertyType } from './DateTimeProperty';
10
10
  import { ObjectProperty, ObjectPropertyType } from './ObjectProperty';
11
+ import { MapProperty, MapPropertyType } from './MapProperty';
12
+ import { CollectionProperty, CollectionPropertyType } from './CollectionProperty';
11
13
  import { PropertyTypes } from './types/PropertyTypes';
12
- export { Property, BaseProperty, BasePropertyType, ArrayProperty, ArrayPropertyType, NumberProperty, NumberPropertyType, BooleanProperty, BooleanPropertyType, DateTimeProperty, DateTimePropertyType, EnumProperty, EnumPropertyType, ObjectProperty, ObjectPropertyType, StringProperty, StringPropertyType, HashProperty, HashPropertyType, };
14
+ export { Property, BaseProperty, BasePropertyType, ArrayProperty, ArrayPropertyType, NumberProperty, NumberPropertyType, BooleanProperty, BooleanPropertyType, DateTimeProperty, DateTimePropertyType, EnumProperty, EnumPropertyType, ObjectProperty, ObjectPropertyType, StringProperty, StringPropertyType, HashProperty, HashPropertyType, MapProperty, MapPropertyType, CollectionProperty, CollectionPropertyType, };
13
15
  declare type BaseType = {
14
16
  type: PropertyTypes;
15
17
  };
16
- export declare type DataObjectProperties = ((NumberPropertyType & BaseType) | (BooleanPropertyType & BaseType) | (EnumPropertyType & BaseType) | (ObjectPropertyType & BaseType) | (StringPropertyType & BaseType) | (HashPropertyType & BaseType) | (DateTimeProperty & BaseType))[];
18
+ export declare type DataObjectProperties = ((NumberPropertyType & BaseType) | (BooleanPropertyType & BaseType) | (EnumPropertyType & BaseType) | (ObjectPropertyType & BaseType) | (StringPropertyType & BaseType) | (HashPropertyType & BaseType) | (DateTimeProperty & BaseType) | (ArrayPropertyType & BaseType) | (MapPropertyType & BaseType) | (CollectionPropertyType & BaseType))[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HashProperty = exports.StringProperty = exports.ObjectProperty = exports.EnumProperty = exports.DateTimeProperty = exports.BooleanProperty = exports.NumberProperty = exports.ArrayProperty = exports.BaseProperty = exports.Property = void 0;
3
+ exports.CollectionProperty = exports.MapProperty = exports.HashProperty = exports.StringProperty = exports.ObjectProperty = exports.EnumProperty = exports.DateTimeProperty = exports.BooleanProperty = exports.NumberProperty = exports.ArrayProperty = exports.BaseProperty = exports.Property = void 0;
4
4
  const Property_1 = require("./Property");
5
5
  Object.defineProperty(exports, "Property", { enumerable: true, get: function () { return Property_1.Property; } });
6
6
  const BaseProperty_1 = require("./BaseProperty");
@@ -21,3 +21,7 @@ const DateTimeProperty_1 = require("./DateTimeProperty");
21
21
  Object.defineProperty(exports, "DateTimeProperty", { enumerable: true, get: function () { return DateTimeProperty_1.DateTimeProperty; } });
22
22
  const ObjectProperty_1 = require("./ObjectProperty");
23
23
  Object.defineProperty(exports, "ObjectProperty", { enumerable: true, get: function () { return ObjectProperty_1.ObjectProperty; } });
24
+ const MapProperty_1 = require("./MapProperty");
25
+ Object.defineProperty(exports, "MapProperty", { enumerable: true, get: function () { return MapProperty_1.MapProperty; } });
26
+ const CollectionProperty_1 = require("./CollectionProperty");
27
+ Object.defineProperty(exports, "CollectionProperty", { enumerable: true, get: function () { return CollectionProperty_1.CollectionProperty; } });
@@ -1,4 +1,6 @@
1
+ import { AbstractPropertyType } from "./AbstractPropertyType";
1
2
  export interface PropertyClassType {
2
- set(value: any): void;
3
- val(transform: any): void;
3
+ set(value: any): AbstractPropertyType;
4
+ val(transform: any): any;
5
+ toJSON(): any;
4
6
  }
@@ -1,2 +1,5 @@
1
1
  import { Property } from '..';
2
- export declare type PropertyTypes = typeof Property.TYPE_STRING | typeof Property.TYPE_NUMBER | typeof Property.TYPE_ENUM | typeof Property.TYPE_BOOLEAN | typeof Property.TYPE_OBJECT | typeof Property.TYPE_DATETIME | typeof Property.TYPE_HASH;
2
+ export declare type PropertyTypes = typeof Property.TYPE_STRING | typeof Property.TYPE_NUMBER | typeof Property.TYPE_ENUM | typeof Property.TYPE_BOOLEAN | typeof Property.TYPE_OBJECT | typeof Property.TYPE_DATETIME | typeof Property.TYPE_HASH | typeof Property.TYPE_ARRAY;
3
+ export declare type BaseType = {
4
+ type: PropertyTypes;
5
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/core",
3
- "version": "0.1.10",
3
+ "version": "0.3.0",
4
4
  "description": "Core objects for business apps",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -11,10 +11,12 @@
11
11
  "author": "Quatrain Développement SAS <developers@quatrain.com>",
12
12
  "license": "MIT",
13
13
  "devDependencies": {
14
+ "@faker-js/faker": "^7.6.0",
14
15
  "@tsconfig/recommended": "^1.0.1",
15
16
  "@types/jest": "^27.0.3",
16
17
  "jest": "^27.4.7",
17
18
  "jest-node-exports-resolver": "^1.1.6",
19
+ "trace-unhandled": "^2.0.1",
18
20
  "ts-jest": "^27.1.2",
19
21
  "ts-node": "^10.4.0",
20
22
  "typescript": "^4.7.4"