@viamrobotics/sdk 0.0.27-alpha.0 → 0.0.27-alpha.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/dist/main.es.js +12 -12
- package/dist/main.umd.js +1 -1
- package/package.json +1 -1
package/dist/main.es.js
CHANGED
|
@@ -225129,18 +225129,18 @@ class RobotClient {
|
|
|
225129
225129
|
}
|
|
225130
225130
|
}
|
|
225131
225131
|
const isLocalConnection = (o) => o.includes(".local"), dialDirect = async (o) => {
|
|
225132
|
-
if (console.
|
|
225132
|
+
if (console.debug("dialing via gRPC..."), !isLocalConnection(o.host))
|
|
225133
225133
|
throw new Error(
|
|
225134
225134
|
`cannot dial "${o.host}" directly, please use a local url instead.`
|
|
225135
225135
|
);
|
|
225136
225136
|
const e = new RobotClient(o.host);
|
|
225137
225137
|
let r;
|
|
225138
|
-
return o.
|
|
225139
|
-
payload: o.
|
|
225140
|
-
type:
|
|
225141
|
-
}), await e.connect(o.authEntity, r), console.
|
|
225138
|
+
return o.credential && (r = {
|
|
225139
|
+
payload: o.credential.payload,
|
|
225140
|
+
type: o.credential.type
|
|
225141
|
+
}), await e.connect(o.authEntity, r), console.debug("connected via gRPC"), e;
|
|
225142
225142
|
}, dialWebRTC = async (o) => {
|
|
225143
|
-
console.
|
|
225143
|
+
console.debug("dialing via WebRTC...");
|
|
225144
225144
|
const e = o.host, r = o.signalingAddress, t = { iceServers: o.iceServers }, n = {
|
|
225145
225145
|
enabled: !0,
|
|
225146
225146
|
host: o.host,
|
|
@@ -225148,10 +225148,10 @@ const isLocalConnection = (o) => o.includes(".local"), dialDirect = async (o) =>
|
|
|
225148
225148
|
rtcConfig: t
|
|
225149
225149
|
}, i = new RobotClient(e, n);
|
|
225150
225150
|
let s;
|
|
225151
|
-
return o.
|
|
225152
|
-
payload: o.
|
|
225153
|
-
type:
|
|
225154
|
-
}), await i.connect(e, s), console.
|
|
225151
|
+
return o.credential && (s = {
|
|
225152
|
+
payload: o.credential.payload,
|
|
225153
|
+
type: o.credential.payload
|
|
225154
|
+
}), await i.connect(e, s), console.debug("connected via WebRTC"), i;
|
|
225155
225155
|
}, isDialWebRTCConf = (o) => {
|
|
225156
225156
|
const e = o;
|
|
225157
225157
|
return !(typeof e.signalingAddress != "string" || !(e.iceServers instanceof Array));
|
|
@@ -225161,13 +225161,13 @@ const isLocalConnection = (o) => o.includes(".local"), dialDirect = async (o) =>
|
|
|
225161
225161
|
try {
|
|
225162
225162
|
e = await dialWebRTC(o);
|
|
225163
225163
|
} catch {
|
|
225164
|
-
console.
|
|
225164
|
+
console.debug("failed to connect via WebRTC...");
|
|
225165
225165
|
}
|
|
225166
225166
|
if (!e)
|
|
225167
225167
|
try {
|
|
225168
225168
|
e = await dialDirect(o);
|
|
225169
225169
|
} catch {
|
|
225170
|
-
console.
|
|
225170
|
+
console.debug("failed to connect via gRPC...");
|
|
225171
225171
|
}
|
|
225172
225172
|
if (!e)
|
|
225173
225173
|
throw new Error("failed to connect to robot");
|