stream-chat 10.0.1 → 10.0.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/cjs/index.browser.js +53 -7
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +54 -7
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +53 -7
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/client.d.ts +6 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types.d.ts +2 -2
- package/dist/types/version.d.ts +60 -0
- package/package.json +1 -1
- package/src/client.ts +26 -8
- package/src/index.ts +2 -0
- package/src/types.ts +2 -2
- package/src/version.ts +98 -0
package/dist/cjs/index.node.js
CHANGED
|
@@ -270,6 +270,7 @@ __export(src_exports, {
|
|
|
270
270
|
textIsEmpty: () => textIsEmpty,
|
|
271
271
|
textStartsWithCommand: () => textStartsWithCommand,
|
|
272
272
|
timeLeftMs: () => timeLeftMs,
|
|
273
|
+
version: () => version,
|
|
273
274
|
withCancellation: () => withCancellation,
|
|
274
275
|
withoutConcurrency: () => withoutConcurrency
|
|
275
276
|
});
|
|
@@ -1652,6 +1653,38 @@ var errorIsApiError = (error) => {
|
|
|
1652
1653
|
};
|
|
1653
1654
|
var isTokenExpiredError = (error) => errorIsApiError(error) && error.response?.data.code === chatCodes.TOKEN_EXPIRED;
|
|
1654
1655
|
|
|
1656
|
+
// src/version.ts
|
|
1657
|
+
var SEMVER_PATTERN = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+?)(?:\.(\d+))?)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
1658
|
+
var parseVersion = (raw) => {
|
|
1659
|
+
const input = raw || "0.0.0-development";
|
|
1660
|
+
const [, major = 0, minor = 0, patch = 0, prerelease = null, prereleaseNumber] = SEMVER_PATTERN.exec(input) ?? [];
|
|
1661
|
+
return Object.freeze({
|
|
1662
|
+
major: Number(major),
|
|
1663
|
+
minor: Number(minor),
|
|
1664
|
+
patch: Number(patch),
|
|
1665
|
+
prerelease,
|
|
1666
|
+
prereleaseNumber: prereleaseNumber ? Number(prereleaseNumber) : null,
|
|
1667
|
+
raw: input
|
|
1668
|
+
});
|
|
1669
|
+
};
|
|
1670
|
+
var readInjectedVersion = () => {
|
|
1671
|
+
try {
|
|
1672
|
+
return "10.0.2";
|
|
1673
|
+
} catch {
|
|
1674
|
+
return void 0;
|
|
1675
|
+
}
|
|
1676
|
+
};
|
|
1677
|
+
var readInjectedClientBundle = () => {
|
|
1678
|
+
try {
|
|
1679
|
+
return "node-cjs";
|
|
1680
|
+
} catch {
|
|
1681
|
+
return void 0;
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
var version = /* @__PURE__ */ parseVersion(
|
|
1685
|
+
/* @__PURE__ */ readInjectedVersion()
|
|
1686
|
+
);
|
|
1687
|
+
|
|
1655
1688
|
// src/errors.ts
|
|
1656
1689
|
var import_axios3 = require("axios");
|
|
1657
1690
|
|
|
@@ -25323,11 +25356,11 @@ var StreamChat = class _StreamChat extends ChatApi {
|
|
|
25323
25356
|
return this.userAgent;
|
|
25324
25357
|
}
|
|
25325
25358
|
if (!this.cachedUserAgent) {
|
|
25326
|
-
const
|
|
25359
|
+
const version2 = readInjectedVersion();
|
|
25327
25360
|
const { name: sdkName, version: sdkVersion } = this.sdkIdentifier ?? {};
|
|
25328
25361
|
const { name: appName, version: appVersion } = this.appIdentifier ?? {};
|
|
25329
25362
|
const { os, model: deviceModel } = this.deviceIdentifier ?? {};
|
|
25330
|
-
const head = sdkName ? `stream-chat-${sdkName}-v${sdkVersion}-llc-v${
|
|
25363
|
+
const head = sdkName ? `stream-chat-${sdkName}-v${sdkVersion}-llc-v${version2}` : `stream-chat-js-v${version2}-${this.node ? "node" : "browser"}`;
|
|
25331
25364
|
this.cachedUserAgent = [
|
|
25332
25365
|
head,
|
|
25333
25366
|
// Each only when a value is present.
|
|
@@ -25336,7 +25369,7 @@ var StreamChat = class _StreamChat extends ChatApi {
|
|
|
25336
25369
|
app_version: appVersion,
|
|
25337
25370
|
os,
|
|
25338
25371
|
device_model: deviceModel,
|
|
25339
|
-
client_bundle:
|
|
25372
|
+
client_bundle: readInjectedClientBundle()
|
|
25340
25373
|
}).filter(([, value]) => value && value.length > 0).map(([key, value]) => `${key}=${value}`)
|
|
25341
25374
|
].join("|");
|
|
25342
25375
|
}
|
|
@@ -25999,16 +26032,29 @@ var StreamChat = class _StreamChat extends ChatApi {
|
|
|
25999
26032
|
};
|
|
26000
26033
|
}
|
|
26001
26034
|
/**
|
|
26002
|
-
* Revokes a global ban.
|
|
26035
|
+
* Revokes a global ban, or a channel ban when `options.type` and `options.id` name a channel.
|
|
26036
|
+
*
|
|
26037
|
+
* Goes through V2 `client.moderation.unban()`. The one exception is
|
|
26038
|
+
* `remove_future_channels_ban`, which that endpoint does not accept, so a call with it set still
|
|
26039
|
+
* goes to v1 `DELETE /moderation/ban`. `shadow` is accepted for compatibility but ignored: the
|
|
26040
|
+
* server lifts whichever ban is in place, shadow or not, on both endpoints.
|
|
26003
26041
|
*
|
|
26004
26042
|
* @param targetUserId - The user to unban.
|
|
26005
26043
|
* @param options - Unban options (optional).
|
|
26006
26044
|
* @returns The server response.
|
|
26007
26045
|
*/
|
|
26008
26046
|
async unbanUser(targetUserId, options) {
|
|
26009
|
-
|
|
26010
|
-
|
|
26011
|
-
|
|
26047
|
+
const { id, remove_future_channels_ban, type } = options ?? {};
|
|
26048
|
+
const target_user_id = options?.target_user_id ?? targetUserId;
|
|
26049
|
+
if (remove_future_channels_ban) {
|
|
26050
|
+
return await this.api.delete(this.baseURL + "/moderation/ban", {
|
|
26051
|
+
...options,
|
|
26052
|
+
target_user_id
|
|
26053
|
+
});
|
|
26054
|
+
}
|
|
26055
|
+
return await this.moderation.unban({
|
|
26056
|
+
target_user_id,
|
|
26057
|
+
channel_cid: type && id ? `${type}:${id}` : void 0
|
|
26012
26058
|
});
|
|
26013
26059
|
}
|
|
26014
26060
|
async blockUser(blockedUserId, requestOptions) {
|
|
@@ -28385,6 +28431,7 @@ var LiveLocationManager = _LiveLocationManager;
|
|
|
28385
28431
|
textIsEmpty,
|
|
28386
28432
|
textStartsWithCommand,
|
|
28387
28433
|
timeLeftMs,
|
|
28434
|
+
version,
|
|
28388
28435
|
withCancellation,
|
|
28389
28436
|
withoutConcurrency
|
|
28390
28437
|
});
|