@apigames/sdk-core 24.1.13 → 24.1.16
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 = new Date(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 = new Date(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 = new Date(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 = new Date(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": "API Games SDK Core",
|
|
15
15
|
"license": "MIT",
|
|
16
|
-
"version": "24.1.
|
|
16
|
+
"version": "24.1.16",
|
|
17
17
|
"main": "lib/index.js",
|
|
18
18
|
"types": "lib/index.d.ts",
|
|
19
19
|
"scripts": {
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"test:watch": "jest --watch"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@apigames/json": "^24.1.
|
|
37
|
-
"@apigames/rest-client": "^24.1.
|
|
36
|
+
"@apigames/json": "^24.1.12",
|
|
37
|
+
"@apigames/rest-client": "^24.1.15",
|
|
38
38
|
"object-hash": "^3.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/date-and-time": "^0.13.0",
|
|
42
42
|
"@types/jest": "^29.5.14",
|
|
43
|
-
"@types/node": "^20.19.
|
|
43
|
+
"@types/node": "^20.19.17",
|
|
44
44
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
45
45
|
"@typescript-eslint/parser": "^7.18.0",
|
|
46
46
|
"date-and-time": "^3.6.0",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"eslint-plugin-react": "^7.37.5",
|
|
52
52
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
53
53
|
"jest": "^29.7.0",
|
|
54
|
-
"ts-jest": "^29.4.
|
|
55
|
-
"typescript": "^5.
|
|
54
|
+
"ts-jest": "^29.4.4",
|
|
55
|
+
"typescript": "^5.9.2"
|
|
56
56
|
},
|
|
57
57
|
"eslintConfig": {},
|
|
58
58
|
"repository": {
|