@amityco/ts-sdk 7.32.1-330f4a7d.0 → 7.32.1-4ee0bce9.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/comment.d.ts +2 -2
- package/dist/@types/domains/comment.d.ts.map +1 -1
- package/dist/@types/domains/content.d.ts +15 -1
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/commentRepository/api/createComment.d.ts +1 -1
- package/dist/commentRepository/api/createComment.d.ts.map +1 -1
- package/dist/commentRepository/api/tests/createComment.gif.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/createComment.gif.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/deleteComment.gif.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/deleteComment.gif.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/updateComment.gif.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/updateComment.gif.test.d.ts.map +1 -0
- package/dist/commentRepository/api/updateComment.d.ts +9 -2
- package/dist/commentRepository/api/updateComment.d.ts.map +1 -1
- package/dist/commentRepository/observers/tests/getComments.gif.test.d.ts +2 -0
- package/dist/commentRepository/observers/tests/getComments.gif.test.d.ts.map +1 -0
- package/dist/commentRepository/utils/dataTypes.d.ts +2 -0
- package/dist/commentRepository/utils/dataTypes.d.ts.map +1 -0
- package/dist/index.cjs.js +53 -7
- package/dist/index.esm.js +53 -7
- package/dist/index.umd.js +1 -1
- package/dist/utils/gifAttachment.d.ts +5 -0
- package/dist/utils/gifAttachment.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/client/api/tests/setupBillableRequests.test.d.ts +0 -2
- package/dist/client/api/tests/setupBillableRequests.test.d.ts.map +0 -1
|
@@ -11,7 +11,7 @@ declare global {
|
|
|
11
11
|
* Absent on the wire means `approved` — see `prepareCommentPayload`.
|
|
12
12
|
*/
|
|
13
13
|
type CommentApprovalStatus = `${CommentApprovalStatusEnum}`;
|
|
14
|
-
type CommentContentType = 'text';
|
|
14
|
+
type CommentContentType = 'text' | 'gif';
|
|
15
15
|
type CommentReferenceType = 'content' | 'post' | 'story';
|
|
16
16
|
type CommentActionType = 'onFetch' | 'onCreate' | 'onUpdate' | 'onDelete' | 'onFlagged' | 'onUnflagged' | 'onReactionAdded' | 'onReactionRemoved';
|
|
17
17
|
type RawComment<T extends CommentContentType = any> = {
|
|
@@ -57,7 +57,7 @@ declare global {
|
|
|
57
57
|
limit?: number;
|
|
58
58
|
page?: Amity.Token;
|
|
59
59
|
dataTypes?: {
|
|
60
|
-
values: ('image' | 'text')[];
|
|
60
|
+
values: ('image' | 'text' | 'gif')[];
|
|
61
61
|
matchType: 'any' | 'exact';
|
|
62
62
|
};
|
|
63
63
|
excludeBlockUserComments?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,WAAW,yBAAyB;YAClC,OAAO,YAAY;YACnB,QAAQ,aAAa;YACrB,QAAQ,aAAa;SACtB;QAED;;;WAGG;QACH,KAAK,qBAAqB,GAAG,GAAG,yBAAyB,EAAE,CAAC;QAE5D,KAAK,kBAAkB,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,WAAW,yBAAyB;YAClC,OAAO,YAAY;YACnB,QAAQ,aAAa;YACrB,QAAQ,aAAa;SACtB;QAED;;;WAGG;QACH,KAAK,qBAAqB,GAAG,GAAG,yBAAyB,EAAE,CAAC;QAE5D,KAAK,kBAAkB,GAAG,MAAM,GAAG,KAAK,CAAC;QACzC,KAAK,oBAAoB,G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GAAG,OAAO,CAAC;aAC5B,CAAC;YACF,wBAAwB,CAAC,EAAE,OAAO,CAAC;SACpC,CAAC;QAEF,KAAK,qBAAqB,GAAG,KAAK,CAAC,oBAAoB,CACrD,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,MAAM,CAAC,GAAG;YACvC,MAAM,CAAC,EAAE,aAAa,GAAG,cAAc,CAAC;SACzC,CACF,CAAC;QAEF,KAAK,0BAA0B,GAAG,KAAK,CAAC,mBAAmB,CACzD,KAAK,CAAC,eAAe,CAAC,WAAW,CAAC,EAClC;YAAE,IAAI,CAAC,EAAE,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,CACnD,CAAC;QAEF,KAAK,uBAAuB,GAAG;YAC7B,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;YAC5C,yFAAyF;YACzF,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC9B,2EAA2E;YAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,yDAAyD;YACzD,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,sFAAsF;YACtF,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB,CAAC;QAEF,KAAK,gCAAgC,GAAG,KAAK,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;QAE5F,KAAK,qCAAqC,GAAG,KAAK,CAAC,mBAAmB,CACpE,KAAK,CAAC,eAAe,CAAC,WAAW,CAAC,EAClC;YAAE,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,CACnB,CAAC;KACH;CACF"}
|
|
@@ -49,11 +49,25 @@ declare global {
|
|
|
49
49
|
fileId: Amity.File<'image'>['fileId'];
|
|
50
50
|
caption?: string;
|
|
51
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* A GIF picked by the app from its own provider. It is a link, not a file: nothing is
|
|
54
|
+
* uploaded and there is no `fileId`. Leave out a size that has no value; `null` is refused,
|
|
55
|
+
* and so is any other key (alt text and provider fields included).
|
|
56
|
+
*/
|
|
57
|
+
type GifAttachment = {
|
|
58
|
+
type: 'gif';
|
|
59
|
+
/** https, path ends in `.gif`, at most 2,000 characters. Checked by the server. */
|
|
60
|
+
url: string;
|
|
61
|
+
/** 1 to 4096 */
|
|
62
|
+
width?: number;
|
|
63
|
+
/** 1 to 4096 */
|
|
64
|
+
height?: number;
|
|
65
|
+
};
|
|
52
66
|
type Attachment = {
|
|
53
67
|
type: 'image' | 'link';
|
|
54
68
|
url?: string;
|
|
55
69
|
fileId?: Amity.File<'image'>['fileId'];
|
|
56
|
-
};
|
|
70
|
+
} | GifAttachment;
|
|
57
71
|
type ContentDataVideo = {
|
|
58
72
|
/**
|
|
59
73
|
* Null until the server has finished transcoding the video: the field is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/content.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;EAM1B,CAAC;AAEH,oBAAY,qBAAqB;IAC/B,mBAAmB,iCAAiC;IACpD,iBAAiB,uBAAuB;IACxC,oBAAoB,2BAA2B;IAC/C,iBAAiB,yBAAyB;IAC1C,4BAA4B,oCAAoC;IAChE,sBAAsB,2CAA2C;IACjE,qBAAqB,6BAA6B;IAClD,WAAW,kBAAkB;IAC7B,gBAAgB,wCAAwC;IACxD,MAAM,WAAW;CAClB;AAED;;;GAGG;AACH,OAAO,EAAE,qBAAqB,IAAI,0BAA0B,EAAE,CAAC;AAE/D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,iBAAiB,GAClB,OAAO,CAAC,GAAG,qBAAqB,EAAE,EAAE,GAAG,qBAAqB,CAAC,MAAM,EAAE,CAAC,GACtE,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;QAElB;;;;;;WAMG;QACH,KAAK,kBAAkB,GAAG;YACx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WAAW,GAAG,MAAM,GAAG,OAAO,IAAI,CAAC,SAAS,MAAM,GAC5E,kBAAkB,GAClB,CAAC,SAAS,OAAO,GACjB,mBAAmB,GACnB,KAAK,CAAC;KACX;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare type CreateCommentBundle = Pick<Amity.Comment<
|
|
1
|
+
declare type CreateCommentBundle = Pick<Amity.Comment<'text'>, 'data' | 'referenceType' | 'referenceId' | 'parentId' | 'metadata' | 'mentionees' | 'attachments' | 'links'>;
|
|
2
2
|
/**
|
|
3
3
|
* ```js
|
|
4
4
|
* import { CommentRepository } from '@amityco/ts-sdk'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComment.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/api/createComment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createComment.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/api/createComment.ts"],"names":[],"mappings":"AA2BA,aAAK,mBAAmB,GAAG,IAAI,CAC7B,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EACnB,MAAM,GACN,eAAe,GACf,aAAa,GACb,UAAU,GACV,UAAU,GACV,YAAY,GACZ,aAAa,GACb,OAAO,CACV,CAAC;AAqEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,aAAa,WAChB,mBAAmB,6BAE1B,QAAQ,MAAM,MAAM,CAAC,aAAa,CAAC,CAmHrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createComment.gif.test.d.ts","sourceRoot":"","sources":["../../../../src/commentRepository/api/tests/createComment.gif.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteComment.gif.test.d.ts","sourceRoot":"","sources":["../../../../src/commentRepository/api/tests/deleteComment.gif.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateComment.gif.test.d.ts","sourceRoot":"","sources":["../../../../src/commentRepository/api/tests/updateComment.gif.test.ts"],"names":[],"mappings":""}
|
|
@@ -4,9 +4,16 @@
|
|
|
4
4
|
* const updated = await CommentRepository.updateComment(commentId, {
|
|
5
5
|
* data: { text: 'hello world' }
|
|
6
6
|
* })
|
|
7
|
+
*
|
|
8
|
+
* // Replace the GIF, or remove it and keep the text
|
|
9
|
+
* await CommentRepository.updateComment(commentId, {
|
|
10
|
+
* attachments: [{ type: 'gif', url: 'https://media.giphy.com/media/l0MYt5jPR6QX5pnqM/giphy.gif' }],
|
|
11
|
+
* })
|
|
12
|
+
* await CommentRepository.updateComment(commentId, { attachments: [] })
|
|
7
13
|
* ```
|
|
8
14
|
*
|
|
9
|
-
* Updates an {@link Amity.Comment}
|
|
15
|
+
* Updates an {@link Amity.Comment}. `attachments` replaces the current ones, `[]` removes them,
|
|
16
|
+
* and leaving `attachments` out keeps them as they are.
|
|
10
17
|
*
|
|
11
18
|
* @param commentId The ID of the {@link Amity.Comment} to edit
|
|
12
19
|
* @param patch The patch data to apply
|
|
@@ -15,5 +22,5 @@
|
|
|
15
22
|
* @category Comment API
|
|
16
23
|
* @async
|
|
17
24
|
*/
|
|
18
|
-
export declare const updateComment: (commentId: Amity.Comment['commentId'], patch: Patch<Amity.Comment, 'data' | 'metadata' | 'mentionees' | 'links'>) => Promise<Amity.Cached<Amity.Comment>>;
|
|
25
|
+
export declare const updateComment: (commentId: Amity.Comment['commentId'], patch: Patch<Amity.Comment, 'data' | 'metadata' | 'mentionees' | 'links' | 'attachments'>) => Promise<Amity.Cached<Amity.Comment>>;
|
|
19
26
|
//# sourceMappingURL=updateComment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateComment.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/api/updateComment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateComment.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/api/updateComment.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,aAAa,cACb,aAAa,CAAC,WAAW,CAAC,SAC9B,MAAM,aAAa,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,OAAO,GAAG,aAAa,CAAC,KACxF,QAAQ,MAAM,MAAM,CAAC,aAAa,CAAC,CAoCrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getComments.gif.test.d.ts","sourceRoot":"","sources":["../../../../src/commentRepository/observers/tests/getComments.gif.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataTypes.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/utils/dataTypes.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,SACvB,MAAM,GAAG,SAAS,eACX,MAAM,UAAU,EAAE,GAAG,SAAS,KAC1C,MAAM,kBAAkB,EAI1B,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -27743,8 +27743,40 @@ getCommentByIds.locally = (commentIds) => {
|
|
|
27743
27743
|
};
|
|
27744
27744
|
};
|
|
27745
27745
|
|
|
27746
|
+
const GIF_OPTIONAL_KEYS = ['width', 'height'];
|
|
27747
|
+
/*
|
|
27748
|
+
* The server refuses a GIF attachment that carries `null` or any key it does not know, so the
|
|
27749
|
+
* request keeps `type`, `url` and only the optional fields that have a value. The SDK does not
|
|
27750
|
+
* check the values themselves: the server answers 400 for a bad one.
|
|
27751
|
+
*/
|
|
27752
|
+
const toGifAttachmentPayload = (gif) => {
|
|
27753
|
+
const payload = { type: 'gif', url: gif.url };
|
|
27754
|
+
GIF_OPTIONAL_KEYS.forEach(key => {
|
|
27755
|
+
const value = gif[key];
|
|
27756
|
+
if (value !== undefined && value !== null)
|
|
27757
|
+
Object.assign(payload, { [key]: value });
|
|
27758
|
+
});
|
|
27759
|
+
return payload;
|
|
27760
|
+
};
|
|
27761
|
+
/* Builds each GIF from its known keys; every other attachment is sent as the caller gave it. */
|
|
27762
|
+
const toAttachmentsPayload = (attachments) => attachments.map(attachment => attachment.type === 'gif'
|
|
27763
|
+
? toGifAttachmentPayload(attachment)
|
|
27764
|
+
: attachment);
|
|
27765
|
+
|
|
27766
|
+
/*
|
|
27767
|
+
* The data types the server lists for a comment, known before it answers: one per attachment
|
|
27768
|
+
* type, plus `text` when there is text. Sorted, as the server sorts them.
|
|
27769
|
+
*/
|
|
27770
|
+
const commentDataTypesOf = (text, attachments) => {
|
|
27771
|
+
const types = new Set((attachments !== null && attachments !== void 0 ? attachments : []).map(attachment => attachment.type));
|
|
27772
|
+
if (text)
|
|
27773
|
+
types.add('text');
|
|
27774
|
+
return [...types].sort();
|
|
27775
|
+
};
|
|
27776
|
+
|
|
27746
27777
|
const getLocalCommentId = () => uuid();
|
|
27747
27778
|
const createCommentOptimistic = (bundle) => {
|
|
27779
|
+
var _a;
|
|
27748
27780
|
const client = getActiveClient();
|
|
27749
27781
|
if (!client.cache)
|
|
27750
27782
|
return;
|
|
@@ -27779,6 +27811,7 @@ const createCommentOptimistic = (bundle) => {
|
|
|
27779
27811
|
targetId: '',
|
|
27780
27812
|
targetType: 'community',
|
|
27781
27813
|
dataType: 'text',
|
|
27814
|
+
dataTypes: commentDataTypesOf((_a = bundle.data) === null || _a === void 0 ? void 0 : _a.text, bundle.attachments),
|
|
27782
27815
|
syncState: "syncing" /* Amity.SyncState.Syncing */,
|
|
27783
27816
|
// In a gated community the optimistic object stays out of public collections until the
|
|
27784
27817
|
// response settles the status; the author's own view still updates through the local event
|
|
@@ -27825,12 +27858,15 @@ const createCommentOptimistic = (bundle) => {
|
|
|
27825
27858
|
const createComment = async (bundle, isOptimistic = true) => {
|
|
27826
27859
|
const client = getActiveClient();
|
|
27827
27860
|
client.log('comment/createComment', Object.assign(Object.assign({}, bundle), { isOptimistic }));
|
|
27861
|
+
// A GIF is sent with its known keys only; the server refuses `null` and unknown keys.
|
|
27862
|
+
const request = bundle.attachments
|
|
27863
|
+
? Object.assign(Object.assign({}, bundle), { attachments: toAttachmentsPayload(bundle.attachments) }) : bundle;
|
|
27828
27864
|
// Without a local comment the server assigns the id; with one, the same id travels through the
|
|
27829
27865
|
// optimistic object, the response and every realtime event so each step recognises it.
|
|
27830
|
-
const optimisticData = isOptimistic ? createCommentOptimistic(
|
|
27866
|
+
const optimisticData = isOptimistic ? createCommentOptimistic(request) : undefined;
|
|
27831
27867
|
const commentId = optimisticData === null || optimisticData === void 0 ? void 0 : optimisticData.commentId;
|
|
27832
27868
|
try {
|
|
27833
|
-
const { data: payload } = await client.http.post('/api/v3/comments', Object.assign(Object.assign({},
|
|
27869
|
+
const { data: payload } = await client.http.post('/api/v3/comments', Object.assign(Object.assign({}, request), { commentId }));
|
|
27834
27870
|
// BE always returns an array of comments If it got record 0 from BE it might have a problem on creation logic
|
|
27835
27871
|
if (payload.comments.length === 0)
|
|
27836
27872
|
throw new Error('Comment not created');
|
|
@@ -27923,9 +27959,16 @@ const createComment = async (bundle, isOptimistic = true) => {
|
|
|
27923
27959
|
* const updated = await CommentRepository.updateComment(commentId, {
|
|
27924
27960
|
* data: { text: 'hello world' }
|
|
27925
27961
|
* })
|
|
27962
|
+
*
|
|
27963
|
+
* // Replace the GIF, or remove it and keep the text
|
|
27964
|
+
* await CommentRepository.updateComment(commentId, {
|
|
27965
|
+
* attachments: [{ type: 'gif', url: 'https://media.giphy.com/media/l0MYt5jPR6QX5pnqM/giphy.gif' }],
|
|
27966
|
+
* })
|
|
27967
|
+
* await CommentRepository.updateComment(commentId, { attachments: [] })
|
|
27926
27968
|
* ```
|
|
27927
27969
|
*
|
|
27928
|
-
* Updates an {@link Amity.Comment}
|
|
27970
|
+
* Updates an {@link Amity.Comment}. `attachments` replaces the current ones, `[]` removes them,
|
|
27971
|
+
* and leaving `attachments` out keeps them as they are.
|
|
27929
27972
|
*
|
|
27930
27973
|
* @param commentId The ID of the {@link Amity.Comment} to edit
|
|
27931
27974
|
* @param patch The patch data to apply
|
|
@@ -27939,7 +27982,10 @@ const updateComment = async (commentId, patch) => {
|
|
|
27939
27982
|
const client = getActiveClient();
|
|
27940
27983
|
client.log('user/updateComment', patch);
|
|
27941
27984
|
const previous = (_a = pullFromCache(['comment', 'get', commentId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
27942
|
-
|
|
27985
|
+
// A GIF is sent with its known keys only; the server refuses `null` and unknown keys.
|
|
27986
|
+
const body = patch.attachments
|
|
27987
|
+
? Object.assign(Object.assign({}, patch), { attachments: toAttachmentsPayload(patch.attachments) }) : patch;
|
|
27988
|
+
const { data: payload } = await client.http.put(`/api/v3/comments/${encodeURIComponent(commentId)}`, body);
|
|
27943
27989
|
const data = prepareCommentPayload(payload);
|
|
27944
27990
|
const updated = data.comments.find(comment => comment.commentId === commentId);
|
|
27945
27991
|
const cachedAt = client.cache && Date.now();
|
|
@@ -28070,13 +28116,13 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
28070
28116
|
permanent,
|
|
28071
28117
|
},
|
|
28072
28118
|
});
|
|
28073
|
-
// to support hard deletion
|
|
28074
|
-
const deleted = Object.assign(Object.assign({}, comment.data), { isDeleted: true });
|
|
28119
|
+
// to support hard deletion; the server empties a deleted comment's attachments
|
|
28120
|
+
const deleted = Object.assign(Object.assign({}, comment.data), { isDeleted: true, attachments: [] });
|
|
28075
28121
|
if (permanent) {
|
|
28076
28122
|
scheduleTask(() => pushToTombstone('comment', commentId));
|
|
28077
28123
|
}
|
|
28078
28124
|
else {
|
|
28079
|
-
upsertInCache(['comment', 'get', commentId], { isDeleted: true });
|
|
28125
|
+
upsertInCache(['comment', 'get', commentId], { isDeleted: true, attachments: [] });
|
|
28080
28126
|
}
|
|
28081
28127
|
if (comment.data.referenceType === 'story') {
|
|
28082
28128
|
const story = await getStoryByStoryId$1(comment.data.referenceId);
|
package/dist/index.esm.js
CHANGED
|
@@ -27743,8 +27743,40 @@ getCommentByIds.locally = (commentIds) => {
|
|
|
27743
27743
|
};
|
|
27744
27744
|
};
|
|
27745
27745
|
|
|
27746
|
+
const GIF_OPTIONAL_KEYS = ['width', 'height'];
|
|
27747
|
+
/*
|
|
27748
|
+
* The server refuses a GIF attachment that carries `null` or any key it does not know, so the
|
|
27749
|
+
* request keeps `type`, `url` and only the optional fields that have a value. The SDK does not
|
|
27750
|
+
* check the values themselves: the server answers 400 for a bad one.
|
|
27751
|
+
*/
|
|
27752
|
+
const toGifAttachmentPayload = (gif) => {
|
|
27753
|
+
const payload = { type: 'gif', url: gif.url };
|
|
27754
|
+
GIF_OPTIONAL_KEYS.forEach(key => {
|
|
27755
|
+
const value = gif[key];
|
|
27756
|
+
if (value !== undefined && value !== null)
|
|
27757
|
+
Object.assign(payload, { [key]: value });
|
|
27758
|
+
});
|
|
27759
|
+
return payload;
|
|
27760
|
+
};
|
|
27761
|
+
/* Builds each GIF from its known keys; every other attachment is sent as the caller gave it. */
|
|
27762
|
+
const toAttachmentsPayload = (attachments) => attachments.map(attachment => attachment.type === 'gif'
|
|
27763
|
+
? toGifAttachmentPayload(attachment)
|
|
27764
|
+
: attachment);
|
|
27765
|
+
|
|
27766
|
+
/*
|
|
27767
|
+
* The data types the server lists for a comment, known before it answers: one per attachment
|
|
27768
|
+
* type, plus `text` when there is text. Sorted, as the server sorts them.
|
|
27769
|
+
*/
|
|
27770
|
+
const commentDataTypesOf = (text, attachments) => {
|
|
27771
|
+
const types = new Set((attachments !== null && attachments !== void 0 ? attachments : []).map(attachment => attachment.type));
|
|
27772
|
+
if (text)
|
|
27773
|
+
types.add('text');
|
|
27774
|
+
return [...types].sort();
|
|
27775
|
+
};
|
|
27776
|
+
|
|
27746
27777
|
const getLocalCommentId = () => uuid();
|
|
27747
27778
|
const createCommentOptimistic = (bundle) => {
|
|
27779
|
+
var _a;
|
|
27748
27780
|
const client = getActiveClient();
|
|
27749
27781
|
if (!client.cache)
|
|
27750
27782
|
return;
|
|
@@ -27779,6 +27811,7 @@ const createCommentOptimistic = (bundle) => {
|
|
|
27779
27811
|
targetId: '',
|
|
27780
27812
|
targetType: 'community',
|
|
27781
27813
|
dataType: 'text',
|
|
27814
|
+
dataTypes: commentDataTypesOf((_a = bundle.data) === null || _a === void 0 ? void 0 : _a.text, bundle.attachments),
|
|
27782
27815
|
syncState: "syncing" /* Amity.SyncState.Syncing */,
|
|
27783
27816
|
// In a gated community the optimistic object stays out of public collections until the
|
|
27784
27817
|
// response settles the status; the author's own view still updates through the local event
|
|
@@ -27825,12 +27858,15 @@ const createCommentOptimistic = (bundle) => {
|
|
|
27825
27858
|
const createComment = async (bundle, isOptimistic = true) => {
|
|
27826
27859
|
const client = getActiveClient();
|
|
27827
27860
|
client.log('comment/createComment', Object.assign(Object.assign({}, bundle), { isOptimistic }));
|
|
27861
|
+
// A GIF is sent with its known keys only; the server refuses `null` and unknown keys.
|
|
27862
|
+
const request = bundle.attachments
|
|
27863
|
+
? Object.assign(Object.assign({}, bundle), { attachments: toAttachmentsPayload(bundle.attachments) }) : bundle;
|
|
27828
27864
|
// Without a local comment the server assigns the id; with one, the same id travels through the
|
|
27829
27865
|
// optimistic object, the response and every realtime event so each step recognises it.
|
|
27830
|
-
const optimisticData = isOptimistic ? createCommentOptimistic(
|
|
27866
|
+
const optimisticData = isOptimistic ? createCommentOptimistic(request) : undefined;
|
|
27831
27867
|
const commentId = optimisticData === null || optimisticData === void 0 ? void 0 : optimisticData.commentId;
|
|
27832
27868
|
try {
|
|
27833
|
-
const { data: payload } = await client.http.post('/api/v3/comments', Object.assign(Object.assign({},
|
|
27869
|
+
const { data: payload } = await client.http.post('/api/v3/comments', Object.assign(Object.assign({}, request), { commentId }));
|
|
27834
27870
|
// BE always returns an array of comments If it got record 0 from BE it might have a problem on creation logic
|
|
27835
27871
|
if (payload.comments.length === 0)
|
|
27836
27872
|
throw new Error('Comment not created');
|
|
@@ -27923,9 +27959,16 @@ const createComment = async (bundle, isOptimistic = true) => {
|
|
|
27923
27959
|
* const updated = await CommentRepository.updateComment(commentId, {
|
|
27924
27960
|
* data: { text: 'hello world' }
|
|
27925
27961
|
* })
|
|
27962
|
+
*
|
|
27963
|
+
* // Replace the GIF, or remove it and keep the text
|
|
27964
|
+
* await CommentRepository.updateComment(commentId, {
|
|
27965
|
+
* attachments: [{ type: 'gif', url: 'https://media.giphy.com/media/l0MYt5jPR6QX5pnqM/giphy.gif' }],
|
|
27966
|
+
* })
|
|
27967
|
+
* await CommentRepository.updateComment(commentId, { attachments: [] })
|
|
27926
27968
|
* ```
|
|
27927
27969
|
*
|
|
27928
|
-
* Updates an {@link Amity.Comment}
|
|
27970
|
+
* Updates an {@link Amity.Comment}. `attachments` replaces the current ones, `[]` removes them,
|
|
27971
|
+
* and leaving `attachments` out keeps them as they are.
|
|
27929
27972
|
*
|
|
27930
27973
|
* @param commentId The ID of the {@link Amity.Comment} to edit
|
|
27931
27974
|
* @param patch The patch data to apply
|
|
@@ -27939,7 +27982,10 @@ const updateComment = async (commentId, patch) => {
|
|
|
27939
27982
|
const client = getActiveClient();
|
|
27940
27983
|
client.log('user/updateComment', patch);
|
|
27941
27984
|
const previous = (_a = pullFromCache(['comment', 'get', commentId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
27942
|
-
|
|
27985
|
+
// A GIF is sent with its known keys only; the server refuses `null` and unknown keys.
|
|
27986
|
+
const body = patch.attachments
|
|
27987
|
+
? Object.assign(Object.assign({}, patch), { attachments: toAttachmentsPayload(patch.attachments) }) : patch;
|
|
27988
|
+
const { data: payload } = await client.http.put(`/api/v3/comments/${encodeURIComponent(commentId)}`, body);
|
|
27943
27989
|
const data = prepareCommentPayload(payload);
|
|
27944
27990
|
const updated = data.comments.find(comment => comment.commentId === commentId);
|
|
27945
27991
|
const cachedAt = client.cache && Date.now();
|
|
@@ -28070,13 +28116,13 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
28070
28116
|
permanent,
|
|
28071
28117
|
},
|
|
28072
28118
|
});
|
|
28073
|
-
// to support hard deletion
|
|
28074
|
-
const deleted = Object.assign(Object.assign({}, comment.data), { isDeleted: true });
|
|
28119
|
+
// to support hard deletion; the server empties a deleted comment's attachments
|
|
28120
|
+
const deleted = Object.assign(Object.assign({}, comment.data), { isDeleted: true, attachments: [] });
|
|
28075
28121
|
if (permanent) {
|
|
28076
28122
|
scheduleTask(() => pushToTombstone('comment', commentId));
|
|
28077
28123
|
}
|
|
28078
28124
|
else {
|
|
28079
|
-
upsertInCache(['comment', 'get', commentId], { isDeleted: true });
|
|
28125
|
+
upsertInCache(['comment', 'get', commentId], { isDeleted: true, attachments: [] });
|
|
28080
28126
|
}
|
|
28081
28127
|
if (comment.data.referenceType === 'story') {
|
|
28082
28128
|
const story = await getStoryByStoryId$1(comment.data.referenceId);
|