@amityco/ts-sdk 7.27.1-fe406650.0 → 7.27.2-9bed893.0
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/channelRepository/api/createChannel.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannel.d.ts.map +1 -1
- package/dist/core/transports/http.d.ts.map +1 -1
- package/dist/core/transports/mqtt.d.ts.map +1 -1
- package/dist/core/transports/tests/mqtt.connackTimeout.test.d.ts +2 -0
- package/dist/core/transports/tests/mqtt.connackTimeout.test.d.ts.map +1 -0
- package/dist/index.cjs.js +29 -6
- package/dist/index.esm.js +29 -6
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createChannel.d.ts","sourceRoot":"","sources":["../../../src/channelRepository/api/createChannel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createChannel.d.ts","sourceRoot":"","sources":["../../../src/channelRepository/api/createChannel.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa;;;;;;yIAmDzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getChannel.d.ts","sourceRoot":"","sources":["../../../src/channelRepository/observers/getChannel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getChannel.d.ts","sourceRoot":"","sources":["../../../src/channelRepository/observers/getChannel.ts"],"names":[],"mappings":"AA8CA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU,cACV,MAAM,OAAO,CAAC,WAAW,CAAC,YAC3B,MAAM,kBAAkB,CAAC,MAAM,OAAO,CAAC,KAChD,MAAM,YAqQR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/core/transports/http.ts"],"names":[],"mappings":"AAgBA,oBAAY,kBAAkB;IAC5B,WAAW,iBAAiB;IAC5B,gBAAgB,uBAAuB;IACvC,YAAY,kBAAkB;CAC/B;AAUD,yDAAyD;AACzD,eAAO,MAAM,oBAAoB,YAEhC,CAAC;AAuDF,mDAAmD;AACnD,eAAO,MAAM,yBAAyB,YAErC,CAAC;AAGF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,aAAc,MAAM,
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/core/transports/http.ts"],"names":[],"mappings":"AAgBA,oBAAY,kBAAkB;IAC5B,WAAW,iBAAiB;IAC5B,gBAAgB,uBAAuB;IACvC,YAAY,kBAAkB;CAC/B;AAUD,yDAAyD;AACzD,eAAO,MAAM,oBAAoB,YAEhC,CAAC;AAuDF,mDAAmD;AACnD,eAAO,MAAM,yBAAyB,YAErC,CAAC;AAGF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,aAAc,MAAM,kCA6InD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mqtt.d.ts","sourceRoot":"","sources":["../../../src/core/transports/mqtt.ts"],"names":[],"mappings":"AAEA,OAAa,EAAuB,cAAc,EAAsB,UAAU,EAAE,MAAM,MAAM,CAAC;AAiCjG,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,cAAc,CAuBjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,aAAc,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"mqtt.d.ts","sourceRoot":"","sources":["../../../src/core/transports/mqtt.ts"],"names":[],"mappings":"AAEA,OAAa,EAAuB,cAAc,EAAsB,UAAU,EAAE,MAAM,MAAM,CAAC;AAiCjG,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,cAAc,CAuBjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,aAAc,MAAM,KAAG,gBAmLtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mqtt.connackTimeout.test.d.ts","sourceRoot":"","sources":["../../../../src/core/transports/tests/mqtt.connackTimeout.test.ts"],"names":[],"mappings":""}
|
package/dist/index.cjs.js
CHANGED
|
@@ -332,8 +332,8 @@ exports.AmityLiveViewerCountMode = void 0;
|
|
|
332
332
|
|
|
333
333
|
function getVersion() {
|
|
334
334
|
try {
|
|
335
|
-
// the string ''v7.27.
|
|
336
|
-
return 'v7.27.
|
|
335
|
+
// the string ''v7.27.1-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
336
|
+
return 'v7.27.1-cjs';
|
|
337
337
|
}
|
|
338
338
|
catch (error) {
|
|
339
339
|
return '__dev__';
|
|
@@ -2221,20 +2221,28 @@ const createHttpTransport = (endpoint) => {
|
|
|
2221
2221
|
});
|
|
2222
2222
|
return response;
|
|
2223
2223
|
}, error => {
|
|
2224
|
-
var _a, _b, _c;
|
|
2224
|
+
var _a, _b, _c, _d;
|
|
2225
2225
|
const { response } = error;
|
|
2226
2226
|
// handle unauthorized request
|
|
2227
2227
|
if ((response === null || response === void 0 ? void 0 : response.data.code) === 400100 /* Amity.ServerError.UNAUTHORIZED */) {
|
|
2228
2228
|
fireEvent('tokenTerminated', "terminated" /* Amity.SessionStates.TERMINATED */);
|
|
2229
2229
|
}
|
|
2230
|
+
// handle globally banned user. The realtime `user.didGlobalBan` event can be missed
|
|
2231
|
+
// (e.g. MQTT dropped before delivery), so mirror the 400100 handling above and fire
|
|
2232
|
+
// the same virtual event the login subscriptions already listen to. That terminates
|
|
2233
|
+
// the session with `TokenTerminationReason.GLOBAL_BAN` and notifies `onClientBanned`
|
|
2234
|
+
// consumers, instead of leaving the session `established` with a revoked token.
|
|
2235
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.code) === 400312 /* Amity.ServerError.GLOBAL_BAN */) {
|
|
2236
|
+
fireEvent('user.didGlobalBan', { users: [], files: [] });
|
|
2237
|
+
}
|
|
2230
2238
|
// handle visitor daily usage limit exceeded
|
|
2231
|
-
if (((
|
|
2239
|
+
if (((_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.code) === 400323 /* Amity.ServerError.VISITOR_USAGE_LIMIT_EXCEEDED */) {
|
|
2232
2240
|
throttledFireVisitorUsageLimit();
|
|
2233
2241
|
throw new ASCError('Visitor usage limit exceeded', 400323 /* Amity.ServerError.VISITOR_USAGE_LIMIT_EXCEEDED */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
2234
2242
|
}
|
|
2235
2243
|
// if it's an error with status in the response payload,
|
|
2236
2244
|
// then it's an expected error.
|
|
2237
|
-
if ((
|
|
2245
|
+
if ((_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.status) {
|
|
2238
2246
|
unwrapPayload(response === null || response === void 0 ? void 0 : response.data);
|
|
2239
2247
|
}
|
|
2240
2248
|
// as on request cancellation error is returned
|
|
@@ -2242,7 +2250,7 @@ const createHttpTransport = (endpoint) => {
|
|
|
2242
2250
|
throw error;
|
|
2243
2251
|
}
|
|
2244
2252
|
// unexpected error.
|
|
2245
|
-
throw new Error((
|
|
2253
|
+
throw new Error((_d = response === null || response === void 0 ? void 0 : response.data) !== null && _d !== void 0 ? _d : error);
|
|
2246
2254
|
});
|
|
2247
2255
|
instance.defaults.paramsSerializer = {
|
|
2248
2256
|
encode: params => encodeURIComponent(params),
|
|
@@ -2611,6 +2619,9 @@ const createMqttTransport = (endpoint) => {
|
|
|
2611
2619
|
const clientId = await getMQTTClientId(params.userId);
|
|
2612
2620
|
if (mqttClient) {
|
|
2613
2621
|
mqttClient.removeAllListeners();
|
|
2622
|
+
mqttClient.on('error', error => {
|
|
2623
|
+
console.warn('MQTT discarded connection error:', error === null || error === void 0 ? void 0 : error.message);
|
|
2624
|
+
});
|
|
2614
2625
|
mqttClient.end(true);
|
|
2615
2626
|
}
|
|
2616
2627
|
mqttClient = mqtt__default["default"].connect(endpoint, getMqttOptions({
|
|
@@ -13026,6 +13037,16 @@ const createChannel = async (bundle) => {
|
|
|
13026
13037
|
/* c8 ignore next */
|
|
13027
13038
|
isPublic: (bundle === null || bundle === void 0 ? void 0 : bundle.type) === 'community' ? isPublic : undefined }));
|
|
13028
13039
|
}
|
|
13040
|
+
// Fire the event locally, the same way createCommunity and createPost do.
|
|
13041
|
+
// Without it a running getChannels collection never inserts the new channel:
|
|
13042
|
+
// its query stream controller inserts an id only on OnCreate / OnJoin /
|
|
13043
|
+
// OnResolveChannel / OnUnarchived, and the first sent message arrives as an
|
|
13044
|
+
// OnUpdate, which only re-notifies. Reusing the MQTT event name means the
|
|
13045
|
+
// already-wired onChannelCreated -> OnCreate path does the insert, so the
|
|
13046
|
+
// list updates without a re-query. onChannelCreated re-runs
|
|
13047
|
+
// prepareChannelPayload + ingestInCache itself, so this is idempotent with
|
|
13048
|
+
// the ingest below.
|
|
13049
|
+
fireEvent('channel.created', payload.data);
|
|
13029
13050
|
const data = await prepareChannelPayload(payload.data);
|
|
13030
13051
|
const cachedAt = client.cache && Date.now();
|
|
13031
13052
|
if (client.cache)
|
|
@@ -21492,6 +21513,8 @@ const getChannel = (channelId, callback) => {
|
|
|
21492
21513
|
onChannelMemberRemoved,
|
|
21493
21514
|
onChannelMemberBanned,
|
|
21494
21515
|
onChannelMemberUnbanned,
|
|
21516
|
+
onChannelMemberRoleAdded,
|
|
21517
|
+
onChannelMemberRoleRemoved,
|
|
21495
21518
|
onChannelSetMuted,
|
|
21496
21519
|
onChannelMessagePinned,
|
|
21497
21520
|
onChannelMessageUnpinned,
|
package/dist/index.esm.js
CHANGED
|
@@ -316,8 +316,8 @@ var AmityLiveViewerCountMode;
|
|
|
316
316
|
|
|
317
317
|
function getVersion() {
|
|
318
318
|
try {
|
|
319
|
-
// the string ''v7.27.
|
|
320
|
-
return 'v7.27.
|
|
319
|
+
// the string ''v7.27.1-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
320
|
+
return 'v7.27.1-esm';
|
|
321
321
|
}
|
|
322
322
|
catch (error) {
|
|
323
323
|
return '__dev__';
|
|
@@ -2205,20 +2205,28 @@ const createHttpTransport = (endpoint) => {
|
|
|
2205
2205
|
});
|
|
2206
2206
|
return response;
|
|
2207
2207
|
}, error => {
|
|
2208
|
-
var _a, _b, _c;
|
|
2208
|
+
var _a, _b, _c, _d;
|
|
2209
2209
|
const { response } = error;
|
|
2210
2210
|
// handle unauthorized request
|
|
2211
2211
|
if ((response === null || response === void 0 ? void 0 : response.data.code) === 400100 /* Amity.ServerError.UNAUTHORIZED */) {
|
|
2212
2212
|
fireEvent('tokenTerminated', "terminated" /* Amity.SessionStates.TERMINATED */);
|
|
2213
2213
|
}
|
|
2214
|
+
// handle globally banned user. The realtime `user.didGlobalBan` event can be missed
|
|
2215
|
+
// (e.g. MQTT dropped before delivery), so mirror the 400100 handling above and fire
|
|
2216
|
+
// the same virtual event the login subscriptions already listen to. That terminates
|
|
2217
|
+
// the session with `TokenTerminationReason.GLOBAL_BAN` and notifies `onClientBanned`
|
|
2218
|
+
// consumers, instead of leaving the session `established` with a revoked token.
|
|
2219
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.code) === 400312 /* Amity.ServerError.GLOBAL_BAN */) {
|
|
2220
|
+
fireEvent('user.didGlobalBan', { users: [], files: [] });
|
|
2221
|
+
}
|
|
2214
2222
|
// handle visitor daily usage limit exceeded
|
|
2215
|
-
if (((
|
|
2223
|
+
if (((_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.code) === 400323 /* Amity.ServerError.VISITOR_USAGE_LIMIT_EXCEEDED */) {
|
|
2216
2224
|
throttledFireVisitorUsageLimit();
|
|
2217
2225
|
throw new ASCError('Visitor usage limit exceeded', 400323 /* Amity.ServerError.VISITOR_USAGE_LIMIT_EXCEEDED */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
2218
2226
|
}
|
|
2219
2227
|
// if it's an error with status in the response payload,
|
|
2220
2228
|
// then it's an expected error.
|
|
2221
|
-
if ((
|
|
2229
|
+
if ((_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.status) {
|
|
2222
2230
|
unwrapPayload(response === null || response === void 0 ? void 0 : response.data);
|
|
2223
2231
|
}
|
|
2224
2232
|
// as on request cancellation error is returned
|
|
@@ -2226,7 +2234,7 @@ const createHttpTransport = (endpoint) => {
|
|
|
2226
2234
|
throw error;
|
|
2227
2235
|
}
|
|
2228
2236
|
// unexpected error.
|
|
2229
|
-
throw new Error((
|
|
2237
|
+
throw new Error((_d = response === null || response === void 0 ? void 0 : response.data) !== null && _d !== void 0 ? _d : error);
|
|
2230
2238
|
});
|
|
2231
2239
|
instance.defaults.paramsSerializer = {
|
|
2232
2240
|
encode: params => encodeURIComponent(params),
|
|
@@ -2595,6 +2603,9 @@ const createMqttTransport = (endpoint) => {
|
|
|
2595
2603
|
const clientId = await getMQTTClientId(params.userId);
|
|
2596
2604
|
if (mqttClient) {
|
|
2597
2605
|
mqttClient.removeAllListeners();
|
|
2606
|
+
mqttClient.on('error', error => {
|
|
2607
|
+
console.warn('MQTT discarded connection error:', error === null || error === void 0 ? void 0 : error.message);
|
|
2608
|
+
});
|
|
2598
2609
|
mqttClient.end(true);
|
|
2599
2610
|
}
|
|
2600
2611
|
mqttClient = mqtt.connect(endpoint, getMqttOptions({
|
|
@@ -13026,6 +13037,16 @@ const createChannel = async (bundle) => {
|
|
|
13026
13037
|
/* c8 ignore next */
|
|
13027
13038
|
isPublic: (bundle === null || bundle === void 0 ? void 0 : bundle.type) === 'community' ? isPublic : undefined }));
|
|
13028
13039
|
}
|
|
13040
|
+
// Fire the event locally, the same way createCommunity and createPost do.
|
|
13041
|
+
// Without it a running getChannels collection never inserts the new channel:
|
|
13042
|
+
// its query stream controller inserts an id only on OnCreate / OnJoin /
|
|
13043
|
+
// OnResolveChannel / OnUnarchived, and the first sent message arrives as an
|
|
13044
|
+
// OnUpdate, which only re-notifies. Reusing the MQTT event name means the
|
|
13045
|
+
// already-wired onChannelCreated -> OnCreate path does the insert, so the
|
|
13046
|
+
// list updates without a re-query. onChannelCreated re-runs
|
|
13047
|
+
// prepareChannelPayload + ingestInCache itself, so this is idempotent with
|
|
13048
|
+
// the ingest below.
|
|
13049
|
+
fireEvent('channel.created', payload.data);
|
|
13029
13050
|
const data = await prepareChannelPayload(payload.data);
|
|
13030
13051
|
const cachedAt = client.cache && Date.now();
|
|
13031
13052
|
if (client.cache)
|
|
@@ -21492,6 +21513,8 @@ const getChannel = (channelId, callback) => {
|
|
|
21492
21513
|
onChannelMemberRemoved,
|
|
21493
21514
|
onChannelMemberBanned,
|
|
21494
21515
|
onChannelMemberUnbanned,
|
|
21516
|
+
onChannelMemberRoleAdded,
|
|
21517
|
+
onChannelMemberRoleRemoved,
|
|
21495
21518
|
onChannelSetMuted,
|
|
21496
21519
|
onChannelMessagePinned,
|
|
21497
21520
|
onChannelMessageUnpinned,
|