@amityco/ts-sdk 7.28.1-ff89ba3b.0 → 7.29.1-0cb2e19.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.
@@ -1 +1 @@
1
- {"version":3,"file":"ChannelLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AA6C1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AAcvF,qBAAa,+BAAgC,SAAQ,wBAAwB,CAC3E,SAAS,EACT,KAAK,CAAC,qBAAqB,EAC3B,KAAK,CAAC,OAAO,EACb,2BAA2B,GAAG,iCAAiC,CAChE;IACC,OAAO,CAAC,qBAAqB,CAA+B;IAE5D,OAAO,CAAC,KAAK,CAA8B;gBAGzC,KAAK,EAAE,KAAK,CAAC,qBAAqB,EAClC,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC;IAgCvD,SAAS,CAAC,KAAK;cAUC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,UAAU;IAI9E,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,SAAS,CAAC;IAI1D,iBAAiB;IAIjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;IAkCzE,OAAO,CAAC,WAAW;IAuDnB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAKvC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAQtC,OAAO,CAAC,gBAAgB;CA0YzB"}
1
+ {"version":3,"file":"ChannelLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AA6C1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AAcvF,qBAAa,+BAAgC,SAAQ,wBAAwB,CAC3E,SAAS,EACT,KAAK,CAAC,qBAAqB,EAC3B,KAAK,CAAC,OAAO,EACb,2BAA2B,GAAG,iCAAiC,CAChE;IACC,OAAO,CAAC,qBAAqB,CAA+B;IAE5D,OAAO,CAAC,KAAK,CAA8B;gBAGzC,KAAK,EAAE,KAAK,CAAC,qBAAqB,EAClC,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC;IAgCvD,SAAS,CAAC,KAAK;cAUC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,UAAU;IAI9E,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,SAAS,CAAC;IAI1D,iBAAiB;IAIjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;IAkCzE,OAAO,CAAC,WAAW;IAgEnB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAKvC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAQtC,OAAO,CAAC,gBAAgB;CA0YzB"}
@@ -2,6 +2,14 @@ declare type ActivityFields = {
2
2
  lastActivity?: boolean;
3
3
  lastMessageAt?: boolean;
4
4
  };
5
+ /**
6
+ * The channel cache is keyed by `channelInternalId`, but a message names its
7
+ * channel by whichever id the producer had: the raw MQTT payload carries the
8
+ * internal id, a converted `Amity.InternalMessage` carries the public id, and
9
+ * the optimistic message carries the sub-channel's `channelId`. Try the direct
10
+ * key first, then match any of the three ids.
11
+ */
12
+ export declare const findCachedChannel: (channelId: string) => Amity.StaticInternalChannel | undefined;
5
13
  /**
6
14
  * Single owner of every local write to a channel's ordering timestamps,
7
15
  * `lastActivity` and `lastMessageAt` (ChannelActivityService v1).
@@ -1 +1 @@
1
- {"version":3,"file":"updateChannelActivityTimestamps.d.ts","sourceRoot":"","sources":["../../../src/channelRepository/utils/updateChannelActivityTimestamps.ts"],"names":[],"mappings":"AAOA,aAAK,cAAc,GAAG;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAoDF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,+BAA+B,cAC/B,MAAM,GAAG,SAAS,MACzB,MAAM,SAAS,GAAG,SAAS,WACvB,cAAc,KACrB,OAaF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,cACjB,MAAM,GAAG,SAAS,WACpB,MAAM,SAAS,GAAG,SAAS,YAC1B,MAAM,SAAS,GAAG,SAAS,KACpC,OAcF,CAAC"}
1
+ {"version":3,"file":"updateChannelActivityTimestamps.d.ts","sourceRoot":"","sources":["../../../src/channelRepository/utils/updateChannelActivityTimestamps.ts"],"names":[],"mappings":"AAOA,aAAK,cAAc,GAAG;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,cAAe,MAAM,KAAG,MAAM,qBAAqB,GAAG,SAUnF,CAAC;AA+BF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,+BAA+B,cAC/B,MAAM,GAAG,SAAS,MACzB,MAAM,SAAS,GAAG,SAAS,WACvB,cAAc,KACrB,OAaF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,cACjB,MAAM,GAAG,SAAS,WACpB,MAAM,SAAS,GAAG,SAAS,YAC1B,MAAM,SAAS,GAAG,SAAS,KACpC,OAcF,CAAC"}
@@ -71,15 +71,6 @@ export declare const sortByLastMessage: SortingFunc<{
71
71
  lastMessageAt?: Date | number | string | null;
72
72
  createdAt: Date | number | string;
73
73
  }>;
74
- /**
75
- * Code-point ordering of objects having a displayName, empty or missing names
76
- * first. This is the server's `sortBy=displayName` order for channels
77
- * (case-sensitive, uppercase before lowercase); a localized or case-insensitive
78
- * comparison would disagree with the page order.
79
- */
80
- export declare const sortByDisplayNameCodePoint: SortingFunc<{
81
- displayName?: string | null;
82
- }>;
83
74
  /**
84
75
  * Filter items by untilAt timestamp based on sort direction
85
76
  * - For 'lastCreated' (newest first): untilAt acts as lower bound, excludes items older than boundary
@@ -1 +1 @@
1
- {"version":3,"file":"sorting.d.ts","sourceRoot":"","sources":["../../../src/core/query/sorting.ts"],"names":[],"mappings":"AAIA,aAAK,WAAW,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAMnE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAGrD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAG/D,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAG7D,CAAC;AAEX;;GAEG;AAC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,MAAM,iBAAiB,EAAE,WAAW,CAAC;IAAE,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,CAG/B,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,CAGjC,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,CAGhC,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC;IAAE,YAAY,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,CAGnC,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC;IAC1C,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC9C,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;CACnC,CAQA,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe;eAA2B,IAAI,GAAG,MAAM,GAAG,MAAM;wBAElE,IAAI,GAAG,MAAM,GAAG,MAAM,UACvB,aAAa,GAAG,cAAc,QAWvC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,YAAa,MAAM,KAAG,MAAM,GAAG,SAW1D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,cACtB,IAAI,GAAG,MAAM,GAAG,MAAM,WACxB,IAAI,GAAG,MAAM,GAAG,MAAM,UACvB,aAAa,GAAG,cAAc,KACrC,OAWF,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -344,8 +344,8 @@ exports.AmityLiveViewerCountMode = void 0;
344
344
 
345
345
  function getVersion() {
346
346
  try {
347
- // the string ''v7.28.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
348
- return 'v7.28.0-cjs';
347
+ // the string ''v7.29.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
348
+ return 'v7.29.0-cjs';
349
349
  }
350
350
  catch (error) {
351
351
  return '__dev__';
@@ -1649,23 +1649,6 @@ const sortByLastMessage = (a, b) => {
1649
1649
  return 1;
1650
1650
  return new Date(b.createdAt).valueOf() - new Date(a.createdAt).valueOf();
1651
1651
  };
1652
- /**
1653
- * Code-point ordering of objects having a displayName, empty or missing names
1654
- * first. This is the server's `sortBy=displayName` order for channels
1655
- * (case-sensitive, uppercase before lowercase); a localized or case-insensitive
1656
- * comparison would disagree with the page order.
1657
- */
1658
- const sortByDisplayNameCodePoint = ({ displayName: a }, { displayName: b }) => {
1659
- const x = a !== null && a !== void 0 ? a : '';
1660
- const y = b !== null && b !== void 0 ? b : '';
1661
- if (x === y)
1662
- return 0;
1663
- if (!x)
1664
- return -1;
1665
- if (!y)
1666
- return 1;
1667
- return x < y ? -1 : 1;
1668
- };
1669
1652
  /**
1670
1653
  * Filter items by untilAt timestamp based on sort direction
1671
1654
  * - For 'lastCreated' (newest first): untilAt acts as lower bound, excludes items older than boundary
@@ -19844,7 +19827,7 @@ const getLocalId = () => `LOCAL_${uuid()}`;
19844
19827
  // FIXME: temp solution
19845
19828
  let uniqueId;
19846
19829
  const createMessageOptimistic = (bundle) => {
19847
- var _a, _b;
19830
+ var _a, _b, _c, _d;
19848
19831
  const client = getActiveClient();
19849
19832
  if (!client.cache)
19850
19833
  return;
@@ -19876,9 +19859,13 @@ const createMessageOptimistic = (bundle) => {
19876
19859
  // as reused to update created and updated time, which should be the same
19877
19860
  const createdTime = new Date().toISOString();
19878
19861
  const message = Object.assign({
19879
- // The optimistic message must name its channel so the session-wide channel
19880
- // activity handler can move lastActivity / lastMessageAt at send time.
19881
- channelId: subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.channelId, creatorId: client.userId, creatorPrivateId: getActiveUser()._id, channelSegment: ((_b = subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.messageCount) !== null && _b !== void 0 ? _b : 0) + 1, childrenNumber: 0, createdAt: createdTime, updatedAt: createdTime, syncState: "syncing" /* Amity.SyncState.Syncing */, isDeleted: false }, bundleWithMessageId);
19862
+ // The optimistic message must name its channel (public id) so the own-send
19863
+ // update can move lastActivity / lastMessageAt at send time. Take it from the
19864
+ // cached sub-channel; when that is not cached, resolve the sub-channel id
19865
+ // through the channel cache, which for a channel's default sub-channel is
19866
+ // the channel itself (ChannelActivityService migration row I2). A thread or
19867
+ // unknown channel resolves to undefined, as before.
19868
+ channelId: (_b = subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.channelId) !== null && _b !== void 0 ? _b : (_c = findCachedChannel(bundle.subChannelId)) === null || _c === void 0 ? void 0 : _c.channelId, creatorId: client.userId, creatorPrivateId: getActiveUser()._id, channelSegment: ((_d = subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.messageCount) !== null && _d !== void 0 ? _d : 0) + 1, childrenNumber: 0, createdAt: createdTime, updatedAt: createdTime, syncState: "syncing" /* Amity.SyncState.Syncing */, isDeleted: false }, bundleWithMessageId);
19882
19869
  const cachedAt = UNSYNCED_OBJECT_CACHED_AT_VALUE;
19883
19870
  pushToCache(['message', 'get', message.messageId], message, { cachedAt });
19884
19871
  // Own-send update (ChannelActivityService row 1): move the channel at send
@@ -22375,11 +22362,15 @@ class ChannelLiveCollectionController extends LiveCollectionController {
22375
22362
  break;
22376
22363
  case 'displayName':
22377
22364
  /*
22378
- * The server returns channels with empty | null displayName's first, then
22379
- * the rest in code-point order (case-sensitive). The comparator mirrors
22380
- * that so the local order agrees with the page order.
22365
+ * The server returns channels with empty | null displayName's first before
22366
+ * returning sorted list of channels with displayNames
22367
+ *
22368
+ * This section needs to be updated as displayNames can be null as well
22381
22369
  */
22382
- channels = channels.sort(sortByDisplayNameCodePoint);
22370
+ channels = channels
22371
+ // this needs to be aligned with the backend data type
22372
+ .map(c => (c.displayName ? c : Object.assign(Object.assign({}, c), { displayName: '' })))
22373
+ .sort(sortByDisplayName);
22383
22374
  break;
22384
22375
  default:
22385
22376
  channels = channels.sort(sortByLastActivity);
@@ -37822,7 +37813,6 @@ exports.restoreCache = restoreCache;
37822
37813
  exports.runQuery = runQuery;
37823
37814
  exports.sortByChannelSegment = sortByChannelSegment;
37824
37815
  exports.sortByDisplayName = sortByDisplayName;
37825
- exports.sortByDisplayNameCodePoint = sortByDisplayNameCodePoint;
37826
37816
  exports.sortByFirstCreated = sortByFirstCreated;
37827
37817
  exports.sortByFirstUpdated = sortByFirstUpdated;
37828
37818
  exports.sortByLastActivity = sortByLastActivity;
package/dist/index.esm.js CHANGED
@@ -328,8 +328,8 @@ var AmityLiveViewerCountMode;
328
328
 
329
329
  function getVersion() {
330
330
  try {
331
- // the string ''v7.28.0-esm'' should be replaced by actual value by @rollup/plugin-replace
332
- return 'v7.28.0-esm';
331
+ // the string ''v7.29.0-esm'' should be replaced by actual value by @rollup/plugin-replace
332
+ return 'v7.29.0-esm';
333
333
  }
334
334
  catch (error) {
335
335
  return '__dev__';
@@ -1633,23 +1633,6 @@ const sortByLastMessage = (a, b) => {
1633
1633
  return 1;
1634
1634
  return new Date(b.createdAt).valueOf() - new Date(a.createdAt).valueOf();
1635
1635
  };
1636
- /**
1637
- * Code-point ordering of objects having a displayName, empty or missing names
1638
- * first. This is the server's `sortBy=displayName` order for channels
1639
- * (case-sensitive, uppercase before lowercase); a localized or case-insensitive
1640
- * comparison would disagree with the page order.
1641
- */
1642
- const sortByDisplayNameCodePoint = ({ displayName: a }, { displayName: b }) => {
1643
- const x = a !== null && a !== void 0 ? a : '';
1644
- const y = b !== null && b !== void 0 ? b : '';
1645
- if (x === y)
1646
- return 0;
1647
- if (!x)
1648
- return -1;
1649
- if (!y)
1650
- return 1;
1651
- return x < y ? -1 : 1;
1652
- };
1653
1636
  /**
1654
1637
  * Filter items by untilAt timestamp based on sort direction
1655
1638
  * - For 'lastCreated' (newest first): untilAt acts as lower bound, excludes items older than boundary
@@ -19844,7 +19827,7 @@ const getLocalId = () => `LOCAL_${uuid()}`;
19844
19827
  // FIXME: temp solution
19845
19828
  let uniqueId;
19846
19829
  const createMessageOptimistic = (bundle) => {
19847
- var _a, _b;
19830
+ var _a, _b, _c, _d;
19848
19831
  const client = getActiveClient();
19849
19832
  if (!client.cache)
19850
19833
  return;
@@ -19876,9 +19859,13 @@ const createMessageOptimistic = (bundle) => {
19876
19859
  // as reused to update created and updated time, which should be the same
19877
19860
  const createdTime = new Date().toISOString();
19878
19861
  const message = Object.assign({
19879
- // The optimistic message must name its channel so the session-wide channel
19880
- // activity handler can move lastActivity / lastMessageAt at send time.
19881
- channelId: subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.channelId, creatorId: client.userId, creatorPrivateId: getActiveUser()._id, channelSegment: ((_b = subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.messageCount) !== null && _b !== void 0 ? _b : 0) + 1, childrenNumber: 0, createdAt: createdTime, updatedAt: createdTime, syncState: "syncing" /* Amity.SyncState.Syncing */, isDeleted: false }, bundleWithMessageId);
19862
+ // The optimistic message must name its channel (public id) so the own-send
19863
+ // update can move lastActivity / lastMessageAt at send time. Take it from the
19864
+ // cached sub-channel; when that is not cached, resolve the sub-channel id
19865
+ // through the channel cache, which for a channel's default sub-channel is
19866
+ // the channel itself (ChannelActivityService migration row I2). A thread or
19867
+ // unknown channel resolves to undefined, as before.
19868
+ channelId: (_b = subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.channelId) !== null && _b !== void 0 ? _b : (_c = findCachedChannel(bundle.subChannelId)) === null || _c === void 0 ? void 0 : _c.channelId, creatorId: client.userId, creatorPrivateId: getActiveUser()._id, channelSegment: ((_d = subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.messageCount) !== null && _d !== void 0 ? _d : 0) + 1, childrenNumber: 0, createdAt: createdTime, updatedAt: createdTime, syncState: "syncing" /* Amity.SyncState.Syncing */, isDeleted: false }, bundleWithMessageId);
19882
19869
  const cachedAt = UNSYNCED_OBJECT_CACHED_AT_VALUE;
19883
19870
  pushToCache(['message', 'get', message.messageId], message, { cachedAt });
19884
19871
  // Own-send update (ChannelActivityService row 1): move the channel at send
@@ -22375,11 +22362,15 @@ class ChannelLiveCollectionController extends LiveCollectionController {
22375
22362
  break;
22376
22363
  case 'displayName':
22377
22364
  /*
22378
- * The server returns channels with empty | null displayName's first, then
22379
- * the rest in code-point order (case-sensitive). The comparator mirrors
22380
- * that so the local order agrees with the page order.
22365
+ * The server returns channels with empty | null displayName's first before
22366
+ * returning sorted list of channels with displayNames
22367
+ *
22368
+ * This section needs to be updated as displayNames can be null as well
22381
22369
  */
22382
- channels = channels.sort(sortByDisplayNameCodePoint);
22370
+ channels = channels
22371
+ // this needs to be aligned with the backend data type
22372
+ .map(c => (c.displayName ? c : Object.assign(Object.assign({}, c), { displayName: '' })))
22373
+ .sort(sortByDisplayName);
22383
22374
  break;
22384
22375
  default:
22385
22376
  channels = channels.sort(sortByLastActivity);
@@ -37705,4 +37696,4 @@ class AmityAttachmentProductTags {
37705
37696
  }
37706
37697
  }
37707
37698
 
37708
- export { API_REGIONS, index$6 as AdRepository, AmityAttachmentProductTags, AmityAutoSubscription, AmityChannelNotificationModeEnum, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, AmityLiveViewerCountMode, AmityModuleNotEntitledError, AmitySharableContentType, AnalyticsSourceTypeEnum, index$g as CategoryRepository, index$k as ChannelRepository, index$t as Client, index$f as CommentRepository, CommunityNotificationEventNameEnum, CommunityPostSettingMaps, CommunityPostSettings, index$h as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, index as CuratedContentRepository, DefaultCommunityPostSetting, index$2 as EventRepository, FeedDataTypeEnum, index$e as FeedRepository, FeedSortByEnum, FeedSourceEnum, FeedTypeEnum, FileAccessTypeEnum, index$q as FileRepository, FileType, GET_WATCHER_URLS, index$4 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTargetTypeEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$3 as LiveReactionRepository, index$8 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$o as MessageRepository, NotificationRolesFilterTypeEnum, NotificationSettingsLevelEnum, index$9 as PollRepository, PostContentType, index$c as PostRepository, PostStructureType, index$1 as ProductRepository, index$p as ReactionRepository, index$a as RoomPresenceRepository, index$d as RoomRepository, SearchUsersByEnum, index$7 as StoryRepository, index$b as StreamRepository, index$n as SubChannelRepository, SubscriptionLevels, UserNotificationModuleNameEnum, UserProfileFieldEnum, UserReportTypeEnum, index$r as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, exceedsUntilAtBoundary, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, filterByUntilAt, filterCommentsByBlockUsers, filterPostsByBlockUsers, getBlockUsersId, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkId, getNetworkTopic, getPostTopic, getRole, getRoomStreamerTopic, getRoomWatcherTopic, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$5 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, resolveModuleAvailability, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByDisplayNameCodePoint, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastMessage, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, validateUntilAt, wipeCache };
37699
+ export { API_REGIONS, index$6 as AdRepository, AmityAttachmentProductTags, AmityAutoSubscription, AmityChannelNotificationModeEnum, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, AmityLiveViewerCountMode, AmityModuleNotEntitledError, AmitySharableContentType, AnalyticsSourceTypeEnum, index$g as CategoryRepository, index$k as ChannelRepository, index$t as Client, index$f as CommentRepository, CommunityNotificationEventNameEnum, CommunityPostSettingMaps, CommunityPostSettings, index$h as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, index as CuratedContentRepository, DefaultCommunityPostSetting, index$2 as EventRepository, FeedDataTypeEnum, index$e as FeedRepository, FeedSortByEnum, FeedSourceEnum, FeedTypeEnum, FileAccessTypeEnum, index$q as FileRepository, FileType, GET_WATCHER_URLS, index$4 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTargetTypeEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$3 as LiveReactionRepository, index$8 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$o as MessageRepository, NotificationRolesFilterTypeEnum, NotificationSettingsLevelEnum, index$9 as PollRepository, PostContentType, index$c as PostRepository, PostStructureType, index$1 as ProductRepository, index$p as ReactionRepository, index$a as RoomPresenceRepository, index$d as RoomRepository, SearchUsersByEnum, index$7 as StoryRepository, index$b as StreamRepository, index$n as SubChannelRepository, SubscriptionLevels, UserNotificationModuleNameEnum, UserProfileFieldEnum, UserReportTypeEnum, index$r as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, exceedsUntilAtBoundary, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, filterByUntilAt, filterCommentsByBlockUsers, filterPostsByBlockUsers, getBlockUsersId, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkId, getNetworkTopic, getPostTopic, getRole, getRoomStreamerTopic, getRoomWatcherTopic, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$5 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, resolveModuleAvailability, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastMessage, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, validateUntilAt, wipeCache };