@stream-io/node-sdk 0.7.63 → 0.7.64

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.es.mjs CHANGED
@@ -1211,6 +1211,12 @@ decoders.ChannelConfigWithInfo = (input) => {
1211
1211
  };
1212
1212
  return decode(typeMappings, input);
1213
1213
  };
1214
+ decoders.ChannelContextResponse = (input) => {
1215
+ const typeMappings = {
1216
+ created_by: { type: 'UserResponse', isSingle: true },
1217
+ };
1218
+ return decode(typeMappings, input);
1219
+ };
1214
1220
  decoders.ChannelCreatedEvent = (input) => {
1215
1221
  const typeMappings = {
1216
1222
  created_at: { type: 'DatetimeType', isSingle: true },
@@ -1252,6 +1258,7 @@ decoders.ChannelMemberResponse = (input) => {
1252
1258
  archived_at: { type: 'DatetimeType', isSingle: true },
1253
1259
  ban_expires: { type: 'DatetimeType', isSingle: true },
1254
1260
  deleted_at: { type: 'DatetimeType', isSingle: true },
1261
+ future_channel_ban_expires: { type: 'DatetimeType', isSingle: true },
1255
1262
  invite_accepted_at: { type: 'DatetimeType', isSingle: true },
1256
1263
  invite_rejected_at: { type: 'DatetimeType', isSingle: true },
1257
1264
  pinned_at: { type: 'DatetimeType', isSingle: true },
@@ -2330,6 +2337,13 @@ decoders.GetDraftResponse = (input) => {
2330
2337
  };
2331
2338
  return decode(typeMappings, input);
2332
2339
  };
2340
+ decoders.GetExternalStorageResponse = (input) => {
2341
+ const typeMappings = {
2342
+ created_at: { type: 'DatetimeType', isSingle: true },
2343
+ updated_at: { type: 'DatetimeType', isSingle: true },
2344
+ };
2345
+ return decode(typeMappings, input);
2346
+ };
2333
2347
  decoders.GetFeedGroupResponse = (input) => {
2334
2348
  const typeMappings = {
2335
2349
  feed_group: { type: 'FeedGroupResponse', isSingle: true },
@@ -2894,6 +2908,13 @@ decoders.MessageWithChannelResponse = (input) => {
2894
2908
  };
2895
2909
  return decode(typeMappings, input);
2896
2910
  };
2911
+ decoders.ModerationAnalysisFailedEvent = (input) => {
2912
+ const typeMappings = {
2913
+ created_at: { type: 'DatetimeType', isSingle: true },
2914
+ received_at: { type: 'DatetimeType', isSingle: true },
2915
+ };
2916
+ return decode(typeMappings, input);
2917
+ };
2897
2918
  decoders.ModerationCallResponse = (input) => {
2898
2919
  const typeMappings = {
2899
2920
  created_at: { type: 'DatetimeType', isSingle: true },
@@ -3123,6 +3144,49 @@ decoders.PinActivityResponse = (input) => {
3123
3144
  };
3124
3145
  return decode(typeMappings, input);
3125
3146
  };
3147
+ decoders.PolicyTestResult = (input) => {
3148
+ const typeMappings = {
3149
+ created_at: { type: 'DatetimeType', isSingle: true },
3150
+ };
3151
+ return decode(typeMappings, input);
3152
+ };
3153
+ decoders.PolicyTestRun = (input) => {
3154
+ const typeMappings = {
3155
+ created_at: { type: 'DatetimeType', isSingle: true },
3156
+ completed_at: { type: 'DatetimeType', isSingle: true },
3157
+ config_updated_at: { type: 'DatetimeType', isSingle: true },
3158
+ started_at: { type: 'DatetimeType', isSingle: true },
3159
+ };
3160
+ return decode(typeMappings, input);
3161
+ };
3162
+ decoders.PolicyTestRunResponse = (input) => {
3163
+ const typeMappings = {
3164
+ results: { type: 'PolicyTestResult', isSingle: false },
3165
+ run: { type: 'PolicyTestRun', isSingle: true },
3166
+ };
3167
+ return decode(typeMappings, input);
3168
+ };
3169
+ decoders.PolicyTestSet = (input) => {
3170
+ const typeMappings = {
3171
+ created_at: { type: 'DatetimeType', isSingle: true },
3172
+ updated_at: { type: 'DatetimeType', isSingle: true },
3173
+ last_run: { type: 'PolicyTestRun', isSingle: true },
3174
+ };
3175
+ return decode(typeMappings, input);
3176
+ };
3177
+ decoders.PolicyTestSetListResponse = (input) => {
3178
+ const typeMappings = {
3179
+ sets: { type: 'PolicyTestSet', isSingle: false },
3180
+ };
3181
+ return decode(typeMappings, input);
3182
+ };
3183
+ decoders.PolicyTestSetResponse = (input) => {
3184
+ const typeMappings = {
3185
+ recent_runs: { type: 'PolicyTestRun', isSingle: false },
3186
+ set: { type: 'PolicyTestSet', isSingle: true },
3187
+ };
3188
+ return decode(typeMappings, input);
3189
+ };
3126
3190
  decoders.PollResponse = (input) => {
3127
3191
  const typeMappings = {
3128
3192
  poll: { type: 'PollResponseData', isSingle: true },
@@ -3839,6 +3903,7 @@ decoders.SegmentTargetResponse = (input) => {
3839
3903
  decoders.SendMessageResponse = (input) => {
3840
3904
  const typeMappings = {
3841
3905
  message: { type: 'MessageResponse', isSingle: true },
3906
+ channel_context: { type: 'ChannelContextResponse', isSingle: true },
3842
3907
  };
3843
3908
  return decode(typeMappings, input);
3844
3909
  };
@@ -4605,6 +4670,7 @@ class CommonApi {
4605
4670
  guest_user_creation_disabled: request?.guest_user_creation_disabled,
4606
4671
  image_moderation_enabled: request?.image_moderation_enabled,
4607
4672
  max_aggregated_activities_length: request?.max_aggregated_activities_length,
4673
+ member_custom_on_messages_enabled: request?.member_custom_on_messages_enabled,
4608
4674
  migrate_permissions_to_v2: request?.migrate_permissions_to_v2,
4609
4675
  moderation_analytics_enabled: request?.moderation_analytics_enabled,
4610
4676
  moderation_enabled: request?.moderation_enabled,
@@ -4669,6 +4735,8 @@ class CommonApi {
4669
4735
  is_substring_matching_enabled: request?.is_substring_matching_enabled,
4670
4736
  team: request?.team,
4671
4737
  type: request?.type,
4738
+ user_id: request?.user_id,
4739
+ user: request?.user,
4672
4740
  };
4673
4741
  const response = await this.apiClient.sendRequest('POST', '/api/v2/blocklists', undefined, undefined, body, 'application/json');
4674
4742
  decoders.CreateBlockListResponse?.(response.body);
@@ -4689,6 +4757,7 @@ class CommonApi {
4689
4757
  async deleteBlockList(request) {
4690
4758
  const queryParams = {
4691
4759
  team: request?.team,
4760
+ user_id: request?.user_id,
4692
4761
  };
4693
4762
  const pathParams = {
4694
4763
  name: request?.name,
@@ -4718,7 +4787,9 @@ class CommonApi {
4718
4787
  is_plural_check_enabled: request?.is_plural_check_enabled,
4719
4788
  is_substring_matching_enabled: request?.is_substring_matching_enabled,
4720
4789
  team: request?.team,
4790
+ user_id: request?.user_id,
4721
4791
  words: request?.words,
4792
+ user: request?.user,
4722
4793
  };
4723
4794
  const response = await this.apiClient.sendRequest('PUT', '/api/v2/blocklists/{name}', pathParams, undefined, body, 'application/json');
4724
4795
  decoders.UpdateBlockListResponse?.(response.body);
@@ -4901,6 +4972,31 @@ class CommonApi {
4901
4972
  decoders.CreateImportV2TaskResponse?.(response.body);
4902
4973
  return { ...response.body, metadata: response.metadata };
4903
4974
  }
4975
+ async deleteImporterExternalStorage() {
4976
+ const response = await this.apiClient.sendRequest('DELETE', '/api/v2/imports/v2/external-storage', undefined, undefined);
4977
+ decoders.DeleteExternalStorageResponse?.(response.body);
4978
+ return { ...response.body, metadata: response.metadata };
4979
+ }
4980
+ async getImporterExternalStorage() {
4981
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/imports/v2/external-storage', undefined, undefined);
4982
+ decoders.GetExternalStorageResponse?.(response.body);
4983
+ return { ...response.body, metadata: response.metadata };
4984
+ }
4985
+ async upsertImporterExternalStorage(request) {
4986
+ const body = {
4987
+ type: request?.type,
4988
+ aws_s3: request?.aws_s3,
4989
+ gcs: request?.gcs,
4990
+ };
4991
+ const response = await this.apiClient.sendRequest('PUT', '/api/v2/imports/v2/external-storage', undefined, undefined, body, 'application/json');
4992
+ decoders.UpsertExternalStorageResponse?.(response.body);
4993
+ return { ...response.body, metadata: response.metadata };
4994
+ }
4995
+ async validateImporterExternalStorage() {
4996
+ const response = await this.apiClient.sendRequest('POST', '/api/v2/imports/v2/external-storage/validate', undefined, undefined);
4997
+ decoders.ValidateExternalStorageResponse?.(response.body);
4998
+ return { ...response.body, metadata: response.metadata };
4999
+ }
4904
5000
  async deleteImportV2Task(request) {
4905
5001
  const pathParams = {
4906
5002
  id: request?.id,
@@ -5087,14 +5183,11 @@ class CommonApi {
5087
5183
  return { ...response.body, metadata: response.metadata };
5088
5184
  }
5089
5185
  async getPollOption(request) {
5090
- const queryParams = {
5091
- user_id: request?.user_id,
5092
- };
5093
5186
  const pathParams = {
5094
5187
  poll_id: request?.poll_id,
5095
5188
  option_id: request?.option_id,
5096
5189
  };
5097
- const response = await this.apiClient.sendRequest('GET', '/api/v2/polls/{poll_id}/options/{option_id}', pathParams, queryParams);
5190
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/polls/{poll_id}/options/{option_id}', pathParams, undefined);
5098
5191
  decoders.PollOptionResponse?.(response.body);
5099
5192
  return { ...response.body, metadata: response.metadata };
5100
5193
  }
@@ -5173,6 +5266,7 @@ class CommonApi {
5173
5266
  android: request?.android,
5174
5267
  ios: request?.ios,
5175
5268
  web: request?.web,
5269
+ unity: request?.unity,
5176
5270
  endpoints: request?.endpoints,
5177
5271
  };
5178
5272
  const response = await this.apiClient.sendRequest('GET', '/api/v2/rate_limits', undefined, queryParams);
@@ -6353,6 +6447,15 @@ class VideoApi {
6353
6447
  decoders.QueryAggregateCallStatsResponse?.(response.body);
6354
6448
  return { ...response.body, metadata: response.metadata };
6355
6449
  }
6450
+ async getDailyDigest(request) {
6451
+ const queryParams = {
6452
+ date: request?.date,
6453
+ app_id: request?.app_id,
6454
+ };
6455
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/video/stats/daily_digest', undefined, queryParams);
6456
+ decoders.GetDailyDigestResponse?.(response.body);
6457
+ return { ...response.body, metadata: response.metadata };
6458
+ }
6356
6459
  }
6357
6460
 
6358
6461
  class CallApi {
@@ -6792,6 +6895,7 @@ class ChatApi {
6792
6895
  predefined_filter: request?.predefined_filter,
6793
6896
  state: request?.state,
6794
6897
  user_id: request?.user_id,
6898
+ member_custom_include: request?.member_custom_include,
6795
6899
  sort: request?.sort,
6796
6900
  filter_conditions: request?.filter_conditions,
6797
6901
  filter_values: request?.filter_values,
@@ -6862,6 +6966,7 @@ class ChatApi {
6862
6966
  hide_for_creator: request?.hide_for_creator,
6863
6967
  state: request?.state,
6864
6968
  thread_unread_counts: request?.thread_unread_counts,
6969
+ member_custom_include: request?.member_custom_include,
6865
6970
  data: request?.data,
6866
6971
  members: request?.members,
6867
6972
  messages: request?.messages,
@@ -6889,6 +6994,11 @@ class ChatApi {
6889
6994
  messages_limit: request?.messages_limit,
6890
6995
  members_limit: request?.members_limit,
6891
6996
  watchers_limit: request?.watchers_limit,
6997
+ messages_id_lt: request?.messages_id_lt,
6998
+ messages_id_lte: request?.messages_id_lte,
6999
+ messages_id_gt: request?.messages_id_gt,
7000
+ messages_id_gte: request?.messages_id_gte,
7001
+ messages_id_around: request?.messages_id_around,
6892
7002
  };
6893
7003
  const pathParams = {
6894
7004
  type: request?.type,
@@ -7069,6 +7179,8 @@ class ChatApi {
7069
7179
  const body = {
7070
7180
  message: request?.message,
7071
7181
  force_moderation: request?.force_moderation,
7182
+ include_channel_context: request?.include_channel_context,
7183
+ include_mentioned_members: request?.include_mentioned_members,
7072
7184
  keep_channel_hidden: request?.keep_channel_hidden,
7073
7185
  pending: request?.pending,
7074
7186
  skip_enrich_url: request?.skip_enrich_url,
@@ -7082,6 +7194,7 @@ class ChatApi {
7082
7194
  async getManyMessages(request) {
7083
7195
  const queryParams = {
7084
7196
  ids: request?.ids,
7197
+ member_custom_include: request?.member_custom_include,
7085
7198
  };
7086
7199
  const pathParams = {
7087
7200
  type: request?.type,
@@ -7100,6 +7213,7 @@ class ChatApi {
7100
7213
  hide_for_creator: request?.hide_for_creator,
7101
7214
  state: request?.state,
7102
7215
  thread_unread_counts: request?.thread_unread_counts,
7216
+ member_custom_include: request?.member_custom_include,
7103
7217
  data: request?.data,
7104
7218
  members: request?.members,
7105
7219
  messages: request?.messages,
@@ -7341,9 +7455,11 @@ class ChatApi {
7341
7455
  channels: request?.channels,
7342
7456
  clear_deleted_message_text: request?.clear_deleted_message_text,
7343
7457
  export_users: request?.export_users,
7458
+ format: request?.format,
7344
7459
  include_soft_deleted_channels: request?.include_soft_deleted_channels,
7345
7460
  include_truncated_messages: request?.include_truncated_messages,
7346
7461
  version: request?.version,
7462
+ include_fields: request?.include_fields,
7347
7463
  };
7348
7464
  const response = await this.apiClient.sendRequest('POST', '/api/v2/chat/export_channels', undefined, undefined, body, 'application/json');
7349
7465
  decoders.ExportChannelsResponse?.(response.body);
@@ -7609,6 +7725,7 @@ class ChatApi {
7609
7725
  id_lt: request?.id_lt,
7610
7726
  id_around: request?.id_around,
7611
7727
  sort: request?.sort,
7728
+ member_custom_include: request?.member_custom_include,
7612
7729
  };
7613
7730
  const pathParams = {
7614
7731
  parent_id: request?.parent_id,
@@ -8598,8 +8715,61 @@ class ModerationApi {
8598
8715
  decoders.MuteResponse?.(response.body);
8599
8716
  return { ...response.body, metadata: response.metadata };
8600
8717
  }
8601
- async listQueues() {
8602
- const response = await this.apiClient.sendRequest('GET', '/api/v2/moderation/queues', undefined, undefined);
8718
+ async getPolicyTestRun(request) {
8719
+ const pathParams = {
8720
+ id: request?.id,
8721
+ };
8722
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/moderation/policy_tests/runs/{id}', pathParams, undefined);
8723
+ decoders.PolicyTestRunResponse?.(response.body);
8724
+ return { ...response.body, metadata: response.metadata };
8725
+ }
8726
+ async listPolicyTestSets() {
8727
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/moderation/policy_tests/sets', undefined, undefined);
8728
+ decoders.PolicyTestSetListResponse?.(response.body);
8729
+ return { ...response.body, metadata: response.metadata };
8730
+ }
8731
+ async createPolicyTestSet(request) {
8732
+ const body = {
8733
+ name: request?.name,
8734
+ config_key: request?.config_key,
8735
+ mode: request?.mode,
8736
+ team: request?.team,
8737
+ rows: request?.rows,
8738
+ seed: request?.seed,
8739
+ };
8740
+ const response = await this.apiClient.sendRequest('POST', '/api/v2/moderation/policy_tests/sets', undefined, undefined, body, 'application/json');
8741
+ decoders.PolicyTestSetResponse?.(response.body);
8742
+ return { ...response.body, metadata: response.metadata };
8743
+ }
8744
+ async deletePolicyTestSet(request) {
8745
+ const pathParams = {
8746
+ id: request?.id,
8747
+ };
8748
+ const response = await this.apiClient.sendRequest('DELETE', '/api/v2/moderation/policy_tests/sets/{id}', pathParams, undefined);
8749
+ decoders.Response?.(response.body);
8750
+ return { ...response.body, metadata: response.metadata };
8751
+ }
8752
+ async getPolicyTestSet(request) {
8753
+ const pathParams = {
8754
+ id: request?.id,
8755
+ };
8756
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/moderation/policy_tests/sets/{id}', pathParams, undefined);
8757
+ decoders.PolicyTestSetResponse?.(response.body);
8758
+ return { ...response.body, metadata: response.metadata };
8759
+ }
8760
+ async startPolicyTestRun(request) {
8761
+ const pathParams = {
8762
+ id: request?.id,
8763
+ };
8764
+ const response = await this.apiClient.sendRequest('POST', '/api/v2/moderation/policy_tests/sets/{id}/runs', pathParams, undefined);
8765
+ decoders.PolicyTestRunResponse?.(response.body);
8766
+ return { ...response.body, metadata: response.metadata };
8767
+ }
8768
+ async listQueues(request) {
8769
+ const queryParams = {
8770
+ user_id: request?.user_id,
8771
+ };
8772
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/moderation/queues', undefined, queryParams);
8603
8773
  decoders.ListQueuesResponse?.(response.body);
8604
8774
  return { ...response.body, metadata: response.metadata };
8605
8775
  }
@@ -8713,6 +8883,7 @@ class ModerationApi {
8713
8883
  delete_message: request?.delete_message,
8714
8884
  delete_reaction: request?.delete_reaction,
8715
8885
  delete_user: request?.delete_user,
8886
+ delete_user_messages: request?.delete_user_messages,
8716
8887
  escalate: request?.escalate,
8717
8888
  flag: request?.flag,
8718
8889
  mark_reviewed: request?.mark_reviewed,
@@ -8798,6 +8969,28 @@ const getRateLimitFromResponseHeader = (responseHeaders) => {
8798
8969
  return result;
8799
8970
  };
8800
8971
 
8972
+ const isScalar = (value) => {
8973
+ const type = typeof value;
8974
+ return type === 'string' || type === 'number' || type === 'boolean';
8975
+ };
8976
+ /**
8977
+ * Scalar arrays go on the wire comma-separated (`ids=a,b`), anything else has
8978
+ * to be JSON or it stringifies to `[object Object]`. `null` and `undefined`
8979
+ * entries are dropped so that a single empty value can't flip the format.
8980
+ */
8981
+ const stringifyArrayParam = (param) => {
8982
+ const entries = [];
8983
+ let allScalar = true;
8984
+ for (const entry of param) {
8985
+ if (entry == null)
8986
+ continue;
8987
+ if (!isScalar(entry))
8988
+ allScalar = false;
8989
+ entries.push(entry);
8990
+ }
8991
+ return allScalar ? entries.join(',') : JSON.stringify(entries);
8992
+ };
8993
+
8801
8994
  class ApiClient {
8802
8995
  constructor(apiConfig) {
8803
8996
  this.apiConfig = apiConfig;
@@ -8819,7 +9012,7 @@ class ApiClient {
8819
9012
  const headers = {
8820
9013
  Authorization: this.apiConfig.token,
8821
9014
  'stream-auth-type': 'jwt',
8822
- 'X-Stream-Client': 'stream-node-' + "0.7.63",
9015
+ 'X-Stream-Client': 'stream-node-' + "0.7.64",
8823
9016
  'Accept-Encoding': 'gzip',
8824
9017
  'x-client-request-id': clientRequestId,
8825
9018
  };
@@ -8884,21 +9077,19 @@ class ApiClient {
8884
9077
  const newParams = [];
8885
9078
  for (const k in params) {
8886
9079
  const param = params[k];
9080
+ if (param === null || param === undefined)
9081
+ continue;
8887
9082
  if (Array.isArray(param)) {
8888
- newParams.push(`${k}=${encodeURIComponent(param.join(','))}`);
9083
+ newParams.push(`${k}=${encodeURIComponent(stringifyArrayParam(param))}`);
8889
9084
  }
8890
9085
  else if (param instanceof Date) {
8891
- newParams.push(param.toISOString());
9086
+ newParams.push(`${k}=${encodeURIComponent(param.toISOString())}`);
8892
9087
  }
8893
9088
  else if (typeof param === 'object') {
8894
9089
  newParams.push(`${k}=${encodeURIComponent(JSON.stringify(param))}`);
8895
9090
  }
8896
- else {
8897
- if (typeof param === 'string' ||
8898
- typeof param === 'number' ||
8899
- typeof param === 'boolean') {
8900
- newParams.push(`${k}=${encodeURIComponent(param)}`);
8901
- }
9091
+ else if (isScalar(param)) {
9092
+ newParams.push(`${k}=${encodeURIComponent(param)}`);
8902
9093
  }
8903
9094
  }
8904
9095
  return newParams.join('&');
@@ -8933,6 +9124,7 @@ class FeedsApi {
8933
9124
  visibility_tag: request?.visibility_tag,
8934
9125
  attachments: request?.attachments,
8935
9126
  collection_refs: request?.collection_refs,
9127
+ collections: request?.collections,
8936
9128
  filter_tags: request?.filter_tags,
8937
9129
  interest_tags: request?.interest_tags,
8938
9130
  mentioned_user_ids: request?.mentioned_user_ids,
@@ -10111,6 +10303,7 @@ class FeedsApi {
10111
10303
  android: request?.android,
10112
10304
  ios: request?.ios,
10113
10305
  web: request?.web,
10306
+ unity: request?.unity,
10114
10307
  server_side: request?.server_side,
10115
10308
  };
10116
10309
  const response = await this.apiClient.sendRequest('GET', '/api/v2/feeds/feeds/rate_limits', undefined, queryParams);