@muze-nl/simplystore 0.6.9 → 0.6.10
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.
package/package.json
CHANGED
|
@@ -145,8 +145,8 @@ export function getDataSpace(path, dataspace) {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
export function linkReplacer(data, baseURL) {
|
|
148
|
-
let type =
|
|
149
|
-
let attributes =
|
|
148
|
+
let type = FastJSONTag.getType(data)
|
|
149
|
+
let attributes = FastJSONTag.getAttributes(data)
|
|
150
150
|
if (Array.isArray(data)) {
|
|
151
151
|
data = data.map((entry,index) => {
|
|
152
152
|
return linkReplacer(data[index], baseURL+index+'/')
|
|
@@ -157,13 +157,13 @@ export function linkReplacer(data, baseURL) {
|
|
|
157
157
|
if (data[source]) {
|
|
158
158
|
data = data[source]
|
|
159
159
|
}
|
|
160
|
-
data = JSONTag.clone(data)
|
|
160
|
+
data = JSONTag.clone(data?.[source] ?? data)
|
|
161
161
|
Object.keys(data).forEach(key => {
|
|
162
162
|
if (Array.isArray(data[key])) {
|
|
163
163
|
data[key] = new JSONTag.Link(baseURL+key+'/')
|
|
164
164
|
} else if (data[key] && typeof data[key] === 'object') {
|
|
165
|
-
if (
|
|
166
|
-
let id=
|
|
165
|
+
if (FastJSONTag.getType(data[key])!=='link') {
|
|
166
|
+
let id=FastJSONTag.getAttribute(data[key], 'id')
|
|
167
167
|
if (!id) {
|
|
168
168
|
id = baseURL+key+'/'
|
|
169
169
|
}
|