@blueid/access-capacitor 12.20.0 → 12.22.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.
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.aar +0 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.aar.asc +7 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.aar.asc.md5 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.aar.asc.sha1 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.aar.asc.sha256 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.aar.asc.sha512 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.aar.md5 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.aar.sha1 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.aar.sha256 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.aar.sha512 +1 -0
- package/android/sdklib/com/blue-id/access/{12.20.0/access-12.20.0.module → 12.22.0/access-12.22.0.module} +15 -15
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.module.asc +7 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.module.asc.md5 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.module.asc.sha1 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.module.asc.sha256 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.module.asc.sha512 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.module.md5 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.module.sha1 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.module.sha256 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.module.sha512 +1 -0
- package/android/sdklib/com/blue-id/access/{12.20.0/access-12.20.0.pom → 12.22.0/access-12.22.0.pom} +1 -1
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.pom.asc +7 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.pom.asc.md5 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.pom.asc.sha1 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.pom.asc.sha256 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.pom.asc.sha512 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.pom.md5 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.pom.sha1 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.pom.sha256 +1 -0
- package/android/sdklib/com/blue-id/access/12.22.0/access-12.22.0.pom.sha512 +1 -0
- package/android/sdklib/com/blue-id/access/maven-metadata.xml +4 -4
- package/android/sdklib/com/blue-id/access/maven-metadata.xml.md5 +1 -1
- package/android/sdklib/com/blue-id/access/maven-metadata.xml.sha1 +1 -1
- package/android/sdklib/com/blue-id/access/maven-metadata.xml.sha256 +1 -1
- package/android/sdklib/com/blue-id/access/maven-metadata.xml.sha512 +1 -1
- package/android/src/main/java/com/blueid/access/plugins/capacitor/BlueIDAccess.java +14 -1
- package/android/src/main/java/com/blueid/access/plugins/capacitor/BlueIDAccessPlugin.java +6 -2
- package/dist/docs.json +7 -0
- package/dist/esm/interop.d.ts +2 -1
- package/dist/esm/interop.js +2 -1
- package/dist/esm/interop.js.map +1 -1
- package/dist/plugin.cjs.js +2 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +2 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/BlueIDAccessPlugin.swift +11 -3
- package/package.json +1 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.aar +0 -0
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.aar.asc +0 -7
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.aar.asc.md5 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.aar.asc.sha1 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.aar.asc.sha256 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.aar.asc.sha512 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.aar.md5 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.aar.sha1 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.aar.sha256 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.aar.sha512 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.module.asc +0 -7
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.module.asc.md5 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.module.asc.sha1 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.module.asc.sha256 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.module.asc.sha512 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.module.md5 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.module.sha1 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.module.sha256 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.module.sha512 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.pom.asc +0 -7
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.pom.asc.md5 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.pom.asc.sha1 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.pom.asc.sha256 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.pom.asc.sha512 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.pom.md5 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.pom.sha1 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.pom.sha256 +0 -1
- package/android/sdklib/com/blue-id/access/12.20.0/access-12.20.0.pom.sha512 +0 -1
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cfd6480f18f582e36468375c475ab1b0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fb0b4b1d218217021a4c6d28e1bc4a5a56e67f68
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
27a98d554ae7ac7aac46de9b89276917b25a7bab53523d027a95c057dcaadd82
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e04119b85dda4a0fc6cbb144f50348a925f8466cbd3798a5c68b75307e44ac507dfc32cd386ec9436d4b78fccdf7da9d7e233624ff9c12cffaa5dcee78f0006f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0420cb1294b5188b73dfe3bbd9439c09
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d95db311e9651010cf516419119422f3f5934f43
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5e078f5a8652ef4e612f4f5dc46df63f8291c29c7d8bd833ffbb1f1618b5340f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fc9bf446c86ce487d468f637f1d60e8db5ea179c4805a02434100c277058d464d4d76c65a67315b74df519639549ac371b8b283ee24ff185cacf8b70ce05361a
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "com.blue-id",
|
|
5
5
|
"module": "access",
|
|
6
|
-
"version": "12.
|
|
6
|
+
"version": "12.22.0",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
],
|
|
41
41
|
"files": [
|
|
42
42
|
{
|
|
43
|
-
"name": "access-12.
|
|
44
|
-
"url": "access-12.
|
|
45
|
-
"size":
|
|
46
|
-
"sha512": "
|
|
47
|
-
"sha256": "
|
|
48
|
-
"sha1": "
|
|
49
|
-
"md5": "
|
|
43
|
+
"name": "access-12.22.0.aar",
|
|
44
|
+
"url": "access-12.22.0.aar",
|
|
45
|
+
"size": 3308249,
|
|
46
|
+
"sha512": "fc9bf446c86ce487d468f637f1d60e8db5ea179c4805a02434100c277058d464d4d76c65a67315b74df519639549ac371b8b283ee24ff185cacf8b70ce05361a",
|
|
47
|
+
"sha256": "5e078f5a8652ef4e612f4f5dc46df63f8291c29c7d8bd833ffbb1f1618b5340f",
|
|
48
|
+
"sha1": "d95db311e9651010cf516419119422f3f5934f43",
|
|
49
|
+
"md5": "0420cb1294b5188b73dfe3bbd9439c09"
|
|
50
50
|
}
|
|
51
51
|
]
|
|
52
52
|
},
|
|
@@ -359,13 +359,13 @@
|
|
|
359
359
|
],
|
|
360
360
|
"files": [
|
|
361
361
|
{
|
|
362
|
-
"name": "access-12.
|
|
363
|
-
"url": "access-12.
|
|
364
|
-
"size":
|
|
365
|
-
"sha512": "
|
|
366
|
-
"sha256": "
|
|
367
|
-
"sha1": "
|
|
368
|
-
"md5": "
|
|
362
|
+
"name": "access-12.22.0.aar",
|
|
363
|
+
"url": "access-12.22.0.aar",
|
|
364
|
+
"size": 3308249,
|
|
365
|
+
"sha512": "fc9bf446c86ce487d468f637f1d60e8db5ea179c4805a02434100c277058d464d4d76c65a67315b74df519639549ac371b8b283ee24ff185cacf8b70ce05361a",
|
|
366
|
+
"sha256": "5e078f5a8652ef4e612f4f5dc46df63f8291c29c7d8bd833ffbb1f1618b5340f",
|
|
367
|
+
"sha1": "d95db311e9651010cf516419119422f3f5934f43",
|
|
368
|
+
"md5": "0420cb1294b5188b73dfe3bbd9439c09"
|
|
369
369
|
}
|
|
370
370
|
]
|
|
371
371
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d2a22247141c1f97734d2f410354e98f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
38c311689a15be238ac1c8bd26131da69403ad85
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4623f35d8e9f7b17b39f922679539ec11045882eedd679e31c3c5245154c76c9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
30e07ae122dc18371be5a38aeb869aaa2e9bd9933952d0029cf1b2a39a29c0d82aa52d5a8519493795b68bff44129501d22230a6d24c8e17851c1329a3c30d5c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f8ff6783db64b571ea3baa3b25b5a48c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
675ae57323e623228edd83ec8f3e1842a3858581
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b2f378a97e9defbf74e5849dfd2b88a75584f90f1d22558979929ca2d8a452b4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
86b6a3506902fabd9e3819b7dc008ec5505e649c7cc722586021317bf40380f7752cb7353ec34b847a4a47e1294505c916936fcd4c2d28a2ef65ecf064ef9b60
|
package/android/sdklib/com/blue-id/access/{12.20.0/access-12.20.0.pom → 12.22.0/access-12.22.0.pom}
RENAMED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>com.blue-id</groupId>
|
|
11
11
|
<artifactId>access</artifactId>
|
|
12
|
-
<version>12.
|
|
12
|
+
<version>12.22.0</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>BlueID Access SDK</name>
|
|
15
15
|
<description>Access SDK to communicate with BlueID Access Devices</description>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5f88a95fec9791817c494be1809c3fa7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0d11a9d787f865723fd278f7f69bdc2db26e612c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
eea1716fe071980a2e7f50190c8c5a108fc68f7f560a16949a902c667d322c96
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
36dca2038f43186dedeb852a89ace35c8179dd5723756c83a19a38b6745f87a126974003f54195f1926c239c21ce60a450e60a0a5735d3f20714fa3f53a54cd7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
08e1853f3b49ea794d0922d1e780eeaa
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3e99687ae6b1d71a6c931a40b217b75d1c4bd2f8
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
edeb98e3251ae94d27f78fbba3ed6f834434bb51ee90c391db1abef1846b067e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
67d05129a4e33d1e5273c601321f105511c6ebc3332f5741a1a4f73b224827d7d8a3084bda700484208b74a502972622e1a745540580588525bb6afabec72127
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>com.blue-id</groupId>
|
|
4
4
|
<artifactId>access</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>12.
|
|
7
|
-
<release>12.
|
|
6
|
+
<latest>12.22.0</latest>
|
|
7
|
+
<release>12.22.0</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>12.
|
|
9
|
+
<version>12.22.0</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20260225185053</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
17fa3b7b52ca1ff3c06eeeb43e5d8982
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
f6abed4aad6973ab531a1c267a78f87abc8ea087
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
356ad1c3c41b623e058c187594fc8c6b66aa52c17b10b871c913aec2466a6bd0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
32fa86ac1cc4078908304566164cb1d602c2883e386b271608a56bd2c2aa8da5bdd36c61761022274df57bf9688f7a11c5039fd54abd4eae6bb327b5f0fe039b
|
|
@@ -59,9 +59,22 @@ public class BlueIDAccess {
|
|
|
59
59
|
return value;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
public void runCommand(String command, Object arg0, Object arg1, Object arg2, Function1<Map<String, ? extends Object>, Void> resolve,
|
|
62
|
+
public void runCommand(String command, Object arg0, Object arg1, Object arg2, Object arg3, Function1<Map<String, ? extends Object>, Void> resolve,
|
|
63
63
|
Function1<Map<String, ? extends Object>, Void> reject) {
|
|
64
64
|
|
|
65
|
+
if (arg3 != null) {
|
|
66
|
+
try {
|
|
67
|
+
for (var method : plugin.getClass().getMethods()) {
|
|
68
|
+
if (method.getName().equals("runCommand") && method.getParameterTypes().length == 7) {
|
|
69
|
+
method.invoke(plugin, command, arg0, arg1, arg2, arg3, resolve, reject);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
} catch (Throwable error) {
|
|
74
|
+
Log.w("Capacitor:", "Falling back to 3-arg runCommand due to reflection error", error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
65
78
|
plugin.runCommand(command, arg0, arg1, arg2, resolve, reject);
|
|
66
79
|
}
|
|
67
80
|
|
|
@@ -64,12 +64,13 @@ public class BlueIDAccessPlugin extends Plugin implements BluePluginDelegate {
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
Object arg0 = null, arg1 = null, arg2 = null;
|
|
67
|
+
Object arg0 = null, arg1 = null, arg2 = null, arg3 = null;
|
|
68
68
|
|
|
69
69
|
try {
|
|
70
70
|
arg0 = call.getData().get("arg0");
|
|
71
71
|
arg1 = call.getData().get("arg1");
|
|
72
72
|
arg2 = call.getData().get("arg2");
|
|
73
|
+
arg3 = call.getData().get("arg3");
|
|
73
74
|
} catch (JSONException e) {
|
|
74
75
|
call.reject(e.getMessage());
|
|
75
76
|
}
|
|
@@ -86,9 +87,12 @@ public class BlueIDAccessPlugin extends Plugin implements BluePluginDelegate {
|
|
|
86
87
|
if (arg2 != null && arg2.toString().equals("null")){ // this is so important don't remove this
|
|
87
88
|
arg2 = null;
|
|
88
89
|
}
|
|
90
|
+
if (arg3 != null && arg3.toString().equals("null")){ // this is so important don't remove this
|
|
91
|
+
arg3 = null;
|
|
92
|
+
}
|
|
89
93
|
|
|
90
94
|
|
|
91
|
-
implementation.runCommand(command, arg0, arg1, arg2, stringObjectMap -> {
|
|
95
|
+
implementation.runCommand(command, arg0, arg1, arg2, arg3, stringObjectMap -> {
|
|
92
96
|
|
|
93
97
|
if (stringObjectMap != null) {
|
|
94
98
|
JSONObject result = new JSONObject(stringObjectMap);
|
package/dist/docs.json
CHANGED
package/dist/esm/interop.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface RunCommandOptions {
|
|
|
13
13
|
arg0: any | null;
|
|
14
14
|
arg1: any | null;
|
|
15
15
|
arg2: any | null;
|
|
16
|
+
arg3: any | null;
|
|
16
17
|
}
|
|
17
18
|
export interface TerminalRunOptions {
|
|
18
19
|
identityID?: string;
|
|
@@ -31,7 +32,7 @@ export declare class BlueIDAccessInterop {
|
|
|
31
32
|
terminalRunFunc: (options: TerminalRunOptions) => Promise<TerminalRunResult>;
|
|
32
33
|
addListenerFunc: (event: string, callback: (data: any) => void) => Promise<BlueAccessListener>;
|
|
33
34
|
constructor(runCommandFunc: (options: RunCommandOptions) => Promise<any>, terminalRunFunc: (options: TerminalRunOptions) => Promise<TerminalRunResult>, addListenerFunc: (event: string, callback: (data: any) => void) => Promise<BlueAccessListener>);
|
|
34
|
-
runCommand(command: string, arg0?: any | null, arg1?: any | null, arg2?: any | null): Promise<any | void>;
|
|
35
|
+
runCommand(command: string, arg0?: any | null, arg1?: any | null, arg2?: any | null, arg3?: any | null): Promise<any | void>;
|
|
35
36
|
terminalRunAll(identityID: string | null, deviceID: string, requests: BlueAccessTerminalRequest[], timeoutSeconds?: number): Promise<BlueAccessTerminalResult[]>;
|
|
36
37
|
terminalRun(identityID: string | null, deviceID: string, request: BlueAccessTerminalRequest, timeoutSeconds?: number): Promise<BlueAccessTerminalResult>;
|
|
37
38
|
addListener(event: string, callback: (data: any) => void): Promise<BlueAccessListener>;
|
package/dist/esm/interop.js
CHANGED
|
@@ -54,7 +54,7 @@ export class BlueIDAccessInterop {
|
|
|
54
54
|
this.terminalRunFunc = terminalRunFunc;
|
|
55
55
|
this.addListenerFunc = addListenerFunc;
|
|
56
56
|
}
|
|
57
|
-
async runCommand(command, arg0 = null, arg1 = null, arg2 = null) {
|
|
57
|
+
async runCommand(command, arg0 = null, arg1 = null, arg2 = null, arg3 = null) {
|
|
58
58
|
if (!command) {
|
|
59
59
|
throw new Error("Missing valid command");
|
|
60
60
|
}
|
|
@@ -64,6 +64,7 @@ export class BlueIDAccessInterop {
|
|
|
64
64
|
arg0: encodeArgument(arg0),
|
|
65
65
|
arg1: encodeArgument(arg1),
|
|
66
66
|
arg2: encodeArgument(arg2),
|
|
67
|
+
arg3: encodeArgument(arg3),
|
|
67
68
|
});
|
|
68
69
|
console.log('Running command with result : ' + JSON.stringify(result));
|
|
69
70
|
if (!result) {
|
package/dist/esm/interop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interop.js","sourceRoot":"","sources":["../../src/interop.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,kFAAkF;AAClF,EAAE;;;;;;;;;;;;AAEF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAE9C,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU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,cAAc,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;QAE3F,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,MAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxC,CAAC;QAED,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa,EAAE,QAA6B;QAC5D,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC,IAAS,EAAE,EAAE;gBAC/C,IAAI,SAAS,GAAG,IAAI,CAAC;gBAErB,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,eAAe,CAAA,EAAE,CAAC;oBAClD,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,eAAe,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;gBACtE,CAAC;gBAED,QAAQ,CAAC,SAAS,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;QACL,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC","sourcesContent":["//\n// Utilities shared for typescript json-interfaces like react-native and capacitor\n//\n\nimport { Message, protoDelimited } from \"@bufbuild/protobuf\";\n\nimport * as base64 from \"./base64\";\n\nimport * as BlueCore from \"./BlueCore_pb\";\nimport * as BlueLock from \"./BlueLock_pb\";\nimport * as BlueSDK from \"./BlueSDK_pb\";\nimport * as BlueSystem from \"./BlueSystem_pb\";\n\nconst protoModules = [BlueCore, BlueLock, BlueSDK, BlueSystem];\n\nconst getMessageClass = (messageTypeName: string): any => {\n for (const protoModule of protoModules) {\n const result = (protoModule as any)[messageTypeName];\n if (result) {\n return result;\n }\n }\n\n throw new Error(\n `No message class found for message type '${messageTypeName}'`\n );\n};\n\nconst encodeArgument = (arg: any | null): any => {\n if (arg instanceof Message) {\n const binary = protoDelimited.enc(arg);\n\n const binaryString: string[] = [];\n for (let i = 0; i < binary.length; i++) {\n binaryString.push(String.fromCharCode(binary[i]!));\n }\n\n const base64String = base64.encode(binaryString.join(\"\"));\n return `message:${base64String}`;\n }\n return arg;\n};\n\nconst decodeResult = (\n messageTypeName: string,\n messageString: string | null\n): any => {\n const MessageClass = getMessageClass(messageTypeName);\n\n if (messageString == null || !messageString.startsWith(\"message:\")) {\n throw new Error(`Invalid message to decode: '${messageString}'`);\n }\n\n const binary = Uint8Array.from(\n base64.decode(messageString.substring(\"message:\".length)),\n (v: string) => v.charCodeAt(0)\n );\n\n return protoDelimited.dec(MessageClass, binary);\n};\n\nexport interface BlueAccessTerminalRequest {\n action: string;\n data: any | null;\n resultMessageTypeName: string | null;\n}\n\nexport interface BlueAccessTerminalResult {\n statusCode: BlueCore.BlueReturnCode;\n data: any | null;\n}\n\nexport interface RunCommandOptions {\n command: string;\n arg0: any | null;\n arg1: any | null;\n arg2: any | null;\n}\n\nexport interface TerminalRunOptions {\n identityID?: string;\n deviceID: string;\n timeoutSeconds: number;\n requests: BlueAccessTerminalRequest[];\n}\n\nexport interface TerminalRunResult {\n results: BlueAccessTerminalResult[];\n}\n\nexport interface BlueAccessListener {\n remove(): Promise<void>;\n}\n\nexport class BlueIDAccessInterop {\n runCommandFunc: (options: RunCommandOptions) => Promise<any>;\n terminalRunFunc: (options: TerminalRunOptions) => Promise<TerminalRunResult>;\n addListenerFunc: (event: string, callback: (data: any) => void) => Promise<BlueAccessListener>;\n\n constructor(\n runCommandFunc: (options: RunCommandOptions) => Promise<any>,\n terminalRunFunc: (options: TerminalRunOptions) => Promise<TerminalRunResult>,\n addListenerFunc: (event: string, callback: (data: any) => void) => Promise<BlueAccessListener>\n ) {\n this.runCommandFunc = runCommandFunc;\n this.terminalRunFunc = terminalRunFunc;\n this.addListenerFunc = addListenerFunc;\n }\n\n async runCommand(\n command: string,\n arg0: any | null = null,\n arg1: any | null = null,\n arg2: any | null = null\n ): Promise<any | void> {\n if (!command) {\n throw new Error(\"Missing valid command\");\n }\n\n console.log('Starting command: '+ JSON.stringify(command));\n\n const result = await this.runCommandFunc({\n command,\n arg0: encodeArgument(arg0),\n arg1: encodeArgument(arg1),\n arg2: encodeArgument(arg2),\n });\n\n console.log('Running command with result : '+ JSON.stringify(result));\n\n if (!result) {\n return null;\n }\n\n if (result.data && result.messageTypeName) {\n return decodeResult(result.messageTypeName, result.data);\n }\n\n console.log('result from interop '+ command + ' : ' + JSON.stringify(result.data));\n\n return result.data;\n }\n\n async terminalRunAll(\n identityID: string | null,\n deviceID: string,\n requests: BlueAccessTerminalRequest[],\n timeoutSeconds = 10.0,\n ): Promise<BlueAccessTerminalResult[]> {\n if (!deviceID) {\n throw new Error(\"Invalid deviceID\");\n }\n\n if (timeoutSeconds <= 0) {\n throw new Error(\"Invalid timeout\");\n }\n\n if (!requests.length) {\n throw new Error(\"Invalid requests\");\n }\n\n const convertedRequests: BlueAccessTerminalRequest[] = requests.map(\n ({ data, ...otherProps }) => ({\n ...otherProps,\n data: encodeArgument(data),\n })\n );\n\n const runResult = await this.terminalRunFunc({\n identityID: identityID || undefined,\n deviceID,\n timeoutSeconds,\n requests: convertedRequests,\n });\n\n if (!runResult?.results?.length) {\n throw new Error(\"No results received\");\n }\n\n const results: BlueAccessTerminalResult[] = [];\n\n for (let index = 0; index < runResult.results.length; index += 1) {\n const request = convertedRequests[index];\n\n if (!request) {\n throw new Error(\"Invalid request\");\n }\n\n const result = runResult.results[index];\n\n if (!result) {\n throw new Error(\"Invalid result\");\n }\n\n if (request.resultMessageTypeName) {\n results.push({\n statusCode: result.statusCode,\n data: decodeResult(request.resultMessageTypeName, result.data),\n });\n } else if (\n typeof result.data === \"string\" &&\n result.data.startsWith(\"message:\") &&\n result.data !== \"message:\"\n ) {\n throw new Error(\n `Missing resultMessageTypeName for action '${request.action}'`\n );\n } else {\n results.push({ statusCode: result.statusCode, data: result.data });\n }\n }\n\n return results;\n }\n\n async terminalRun(\n identityID: string | null,\n deviceID: string,\n request: BlueAccessTerminalRequest,\n timeoutSeconds = 10.0,\n ): Promise<BlueAccessTerminalResult> {\n const results = await this.terminalRunAll(identityID, deviceID, [request], timeoutSeconds);\n \n if (results?.length !== 1 || !results[0]) {\n throw new Error('Unexpected results');\n }\n\n return results[0];\n }\n\n async addListener(event: string, callback: (data: any) => void): Promise<BlueAccessListener> {\n if (this.addListenerFunc) {\n return this.addListenerFunc(event, (data: any) => {\n let eventData = data;\n\n if (eventData?.data && eventData?.messageTypeName) {\n eventData = decodeResult(eventData.messageTypeName, eventData.data);\n }\n\n callback(eventData);\n });\n }\n throw new Error('No listeners supported.');\n }\n}\n\nexport * from \"./BlueCore_pb\";\nexport * from \"./BlueLock_pb\";\nexport * from \"./BlueSDK_pb\";\nexport * from \"./BlueSystem_pb\";\n"]}
|
|
1
|
+
{"version":3,"file":"interop.js","sourceRoot":"","sources":["../../src/interop.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,kFAAkF;AAClF,EAAE;;;;;;;;;;;;AAEF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAE9C,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU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ClC,cAAc,GAAG,IAAI;QAErB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;QAE3F,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,MAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxC,CAAC;QAED,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa,EAAE,QAA6B;QAC5D,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC,IAAS,EAAE,EAAE;gBAC/C,IAAI,SAAS,GAAG,IAAI,CAAC;gBAErB,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,eAAe,CAAA,EAAE,CAAC;oBAClD,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,eAAe,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;gBACtE,CAAC;gBAED,QAAQ,CAAC,SAAS,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;QACL,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC","sourcesContent":["//\n// Utilities shared for typescript json-interfaces like react-native and capacitor\n//\n\nimport { Message, protoDelimited } from \"@bufbuild/protobuf\";\n\nimport * as base64 from \"./base64\";\n\nimport * as BlueCore from \"./BlueCore_pb\";\nimport * as BlueLock from \"./BlueLock_pb\";\nimport * as BlueSDK from \"./BlueSDK_pb\";\nimport * as BlueSystem from \"./BlueSystem_pb\";\n\nconst protoModules = [BlueCore, BlueLock, BlueSDK, BlueSystem];\n\nconst getMessageClass = (messageTypeName: string): any => {\n for (const protoModule of protoModules) {\n const result = (protoModule as any)[messageTypeName];\n if (result) {\n return result;\n }\n }\n\n throw new Error(\n `No message class found for message type '${messageTypeName}'`\n );\n};\n\nconst encodeArgument = (arg: any | null): any => {\n if (arg instanceof Message) {\n const binary = protoDelimited.enc(arg);\n\n const binaryString: string[] = [];\n for (let i = 0; i < binary.length; i++) {\n binaryString.push(String.fromCharCode(binary[i]!));\n }\n\n const base64String = base64.encode(binaryString.join(\"\"));\n return `message:${base64String}`;\n }\n return arg;\n};\n\nconst decodeResult = (\n messageTypeName: string,\n messageString: string | null\n): any => {\n const MessageClass = getMessageClass(messageTypeName);\n\n if (messageString == null || !messageString.startsWith(\"message:\")) {\n throw new Error(`Invalid message to decode: '${messageString}'`);\n }\n\n const binary = Uint8Array.from(\n base64.decode(messageString.substring(\"message:\".length)),\n (v: string) => v.charCodeAt(0)\n );\n\n return protoDelimited.dec(MessageClass, binary);\n};\n\nexport interface BlueAccessTerminalRequest {\n action: string;\n data: any | null;\n resultMessageTypeName: string | null;\n}\n\nexport interface BlueAccessTerminalResult {\n statusCode: BlueCore.BlueReturnCode;\n data: any | null;\n}\n\nexport interface RunCommandOptions {\n command: string;\n arg0: any | null;\n arg1: any | null;\n arg2: any | null;\n arg3: any | null;\n}\n\nexport interface TerminalRunOptions {\n identityID?: string;\n deviceID: string;\n timeoutSeconds: number;\n requests: BlueAccessTerminalRequest[];\n}\n\nexport interface TerminalRunResult {\n results: BlueAccessTerminalResult[];\n}\n\nexport interface BlueAccessListener {\n remove(): Promise<void>;\n}\n\nexport class BlueIDAccessInterop {\n runCommandFunc: (options: RunCommandOptions) => Promise<any>;\n terminalRunFunc: (options: TerminalRunOptions) => Promise<TerminalRunResult>;\n addListenerFunc: (event: string, callback: (data: any) => void) => Promise<BlueAccessListener>;\n\n constructor(\n runCommandFunc: (options: RunCommandOptions) => Promise<any>,\n terminalRunFunc: (options: TerminalRunOptions) => Promise<TerminalRunResult>,\n addListenerFunc: (event: string, callback: (data: any) => void) => Promise<BlueAccessListener>\n ) {\n this.runCommandFunc = runCommandFunc;\n this.terminalRunFunc = terminalRunFunc;\n this.addListenerFunc = addListenerFunc;\n }\n\n async runCommand(\n command: string,\n arg0: any | null = null,\n arg1: any | null = null,\n arg2: any | null = null,\n arg3: any | null = null\n ): Promise<any | void> {\n if (!command) {\n throw new Error(\"Missing valid command\");\n }\n\n console.log('Starting command: '+ JSON.stringify(command));\n\n const result = await this.runCommandFunc({\n command,\n arg0: encodeArgument(arg0),\n arg1: encodeArgument(arg1),\n arg2: encodeArgument(arg2),\n arg3: encodeArgument(arg3),\n });\n\n console.log('Running command with result : '+ JSON.stringify(result));\n\n if (!result) {\n return null;\n }\n\n if (result.data && result.messageTypeName) {\n return decodeResult(result.messageTypeName, result.data);\n }\n\n console.log('result from interop '+ command + ' : ' + JSON.stringify(result.data));\n\n return result.data;\n }\n\n async terminalRunAll(\n identityID: string | null,\n deviceID: string,\n requests: BlueAccessTerminalRequest[],\n timeoutSeconds = 10.0,\n ): Promise<BlueAccessTerminalResult[]> {\n if (!deviceID) {\n throw new Error(\"Invalid deviceID\");\n }\n\n if (timeoutSeconds <= 0) {\n throw new Error(\"Invalid timeout\");\n }\n\n if (!requests.length) {\n throw new Error(\"Invalid requests\");\n }\n\n const convertedRequests: BlueAccessTerminalRequest[] = requests.map(\n ({ data, ...otherProps }) => ({\n ...otherProps,\n data: encodeArgument(data),\n })\n );\n\n const runResult = await this.terminalRunFunc({\n identityID: identityID || undefined,\n deviceID,\n timeoutSeconds,\n requests: convertedRequests,\n });\n\n if (!runResult?.results?.length) {\n throw new Error(\"No results received\");\n }\n\n const results: BlueAccessTerminalResult[] = [];\n\n for (let index = 0; index < runResult.results.length; index += 1) {\n const request = convertedRequests[index];\n\n if (!request) {\n throw new Error(\"Invalid request\");\n }\n\n const result = runResult.results[index];\n\n if (!result) {\n throw new Error(\"Invalid result\");\n }\n\n if (request.resultMessageTypeName) {\n results.push({\n statusCode: result.statusCode,\n data: decodeResult(request.resultMessageTypeName, result.data),\n });\n } else if (\n typeof result.data === \"string\" &&\n result.data.startsWith(\"message:\") &&\n result.data !== \"message:\"\n ) {\n throw new Error(\n `Missing resultMessageTypeName for action '${request.action}'`\n );\n } else {\n results.push({ statusCode: result.statusCode, data: result.data });\n }\n }\n\n return results;\n }\n\n async terminalRun(\n identityID: string | null,\n deviceID: string,\n request: BlueAccessTerminalRequest,\n timeoutSeconds = 10.0,\n ): Promise<BlueAccessTerminalResult> {\n const results = await this.terminalRunAll(identityID, deviceID, [request], timeoutSeconds);\n \n if (results?.length !== 1 || !results[0]) {\n throw new Error('Unexpected results');\n }\n\n return results[0];\n }\n\n async addListener(event: string, callback: (data: any) => void): Promise<BlueAccessListener> {\n if (this.addListenerFunc) {\n return this.addListenerFunc(event, (data: any) => {\n let eventData = data;\n\n if (eventData?.data && eventData?.messageTypeName) {\n eventData = decodeResult(eventData.messageTypeName, eventData.data);\n }\n\n callback(eventData);\n });\n }\n throw new Error('No listeners supported.');\n }\n}\n\nexport * from \"./BlueCore_pb\";\nexport * from \"./BlueLock_pb\";\nexport * from \"./BlueSDK_pb\";\nexport * from \"./BlueSystem_pb\";\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -4811,7 +4811,7 @@ class BlueIDAccessInterop {
|
|
|
4811
4811
|
this.terminalRunFunc = terminalRunFunc;
|
|
4812
4812
|
this.addListenerFunc = addListenerFunc;
|
|
4813
4813
|
}
|
|
4814
|
-
async runCommand(command, arg0 = null, arg1 = null, arg2 = null) {
|
|
4814
|
+
async runCommand(command, arg0 = null, arg1 = null, arg2 = null, arg3 = null) {
|
|
4815
4815
|
if (!command) {
|
|
4816
4816
|
throw new Error("Missing valid command");
|
|
4817
4817
|
}
|
|
@@ -4821,6 +4821,7 @@ class BlueIDAccessInterop {
|
|
|
4821
4821
|
arg0: encodeArgument(arg0),
|
|
4822
4822
|
arg1: encodeArgument(arg1),
|
|
4823
4823
|
arg2: encodeArgument(arg2),
|
|
4824
|
+
arg3: encodeArgument(arg3),
|
|
4824
4825
|
});
|
|
4825
4826
|
console.log('Running command with result : ' + JSON.stringify(result));
|
|
4826
4827
|
if (!result) {
|