@amityco/ts-sdk 0.0.1-2a2e88c.0 → 0.0.1-2b186ff.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.
@@ -11,6 +11,7 @@ declare global {
11
11
  childrenNumber: number;
12
12
  children: Comment['commentId'][];
13
13
  segmentNumber: number;
14
+ editedAt: Amity.timestamp;
14
15
  } & Amity.Relationship<CommentReferenceType> & Amity.Content<T> & Amity.Metadata & Amity.Flaggable & Amity.Reactable & Amity.Timestamps & Amity.SoftDelete & Amity.Subscribable & Amity.Mentionable<'user'>;
15
16
  }
16
17
  }
@@ -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,KAAK,kBAAkB,GAAG,MAAM,CAAC;QACjC,KAAK,oBAAoB,GAAG,SAAS,GAAG,MAAM,CAAC;QAE/C,KAAK,OAAO,CAAC,CAAC,SAAS,kBAAkB,GAAG,GAAG,IAAI;YACjD,SAAS,EAAE,MAAM,CAAC;YAClB,MAAM,EAAE,MAAM,CAAC;YACf,QAAQ,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;YAChC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;YAC7B,cAAc,EAAE,MAAM,CAAC;YACvB,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YACjC,aAAa,EAAE,MAAM,CAAC;SACvB,GAAG,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,GAC1C,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAChB,KAAK,CAAC,QAAQ,GACd,KAAK,CAAC,SAAS,GACf,KAAK,CAAC,SAAS,GACf,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,YAAY,GAClB,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;KAC7B;CACF"}
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,KAAK,kBAAkB,GAAG,MAAM,CAAC;QACjC,KAAK,oBAAoB,GAAG,SAAS,GAAG,MAAM,CAAC;QAE/C,KAAK,OAAO,CAAC,CAAC,SAAS,kBAAkB,GAAG,GAAG,IAAI;YACjD,SAAS,EAAE,MAAM,CAAC;YAClB,MAAM,EAAE,MAAM,CAAC;YACf,QAAQ,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;YAChC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;YAC7B,cAAc,EAAE,MAAM,CAAC;YACvB,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YACjC,aAAa,EAAE,MAAM,CAAC;YACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;SAC3B,GAAG,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,GAC1C,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAChB,KAAK,CAAC,QAAQ,GACd,KAAK,CAAC,SAAS,GACf,KAAK,CAAC,SAAS,GACf,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,YAAY,GAClB,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;KAC7B;CACF"}
@@ -19,6 +19,8 @@ export declare const queryChannels: {
19
19
  membership?: "all" | "member" | "notMember" | undefined;
20
20
  sortBy?: "displayName" | "firstCreated" | "lastCreated" | undefined;
21
21
  types?: Amity.ChannelType | undefined;
22
+ tags?: Amity.Taggable['tags'];
23
+ excludeTags?: Amity.Taggable['tags'];
22
24
  page?: Amity.Page | undefined;
23
25
  } | undefined): Promise<Amity.Cached<Amity.Paged<Amity.Channel>>>;
24
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"queryChannels.d.ts","sourceRoot":"","sources":["../../../src/channel/api/queryChannels.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa;;;;;;;oBAMtB,QAAQ,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC;IA8CrD;;;;;;;;;;;;OAYG;mBAC6B,WAAW,oBAAoB,CAAC,CAAC,CAAC,CAAC;CAflE,CAAC"}
1
+ {"version":3,"file":"queryChannels.d.ts","sourceRoot":"","sources":["../../../src/channel/api/queryChannels.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa;;;;;;eAKjB,MAAM,QAAQ,CAAC,MAAM,CAAC;sBACf,MAAM,QAAQ,CAAC,MAAM,CAAC;;oBAElC,QAAQ,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC;IA8CrD;;;;;;;;;;;;OAYG;mBAC6B,WAAW,oBAAoB,CAAC,CAAC,CAAC,CAAC;CAflE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/core/subscription.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC,oBAAY,kBAAkB;IAC5B,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,gBAAgB,qBAAqB;IACrC,IAAI,SAAS;CACd;AAkBD,eAAO,MAAM,iBAAiB,aAClB,MAAM,YAAY,UACrB,QAAQ,kBAAkB,EAAE,mBAAmB,IAAI,CAAC,KAC1D,MAA4C,CAAC;AAEhD,eAAO,MAAM,YAAY,aACb,MAAM,YAAY,UACrB,QAAQ,kBAAkB,EAAE,mBAAmB,SAAS,CAAC,KAC/D,MAMA,CAAC;AAEJ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,IAAI,CAAC,GACzC,KAAK,CAAC,YAAY,CAapB"}
package/dist/index.cjs.js CHANGED
@@ -21,7 +21,9 @@ var AsyncStorage__default = /*#__PURE__*/_interopDefaultLegacy(AsyncStorage);
21
21
 
22
22
  var _a$1;
23
23
  /* eslint-disable no-undef */
24
- const theGlobal = globalThis || global || window;
24
+ const theGlobal =
25
+ // eslint-disable-next-line no-nested-ternary
26
+ typeof globalThis === 'object' ? globalThis : typeof global === 'object' ? global : window;
25
27
  const { process: safeProcess = {} } = theGlobal;
26
28
  const isProduction = ((_a$1 = safeProcess.env) === null || _a$1 === void 0 ? void 0 : _a$1.NODE_ENV) === 'production';
27
29
 
@@ -15155,9 +15157,7 @@ const getCommunityUserTopic = (path, level) => {
15155
15157
  }
15156
15158
  };
15157
15159
  const getCommunityTopic = ({ path }, level = exports.SubscriptionLevels.COMMUNITY) => getCommunityUserTopic(path, level);
15158
- const getUserTopic = ({ path }, level = exports.SubscriptionLevels.USER) => getCommunityUserTopic(level === exports.SubscriptionLevels.USER
15159
- ? path
15160
- : path.replace(/^(?<networkId>\w*)/, '$<networkId>/social'), level);
15160
+ const getUserTopic = ({ path }, level = exports.SubscriptionLevels.USER) => getCommunityUserTopic(level === exports.SubscriptionLevels.USER ? path : path.replace(/^(\w*)/, '$1/social'), level);
15161
15161
  const getPostTopic = ({ path }, level = exports.SubscriptionLevels.POST) => {
15162
15162
  switch (level) {
15163
15163
  case 'comment':
@@ -20850,6 +20850,35 @@ const deletePoll = async (pollId) => {
20850
20850
  return success;
20851
20851
  };
20852
20852
 
20853
+ /**
20854
+ * ```js
20855
+ * import { votePoll } from '@amityco/ts-sdk'
20856
+ * const voted = await votePoll(pollId)
20857
+ * ```
20858
+ *
20859
+ * Votes for an {@link Amity.Poll}
20860
+ *
20861
+ * @param pollId The ID of the {@link Amity.Poll} to vote
20862
+ * @param answerIds The IDs of the {@link Amity.Poll} answers to vote {@link Amity.Poll}
20863
+ * @returns the updated {@link Amity.Poll} object
20864
+ *
20865
+ * @category Poll API
20866
+ * @async
20867
+ */
20868
+ const votePoll = async (pollId, answerIds) => {
20869
+ const client = getActiveClient();
20870
+ client.log('user/votePoll', pollId);
20871
+ const { data } = await client.http.post(`/api/v3/polls/${encodeURIComponent(pollId)}/votes`, { pollId, answerIds });
20872
+ const cachedAt = client.cache && Date.now();
20873
+ if (client.cache)
20874
+ ingestInCache(data, { cachedAt });
20875
+ const { polls } = data;
20876
+ return {
20877
+ data: polls.find(poll => poll.pollId === pollId),
20878
+ cachedAt,
20879
+ };
20880
+ };
20881
+
20853
20882
  /**
20854
20883
  * ```js
20855
20884
  * import { getStream } from '@amityco/ts-sdk'
@@ -21338,4 +21367,5 @@ exports.updatePost = updatePost;
21338
21367
  exports.updateStream = updateStream;
21339
21368
  exports.updateUser = updateUser;
21340
21369
  exports.upsertInCache = upsertInCache;
21370
+ exports.votePoll = votePoll;
21341
21371
  exports.wipeCache = wipeCache;
package/dist/index.esm.js CHANGED
@@ -8,7 +8,9 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
8
8
 
9
9
  var _a$1;
10
10
  /* eslint-disable no-undef */
11
- const theGlobal = globalThis || global || window;
11
+ const theGlobal =
12
+ // eslint-disable-next-line no-nested-ternary
13
+ typeof globalThis === 'object' ? globalThis : typeof global === 'object' ? global : window;
12
14
  const { process: safeProcess = {} } = theGlobal;
13
15
  const isProduction = ((_a$1 = safeProcess.env) === null || _a$1 === void 0 ? void 0 : _a$1.NODE_ENV) === 'production';
14
16
 
@@ -15142,9 +15144,7 @@ const getCommunityUserTopic = (path, level) => {
15142
15144
  }
15143
15145
  };
15144
15146
  const getCommunityTopic = ({ path }, level = SubscriptionLevels.COMMUNITY) => getCommunityUserTopic(path, level);
15145
- const getUserTopic = ({ path }, level = SubscriptionLevels.USER) => getCommunityUserTopic(level === SubscriptionLevels.USER
15146
- ? path
15147
- : path.replace(/^(?<networkId>\w*)/, '$<networkId>/social'), level);
15147
+ const getUserTopic = ({ path }, level = SubscriptionLevels.USER) => getCommunityUserTopic(level === SubscriptionLevels.USER ? path : path.replace(/^(\w*)/, '$1/social'), level);
15148
15148
  const getPostTopic = ({ path }, level = SubscriptionLevels.POST) => {
15149
15149
  switch (level) {
15150
15150
  case 'comment':
@@ -20837,6 +20837,35 @@ const deletePoll = async (pollId) => {
20837
20837
  return success;
20838
20838
  };
20839
20839
 
20840
+ /**
20841
+ * ```js
20842
+ * import { votePoll } from '@amityco/ts-sdk'
20843
+ * const voted = await votePoll(pollId)
20844
+ * ```
20845
+ *
20846
+ * Votes for an {@link Amity.Poll}
20847
+ *
20848
+ * @param pollId The ID of the {@link Amity.Poll} to vote
20849
+ * @param answerIds The IDs of the {@link Amity.Poll} answers to vote {@link Amity.Poll}
20850
+ * @returns the updated {@link Amity.Poll} object
20851
+ *
20852
+ * @category Poll API
20853
+ * @async
20854
+ */
20855
+ const votePoll = async (pollId, answerIds) => {
20856
+ const client = getActiveClient();
20857
+ client.log('user/votePoll', pollId);
20858
+ const { data } = await client.http.post(`/api/v3/polls/${encodeURIComponent(pollId)}/votes`, { pollId, answerIds });
20859
+ const cachedAt = client.cache && Date.now();
20860
+ if (client.cache)
20861
+ ingestInCache(data, { cachedAt });
20862
+ const { polls } = data;
20863
+ return {
20864
+ data: polls.find(poll => poll.pollId === pollId),
20865
+ cachedAt,
20866
+ };
20867
+ };
20868
+
20840
20869
  /**
20841
20870
  * ```js
20842
20871
  * import { getStream } from '@amityco/ts-sdk'
@@ -21130,4 +21159,4 @@ const onStreamRecorded = (callback) => {
21130
21159
  return createEventSubscriber(client, 'stream/onStreamRecorded', 'video-streaming.didRecord', filter);
21131
21160
  };
21132
21161
 
21133
- export { API_REGIONS, SubscriptionLevels, VERSION$1 as VERSION, acceptFollower, addChannelMembers, addChannelMembersRole, addCommunityMembers, addCommunityMembersRoles, addReaction, backupCache, closePoll, connectClient, createChannel, createClient, createComment, createCommunity, createFile, createMessage, createPoll, createPost, createQuery, createReport, createStream, createVideo, declineFollower, deleteChannel, deleteComment, deleteCommunity, deleteFile, deleteMessage, deletePoll, deletePost, deleteReport, deleteStream, disableCache, disconnectClient, disposeStream, dropFromCache, enableCache, fileUrlWithSize, filterByPropEquality, follow, getActiveClient, getCategory, getChannel, getChannels, getComment, getCommentTopic, getComments, getCommunities, getCommunity, getCommunityTopic, getFile, getFollowInfo, getMessage, getMessages, getMyFollowersTopic, getMyFollowingsTopic, getPoll, getPost, getPostTopic, getPosts, getRecommendedCommunities, getRole, getStream, getTopTrendingCommunities, getUser, getUserTopic, getUsers, isAfterBefore, isAfterBeforeRaw, isCachable, isConnected, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkipLimit, joinChannel, joinCommunity, leaveChannel, leaveCommunity, mergeInCache, observeChannel, observeComment, observeComments, observeCommunity, observeFile, observeFollowInfo, observeFollowers, observeFollowings, observeMessage, observeMessages, observePost, observePosts, observeUser, onChannelDeleted, onChannelJoined, onChannelLeft, onChannelUpdated, onClientBanned, onClientDisconnected, onCommentCreated, onCommentDeleted, onCommentFlagged, onCommentReactionAdded, onCommentReactionRemoved, onCommentUnflagged, onCommentUpdated, onCommunityCreated, onCommunityDeleted, onCommunityJoined, onCommunityLeft, onCommunityUpdated, onCommunityUserAdded, onCommunityUserBanned, onCommunityUserRemoved, onCommunityUserUnbanned, onConnectionError, onFollowInfoUpdated, onFollowRequestAccepted, onFollowRequestCanceled, onFollowRequestDeclined, onFollowerDeleted, onFollowerRequested, onMemberAdded, onMemberRemoved, onMessageCreated, onMessageDeleted, onMessageUpdated, onPostApproved, onPostCreated, onPostDeclined, onPostDeleted, onPostFlagged, onPostReactionAdded, onPostReactionRemoved, onPostUnflagged, onPostUpdated, onReactionRemoved, onStreamRecorded, onStreamStarted, onStreamStopped, onUserFlagCleared, onUserFlagged, onUserFollowed, onUserUnflagged, onUserUnfollowed, onUserUpdated, pullFromCache, pushToCache, queryCache, queryCategories, queryChannelMembers, queryChannels, queryComments, queryCommunities, queryCommunityMembers, queryFollowers, queryFollowings, queryGlobalFeed, queryMessages, queryOptions, queryPosts, queryRoles, queryStreams, queryUsers, removeChannelMembers, removeChannelMembersRole, removeCommunityMembers, removeCommunityMembersRoles, removeReaction, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByLastActivity, sortByLastCreated, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, unfollow, updateChannel, updateComment, updateCommunity, updateMessage, updatePost, updateStream, updateUser, upsertInCache, wipeCache };
21162
+ export { API_REGIONS, SubscriptionLevels, VERSION$1 as VERSION, acceptFollower, addChannelMembers, addChannelMembersRole, addCommunityMembers, addCommunityMembersRoles, addReaction, backupCache, closePoll, connectClient, createChannel, createClient, createComment, createCommunity, createFile, createMessage, createPoll, createPost, createQuery, createReport, createStream, createVideo, declineFollower, deleteChannel, deleteComment, deleteCommunity, deleteFile, deleteMessage, deletePoll, deletePost, deleteReport, deleteStream, disableCache, disconnectClient, disposeStream, dropFromCache, enableCache, fileUrlWithSize, filterByPropEquality, follow, getActiveClient, getCategory, getChannel, getChannels, getComment, getCommentTopic, getComments, getCommunities, getCommunity, getCommunityTopic, getFile, getFollowInfo, getMessage, getMessages, getMyFollowersTopic, getMyFollowingsTopic, getPoll, getPost, getPostTopic, getPosts, getRecommendedCommunities, getRole, getStream, getTopTrendingCommunities, getUser, getUserTopic, getUsers, isAfterBefore, isAfterBeforeRaw, isCachable, isConnected, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkipLimit, joinChannel, joinCommunity, leaveChannel, leaveCommunity, mergeInCache, observeChannel, observeComment, observeComments, observeCommunity, observeFile, observeFollowInfo, observeFollowers, observeFollowings, observeMessage, observeMessages, observePost, observePosts, observeUser, onChannelDeleted, onChannelJoined, onChannelLeft, onChannelUpdated, onClientBanned, onClientDisconnected, onCommentCreated, onCommentDeleted, onCommentFlagged, onCommentReactionAdded, onCommentReactionRemoved, onCommentUnflagged, onCommentUpdated, onCommunityCreated, onCommunityDeleted, onCommunityJoined, onCommunityLeft, onCommunityUpdated, onCommunityUserAdded, onCommunityUserBanned, onCommunityUserRemoved, onCommunityUserUnbanned, onConnectionError, onFollowInfoUpdated, onFollowRequestAccepted, onFollowRequestCanceled, onFollowRequestDeclined, onFollowerDeleted, onFollowerRequested, onMemberAdded, onMemberRemoved, onMessageCreated, onMessageDeleted, onMessageUpdated, onPostApproved, onPostCreated, onPostDeclined, onPostDeleted, onPostFlagged, onPostReactionAdded, onPostReactionRemoved, onPostUnflagged, onPostUpdated, onReactionRemoved, onStreamRecorded, onStreamStarted, onStreamStopped, onUserFlagCleared, onUserFlagged, onUserFollowed, onUserUnflagged, onUserUnfollowed, onUserUpdated, pullFromCache, pushToCache, queryCache, queryCategories, queryChannelMembers, queryChannels, queryComments, queryCommunities, queryCommunityMembers, queryFollowers, queryFollowings, queryGlobalFeed, queryMessages, queryOptions, queryPosts, queryRoles, queryStreams, queryUsers, removeChannelMembers, removeChannelMembersRole, removeCommunityMembers, removeCommunityMembersRoles, removeReaction, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByLastActivity, sortByLastCreated, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, unfollow, updateChannel, updateComment, updateCommunity, updateMessage, updatePost, updateStream, updateUser, upsertInCache, votePoll, wipeCache };