@wildix/xbees-conversations-utils 1.1.85 → 1.1.86
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/README.md +118 -1
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/streamRateLimitHandlingProxy/constants.js +43 -0
- package/dist-cjs/streamRateLimitHandlingProxy/createRateLimitedStreamProxy.js +92 -0
- package/dist-cjs/streamRateLimitHandlingProxy/generatedMethodNames.js +320 -0
- package/dist-cjs/streamRateLimitHandlingProxy/helpers/RedisCooldown.js +174 -0
- package/dist-cjs/streamRateLimitHandlingProxy/helpers/createRateLimitExceededException.js +32 -0
- package/dist-cjs/streamRateLimitHandlingProxy/helpers/executeWithRateLimitHandling.js +144 -0
- package/dist-cjs/streamRateLimitHandlingProxy/helpers/headerUtils.js +40 -0
- package/dist-cjs/streamRateLimitHandlingProxy/helpers/isStreamChannelLike.js +23 -0
- package/dist-cjs/streamRateLimitHandlingProxy/helpers/processStreamBudgetHeaders.js +93 -0
- package/dist-cjs/streamRateLimitHandlingProxy/helpers/processStreamRateLimitException.js +63 -0
- package/dist-cjs/streamRateLimitHandlingProxy/helpers/processStreamRateLimitHeaders.js +72 -0
- package/dist-cjs/streamRateLimitHandlingProxy/helpers/rateLimitSnapshot.js +31 -0
- package/dist-cjs/streamRateLimitHandlingProxy/helpers/registerStreamInterceptors.js +58 -0
- package/dist-cjs/streamRateLimitHandlingProxy/helpers/splitCallArgsAndOptions.js +21 -0
- package/dist-cjs/streamRateLimitHandlingProxy/index.js +5 -0
- package/dist-cjs/streamRateLimitHandlingProxy/types.js +3 -0
- package/dist-cjs/streamRateLimitHandlingProxy/withStreamRateLimitOptions.js +10 -0
- package/dist-es/index.js +1 -1
- package/dist-es/streamRateLimitHandlingProxy/constants.js +33 -0
- package/dist-es/streamRateLimitHandlingProxy/createRateLimitedStreamProxy.js +88 -0
- package/dist-es/streamRateLimitHandlingProxy/generatedMethodNames.js +317 -0
- package/dist-es/streamRateLimitHandlingProxy/helpers/RedisCooldown.js +170 -0
- package/dist-es/streamRateLimitHandlingProxy/helpers/createRateLimitExceededException.js +28 -0
- package/dist-es/streamRateLimitHandlingProxy/helpers/executeWithRateLimitHandling.js +140 -0
- package/dist-es/streamRateLimitHandlingProxy/helpers/headerUtils.js +34 -0
- package/dist-es/streamRateLimitHandlingProxy/helpers/isStreamChannelLike.js +19 -0
- package/dist-es/streamRateLimitHandlingProxy/helpers/processStreamBudgetHeaders.js +89 -0
- package/dist-es/streamRateLimitHandlingProxy/helpers/processStreamRateLimitException.js +59 -0
- package/dist-es/streamRateLimitHandlingProxy/helpers/processStreamRateLimitHeaders.js +68 -0
- package/dist-es/streamRateLimitHandlingProxy/helpers/rateLimitSnapshot.js +26 -0
- package/dist-es/streamRateLimitHandlingProxy/helpers/registerStreamInterceptors.js +54 -0
- package/dist-es/streamRateLimitHandlingProxy/helpers/splitCallArgsAndOptions.js +17 -0
- package/dist-es/streamRateLimitHandlingProxy/index.js +2 -0
- package/dist-es/streamRateLimitHandlingProxy/types.js +1 -0
- package/dist-es/streamRateLimitHandlingProxy/withStreamRateLimitOptions.js +6 -0
- package/dist-types/index.d.ts +1 -1
- package/dist-types/streamRateLimitHandlingProxy/constants.d.ts +29 -0
- package/dist-types/streamRateLimitHandlingProxy/createRateLimitedStreamProxy.d.ts +11 -0
- package/dist-types/streamRateLimitHandlingProxy/generatedMethodNames.d.ts +11 -0
- package/dist-types/streamRateLimitHandlingProxy/helpers/RedisCooldown.d.ts +11 -0
- package/dist-types/streamRateLimitHandlingProxy/helpers/createRateLimitExceededException.d.ts +10 -0
- package/dist-types/streamRateLimitHandlingProxy/helpers/executeWithRateLimitHandling.d.ts +2 -0
- package/dist-types/streamRateLimitHandlingProxy/helpers/headerUtils.d.ts +4 -0
- package/dist-types/streamRateLimitHandlingProxy/helpers/isStreamChannelLike.d.ts +6 -0
- package/dist-types/streamRateLimitHandlingProxy/helpers/processStreamBudgetHeaders.d.ts +9 -0
- package/dist-types/streamRateLimitHandlingProxy/helpers/processStreamRateLimitException.d.ts +3 -0
- package/dist-types/streamRateLimitHandlingProxy/helpers/processStreamRateLimitHeaders.d.ts +6 -0
- package/dist-types/streamRateLimitHandlingProxy/helpers/rateLimitSnapshot.d.ts +3 -0
- package/dist-types/streamRateLimitHandlingProxy/helpers/registerStreamInterceptors.d.ts +2 -0
- package/dist-types/streamRateLimitHandlingProxy/helpers/splitCallArgsAndOptions.d.ts +6 -0
- package/dist-types/streamRateLimitHandlingProxy/index.d.ts +2 -0
- package/dist-types/streamRateLimitHandlingProxy/types.d.ts +68 -0
- package/dist-types/streamRateLimitHandlingProxy/withStreamRateLimitOptions.d.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerStreamInterceptors = void 0;
|
|
4
|
+
const processStreamBudgetHeaders_1 = require("./processStreamBudgetHeaders");
|
|
5
|
+
const processStreamRateLimitHeaders_1 = require("./processStreamRateLimitHeaders");
|
|
6
|
+
const attachedInterceptors = new WeakSet();
|
|
7
|
+
function hasResponseInterceptors(value) {
|
|
8
|
+
return (typeof value === 'object' &&
|
|
9
|
+
value !== null &&
|
|
10
|
+
typeof value.interceptors?.response?.use === 'function');
|
|
11
|
+
}
|
|
12
|
+
function resolveAxiosInstance(stream) {
|
|
13
|
+
if (hasResponseInterceptors(stream)) {
|
|
14
|
+
return stream;
|
|
15
|
+
}
|
|
16
|
+
if (typeof stream !== 'object' || stream === null) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const maybeStream = stream;
|
|
20
|
+
if (hasResponseInterceptors(maybeStream.axiosInstance)) {
|
|
21
|
+
return maybeStream.axiosInstance;
|
|
22
|
+
}
|
|
23
|
+
if (hasResponseInterceptors(maybeStream._client?.axiosInstance)) {
|
|
24
|
+
return maybeStream._client?.axiosInstance;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function registerStreamInterceptors(stream, context) {
|
|
28
|
+
const { logger } = context;
|
|
29
|
+
const axiosInstance = resolveAxiosInstance(stream);
|
|
30
|
+
if (!axiosInstance || !axiosInstance.interceptors?.response?.use) {
|
|
31
|
+
logger.warn('Unable to register stream budget & rate limit interceptors: axios instance not found');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (attachedInterceptors.has(axiosInstance)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
attachedInterceptors.add(axiosInstance);
|
|
38
|
+
axiosInstance.interceptors.response.use(async (response) => {
|
|
39
|
+
try {
|
|
40
|
+
await (0, processStreamBudgetHeaders_1.processStreamBudgetHeaders)(response?.headers, context);
|
|
41
|
+
await (0, processStreamRateLimitHeaders_1.processStreamRateLimitHeaders)(response?.headers, context);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
logger.warn('Failed to process Stream response headers in interceptor', { error });
|
|
45
|
+
}
|
|
46
|
+
return response;
|
|
47
|
+
}, async (error) => {
|
|
48
|
+
try {
|
|
49
|
+
await (0, processStreamBudgetHeaders_1.processStreamBudgetHeaders)(error?.response?.headers, context);
|
|
50
|
+
await (0, processStreamRateLimitHeaders_1.processStreamRateLimitHeaders)(error?.response?.headers, context);
|
|
51
|
+
}
|
|
52
|
+
catch (interceptorError) {
|
|
53
|
+
logger.warn('Failed to process Stream error headers in interceptor', { error: interceptorError });
|
|
54
|
+
}
|
|
55
|
+
return Promise.reject(error);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
exports.registerStreamInterceptors = registerStreamInterceptors;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.splitCallArgsAndOptions = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
function isStreamRateLimitOptionsToken(value) {
|
|
6
|
+
return typeof value === 'object' && value !== null && constants_1.STREAM_RATE_LIMIT_OPTIONS_MARKER in value;
|
|
7
|
+
}
|
|
8
|
+
function splitCallArgsAndOptions(args) {
|
|
9
|
+
if (args.length === 0) {
|
|
10
|
+
return { callArgs: args, callOptions: {} };
|
|
11
|
+
}
|
|
12
|
+
const lastArg = args[args.length - 1];
|
|
13
|
+
if (isStreamRateLimitOptionsToken(lastArg)) {
|
|
14
|
+
return {
|
|
15
|
+
callArgs: args.slice(0, -1),
|
|
16
|
+
callOptions: lastArg[constants_1.STREAM_RATE_LIMIT_OPTIONS_MARKER],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return { callArgs: args, callOptions: {} };
|
|
20
|
+
}
|
|
21
|
+
exports.splitCallArgsAndOptions = splitCallArgsAndOptions;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withStreamRateLimitOptions = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
function withStreamRateLimitOptions(options) {
|
|
6
|
+
return {
|
|
7
|
+
[constants_1.STREAM_RATE_LIMIT_OPTIONS_MARKER]: options,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
exports.withStreamRateLimitOptions = withStreamRateLimitOptions;
|
package/dist-es/index.js
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { CHANNEL_METHOD_NAMES, CHANNEL_SYNC_METHOD_NAMES, CHANNEL_SYNC_PROXY_RESULT_METHOD_NAMES, STREAM_CHANNEL_RESULT_METHOD_NAMES, STREAM_METHOD_NAMES, STREAM_SYNC_CHANNEL_RESULT_METHOD_NAMES, STREAM_SYNC_METHOD_NAMES, } from './generatedMethodNames';
|
|
2
|
+
export const DEFAULT_MAX_DELAY_MS = 5000;
|
|
3
|
+
export const DEFAULT_RETRY_AFTER_MS = 10000;
|
|
4
|
+
export const DEFAULT_JITTER_MS = 150;
|
|
5
|
+
export const RETRY_AFTER_BUFFER_MS = 1000;
|
|
6
|
+
export const STREAM_RATE_LIMIT_COOLDOWN_KEY_PREFIX = 'stream-rate-limit-cooldown:';
|
|
7
|
+
export const STREAM_BUDGET_COOLDOWN_KEY_PREFIX = 'stream-budget-cooldown:';
|
|
8
|
+
export const STREAM_RATE_LIMIT_OPTIONS_MARKER = '__xbsRateLimitOptions';
|
|
9
|
+
export const STREAM_RATE_LIMIT_SOFT_COOLDOWN_KEY = 'stream-rate-limit-soft-global';
|
|
10
|
+
export const STREAM_RATE_LIMIT_METADATA_KEY_SUFFIX = ':meta';
|
|
11
|
+
export const STREAM_BUDGET_COOLDOWN_KEY = 'stream-budget-global';
|
|
12
|
+
export const BUDGET_THRESHOLD = 0.8;
|
|
13
|
+
export const BUDGET_DELAY_MIN_MS = 30000;
|
|
14
|
+
export const BUDGET_DELAY_MAX_MS = 60000;
|
|
15
|
+
export const BUDGET_CLEAR_USAGE_THRESHOLD = 0.6;
|
|
16
|
+
export const BUDGET_RELAXED_USAGE_THRESHOLD = 0.7;
|
|
17
|
+
export const BUDGET_RELAXED_DELAY_MIN_MS = 5000;
|
|
18
|
+
export const BUDGET_RELAXED_DELAY_MAX_MS = 10000;
|
|
19
|
+
export const BUDGET_MINIMAL_DELAY_MIN_MS = 1000;
|
|
20
|
+
export const BUDGET_MINIMAL_DELAY_MAX_MS = 2000;
|
|
21
|
+
export const BUDGET_COOLDOWN_SLEEP_CHUNK_MS = 3000;
|
|
22
|
+
export const SOFT_THROTTLE_USAGE_LOW = 0.7;
|
|
23
|
+
export const SOFT_THROTTLE_USAGE_MEDIUM = 0.85;
|
|
24
|
+
export const SOFT_THROTTLE_USAGE_HIGH = 0.95;
|
|
25
|
+
export const SOFT_THROTTLE_DELAY_LOW_MS = 500;
|
|
26
|
+
export const SOFT_THROTTLE_DELAY_MEDIUM_MS = 1500;
|
|
27
|
+
export const SOFT_THROTTLE_DELAY_HIGH_MS = 3000;
|
|
28
|
+
export const DEFAULT_OPTIONS = {
|
|
29
|
+
maxAttempts: 3,
|
|
30
|
+
enableCooldown: true,
|
|
31
|
+
maxDelayMs: 5000,
|
|
32
|
+
maxRetryableDelayMs: 10000,
|
|
33
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CHANNEL_SYNC_METHOD_NAMES, CHANNEL_SYNC_PROXY_RESULT_METHOD_NAMES, DEFAULT_OPTIONS, STREAM_CHANNEL_RESULT_METHOD_NAMES, STREAM_SYNC_CHANNEL_RESULT_METHOD_NAMES, STREAM_SYNC_METHOD_NAMES, } from './constants';
|
|
2
|
+
import { executeWithRateLimitHandling } from './helpers/executeWithRateLimitHandling';
|
|
3
|
+
import { isStreamChannelLike } from './helpers/isStreamChannelLike';
|
|
4
|
+
import { registerStreamInterceptors } from './helpers/registerStreamInterceptors';
|
|
5
|
+
import { splitCallArgsAndOptions } from './helpers/splitCallArgsAndOptions';
|
|
6
|
+
const STREAM_SYNC_METHODS = new Set(STREAM_SYNC_METHOD_NAMES);
|
|
7
|
+
const STREAM_CHANNEL_RESULT_METHODS = new Set(STREAM_CHANNEL_RESULT_METHOD_NAMES);
|
|
8
|
+
const STREAM_SYNC_CHANNEL_RESULT_METHODS = new Set(STREAM_SYNC_CHANNEL_RESULT_METHOD_NAMES);
|
|
9
|
+
const CHANNEL_SYNC_METHODS = new Set(CHANNEL_SYNC_METHOD_NAMES);
|
|
10
|
+
const CHANNEL_SYNC_PROXY_RESULT_METHODS = new Set(CHANNEL_SYNC_PROXY_RESULT_METHOD_NAMES);
|
|
11
|
+
function wrapKnownChannelResult(result, dependencies) {
|
|
12
|
+
if (Array.isArray(result)) {
|
|
13
|
+
return result.map((item) => wrapKnownChannelResult(item, dependencies));
|
|
14
|
+
}
|
|
15
|
+
if (typeof result !== 'object' || result === null) {
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
return wrapTarget(result, dependencies);
|
|
19
|
+
}
|
|
20
|
+
function normalizeStreamCallResult(result, dependencies, wrapAsChannelResult = false) {
|
|
21
|
+
if (wrapAsChannelResult) {
|
|
22
|
+
return wrapKnownChannelResult(result, dependencies);
|
|
23
|
+
}
|
|
24
|
+
if (Array.isArray(result)) {
|
|
25
|
+
return result.map((item) => normalizeStreamCallResult(item, dependencies));
|
|
26
|
+
}
|
|
27
|
+
if (!isStreamChannelLike(result)) {
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
return wrapTarget(result, dependencies);
|
|
31
|
+
}
|
|
32
|
+
function createRateLimitedMethodWrapper(target, value, operation, dependencies, wrapAsChannelResult) {
|
|
33
|
+
return async (...args) => {
|
|
34
|
+
const { callArgs, callOptions } = splitCallArgsAndOptions(args);
|
|
35
|
+
const result = await executeWithRateLimitHandling(() => Reflect.apply(value, target, callArgs), operation, dependencies.context, {
|
|
36
|
+
...DEFAULT_OPTIONS,
|
|
37
|
+
...callOptions,
|
|
38
|
+
});
|
|
39
|
+
return normalizeStreamCallResult(result, dependencies, wrapAsChannelResult);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function wrapTarget(target, dependencies) {
|
|
43
|
+
const cachedObject = dependencies.cache.get(target);
|
|
44
|
+
if (cachedObject) {
|
|
45
|
+
return cachedObject;
|
|
46
|
+
}
|
|
47
|
+
const proxy = new Proxy(target, {
|
|
48
|
+
get: (originalTarget, property, receiver) => {
|
|
49
|
+
const value = Reflect.get(originalTarget, property, receiver);
|
|
50
|
+
if (typeof property !== 'string' || typeof value !== 'function') {
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
if (STREAM_SYNC_CHANNEL_RESULT_METHODS.has(property)) {
|
|
54
|
+
return (...args) => {
|
|
55
|
+
const { callArgs } = splitCallArgsAndOptions(args);
|
|
56
|
+
const result = Reflect.apply(value, originalTarget, callArgs);
|
|
57
|
+
return normalizeStreamCallResult(result, dependencies, true);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (CHANNEL_SYNC_PROXY_RESULT_METHODS.has(property)) {
|
|
61
|
+
return (...args) => {
|
|
62
|
+
const { callArgs } = splitCallArgsAndOptions(args);
|
|
63
|
+
const result = Reflect.apply(value, originalTarget, callArgs);
|
|
64
|
+
if (typeof result === 'object' && result !== null) {
|
|
65
|
+
return wrapTarget(result, dependencies);
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (STREAM_SYNC_METHODS.has(property) || CHANNEL_SYNC_METHODS.has(property)) {
|
|
71
|
+
return (...args) => {
|
|
72
|
+
const { callArgs } = splitCallArgsAndOptions(args);
|
|
73
|
+
return Reflect.apply(value, originalTarget, callArgs);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return createRateLimitedMethodWrapper(originalTarget, value, property, dependencies, STREAM_CHANNEL_RESULT_METHODS.has(property));
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
dependencies.cache.set(target, proxy);
|
|
80
|
+
return proxy;
|
|
81
|
+
}
|
|
82
|
+
export function createRateLimitedStreamProxy(stream, context) {
|
|
83
|
+
registerStreamInterceptors(stream, context);
|
|
84
|
+
return wrapTarget(stream, {
|
|
85
|
+
context,
|
|
86
|
+
cache: new WeakMap(),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
export const STREAM_METHOD_NAMES = [
|
|
2
|
+
'_addChannelConfig',
|
|
3
|
+
'_buildWSPayload',
|
|
4
|
+
'_callClientListeners',
|
|
5
|
+
'_createImport',
|
|
6
|
+
'_createImportURL',
|
|
7
|
+
'_deleteUserMessageReference',
|
|
8
|
+
'_enrichAxiosOptions',
|
|
9
|
+
'_getConnectionID',
|
|
10
|
+
'_getImport',
|
|
11
|
+
'_getToken',
|
|
12
|
+
'_handleClientEvent',
|
|
13
|
+
'_handleUserEvent',
|
|
14
|
+
'_hasConnectionID',
|
|
15
|
+
'_isUsingServerAuth',
|
|
16
|
+
'_listImports',
|
|
17
|
+
'_logApiError',
|
|
18
|
+
'_logApiRequest',
|
|
19
|
+
'_logApiResponse',
|
|
20
|
+
'_muteStatus',
|
|
21
|
+
'_normalizeDate',
|
|
22
|
+
'_normalizeExpiration',
|
|
23
|
+
'_queryFlagReports',
|
|
24
|
+
'_queryFlags',
|
|
25
|
+
'_reviewFlagReport',
|
|
26
|
+
'_sayHi',
|
|
27
|
+
'_setToken',
|
|
28
|
+
'_setupConnection',
|
|
29
|
+
'_setUser',
|
|
30
|
+
'_startCleaning',
|
|
31
|
+
'_unblockMessage',
|
|
32
|
+
'_updateMemberWatcherReferences',
|
|
33
|
+
'_updateUserMessageReferences',
|
|
34
|
+
'_updateUserReferences',
|
|
35
|
+
'_validateAndGetMessageId',
|
|
36
|
+
'addDevice',
|
|
37
|
+
'banUser',
|
|
38
|
+
'channel',
|
|
39
|
+
'closeConnection',
|
|
40
|
+
'commitMessage',
|
|
41
|
+
'connect',
|
|
42
|
+
'connectAnonymousUser',
|
|
43
|
+
'connectUser',
|
|
44
|
+
'createAbortControllerForNextRequest',
|
|
45
|
+
'createBlockList',
|
|
46
|
+
'createCampaign',
|
|
47
|
+
'createChannelType',
|
|
48
|
+
'createCommand',
|
|
49
|
+
'createPermission',
|
|
50
|
+
'createRole',
|
|
51
|
+
'createSegment',
|
|
52
|
+
'createToken',
|
|
53
|
+
'deactivateUser',
|
|
54
|
+
'deactivateUsers',
|
|
55
|
+
'delete',
|
|
56
|
+
'deleteBlockList',
|
|
57
|
+
'deleteCampaign',
|
|
58
|
+
'deleteChannels',
|
|
59
|
+
'deleteChannelType',
|
|
60
|
+
'deleteCommand',
|
|
61
|
+
'deleteMessage',
|
|
62
|
+
'deletePermission',
|
|
63
|
+
'deletePushProvider',
|
|
64
|
+
'deleteRole',
|
|
65
|
+
'deleteSegment',
|
|
66
|
+
'deleteUser',
|
|
67
|
+
'deleteUsers',
|
|
68
|
+
'devToken',
|
|
69
|
+
'disconnect',
|
|
70
|
+
'disconnectUser',
|
|
71
|
+
'dispatchEvent',
|
|
72
|
+
'doAxiosRequest',
|
|
73
|
+
'enrichURL',
|
|
74
|
+
'errorFromResponse',
|
|
75
|
+
'exportChannel',
|
|
76
|
+
'exportChannels',
|
|
77
|
+
'exportUser',
|
|
78
|
+
'exportUsers',
|
|
79
|
+
'flagMessage',
|
|
80
|
+
'flagUser',
|
|
81
|
+
'get',
|
|
82
|
+
'getAppSettings',
|
|
83
|
+
'getAuthType',
|
|
84
|
+
'getBlockList',
|
|
85
|
+
'getCallToken',
|
|
86
|
+
'getChannelById',
|
|
87
|
+
'getChannelByMembers',
|
|
88
|
+
'getChannelType',
|
|
89
|
+
'getCommand',
|
|
90
|
+
'getDevices',
|
|
91
|
+
'getExportChannelStatus',
|
|
92
|
+
'getMessage',
|
|
93
|
+
'getPermission',
|
|
94
|
+
'getRateLimits',
|
|
95
|
+
'getTask',
|
|
96
|
+
'getUnreadCount',
|
|
97
|
+
'getUserAgent',
|
|
98
|
+
'handleEvent',
|
|
99
|
+
'handleResponse',
|
|
100
|
+
'hydrateActiveChannels',
|
|
101
|
+
'listBlockLists',
|
|
102
|
+
'listChannelTypes',
|
|
103
|
+
'listCommands',
|
|
104
|
+
'listPermissions',
|
|
105
|
+
'listPushProviders',
|
|
106
|
+
'listRoles',
|
|
107
|
+
'markAllRead',
|
|
108
|
+
'markChannelsRead',
|
|
109
|
+
'muteUser',
|
|
110
|
+
'off',
|
|
111
|
+
'on',
|
|
112
|
+
'openConnection',
|
|
113
|
+
'partialUpdateMessage',
|
|
114
|
+
'partialUpdateUser',
|
|
115
|
+
'partialUpdateUsers',
|
|
116
|
+
'patch',
|
|
117
|
+
'pinMessage',
|
|
118
|
+
'post',
|
|
119
|
+
'put',
|
|
120
|
+
'queryBannedUsers',
|
|
121
|
+
'queryCampaigns',
|
|
122
|
+
'queryChannels',
|
|
123
|
+
'queryMessageFlags',
|
|
124
|
+
'queryRecipients',
|
|
125
|
+
'querySegments',
|
|
126
|
+
'queryUsers',
|
|
127
|
+
'reactivateUser',
|
|
128
|
+
'reactivateUsers',
|
|
129
|
+
'recoverState',
|
|
130
|
+
'removeDevice',
|
|
131
|
+
'removeShadowBan',
|
|
132
|
+
'restoreUsers',
|
|
133
|
+
'resumeCampaign',
|
|
134
|
+
'revokeTokens',
|
|
135
|
+
'revokeUsersToken',
|
|
136
|
+
'revokeUserToken',
|
|
137
|
+
'scheduleCampaign',
|
|
138
|
+
'search',
|
|
139
|
+
'sendFile',
|
|
140
|
+
'sendUserCustomEvent',
|
|
141
|
+
'setAnonymousUser',
|
|
142
|
+
'setBaseURL',
|
|
143
|
+
'setGuestUser',
|
|
144
|
+
'setLocalDevice',
|
|
145
|
+
'setUser',
|
|
146
|
+
'setUserAgent',
|
|
147
|
+
'shadowBan',
|
|
148
|
+
'stopCampaign',
|
|
149
|
+
'sync',
|
|
150
|
+
'testCampaign',
|
|
151
|
+
'testPushSettings',
|
|
152
|
+
'testSQSSettings',
|
|
153
|
+
'translateMessage',
|
|
154
|
+
'unbanUser',
|
|
155
|
+
'unblockMessage',
|
|
156
|
+
'unflagMessage',
|
|
157
|
+
'unflagUser',
|
|
158
|
+
'unmuteUser',
|
|
159
|
+
'unpinMessage',
|
|
160
|
+
'updateAppSettings',
|
|
161
|
+
'updateBlockList',
|
|
162
|
+
'updateCampaign',
|
|
163
|
+
'updateChannelType',
|
|
164
|
+
'updateCommand',
|
|
165
|
+
'updateMessage',
|
|
166
|
+
'updatePermission',
|
|
167
|
+
'updateSegment',
|
|
168
|
+
'updateUser',
|
|
169
|
+
'updateUsers',
|
|
170
|
+
'upsertPushProvider',
|
|
171
|
+
'upsertUser',
|
|
172
|
+
'upsertUsers',
|
|
173
|
+
'userMuteStatus',
|
|
174
|
+
'verifyWebhook',
|
|
175
|
+
];
|
|
176
|
+
export const STREAM_SYNC_METHOD_NAMES = [
|
|
177
|
+
'_addChannelConfig',
|
|
178
|
+
'_buildWSPayload',
|
|
179
|
+
'_callClientListeners',
|
|
180
|
+
'_deleteUserMessageReference',
|
|
181
|
+
'_enrichAxiosOptions',
|
|
182
|
+
'_getConnectionID',
|
|
183
|
+
'_getToken',
|
|
184
|
+
'_handleClientEvent',
|
|
185
|
+
'_handleUserEvent',
|
|
186
|
+
'_hasConnectionID',
|
|
187
|
+
'_isUsingServerAuth',
|
|
188
|
+
'_logApiError',
|
|
189
|
+
'_logApiRequest',
|
|
190
|
+
'_logApiResponse',
|
|
191
|
+
'_muteStatus',
|
|
192
|
+
'_normalizeDate',
|
|
193
|
+
'_normalizeExpiration',
|
|
194
|
+
'_sayHi',
|
|
195
|
+
'_setUser',
|
|
196
|
+
'_startCleaning',
|
|
197
|
+
'_updateMemberWatcherReferences',
|
|
198
|
+
'_updateUserMessageReferences',
|
|
199
|
+
'_updateUserReferences',
|
|
200
|
+
'_validateAndGetMessageId',
|
|
201
|
+
'createAbortControllerForNextRequest',
|
|
202
|
+
'createToken',
|
|
203
|
+
'devToken',
|
|
204
|
+
'dispatchEvent',
|
|
205
|
+
'errorFromResponse',
|
|
206
|
+
'getAuthType',
|
|
207
|
+
'getUserAgent',
|
|
208
|
+
'handleEvent',
|
|
209
|
+
'handleResponse',
|
|
210
|
+
'off',
|
|
211
|
+
'on',
|
|
212
|
+
'setBaseURL',
|
|
213
|
+
'setLocalDevice',
|
|
214
|
+
'setUserAgent',
|
|
215
|
+
'userMuteStatus',
|
|
216
|
+
'verifyWebhook',
|
|
217
|
+
];
|
|
218
|
+
export const STREAM_CHANNEL_RESULT_METHOD_NAMES = [
|
|
219
|
+
'channel',
|
|
220
|
+
'getChannelById',
|
|
221
|
+
'getChannelByMembers',
|
|
222
|
+
'hydrateActiveChannels',
|
|
223
|
+
'queryChannels',
|
|
224
|
+
];
|
|
225
|
+
export const STREAM_SYNC_CHANNEL_RESULT_METHOD_NAMES = [
|
|
226
|
+
'channel',
|
|
227
|
+
'getChannelById',
|
|
228
|
+
'getChannelByMembers',
|
|
229
|
+
'hydrateActiveChannels',
|
|
230
|
+
];
|
|
231
|
+
export const CHANNEL_METHOD_NAMES = [
|
|
232
|
+
'_callChannelListeners',
|
|
233
|
+
'_channelURL',
|
|
234
|
+
'_checkInitialized',
|
|
235
|
+
'_countMessageAsUnread',
|
|
236
|
+
'_disconnect',
|
|
237
|
+
'_extendEventWithOwnReactions',
|
|
238
|
+
'_handleChannelEvent',
|
|
239
|
+
'_initializeState',
|
|
240
|
+
'_update',
|
|
241
|
+
'acceptInvite',
|
|
242
|
+
'addMembers',
|
|
243
|
+
'addModerators',
|
|
244
|
+
'assignRoles',
|
|
245
|
+
'banUser',
|
|
246
|
+
'clean',
|
|
247
|
+
'countUnread',
|
|
248
|
+
'countUnreadMentions',
|
|
249
|
+
'create',
|
|
250
|
+
'createCall',
|
|
251
|
+
'delete',
|
|
252
|
+
'deleteFile',
|
|
253
|
+
'deleteImage',
|
|
254
|
+
'deleteReaction',
|
|
255
|
+
'demoteModerators',
|
|
256
|
+
'disableSlowMode',
|
|
257
|
+
'enableSlowMode',
|
|
258
|
+
'getClient',
|
|
259
|
+
'getConfig',
|
|
260
|
+
'getMessagesById',
|
|
261
|
+
'getPinnedMessages',
|
|
262
|
+
'getReactions',
|
|
263
|
+
'getReplies',
|
|
264
|
+
'hide',
|
|
265
|
+
'inviteMembers',
|
|
266
|
+
'keystroke',
|
|
267
|
+
'lastMessage',
|
|
268
|
+
'lastRead',
|
|
269
|
+
'markRead',
|
|
270
|
+
'markUnread',
|
|
271
|
+
'mute',
|
|
272
|
+
'muteStatus',
|
|
273
|
+
'off',
|
|
274
|
+
'on',
|
|
275
|
+
'query',
|
|
276
|
+
'queryMembers',
|
|
277
|
+
'rejectInvite',
|
|
278
|
+
'removeMembers',
|
|
279
|
+
'removeShadowBan',
|
|
280
|
+
'search',
|
|
281
|
+
'sendAction',
|
|
282
|
+
'sendEvent',
|
|
283
|
+
'sendFile',
|
|
284
|
+
'sendImage',
|
|
285
|
+
'sendMessage',
|
|
286
|
+
'sendReaction',
|
|
287
|
+
'shadowBan',
|
|
288
|
+
'show',
|
|
289
|
+
'stopTyping',
|
|
290
|
+
'stopWatching',
|
|
291
|
+
'truncate',
|
|
292
|
+
'unbanUser',
|
|
293
|
+
'unmute',
|
|
294
|
+
'update',
|
|
295
|
+
'updatePartial',
|
|
296
|
+
'watch',
|
|
297
|
+
];
|
|
298
|
+
export const CHANNEL_SYNC_METHOD_NAMES = [
|
|
299
|
+
'_callChannelListeners',
|
|
300
|
+
'_channelURL',
|
|
301
|
+
'_checkInitialized',
|
|
302
|
+
'_countMessageAsUnread',
|
|
303
|
+
'_disconnect',
|
|
304
|
+
'_extendEventWithOwnReactions',
|
|
305
|
+
'_handleChannelEvent',
|
|
306
|
+
'_initializeState',
|
|
307
|
+
'clean',
|
|
308
|
+
'countUnread',
|
|
309
|
+
'countUnreadMentions',
|
|
310
|
+
'getConfig',
|
|
311
|
+
'lastMessage',
|
|
312
|
+
'lastRead',
|
|
313
|
+
'muteStatus',
|
|
314
|
+
'off',
|
|
315
|
+
'on',
|
|
316
|
+
];
|
|
317
|
+
export const CHANNEL_SYNC_PROXY_RESULT_METHOD_NAMES = ['getClient'];
|