@stream-io/node-sdk 0.2.0 → 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/dist/index.cjs.js +32 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +32 -32
- package/dist/index.es.js.map +1 -1
- package/dist/src/StreamCall.d.ts +2 -2
- package/dist/src/StreamClient.d.ts +4 -1
- package/dist/src/gen/video/apis/ProductvideoApi.d.ts +5 -5
- package/dist/src/gen/video/models/index.d.ts +91 -6
- package/dist/src/gen/video/runtime.d.ts +1 -1
- package/dist/src/types.d.ts +12 -0
- package/dist/src/utils/create-token.d.ts +6 -1
- package/package.json +1 -1
- package/src/StreamCall.ts +3 -2
- package/src/StreamClient.ts +22 -23
- package/src/gen/video/apis/ProductvideoApi.ts +9 -9
- package/src/gen/video/models/index.ts +91 -6
- package/src/gen/video/runtime.ts +1 -1
- package/src/types.ts +14 -0
- package/src/utils/create-token.ts +5 -16
package/dist/index.cjs.js
CHANGED
|
@@ -6158,7 +6158,7 @@ class StreamChatClient {
|
|
|
6158
6158
|
* Stream API
|
|
6159
6159
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6160
6160
|
*
|
|
6161
|
-
* The version of the OpenAPI document: v113.
|
|
6161
|
+
* The version of the OpenAPI document: v113.1.0
|
|
6162
6162
|
*
|
|
6163
6163
|
*
|
|
6164
6164
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -6418,7 +6418,7 @@ class JSONApiResponse {
|
|
|
6418
6418
|
* Stream API
|
|
6419
6419
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6420
6420
|
*
|
|
6421
|
-
* The version of the OpenAPI document: v113.
|
|
6421
|
+
* The version of the OpenAPI document: v113.1.0
|
|
6422
6422
|
*
|
|
6423
6423
|
*
|
|
6424
6424
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -7632,8 +7632,8 @@ class ProductvideoApi extends BaseAPI {
|
|
|
7632
7632
|
if (requestParameters.id === null || requestParameters.id === undefined) {
|
|
7633
7633
|
throw new RequiredError('id', 'Required parameter requestParameters.id was null or undefined when calling sendCallEvent.');
|
|
7634
7634
|
}
|
|
7635
|
-
if (requestParameters.
|
|
7636
|
-
throw new RequiredError('
|
|
7635
|
+
if (requestParameters.videoSendCallEventRequest === null || requestParameters.videoSendCallEventRequest === undefined) {
|
|
7636
|
+
throw new RequiredError('videoSendCallEventRequest', 'Required parameter requestParameters.videoSendCallEventRequest was null or undefined when calling sendCallEvent.');
|
|
7637
7637
|
}
|
|
7638
7638
|
const queryParameters = {};
|
|
7639
7639
|
const headerParameters = {};
|
|
@@ -7652,7 +7652,7 @@ class ProductvideoApi extends BaseAPI {
|
|
|
7652
7652
|
method: 'POST',
|
|
7653
7653
|
headers: headerParameters,
|
|
7654
7654
|
query: queryParameters,
|
|
7655
|
-
body: requestParameters.
|
|
7655
|
+
body: requestParameters.videoSendCallEventRequest,
|
|
7656
7656
|
}, initOverrides);
|
|
7657
7657
|
return new JSONApiResponse(response);
|
|
7658
7658
|
});
|
|
@@ -8383,8 +8383,8 @@ class StreamCall {
|
|
|
8383
8383
|
videoQueryCallMembersRequest: Object.assign(Object.assign({}, (request !== null && request !== void 0 ? request : {})), this.baseRequest),
|
|
8384
8384
|
});
|
|
8385
8385
|
};
|
|
8386
|
-
this.sendCustomEvent = (
|
|
8387
|
-
return this.apiClient.sendCallEvent(Object.assign({
|
|
8386
|
+
this.sendCustomEvent = (videoSendCallEventRequest) => {
|
|
8387
|
+
return this.apiClient.sendCallEvent(Object.assign({ videoSendCallEventRequest }, this.baseRequest));
|
|
8388
8388
|
};
|
|
8389
8389
|
this.startHLSBroadcasting = () => {
|
|
8390
8390
|
return this.apiClient.startHLSBroadcasting(Object.assign({}, this.baseRequest));
|
|
@@ -8490,16 +8490,15 @@ class StreamVideoClient {
|
|
|
8490
8490
|
}
|
|
8491
8491
|
}
|
|
8492
8492
|
|
|
8493
|
-
function JWTUserToken(apiSecret,
|
|
8494
|
-
if (typeof userId !== 'string') {
|
|
8495
|
-
throw new TypeError('userId should be a string');
|
|
8496
|
-
}
|
|
8497
|
-
const payload = Object.assign({ user_id: userId }, extraData);
|
|
8493
|
+
function JWTUserToken(apiSecret, payload) {
|
|
8498
8494
|
// make sure we return a clear error when jwt is shimmed (ie. browser build)
|
|
8499
8495
|
if (jwt == null || jwt.sign == null) {
|
|
8500
8496
|
throw Error(`Unable to find jwt crypto, if you are getting this error is probably because you are trying to generate tokens on browser or React Native (or other environment where crypto functions are not available). Please Note: token should only be generated server-side.`);
|
|
8501
8497
|
}
|
|
8502
|
-
const opts = Object.assign({
|
|
8498
|
+
const opts = Object.assign({
|
|
8499
|
+
algorithm: 'HS256',
|
|
8500
|
+
noTimestamp: true,
|
|
8501
|
+
});
|
|
8503
8502
|
if (payload.iat) {
|
|
8504
8503
|
opts.noTimestamp = false;
|
|
8505
8504
|
}
|
|
@@ -8738,7 +8737,7 @@ class StreamClient {
|
|
|
8738
8737
|
? 'https://chat.stream-io-api.com'
|
|
8739
8738
|
: 'https://video.stream-io-api.com'),
|
|
8740
8739
|
headers: {
|
|
8741
|
-
'X-Stream-Client': 'stream-node-' + "0.2.
|
|
8740
|
+
'X-Stream-Client': 'stream-node-' + "0.2.2",
|
|
8742
8741
|
},
|
|
8743
8742
|
middleware: [
|
|
8744
8743
|
{
|
|
@@ -8866,18 +8865,16 @@ class StreamClient {
|
|
|
8866
8865
|
* @returns
|
|
8867
8866
|
*/
|
|
8868
8867
|
createToken(userID, exp = Math.round(new Date().getTime() / 1000) + 60 * 60, iat = Math.round(Date.now() / 1000), call_cids) {
|
|
8869
|
-
const
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
extra.iat = iat;
|
|
8875
|
-
}
|
|
8868
|
+
const payload = {
|
|
8869
|
+
user_id: userID,
|
|
8870
|
+
exp,
|
|
8871
|
+
iat,
|
|
8872
|
+
};
|
|
8876
8873
|
if (call_cids) {
|
|
8877
8874
|
console.warn(`Use createCallToken method for creating call tokens, the "call_cids" param will be removed from the createToken method with version 0.2.0`);
|
|
8878
|
-
|
|
8875
|
+
payload.call_cids = call_cids;
|
|
8879
8876
|
}
|
|
8880
|
-
return JWTUserToken(this.secret,
|
|
8877
|
+
return JWTUserToken(this.secret, payload);
|
|
8881
8878
|
}
|
|
8882
8879
|
/**
|
|
8883
8880
|
*
|
|
@@ -8887,16 +8884,19 @@ class StreamClient {
|
|
|
8887
8884
|
* @param iat this is deprecated, the current date will be set internally
|
|
8888
8885
|
* @returns
|
|
8889
8886
|
*/
|
|
8890
|
-
createCallToken(
|
|
8891
|
-
const
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8887
|
+
createCallToken(userIdOrObject, call_cids, exp = Math.round(new Date().getTime() / 1000) + 60 * 60, iat = Math.round(Date.now() / 1000)) {
|
|
8888
|
+
const payload = {
|
|
8889
|
+
exp,
|
|
8890
|
+
iat,
|
|
8891
|
+
call_cids,
|
|
8892
|
+
user_id: typeof userIdOrObject === 'string'
|
|
8893
|
+
? userIdOrObject
|
|
8894
|
+
: userIdOrObject.user_id,
|
|
8895
|
+
};
|
|
8896
|
+
if (typeof userIdOrObject === 'object' && userIdOrObject.role) {
|
|
8897
|
+
payload.role = userIdOrObject.role;
|
|
8897
8898
|
}
|
|
8898
|
-
|
|
8899
|
-
return JWTUserToken(this.secret, userID, extra);
|
|
8899
|
+
return JWTUserToken(this.secret, payload);
|
|
8900
8900
|
}
|
|
8901
8901
|
mapCustomDataAfterReceive(user) {
|
|
8902
8902
|
if (!user) {
|