@ray-js/lock-sdk 1.2.0-beta.27 → 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.
- package/lib/entries/main/bootstrap/bootstrap-lock-instance.d.ts +2 -1
- package/lib/entries/main/bootstrap/bootstrap-lock-instance.js +8 -4
- package/lib/entries/main/bootstrap/bootstrap.d.ts +3 -2
- package/lib/entries/main/bootstrap/bootstrap.js +8 -6
- package/lib/entries/main/bootstrap/primary-instance.d.ts +1 -2
- package/lib/entries/main/build-instance.d.ts +6 -3
- package/lib/entries/main/build-instance.js +13 -1
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/binding.d.ts +2 -2
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/binding.js +3 -3
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.d.ts +6 -6
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.js +10 -10
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.d.ts +0 -2
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.js +0 -2
- package/lib/entries/main/exports/fit-sdk/log.d.ts +3 -0
- package/lib/entries/main/exports/fit-sdk/log.js +5 -0
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/temp.d.ts +8 -8
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/temp.js +5 -5
- package/lib/entries/main/exports/index.d.ts +4 -0
- package/lib/entries/main/exports/index.js +4 -0
- package/lib/entries/main/index.d.ts +2 -2
- package/lib/entries/main/index.js +9 -3
- package/lib/feature/misc/is-use-near-channel-for-runtime.js +1 -1
- package/lib/feature/user/sync-user.js +1 -1
- package/lib/interface.d.ts +1 -0
- package/package.json +1 -11
- package/lib/api/product.d.ts +0 -8
- package/lib/api/product.js +0 -10
- package/lib/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/bootstrap/bootstrap-lock-instance.js +0 -16
- package/lib/bootstrap/bootstrap.d.ts +0 -4
- package/lib/bootstrap/bootstrap.js +0 -53
- package/lib/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/bootstrap/primary-instance.d.ts +0 -6
- package/lib/bootstrap/primary-instance.js +0 -24
- package/lib/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/ble/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/entries/ble/bootstrap/bootstrap-lock-instance.js +0 -12
- package/lib/entries/ble/bootstrap/bootstrap.d.ts +0 -4
- package/lib/entries/ble/bootstrap/bootstrap.js +0 -53
- package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/entries/ble/bootstrap/primary-instance.d.ts +0 -6
- package/lib/entries/ble/bootstrap/primary-instance.js +0 -24
- package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/entries/ble/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/entries/ble/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/ble/build-instance.d.ts +0 -9
- package/lib/entries/ble/build-instance.js +0 -50
- package/lib/entries/ble/exports/capability.d.ts +0 -6
- package/lib/entries/ble/exports/capability.js +0 -17
- package/lib/entries/ble/exports/config.d.ts +0 -3
- package/lib/entries/ble/exports/config.js +0 -5
- package/lib/entries/ble/exports/dp.d.ts +0 -9
- package/lib/entries/ble/exports/dp.js +0 -13
- package/lib/entries/ble/exports/index.d.ts +0 -16
- package/lib/entries/ble/exports/index.js +0 -16
- package/lib/entries/ble/exports/linkage.d.ts +0 -5
- package/lib/entries/ble/exports/linkage.js +0 -15
- package/lib/entries/ble/exports/log.d.ts +0 -9
- package/lib/entries/ble/exports/log.js +0 -21
- package/lib/entries/ble/exports/media.d.ts +0 -4
- package/lib/entries/ble/exports/media.js +0 -12
- package/lib/entries/ble/exports/misc.d.ts +0 -19
- package/lib/entries/ble/exports/misc.js +0 -30
- package/lib/entries/ble/exports/offline-dps.d.ts +0 -8
- package/lib/entries/ble/exports/offline-dps.js +0 -24
- package/lib/entries/ble/exports/open/do-open-close-action.d.ts +0 -2
- package/lib/entries/ble/exports/open/do-open-close-action.js +0 -36
- package/lib/entries/ble/exports/open/index.d.ts +0 -18
- package/lib/entries/ble/exports/open/index.js +0 -45
- package/lib/entries/ble/exports/signal.d.ts +0 -6
- package/lib/entries/ble/exports/signal.js +0 -14
- package/lib/entries/ble/exports/sleep.d.ts +0 -13
- package/lib/entries/ble/exports/sleep.js +0 -31
- package/lib/entries/ble/exports/state.d.ts +0 -6
- package/lib/entries/ble/exports/state.js +0 -19
- package/lib/entries/ble/exports/temporary.d.ts +0 -31
- package/lib/entries/ble/exports/temporary.js +0 -91
- package/lib/entries/ble/exports/unlock/sync.d.ts +0 -1
- package/lib/entries/ble/exports/unlock/sync.js +0 -5
- package/lib/entries/ble/exports/unlock-method.d.ts +0 -19
- package/lib/entries/ble/exports/unlock-method.js +0 -58
- package/lib/entries/ble/exports/user/index.d.ts +0 -23
- package/lib/entries/ble/exports/user/index.js +0 -22
- package/lib/entries/ble/exports/user/sync.d.ts +0 -1
- package/lib/entries/ble/exports/user/sync.js +0 -5
- package/lib/entries/ble/index.d.ts +0 -8
- package/lib/entries/ble/index.js +0 -39
- package/lib/entries/fit/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/entries/fit/bootstrap/bootstrap-lock-instance.js +0 -25
- package/lib/entries/fit/bootstrap/bootstrap.d.ts +0 -4
- package/lib/entries/fit/bootstrap/bootstrap.js +0 -70
- package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/entries/fit/bootstrap/primary-instance.d.ts +0 -6
- package/lib/entries/fit/bootstrap/primary-instance.js +0 -24
- package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/entries/fit/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/entries/fit/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/fit/build-instance.d.ts +0 -9
- package/lib/entries/fit/build-instance.js +0 -59
- package/lib/entries/fit/exports/log.d.ts +0 -7
- package/lib/entries/fit/exports/log.js +0 -15
- package/lib/entries/fit/exports/misc.d.ts +0 -5
- package/lib/entries/fit/exports/misc.js +0 -9
- package/lib/entries/fit/exports/setting.d.ts +0 -4
- package/lib/entries/fit/exports/setting.js +0 -8
- package/lib/entries/fit/exports/state.d.ts +0 -4
- package/lib/entries/fit/exports/state.js +0 -12
- package/lib/entries/fit/index.d.ts +0 -8
- package/lib/entries/fit/index.js +0 -38
- package/lib/entries/main/exports/open.d.ts +0 -16
- package/lib/entries/main/exports/open.js +0 -44
- package/lib/entries/screen/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/entries/screen/bootstrap/bootstrap-lock-instance.js +0 -12
- package/lib/entries/screen/bootstrap/bootstrap.d.ts +0 -4
- package/lib/entries/screen/bootstrap/bootstrap.js +0 -69
- package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/entries/screen/bootstrap/primary-instance.d.ts +0 -6
- package/lib/entries/screen/bootstrap/primary-instance.js +0 -24
- package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/entries/screen/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/entries/screen/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/screen/build-instance.d.ts +0 -9
- package/lib/entries/screen/build-instance.js +0 -57
- package/lib/entries/screen/exports/bind-events.d.ts +0 -4
- package/lib/entries/screen/exports/bind-events.js +0 -8
- package/lib/entries/screen/exports/binding.d.ts +0 -6
- package/lib/entries/screen/exports/binding.js +0 -15
- package/lib/entries/screen/exports/device.d.ts +0 -16
- package/lib/entries/screen/exports/device.js +0 -41
- package/lib/entries/screen/exports/event.d.ts +0 -3
- package/lib/entries/screen/exports/event.js +0 -5
- package/lib/entries/screen/exports/index.d.ts +0 -5
- package/lib/entries/screen/exports/index.js +0 -5
- package/lib/entries/screen/exports/user.d.ts +0 -2
- package/lib/entries/screen/exports/user.js +0 -8
- package/lib/entries/screen/index.d.ts +0 -8
- package/lib/entries/screen/index.js +0 -36
- package/lib/feature/fit/product.d.ts +0 -5
- package/lib/feature/fit/product.js +0 -11
- package/lib/feature/unlock/door/door-action.d.ts +0 -2
- package/lib/feature/unlock/door/door-action.js +0 -32
- package/lib/fit.d.ts +0 -4
- package/lib/fit.js +0 -3
- package/lib/runtime/device-status/compute-device-status.d.ts +0 -25
- package/lib/runtime/device-status/compute-device-status.js +0 -94
- package/lib/screen.d.ts +0 -4
- package/lib/screen.js +0 -3
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { LockSDKOption } from "../../../interface";
|
|
2
2
|
import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
3
3
|
import { type LockSDKInstance } from "../build-instance";
|
|
4
|
-
|
|
4
|
+
import { type SDKKind } from "./bootstrap";
|
|
5
|
+
export declare function bootstrapRegisteredInstance(kind: SDKKind, options?: LockSDKOption): Promise<{
|
|
5
6
|
runtime: LockDeviceRuntime;
|
|
6
7
|
instance: LockSDKInstance;
|
|
7
8
|
}>;
|
|
@@ -2,15 +2,19 @@ import { addEvents, removeEvents, } from "../../../feature/state/platform-routin
|
|
|
2
2
|
import { initState } from "../../../feature/state/init-state";
|
|
3
3
|
import { clearStateForRuntime } from "../../../feature/state/clear";
|
|
4
4
|
import { registerRuntime, unregisterRuntime, getRegisteredRuntimeCount, } from "../../../runtime/registry";
|
|
5
|
-
import {
|
|
5
|
+
import { buildSDKInstance } from "../build-instance";
|
|
6
6
|
import { createBootstrappedRuntime } from "./bootstrap";
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
import { startFitSyncReportForRuntime } from "../../../feature/fit/sync";
|
|
8
|
+
export async function bootstrapRegisteredInstance(kind, options) {
|
|
9
|
+
const runtime = await createBootstrappedRuntime(kind, options);
|
|
9
10
|
registerRuntime(runtime);
|
|
10
11
|
try {
|
|
11
12
|
addEvents(runtime);
|
|
12
13
|
await initState(runtime);
|
|
13
|
-
|
|
14
|
+
if (kind === "fit") {
|
|
15
|
+
startFitSyncReportForRuntime(runtime);
|
|
16
|
+
}
|
|
17
|
+
return { runtime, instance: buildSDKInstance(runtime) };
|
|
14
18
|
}
|
|
15
19
|
catch (error) {
|
|
16
20
|
unregisterRuntime(runtime.devId);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LockSDKOption } from "../../../interface";
|
|
2
2
|
import { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
3
|
-
export
|
|
4
|
-
export declare function
|
|
3
|
+
export type SDKKind = "lock" | "fit" | "screen";
|
|
4
|
+
export declare function applyOptionsToRuntime(runtime: LockDeviceRuntime, kind: SDKKind, options?: LockSDKOption): Promise<void>;
|
|
5
|
+
export declare function createBootstrappedRuntime(kind: SDKKind, options?: LockSDKOption): Promise<LockDeviceRuntime>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import dpCodes from "../../../config/dp-code";
|
|
2
2
|
import { getCapabilities } from "../../../utils";
|
|
3
|
-
import { getDeviceInfo, trackEvent
|
|
3
|
+
import { getDeviceInfo, trackEvent } from "../../../platform/device";
|
|
4
4
|
import { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
5
5
|
import { sdkLog, setSDKLogConfig } from "../../../utils/sdk-log";
|
|
6
|
-
export async function
|
|
6
|
+
export async function applyOptionsToRuntime(runtime, kind, options) {
|
|
7
|
+
const isFit = kind === "fit";
|
|
7
8
|
setSDKLogConfig({
|
|
8
9
|
level: options?.logLevel ?? "warn",
|
|
9
10
|
sink: options?.logger,
|
|
@@ -12,7 +13,7 @@ export async function applyLockOptionsToRuntime(runtime, options) {
|
|
|
12
13
|
const { config } = runtime;
|
|
13
14
|
let { devInfo, deviceId } = options || {};
|
|
14
15
|
if (!devInfo && !deviceId) {
|
|
15
|
-
throw new Error(
|
|
16
|
+
throw new Error(`deviceId is required in ${isFit ? "fit" : "lock"} sdk`);
|
|
16
17
|
}
|
|
17
18
|
if (deviceId && (!devInfo || devInfo.devId !== deviceId)) {
|
|
18
19
|
devInfo = await getDeviceInfo(deviceId);
|
|
@@ -36,6 +37,7 @@ export async function applyLockOptionsToRuntime(runtime, options) {
|
|
|
36
37
|
idsByCode[item.code] = item.id;
|
|
37
38
|
});
|
|
38
39
|
}
|
|
40
|
+
config.isFitting = isFit;
|
|
39
41
|
config.strictMode = options?.strictMode ?? true;
|
|
40
42
|
config.passwordDigitalBase = options?.passwordDigitalBase ?? 10;
|
|
41
43
|
config.passwordSupportZero = options?.passwordSupportZero ?? true;
|
|
@@ -50,7 +52,7 @@ export async function applyLockOptionsToRuntime(runtime, options) {
|
|
|
50
52
|
config.localCache = options?.localCache ?? true;
|
|
51
53
|
config.notSupportWake = options?.notSupportWake ?? false;
|
|
52
54
|
config.communication = getCapabilities(devInfo.capability).map((item) => item.id);
|
|
53
|
-
sdkLog("info", "bootstrap", "applyOptions", {
|
|
55
|
+
sdkLog("info", isFit ? "fit-bootstrap" : "bootstrap", "applyOptions", {
|
|
54
56
|
devId: config.devInfo.devId,
|
|
55
57
|
data: {
|
|
56
58
|
productId: config.devInfo.productId,
|
|
@@ -64,8 +66,8 @@ export async function applyLockOptionsToRuntime(runtime, options) {
|
|
|
64
66
|
pid: devInfo.productId,
|
|
65
67
|
});
|
|
66
68
|
}
|
|
67
|
-
export async function createBootstrappedRuntime(options) {
|
|
69
|
+
export async function createBootstrappedRuntime(kind, options) {
|
|
68
70
|
const runtime = new LockDeviceRuntime();
|
|
69
|
-
await
|
|
71
|
+
await applyOptionsToRuntime(runtime, kind, options);
|
|
70
72
|
return runtime;
|
|
71
73
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
2
|
-
|
|
3
|
-
export declare function setPrimaryLockSDKInstance(instance: LockSDKInstance): void;
|
|
2
|
+
export declare function setPrimaryLockSDKInstance(instance: object): void;
|
|
4
3
|
export declare function getPrimaryLockSDKRuntime(): LockDeviceRuntime | null;
|
|
5
4
|
export declare function clearPrimaryLockSDKInstance(): void;
|
|
6
5
|
export declare function clearPrimaryLockSDKInstanceIfDevId(devId: string): void;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
|
+
import { type UpdateConfigParams } from "../../feature/misc/update-config";
|
|
2
3
|
import * as DeviceExports from "./exports";
|
|
3
|
-
export
|
|
4
|
+
export type LockSDKInstance = {
|
|
4
5
|
destroy(): void;
|
|
5
|
-
|
|
6
|
+
updateConfig(options: UpdateConfigParams): void;
|
|
7
|
+
} & Omit<typeof DeviceExports, "updateConfig">;
|
|
8
|
+
export type FitSDKInstance = LockSDKInstance;
|
|
6
9
|
export declare function getFlatInstanceMethodKeysForTests(): string[];
|
|
7
|
-
export declare function
|
|
10
|
+
export declare function buildSDKInstance(runtime: LockDeviceRuntime): LockSDKInstance;
|
|
@@ -4,6 +4,8 @@ import { unregisterRuntime, getRegisteredRuntimeCount, } from "../../runtime/reg
|
|
|
4
4
|
import { clearStateForRuntime } from "../../feature/state/clear";
|
|
5
5
|
import { removeEvents } from "../../feature/state/platform-routing";
|
|
6
6
|
import { sdkLog } from "../../utils/sdk-log";
|
|
7
|
+
import { stopFitSyncReportForRuntime } from "../../feature/fit/sync";
|
|
8
|
+
import { updateConfigForRuntime, } from "../../feature/misc/update-config";
|
|
7
9
|
import * as DeviceExports from "./exports";
|
|
8
10
|
const RESERVED_INSTANCE_METHOD_KEYS = new Set(["destroy", "updateConfig"]);
|
|
9
11
|
let cachedFlatExportKeys = null;
|
|
@@ -20,17 +22,27 @@ function collectFlatInstanceExportKeys() {
|
|
|
20
22
|
export function getFlatInstanceMethodKeysForTests() {
|
|
21
23
|
return collectFlatInstanceExportKeys();
|
|
22
24
|
}
|
|
23
|
-
export function
|
|
25
|
+
export function buildSDKInstance(runtime) {
|
|
24
26
|
const instance = {
|
|
25
27
|
destroy() {
|
|
26
28
|
sdkLog("info", "lifecycle", "destroy", { devId: runtime.devId });
|
|
27
29
|
unregisterRuntime(runtime.devId);
|
|
28
30
|
clearPrimaryLockSDKInstanceIfDevId(runtime.devId);
|
|
31
|
+
if (runtime.config.isFitting) {
|
|
32
|
+
stopFitSyncReportForRuntime(runtime);
|
|
33
|
+
}
|
|
29
34
|
clearStateForRuntime(runtime);
|
|
30
35
|
if (getRegisteredRuntimeCount() === 0) {
|
|
31
36
|
removeEvents();
|
|
32
37
|
}
|
|
33
38
|
},
|
|
39
|
+
updateConfig(options) {
|
|
40
|
+
sdkLog("info", "lifecycle", "updateConfig", {
|
|
41
|
+
devId: runtime.devId,
|
|
42
|
+
data: { keys: Object.keys(options) },
|
|
43
|
+
});
|
|
44
|
+
updateConfigForRuntime(runtime, options);
|
|
45
|
+
},
|
|
34
46
|
};
|
|
35
47
|
registerLockSDKInstanceRuntime(instance, runtime);
|
|
36
48
|
sdkLog("info", "lifecycle", "createInstance", { devId: runtime.devId });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type BoundLockListItem, type FitLockUnbindableReason, type UnbindLockListItem } from "
|
|
2
|
-
import { BoundFitLockItem, UnbindLockItem } from "
|
|
1
|
+
import { type BoundLockListItem, type FitLockUnbindableReason, type UnbindLockListItem } from "../../../../feature/fit/list";
|
|
2
|
+
import { BoundFitLockItem, UnbindLockItem } from "../../../../api/fit";
|
|
3
3
|
export type { BoundFitLockItem, BoundLockListItem, UnbindLockItem, UnbindLockListItem, FitLockUnbindableReason, };
|
|
4
4
|
export declare function getBoundLockList(): Promise<BoundLockListItem[]>;
|
|
5
5
|
export declare function getUnbindLockList(): Promise<UnbindLockListItem[]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getBoundLockListForRuntime, getUnbindLockListForRuntime, } from "
|
|
2
|
-
import { activateLockToFitForRuntime, bindLockToFitForRuntime, unbindLockToFitForRuntime, } from "
|
|
3
|
-
import { resolveRuntimeFromExportThis } from "
|
|
1
|
+
import { getBoundLockListForRuntime, getUnbindLockListForRuntime, } from "../../../../feature/fit/list";
|
|
2
|
+
import { activateLockToFitForRuntime, bindLockToFitForRuntime, unbindLockToFitForRuntime, } from "../../../../feature/fit/bind-lock-to-fit";
|
|
3
|
+
import { resolveRuntimeFromExportThis } from "../../bootstrap/resolve-runtime-from-export-this";
|
|
4
4
|
export function getBoundLockList() {
|
|
5
5
|
return getBoundLockListForRuntime(resolveRuntimeFromExportThis(this));
|
|
6
6
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type FitStartAddUnlockMethodResult } from "
|
|
2
|
-
import type { FitAddPasswordParams, FitAddUnlockMethodEvent, FitAddUnlockMethodListener, FitCancelAddUnlockMethodParams, FitStartAddUnlockMethodParams, FitUnlockMethodDevice, FitUnlockMethodItem, FitUpdateUnlockMethodParams, GetFitUnlockMethodListParams } from "
|
|
3
|
-
import { CreateTemporaryBleKeyParams, UpdateTemporaryBleKeyParams, RenameFitBleKeyParams } from "
|
|
4
|
-
import { type FitUserItem } from "
|
|
5
|
-
import type { FitBleKeyItem } from "
|
|
1
|
+
import { type FitStartAddUnlockMethodResult } from "../../../../feature/fit/method/add-flow";
|
|
2
|
+
import type { FitAddPasswordParams, FitAddUnlockMethodEvent, FitAddUnlockMethodListener, FitCancelAddUnlockMethodParams, FitStartAddUnlockMethodParams, FitUnlockMethodDevice, FitUnlockMethodItem, FitUpdateUnlockMethodParams, GetFitUnlockMethodListParams } from "../../../../feature/fit/method/types";
|
|
3
|
+
import { CreateTemporaryBleKeyParams, UpdateTemporaryBleKeyParams, RenameFitBleKeyParams } from "../../../../feature/fit/ble-key";
|
|
4
|
+
import { type FitUserItem } from "../../../../feature/fit/users";
|
|
5
|
+
import type { FitBleKeyItem } from "../../../../interface";
|
|
6
6
|
export type { FitAddPasswordParams, FitStartAddUnlockMethodParams, FitCancelAddUnlockMethodParams, FitUpdateUnlockMethodParams, FitAddUnlockMethodEvent, FitAddUnlockMethodListener, FitStartAddUnlockMethodResult, FitUserItem, FitUnlockMethodDevice, FitUnlockMethodItem, GetFitUnlockMethodListParams, FitBleKeyItem, CreateTemporaryBleKeyParams, };
|
|
7
7
|
export declare function fitAddPassword(params: FitAddPasswordParams): Promise<void>;
|
|
8
8
|
export declare function fitStartAddUnlockMethod(params: FitStartAddUnlockMethodParams): Promise<FitStartAddUnlockMethodResult>;
|
|
@@ -12,7 +12,7 @@ export declare function offFitAddUnlockMethod(listener: FitAddUnlockMethodListen
|
|
|
12
12
|
export declare function fitUpdateUnlockMethod(params: FitUpdateUnlockMethodParams): Promise<void>;
|
|
13
13
|
export declare function fitDeleteUnlockMethod(id: number, lockDevId?: string): Promise<void>;
|
|
14
14
|
export declare function getFitUnlockMethodList(params: GetFitUnlockMethodListParams): Promise<FitUnlockMethodItem[]>;
|
|
15
|
-
export declare function syncOpenModeRise(dpCodes?: string[]): Promise<import("
|
|
15
|
+
export declare function syncOpenModeRise(dpCodes?: string[]): Promise<import("../../../../api/fit").SyncOpenModeRiseResult>;
|
|
16
16
|
export declare function getFitBleKeyList(): Promise<FitBleKeyItem[]>;
|
|
17
17
|
export declare function addFitBleKey(params: Record<string, unknown>): Promise<unknown>;
|
|
18
18
|
export declare function createFitPermanentBleKey(userId: string): Promise<unknown>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { resolveRuntimeFromExportThis } from "
|
|
2
|
-
import { fitAddPasswordForRuntime } from "
|
|
3
|
-
import { fitCancelAddUnlockMethodForRuntime, fitStartAddUnlockMethodForRuntime, } from "
|
|
4
|
-
import { fitDeleteUnlockMethodForRuntime, fitUpdateUnlockMethodForRuntime, } from "
|
|
5
|
-
import { offFitAddUnlockMethodForRuntime, onFitAddUnlockMethodForRuntime, } from "
|
|
6
|
-
import { getFitUnlockMethodListForRuntime } from "
|
|
7
|
-
import { syncOpenModeRiseForRuntime } from "
|
|
8
|
-
import { getFitBleKeyListForRuntime, addFitBleKeyForRuntime, createFitPermanentBleKeyForRuntime, createFitTemporaryBleKeyForRuntime, updateFitTemporaryBleKeyForRuntime, removeFitBleKeyForRuntime, renameFitBleKeyForRuntime, } from "
|
|
9
|
-
import { setFitSettingForRuntime } from "
|
|
10
|
-
import { getFitUsersForRuntime, } from "
|
|
1
|
+
import { resolveRuntimeFromExportThis } from "../../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
+
import { fitAddPasswordForRuntime } from "../../../../feature/fit/method/add-password";
|
|
3
|
+
import { fitCancelAddUnlockMethodForRuntime, fitStartAddUnlockMethodForRuntime, } from "../../../../feature/fit/method/add-flow";
|
|
4
|
+
import { fitDeleteUnlockMethodForRuntime, fitUpdateUnlockMethodForRuntime, } from "../../../../feature/fit/method/update-remove";
|
|
5
|
+
import { offFitAddUnlockMethodForRuntime, onFitAddUnlockMethodForRuntime, } from "../../../../feature/fit/method/add-method-events";
|
|
6
|
+
import { getFitUnlockMethodListForRuntime } from "../../../../feature/fit/method/list";
|
|
7
|
+
import { syncOpenModeRiseForRuntime } from "../../../../feature/fit/sync";
|
|
8
|
+
import { getFitBleKeyListForRuntime, addFitBleKeyForRuntime, createFitPermanentBleKeyForRuntime, createFitTemporaryBleKeyForRuntime, updateFitTemporaryBleKeyForRuntime, removeFitBleKeyForRuntime, renameFitBleKeyForRuntime, } from "../../../../feature/fit/ble-key";
|
|
9
|
+
import { setFitSettingForRuntime } from "../../../../feature/fit/setting";
|
|
10
|
+
import { getFitUsersForRuntime, } from "../../../../feature/fit/users";
|
|
11
11
|
export function fitAddPassword(params) {
|
|
12
12
|
return fitAddPasswordForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
13
13
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { resolveRuntimeFromExportThis } from "../../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
+
import { getFitLogsForRuntime, } from "../../../../feature/fit/log";
|
|
3
|
+
export async function getFitLogs(params) {
|
|
4
|
+
return getFitLogsForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
5
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type FitOnlinePasswordItem, type FitOfflinePasswordItem } from "
|
|
2
|
-
import { type AddFitTempPwdParams, type RemoveFitTempPwdParams, type RenameFitTempPwdParams, type RenameFitOfflineTempPwdParams, type RevokeFitOfflineTempPwdParams, type FitOfflineClearCodeResult, type ResendFitTempPwdParams, type UpdateFitTempPwdParams } from "
|
|
3
|
-
import { type ClearFitInvalidPwdParams, type GetFitInvalidPwdListParams } from "
|
|
4
|
-
import { type FitOfflineOnceResult } from "
|
|
5
|
-
import type { LimitOfflinePwdItem, OfflinePwdAvailableResult } from "
|
|
6
|
-
import type { TempPasswordResult } from "
|
|
1
|
+
import { type FitOnlinePasswordItem, type FitOfflinePasswordItem } from "../../../../feature/fit/password-list";
|
|
2
|
+
import { type AddFitTempPwdParams, type RemoveFitTempPwdParams, type RenameFitTempPwdParams, type RenameFitOfflineTempPwdParams, type RevokeFitOfflineTempPwdParams, type FitOfflineClearCodeResult, type ResendFitTempPwdParams, type UpdateFitTempPwdParams } from "../../../../feature/fit/temp-password";
|
|
3
|
+
import { type ClearFitInvalidPwdParams, type GetFitInvalidPwdListParams } from "../../../../feature/fit/invalid-password";
|
|
4
|
+
import { type FitOfflineOnceResult } from "../../../../feature/password/temporary/offline-create";
|
|
5
|
+
import type { LimitOfflinePwdItem, OfflinePwdAvailableResult } from "../../../../api/temp";
|
|
6
|
+
import type { TempPasswordResult } from "../../../../interface";
|
|
7
7
|
export declare function getFitPasswordList(): Promise<{
|
|
8
8
|
id: number;
|
|
9
9
|
unlockId: string;
|
|
@@ -13,7 +13,7 @@ export declare function getFitPasswordList(): Promise<{
|
|
|
13
13
|
lockUserId: number;
|
|
14
14
|
userType: number;
|
|
15
15
|
devLockId: string;
|
|
16
|
-
effective: import("
|
|
16
|
+
effective: import("../../../../interface").EffectiveConfig;
|
|
17
17
|
}[]>;
|
|
18
18
|
export declare function getFitOnlinePasswordList(): Promise<FitOnlinePasswordItem[]>;
|
|
19
19
|
export declare function getFitOfflinePasswordList(): Promise<FitOfflinePasswordItem[]>;
|
|
@@ -26,7 +26,7 @@ export declare function renameFitTempPwd(params: RenameFitTempPwdParams): Promis
|
|
|
26
26
|
export declare function renameFitOfflineTempPwd(params: RenameFitOfflineTempPwdParams): Promise<void>;
|
|
27
27
|
export declare function revokeFitOfflineTempPwd(params: RevokeFitOfflineTempPwdParams): Promise<FitOfflineClearCodeResult>;
|
|
28
28
|
export declare function resendFitTempPwd(params: ResendFitTempPwdParams): Promise<boolean>;
|
|
29
|
-
export declare function getFitInvalidPwdList(params?: GetFitInvalidPwdListParams): Promise<import("
|
|
29
|
+
export declare function getFitInvalidPwdList(params?: GetFitInvalidPwdListParams): Promise<import("../../../../api/fit").FitInvalidPwdListResult>;
|
|
30
30
|
export declare function clearFitInvalidPwd(params?: ClearFitInvalidPwdParams): Promise<boolean>;
|
|
31
31
|
export declare function getFitDynamicPassword(): Promise<TempPasswordResult>;
|
|
32
32
|
export declare function getFitOfflineOncePassword(): Promise<FitOfflineOnceResult>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getFitPasswordListForRuntime, getFitOnlinePasswordListForRuntime, getFitOfflinePasswordListForRuntime, } from "
|
|
2
|
-
import { resolveRuntimeFromExportThis } from "
|
|
3
|
-
import { fitAddTempPwdForRuntime, fitRemoveTempPwdForRuntime, fitRenameTempPwdForRuntime, fitRenameOfflineTempPwdForRuntime, fitRevokeOfflineTempPwdForRuntime, fitResendTempPwdForRuntime, fitUpdateTempPwdForRuntime, } from "
|
|
4
|
-
import { clearFitInvalidPwdForRuntime, getFitInvalidPwdListForRuntime, } from "
|
|
5
|
-
import { createTempDynamicForRuntime, createFitOfflineOnceForRuntime, createFitOfflineLimitForRuntime, createFitOfflineClearAllForRuntime, getFitOfflineRevocableListForRuntime, getFitOfflinePwdAvailableForRuntime, } from "
|
|
1
|
+
import { getFitPasswordListForRuntime, getFitOnlinePasswordListForRuntime, getFitOfflinePasswordListForRuntime, } from "../../../../feature/fit/password-list";
|
|
2
|
+
import { resolveRuntimeFromExportThis } from "../../bootstrap/resolve-runtime-from-export-this";
|
|
3
|
+
import { fitAddTempPwdForRuntime, fitRemoveTempPwdForRuntime, fitRenameTempPwdForRuntime, fitRenameOfflineTempPwdForRuntime, fitRevokeOfflineTempPwdForRuntime, fitResendTempPwdForRuntime, fitUpdateTempPwdForRuntime, } from "../../../../feature/fit/temp-password";
|
|
4
|
+
import { clearFitInvalidPwdForRuntime, getFitInvalidPwdListForRuntime, } from "../../../../feature/fit/invalid-password";
|
|
5
|
+
import { createTempDynamicForRuntime, createFitOfflineOnceForRuntime, createFitOfflineLimitForRuntime, createFitOfflineClearAllForRuntime, getFitOfflineRevocableListForRuntime, getFitOfflinePwdAvailableForRuntime, } from "../../../../feature/password/temporary/offline-create";
|
|
6
6
|
export function getFitPasswordList() {
|
|
7
7
|
return getFitPasswordListForRuntime(resolveRuntimeFromExportThis(this));
|
|
8
8
|
}
|
|
@@ -23,3 +23,7 @@ export * from "./ai";
|
|
|
23
23
|
export * from "./accessory-binding";
|
|
24
24
|
export * from "./screen/list";
|
|
25
25
|
export * from "./screen/bind";
|
|
26
|
+
export * from "./fit-sdk/binding";
|
|
27
|
+
export * from "./fit-sdk/device";
|
|
28
|
+
export * from "./fit-sdk/log";
|
|
29
|
+
export * from "./fit-sdk/temp";
|
|
@@ -23,3 +23,7 @@ export * from "./ai";
|
|
|
23
23
|
export * from "./accessory-binding";
|
|
24
24
|
export * from "./screen/list";
|
|
25
25
|
export * from "./screen/bind";
|
|
26
|
+
export * from "./fit-sdk/binding";
|
|
27
|
+
export * from "./fit-sdk/device";
|
|
28
|
+
export * from "./fit-sdk/log";
|
|
29
|
+
export * from "./fit-sdk/temp";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LockSDKOption } from "../../interface";
|
|
2
|
-
import type { LockSDKInstance } from "./build-instance";
|
|
2
|
+
import type { LockSDKInstance, FitSDKInstance } from "./build-instance";
|
|
3
3
|
export * from "./exports";
|
|
4
|
-
export type { LockSDKInstance };
|
|
4
|
+
export type { LockSDKInstance, FitSDKInstance };
|
|
5
5
|
export type { LockSdkBoundExportThis } from "./bootstrap/resolve-runtime-from-export-this";
|
|
6
6
|
export declare const createLockSDK: (options?: Omit<LockSDKOption, "preFetch">) => Promise<LockSDKInstance>;
|
|
7
7
|
export declare const init: (options?: LockSDKOption) => Promise<void>;
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { clearStateForRuntime } from "../../feature/state/clear";
|
|
2
2
|
import { removeEvents } from "../../feature/state/platform-routing";
|
|
3
|
-
import {
|
|
3
|
+
import { bootstrapRegisteredInstance } from "./bootstrap/bootstrap-lock-instance";
|
|
4
4
|
import { clearPrimaryLockSDKInstance, setPrimaryLockSDKInstance, } from "./bootstrap/primary-instance";
|
|
5
5
|
import { clearAllRuntimes, listRegisteredRuntimes, } from "../../runtime/registry";
|
|
6
6
|
import { getLaunchOptionsSync } from "../../platform/device";
|
|
7
|
+
import { stopFitSyncReportForRuntime } from "../../feature/fit/sync";
|
|
7
8
|
import { getError } from "../../utils/errors";
|
|
8
9
|
export * from "./exports";
|
|
9
10
|
export const createLockSDK = async (options) => {
|
|
10
|
-
const
|
|
11
|
+
const kind = options?.kind ?? "lock";
|
|
12
|
+
const { instance } = await bootstrapRegisteredInstance(kind, {
|
|
11
13
|
...options,
|
|
12
14
|
preFetch: false,
|
|
13
15
|
});
|
|
14
16
|
return instance;
|
|
15
17
|
};
|
|
16
18
|
export const init = async (options) => {
|
|
19
|
+
const kind = options?.kind ?? "lock";
|
|
17
20
|
const opts = { ...options };
|
|
18
21
|
const { devInfo, deviceId } = opts;
|
|
19
22
|
if (!devInfo && !deviceId) {
|
|
@@ -23,12 +26,15 @@ export const init = async (options) => {
|
|
|
23
26
|
throw getError(1000);
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
|
-
const { instance } = await
|
|
29
|
+
const { instance } = await bootstrapRegisteredInstance(kind, opts);
|
|
27
30
|
setPrimaryLockSDKInstance(instance);
|
|
28
31
|
};
|
|
29
32
|
export const destroy = () => {
|
|
30
33
|
removeEvents();
|
|
31
34
|
for (const rt of listRegisteredRuntimes()) {
|
|
35
|
+
if (rt.config.isFitting) {
|
|
36
|
+
stopFitSyncReportForRuntime(rt);
|
|
37
|
+
}
|
|
32
38
|
clearStateForRuntime(rt);
|
|
33
39
|
}
|
|
34
40
|
clearAllRuntimes();
|
|
@@ -5,7 +5,7 @@ import { publishDpsOnlyWithRuntime, } from "../dp/publish-dps";
|
|
|
5
5
|
import dpCodes from "../../config/dp-code";
|
|
6
6
|
import { hasCapabilityForRuntime, isBlePureDeviceForRuntime } from "../misc/capability";
|
|
7
7
|
import { sdkLog } from "../../utils/sdk-log";
|
|
8
|
-
import { ProductCommunicationType } from "
|
|
8
|
+
import { ProductCommunicationType } from "../../constant";
|
|
9
9
|
export async function syncDeleteUsersWithRuntime(runtime) {
|
|
10
10
|
const hasWifi = hasCapabilityForRuntime(runtime, ProductCommunicationType.WIFI);
|
|
11
11
|
if (hasWifi && runtime.config.devInfo.wifiEnableState !== 1) {
|
package/lib/interface.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/lock-sdk",
|
|
3
|
-
"version": "1.2.0-beta.
|
|
3
|
+
"version": "1.2.0-beta.29",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib",
|
|
6
6
|
"LICENSE.md"
|
|
@@ -12,16 +12,6 @@
|
|
|
12
12
|
"types": "./lib/index.d.ts",
|
|
13
13
|
"import": "./lib/index.js",
|
|
14
14
|
"default": "./lib/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./fit": {
|
|
17
|
-
"types": "./lib/fit.d.ts",
|
|
18
|
-
"import": "./lib/fit.js",
|
|
19
|
-
"default": "./lib/fit.js"
|
|
20
|
-
},
|
|
21
|
-
"./screen": {
|
|
22
|
-
"types": "./lib/screen.d.ts",
|
|
23
|
-
"import": "./lib/screen.js",
|
|
24
|
-
"default": "./lib/screen.js"
|
|
25
15
|
}
|
|
26
16
|
},
|
|
27
17
|
"scripts": {
|
package/lib/api/product.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export interface ProductSpecResult {
|
|
2
|
-
productManual?: boolean;
|
|
3
|
-
productInstVideo?: boolean;
|
|
4
|
-
urlType?: number;
|
|
5
|
-
url?: string;
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
}
|
|
8
|
-
export declare const configCheck: (devId: string, productId: string, configItem: string) => Promise<ProductSpecResult>;
|
package/lib/api/product.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { THING } from "../utils/constant";
|
|
2
|
-
import { requestApi } from "./request";
|
|
3
|
-
export const configCheck = (devId, productId, configItem) => {
|
|
4
|
-
return requestApi({
|
|
5
|
-
logName: "productConfigCheck",
|
|
6
|
-
api: `${THING}.m.product.config.check`,
|
|
7
|
-
version: "1.0",
|
|
8
|
-
data: { devId, productId, configItem },
|
|
9
|
-
});
|
|
10
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { LockSDKOption } from "../interface";
|
|
2
|
-
import type { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
|
|
3
|
-
import { type LockSDKInstance } from "../entries/main/build-instance";
|
|
4
|
-
export declare function bootstrapRegisteredLockInstance(options?: LockSDKOption): Promise<{
|
|
5
|
-
runtime: LockDeviceRuntime;
|
|
6
|
-
instance: LockSDKInstance;
|
|
7
|
-
}>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { addEvents } from "../feature/state/platform-routing";
|
|
2
|
-
import { initState } from "../feature/state/init-state";
|
|
3
|
-
import { registerRuntime } from "../runtime/registry";
|
|
4
|
-
import { buildLockSDKInstance, } from "../entries/main/build-instance";
|
|
5
|
-
import * as MainDeviceExports from "../entries/main/exports";
|
|
6
|
-
import { createBootstrappedRuntime } from "./bootstrap";
|
|
7
|
-
export async function bootstrapRegisteredLockInstance(options) {
|
|
8
|
-
const runtime = await createBootstrappedRuntime(options);
|
|
9
|
-
registerRuntime(runtime);
|
|
10
|
-
addEvents(runtime);
|
|
11
|
-
await initState(runtime);
|
|
12
|
-
return {
|
|
13
|
-
runtime,
|
|
14
|
-
instance: buildLockSDKInstance(runtime, MainDeviceExports),
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { LockSDKOption } from "../interface";
|
|
2
|
-
import { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
|
|
3
|
-
export declare function applyLockOptionsToRuntime(runtime: LockDeviceRuntime, options?: LockSDKOption): Promise<void>;
|
|
4
|
-
export declare function createBootstrappedRuntime(options?: LockSDKOption): Promise<LockDeviceRuntime>;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import dpCodes from "../config/dp-code";
|
|
2
|
-
import { getCapabilities } from "../utils";
|
|
3
|
-
import { getDeviceInfo, trackEvent } from "../platform/device";
|
|
4
|
-
import { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
|
|
5
|
-
export async function applyLockOptionsToRuntime(runtime, options) {
|
|
6
|
-
const { config } = runtime;
|
|
7
|
-
let { devInfo, deviceId } = options || {};
|
|
8
|
-
if (!devInfo && !deviceId) {
|
|
9
|
-
throw new Error("deviceId is required in lock sdk");
|
|
10
|
-
}
|
|
11
|
-
if (deviceId && (!devInfo || devInfo.devId !== deviceId)) {
|
|
12
|
-
devInfo = await getDeviceInfo(deviceId);
|
|
13
|
-
}
|
|
14
|
-
let dpSchema = {};
|
|
15
|
-
const codesById = {};
|
|
16
|
-
const idsByCode = {};
|
|
17
|
-
if (devInfo.schema) {
|
|
18
|
-
dpSchema = devInfo.schema.reduce((acc, cur) => {
|
|
19
|
-
acc[cur.code] = cur;
|
|
20
|
-
codesById[cur.id] = cur.code;
|
|
21
|
-
idsByCode[cur.code] = cur.id;
|
|
22
|
-
return acc;
|
|
23
|
-
}, {});
|
|
24
|
-
}
|
|
25
|
-
else if (devInfo.dpSchema) {
|
|
26
|
-
dpSchema = devInfo.dpSchema;
|
|
27
|
-
Object.keys(dpSchema).forEach((key) => {
|
|
28
|
-
const item = dpSchema[key];
|
|
29
|
-
codesById[item.id] = item.code;
|
|
30
|
-
idsByCode[item.code] = item.id;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
config.strictMode = options?.strictMode ?? true;
|
|
34
|
-
config.passwordDigitalBase = options?.passwordDigitalBase ?? 10;
|
|
35
|
-
config.passwordSupportZero = options?.passwordSupportZero ?? true;
|
|
36
|
-
config.supportMultipleFace = options?.supportMultipleFace ?? false;
|
|
37
|
-
config.supportOfflineDps = options?.supportOfflineDps ?? false;
|
|
38
|
-
config.devInfo = devInfo;
|
|
39
|
-
config.dpSchema = dpSchema;
|
|
40
|
-
config.codesById = codesById;
|
|
41
|
-
config.idsByCode = idsByCode;
|
|
42
|
-
config.supportBigData = !!dpSchema[dpCodes.synchMethodW];
|
|
43
|
-
config.preFetch = options?.preFetch ?? false;
|
|
44
|
-
config.communication = getCapabilities(devInfo.capability).map((item) => item.id);
|
|
45
|
-
trackEvent("t$y_UztB3Lj9Qns375R0r7dA0L5Kr2VytH3J".replace("$", ""), {
|
|
46
|
-
pid: devInfo.productId,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
export async function createBootstrappedRuntime(options) {
|
|
50
|
-
const runtime = new LockDeviceRuntime();
|
|
51
|
-
await applyLockOptionsToRuntime(runtime, options);
|
|
52
|
-
return runtime;
|
|
53
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
|
|
2
|
-
export declare function registerLockSDKInstanceRuntime(instance: object, runtime: LockDeviceRuntime): void;
|
|
3
|
-
export declare function getRuntimeForLockSDKInstance(instance: object): LockDeviceRuntime | undefined;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
|
|
2
|
-
import type { LockSDKInstance } from "../entries/main/build-instance";
|
|
3
|
-
export declare function setPrimaryLockSDKInstance(instance: LockSDKInstance): void;
|
|
4
|
-
export declare function getPrimaryLockSDKRuntime(): LockDeviceRuntime | null;
|
|
5
|
-
export declare function clearPrimaryLockSDKInstance(): void;
|
|
6
|
-
export declare function clearPrimaryLockSDKInstanceIfDevId(devId: string): void;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { getRuntimeForLockSDKInstance } from "./lock-instance-runtime-ref";
|
|
2
|
-
let primaryDevId = null;
|
|
3
|
-
let primaryRuntime = null;
|
|
4
|
-
export function setPrimaryLockSDKInstance(instance) {
|
|
5
|
-
const runtime = getRuntimeForLockSDKInstance(instance);
|
|
6
|
-
if (!runtime) {
|
|
7
|
-
throw new Error("setPrimaryLockSDKInstance: instance must be returned by createLockSDK or init");
|
|
8
|
-
}
|
|
9
|
-
primaryDevId = runtime.devId;
|
|
10
|
-
primaryRuntime = runtime;
|
|
11
|
-
}
|
|
12
|
-
export function getPrimaryLockSDKRuntime() {
|
|
13
|
-
return primaryRuntime;
|
|
14
|
-
}
|
|
15
|
-
export function clearPrimaryLockSDKInstance() {
|
|
16
|
-
primaryDevId = null;
|
|
17
|
-
primaryRuntime = null;
|
|
18
|
-
}
|
|
19
|
-
export function clearPrimaryLockSDKInstanceIfDevId(devId) {
|
|
20
|
-
if (primaryDevId === devId) {
|
|
21
|
-
primaryDevId = null;
|
|
22
|
-
primaryRuntime = null;
|
|
23
|
-
}
|
|
24
|
-
}
|