@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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.0.6](https://github.com/GetStream/stream-video-js/compare/client0.0.5...client0.0.6) (2023-06-07)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* Add token creation to client ([#607](https://github.com/GetStream/stream-video-js/issues/607)) ([5f95420](https://github.com/GetStream/stream-video-js/commit/5f9542029a64ddaf6ee7912ea7b364fc74c93bf0))
|
|
11
|
+
|
|
5
12
|
### [0.0.5](https://github.com/GetStream/stream-video-js/compare/client0.0.4...client0.0.5) (2023-06-06)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.browser.es.js
CHANGED
|
@@ -10993,7 +10993,7 @@ class StreamClient {
|
|
|
10993
10993
|
}
|
|
10994
10994
|
getUserAgent() {
|
|
10995
10995
|
return (this.userAgent ||
|
|
10996
|
-
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.
|
|
10996
|
+
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.5"}`);
|
|
10997
10997
|
}
|
|
10998
10998
|
setUserAgent(userAgent) {
|
|
10999
10999
|
this.userAgent = userAgent;
|
|
@@ -11027,6 +11027,32 @@ class StreamClient {
|
|
|
11027
11027
|
createAbortControllerForNextRequest() {
|
|
11028
11028
|
return (this.nextRequestAbortController = new AbortController());
|
|
11029
11029
|
}
|
|
11030
|
+
/**
|
|
11031
|
+
* createToken - Creates a token to authenticate this user. This function is used server side.
|
|
11032
|
+
* The resulting token should be passed to the client side when the users registers or logs in.
|
|
11033
|
+
*
|
|
11034
|
+
* @param {string} userID The User ID
|
|
11035
|
+
* @param {number} [exp] The expiration time for the token expressed in the number of seconds since the epoch
|
|
11036
|
+
* @param call_cids for anonymous tokens you have to provide the call cids the use can join
|
|
11037
|
+
*
|
|
11038
|
+
* @return {string} Returns a token
|
|
11039
|
+
*/
|
|
11040
|
+
createToken(userID, exp, iat, call_cids) {
|
|
11041
|
+
if (this.secret == null) {
|
|
11042
|
+
throw Error(`tokens can only be created server-side using the API Secret`);
|
|
11043
|
+
}
|
|
11044
|
+
const extra = {};
|
|
11045
|
+
if (exp) {
|
|
11046
|
+
extra.exp = exp;
|
|
11047
|
+
}
|
|
11048
|
+
if (iat) {
|
|
11049
|
+
extra.iat = iat;
|
|
11050
|
+
}
|
|
11051
|
+
if (call_cids) {
|
|
11052
|
+
extra.call_cids = call_cids;
|
|
11053
|
+
}
|
|
11054
|
+
return JWTUserToken(this.secret, userID, extra, {});
|
|
11055
|
+
}
|
|
11030
11056
|
}
|
|
11031
11057
|
|
|
11032
11058
|
/**
|
|
@@ -11264,9 +11290,7 @@ class StreamVideoClient {
|
|
|
11264
11290
|
this.removeDevice = (id, userID) => __awaiter(this, void 0, void 0, function* () {
|
|
11265
11291
|
return yield this.streamClient.delete('/devices', Object.assign({ id }, (userID ? { user_id: userID } : {})));
|
|
11266
11292
|
});
|
|
11267
|
-
this.streamClient = new StreamClient(apiKey, Object.assign({
|
|
11268
|
-
// FIXME: OL: fix SSR.
|
|
11269
|
-
browser: true, persistUserOnConnectionFailure: true }, opts));
|
|
11293
|
+
this.streamClient = new StreamClient(apiKey, Object.assign({ persistUserOnConnectionFailure: true }, opts));
|
|
11270
11294
|
this.writeableStateStore = new StreamVideoWriteableStateStore();
|
|
11271
11295
|
this.readOnlyStateStore = new StreamVideoReadOnlyStateStore(this.writeableStateStore);
|
|
11272
11296
|
}
|
|
@@ -11283,6 +11307,19 @@ class StreamVideoClient {
|
|
|
11283
11307
|
return yield this.addDevice(id, push_provider, push_provider_name, userID, true);
|
|
11284
11308
|
});
|
|
11285
11309
|
}
|
|
11310
|
+
/**
|
|
11311
|
+
* createToken - Creates a token to authenticate this user. This function is used server side.
|
|
11312
|
+
* The resulting token should be passed to the client side when the users registers or logs in.
|
|
11313
|
+
*
|
|
11314
|
+
* @param {string} userID The User ID
|
|
11315
|
+
* @param {number} [exp] The expiration time for the token expressed in the number of seconds since the epoch
|
|
11316
|
+
* @param call_cids for anonymous tokens you have to provide the call cids the use can join
|
|
11317
|
+
*
|
|
11318
|
+
* @return {string} Returns a token
|
|
11319
|
+
*/
|
|
11320
|
+
createToken(userID, exp, iat, call_cids) {
|
|
11321
|
+
return this.streamClient.createToken(userID, exp, iat, call_cids);
|
|
11322
|
+
}
|
|
11286
11323
|
}
|
|
11287
11324
|
|
|
11288
11325
|
const getDevices = (constraints) => {
|