@ray-js/api 1.5.7 → 1.5.9

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,3 +1,11 @@
1
+ /**
2
+ * 与面板/设备建立绑定关系,通常为设备ID、DP点、群组、规则,dpId#value等
3
+ */
4
+ type AssociativeEntityId = string;
5
+ /**
6
+ * 当associativeEntityId不足以区分情况下使用,通常可关联设备、DP值、群组、规则等
7
+ */
8
+ type AssociativeEntityValue = string;
1
9
  export interface Scene {
2
10
  dpId: number;
3
11
  bindType: number;
@@ -869,21 +877,23 @@ export type IGetSceneListResponse = Array<{
869
877
  }>;
870
878
  export interface IBindRule {
871
879
  devId: string;
872
- associativeEntityId: string;
880
+ sourceEntityId?: string;
881
+ associativeEntityId: AssociativeEntityId;
873
882
  ruleId: string;
874
883
  entitySubIds: string;
875
884
  expr: [string[]];
876
885
  bizDomain: string;
886
+ gid: string;
877
887
  }
878
888
  export interface IBindRuleResponse {
879
889
  /**
880
- * 关联 DP 点和 DP 点值的组合
890
+ * 与面板/设备建立绑定关系,通常为设备ID、DP点、群组、规则,dpId#value等
881
891
  */
882
- associativeEntityId: string;
892
+ associativeEntityId: AssociativeEntityId;
883
893
  /**
884
- * 动作 ID
894
+ * 当associativeEntityId不足以区分情况下使用,通常可关联设备、DP值、群组、规则等
885
895
  */
886
- associativeEntityValue: string;
896
+ associativeEntityValue: AssociativeEntityValue;
887
897
  /**
888
898
  * 业务域
889
899
  */
@@ -909,16 +919,20 @@ export interface IBindRuleResponse {
909
919
  */
910
920
  triggerRuleVO: any;
911
921
  }
922
+ declare enum EntityType {
923
+ DEVICE = 1,// 关联实体为设备
924
+ RULE = 2
925
+ }
912
926
  export interface IGetBindRuleList {
913
927
  bizDomain: string;
914
928
  devId: string;
915
929
  sourceEntityId?: string;
916
- entityType: number;
930
+ entityType: EntityType;
917
931
  gid: string;
918
932
  }
919
933
  export type IGetBindRuleListResponse = Array<{
920
- associativeEntityId: string;
921
- associativeEntityValueList: any[];
934
+ associativeEntityId: AssociativeEntityId;
935
+ associativeEntityValueList: AssociativeEntityValue[];
922
936
  bizDomain: string;
923
937
  sourceEntityId: string;
924
938
  }>;
@@ -926,8 +940,9 @@ export interface IRemoveRule {
926
940
  bizDomain: string;
927
941
  sourceEntityId?: string;
928
942
  devId: string;
929
- associativeEntityId: string;
930
- associativeEntityValue: string;
943
+ associativeEntityId: AssociativeEntityId;
944
+ associativeEntityValue: AssociativeEntityValue;
945
+ gid: string;
931
946
  }
932
947
  export interface IGetDevProperty {
933
948
  /**
@@ -1057,3 +1072,4 @@ export type IGetZigbeeLocalGroupDeviceListResponse = Array<{
1057
1072
  */
1058
1073
  gwOnline: boolean;
1059
1074
  }>;
1075
+ export {};
@@ -1 +1,19 @@
1
+ // 场景相关接口
2
+ /**
3
+ * 与面板/设备建立绑定关系,通常为设备ID、DP点、群组、规则,dpId#value等
4
+ */
5
+ /**
6
+ * 当associativeEntityId不足以区分情况下使用,通常可关联设备、DP值、群组、规则等
7
+ */
8
+ // 云端定时接口
9
+ // 电费统计接口
10
+ // 设备接口
11
+ // 数据统计接口
12
+ // 告警相关接口
13
+ // 联动相关
14
+ var EntityType = /*#__PURE__*/function (EntityType) {
15
+ EntityType[EntityType["DEVICE"] = 1] = "DEVICE";
16
+ EntityType[EntityType["RULE"] = 2] = "RULE";
17
+ return EntityType;
18
+ }(EntityType || {}); // 关联实体为联动规则
1
19
  export {};
@@ -10,7 +10,7 @@ declare const getLinkageDeviceList: (params: IGetLinkageDeviceList) => Promise<I
10
10
  * @param {number} devId 设备id
11
11
  * @param {number} gid 家庭Id
12
12
  */
13
- declare const getSceneList: ({ devId, gid }: {
13
+ declare const getSceneList: ({ devId, gid, }: {
14
14
  devId: string;
15
15
  gid: string;
16
16
  }) => Promise<IGetSceneListResponse>;
@@ -19,7 +19,6 @@ declare const getSceneList: ({ devId, gid }: {
19
19
  * @param {string} bizDomain 业务范围
20
20
  * @param {string} devId 设备id
21
21
  * @param {number} entityType 实体类型
22
- * @param {string} gid 家庭Id
23
22
  */
24
23
  declare const getBindRuleList: (params: IGetBindRuleList) => Promise<IGetBindRuleListResponse>;
25
24
  /**
@@ -30,14 +29,16 @@ declare const getBindRuleList: (params: IGetBindRuleList) => Promise<IGetBindRul
30
29
  * @param {string} entitySubIds 关联 DP 点
31
30
  * @param {Array} expr 关联DP点、动作组合
32
31
  * @param {string} bizDomain 业务域
32
+ * @param {string} bizDomain 业务域
33
33
  */
34
- declare const bindRule: ({ devId, associativeEntityId, ruleId, entitySubIds, expr, bizDomain, }: IBindRule) => Promise<IBindRuleResponse>;
34
+ declare const bindRule: (params: IBindRule) => Promise<IBindRuleResponse>;
35
35
  /**
36
36
  * 解除联动
37
37
  * @param {string} bizDomain 业务范围
38
38
  * @param {string} devId 设备id
39
39
  * @param {string} associativeEntityId 关联dp组合
40
40
  * @param {string} associativeEntityValue 规则id
41
+ * @param {string} gid 家庭id
41
42
  */
42
43
  declare const removeRule: (params: IRemoveRule) => Promise<boolean>;
43
44
  /**
@@ -1,6 +1,7 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- const _excluded = ["gid", "devId", "sourceEntityId"];
3
+ const _excluded = ["gid", "devId", "sourceEntityId"],
4
+ _excluded2 = ["sourceEntityId", "devId", "gid"];
4
5
  import { requestCloud } from '../';
5
6
  import { THING } from '../constants';
6
7
  /**
@@ -14,7 +15,7 @@ const getLinkageDeviceList = params => {
14
15
  version: '3.0',
15
16
  data: _objectSpread({}, params),
16
17
  extData: {
17
- gid: params.gid
18
+ gid: "".concat(params.gid)
18
19
  }
19
20
  });
20
21
  };
@@ -36,7 +37,7 @@ const getSceneList = _ref => {
36
37
  devId
37
38
  },
38
39
  extData: {
39
- gid
40
+ gid: "".concat(gid)
40
41
  }
41
42
  });
42
43
  };
@@ -46,7 +47,6 @@ const getSceneList = _ref => {
46
47
  * @param {string} bizDomain 业务范围
47
48
  * @param {string} devId 设备id
48
49
  * @param {number} entityType 实体类型
49
- * @param {string} gid 家庭Id
50
50
  */
51
51
  const getBindRuleList = async params => {
52
52
  const {
@@ -62,7 +62,7 @@ const getBindRuleList = async params => {
62
62
  sourceEntityId: sourceEntityId || devId
63
63
  }),
64
64
  extData: {
65
- gid
65
+ gid: "".concat(gid)
66
66
  }
67
67
  });
68
68
  };
@@ -75,22 +75,25 @@ const getBindRuleList = async params => {
75
75
  * @param {string} entitySubIds 关联 DP 点
76
76
  * @param {Array} expr 关联DP点、动作组合
77
77
  * @param {string} bizDomain 业务域
78
+ * @param {string} bizDomain 业务域
78
79
  */
79
- const bindRule = _ref2 => {
80
- let {
80
+ const bindRule = params => {
81
+ const {
81
82
  devId,
83
+ sourceEntityId,
82
84
  associativeEntityId,
83
85
  ruleId,
84
86
  entitySubIds,
85
87
  expr,
86
- bizDomain
87
- } = _ref2;
88
+ bizDomain,
89
+ gid
90
+ } = params;
88
91
  return requestCloud({
89
92
  api: "".concat(THING, ".m.linkage.associative.entity.bind"),
90
93
  version: '1.0',
91
94
  data: {
92
95
  relationExpr: {
93
- sourceEntityId: devId,
96
+ sourceEntityId: sourceEntityId || devId,
94
97
  associativeEntityId,
95
98
  associativeEntityValue: ruleId,
96
99
  triggerRuleVO: {
@@ -110,6 +113,9 @@ const bindRule = _ref2 => {
110
113
  bizDomain,
111
114
  uniqueType: 3
112
115
  }
116
+ },
117
+ extData: {
118
+ gid: "".concat(gid)
113
119
  }
114
120
  });
115
121
  };
@@ -120,12 +126,24 @@ const bindRule = _ref2 => {
120
126
  * @param {string} devId 设备id
121
127
  * @param {string} associativeEntityId 关联dp组合
122
128
  * @param {string} associativeEntityValue 规则id
129
+ * @param {string} gid 家庭id
123
130
  */
124
131
  const removeRule = params => {
132
+ const {
133
+ sourceEntityId,
134
+ devId,
135
+ gid
136
+ } = params,
137
+ rest = _objectWithoutProperties(params, _excluded2);
125
138
  return requestCloud({
126
139
  api: "".concat(THING, ".m.linkage.associative.entity.remove"),
127
140
  version: '1.0',
128
- data: _objectSpread({}, params)
141
+ data: _objectSpread({
142
+ sourceEntityId: sourceEntityId || devId
143
+ }, rest),
144
+ extData: {
145
+ gid: "".concat(gid)
146
+ }
129
147
  });
130
148
  };
131
149
 
@@ -133,10 +151,10 @@ const removeRule = params => {
133
151
  * 触发联动
134
152
  * @param {string} ruleId 规则id
135
153
  */
136
- const triggerRule = _ref3 => {
154
+ const triggerRule = _ref2 => {
137
155
  let {
138
156
  ruleId
139
- } = _ref3;
157
+ } = _ref2;
140
158
  return requestCloud({
141
159
  api: "".concat(THING, ".m.linkage.rule.trigger"),
142
160
  version: '1.0',
@@ -150,10 +168,10 @@ const triggerRule = _ref3 => {
150
168
  * 启用联动
151
169
  * @param {string} ruleId 规则id
152
170
  */
153
- const enableRule = _ref4 => {
171
+ const enableRule = _ref3 => {
154
172
  let {
155
173
  ruleId
156
- } = _ref4;
174
+ } = _ref3;
157
175
  return requestCloud({
158
176
  api: "".concat(THING, ".m.linkage.rule.enable"),
159
177
  version: '1.0',
@@ -167,10 +185,10 @@ const enableRule = _ref4 => {
167
185
  * 停用联动
168
186
  * @param {string} ruleId 规则id
169
187
  */
170
- const disableRule = _ref5 => {
188
+ const disableRule = _ref4 => {
171
189
  let {
172
190
  ruleId
173
- } = _ref5;
191
+ } = _ref4;
174
192
  return requestCloud({
175
193
  api: "".concat(THING, ".m.linkage.rule.disable"),
176
194
  version: '1.0',
@@ -21,7 +21,10 @@ type OpenMoreService = {} & ICommon;
21
21
  * 跳转到更多服务
22
22
  */
23
23
  export declare function openMoreService(params?: OpenMoreService): Promise<void>;
24
- type OpenAppHelpCenter = {} & ICommon;
24
+ type OpenAppHelpCenter = {
25
+ bizCode?: string;
26
+ key?: string;
27
+ } & ICommon;
25
28
  /**
26
29
  * 跳转到App帮助与反馈页
27
30
  */
@@ -1,3 +1,6 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ const _excluded = ["bizCode", "key"];
1
4
  import { nativeRouter } from './common';
2
5
  /**
3
6
  * 打开APP扫码
@@ -31,7 +34,17 @@ export function openMoreService(params) {
31
34
  * 跳转到App帮助与反馈页
32
35
  */
33
36
  export function openAppHelpCenter(params) {
34
- return nativeRouter('helpCenter', params);
37
+ const _ref = params || {},
38
+ {
39
+ bizCode = 'help_center',
40
+ key = 'main_page'
41
+ } = _ref,
42
+ rest = _objectWithoutProperties(_ref, _excluded);
43
+ const p = _objectSpread({
44
+ bizCode,
45
+ key
46
+ }, rest);
47
+ return nativeRouter('helpCenter', p);
35
48
  }
36
49
 
37
50
  // messageCenter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/api",
3
- "version": "1.5.7",
3
+ "version": "1.5.9",
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.7",
33
- "@ray-js/router": "1.5.7",
32
+ "@ray-js/framework": "1.5.9",
33
+ "@ray-js/router": "1.5.9",
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.7",
39
+ "@ray-js/cli": "1.5.9",
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.org"
48
48
  },
49
- "gitHead": "47c88e9aab161b13d41234f6bfc65bb0e627426a"
49
+ "gitHead": "01395752c6cc7f4b152fcc6262b6ef2a502f0dd9"
50
50
  }