@amityco/ts-sdk 7.32.0 → 7.32.1-0c1c3831.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 (44) hide show
  1. package/dist/@types/domains/comment.d.ts +2 -2
  2. package/dist/@types/domains/comment.d.ts.map +1 -1
  3. package/dist/@types/domains/content.d.ts +23 -3
  4. package/dist/@types/domains/content.d.ts.map +1 -1
  5. package/dist/@types/domains/feed.d.ts +4 -1
  6. package/dist/@types/domains/feed.d.ts.map +1 -1
  7. package/dist/@types/domains/post.d.ts +11 -0
  8. package/dist/@types/domains/post.d.ts.map +1 -1
  9. package/dist/commentRepository/api/createComment.d.ts +1 -1
  10. package/dist/commentRepository/api/createComment.d.ts.map +1 -1
  11. package/dist/commentRepository/api/tests/createComment.gif.test.d.ts +2 -0
  12. package/dist/commentRepository/api/tests/createComment.gif.test.d.ts.map +1 -0
  13. package/dist/commentRepository/api/tests/deleteComment.gif.test.d.ts +2 -0
  14. package/dist/commentRepository/api/tests/deleteComment.gif.test.d.ts.map +1 -0
  15. package/dist/commentRepository/api/tests/updateComment.gif.test.d.ts +2 -0
  16. package/dist/commentRepository/api/tests/updateComment.gif.test.d.ts.map +1 -0
  17. package/dist/commentRepository/api/updateComment.d.ts +9 -2
  18. package/dist/commentRepository/api/updateComment.d.ts.map +1 -1
  19. package/dist/commentRepository/observers/tests/getComments.gif.test.d.ts +2 -0
  20. package/dist/commentRepository/observers/tests/getComments.gif.test.d.ts.map +1 -0
  21. package/dist/commentRepository/utils/dataTypes.d.ts +2 -0
  22. package/dist/commentRepository/utils/dataTypes.d.ts.map +1 -0
  23. package/dist/index.cjs.js +81 -40
  24. package/dist/index.esm.js +81 -40
  25. package/dist/index.umd.js +2 -2
  26. package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
  27. package/dist/postRepository/api/createMixedMediaPost.d.ts +6 -6
  28. package/dist/postRepository/api/createMixedMediaPost.d.ts.map +1 -1
  29. package/dist/postRepository/api/createPost.d.ts +1 -4
  30. package/dist/postRepository/api/createPost.d.ts.map +1 -1
  31. package/dist/postRepository/api/editPost.d.ts +4 -5
  32. package/dist/postRepository/api/editPost.d.ts.map +1 -1
  33. package/dist/postRepository/api/tests/gifPost.test.d.ts +2 -0
  34. package/dist/postRepository/api/tests/gifPost.test.d.ts.map +1 -0
  35. package/dist/postRepository/observers/getPosts.d.ts +4 -0
  36. package/dist/postRepository/observers/getPosts.d.ts.map +1 -1
  37. package/dist/postRepository/utils/attachments.d.ts +8 -0
  38. package/dist/postRepository/utils/attachments.d.ts.map +1 -0
  39. package/dist/utils/gifAttachment.d.ts +5 -0
  40. package/dist/utils/gifAttachment.d.ts.map +1 -0
  41. package/dist/utils/postTypePredicate.d.ts +1 -0
  42. package/dist/utils/postTypePredicate.d.ts.map +1 -1
  43. package/dist/utils/tests/dummy/comment.d.ts +1 -1
  44. package/package.json +1 -1
@@ -3,7 +3,7 @@ export declare const getSubChannelMessagePreviewWithUser: (subChannel: Amity.Sub
3
3
  user: Amity.User | undefined;
4
4
  messagePreviewId: string;
5
5
  subChannelName: string;
6
- data?: string | Record<string, unknown> | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataAudio | Amity.ContentDataPoll | Amity.ContentDataStream | Amity.ContentDataClip | Amity.ContentDataRoom | Amity.ContentDataEvent | undefined;
6
+ data?: string | Record<string, unknown> | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataAudio | Amity.ContentDataPoll | Amity.ContentDataStream | Amity.ContentDataClip | Amity.ContentDataRoom | Amity.ContentDataEvent | Amity.ContentDataGif | undefined;
7
7
  dataType?: any;
8
8
  channelId: string;
9
9
  subChannelId: string;
@@ -10,11 +10,14 @@ import { AmityAttachmentProductTags } from '~/productRepository/helpers';
10
10
  * { fileId: "file1", type: "image" },
11
11
  * { fileId: "file2", type: "video" },
12
12
  * { fileId: "file3", type: "audio" },
13
- * { fileId: "file4", type: "file" }
13
+ * { fileId: "file4", type: "file" },
14
+ * { type: "gif", url: "https://media.giphy.com/media/l0MYt5jPR6QX5pnqM/giphy.gif", width: 480, height: 270 }
14
15
  * ],
15
16
  * })
16
17
  * ```
17
18
  *
19
+ * A post holds 1 to 10 attachments. A GIF is a link, not a file, and takes no product tags.
20
+ *
18
21
  * Creates an {@link Amity.Post}
19
22
  *
20
23
  * @param bundle The data necessary to create a new {@link Amity.Post}
@@ -28,10 +31,7 @@ export declare const createMixedMediaPost: (bundle: Pick<Amity.Post, 'targetType
28
31
  text?: string;
29
32
  title?: string;
30
33
  };
31
- attachments: {
32
- type: Amity.MixedMediaPostContentType;
33
- fileId: Amity.File['fileId'];
34
- }[];
35
- attachmentProductTags: AmityAttachmentProductTags;
34
+ attachments: Amity.PostAttachment[];
35
+ attachmentProductTags?: AmityAttachmentProductTags;
36
36
  }) => Promise<Amity.Cached<Amity.Post>>;
37
37
  //# sourceMappingURL=createMixedMediaPost.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createMixedMediaPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/createMixedMediaPost.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAKzE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,oBAAoB,WACvB,KAAK,MAAM,IAAI,EAAE,YAAY,GAAG,UAAU,CAAC,GACjD,QAAQ,KAAK,MAAM,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC,GAAG;IAC3E,IAAI,CAAC,EAAE;QACL,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;QAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;KAAE,EAAE,CAAC;IACvF,qBAAqB,EAAE,0BAA0B,CAAC;CACnD,KACF,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,CAuClC,CAAC"}
1
+ {"version":3,"file":"createMixedMediaPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/createMixedMediaPost.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAMzE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,oBAAoB,WACvB,KAAK,MAAM,IAAI,EAAE,YAAY,GAAG,UAAU,CAAC,GACjD,QAAQ,KAAK,MAAM,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC,GAAG;IAC3E,IAAI,CAAC,EAAE;QACL,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,WAAW,EAAE,MAAM,cAAc,EAAE,CAAC;IACpC,qBAAqB,CAAC,EAAE,0BAA0B,CAAC;CACpD,KACF,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,CA0BlC,CAAC"}
@@ -22,10 +22,7 @@ export declare const createPost: <T extends string>(bundle: Pick<Amity.Post<T>,
22
22
  data?: {
23
23
  [k: string]: any;
24
24
  } | undefined;
25
- attachments?: {
26
- type: T;
27
- fileId: Amity.File['fileId'];
28
- }[] | undefined;
25
+ attachments?: Amity.PostAttachment<T>[] | undefined;
29
26
  links?: Amity.Link[] | undefined;
30
27
  productTags?: Amity.TextProductTag[] | undefined;
31
28
  attachmentProductTags?: AmityAttachmentProductTags | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"createPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/createPost.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAKzE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU;;;;;;;gBAKgB,UAAU,CAAC,QAAQ,CAAC;;;;;MAKxD,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,CA6ClC,CAAC"}
1
+ {"version":3,"file":"createPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/createPost.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAMzE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU;;;;;;;;;MAUpB,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,CAgClC,CAAC"}
@@ -7,7 +7,9 @@ import { AmityAttachmentProductTags } from '~/productRepository/helpers';
7
7
  * })
8
8
  * ```
9
9
  *
10
- * Updates an {@link Amity.Post}
10
+ * Updates an {@link Amity.Post}. `attachments` is the full list to keep: a GIF is matched by its
11
+ * `url`, so send each kept GIF back with its link and size as read from `childrenPosts`; an
12
+ * attachment left out is deleted, `[]` removes them all, and leaving `attachments` out keeps them.
11
13
  *
12
14
  * @param postId The ID of the {@link Amity.Post} to edit
13
15
  * @param patch The patch data to apply
@@ -17,10 +19,7 @@ import { AmityAttachmentProductTags } from '~/productRepository/helpers';
17
19
  * @async
18
20
  */
19
21
  export declare const editPost: <T extends string>(postId: Amity.Post['postId'], patch: Partial<Pick<Amity.Post<any>, "tags" | "metadata" | "data" | "mentionees" | "hashtags">> & {
20
- attachments?: {
21
- type: T;
22
- fileId: Amity.File['fileId'];
23
- }[] | undefined;
22
+ attachments?: Amity.PostAttachment<T>[] | undefined;
24
23
  links?: Amity.Link[] | undefined;
25
24
  productTags?: Amity.TextProductTag[] | undefined;
26
25
  attachmentProductTags?: AmityAttachmentProductTags | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"editPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/editPost.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAKzE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,6BACX,MAAM,IAAI,CAAC,QAAQ,CAAC;;;gBAEO,UAAU,CAAC,QAAQ,CAAC;;;;;MAKtD,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,CA0ClC,CAAC"}
1
+ {"version":3,"file":"editPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/editPost.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAMzE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,QAAQ,6BACX,MAAM,IAAI,CAAC,QAAQ,CAAC;;;;;MAO3B,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,CA6BlC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=gifPost.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gifPost.test.d.ts","sourceRoot":"","sources":["../../../../src/postRepository/api/tests/gifPost.test.ts"],"names":[],"mappings":""}
@@ -11,6 +11,10 @@
11
11
  *
12
12
  * Observe all mutations on a list of {@link Amity.Post} for a given target object
13
13
  *
14
+ * GIF posts come back on every API version. This query is on v5, so `dataTypes: ['gif']` filters
15
+ * them; a post with GIFs beside other media is `mixed` and is hidden unless
16
+ * `includeMixedStructure` is `true`.
17
+ *
14
18
  * @param params.targetType the type of the target
15
19
  * @param params.targetId the ID of the target
16
20
  * @param callback the function to call when new data are available
@@ -1 +1 @@
1
- {"version":3,"file":"getPosts.d.ts","sourceRoot":"","sources":["../../../src/postRepository/observers/getPosts.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,QAAQ,WACX,MAAM,kBAAkB,YACtB,MAAM,sBAAsB,CAAC,MAAM,IAAI,CAAC,WACzC,MAAM,oBAAoB,KAClC,MAAM,YAqBR,CAAC"}
1
+ {"version":3,"file":"getPosts.d.ts","sourceRoot":"","sources":["../../../src/postRepository/observers/getPosts.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,QAAQ,WACX,MAAM,kBAAkB,YACtB,MAAM,sBAAsB,CAAC,MAAM,IAAI,CAAC,WACzC,MAAM,oBAAoB,KAClC,MAAM,YAqBR,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { AmityAttachmentProductTags } from '~/productRepository/helpers';
2
+ declare type WritableAttachment = {
3
+ type: string;
4
+ fileId?: Amity.File['fileId'];
5
+ };
6
+ export declare const preparePostAttachments: <A extends WritableAttachment>(attachments: A[] | undefined, attachmentProductTags?: AmityAttachmentProductTags) => A[] | undefined;
7
+ export {};
8
+ //# sourceMappingURL=attachments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../../src/postRepository/utils/attachments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAGzE,aAAK,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;CAAE,CAAC;AAM1E,eAAO,MAAM,sBAAsB,uFAET,0BAA0B,oBAQhD,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const toGifAttachmentPayload: (gif: Amity.GifAttachment) => Amity.GifAttachment;
2
+ export declare const toAttachmentsPayload: <T extends {
3
+ type: string;
4
+ }>(attachments: T[]) => T[];
5
+ //# sourceMappingURL=gifAttachment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gifAttachment.d.ts","sourceRoot":"","sources":["../../src/utils/gifAttachment.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,sBAAsB,QAAS,MAAM,aAAa,KAAG,MAAM,aASvE,CAAC;AAGF,eAAO,MAAM,oBAAoB;UAAsB,MAAM;2BAK1D,CAAC"}
@@ -7,4 +7,5 @@ export declare function isAmityClipPost(post: Amity.InternalPost): post is Amity
7
7
  export declare function isAmityAudioPost(post: Amity.InternalPost): post is Amity.Post<'audio'>;
8
8
  export declare function isAmityRoomPost(post: Amity.InternalPost): post is Amity.Post<'room'>;
9
9
  export declare function isAmityEventPost(post: Amity.InternalPost): post is Amity.Post<'event'>;
10
+ export declare function isAmityGifPost(post: Amity.InternalPost): post is Amity.Post<'gif'>;
10
11
  //# sourceMappingURL=postTypePredicate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"postTypePredicate.d.ts","sourceRoot":"","sources":["../../src/utils/postTypePredicate.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAOtF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAOpF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAQtF;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAOhG;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAOpF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAOpF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IA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Y,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAOpF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAEtF;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAOlF"}
@@ -25,7 +25,7 @@ export declare const generateComment: (params?: Partial<Amity.InternalComment>)
25
25
  referenceType: Amity.CommentReferenceType;
26
26
  dataType?: any;
27
27
  dataTypes?: any[] | undefined;
28
- data?: string | Record<string, unknown> | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataAudio | Amity.ContentDataPoll | Amity.ContentDataStream | Amity.ContentDataClip | Amity.ContentDataRoom | Amity.ContentDataEvent | undefined;
28
+ data?: string | Record<string, unknown> | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataAudio | Amity.ContentDataPoll | Amity.ContentDataStream | Amity.ContentDataClip | Amity.ContentDataRoom | Amity.ContentDataEvent | Amity.ContentDataGif | undefined;
29
29
  metadata?: Record<string, any> | undefined;
30
30
  flagCount: number;
31
31
  hashFlag: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "7.32.0",
3
+ "version": "7.32.1-0c1c3831.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",