@stream-io/video-client 0.0.5 → 0.0.6
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/CHANGELOG.md +7 -0
- package/dist/index.browser.es.js +41 -4
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +41 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +41 -4
- package/dist/index.es.js.map +1 -1
- package/dist/src/StreamVideoClient.d.ts +11 -0
- package/dist/src/coordinator/connection/client.d.ts +11 -0
- package/package.json +1 -1
- package/src/StreamVideoClient.ts +19 -2
- package/src/coordinator/connection/client.ts +39 -1
package/dist/index.cjs.js
CHANGED
|
@@ -10998,7 +10998,7 @@ class StreamClient {
|
|
|
10998
10998
|
}
|
|
10999
10999
|
getUserAgent() {
|
|
11000
11000
|
return (this.userAgent ||
|
|
11001
|
-
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.
|
|
11001
|
+
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.5"}`);
|
|
11002
11002
|
}
|
|
11003
11003
|
setUserAgent(userAgent) {
|
|
11004
11004
|
this.userAgent = userAgent;
|
|
@@ -11032,6 +11032,32 @@ class StreamClient {
|
|
|
11032
11032
|
createAbortControllerForNextRequest() {
|
|
11033
11033
|
return (this.nextRequestAbortController = new AbortController());
|
|
11034
11034
|
}
|
|
11035
|
+
/**
|
|
11036
|
+
* createToken - Creates a token to authenticate this user. This function is used server side.
|
|
11037
|
+
* The resulting token should be passed to the client side when the users registers or logs in.
|
|
11038
|
+
*
|
|
11039
|
+
* @param {string} userID The User ID
|
|
11040
|
+
* @param {number} [exp] The expiration time for the token expressed in the number of seconds since the epoch
|
|
11041
|
+
* @param call_cids for anonymous tokens you have to provide the call cids the use can join
|
|
11042
|
+
*
|
|
11043
|
+
* @return {string} Returns a token
|
|
11044
|
+
*/
|
|
11045
|
+
createToken(userID, exp, iat, call_cids) {
|
|
11046
|
+
if (this.secret == null) {
|
|
11047
|
+
throw Error(`tokens can only be created server-side using the API Secret`);
|
|
11048
|
+
}
|
|
11049
|
+
const extra = {};
|
|
11050
|
+
if (exp) {
|
|
11051
|
+
extra.exp = exp;
|
|
11052
|
+
}
|
|
11053
|
+
if (iat) {
|
|
11054
|
+
extra.iat = iat;
|
|
11055
|
+
}
|
|
11056
|
+
if (call_cids) {
|
|
11057
|
+
extra.call_cids = call_cids;
|
|
11058
|
+
}
|
|
11059
|
+
return JWTUserToken(this.secret, userID, extra, {});
|
|
11060
|
+
}
|
|
11035
11061
|
}
|
|
11036
11062
|
|
|
11037
11063
|
/**
|
|
@@ -11269,9 +11295,7 @@ class StreamVideoClient {
|
|
|
11269
11295
|
this.removeDevice = (id, userID) => __awaiter(this, void 0, void 0, function* () {
|
|
11270
11296
|
return yield this.streamClient.delete('/devices', Object.assign({ id }, (userID ? { user_id: userID } : {})));
|
|
11271
11297
|
});
|
|
11272
|
-
this.streamClient = new StreamClient(apiKey, Object.assign({
|
|
11273
|
-
// FIXME: OL: fix SSR.
|
|
11274
|
-
browser: true, persistUserOnConnectionFailure: true }, opts));
|
|
11298
|
+
this.streamClient = new StreamClient(apiKey, Object.assign({ persistUserOnConnectionFailure: true }, opts));
|
|
11275
11299
|
this.writeableStateStore = new StreamVideoWriteableStateStore();
|
|
11276
11300
|
this.readOnlyStateStore = new StreamVideoReadOnlyStateStore(this.writeableStateStore);
|
|
11277
11301
|
}
|
|
@@ -11288,6 +11312,19 @@ class StreamVideoClient {
|
|
|
11288
11312
|
return yield this.addDevice(id, push_provider, push_provider_name, userID, true);
|
|
11289
11313
|
});
|
|
11290
11314
|
}
|
|
11315
|
+
/**
|
|
11316
|
+
* createToken - Creates a token to authenticate this user. This function is used server side.
|
|
11317
|
+
* The resulting token should be passed to the client side when the users registers or logs in.
|
|
11318
|
+
*
|
|
11319
|
+
* @param {string} userID The User ID
|
|
11320
|
+
* @param {number} [exp] The expiration time for the token expressed in the number of seconds since the epoch
|
|
11321
|
+
* @param call_cids for anonymous tokens you have to provide the call cids the use can join
|
|
11322
|
+
*
|
|
11323
|
+
* @return {string} Returns a token
|
|
11324
|
+
*/
|
|
11325
|
+
createToken(userID, exp, iat, call_cids) {
|
|
11326
|
+
return this.streamClient.createToken(userID, exp, iat, call_cids);
|
|
11327
|
+
}
|
|
11291
11328
|
}
|
|
11292
11329
|
|
|
11293
11330
|
const getDevices = (constraints) => {
|