@amityco/ts-sdk 7.5.4-d9c7b36.0 → 7.5.4-ec2fdd4.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.
Files changed (33) hide show
  1. package/dist/@types/domains/content.d.ts +5 -2
  2. package/dist/@types/domains/content.d.ts.map +1 -1
  3. package/dist/@types/domains/pinnedPost.d.ts +1 -1
  4. package/dist/@types/domains/pinnedPost.d.ts.map +1 -1
  5. package/dist/@types/index.d.ts +2 -0
  6. package/dist/@types/index.d.ts.map +1 -1
  7. package/dist/client/api/index.d.ts +1 -0
  8. package/dist/client/api/index.d.ts.map +1 -1
  9. package/dist/client/api/resumeSession.d.ts +32 -0
  10. package/dist/client/api/resumeSession.d.ts.map +1 -0
  11. package/dist/client/api/tests/resumeSession.test.d.ts +2 -0
  12. package/dist/client/api/tests/resumeSession.test.d.ts.map +1 -0
  13. package/dist/communityRepository/api/deleteCommunity.d.ts.map +1 -1
  14. package/dist/communityRepository/api/getCommunity.d.ts +2 -2
  15. package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
  16. package/dist/communityRepository/observers/getCommunity.d.ts.map +1 -1
  17. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts.map +1 -1
  18. package/dist/index.cjs.js +195 -18
  19. package/dist/index.esm.js +194 -18
  20. package/dist/index.umd.js +4 -4
  21. package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
  22. package/dist/utils/tests/dummy/comment.d.ts +1 -1
  23. package/package.json +2 -1
  24. package/src/@types/domains/content.ts +15 -1
  25. package/src/@types/domains/pinnedPost.ts +1 -1
  26. package/src/@types/index.ts +2 -0
  27. package/src/client/api/index.ts +1 -0
  28. package/src/client/api/resumeSession.ts +282 -0
  29. package/src/client/api/tests/resumeSession.test.ts +173 -0
  30. package/src/communityRepository/api/deleteCommunity.ts +2 -1
  31. package/src/communityRepository/api/getCommunity.ts +5 -7
  32. package/src/communityRepository/observers/getCommunity.ts +24 -12
  33. package/src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts +1 -2
@@ -19,7 +19,7 @@ export declare enum ContentFlagReasonEnum {
19
19
  declare global {
20
20
  namespace Amity {
21
21
  type ContentFlagReason = Exclude<`${ContentFlagReasonEnum}`, `${ContentFlagReasonEnum.Others}`> | (string & {});
22
- type ContentType = 'text' | 'image' | 'file' | 'video' | 'poll' | 'json' | string;
22
+ type ContentType = 'text' | 'image' | 'file' | 'video' | 'poll' | 'json' | 'liveStream' | string;
23
23
  type ContentFeedType = ValueOf<typeof ContentFeedType>;
24
24
  type ContentDataText = {
25
25
  text: string;
@@ -45,7 +45,10 @@ declare global {
45
45
  type ContentDataPoll = {
46
46
  pollId: Amity.Poll['pollId'];
47
47
  };
48
- type ContentData<T extends ContentType> = T extends 'text' ? ContentDataText : T extends 'file' ? ContentDataFile : T extends 'image' ? ContentDataImage : T extends 'video' ? ContentDataVideo : T extends 'poll' ? ContentDataPoll : T extends 'json' ? Record<string, unknown> : T extends string ? string | Record<string, unknown> : never;
48
+ type ContentDataStream = {
49
+ streamId: Amity.Stream['streamId'];
50
+ };
51
+ type ContentData<T extends ContentType> = T extends 'text' ? ContentDataText : T extends 'file' ? ContentDataFile : T extends 'image' ? ContentDataImage : T extends 'video' ? ContentDataVideo : T extends 'poll' ? ContentDataPoll : T extends 'liveStream' ? ContentDataStream : T extends 'json' ? Record<string, unknown> : T extends string ? string | Record<string, unknown> : never;
49
52
  type Content<T extends ContentType> = {
50
53
  dataType?: T;
51
54
  dataTypes?: T[];
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/content.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;EAM1B,CAAC;AAEH,oBAAY,qBAAqB;IAC/B,mBAAmB,iCAAiC;IACpD,oBAAoB,2BAA2B;IAC/C,iBAAiB,yBAAyB;IAC1C,4BAA4B,oCAAoC;IAChE,sBAA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OAAO,CAAC;YACrB,OAAO,EAAE,OAAO,CAAC;YACjB,kBAAkB,EAAE,MAAM,CAAC;YAC3B,eAAe,EAAE;gBACf,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC;gBACrC,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC;aACtC,CAAC;SACH,CAAC;QAEF,KAAK,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,MAAM,GAAG,OAAO,IAAI,CAAC,SAAS,MAAM,GAC5E,kBAAkB,GAClB,CAAC,SAAS,OAAO,GACjB,mBAAmB,GACnB,KAAK,CAAC;KACX;CACF"}
@@ -23,7 +23,7 @@ declare global {
23
23
  pinnedBy: Amity.User;
24
24
  pinnedAt: Date;
25
25
  };
26
- type GlobalPinnedPostLiveCollection = Amity.LiveCollectionParams<Record<string, never>>;
26
+ type GlobalPinnedPostLiveCollection = Amity.LiveCollectionParams<{}>;
27
27
  }
28
28
  }
29
29
  //# sourceMappingURL=pinnedPost.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pinnedPost.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/pinnedPost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QAEd,KAAK,iBAAiB,CAAC,CAAC,SAAS,KAAK,CAAC,eAAe,GAAG,GAAG,IAAI;YAC9D,UAAU,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;YACjC,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;YACrB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1B,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACjC,QAAQ,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;YAC7B,eAAe,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;YACnC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,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Y,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACjC,QAAQ,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;YAC7B,eAAe,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;YACnC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;SACxB,GAAG,KAAK,CAAC,gBAAgB,CAAC;QAE3B,KAAK,wBAAwB,GAAG,KAAK,CAAC,oBAAoB,CAAC;YACzD,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;YAC5C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;YAC1B,MAAM,EAAE,YAAY,GAAG,aAAa,CAAC;SACtC,CAAC,CAAC;QAEH,KAAK,6BAA6B,GAAG,IAAI,CACvC,KAAK,CAAC,mBAAmB,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,EACvE,QAAQ,CACT,CAAC;QAEF,KAAK,UAAU,GAAG;YAChB,IAAI,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;YAC7B,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAClC,MAAM,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;YACpC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC;YACrB,QAAQ,EAAE,IAAI,CAAC;SAChB,CAAC;QAEF,KAAK,8BAA8B,GAAG,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;KACtE;CACF"}
@@ -32,4 +32,6 @@ export * from './domains/notification';
32
32
  export * from './domains/client';
33
33
  export * from './domains/invitation';
34
34
  export * from './domains/joinRequest';
35
+ export * from './domains/pin';
36
+ export * from './domains/pinnedPost';
35
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/@types/index.ts"],"names":[],"mappings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OAAO,gBAAgB,CAAC;AACxB,OAAO,kBAAkB,CAAC;AAE1B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,oBAAoB,CAAC;AAE5B,OAAO,iBAAiB,CAAC;AACzB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,sBAAsB,CAAC;AAE9B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,mBAAmB,CAAC;AAE3B,OAAO,kBAAkB,CAAC;AAE1B,OAAO,mBAAmB,CAAC;AAE3B,OAAO,gBAAgB,CAAC;AACxB,OAAO,iBAAiB,CAAC;AAEzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC"}
@@ -4,6 +4,7 @@ export * from './createClient';
4
4
  export * from './login';
5
5
  export * from './logout';
6
6
  export * from './secureLogout';
7
+ export * from './resumeSession';
7
8
  export * from './isConnected';
8
9
  export * from './getFeedSettings';
9
10
  export * from './renewal';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,cAAc,cAAc,CAAC;AAE7B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAE/B,cAAc,eAAe,CAAC;AAE9B,cAAc,mBAAmB,CAAC;AAElC,cAAc,WAAW,CAAC;AAE1B,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC;AAEpC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,cAAc,cAAc,CAAC;AAE7B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAEhC,cAAc,eAAe,CAAC;AAE9B,cAAc,mBAAmB,CAAC;AAElC,cAAc,WAAW,CAAC;AAE1B,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC;AAEpC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,32 @@
1
+ interface Params {
2
+ userId: string;
3
+ token: {
4
+ issuedAt: string;
5
+ expiresAt: string;
6
+ accessToken: string;
7
+ };
8
+ }
9
+ /**
10
+ * ```js
11
+ * import { resumeSession } from '@amityco/ts-sdk/client/api'
12
+ * const success = await resumeSession({
13
+ * userId: 'XYZ123456789',
14
+ * token: { accessToken: 'abc123', issuedAt: '2023-01-01T00:00:00Z', expiresAt: '2023-01-02T00:00:00Z' }
15
+ * })
16
+ * ```
17
+ *
18
+ * Connects an {@link Amity.Client} instance to ASC servers using an existing access token
19
+ *
20
+ * @param params the connect parameters
21
+ * @param params.userId the user ID for the current session
22
+ * @param params.token the existing access token with its metadata
23
+ * @param sessionHandler the session handler for token renewal
24
+ * @param config optional configuration
25
+ * @returns a success boolean if connected
26
+ *
27
+ * @category Client API
28
+ * @async
29
+ */
30
+ export declare const resumeSession: (params: Params, sessionHandler: Amity.SessionHandler, config?: Amity.ConnectClientConfig) => Promise<boolean>;
31
+ export {};
32
+ //# sourceMappingURL=resumeSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resumeSession.d.ts","sourceRoot":"","sources":["../../../src/client/api/resumeSession.ts"],"names":[],"mappings":"AA0CA,UAAU,MAAM;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AA+DD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,WAChB,MAAM,kBACE,MAAM,cAAc,WAC3B,MAAM,mBAAmB,KACjC,QAAQ,OAAO,CA+IjB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=resumeSession.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resumeSession.test.d.ts","sourceRoot":"","sources":["../../../../src/client/api/tests/resumeSession.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"deleteCommunity.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/api/deleteCommunity.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,gBACb,MAAM,SAAS,CAAC,aAAa,CAAC,KAC1C,QAAQ,MAAM,SAAS,CAmBzB,CAAC"}
1
+ {"version":3,"file":"deleteCommunity.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/api/deleteCommunity.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,gBACb,MAAM,SAAS,CAAC,aAAa,CAAC,KAC1C,QAAQ,MAAM,SAAS,CAmBzB,CAAC"}
@@ -13,7 +13,7 @@
13
13
  * @async
14
14
  */
15
15
  export declare const getCommunity: {
16
- (communityId: Amity.Community['communityId'], type?: Amity.JoinRequestType, includeDiscoverablePrivateCommunity?: boolean): Promise<Amity.Cached<Amity.Community>>;
16
+ (communityId: Amity.Community['communityId'], type?: Amity.JoinRequestType, includeDiscoverablePrivateCommunity?: boolean): Promise<Amity.Cached<Amity.InternalCommunity>>;
17
17
  /**
18
18
  * ```js
19
19
  * import { CommunityRepository } from '@amityco/ts-sdk'
@@ -27,6 +27,6 @@ export declare const getCommunity: {
27
27
  *
28
28
  * @category Community API
29
29
  */
30
- locally(communityId: Amity.Community['communityId']): Amity.Cached<Amity.Community> | undefined;
30
+ locally(communityId: Amity.Community['communityId']): Amity.Cached<Amity.InternalCommunity> | undefined;
31
31
  };
32
32
  //# sourceMappingURL=getCommunity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCommunity.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/api/getCommunity.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY;kBACV,MAAM,SAAS,CAAC,aAAa,CAAC,SACpC,MAAM,eAAe,wCACU,OAAO,GAC5C,QAAQ,MAAM,MAAM,CAAC,MAAM,SAAS,CAAC,CAAC;IAiCzC;;;;;;;;;;;;OAYG;yBAEY,MAAM,SAAS,CAAC,aAAa,CAAC,GAC1C,MAAM,MAAM,CAAC,MAAM,SAAS,CAAC,GAAG,SAAS;CAjB3C,CAAC"}
1
+ {"version":3,"file":"getCommunity.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/api/getCommunity.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY;kBACV,MAAM,SAAS,CAAC,aAAa,CAAC,SACpC,MAAM,eAAe,wCACU,OAAO,GAC5C,QAAQ,MAAM,MAAM,CAAC,MAAM,iBAAiB,CAAC,CAAC;IA+BjD;;;;;;;;;;;;OAYG;yBAEY,MAAM,SAAS,CAAC,aAAa,CAAC,GAC1C,MAAM,MAAM,CAAC,MAAM,iBAAiB,CAAC,GAAG,SAAS;CAjBnD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getCommunity.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/observers/getCommunity.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,gBACV,MAAM,SAAS,CAAC,aAAa,CAAC,YACjC,MAAM,kBAAkB,CAAC,MAAM,SAAS,CAAC,KAClD,MAAM,YAaR,CAAC"}
1
+ {"version":3,"file":"getCommunity.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/observers/getCommunity.ts"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,gBACV,MAAM,SAAS,CAAC,aAAa,CAAC,YACjC,MAAM,kBAAkB,CAAC,MAAM,SAAS,CAAC,KAClD,MAAM,YAwBR,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"JoinRequestsPaginationController.d.ts","sourceRoot":"","sources":["../../../../src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAGlF;;;GAGG;AACH,qBAAa,gCAAiC,SAAQ,oBAAoB,CACxE,aAAa,EACb,KAAK,CAAC,yBAAyB,CAChC;IACO,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,yBAAyB,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS;CAczF"}
1
+ {"version":3,"file":"JoinRequestsPaginationController.d.ts","sourceRoot":"","sources":["../../../../src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAElF;;;GAGG;AACH,qBAAa,gCAAiC,SAAQ,oBAAoB,CACxE,aAAa,EACb,KAAK,CAAC,yBAAyB,CAChC;IACO,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,yBAAyB,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS;CAczF"}
package/dist/index.cjs.js CHANGED
@@ -10,6 +10,7 @@ var HttpAgent = require('agentkeepalive');
10
10
  var io = require('socket.io-client');
11
11
  var uuid$1 = require('react-native-uuid');
12
12
  var hash = require('object-hash');
13
+ var jwtDecode = require('jwt-decode');
13
14
  var Hls = require('hls.js');
14
15
 
15
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -21,6 +22,7 @@ var HttpAgent__default = /*#__PURE__*/_interopDefaultLegacy(HttpAgent);
21
22
  var io__default = /*#__PURE__*/_interopDefaultLegacy(io);
22
23
  var uuid__default = /*#__PURE__*/_interopDefaultLegacy(uuid$1);
23
24
  var hash__default = /*#__PURE__*/_interopDefaultLegacy(hash);
25
+ var jwtDecode__default = /*#__PURE__*/_interopDefaultLegacy(jwtDecode);
24
26
  var Hls__default = /*#__PURE__*/_interopDefaultLegacy(Hls);
25
27
 
26
28
  exports.MembershipAcceptanceTypeEnum = void 0;
@@ -7725,7 +7727,7 @@ class PaginationController {
7725
7727
  */
7726
7728
  class JoinRequestsPaginationController extends PaginationController {
7727
7729
  async getRequest(queryParams, token) {
7728
- const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, communityId } = queryParams, params = __rest(queryParams, ["limit", "communityId"]);
7730
+ const { limit = 20, communityId } = queryParams, params = __rest(queryParams, ["limit", "communityId"]);
7729
7731
  const options = token ? { token } : { limit };
7730
7732
  const { data: queryResponse } = await this.http.get(`/api/v4/communities/${communityId}/join`, {
7731
7733
  params: Object.assign(Object.assign({}, params), { options }),
@@ -9901,8 +9903,8 @@ const removeChannelMarkerCache = (channel) => {
9901
9903
  * than the one already connected, in which case the existing subscriptions need
9902
9904
  * to be cleared
9903
9905
  */
9904
- let subscriptions = [];
9905
- async function runMqtt() {
9906
+ let subscriptions$1 = [];
9907
+ async function runMqtt$1() {
9906
9908
  await modifyMqttConnection();
9907
9909
  }
9908
9910
  /* begin_public_function
@@ -9937,8 +9939,8 @@ const login = async (params, sessionHandler, config) => {
9937
9939
  if (client.userId && client.userId !== params.userId) {
9938
9940
  await logout();
9939
9941
  // Remove subscription to ban and delete
9940
- subscriptions.forEach(fn => fn());
9941
- subscriptions = [];
9942
+ subscriptions$1.forEach(fn => fn());
9943
+ subscriptions$1 = [];
9942
9944
  }
9943
9945
  // default values
9944
9946
  const defaultDeviceId = await getDeviceId();
@@ -9984,40 +9986,40 @@ const login = async (params, sessionHandler, config) => {
9984
9986
  throw error;
9985
9987
  }
9986
9988
  if ((config === null || config === void 0 ? void 0 : config.disableRTE) !== true) {
9987
- runMqtt();
9989
+ runMqtt$1();
9988
9990
  }
9989
9991
  await initializeMessagePreviewSetting();
9990
- if (subscriptions.length === 0) {
9991
- subscriptions.push(
9992
+ if (subscriptions$1.length === 0) {
9993
+ subscriptions$1.push(
9992
9994
  // GLOBAL_BAN
9993
9995
  onClientBanned((_) => {
9994
9996
  terminateClient("globalBan" /* Amity.TokenTerminationReason.GLOBAL_BAN */);
9995
- subscriptions.forEach(fn => fn());
9997
+ subscriptions$1.forEach(fn => fn());
9996
9998
  unsubWatcher();
9997
9999
  }), onTokenTerminated(_ => {
9998
10000
  terminateClient();
9999
- subscriptions.forEach(fn => fn());
10001
+ subscriptions$1.forEach(fn => fn());
10000
10002
  unsubWatcher();
10001
10003
  }), onUserDeleted$2((user) => {
10002
10004
  if (user.userId === client.userId) {
10003
10005
  terminateClient("userDeleted" /* Amity.TokenTerminationReason.USER_DELETED */);
10004
- subscriptions.forEach(fn => fn());
10006
+ subscriptions$1.forEach(fn => fn());
10005
10007
  unsubWatcher();
10006
10008
  }
10007
10009
  }), onTokenExpired(state => {
10008
10010
  SessionWatcher$1.getInstance().setSessionState(state);
10009
10011
  logout();
10010
- subscriptions.forEach(fn => fn());
10012
+ subscriptions$1.forEach(fn => fn());
10011
10013
  }),
10012
10014
  // NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
10013
10015
  // the channel because currently backend can't handle this, so every time a user is banned from
10014
10016
  // a channel or the channel is deleted the channel's unread count will not be reset to zero
10015
10017
  onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler());
10016
10018
  if (client.useLegacyUnreadCount) {
10017
- subscriptions.push(readReceiptSyncEngineOnLoginHandler());
10019
+ subscriptions$1.push(readReceiptSyncEngineOnLoginHandler());
10018
10020
  }
10019
10021
  else
10020
- subscriptions.push(legacyReadReceiptSyncEngineOnLoginHandler());
10022
+ subscriptions$1.push(legacyReadReceiptSyncEngineOnLoginHandler());
10021
10023
  }
10022
10024
  return true;
10023
10025
  };
@@ -10942,6 +10944,176 @@ const secureLogout = async () => {
10942
10944
  };
10943
10945
  /* end_public_function */
10944
10946
 
10947
+ /*
10948
+ * declared earlier to accomodate case when logging in with a different user
10949
+ * than the one already connected, in which case the existing subscriptions need
10950
+ * to be cleared
10951
+ */
10952
+ let subscriptions = [];
10953
+ async function runMqtt() {
10954
+ await modifyMqttConnection();
10955
+ }
10956
+ const isSameUserId = (token) => {
10957
+ var _a;
10958
+ const client = getActiveClient();
10959
+ const decoded = jwtDecode__default["default"](token);
10960
+ return ((_a = decoded === null || decoded === void 0 ? void 0 : decoded.user) === null || _a === void 0 ? void 0 : _a.publicUserId) === client.userId;
10961
+ };
10962
+ const validateAccessToken = async ({ token, userId }) => {
10963
+ const client = getActiveClient();
10964
+ // begin establishing session
10965
+ setSessionState("establishing" /* Amity.SessionStates.ESTABLISHING */);
10966
+ const { data: { users }, } = await client.http.get(`/api/v3/users/${userId}`, {
10967
+ headers: {
10968
+ Authorization: `Bearer ${token.accessToken}`,
10969
+ },
10970
+ });
10971
+ const user = users.find((u) => u.userId === userId);
10972
+ client.http.defaults.headers.common.Authorization = `Bearer ${token.accessToken}`;
10973
+ client.http.defaults.metadata = {
10974
+ tokenExpiry: token.expiresAt,
10975
+ isGlobalBanned: false,
10976
+ isUserDeleted: false,
10977
+ };
10978
+ client.upload.defaults.headers.common.Authorization = `Bearer ${token.accessToken}`;
10979
+ client.upload.defaults.metadata = {
10980
+ tokenExpiry: token.expiresAt,
10981
+ isGlobalBanned: false,
10982
+ isUserDeleted: false,
10983
+ };
10984
+ // manually setup the token for ws transport
10985
+ if (client.ws)
10986
+ client.ws.io.opts.query = { token: token.accessToken };
10987
+ client.token = token;
10988
+ setSessionState("established" /* Amity.SessionStates.ESTABLISHED */);
10989
+ return user;
10990
+ };
10991
+ /* begin_public_function
10992
+ id: client.resumeSession
10993
+ */
10994
+ /**
10995
+ * ```js
10996
+ * import { resumeSession } from '@amityco/ts-sdk/client/api'
10997
+ * const success = await resumeSession({
10998
+ * userId: 'XYZ123456789',
10999
+ * token: { accessToken: 'abc123', issuedAt: '2023-01-01T00:00:00Z', expiresAt: '2023-01-02T00:00:00Z' }
11000
+ * })
11001
+ * ```
11002
+ *
11003
+ * Connects an {@link Amity.Client} instance to ASC servers using an existing access token
11004
+ *
11005
+ * @param params the connect parameters
11006
+ * @param params.userId the user ID for the current session
11007
+ * @param params.token the existing access token with its metadata
11008
+ * @param sessionHandler the session handler for token renewal
11009
+ * @param config optional configuration
11010
+ * @returns a success boolean if connected
11011
+ *
11012
+ * @category Client API
11013
+ * @async
11014
+ */
11015
+ const resumeSession = async (params, sessionHandler, config) => {
11016
+ var _a;
11017
+ const client = getActiveClient();
11018
+ let unsubWatcher;
11019
+ client.log('client/api/resumeSession', Object.assign({ apiKey: client.apiKey, sessionState: client.sessionState }, params));
11020
+ // Handle existing connected user
11021
+ if (client.userId) {
11022
+ if (client.userId === params.userId && isSameUserId(params.token.accessToken)) {
11023
+ // Clear connections and listeners but preserve cache
11024
+ if (client.mqtt && client.mqtt.connected) {
11025
+ client.mqtt.disconnect();
11026
+ }
11027
+ if (client.ws && client.ws.connected) {
11028
+ client.ws.disconnect();
11029
+ }
11030
+ // Clear existing subscriptions
11031
+ subscriptions.forEach(fn => fn());
11032
+ subscriptions = [];
11033
+ }
11034
+ else {
11035
+ // Different user - do full logout
11036
+ await logout();
11037
+ // Remove subscription to ban and delete
11038
+ subscriptions.forEach(fn => fn());
11039
+ subscriptions = [];
11040
+ }
11041
+ }
11042
+ try {
11043
+ const user = await validateAccessToken(params);
11044
+ if (user == null) {
11045
+ throw new ASCError(`${params.userId} has not been found`, 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
11046
+ }
11047
+ if (user.isDeleted) {
11048
+ terminateClient("userDeleted" /* Amity.TokenTerminationReason.USER_DELETED */);
11049
+ return false;
11050
+ }
11051
+ if (user.isGlobalBanned) {
11052
+ terminateClient("globalBan" /* Amity.TokenTerminationReason.GLOBAL_BAN */);
11053
+ return false;
11054
+ }
11055
+ // FIXME: events are duplicated if connectClient is called few times without disconnectClient
11056
+ // wire websocket events to our event emitter
11057
+ proxyWebsocketEvents(client.ws, client.emitter);
11058
+ (_a = client.ws) === null || _a === void 0 ? void 0 : _a.open();
11059
+ client.userId = user.userId;
11060
+ client.sessionHandler = sessionHandler;
11061
+ /*
11062
+ * Cannot push to subscriptions as watcher needs to continue working even if
11063
+ * token expires
11064
+ */
11065
+ unsubWatcher = client.accessTokenExpiryWatcher(sessionHandler);
11066
+ setActiveUser(user);
11067
+ }
11068
+ catch (error) {
11069
+ /*
11070
+ * if getting token failed session state reverts to initial state when app
11071
+ * is first launched
11072
+ */
11073
+ SessionWatcher$1.getInstance().setSessionState("notLoggedIn" /* Amity.SessionStates.NOT_LOGGED_IN */);
11074
+ // pass error down tree so the calling function handle it
11075
+ throw error;
11076
+ }
11077
+ if ((config === null || config === void 0 ? void 0 : config.disableRTE) !== true) {
11078
+ runMqtt();
11079
+ }
11080
+ await initializeMessagePreviewSetting();
11081
+ if (subscriptions.length === 0) {
11082
+ subscriptions.push(
11083
+ // GLOBAL_BAN
11084
+ onClientBanned((_) => {
11085
+ terminateClient("globalBan" /* Amity.TokenTerminationReason.GLOBAL_BAN */);
11086
+ subscriptions.forEach(fn => fn());
11087
+ unsubWatcher();
11088
+ }), onTokenTerminated(_ => {
11089
+ terminateClient();
11090
+ subscriptions.forEach(fn => fn());
11091
+ unsubWatcher();
11092
+ }), onUserDeleted$2((user) => {
11093
+ if (user.userId === client.userId) {
11094
+ terminateClient("userDeleted" /* Amity.TokenTerminationReason.USER_DELETED */);
11095
+ subscriptions.forEach(fn => fn());
11096
+ unsubWatcher();
11097
+ }
11098
+ }), onTokenExpired(state => {
11099
+ SessionWatcher$1.getInstance().setSessionState(state);
11100
+ logout();
11101
+ subscriptions.forEach(fn => fn());
11102
+ }),
11103
+ // NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
11104
+ // the channel because currently backend can't handle this, so every time a user is banned from
11105
+ // a channel or the channel is deleted the channel's unread count will not be reset to zero
11106
+ onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler());
11107
+ if (client.useLegacyUnreadCount) {
11108
+ subscriptions.push(readReceiptSyncEngineOnLoginHandler());
11109
+ }
11110
+ else
11111
+ subscriptions.push(legacyReadReceiptSyncEngineOnLoginHandler());
11112
+ }
11113
+ return true;
11114
+ };
11115
+ /* end_public_function */
11116
+
10945
11117
  /**
10946
11118
  * ```js
10947
11119
  * import { isConnected } from '@amityco/ts-sdk'
@@ -11347,6 +11519,7 @@ var index$n = /*#__PURE__*/Object.freeze({
11347
11519
  login: login,
11348
11520
  logout: logout,
11349
11521
  secureLogout: secureLogout,
11522
+ resumeSession: resumeSession,
11350
11523
  isConnected: isConnected,
11351
11524
  getFeedSettings: getFeedSettings,
11352
11525
  renewal: renewal,
@@ -19608,7 +19781,7 @@ const getCommunity$1 = async (communityId, type, includeDiscoverablePrivateCommu
19608
19781
  }
19609
19782
  const { communities } = data;
19610
19783
  return {
19611
- data: LinkedObject.community(communities.find(community => community.communityId === communityId)),
19784
+ data: communities.find(community => community.communityId === communityId),
19612
19785
  cachedAt,
19613
19786
  };
19614
19787
  };
@@ -19634,7 +19807,7 @@ getCommunity$1.locally = (communityId) => {
19634
19807
  if (!cached)
19635
19808
  return;
19636
19809
  return {
19637
- data: LinkedObject.community(cached.data),
19810
+ data: cached.data,
19638
19811
  cachedAt: cached.cachedAt,
19639
19812
  };
19640
19813
  };
@@ -19670,7 +19843,7 @@ const deleteCommunity = async (communityId) => {
19670
19843
  files: [],
19671
19844
  users: [],
19672
19845
  });
19673
- return deleted.data;
19846
+ return LinkedObject.community(deleted.data);
19674
19847
  };
19675
19848
  /* end_public_function */
19676
19849
 
@@ -21180,7 +21353,11 @@ const getCommunity = (communityId, callback) => {
21180
21353
  onCommunityUserUnbanned,
21181
21354
  onCommunityUserChanged,
21182
21355
  convertEventPayload(onLocalCommunityJoin, 'targetId', 'community'),
21183
- ]);
21356
+ ], {
21357
+ callbackDataSelector: (data) => {
21358
+ return LinkedObject.community(data);
21359
+ },
21360
+ });
21184
21361
  };
21185
21362
  /* end_public_function */
21186
21363