@amityco/ts-sdk 6.3.2-de32ca2.0 → 6.3.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/@types/domains/user.d.ts +0 -1
- package/dist/@types/domains/user.d.ts.map +1 -1
- package/dist/client/api/login.d.ts.map +1 -1
- package/dist/client/utils/subscribeGlobalTopic.d.ts +2 -0
- package/dist/client/utils/subscribeGlobalTopic.d.ts.map +1 -0
- package/dist/core/transports/mqtt.d.ts.map +1 -1
- package/dist/index.cjs.js +24 -56
- package/dist/index.esm.js +24 -56
- package/dist/index.umd.js +2 -2
- package/dist/userRepository/observers/index.d.ts +0 -1
- package/dist/userRepository/observers/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/domains/user.ts +0 -2
- package/src/client/api/login.ts +1 -18
- package/src/client/utils/subscribeGlobalTopic.ts +23 -0
- package/src/core/transports/mqtt.ts +14 -21
- package/src/userRepository/observers/getUsers.ts +1 -1
- package/src/userRepository/observers/index.ts +0 -1
- package/dist/userRepository/observers/searchUserByDisplayName.d.ts +0 -19
- package/dist/userRepository/observers/searchUserByDisplayName.d.ts.map +0 -1
- package/dist/userRepository/observers/tests/searchUserByDisplayName.test.d.ts +0 -2
- package/dist/userRepository/observers/tests/searchUserByDisplayName.test.d.ts.map +0 -1
- package/src/userRepository/observers/searchUserByDisplayName.ts +0 -30
- package/src/userRepository/observers/tests/searchUserByDisplayName.test.ts +0 -113
|
@@ -17,7 +17,6 @@ declare global {
|
|
|
17
17
|
page?: Amity.Page;
|
|
18
18
|
};
|
|
19
19
|
type UserLiveCollection = Amity.LiveCollectionParams<Omit<QueryUsers, 'page'>>;
|
|
20
|
-
type UserSearchLiveCollection = Amity.LiveCollectionParams<Omit<QueryUsers, 'sortBy'>>;
|
|
21
20
|
type UserLiveCollectionCache = Amity.LiveCollectionCache<Amity.User['userId'], Pick<QueryUsers, 'page'>>;
|
|
22
21
|
}
|
|
23
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,cAAc,GACf,SAAS,GACT,UAAU,GACV,UAAU,GACV,WAAW,GACX,aAAa,GACb,eAAe,CAAC;QAEpB,KAAK,IAAI,GAAG;YACV,GAAG,EAAE,MAAM,CAAC;YACZ,MAAM,EAAE,MAAM,CAAC;YACf,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,YAAY,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;YAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;YACzB,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB,GAAG,KAAK,CAAC,QAAQ,GAChB,KAAK,CAAC,QAAQ,GACd,KAAK,CAAC,SAAS,GACf,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,YAAY,CAAC;QAErB,KAAK,UAAU,GAAG;YAChB,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACxC,MAAM,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;YAC3B,MAAM,CAAC,EAAE,aAAa,GAAG,cAAc,GAAG,aAAa,CAAC;YACxD,IAAI,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC;SACnB,CAAC;QAEF,KAAK,kBAAkB,GAAG,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;QAE/E,KAAK,
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,cAAc,GACf,SAAS,GACT,UAAU,GACV,UAAU,GACV,WAAW,GACX,aAAa,GACb,eAAe,CAAC;QAEpB,KAAK,IAAI,GAAG;YACV,GAAG,EAAE,MAAM,CAAC;YACZ,MAAM,EAAE,MAAM,CAAC;YACf,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,YAAY,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;YAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;YACzB,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB,GAAG,KAAK,CAAC,QAAQ,GAChB,KAAK,CAAC,QAAQ,GACd,KAAK,CAAC,SAAS,GACf,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,YAAY,CAAC;QAErB,KAAK,UAAU,GAAG;YAChB,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACxC,MAAM,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;YAC3B,MAAM,CAAC,EAAE,aAAa,GAAG,cAAc,GAAG,aAAa,CAAC;YACxD,IAAI,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC;SACnB,CAAC;QAEF,KAAK,kBAAkB,GAAG,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;QAE/E,KAAK,uBAAuB,GAAG,KAAK,CAAC,mBAAmB,CACtD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EACpB,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CACzB,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/client/api/login.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/client/api/login.ts"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,KAAK,WACR,MAAM,mBAAmB,kBACjB,MAAM,cAAc,WAC3B,MAAM,mBAAmB,KACjC,QAAQ,OAAO,CA2GjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribeGlobalTopic.d.ts","sourceRoot":"","sources":["../../../src/client/utils/subscribeGlobalTopic.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,oBAAoB,kBAYhC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mqtt.d.ts","sourceRoot":"","sources":["../../../src/core/transports/mqtt.ts"],"names":[],"mappings":"AAEA,OAAa,EAAE,cAAc,EAAsB,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"mqtt.d.ts","sourceRoot":"","sources":["../../../src/core/transports/mqtt.ts"],"names":[],"mappings":"AAEA,OAAa,EAAE,cAAc,EAAsB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAetF,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,cAAc,CAiBjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,aAAc,MAAM,KAAG,gBAyGtD,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -96,8 +96,8 @@ const PostContentType = Object.freeze({
|
|
|
96
96
|
|
|
97
97
|
function getVersion() {
|
|
98
98
|
try {
|
|
99
|
-
// the string ''v6.3.
|
|
100
|
-
return 'v6.3.
|
|
99
|
+
// the string ''v6.3.2-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
100
|
+
return 'v6.3.2-cjs';
|
|
101
101
|
}
|
|
102
102
|
catch (error) {
|
|
103
103
|
return '__dev__';
|
|
@@ -20413,10 +20413,22 @@ var mqtt$1 = {exports: {}};
|
|
|
20413
20413
|
|
|
20414
20414
|
var mqtt = /*@__PURE__*/getDefaultExportFromCjs(mqtt$1.exports);
|
|
20415
20415
|
|
|
20416
|
+
const subscribeGlobalTopic = () => {
|
|
20417
|
+
const disposers = [
|
|
20418
|
+
subscribeTopic(getNetworkTopic()),
|
|
20419
|
+
subscribeTopic(getSmartFeedChannelTopic()),
|
|
20420
|
+
subscribeTopic(getSmartFeedSubChannelTopic()),
|
|
20421
|
+
subscribeTopic(getSmartFeedMessageTopic()),
|
|
20422
|
+
// subscribing to user topic is necessary to handle ban event
|
|
20423
|
+
subscribeTopic(getUserTopic(getActiveUser())),
|
|
20424
|
+
];
|
|
20425
|
+
return () => disposers.forEach(fn => fn());
|
|
20426
|
+
};
|
|
20427
|
+
|
|
20416
20428
|
/* eslint-disable no-console */
|
|
20417
20429
|
const QOS_FAILURE_CODE = 128;
|
|
20418
20430
|
const RETRY_BASE_TIMEOUT = 1000;
|
|
20419
|
-
const
|
|
20431
|
+
const RETRY_MAX_TIMEOUT = 8000;
|
|
20420
20432
|
var MqttError;
|
|
20421
20433
|
(function (MqttError) {
|
|
20422
20434
|
MqttError[MqttError["IDENTIFIER_REJECTED"] = 2] = "IDENTIFIER_REJECTED";
|
|
@@ -20424,7 +20436,7 @@ var MqttError;
|
|
|
20424
20436
|
MqttError[MqttError["NOT_AUTHORIZED"] = 5] = "NOT_AUTHORIZED";
|
|
20425
20437
|
})(MqttError || (MqttError = {}));
|
|
20426
20438
|
function getMqttOptions(params) {
|
|
20427
|
-
return Object.assign({ clean: false, clientId: `mqttjs_ + ${Math.random().toString(16).substring(2, 10)}`, protocolId: 'MQTT', protocolVersion: 4, reconnectPeriod:
|
|
20439
|
+
return Object.assign({ clean: false, clientId: `mqttjs_ + ${Math.random().toString(16).substring(2, 10)}`, protocolId: 'MQTT', protocolVersion: 4, reconnectPeriod: RETRY_BASE_TIMEOUT, will: {
|
|
20428
20440
|
topic: 'WillMsg',
|
|
20429
20441
|
payload: 'Connection Closed abnormally..!',
|
|
20430
20442
|
qos: 0,
|
|
@@ -20442,14 +20454,6 @@ function getMqttOptions(params) {
|
|
|
20442
20454
|
*/
|
|
20443
20455
|
const createMqttTransport = (endpoint) => {
|
|
20444
20456
|
let mqttClient;
|
|
20445
|
-
let retryCount = 0;
|
|
20446
|
-
let allowReconnection = true;
|
|
20447
|
-
const reconnect = () => {
|
|
20448
|
-
setTimeout(() => {
|
|
20449
|
-
retryCount += 1;
|
|
20450
|
-
mqttClient.reconnect();
|
|
20451
|
-
}, RETRY_BASE_TIMEOUT * 2 ** (retryCount > RETRY_COUNT_MAX ? RETRY_COUNT_MAX : retryCount));
|
|
20452
|
-
};
|
|
20453
20457
|
async function connect(params) {
|
|
20454
20458
|
if (mqttClient) {
|
|
20455
20459
|
mqttClient.removeAllListeners();
|
|
@@ -20457,8 +20461,8 @@ const createMqttTransport = (endpoint) => {
|
|
|
20457
20461
|
}
|
|
20458
20462
|
mqttClient = mqtt.connect(endpoint, getMqttOptions({ username: params.userId, password: params.accessToken }));
|
|
20459
20463
|
mqttClient.on('connect', () => {
|
|
20460
|
-
|
|
20461
|
-
|
|
20464
|
+
mqttClient.options.reconnectPeriod = RETRY_BASE_TIMEOUT;
|
|
20465
|
+
subscribeGlobalTopic();
|
|
20462
20466
|
});
|
|
20463
20467
|
mqttClient.on('error', (error) => {
|
|
20464
20468
|
// eslint-disable-next-line default-case
|
|
@@ -20466,20 +20470,18 @@ const createMqttTransport = (endpoint) => {
|
|
|
20466
20470
|
case 2 /* MqttError.IDENTIFIER_REJECTED */:
|
|
20467
20471
|
case 4 /* MqttError.BAD_USERNAME_OR_PASSWORD */:
|
|
20468
20472
|
case 5 /* MqttError.NOT_AUTHORIZED */:
|
|
20469
|
-
|
|
20473
|
+
mqttClient.end();
|
|
20470
20474
|
}
|
|
20471
20475
|
});
|
|
20472
|
-
mqttClient.on('
|
|
20473
|
-
|
|
20474
|
-
|
|
20475
|
-
}
|
|
20476
|
+
mqttClient.on('reconnect', () => {
|
|
20477
|
+
// Double the reconnect period for each attempt
|
|
20478
|
+
mqttClient.options.reconnectPeriod = Math.min((mqttClient.options.reconnectPeriod || RETRY_BASE_TIMEOUT) * 2, RETRY_MAX_TIMEOUT);
|
|
20476
20479
|
});
|
|
20477
20480
|
return new Promise(resolve => mqttClient.once('connect', () => resolve()));
|
|
20478
20481
|
}
|
|
20479
20482
|
return {
|
|
20480
20483
|
connect,
|
|
20481
20484
|
async disconnect() {
|
|
20482
|
-
allowReconnection = false;
|
|
20483
20485
|
if (this.connected) {
|
|
20484
20486
|
return new Promise(resolve => mqttClient === null || mqttClient === void 0 ? void 0 : mqttClient.end(true, undefined, () => resolve()));
|
|
20485
20487
|
}
|
|
@@ -21411,14 +21413,6 @@ const login = async (params, sessionHandler, config) => {
|
|
|
21411
21413
|
// pass error down tree so the calling function handle it
|
|
21412
21414
|
throw error;
|
|
21413
21415
|
}
|
|
21414
|
-
if ((config === null || config === void 0 ? void 0 : config.disableRTE) !== true) {
|
|
21415
|
-
subscribeTopic(getNetworkTopic());
|
|
21416
|
-
subscribeTopic(getSmartFeedChannelTopic());
|
|
21417
|
-
subscribeTopic(getSmartFeedSubChannelTopic());
|
|
21418
|
-
subscribeTopic(getSmartFeedMessageTopic());
|
|
21419
|
-
// subscribing to user topic is necessary to handle ban event
|
|
21420
|
-
subscribeTopic(getUserTopic(getActiveUser()));
|
|
21421
|
-
}
|
|
21422
21416
|
subscriptions.push(
|
|
21423
21417
|
// GLOBAL_BAN
|
|
21424
21418
|
onClientBanned((_) => {
|
|
@@ -24479,7 +24473,7 @@ queryUsers.locally = (query = {}) => {
|
|
|
24479
24473
|
};
|
|
24480
24474
|
|
|
24481
24475
|
/* begin_public_function
|
|
24482
|
-
id: user.query
|
|
24476
|
+
id: user.query, user.search
|
|
24483
24477
|
*/
|
|
24484
24478
|
/**
|
|
24485
24479
|
* ```js
|
|
@@ -24617,31 +24611,6 @@ const observeUser = (userId, callback) => {
|
|
|
24617
24611
|
};
|
|
24618
24612
|
};
|
|
24619
24613
|
|
|
24620
|
-
/* begin_public_function
|
|
24621
|
-
id: user.search
|
|
24622
|
-
*/
|
|
24623
|
-
/**
|
|
24624
|
-
* ```js
|
|
24625
|
-
* import { UserRepository } from '@amityco/ts-sdk'
|
|
24626
|
-
*
|
|
24627
|
-
* let users = []
|
|
24628
|
-
* const unsub = UserRepository.searchUserByDisplayName({}, response => merge(users, response.data))
|
|
24629
|
-
* ```
|
|
24630
|
-
*
|
|
24631
|
-
* Observe all mutations on a list of {@link Amity.User}s
|
|
24632
|
-
*
|
|
24633
|
-
* @param params for searching users
|
|
24634
|
-
* @param callback the function to call when new data are available
|
|
24635
|
-
* @param config the configuration for the live collection
|
|
24636
|
-
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the users
|
|
24637
|
-
*
|
|
24638
|
-
* @category Category Live Collection
|
|
24639
|
-
*/
|
|
24640
|
-
const searchUserByDisplayName = (params, callback, config) => {
|
|
24641
|
-
return getUsers(Object.assign(Object.assign({}, params), { filter: 'all' }), callback, config);
|
|
24642
|
-
};
|
|
24643
|
-
/* end_public_function */
|
|
24644
|
-
|
|
24645
24614
|
var index$g = /*#__PURE__*/Object.freeze({
|
|
24646
24615
|
__proto__: null,
|
|
24647
24616
|
Relationship: index$h,
|
|
@@ -24658,8 +24627,7 @@ var index$g = /*#__PURE__*/Object.freeze({
|
|
|
24658
24627
|
getUser: getUser,
|
|
24659
24628
|
getUsers: getUsers,
|
|
24660
24629
|
observeUser: observeUser,
|
|
24661
|
-
getBlockedUsers: getBlockedUsers$1
|
|
24662
|
-
searchUserByDisplayName: searchUserByDisplayName
|
|
24630
|
+
getBlockedUsers: getBlockedUsers$1
|
|
24663
24631
|
});
|
|
24664
24632
|
|
|
24665
24633
|
/* begin_public_function
|
package/dist/index.esm.js
CHANGED
|
@@ -82,8 +82,8 @@ const PostContentType = Object.freeze({
|
|
|
82
82
|
|
|
83
83
|
function getVersion() {
|
|
84
84
|
try {
|
|
85
|
-
// the string ''v6.3.
|
|
86
|
-
return 'v6.3.
|
|
85
|
+
// the string ''v6.3.2-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
86
|
+
return 'v6.3.2-esm';
|
|
87
87
|
}
|
|
88
88
|
catch (error) {
|
|
89
89
|
return '__dev__';
|
|
@@ -20399,10 +20399,22 @@ var mqtt$1 = {exports: {}};
|
|
|
20399
20399
|
|
|
20400
20400
|
var mqtt = /*@__PURE__*/getDefaultExportFromCjs(mqtt$1.exports);
|
|
20401
20401
|
|
|
20402
|
+
const subscribeGlobalTopic = () => {
|
|
20403
|
+
const disposers = [
|
|
20404
|
+
subscribeTopic(getNetworkTopic()),
|
|
20405
|
+
subscribeTopic(getSmartFeedChannelTopic()),
|
|
20406
|
+
subscribeTopic(getSmartFeedSubChannelTopic()),
|
|
20407
|
+
subscribeTopic(getSmartFeedMessageTopic()),
|
|
20408
|
+
// subscribing to user topic is necessary to handle ban event
|
|
20409
|
+
subscribeTopic(getUserTopic(getActiveUser())),
|
|
20410
|
+
];
|
|
20411
|
+
return () => disposers.forEach(fn => fn());
|
|
20412
|
+
};
|
|
20413
|
+
|
|
20402
20414
|
/* eslint-disable no-console */
|
|
20403
20415
|
const QOS_FAILURE_CODE = 128;
|
|
20404
20416
|
const RETRY_BASE_TIMEOUT = 1000;
|
|
20405
|
-
const
|
|
20417
|
+
const RETRY_MAX_TIMEOUT = 8000;
|
|
20406
20418
|
var MqttError;
|
|
20407
20419
|
(function (MqttError) {
|
|
20408
20420
|
MqttError[MqttError["IDENTIFIER_REJECTED"] = 2] = "IDENTIFIER_REJECTED";
|
|
@@ -20410,7 +20422,7 @@ var MqttError;
|
|
|
20410
20422
|
MqttError[MqttError["NOT_AUTHORIZED"] = 5] = "NOT_AUTHORIZED";
|
|
20411
20423
|
})(MqttError || (MqttError = {}));
|
|
20412
20424
|
function getMqttOptions(params) {
|
|
20413
|
-
return Object.assign({ clean: false, clientId: `mqttjs_ + ${Math.random().toString(16).substring(2, 10)}`, protocolId: 'MQTT', protocolVersion: 4, reconnectPeriod:
|
|
20425
|
+
return Object.assign({ clean: false, clientId: `mqttjs_ + ${Math.random().toString(16).substring(2, 10)}`, protocolId: 'MQTT', protocolVersion: 4, reconnectPeriod: RETRY_BASE_TIMEOUT, will: {
|
|
20414
20426
|
topic: 'WillMsg',
|
|
20415
20427
|
payload: 'Connection Closed abnormally..!',
|
|
20416
20428
|
qos: 0,
|
|
@@ -20428,14 +20440,6 @@ function getMqttOptions(params) {
|
|
|
20428
20440
|
*/
|
|
20429
20441
|
const createMqttTransport = (endpoint) => {
|
|
20430
20442
|
let mqttClient;
|
|
20431
|
-
let retryCount = 0;
|
|
20432
|
-
let allowReconnection = true;
|
|
20433
|
-
const reconnect = () => {
|
|
20434
|
-
setTimeout(() => {
|
|
20435
|
-
retryCount += 1;
|
|
20436
|
-
mqttClient.reconnect();
|
|
20437
|
-
}, RETRY_BASE_TIMEOUT * 2 ** (retryCount > RETRY_COUNT_MAX ? RETRY_COUNT_MAX : retryCount));
|
|
20438
|
-
};
|
|
20439
20443
|
async function connect(params) {
|
|
20440
20444
|
if (mqttClient) {
|
|
20441
20445
|
mqttClient.removeAllListeners();
|
|
@@ -20443,8 +20447,8 @@ const createMqttTransport = (endpoint) => {
|
|
|
20443
20447
|
}
|
|
20444
20448
|
mqttClient = mqtt.connect(endpoint, getMqttOptions({ username: params.userId, password: params.accessToken }));
|
|
20445
20449
|
mqttClient.on('connect', () => {
|
|
20446
|
-
|
|
20447
|
-
|
|
20450
|
+
mqttClient.options.reconnectPeriod = RETRY_BASE_TIMEOUT;
|
|
20451
|
+
subscribeGlobalTopic();
|
|
20448
20452
|
});
|
|
20449
20453
|
mqttClient.on('error', (error) => {
|
|
20450
20454
|
// eslint-disable-next-line default-case
|
|
@@ -20452,20 +20456,18 @@ const createMqttTransport = (endpoint) => {
|
|
|
20452
20456
|
case 2 /* MqttError.IDENTIFIER_REJECTED */:
|
|
20453
20457
|
case 4 /* MqttError.BAD_USERNAME_OR_PASSWORD */:
|
|
20454
20458
|
case 5 /* MqttError.NOT_AUTHORIZED */:
|
|
20455
|
-
|
|
20459
|
+
mqttClient.end();
|
|
20456
20460
|
}
|
|
20457
20461
|
});
|
|
20458
|
-
mqttClient.on('
|
|
20459
|
-
|
|
20460
|
-
|
|
20461
|
-
}
|
|
20462
|
+
mqttClient.on('reconnect', () => {
|
|
20463
|
+
// Double the reconnect period for each attempt
|
|
20464
|
+
mqttClient.options.reconnectPeriod = Math.min((mqttClient.options.reconnectPeriod || RETRY_BASE_TIMEOUT) * 2, RETRY_MAX_TIMEOUT);
|
|
20462
20465
|
});
|
|
20463
20466
|
return new Promise(resolve => mqttClient.once('connect', () => resolve()));
|
|
20464
20467
|
}
|
|
20465
20468
|
return {
|
|
20466
20469
|
connect,
|
|
20467
20470
|
async disconnect() {
|
|
20468
|
-
allowReconnection = false;
|
|
20469
20471
|
if (this.connected) {
|
|
20470
20472
|
return new Promise(resolve => mqttClient === null || mqttClient === void 0 ? void 0 : mqttClient.end(true, undefined, () => resolve()));
|
|
20471
20473
|
}
|
|
@@ -21397,14 +21399,6 @@ const login = async (params, sessionHandler, config) => {
|
|
|
21397
21399
|
// pass error down tree so the calling function handle it
|
|
21398
21400
|
throw error;
|
|
21399
21401
|
}
|
|
21400
|
-
if ((config === null || config === void 0 ? void 0 : config.disableRTE) !== true) {
|
|
21401
|
-
subscribeTopic(getNetworkTopic());
|
|
21402
|
-
subscribeTopic(getSmartFeedChannelTopic());
|
|
21403
|
-
subscribeTopic(getSmartFeedSubChannelTopic());
|
|
21404
|
-
subscribeTopic(getSmartFeedMessageTopic());
|
|
21405
|
-
// subscribing to user topic is necessary to handle ban event
|
|
21406
|
-
subscribeTopic(getUserTopic(getActiveUser()));
|
|
21407
|
-
}
|
|
21408
21402
|
subscriptions.push(
|
|
21409
21403
|
// GLOBAL_BAN
|
|
21410
21404
|
onClientBanned((_) => {
|
|
@@ -24465,7 +24459,7 @@ queryUsers.locally = (query = {}) => {
|
|
|
24465
24459
|
};
|
|
24466
24460
|
|
|
24467
24461
|
/* begin_public_function
|
|
24468
|
-
id: user.query
|
|
24462
|
+
id: user.query, user.search
|
|
24469
24463
|
*/
|
|
24470
24464
|
/**
|
|
24471
24465
|
* ```js
|
|
@@ -24603,31 +24597,6 @@ const observeUser = (userId, callback) => {
|
|
|
24603
24597
|
};
|
|
24604
24598
|
};
|
|
24605
24599
|
|
|
24606
|
-
/* begin_public_function
|
|
24607
|
-
id: user.search
|
|
24608
|
-
*/
|
|
24609
|
-
/**
|
|
24610
|
-
* ```js
|
|
24611
|
-
* import { UserRepository } from '@amityco/ts-sdk'
|
|
24612
|
-
*
|
|
24613
|
-
* let users = []
|
|
24614
|
-
* const unsub = UserRepository.searchUserByDisplayName({}, response => merge(users, response.data))
|
|
24615
|
-
* ```
|
|
24616
|
-
*
|
|
24617
|
-
* Observe all mutations on a list of {@link Amity.User}s
|
|
24618
|
-
*
|
|
24619
|
-
* @param params for searching users
|
|
24620
|
-
* @param callback the function to call when new data are available
|
|
24621
|
-
* @param config the configuration for the live collection
|
|
24622
|
-
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the users
|
|
24623
|
-
*
|
|
24624
|
-
* @category Category Live Collection
|
|
24625
|
-
*/
|
|
24626
|
-
const searchUserByDisplayName = (params, callback, config) => {
|
|
24627
|
-
return getUsers(Object.assign(Object.assign({}, params), { filter: 'all' }), callback, config);
|
|
24628
|
-
};
|
|
24629
|
-
/* end_public_function */
|
|
24630
|
-
|
|
24631
24600
|
var index$g = /*#__PURE__*/Object.freeze({
|
|
24632
24601
|
__proto__: null,
|
|
24633
24602
|
Relationship: index$h,
|
|
@@ -24644,8 +24613,7 @@ var index$g = /*#__PURE__*/Object.freeze({
|
|
|
24644
24613
|
getUser: getUser,
|
|
24645
24614
|
getUsers: getUsers,
|
|
24646
24615
|
observeUser: observeUser,
|
|
24647
|
-
getBlockedUsers: getBlockedUsers$1
|
|
24648
|
-
searchUserByDisplayName: searchUserByDisplayName
|
|
24616
|
+
getBlockedUsers: getBlockedUsers$1
|
|
24649
24617
|
});
|
|
24650
24618
|
|
|
24651
24619
|
/* begin_public_function
|