@amityco/ts-sdk-react-native 6.9.1-e6a3d26.0 → 6.10.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 (47) hide show
  1. package/dist/channelRepsitory/observers/getChannels.d.ts.map +1 -1
  2. package/dist/client/api/logout.d.ts.map +1 -1
  3. package/dist/commentRepository/events/onCommentCreated.d.ts +3 -3
  4. package/dist/commentRepository/events/onCommentCreated.d.ts.map +1 -1
  5. package/dist/commentRepository/events/onCommentDeleted.d.ts +3 -3
  6. package/dist/commentRepository/events/onCommentDeleted.d.ts.map +1 -1
  7. package/dist/commentRepository/events/onCommentFlagged.d.ts +3 -3
  8. package/dist/commentRepository/events/onCommentFlagged.d.ts.map +1 -1
  9. package/dist/commentRepository/events/onCommentReactionAdded.d.ts +3 -3
  10. package/dist/commentRepository/events/onCommentReactionAdded.d.ts.map +1 -1
  11. package/dist/commentRepository/events/onCommentReactionRemoved.d.ts +3 -3
  12. package/dist/commentRepository/events/onCommentReactionRemoved.d.ts.map +1 -1
  13. package/dist/commentRepository/events/onCommentUnflagged.d.ts +3 -3
  14. package/dist/commentRepository/events/onCommentUnflagged.d.ts.map +1 -1
  15. package/dist/commentRepository/events/onCommentUpdated.d.ts +3 -3
  16. package/dist/commentRepository/events/onCommentUpdated.d.ts.map +1 -1
  17. package/dist/commentRepository/events/utils.d.ts +1 -1
  18. package/dist/commentRepository/events/utils.d.ts.map +1 -1
  19. package/dist/commentRepository/observers/getComment.d.ts +2 -2
  20. package/dist/commentRepository/observers/getComment.d.ts.map +1 -1
  21. package/dist/commentRepository/observers/getComments.d.ts.map +1 -1
  22. package/dist/core/device.d.ts.map +1 -1
  23. package/dist/core/events.d.ts.map +1 -1
  24. package/dist/core/query/filtering.d.ts.map +1 -1
  25. package/dist/index.cjs.js +113 -86
  26. package/dist/index.esm.js +113 -86
  27. package/dist/index.umd.js +2 -2
  28. package/dist/utils/tests/dummy/comment.d.ts +40 -1
  29. package/dist/utils/tests/dummy/comment.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/src/channelRepsitory/observers/getChannels.ts +17 -2
  32. package/src/client/api/logout.ts +7 -5
  33. package/src/commentRepository/events/onCommentCreated.ts +4 -5
  34. package/src/commentRepository/events/onCommentDeleted.ts +4 -5
  35. package/src/commentRepository/events/onCommentFlagged.ts +4 -5
  36. package/src/commentRepository/events/onCommentReactionAdded.ts +6 -5
  37. package/src/commentRepository/events/onCommentReactionRemoved.ts +6 -5
  38. package/src/commentRepository/events/onCommentUnflagged.ts +4 -5
  39. package/src/commentRepository/events/onCommentUpdated.ts +4 -5
  40. package/src/commentRepository/events/utils.ts +4 -3
  41. package/src/commentRepository/observers/getComment.ts +2 -2
  42. package/src/commentRepository/observers/getComments.ts +5 -1
  43. package/src/commentRepository/observers/tests/getComment.test.ts +18 -14
  44. package/src/core/device.ts +2 -1
  45. package/src/core/events.ts +6 -1
  46. package/src/core/query/filtering.ts +24 -17
  47. package/src/utils/tests/dummy/comment.ts +16 -9
@@ -1 +1 @@
1
- {"version":3,"file":"getChannels.d.ts","sourceRoot":"","sources":["../../../src/channelRepsitory/observers/getChannels.ts"],"names":[],"mappings":"AAuCA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,WAAW,WACd,MAAM,qBAAqB,YACzB,MAAM,sBAAsB,CAAC,MAAM,OAAO,CAAC,WAC5C,MAAM,oBAAoB,eAkJpC,CAAC"}
1
+ {"version":3,"file":"getChannels.d.ts","sourceRoot":"","sources":["../../../src/channelRepsitory/observers/getChannels.ts"],"names":[],"mappings":"AAwCA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,WAAW,WACd,MAAM,qBAAqB,YACzB,MAAM,sBAAsB,CAAC,MAAM,OAAO,CAAC,WAC5C,MAAM,oBAAoB,eAgKpC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/client/api/logout.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,MAAM,QAAa,QAAQ,OAAO,CA6C9C,CAAC"}
1
+ {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/client/api/logout.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,MAAM,QAAa,QAAQ,OAAO,CA+C9C,CAAC"}
@@ -6,12 +6,12 @@
6
6
  * })
7
7
  * ```
8
8
  *
9
- * Fired when a {@link Amity.InternalComment} has been created
9
+ * Fired when a {@link Amity.Comment} has been created
10
10
  *
11
11
  * @param callback The function to call when the event was fired
12
12
  * @returns an {@link Amity.Unsubscriber} function to stop listening
13
13
  *
14
- * @category InternalComment Events
14
+ * @category Comment Events
15
15
  */
16
- export declare const onCommentCreated: (callback: Amity.Listener<Amity.InternalComment>) => Amity.Unsubscriber;
16
+ export declare const onCommentCreated: (callback: Amity.Listener<Amity.Comment>) => Amity.Unsubscriber;
17
17
  //# sourceMappingURL=onCommentCreated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"onCommentCreated.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentCreated.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,aACjB,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YAAyE,CAAC"}
1
+ {"version":3,"file":"onCommentCreated.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentCreated.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,aAAc,MAAM,QAAQ,CAAC,aAAa,CAAC,KAAG,MAAM,YACtB,CAAC"}
@@ -6,12 +6,12 @@
6
6
  * })
7
7
  * ```
8
8
  *
9
- * Fired when a {@link Amity.InternalComment} has been deleted
9
+ * Fired when a {@link Amity.Comment} has been deleted
10
10
  *
11
11
  * @param callback The function to call when the event was fired
12
12
  * @returns an {@link Amity.Unsubscriber} function to stop listening
13
13
  *
14
- * @category InternalComment Events
14
+ * @category Comment Events
15
15
  */
16
- export declare const onCommentDeleted: (callback: Amity.Listener<Amity.InternalComment>) => Amity.Unsubscriber;
16
+ export declare const onCommentDeleted: (callback: Amity.Listener<Amity.Comment>) => Amity.Unsubscriber;
17
17
  //# sourceMappingURL=onCommentDeleted.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"onCommentDeleted.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentDeleted.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,aACjB,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YAAyE,CAAC"}
1
+ {"version":3,"file":"onCommentDeleted.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentDeleted.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,aAAc,MAAM,QAAQ,CAAC,aAAa,CAAC,KAAG,MAAM,YACtB,CAAC"}
@@ -6,12 +6,12 @@
6
6
  * })
7
7
  * ```
8
8
  *
9
- * Fired when a {@link Amity.InternalComment} has been flagged
9
+ * Fired when a {@link Amity.Comment} has been flagged
10
10
  *
11
11
  * @param callback The function to call when the event was fired
12
12
  * @returns an {@link Amity.Unsubscriber} function to stop listening
13
13
  *
14
- * @category InternalComment Events
14
+ * @category Comment Events
15
15
  */
16
- export declare const onCommentFlagged: (callback: Amity.Listener<Amity.InternalComment>) => Amity.Unsubscriber;
16
+ export declare const onCommentFlagged: (callback: Amity.Listener<Amity.Comment>) => Amity.Unsubscriber;
17
17
  //# sourceMappingURL=onCommentFlagged.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"onCommentFlagged.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentFlagged.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,aACjB,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YAAyE,CAAC"}
1
+ {"version":3,"file":"onCommentFlagged.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentFlagged.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,aAAc,MAAM,QAAQ,CAAC,aAAa,CAAC,KAAG,MAAM,YACtB,CAAC"}
@@ -6,12 +6,12 @@
6
6
  * })
7
7
  * ```
8
8
  *
9
- * Fired when a {@link Amity.InternalComment} has been reacted
9
+ * Fired when a {@link Amity.Comment} has been reacted
10
10
  *
11
11
  * @param callback The function to call when the event was fired
12
12
  * @returns an {@link Amity.Unsubscriber} function to stop listening
13
13
  *
14
- * @category InternalComment Events
14
+ * @category Comment Events
15
15
  */
16
- export declare const onCommentReactionAdded: (callback: Amity.Listener<Amity.InternalComment>) => Amity.Unsubscriber;
16
+ export declare const onCommentReactionAdded: (callback: Amity.Listener<Amity.Comment>) => Amity.Unsubscriber;
17
17
  //# sourceMappingURL=onCommentReactionAdded.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"onCommentReactionAdded.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentReactionAdded.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,aACvB,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YAuBR,CAAC"}
1
+ {"version":3,"file":"onCommentReactionAdded.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentReactionAdded.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,aACvB,MAAM,QAAQ,CAAC,aAAa,CAAC,KACtC,MAAM,YAuBR,CAAC"}
@@ -6,12 +6,12 @@
6
6
  * })
7
7
  * ```
8
8
  *
9
- * Fired when a reaction has been removed from a {@link Amity.InternalComment}
9
+ * Fired when a reaction has been removed from a {@link Amity.Comment}
10
10
  *
11
11
  * @param callback The function to call when the event was fired
12
12
  * @returns an {@link Amity.Unsubscriber} function to stop listening
13
13
  *
14
- * @category InternalComment Events
14
+ * @category Comment Events
15
15
  */
16
- export declare const onCommentReactionRemoved: (callback: Amity.Listener<Amity.InternalComment>) => Amity.Unsubscriber;
16
+ export declare const onCommentReactionRemoved: (callback: Amity.Listener<Amity.Comment>) => Amity.Unsubscriber;
17
17
  //# sourceMappingURL=onCommentReactionRemoved.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"onCommentReactionRemoved.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentReactionRemoved.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,aACzB,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YAuBR,CAAC"}
1
+ {"version":3,"file":"onCommentReactionRemoved.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentReactionRemoved.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,aACzB,MAAM,QAAQ,CAAC,aAAa,CAAC,KACtC,MAAM,YAuBR,CAAC"}
@@ -6,12 +6,12 @@
6
6
  * })
7
7
  * ```
8
8
  *
9
- * Fired when a flag has been removed from a {@link Amity.InternalComment}
9
+ * Fired when a flag has been removed from a {@link Amity.Comment}
10
10
  *
11
11
  * @param callback The function to call when the event was fired
12
12
  * @returns an {@link Amity.Unsubscriber} function to stop listening
13
13
  *
14
- * @category InternalComment Events
14
+ * @category Comment Events
15
15
  */
16
- export declare const onCommentUnflagged: (callback: Amity.Listener<Amity.InternalComment>) => Amity.Unsubscriber;
16
+ export declare const onCommentUnflagged: (callback: Amity.Listener<Amity.Comment>) => Amity.Unsubscriber;
17
17
  //# sourceMappingURL=onCommentUnflagged.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"onCommentUnflagged.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentUnflagged.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,aACnB,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YAA2E,CAAC"}
1
+ {"version":3,"file":"onCommentUnflagged.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentUnflagged.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,aAAc,MAAM,QAAQ,CAAC,aAAa,CAAC,KAAG,MAAM,YACtB,CAAC"}
@@ -6,12 +6,12 @@
6
6
  * })
7
7
  * ```
8
8
  *
9
- * Fired when a {@link Amity.InternalComment} has been updated
9
+ * Fired when a {@link Amity.Comment} has been updated
10
10
  *
11
11
  * @param callback The function to call when the event was fired
12
12
  * @returns an {@link Amity.Unsubscriber} function to stop listening
13
13
  *
14
- * @category InternalComment Events
14
+ * @category Comment Events
15
15
  */
16
- export declare const onCommentUpdated: (callback: Amity.Listener<Amity.InternalComment>) => Amity.Unsubscriber;
16
+ export declare const onCommentUpdated: (callback: Amity.Listener<Amity.Comment>) => Amity.Unsubscriber;
17
17
  //# sourceMappingURL=onCommentUpdated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"onCommentUpdated.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentUpdated.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,aACjB,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,KAC9C,MAAM,YAAyE,CAAC"}
1
+ {"version":3,"file":"onCommentUpdated.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/onCommentUpdated.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,aAAc,MAAM,QAAQ,CAAC,aAAa,CAAC,KAAG,MAAM,YACtB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const createCommentEventSubscriber: (event: keyof Amity.MqttCommentEvents, callback: Amity.Listener<Amity.InternalComment>) => Amity.Unsubscriber;
1
+ export declare const createCommentEventSubscriber: (event: keyof Amity.MqttCommentEvents, callback: Amity.Listener<Amity.Comment>) => Amity.Unsubscriber;
2
2
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/utils.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,4BAA4B,UAChC,MAAM,MAAM,iBAAiB,YAC1B,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,uBA8BhD,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/utils.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,4BAA4B,UAChC,MAAM,MAAM,iBAAiB,YAC1B,MAAM,QAAQ,CAAC,aAAa,CAAC,uBA8BxC,CAAC"}
@@ -9,7 +9,7 @@
9
9
  * });
10
10
  * ```
11
11
  *
12
- * Observe all mutation on a given {@link Amity.InternalComment}
12
+ * Observe all mutation on a given {@link Amity.Comment}
13
13
  *
14
14
  * @param commentId the ID of the comment to observe
15
15
  * @param callback the function to call when new data are available
@@ -17,5 +17,5 @@
17
17
  *
18
18
  * @category InternalComment Live Object
19
19
  */
20
- export declare const getComment: (commentId: Amity.InternalComment['commentId'], callback: Amity.LiveObjectCallback<Amity.InternalComment>) => Amity.Unsubscriber;
20
+ export declare const getComment: (commentId: Amity.InternalComment['commentId'], callback: Amity.LiveObjectCallback<Amity.Comment>) => Amity.Unsubscriber;
21
21
  //# sourceMappingURL=getComment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getComment.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/observers/getComment.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU,cACV,MAAM,eAAe,CAAC,WAAW,CAAC,YACnC,MAAM,kBAAkB,CAAC,MAAM,eAAe,CAAC,KACxD,MAAM,YASR,CAAC"}
1
+ {"version":3,"file":"getComment.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/observers/getComment.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU,cACV,MAAM,eAAe,CAAC,WAAW,CAAC,YACnC,MAAM,kBAAkB,CAAC,aAAa,CAAC,KAChD,MAAM,YASR,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getComments.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/observers/getComments.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,WACd,MAAM,qBAAqB,YACzB,MAAM,sBAAsB,CAAC,MAAM,eAAe,CAAC,WACpD,MAAM,oBAAoB,KAClC,MAAM,YA2HR,CAAC"}
1
+ {"version":3,"file":"getComments.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/observers/getComments.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,WACd,MAAM,qBAAqB,YACzB,MAAM,sBAAsB,CAAC,MAAM,eAAe,CAAC,WACpD,MAAM,oBAAoB,KAClC,MAAM,YA+HR,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/core/device.ts"],"names":[],"mappings":"AAqDA,cAAc;AACd,eAAO,MAAM,WAAW,uBAavB,CAAC;AAEF,eAAO,MAAM,eAAe,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,oBAGjE,CAAC;AAEF,cAAc;AACd,eAAO,MAAM,cAAc,cAO1B,CAAC;AAEF,cAAc;AACd,eAAO,MAAM,aAAa,QAAO,MAAM,MAAM,CAAC,YAAY,CASzD,CAAC"}
1
+ {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/core/device.ts"],"names":[],"mappings":"AAsDA,cAAc;AACd,eAAO,MAAM,WAAW,uBAavB,CAAC;AAEF,eAAO,MAAM,eAAe,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,oBAGjE,CAAC;AAEF,cAAc;AACd,eAAO,MAAM,cAAc,cAO1B,CAAC;AAEF,cAAc;AACd,eAAO,MAAM,aAAa,QAAO,MAAM,MAAM,CAAC,YAAY,CASzD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/core/events.ts"],"names":[],"mappings":"AA+BA,cAAc;AACd,eAAO,MAAM,kBAAkB,4CAE9B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,OAAQ,MAAM,MAAM,CAAC,IAAI,CAAC,WAAW,MAAM,MAAM,CAAC,SAAS,CAAC,SAM5F,CAAC;AAEF,eAAO,MAAM,eAAe,eACd,MAAM,MAAM,CAAC,MAAM,CAAC,WACvB,MAAM,MAAM,CAAC,SAAS,CAAC,SAajC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,8pEACxB,MAAM,MAAM,aACT,MAAM,oDAGhB,MAAM,YAiBR,CAAC;AAEF,eAAO,MAAM,2BAA2B,8pEAC9B,MAAM,MAAM,aACT,MAAM,yBAEJ,OAAO,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,KAC5C,MAAM,YAQR,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,isEAKrB,CAAC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/core/events.ts"],"names":[],"mappings":"AA+BA,cAAc;AACd,eAAO,MAAM,kBAAkB,4CAE9B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,OAAQ,MAAM,MAAM,CAAC,IAAI,CAAC,WAAW,MAAM,MAAM,CAAC,SAAS,CAAC,SA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index.cjs.js CHANGED
@@ -114,8 +114,8 @@ const PostContentType = Object.freeze({
114
114
 
115
115
  function getVersion() {
116
116
  try {
117
- // the string ''v6.9.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
118
- return 'v6.9.0-cjs';
117
+ // the string ''v6.10.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
118
+ return 'v6.10.0-cjs';
119
119
  }
120
120
  catch (error) {
121
121
  return '__dev__';
@@ -1210,26 +1210,35 @@ const filterByCommunityMembership = (collection, membership, userId) => {
1210
1210
  * @hidden
1211
1211
  */
1212
1212
  const filterByPostDataTypes = (collection, dataTypes) => {
1213
- const filteredPosts = [];
1214
- collection.forEach(c => {
1213
+ const postIds = [];
1214
+ return collection.reduce((acc, post) => {
1215
1215
  var _a;
1216
- /*
1217
- * A text post with no children is just a text post
1218
- */
1219
- if (c.dataType === 'text' && !c.children.length)
1220
- return;
1221
- if (c.children.length) {
1222
- const childPost = (_a = pullFromCache(['post', 'get', c.children[0]])) === null || _a === void 0 ? void 0 : _a.data;
1223
- if (childPost && (dataTypes === null || dataTypes === void 0 ? void 0 : dataTypes.includes(childPost === null || childPost === void 0 ? void 0 : childPost.dataType))) {
1224
- // @ts-ignore
1225
- filteredPosts.push(childPost);
1226
- }
1227
- return;
1216
+ // A text post with no children is just a text post
1217
+ if (post.dataType === 'text' && !post.children.length)
1218
+ return acc;
1219
+ // Skip if post is already in the collection
1220
+ if (postIds.includes(post.postId))
1221
+ return acc;
1222
+ // Check dataType for current post
1223
+ if (dataTypes === null || dataTypes === void 0 ? void 0 : dataTypes.includes(post.dataType)) {
1224
+ acc.push(post);
1228
1225
  }
1229
- if (dataTypes === null || dataTypes === void 0 ? void 0 : dataTypes.includes(c.dataType))
1230
- filteredPosts.push(c);
1231
- });
1232
- return filteredPosts;
1226
+ // Check dataType for child post. this function will return all child posts in a same level of parent post (flatten)
1227
+ if (!post.children.length)
1228
+ return acc;
1229
+ const childPost = (_a = pullFromCache(['post', 'get', post.children[0]])) === null || _a === void 0 ? void 0 : _a.data;
1230
+ if (!childPost)
1231
+ return acc;
1232
+ // Prevent to insert a duplicate record
1233
+ if (postIds.includes(childPost.postId))
1234
+ return acc;
1235
+ if (dataTypes === null || dataTypes === void 0 ? void 0 : dataTypes.includes(childPost === null || childPost === void 0 ? void 0 : childPost.dataType))
1236
+ return acc;
1237
+ postIds.push(childPost.postId);
1238
+ // @ts-ignore
1239
+ acc.push(childPost);
1240
+ return acc;
1241
+ }, []);
1233
1242
  };
1234
1243
  /**
1235
1244
  * Filter a collection by search term
@@ -1403,7 +1412,12 @@ const createEventSubscriber = (client, namespace, event, fn) => {
1403
1412
  log(`${namespace}(tmpid: ${timestamp}) > listen`);
1404
1413
  const handler = (...payload) => {
1405
1414
  log(`${namespace}(tmpid: ${timestamp}) > trigger`, payload);
1406
- fn(...payload);
1415
+ try {
1416
+ fn(...payload);
1417
+ }
1418
+ catch (e) {
1419
+ log(`${namespace}(tmpid: ${timestamp}) > error`, e);
1420
+ }
1407
1421
  };
1408
1422
  emitter.on(event, handler);
1409
1423
  return () => {
@@ -4419,7 +4433,8 @@ const uuid = () => nativeIdGenerator__default["default"].v4().toString();
4419
4433
 
4420
4434
  // TODO: find a way to uniquely identify the device
4421
4435
  let tabIndex = 0;
4422
- if (typeof BroadcastChannel !== 'undefined') {
4436
+ // This logic is running on browser only
4437
+ if (typeof BroadcastChannel !== 'undefined' && typeof window !== 'undefined') {
4423
4438
  const tabId = uuid();
4424
4439
  const openedTabs = {};
4425
4440
  const internalBroadcast = new BroadcastChannel('amity_ts_sdk');
@@ -5833,11 +5848,12 @@ const onUserDeleted = (callback) => createUserEventSubscriber('user.deleted', ca
5833
5848
  const logout = async () => {
5834
5849
  const client = getActiveClient();
5835
5850
  client.log('client/api/disconnectClient');
5836
- await new Promise(resolve => {
5837
- client.ws.once('disconnect', resolve);
5838
- client.ws.disconnect();
5851
+ if (client.mqtt.connected) {
5839
5852
  client.mqtt.disconnect();
5840
- });
5853
+ }
5854
+ if (client.ws.connected) {
5855
+ client.ws.disconnect();
5856
+ }
5841
5857
  /*
5842
5858
  * for cases when session state is terminated (example on ban) or token expired,
5843
5859
  * the terminating block will set session state to terminated or for the or
@@ -5867,7 +5883,7 @@ const logout = async () => {
5867
5883
  if (client.sessionState !== "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */ && client.cache) {
5868
5884
  client.cache = { data: {} };
5869
5885
  }
5870
- return !client.ws.connected;
5886
+ return true;
5871
5887
  };
5872
5888
  /* end_public_function */
5873
5889
 
@@ -7505,6 +7521,42 @@ const getChannel = (channelId, callback) => {
7505
7521
  };
7506
7522
  /* end_public_function */
7507
7523
 
7524
+ /**
7525
+ * ```js
7526
+ * import { onMessageCreated } from '@amityco/ts-sdk-react-native'
7527
+ * const dispose = onMessageCreated(message => {
7528
+ * // ...
7529
+ * })
7530
+ * ```
7531
+ *
7532
+ * Fired when an {@link Amity.Message} has been created
7533
+ *
7534
+ * @param callback The function to call when the event was fired
7535
+ * @param local Trigger when an event occurs from a local event or not
7536
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
7537
+ *
7538
+ * @category Message Events
7539
+ */
7540
+ const onMessageCreated = (callback, local = true) => {
7541
+ const client = getActiveClient();
7542
+ const filter = async (rawPayload) => {
7543
+ const payload = await prepareMessagePayload(rawPayload);
7544
+ const message = payload.messages[0];
7545
+ // Update in cache
7546
+ ingestInCache(payload);
7547
+ callback(message);
7548
+ };
7549
+ const disposers = [
7550
+ createEventSubscriber(client, 'message/onMessageCreated', 'message.created', filter),
7551
+ ];
7552
+ if (local) {
7553
+ createEventSubscriber(client, 'message/onMessageCreated', 'local.message.created', payload => callback(payload.messages[0]));
7554
+ }
7555
+ return () => {
7556
+ disposers.forEach(fn => fn());
7557
+ };
7558
+ };
7559
+
7508
7560
  /**
7509
7561
  * ```js
7510
7562
  * import { queryChannels } from '@amityco/ts-sdk-react-native'
@@ -7667,7 +7719,14 @@ const getChannels = (params, callback, config) => {
7667
7719
  responder(data);
7668
7720
  }, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
7669
7721
  };
7670
- disposers.push(onChannelCreated(realtimeRouter()), onChannelDeleted(realtimeRouter()), onChannelUpdated(realtimeRouter()), onChannelMuted(realtimeRouter()), onChannelJoined(realtimeRouter()), onChannelLeft(realtimeRouter()), onChannelMemberAdded(realtimeRouter()), onChannelMemberRemoved(realtimeRouter()), convertEventPayload(onChannelMarkerFetched, 'entityId', 'channel')(realtimeRouter()));
7722
+ disposers.push(onMessageCreated(message => {
7723
+ const cacheData = pullFromCache(['channel', 'get', message.channelId]);
7724
+ if (!cacheData)
7725
+ return;
7726
+ const channelData = Object.assign(Object.assign({}, cacheData.data), { lastActivity: message.createdAt });
7727
+ upsertInCache(['channel', 'get', message.channelId], channelData);
7728
+ realtimeRouter()(channelData);
7729
+ }), onChannelCreated(realtimeRouter()), onChannelDeleted(realtimeRouter()), onChannelUpdated(realtimeRouter()), onChannelMuted(realtimeRouter()), onChannelJoined(realtimeRouter()), onChannelLeft(realtimeRouter()), onChannelMemberAdded(realtimeRouter()), onChannelMemberRemoved(realtimeRouter()), convertEventPayload(onChannelMarkerFetched, 'entityId', 'channel')(realtimeRouter()));
7671
7730
  onFetch(true);
7672
7731
  disposers.push(() => dropFromCache(cacheKey));
7673
7732
  return () => {
@@ -8208,42 +8267,6 @@ const onUserMarkerSync = (callback) => {
8208
8267
  return createEventSubscriber(client, 'UserMarker/onUserMarkerSync', 'marker.user-sync', filter);
8209
8268
  };
8210
8269
 
8211
- /**
8212
- * ```js
8213
- * import { onMessageCreated } from '@amityco/ts-sdk-react-native'
8214
- * const dispose = onMessageCreated(message => {
8215
- * // ...
8216
- * })
8217
- * ```
8218
- *
8219
- * Fired when an {@link Amity.Message} has been created
8220
- *
8221
- * @param callback The function to call when the event was fired
8222
- * @param local Trigger when an event occurs from a local event or not
8223
- * @returns an {@link Amity.Unsubscriber} function to stop listening
8224
- *
8225
- * @category Message Events
8226
- */
8227
- const onMessageCreated = (callback, local = true) => {
8228
- const client = getActiveClient();
8229
- const filter = async (rawPayload) => {
8230
- const payload = await prepareMessagePayload(rawPayload);
8231
- const message = payload.messages[0];
8232
- // Update in cache
8233
- ingestInCache(payload);
8234
- callback(message);
8235
- };
8236
- const disposers = [
8237
- createEventSubscriber(client, 'message/onMessageCreated', 'message.created', filter),
8238
- ];
8239
- if (local) {
8240
- createEventSubscriber(client, 'message/onMessageCreated', 'local.message.created', payload => callback(payload.messages[0]));
8241
- }
8242
- return () => {
8243
- disposers.forEach(fn => fn());
8244
- };
8245
- };
8246
-
8247
8270
  /**
8248
8271
  * ```js
8249
8272
  * import { onMessageUpdated } from '@amityco/ts-sdk-react-native'
@@ -11736,7 +11759,7 @@ const createCommentEventSubscriber = (event, callback) => {
11736
11759
  var _a;
11737
11760
  if (!client.cache) {
11738
11761
  // TODO: here we are missing specific properties here!
11739
- callback(payload.comments[0]);
11762
+ callback(LinkedObject.comment(payload.comments[0]));
11740
11763
  }
11741
11764
  else {
11742
11765
  ingestInCache(payload);
@@ -11749,7 +11772,7 @@ const createCommentEventSubscriber = (event, callback) => {
11749
11772
  const queries = (_a = queryCache(['comment', 'query'])) === null || _a === void 0 ? void 0 : _a.filter(({ key }) => { var _a; return ((_a = key[2]) === null || _a === void 0 ? void 0 : _a.referenceId) === comment.data.referenceId; });
11750
11773
  queries === null || queries === void 0 ? void 0 : queries.map(({ key, data }) => upsertInCache(key, data, { cachedAt: -1 }));
11751
11774
  }
11752
- callback(comment.data);
11775
+ callback(LinkedObject.comment(comment.data));
11753
11776
  }
11754
11777
  };
11755
11778
  return createEventSubscriber(client, event, event, filter);
@@ -11763,12 +11786,12 @@ const createCommentEventSubscriber = (event, callback) => {
11763
11786
  * })
11764
11787
  * ```
11765
11788
  *
11766
- * Fired when a {@link Amity.InternalComment} has been created
11789
+ * Fired when a {@link Amity.Comment} has been created
11767
11790
  *
11768
11791
  * @param callback The function to call when the event was fired
11769
11792
  * @returns an {@link Amity.Unsubscriber} function to stop listening
11770
11793
  *
11771
- * @category InternalComment Events
11794
+ * @category Comment Events
11772
11795
  */
11773
11796
  const onCommentCreated = (callback) => createCommentEventSubscriber('comment.created', callback);
11774
11797
 
@@ -11780,12 +11803,12 @@ const onCommentCreated = (callback) => createCommentEventSubscriber('comment.cre
11780
11803
  * })
11781
11804
  * ```
11782
11805
  *
11783
- * Fired when a {@link Amity.InternalComment} has been updated
11806
+ * Fired when a {@link Amity.Comment} has been updated
11784
11807
  *
11785
11808
  * @param callback The function to call when the event was fired
11786
11809
  * @returns an {@link Amity.Unsubscriber} function to stop listening
11787
11810
  *
11788
- * @category InternalComment Events
11811
+ * @category Comment Events
11789
11812
  */
11790
11813
  const onCommentUpdated = (callback) => createCommentEventSubscriber('comment.updated', callback);
11791
11814
 
@@ -11797,12 +11820,12 @@ const onCommentUpdated = (callback) => createCommentEventSubscriber('comment.upd
11797
11820
  * })
11798
11821
  * ```
11799
11822
  *
11800
- * Fired when a {@link Amity.InternalComment} has been deleted
11823
+ * Fired when a {@link Amity.Comment} has been deleted
11801
11824
  *
11802
11825
  * @param callback The function to call when the event was fired
11803
11826
  * @returns an {@link Amity.Unsubscriber} function to stop listening
11804
11827
  *
11805
- * @category InternalComment Events
11828
+ * @category Comment Events
11806
11829
  */
11807
11830
  const onCommentDeleted = (callback) => createCommentEventSubscriber('comment.deleted', callback);
11808
11831
 
@@ -11814,12 +11837,12 @@ const onCommentDeleted = (callback) => createCommentEventSubscriber('comment.del
11814
11837
  * })
11815
11838
  * ```
11816
11839
  *
11817
- * Fired when a {@link Amity.InternalComment} has been flagged
11840
+ * Fired when a {@link Amity.Comment} has been flagged
11818
11841
  *
11819
11842
  * @param callback The function to call when the event was fired
11820
11843
  * @returns an {@link Amity.Unsubscriber} function to stop listening
11821
11844
  *
11822
- * @category InternalComment Events
11845
+ * @category Comment Events
11823
11846
  */
11824
11847
  const onCommentFlagged = (callback) => createCommentEventSubscriber('comment.flagged', callback);
11825
11848
 
@@ -11831,12 +11854,12 @@ const onCommentFlagged = (callback) => createCommentEventSubscriber('comment.fla
11831
11854
  * })
11832
11855
  * ```
11833
11856
  *
11834
- * Fired when a flag has been removed from a {@link Amity.InternalComment}
11857
+ * Fired when a flag has been removed from a {@link Amity.Comment}
11835
11858
  *
11836
11859
  * @param callback The function to call when the event was fired
11837
11860
  * @returns an {@link Amity.Unsubscriber} function to stop listening
11838
11861
  *
11839
- * @category InternalComment Events
11862
+ * @category Comment Events
11840
11863
  */
11841
11864
  const onCommentUnflagged = (callback) => createCommentEventSubscriber('comment.unflagged', callback);
11842
11865
 
@@ -11848,18 +11871,18 @@ const onCommentUnflagged = (callback) => createCommentEventSubscriber('comment.u
11848
11871
  * })
11849
11872
  * ```
11850
11873
  *
11851
- * Fired when a {@link Amity.InternalComment} has been reacted
11874
+ * Fired when a {@link Amity.Comment} has been reacted
11852
11875
  *
11853
11876
  * @param callback The function to call when the event was fired
11854
11877
  * @returns an {@link Amity.Unsubscriber} function to stop listening
11855
11878
  *
11856
- * @category InternalComment Events
11879
+ * @category Comment Events
11857
11880
  */
11858
11881
  const onCommentReactionAdded = (callback) => {
11859
11882
  const client = getActiveClient();
11860
11883
  const filter = (payload) => {
11861
11884
  if (!client.cache) {
11862
- callback(payload.comments[0]);
11885
+ callback(LinkedObject.comment(payload.comments[0]));
11863
11886
  }
11864
11887
  else {
11865
11888
  const processed = prepareReactionPayloadFormEvent('comment.addReaction', payload);
@@ -11870,7 +11893,7 @@ const onCommentReactionAdded = (callback) => {
11870
11893
  'get',
11871
11894
  payload.comments[0].commentId,
11872
11895
  ]);
11873
- callback(comment.data);
11896
+ callback(LinkedObject.comment(comment.data));
11874
11897
  }
11875
11898
  };
11876
11899
  return createEventSubscriber(client, 'comment.addReaction', 'comment.addReaction', filter);
@@ -11884,18 +11907,18 @@ const onCommentReactionAdded = (callback) => {
11884
11907
  * })
11885
11908
  * ```
11886
11909
  *
11887
- * Fired when a reaction has been removed from a {@link Amity.InternalComment}
11910
+ * Fired when a reaction has been removed from a {@link Amity.Comment}
11888
11911
  *
11889
11912
  * @param callback The function to call when the event was fired
11890
11913
  * @returns an {@link Amity.Unsubscriber} function to stop listening
11891
11914
  *
11892
- * @category InternalComment Events
11915
+ * @category Comment Events
11893
11916
  */
11894
11917
  const onCommentReactionRemoved = (callback) => {
11895
11918
  const client = getActiveClient();
11896
11919
  const filter = (payload) => {
11897
11920
  if (!client.cache) {
11898
- callback(payload.comments[0]);
11921
+ callback(LinkedObject.comment(payload.comments[0]));
11899
11922
  }
11900
11923
  else {
11901
11924
  const processed = prepareReactionPayloadFormEvent('comment.removeReaction', payload);
@@ -11906,7 +11929,7 @@ const onCommentReactionRemoved = (callback) => {
11906
11929
  'get',
11907
11930
  payload.comments[0].commentId,
11908
11931
  ]);
11909
- callback(comment.data);
11932
+ callback(LinkedObject.comment(comment.data));
11910
11933
  }
11911
11934
  };
11912
11935
  return createEventSubscriber(client, 'comment.removeReaction', 'comment.removeReaction', filter);
@@ -17229,7 +17252,7 @@ const observeComment = (commentId, callback, policy = 'cache_then_server') => {
17229
17252
  * });
17230
17253
  * ```
17231
17254
  *
17232
- * Observe all mutation on a given {@link Amity.InternalComment}
17255
+ * Observe all mutation on a given {@link Amity.Comment}
17233
17256
  *
17234
17257
  * @param commentId the ID of the comment to observe
17235
17258
  * @param callback the function to call when new data are available
@@ -17336,7 +17359,11 @@ const getComments = (params, callback, config) => {
17336
17359
  const cacheKey = [
17337
17360
  'comment',
17338
17361
  'collection',
17339
- { referenceId: params.referenceType, referenceType: params.referenceId },
17362
+ {
17363
+ referenceId: params.referenceType,
17364
+ referenceType: params.referenceId,
17365
+ parentId: (params === null || params === void 0 ? void 0 : params.parentId) || '',
17366
+ },
17340
17367
  ];
17341
17368
  const responder = (data) => {
17342
17369
  var _a, _b;