nayota-show-sdk 1.3.75 → 1.3.76
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
|
@@ -215,12 +215,16 @@ function mapIotDepartsToLegacy(item = {}) {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
function mapDevicesToIotQuery(query = {}) {
|
|
218
|
+
const digitalTwinTypeId = query.digitalTwinTypeId != null && query.digitalTwinTypeId !== ''
|
|
219
|
+
? query.digitalTwinTypeId
|
|
220
|
+
: resolveLegacyReference(query.deviceClass) || undefined
|
|
221
|
+
|
|
218
222
|
return removeUndefinedFields({
|
|
219
223
|
...omitKeys(query, ['_id', 'depart', 'area', 'deviceClass', 'cloudType', 'status', 'sort']),
|
|
220
224
|
id: query.id || query._id,
|
|
221
225
|
hierarchyId: query.hierarchyId || query.depart,
|
|
222
226
|
spaceId: query.spaceId || query.area,
|
|
223
|
-
digitalTwinTypeId
|
|
227
|
+
digitalTwinTypeId,
|
|
224
228
|
isActive: query.isActive != null ? query.isActive : (query.cloudType != null ? query.cloudType : query.status),
|
|
225
229
|
...parseLegacySort(query.sort, {
|
|
226
230
|
deviceClass: 'digitalTwinTypeId',
|
|
@@ -232,6 +236,10 @@ function mapDevicesToIotQuery(query = {}) {
|
|
|
232
236
|
}
|
|
233
237
|
|
|
234
238
|
function mapDevicesToIotBody(data = {}) {
|
|
239
|
+
const digitalTwinTypeId = data.digitalTwinTypeId != null && data.digitalTwinTypeId !== ''
|
|
240
|
+
? data.digitalTwinTypeId
|
|
241
|
+
: resolveLegacyReference(data.deviceClass) || undefined
|
|
242
|
+
|
|
235
243
|
const metadata = mergeMetadata(data.metadata, {
|
|
236
244
|
configDeviceId: data.n_device,
|
|
237
245
|
mapLatLng: data.mapLatLng,
|
|
@@ -268,7 +276,7 @@ function mapDevicesToIotBody(data = {}) {
|
|
|
268
276
|
twinId: data.twinId || data.n_device || fallbackCode(data.name || data._id, 'TWIN'),
|
|
269
277
|
hierarchyId: data.hierarchyId || data.depart,
|
|
270
278
|
spaceId: data.spaceId || data.area,
|
|
271
|
-
digitalTwinTypeId
|
|
279
|
+
digitalTwinTypeId,
|
|
272
280
|
isActive: data.isActive != null ? data.isActive : (data.cloudType != null ? data.cloudType : data.status),
|
|
273
281
|
metadata: Object.keys(metadata).length ? metadata : undefined
|
|
274
282
|
})
|
|
@@ -127,6 +127,25 @@ describe('iotModuleSpecs departs hierarchy compatibility', () => {
|
|
|
127
127
|
})
|
|
128
128
|
})
|
|
129
129
|
|
|
130
|
+
describe('iotModuleSpecs devices write compatibility', () => {
|
|
131
|
+
const devices = iotModuleSpecs.devices.operations
|
|
132
|
+
|
|
133
|
+
test('does not send digitalTwinTypeId null for partial map coordinate updates', () => {
|
|
134
|
+
const request = devices.updateOne.toRequest({
|
|
135
|
+
_id: '77b8889e-7d3a-4efa-9fc9-858305468d6c',
|
|
136
|
+
digitalTwinTypeId: null,
|
|
137
|
+
spaceId: 'c13c121f-1a23-4656-be54-9e7488f43c55',
|
|
138
|
+
svgCoordinates: [891.4283167347667, 739.999788571489]
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
expect(request.url).toBe('/digital-twins/77b8889e-7d3a-4efa-9fc9-858305468d6c')
|
|
142
|
+
expect(request.method).toBe('patch')
|
|
143
|
+
expect(request.data.digitalTwinTypeId).toBeUndefined()
|
|
144
|
+
expect(request.data.spaceId).toBe('c13c121f-1a23-4656-be54-9e7488f43c55')
|
|
145
|
+
expect(request.data.svgCoordinates).toEqual([891.4283167347667, 739.999788571489])
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
|
|
130
149
|
describe('iotModuleSpecs devices easyList legacy compatibility', () => {
|
|
131
150
|
const easyList = iotModuleSpecs.devices.operations.easyList
|
|
132
151
|
|