nayota-show-sdk 1.3.71 → 1.3.72

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/api/devices.js CHANGED
@@ -369,6 +369,10 @@ export function easyList(data) {
369
369
  }
370
370
  */
371
371
  export function getPropHistoryData(data) {
372
+ if (shouldUseIot('getPropHistoryData')) {
373
+ return executeIotModuleAction(MODULE_NAME, 'getPropHistoryData', data)
374
+ }
375
+
372
376
  return requestShow({
373
377
  url: '/devices/getPropHistoryData',
374
378
  method: 'post',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nayota-show-sdk",
3
- "version": "1.3.71",
3
+ "version": "1.3.72",
4
4
  "description": "nayota-show-server rest-api",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -738,6 +738,29 @@ export const iotModuleSpecs = {
738
738
  }
739
739
  }
740
740
  }
741
+ },
742
+ getPropHistoryData: {
743
+ toRequest(data = {}) {
744
+ return {
745
+ url: '/devices/getPropHistoryData',
746
+ method: 'post',
747
+ data
748
+ }
749
+ },
750
+ fromResponse(response) {
751
+ const payload = response && response.data && response.status ? response.data : response
752
+ const data = payload?.data !== undefined ? payload.data : payload
753
+ const rows = Array.isArray(data?.rows)
754
+ ? data.rows
755
+ : Array.isArray(payload?.rows)
756
+ ? payload.rows
757
+ : []
758
+ return removeUndefinedFields({
759
+ code: Number(data?.code ?? payload?.code ?? 0),
760
+ rows,
761
+ message: data?.message ?? payload?.message
762
+ })
763
+ }
741
764
  }
742
765
  }
743
766
  },
@@ -225,3 +225,47 @@ describe('iotModuleSpecs devices easyList legacy compatibility', () => {
225
225
  )
226
226
  })
227
227
  })
228
+
229
+ describe('iotModuleSpecs devices getPropHistoryData legacy compatibility', () => {
230
+ const getPropHistoryData = iotModuleSpecs.devices.operations.getPropHistoryData
231
+
232
+ test('posts to the legacy-compatible iot endpoint and keeps rows at top level', () => {
233
+ const request = getPropHistoryData.toRequest({
234
+ date: '2026-04-25T15:59:59.000Z',
235
+ deviceClasses: ['type-1']
236
+ })
237
+
238
+ expect(request).toEqual({
239
+ url: '/devices/getPropHistoryData',
240
+ method: 'post',
241
+ data: {
242
+ date: '2026-04-25T15:59:59.000Z',
243
+ deviceClasses: ['type-1']
244
+ }
245
+ })
246
+
247
+ const response = getPropHistoryData.fromResponse({
248
+ code: 0,
249
+ rows: [
250
+ {
251
+ _id: 'status-prop',
252
+ value: 1,
253
+ valueStr: '制热',
254
+ recordTime: '2026-04-25T08:00:00.000Z'
255
+ }
256
+ ]
257
+ })
258
+
259
+ expect(response).toEqual({
260
+ code: 0,
261
+ rows: [
262
+ {
263
+ _id: 'status-prop',
264
+ value: 1,
265
+ valueStr: '制热',
266
+ recordTime: '2026-04-25T08:00:00.000Z'
267
+ }
268
+ ]
269
+ })
270
+ })
271
+ })