@ray-js/lock-sdk 1.2.0-beta.9 → 1.2.0

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 (231) 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/temp.d.ts +21 -0
  8. package/lib/api/temp.js +24 -0
  9. package/lib/config/dp-code/index.d.ts +1 -1
  10. package/lib/config/dp-code/index.js +1 -0
  11. package/lib/entries/main/bootstrap/bootstrap-lock-instance.d.ts +2 -1
  12. package/lib/entries/main/bootstrap/bootstrap-lock-instance.js +23 -8
  13. package/lib/entries/main/bootstrap/bootstrap.d.ts +3 -2
  14. package/lib/entries/main/bootstrap/bootstrap.js +10 -6
  15. package/lib/entries/main/bootstrap/primary-instance.d.ts +1 -2
  16. package/lib/entries/main/bootstrap/primary-instance.js +1 -1
  17. package/lib/entries/main/bootstrap/resolve-runtime-from-export-this.js +1 -1
  18. package/lib/entries/main/build-instance.d.ts +6 -3
  19. package/lib/entries/main/build-instance.js +13 -1
  20. package/lib/entries/main/exports/capability.d.ts +2 -0
  21. package/lib/entries/main/exports/capability.js +7 -1
  22. package/lib/entries/main/exports/fit-sdk/binding.d.ts +10 -0
  23. package/lib/entries/{fit/exports → main/exports/fit-sdk}/binding.js +6 -3
  24. package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.d.ts +11 -10
  25. package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.js +20 -20
  26. package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.d.ts +1 -0
  27. package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.js +1 -0
  28. package/lib/entries/main/exports/fit-sdk/log.d.ts +3 -0
  29. package/lib/entries/main/exports/fit-sdk/log.js +5 -0
  30. package/lib/entries/main/exports/fit-sdk/temp.d.ts +40 -0
  31. package/lib/entries/main/exports/fit-sdk/temp.js +59 -0
  32. package/lib/entries/main/exports/gesture.d.ts +6 -0
  33. package/lib/entries/main/exports/gesture.js +8 -0
  34. package/lib/entries/main/exports/index.d.ts +5 -0
  35. package/lib/entries/main/exports/index.js +5 -0
  36. package/lib/entries/main/exports/log.d.ts +2 -0
  37. package/lib/entries/main/exports/log.js +7 -1
  38. package/lib/entries/main/exports/misc.d.ts +4 -2
  39. package/lib/entries/main/exports/misc.js +2 -2
  40. package/lib/entries/main/index.d.ts +3 -3
  41. package/lib/entries/main/index.js +11 -5
  42. package/lib/feature/fit/bind-lock-to-fit.d.ts +1 -0
  43. package/lib/feature/fit/bind-lock-to-fit.js +53 -0
  44. package/lib/feature/fit/ble-key.d.ts +10 -4
  45. package/lib/feature/fit/ble-key.js +145 -4
  46. package/lib/feature/fit/device-bv.d.ts +2 -0
  47. package/lib/feature/fit/device-bv.js +15 -0
  48. package/lib/feature/fit/invalid-password.d.ts +10 -0
  49. package/lib/feature/fit/invalid-password.js +43 -0
  50. package/lib/feature/fit/list.d.ts +12 -2
  51. package/lib/feature/fit/list.js +54 -5
  52. package/lib/feature/fit/log.d.ts +7 -0
  53. package/lib/feature/fit/log.js +123 -0
  54. package/lib/feature/fit/method/add-flow.js +2 -2
  55. package/lib/feature/fit/method/add-password.js +2 -2
  56. package/lib/feature/fit/method/update-remove.js +40 -14
  57. package/lib/feature/fit/password-list.d.ts +37 -0
  58. package/lib/feature/fit/password-list.js +44 -1
  59. package/lib/feature/fit/security-channel.d.ts +3 -0
  60. package/lib/feature/fit/security-channel.js +43 -0
  61. package/lib/feature/fit/shared.d.ts +8 -0
  62. package/lib/feature/fit/shared.js +40 -1
  63. package/lib/feature/fit/sync.d.ts +4 -2
  64. package/lib/feature/fit/sync.js +63 -22
  65. package/lib/feature/fit/temp-password.d.ts +23 -0
  66. package/lib/feature/fit/temp-password.js +95 -3
  67. package/lib/feature/fit/users.d.ts +1 -0
  68. package/lib/feature/fit/users.js +1 -0
  69. package/lib/feature/gesture/gesture.d.ts +6 -0
  70. package/lib/feature/gesture/gesture.js +3 -0
  71. package/lib/feature/log/log.d.ts +5 -1
  72. package/lib/feature/log/log.js +53 -6
  73. package/lib/feature/misc/ble-control.js +2 -2
  74. package/lib/feature/misc/capability.d.ts +2 -0
  75. package/lib/feature/misc/capability.js +33 -31
  76. package/lib/feature/misc/connect-device.d.ts +1 -1
  77. package/lib/feature/misc/connect-device.js +7 -6
  78. package/lib/feature/misc/is-use-near-channel-for-runtime.js +8 -1
  79. package/lib/feature/password/temporary/offline-create.d.ts +14 -0
  80. package/lib/feature/password/temporary/offline-create.js +77 -1
  81. package/lib/feature/service/goto-service.d.ts +1 -1
  82. package/lib/feature/state/clear.js +1 -0
  83. package/lib/feature/state/device-status.js +17 -6
  84. package/lib/feature/state/init-state.js +17 -9
  85. package/lib/feature/state/platform-routing.js +12 -3
  86. package/lib/feature/state/remote-permissions.js +2 -1
  87. package/lib/feature/state/sync/remote-serect-key.js +7 -0
  88. package/lib/feature/storage/swr-cache.d.ts +7 -0
  89. package/lib/feature/storage/swr-cache.js +54 -0
  90. package/lib/feature/unlock/method/add-flow.js +2 -2
  91. package/lib/feature/unlock/method/add-password.js +2 -2
  92. package/lib/feature/user/sync-user.js +4 -2
  93. package/lib/feature/utils/index.d.ts +1 -0
  94. package/lib/feature/utils/index.js +1 -0
  95. package/lib/interface.d.ts +23 -1
  96. package/lib/platform/device.d.ts +4 -3
  97. package/lib/platform/ipc.d.ts +3 -0
  98. package/lib/platform/ipc.js +13 -0
  99. package/lib/platform/storage.d.ts +1 -1
  100. package/lib/runtime/LockDeviceRuntime.js +3 -0
  101. package/lib/runtime/lock-config.d.ts +3 -0
  102. package/lib/runtime/lock-config.js +5 -0
  103. package/lib/runtime/runtime-state-types.d.ts +6 -0
  104. package/lib/utils/constant.d.ts +1 -0
  105. package/lib/utils/constant.js +6 -0
  106. package/lib/utils/index.d.ts +2 -1
  107. package/lib/utils/index.js +1 -0
  108. package/package.json +1 -11
  109. package/lib/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  110. package/lib/bootstrap/bootstrap-lock-instance.js +0 -16
  111. package/lib/bootstrap/bootstrap.d.ts +0 -4
  112. package/lib/bootstrap/bootstrap.js +0 -53
  113. package/lib/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  114. package/lib/bootstrap/lock-instance-runtime-ref.js +0 -7
  115. package/lib/bootstrap/primary-instance.d.ts +0 -6
  116. package/lib/bootstrap/primary-instance.js +0 -24
  117. package/lib/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  118. package/lib/bootstrap/resolve-runtime-from-export-this.js +0 -29
  119. package/lib/bootstrap/top-level-runtime.d.ts +0 -2
  120. package/lib/bootstrap/top-level-runtime.js +0 -9
  121. package/lib/entries/ble/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  122. package/lib/entries/ble/bootstrap/bootstrap-lock-instance.js +0 -12
  123. package/lib/entries/ble/bootstrap/bootstrap.d.ts +0 -4
  124. package/lib/entries/ble/bootstrap/bootstrap.js +0 -53
  125. package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  126. package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.js +0 -7
  127. package/lib/entries/ble/bootstrap/primary-instance.d.ts +0 -6
  128. package/lib/entries/ble/bootstrap/primary-instance.js +0 -24
  129. package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  130. package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.js +0 -29
  131. package/lib/entries/ble/bootstrap/top-level-runtime.d.ts +0 -2
  132. package/lib/entries/ble/bootstrap/top-level-runtime.js +0 -9
  133. package/lib/entries/ble/build-instance.d.ts +0 -9
  134. package/lib/entries/ble/build-instance.js +0 -50
  135. package/lib/entries/ble/exports/capability.d.ts +0 -6
  136. package/lib/entries/ble/exports/capability.js +0 -17
  137. package/lib/entries/ble/exports/config.d.ts +0 -3
  138. package/lib/entries/ble/exports/config.js +0 -5
  139. package/lib/entries/ble/exports/dp.d.ts +0 -9
  140. package/lib/entries/ble/exports/dp.js +0 -13
  141. package/lib/entries/ble/exports/index.d.ts +0 -16
  142. package/lib/entries/ble/exports/index.js +0 -16
  143. package/lib/entries/ble/exports/linkage.d.ts +0 -5
  144. package/lib/entries/ble/exports/linkage.js +0 -15
  145. package/lib/entries/ble/exports/log.d.ts +0 -9
  146. package/lib/entries/ble/exports/log.js +0 -21
  147. package/lib/entries/ble/exports/media.d.ts +0 -4
  148. package/lib/entries/ble/exports/media.js +0 -12
  149. package/lib/entries/ble/exports/misc.d.ts +0 -19
  150. package/lib/entries/ble/exports/misc.js +0 -30
  151. package/lib/entries/ble/exports/offline-dps.d.ts +0 -8
  152. package/lib/entries/ble/exports/offline-dps.js +0 -24
  153. package/lib/entries/ble/exports/open/do-open-close-action.d.ts +0 -2
  154. package/lib/entries/ble/exports/open/do-open-close-action.js +0 -36
  155. package/lib/entries/ble/exports/open/index.d.ts +0 -18
  156. package/lib/entries/ble/exports/open/index.js +0 -45
  157. package/lib/entries/ble/exports/signal.d.ts +0 -6
  158. package/lib/entries/ble/exports/signal.js +0 -14
  159. package/lib/entries/ble/exports/sleep.d.ts +0 -13
  160. package/lib/entries/ble/exports/sleep.js +0 -31
  161. package/lib/entries/ble/exports/state.d.ts +0 -6
  162. package/lib/entries/ble/exports/state.js +0 -19
  163. package/lib/entries/ble/exports/temporary.d.ts +0 -31
  164. package/lib/entries/ble/exports/temporary.js +0 -91
  165. package/lib/entries/ble/exports/unlock/sync.d.ts +0 -1
  166. package/lib/entries/ble/exports/unlock/sync.js +0 -5
  167. package/lib/entries/ble/exports/unlock-method.d.ts +0 -19
  168. package/lib/entries/ble/exports/unlock-method.js +0 -58
  169. package/lib/entries/ble/exports/user/index.d.ts +0 -23
  170. package/lib/entries/ble/exports/user/index.js +0 -22
  171. package/lib/entries/ble/exports/user/sync.d.ts +0 -1
  172. package/lib/entries/ble/exports/user/sync.js +0 -5
  173. package/lib/entries/ble/index.d.ts +0 -8
  174. package/lib/entries/ble/index.js +0 -39
  175. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  176. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.js +0 -12
  177. package/lib/entries/fit/bootstrap/bootstrap.d.ts +0 -4
  178. package/lib/entries/fit/bootstrap/bootstrap.js +0 -69
  179. package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  180. package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.js +0 -7
  181. package/lib/entries/fit/bootstrap/primary-instance.d.ts +0 -6
  182. package/lib/entries/fit/bootstrap/primary-instance.js +0 -24
  183. package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  184. package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.js +0 -29
  185. package/lib/entries/fit/bootstrap/top-level-runtime.d.ts +0 -2
  186. package/lib/entries/fit/bootstrap/top-level-runtime.js +0 -9
  187. package/lib/entries/fit/build-instance.d.ts +0 -9
  188. package/lib/entries/fit/build-instance.js +0 -57
  189. package/lib/entries/fit/exports/binding.d.ts +0 -8
  190. package/lib/entries/fit/exports/temp.d.ts +0 -19
  191. package/lib/entries/fit/exports/temp.js +0 -18
  192. package/lib/entries/fit/index.d.ts +0 -8
  193. package/lib/entries/fit/index.js +0 -36
  194. package/lib/entries/main/exports/open.d.ts +0 -16
  195. package/lib/entries/main/exports/open.js +0 -44
  196. package/lib/entries/screen/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  197. package/lib/entries/screen/bootstrap/bootstrap-lock-instance.js +0 -12
  198. package/lib/entries/screen/bootstrap/bootstrap.d.ts +0 -4
  199. package/lib/entries/screen/bootstrap/bootstrap.js +0 -69
  200. package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  201. package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.js +0 -7
  202. package/lib/entries/screen/bootstrap/primary-instance.d.ts +0 -6
  203. package/lib/entries/screen/bootstrap/primary-instance.js +0 -24
  204. package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  205. package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.js +0 -29
  206. package/lib/entries/screen/bootstrap/top-level-runtime.d.ts +0 -2
  207. package/lib/entries/screen/bootstrap/top-level-runtime.js +0 -9
  208. package/lib/entries/screen/build-instance.d.ts +0 -9
  209. package/lib/entries/screen/build-instance.js +0 -57
  210. package/lib/entries/screen/exports/bind-events.d.ts +0 -4
  211. package/lib/entries/screen/exports/bind-events.js +0 -8
  212. package/lib/entries/screen/exports/binding.d.ts +0 -6
  213. package/lib/entries/screen/exports/binding.js +0 -15
  214. package/lib/entries/screen/exports/device.d.ts +0 -16
  215. package/lib/entries/screen/exports/device.js +0 -41
  216. package/lib/entries/screen/exports/event.d.ts +0 -3
  217. package/lib/entries/screen/exports/event.js +0 -5
  218. package/lib/entries/screen/exports/index.d.ts +0 -5
  219. package/lib/entries/screen/exports/index.js +0 -5
  220. package/lib/entries/screen/exports/user.d.ts +0 -2
  221. package/lib/entries/screen/exports/user.js +0 -8
  222. package/lib/entries/screen/index.d.ts +0 -8
  223. package/lib/entries/screen/index.js +0 -36
  224. package/lib/feature/unlock/door/door-action.d.ts +0 -2
  225. package/lib/feature/unlock/door/door-action.js +0 -32
  226. package/lib/fit.d.ts +0 -4
  227. package/lib/fit.js +0 -3
  228. package/lib/runtime/device-status/compute-device-status.d.ts +0 -25
  229. package/lib/runtime/device-status/compute-device-status.js +0 -94
  230. package/lib/screen.d.ts +0 -4
  231. package/lib/screen.js +0 -3
@@ -1,94 +0,0 @@
1
- import dpCodes from "../../config/dp-code";
2
- import { ProductCommunicationType } from "../../constant";
3
- import { isOnlineByType } from "../../utils";
4
- export function computeDeviceStatus(config, deps) {
5
- const { onlineType, devInfo: { isCloudOnline, isOnline, wifiEnableState, isMatter }, } = config;
6
- const supportWifi = deps.hasCapability(ProductCommunicationType.WIFI);
7
- const supportBle = deps.hasCapability(ProductCommunicationType.BLUETOOTH);
8
- const supportThread = deps.hasCapability(ProductCommunicationType.THREAD);
9
- const status = {
10
- type: isOnline ? "online" : "offline",
11
- connectEnable: false,
12
- onlineType: "unknown",
13
- onlineTypes: [],
14
- isWifiActive: wifiEnableState !== 1,
15
- isWifiMatter: !!isMatter && supportWifi,
16
- };
17
- const isMatterLocal = isOnlineByType(onlineType, 8);
18
- const isBleOnline = isOnlineByType(onlineType, 2);
19
- const isLocalOnline = !isCloudOnline && isOnlineByType(onlineType, 1);
20
- const hasWirelessAwakeDp = deps.hasDp(dpCodes.wirelessAwake);
21
- const wirelessAwake = deps.getDpValue(dpCodes.wirelessAwake);
22
- status.connectEnable = deps.isSupportBleControl() && !isOnline;
23
- if (supportWifi) {
24
- if (!status.connectEnable) {
25
- if (isCloudOnline) {
26
- status.connectEnable =
27
- hasWirelessAwakeDp && wirelessAwake === false && !isBleOnline;
28
- }
29
- }
30
- }
31
- if (isOnline) {
32
- if (isCloudOnline) {
33
- if (hasWirelessAwakeDp) {
34
- if (wirelessAwake) {
35
- status.onlineTypes.push("cloud");
36
- }
37
- else {
38
- status.type = "offline";
39
- }
40
- }
41
- else {
42
- status.onlineTypes.push("cloud");
43
- }
44
- }
45
- if (isLocalOnline) {
46
- status.onlineTypes.push("local");
47
- }
48
- if (isMatterLocal) {
49
- if (!status.onlineTypes.includes("local")) {
50
- status.onlineTypes.push("local");
51
- }
52
- }
53
- if (isBleOnline) {
54
- status.onlineTypes.push("ble");
55
- }
56
- }
57
- if (status.onlineTypes.length === 0 && isOnline) {
58
- status.onlineTypes.push("unknown");
59
- }
60
- if (supportThread && supportBle) {
61
- const isShareThread = deps.isShareThread();
62
- if (isShareThread && isOnline) {
63
- if (!status.onlineTypes.includes("local")) {
64
- status.onlineTypes = ["local"];
65
- }
66
- }
67
- }
68
- if (status.onlineTypes.includes("ble")) {
69
- status.onlineType = "ble";
70
- }
71
- else if (status.onlineTypes.includes("cloud")) {
72
- status.onlineType = "cloud";
73
- }
74
- else if (status.onlineTypes.includes("local")) {
75
- status.onlineType = "local";
76
- }
77
- else {
78
- status.onlineType = "unknown";
79
- }
80
- if (!isOnline) {
81
- if (deps.readIsSleep()) {
82
- status.type = "sleep";
83
- }
84
- }
85
- if (status.type === "sleep") {
86
- if (deps.getDpValue(dpCodes.dormantSwitch) ||
87
- deps.getDpValue(dpCodes.onlineSwitch)) {
88
- if (deps.registeredRuntimeCount === 1) {
89
- status.sleepPeriod = deps.getDormantPeriod();
90
- }
91
- }
92
- }
93
- return status;
94
- }
package/lib/screen.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./entries/screen/index";
2
- export * from "./interface";
3
- export * from "./constant";
4
- export type { SDKLogConfig, SDKLogEntry, SDKLogLevel, SDKLogSink, } from "./utils/sdk-log";
package/lib/screen.js DELETED
@@ -1,3 +0,0 @@
1
- export * from "./entries/screen/index";
2
- export * from "./interface";
3
- export * from "./constant";