@ray-js/api 1.5.26 → 1.5.28

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.
@@ -1,4 +1,4 @@
1
- import { IGetDpsInfos, IUpdateDpName, IUpdateGroupDpName, IGetWeatherQuality, IGetWeathers, ISaveCustomizePosition, IGetCustomizePosition, IGetDpsInfosResponse, IGetGroupDpsInfosResponse, IGetWeatherQualityResponse, IGetCustomizePositionResponse, IGetWeathersResponse, IGetDevProperty, ISaveDevProperty } from './interface';
1
+ import { IGetDpsInfos, IUpdateDpName, IUpdateGroupDpName, IGetWeatherQuality, IGetWeathers, ISaveCustomizePosition, IGetCustomizePosition, IGetDpsInfosResponse, IGetGroupDpsInfosResponse, IGetWeatherQualityResponse, IGetCustomizePositionResponse, IGetWeathersResponse, IGetDevProperty, IGetDevPropertyResponse, ISaveDevProperty } from './interface';
2
2
  /**
3
3
  * 获取设备所有 DP 信息
4
4
  * @param {string} gwId 网关Id, 直连设备值同 devId,子设备则传网关的设备id
@@ -54,7 +54,7 @@ declare const getCustomizePosition: (params: IGetCustomizePosition) => Promise<I
54
54
  * 获取设备属性
55
55
  * @param {string} devId 设备Id
56
56
  */
57
- declare const getDevProperty: (params: IGetDevProperty) => Promise<string>;
57
+ declare const getDevProperty: (params: IGetDevProperty) => Promise<IGetDevPropertyResponse>;
58
58
  /**
59
59
  * 保存设备属性
60
60
  * @param {string} devId 设备Id
@@ -1268,7 +1268,40 @@ export interface IGetDevProperty {
1268
1268
  */
1269
1269
  code: string;
1270
1270
  }
1271
- export type IGetDevPropertyResponse = string;
1271
+ export type IGetDevPropertyResponse = Array<{
1272
+ /**
1273
+ * 业务类型
1274
+ */
1275
+ bizType: number;
1276
+ /**
1277
+ * 设备自定义属性 key
1278
+ */
1279
+ code: string;
1280
+ /**
1281
+ * 设备 ID
1282
+ */
1283
+ devId: string;
1284
+ /**
1285
+ * 创建时间
1286
+ */
1287
+ gmtCreate: number;
1288
+ /**
1289
+ * 修改时间
1290
+ */
1291
+ gmtModified: number;
1292
+ /**
1293
+ * 唯一标识
1294
+ */
1295
+ id: string;
1296
+ /**
1297
+ * 保存设备属性时的配置规则
1298
+ */
1299
+ type: string;
1300
+ /**
1301
+ * 属性值
1302
+ */
1303
+ value: string;
1304
+ }>;
1272
1305
  export interface ISaveDevProperty {
1273
1306
  /**
1274
1307
  * 设备 ID
@@ -1282,6 +1315,12 @@ export interface ISaveDevProperty {
1282
1315
  * 设备自定义属性列表,string 结构详见 @type{DeviceProperty}
1283
1316
  */
1284
1317
  propertyList: string;
1318
+ /**
1319
+ * 保存设备属性的配置规则,仅针对当前写入的属性有效,
1320
+ * 默认在设备重置和设备重置并清除数据时均会移除
1321
+ * 可以配置成 `remainAfterReset` 代表在设备重置时保留数据,仅在设备重置并清除数据时移除
1322
+ */
1323
+ type?: 'remainAfterReset' | string;
1285
1324
  }
1286
1325
  export interface DeviceProperty {
1287
1326
  /**
@@ -166,11 +166,15 @@ export async function initPanelEnvironment() {
166
166
  initPanel(getLaunchOptionsSync());
167
167
  }, 3000);
168
168
  // 基础库版本需要大于 2.6.0
169
+
170
+ // @ts-ignore
171
+ const __AppOnReady = App.onReady;
169
172
  // @ts-ignore
170
173
  App.onReady = event => {
174
+ typeof __AppOnReady === 'function' && __AppOnReady(event);
171
175
  init = true;
172
176
  clearTimeout(timeout);
173
- initPanel(event);
177
+ initPanel(getLaunchOptionsSync());
174
178
  };
175
179
 
176
180
  // 使用 Promise 确保业务可以通过 initPanelEnvironment 的正常调用明确设备信息初始化完成
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/api",
3
- "version": "1.5.26",
3
+ "version": "1.5.28",
4
4
  "description": "Ray universal api",
5
5
  "keywords": [
6
6
  "ray"
@@ -29,14 +29,14 @@
29
29
  "watch": "ray start --type=component"
30
30
  },
31
31
  "dependencies": {
32
- "@ray-js/framework": "1.5.26",
33
- "@ray-js/router": "1.5.26",
32
+ "@ray-js/framework": "1.5.28",
33
+ "@ray-js/router": "1.5.28",
34
34
  "@ray-js/wechat": "^0.2.9",
35
35
  "base64-browser": "^1.0.1",
36
36
  "query-string": "^7.1.3"
37
37
  },
38
38
  "devDependencies": {
39
- "@ray-js/cli": "1.5.26",
39
+ "@ray-js/cli": "1.5.28",
40
40
  "art-template": "^4.13.2",
41
41
  "fs-extra": "^10.1.0",
42
42
  "miniprogram-api-typings": "^3.12.2",
@@ -46,5 +46,5 @@
46
46
  "access": "public",
47
47
  "registry": "https://registry.npmjs.com"
48
48
  },
49
- "gitHead": "779a1ed43d28b46191e9c2a4044795700489f7b3"
49
+ "gitHead": "40359d8769cb30688c912044b009dc7115e73c31"
50
50
  }