@stream-io/node-sdk 0.1.7 → 0.1.9

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.
Files changed (86) hide show
  1. package/README.md +8 -2
  2. package/dist/index.cjs.js +169 -514
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.d.ts +6 -6
  5. package/dist/index.es.js +169 -514
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/src/StreamCall.d.ts +7 -10
  8. package/dist/src/StreamChannel.d.ts +4 -4
  9. package/dist/src/StreamChatClient.d.ts +8 -8
  10. package/dist/src/StreamClient.d.ts +11 -11
  11. package/dist/src/StreamVideoClient.d.ts +4 -4
  12. package/dist/src/gen/chat/apis/ChannelTypesApi.d.ts +1 -1
  13. package/dist/src/gen/chat/apis/ChannelsApi.d.ts +12 -40
  14. package/dist/src/gen/chat/apis/CustomCommandsApi.d.ts +1 -1
  15. package/dist/src/gen/chat/apis/DefaultApi.d.ts +1 -1
  16. package/dist/src/gen/chat/apis/DevicesApi.d.ts +1 -1
  17. package/dist/src/gen/chat/apis/EventsApi.d.ts +2 -19
  18. package/dist/src/gen/chat/apis/FilesApi.d.ts +1 -1
  19. package/dist/src/gen/chat/apis/GDPRApi.d.ts +1 -1
  20. package/dist/src/gen/chat/apis/ImportsApi.d.ts +1 -1
  21. package/dist/src/gen/chat/apis/MessagesApi.d.ts +2 -2
  22. package/dist/src/gen/chat/apis/ModerationApi.d.ts +1 -1
  23. package/dist/src/gen/chat/apis/PermissionsV2Api.d.ts +1 -1
  24. package/dist/src/gen/chat/apis/PushApi.d.ts +1 -1
  25. package/dist/src/gen/chat/apis/ReactionsApi.d.ts +1 -1
  26. package/dist/src/gen/chat/apis/ServerSideApi.d.ts +1 -1
  27. package/dist/src/gen/chat/apis/SettingsApi.d.ts +1 -1
  28. package/dist/src/gen/chat/apis/TasksApi.d.ts +1 -1
  29. package/dist/src/gen/chat/apis/TestingApi.d.ts +1 -1
  30. package/dist/src/gen/chat/apis/UsersApi.d.ts +1 -1
  31. package/dist/src/gen/chat/models/index.d.ts +191 -160
  32. package/dist/src/gen/chat/runtime.d.ts +1 -1
  33. package/dist/src/gen/video/apis/DefaultApi.d.ts +2 -76
  34. package/dist/src/gen/video/apis/ServerSideApi.d.ts +1 -1
  35. package/dist/src/gen/video/models/index.d.ts +0 -271
  36. package/dist/src/gen/video/runtime.d.ts +1 -1
  37. package/dist/src/utils/create-token.d.ts +1 -1
  38. package/index.ts +6 -6
  39. package/package.json +26 -6
  40. package/src/StreamCall.ts +15 -19
  41. package/src/StreamChannel.ts +177 -75
  42. package/src/StreamChatClient.ts +82 -45
  43. package/src/StreamClient.ts +78 -75
  44. package/src/StreamVideoClient.ts +8 -8
  45. package/src/gen/chat/apis/ChannelTypesApi.ts +1 -1
  46. package/src/gen/chat/apis/ChannelsApi.ts +35 -160
  47. package/src/gen/chat/apis/CustomCommandsApi.ts +1 -1
  48. package/src/gen/chat/apis/DefaultApi.ts +1 -1
  49. package/src/gen/chat/apis/DevicesApi.ts +1 -1
  50. package/src/gen/chat/apis/EventsApi.ts +1 -74
  51. package/src/gen/chat/apis/FilesApi.ts +11 -11
  52. package/src/gen/chat/apis/GDPRApi.ts +1 -1
  53. package/src/gen/chat/apis/ImportsApi.ts +1 -1
  54. package/src/gen/chat/apis/MessagesApi.ts +56 -56
  55. package/src/gen/chat/apis/ModerationApi.ts +1 -1
  56. package/src/gen/chat/apis/PermissionsV2Api.ts +1 -1
  57. package/src/gen/chat/apis/PushApi.ts +1 -1
  58. package/src/gen/chat/apis/ReactionsApi.ts +1 -1
  59. package/src/gen/chat/apis/ServerSideApi.ts +1 -1
  60. package/src/gen/chat/apis/SettingsApi.ts +1 -1
  61. package/src/gen/chat/apis/TasksApi.ts +1 -1
  62. package/src/gen/chat/apis/TestingApi.ts +1 -1
  63. package/src/gen/chat/apis/UsersApi.ts +1 -1
  64. package/src/gen/chat/apis/index.ts +0 -1
  65. package/src/gen/chat/models/index.ts +191 -160
  66. package/src/gen/chat/runtime.ts +1 -1
  67. package/src/gen/video/apis/DefaultApi.ts +1 -303
  68. package/src/gen/video/apis/ServerSideApi.ts +1 -1
  69. package/src/gen/video/models/index.ts +0 -269
  70. package/src/gen/video/runtime.ts +1 -1
  71. package/src/types.ts +1 -1
  72. package/src/utils/create-token.ts +1 -1
  73. package/dist/__tests__/block-lists.test.d.ts +0 -1
  74. package/dist/__tests__/call-members.test.d.ts +0 -1
  75. package/dist/__tests__/call-types.test.d.ts +0 -1
  76. package/dist/__tests__/call.test.d.ts +0 -1
  77. package/dist/__tests__/channel-types.test.d.ts +0 -1
  78. package/dist/__tests__/channel.test.d.ts +0 -1
  79. package/dist/__tests__/command.test.d.ts +0 -1
  80. package/dist/__tests__/create-test-client.d.ts +0 -3
  81. package/dist/__tests__/create-token.test.d.ts +0 -1
  82. package/dist/__tests__/devices-push.test.d.ts +0 -1
  83. package/dist/__tests__/messages.test.d.ts +0 -1
  84. package/dist/__tests__/permissions-app-settings.test.d.ts +0 -1
  85. package/dist/__tests__/user-compat.test.d.ts +0 -1
  86. package/dist/__tests__/users.test.d.ts +0 -1
@@ -87,19 +87,6 @@ export interface VideoAPNSRequest {
87
87
  */
88
88
  title?: string;
89
89
  }
90
- /**
91
- *
92
- * @export
93
- * @interface VideoAcceptCallResponse
94
- */
95
- export interface VideoAcceptCallResponse {
96
- /**
97
- *
98
- * @type {string}
99
- * @memberof VideoAcceptCallResponse
100
- */
101
- duration: string;
102
- }
103
90
  /**
104
91
  *
105
92
  * @export
@@ -2009,31 +1996,6 @@ export interface VideoCreateGuestResponse {
2009
1996
  */
2010
1997
  user: VideoUserResponse;
2011
1998
  }
2012
- /**
2013
- *
2014
- * @export
2015
- * @interface VideoCredentials
2016
- */
2017
- export interface VideoCredentials {
2018
- /**
2019
- *
2020
- * @type {Array<VideoICEServer>}
2021
- * @memberof VideoCredentials
2022
- */
2023
- ice_servers: Array<VideoICEServer>;
2024
- /**
2025
- *
2026
- * @type {VideoSFUResponse}
2027
- * @memberof VideoCredentials
2028
- */
2029
- server: VideoSFUResponse;
2030
- /**
2031
- *
2032
- * @type {string}
2033
- * @memberof VideoCredentials
2034
- */
2035
- token: string;
2036
- }
2037
1999
  /**
2038
2000
  * A custom event, this event is used to send custom events to other participants in the call.
2039
2001
  * @export
@@ -2641,129 +2603,6 @@ export interface VideoHealthCheckEvent {
2641
2603
  */
2642
2604
  type: string;
2643
2605
  }
2644
- /**
2645
- *
2646
- * @export
2647
- * @interface VideoICEServer
2648
- */
2649
- export interface VideoICEServer {
2650
- /**
2651
- *
2652
- * @type {string}
2653
- * @memberof VideoICEServer
2654
- */
2655
- password: string;
2656
- /**
2657
- *
2658
- * @type {Array<string>}
2659
- * @memberof VideoICEServer
2660
- */
2661
- urls: Array<string>;
2662
- /**
2663
- *
2664
- * @type {string}
2665
- * @memberof VideoICEServer
2666
- */
2667
- username: string;
2668
- }
2669
- /**
2670
- *
2671
- * @export
2672
- * @interface VideoJoinCallRequest
2673
- */
2674
- export interface VideoJoinCallRequest {
2675
- /**
2676
- * if true the call will be created if it doesn't exist
2677
- * @type {boolean}
2678
- * @memberof VideoJoinCallRequest
2679
- */
2680
- create?: boolean;
2681
- /**
2682
- *
2683
- * @type {VideoCallRequest}
2684
- * @memberof VideoJoinCallRequest
2685
- */
2686
- data?: VideoCallRequest;
2687
- /**
2688
- *
2689
- * @type {string}
2690
- * @memberof VideoJoinCallRequest
2691
- */
2692
- location: string;
2693
- /**
2694
- *
2695
- * @type {number}
2696
- * @memberof VideoJoinCallRequest
2697
- */
2698
- members_limit?: number;
2699
- /**
2700
- * If the participant is migrating from another SFU, then this is the ID of the previous SFU
2701
- * @type {string}
2702
- * @memberof VideoJoinCallRequest
2703
- */
2704
- migrating_from?: string;
2705
- /**
2706
- *
2707
- * @type {boolean}
2708
- * @memberof VideoJoinCallRequest
2709
- */
2710
- notify?: boolean;
2711
- /**
2712
- * if true and the call is created, the notification will include ring=true
2713
- * @type {boolean}
2714
- * @memberof VideoJoinCallRequest
2715
- */
2716
- ring?: boolean;
2717
- }
2718
- /**
2719
- *
2720
- * @export
2721
- * @interface VideoJoinCallResponse
2722
- */
2723
- export interface VideoJoinCallResponse {
2724
- /**
2725
- *
2726
- * @type {VideoCallResponse}
2727
- * @memberof VideoJoinCallResponse
2728
- */
2729
- call: VideoCallResponse;
2730
- /**
2731
- *
2732
- * @type {boolean}
2733
- * @memberof VideoJoinCallResponse
2734
- */
2735
- created: boolean;
2736
- /**
2737
- *
2738
- * @type {VideoCredentials}
2739
- * @memberof VideoJoinCallResponse
2740
- */
2741
- credentials: VideoCredentials;
2742
- /**
2743
- *
2744
- * @type {string}
2745
- * @memberof VideoJoinCallResponse
2746
- */
2747
- duration: string;
2748
- /**
2749
- *
2750
- * @type {Array<VideoMemberResponse>}
2751
- * @memberof VideoJoinCallResponse
2752
- */
2753
- members: Array<VideoMemberResponse>;
2754
- /**
2755
- *
2756
- * @type {VideoMemberResponse}
2757
- * @memberof VideoJoinCallResponse
2758
- */
2759
- membership?: VideoMemberResponse;
2760
- /**
2761
- *
2762
- * @type {Array<VideoOwnCapability>}
2763
- * @memberof VideoJoinCallResponse
2764
- */
2765
- own_capabilities: Array<VideoOwnCapability>;
2766
- }
2767
2606
  /**
2768
2607
  *
2769
2608
  * @export
@@ -3575,45 +3414,6 @@ export interface VideoRecordSettingsResponse {
3575
3414
  */
3576
3415
  quality: string;
3577
3416
  }
3578
- /**
3579
- *
3580
- * @export
3581
- * @interface VideoRejectCallResponse
3582
- */
3583
- export interface VideoRejectCallResponse {
3584
- /**
3585
- *
3586
- * @type {string}
3587
- * @memberof VideoRejectCallResponse
3588
- */
3589
- duration: string;
3590
- }
3591
- /**
3592
- *
3593
- * @export
3594
- * @interface VideoRequestPermissionRequest
3595
- */
3596
- export interface VideoRequestPermissionRequest {
3597
- /**
3598
- *
3599
- * @type {Array<string>}
3600
- * @memberof VideoRequestPermissionRequest
3601
- */
3602
- permissions: Array<string>;
3603
- }
3604
- /**
3605
- *
3606
- * @export
3607
- * @interface VideoRequestPermissionResponse
3608
- */
3609
- export interface VideoRequestPermissionResponse {
3610
- /**
3611
- *
3612
- * @type {string}
3613
- * @memberof VideoRequestPermissionResponse
3614
- */
3615
- duration: string;
3616
- }
3617
3417
  /**
3618
3418
  *
3619
3419
  * @export
@@ -3665,31 +3465,6 @@ export interface VideoRingSettingsRequest {
3665
3465
  */
3666
3466
  incoming_call_timeout_ms?: number;
3667
3467
  }
3668
- /**
3669
- *
3670
- * @export
3671
- * @interface VideoSFUResponse
3672
- */
3673
- export interface VideoSFUResponse {
3674
- /**
3675
- *
3676
- * @type {string}
3677
- * @memberof VideoSFUResponse
3678
- */
3679
- edge_name: string;
3680
- /**
3681
- *
3682
- * @type {string}
3683
- * @memberof VideoSFUResponse
3684
- */
3685
- url: string;
3686
- /**
3687
- *
3688
- * @type {string}
3689
- * @memberof VideoSFUResponse
3690
- */
3691
- ws_endpoint: string;
3692
- }
3693
3468
  /**
3694
3469
  *
3695
3470
  * @export
@@ -3756,52 +3531,6 @@ export interface VideoSendEventResponse {
3756
3531
  */
3757
3532
  duration: string;
3758
3533
  }
3759
- /**
3760
- *
3761
- * @export
3762
- * @interface VideoSendReactionRequest
3763
- */
3764
- export interface VideoSendReactionRequest {
3765
- /**
3766
- *
3767
- * @type {{ [key: string]: any; }}
3768
- * @memberof VideoSendReactionRequest
3769
- */
3770
- custom?: {
3771
- [key: string]: any;
3772
- };
3773
- /**
3774
- *
3775
- * @type {string}
3776
- * @memberof VideoSendReactionRequest
3777
- */
3778
- emoji_code?: string;
3779
- /**
3780
- *
3781
- * @type {string}
3782
- * @memberof VideoSendReactionRequest
3783
- */
3784
- type: string;
3785
- }
3786
- /**
3787
- *
3788
- * @export
3789
- * @interface VideoSendReactionResponse
3790
- */
3791
- export interface VideoSendReactionResponse {
3792
- /**
3793
- * Duration of the request in human-readable format
3794
- * @type {string}
3795
- * @memberof VideoSendReactionResponse
3796
- */
3797
- duration: string;
3798
- /**
3799
- *
3800
- * @type {VideoReactionResponse}
3801
- * @memberof VideoSendReactionResponse
3802
- */
3803
- reaction: VideoReactionResponse;
3804
- }
3805
3534
  /**
3806
3535
  *
3807
3536
  * @export
@@ -2,7 +2,7 @@
2
2
  * Stream Video API
3
3
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
4
  *
5
- * The version of the OpenAPI document: v89.9.2
5
+ * The version of the OpenAPI document: v92.7.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -1,3 +1,3 @@
1
- import { Secret, SignOptions } from "jsonwebtoken";
1
+ import { Secret, SignOptions } from 'jsonwebtoken';
2
2
  export declare function JWTUserToken(apiSecret: Secret, userId: string, extraData?: {}, jwtOptions?: SignOptions): string;
3
3
  export declare function JWTServerToken(apiSecret: Secret, jwtOptions?: SignOptions): string;
package/index.ts CHANGED
@@ -1,7 +1,7 @@
1
- export * from "./src/gen/chat/models";
1
+ export * from './src/gen/chat/models';
2
2
  export * from './src/gen/video/models';
3
- export * from "./src/StreamClient";
4
- export * from "./src/StreamVideoClient";
5
- export * from "./src/StreamCall";
6
- export * from "./src/StreamChatClient";
7
- export * from "./src/StreamChannel";
3
+ export * from './src/StreamClient';
4
+ export * from './src/StreamVideoClient';
5
+ export * from './src/StreamCall';
6
+ export * from './src/StreamChatClient';
7
+ export * from './src/StreamChannel';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/node-sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -12,12 +12,22 @@
12
12
  "url": "https://github.com/GetStream/stream-node.git"
13
13
  },
14
14
  "scripts": {
15
+ "prepare": "husky install",
15
16
  "prepublish": "yarn build",
16
17
  "test": "vitest",
18
+ "test:bun": "bun run vitest",
17
19
  "start": "rollup -w -c",
18
20
  "build": "rm -rf dist && rollup -c",
19
21
  "generate:open-api": "./generate-openapi.sh protocol",
20
- "generate:open-api:dev": "./generate-openapi.sh chat"
22
+ "generate:open-api:dev": "./generate-openapi.sh chat",
23
+ "lint": "eslint **/*.ts",
24
+ "lint:fix": "eslint --fix **/*.ts",
25
+ "prettier:fix": "prettier . --write"
26
+ },
27
+ "lint-staged": {
28
+ "**/*": [
29
+ "prettier --write --ignore-unknown"
30
+ ]
21
31
  },
22
32
  "files": [
23
33
  "dist",
@@ -34,15 +44,25 @@
34
44
  "@rollup/plugin-typescript": "^11.1.4",
35
45
  "@types/jsonwebtoken": "^9.0.3",
36
46
  "@types/uuid": "^9.0.4",
47
+ "@typescript-eslint/eslint-plugin": "^6.4.0",
37
48
  "dotenv": "^16.3.1",
49
+ "eslint": "^8.0.1",
50
+ "eslint-config-prettier": "^9.0.0",
51
+ "eslint-config-standard-with-typescript": "^40.0.0",
52
+ "eslint-plugin-import": "^2.25.2",
53
+ "eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
54
+ "eslint-plugin-promise": "^6.0.0",
55
+ "husky": "^8.0.3",
56
+ "lint-staged": "^15.1.0",
57
+ "prettier": "^3.1.0",
38
58
  "rollup": "^3.29.3",
39
59
  "typescript": "^5.2.2",
40
60
  "vite": "^4.4.9",
41
- "vitest": "^0.34.5",
61
+ "vitest": "^1.0.0-beta.5",
42
62
  "vitest-mock-extended": "^1.2.1"
43
63
  },
44
64
  "dependencies": {
45
- "uuid": "^9.0.1",
46
- "jsonwebtoken": "^9.0.2"
65
+ "jsonwebtoken": "^9.0.2",
66
+ "uuid": "^9.0.1"
47
67
  }
48
- }
68
+ }
package/src/StreamCall.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { StreamClient } from "./StreamClient";
1
+ import { StreamClient } from './StreamClient';
2
2
  import {
3
3
  DefaultApi,
4
4
  GetCallRequest,
@@ -13,31 +13,27 @@ import {
13
13
  VideoUpdateCallMembersRequest,
14
14
  VideoUpdateUserPermissionsRequest,
15
15
  VideoQueryMembersRequest,
16
- } from "./gen/video";
17
- import { OmitTypeId } from "./types";
16
+ } from './gen/video';
17
+ import { OmitTypeId } from './types';
18
18
 
19
19
  export class StreamCall {
20
20
  private readonly baseRequest: { type: string; id: string };
21
21
  private readonly apiClient: DefaultApi;
22
22
 
23
23
  constructor(
24
- private streamClient: StreamClient,
25
- private type: string,
26
- private id: string
24
+ private readonly streamClient: StreamClient,
25
+ private readonly type: string,
26
+ private readonly id: string,
27
27
  ) {
28
28
  this.baseRequest = { id: this.id, type: this.type };
29
29
  const configuration = this.streamClient.getConfiguration({
30
30
  basePath:
31
- this.streamClient.options.basePath ||
32
- "https://video.stream-io-api.com/video",
31
+ this.streamClient.options.basePath ??
32
+ 'https://video.stream-io-api.com/video',
33
33
  });
34
34
  this.apiClient = new DefaultApi(configuration);
35
35
  }
36
36
 
37
- accept = () => {
38
- return this.apiClient.acceptCall(this.baseRequest);
39
- };
40
-
41
37
  blockUser = (videoBlockUserRequest: VideoBlockUserRequest) => {
42
38
  return this.apiClient.blockUser({
43
39
  ...this.baseRequest,
@@ -50,13 +46,13 @@ export class StreamCall {
50
46
  };
51
47
 
52
48
  get = (request?: OmitTypeId<GetCallRequest>) => {
53
- return this.apiClient.getCall({ ...(request || {}), ...this.baseRequest });
49
+ return this.apiClient.getCall({ ...(request ?? {}), ...this.baseRequest });
54
50
  };
55
51
 
56
52
  getOrCreate = (videoGetOrCreateCallRequest?: VideoGetOrCreateCallRequest) => {
57
53
  return this.apiClient.getOrCreateCall({
58
54
  ...this.baseRequest,
59
- videoGetOrCreateCallRequest: videoGetOrCreateCallRequest || {},
55
+ videoGetOrCreateCallRequest: videoGetOrCreateCallRequest ?? {},
60
56
  });
61
57
  };
62
58
 
@@ -67,7 +63,7 @@ export class StreamCall {
67
63
  goLive = (videoGoLiveRequest?: VideoGoLiveRequest) => {
68
64
  return this.apiClient.goLive({
69
65
  ...this.baseRequest,
70
- videoGoLiveRequest: videoGoLiveRequest || {},
66
+ videoGoLiveRequest: videoGoLiveRequest ?? {},
71
67
  });
72
68
  };
73
69
 
@@ -86,11 +82,11 @@ export class StreamCall {
86
82
 
87
83
  queryMembers = (request?: OmitTypeId<VideoQueryMembersRequest>) => {
88
84
  return this.apiClient.queryMembers({
89
- videoQueryMembersRequest: { ...(request || {}), ...this.baseRequest },
85
+ videoQueryMembersRequest: { ...(request ?? {}), ...this.baseRequest },
90
86
  });
91
87
  };
92
88
 
93
- sendCustomEvent = (event: { [key: string]: any }) => {
89
+ sendCustomEvent = (event: Record<string, any>) => {
94
90
  return this.apiClient.sendEvent({
95
91
  videoSendEventRequest: { custom: event },
96
92
  ...this.baseRequest,
@@ -140,7 +136,7 @@ export class StreamCall {
140
136
  };
141
137
 
142
138
  updateCallMembers = (
143
- videoUpdateCallMembersRequest: VideoUpdateCallMembersRequest
139
+ videoUpdateCallMembersRequest: VideoUpdateCallMembersRequest,
144
140
  ) => {
145
141
  return this.apiClient.updateCallMembers({
146
142
  videoUpdateCallMembersRequest,
@@ -149,7 +145,7 @@ export class StreamCall {
149
145
  };
150
146
 
151
147
  updateUserPermissions = (
152
- videoUpdateUserPermissionsRequest: VideoUpdateUserPermissionsRequest
148
+ videoUpdateUserPermissionsRequest: VideoUpdateUserPermissionsRequest,
153
149
  ) => {
154
150
  return this.apiClient.updateUserPermissions({
155
151
  videoUpdateUserPermissionsRequest,