@ray-js/lock-sdk 1.2.0-beta.28 → 1.2.0-beta.29

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 (155) hide show
  1. package/lib/entries/main/bootstrap/bootstrap-lock-instance.d.ts +2 -1
  2. package/lib/entries/main/bootstrap/bootstrap-lock-instance.js +8 -4
  3. package/lib/entries/main/bootstrap/bootstrap.d.ts +3 -2
  4. package/lib/entries/main/bootstrap/bootstrap.js +8 -6
  5. package/lib/entries/main/bootstrap/primary-instance.d.ts +1 -2
  6. package/lib/entries/main/build-instance.d.ts +6 -3
  7. package/lib/entries/main/build-instance.js +13 -1
  8. package/lib/entries/{fit/exports → main/exports/fit-sdk}/binding.d.ts +2 -2
  9. package/lib/entries/{fit/exports → main/exports/fit-sdk}/binding.js +3 -3
  10. package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.d.ts +6 -6
  11. package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.js +10 -10
  12. package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.d.ts +0 -2
  13. package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.js +0 -2
  14. package/lib/entries/main/exports/fit-sdk/log.d.ts +3 -0
  15. package/lib/entries/main/exports/fit-sdk/log.js +5 -0
  16. package/lib/entries/{fit/exports → main/exports/fit-sdk}/temp.d.ts +8 -8
  17. package/lib/entries/{fit/exports → main/exports/fit-sdk}/temp.js +5 -5
  18. package/lib/entries/main/exports/index.d.ts +4 -0
  19. package/lib/entries/main/exports/index.js +4 -0
  20. package/lib/entries/main/index.d.ts +2 -2
  21. package/lib/entries/main/index.js +9 -3
  22. package/lib/interface.d.ts +1 -0
  23. package/package.json +1 -11
  24. package/lib/api/product.d.ts +0 -8
  25. package/lib/api/product.js +0 -10
  26. package/lib/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  27. package/lib/bootstrap/bootstrap-lock-instance.js +0 -16
  28. package/lib/bootstrap/bootstrap.d.ts +0 -4
  29. package/lib/bootstrap/bootstrap.js +0 -53
  30. package/lib/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  31. package/lib/bootstrap/lock-instance-runtime-ref.js +0 -7
  32. package/lib/bootstrap/primary-instance.d.ts +0 -6
  33. package/lib/bootstrap/primary-instance.js +0 -24
  34. package/lib/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  35. package/lib/bootstrap/resolve-runtime-from-export-this.js +0 -29
  36. package/lib/bootstrap/top-level-runtime.d.ts +0 -2
  37. package/lib/bootstrap/top-level-runtime.js +0 -9
  38. package/lib/entries/ble/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  39. package/lib/entries/ble/bootstrap/bootstrap-lock-instance.js +0 -12
  40. package/lib/entries/ble/bootstrap/bootstrap.d.ts +0 -4
  41. package/lib/entries/ble/bootstrap/bootstrap.js +0 -53
  42. package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  43. package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.js +0 -7
  44. package/lib/entries/ble/bootstrap/primary-instance.d.ts +0 -6
  45. package/lib/entries/ble/bootstrap/primary-instance.js +0 -24
  46. package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  47. package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.js +0 -29
  48. package/lib/entries/ble/bootstrap/top-level-runtime.d.ts +0 -2
  49. package/lib/entries/ble/bootstrap/top-level-runtime.js +0 -9
  50. package/lib/entries/ble/build-instance.d.ts +0 -9
  51. package/lib/entries/ble/build-instance.js +0 -50
  52. package/lib/entries/ble/exports/capability.d.ts +0 -6
  53. package/lib/entries/ble/exports/capability.js +0 -17
  54. package/lib/entries/ble/exports/config.d.ts +0 -3
  55. package/lib/entries/ble/exports/config.js +0 -5
  56. package/lib/entries/ble/exports/dp.d.ts +0 -9
  57. package/lib/entries/ble/exports/dp.js +0 -13
  58. package/lib/entries/ble/exports/index.d.ts +0 -16
  59. package/lib/entries/ble/exports/index.js +0 -16
  60. package/lib/entries/ble/exports/linkage.d.ts +0 -5
  61. package/lib/entries/ble/exports/linkage.js +0 -15
  62. package/lib/entries/ble/exports/log.d.ts +0 -9
  63. package/lib/entries/ble/exports/log.js +0 -21
  64. package/lib/entries/ble/exports/media.d.ts +0 -4
  65. package/lib/entries/ble/exports/media.js +0 -12
  66. package/lib/entries/ble/exports/misc.d.ts +0 -19
  67. package/lib/entries/ble/exports/misc.js +0 -30
  68. package/lib/entries/ble/exports/offline-dps.d.ts +0 -8
  69. package/lib/entries/ble/exports/offline-dps.js +0 -24
  70. package/lib/entries/ble/exports/open/do-open-close-action.d.ts +0 -2
  71. package/lib/entries/ble/exports/open/do-open-close-action.js +0 -36
  72. package/lib/entries/ble/exports/open/index.d.ts +0 -18
  73. package/lib/entries/ble/exports/open/index.js +0 -45
  74. package/lib/entries/ble/exports/signal.d.ts +0 -6
  75. package/lib/entries/ble/exports/signal.js +0 -14
  76. package/lib/entries/ble/exports/sleep.d.ts +0 -13
  77. package/lib/entries/ble/exports/sleep.js +0 -31
  78. package/lib/entries/ble/exports/state.d.ts +0 -6
  79. package/lib/entries/ble/exports/state.js +0 -19
  80. package/lib/entries/ble/exports/temporary.d.ts +0 -31
  81. package/lib/entries/ble/exports/temporary.js +0 -91
  82. package/lib/entries/ble/exports/unlock/sync.d.ts +0 -1
  83. package/lib/entries/ble/exports/unlock/sync.js +0 -5
  84. package/lib/entries/ble/exports/unlock-method.d.ts +0 -19
  85. package/lib/entries/ble/exports/unlock-method.js +0 -58
  86. package/lib/entries/ble/exports/user/index.d.ts +0 -23
  87. package/lib/entries/ble/exports/user/index.js +0 -22
  88. package/lib/entries/ble/exports/user/sync.d.ts +0 -1
  89. package/lib/entries/ble/exports/user/sync.js +0 -5
  90. package/lib/entries/ble/index.d.ts +0 -8
  91. package/lib/entries/ble/index.js +0 -39
  92. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  93. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.js +0 -25
  94. package/lib/entries/fit/bootstrap/bootstrap.d.ts +0 -4
  95. package/lib/entries/fit/bootstrap/bootstrap.js +0 -70
  96. package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  97. package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.js +0 -7
  98. package/lib/entries/fit/bootstrap/primary-instance.d.ts +0 -6
  99. package/lib/entries/fit/bootstrap/primary-instance.js +0 -24
  100. package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  101. package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.js +0 -29
  102. package/lib/entries/fit/bootstrap/top-level-runtime.d.ts +0 -2
  103. package/lib/entries/fit/bootstrap/top-level-runtime.js +0 -9
  104. package/lib/entries/fit/build-instance.d.ts +0 -9
  105. package/lib/entries/fit/build-instance.js +0 -59
  106. package/lib/entries/fit/exports/log.d.ts +0 -7
  107. package/lib/entries/fit/exports/log.js +0 -15
  108. package/lib/entries/fit/exports/misc.d.ts +0 -5
  109. package/lib/entries/fit/exports/misc.js +0 -9
  110. package/lib/entries/fit/exports/setting.d.ts +0 -4
  111. package/lib/entries/fit/exports/setting.js +0 -8
  112. package/lib/entries/fit/exports/state.d.ts +0 -4
  113. package/lib/entries/fit/exports/state.js +0 -12
  114. package/lib/entries/fit/index.d.ts +0 -8
  115. package/lib/entries/fit/index.js +0 -38
  116. package/lib/entries/main/exports/open.d.ts +0 -16
  117. package/lib/entries/main/exports/open.js +0 -44
  118. package/lib/entries/screen/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  119. package/lib/entries/screen/bootstrap/bootstrap-lock-instance.js +0 -12
  120. package/lib/entries/screen/bootstrap/bootstrap.d.ts +0 -4
  121. package/lib/entries/screen/bootstrap/bootstrap.js +0 -69
  122. package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  123. package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.js +0 -7
  124. package/lib/entries/screen/bootstrap/primary-instance.d.ts +0 -6
  125. package/lib/entries/screen/bootstrap/primary-instance.js +0 -24
  126. package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  127. package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.js +0 -29
  128. package/lib/entries/screen/bootstrap/top-level-runtime.d.ts +0 -2
  129. package/lib/entries/screen/bootstrap/top-level-runtime.js +0 -9
  130. package/lib/entries/screen/build-instance.d.ts +0 -9
  131. package/lib/entries/screen/build-instance.js +0 -57
  132. package/lib/entries/screen/exports/bind-events.d.ts +0 -4
  133. package/lib/entries/screen/exports/bind-events.js +0 -8
  134. package/lib/entries/screen/exports/binding.d.ts +0 -6
  135. package/lib/entries/screen/exports/binding.js +0 -15
  136. package/lib/entries/screen/exports/device.d.ts +0 -16
  137. package/lib/entries/screen/exports/device.js +0 -41
  138. package/lib/entries/screen/exports/event.d.ts +0 -3
  139. package/lib/entries/screen/exports/event.js +0 -5
  140. package/lib/entries/screen/exports/index.d.ts +0 -5
  141. package/lib/entries/screen/exports/index.js +0 -5
  142. package/lib/entries/screen/exports/user.d.ts +0 -2
  143. package/lib/entries/screen/exports/user.js +0 -8
  144. package/lib/entries/screen/index.d.ts +0 -8
  145. package/lib/entries/screen/index.js +0 -36
  146. package/lib/feature/fit/product.d.ts +0 -5
  147. package/lib/feature/fit/product.js +0 -11
  148. package/lib/feature/unlock/door/door-action.d.ts +0 -2
  149. package/lib/feature/unlock/door/door-action.js +0 -32
  150. package/lib/fit.d.ts +0 -4
  151. package/lib/fit.js +0 -3
  152. package/lib/runtime/device-status/compute-device-status.d.ts +0 -25
  153. package/lib/runtime/device-status/compute-device-status.js +0 -94
  154. package/lib/screen.d.ts +0 -4
  155. package/lib/screen.js +0 -3
@@ -1,5 +0,0 @@
1
- import { getEventListForRuntime } from "../../../feature/screen/event";
2
- import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
3
- export function getEventList(params) {
4
- return getEventListForRuntime(resolveRuntimeFromExportThis(this), params);
5
- }
@@ -1,5 +0,0 @@
1
- export * from "./binding";
2
- export * from "./event";
3
- export * from "./user";
4
- export * from "./device";
5
- export * from "./bind-events";
@@ -1,5 +0,0 @@
1
- export * from "./binding";
2
- export * from "./event";
3
- export * from "./user";
4
- export * from "./device";
5
- export * from "./bind-events";
@@ -1,2 +0,0 @@
1
- export declare function getCurrentUser(isForce?: boolean): Promise<import("../../..").CurrentUser>;
2
- export declare function getCurrentUserSync(): import("../../..").CurrentUser | null;
@@ -1,8 +0,0 @@
1
- import { getCurrentUserForRuntime } from "../../../feature/user/current-user";
2
- import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
3
- export async function getCurrentUser(isForce) {
4
- return getCurrentUserForRuntime(resolveRuntimeFromExportThis(this), isForce);
5
- }
6
- export function getCurrentUserSync() {
7
- return resolveRuntimeFromExportThis(this).cache.currentUser;
8
- }
@@ -1,8 +0,0 @@
1
- import type { LockSDKOption } from "../../interface";
2
- import type { ScreenSDKInstance } from "./build-instance";
3
- export * from "./exports";
4
- export type { ScreenSDKInstance };
5
- export type { ScreenSdkBoundExportThis } from "./bootstrap/resolve-runtime-from-export-this";
6
- export declare const createScreenSDK: (options?: Omit<LockSDKOption, "preFetch">) => Promise<ScreenSDKInstance>;
7
- export declare const initScreen: (options?: LockSDKOption) => Promise<void>;
8
- export declare const destroyScreen: () => void;
@@ -1,36 +0,0 @@
1
- import { clearStateForRuntime } from "../../feature/state/clear";
2
- import { removeEvents } from "../../feature/state/platform-routing";
3
- import { bootstrapRegisteredScreenInstance } from "./bootstrap/bootstrap-lock-instance";
4
- import { clearPrimaryScreenSDKInstance, setPrimaryScreenSDKInstance, } from "./bootstrap/primary-instance";
5
- import { clearAllRuntimes, listRegisteredRuntimes, } from "../../runtime/registry";
6
- import { getLaunchOptionsSync } from "../../platform/device";
7
- import { getError } from "../../utils/errors";
8
- export * from "./exports";
9
- export const createScreenSDK = async (options) => {
10
- const { instance } = await bootstrapRegisteredScreenInstance({
11
- ...options,
12
- preFetch: false,
13
- });
14
- return instance;
15
- };
16
- export const initScreen = async (options) => {
17
- const opts = { ...options };
18
- const { devInfo, deviceId } = opts;
19
- if (!devInfo && !deviceId) {
20
- const { query } = getLaunchOptionsSync();
21
- opts.deviceId = query.deviceId;
22
- if (!opts.deviceId) {
23
- throw getError(1000);
24
- }
25
- }
26
- const { instance } = await bootstrapRegisteredScreenInstance(opts);
27
- setPrimaryScreenSDKInstance(instance);
28
- };
29
- export const destroyScreen = () => {
30
- removeEvents();
31
- for (const rt of listRegisteredRuntimes()) {
32
- clearStateForRuntime(rt);
33
- }
34
- clearAllRuntimes();
35
- clearPrimaryScreenSDKInstance();
36
- };
@@ -1,5 +0,0 @@
1
- import { type ProductSpecResult } from "../../api/product";
2
- import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
3
- export declare const getProductSpecForRuntime: (runtime: LockDeviceRuntime, configItem: string) => Promise<ProductSpecResult>;
4
- export declare const getProductInstVideoForRuntime: (runtime: LockDeviceRuntime) => Promise<ProductSpecResult>;
5
- export declare const getProductEBookForRuntime: (runtime: LockDeviceRuntime) => Promise<ProductSpecResult>;
@@ -1,11 +0,0 @@
1
- import { configCheck, } from "../../api/product";
2
- export const getProductSpecForRuntime = (runtime, configItem) => {
3
- const { devId, productId } = runtime.config.devInfo;
4
- return configCheck(devId, productId, configItem);
5
- };
6
- export const getProductInstVideoForRuntime = (runtime) => {
7
- return getProductSpecForRuntime(runtime, "product_inst_video");
8
- };
9
- export const getProductEBookForRuntime = (runtime) => {
10
- return getProductSpecForRuntime(runtime, "product_manual");
11
- };
@@ -1,2 +0,0 @@
1
- import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
2
- export declare const doOpenCloseActionForRuntime: (this: unknown, rt: LockDeviceRuntime, isOpen: boolean, timeout: number) => Promise<void>;
@@ -1,32 +0,0 @@
1
- import { parallelOnlyForRuntime } from "../../utils";
2
- import { checkRemoteEnabledForRuntime } from "./check-remote";
3
- import { getCurrentUserForRuntime } from "../../user/current-user";
4
- import { resolveOpenClosePath } from "./open-close-path";
5
- import { executeOpenCloseMatterLan } from "./door-matter-lan";
6
- import { executeOpenCloseNearDualMode } from "./door-near-dual-mode";
7
- import { executeOpenCloseBleOnly } from "./door-ble-only";
8
- import { executeOpenCloseRemoteCloud } from "./door-remote-cloud";
9
- export const doOpenCloseActionForRuntime = parallelOnlyForRuntime(async function doOpenCloseActionForRuntime(rt, isOpen, timeout) {
10
- await checkRemoteEnabledForRuntime(rt);
11
- const path = resolveOpenClosePath(rt);
12
- const currentUser = await getCurrentUserForRuntime(rt);
13
- const memberId = currentUser.lockUserId !== 0 ? currentUser.lockUserId : currentUser.userId;
14
- switch (path) {
15
- case "matter_lan":
16
- await executeOpenCloseMatterLan(rt, isOpen);
17
- return;
18
- case "near_dual_mode":
19
- await executeOpenCloseNearDualMode(rt, isOpen, timeout, memberId);
20
- return;
21
- case "ble_only":
22
- await executeOpenCloseBleOnly(rt, isOpen, timeout, memberId);
23
- return;
24
- case "remote_cloud":
25
- await executeOpenCloseRemoteCloud(rt, isOpen, timeout, memberId);
26
- return;
27
- default: {
28
- const _exhaustive = path;
29
- return _exhaustive;
30
- }
31
- }
32
- });
package/lib/fit.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./entries/fit/index";
2
- export * from "./interface";
3
- export * from "./constant";
4
- export type { SDKLogConfig, SDKLogEntry, SDKLogLevel, SDKLogSink, } from "./utils/sdk-log";
package/lib/fit.js DELETED
@@ -1,3 +0,0 @@
1
- export * from "./entries/fit/index";
2
- export * from "./interface";
3
- export * from "./constant";
@@ -1,25 +0,0 @@
1
- import { ProductCommunicationType } from "../../constant";
2
- import type { DeviceStatus } from "../../interface";
3
- export type ComputeDeviceStatusConfigSlice = {
4
- onlineType: number;
5
- devInfo: {
6
- isCloudOnline: boolean;
7
- isOnline: boolean;
8
- wifiEnableState?: number;
9
- isMatter?: boolean;
10
- };
11
- };
12
- export type ComputeDeviceStatusDeps = {
13
- hasCapability: (t: ProductCommunicationType) => boolean;
14
- hasDp: (code: string) => boolean;
15
- getDpValue: (code: string) => unknown;
16
- isSupportBleControl: () => boolean;
17
- isShareThread: () => boolean;
18
- readIsSleep: () => boolean;
19
- registeredRuntimeCount: number;
20
- getDormantPeriod: () => {
21
- start: number;
22
- end: number;
23
- };
24
- };
25
- export declare function computeDeviceStatus(config: ComputeDeviceStatusConfigSlice, deps: ComputeDeviceStatusDeps): DeviceStatus;
@@ -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";