@ray-js/lock-sdk 1.2.0-beta.3 → 1.2.0-beta.30

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.
Files changed (269) hide show
  1. package/lib/api/fit.d.ts +55 -2
  2. package/lib/api/fit.js +43 -1
  3. package/lib/api/gesture.d.ts +11 -0
  4. package/lib/api/gesture.js +18 -0
  5. package/lib/api/log.d.ts +52 -4
  6. package/lib/api/log.js +22 -0
  7. package/lib/api/notify.d.ts +28 -0
  8. package/lib/api/notify.js +17 -0
  9. package/lib/api/service.d.ts +26 -0
  10. package/lib/api/service.js +25 -0
  11. package/lib/api/temp.d.ts +21 -0
  12. package/lib/api/temp.js +24 -0
  13. package/lib/api/video.d.ts +9 -0
  14. package/lib/api/video.js +30 -0
  15. package/lib/api/voip.d.ts +10 -0
  16. package/lib/api/voip.js +17 -0
  17. package/lib/config/dp-code/index.d.ts +2 -1
  18. package/lib/config/dp-code/index.js +2 -0
  19. package/lib/config/dp-map/media.d.ts +13 -0
  20. package/lib/config/dp-map/media.js +19 -0
  21. package/lib/entries/main/bootstrap/bootstrap-lock-instance.d.ts +2 -1
  22. package/lib/entries/main/bootstrap/bootstrap-lock-instance.js +23 -8
  23. package/lib/entries/main/bootstrap/bootstrap.d.ts +3 -2
  24. package/lib/entries/main/bootstrap/bootstrap.js +10 -6
  25. package/lib/entries/main/bootstrap/primary-instance.d.ts +1 -2
  26. package/lib/entries/main/bootstrap/primary-instance.js +1 -1
  27. package/lib/entries/main/bootstrap/resolve-runtime-from-export-this.js +1 -1
  28. package/lib/entries/main/build-instance.d.ts +6 -3
  29. package/lib/entries/main/build-instance.js +13 -1
  30. package/lib/entries/main/exports/capability.d.ts +2 -0
  31. package/lib/entries/main/exports/capability.js +7 -1
  32. package/lib/entries/main/exports/fit-sdk/binding.d.ts +10 -0
  33. package/lib/entries/{fit/exports → main/exports/fit-sdk}/binding.js +6 -3
  34. package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.d.ts +11 -10
  35. package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.js +20 -20
  36. package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.d.ts +1 -0
  37. package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.js +1 -0
  38. package/lib/entries/main/exports/fit-sdk/log.d.ts +3 -0
  39. package/lib/entries/main/exports/fit-sdk/log.js +5 -0
  40. package/lib/entries/main/exports/fit-sdk/temp.d.ts +40 -0
  41. package/lib/entries/main/exports/fit-sdk/temp.js +59 -0
  42. package/lib/entries/main/exports/gesture.d.ts +6 -0
  43. package/lib/entries/main/exports/gesture.js +8 -0
  44. package/lib/entries/main/exports/index.d.ts +8 -0
  45. package/lib/entries/main/exports/index.js +8 -0
  46. package/lib/entries/main/exports/log.d.ts +2 -0
  47. package/lib/entries/main/exports/log.js +7 -1
  48. package/lib/entries/main/exports/media.d.ts +10 -1
  49. package/lib/entries/main/exports/media.js +29 -1
  50. package/lib/entries/main/exports/misc.d.ts +4 -2
  51. package/lib/entries/main/exports/misc.js +2 -2
  52. package/lib/entries/main/exports/notify.d.ts +7 -0
  53. package/lib/entries/main/exports/notify.js +8 -0
  54. package/lib/entries/main/exports/service.d.ts +4 -0
  55. package/lib/entries/main/exports/service.js +11 -0
  56. package/lib/entries/main/exports/voip.d.ts +3 -0
  57. package/lib/entries/main/exports/voip.js +8 -0
  58. package/lib/entries/main/index.d.ts +3 -3
  59. package/lib/entries/main/index.js +11 -5
  60. package/lib/feature/fit/bind-lock-to-fit.d.ts +1 -0
  61. package/lib/feature/fit/bind-lock-to-fit.js +53 -0
  62. package/lib/feature/fit/ble-key.d.ts +10 -4
  63. package/lib/feature/fit/ble-key.js +145 -4
  64. package/lib/feature/fit/device-bv.d.ts +2 -0
  65. package/lib/feature/fit/device-bv.js +15 -0
  66. package/lib/feature/fit/invalid-password.d.ts +10 -0
  67. package/lib/feature/fit/invalid-password.js +43 -0
  68. package/lib/feature/fit/list.d.ts +12 -2
  69. package/lib/feature/fit/list.js +54 -5
  70. package/lib/feature/fit/log.d.ts +7 -0
  71. package/lib/feature/fit/log.js +123 -0
  72. package/lib/feature/fit/method/add-flow.js +2 -2
  73. package/lib/feature/fit/method/add-password.js +2 -2
  74. package/lib/feature/fit/method/update-remove.js +40 -14
  75. package/lib/feature/fit/password-list.d.ts +37 -0
  76. package/lib/feature/fit/password-list.js +44 -1
  77. package/lib/feature/fit/security-channel.d.ts +3 -0
  78. package/lib/feature/fit/security-channel.js +43 -0
  79. package/lib/feature/fit/shared.d.ts +8 -0
  80. package/lib/feature/fit/shared.js +40 -1
  81. package/lib/feature/fit/sync.d.ts +4 -2
  82. package/lib/feature/fit/sync.js +63 -22
  83. package/lib/feature/fit/temp-password.d.ts +23 -0
  84. package/lib/feature/fit/temp-password.js +95 -3
  85. package/lib/feature/fit/users.d.ts +1 -0
  86. package/lib/feature/fit/users.js +1 -0
  87. package/lib/feature/gesture/gesture.d.ts +6 -0
  88. package/lib/feature/gesture/gesture.js +3 -0
  89. package/lib/feature/log/log.d.ts +5 -1
  90. package/lib/feature/log/log.js +53 -6
  91. package/lib/feature/media/camera.d.ts +18 -0
  92. package/lib/feature/media/camera.js +36 -0
  93. package/lib/feature/media/media.d.ts +10 -0
  94. package/lib/feature/media/media.js +31 -0
  95. package/lib/feature/misc/ble-control.js +2 -2
  96. package/lib/feature/misc/capability.d.ts +2 -0
  97. package/lib/feature/misc/capability.js +84 -11
  98. package/lib/feature/misc/connect-device.d.ts +1 -1
  99. package/lib/feature/misc/connect-device.js +7 -6
  100. package/lib/feature/misc/is-use-near-channel-for-runtime.js +8 -1
  101. package/lib/feature/notify/notify.d.ts +4 -0
  102. package/lib/feature/notify/notify.js +3 -0
  103. package/lib/feature/password/temporary/custom-dp.js +59 -54
  104. package/lib/feature/password/temporary/offline-create.d.ts +14 -0
  105. package/lib/feature/password/temporary/offline-create.js +77 -1
  106. package/lib/feature/service/goto-service.d.ts +3 -2
  107. package/lib/feature/service/goto-service.js +7 -1
  108. package/lib/feature/service/value-added.d.ts +4 -0
  109. package/lib/feature/service/value-added.js +4 -0
  110. package/lib/feature/state/clear.js +1 -0
  111. package/lib/feature/state/device-status.js +17 -6
  112. package/lib/feature/state/init-state.js +20 -12
  113. package/lib/feature/state/platform-routing.js +12 -3
  114. package/lib/feature/state/remote-permissions.js +17 -0
  115. package/lib/feature/state/sync/remote-serect-key.js +7 -0
  116. package/lib/feature/storage/index.d.ts +5 -0
  117. package/lib/feature/storage/index.js +32 -0
  118. package/lib/feature/storage/swr-cache.d.ts +7 -0
  119. package/lib/feature/storage/swr-cache.js +54 -0
  120. package/lib/feature/unlock/method/add-flow.js +2 -2
  121. package/lib/feature/unlock/method/add-password.js +2 -2
  122. package/lib/feature/unlock/sync/unlock-method.js +3 -0
  123. package/lib/feature/user/sync-user.js +4 -2
  124. package/lib/feature/utils/index.d.ts +1 -0
  125. package/lib/feature/utils/index.js +1 -0
  126. package/lib/feature/voip/voip.d.ts +3 -0
  127. package/lib/feature/voip/voip.js +3 -0
  128. package/lib/interface.d.ts +42 -1
  129. package/lib/platform/device.d.ts +4 -3
  130. package/lib/platform/index.d.ts +1 -0
  131. package/lib/platform/index.js +1 -0
  132. package/lib/platform/ipc.d.ts +3 -0
  133. package/lib/platform/ipc.js +13 -0
  134. package/lib/platform/storage.d.ts +3 -0
  135. package/lib/platform/storage.js +9 -0
  136. package/lib/runtime/LockDeviceRuntime.js +3 -0
  137. package/lib/runtime/lock-config.d.ts +5 -1
  138. package/lib/runtime/lock-config.js +6 -0
  139. package/lib/runtime/runtime-state-types.d.ts +6 -0
  140. package/lib/utils/constant.d.ts +1 -0
  141. package/lib/utils/constant.js +6 -0
  142. package/lib/utils/errors.js +3 -1
  143. package/lib/utils/index.d.ts +2 -1
  144. package/lib/utils/index.js +1 -0
  145. package/lib/utils/parse.js +1 -1
  146. package/package.json +1 -11
  147. package/lib/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  148. package/lib/bootstrap/bootstrap-lock-instance.js +0 -16
  149. package/lib/bootstrap/bootstrap.d.ts +0 -4
  150. package/lib/bootstrap/bootstrap.js +0 -53
  151. package/lib/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  152. package/lib/bootstrap/lock-instance-runtime-ref.js +0 -7
  153. package/lib/bootstrap/primary-instance.d.ts +0 -6
  154. package/lib/bootstrap/primary-instance.js +0 -24
  155. package/lib/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  156. package/lib/bootstrap/resolve-runtime-from-export-this.js +0 -29
  157. package/lib/bootstrap/top-level-runtime.d.ts +0 -2
  158. package/lib/bootstrap/top-level-runtime.js +0 -9
  159. package/lib/entries/ble/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  160. package/lib/entries/ble/bootstrap/bootstrap-lock-instance.js +0 -12
  161. package/lib/entries/ble/bootstrap/bootstrap.d.ts +0 -4
  162. package/lib/entries/ble/bootstrap/bootstrap.js +0 -53
  163. package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  164. package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.js +0 -7
  165. package/lib/entries/ble/bootstrap/primary-instance.d.ts +0 -6
  166. package/lib/entries/ble/bootstrap/primary-instance.js +0 -24
  167. package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  168. package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.js +0 -29
  169. package/lib/entries/ble/bootstrap/top-level-runtime.d.ts +0 -2
  170. package/lib/entries/ble/bootstrap/top-level-runtime.js +0 -9
  171. package/lib/entries/ble/build-instance.d.ts +0 -9
  172. package/lib/entries/ble/build-instance.js +0 -50
  173. package/lib/entries/ble/exports/capability.d.ts +0 -6
  174. package/lib/entries/ble/exports/capability.js +0 -17
  175. package/lib/entries/ble/exports/config.d.ts +0 -3
  176. package/lib/entries/ble/exports/config.js +0 -5
  177. package/lib/entries/ble/exports/dp.d.ts +0 -9
  178. package/lib/entries/ble/exports/dp.js +0 -13
  179. package/lib/entries/ble/exports/index.d.ts +0 -16
  180. package/lib/entries/ble/exports/index.js +0 -16
  181. package/lib/entries/ble/exports/linkage.d.ts +0 -5
  182. package/lib/entries/ble/exports/linkage.js +0 -15
  183. package/lib/entries/ble/exports/log.d.ts +0 -9
  184. package/lib/entries/ble/exports/log.js +0 -21
  185. package/lib/entries/ble/exports/media.d.ts +0 -4
  186. package/lib/entries/ble/exports/media.js +0 -12
  187. package/lib/entries/ble/exports/misc.d.ts +0 -19
  188. package/lib/entries/ble/exports/misc.js +0 -30
  189. package/lib/entries/ble/exports/offline-dps.d.ts +0 -8
  190. package/lib/entries/ble/exports/offline-dps.js +0 -24
  191. package/lib/entries/ble/exports/open/do-open-close-action.d.ts +0 -2
  192. package/lib/entries/ble/exports/open/do-open-close-action.js +0 -36
  193. package/lib/entries/ble/exports/open/index.d.ts +0 -18
  194. package/lib/entries/ble/exports/open/index.js +0 -45
  195. package/lib/entries/ble/exports/signal.d.ts +0 -6
  196. package/lib/entries/ble/exports/signal.js +0 -14
  197. package/lib/entries/ble/exports/sleep.d.ts +0 -13
  198. package/lib/entries/ble/exports/sleep.js +0 -31
  199. package/lib/entries/ble/exports/state.d.ts +0 -6
  200. package/lib/entries/ble/exports/state.js +0 -19
  201. package/lib/entries/ble/exports/temporary.d.ts +0 -31
  202. package/lib/entries/ble/exports/temporary.js +0 -91
  203. package/lib/entries/ble/exports/unlock/sync.d.ts +0 -1
  204. package/lib/entries/ble/exports/unlock/sync.js +0 -5
  205. package/lib/entries/ble/exports/unlock-method.d.ts +0 -19
  206. package/lib/entries/ble/exports/unlock-method.js +0 -58
  207. package/lib/entries/ble/exports/user/index.d.ts +0 -23
  208. package/lib/entries/ble/exports/user/index.js +0 -22
  209. package/lib/entries/ble/exports/user/sync.d.ts +0 -1
  210. package/lib/entries/ble/exports/user/sync.js +0 -5
  211. package/lib/entries/ble/index.d.ts +0 -8
  212. package/lib/entries/ble/index.js +0 -39
  213. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  214. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.js +0 -12
  215. package/lib/entries/fit/bootstrap/bootstrap.d.ts +0 -4
  216. package/lib/entries/fit/bootstrap/bootstrap.js +0 -69
  217. package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  218. package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.js +0 -7
  219. package/lib/entries/fit/bootstrap/primary-instance.d.ts +0 -6
  220. package/lib/entries/fit/bootstrap/primary-instance.js +0 -24
  221. package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  222. package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.js +0 -29
  223. package/lib/entries/fit/bootstrap/top-level-runtime.d.ts +0 -2
  224. package/lib/entries/fit/bootstrap/top-level-runtime.js +0 -9
  225. package/lib/entries/fit/build-instance.d.ts +0 -9
  226. package/lib/entries/fit/build-instance.js +0 -57
  227. package/lib/entries/fit/exports/binding.d.ts +0 -8
  228. package/lib/entries/fit/exports/temp.d.ts +0 -19
  229. package/lib/entries/fit/exports/temp.js +0 -18
  230. package/lib/entries/fit/index.d.ts +0 -8
  231. package/lib/entries/fit/index.js +0 -36
  232. package/lib/entries/main/exports/open.d.ts +0 -16
  233. package/lib/entries/main/exports/open.js +0 -44
  234. package/lib/entries/screen/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  235. package/lib/entries/screen/bootstrap/bootstrap-lock-instance.js +0 -12
  236. package/lib/entries/screen/bootstrap/bootstrap.d.ts +0 -4
  237. package/lib/entries/screen/bootstrap/bootstrap.js +0 -69
  238. package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  239. package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.js +0 -7
  240. package/lib/entries/screen/bootstrap/primary-instance.d.ts +0 -6
  241. package/lib/entries/screen/bootstrap/primary-instance.js +0 -24
  242. package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  243. package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.js +0 -29
  244. package/lib/entries/screen/bootstrap/top-level-runtime.d.ts +0 -2
  245. package/lib/entries/screen/bootstrap/top-level-runtime.js +0 -9
  246. package/lib/entries/screen/build-instance.d.ts +0 -9
  247. package/lib/entries/screen/build-instance.js +0 -57
  248. package/lib/entries/screen/exports/bind-events.d.ts +0 -4
  249. package/lib/entries/screen/exports/bind-events.js +0 -8
  250. package/lib/entries/screen/exports/binding.d.ts +0 -6
  251. package/lib/entries/screen/exports/binding.js +0 -15
  252. package/lib/entries/screen/exports/device.d.ts +0 -16
  253. package/lib/entries/screen/exports/device.js +0 -41
  254. package/lib/entries/screen/exports/event.d.ts +0 -3
  255. package/lib/entries/screen/exports/event.js +0 -5
  256. package/lib/entries/screen/exports/index.d.ts +0 -5
  257. package/lib/entries/screen/exports/index.js +0 -5
  258. package/lib/entries/screen/exports/user.d.ts +0 -2
  259. package/lib/entries/screen/exports/user.js +0 -8
  260. package/lib/entries/screen/index.d.ts +0 -8
  261. package/lib/entries/screen/index.js +0 -36
  262. package/lib/feature/unlock/door/door-action.d.ts +0 -2
  263. package/lib/feature/unlock/door/door-action.js +0 -32
  264. package/lib/fit.d.ts +0 -4
  265. package/lib/fit.js +0 -3
  266. package/lib/runtime/device-status/compute-device-status.d.ts +0 -25
  267. package/lib/runtime/device-status/compute-device-status.js +0 -94
  268. package/lib/screen.d.ts +0 -4
  269. package/lib/screen.js +0 -3
@@ -0,0 +1,123 @@
1
+ import { getFitRecordListApi } from "../../api/log";
2
+ import { closeTypes, dpIdsForUsernameToUnlockName, unlockDp2Type, } from "../log/log";
3
+ import dpCodes from "../../config/dp-code";
4
+ import base64ToHex from "../../utils/base64-to-hex";
5
+ import { handleLocalOperation } from "../../utils/log";
6
+ import { getCurrentUserForRuntime } from "../user/current-user";
7
+ const fitRecordDps = [
8
+ dpCodes.bluetoothUnlockKit,
9
+ dpCodes.unlockPasswordKit,
10
+ dpCodes.unlockCardKit,
11
+ dpCodes.unlockFingerprintKit,
12
+ dpCodes.unlockFaceKit,
13
+ dpCodes.unlockEyeKit,
14
+ dpCodes.unlockHandKit,
15
+ dpCodes.unlockFingerVeinKit,
16
+ dpCodes.unlockTemporaryKit,
17
+ dpCodes.unlockDoubleKit,
18
+ dpCodes.unlockOfflinePd,
19
+ dpCodes.unlockDynamic,
20
+ dpCodes.lockRecord,
21
+ ];
22
+ function parseFitRecord(cfg, raw, currentUserId) {
23
+ const historyId = raw.historyId ?? raw.id;
24
+ const time = raw.gmtCreate ?? Number(raw.time);
25
+ const dpId = typeof raw.dpId === "string" ? Number(raw.dpId) : raw.dpId;
26
+ let closeValue = undefined;
27
+ let dpValue = raw.dpValue;
28
+ const dpCode = cfg.codesById[dpId];
29
+ let type = dpCode === dpCodes.lockRecord ? "close_record" : "unlock_record";
30
+ const dpSchema = cfg.dpSchema[dpCode];
31
+ if (dpSchema?.type === "raw" && typeof dpValue === "string") {
32
+ try {
33
+ dpValue = base64ToHex(dpValue);
34
+ }
35
+ catch {
36
+ }
37
+ }
38
+ if (type === "close_record") {
39
+ const rawCloseValue = typeof dpValue === "string" ? dpValue : "";
40
+ const closeType = parseInt(rawCloseValue.slice(0, 2), 16);
41
+ closeValue = closeTypes[closeType] || closeTypes[0];
42
+ }
43
+ if (dpCode === dpCodes.lockLocalRecord) {
44
+ type = "local_operation";
45
+ }
46
+ let userName = raw.userName;
47
+ let unlockName = raw.unlockName;
48
+ if (dpIdsForUsernameToUnlockName.includes(dpId)) {
49
+ unlockName = raw.userName;
50
+ userName = "";
51
+ }
52
+ const log = {
53
+ type,
54
+ logId: String(historyId),
55
+ userId: raw.userId,
56
+ dpId,
57
+ data: dpValue,
58
+ dpCode,
59
+ userName: userName || "",
60
+ unlockName: unlockName || "",
61
+ avatarUrl: raw.avatarUrl,
62
+ relateDevName: raw.relateDevName,
63
+ mediaInfo: raw.mediaInfoList?.map?.((item) => {
64
+ return {
65
+ mediaPath: item.mediaPath,
66
+ fileKey: item.fileKey,
67
+ fileUrl: item.fileUrl,
68
+ mediaBucket: item.mediaBucket,
69
+ mediaKey: item.mediaKey,
70
+ width: item.positionWidth,
71
+ height: item.positionHeight,
72
+ angle: item.positionAngle,
73
+ isVR: !!item.positionVr,
74
+ position: item.position,
75
+ };
76
+ }),
77
+ unionUnlockInfo: raw.unionUnlockInfo?.map((item) => ({
78
+ userId: item.userId,
79
+ userName: item.userName,
80
+ unlockName: item.unlockName,
81
+ sn: item.sn,
82
+ type: unlockDp2Type[item.opMode],
83
+ })),
84
+ closeValue,
85
+ time,
86
+ currentUser: +raw.userId === +currentUserId,
87
+ bindable: raw.memberBindableFlag === 1,
88
+ unlockMethod: type === "unlock_record" ? unlockDp2Type[dpCode] : undefined,
89
+ localRecord: handleLocalOperation(raw.localOperateRecordInfo, dpValue),
90
+ };
91
+ if (raw.matterRecordInfo) {
92
+ log.matterRecord = {
93
+ sn: raw.matterRecordInfo.matterSn,
94
+ type: raw.matterRecordInfo.matterType,
95
+ source: raw.matterRecordInfo.matterSource,
96
+ };
97
+ }
98
+ return log;
99
+ }
100
+ export async function getFitLogsForRuntime(rt, params) {
101
+ const cfg = rt.config;
102
+ const { page = 1, pageSize = 50 } = params || {};
103
+ const currentUser = await getCurrentUserForRuntime(rt);
104
+ const data = await getFitRecordListApi({
105
+ devId: cfg.devInfo.devId,
106
+ dpIds: fitRecordDps.reduce((res, item) => {
107
+ if (cfg.idsByCode[item]) {
108
+ res.push(cfg.idsByCode[item]);
109
+ }
110
+ return res;
111
+ }, []),
112
+ offset: (page - 1) * pageSize,
113
+ limit: pageSize,
114
+ });
115
+ if (!data?.datas?.length) {
116
+ return { list: [], hasMore: false, total: 0 };
117
+ }
118
+ return {
119
+ list: data.datas.map((raw) => parseFitRecord(cfg, raw, currentUser.userId)),
120
+ hasMore: data.hasNext,
121
+ total: data.totalCount,
122
+ };
123
+ }
@@ -1,6 +1,6 @@
1
1
  import dpUtils from "@ray-js/tuya-dp-transform";
2
2
  import { addFitOpenMode } from "../../../api/fit";
3
- import { sleep } from "../../../utils";
3
+ import { formatCloudUnlockId, sleep } from "../../../utils";
4
4
  import { DPCHANGE } from "../../../utils/constant";
5
5
  import { getError } from "../../../utils/errors";
6
6
  import emitter from "../../../utils/event";
@@ -195,7 +195,7 @@ const handleAddReport = async (dps) => {
195
195
  await addFitOpenMode({
196
196
  devIdList: [addUnlockMethodData.lockDevId],
197
197
  fittingId: rt.devId,
198
- unlockId: `${addUnlockMethodData.unlockDpId}-${result.unlockId}`,
198
+ unlockId: formatCloudUnlockId(addUnlockMethodData.unlockDpId, result.unlockId),
199
199
  unlockName: "",
200
200
  userId: addUnlockMethodData.userId,
201
201
  hijack: false,
@@ -1,6 +1,6 @@
1
1
  import dpUtils from "@ray-js/tuya-dp-transform";
2
2
  import { addFitOpenMode } from "../../../api/fit";
3
- import { sleep } from "../../../utils";
3
+ import { formatCloudUnlockId, sleep } from "../../../utils";
4
4
  import { getError, handleCloudError } from "../../../utils/errors";
5
5
  import { publishDpsForRuntime } from "../../dp/publish-dps";
6
6
  import { getFitUnlockMethodBase } from "./internal/base";
@@ -75,7 +75,7 @@ export async function fitAddPasswordForRuntime(rt, params) {
75
75
  await addFitOpenMode({
76
76
  devIdList: [lockDevId],
77
77
  fittingId,
78
- unlockId: `${dpId}-${res.unlockId}`,
78
+ unlockId: formatCloudUnlockId(dpId, res.unlockId),
79
79
  unlockName: params.name,
80
80
  userId: params.userId,
81
81
  hijack: !!params.hijack,
@@ -1,14 +1,40 @@
1
1
  import dpUtils from "@ray-js/tuya-dp-transform";
2
- import { removeFitOpenMode, updateFitOpenMode } from "../../../api/fit";
2
+ import { getFitOpenModeList, removeFitOpenMode, updateFitOpenMode, } from "../../../api/fit";
3
3
  import dpCodes from "../../../config/dp-code";
4
4
  import { fitRemove, fitReportRemove, } from "../../../config/dp-map/unlock-method-fit";
5
5
  import { isAdmin } from "../../../utils";
6
6
  import { getError, handleCloudError } from "../../../utils/errors";
7
7
  import { publishDpsForRuntime } from "../../dp/publish-dps";
8
- import { getUnlockMethodTypeByDpCodeForRuntime, parallelOnlyForRuntime, } from "../../utils";
9
- import { getUnlockMethodDetailForRuntime } from "../../unlock/method/detail";
10
- import { resolveSlaveId } from "../resolve-slave-id";
8
+ import { getUnlockMethodTypeByTypeForRuntime, parallelOnlyForRuntime, } from "../../utils";
11
9
  import { sdkLog } from "../../../utils/sdk-log";
10
+ const FIT_DELETABLE_UNLOCK_METHOD_TYPES = [
11
+ "card",
12
+ "finger",
13
+ "face",
14
+ "hand",
15
+ "fingerVein",
16
+ ];
17
+ async function findFitOpenModeRawById(rt, id) {
18
+ for (const type of FIT_DELETABLE_UNLOCK_METHOD_TYPES) {
19
+ let unlockMethodConfig;
20
+ try {
21
+ unlockMethodConfig = getUnlockMethodTypeByTypeForRuntime(rt, type);
22
+ }
23
+ catch {
24
+ continue;
25
+ }
26
+ const dpId = rt.config.idsByCode[unlockMethodConfig.code];
27
+ if (!dpId) {
28
+ continue;
29
+ }
30
+ const raw = await getFitOpenModeList(rt.devId, dpId);
31
+ const hit = (raw ?? []).find((item) => item.unlockBindingId === id);
32
+ if (hit) {
33
+ return { raw: hit, unlockMethodConfig };
34
+ }
35
+ }
36
+ return null;
37
+ }
12
38
  export async function fitUpdateUnlockMethodForRuntime(rt, params) {
13
39
  const startedAt = Date.now();
14
40
  sdkLog("info", "fitUnlockMethod", "updateStart", {
@@ -49,19 +75,20 @@ export const fitDeleteUnlockMethodForRuntime = parallelOnlyForRuntime(async func
49
75
  devId: rt.devId,
50
76
  data: { id, hasLockDevId: typeof lockDevId === "string" },
51
77
  });
52
- const detail = await getUnlockMethodDetailForRuntime(rt, id);
53
- const { lockUserId, unlockId, userType, dpId } = detail;
54
- const code = cfg.codesById[dpId];
55
- if (!code) {
56
- const error = getError(1014);
57
- sdkLog("warn", "fitUnlockMethod", "deleteMissingDpCode", {
78
+ const found = await findFitOpenModeRawById(rt, id);
79
+ if (!found) {
80
+ const error = getError(1040);
81
+ sdkLog("warn", "fitUnlockMethod", "deleteRecordNotFound", {
58
82
  devId: rt.devId,
59
- data: { id, dpId },
83
+ data: { id },
60
84
  error,
61
85
  });
62
86
  throw error;
63
87
  }
64
- const unlockMethodConfig = getUnlockMethodTypeByDpCodeForRuntime(rt, code);
88
+ const { raw, unlockMethodConfig } = found;
89
+ const lockUserId = raw.lockUserId;
90
+ const unlockId = raw.sn;
91
+ const slaveId = parseInt(raw.devUnlockId, 16);
65
92
  const removeDpCode = dpCodes.unlockMethodDel;
66
93
  if (!cfg.dpSchema[removeDpCode]) {
67
94
  const error = getError(1014);
@@ -72,12 +99,11 @@ export const fitDeleteUnlockMethodForRuntime = parallelOnlyForRuntime(async func
72
99
  });
73
100
  throw error;
74
101
  }
75
- const slaveId = await resolveSlaveId(rt, lockDevId);
76
102
  const dpData = {
77
103
  slaveId,
78
104
  type: unlockMethodConfig.id,
79
105
  stage: 0,
80
- admin: isAdmin(userType),
106
+ admin: isAdmin(raw.userType),
81
107
  memberId: lockUserId,
82
108
  unlockId,
83
109
  operation: 1,
@@ -1,3 +1,4 @@
1
+ import { type RawFitOpenModeScheduleItem } from "../../api/fit";
1
2
  import { EffectiveConfig, UnlockMethodType } from "../../interface";
2
3
  import { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
3
4
  export interface FitPasswordItem {
@@ -22,3 +23,39 @@ export declare const getFitPasswordListForRuntime: (runtime: LockDeviceRuntime)
22
23
  devLockId: string;
23
24
  effective: EffectiveConfig;
24
25
  }[]>;
26
+ export interface FitOnlinePasswordItem {
27
+ id: number;
28
+ pwdId: number;
29
+ sn: number;
30
+ gmtCreate: number;
31
+ opModeType: number;
32
+ opModeSubType: number;
33
+ name: string;
34
+ userName: string;
35
+ mobile: string;
36
+ hijack: boolean;
37
+ operate: number;
38
+ effectiveTime: number;
39
+ invalidTime: number;
40
+ devNameList: string[];
41
+ scheduleDetails: RawFitOpenModeScheduleItem[];
42
+ }
43
+ export interface FitOfflinePasswordItem {
44
+ id: number | string;
45
+ pwdId: number;
46
+ sn: number;
47
+ gmtCreate: number;
48
+ opModeType: number;
49
+ opModeSubType: number;
50
+ pwdName: string;
51
+ mayExpired: boolean;
52
+ gmtStart: number;
53
+ gmtExpired: number;
54
+ devNameList: string[];
55
+ scheduleDetails: RawFitOpenModeScheduleItem[];
56
+ revokedPwdName: string;
57
+ revokedPwdEffectiveTime: number;
58
+ revokedPwdInvalidTime: number;
59
+ }
60
+ export declare const getFitOnlinePasswordListForRuntime: (runtime: LockDeviceRuntime) => Promise<FitOnlinePasswordItem[]>;
61
+ export declare const getFitOfflinePasswordListForRuntime: (runtime: LockDeviceRuntime) => Promise<FitOfflinePasswordItem[]>;
@@ -1,4 +1,4 @@
1
- import { getFitPasswordList } from "../../api/fit";
1
+ import { getFitPasswordList, getFitOfflinePasswordList, } from "../../api/fit";
2
2
  import { parseWeek } from "../../utils";
3
3
  export const getFitPasswordListForRuntime = async (runtime) => {
4
4
  const list = await getFitPasswordList(runtime.devId);
@@ -29,3 +29,46 @@ export const getFitPasswordListForRuntime = async (runtime) => {
29
29
  };
30
30
  });
31
31
  };
32
+ export const getFitOnlinePasswordListForRuntime = async (runtime) => {
33
+ const list = await getFitPasswordList(runtime.devId);
34
+ return (list ?? []).map((item) => ({
35
+ id: item.unlockBindingId,
36
+ pwdId: item.pwdId,
37
+ sn: item.sn,
38
+ gmtCreate: item.gmtCreate,
39
+ opModeType: item.opModeType,
40
+ opModeSubType: item.opModeSubType,
41
+ name: item.name,
42
+ userName: item.userName,
43
+ mobile: item.mobile,
44
+ hijack: item.hijack,
45
+ operate: item.operate,
46
+ effectiveTime: item.effectiveTime,
47
+ invalidTime: item.invalidTime,
48
+ devNameList: item.devNameList ?? [],
49
+ scheduleDetails: item.scheduleDetails ?? [],
50
+ }));
51
+ };
52
+ export const getFitOfflinePasswordListForRuntime = async (runtime) => {
53
+ const res = await getFitOfflinePasswordList(runtime.devId);
54
+ const list = Array.isArray(res)
55
+ ? res
56
+ : (res?.datas ?? []);
57
+ return list.map((item) => ({
58
+ id: item.unlockBindingId ?? item.pwdId,
59
+ pwdId: item.pwdId,
60
+ sn: item.sn,
61
+ gmtCreate: item.gmtCreate,
62
+ opModeType: item.opModeType ?? 3,
63
+ opModeSubType: item.opModeSubType,
64
+ pwdName: item.pwdName,
65
+ mayExpired: item.mayExpired,
66
+ gmtStart: item.gmtStart,
67
+ gmtExpired: item.gmtExpired,
68
+ devNameList: item.devNameList ?? [],
69
+ scheduleDetails: item.scheduleDetails ?? [],
70
+ revokedPwdName: item.revokedPwdName,
71
+ revokedPwdEffectiveTime: item.revokedPwdEffectiveTime,
72
+ revokedPwdInvalidTime: item.revokedPwdInvalidTime,
73
+ }));
74
+ };
@@ -0,0 +1,3 @@
1
+ import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
+ export declare const isFitSecurityChannelEnabledForRuntime: (rt: LockDeviceRuntime) => boolean;
3
+ export declare const getSecurityUpdatedLockIds: (fittingId: string) => Promise<string[]>;
@@ -0,0 +1,43 @@
1
+ import { getDeviceProperties } from "../../api/setting";
2
+ import { sdkLog } from "../../utils/sdk-log";
3
+ export const isFitSecurityChannelEnabledForRuntime = (rt) => {
4
+ const raw = rt.config.devInfo?.meta?.["btScyChannel"];
5
+ if (!raw) {
6
+ return false;
7
+ }
8
+ try {
9
+ const parsed = typeof raw === "string"
10
+ ? JSON.parse(raw)
11
+ : raw;
12
+ return parsed?.enable === 1;
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ };
18
+ export const getSecurityUpdatedLockIds = async (fittingId) => {
19
+ try {
20
+ const props = await getDeviceProperties(fittingId, ["SECURITY_UPDATED"]);
21
+ const raw = props?.["SECURITY_UPDATED"];
22
+ if (typeof raw === "string") {
23
+ try {
24
+ return JSON.parse(raw).value || [];
25
+ }
26
+ catch {
27
+ return [];
28
+ }
29
+ }
30
+ if (raw && typeof raw === "object") {
31
+ return (raw.value ||
32
+ (Array.isArray(raw) ? raw : []));
33
+ }
34
+ return [];
35
+ }
36
+ catch (e) {
37
+ sdkLog("warn", "fit", "getSecurityUpdatedError", {
38
+ devId: fittingId,
39
+ error: e,
40
+ });
41
+ return [];
42
+ }
43
+ };
@@ -2,6 +2,14 @@ export type FitBindOperation = "bind" | "unbind";
2
2
  export declare const FIT_BIND_TIMEOUT_MS = 12000;
3
3
  export declare const FIT_OPERATION_CODE: Record<FitBindOperation, "00" | "01">;
4
4
  export declare const normalizeHex: (value: string) => string;
5
+ export declare function markPrecautionaryUnbindPublished(fittingId: string, fit: {
6
+ fittingUnlockId: string;
7
+ randomStr: string;
8
+ devUnlockId: string;
9
+ }): void;
10
+ export declare function clearPrecautionaryUnbindSuppression(fittingId: string): void;
11
+ export declare function shouldSuppressFitSyncReportFrame(fittingId: string, data: string): boolean;
12
+ export declare function normalizeDevUuidHex(devUuid: string): string;
5
13
  export declare function buildTransparentData(operation: FitBindOperation, fit: {
6
14
  fittingUnlockId: string;
7
15
  randomStr: string;
@@ -7,8 +7,43 @@ export const FIT_OPERATION_CODE = {
7
7
  unbind: "01",
8
8
  };
9
9
  export const normalizeHex = (value) => value.replace(/\s/g, "");
10
+ const PRECAUTIONARY_UNBIND_SUPPRESS_MS = 60_000;
11
+ const pendingPrecautionaryUnbindAcks = new Map();
12
+ const buildUnbindAckPrefix = (fit) => `01${fit.fittingUnlockId}${fit.randomStr}${fit.devUnlockId}`.toLowerCase();
13
+ export function markPrecautionaryUnbindPublished(fittingId, fit) {
14
+ pendingPrecautionaryUnbindAcks.set(fittingId, {
15
+ prefix: buildUnbindAckPrefix(fit),
16
+ expiresAt: Date.now() + PRECAUTIONARY_UNBIND_SUPPRESS_MS,
17
+ });
18
+ }
19
+ export function clearPrecautionaryUnbindSuppression(fittingId) {
20
+ pendingPrecautionaryUnbindAcks.delete(fittingId);
21
+ }
22
+ export function shouldSuppressFitSyncReportFrame(fittingId, data) {
23
+ const entry = pendingPrecautionaryUnbindAcks.get(fittingId);
24
+ if (!entry) {
25
+ return false;
26
+ }
27
+ if (Date.now() > entry.expiresAt) {
28
+ pendingPrecautionaryUnbindAcks.delete(fittingId);
29
+ return false;
30
+ }
31
+ return normalizeHex(data).toLowerCase().startsWith(entry.prefix);
32
+ }
33
+ export function normalizeDevUuidHex(devUuid) {
34
+ if (devUuid.length >= 32 &&
35
+ devUuid.length % 2 === 0 &&
36
+ /^[0-9a-fA-F]+$/.test(devUuid)) {
37
+ return devUuid;
38
+ }
39
+ let hex = "";
40
+ for (let i = 0; i < devUuid.length; i += 1) {
41
+ hex += devUuid.charCodeAt(i).toString(16);
42
+ }
43
+ return hex;
44
+ }
10
45
  export function buildTransparentData(operation, fit, loginKey) {
11
- return `${FIT_OPERATION_CODE[operation]}${fit.fittingUnlockId}${fit.randomStr}${fit.devUnlockId}${fit.devUuid}${loginKey}`;
46
+ return `${FIT_OPERATION_CODE[operation]}${fit.fittingUnlockId}${fit.randomStr}${fit.devUnlockId}${normalizeDevUuidHex(fit.devUuid)}${loginKey}`;
12
47
  }
13
48
  export function buildLockCheckCodeTemplate(operation, fit) {
14
49
  return `ffff${fit.devUnlockId}${FIT_OPERATION_CODE[operation]}${fit.fittingUnlockId}${fit.randomStr}`;
@@ -106,8 +141,12 @@ export async function publishFitTransparentFlow(fittingId, keyDeviceId, operatio
106
141
  expectedOperation: FIT_OPERATION_CODE[operation],
107
142
  });
108
143
  if (operation === "bind") {
144
+ markPrecautionaryUnbindPublished(fittingId, fit);
109
145
  await publishBLETransparentData(fittingId, buildTransparentData("unbind", fit, loginKey));
110
146
  }
147
+ else {
148
+ clearPrecautionaryUnbindSuppression(fittingId);
149
+ }
111
150
  await publishBLETransparentData(fittingId, buildTransparentData(operation, fit, loginKey));
112
151
  await waitResult;
113
152
  sdkLog("info", "fit", "transparentFlowSuccess", {
@@ -1,4 +1,6 @@
1
1
  import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
+ import { type SyncOpenModeRiseResult } from "../../api/fit";
2
3
  export declare function syncFitBindingsForRuntime(runtime: LockDeviceRuntime): Promise<void>;
3
- export declare function syncFitReportForRuntime(runtime: LockDeviceRuntime, ins: string): Promise<unknown>;
4
- export declare function syncOpenModeRiseForRuntime(runtime: LockDeviceRuntime, dpIds: string): Promise<unknown>;
4
+ export declare function startFitSyncReportForRuntime(runtime: LockDeviceRuntime): void;
5
+ export declare function stopFitSyncReportForRuntime(runtime: LockDeviceRuntime): void;
6
+ export declare function syncOpenModeRiseForRuntime(runtime: LockDeviceRuntime, dpCodes?: string[]): Promise<SyncOpenModeRiseResult>;
@@ -1,12 +1,22 @@
1
1
  import { syncFitToLockRise, syncFitReport as syncFitReportApi, syncOpenModeRise as syncOpenModeRiseApi, } from "../../api/fit";
2
- import { publishBLETransparentData, subscribeBLETransparentDataReport, } from "../../platform/device";
2
+ import { unlockMethodDpCodes } from "../utils";
3
+ import { offBLETransparentDataReport, onBLETransparentDataReport, publishBLETransparentData, subscribeBLETransparentDataReport, } from "../../platform/device";
3
4
  import { sdkLog } from "../../utils/sdk-log";
5
+ import { shouldSuppressFitSyncReportFrame } from "./shared";
4
6
  export async function syncFitBindingsForRuntime(runtime) {
5
7
  const startedAt = Date.now();
6
8
  const fittingId = runtime.devId;
7
9
  sdkLog("info", "fit", "syncBindingsStart", {
8
10
  devId: runtime.devId,
9
11
  });
12
+ if (runtime.sync.fitBindingsSyncStarted) {
13
+ sdkLog("info", "fit", "syncBindingsSkip", {
14
+ devId: runtime.devId,
15
+ data: { reason: "already_started" },
16
+ });
17
+ return;
18
+ }
19
+ runtime.sync.fitBindingsSyncStarted = true;
10
20
  try {
11
21
  const result = await syncFitToLockRise(fittingId);
12
22
  const instructions = Array.isArray(result.ins) ? result.ins : [];
@@ -29,6 +39,7 @@ export async function syncFitBindingsForRuntime(runtime) {
29
39
  });
30
40
  }
31
41
  catch (error) {
42
+ runtime.sync.fitBindingsSyncStarted = false;
32
43
  sdkLog("error", "fit", "syncBindingsFail", {
33
44
  devId: runtime.devId,
34
45
  duration: Date.now() - startedAt,
@@ -37,35 +48,65 @@ export async function syncFitBindingsForRuntime(runtime) {
37
48
  throw error;
38
49
  }
39
50
  }
40
- export async function syncFitReportForRuntime(runtime, ins) {
41
- const startedAt = Date.now();
42
- sdkLog("info", "fit", "syncReportStart", {
43
- devId: runtime.devId,
44
- data: { hasInstruction: !!ins },
45
- });
46
- try {
47
- const result = await syncFitReportApi(runtime.devId, ins);
48
- sdkLog("info", "fit", "syncReportSuccess", {
49
- devId: runtime.devId,
50
- duration: Date.now() - startedAt,
51
- });
52
- return result;
51
+ export function startFitSyncReportForRuntime(runtime) {
52
+ if (runtime.sync.fitSyncReportHandler) {
53
+ return;
53
54
  }
54
- catch (error) {
55
- sdkLog("error", "fit", "syncReportFail", {
56
- devId: runtime.devId,
57
- duration: Date.now() - startedAt,
58
- error,
55
+ const devId = runtime.devId;
56
+ subscribeBLETransparentDataReport(devId);
57
+ const handler = (params) => {
58
+ if (params?.deviceId !== devId || !params?.data) {
59
+ return;
60
+ }
61
+ if (shouldSuppressFitSyncReportFrame(devId, params.data)) {
62
+ sdkLog("info", "fit", "syncReportSuppressPrecautionaryUnbindAck", {
63
+ devId,
64
+ });
65
+ return;
66
+ }
67
+ syncFitReportApi(devId, params.data).catch((e) => {
68
+ sdkLog("warn", "fit", "syncReportAutoError", {
69
+ devId,
70
+ error: e,
71
+ });
59
72
  });
60
- throw error;
73
+ };
74
+ runtime.sync.fitSyncReportHandler = handler;
75
+ onBLETransparentDataReport(handler);
76
+ sdkLog("info", "fit", "startSyncReport", { devId });
77
+ }
78
+ export function stopFitSyncReportForRuntime(runtime) {
79
+ const handler = runtime.sync.fitSyncReportHandler;
80
+ if (handler) {
81
+ offBLETransparentDataReport(handler);
82
+ runtime.sync.fitSyncReportHandler = null;
61
83
  }
84
+ runtime.sync.fitBindingsSyncStarted = false;
85
+ sdkLog("info", "fit", "stopSyncReport", { devId: runtime.devId });
62
86
  }
63
- export async function syncOpenModeRiseForRuntime(runtime, dpIds) {
87
+ export async function syncOpenModeRiseForRuntime(runtime, dpCodes) {
64
88
  const startedAt = Date.now();
89
+ const codes = dpCodes?.length ? dpCodes : unlockMethodDpCodes;
90
+ const dpIds = [
91
+ ...new Set(codes.reduce((res, code) => {
92
+ const id = runtime.config.idsByCode[code];
93
+ if (id) {
94
+ res.push(String(id));
95
+ }
96
+ return res;
97
+ }, [])),
98
+ ];
65
99
  sdkLog("info", "fit", "syncOpenModeRiseStart", {
66
100
  devId: runtime.devId,
67
- data: { hasDpIds: !!dpIds },
101
+ data: { isAll: !dpCodes?.length, dpIdCount: dpIds.length },
68
102
  });
103
+ if (!dpIds.length) {
104
+ sdkLog("info", "fit", "syncOpenModeRiseSkip", {
105
+ devId: runtime.devId,
106
+ data: { reason: "no_matched_dp" },
107
+ });
108
+ return { ins: "", distributed: false };
109
+ }
69
110
  try {
70
111
  const result = await syncOpenModeRiseApi(runtime.devId, dpIds);
71
112
  sdkLog("info", "fit", "syncOpenModeRiseSuccess", {
@@ -25,3 +25,26 @@ export interface RenameFitTempPwdParams {
25
25
  name: string;
26
26
  }
27
27
  export declare const fitRenameTempPwdForRuntime: (runtime: LockDeviceRuntime, params: RenameFitTempPwdParams) => Promise<void>;
28
+ export interface RenameFitOfflineTempPwdParams {
29
+ pwdId: number;
30
+ name: string;
31
+ }
32
+ export declare const fitRenameOfflineTempPwdForRuntime: (runtime: LockDeviceRuntime, params: RenameFitOfflineTempPwdParams) => Promise<void>;
33
+ export interface RevokeFitOfflineTempPwdParams {
34
+ pwdId: number;
35
+ name?: string;
36
+ }
37
+ export interface FitOfflineClearCodeResult {
38
+ password: string;
39
+ pwdId: string;
40
+ name: string;
41
+ effectiveConfig: {
42
+ effectiveDate: number;
43
+ expiredDate: number;
44
+ };
45
+ }
46
+ export declare const fitRevokeOfflineTempPwdForRuntime: (runtime: LockDeviceRuntime, params: RevokeFitOfflineTempPwdParams) => Promise<FitOfflineClearCodeResult>;
47
+ export interface ResendFitTempPwdParams {
48
+ id: number;
49
+ }
50
+ export declare const fitResendTempPwdForRuntime: (runtime: LockDeviceRuntime, params: ResendFitTempPwdParams) => Promise<boolean>;