@apigames/sdk-core 22.1.21 → 22.1.22
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.
|
@@ -53,7 +53,8 @@ export declare class GeospatialPoint extends ResourceObjectAttributeBase impleme
|
|
|
53
53
|
export declare class ResourceObjectRelationshipBase {
|
|
54
54
|
private _includes;
|
|
55
55
|
constructor(includes: ResourceContainerIncludedResourceTypes);
|
|
56
|
-
protected
|
|
56
|
+
protected LoadRelationship(expectedType: string, value: any): ResourceObjectRelationship;
|
|
57
|
+
protected LoadRelationships(expectedType: string, value: any): ResourceObjectRelationships;
|
|
57
58
|
static RelationshipType(relationshipName: string): string;
|
|
58
59
|
}
|
|
59
60
|
export interface IResourceObject {
|
|
@@ -48,12 +48,45 @@ class ResourceObjectRelationshipBase {
|
|
|
48
48
|
constructor(includes) {
|
|
49
49
|
this._includes = includes;
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
if ((0, json_1.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
LoadRelationship(expectedType, value) {
|
|
52
|
+
if ((0, json_1.isObject)(value)) {
|
|
53
|
+
if ((0, json_1.hasProperty)(value, 'data') && (0, json_1.isObject)(value.data) && (Object.keys(value.data).length === 2)
|
|
54
|
+
&& (0, json_1.hasProperty)(value.data, 'type') && (0, json_1.isString)(value.data.type)
|
|
55
|
+
&& (value.data.type === expectedType)
|
|
56
|
+
&& (0, json_1.hasProperty)(value.data, 'id') && (0, json_1.isString)(value.data.id)) {
|
|
57
|
+
return new ResourceObjectRelationship(this._includes, value.data.type, value.data.id);
|
|
58
|
+
}
|
|
59
|
+
if ((Object.keys(value).length === 1) && (0, json_1.hasProperty)(value, 'id') && (0, json_1.isString)(value.id)) {
|
|
60
|
+
return new ResourceObjectRelationship(this._includes, expectedType, value.id);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
LoadRelationships(expectedType, value) {
|
|
66
|
+
if ((0, json_1.isObject)(value)) {
|
|
67
|
+
if ((0, json_1.hasProperty)(value, 'data') && (0, json_1.isArray)(value.data)) {
|
|
68
|
+
const relationships = [];
|
|
69
|
+
for (const relationship of value.data) {
|
|
70
|
+
if ((0, json_1.isObject)(relationship) && (Object.keys(relationship).length === 2)
|
|
71
|
+
&& (0, json_1.hasProperty)(relationship, 'type') && (0, json_1.isString)(relationship.type)
|
|
72
|
+
&& (relationship.type === expectedType)
|
|
73
|
+
&& (0, json_1.hasProperty)(relationship, 'id') && (0, json_1.isString)(relationship.id)) {
|
|
74
|
+
relationships.push(new ResourceObjectRelationship(this._includes, relationship.type, relationship.id));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return relationships;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if ((0, json_1.isArray)(value)) {
|
|
81
|
+
const relationships = [];
|
|
82
|
+
for (const relationship of value) {
|
|
83
|
+
if ((0, json_1.isObject)(relationship) && (Object.keys(relationship).length === 1)
|
|
84
|
+
&& (0, json_1.hasProperty)(relationship, 'id') && (0, json_1.isString)(relationship.id)) {
|
|
85
|
+
relationships.push(new ResourceObjectRelationship(this._includes, expectedType, relationship.id));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return relationships;
|
|
89
|
+
}
|
|
57
90
|
return undefined;
|
|
58
91
|
}
|
|
59
92
|
static RelationshipType(relationshipName) {
|