@plattar/sdk-core
Advanced tools
Comparing version
@@ -98,21 +98,25 @@ "use strict"; | ||
// NOTE: this could probably be optimized by using attributes directly instead of deep-copy | ||
for (const [key, value] of Object.entries(data.object.attributes)) { | ||
(this._attributes)[key] = value; | ||
if (data.object.attributes) { | ||
for (const [key, value] of Object.entries(data.object.attributes)) { | ||
(this._attributes)[key] = value; | ||
} | ||
} | ||
// we need to build the relationships of this object from the records section | ||
// which includes all the records from any include query | ||
for (const [_key, value] of Object.entries(data.object.relationships)) { | ||
const relationRecord = value.data; | ||
// check if the object exists in the includes section - the value | ||
// can either be a single object or an array | ||
// this only contains id or type but not the full record | ||
if (Array.isArray(relationRecord)) { | ||
const arrayRecord = relationRecord; | ||
arrayRecord.forEach((record) => { | ||
this._CreateRecord(data, record); | ||
}); | ||
if (data.object.relationships) { | ||
for (const [_key, value] of Object.entries(data.object.relationships)) { | ||
const relationRecord = value.data; | ||
// check if the object exists in the includes section - the value | ||
// can either be a single object or an array | ||
// this only contains id or type but not the full record | ||
if (Array.isArray(relationRecord)) { | ||
const arrayRecord = relationRecord; | ||
arrayRecord.forEach((record) => { | ||
this._CreateRecord(data, record); | ||
}); | ||
} | ||
else { | ||
this._CreateRecord(data, relationRecord); | ||
} | ||
} | ||
else { | ||
this._CreateRecord(data, relationRecord); | ||
} | ||
} | ||
@@ -119,0 +123,0 @@ } |
@@ -111,3 +111,3 @@ "use strict"; | ||
async _Fetch(url, type) { | ||
return CoreQuery.fetch(this.service, this.instance, encodeURI(`${url}?${this.toString()}`), type, this._abort.signal); | ||
return CoreQuery.fetch(this.service, this.instance, encodeURI(`${url}${this._queries.length > 0 ? `?${this.toString()}` : ''}`), type, this._abort.signal); | ||
} | ||
@@ -114,0 +114,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
declare const _default: "1.164.6"; | ||
declare const _default: "1.164.7"; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = "1.164.6"; | ||
exports.default = "1.164.7"; |
{ | ||
"name": "@plattar/sdk-core", | ||
"version": "1.164.6", | ||
"version": "1.164.7", | ||
"description": "Core SDK Module for Generative SDK using API Core", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
77160
0.27%1944
0.21%