@cpzxrobot/sdk 1.3.61 → 1.3.63

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/device_gateway.ts CHANGED
@@ -213,6 +213,7 @@ export class DeviceGateway extends Object {
213
213
  async watch(
214
214
  ids: number | number[],
215
215
  fn: any,
216
+ showLast: boolean = true
216
217
  ) {
217
218
  var axios = await this.context.ready;
218
219
  var idQuery = "";
@@ -221,6 +222,9 @@ export class DeviceGateway extends Object {
221
222
  } else {
222
223
  idQuery = `ids=${ids}`;
223
224
  }
225
+ if (showLast) {
226
+ idQuery += "&show-last=true";
227
+ }
224
228
  return axios.getAsSse(`/api/v1/device/watch?` + idQuery, fn)
225
229
  }
226
230
 
@@ -775,7 +779,7 @@ export class DeviceGateway extends Object {
775
779
  if (manufacturerId === undefined) {
776
780
  return axios.get('/api/v3/device/model');
777
781
  } else {
778
- return axios.get(`/api/v3/device/manufacture/${manufacturerId}/models`);
782
+ return axios.get(`/api/v3/device/manufacturer/${manufacturerId}/models`);
779
783
  }
780
784
  },
781
785
 
@@ -173,7 +173,7 @@ class DeviceGateway extends Object {
173
173
  show(id, type = "datapoint") {
174
174
  this.context.platform.showInDeviceManager(id, type);
175
175
  }
176
- async watch(ids, fn) {
176
+ async watch(ids, fn, showLast = true) {
177
177
  var axios = await this.context.ready;
178
178
  var idQuery = "";
179
179
  if (Array.isArray(ids)) {
@@ -182,6 +182,9 @@ class DeviceGateway extends Object {
182
182
  else {
183
183
  idQuery = `ids=${ids}`;
184
184
  }
185
+ if (showLast) {
186
+ idQuery += "&show-last=true";
187
+ }
185
188
  return axios.getAsSse(`/api/v1/device/watch?` + idQuery, fn);
186
189
  }
187
190
  getFilter(type, cls) {
@@ -618,7 +621,7 @@ class DeviceGateway extends Object {
618
621
  return axios.get('/api/v3/device/model');
619
622
  }
620
623
  else {
621
- return axios.get(`/api/v3/device/manufacture/${manufacturerId}/models`);
624
+ return axios.get(`/api/v3/device/manufacturer/${manufacturerId}/models`);
622
625
  }
623
626
  },
624
627
  create: async (data) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.61",
3
+ "version": "1.3.63",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {