@amityco/ts-sdk 0.0.1-beta.41.1 → 0.0.1-beta.42.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/core/model.d.ts +3 -1
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/domains/category.d.ts +1 -1
- package/dist/@types/domains/category.d.ts.map +1 -1
- package/dist/@types/domains/comment.d.ts +1 -1
- package/dist/@types/domains/comment.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +1 -1
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/message.d.ts +1 -1
- package/dist/@types/domains/message.d.ts.map +1 -1
- package/dist/@types/domains/post.d.ts +1 -1
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/@types/domains/subChannel.d.ts +1 -1
- package/dist/@types/domains/subChannel.d.ts.map +1 -1
- package/dist/cache/utils/index.d.ts +1 -0
- package/dist/cache/utils/index.d.ts.map +1 -1
- package/dist/category/api/queryCategories.d.ts.map +1 -1
- package/dist/category/observers/liveCategories.d.ts.map +1 -1
- package/dist/channel/observers/liveChannel.d.ts.map +1 -1
- package/dist/channel/observers/liveChannels.d.ts.map +1 -1
- package/dist/comment/api/queryComments.d.ts.map +1 -1
- package/dist/comment/api/tests/queryComments.test.d.ts +2 -0
- package/dist/comment/api/tests/queryComments.test.d.ts.map +1 -0
- package/dist/comment/observers/liveComments.d.ts.map +1 -1
- package/dist/community/api/queryCommunities.d.ts.map +1 -1
- package/dist/community/observers/liveCommunities.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/identifyModel.d.ts.map +1 -1
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/follow/api/getFollowInfo.d.ts.map +1 -1
- package/dist/follow/observers/index.d.ts +1 -0
- package/dist/follow/observers/index.d.ts.map +1 -1
- package/dist/follow/observers/liveFollowInfo.d.ts +21 -0
- package/dist/follow/observers/liveFollowInfo.d.ts.map +1 -0
- package/dist/follow/observers/tests/liveFollowInfo.test.d.ts +2 -0
- package/dist/follow/observers/tests/liveFollowInfo.test.d.ts.map +1 -0
- package/dist/index.cjs.js +112 -63
- package/dist/index.esm.js +112 -64
- package/dist/index.umd.js +4 -4
- package/dist/message/api/createMessage.d.ts +2 -1
- package/dist/message/api/createMessage.d.ts.map +1 -1
- package/dist/message/observers/liveMessages.d.ts.map +1 -1
- package/dist/message/utils/index.d.ts +3 -2
- package/dist/message/utils/index.d.ts.map +1 -1
- package/dist/post/api/queryPosts.d.ts.map +1 -1
- package/dist/post/observers/livePosts.d.ts.map +1 -1
- package/dist/subChannel/api/querySubChannels.d.ts.map +1 -1
- package/dist/subChannel/observers/liveSubChannels.d.ts.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/liveObject.d.ts +1 -1
- package/dist/utils/liveObject.d.ts.map +1 -1
- package/dist/utils/tests/dummy/comment.d.ts +77 -0
- package/dist/utils/tests/dummy/comment.d.ts.map +1 -0
- package/dist/utils/tests/dummy/community.d.ts +1 -1
- package/dist/utils/tests/dummy/index.d.ts +1 -0
- package/dist/utils/tests/dummy/index.d.ts.map +1 -1
- package/dist/utils/tests/dummy/post.d.ts +0 -12
- package/dist/utils/tests/dummy/post.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/model.ts +3 -1
- package/src/@types/domains/category.ts +1 -1
- package/src/@types/domains/comment.ts +1 -1
- package/src/@types/domains/community.ts +1 -1
- package/src/@types/domains/message.ts +1 -1
- package/src/@types/domains/post.ts +1 -1
- package/src/@types/domains/subChannel.ts +1 -1
- package/src/cache/utils/index.ts +5 -2
- package/src/category/api/queryCategories.ts +2 -1
- package/src/category/observers/liveCategories.ts +3 -1
- package/src/category/observers/tests/liveCategories.test.ts +1 -3
- package/src/channel/api/tests/addChannelMembers.test.ts +13 -0
- package/src/channel/api/tests/queryChannelMembers.test.ts +1 -0
- package/src/channel/api/tests/removeChannelMembers.test.ts +9 -2
- package/src/channel/observers/liveChannel.ts +16 -1
- package/src/channel/observers/liveChannels.ts +11 -9
- package/src/comment/api/queryComments.ts +2 -1
- package/src/comment/api/tests/createComment.test.ts +17 -112
- package/src/comment/api/tests/queryComments.test.ts +147 -0
- package/src/comment/api/tests/updateComment.test.ts +14 -85
- package/src/comment/observers/liveComments.ts +12 -7
- package/src/community/api/queryCommunities.ts +2 -1
- package/src/community/api/test/queryCommunity.test.ts +30 -0
- package/src/community/observers/liveCommunities.ts +13 -7
- package/src/community/observers/tests/liveCommunities.test.ts +2 -2
- package/src/core/model/idResolvers.ts +1 -0
- package/src/core/model/identifyModel.ts +2 -1
- package/src/core/model/index.ts +11 -2
- package/src/follow/api/getFollowInfo.ts +4 -8
- package/src/follow/observers/index.ts +1 -0
- package/src/follow/observers/liveFollowInfo.ts +29 -0
- package/src/follow/observers/tests/liveFollowInfo.test.ts +198 -0
- package/src/message/api/createMessage.ts +17 -5
- package/src/message/api/tests/createMessage.test.ts +36 -5
- package/src/message/api/tests/deleteMessage.test.ts +10 -3
- package/src/message/api/tests/getMessage.test.ts +9 -3
- package/src/message/api/tests/queryMessages.test.ts +30 -0
- package/src/message/api/tests/updateMessage.test.ts +9 -2
- package/src/message/observers/liveMessages.ts +15 -15
- package/src/message/tests/observers/liveMessages.test.ts +2 -2
- package/src/message/utils/index.ts +10 -1
- package/src/post/api/queryPosts.ts +2 -1
- package/src/post/api/tests/queryPosts.test.ts +30 -0
- package/src/post/observers/livePosts.ts +16 -11
- package/src/post/observers/tests/livePosts.test.ts +4 -5
- package/src/reaction/api/tests/addReaction.test.ts +13 -0
- package/src/reaction/api/tests/removeReaction.test.ts +13 -0
- package/src/subChannel/api/querySubChannels.ts +2 -1
- package/src/subChannel/observers/liveSubChannels.ts +6 -5
- package/src/subChannel/observers/tests/liveSubChannels.test.ts +5 -2
- package/src/utils/constants.ts +2 -1
- package/src/utils/liveObject.ts +1 -4
- package/src/utils/tests/dummy/comment.ts +268 -0
- package/src/utils/tests/dummy/index.ts +1 -0
- package/src/utils/tests/dummy/post.ts +0 -114
- package/dist/post/tests/api/getPost.test.d.ts +0 -2
- package/dist/post/tests/api/getPost.test.d.ts.map +0 -1
- package/dist/post/tests/api/queryPosts.test.d.ts +0 -2
- package/dist/post/tests/api/queryPosts.test.d.ts.map +0 -1
- package/src/post/tests/api/getPost.test.ts +0 -98
- package/src/post/tests/api/queryPosts.test.ts +0 -123
|
@@ -24,6 +24,7 @@ export declare const createMessage: {
|
|
|
24
24
|
<T extends Amity.MessageContentType>(bundle: Pick<Amity.Message<T>, "subChannelId" | "parentId" | "dataType" | "tags" | "metadata" | "mentionees"> & {
|
|
25
25
|
data?: Amity.ContentData<T> | undefined;
|
|
26
26
|
fileId?: string | undefined;
|
|
27
|
+
referenceId?: string | undefined;
|
|
27
28
|
}): Promise<Amity.Cached<Amity.Message>>;
|
|
28
29
|
/**
|
|
29
30
|
* ```js
|
|
@@ -42,6 +43,6 @@ export declare const createMessage: {
|
|
|
42
43
|
*
|
|
43
44
|
* @category Message API
|
|
44
45
|
*/
|
|
45
|
-
optimistically(bundle: Parameters<typeof createMessage>[0]): Amity.Cached<Amity.Message> | undefined;
|
|
46
|
+
optimistically({ referenceId, ...bundle }: Parameters<typeof createMessage>[0]): Amity.Cached<Amity.Message> | undefined;
|
|
46
47
|
};
|
|
47
48
|
//# sourceMappingURL=createMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMessage.d.ts","sourceRoot":"","sources":["../../../src/message/api/createMessage.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"createMessage.d.ts","sourceRoot":"","sources":["../../../src/message/api/createMessage.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,aAAa;;;;;QAmBvB,QAAQ,MAAM,MAAM,CAAC,MAAM,OAAO,CAAC,CAAC;IA6BvC;;;;;;;;;;;;;;;;OAgBG;+CAIA,WAAW,oBAAoB,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,MAAM,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS;CAtB/E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveMessages.d.ts","sourceRoot":"","sources":["../../../src/message/observers/liveMessages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"liveMessages.d.ts","sourceRoot":"","sources":["../../../src/message/observers/liveMessages.ts"],"names":[],"mappings":"AA0BA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,WACf,MAAM,sBAAsB,YAC1B,MAAM,sBAAsB,CAAC,MAAM,OAAO,CAAC,WAC5C,MAAM,oBAAoB,KAClC,MAAM,YA2GR,CAAC"}
|
|
@@ -4,8 +4,9 @@ export declare const prepareMessagePayload: (payload: Amity.MessagePayload) => A
|
|
|
4
4
|
export declare const convertResponseFromRaw: <T extends Amity.MessagePayload<any>>(response: AxiosResponse<T, any>) => AxiosResponse<Omit<T, "messages"> & {
|
|
5
5
|
messages: Amity.ProcessedMessagePayload['messages'];
|
|
6
6
|
}, any>;
|
|
7
|
-
declare type RawQueryMessages = Omit<Amity.QueryMessages, 'page' | 'sortBy' | 'subChannelId' | 'tags'> & {
|
|
7
|
+
declare type RawQueryMessages = Omit<Amity.QueryMessages, 'page' | 'sortBy' | 'subChannelId' | 'tags' | 'includeDeleted'> & {
|
|
8
8
|
includeTags?: Amity.QueryMessages['tags'];
|
|
9
|
+
isDeleted?: Amity.Message['isDeleted'];
|
|
9
10
|
messageFeedId: Amity.QueryMessages['subChannelId'];
|
|
10
11
|
options: {
|
|
11
12
|
sortBy?: Amity.QueryMessages['sortBy'];
|
|
@@ -13,6 +14,6 @@ declare type RawQueryMessages = Omit<Amity.QueryMessages, 'page' | 'sortBy' | 's
|
|
|
13
14
|
};
|
|
14
15
|
};
|
|
15
16
|
export declare function convertParams({ subChannelId, mentionees, ...rest }: Partial<Amity.Message>): Record<string, any>;
|
|
16
|
-
export declare function convertQueryParams({ page, sortBy, subChannelId, tags, ...rest }: Amity.QueryMessages): RawQueryMessages;
|
|
17
|
+
export declare function convertQueryParams({ page, sortBy, subChannelId, tags, includeDeleted, ...rest }: Amity.QueryMessages): RawQueryMessages;
|
|
17
18
|
export {};
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/message/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKtC,wBAAgB,cAAc,CAAC,EAC7B,eAAe,EACf,UAAU,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACb,WAAW,EACX,aAAa,EACb,SAAS,EACT,WAAW,EACX,OAAO,EACP,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,OAAO,CAmDlC;AAED,eAAO,MAAM,qBAAqB,YACvB,MAAM,cAAc,KAC5B,MAAM,uBAKR,CAAC;AAEF,eAAO,MAAM,sBAAsB;cAEgB,MAAM,uBAAuB,CAAC,UAAU,CAAC;OAQ3F,CAAC;AAEF,aAAK,gBAAgB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/message/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKtC,wBAAgB,cAAc,CAAC,EAC7B,eAAe,EACf,UAAU,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACb,WAAW,EACX,aAAa,EACb,SAAS,EACT,WAAW,EACX,OAAO,EACP,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,OAAO,CAmDlC;AAED,eAAO,MAAM,qBAAqB,YACvB,MAAM,cAAc,KAC5B,MAAM,uBAKR,CAAC;AAEF,eAAO,MAAM,sBAAsB;cAEgB,MAAM,uBAAuB,CAAC,UAAU,CAAC;OAQ3F,CAAC;AAEF,aAAK,gBAAgB,GAAG,IAAI,CAC1B,KAAK,CAAC,aAAa,EAInB,MAAM,GAAG,QAAQ,GAAG,cAAc,GAAG,MAAM,GAAG,gBAAgB,CAC/D,GAAG;IACF,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,SAAS,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACvC,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IACnD,OAAO,EAAE;QACP,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACvC,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC5B,YAAY,EACZ,UAAU,EACV,GAAG,IAAI,EACR,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAE9C;AAED,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,cAAc,EACd,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,aAAa,GAAG,gBAAgB,CAiBxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryPosts.d.ts","sourceRoot":"","sources":["../../../src/post/api/queryPosts.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU;YACd,MAAM,UAAU,GACtB,QAAQ,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"queryPosts.d.ts","sourceRoot":"","sources":["../../../src/post/api/queryPosts.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU;YACd,MAAM,UAAU,GACtB,QAAQ,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;IAmDhE;;;;;;;;;;;;OAYG;mBAEM,WAAW,iBAAiB,CAAC,CAAC,CAAC,CAAC,GACtC,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,SAAS;CAlBlE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"livePosts.d.ts","sourceRoot":"","sources":["../../../src/post/observers/livePosts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"livePosts.d.ts","sourceRoot":"","sources":["../../../src/post/observers/livePosts.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,SAAS,WACZ,MAAM,kBAAkB,YACtB,MAAM,sBAAsB,CAAC,MAAM,IAAI,CAAC,WACzC,MAAM,oBAAoB,KAClC,MAAM,YAgIR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"querySubChannels.d.ts","sourceRoot":"","sources":["../../../src/subChannel/api/querySubChannels.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB;YACpB,MAAM,gBAAgB,GAC5B,QAAQ,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,UAAU,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"querySubChannels.d.ts","sourceRoot":"","sources":["../../../src/subChannel/api/querySubChannels.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB;YACpB,MAAM,gBAAgB,GAC5B,QAAQ,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,UAAU,CAAC,CAAC,CAAC;IA4CvD;;;;;;;;;;;;OAYG;mBAEM,WAAW,uBAAuB,CAAC,CAAC,CAAC,CAAC,GAC5C,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,UAAU,CAAC,CAAC,GAAG,SAAS;CAlBzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveSubChannels.d.ts","sourceRoot":"","sources":["../../../src/subChannel/observers/liveSubChannels.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"liveSubChannels.d.ts","sourceRoot":"","sources":["../../../src/subChannel/observers/liveSubChannels.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,wBAAwB,YAC5B,MAAM,sBAAsB,CAAC,MAAM,UAAU,CAAC,WAC/C,MAAM,oBAAoB,eA+FpC,CAAC"}
|
|
@@ -4,6 +4,7 @@ export declare const ENABLE_CACHE_MESSAGE = "For using Live Collection feature y
|
|
|
4
4
|
export declare const LIVE_OBJECT_ENABLE_CACHE_MESSAGE = "For using Live Object feature you need to enable Cache!";
|
|
5
5
|
export declare const UNSYNCED_OBJECT_CACHED_AT_MESSAGE = "Observing unsynced object is not supported by Live Object.";
|
|
6
6
|
export declare const UNSYNCED_OBJECT_CACHED_AT_VALUE = -5;
|
|
7
|
+
export declare const SECOND = 1000;
|
|
7
8
|
export declare const MINUTE: number;
|
|
8
9
|
export declare const ACCESS_TOKEN_WATCHER_INTERVAL: number;
|
|
9
10
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mCAAmC,IAAI,CAAC;AACrD,eAAO,MAAM,iCAAiC,EAAE,KAAK,CAAC,WAAiC,CAAC;AACxF,eAAO,MAAM,oBAAoB,gEAAgE,CAAC;AAClG,eAAO,MAAM,gCAAgC,4DACc,CAAC;AAC5D,eAAO,MAAM,iCAAiC,+DACgB,CAAC;AAC/D,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAClD,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mCAAmC,IAAI,CAAC;AACrD,eAAO,MAAM,iCAAiC,EAAE,KAAK,CAAC,WAAiC,CAAC;AACxF,eAAO,MAAM,oBAAoB,gEAAgE,CAAC;AAClG,eAAO,MAAM,gCAAgC,4DACc,CAAC;AAC5D,eAAO,MAAM,iCAAiC,+DACgB,CAAC;AAC/D,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAClD,eAAO,MAAM,MAAM,OAAO,CAAC;AAC3B,eAAO,MAAM,MAAM,QAAc,CAAC;AAClC,eAAO,MAAM,6BAA6B,QAAc,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const liveObject: <T extends Amity.User | Amity.File<any> | Amity.Role | Amity.Channel<any> | Amity.SubChannel | Amity.Membership<"channel"> | Amity.Message<any> | Amity.Community | Amity.Category | Amity.Membership<"community"> | Amity.Feed | Amity.Post<any> | Amity.Comment<any> | Amity.Poll | Amity.Stream | Amity.FollowStatus, K extends keyof T>(id: T[K], callback: Amity.LiveObjectCallback<T>, key: K, fetcher: (id: T[K]) => Promise<Amity.Cached<T>>, eventHandlers: ((callback: Amity.Listener<T>) => Amity.Unsubscriber)[]) => Amity.Unsubscriber;
|
|
1
|
+
export declare const liveObject: <T extends Amity.User | Amity.File<any> | Amity.Role | Amity.Channel<any> | Amity.SubChannel | Amity.Membership<"channel"> | Amity.Message<any> | Amity.Community | Amity.Category | Amity.Membership<"community"> | Amity.Feed | Amity.Post<any> | Amity.Comment<any> | Amity.Poll | Amity.Reaction | Amity.Stream | Amity.FollowStatus | Amity.FollowCount | Amity.FollowInfo, K extends keyof T>(id: T[K], callback: Amity.LiveObjectCallback<T>, key: K, fetcher: (id: T[K]) => Promise<Amity.Cached<T>>, eventHandlers: ((callback: Amity.Listener<T>) => Amity.Unsubscriber)[]) => Amity.Unsubscriber;
|
|
2
2
|
//# sourceMappingURL=liveObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveObject.d.ts","sourceRoot":"","sources":["../../src/utils/liveObject.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"liveObject.d.ts","sourceRoot":"","sources":["../../src/utils/liveObject.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,UAAU,iiBAKiC,MAAM,YAAY,QACvE,MAAM,YAkER,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createComment } from '~/comment/api';
|
|
2
|
+
export declare function generateComment(params?: Partial<Amity.Comment>): Amity.Comment;
|
|
3
|
+
export declare const comment11: Amity.Comment;
|
|
4
|
+
export declare const imageComment11: Amity.Comment;
|
|
5
|
+
export declare const textImageComment11: Amity.Comment;
|
|
6
|
+
export declare const textMentionComment11: Amity.Comment;
|
|
7
|
+
export declare const comment12: Amity.Comment;
|
|
8
|
+
export declare const imageComment12: Amity.Comment;
|
|
9
|
+
export declare const textImageComment12: Amity.Comment;
|
|
10
|
+
export declare const textCommentPayload: Amity.CommentPayload;
|
|
11
|
+
export declare const comment12Payload: Amity.CommentPayload;
|
|
12
|
+
export declare const imageCommentPayload: Amity.CommentPayload;
|
|
13
|
+
export declare const textImageCommentPayload: Amity.CommentPayload;
|
|
14
|
+
export declare const textCommentMentionPayload: Amity.CommentPayload;
|
|
15
|
+
export declare const postPayload: Amity.ProcessedPostPayload;
|
|
16
|
+
export declare const textAndImageCommentMixedPayload: Amity.CommentPayload;
|
|
17
|
+
export declare const deletedCommentPayload: Amity.CommentPayload;
|
|
18
|
+
export declare const textCommentResponse: {
|
|
19
|
+
data: {
|
|
20
|
+
files: never[];
|
|
21
|
+
commentChildren: never[];
|
|
22
|
+
paging: {};
|
|
23
|
+
comments: Amity.Comment<any>[];
|
|
24
|
+
users: Amity.User[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const imageCommentResponse: {
|
|
28
|
+
data: {
|
|
29
|
+
files: never[];
|
|
30
|
+
commentChildren: never[];
|
|
31
|
+
paging: {};
|
|
32
|
+
comments: Amity.Comment<any>[];
|
|
33
|
+
users: Amity.User[];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export declare const textImageCommentResponse: {
|
|
37
|
+
data: {
|
|
38
|
+
files: never[];
|
|
39
|
+
commentChildren: never[];
|
|
40
|
+
paging: {};
|
|
41
|
+
comments: Amity.Comment<any>[];
|
|
42
|
+
users: Amity.User[];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export declare const textMentionCommentResponse: {
|
|
46
|
+
data: {
|
|
47
|
+
files: never[];
|
|
48
|
+
commentChildren: never[];
|
|
49
|
+
paging: {};
|
|
50
|
+
comments: Amity.Comment<any>[];
|
|
51
|
+
users: Amity.User[];
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export declare const textCommentParentIdResponse: {
|
|
55
|
+
data: {
|
|
56
|
+
files: never[];
|
|
57
|
+
commentChildren: never[];
|
|
58
|
+
paging: {};
|
|
59
|
+
comments: Amity.Comment<any>[];
|
|
60
|
+
users: Amity.User[];
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export declare const deletedCommentResponse: {
|
|
64
|
+
data: {
|
|
65
|
+
files: never[];
|
|
66
|
+
commentChildren: never[];
|
|
67
|
+
paging: {};
|
|
68
|
+
comments: Amity.Comment<any>[];
|
|
69
|
+
users: Amity.User[];
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export declare const textCommentRequestPayload: Parameters<typeof createComment>[0];
|
|
73
|
+
export declare const textCommentParentIdRequestPayload: Parameters<typeof createComment>[0];
|
|
74
|
+
export declare const imageCommentRequestPayload: Parameters<typeof createComment>[0];
|
|
75
|
+
export declare const textImageCommentRequestPayload: Parameters<typeof createComment>[0];
|
|
76
|
+
export declare const textCommentWithMentionRequestPayload: Parameters<typeof createComment>[0];
|
|
77
|
+
//# sourceMappingURL=comment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../../../src/utils/tests/dummy/comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,MAAM,eAAe,CAAC;AAK7D,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,OAAO,CA4B9E;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,OAA2B,CAAC;AAE1D,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,OASjC,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,OASrC,CAAC;AAEH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,OAOvC,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,OAG5B,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,OAGjC,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,OAGrC,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,cAKtC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,cAKpC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,cAKvC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,cAK3C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,cAK7C,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,oBAU/B,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,KAAK,CAAC,cAKnD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,cAkBzC,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;;;;;;CAO/B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;CAOhC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;CAOpC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;CAOtC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;CAOvC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;CAOlC,CAAC;AAGF,eAAO,MAAM,yBAAyB,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAMzE,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAOjF,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAS1E,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAY9E,CAAC;AAEF,eAAO,MAAM,oCAAoC,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAYpF,CAAC"}
|
|
@@ -56,7 +56,7 @@ export declare const communityUserModel: {
|
|
|
56
56
|
lastActivity: string;
|
|
57
57
|
userId: string;
|
|
58
58
|
communityId: string;
|
|
59
|
-
communityMembership: "
|
|
59
|
+
communityMembership: "none" | "banned" | "member";
|
|
60
60
|
createdAt: string;
|
|
61
61
|
updatedAt?: string | undefined;
|
|
62
62
|
roles: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/tests/dummy/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,QAA2B,CAAC;AAC7C,eAAO,MAAM,mBAAmB;;;CAAiC,CAAC;AAElE,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AAEvB,cAAc,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/tests/dummy/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,QAA2B,CAAC;AAC7C,eAAO,MAAM,mBAAmB;;;CAAiC,CAAC;AAElE,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AAEvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAE1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAE3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAE7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAE3B,cAAc,UAAU,CAAC;AAEzB,cAAc,QAAQ,CAAC"}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
export declare function generatePost(params?: Partial<Amity.Post>): Amity.Post;
|
|
2
|
-
export declare function generateComment(params?: Partial<Amity.Comment>): Amity.Comment;
|
|
3
2
|
export declare const post11: Amity.Post;
|
|
4
3
|
export declare const post12: Amity.Post;
|
|
5
4
|
export declare const post13: Amity.Post;
|
|
6
5
|
export declare const post14: Amity.Post;
|
|
7
6
|
export declare const post15: Amity.Post;
|
|
8
7
|
export declare const post16: Amity.Post;
|
|
9
|
-
export declare const comment11: Amity.Comment;
|
|
10
|
-
export declare const imageComment11: Amity.Comment;
|
|
11
|
-
export declare const textImageComment11: Amity.Comment;
|
|
12
|
-
export declare const textMentionComment11: Amity.Comment;
|
|
13
|
-
export declare const textWithParentComment11: Amity.Comment;
|
|
14
8
|
export declare const posts: {
|
|
15
9
|
targetId: string;
|
|
16
10
|
targetType: Amity.PostTargetType;
|
|
@@ -18,12 +12,6 @@ export declare const posts: {
|
|
|
18
12
|
page2: string[];
|
|
19
13
|
page3: string[];
|
|
20
14
|
};
|
|
21
|
-
export declare const textCommentPayload: Amity.CommentPayload;
|
|
22
|
-
export declare const imageCommentPayload: Amity.CommentPayload;
|
|
23
|
-
export declare const textImageCommentPayload: Amity.CommentPayload;
|
|
24
|
-
export declare const textCommentMentionPayload: Amity.CommentPayload;
|
|
25
|
-
export declare const textCommentParentIdPayload: Amity.CommentPayload;
|
|
26
|
-
export declare const postPayload: Amity.ProcessedPostPayload;
|
|
27
15
|
export declare const emptyPostPayload: {
|
|
28
16
|
posts: never[];
|
|
29
17
|
postChildren: never[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../../../src/utils/tests/dummy/post.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAyBrE;AAED,
|
|
1
|
+
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../../../src/utils/tests/dummy/post.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAyBrE;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,IAAqB,CAAC;AAEjD,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,IAG1B,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,IAG1B,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,IAO1B,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,IAQ1B,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,IAI1B,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;CAMjB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;CAU5B,CAAC;AAIF,eAAO,MAAM,iBAAiB;;;;;CAS7B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;CASlC,CAAC"}
|
package/package.json
CHANGED
package/src/@types/core/model.ts
CHANGED
|
@@ -27,6 +27,7 @@ declare global {
|
|
|
27
27
|
stream: Amity.Stream;
|
|
28
28
|
|
|
29
29
|
follow: Amity.FollowStatus;
|
|
30
|
+
followInfo: Amity.FollowInfo;
|
|
30
31
|
followCount: Amity.FollowCount;
|
|
31
32
|
|
|
32
33
|
feed: Amity.Feed;
|
|
@@ -61,7 +62,8 @@ declare global {
|
|
|
61
62
|
stream: Pick<Amity.Stream, 'streamId'>;
|
|
62
63
|
|
|
63
64
|
follow: Pick<Amity.FollowStatus, 'from' | 'to'>;
|
|
64
|
-
|
|
65
|
+
followInfo: Pick<Amity.FollowInfo, 'userId' | 'status'>;
|
|
66
|
+
followCount: Pick<Amity.FollowInfo, 'userId' | 'followerCount'>;
|
|
65
67
|
|
|
66
68
|
feed: Pick<Amity.Feed, 'targetId' | 'feedId'>;
|
|
67
69
|
};
|
|
@@ -41,7 +41,7 @@ declare global {
|
|
|
41
41
|
sortBy?: 'lastCreated' | 'firstCreated' | 'lastUpdated' | 'firstUpdated';
|
|
42
42
|
parentId?: Amity.Comment['commentId'] | null;
|
|
43
43
|
hasFlag?: boolean;
|
|
44
|
-
|
|
44
|
+
includeDeleted?: boolean;
|
|
45
45
|
page?: Amity.Page;
|
|
46
46
|
dataTypes?: {
|
|
47
47
|
values: ('image' | 'text')[];
|
|
@@ -75,7 +75,7 @@ declare global {
|
|
|
75
75
|
displayName?: string;
|
|
76
76
|
membership?: 'all' | 'member' | 'notMember';
|
|
77
77
|
categoryId?: Amity.Category['categoryId'];
|
|
78
|
-
|
|
78
|
+
includeDeleted?: boolean;
|
|
79
79
|
tags?: Amity.Taggable['tags'];
|
|
80
80
|
sortBy?: 'displayName' | 'firstCreated' | 'lastCreated';
|
|
81
81
|
page?: Amity.Page;
|
|
@@ -54,7 +54,7 @@ declare global {
|
|
|
54
54
|
targetType: Amity.Post['targetType'];
|
|
55
55
|
sortBy?: 'lastCreated' | 'firstCreated' | 'lastUpdated' | 'firstUpdated';
|
|
56
56
|
dataTypes?: Exclude<Amity.PostContentType, 'text'>[];
|
|
57
|
-
|
|
57
|
+
includeDeleted?: boolean;
|
|
58
58
|
hasFlag?: boolean;
|
|
59
59
|
feedType?: 'reviewing' | 'published';
|
|
60
60
|
tags?: Amity.Taggable['tags'];
|
package/src/cache/utils/index.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// cache constants
|
|
2
|
+
import { MINUTE, SECOND } from '~/utils/constants';
|
|
3
|
+
|
|
2
4
|
export const CACHE_KEY_GET = 'get';
|
|
3
5
|
export const CACHE_KEY_QUERY = 'query';
|
|
4
6
|
export const CACHE_KEY_TOMBSTONE = 'dead';
|
|
5
7
|
export const CACHE_KEY_COLLECTION = 'collection';
|
|
6
8
|
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
+
export const CACHE_SHORTEN_LIFESPAN = 2 * SECOND;
|
|
10
|
+
export const CACHE_LIFESPAN = 1 * MINUTE; // 1 minute
|
|
11
|
+
export const CACHE_LIFESPAN_TOMBSTONE = 3 * MINUTE; // 3 minutes
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* Shallow-clones an object and sort its keys
|
|
@@ -29,13 +29,14 @@ export const queryCategories = async (
|
|
|
29
29
|
const client = getActiveClient();
|
|
30
30
|
client.log('category/queryCategories', query);
|
|
31
31
|
|
|
32
|
-
const { page = { limit: 10 }, ...params } = query ?? {};
|
|
32
|
+
const { page = { limit: 10 }, includeDeleted, ...params } = query ?? {};
|
|
33
33
|
|
|
34
34
|
const { data } = await client.http.get<Amity.CategoryPayload & Amity.Pagination>(
|
|
35
35
|
`/api/v3/community-categories`,
|
|
36
36
|
{
|
|
37
37
|
params: {
|
|
38
38
|
...params,
|
|
39
|
+
isDeleted: includeDeleted === false ? false : undefined,
|
|
39
40
|
options: {
|
|
40
41
|
token: toToken(page, 'skiplimit'),
|
|
41
42
|
},
|
|
@@ -63,7 +63,9 @@ export const liveCategories = (
|
|
|
63
63
|
.filter(Boolean)
|
|
64
64
|
.map(({ data }) => data) ?? [];
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
if (params.includeDeleted === false) {
|
|
67
|
+
categories = filterByPropEquality(categories, 'isDeleted', false);
|
|
68
|
+
}
|
|
67
69
|
|
|
68
70
|
switch (params.sortBy) {
|
|
69
71
|
case 'firstCreated':
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
categoryQueryResponsePage2,
|
|
9
9
|
category11,
|
|
10
10
|
category12,
|
|
11
|
-
category13,
|
|
12
11
|
} from '~/utils/tests';
|
|
13
12
|
import { sortByName } from '~/core/query';
|
|
14
13
|
|
|
@@ -84,8 +83,7 @@ describe('live Caategories', () => {
|
|
|
84
83
|
});
|
|
85
84
|
|
|
86
85
|
const filters: [string, Amity.CategoryLiveCollection, Amity.Category[]][] = [
|
|
87
|
-
['deleted', {
|
|
88
|
-
['not deleted', { isDeleted: false }, [category11, category12]],
|
|
86
|
+
['not deleted', { includeDeleted: false }, [category11, category12]],
|
|
89
87
|
];
|
|
90
88
|
|
|
91
89
|
test.each(filters)('it should filter by %s categories', async (filter, params, expected) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ASCApiError } from '~/core/errors';
|
|
1
2
|
import { getResolver } from '~/core/model';
|
|
2
3
|
import { pullFromCache, enableCache, disableCache } from '~/cache/api';
|
|
3
4
|
|
|
@@ -19,6 +20,7 @@ describe('addChannelMembers', () => {
|
|
|
19
20
|
const { channelId } = channelUserQueryResponse.data.channels[0];
|
|
20
21
|
const { userId } = rawChannelUser;
|
|
21
22
|
|
|
23
|
+
// integration_test_id: e5bc67d9-7fbe-42ac-8fac-8ee25a6d6da2
|
|
22
24
|
test('it should add channel members in channel', async () => {
|
|
23
25
|
client.http.post = jest.fn().mockResolvedValueOnce(channelUserQueryResponse);
|
|
24
26
|
|
|
@@ -27,6 +29,17 @@ describe('addChannelMembers', () => {
|
|
|
27
29
|
expect(recieved).toBe(true);
|
|
28
30
|
});
|
|
29
31
|
|
|
32
|
+
// integration_test_id: 14286d06-b4c0-4b1d-80b8-c709dd7eac6c
|
|
33
|
+
test('it should throw error with 400304 when adding a banned member', async () => {
|
|
34
|
+
client.http.post = jest
|
|
35
|
+
.fn()
|
|
36
|
+
.mockRejectedValueOnce(
|
|
37
|
+
new ASCApiError('banned', Amity.ServerError.CHANNEL_BAN, Amity.ErrorLevel.ERROR),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
await expect(addChannelMembers(channelId, [userId])).rejects.toThrow('400304');
|
|
41
|
+
});
|
|
42
|
+
|
|
30
43
|
test('it should update cache with channel members', async () => {
|
|
31
44
|
enableCache();
|
|
32
45
|
|
|
@@ -11,6 +11,7 @@ import { queryChannelMembers } from '../queryChannelMembers';
|
|
|
11
11
|
describe('queryChannelMembers', () => {
|
|
12
12
|
const { channelId } = channelUserQueryResponse.data.channels[0];
|
|
13
13
|
|
|
14
|
+
// integration_test_id: 1e5a4b11-a7f3-496e-a594-22b10ed28a20
|
|
14
15
|
test('it should return channel members', async () => {
|
|
15
16
|
const expected = channelUserQueryResponse.data.channelUsers;
|
|
16
17
|
client.http.get = jest.fn().mockResolvedValue(channelUserQueryResponse);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ASCApiError } from '~/core/errors';
|
|
1
2
|
import { getResolver } from '~/core/model';
|
|
2
3
|
import { pullFromCache, enableCache, disableCache } from '~/cache/api';
|
|
3
4
|
|
|
@@ -28,6 +29,7 @@ describe('removeChannelMembers', () => {
|
|
|
28
29
|
const { channelId } = channelUserQueryResponse.data.channels[0];
|
|
29
30
|
const { userId } = rawChannelUser;
|
|
30
31
|
|
|
32
|
+
// integration_test_id: fa47f7d9-2b60-4f4e-b65f-f3c3a7999a3f
|
|
31
33
|
test('it should remove channel members from channel', async () => {
|
|
32
34
|
client.http.delete = jest.fn().mockResolvedValueOnce(channelUserQueryResponse);
|
|
33
35
|
|
|
@@ -98,9 +100,14 @@ describe('removeChannelMembers', () => {
|
|
|
98
100
|
unsub();
|
|
99
101
|
});
|
|
100
102
|
|
|
103
|
+
// integration_test_id: a9d13eff-5e17-4fc5-b20e-43c568aa8c23
|
|
101
104
|
test('it should return an error', async () => {
|
|
102
|
-
client.http.delete = jest
|
|
105
|
+
client.http.delete = jest
|
|
106
|
+
.fn()
|
|
107
|
+
.mockRejectedValueOnce(
|
|
108
|
+
new ASCApiError('banned', Amity.ServerError.CHANNEL_BAN, Amity.ErrorLevel.ERROR),
|
|
109
|
+
);
|
|
103
110
|
|
|
104
|
-
await expect(removeChannelMembers('channelId', [])).rejects.toThrow('
|
|
111
|
+
await expect(removeChannelMembers('channelId', [])).rejects.toThrow('400304');
|
|
105
112
|
});
|
|
106
113
|
});
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { liveObject } from '~/utils/liveObject';
|
|
2
2
|
import { onMessageCreated } from '~/message/events';
|
|
3
3
|
import { getChannel } from '../api';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
onChannelDeleted,
|
|
6
|
+
onChannelJoined,
|
|
7
|
+
onChannelLeft,
|
|
8
|
+
onChannelMemberAdded,
|
|
9
|
+
onChannelMemberBanned,
|
|
10
|
+
onChannelMemberRemoved,
|
|
11
|
+
onChannelMemberUnbanned,
|
|
12
|
+
onChannelMuted,
|
|
13
|
+
onChannelUpdated,
|
|
14
|
+
} from '../events';
|
|
5
15
|
|
|
6
16
|
/**
|
|
7
17
|
* ```js
|
|
@@ -30,6 +40,11 @@ export const liveChannel = (
|
|
|
30
40
|
onChannelUpdated,
|
|
31
41
|
onChannelDeleted,
|
|
32
42
|
onChannelJoined,
|
|
43
|
+
onChannelLeft,
|
|
44
|
+
onChannelMemberAdded,
|
|
45
|
+
onChannelMemberRemoved,
|
|
46
|
+
onChannelMemberBanned,
|
|
47
|
+
onChannelMemberUnbanned,
|
|
33
48
|
onChannelMuted,
|
|
34
49
|
() => onMessageCreated(() => null), // watch unread count
|
|
35
50
|
]);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/* eslint-disable no-use-before-define */
|
|
2
2
|
import { getResolver } from '~/core/model';
|
|
3
|
-
import { pullFromCache, pushToCache } from '~/cache/api';
|
|
3
|
+
import { dropFromCache, pullFromCache, pushToCache } from '~/cache/api';
|
|
4
4
|
import { getActiveClient } from '~/client/api';
|
|
5
5
|
import {
|
|
6
6
|
createQuery,
|
|
7
|
-
runQuery,
|
|
8
|
-
queryOptions,
|
|
9
|
-
filterByPropEquality,
|
|
10
7
|
filterByChannelMembership,
|
|
11
|
-
|
|
8
|
+
filterByPropEquality,
|
|
9
|
+
queryOptions,
|
|
10
|
+
runQuery,
|
|
12
11
|
sortByDisplayName,
|
|
13
|
-
sortByLastActivity,
|
|
14
12
|
sortByFirstCreated,
|
|
13
|
+
sortByLastActivity,
|
|
14
|
+
sortByLastCreated,
|
|
15
15
|
} from '~/core/query';
|
|
16
16
|
import {
|
|
17
17
|
COLLECTION_DEFAULT_CACHING_POLICY,
|
|
@@ -19,15 +19,16 @@ import {
|
|
|
19
19
|
ENABLE_CACHE_MESSAGE,
|
|
20
20
|
} from '~/utils/constants';
|
|
21
21
|
import { onMessageCreated } from '~/message/events';
|
|
22
|
+
import { CACHE_SHORTEN_LIFESPAN } from '~/cache/utils';
|
|
22
23
|
import {
|
|
23
24
|
onChannelCreated,
|
|
24
25
|
onChannelDeleted,
|
|
25
|
-
onChannelUpdated,
|
|
26
|
-
onChannelMuted,
|
|
27
26
|
onChannelJoined,
|
|
28
27
|
onChannelLeft,
|
|
29
28
|
onChannelMemberAdded,
|
|
30
29
|
onChannelMemberRemoved,
|
|
30
|
+
onChannelMuted,
|
|
31
|
+
onChannelUpdated,
|
|
31
32
|
} from '../events';
|
|
32
33
|
import { queryChannels } from '../api';
|
|
33
34
|
|
|
@@ -175,7 +176,7 @@ export const liveChannels = (
|
|
|
175
176
|
|
|
176
177
|
responder(data);
|
|
177
178
|
},
|
|
178
|
-
queryOptions(policy),
|
|
179
|
+
queryOptions(policy, CACHE_SHORTEN_LIFESPAN),
|
|
179
180
|
);
|
|
180
181
|
};
|
|
181
182
|
|
|
@@ -196,5 +197,6 @@ export const liveChannels = (
|
|
|
196
197
|
return () => {
|
|
197
198
|
log(`liveChannels(tmpid: ${timestamp}) > dispose`);
|
|
198
199
|
disposers.forEach(fn => fn());
|
|
200
|
+
dropFromCache(cacheKey);
|
|
199
201
|
};
|
|
200
202
|
};
|
|
@@ -28,7 +28,7 @@ export const queryComments = async (
|
|
|
28
28
|
const client = getActiveClient();
|
|
29
29
|
client.log('comment/queryComments', query);
|
|
30
30
|
|
|
31
|
-
const { page = { limit: 10 }, ...params } = query;
|
|
31
|
+
const { page = { limit: 10 }, includeDeleted, ...params } = query;
|
|
32
32
|
|
|
33
33
|
const options = {
|
|
34
34
|
type: params.sortBy ? 'pagination' : undefined,
|
|
@@ -44,6 +44,7 @@ export const queryComments = async (
|
|
|
44
44
|
{
|
|
45
45
|
params: {
|
|
46
46
|
...params,
|
|
47
|
+
isDeleted: includeDeleted === false ? false : undefined,
|
|
47
48
|
// filterByParentId, API-FIX: backend does not support this boolean LOL. what the hell seriously.
|
|
48
49
|
options,
|
|
49
50
|
},
|