@amityco/ts-sdk 0.0.1-4fb63bf.0 → 0.0.1-4fb735e.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/domains/client.d.ts +1 -0
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/client/api/createClient.d.ts.map +1 -1
- package/dist/comment/api/deleteComment.d.ts +35 -2
- package/dist/comment/api/deleteComment.d.ts.map +1 -1
- package/dist/index.cjs.js +40 -36
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +40 -37
- package/dist/index.umd.js +17 -5204
- package/dist/post/api/deletePost.d.ts +38 -2
- package/dist/post/api/deletePost.d.ts.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +3 -1
- package/rollup.config.js +61 -21
- package/src/@types/domains/client.ts +2 -0
- package/src/client/api/createClient.ts +16 -8
- package/src/comment/api/deleteComment.ts +15 -18
- package/src/index.ts +2 -0
- package/src/post/api/deletePost.ts +20 -20
- package/src/version.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAE9B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;QAErD,KAAK,MAAM,GAAG;YACZ,GAAG,EAAE,MAAM,CAAA;YACX,IAAI,EAAE,aAAa,CAAA;YACnB,EAAE,EAAE,cAAc,CAAC,MAAM,CAAA;YACzB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YAE9B,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAA;YAEnB,MAAM,CAAC,EAAE,MAAM,CAAA;YACf,MAAM,CAAC,EAAE,MAAM,CAAA;YAEf,GAAG,EAAE,MAAM,IAAI,CAAA;SAChB,CAAA;QAED,KAAK,MAAM,GAAG;YACZ,QAAQ,EAAE,MAAM,CAAA;YAChB,UAAU,EAAE;gBACV,OAAO,EAAE,MAAM,CAAA;gBACf,IAAI,EAAE,MAAM,GAAG,KAAK,CAAA;gBACpB,KAAK,CAAC,EAAE,MAAM,CAAA;aACf,CAAA;SACF,CAAA;QAED,KAAK,MAAM,GAAG;YACZ,WAAW,EAAE,MAAM,CAAA;YACnB,YAAY,EAAE,MAAM,CAAA;SACrB,CAAA;KACF;CACF"}
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAE9B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;QAErD,KAAK,MAAM,GAAG;YACZ,OAAO,EAAE,MAAM,CAAA;YAEf,GAAG,EAAE,MAAM,CAAA;YACX,IAAI,EAAE,aAAa,CAAA;YACnB,EAAE,EAAE,cAAc,CAAC,MAAM,CAAA;YACzB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YAE9B,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAA;YAEnB,MAAM,CAAC,EAAE,MAAM,CAAA;YACf,MAAM,CAAC,EAAE,MAAM,CAAA;YAEf,GAAG,EAAE,MAAM,IAAI,CAAA;SAChB,CAAA;QAED,KAAK,MAAM,GAAG;YACZ,QAAQ,EAAE,MAAM,CAAA;YAChB,UAAU,EAAE;gBACV,OAAO,EAAE,MAAM,CAAA;gBACf,IAAI,EAAE,MAAM,GAAG,KAAK,CAAA;gBACpB,KAAK,CAAC,EAAE,MAAM,CAAA;aACf,CAAA;SACF,CAAA;QAED,KAAK,MAAM,GAAG;YACZ,WAAW,EAAE,MAAM,CAAA;YACnB,YAAY,EAAE,MAAM,CAAA;SACrB,CAAA;KACF;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../../src/client/api/createClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../../src/client/api/createClient.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;IAcI;AACJ,eAAO,MAAM,YAAY,WACf,MAAM,gBACD,MAAM,iBACL,MAAM,KACnB,MAAM,MA+BR,CAAA"}
|
|
@@ -12,7 +12,40 @@
|
|
|
12
12
|
* @category Comment API
|
|
13
13
|
* @async
|
|
14
14
|
*/
|
|
15
|
-
export declare const deleteComment: (commentId: Amity.Comment['commentId'], permanent?: boolean) => Promise<
|
|
16
|
-
|
|
15
|
+
export declare const deleteComment: (commentId: Amity.Comment['commentId'], permanent?: boolean) => Promise<{
|
|
16
|
+
isDeleted: boolean;
|
|
17
|
+
commentId: string;
|
|
18
|
+
userId: string;
|
|
19
|
+
parentId?: string | undefined;
|
|
20
|
+
rootId: string;
|
|
21
|
+
childrenNumber: number;
|
|
22
|
+
children: string[];
|
|
23
|
+
segmentNumber: number;
|
|
24
|
+
referenceId: string;
|
|
25
|
+
referenceType: Amity.CommentReferenceType;
|
|
26
|
+
dataType?: any;
|
|
27
|
+
data: any;
|
|
28
|
+
metadata?: Record<string, any> | undefined;
|
|
29
|
+
flagCount: number;
|
|
30
|
+
hashFlag: {
|
|
31
|
+
bits: number;
|
|
32
|
+
hashes: number;
|
|
33
|
+
hash: string;
|
|
34
|
+
} | null;
|
|
35
|
+
reactionsCount: number;
|
|
36
|
+
reactions: Record<string, number>;
|
|
37
|
+
myReactions?: string[] | undefined;
|
|
38
|
+
latestReaction?: ({
|
|
39
|
+
reactionId: string;
|
|
40
|
+
userId: string;
|
|
41
|
+
reactionName: string;
|
|
42
|
+
} & Amity.CreatedAt & Amity.Relationship<Amity.ReactableType> & {
|
|
43
|
+
eventName: "added" | "removed";
|
|
44
|
+
}) | undefined;
|
|
45
|
+
createdAt: string;
|
|
46
|
+
updatedAt?: string | undefined;
|
|
47
|
+
deletedAt?: string | undefined;
|
|
48
|
+
localId: string;
|
|
49
|
+
syncedAt: number;
|
|
17
50
|
}>;
|
|
18
51
|
//# sourceMappingURL=deleteComment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteComment.d.ts","sourceRoot":"","sources":["../../../src/comment/api/deleteComment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deleteComment.d.ts","sourceRoot":"","sources":["../../../src/comment/api/deleteComment.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,cACb,aAAa,CAAC,WAAW,CAAC,cAC1B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCnB,CAAA"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -21,6 +21,10 @@ var io__default = /*#__PURE__*/_interopDefaultLegacy(io);
|
|
|
21
21
|
var mitt__default = /*#__PURE__*/_interopDefaultLegacy(mitt);
|
|
22
22
|
var AsyncStorage__default = /*#__PURE__*/_interopDefaultLegacy(AsyncStorage);
|
|
23
23
|
|
|
24
|
+
var _a;
|
|
25
|
+
// used in createClient
|
|
26
|
+
const VERSION$1 = (_a = 'v0.0.1-beta.7-cjs') !== null && _a !== void 0 ? _a : '__dev__';
|
|
27
|
+
|
|
24
28
|
/**
|
|
25
29
|
* Generic ASC error
|
|
26
30
|
* @category Errors
|
|
@@ -984,7 +988,12 @@ const createClient = (apiKey, apiEndpoint = 'https://api.amity.co', debugSession
|
|
|
984
988
|
const ws = createWebsocketTransport(apiEndpoint);
|
|
985
989
|
const emitter = createEventEmitter();
|
|
986
990
|
const client = {
|
|
987
|
-
|
|
991
|
+
version: `${VERSION$1}`,
|
|
992
|
+
apiKey,
|
|
993
|
+
log,
|
|
994
|
+
http,
|
|
995
|
+
ws,
|
|
996
|
+
emitter,
|
|
988
997
|
use: () => setActiveClient(client),
|
|
989
998
|
};
|
|
990
999
|
try {
|
|
@@ -2993,9 +3002,9 @@ const removeCommunityMembersRole = async (communityId, roleId, userIds) => {
|
|
|
2993
3002
|
* @async
|
|
2994
3003
|
*/
|
|
2995
3004
|
const deletePost = async (postId, permanent = false) => {
|
|
2996
|
-
var _a;
|
|
2997
3005
|
const client = getActiveClient();
|
|
2998
3006
|
client.log('post/deletePost', postId);
|
|
3007
|
+
let post = await getPost(postId);
|
|
2999
3008
|
// API-FIX: This endpoint has not been implemented yet.
|
|
3000
3009
|
await client.http.delete(`/api/v4/posts/${postId}`, {
|
|
3001
3010
|
params: {
|
|
@@ -3003,26 +3012,25 @@ const deletePost = async (postId, permanent = false) => {
|
|
|
3003
3012
|
permanent,
|
|
3004
3013
|
},
|
|
3005
3014
|
});
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
if (((_a = error) === null || _a === void 0 ? void 0 : _a.code) === 400400 /* ITEM_NOT_FOUND */) {
|
|
3013
|
-
// there is currently a limitation which doesnt allow us to fire event to tell that community
|
|
3014
|
-
// has been updated. reason is that, when the object is deleted, we don't have its `communityId`
|
|
3015
|
-
// and so we cannot refetch the community or advertise on events. hopefully this should be solved
|
|
3016
|
-
// later when realtime events covers that for us.
|
|
3017
|
-
return { success: true };
|
|
3018
|
-
}
|
|
3019
|
-
throw (error);
|
|
3020
|
-
}
|
|
3021
|
-
if (deleted.targetType === 'community') {
|
|
3022
|
-
const community = await getCommunity(deleted.targetId);
|
|
3015
|
+
// there is currently a limitation which doesn't allow us to fire event to tell that community
|
|
3016
|
+
// has been updated. reason is that, when the object is deleted, we don't have its `communityId`
|
|
3017
|
+
// and so we cannot refetch the community or advertise on events. hopefully this should be solved
|
|
3018
|
+
// later when realtime events covers that for us.
|
|
3019
|
+
if (post.targetType === 'community') {
|
|
3020
|
+
const community = await getCommunity(post.targetId);
|
|
3023
3021
|
fireEvent('v3.community.didUpdate', { communities: [community] });
|
|
3024
3022
|
}
|
|
3023
|
+
// to support hard deletion
|
|
3024
|
+
const deleted = Object.assign(Object.assign({}, post), { isDeleted: true });
|
|
3025
3025
|
fireEvent('v3.post.didDelete', { posts: [deleted] });
|
|
3026
|
+
if (permanent) {
|
|
3027
|
+
setTimeout(() => {
|
|
3028
|
+
dropFromCache('post', { postId });
|
|
3029
|
+
}, 0);
|
|
3030
|
+
}
|
|
3031
|
+
else {
|
|
3032
|
+
mergeInCache('post', { postId, isDeleted: true });
|
|
3033
|
+
}
|
|
3026
3034
|
return deleted;
|
|
3027
3035
|
};
|
|
3028
3036
|
|
|
@@ -3309,9 +3317,9 @@ const updateComment = async (commentId, patch) => {
|
|
|
3309
3317
|
* @async
|
|
3310
3318
|
*/
|
|
3311
3319
|
const deleteComment = async (commentId, permanent = false) => {
|
|
3312
|
-
var _a;
|
|
3313
3320
|
const client = getActiveClient();
|
|
3314
3321
|
client.log('comment/deleteComment', commentId);
|
|
3322
|
+
const comment = await getComment(commentId);
|
|
3315
3323
|
// API-FIX: This endpoint has not been implemented yet.
|
|
3316
3324
|
await client.http.delete(`/api/v4/comments/${commentId}`, {
|
|
3317
3325
|
params: {
|
|
@@ -3319,24 +3327,19 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
3319
3327
|
permanent,
|
|
3320
3328
|
},
|
|
3321
3329
|
});
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
deleted = await getComment(commentId);
|
|
3326
|
-
}
|
|
3327
|
-
catch (error) {
|
|
3328
|
-
if (((_a = error) === null || _a === void 0 ? void 0 : _a.code) === 400400 /* ITEM_NOT_FOUND */) {
|
|
3329
|
-
// there is currently a limitation which doesnt allow us to fire event to tell that post
|
|
3330
|
-
// has been updated. reason is that, when the object is deleted, we don't have its `postId`
|
|
3331
|
-
// and so we cannot refetch the post or advertise on events. hopefully this should be solved
|
|
3332
|
-
// later when realtime events covers that for us.
|
|
3333
|
-
return { success: true };
|
|
3334
|
-
}
|
|
3335
|
-
throw (error);
|
|
3336
|
-
}
|
|
3337
|
-
const post = await getPost(deleted.referenceId);
|
|
3330
|
+
// to support hard deletion
|
|
3331
|
+
const deleted = Object.assign(Object.assign({}, comment), { isDeleted: true });
|
|
3332
|
+
const post = await getPost(comment.referenceId);
|
|
3338
3333
|
fireEvent('v3.post.didUpdate', { posts: [post] });
|
|
3339
3334
|
fireEvent('v3.comment.didDelete', { comments: [deleted] });
|
|
3335
|
+
if (permanent) {
|
|
3336
|
+
setTimeout(() => {
|
|
3337
|
+
dropFromCache('comment', { commentId });
|
|
3338
|
+
}, 0);
|
|
3339
|
+
}
|
|
3340
|
+
else {
|
|
3341
|
+
mergeInCache('comment', { commentId, isDeleted: true });
|
|
3342
|
+
}
|
|
3340
3343
|
return deleted;
|
|
3341
3344
|
};
|
|
3342
3345
|
|
|
@@ -5061,6 +5064,7 @@ const disposeStream = async (streamId) => {
|
|
|
5061
5064
|
return videoStreamings.find(stream => stream.streamId === streamId);
|
|
5062
5065
|
};
|
|
5063
5066
|
|
|
5067
|
+
exports.VERSION = VERSION$1;
|
|
5064
5068
|
exports.addChannelMembers = addChannelMembers;
|
|
5065
5069
|
exports.addChannelMembersRole = addChannelMembersRole;
|
|
5066
5070
|
exports.addCommunityMembers = addCommunityMembers;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,CAAA;AAEjB,cAAc,WAAW,CAAA;AAGzB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAE7B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAG/B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAEhC,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAEhC,cAAc,YAAY,CAAA;AAG1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AAEjC,cAAc,cAAc,CAAA;AAG5B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AAEnC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AAGnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AAErC,cAAc,YAAY,CAAA;AAE1B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAEhC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AAEnC,cAAc,cAAc,CAAA"}
|
package/dist/index.esm.js
CHANGED
|
@@ -7,6 +7,10 @@ import io from 'socket.io-client';
|
|
|
7
7
|
import mitt from 'mitt';
|
|
8
8
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
9
9
|
|
|
10
|
+
var _a;
|
|
11
|
+
// used in createClient
|
|
12
|
+
const VERSION$1 = (_a = 'v0.0.1-beta.7-esm') !== null && _a !== void 0 ? _a : '__dev__';
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* Generic ASC error
|
|
12
16
|
* @category Errors
|
|
@@ -970,7 +974,12 @@ const createClient = (apiKey, apiEndpoint = 'https://api.amity.co', debugSession
|
|
|
970
974
|
const ws = createWebsocketTransport(apiEndpoint);
|
|
971
975
|
const emitter = createEventEmitter();
|
|
972
976
|
const client = {
|
|
973
|
-
|
|
977
|
+
version: `${VERSION$1}`,
|
|
978
|
+
apiKey,
|
|
979
|
+
log,
|
|
980
|
+
http,
|
|
981
|
+
ws,
|
|
982
|
+
emitter,
|
|
974
983
|
use: () => setActiveClient(client),
|
|
975
984
|
};
|
|
976
985
|
try {
|
|
@@ -2979,9 +2988,9 @@ const removeCommunityMembersRole = async (communityId, roleId, userIds) => {
|
|
|
2979
2988
|
* @async
|
|
2980
2989
|
*/
|
|
2981
2990
|
const deletePost = async (postId, permanent = false) => {
|
|
2982
|
-
var _a;
|
|
2983
2991
|
const client = getActiveClient();
|
|
2984
2992
|
client.log('post/deletePost', postId);
|
|
2993
|
+
let post = await getPost(postId);
|
|
2985
2994
|
// API-FIX: This endpoint has not been implemented yet.
|
|
2986
2995
|
await client.http.delete(`/api/v4/posts/${postId}`, {
|
|
2987
2996
|
params: {
|
|
@@ -2989,26 +2998,25 @@ const deletePost = async (postId, permanent = false) => {
|
|
|
2989
2998
|
permanent,
|
|
2990
2999
|
},
|
|
2991
3000
|
});
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
if (((_a = error) === null || _a === void 0 ? void 0 : _a.code) === 400400 /* ITEM_NOT_FOUND */) {
|
|
2999
|
-
// there is currently a limitation which doesnt allow us to fire event to tell that community
|
|
3000
|
-
// has been updated. reason is that, when the object is deleted, we don't have its `communityId`
|
|
3001
|
-
// and so we cannot refetch the community or advertise on events. hopefully this should be solved
|
|
3002
|
-
// later when realtime events covers that for us.
|
|
3003
|
-
return { success: true };
|
|
3004
|
-
}
|
|
3005
|
-
throw (error);
|
|
3006
|
-
}
|
|
3007
|
-
if (deleted.targetType === 'community') {
|
|
3008
|
-
const community = await getCommunity(deleted.targetId);
|
|
3001
|
+
// there is currently a limitation which doesn't allow us to fire event to tell that community
|
|
3002
|
+
// has been updated. reason is that, when the object is deleted, we don't have its `communityId`
|
|
3003
|
+
// and so we cannot refetch the community or advertise on events. hopefully this should be solved
|
|
3004
|
+
// later when realtime events covers that for us.
|
|
3005
|
+
if (post.targetType === 'community') {
|
|
3006
|
+
const community = await getCommunity(post.targetId);
|
|
3009
3007
|
fireEvent('v3.community.didUpdate', { communities: [community] });
|
|
3010
3008
|
}
|
|
3009
|
+
// to support hard deletion
|
|
3010
|
+
const deleted = Object.assign(Object.assign({}, post), { isDeleted: true });
|
|
3011
3011
|
fireEvent('v3.post.didDelete', { posts: [deleted] });
|
|
3012
|
+
if (permanent) {
|
|
3013
|
+
setTimeout(() => {
|
|
3014
|
+
dropFromCache('post', { postId });
|
|
3015
|
+
}, 0);
|
|
3016
|
+
}
|
|
3017
|
+
else {
|
|
3018
|
+
mergeInCache('post', { postId, isDeleted: true });
|
|
3019
|
+
}
|
|
3012
3020
|
return deleted;
|
|
3013
3021
|
};
|
|
3014
3022
|
|
|
@@ -3295,9 +3303,9 @@ const updateComment = async (commentId, patch) => {
|
|
|
3295
3303
|
* @async
|
|
3296
3304
|
*/
|
|
3297
3305
|
const deleteComment = async (commentId, permanent = false) => {
|
|
3298
|
-
var _a;
|
|
3299
3306
|
const client = getActiveClient();
|
|
3300
3307
|
client.log('comment/deleteComment', commentId);
|
|
3308
|
+
const comment = await getComment(commentId);
|
|
3301
3309
|
// API-FIX: This endpoint has not been implemented yet.
|
|
3302
3310
|
await client.http.delete(`/api/v4/comments/${commentId}`, {
|
|
3303
3311
|
params: {
|
|
@@ -3305,24 +3313,19 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
3305
3313
|
permanent,
|
|
3306
3314
|
},
|
|
3307
3315
|
});
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
deleted = await getComment(commentId);
|
|
3312
|
-
}
|
|
3313
|
-
catch (error) {
|
|
3314
|
-
if (((_a = error) === null || _a === void 0 ? void 0 : _a.code) === 400400 /* ITEM_NOT_FOUND */) {
|
|
3315
|
-
// there is currently a limitation which doesnt allow us to fire event to tell that post
|
|
3316
|
-
// has been updated. reason is that, when the object is deleted, we don't have its `postId`
|
|
3317
|
-
// and so we cannot refetch the post or advertise on events. hopefully this should be solved
|
|
3318
|
-
// later when realtime events covers that for us.
|
|
3319
|
-
return { success: true };
|
|
3320
|
-
}
|
|
3321
|
-
throw (error);
|
|
3322
|
-
}
|
|
3323
|
-
const post = await getPost(deleted.referenceId);
|
|
3316
|
+
// to support hard deletion
|
|
3317
|
+
const deleted = Object.assign(Object.assign({}, comment), { isDeleted: true });
|
|
3318
|
+
const post = await getPost(comment.referenceId);
|
|
3324
3319
|
fireEvent('v3.post.didUpdate', { posts: [post] });
|
|
3325
3320
|
fireEvent('v3.comment.didDelete', { comments: [deleted] });
|
|
3321
|
+
if (permanent) {
|
|
3322
|
+
setTimeout(() => {
|
|
3323
|
+
dropFromCache('comment', { commentId });
|
|
3324
|
+
}, 0);
|
|
3325
|
+
}
|
|
3326
|
+
else {
|
|
3327
|
+
mergeInCache('comment', { commentId, isDeleted: true });
|
|
3328
|
+
}
|
|
3326
3329
|
return deleted;
|
|
3327
3330
|
};
|
|
3328
3331
|
|
|
@@ -5047,4 +5050,4 @@ const disposeStream = async (streamId) => {
|
|
|
5047
5050
|
return videoStreamings.find(stream => stream.streamId === streamId);
|
|
5048
5051
|
};
|
|
5049
5052
|
|
|
5050
|
-
export { addChannelMembers, addChannelMembersRole, addCommunityMembers, addCommunityMembersRole, addReaction, clearCache, connectClient, createCache, createChannel, createClient, createComment, createCommunity, createFile, createMessage, createPost, createQuery, createReport, createStream, decorateModel, decorateModels, decoratePayload, deleteChannel, deleteComment, deleteCommunity, deleteFile, deleteMessage, deletePost, deleteReport, deleteStream, disconnectClient, disposeStream, dropFromCache, enableCache, fileUrlWithSize, filterByPropEquality, getActiveClient, getChannel, getChannels, getComment, getComments, getCommunities, getCommunity, getFile, getMessage, getMessages, getPost, getPosts, getRole, getStream, getUser, getUsers, ingestInCache, isAfterBefore, isConnected, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkipLimit, isSyncable, isSynced, joinChannel, joinCommunity, leaveChannel, leaveCommunity, memoryStore, memoryStores, mergeInCache, mutateCache, observeChannel, observeComment, observeComments, observeCommunity, observeFile, observeMessage, observeMessages, observePost, observePosts, observeUser, onChannelDeleted, onChannelJoined, onChannelLeft, onChannelUpdated, onClientBanned, onClientDisconnected, onCommentCreated, onCommentDeleted, onCommentUpdated, onCommunityCreated, onCommunityDeleted, onCommunityJoined, onCommunityLeft, onCommunityUpdated, onConnectionError, onMemberAdded, onMemberRemoved, onMessageCreated, onMessageDeleted, onMessageUpdated, onPostCreated, onPostDeleted, onPostUpdated, onReactionRemoved, onUserUpdated, persistentStore, pullFromCache, pushToCache, queryChannelMembers, queryChannels, queryComments, queryCommunities, queryCommunityMembers, queryGlobalFeed, queryMessages, queryOptions, queryPosts, queryRoles, queryStreams, queryUsers, removeChannelMembers, removeChannelMembersRole, removeCommunityMembers, removeCommunityMembersRole, removeReaction, runQuery, sliceByPaging, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByLastActivity, sortByLastCreated, sortBySegmentNumber, syncInCache, toPage, toToken, updateChannel, updateComment, updateCommunity, updateMessage, updatePost, updateStream, updateUser };
|
|
5053
|
+
export { VERSION$1 as VERSION, addChannelMembers, addChannelMembersRole, addCommunityMembers, addCommunityMembersRole, addReaction, clearCache, connectClient, createCache, createChannel, createClient, createComment, createCommunity, createFile, createMessage, createPost, createQuery, createReport, createStream, decorateModel, decorateModels, decoratePayload, deleteChannel, deleteComment, deleteCommunity, deleteFile, deleteMessage, deletePost, deleteReport, deleteStream, disconnectClient, disposeStream, dropFromCache, enableCache, fileUrlWithSize, filterByPropEquality, getActiveClient, getChannel, getChannels, getComment, getComments, getCommunities, getCommunity, getFile, getMessage, getMessages, getPost, getPosts, getRole, getStream, getUser, getUsers, ingestInCache, isAfterBefore, isConnected, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkipLimit, isSyncable, isSynced, joinChannel, joinCommunity, leaveChannel, leaveCommunity, memoryStore, memoryStores, mergeInCache, mutateCache, observeChannel, observeComment, observeComments, observeCommunity, observeFile, observeMessage, observeMessages, observePost, observePosts, observeUser, onChannelDeleted, onChannelJoined, onChannelLeft, onChannelUpdated, onClientBanned, onClientDisconnected, onCommentCreated, onCommentDeleted, onCommentUpdated, onCommunityCreated, onCommunityDeleted, onCommunityJoined, onCommunityLeft, onCommunityUpdated, onConnectionError, onMemberAdded, onMemberRemoved, onMessageCreated, onMessageDeleted, onMessageUpdated, onPostCreated, onPostDeleted, onPostUpdated, onReactionRemoved, onUserUpdated, persistentStore, pullFromCache, pushToCache, queryChannelMembers, queryChannels, queryComments, queryCommunities, queryCommunityMembers, queryGlobalFeed, queryMessages, queryOptions, queryPosts, queryRoles, queryStreams, queryUsers, removeChannelMembers, removeChannelMembersRole, removeCommunityMembers, removeCommunityMembersRole, removeReaction, runQuery, sliceByPaging, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByLastActivity, sortByLastCreated, sortBySegmentNumber, syncInCache, toPage, toToken, updateChannel, updateComment, updateCommunity, updateMessage, updatePost, updateStream, updateUser };
|