@cloudize/sdk-core 24.1.13 → 24.1.14

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.
@@ -3,14 +3,24 @@ export declare enum ResourceObjectMode {
3
3
  NewDocument = 0,
4
4
  ExistingDocument = 1
5
5
  }
6
+ export type ResourceObjectMetadata = {
7
+ insertedAt?: Date;
8
+ updatedAt?: Date;
9
+ deletedAt?: Date;
10
+ version?: Date;
11
+ searchScore?: number;
12
+ distance?: number;
13
+ };
6
14
  export default class ResourceObject implements IResourceObject {
7
15
  private _container;
8
16
  private _id;
17
+ private _meta;
9
18
  private _mode;
10
19
  private _uri;
11
20
  constructor(container: IResourceContainer, mode: ResourceObjectMode);
12
21
  protected EndpointContentType(): string;
13
22
  protected LoadAttributes(value: any): void;
23
+ protected LoadMetadata(value: any): void;
14
24
  protected LoadRelationships(value: any): void;
15
25
  protected RelationshipType(relationshipName: string): string;
16
26
  UpdateAttributes(value: any): void;
@@ -32,6 +42,7 @@ export default class ResourceObject implements IResourceObject {
32
42
  set id(value: string);
33
43
  get attributes(): IResourceObjectAttributes;
34
44
  get relationships(): IResourceObjectRelationships;
45
+ get meta(): ResourceObjectMetadata;
35
46
  protected get shadowAttributes(): IResourceObjectAttributes;
36
47
  protected get shadowRelationships(): IResourceObjectRelationships;
37
48
  get uri(): ResourceObjectUri;
@@ -19,6 +19,7 @@ var ResourceObjectMode;
19
19
  })(ResourceObjectMode || (exports.ResourceObjectMode = ResourceObjectMode = {}));
20
20
  class ResourceObject {
21
21
  constructor(container, mode) {
22
+ this._meta = {};
22
23
  this._mode = ResourceObjectMode.NewDocument;
23
24
  this._container = container;
24
25
  this._mode = mode;
@@ -29,6 +30,27 @@ class ResourceObject {
29
30
  LoadAttributes(value) {
30
31
  throw new Error('Method or Property not implemented.');
31
32
  }
33
+ LoadMetadata(value) {
34
+ this._meta = {};
35
+ if ((0, json_1.isDefinedAndNotNull)(value) && (0, json_1.hasProperty)(value, 'insertedAt')
36
+ && (0, json_1.isString)(value.insertedAt))
37
+ this._meta.insertedAt = value.insertedAt;
38
+ if ((0, json_1.isDefinedAndNotNull)(value) && (0, json_1.hasProperty)(value, 'updatedAt')
39
+ && (0, json_1.isString)(value.updatedAt))
40
+ this._meta.updatedAt = value.updatedAt;
41
+ if ((0, json_1.isDefinedAndNotNull)(value) && (0, json_1.hasProperty)(value, 'deletedAt')
42
+ && (0, json_1.isString)(value.deletedAt))
43
+ this._meta.deletedAt = value.deletedAt;
44
+ if ((0, json_1.isDefinedAndNotNull)(value) && (0, json_1.hasProperty)(value, 'version')
45
+ && (0, json_1.isString)(value.version))
46
+ this._meta.version = value.version;
47
+ if ((0, json_1.isDefinedAndNotNull)(value) && (0, json_1.hasProperty)(value, 'searchScore')
48
+ && (0, json_1.isNumber)(value.searchScore))
49
+ this._meta.searchScore = value.searchScore;
50
+ if ((0, json_1.isDefinedAndNotNull)(value) && (0, json_1.hasProperty)(value, 'distance')
51
+ && (0, json_1.isNumber)(value.distance))
52
+ this._meta.distance = value.distance;
53
+ }
32
54
  LoadRelationships(value) {
33
55
  throw new Error('Method or Property not implemented.');
34
56
  }
@@ -56,6 +78,8 @@ class ResourceObject {
56
78
  && (0, json_1.isString)(value.links.self)) {
57
79
  this._uri = value.links.self;
58
80
  }
81
+ if ((0, json_1.hasProperty)(value, 'meta'))
82
+ this.LoadMetadata(value.meta);
59
83
  this._mode = ResourceObjectMode.ExistingDocument;
60
84
  return this;
61
85
  }
@@ -290,6 +314,9 @@ class ResourceObject {
290
314
  get relationships() {
291
315
  throw new Error('Method or Property not implemented.');
292
316
  }
317
+ get meta() {
318
+ return this._meta;
319
+ }
293
320
  get shadowAttributes() {
294
321
  throw new Error('Method or Property not implemented.');
295
322
  }
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "description": "Cloudize SDK Core",
15
15
  "license": "MIT",
16
- "version": "24.1.13",
16
+ "version": "24.1.14",
17
17
  "main": "lib/index.js",
18
18
  "types": "lib/index.d.ts",
19
19
  "scripts": {