@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.es.js
CHANGED
|
@@ -6156,7 +6156,7 @@ class StreamChatClient {
|
|
|
6156
6156
|
* Stream API
|
|
6157
6157
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6158
6158
|
*
|
|
6159
|
-
* The version of the OpenAPI document: v113.
|
|
6159
|
+
* The version of the OpenAPI document: v113.1.0
|
|
6160
6160
|
*
|
|
6161
6161
|
*
|
|
6162
6162
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -6416,7 +6416,7 @@ class JSONApiResponse {
|
|
|
6416
6416
|
* Stream API
|
|
6417
6417
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6418
6418
|
*
|
|
6419
|
-
* The version of the OpenAPI document: v113.
|
|
6419
|
+
* The version of the OpenAPI document: v113.1.0
|
|
6420
6420
|
*
|
|
6421
6421
|
*
|
|
6422
6422
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -7630,8 +7630,8 @@ class ProductvideoApi extends BaseAPI {
|
|
|
7630
7630
|
if (requestParameters.id === null || requestParameters.id === undefined) {
|
|
7631
7631
|
throw new RequiredError('id', 'Required parameter requestParameters.id was null or undefined when calling sendCallEvent.');
|
|
7632
7632
|
}
|
|
7633
|
-
if (requestParameters.
|
|
7634
|
-
throw new RequiredError('
|
|
7633
|
+
if (requestParameters.videoSendCallEventRequest === null || requestParameters.videoSendCallEventRequest === undefined) {
|
|
7634
|
+
throw new RequiredError('videoSendCallEventRequest', 'Required parameter requestParameters.videoSendCallEventRequest was null or undefined when calling sendCallEvent.');
|
|
7635
7635
|
}
|
|
7636
7636
|
const queryParameters = {};
|
|
7637
7637
|
const headerParameters = {};
|
|
@@ -7650,7 +7650,7 @@ class ProductvideoApi extends BaseAPI {
|
|
|
7650
7650
|
method: 'POST',
|
|
7651
7651
|
headers: headerParameters,
|
|
7652
7652
|
query: queryParameters,
|
|
7653
|
-
body: requestParameters.
|
|
7653
|
+
body: requestParameters.videoSendCallEventRequest,
|
|
7654
7654
|
}, initOverrides);
|
|
7655
7655
|
return new JSONApiResponse(response);
|
|
7656
7656
|
});
|
|
@@ -8381,8 +8381,8 @@ class StreamCall {
|
|
|
8381
8381
|
videoQueryCallMembersRequest: Object.assign(Object.assign({}, (request !== null && request !== void 0 ? request : {})), this.baseRequest),
|
|
8382
8382
|
});
|
|
8383
8383
|
};
|
|
8384
|
-
this.sendCustomEvent = (
|
|
8385
|
-
return this.apiClient.sendCallEvent(Object.assign({
|
|
8384
|
+
this.sendCustomEvent = (videoSendCallEventRequest) => {
|
|
8385
|
+
return this.apiClient.sendCallEvent(Object.assign({ videoSendCallEventRequest }, this.baseRequest));
|
|
8386
8386
|
};
|
|
8387
8387
|
this.startHLSBroadcasting = () => {
|
|
8388
8388
|
return this.apiClient.startHLSBroadcasting(Object.assign({}, this.baseRequest));
|
|
@@ -8488,16 +8488,15 @@ class StreamVideoClient {
|
|
|
8488
8488
|
}
|
|
8489
8489
|
}
|
|
8490
8490
|
|
|
8491
|
-
function JWTUserToken(apiSecret,
|
|
8492
|
-
if (typeof userId !== 'string') {
|
|
8493
|
-
throw new TypeError('userId should be a string');
|
|
8494
|
-
}
|
|
8495
|
-
const payload = Object.assign({ user_id: userId }, extraData);
|
|
8491
|
+
function JWTUserToken(apiSecret, payload) {
|
|
8496
8492
|
// make sure we return a clear error when jwt is shimmed (ie. browser build)
|
|
8497
8493
|
if (jwt == null || jwt.sign == null) {
|
|
8498
8494
|
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.`);
|
|
8499
8495
|
}
|
|
8500
|
-
const opts = Object.assign({
|
|
8496
|
+
const opts = Object.assign({
|
|
8497
|
+
algorithm: 'HS256',
|
|
8498
|
+
noTimestamp: true,
|
|
8499
|
+
});
|
|
8501
8500
|
if (payload.iat) {
|
|
8502
8501
|
opts.noTimestamp = false;
|
|
8503
8502
|
}
|
|
@@ -8736,7 +8735,7 @@ class StreamClient {
|
|
|
8736
8735
|
? 'https://chat.stream-io-api.com'
|
|
8737
8736
|
: 'https://video.stream-io-api.com'),
|
|
8738
8737
|
headers: {
|
|
8739
|
-
'X-Stream-Client': 'stream-node-' + "0.2.
|
|
8738
|
+
'X-Stream-Client': 'stream-node-' + "0.2.2",
|
|
8740
8739
|
},
|
|
8741
8740
|
middleware: [
|
|
8742
8741
|
{
|
|
@@ -8864,18 +8863,16 @@ class StreamClient {
|
|
|
8864
8863
|
* @returns
|
|
8865
8864
|
*/
|
|
8866
8865
|
createToken(userID, exp = Math.round(new Date().getTime() / 1000) + 60 * 60, iat = Math.round(Date.now() / 1000), call_cids) {
|
|
8867
|
-
const
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
extra.iat = iat;
|
|
8873
|
-
}
|
|
8866
|
+
const payload = {
|
|
8867
|
+
user_id: userID,
|
|
8868
|
+
exp,
|
|
8869
|
+
iat,
|
|
8870
|
+
};
|
|
8874
8871
|
if (call_cids) {
|
|
8875
8872
|
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`);
|
|
8876
|
-
|
|
8873
|
+
payload.call_cids = call_cids;
|
|
8877
8874
|
}
|
|
8878
|
-
return JWTUserToken(this.secret,
|
|
8875
|
+
return JWTUserToken(this.secret, payload);
|
|
8879
8876
|
}
|
|
8880
8877
|
/**
|
|
8881
8878
|
*
|
|
@@ -8885,16 +8882,19 @@ class StreamClient {
|
|
|
8885
8882
|
* @param iat this is deprecated, the current date will be set internally
|
|
8886
8883
|
* @returns
|
|
8887
8884
|
*/
|
|
8888
|
-
createCallToken(
|
|
8889
|
-
const
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8885
|
+
createCallToken(userIdOrObject, call_cids, exp = Math.round(new Date().getTime() / 1000) + 60 * 60, iat = Math.round(Date.now() / 1000)) {
|
|
8886
|
+
const payload = {
|
|
8887
|
+
exp,
|
|
8888
|
+
iat,
|
|
8889
|
+
call_cids,
|
|
8890
|
+
user_id: typeof userIdOrObject === 'string'
|
|
8891
|
+
? userIdOrObject
|
|
8892
|
+
: userIdOrObject.user_id,
|
|
8893
|
+
};
|
|
8894
|
+
if (typeof userIdOrObject === 'object' && userIdOrObject.role) {
|
|
8895
|
+
payload.role = userIdOrObject.role;
|
|
8895
8896
|
}
|
|
8896
|
-
|
|
8897
|
-
return JWTUserToken(this.secret, userID, extra);
|
|
8897
|
+
return JWTUserToken(this.secret, payload);
|
|
8898
8898
|
}
|
|
8899
8899
|
mapCustomDataAfterReceive(user) {
|
|
8900
8900
|
if (!user) {
|