@sjhmars/happy-bridge 0.2.1 → 0.2.2
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/client.js +9 -9
- package/lib/index.js +11 -4
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -17,21 +17,21 @@ window.__ModuleLoader__.load({
|
|
|
17
17
|
document.head.appendChild(tag);
|
|
18
18
|
}
|
|
19
19
|
var HappyBridgeCard_module_css_default = {
|
|
20
|
-
"error": "l9rBEq_error",
|
|
21
20
|
"row": "l9rBEq_row",
|
|
22
|
-
"chevron": "l9rBEq_chevron",
|
|
23
|
-
"body": "l9rBEq_body",
|
|
24
|
-
"button": "l9rBEq_button",
|
|
25
21
|
"qr": "l9rBEq_qr",
|
|
22
|
+
"headText": "l9rBEq_headText",
|
|
26
23
|
"status": "l9rBEq_status",
|
|
27
|
-
"
|
|
24
|
+
"description": "l9rBEq_description",
|
|
28
25
|
"name": "l9rBEq_name",
|
|
26
|
+
"label": "l9rBEq_label",
|
|
27
|
+
"button": "l9rBEq_button",
|
|
29
28
|
"header": "l9rBEq_header",
|
|
29
|
+
"card": "l9rBEq_card",
|
|
30
|
+
"checkbox": "l9rBEq_checkbox",
|
|
31
|
+
"chevron": "l9rBEq_chevron",
|
|
32
|
+
"body": "l9rBEq_body",
|
|
30
33
|
"select": "l9rBEq_select",
|
|
31
|
-
"
|
|
32
|
-
"label": "l9rBEq_label",
|
|
33
|
-
"headText": "l9rBEq_headText",
|
|
34
|
-
"card": "l9rBEq_card"
|
|
34
|
+
"error": "l9rBEq_error"
|
|
35
35
|
};
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/client/HappyBridgeCard.tsx
|
package/lib/index.js
CHANGED
|
@@ -3947,6 +3947,8 @@ var HappyBridge = class {
|
|
|
3947
3947
|
if (link.alwaysAllow.has(req.toolName)) return "allowed-once";
|
|
3948
3948
|
if (!grantAtLeast(this.config.remoteGrant, "approve")) return next();
|
|
3949
3949
|
const id = req.callId;
|
|
3950
|
+
const controller = new AbortController();
|
|
3951
|
+
req.signal = req.signal === void 0 ? controller.signal : AbortSignal.any([req.signal, controller.signal]);
|
|
3950
3952
|
this.startTool(link, id, req.toolName, req.reason === void 0 ? {} : { reason: req.reason });
|
|
3951
3953
|
const phone = new Promise((resolve) => {
|
|
3952
3954
|
link.pendingHuman = {
|
|
@@ -3957,13 +3959,18 @@ var HappyBridge = class {
|
|
|
3957
3959
|
};
|
|
3958
3960
|
});
|
|
3959
3961
|
this.pushRequests(link);
|
|
3960
|
-
const
|
|
3961
|
-
src: "
|
|
3962
|
+
const web = next().then((outcome) => ({
|
|
3963
|
+
src: "web",
|
|
3962
3964
|
outcome
|
|
3963
|
-
})
|
|
3965
|
+
}), () => ({
|
|
3964
3966
|
src: "web",
|
|
3967
|
+
outcome: "cancelled"
|
|
3968
|
+
}));
|
|
3969
|
+
const winner = await Promise.race([phone.then((outcome) => ({
|
|
3970
|
+
src: "phone",
|
|
3965
3971
|
outcome
|
|
3966
|
-
}))]);
|
|
3972
|
+
})), web]);
|
|
3973
|
+
if (winner.src === "phone") controller.abort();
|
|
3967
3974
|
if (winner.src === "web" && link.pendingHuman?.kind === "approval" && link.pendingHuman.id === id) {
|
|
3968
3975
|
delete link.pendingHuman;
|
|
3969
3976
|
this.clearRequest(link, id, winner.outcome === "allowed-once" ? "approved" : "canceled");
|
package/package.json
CHANGED