@ray-js/api 1.5.8 → 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,7 +877,8 @@ 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[]];
@@ -878,13 +887,13 @@ export interface IBindRule {
878
887
  }
879
888
  export interface IBindRuleResponse {
880
889
  /**
881
- * 关联 DP 点和 DP 点值的组合
890
+ * 与面板/设备建立绑定关系,通常为设备ID、DP点、群组、规则,dpId#value等
882
891
  */
883
- associativeEntityId: string;
892
+ associativeEntityId: AssociativeEntityId;
884
893
  /**
885
- * 动作 ID
894
+ * 当associativeEntityId不足以区分情况下使用,通常可关联设备、DP值、群组、规则等
886
895
  */
887
- associativeEntityValue: string;
896
+ associativeEntityValue: AssociativeEntityValue;
888
897
  /**
889
898
  * 业务域
890
899
  */
@@ -910,16 +919,20 @@ export interface IBindRuleResponse {
910
919
  */
911
920
  triggerRuleVO: any;
912
921
  }
922
+ declare enum EntityType {
923
+ DEVICE = 1,// 关联实体为设备
924
+ RULE = 2
925
+ }
913
926
  export interface IGetBindRuleList {
914
927
  bizDomain: string;
915
928
  devId: string;
916
929
  sourceEntityId?: string;
917
- entityType: number;
930
+ entityType: EntityType;
918
931
  gid: string;
919
932
  }
920
933
  export type IGetBindRuleListResponse = Array<{
921
- associativeEntityId: string;
922
- associativeEntityValueList: any[];
934
+ associativeEntityId: AssociativeEntityId;
935
+ associativeEntityValueList: AssociativeEntityValue[];
923
936
  bizDomain: string;
924
937
  sourceEntityId: string;
925
938
  }>;
@@ -927,8 +940,8 @@ export interface IRemoveRule {
927
940
  bizDomain: string;
928
941
  sourceEntityId?: string;
929
942
  devId: string;
930
- associativeEntityId: string;
931
- associativeEntityValue: string;
943
+ associativeEntityId: AssociativeEntityId;
944
+ associativeEntityValue: AssociativeEntityValue;
932
945
  gid: string;
933
946
  }
934
947
  export interface IGetDevProperty {
@@ -1059,3 +1072,4 @@ export type IGetZigbeeLocalGroupDeviceListResponse = Array<{
1059
1072
  */
1060
1073
  gwOnline: boolean;
1061
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>;
@@ -31,7 +31,7 @@ declare const getBindRuleList: (params: IGetBindRuleList) => Promise<IGetBindRul
31
31
  * @param {string} bizDomain 业务域
32
32
  * @param {string} bizDomain 业务域
33
33
  */
34
- declare const bindRule: ({ devId, associativeEntityId, ruleId, entitySubIds, expr, bizDomain, gid }: IBindRule) => Promise<IBindRuleResponse>;
34
+ declare const bindRule: (params: IBindRule) => Promise<IBindRuleResponse>;
35
35
  /**
36
36
  * 解除联动
37
37
  * @param {string} bizDomain 业务范围
@@ -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
  /**
@@ -76,22 +77,23 @@ const getBindRuleList = async params => {
76
77
  * @param {string} bizDomain 业务域
77
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
88
  bizDomain,
87
89
  gid
88
- } = _ref2;
90
+ } = params;
89
91
  return requestCloud({
90
92
  api: "".concat(THING, ".m.linkage.associative.entity.bind"),
91
93
  version: '1.0',
92
94
  data: {
93
95
  relationExpr: {
94
- sourceEntityId: devId,
96
+ sourceEntityId: sourceEntityId || devId,
95
97
  associativeEntityId,
96
98
  associativeEntityValue: ruleId,
97
99
  triggerRuleVO: {
@@ -127,12 +129,20 @@ const bindRule = _ref2 => {
127
129
  * @param {string} gid 家庭id
128
130
  */
129
131
  const removeRule = params => {
132
+ const {
133
+ sourceEntityId,
134
+ devId,
135
+ gid
136
+ } = params,
137
+ rest = _objectWithoutProperties(params, _excluded2);
130
138
  return requestCloud({
131
139
  api: "".concat(THING, ".m.linkage.associative.entity.remove"),
132
140
  version: '1.0',
133
- data: _objectSpread({}, params),
141
+ data: _objectSpread({
142
+ sourceEntityId: sourceEntityId || devId
143
+ }, rest),
134
144
  extData: {
135
- gid: "".concat(params.gid)
145
+ gid: "".concat(gid)
136
146
  }
137
147
  });
138
148
  };
@@ -141,10 +151,10 @@ const removeRule = params => {
141
151
  * 触发联动
142
152
  * @param {string} ruleId 规则id
143
153
  */
144
- const triggerRule = _ref3 => {
154
+ const triggerRule = _ref2 => {
145
155
  let {
146
156
  ruleId
147
- } = _ref3;
157
+ } = _ref2;
148
158
  return requestCloud({
149
159
  api: "".concat(THING, ".m.linkage.rule.trigger"),
150
160
  version: '1.0',
@@ -158,10 +168,10 @@ const triggerRule = _ref3 => {
158
168
  * 启用联动
159
169
  * @param {string} ruleId 规则id
160
170
  */
161
- const enableRule = _ref4 => {
171
+ const enableRule = _ref3 => {
162
172
  let {
163
173
  ruleId
164
- } = _ref4;
174
+ } = _ref3;
165
175
  return requestCloud({
166
176
  api: "".concat(THING, ".m.linkage.rule.enable"),
167
177
  version: '1.0',
@@ -175,10 +185,10 @@ const enableRule = _ref4 => {
175
185
  * 停用联动
176
186
  * @param {string} ruleId 规则id
177
187
  */
178
- const disableRule = _ref5 => {
188
+ const disableRule = _ref4 => {
179
189
  let {
180
190
  ruleId
181
- } = _ref5;
191
+ } = _ref4;
182
192
  return requestCloud({
183
193
  api: "".concat(THING, ".m.linkage.rule.disable"),
184
194
  version: '1.0',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/api",
3
- "version": "1.5.8",
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.8",
33
- "@ray-js/router": "1.5.8",
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.8",
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": "5e676b1fb2f9d04c5bcec74f0988dcb9c7e658b8"
49
+ "gitHead": "01395752c6cc7f4b152fcc6262b6ef2a502f0dd9"
50
50
  }