nayota-show-sdk 1.3.110 → 1.3.111
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
|
@@ -1101,6 +1101,22 @@ function createDeviceClassOperations() {
|
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
|
|
1104
|
+
operations.onlineRate = {
|
|
1105
|
+
toRequest(query = {}) {
|
|
1106
|
+
return {
|
|
1107
|
+
url: '/device-classes/online-rate',
|
|
1108
|
+
method: 'get',
|
|
1109
|
+
params: query
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1112
|
+
fromResponse(response) {
|
|
1113
|
+
const payload = response && response.data && response.status ? response.data : response
|
|
1114
|
+
return payload && payload.code !== undefined
|
|
1115
|
+
? payload
|
|
1116
|
+
: { code: 0, data: payload?.data !== undefined ? payload.data : payload }
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1104
1120
|
return operations
|
|
1105
1121
|
}
|
|
1106
1122
|
|
|
@@ -51,6 +51,34 @@ describe('iotModuleSpecs deviceClass UI compatibility', () => {
|
|
|
51
51
|
expect(request.data.metadata.bms.deviceUI).toBe('legacy-device-ui-2')
|
|
52
52
|
})
|
|
53
53
|
|
|
54
|
+
test('maps onlineRate to the iot legacy-compatible device-classes endpoint', () => {
|
|
55
|
+
const request = deviceClass.onlineRate.toRequest({ year: 2026, month: 7 })
|
|
56
|
+
|
|
57
|
+
expect(request).toEqual({
|
|
58
|
+
url: '/device-classes/online-rate',
|
|
59
|
+
method: 'get',
|
|
60
|
+
params: { year: 2026, month: 7 }
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
expect(
|
|
64
|
+
deviceClass.onlineRate.fromResponse({
|
|
65
|
+
code: 0,
|
|
66
|
+
data: {
|
|
67
|
+
year: 2026,
|
|
68
|
+
month: 7,
|
|
69
|
+
summary: { onlineRate: 1 }
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
).toEqual({
|
|
73
|
+
code: 0,
|
|
74
|
+
data: {
|
|
75
|
+
year: 2026,
|
|
76
|
+
month: 7,
|
|
77
|
+
summary: { onlineRate: 1 }
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
|
|
54
82
|
test('expands digital twin type ui relation back to legacy uis', () => {
|
|
55
83
|
const response = deviceClass.list.fromResponse({
|
|
56
84
|
code: 0,
|