@amityco/ts-sdk-react-native 6.20.1 → 6.21.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/@types/core/events.d.ts +12 -7
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +3 -3
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +2 -2
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/channel.d.ts +3 -0
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/@types/domains/reaction.d.ts +8 -4
- package/dist/@types/domains/reaction.d.ts.map +1 -1
- package/dist/channelRepository/api/getChannel.d.ts +2 -2
- package/dist/channelRepository/api/getChannel.d.ts.map +1 -1
- package/dist/channelRepository/api/getChannelByIds.d.ts +2 -2
- package/dist/channelRepository/api/getChannelByIds.d.ts.map +1 -1
- package/dist/channelRepository/events/onChannelResolved.d.ts +12 -0
- package/dist/channelRepository/events/onChannelResolved.d.ts.map +1 -0
- package/dist/channelRepository/observers/getChannel.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannels/ChannelQueryStreamController.d.ts.map +1 -1
- package/dist/channelRepository/observers/observeChannel.d.ts +1 -1
- package/dist/channelRepository/observers/observeChannel.d.ts.map +1 -1
- package/dist/channelRepository/utils/getSubChannelsUnreadCount.d.ts.map +1 -1
- package/dist/channelRepository/utils/prepateUnreadCountInfo.d.ts.map +1 -1
- package/dist/channelRepository/utils/resolveChannels.d.ts +2 -0
- package/dist/channelRepository/utils/resolveChannels.d.ts.map +1 -0
- package/dist/client/api/login.d.ts.map +1 -1
- package/dist/client/utils/ObjectResolver/objectResolverEngine.d.ts.map +1 -1
- package/dist/client/utils/onOffline.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/index.cjs.js +199 -155
- package/dist/index.esm.js +199 -155
- package/dist/index.umd.js +2 -2
- package/dist/marker/events/onUserMessageFeedMarkerResolved.d.ts +12 -0
- package/dist/marker/events/onUserMessageFeedMarkerResolved.d.ts.map +1 -0
- package/dist/marker/utils/resolveUserMessageFeedMakers.d.ts +2 -0
- package/dist/marker/utils/resolveUserMessageFeedMakers.d.ts.map +1 -0
- package/dist/messageRepository/utils/prepareMessagePayload.d.ts +1 -1
- package/dist/messageRepository/utils/prepareMessagePayload.d.ts.map +1 -1
- package/dist/reactionRepository/api/addReaction.d.ts +2 -2
- package/dist/reactionRepository/api/addReaction.d.ts.map +1 -1
- package/dist/reactionRepository/api/queryReactor.d.ts +3 -3
- package/dist/reactionRepository/api/queryReactor.d.ts.map +1 -1
- package/dist/reactionRepository/api/removeReaction.d.ts +2 -2
- package/dist/reactionRepository/api/removeReaction.d.ts.map +1 -1
- package/dist/reactionRepository/events/onReactorAdded.d.ts +2 -2
- package/dist/reactionRepository/events/onReactorAdded.d.ts.map +1 -1
- package/dist/reactionRepository/events/onReactorRemoved.d.ts +2 -2
- package/dist/reactionRepository/events/onReactorRemoved.d.ts.map +1 -1
- package/dist/reactionRepository/observers/getReactions.d.ts +1 -1
- package/dist/reactionRepository/observers/getReactions.d.ts.map +1 -1
- package/dist/reactionRepository/utils/prepareMessagePayloadForCache.d.ts +1 -1
- package/dist/reactionRepository/utils/prepareMessagePayloadForCache.d.ts.map +1 -1
- package/dist/streamRepository/events/onStreamStopped.d.ts.map +1 -1
- package/dist/utils/linkedObject/index.d.ts +1 -0
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/reactorLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/reactorLinkedObject.d.ts.map +1 -0
- package/dist/utils/tests/dummy/reaction.d.ts +1 -1
- package/dist/utils/tests/dummy/reaction.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/events.ts +13 -7
- package/src/@types/core/model.ts +3 -3
- package/src/@types/core/payload.ts +2 -2
- package/src/@types/domains/channel.ts +3 -0
- package/src/@types/domains/reaction.ts +10 -4
- package/src/analytic/api/queryReachUser.ts +1 -1
- package/src/channelRepository/api/getChannel.ts +11 -7
- package/src/channelRepository/api/getChannelByIds.ts +13 -7
- package/src/channelRepository/events/onChannelResolved.ts +22 -0
- package/src/channelRepository/observers/getChannel.ts +2 -0
- package/src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts +14 -10
- package/src/channelRepository/observers/getChannels/ChannelQueryStreamController.ts +4 -5
- package/src/channelRepository/utils/getChannelIsMentioned.ts +2 -2
- package/src/channelRepository/utils/getSubChannelsUnreadCount.ts +3 -2
- package/src/channelRepository/utils/prepareChannelPayload.ts +2 -2
- package/src/channelRepository/utils/prepateUnreadCountInfo.ts +2 -1
- package/src/channelRepository/utils/resolveChannels.ts +8 -0
- package/src/client/api/login.ts +1 -3
- package/src/client/utils/ObjectResolver/objectResolverEngine.ts +5 -4
- package/src/client/utils/hasPermission/checkUserPermission.ts +1 -1
- package/src/client/utils/onOffline.ts +17 -0
- package/src/commentRepository/events/onCommentReactionAdded.ts +1 -1
- package/src/commentRepository/events/onCommentReactionRemoved.ts +1 -1
- package/src/commentRepository/observers/tests/getComment.test.ts +2 -2
- package/src/core/events.ts +4 -0
- package/src/core/model/idResolvers.ts +1 -1
- package/src/core/query/filtering.ts +1 -1
- package/src/marker/events/onUserMessageFeedMarkerResolved.ts +29 -0
- package/src/marker/utils/resolveUserMessageFeedMakers.ts +17 -0
- package/src/messageRepository/utils/prepareMessagePayload.ts +2 -2
- package/src/postRepository/observers/tests/getPost.test.ts +1 -1
- package/src/postRepository/observers/tests/getPosts.test.ts +1 -1
- package/src/reactionRepository/api/addReaction.ts +2 -2
- package/src/reactionRepository/api/queryReactor.ts +3 -3
- package/src/reactionRepository/api/removeReaction.ts +2 -2
- package/src/reactionRepository/events/onReactorAdded.ts +5 -5
- package/src/reactionRepository/events/onReactorRemoved.ts +5 -5
- package/src/reactionRepository/observers/getReactions.ts +18 -16
- package/src/reactionRepository/utils/prepareMessagePayloadForCache.ts +1 -1
- package/src/streamRepository/events/onStreamRecorded.ts +1 -1
- package/src/streamRepository/events/onStreamStarted.ts +1 -1
- package/src/streamRepository/events/onStreamStopped.ts +6 -1
- package/src/utils/linkedObject/index.ts +2 -0
- package/src/utils/linkedObject/reactorLinkedObject.ts +13 -0
- package/src/utils/tests/dummy/reaction.ts +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal used only
|
|
3
|
+
*
|
|
4
|
+
* Fired when an {@link Amity.userMessageFeedMarkers} has been resolved by Object Rsesolver
|
|
5
|
+
*
|
|
6
|
+
* @param callback The function to call when the event was fired
|
|
7
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
8
|
+
*
|
|
9
|
+
* @category MessageMarker Events
|
|
10
|
+
*/
|
|
11
|
+
export declare const onUserMessageFeedMarkerResolved: (callback: Amity.Listener<Amity.Events['local.userMessageFeedMarkers.resolved']>) => Amity.Unsubscriber;
|
|
12
|
+
//# sourceMappingURL=onUserMessageFeedMarkerResolved.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onUserMessageFeedMarkerResolved.d.ts","sourceRoot":"","sources":["../../../src/marker/events/onUserMessageFeedMarkerResolved.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,eAAO,MAAM,+BAA+B,aAChC,MAAM,QAAQ,CAAC,MAAM,MAAM,CAAC,uCAAuC,CAAC,CAAC,KAC9E,MAAM,YAaR,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveUserMessageFeedMakers.d.ts","sourceRoot":"","sources":["../../../src/marker/utils/resolveUserMessageFeedMakers.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,6BAA6B,eAC5B,MAAM,eAAe,CAAC,mBAAmB,CAAC,EAAE,kBAWzD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function convertFromRaw(message: Amity.RawMessage, reactors?: Amity.
|
|
1
|
+
export declare function convertFromRaw(message: Amity.RawMessage, reactors?: Amity.InternalReactor[], event?: keyof Amity.MqttMessageEvents): Amity.InternalMessage;
|
|
2
2
|
export declare const prepareMessagePayload: (payload: Amity.MessagePayload, event?: keyof Amity.MqttMessageEvents) => Promise<Amity.ProcessedMessagePayload>;
|
|
3
3
|
declare type RawQueryMessages = Omit<Amity.QueryMessages, 'page' | 'sortBy' | 'subChannelId' | 'tags' | 'includeDeleted' | 'aroundMessageId' | 'dataType' | 'includingTags' | 'excludingTags'> & {
|
|
4
4
|
includeTags?: Amity.QueryMessages['includingTags'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareMessagePayload.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/utils/prepareMessagePayload.ts"],"names":[],"mappings":"AAYA,wBAAgB,cAAc,CAC5B,OAAO,EAAE,KAAK,CAAC,UAAU,EACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"prepareMessagePayload.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/utils/prepareMessagePayload.ts"],"names":[],"mappings":"AAYA,wBAAgB,cAAc,CAC5B,OAAO,EAAE,KAAK,CAAC,UAAU,EACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,eAAe,EAAE,EAClC,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC,iBAAiB,GACpC,KAAK,CAAC,eAAe,CAkEvB;AAWD,eAAO,MAAM,qBAAqB,YACvB,MAAM,cAAc,UACrB,MAAM,MAAM,iBAAiB,KACpC,QAAQ,MAAM,uBAAuB,CA0CvC,CAAC;AAEF,aAAK,gBAAgB,GAAG,IAAI,CAC1B,KAAK,CAAC,aAAa,EAIjB,MAAM,GACN,QAAQ,GACR,cAAc,GACd,MAAM,GACN,gBAAgB,GAChB,iBAAiB,GACjB,UAAU,GACV,eAAe,GACf,eAAe,CAClB,GAAG;IACF,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACnD,SAAS,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACvC,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IACnD,QAAQ,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC;IACpC,OAAO,EAAE;QACP,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACvC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;KACrC,CAAC;CACH,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC5B,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,GAAG,IAAI,EACR,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAc9C;AAED,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,KAAK,EACL,IAAI,EACJ,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,sBAAsB,GAAG,gBAAgB,CA6BjD"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* @async
|
|
16
16
|
* */
|
|
17
17
|
export declare const addReaction: {
|
|
18
|
-
(referenceType: Amity.Reaction['referenceType'], referenceId: Amity.Reaction['referenceId'], reactionName: Amity.
|
|
18
|
+
(referenceType: Amity.Reaction['referenceType'], referenceId: Amity.Reaction['referenceId'], reactionName: Amity.InternalReactor['reactionName']): Promise<boolean>;
|
|
19
19
|
/**
|
|
20
20
|
* ```js
|
|
21
21
|
* import { addReaction } from '@amityco/ts-sdk-react-native'
|
|
@@ -31,6 +31,6 @@ export declare const addReaction: {
|
|
|
31
31
|
*
|
|
32
32
|
* @category Reaction API
|
|
33
33
|
* */
|
|
34
|
-
optimistically(referenceType: Amity.ReactableType, referenceId: Amity.Reaction['referenceId'], reactionName: Amity.
|
|
34
|
+
optimistically(referenceType: Amity.ReactableType, referenceId: Amity.Reaction['referenceId'], reactionName: Amity.InternalReactor['reactionName']): boolean | undefined;
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=addReaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addReaction.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/api/addReaction.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;KAeK;AACL,eAAO,MAAM,WAAW;oBACP,MAAM,QAAQ,CAAC,eAAe,CAAC,eACjC,MAAM,QAAQ,CAAC,aAAa,CAAC,gBAC5B,MAAM,
|
|
1
|
+
{"version":3,"file":"addReaction.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/api/addReaction.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;KAeK;AACL,eAAO,MAAM,WAAW;oBACP,MAAM,QAAQ,CAAC,eAAe,CAAC,eACjC,MAAM,QAAQ,CAAC,aAAa,CAAC,gBAC5B,MAAM,eAAe,CAAC,cAAc,CAAC,GAClD,QAAQ,OAAO,CAAC;IA8BnB;;;;;;;;;;;;;;SAcK;kCAEY,MAAM,aAAa,eACrB,MAAM,QAAQ,CAAC,aAAa,CAAC,gBAC5B,MAAM,eAAe,CAAC,cAAc,CAAC,GAClD,OAAO,GAAG,SAAS;CAtBrB,CAAC"}
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
* })
|
|
8
8
|
* ```
|
|
9
9
|
*
|
|
10
|
-
* Queries a paginable list of {@link Amity.
|
|
10
|
+
* Queries a paginable list of {@link Amity.InternalReactor} objects
|
|
11
11
|
*
|
|
12
12
|
* @param query The query parameters
|
|
13
|
-
* @returns A page of {@link Amity.
|
|
13
|
+
* @returns A page of {@link Amity.InternalReactor} objects
|
|
14
14
|
*
|
|
15
15
|
* @reaction Reaction API
|
|
16
16
|
* @async
|
|
17
17
|
* */
|
|
18
|
-
export declare const queryReactor: (query: Amity.QueryReactions) => Promise<Amity.Paged<Amity.
|
|
18
|
+
export declare const queryReactor: (query: Amity.QueryReactions) => Promise<Amity.Paged<Amity.InternalReactor, Amity.Page<string>>>;
|
|
19
19
|
//# sourceMappingURL=queryReactor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryReactor.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/api/queryReactor.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;KAgBK;AACL,eAAO,MAAM,YAAY,UAChB,MAAM,cAAc,KAC1B,QAAQ,MAAM,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"queryReactor.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/api/queryReactor.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;KAgBK;AACL,eAAO,MAAM,YAAY,UAChB,MAAM,cAAc,KAC1B,QAAQ,MAAM,KAAK,CAAC,MAAM,eAAe,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAOhE,CAAC"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* @async
|
|
16
16
|
* */
|
|
17
17
|
export declare const removeReaction: {
|
|
18
|
-
(referenceType: Amity.Reaction['referenceType'], referenceId: Amity.Reaction['referenceId'], reactionName: Amity.
|
|
18
|
+
(referenceType: Amity.Reaction['referenceType'], referenceId: Amity.Reaction['referenceId'], reactionName: Amity.InternalReactor['reactionName']): Promise<boolean>;
|
|
19
19
|
/**
|
|
20
20
|
* ```js
|
|
21
21
|
* import { removeReaction } from '@amityco/ts-sdk-react-native'
|
|
@@ -31,6 +31,6 @@ export declare const removeReaction: {
|
|
|
31
31
|
*
|
|
32
32
|
* @category Reaction API
|
|
33
33
|
* */
|
|
34
|
-
optimistically(referenceType: Amity.ReactableType, referenceId: Amity.Reaction['referenceId'], reactionName: Amity.
|
|
34
|
+
optimistically(referenceType: Amity.ReactableType, referenceId: Amity.Reaction['referenceId'], reactionName: Amity.InternalReactor['reactionName']): boolean | undefined;
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=removeReaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeReaction.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/api/removeReaction.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;KAeK;AACL,eAAO,MAAM,cAAc;oBACV,MAAM,QAAQ,CAAC,eAAe,CAAC,eACjC,MAAM,QAAQ,CAAC,aAAa,CAAC,gBAC5B,MAAM,
|
|
1
|
+
{"version":3,"file":"removeReaction.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/api/removeReaction.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;KAeK;AACL,eAAO,MAAM,cAAc;oBACV,MAAM,QAAQ,CAAC,eAAe,CAAC,eACjC,MAAM,QAAQ,CAAC,aAAa,CAAC,gBAC5B,MAAM,eAAe,CAAC,cAAc,CAAC,GAClD,QAAQ,OAAO,CAAC;IAgCnB;;;;;;;;;;;;;;SAcK;kCAEY,MAAM,aAAa,eACrB,MAAM,QAAQ,CAAC,aAAa,CAAC,gBAC5B,MAAM,eAAe,CAAC,cAAc,CAAC,GAClD,OAAO,GAAG,SAAS;CAtBrB,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* })
|
|
7
7
|
* ```
|
|
8
8
|
*
|
|
9
|
-
* Fired when an {@link Amity.
|
|
9
|
+
* Fired when an {@link Amity.InternalReactor} has been added
|
|
10
10
|
*
|
|
11
11
|
* @param {@link Amity.ReactableType} referenceType
|
|
12
12
|
* @param {string} referenceId
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @category Events
|
|
17
17
|
* */
|
|
18
|
-
export declare const onReactorAdded: (referenceType: Amity.ReactableType, referenceId: Amity.Reaction['referenceId'], callback: Amity.Listener<Amity.
|
|
18
|
+
export declare const onReactorAdded: (referenceType: Amity.ReactableType, referenceId: Amity.Reaction['referenceId'], callback: Amity.Listener<Amity.InternalReactor>) => Amity.Unsubscriber;
|
|
19
19
|
//# sourceMappingURL=onReactorAdded.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onReactorAdded.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/events/onReactorAdded.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;KAgBK;AACL,eAAO,MAAM,cAAc,kBACV,MAAM,aAAa,eACrB,MAAM,QAAQ,CAAC,aAAa,CAAC,YAChC,MAAM,QAAQ,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"onReactorAdded.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/events/onReactorAdded.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;KAgBK;AACL,eAAO,MAAM,cAAc,kBACV,MAAM,aAAa,eACrB,MAAM,QAAQ,CAAC,aAAa,CAAC,YAChC,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YA8DR,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* })
|
|
7
7
|
* ```
|
|
8
8
|
*
|
|
9
|
-
* Fired when an {@link Amity.
|
|
9
|
+
* Fired when an {@link Amity.InternalReactor} has been removed
|
|
10
10
|
*
|
|
11
11
|
* @param {@link Amity.ReactableType} referenceType
|
|
12
12
|
* @param {string} referenceId
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @category Events
|
|
17
17
|
* */
|
|
18
|
-
export declare const onReactorRemoved: (referenceType: Amity.ReactableType, referenceId: Amity.Reaction['referenceId'], callback: Amity.Listener<Amity.
|
|
18
|
+
export declare const onReactorRemoved: (referenceType: Amity.ReactableType, referenceId: Amity.Reaction['referenceId'], callback: Amity.Listener<Amity.InternalReactor>) => Amity.Unsubscriber;
|
|
19
19
|
//# sourceMappingURL=onReactorRemoved.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onReactorRemoved.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/events/onReactorRemoved.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;KAgBK;AACL,eAAO,MAAM,gBAAgB,kBACZ,MAAM,aAAa,eACrB,MAAM,QAAQ,CAAC,aAAa,CAAC,YAChC,MAAM,QAAQ,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"onReactorRemoved.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/events/onReactorRemoved.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;KAgBK;AACL,eAAO,MAAM,gBAAgB,kBACZ,MAAM,aAAa,eACrB,MAAM,QAAQ,CAAC,aAAa,CAAC,YAChC,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YAkER,CAAC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* }, response => merge(reactions, response.data))
|
|
10
10
|
* ```
|
|
11
11
|
*
|
|
12
|
-
* Observe all mutations on a list of {@link Amity.
|
|
12
|
+
* Observe all mutations on a list of {@link Amity.InternalReactor} for a given target object
|
|
13
13
|
*
|
|
14
14
|
* @param params for querying reactions
|
|
15
15
|
* @param callback the function to call when new data are available
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getReactions.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/observers/getReactions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getReactions.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/observers/getReactions.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,YAAY,WACf,MAAM,sBAAsB,YAC1B,MAAM,sBAAsB,CAAC,MAAM,OAAO,CAAC,WAC5C,MAAM,oBAAoB,KAClC,MAAM,YAsGR,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** @hidden */
|
|
2
|
-
export declare const prepareMessagePayloadForCache: (payload: Amity.InternalMessage, reactors: Amity.
|
|
2
|
+
export declare const prepareMessagePayloadForCache: (payload: Amity.InternalMessage, reactors: Amity.InternalReactor[], event: Pick<Amity.Events, 'message.reactionAdded' | 'message.reactionRemoved'> | string) => void;
|
|
3
3
|
//# sourceMappingURL=prepareMessagePayloadForCache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareMessagePayloadForCache.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/utils/prepareMessagePayloadForCache.ts"],"names":[],"mappings":"AAGA,cAAc;AAKd,eAAO,MAAM,6BAA6B,YAC/B,MAAM,eAAe,YACpB,MAAM,
|
|
1
|
+
{"version":3,"file":"prepareMessagePayloadForCache.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/utils/prepareMessagePayloadForCache.ts"],"names":[],"mappings":"AAGA,cAAc;AAKd,eAAO,MAAM,6BAA6B,YAC/B,MAAM,eAAe,YACpB,MAAM,eAAe,EAAE,SAC1B,KAAK,MAAM,MAAM,EAAE,uBAAuB,GAAG,yBAAyB,CAAC,GAAG,MAAM,SAgCxF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onStreamStopped.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/events/onStreamStopped.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,aAAc,MAAM,QAAQ,CAAC,MAAM,MAAM,CAAC,KAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"onStreamStopped.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/events/onStreamStopped.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,aAAc,MAAM,QAAQ,CAAC,MAAM,MAAM,CAAC,KAAG,MAAM,YAc9E,CAAC"}
|
|
@@ -6,5 +6,6 @@ export declare const LinkedObject: {
|
|
|
6
6
|
story: (story: Amity.InternalStory) => Amity.Story;
|
|
7
7
|
storyTarget: (storyTarget: Amity.RawStoryTarget) => Amity.StoryTarget;
|
|
8
8
|
message: (message: Amity.InternalMessage<any>) => Amity.Message<any>;
|
|
9
|
+
reactor: (reactor: Amity.InternalReactor) => Amity.Reactor;
|
|
9
10
|
};
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,YAAY;;;;;;;;;CASxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactorLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/reactorLinkedObject.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,YAAa,MAAM,eAAe,KAAG,MAAM,OAS1E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reaction.d.ts","sourceRoot":"","sources":["../../../../src/utils/tests/dummy/reaction.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"reaction.d.ts","sourceRoot":"","sources":["../../../../src/utils/tests/dummy/reaction.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,eAK7B,CAAC;AACF,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,QAI9B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,eAGnC,CAAC"}
|
package/package.json
CHANGED
|
@@ -26,9 +26,9 @@ declare global {
|
|
|
26
26
|
reconnect_error: Amity.ErrorResponse | undefined;
|
|
27
27
|
reconnect_failed: Amity.ErrorResponse | undefined;
|
|
28
28
|
|
|
29
|
-
'video-streaming.didRecord': Amity.StreamPayload;
|
|
30
|
-
'video-streaming.didStart': Amity.StreamPayload;
|
|
31
|
-
'video-streaming.didStop': Amity.StreamPayload;
|
|
29
|
+
'v3.video-streaming.didRecord': Amity.StreamPayload;
|
|
30
|
+
'v3.video-streaming.didStart': Amity.StreamPayload;
|
|
31
|
+
'v3.video-streaming.didStop': Amity.StreamPayload;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
type MqttEvents = {
|
|
@@ -111,8 +111,8 @@ declare global {
|
|
|
111
111
|
'post.declined': Amity.PostPayload;
|
|
112
112
|
'post.flagged': Amity.PostPayload;
|
|
113
113
|
'post.unflagged': Amity.PostPayload;
|
|
114
|
-
'post.addReaction': Amity.PostPayload & { reactor: Amity.
|
|
115
|
-
'post.removeReaction': Amity.PostPayload & { reactor: Amity.
|
|
114
|
+
'post.addReaction': Amity.PostPayload & { reactor: Amity.InternalReactor };
|
|
115
|
+
'post.removeReaction': Amity.PostPayload & { reactor: Amity.InternalReactor };
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
type MqttCommentEvents = {
|
|
@@ -121,8 +121,8 @@ declare global {
|
|
|
121
121
|
'comment.deleted': Amity.CommentPayload;
|
|
122
122
|
'comment.flagged': Amity.CommentPayload;
|
|
123
123
|
'comment.unflagged': Amity.CommentPayload;
|
|
124
|
-
'comment.addReaction': Amity.CommentPayload & { reactor: Amity.
|
|
125
|
-
'comment.removeReaction': Amity.CommentPayload & { reactor: Amity.
|
|
124
|
+
'comment.addReaction': Amity.CommentPayload & { reactor: Amity.InternalReactor };
|
|
125
|
+
'comment.removeReaction': Amity.CommentPayload & { reactor: Amity.InternalReactor };
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
type MqttUserEvents = {
|
|
@@ -188,6 +188,12 @@ declare global {
|
|
|
188
188
|
userMessageFeedMarker: Amity.UserMessageFeedMarkerPayload;
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
+
'local.channel.resolved': Amity.InternalChannel[];
|
|
192
|
+
'local.userMessageFeedMarkers.resolved': {
|
|
193
|
+
feedMarkers: Amity.FeedMarker[];
|
|
194
|
+
userFeedMarkers: Amity.UserFeedMarkerResponse[];
|
|
195
|
+
};
|
|
196
|
+
|
|
191
197
|
'local.story.created': Amity.StoryPayload;
|
|
192
198
|
'local.story.updated': Amity.StoryPayload;
|
|
193
199
|
'local.story.deleted': Amity.StoryPayload;
|
package/src/@types/core/model.ts
CHANGED
|
@@ -39,7 +39,7 @@ declare global {
|
|
|
39
39
|
commentChildren: Amity.InternalComment;
|
|
40
40
|
poll: Amity.Poll;
|
|
41
41
|
reaction: Amity.Reaction;
|
|
42
|
-
reactor: Amity.
|
|
42
|
+
reactor: Amity.InternalReactor;
|
|
43
43
|
|
|
44
44
|
stream: Amity.Stream;
|
|
45
45
|
|
|
@@ -66,7 +66,7 @@ declare global {
|
|
|
66
66
|
story: Pick<Amity.InternalStory, 'referenceId'>;
|
|
67
67
|
storyTarget: Pick<Amity.RawStoryTarget, 'targetId'>;
|
|
68
68
|
|
|
69
|
-
channel: Pick<Amity.Channel, '
|
|
69
|
+
channel: Pick<Amity.Channel, 'channelInternalId'>;
|
|
70
70
|
subChannel: Pick<Amity.SubChannel, 'subChannelId'>;
|
|
71
71
|
channelUsers: Pick<Amity.Membership<'channel'>, 'channelId' | 'userId'>;
|
|
72
72
|
message: Pick<Amity.InternalMessage, 'messageId'>;
|
|
@@ -91,7 +91,7 @@ declare global {
|
|
|
91
91
|
commentChildren: Pick<Amity.InternalComment, 'commentId'>;
|
|
92
92
|
poll: Pick<Amity.Poll, 'pollId'>;
|
|
93
93
|
reaction: Pick<Amity.Reaction, 'referenceType' | 'referenceId'>;
|
|
94
|
-
reactor: Pick<Amity.
|
|
94
|
+
reactor: Pick<Amity.InternalReactor, 'reactionId'>;
|
|
95
95
|
|
|
96
96
|
stream: Pick<Amity.Stream, 'streamId'>;
|
|
97
97
|
|
|
@@ -227,7 +227,7 @@ declare global {
|
|
|
227
227
|
messages: Amity.InternalMessage<T>[];
|
|
228
228
|
users: Amity.InternalUser[];
|
|
229
229
|
files: Amity.File[];
|
|
230
|
-
reactions: Amity.
|
|
230
|
+
reactions: Amity.InternalReactor[];
|
|
231
231
|
};
|
|
232
232
|
|
|
233
233
|
type MessagePayload<T extends Amity.MessageContentType = any> = Omit<
|
|
@@ -331,7 +331,7 @@ declare global {
|
|
|
331
331
|
|
|
332
332
|
// Payload with Reaction
|
|
333
333
|
type StoryReactionPayload = {
|
|
334
|
-
reactions: Amity.
|
|
334
|
+
reactions: Amity.InternalReactor[];
|
|
335
335
|
} & Amity.StoryPayload;
|
|
336
336
|
|
|
337
337
|
/**
|
|
@@ -16,6 +16,7 @@ declare global {
|
|
|
16
16
|
| 'onChannelMemberRoleRemoved';
|
|
17
17
|
|
|
18
18
|
const enum ChannelActionType {
|
|
19
|
+
OnResolve = 'onResolve',
|
|
19
20
|
OnFetch = 'onFetch',
|
|
20
21
|
OnCreate = 'onCreate',
|
|
21
22
|
OnUpdate = 'onUpdate',
|
|
@@ -31,6 +32,8 @@ declare global {
|
|
|
31
32
|
type RawChannel<T extends ChannelType = any> = {
|
|
32
33
|
_id: string;
|
|
33
34
|
channelId: string;
|
|
35
|
+
channelInternalId: string;
|
|
36
|
+
channelPublicId: string;
|
|
34
37
|
displayName?: string;
|
|
35
38
|
avatarFileId?: Amity.File<'image'>['fileId'];
|
|
36
39
|
type: T;
|
|
@@ -6,12 +6,18 @@ declare global {
|
|
|
6
6
|
|
|
7
7
|
type ReactionActionType = 'onAdded' | 'onRemoved';
|
|
8
8
|
|
|
9
|
-
type
|
|
9
|
+
type InternalReactor = {
|
|
10
10
|
reactionId: string;
|
|
11
11
|
reactionName: string;
|
|
12
12
|
userId: Amity.InternalUser['userId'];
|
|
13
13
|
} & Amity.Timestamps;
|
|
14
14
|
|
|
15
|
+
type ReactorLinkedObject = {
|
|
16
|
+
user?: Amity.User;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type Reactor = Amity.InternalReactor & Amity.ReactorLinkedObject;
|
|
20
|
+
|
|
15
21
|
type Reactable = {
|
|
16
22
|
reactionsCount: number;
|
|
17
23
|
reactions: Record<string, number>;
|
|
@@ -19,20 +25,20 @@ declare global {
|
|
|
19
25
|
};
|
|
20
26
|
|
|
21
27
|
type Reaction = {
|
|
22
|
-
reactors:
|
|
28
|
+
reactors: InternalReactor[];
|
|
23
29
|
} & Amity.Relationship<ReactableType>;
|
|
24
30
|
|
|
25
31
|
type QueryReactions = {
|
|
26
32
|
referenceId: Amity.Reaction['referenceId'];
|
|
27
33
|
referenceType: Amity.Reaction['referenceType'];
|
|
28
|
-
reactionName?: Amity.
|
|
34
|
+
reactionName?: Amity.InternalReactor['reactionName'];
|
|
29
35
|
page?: Amity.Page<string>;
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
type ReactionLiveCollection = Amity.LiveCollectionParams<Omit<QueryReactions, 'page'>>;
|
|
33
39
|
|
|
34
40
|
type ReactionLiveCollectionCache = Amity.LiveCollectionCache<
|
|
35
|
-
Amity.
|
|
41
|
+
Amity.InternalReactor['reactionId'],
|
|
36
42
|
Pick<QueryReactions, 'page'>
|
|
37
43
|
>;
|
|
38
44
|
}
|
|
@@ -23,7 +23,7 @@ export const queryReachUser = async ({
|
|
|
23
23
|
params.limit = limit;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const view = viewedType === 'post' ? 'posts' : 'stories'
|
|
26
|
+
const view = viewedType === 'post' ? 'posts' : 'stories';
|
|
27
27
|
const url = `/api/v1/analytics/views/${view}/${viewId}/users`;
|
|
28
28
|
|
|
29
29
|
const response = await client.http.get(url, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getActiveClient } from '~/client/api';
|
|
2
2
|
|
|
3
|
-
import { pullFromCache } from '~/cache/api';
|
|
3
|
+
import { pullFromCache, queryCache } from '~/cache/api';
|
|
4
4
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
5
5
|
|
|
6
6
|
import { isInTombstone } from '~/cache/api/isInTombstone';
|
|
@@ -25,7 +25,7 @@ import { prepareUnreadCountInfo } from '../utils/prepateUnreadCountInfo';
|
|
|
25
25
|
* @async
|
|
26
26
|
*/
|
|
27
27
|
export const getChannel = async (
|
|
28
|
-
channelId: Amity.Channel['
|
|
28
|
+
channelId: Amity.Channel['channelPublicId'],
|
|
29
29
|
): Promise<Amity.Cached<Amity.InternalChannel>> => {
|
|
30
30
|
const client = getActiveClient();
|
|
31
31
|
client.log('channel/getChannel', channelId);
|
|
@@ -46,6 +46,7 @@ export const getChannel = async (
|
|
|
46
46
|
}
|
|
47
47
|
} catch (error) {
|
|
48
48
|
if (checkIfShouldGoesToTombstone((error as Amity.ErrorResponse)?.code)) {
|
|
49
|
+
// NOTE: use channelPublicId as tombstone cache key since we cannot get the channelPrivateId that come along with channel data from server
|
|
49
50
|
pushToTombstone('channel', channelId);
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -77,19 +78,22 @@ export const getChannel = async (
|
|
|
77
78
|
* @category Channel API
|
|
78
79
|
*/
|
|
79
80
|
getChannel.locally = (
|
|
80
|
-
channelId: Amity.Channel['
|
|
81
|
+
channelId: Amity.Channel['channelPublicId'],
|
|
81
82
|
): Amity.Cached<Amity.Channel> | undefined => {
|
|
82
83
|
const client = getActiveClient();
|
|
83
84
|
client.log('channel/getChannel.locally', channelId);
|
|
84
85
|
|
|
85
86
|
if (!client.cache) return;
|
|
86
87
|
|
|
87
|
-
|
|
88
|
+
// use queryCache to get all channel caches and filter by channelPublicId since we use channelPrivateId as cache key
|
|
89
|
+
const cached = queryCache<Amity.InternalChannel>(['channel', 'get'])?.filter(({ data }) => {
|
|
90
|
+
return data.channelPublicId === channelId;
|
|
91
|
+
});
|
|
88
92
|
|
|
89
|
-
if (!cached) return;
|
|
93
|
+
if (!cached || cached?.length === 0) return;
|
|
90
94
|
|
|
91
95
|
return {
|
|
92
|
-
data: cached.data,
|
|
93
|
-
cachedAt: cached.cachedAt,
|
|
96
|
+
data: cached[0].data,
|
|
97
|
+
cachedAt: cached[0].cachedAt,
|
|
94
98
|
};
|
|
95
99
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { queryCache } from '~/cache/api';
|
|
4
4
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
5
5
|
|
|
6
6
|
import { checkIfShouldGoesToTombstone } from '~/cache/utils';
|
|
7
7
|
import { pushToTombstone } from '~/cache/api/pushToTombstone';
|
|
8
8
|
import { prepareChannelPayload } from '../utils';
|
|
9
9
|
import { fireEvent } from '~/core/events';
|
|
10
|
+
import { prepareUnreadCountInfo } from '../utils/prepateUnreadCountInfo';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* ```js
|
|
@@ -23,7 +24,7 @@ import { fireEvent } from '~/core/events';
|
|
|
23
24
|
* @async
|
|
24
25
|
*/
|
|
25
26
|
export const getChannelByIds = async (
|
|
26
|
-
channelIds: Amity.Channel['
|
|
27
|
+
channelIds: Amity.Channel['channelPublicId'][],
|
|
27
28
|
): Promise<Amity.Cached<Amity.InternalChannel[]>> => {
|
|
28
29
|
const client = getActiveClient();
|
|
29
30
|
client.log('channel/getChannelByIds', channelIds);
|
|
@@ -42,6 +43,7 @@ export const getChannelByIds = async (
|
|
|
42
43
|
} catch (error) {
|
|
43
44
|
channelIds.forEach(channelId => {
|
|
44
45
|
if (checkIfShouldGoesToTombstone((error as Amity.ErrorResponse)?.code)) {
|
|
46
|
+
// NOTE: use channelPublicId as tombstone cache key since we cannot get the channelPrivateId that come along with channel data from server
|
|
45
47
|
pushToTombstone('channel', channelId);
|
|
46
48
|
}
|
|
47
49
|
});
|
|
@@ -51,6 +53,10 @@ export const getChannelByIds = async (
|
|
|
51
53
|
|
|
52
54
|
const data = await prepareChannelPayload(payload);
|
|
53
55
|
|
|
56
|
+
if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode()) {
|
|
57
|
+
await prepareUnreadCountInfo(payload);
|
|
58
|
+
}
|
|
59
|
+
|
|
54
60
|
const cachedAt = client.cache && Date.now();
|
|
55
61
|
if (client.cache) ingestInCache(data, { cachedAt });
|
|
56
62
|
|
|
@@ -76,18 +82,18 @@ export const getChannelByIds = async (
|
|
|
76
82
|
* @category Channel API
|
|
77
83
|
*/
|
|
78
84
|
getChannelByIds.locally = (
|
|
79
|
-
channelIds: Amity.Channel['
|
|
85
|
+
channelIds: Amity.Channel['channelPublicId'][],
|
|
80
86
|
): Amity.Cached<Amity.Channel[]> | undefined => {
|
|
81
87
|
const client = getActiveClient();
|
|
82
88
|
client.log('channel/getChannelByIds.locally', channelIds);
|
|
83
89
|
|
|
84
90
|
if (!client.cache) return;
|
|
85
91
|
|
|
86
|
-
const cached =
|
|
87
|
-
.
|
|
88
|
-
|
|
92
|
+
const cached = queryCache<Amity.InternalChannel>(['channel', 'get'])?.filter(({ data }) => {
|
|
93
|
+
return channelIds.includes(data.channelPublicId);
|
|
94
|
+
});
|
|
89
95
|
|
|
90
|
-
if (cached?.length < channelIds.length) return;
|
|
96
|
+
if (!cached || cached?.length < channelIds.length) return;
|
|
91
97
|
|
|
92
98
|
const channels = cached.map(({ data }) => data);
|
|
93
99
|
const oldest = cached.sort((a, b) => (a.cachedAt! < b.cachedAt! ? -1 : 1))?.[0];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { createEventSubscriber } from '~/core/events';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Internal used only
|
|
6
|
+
*
|
|
7
|
+
* Fired when any {@link Amity.Channel} have been resolved by Object resolver
|
|
8
|
+
*
|
|
9
|
+
* @param callback The function to call when the event was fired
|
|
10
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
11
|
+
*
|
|
12
|
+
* @category Channel Events
|
|
13
|
+
*/
|
|
14
|
+
export const onChannelResolved = (callback: Amity.Listener<Amity.InternalChannel[]>) => {
|
|
15
|
+
const client = getActiveClient();
|
|
16
|
+
|
|
17
|
+
const filter = async (payload: Amity.InternalChannel[]) => {
|
|
18
|
+
callback(payload);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return createEventSubscriber(client, 'onChannelResolved', 'local.channel.resolved', filter);
|
|
22
|
+
};
|
|
@@ -115,6 +115,7 @@ export const getChannel = (
|
|
|
115
115
|
|
|
116
116
|
if (message.channelId !== channelId) return;
|
|
117
117
|
|
|
118
|
+
// channelId from message is channelInternalId
|
|
118
119
|
const channel = pullFromCache<Amity.Channel>(['channel', 'get', channelId])?.data;
|
|
119
120
|
if (!channel) return;
|
|
120
121
|
|
|
@@ -140,6 +141,7 @@ export const getChannel = (
|
|
|
140
141
|
|
|
141
142
|
if (message.channelId !== channelId) return;
|
|
142
143
|
|
|
144
|
+
// channelId from message is channelInternalId
|
|
143
145
|
const channel = pullFromCache<Amity.Channel>(['channel', 'get', channelId])?.data;
|
|
144
146
|
if (!channel) return;
|
|
145
147
|
|
|
@@ -52,8 +52,9 @@ import { onSubChannelCreated } from '~/subChannelRepository';
|
|
|
52
52
|
|
|
53
53
|
import ObjectResolverEngine from '~/client/utils/ObjectResolver/objectResolverEngine';
|
|
54
54
|
import { prepareUnreadCountInfo } from '~/channelRepository/utils/prepateUnreadCountInfo';
|
|
55
|
-
import { onUserFeedMarkerFetched } from '~/marker/events/onUserFeedMarkerFetched';
|
|
56
55
|
import { resolveUnreadInfoOnChannelEvent } from '~/channelRepository/utils/resolveUnreadInfoOnChannelEvent';
|
|
56
|
+
import { onChannelResolved } from '~/channelRepository/events/onChannelResolved';
|
|
57
|
+
import { onUserMessageFeedMarkerResolved } from '~/marker/events/onUserMessageFeedMarkerResolved';
|
|
57
58
|
|
|
58
59
|
export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
59
60
|
'channel',
|
|
@@ -241,7 +242,6 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
241
242
|
private getSubscriptions() {
|
|
242
243
|
const subscriptions = [
|
|
243
244
|
{
|
|
244
|
-
// TODO: merge this code to another onMessageCreated in this file
|
|
245
245
|
fn: convertEventPayload(
|
|
246
246
|
(callback: Amity.Listener<Amity.InternalMessage>) => {
|
|
247
247
|
return onMessageCreatedMqtt(message => {
|
|
@@ -253,7 +253,7 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
253
253
|
|
|
254
254
|
if (!cacheData) {
|
|
255
255
|
const objectResolverEngine = ObjectResolverEngine.getInstance();
|
|
256
|
-
|
|
256
|
+
// channelId from message event payload is channelInternalId
|
|
257
257
|
objectResolverEngine.resolve(message.channelId, Amity.ReferenceType.CHANNEL);
|
|
258
258
|
} else {
|
|
259
259
|
updateChannelCache(cacheData, {
|
|
@@ -270,7 +270,6 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
270
270
|
action: Amity.ChannelActionType.OnUpdate,
|
|
271
271
|
},
|
|
272
272
|
{
|
|
273
|
-
// TODO: merge this code to another onMessageCreated in this file
|
|
274
273
|
fn: convertEventPayload(
|
|
275
274
|
(callback: Amity.Listener<Amity.InternalMessage>) => {
|
|
276
275
|
return onMessageCreatedLocal(message => {
|
|
@@ -525,14 +524,19 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
525
524
|
action: Amity.ChannelActionType.OnUpdate,
|
|
526
525
|
},
|
|
527
526
|
{
|
|
528
|
-
fn:
|
|
529
|
-
action: Amity.ChannelActionType.
|
|
527
|
+
fn: onChannelResolved,
|
|
528
|
+
action: Amity.ChannelActionType.OnResolve,
|
|
530
529
|
},
|
|
531
530
|
{
|
|
532
531
|
fn: (callback: Amity.Listener<Amity.InternalChannel[]>) => {
|
|
533
|
-
const
|
|
532
|
+
const handleUserFeedMarkerResolved = async (
|
|
533
|
+
marker: Amity.UserMessageFeedMarkerPayload,
|
|
534
|
+
) => {
|
|
534
535
|
if (marker.feedMarkers) {
|
|
535
|
-
const channelIds =
|
|
536
|
+
const channelIds = [
|
|
537
|
+
...new Set(marker.feedMarkers.map(feedMarker => feedMarker.entityId)),
|
|
538
|
+
];
|
|
539
|
+
|
|
536
540
|
const channels = channelIds
|
|
537
541
|
.map(
|
|
538
542
|
channelId =>
|
|
@@ -543,9 +547,9 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
543
547
|
callback(channels);
|
|
544
548
|
}
|
|
545
549
|
};
|
|
546
|
-
return
|
|
550
|
+
return onUserMessageFeedMarkerResolved(handleUserFeedMarkerResolved);
|
|
547
551
|
},
|
|
548
|
-
action: Amity.ChannelActionType.
|
|
552
|
+
action: Amity.ChannelActionType.OnResolve,
|
|
549
553
|
},
|
|
550
554
|
];
|
|
551
555
|
|