@amityco/ts-sdk-react-native 7.0.3-ae47dd5.0 → 7.1.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/.env +26 -26
- package/dist/index.cjs.js +9 -3
- package/dist/index.esm.js +9 -3
- package/dist/index.umd.js +3 -3
- package/dist/reactionRepository/api/addReaction.d.ts.map +1 -1
- package/dist/reactionRepository/api/removeReaction.d.ts.map +1 -1
- package/dist/reactionRepository/observers/getReactions/ReactionPaginationController.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/reactionRepository/api/addReaction.ts +8 -0
- package/src/reactionRepository/api/removeReaction.ts +8 -0
- package/src/reactionRepository/observers/getReactions/ReactionPaginationController.ts +8 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addReaction.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/api/addReaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addReaction.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/api/addReaction.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;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;IAmFnB;;;;;;;;;;;;;;SAcK;kCAEY,MAAM,aAAa,eACrB,MAAM,QAAQ,CAAC,aAAa,CAAC,gBAC5B,MAAM,eAAe,CAAC,cAAc,CAAC,GAClD,OAAO,GAAG,SAAS;CAtBrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeReaction.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/api/removeReaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"removeReaction.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/api/removeReaction.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;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;IAsFnB;;;;;;;;;;;;;;SAcK;kCAEY,MAAM,aAAa,eACrB,MAAM,QAAQ,CAAC,aAAa,CAAC,gBAC5B,MAAM,eAAe,CAAC,cAAc,CAAC,GAClD,OAAO,GAAG,SAAS;CAtBrB,CAAC"}
|
package/dist/reactionRepository/observers/getReactions/ReactionPaginationController.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactionPaginationController.d.ts","sourceRoot":"","sources":["../../../../src/reactionRepository/observers/getReactions/ReactionPaginationController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"ReactionPaginationController.d.ts","sourceRoot":"","sources":["../../../../src/reactionRepository/observers/getReactions/ReactionPaginationController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAKlF,qBAAa,4BAA6B,SAAQ,oBAAoB,CACpE,UAAU,EACV,KAAK,CAAC,sBAAsB,CAC7B;IACO,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,sBAAsB,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS;CA2BtF"}
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import { upsertInCache, pullFromCache, pushToCache } from '~/cache/api';
|
|
|
5
5
|
import { UNSYNCED_OBJECT_CACHED_AT_VALUE } from '~/utils/constants';
|
|
6
6
|
import { dispatchReactable } from '../utils';
|
|
7
7
|
import { fireEvent } from '~/core/events';
|
|
8
|
+
import { ASCApiError } from '~/core/errors';
|
|
8
9
|
|
|
9
10
|
/* begin_public_function
|
|
10
11
|
id: reaction.add
|
|
@@ -37,6 +38,13 @@ export const addReaction = async (
|
|
|
37
38
|
reactionName,
|
|
38
39
|
});
|
|
39
40
|
|
|
41
|
+
if (!['post', 'comment', 'story', 'message'].includes(referenceType))
|
|
42
|
+
throw new ASCApiError(
|
|
43
|
+
'The reference type is not valid. It should be one of post, comment, story, or message',
|
|
44
|
+
Amity.ServerError.BAD_REQUEST,
|
|
45
|
+
Amity.ErrorLevel.ERROR,
|
|
46
|
+
);
|
|
47
|
+
|
|
40
48
|
const { data } = await client.http.post<{ addedId: 'string' }>('/api/v2/reactions', {
|
|
41
49
|
referenceId,
|
|
42
50
|
referenceType,
|
|
@@ -6,6 +6,7 @@ import { UNSYNCED_OBJECT_CACHED_AT_VALUE } from '~/utils/constants';
|
|
|
6
6
|
|
|
7
7
|
import { dispatchReactable } from '../utils';
|
|
8
8
|
import { fireEvent } from '~/core/events';
|
|
9
|
+
import { ASCApiError } from '~/core/errors';
|
|
9
10
|
|
|
10
11
|
/* begin_public_function
|
|
11
12
|
id: reaction.remove
|
|
@@ -38,6 +39,13 @@ export const removeReaction = async (
|
|
|
38
39
|
reactionName,
|
|
39
40
|
});
|
|
40
41
|
|
|
42
|
+
if (!['post', 'comment', 'story', 'message'].includes(referenceType))
|
|
43
|
+
throw new ASCApiError(
|
|
44
|
+
'The reference type is not valid. It should be one of post, comment, story, or message',
|
|
45
|
+
Amity.ServerError.BAD_REQUEST,
|
|
46
|
+
Amity.ErrorLevel.ERROR,
|
|
47
|
+
);
|
|
48
|
+
|
|
41
49
|
const { data } = await client.http.delete<{ removedId: string }>(`/api/v2/reactions`, {
|
|
42
50
|
data: {
|
|
43
51
|
referenceId,
|
|
@@ -2,6 +2,7 @@ import { getActiveClient } from '~/client';
|
|
|
2
2
|
import { PaginationController } from '~/core/liveCollection/PaginationController';
|
|
3
3
|
import { COLLECTION_DEFAULT_PAGINATION_LIMIT } from '~/utils/constants';
|
|
4
4
|
import { REFERENCE_API_V5 } from '~/reactionRepository/api/constants';
|
|
5
|
+
import { ASCApiError } from '~/core/errors';
|
|
5
6
|
|
|
6
7
|
export class ReactionPaginationController extends PaginationController<
|
|
7
8
|
'reaction',
|
|
@@ -15,6 +16,13 @@ export class ReactionPaginationController extends PaginationController<
|
|
|
15
16
|
|
|
16
17
|
const path = '/api/v3/reactions';
|
|
17
18
|
|
|
19
|
+
if (!['post', 'comment', 'story', 'message'].includes(params.referenceType))
|
|
20
|
+
throw new ASCApiError(
|
|
21
|
+
'The reference type is not valid. It should be one of post, comment, story, or message',
|
|
22
|
+
Amity.ServerError.BAD_REQUEST,
|
|
23
|
+
Amity.ErrorLevel.ERROR,
|
|
24
|
+
);
|
|
25
|
+
|
|
18
26
|
const { data: queryResponse } = await this.http.get<Amity.ReactionPayload & Amity.Pagination>(
|
|
19
27
|
path,
|
|
20
28
|
{
|