@stream-io/node-sdk 0.9.1 → 0.9.3
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/CHANGELOG.md +14 -0
- package/dist/index.cjs.js +173 -62
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.es.mjs +172 -61
- package/dist/index.es.mjs.map +1 -1
- package/dist/src/ApiClient.d.ts +1 -1
- package/dist/src/gen/chat/ChannelApi.d.ts +1 -0
- package/dist/src/gen/chat/ChatApi.d.ts +3 -1
- package/dist/src/gen/common/CommonApi.d.ts +4 -1
- package/dist/src/gen/feeds/FeedsApi.d.ts +1 -0
- package/dist/src/gen/models/index.d.ts +683 -17
- package/dist/src/gen/moderation/ModerationApi.d.ts +23 -1
- package/dist/src/utils/webhook.d.ts +15 -0
- package/index.ts +1 -0
- package/package.json +11 -11
- package/src/ApiClient.ts +5 -2
- package/src/gen/chat/ChannelApi.ts +1 -0
- package/src/gen/chat/ChatApi.ts +27 -0
- package/src/gen/common/CommonApi.ts +11 -2
- package/src/gen/feeds/FeedsApi.ts +2 -0
- package/src/gen/models/index.ts +772 -17
- package/src/gen/moderation/ModerationApi.ts +222 -0
- package/src/utils/webhook.ts +24 -2
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export * from './src/StreamVideoClient';
|
|
|
6
6
|
export * from './src/gen/models';
|
|
7
7
|
export * from './src/StreamFeedsClient';
|
|
8
8
|
export * from './src/StreamFeed';
|
|
9
|
-
export { InvalidWebhookError, InvalidWebhookErrorMessages, verifyAndParseWebhook, } from './src/utils/webhook';
|
|
9
|
+
export { InvalidWebhookError, InvalidWebhookErrorMessages, verifyAndParseWebhook, webhookConfig, } from './src/utils/webhook';
|
|
10
10
|
export { convertTimestampToDate, dateToNs, msToNs, nowNs, NS_PER_MS, nsToDate, nsToMs, nsToRfc3339, } from './src/utils/time';
|
|
11
11
|
export { StreamError } from './src/types';
|
package/dist/index.es.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import jwt from "jsonwebtoken";
|
|
2
2
|
import crypto, { randomUUID } from "crypto";
|
|
3
3
|
import zlib from "zlib";
|
|
4
|
-
|
|
4
|
+
// src/utils/create-token.ts
|
|
5
5
|
function JWTUserToken(apiSecret, payload) {
|
|
6
6
|
if (jwt?.sign == null) 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.`);
|
|
7
7
|
const opts = {
|
|
@@ -19,8 +19,7 @@ function JWTServerToken(apiSecret, jwtOptions = {}) {
|
|
|
19
19
|
}, jwtOptions);
|
|
20
20
|
return jwt.sign(payload, apiSecret, opts);
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
//#region src/utils/webhook.ts
|
|
22
|
+
// src/utils/webhook.ts
|
|
24
23
|
/**
|
|
25
24
|
* Canonical failure-mode messages for {@link InvalidWebhookError}.
|
|
26
25
|
*
|
|
@@ -51,6 +50,15 @@ var InvalidWebhookError = class extends Error {
|
|
|
51
50
|
};
|
|
52
51
|
var GZIP_MAGIC = Buffer.from([31, 139]);
|
|
53
52
|
/**
|
|
53
|
+
* Webhook helper settings.
|
|
54
|
+
*
|
|
55
|
+
* `maxPayloadBytes` caps the decompressed size of a gzip webhook body
|
|
56
|
+
* (default 10 MiB). {@link gunzipPayload} runs before the signature
|
|
57
|
+
* check, so without a cap an unsigned gzip bomb could exhaust memory.
|
|
58
|
+
* Raise it if your events are larger.
|
|
59
|
+
*/
|
|
60
|
+
var webhookConfig = { maxPayloadBytes: 10485760 };
|
|
61
|
+
/**
|
|
54
62
|
* Returns `body` as a `Buffer`, gzip-decompressed when its first two
|
|
55
63
|
* bytes match the gzip magic (`1f 8b`, per RFC 1952). When the body is
|
|
56
64
|
* plain JSON (no compression, or middleware already decompressed), the
|
|
@@ -59,13 +67,21 @@ var GZIP_MAGIC = Buffer.from([31, 139]);
|
|
|
59
67
|
* Magic-byte detection (rather than relying on a header) keeps the same
|
|
60
68
|
* handler correct when middleware - Express, Next.js, AWS Lambda -
|
|
61
69
|
* auto-decompresses the request before your code sees it.
|
|
70
|
+
*
|
|
71
|
+
* @throws {InvalidWebhookError} When the body has the gzip magic but is
|
|
72
|
+
* not valid gzip, or inflates to more than
|
|
73
|
+
* `webhookConfig.maxPayloadBytes`.
|
|
62
74
|
*/
|
|
63
75
|
function gunzipPayload(rawBody) {
|
|
64
76
|
const body = Buffer.isBuffer(rawBody) ? rawBody : Buffer.from(rawBody);
|
|
65
|
-
if (body.length >= 2 && body.subarray(0, 2).equals(GZIP_MAGIC))
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
if (body.length >= 2 && body.subarray(0, 2).equals(GZIP_MAGIC)) {
|
|
78
|
+
const limit = webhookConfig.maxPayloadBytes;
|
|
79
|
+
try {
|
|
80
|
+
return zlib.gunzipSync(body, { maxOutputLength: limit });
|
|
81
|
+
} catch (err) {
|
|
82
|
+
if (err.code === "ERR_BUFFER_TOO_LARGE") throw new InvalidWebhookError(`${InvalidWebhookErrorMessages.gzipFailed}: payload exceeds ${limit} bytes`);
|
|
83
|
+
throw new InvalidWebhookError(InvalidWebhookErrorMessages.gzipFailed);
|
|
84
|
+
}
|
|
69
85
|
}
|
|
70
86
|
return body;
|
|
71
87
|
}
|
|
@@ -173,8 +189,7 @@ function parseSqs(messageBody) {
|
|
|
173
189
|
function parseSns(notificationBody) {
|
|
174
190
|
return parseEvent(decodeSnsPayload(notificationBody));
|
|
175
191
|
}
|
|
176
|
-
|
|
177
|
-
//#region src/gen/model-decoders/decoders.ts
|
|
192
|
+
// src/gen/model-decoders/decoders.ts
|
|
178
193
|
var decoders = {};
|
|
179
194
|
var decodeDatetimeType = (input) => typeof input === "number" ? new Date(Math.floor(input / 1e6)) : new Date(input);
|
|
180
195
|
decoders.DatetimeType = decodeDatetimeType;
|
|
@@ -219,8 +234,7 @@ decoders["GetApplicationResponse"] = (input) => {
|
|
|
219
234
|
isSingle: true
|
|
220
235
|
} }, input);
|
|
221
236
|
};
|
|
222
|
-
|
|
223
|
-
//#region src/gen/common/CommonApi.ts
|
|
237
|
+
// src/gen/common/CommonApi.ts
|
|
224
238
|
var CommonApi = class {
|
|
225
239
|
apiClient;
|
|
226
240
|
constructor(apiClient) {
|
|
@@ -283,6 +297,7 @@ var CommonApi = class {
|
|
|
283
297
|
user_search_disallowed_roles: request?.user_search_disallowed_roles,
|
|
284
298
|
webhook_events: request?.webhook_events,
|
|
285
299
|
activity_metrics_config: request?.activity_metrics_config,
|
|
300
|
+
agent_review: request?.agent_review,
|
|
286
301
|
apn_config: request?.apn_config,
|
|
287
302
|
async_moderation_config: request?.async_moderation_config,
|
|
288
303
|
datadog_info: request?.datadog_info,
|
|
@@ -508,8 +523,12 @@ var CommonApi = class {
|
|
|
508
523
|
decoders["CreateImportURLResponse"]?.(response);
|
|
509
524
|
return response;
|
|
510
525
|
}
|
|
511
|
-
async listImports() {
|
|
512
|
-
const
|
|
526
|
+
async listImports(request) {
|
|
527
|
+
const queryParams = {
|
|
528
|
+
limit: request?.limit,
|
|
529
|
+
offset: request?.offset
|
|
530
|
+
};
|
|
531
|
+
const response = await this.apiClient.sendRequest("GET", "/api/v2/imports", void 0, queryParams);
|
|
513
532
|
decoders["ListImportsResponse"]?.(response);
|
|
514
533
|
return response;
|
|
515
534
|
}
|
|
@@ -1140,8 +1159,7 @@ var CommonApi = class {
|
|
|
1140
1159
|
return response;
|
|
1141
1160
|
}
|
|
1142
1161
|
};
|
|
1143
|
-
|
|
1144
|
-
//#region src/gen/video/VideoApi.ts
|
|
1162
|
+
// src/gen/video/VideoApi.ts
|
|
1145
1163
|
var VideoApi = class {
|
|
1146
1164
|
apiClient;
|
|
1147
1165
|
constructor(apiClient) {
|
|
@@ -1971,8 +1989,7 @@ var VideoApi = class {
|
|
|
1971
1989
|
return response;
|
|
1972
1990
|
}
|
|
1973
1991
|
};
|
|
1974
|
-
|
|
1975
|
-
//#region src/gen/video/CallApi.ts
|
|
1992
|
+
// src/gen/video/CallApi.ts
|
|
1976
1993
|
var CallApi = class {
|
|
1977
1994
|
videoApi;
|
|
1978
1995
|
type;
|
|
@@ -2256,8 +2273,7 @@ var CallApi = class {
|
|
|
2256
2273
|
});
|
|
2257
2274
|
}
|
|
2258
2275
|
};
|
|
2259
|
-
|
|
2260
|
-
//#region src/StreamCall.ts
|
|
2276
|
+
// src/StreamCall.ts
|
|
2261
2277
|
var StreamCall = class extends CallApi {
|
|
2262
2278
|
type;
|
|
2263
2279
|
id;
|
|
@@ -2298,8 +2314,7 @@ var StreamCall = class extends CallApi {
|
|
|
2298
2314
|
return { address: this.data.ingress.srt.address.replace("{passphrase}", segments[2]).replace("{token}", token) };
|
|
2299
2315
|
};
|
|
2300
2316
|
};
|
|
2301
|
-
|
|
2302
|
-
//#region src/StreamVideoClient.ts
|
|
2317
|
+
// src/StreamVideoClient.ts
|
|
2303
2318
|
var StreamVideoClient = class extends VideoApi {
|
|
2304
2319
|
streamClient;
|
|
2305
2320
|
constructor({ streamClient, apiClient }) {
|
|
@@ -2341,8 +2356,7 @@ var StreamVideoClient = class extends VideoApi {
|
|
|
2341
2356
|
return realtimeClient;
|
|
2342
2357
|
};
|
|
2343
2358
|
};
|
|
2344
|
-
|
|
2345
|
-
//#region src/gen/chat/ChatApi.ts
|
|
2359
|
+
// src/gen/chat/ChatApi.ts
|
|
2346
2360
|
var ChatApi = class {
|
|
2347
2361
|
apiClient;
|
|
2348
2362
|
constructor(apiClient) {
|
|
@@ -2565,6 +2579,7 @@ var ChatApi = class {
|
|
|
2565
2579
|
messages_id_gt: request?.messages_id_gt,
|
|
2566
2580
|
messages_id_gte: request?.messages_id_gte,
|
|
2567
2581
|
messages_id_around: request?.messages_id_around,
|
|
2582
|
+
include_soft_deleted_channel: request?.include_soft_deleted_channel,
|
|
2568
2583
|
user_id: request?.user_id
|
|
2569
2584
|
};
|
|
2570
2585
|
const pathParams = {
|
|
@@ -3528,6 +3543,17 @@ var ChatApi = class {
|
|
|
3528
3543
|
decoders["SearchResponse"]?.(response);
|
|
3529
3544
|
return response;
|
|
3530
3545
|
}
|
|
3546
|
+
async searchAll(request) {
|
|
3547
|
+
const body = {
|
|
3548
|
+
limit: request?.limit,
|
|
3549
|
+
query: request?.query,
|
|
3550
|
+
entities: request?.entities,
|
|
3551
|
+
next: request?.next
|
|
3552
|
+
};
|
|
3553
|
+
const response = await this.apiClient.sendRequest("POST", "/api/v2/chat/search/all", void 0, void 0, body);
|
|
3554
|
+
decoders["SearchAllResponse"]?.(response);
|
|
3555
|
+
return response;
|
|
3556
|
+
}
|
|
3531
3557
|
async createSegment(request) {
|
|
3532
3558
|
const body = {
|
|
3533
3559
|
type: request?.type,
|
|
@@ -3689,8 +3715,7 @@ var ChatApi = class {
|
|
|
3689
3715
|
return response;
|
|
3690
3716
|
}
|
|
3691
3717
|
};
|
|
3692
|
-
|
|
3693
|
-
//#region src/gen/chat/ChannelApi.ts
|
|
3718
|
+
// src/gen/chat/ChannelApi.ts
|
|
3694
3719
|
var ChannelApi = class {
|
|
3695
3720
|
chatApi;
|
|
3696
3721
|
type;
|
|
@@ -3901,8 +3926,7 @@ var ChannelApi = class {
|
|
|
3901
3926
|
});
|
|
3902
3927
|
}
|
|
3903
3928
|
};
|
|
3904
|
-
|
|
3905
|
-
//#region src/StreamChannel.ts
|
|
3929
|
+
// src/StreamChannel.ts
|
|
3906
3930
|
var StreamChannel = class extends ChannelApi {
|
|
3907
3931
|
get cid() {
|
|
3908
3932
|
return `${this.type}:${this.id}`;
|
|
@@ -3935,8 +3959,7 @@ var StreamChannel = class extends ChannelApi {
|
|
|
3935
3959
|
return super.uploadChannelImage(request);
|
|
3936
3960
|
};
|
|
3937
3961
|
};
|
|
3938
|
-
|
|
3939
|
-
//#region src/StreamChatClient.ts
|
|
3962
|
+
// src/StreamChatClient.ts
|
|
3940
3963
|
var StreamChatClient = class extends ChatApi {
|
|
3941
3964
|
channel = (type, id) => {
|
|
3942
3965
|
return new StreamChannel(this, type, id);
|
|
@@ -3948,8 +3971,7 @@ var StreamChatClient = class extends ChatApi {
|
|
|
3948
3971
|
return super.uploadChannelImage(request);
|
|
3949
3972
|
};
|
|
3950
3973
|
};
|
|
3951
|
-
|
|
3952
|
-
//#region src/gen/moderation/ModerationApi.ts
|
|
3974
|
+
// src/gen/moderation/ModerationApi.ts
|
|
3953
3975
|
var ModerationApi = class {
|
|
3954
3976
|
apiClient;
|
|
3955
3977
|
constructor(apiClient) {
|
|
@@ -4026,6 +4048,33 @@ var ModerationApi = class {
|
|
|
4026
4048
|
decoders["InsertActionLogResponse"]?.(response);
|
|
4027
4049
|
return response;
|
|
4028
4050
|
}
|
|
4051
|
+
async listAgentFeedback(request) {
|
|
4052
|
+
const queryParams = {
|
|
4053
|
+
limit: request?.limit,
|
|
4054
|
+
next: request?.next
|
|
4055
|
+
};
|
|
4056
|
+
const response = await this.apiClient.sendRequest("GET", "/api/v2/moderation/agent_feedback", void 0, queryParams);
|
|
4057
|
+
decoders["ListAgentFeedbackResponse"]?.(response);
|
|
4058
|
+
return response;
|
|
4059
|
+
}
|
|
4060
|
+
async submitAgentFeedback(request) {
|
|
4061
|
+
const body = {
|
|
4062
|
+
item_id: request?.item_id,
|
|
4063
|
+
moderator_action: request?.moderator_action,
|
|
4064
|
+
improvement: request?.improvement,
|
|
4065
|
+
reason: request?.reason,
|
|
4066
|
+
user_id: request?.user_id,
|
|
4067
|
+
user: request?.user
|
|
4068
|
+
};
|
|
4069
|
+
const response = await this.apiClient.sendRequest("POST", "/api/v2/moderation/agent_feedback", void 0, void 0, body);
|
|
4070
|
+
decoders["SubmitAgentFeedbackResponse"]?.(response);
|
|
4071
|
+
return response;
|
|
4072
|
+
}
|
|
4073
|
+
async getAgentReviewStatus() {
|
|
4074
|
+
const response = await this.apiClient.sendRequest("GET", "/api/v2/moderation/agent_review_status", void 0, void 0);
|
|
4075
|
+
decoders["GetAgentReviewStatusResponse"]?.(response);
|
|
4076
|
+
return response;
|
|
4077
|
+
}
|
|
4029
4078
|
async analyze(request) {
|
|
4030
4079
|
const body = {
|
|
4031
4080
|
async_response: request?.async_response,
|
|
@@ -4187,6 +4236,37 @@ var ModerationApi = class {
|
|
|
4187
4236
|
decoders["UpsertConfigResponse"]?.(response);
|
|
4188
4237
|
return response;
|
|
4189
4238
|
}
|
|
4239
|
+
async saveConfigVersion(request) {
|
|
4240
|
+
const body = {
|
|
4241
|
+
base_version: request?.base_version,
|
|
4242
|
+
key: request?.key,
|
|
4243
|
+
async: request?.async,
|
|
4244
|
+
team: request?.team,
|
|
4245
|
+
user_id: request?.user_id,
|
|
4246
|
+
ai_audio_config: request?.ai_audio_config,
|
|
4247
|
+
ai_image_config: request?.ai_image_config,
|
|
4248
|
+
ai_text_config: request?.ai_text_config,
|
|
4249
|
+
ai_video_config: request?.ai_video_config,
|
|
4250
|
+
automod_platform_circumvention_config: request?.automod_platform_circumvention_config,
|
|
4251
|
+
automod_semantic_filters_config: request?.automod_semantic_filters_config,
|
|
4252
|
+
automod_toxicity_config: request?.automod_toxicity_config,
|
|
4253
|
+
aws_rekognition_config: request?.aws_rekognition_config,
|
|
4254
|
+
block_list_config: request?.block_list_config,
|
|
4255
|
+
bodyguard_config: request?.bodyguard_config,
|
|
4256
|
+
engine: request?.engine,
|
|
4257
|
+
flood_config: request?.flood_config,
|
|
4258
|
+
google_vision_config: request?.google_vision_config,
|
|
4259
|
+
intent_config: request?.intent_config,
|
|
4260
|
+
llm_config: request?.llm_config,
|
|
4261
|
+
rule_builder_config: request?.rule_builder_config,
|
|
4262
|
+
user: request?.user,
|
|
4263
|
+
velocity_filter_config: request?.velocity_filter_config,
|
|
4264
|
+
video_call_rule_config: request?.video_call_rule_config
|
|
4265
|
+
};
|
|
4266
|
+
const response = await this.apiClient.sendRequest("POST", "/api/v2/moderation/config/versions", void 0, void 0, body);
|
|
4267
|
+
decoders["SaveConfigVersionResponse"]?.(response);
|
|
4268
|
+
return response;
|
|
4269
|
+
}
|
|
4190
4270
|
async deleteConfig(request) {
|
|
4191
4271
|
const queryParams = {
|
|
4192
4272
|
team: request?.team,
|
|
@@ -4204,6 +4284,37 @@ var ModerationApi = class {
|
|
|
4204
4284
|
decoders["GetConfigResponse"]?.(response);
|
|
4205
4285
|
return response;
|
|
4206
4286
|
}
|
|
4287
|
+
async listConfigVersions(request) {
|
|
4288
|
+
const queryParams = { team: request?.team };
|
|
4289
|
+
const pathParams = { key: request?.key };
|
|
4290
|
+
const response = await this.apiClient.sendRequest("GET", "/api/v2/moderation/config/{key}/versions", pathParams, queryParams);
|
|
4291
|
+
decoders["ListConfigVersionsResponse"]?.(response);
|
|
4292
|
+
return response;
|
|
4293
|
+
}
|
|
4294
|
+
async getConfigVersion(request) {
|
|
4295
|
+
const queryParams = { team: request?.team };
|
|
4296
|
+
const pathParams = {
|
|
4297
|
+
key: request?.key,
|
|
4298
|
+
version: request?.version
|
|
4299
|
+
};
|
|
4300
|
+
const response = await this.apiClient.sendRequest("GET", "/api/v2/moderation/config/{key}/versions/{version}", pathParams, queryParams);
|
|
4301
|
+
decoders["GetConfigVersionResponse"]?.(response);
|
|
4302
|
+
return response;
|
|
4303
|
+
}
|
|
4304
|
+
async publishConfigVersion(request) {
|
|
4305
|
+
const pathParams = {
|
|
4306
|
+
key: request?.key,
|
|
4307
|
+
version: request?.version
|
|
4308
|
+
};
|
|
4309
|
+
const body = {
|
|
4310
|
+
team: request?.team,
|
|
4311
|
+
user_id: request?.user_id,
|
|
4312
|
+
user: request?.user
|
|
4313
|
+
};
|
|
4314
|
+
const response = await this.apiClient.sendRequest("POST", "/api/v2/moderation/config/{key}/versions/{version}/publish", pathParams, void 0, body);
|
|
4315
|
+
decoders["PublishConfigVersionResponse"]?.(response);
|
|
4316
|
+
return response;
|
|
4317
|
+
}
|
|
4207
4318
|
async queryModerationConfigs(request) {
|
|
4208
4319
|
const body = {
|
|
4209
4320
|
limit: request?.limit,
|
|
@@ -4530,6 +4641,16 @@ var ModerationApi = class {
|
|
|
4530
4641
|
decoders["QueryReviewQueueResponse"]?.(response);
|
|
4531
4642
|
return response;
|
|
4532
4643
|
}
|
|
4644
|
+
async countReviewQueue(request) {
|
|
4645
|
+
const body = {
|
|
4646
|
+
user_id: request?.user_id,
|
|
4647
|
+
filter: request?.filter,
|
|
4648
|
+
user: request?.user
|
|
4649
|
+
};
|
|
4650
|
+
const response = await this.apiClient.sendRequest("POST", "/api/v2/moderation/review_queue/count", void 0, void 0, body);
|
|
4651
|
+
decoders["CountReviewQueueResponse"]?.(response);
|
|
4652
|
+
return response;
|
|
4653
|
+
}
|
|
4533
4654
|
async getReviewQueueItem(request) {
|
|
4534
4655
|
const pathParams = { id: request?.id };
|
|
4535
4656
|
const response = await this.apiClient.sendRequest("GET", "/api/v2/moderation/review_queue/{id}", pathParams, void 0);
|
|
@@ -4557,6 +4678,7 @@ var ModerationApi = class {
|
|
|
4557
4678
|
appeal_id: request?.appeal_id,
|
|
4558
4679
|
item_id: request?.item_id,
|
|
4559
4680
|
user_id: request?.user_id,
|
|
4681
|
+
agent_recommendation: request?.agent_recommendation,
|
|
4560
4682
|
ban: request?.ban,
|
|
4561
4683
|
block: request?.block,
|
|
4562
4684
|
bypass: request?.bypass,
|
|
@@ -4614,7 +4736,8 @@ var ModerationApi = class {
|
|
|
4614
4736
|
const queryParams = {
|
|
4615
4737
|
target_user_id: request?.target_user_id,
|
|
4616
4738
|
channel_cid: request?.channel_cid,
|
|
4617
|
-
created_by: request?.created_by
|
|
4739
|
+
created_by: request?.created_by,
|
|
4740
|
+
remove_future_channels_ban: request?.remove_future_channels_ban
|
|
4618
4741
|
};
|
|
4619
4742
|
const body = {
|
|
4620
4743
|
unbanned_by_id: request?.unbanned_by_id,
|
|
@@ -4635,11 +4758,9 @@ var ModerationApi = class {
|
|
|
4635
4758
|
return response;
|
|
4636
4759
|
}
|
|
4637
4760
|
};
|
|
4638
|
-
|
|
4639
|
-
//#region src/StreamModerationClient.ts
|
|
4761
|
+
// src/StreamModerationClient.ts
|
|
4640
4762
|
var StreamModerationClient = class extends ModerationApi {};
|
|
4641
|
-
|
|
4642
|
-
//#region src/types.ts
|
|
4763
|
+
// src/types.ts
|
|
4643
4764
|
var StreamError = class extends Error {
|
|
4644
4765
|
metadata;
|
|
4645
4766
|
code;
|
|
@@ -4651,8 +4772,7 @@ var StreamError = class extends Error {
|
|
|
4651
4772
|
this.apiError = apiError;
|
|
4652
4773
|
}
|
|
4653
4774
|
};
|
|
4654
|
-
|
|
4655
|
-
//#region src/utils/rate-limit.ts
|
|
4775
|
+
// src/utils/rate-limit.ts
|
|
4656
4776
|
var getRateLimitFromResponseHeader = (responseHeaders) => {
|
|
4657
4777
|
return {
|
|
4658
4778
|
rateLimit: responseHeaders.has("x-ratelimit-limit") ? +responseHeaders.get("x-ratelimit-limit") : void 0,
|
|
@@ -4660,8 +4780,7 @@ var getRateLimitFromResponseHeader = (responseHeaders) => {
|
|
|
4660
4780
|
rateLimitReset: responseHeaders.has("x-ratelimit-reset") ? /* @__PURE__ */ new Date(+responseHeaders.get("x-ratelimit-reset") * 1e3) : void 0
|
|
4661
4781
|
};
|
|
4662
4782
|
};
|
|
4663
|
-
|
|
4664
|
-
//#region src/utils/query-params.ts
|
|
4783
|
+
// src/utils/query-params.ts
|
|
4665
4784
|
var isScalar = (value) => {
|
|
4666
4785
|
const type = typeof value;
|
|
4667
4786
|
return type === "string" || type === "number" || type === "boolean";
|
|
@@ -4681,8 +4800,7 @@ var stringifyArrayParam = (param) => {
|
|
|
4681
4800
|
}
|
|
4682
4801
|
return allScalar ? entries.join(",") : JSON.stringify(entries);
|
|
4683
4802
|
};
|
|
4684
|
-
|
|
4685
|
-
//#region src/ApiClient.ts
|
|
4803
|
+
// src/ApiClient.ts
|
|
4686
4804
|
var ApiClient = class {
|
|
4687
4805
|
apiConfig;
|
|
4688
4806
|
dispatcher;
|
|
@@ -4699,14 +4817,14 @@ var ApiClient = class {
|
|
|
4699
4817
|
queryParams.api_key = this.apiConfig.apiKey;
|
|
4700
4818
|
const encodedParams = this.queryParamsStringify(queryParams);
|
|
4701
4819
|
if (pathParams) Object.keys(pathParams).forEach((paramName) => {
|
|
4702
|
-
url = url.replace(`{${paramName}}`, pathParams[paramName]);
|
|
4820
|
+
url = url.replace(`{${paramName}}`, encodeURIComponent(pathParams[paramName]));
|
|
4703
4821
|
});
|
|
4704
4822
|
url += `?${encodedParams}`;
|
|
4705
4823
|
const clientRequestId = randomUUID();
|
|
4706
4824
|
const headers = {
|
|
4707
4825
|
Authorization: this.apiConfig.token,
|
|
4708
4826
|
"stream-auth-type": "jwt",
|
|
4709
|
-
"X-Stream-Client": "stream-node-0.9.
|
|
4827
|
+
"X-Stream-Client": "stream-node-0.9.3",
|
|
4710
4828
|
"Accept-Encoding": "gzip",
|
|
4711
4829
|
"x-client-request-id": clientRequestId
|
|
4712
4830
|
};
|
|
@@ -4775,8 +4893,7 @@ var ApiClient = class {
|
|
|
4775
4893
|
return newParams.join("&");
|
|
4776
4894
|
};
|
|
4777
4895
|
};
|
|
4778
|
-
|
|
4779
|
-
//#region src/gen/feeds/FeedsApi.ts
|
|
4896
|
+
// src/gen/feeds/FeedsApi.ts
|
|
4780
4897
|
var FeedsApi = class {
|
|
4781
4898
|
apiClient;
|
|
4782
4899
|
constructor(apiClient) {
|
|
@@ -5050,7 +5167,8 @@ var FeedsApi = class {
|
|
|
5050
5167
|
translate_text: request?.translate_text,
|
|
5051
5168
|
include_top_level_comment_count: request?.include_top_level_comment_count,
|
|
5052
5169
|
include_soft_deleted_activities: request?.include_soft_deleted_activities,
|
|
5053
|
-
include_moderated_activities: request?.include_moderated_activities
|
|
5170
|
+
include_moderated_activities: request?.include_moderated_activities,
|
|
5171
|
+
skip_viewer_visibility: request?.skip_viewer_visibility
|
|
5054
5172
|
};
|
|
5055
5173
|
const pathParams = { id: request?.id };
|
|
5056
5174
|
const response = await this.apiClient.sendRequest("GET", "/api/v2/feeds/activities/{id}", pathParams, queryParams);
|
|
@@ -6277,8 +6395,7 @@ var FeedsApi = class {
|
|
|
6277
6395
|
return response;
|
|
6278
6396
|
}
|
|
6279
6397
|
};
|
|
6280
|
-
|
|
6281
|
-
//#region src/gen/feeds/FeedApi.ts
|
|
6398
|
+
// src/gen/feeds/FeedApi.ts
|
|
6282
6399
|
var FeedApi = class {
|
|
6283
6400
|
feedsApi;
|
|
6284
6401
|
group;
|
|
@@ -6386,15 +6503,13 @@ var FeedApi = class {
|
|
|
6386
6503
|
});
|
|
6387
6504
|
}
|
|
6388
6505
|
};
|
|
6389
|
-
|
|
6390
|
-
//#region src/StreamFeed.ts
|
|
6506
|
+
// src/StreamFeed.ts
|
|
6391
6507
|
var StreamFeed = class extends FeedApi {
|
|
6392
6508
|
get feed() {
|
|
6393
6509
|
return `${this.group}:${this.id}`;
|
|
6394
6510
|
}
|
|
6395
6511
|
};
|
|
6396
|
-
|
|
6397
|
-
//#region src/StreamFeedsClient.ts
|
|
6512
|
+
// src/StreamFeedsClient.ts
|
|
6398
6513
|
var StreamFeedsClient = class extends FeedsApi {
|
|
6399
6514
|
feed = (group, id) => {
|
|
6400
6515
|
return new StreamFeed(this, group, id);
|
|
@@ -6421,8 +6536,7 @@ var StreamFeedsClient = class extends FeedsApi {
|
|
|
6421
6536
|
return super.unfollowBatch(request);
|
|
6422
6537
|
};
|
|
6423
6538
|
};
|
|
6424
|
-
|
|
6425
|
-
//#region src/StreamClient.ts
|
|
6539
|
+
// src/StreamClient.ts
|
|
6426
6540
|
var StreamClient = class StreamClient extends CommonApi {
|
|
6427
6541
|
apiKey;
|
|
6428
6542
|
secret;
|
|
@@ -6619,8 +6733,7 @@ var StreamClient = class StreamClient extends CommonApi {
|
|
|
6619
6733
|
*/
|
|
6620
6734
|
parseSns = (notificationBody) => parseSns(notificationBody);
|
|
6621
6735
|
};
|
|
6622
|
-
|
|
6623
|
-
//#region src/gen/models/index.ts
|
|
6736
|
+
// src/gen/models/index.ts
|
|
6624
6737
|
var ChannelOwnCapability = {
|
|
6625
6738
|
BAN_CHANNEL_MEMBERS: "ban-channel-members",
|
|
6626
6739
|
CAST_POLL_VOTE: "cast-poll-vote",
|
|
@@ -6735,8 +6848,7 @@ var OwnCapability = {
|
|
|
6735
6848
|
UPDATE_CALL_PERMISSIONS: "update-call-permissions",
|
|
6736
6849
|
UPDATE_CALL_SETTINGS: "update-call-settings"
|
|
6737
6850
|
};
|
|
6738
|
-
|
|
6739
|
-
//#region src/utils/time.ts
|
|
6851
|
+
// src/utils/time.ts
|
|
6740
6852
|
/**
|
|
6741
6853
|
* Unit conversions between the API's timestamps and JavaScript's.
|
|
6742
6854
|
*
|
|
@@ -6811,7 +6923,6 @@ var convertTimestampToDate = (timestamp) => {
|
|
|
6811
6923
|
if (timestamp == null || !Number.isFinite(timestamp)) return void 0;
|
|
6812
6924
|
return nsToDate(timestamp);
|
|
6813
6925
|
};
|
|
6814
|
-
|
|
6815
|
-
export { ChannelOwnCapability, FeedOwnCapability, InvalidWebhookError, InvalidWebhookErrorMessages, NS_PER_MS, OwnCapability, StreamCall, StreamChannel, StreamChatClient, StreamClient, StreamError, StreamFeed, StreamFeedsClient, StreamVideoClient, convertTimestampToDate, dateToNs, msToNs, nowNs, nsToDate, nsToMs, nsToRfc3339, verifyAndParseWebhook };
|
|
6926
|
+
export { ChannelOwnCapability, FeedOwnCapability, InvalidWebhookError, InvalidWebhookErrorMessages, NS_PER_MS, OwnCapability, StreamCall, StreamChannel, StreamChatClient, StreamClient, StreamError, StreamFeed, StreamFeedsClient, StreamVideoClient, convertTimestampToDate, dateToNs, msToNs, nowNs, nsToDate, nsToMs, nsToRfc3339, verifyAndParseWebhook, webhookConfig };
|
|
6816
6927
|
|
|
6817
6928
|
//# sourceMappingURL=index.es.mjs.map
|