@amityco/ts-sdk-react-native 7.6.1-f7cc558.0 → 7.7.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/@types/core/payload.d.ts +1 -1
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/content.d.ts +8 -2
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/@types/domains/feed.d.ts +2 -1
- package/dist/@types/domains/feed.d.ts.map +1 -1
- package/dist/@types/domains/file.d.ts +3 -1
- package/dist/@types/domains/file.d.ts.map +1 -1
- package/dist/@types/domains/post.d.ts +3 -0
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
- package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts +1 -1
- package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts.map +1 -1
- package/dist/feedRepository/api/queryGlobalFeed.d.ts.map +1 -1
- package/dist/fileRepository/api/index.d.ts +1 -0
- package/dist/fileRepository/api/index.d.ts.map +1 -1
- package/dist/fileRepository/api/uploadClip.d.ts +17 -0
- package/dist/fileRepository/api/uploadClip.d.ts.map +1 -0
- package/dist/index.cjs.js +116 -14
- package/dist/index.esm.js +116 -14
- package/dist/index.umd.js +2 -2
- package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
- package/dist/postRepository/api/createClipPost.d.ts +32 -0
- package/dist/postRepository/api/createClipPost.d.ts.map +1 -0
- package/dist/postRepository/api/index.d.ts +1 -0
- package/dist/postRepository/api/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
- package/dist/utils/postTypePredicate.d.ts +1 -0
- package/dist/utils/postTypePredicate.d.ts.map +1 -1
- package/dist/utils/tests/dummy/comment.d.ts +1 -1
- package/package.json +1 -1
- package/src/@types/core/payload.ts +1 -1
- package/src/@types/domains/content.ts +10 -0
- package/src/@types/domains/feed.ts +2 -1
- package/src/@types/domains/file.ts +5 -0
- package/src/@types/domains/post.ts +4 -0
- package/src/communityRepository/api/getCommunity.ts +0 -9
- package/src/feedRepository/api/getCustomRankingGlobalFeed.ts +1 -1
- package/src/feedRepository/api/queryGlobalFeed.ts +3 -1
- package/src/fileRepository/api/index.ts +1 -0
- package/src/fileRepository/api/uploadClip.ts +71 -0
- package/src/postRepository/api/createClipPost.ts +62 -0
- package/src/postRepository/api/index.ts +2 -0
- package/src/postRepository/api/queryPosts.ts +1 -1
- package/src/postRepository/observers/getPosts/PostPaginationController.ts +1 -1
- package/src/utils/linkedObject/postLinkedObject.ts +12 -1
- package/src/utils/postTypePredicate.ts +9 -0
package/dist/index.esm.js
CHANGED
|
@@ -21,6 +21,7 @@ const FileType = Object.freeze({
|
|
|
21
21
|
FILE: 'file',
|
|
22
22
|
IMAGE: 'image',
|
|
23
23
|
VIDEO: 'video',
|
|
24
|
+
CLIP: 'clip',
|
|
24
25
|
});
|
|
25
26
|
const VideoResolution = Object.freeze({
|
|
26
27
|
'1080P': '1080p',
|
|
@@ -104,6 +105,7 @@ const PostContentType = Object.freeze({
|
|
|
104
105
|
VIDEO: 'video',
|
|
105
106
|
LIVESTREAM: 'liveStream',
|
|
106
107
|
POLL: 'poll',
|
|
108
|
+
CLIP: 'clip',
|
|
107
109
|
});
|
|
108
110
|
|
|
109
111
|
var InvitationTypeEnum;
|
|
@@ -139,8 +141,8 @@ var JoinResultStatusEnum;
|
|
|
139
141
|
|
|
140
142
|
function getVersion() {
|
|
141
143
|
try {
|
|
142
|
-
// the string ''v7.
|
|
143
|
-
return 'v7.
|
|
144
|
+
// the string ''v7.7.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
145
|
+
return 'v7.7.0-esm';
|
|
144
146
|
}
|
|
145
147
|
catch (error) {
|
|
146
148
|
return '__dev__';
|
|
@@ -22841,6 +22843,12 @@ function isAmityVideoPost(post) {
|
|
|
22841
22843
|
'videoFileId' in post.data &&
|
|
22842
22844
|
'thumbnailFileId' in post.data &&
|
|
22843
22845
|
post.dataType === 'video');
|
|
22846
|
+
}
|
|
22847
|
+
function isAmityClipPost(post) {
|
|
22848
|
+
return !!(post.data &&
|
|
22849
|
+
typeof post.data !== 'string' &&
|
|
22850
|
+
'fileId' in post.data &&
|
|
22851
|
+
post.dataType === 'clip');
|
|
22844
22852
|
}
|
|
22845
22853
|
|
|
22846
22854
|
const postLinkedObject = (post) => {
|
|
@@ -22895,6 +22903,12 @@ const postLinkedObject = (post) => {
|
|
|
22895
22903
|
return isAmityFilePost(post)
|
|
22896
22904
|
? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
|
|
22897
22905
|
: undefined;
|
|
22906
|
+
},
|
|
22907
|
+
getClipInfo() {
|
|
22908
|
+
var _a, _b;
|
|
22909
|
+
return isAmityClipPost(post)
|
|
22910
|
+
? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
|
|
22911
|
+
: undefined;
|
|
22898
22912
|
} });
|
|
22899
22913
|
};
|
|
22900
22914
|
|
|
@@ -30154,6 +30168,57 @@ const updateAltText = async (fileId, altText) => {
|
|
|
30154
30168
|
};
|
|
30155
30169
|
/* end_public_function */
|
|
30156
30170
|
|
|
30171
|
+
/* begin_public_function
|
|
30172
|
+
id: file.upload.clip
|
|
30173
|
+
*/
|
|
30174
|
+
/**
|
|
30175
|
+
* ```js
|
|
30176
|
+
* import { FileRepository } from '@amityco/ts-sdk'
|
|
30177
|
+
* const created = await FileRepository.uploadClip(formData)
|
|
30178
|
+
* ```
|
|
30179
|
+
*
|
|
30180
|
+
* Creates an {@link Amity.File}
|
|
30181
|
+
*
|
|
30182
|
+
* @param formData The data necessary to create a new {@link Amity.File}
|
|
30183
|
+
* @param onProgress The callback to track the upload progress
|
|
30184
|
+
* @returns The newly created {@link Amity.File}
|
|
30185
|
+
*
|
|
30186
|
+
* @category File API
|
|
30187
|
+
* @async
|
|
30188
|
+
*/
|
|
30189
|
+
const uploadClip = async (formData, feedType, onProgress) => {
|
|
30190
|
+
const client = getActiveClient();
|
|
30191
|
+
client.log('file/uploadClip', formData);
|
|
30192
|
+
const file = formData.get('files');
|
|
30193
|
+
if (!file)
|
|
30194
|
+
throw new Error('The formData object must have a `files` key.');
|
|
30195
|
+
const accessType = GlobalFileAccessType$1.getInstance().getFileAccessType();
|
|
30196
|
+
formData.append('accessType', accessType);
|
|
30197
|
+
formData.append('preferredFilename', file.name);
|
|
30198
|
+
if (feedType) {
|
|
30199
|
+
formData.append('feedType', feedType);
|
|
30200
|
+
}
|
|
30201
|
+
const headers = 'getHeaders' in formData
|
|
30202
|
+
? formData.getHeaders()
|
|
30203
|
+
: { 'content-type': 'multipart/form-data' };
|
|
30204
|
+
const { data } = await client.upload.post('/api/v4/clips', formData, {
|
|
30205
|
+
headers,
|
|
30206
|
+
onUploadProgress({ loaded, total = 100 }) {
|
|
30207
|
+
onProgress && onProgress(Math.round((loaded * 100) / total));
|
|
30208
|
+
},
|
|
30209
|
+
});
|
|
30210
|
+
// API-FIX: payload should be serialized properly
|
|
30211
|
+
// const { files } = data
|
|
30212
|
+
const cachedAt = client.cache && Date.now();
|
|
30213
|
+
if (client.cache)
|
|
30214
|
+
ingestInCache({ files: data }, { cachedAt });
|
|
30215
|
+
return {
|
|
30216
|
+
data,
|
|
30217
|
+
cachedAt,
|
|
30218
|
+
};
|
|
30219
|
+
};
|
|
30220
|
+
/* end_public_function */
|
|
30221
|
+
|
|
30157
30222
|
var index$k = /*#__PURE__*/Object.freeze({
|
|
30158
30223
|
__proto__: null,
|
|
30159
30224
|
getFile: getFile,
|
|
@@ -30162,7 +30227,8 @@ var index$k = /*#__PURE__*/Object.freeze({
|
|
|
30162
30227
|
fileUrlWithSize: fileUrlWithSize,
|
|
30163
30228
|
uploadVideo: uploadVideo,
|
|
30164
30229
|
uploadImage: uploadImage,
|
|
30165
|
-
updateAltText: updateAltText
|
|
30230
|
+
updateAltText: updateAltText,
|
|
30231
|
+
uploadClip: uploadClip
|
|
30166
30232
|
});
|
|
30167
30233
|
|
|
30168
30234
|
/**
|
|
@@ -36030,16 +36096,11 @@ const updateCommunity = async (communityId, patch) => {
|
|
|
36030
36096
|
* @category Community API
|
|
36031
36097
|
* @async
|
|
36032
36098
|
*/
|
|
36033
|
-
const getCommunity$1 = async (communityId
|
|
36099
|
+
const getCommunity$1 = async (communityId) => {
|
|
36034
36100
|
const client = getActiveClient();
|
|
36035
36101
|
client.log('community/getCommunity', communityId);
|
|
36036
36102
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
36037
|
-
const { data: payload } = await client.http.get(`/api/v3/communities/${communityId}
|
|
36038
|
-
params: {
|
|
36039
|
-
type: 'communityJoinRequest',
|
|
36040
|
-
includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity !== null && includeDiscoverablePrivateCommunity !== void 0 ? includeDiscoverablePrivateCommunity : true,
|
|
36041
|
-
},
|
|
36042
|
-
});
|
|
36103
|
+
const { data: payload } = await client.http.get(`/api/v3/communities/${communityId}`);
|
|
36043
36104
|
const data = prepareCommunityPayload(payload);
|
|
36044
36105
|
const cachedAt = client.cache && Date.now();
|
|
36045
36106
|
if (client.cache) {
|
|
@@ -38763,14 +38824,14 @@ var index$a = /*#__PURE__*/Object.freeze({
|
|
|
38763
38824
|
const queryGlobalFeed = async (query) => {
|
|
38764
38825
|
const client = getActiveClient();
|
|
38765
38826
|
client.log('feed/queryGlobalFeed', query);
|
|
38766
|
-
const _a = query !== null && query !== void 0 ? query : {}, { queryToken } = _a, params = __rest(_a, ["queryToken"]);
|
|
38827
|
+
const _a = query !== null && query !== void 0 ? query : {}, { queryToken, dataTypes, resolveParent } = _a, params = __rest(_a, ["queryToken", "dataTypes", "resolveParent"]);
|
|
38767
38828
|
const options = (() => {
|
|
38768
38829
|
if (queryToken)
|
|
38769
38830
|
return { token: queryToken };
|
|
38770
38831
|
return undefined;
|
|
38771
38832
|
})();
|
|
38772
38833
|
const { data: queryPayload } = await client.http.get(`/api/v4/me/global-feeds`, {
|
|
38773
|
-
params: Object.assign(Object.assign({}, params), { options }),
|
|
38834
|
+
params: Object.assign(Object.assign({}, params), { dataTypes, resolveParent: resolveParent !== null && resolveParent !== void 0 ? resolveParent : true, options }),
|
|
38774
38835
|
});
|
|
38775
38836
|
const { paging } = queryPayload, payload = __rest(queryPayload, ["paging"]);
|
|
38776
38837
|
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
@@ -39356,6 +39417,46 @@ const isPostFlaggedByMe = async (postId) => {
|
|
|
39356
39417
|
};
|
|
39357
39418
|
/* end_public_function */
|
|
39358
39419
|
|
|
39420
|
+
/* begin_public_function
|
|
39421
|
+
id: post.create.clip_post
|
|
39422
|
+
*/
|
|
39423
|
+
/**
|
|
39424
|
+
* ```js
|
|
39425
|
+
* import { PostRepository } from '@amityco/ts-sdk'
|
|
39426
|
+
* const created = await PostRepository.createClipPost({
|
|
39427
|
+
* targetType: 'user',
|
|
39428
|
+
* targetId: 'foobar',
|
|
39429
|
+
* dataType: 'clip',
|
|
39430
|
+
* data: { text: 'hello world' },
|
|
39431
|
+
* attachments: [{ type: 'clip', fileId: 'fileId123', displayMode: 'fill', isMuted: false }]
|
|
39432
|
+
* }))
|
|
39433
|
+
* ```
|
|
39434
|
+
*
|
|
39435
|
+
* Creates an {@link Amity.Post}
|
|
39436
|
+
*
|
|
39437
|
+
* @param bundle The data necessary to create a new {@link Amity.Post}
|
|
39438
|
+
* @returns The newly created {@link Amity.Post}
|
|
39439
|
+
*
|
|
39440
|
+
* @category Post API
|
|
39441
|
+
* @async
|
|
39442
|
+
*/
|
|
39443
|
+
const createClipPost = async (bundle) => {
|
|
39444
|
+
const client = getActiveClient();
|
|
39445
|
+
client.log('post/createPost', bundle);
|
|
39446
|
+
const { data: payload } = await client.http.post('/api/v4/posts', bundle);
|
|
39447
|
+
fireEvent('post.created', payload);
|
|
39448
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
39449
|
+
const cachedAt = client.cache && Date.now();
|
|
39450
|
+
if (client.cache)
|
|
39451
|
+
ingestInCache(data, { cachedAt });
|
|
39452
|
+
const { posts } = data;
|
|
39453
|
+
return {
|
|
39454
|
+
data: LinkedObject.post(posts[0]),
|
|
39455
|
+
cachedAt,
|
|
39456
|
+
};
|
|
39457
|
+
};
|
|
39458
|
+
/* end_public_function */
|
|
39459
|
+
|
|
39359
39460
|
/* begin_public_function
|
|
39360
39461
|
id: comment.get_by_ids
|
|
39361
39462
|
*/
|
|
@@ -40444,7 +40545,7 @@ class PostPaginationController extends PaginationController {
|
|
|
40444
40545
|
type: params.sortBy || queryParams.limit ? 'pagination' : undefined,
|
|
40445
40546
|
};
|
|
40446
40547
|
const options = token ? Object.assign(Object.assign({}, baseOptions), { token }) : Object.assign(Object.assign({}, baseOptions), { limit });
|
|
40447
|
-
const { data: queryResponse } = await this.http.get(`/api/
|
|
40548
|
+
const { data: queryResponse } = await this.http.get(`/api/v5/posts`, {
|
|
40448
40549
|
params: Object.assign(Object.assign({}, params), { isDeleted: inferIsDeleted(includeDeleted),
|
|
40449
40550
|
/*
|
|
40450
40551
|
* when creating post like image, file, video BE will create 2 posts
|
|
@@ -41256,6 +41357,7 @@ var index$7 = /*#__PURE__*/Object.freeze({
|
|
|
41256
41357
|
flagPost: flagPost,
|
|
41257
41358
|
unflagPost: unflagPost,
|
|
41258
41359
|
isPostFlaggedByMe: isPostFlaggedByMe,
|
|
41360
|
+
createClipPost: createClipPost,
|
|
41259
41361
|
onPostCreated: onPostCreated,
|
|
41260
41362
|
onPostUpdated: onPostUpdated,
|
|
41261
41363
|
onPostDeleted: onPostDeleted,
|
|
@@ -42070,7 +42172,7 @@ var index$5 = /*#__PURE__*/Object.freeze({
|
|
|
42070
42172
|
getPoll: getPoll
|
|
42071
42173
|
});
|
|
42072
42174
|
|
|
42073
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
42175
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHo80SecH7FuF2\nhFYnb+l26/VN8UMLXAQFLnxciNTEwkGVFMpdezlH8rU2HtUJL4RETogbAOLVY0XM\njs6sPn8G1nALmh9qeDpUtVqFOVtBHxEZ910TLOtQiunjqJKO5nWdqZ71EC3OFluR\niGQkO84BiIFbv37ub7xl3S8XarbtKoLcyVpkDHi+1wx1pgCAn6gtBUgckPL5NR8j\nLseabl3HAXQfhTCKo4tmOFM2Dxwl1IUMmIJrJg/aIU/U0tj/1Eoo7mG0JcNWX19l\nW3EecCbi0ncCJOrkUdwlBrcjaMayaX/ubEwyUeTGiLdyc4L3GRLHjyK8xgVNXRMH\nbZWJ2a5NAgMBAAECggEASxuE+35zTFO/XydKgmvIGcWL9FbgMlXb7Vcf0nBoG945\nbiz0NVc2paraIhJXc608xbYF3qLmtAE1MVBI0ORyRdBHNxY024l/6H6SH60Ed+uI\nM4ysp5ourY6Vj+DLwpdRiI9YDjqYAQDIUmhNxJP7XPhOMoZI6st+xZQBM34ic/bv\nAMSJm9OZphSp3+qXVkFZztr2mxD2EZSJJLYxi8BCdgM2qhazalbcJ6zDKHCZWVWm\n8RRxDGldyMb/237JxETzP40tAlzOZDmBAbUgEnurDJ93RVDIE3rbZUshwgeQd18a\nem096mWgvB1AIKYgsTAR3pw+V19YWAjq/glP6fz8wQKBgQD/oQq+ukKF0PRgBeM5\ngeTjSwsdGppQLmf5ndujvoiz/TpdjDEPu6R8kigQr1rG2t4K/yfdZoI8RdmJD1al\n3Q7N9hofooSy4rj6E3txzWZCHJjHad2cnCp/O26HiReGAl7wTcfTmNdiFHhZQzm5\nJBkvWAiwuvQMNfEbnXxw6/vIDwKBgQDH7fX8gsc77JLvAWgp1MaQN/sbqVb6JeT1\nFQfR8E/WFCSmzQBtNzd5KgYuCeelwr/8DyYytvN2BzCYZXp73gI1jF3YlW5jVn74\nOY6TwQ095digwo6Z0yuxopdIOApKgAkL9PRKgNrqAf3NAyMua6lOGifzjDojC3KU\nfylQmxMn4wKBgHp2B9O/H0dEBw5JQ8W0+JX6yWQz7mEjGiR2/1W+XXb8hQ1zr709\nw1r6Gb+EghRpnZ3fBpYGGbYOMFx8wKHM+N6qW3F0ReX8v2juFGE8aRSa5oYBrWzt\nU16Idjbv8hj84cZ1PJmdyvDtpYn9rpWHOZl4rxEbPvbqkIsOMyNVqdT5AoGAOSge\nmwIIU2le2FVeohbibXiToWTYKMuMmURZ5/r72AgKMmWJKbAPe+Q3wBG01/7FRBpQ\noU8Ma0HC8s6QJbliiEyIx9JwrJWd1vkdecBHONrtA4ibm/5zD2WcOllLF+FitLhi\n3qnX6+6F0IaFGFBPJrTzlv0P4dTz/OAdv52V7GECgYEA2TttOKBAqWllgOaZOkql\nLVMJVmgR7s6tLi1+cEP8ZcapV9aRbRzTAKXm4f8AEhtlG9F9kCOvHYCYGi6JaiWJ\nZkHjeex3T+eE6Di6y5Bm/Ift5jtVhJ4jCVwHOKTMej79NPUFTJfv8hCo29haBDv6\nRXFrv+T21KCcw8k3sJeJWWQ=\n-----END PRIVATE KEY-----";
|
|
42074
42176
|
/*
|
|
42075
42177
|
* The crypto algorithm used for importing key and signing string
|
|
42076
42178
|
*/
|