@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.cjs.js CHANGED
@@ -1230,6 +1230,12 @@ decoders.ChannelConfigWithInfo = (input) => {
1230
1230
  };
1231
1231
  return decode(typeMappings, input);
1232
1232
  };
1233
+ decoders.ChannelContextResponse = (input) => {
1234
+ const typeMappings = {
1235
+ created_by: { type: 'UserResponse', isSingle: true },
1236
+ };
1237
+ return decode(typeMappings, input);
1238
+ };
1233
1239
  decoders.ChannelCreatedEvent = (input) => {
1234
1240
  const typeMappings = {
1235
1241
  created_at: { type: 'DatetimeType', isSingle: true },
@@ -1271,6 +1277,7 @@ decoders.ChannelMemberResponse = (input) => {
1271
1277
  archived_at: { type: 'DatetimeType', isSingle: true },
1272
1278
  ban_expires: { type: 'DatetimeType', isSingle: true },
1273
1279
  deleted_at: { type: 'DatetimeType', isSingle: true },
1280
+ future_channel_ban_expires: { type: 'DatetimeType', isSingle: true },
1274
1281
  invite_accepted_at: { type: 'DatetimeType', isSingle: true },
1275
1282
  invite_rejected_at: { type: 'DatetimeType', isSingle: true },
1276
1283
  pinned_at: { type: 'DatetimeType', isSingle: true },
@@ -2349,6 +2356,13 @@ decoders.GetDraftResponse = (input) => {
2349
2356
  };
2350
2357
  return decode(typeMappings, input);
2351
2358
  };
2359
+ decoders.GetExternalStorageResponse = (input) => {
2360
+ const typeMappings = {
2361
+ created_at: { type: 'DatetimeType', isSingle: true },
2362
+ updated_at: { type: 'DatetimeType', isSingle: true },
2363
+ };
2364
+ return decode(typeMappings, input);
2365
+ };
2352
2366
  decoders.GetFeedGroupResponse = (input) => {
2353
2367
  const typeMappings = {
2354
2368
  feed_group: { type: 'FeedGroupResponse', isSingle: true },
@@ -2913,6 +2927,13 @@ decoders.MessageWithChannelResponse = (input) => {
2913
2927
  };
2914
2928
  return decode(typeMappings, input);
2915
2929
  };
2930
+ decoders.ModerationAnalysisFailedEvent = (input) => {
2931
+ const typeMappings = {
2932
+ created_at: { type: 'DatetimeType', isSingle: true },
2933
+ received_at: { type: 'DatetimeType', isSingle: true },
2934
+ };
2935
+ return decode(typeMappings, input);
2936
+ };
2916
2937
  decoders.ModerationCallResponse = (input) => {
2917
2938
  const typeMappings = {
2918
2939
  created_at: { type: 'DatetimeType', isSingle: true },
@@ -3142,6 +3163,49 @@ decoders.PinActivityResponse = (input) => {
3142
3163
  };
3143
3164
  return decode(typeMappings, input);
3144
3165
  };
3166
+ decoders.PolicyTestResult = (input) => {
3167
+ const typeMappings = {
3168
+ created_at: { type: 'DatetimeType', isSingle: true },
3169
+ };
3170
+ return decode(typeMappings, input);
3171
+ };
3172
+ decoders.PolicyTestRun = (input) => {
3173
+ const typeMappings = {
3174
+ created_at: { type: 'DatetimeType', isSingle: true },
3175
+ completed_at: { type: 'DatetimeType', isSingle: true },
3176
+ config_updated_at: { type: 'DatetimeType', isSingle: true },
3177
+ started_at: { type: 'DatetimeType', isSingle: true },
3178
+ };
3179
+ return decode(typeMappings, input);
3180
+ };
3181
+ decoders.PolicyTestRunResponse = (input) => {
3182
+ const typeMappings = {
3183
+ results: { type: 'PolicyTestResult', isSingle: false },
3184
+ run: { type: 'PolicyTestRun', isSingle: true },
3185
+ };
3186
+ return decode(typeMappings, input);
3187
+ };
3188
+ decoders.PolicyTestSet = (input) => {
3189
+ const typeMappings = {
3190
+ created_at: { type: 'DatetimeType', isSingle: true },
3191
+ updated_at: { type: 'DatetimeType', isSingle: true },
3192
+ last_run: { type: 'PolicyTestRun', isSingle: true },
3193
+ };
3194
+ return decode(typeMappings, input);
3195
+ };
3196
+ decoders.PolicyTestSetListResponse = (input) => {
3197
+ const typeMappings = {
3198
+ sets: { type: 'PolicyTestSet', isSingle: false },
3199
+ };
3200
+ return decode(typeMappings, input);
3201
+ };
3202
+ decoders.PolicyTestSetResponse = (input) => {
3203
+ const typeMappings = {
3204
+ recent_runs: { type: 'PolicyTestRun', isSingle: false },
3205
+ set: { type: 'PolicyTestSet', isSingle: true },
3206
+ };
3207
+ return decode(typeMappings, input);
3208
+ };
3145
3209
  decoders.PollResponse = (input) => {
3146
3210
  const typeMappings = {
3147
3211
  poll: { type: 'PollResponseData', isSingle: true },
@@ -3858,6 +3922,7 @@ decoders.SegmentTargetResponse = (input) => {
3858
3922
  decoders.SendMessageResponse = (input) => {
3859
3923
  const typeMappings = {
3860
3924
  message: { type: 'MessageResponse', isSingle: true },
3925
+ channel_context: { type: 'ChannelContextResponse', isSingle: true },
3861
3926
  };
3862
3927
  return decode(typeMappings, input);
3863
3928
  };
@@ -4624,6 +4689,7 @@ class CommonApi {
4624
4689
  guest_user_creation_disabled: request?.guest_user_creation_disabled,
4625
4690
  image_moderation_enabled: request?.image_moderation_enabled,
4626
4691
  max_aggregated_activities_length: request?.max_aggregated_activities_length,
4692
+ member_custom_on_messages_enabled: request?.member_custom_on_messages_enabled,
4627
4693
  migrate_permissions_to_v2: request?.migrate_permissions_to_v2,
4628
4694
  moderation_analytics_enabled: request?.moderation_analytics_enabled,
4629
4695
  moderation_enabled: request?.moderation_enabled,
@@ -4688,6 +4754,8 @@ class CommonApi {
4688
4754
  is_substring_matching_enabled: request?.is_substring_matching_enabled,
4689
4755
  team: request?.team,
4690
4756
  type: request?.type,
4757
+ user_id: request?.user_id,
4758
+ user: request?.user,
4691
4759
  };
4692
4760
  const response = await this.apiClient.sendRequest('POST', '/api/v2/blocklists', undefined, undefined, body, 'application/json');
4693
4761
  decoders.CreateBlockListResponse?.(response.body);
@@ -4708,6 +4776,7 @@ class CommonApi {
4708
4776
  async deleteBlockList(request) {
4709
4777
  const queryParams = {
4710
4778
  team: request?.team,
4779
+ user_id: request?.user_id,
4711
4780
  };
4712
4781
  const pathParams = {
4713
4782
  name: request?.name,
@@ -4737,7 +4806,9 @@ class CommonApi {
4737
4806
  is_plural_check_enabled: request?.is_plural_check_enabled,
4738
4807
  is_substring_matching_enabled: request?.is_substring_matching_enabled,
4739
4808
  team: request?.team,
4809
+ user_id: request?.user_id,
4740
4810
  words: request?.words,
4811
+ user: request?.user,
4741
4812
  };
4742
4813
  const response = await this.apiClient.sendRequest('PUT', '/api/v2/blocklists/{name}', pathParams, undefined, body, 'application/json');
4743
4814
  decoders.UpdateBlockListResponse?.(response.body);
@@ -4920,6 +4991,31 @@ class CommonApi {
4920
4991
  decoders.CreateImportV2TaskResponse?.(response.body);
4921
4992
  return { ...response.body, metadata: response.metadata };
4922
4993
  }
4994
+ async deleteImporterExternalStorage() {
4995
+ const response = await this.apiClient.sendRequest('DELETE', '/api/v2/imports/v2/external-storage', undefined, undefined);
4996
+ decoders.DeleteExternalStorageResponse?.(response.body);
4997
+ return { ...response.body, metadata: response.metadata };
4998
+ }
4999
+ async getImporterExternalStorage() {
5000
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/imports/v2/external-storage', undefined, undefined);
5001
+ decoders.GetExternalStorageResponse?.(response.body);
5002
+ return { ...response.body, metadata: response.metadata };
5003
+ }
5004
+ async upsertImporterExternalStorage(request) {
5005
+ const body = {
5006
+ type: request?.type,
5007
+ aws_s3: request?.aws_s3,
5008
+ gcs: request?.gcs,
5009
+ };
5010
+ const response = await this.apiClient.sendRequest('PUT', '/api/v2/imports/v2/external-storage', undefined, undefined, body, 'application/json');
5011
+ decoders.UpsertExternalStorageResponse?.(response.body);
5012
+ return { ...response.body, metadata: response.metadata };
5013
+ }
5014
+ async validateImporterExternalStorage() {
5015
+ const response = await this.apiClient.sendRequest('POST', '/api/v2/imports/v2/external-storage/validate', undefined, undefined);
5016
+ decoders.ValidateExternalStorageResponse?.(response.body);
5017
+ return { ...response.body, metadata: response.metadata };
5018
+ }
4923
5019
  async deleteImportV2Task(request) {
4924
5020
  const pathParams = {
4925
5021
  id: request?.id,
@@ -5106,14 +5202,11 @@ class CommonApi {
5106
5202
  return { ...response.body, metadata: response.metadata };
5107
5203
  }
5108
5204
  async getPollOption(request) {
5109
- const queryParams = {
5110
- user_id: request?.user_id,
5111
- };
5112
5205
  const pathParams = {
5113
5206
  poll_id: request?.poll_id,
5114
5207
  option_id: request?.option_id,
5115
5208
  };
5116
- const response = await this.apiClient.sendRequest('GET', '/api/v2/polls/{poll_id}/options/{option_id}', pathParams, queryParams);
5209
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/polls/{poll_id}/options/{option_id}', pathParams, undefined);
5117
5210
  decoders.PollOptionResponse?.(response.body);
5118
5211
  return { ...response.body, metadata: response.metadata };
5119
5212
  }
@@ -5192,6 +5285,7 @@ class CommonApi {
5192
5285
  android: request?.android,
5193
5286
  ios: request?.ios,
5194
5287
  web: request?.web,
5288
+ unity: request?.unity,
5195
5289
  endpoints: request?.endpoints,
5196
5290
  };
5197
5291
  const response = await this.apiClient.sendRequest('GET', '/api/v2/rate_limits', undefined, queryParams);
@@ -6372,6 +6466,15 @@ class VideoApi {
6372
6466
  decoders.QueryAggregateCallStatsResponse?.(response.body);
6373
6467
  return { ...response.body, metadata: response.metadata };
6374
6468
  }
6469
+ async getDailyDigest(request) {
6470
+ const queryParams = {
6471
+ date: request?.date,
6472
+ app_id: request?.app_id,
6473
+ };
6474
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/video/stats/daily_digest', undefined, queryParams);
6475
+ decoders.GetDailyDigestResponse?.(response.body);
6476
+ return { ...response.body, metadata: response.metadata };
6477
+ }
6375
6478
  }
6376
6479
 
6377
6480
  class CallApi {
@@ -6811,6 +6914,7 @@ class ChatApi {
6811
6914
  predefined_filter: request?.predefined_filter,
6812
6915
  state: request?.state,
6813
6916
  user_id: request?.user_id,
6917
+ member_custom_include: request?.member_custom_include,
6814
6918
  sort: request?.sort,
6815
6919
  filter_conditions: request?.filter_conditions,
6816
6920
  filter_values: request?.filter_values,
@@ -6881,6 +6985,7 @@ class ChatApi {
6881
6985
  hide_for_creator: request?.hide_for_creator,
6882
6986
  state: request?.state,
6883
6987
  thread_unread_counts: request?.thread_unread_counts,
6988
+ member_custom_include: request?.member_custom_include,
6884
6989
  data: request?.data,
6885
6990
  members: request?.members,
6886
6991
  messages: request?.messages,
@@ -6908,6 +7013,11 @@ class ChatApi {
6908
7013
  messages_limit: request?.messages_limit,
6909
7014
  members_limit: request?.members_limit,
6910
7015
  watchers_limit: request?.watchers_limit,
7016
+ messages_id_lt: request?.messages_id_lt,
7017
+ messages_id_lte: request?.messages_id_lte,
7018
+ messages_id_gt: request?.messages_id_gt,
7019
+ messages_id_gte: request?.messages_id_gte,
7020
+ messages_id_around: request?.messages_id_around,
6911
7021
  };
6912
7022
  const pathParams = {
6913
7023
  type: request?.type,
@@ -7088,6 +7198,8 @@ class ChatApi {
7088
7198
  const body = {
7089
7199
  message: request?.message,
7090
7200
  force_moderation: request?.force_moderation,
7201
+ include_channel_context: request?.include_channel_context,
7202
+ include_mentioned_members: request?.include_mentioned_members,
7091
7203
  keep_channel_hidden: request?.keep_channel_hidden,
7092
7204
  pending: request?.pending,
7093
7205
  skip_enrich_url: request?.skip_enrich_url,
@@ -7101,6 +7213,7 @@ class ChatApi {
7101
7213
  async getManyMessages(request) {
7102
7214
  const queryParams = {
7103
7215
  ids: request?.ids,
7216
+ member_custom_include: request?.member_custom_include,
7104
7217
  };
7105
7218
  const pathParams = {
7106
7219
  type: request?.type,
@@ -7119,6 +7232,7 @@ class ChatApi {
7119
7232
  hide_for_creator: request?.hide_for_creator,
7120
7233
  state: request?.state,
7121
7234
  thread_unread_counts: request?.thread_unread_counts,
7235
+ member_custom_include: request?.member_custom_include,
7122
7236
  data: request?.data,
7123
7237
  members: request?.members,
7124
7238
  messages: request?.messages,
@@ -7360,9 +7474,11 @@ class ChatApi {
7360
7474
  channels: request?.channels,
7361
7475
  clear_deleted_message_text: request?.clear_deleted_message_text,
7362
7476
  export_users: request?.export_users,
7477
+ format: request?.format,
7363
7478
  include_soft_deleted_channels: request?.include_soft_deleted_channels,
7364
7479
  include_truncated_messages: request?.include_truncated_messages,
7365
7480
  version: request?.version,
7481
+ include_fields: request?.include_fields,
7366
7482
  };
7367
7483
  const response = await this.apiClient.sendRequest('POST', '/api/v2/chat/export_channels', undefined, undefined, body, 'application/json');
7368
7484
  decoders.ExportChannelsResponse?.(response.body);
@@ -7628,6 +7744,7 @@ class ChatApi {
7628
7744
  id_lt: request?.id_lt,
7629
7745
  id_around: request?.id_around,
7630
7746
  sort: request?.sort,
7747
+ member_custom_include: request?.member_custom_include,
7631
7748
  };
7632
7749
  const pathParams = {
7633
7750
  parent_id: request?.parent_id,
@@ -8617,8 +8734,61 @@ class ModerationApi {
8617
8734
  decoders.MuteResponse?.(response.body);
8618
8735
  return { ...response.body, metadata: response.metadata };
8619
8736
  }
8620
- async listQueues() {
8621
- const response = await this.apiClient.sendRequest('GET', '/api/v2/moderation/queues', undefined, undefined);
8737
+ async getPolicyTestRun(request) {
8738
+ const pathParams = {
8739
+ id: request?.id,
8740
+ };
8741
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/moderation/policy_tests/runs/{id}', pathParams, undefined);
8742
+ decoders.PolicyTestRunResponse?.(response.body);
8743
+ return { ...response.body, metadata: response.metadata };
8744
+ }
8745
+ async listPolicyTestSets() {
8746
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/moderation/policy_tests/sets', undefined, undefined);
8747
+ decoders.PolicyTestSetListResponse?.(response.body);
8748
+ return { ...response.body, metadata: response.metadata };
8749
+ }
8750
+ async createPolicyTestSet(request) {
8751
+ const body = {
8752
+ name: request?.name,
8753
+ config_key: request?.config_key,
8754
+ mode: request?.mode,
8755
+ team: request?.team,
8756
+ rows: request?.rows,
8757
+ seed: request?.seed,
8758
+ };
8759
+ const response = await this.apiClient.sendRequest('POST', '/api/v2/moderation/policy_tests/sets', undefined, undefined, body, 'application/json');
8760
+ decoders.PolicyTestSetResponse?.(response.body);
8761
+ return { ...response.body, metadata: response.metadata };
8762
+ }
8763
+ async deletePolicyTestSet(request) {
8764
+ const pathParams = {
8765
+ id: request?.id,
8766
+ };
8767
+ const response = await this.apiClient.sendRequest('DELETE', '/api/v2/moderation/policy_tests/sets/{id}', pathParams, undefined);
8768
+ decoders.Response?.(response.body);
8769
+ return { ...response.body, metadata: response.metadata };
8770
+ }
8771
+ async getPolicyTestSet(request) {
8772
+ const pathParams = {
8773
+ id: request?.id,
8774
+ };
8775
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/moderation/policy_tests/sets/{id}', pathParams, undefined);
8776
+ decoders.PolicyTestSetResponse?.(response.body);
8777
+ return { ...response.body, metadata: response.metadata };
8778
+ }
8779
+ async startPolicyTestRun(request) {
8780
+ const pathParams = {
8781
+ id: request?.id,
8782
+ };
8783
+ const response = await this.apiClient.sendRequest('POST', '/api/v2/moderation/policy_tests/sets/{id}/runs', pathParams, undefined);
8784
+ decoders.PolicyTestRunResponse?.(response.body);
8785
+ return { ...response.body, metadata: response.metadata };
8786
+ }
8787
+ async listQueues(request) {
8788
+ const queryParams = {
8789
+ user_id: request?.user_id,
8790
+ };
8791
+ const response = await this.apiClient.sendRequest('GET', '/api/v2/moderation/queues', undefined, queryParams);
8622
8792
  decoders.ListQueuesResponse?.(response.body);
8623
8793
  return { ...response.body, metadata: response.metadata };
8624
8794
  }
@@ -8732,6 +8902,7 @@ class ModerationApi {
8732
8902
  delete_message: request?.delete_message,
8733
8903
  delete_reaction: request?.delete_reaction,
8734
8904
  delete_user: request?.delete_user,
8905
+ delete_user_messages: request?.delete_user_messages,
8735
8906
  escalate: request?.escalate,
8736
8907
  flag: request?.flag,
8737
8908
  mark_reviewed: request?.mark_reviewed,
@@ -8817,6 +8988,28 @@ const getRateLimitFromResponseHeader = (responseHeaders) => {
8817
8988
  return result;
8818
8989
  };
8819
8990
 
8991
+ const isScalar = (value) => {
8992
+ const type = typeof value;
8993
+ return type === 'string' || type === 'number' || type === 'boolean';
8994
+ };
8995
+ /**
8996
+ * Scalar arrays go on the wire comma-separated (`ids=a,b`), anything else has
8997
+ * to be JSON or it stringifies to `[object Object]`. `null` and `undefined`
8998
+ * entries are dropped so that a single empty value can't flip the format.
8999
+ */
9000
+ const stringifyArrayParam = (param) => {
9001
+ const entries = [];
9002
+ let allScalar = true;
9003
+ for (const entry of param) {
9004
+ if (entry == null)
9005
+ continue;
9006
+ if (!isScalar(entry))
9007
+ allScalar = false;
9008
+ entries.push(entry);
9009
+ }
9010
+ return allScalar ? entries.join(',') : JSON.stringify(entries);
9011
+ };
9012
+
8820
9013
  class ApiClient {
8821
9014
  constructor(apiConfig) {
8822
9015
  this.apiConfig = apiConfig;
@@ -8838,7 +9031,7 @@ class ApiClient {
8838
9031
  const headers = {
8839
9032
  Authorization: this.apiConfig.token,
8840
9033
  'stream-auth-type': 'jwt',
8841
- 'X-Stream-Client': 'stream-node-' + "0.7.63",
9034
+ 'X-Stream-Client': 'stream-node-' + "0.7.64",
8842
9035
  'Accept-Encoding': 'gzip',
8843
9036
  'x-client-request-id': clientRequestId,
8844
9037
  };
@@ -8903,21 +9096,19 @@ class ApiClient {
8903
9096
  const newParams = [];
8904
9097
  for (const k in params) {
8905
9098
  const param = params[k];
9099
+ if (param === null || param === undefined)
9100
+ continue;
8906
9101
  if (Array.isArray(param)) {
8907
- newParams.push(`${k}=${encodeURIComponent(param.join(','))}`);
9102
+ newParams.push(`${k}=${encodeURIComponent(stringifyArrayParam(param))}`);
8908
9103
  }
8909
9104
  else if (param instanceof Date) {
8910
- newParams.push(param.toISOString());
9105
+ newParams.push(`${k}=${encodeURIComponent(param.toISOString())}`);
8911
9106
  }
8912
9107
  else if (typeof param === 'object') {
8913
9108
  newParams.push(`${k}=${encodeURIComponent(JSON.stringify(param))}`);
8914
9109
  }
8915
- else {
8916
- if (typeof param === 'string' ||
8917
- typeof param === 'number' ||
8918
- typeof param === 'boolean') {
8919
- newParams.push(`${k}=${encodeURIComponent(param)}`);
8920
- }
9110
+ else if (isScalar(param)) {
9111
+ newParams.push(`${k}=${encodeURIComponent(param)}`);
8921
9112
  }
8922
9113
  }
8923
9114
  return newParams.join('&');
@@ -8952,6 +9143,7 @@ class FeedsApi {
8952
9143
  visibility_tag: request?.visibility_tag,
8953
9144
  attachments: request?.attachments,
8954
9145
  collection_refs: request?.collection_refs,
9146
+ collections: request?.collections,
8955
9147
  filter_tags: request?.filter_tags,
8956
9148
  interest_tags: request?.interest_tags,
8957
9149
  mentioned_user_ids: request?.mentioned_user_ids,
@@ -10130,6 +10322,7 @@ class FeedsApi {
10130
10322
  android: request?.android,
10131
10323
  ios: request?.ios,
10132
10324
  web: request?.web,
10325
+ unity: request?.unity,
10133
10326
  server_side: request?.server_side,
10134
10327
  };
10135
10328
  const response = await this.apiClient.sendRequest('GET', '/api/v2/feeds/feeds/rate_limits', undefined, queryParams);