@amityco/ts-sdk 0.0.1-beta.2 → 0.0.1-c58e50d.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/LICENSE +390 -0
- package/dist/@types/core/cache.d.ts +21 -0
- package/{@types → dist/@types}/core/cache.d.ts.map +0 -0
- package/dist/@types/core/errors.d.ts +32 -0
- package/{@types → dist/@types}/core/errors.d.ts.map +0 -0
- package/dist/@types/core/events.d.ts +46 -0
- package/{@types → dist/@types}/core/events.d.ts.map +0 -0
- package/dist/@types/core/model.d.ts +41 -0
- package/dist/@types/core/model.d.ts.map +1 -0
- package/dist/@types/core/payload.d.ts +88 -0
- package/dist/@types/core/payload.d.ts.map +1 -0
- package/dist/@types/core/permissions.d.ts +71 -0
- package/dist/@types/core/permissions.d.ts.map +1 -0
- package/dist/@types/core/query.d.ts +72 -0
- package/dist/@types/core/query.d.ts.map +1 -0
- package/dist/@types/core/store.d.ts +46 -0
- package/{@types → dist/@types}/core/store.d.ts.map +0 -0
- package/dist/@types/core/transport.d.ts +27 -0
- package/{@types → dist/@types}/core/transport.d.ts.map +0 -0
- package/dist/@types/domains/category.d.ts +11 -0
- package/{@types → dist/@types}/domains/category.d.ts.map +0 -0
- package/dist/@types/domains/channel.d.ts +26 -0
- package/{@types → dist/@types}/domains/channel.d.ts.map +0 -0
- package/dist/@types/domains/client.d.ts +31 -0
- package/{@types → dist/@types}/domains/client.d.ts.map +0 -0
- package/dist/@types/domains/comment.d.ts +17 -0
- package/{@types → dist/@types}/domains/comment.d.ts.map +0 -0
- package/dist/@types/domains/community.d.ts +24 -0
- package/dist/@types/domains/community.d.ts.map +1 -0
- package/dist/@types/domains/content.d.ts +26 -0
- package/{@types → dist/@types}/domains/content.d.ts.map +0 -0
- package/dist/@types/domains/feed.d.ts +14 -0
- package/{@types → dist/@types}/domains/feed.d.ts.map +0 -0
- package/dist/@types/domains/file.d.ts +29 -0
- package/{@types → dist/@types}/domains/file.d.ts.map +0 -0
- package/dist/@types/domains/group.d.ts +26 -0
- package/dist/@types/domains/group.d.ts.map +1 -0
- package/dist/@types/domains/message.d.ts +16 -0
- package/{@types → dist/@types}/domains/message.d.ts.map +0 -0
- package/dist/@types/domains/partials.d.ts +42 -0
- package/{@types → dist/@types}/domains/partials.d.ts.map +0 -0
- package/dist/@types/domains/post.d.ts +22 -0
- package/dist/@types/domains/post.d.ts.map +1 -0
- package/dist/@types/domains/reaction.d.ts +24 -0
- package/{@types → dist/@types}/domains/reaction.d.ts.map +0 -0
- package/dist/@types/domains/stream.d.ts +47 -0
- package/{@types → dist/@types}/domains/stream.d.ts.map +0 -0
- package/dist/@types/domains/user.d.ts +12 -0
- package/{@types → dist/@types}/domains/user.d.ts.map +0 -0
- package/dist/@types/global.d.ts +13 -0
- package/{@types → dist/@types}/global.d.ts.map +0 -0
- package/dist/@types/index.d.ts +23 -0
- package/{@types → dist/@types}/index.d.ts.map +0 -0
- package/dist/category/api/getCategory.d.ts +16 -0
- package/{category → dist/category}/api/getCategory.d.ts.map +0 -0
- package/dist/category/api/index.d.ts +3 -0
- package/{category → dist/category}/api/index.d.ts.map +0 -0
- package/dist/category/api/queryCategories.d.ts +23 -0
- package/{category → dist/category}/api/queryCategories.d.ts.map +0 -0
- package/dist/channel/api/addChannelMembers.d.ts +17 -0
- package/dist/channel/api/addChannelMembers.d.ts.map +1 -0
- package/dist/channel/api/addChannelMembersRole.d.ts +18 -0
- package/dist/channel/api/addChannelMembersRole.d.ts.map +1 -0
- package/dist/channel/api/createChannel.d.ts +19 -0
- package/dist/channel/api/createChannel.d.ts.map +1 -0
- package/dist/channel/api/deleteChannel.d.ts +16 -0
- package/{channel → dist/channel}/api/deleteChannel.d.ts.map +0 -0
- package/dist/channel/api/getChannel.d.ts +32 -0
- package/{channel → dist/channel}/api/getChannel.d.ts.map +0 -0
- package/dist/channel/api/getChannels.d.ts +32 -0
- package/{channel → dist/channel}/api/getChannels.d.ts.map +0 -0
- package/dist/channel/api/index.d.ts +14 -0
- package/dist/channel/api/index.d.ts.map +1 -0
- package/dist/channel/api/joinChannel.d.ts +16 -0
- package/{channel → dist/channel}/api/joinChannel.d.ts.map +0 -0
- package/dist/channel/api/leaveChannel.d.ts +16 -0
- package/{channel → dist/channel}/api/leaveChannel.d.ts.map +0 -0
- package/dist/channel/api/queryChannelMembers.d.ts +42 -0
- package/dist/channel/api/queryChannelMembers.d.ts.map +1 -0
- package/dist/channel/api/queryChannels.d.ts +42 -0
- package/dist/channel/api/queryChannels.d.ts.map +1 -0
- package/dist/channel/api/removeChannelMembers.d.ts +17 -0
- package/dist/channel/api/removeChannelMembers.d.ts.map +1 -0
- package/dist/channel/api/removeChannelMembersRole.d.ts +18 -0
- package/dist/channel/api/removeChannelMembersRole.d.ts.map +1 -0
- package/dist/channel/api/updateChannel.d.ts +17 -0
- package/{channel → dist/channel}/api/updateChannel.d.ts.map +0 -0
- package/dist/channel/events/index.d.ts +7 -0
- package/{channel → dist/channel}/events/index.d.ts.map +0 -0
- package/dist/channel/events/onChannelCreated.d.ts +17 -0
- package/{channel → dist/channel}/events/onChannelCreated.d.ts.map +0 -0
- package/dist/channel/events/onChannelDeleted.d.ts +17 -0
- package/{channel → dist/channel}/events/onChannelDeleted.d.ts.map +0 -0
- package/dist/channel/events/onChannelJoined.d.ts +17 -0
- package/{channel → dist/channel}/events/onChannelJoined.d.ts.map +0 -0
- package/dist/channel/events/onChannelLeft.d.ts +17 -0
- package/{channel → dist/channel}/events/onChannelLeft.d.ts.map +0 -0
- package/dist/channel/events/onChannelUpdated.d.ts +17 -0
- package/{channel → dist/channel}/events/onChannelUpdated.d.ts.map +0 -0
- package/dist/channel/events/onMemberAdded.d.ts +17 -0
- package/{channel → dist/channel}/events/onMemberAdded.d.ts.map +0 -0
- package/dist/channel/events/onMemberRemoved.d.ts +17 -0
- package/{channel → dist/channel}/events/onMemberRemoved.d.ts.map +0 -0
- package/dist/channel/observers/index.d.ts +2 -0
- package/{channel → dist/channel}/observers/index.d.ts.map +0 -0
- package/dist/channel/observers/observeChannel.d.ts +20 -0
- package/{channel → dist/channel}/observers/observeChannel.d.ts.map +0 -0
- package/dist/client/api/activeClient.d.ts +17 -0
- package/{client → dist/client}/api/activeClient.d.ts.map +0 -0
- package/dist/client/api/clearCache.d.ts +15 -0
- package/dist/client/api/clearCache.d.ts.map +1 -0
- package/dist/client/api/connectClient.d.ts +26 -0
- package/dist/client/api/connectClient.d.ts.map +1 -0
- package/dist/client/api/createClient.d.ts +17 -0
- package/{client → dist/client}/api/createClient.d.ts.map +0 -0
- package/dist/client/api/disconnectClient.d.ts +16 -0
- package/{client → dist/client}/api/disconnectClient.d.ts.map +0 -0
- package/dist/client/api/enableCache.d.ts +15 -0
- package/dist/client/api/enableCache.d.ts.map +1 -0
- package/dist/client/api/getToken.d.ts +19 -0
- package/{client → dist/client}/api/getToken.d.ts.map +0 -0
- package/dist/client/api/index.d.ts +8 -0
- package/dist/client/api/index.d.ts.map +1 -0
- package/dist/client/api/isConnected.d.ts +14 -0
- package/{client → dist/client}/api/isConnected.d.ts.map +0 -0
- package/dist/client/events/index.d.ts +2 -0
- package/{client → dist/client}/events/index.d.ts.map +0 -0
- package/dist/client/events/onClientDisconnected.d.ts +17 -0
- package/{client → dist/client}/events/onClientDisconnected.d.ts.map +0 -0
- package/dist/comment/api/createComment.d.ts +16 -0
- package/dist/comment/api/createComment.d.ts.map +1 -0
- package/dist/comment/api/deleteComment.d.ts +16 -0
- package/{comment → dist/comment}/api/deleteComment.d.ts.map +0 -0
- package/dist/comment/api/getComment.d.ts +32 -0
- package/{comment → dist/comment}/api/getComment.d.ts.map +0 -0
- package/dist/comment/api/getComments.d.ts +32 -0
- package/{comment → dist/comment}/api/getComments.d.ts.map +0 -0
- package/dist/comment/api/index.d.ts +7 -0
- package/{comment → dist/comment}/api/index.d.ts.map +0 -0
- package/dist/comment/api/queryComments.d.ts +53 -0
- package/dist/comment/api/queryComments.d.ts.map +1 -0
- package/dist/comment/api/updateComment.d.ts +19 -0
- package/{comment → dist/comment}/api/updateComment.d.ts.map +0 -0
- package/dist/comment/events/index.d.ts +4 -0
- package/{comment → dist/comment}/events/index.d.ts.map +0 -0
- package/dist/comment/events/onCommentCreated.d.ts +17 -0
- package/{comment → dist/comment}/events/onCommentCreated.d.ts.map +0 -0
- package/dist/comment/events/onCommentDeleted.d.ts +17 -0
- package/{comment → dist/comment}/events/onCommentDeleted.d.ts.map +0 -0
- package/dist/comment/events/onCommentUpdated.d.ts +17 -0
- package/{comment → dist/comment}/events/onCommentUpdated.d.ts.map +0 -0
- package/dist/comment/observers/index.d.ts +3 -0
- package/{comment → dist/comment}/observers/index.d.ts.map +0 -0
- package/dist/comment/observers/observeComment.d.ts +20 -0
- package/{comment → dist/comment}/observers/observeComment.d.ts.map +0 -0
- package/dist/comment/observers/observeComments.d.ts +22 -0
- package/{comment → dist/comment}/observers/observeComments.d.ts.map +0 -0
- package/dist/community/api/addCommunityMembers.d.ts +17 -0
- package/dist/community/api/addCommunityMembers.d.ts.map +1 -0
- package/dist/community/api/addCommunityMembersRole.d.ts +18 -0
- package/dist/community/api/addCommunityMembersRole.d.ts.map +1 -0
- package/dist/community/api/createCommunity.d.ts +20 -0
- package/{community → dist/community}/api/createCommunity.d.ts.map +0 -0
- package/dist/community/api/deleteCommunity.d.ts +16 -0
- package/{community → dist/community}/api/deleteCommunity.d.ts.map +0 -0
- package/dist/community/api/getCommunities.d.ts +32 -0
- package/{community → dist/community}/api/getCommunities.d.ts.map +0 -0
- package/dist/community/api/getCommunity.d.ts +32 -0
- package/dist/community/api/getCommunity.d.ts.map +1 -0
- package/dist/community/api/index.d.ts +14 -0
- package/dist/community/api/index.d.ts.map +1 -0
- package/dist/community/api/joinCommunity.d.ts +16 -0
- package/{community → dist/community}/api/joinCommunity.d.ts.map +0 -0
- package/dist/community/api/leaveCommunity.d.ts +16 -0
- package/{community → dist/community}/api/leaveCommunity.d.ts.map +0 -0
- package/dist/community/api/queryCommunities.d.ts +46 -0
- package/{community → dist/community}/api/queryCommunities.d.ts.map +0 -0
- package/dist/community/api/queryCommunityMembers.d.ts +42 -0
- package/dist/community/api/queryCommunityMembers.d.ts.map +1 -0
- package/dist/community/api/removeCommunityMembers.d.ts +17 -0
- package/dist/community/api/removeCommunityMembers.d.ts.map +1 -0
- package/dist/community/api/removeCommunityMembersRole.d.ts +18 -0
- package/dist/community/api/removeCommunityMembersRole.d.ts.map +1 -0
- package/dist/community/api/updateCommunity.d.ts +17 -0
- package/{community → dist/community}/api/updateCommunity.d.ts.map +0 -0
- package/dist/community/events/index.d.ts +6 -0
- package/{community → dist/community}/events/index.d.ts.map +0 -0
- package/dist/community/events/onCommunityCreated.d.ts +17 -0
- package/{community → dist/community}/events/onCommunityCreated.d.ts.map +0 -0
- package/dist/community/events/onCommunityDeleted.d.ts +17 -0
- package/{community → dist/community}/events/onCommunityDeleted.d.ts.map +0 -0
- package/dist/community/events/onCommunityJoined.d.ts +17 -0
- package/{community → dist/community}/events/onCommunityJoined.d.ts.map +0 -0
- package/dist/community/events/onCommunityLeft.d.ts +17 -0
- package/{community → dist/community}/events/onCommunityLeft.d.ts.map +0 -0
- package/dist/community/events/onCommunityUpdated.d.ts +17 -0
- package/{community → dist/community}/events/onCommunityUpdated.d.ts.map +0 -0
- package/dist/community/observers/index.d.ts +2 -0
- package/{community → dist/community}/observers/index.d.ts.map +0 -0
- package/dist/community/observers/observeCommunity.d.ts +20 -0
- package/{community → dist/community}/observers/observeCommunity.d.ts.map +0 -0
- package/dist/core/cache/drop.d.ts +11 -0
- package/{core → dist/core}/cache/drop.d.ts.map +0 -0
- package/dist/core/cache/index.d.ts +19 -0
- package/{core → dist/core}/cache/index.d.ts.map +0 -0
- package/dist/core/cache/ingest.d.ts +10 -0
- package/{core → dist/core}/cache/ingest.d.ts.map +0 -0
- package/dist/core/cache/merge.d.ts +10 -0
- package/{core → dist/core}/cache/merge.d.ts.map +0 -0
- package/dist/core/cache/mutate.d.ts +10 -0
- package/{core → dist/core}/cache/mutate.d.ts.map +0 -0
- package/dist/core/cache/pull.d.ts +11 -0
- package/{core → dist/core}/cache/pull.d.ts.map +0 -0
- package/dist/core/cache/push.d.ts +10 -0
- package/{core → dist/core}/cache/push.d.ts.map +0 -0
- package/dist/core/cache/sync.d.ts +10 -0
- package/{core → dist/core}/cache/sync.d.ts.map +0 -0
- package/dist/core/debug.d.ts +15 -0
- package/{core → dist/core}/debug.d.ts.map +0 -0
- package/dist/core/device.d.ts +7 -0
- package/{core → dist/core}/device.d.ts.map +0 -0
- package/dist/core/errors.d.ts +59 -0
- package/{core → dist/core}/errors.d.ts.map +0 -0
- package/dist/core/events.d.ts +33 -0
- package/{core → dist/core}/events.d.ts.map +0 -0
- package/dist/core/model/idResolvers.d.ts +20 -0
- package/dist/core/model/idResolvers.d.ts.map +1 -0
- package/dist/core/model/identifyModel.d.ts +8 -0
- package/dist/core/model/identifyModel.d.ts.map +1 -0
- package/dist/core/model/index.d.ts +4 -0
- package/{core → dist/core}/model/index.d.ts.map +0 -0
- package/dist/core/model/toRecord.d.ts +10 -0
- package/{core → dist/core}/model/toRecord.d.ts.map +0 -0
- package/dist/core/query/decorate.d.ts +23 -0
- package/dist/core/query/decorate.d.ts.map +1 -0
- package/dist/core/query/filtering.d.ts +12 -0
- package/{core → dist/core}/query/filtering.d.ts.map +0 -0
- package/dist/core/query/index.d.ts +6 -0
- package/{core → dist/core}/query/index.d.ts.map +0 -0
- package/dist/core/query/paging.d.ts +58 -0
- package/dist/core/query/paging.d.ts.map +1 -0
- package/dist/core/query/query.d.ts +121 -0
- package/dist/core/query/query.d.ts.map +1 -0
- package/dist/core/query/sorting.d.ts +39 -0
- package/dist/core/query/sorting.d.ts.map +1 -0
- package/dist/core/stores/index.d.ts +3 -0
- package/{core → dist/core}/stores/index.d.ts.map +0 -0
- package/dist/core/stores/memory.d.ts +30 -0
- package/dist/core/stores/memory.d.ts.map +1 -0
- package/dist/core/stores/persistent.d.ts +13 -0
- package/{core → dist/core}/stores/persistent.d.ts.map +0 -0
- package/dist/core/transports.d.ts +49 -0
- package/dist/core/transports.d.ts.map +1 -0
- package/dist/core/uuid.d.ts +2 -0
- package/{core → dist/core}/uuid.d.ts.map +0 -0
- package/dist/feed/api/index.d.ts +2 -0
- package/{feed → dist/feed}/api/index.d.ts.map +0 -0
- package/dist/feed/api/queryGlobalFeed.d.ts +23 -0
- package/{feed → dist/feed}/api/queryGlobalFeed.d.ts.map +0 -0
- package/dist/file/api/createFile.d.ts +16 -0
- package/dist/file/api/createFile.d.ts.map +1 -0
- package/dist/file/api/deleteFile.d.ts +16 -0
- package/{file → dist/file}/api/deleteFile.d.ts.map +0 -0
- package/dist/file/api/fileUrlWithSize.d.ts +9 -0
- package/dist/file/api/fileUrlWithSize.d.ts.map +1 -0
- package/dist/file/api/getFile.d.ts +32 -0
- package/{file → dist/file}/api/getFile.d.ts.map +0 -0
- package/dist/file/api/index.d.ts +5 -0
- package/{file → dist/file}/api/index.d.ts.map +0 -0
- package/dist/file/observers/index.d.ts +2 -0
- package/{file → dist/file}/observers/index.d.ts.map +0 -0
- package/dist/file/observers/observeFile.d.ts +20 -0
- package/{file → dist/file}/observers/observeFile.d.ts.map +0 -0
- package/dist/index.cjs.js +4884 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +4734 -0
- package/dist/index.umd.js +4880 -0
- package/dist/message/api/createMessage.d.ts +38 -0
- package/{message → dist/message}/api/createMessage.d.ts.map +0 -0
- package/dist/message/api/deleteMessage.d.ts +32 -0
- package/{message → dist/message}/api/deleteMessage.d.ts.map +0 -0
- package/dist/message/api/getMessage.d.ts +32 -0
- package/{message → dist/message}/api/getMessage.d.ts.map +0 -0
- package/dist/message/api/getMessages.d.ts +32 -0
- package/{message → dist/message}/api/getMessages.d.ts.map +0 -0
- package/dist/message/api/index.d.ts +7 -0
- package/{message → dist/message}/api/index.d.ts.map +0 -0
- package/dist/message/api/queryMessages.d.ts +55 -0
- package/{message → dist/message}/api/queryMessages.d.ts.map +0 -0
- package/dist/message/api/updateMessage.d.ts +38 -0
- package/{message → dist/message}/api/updateMessage.d.ts.map +0 -0
- package/dist/message/events/index.d.ts +4 -0
- package/{message → dist/message}/events/index.d.ts.map +0 -0
- package/dist/message/events/onMessageCreated.d.ts +17 -0
- package/{message → dist/message}/events/onMessageCreated.d.ts.map +0 -0
- package/dist/message/events/onMessageDeleted.d.ts +17 -0
- package/{message → dist/message}/events/onMessageDeleted.d.ts.map +0 -0
- package/dist/message/events/onMessageUpdated.d.ts +17 -0
- package/{message → dist/message}/events/onMessageUpdated.d.ts.map +0 -0
- package/dist/message/observers/index.d.ts +3 -0
- package/{message → dist/message}/observers/index.d.ts.map +0 -0
- package/dist/message/observers/observeMessage.d.ts +22 -0
- package/{message → dist/message}/observers/observeMessage.d.ts.map +0 -0
- package/dist/message/observers/observeMessages.d.ts +19 -0
- package/{message → dist/message}/observers/observeMessages.d.ts.map +0 -0
- package/dist/post/api/createPost.d.ts +21 -0
- package/{post → dist/post}/api/createPost.d.ts.map +0 -0
- package/dist/post/api/deletePost.d.ts +16 -0
- package/{post → dist/post}/api/deletePost.d.ts.map +0 -0
- package/dist/post/api/getPost.d.ts +32 -0
- package/{post → dist/post}/api/getPost.d.ts.map +0 -0
- package/dist/post/api/getPosts.d.ts +32 -0
- package/{post → dist/post}/api/getPosts.d.ts.map +0 -0
- package/dist/post/api/index.d.ts +7 -0
- package/{post → dist/post}/api/index.d.ts.map +0 -0
- package/dist/post/api/queryPosts.d.ts +47 -0
- package/dist/post/api/queryPosts.d.ts.map +1 -0
- package/dist/post/api/updatePost.d.ts +19 -0
- package/{post → dist/post}/api/updatePost.d.ts.map +0 -0
- package/dist/post/events/index.d.ts +4 -0
- package/{post → dist/post}/events/index.d.ts.map +0 -0
- package/dist/post/events/onPostCreated.d.ts +17 -0
- package/{post → dist/post}/events/onPostCreated.d.ts.map +0 -0
- package/dist/post/events/onPostDeleted.d.ts +17 -0
- package/{post → dist/post}/events/onPostDeleted.d.ts.map +0 -0
- package/dist/post/events/onPostUpdated.d.ts +17 -0
- package/{post → dist/post}/events/onPostUpdated.d.ts.map +0 -0
- package/dist/post/observers/index.d.ts +3 -0
- package/{post → dist/post}/observers/index.d.ts.map +0 -0
- package/dist/post/observers/observePost.d.ts +20 -0
- package/{post → dist/post}/observers/observePost.d.ts.map +0 -0
- package/dist/post/observers/observePosts.d.ts +25 -0
- package/dist/post/observers/observePosts.d.ts.map +1 -0
- package/dist/reaction/api/addReaction.d.ts +36 -0
- package/{reaction → dist/reaction}/api/addReaction.d.ts.map +0 -0
- package/dist/reaction/api/index.d.ts +3 -0
- package/{reaction → dist/reaction}/api/index.d.ts.map +0 -0
- package/dist/reaction/api/removeReaction.d.ts +36 -0
- package/{reaction → dist/reaction}/api/removeReaction.d.ts.map +0 -0
- package/dist/reaction/events/index.d.ts +2 -0
- package/{reaction → dist/reaction}/events/index.d.ts.map +0 -0
- package/dist/reaction/events/onReactionAdded.d.ts +17 -0
- package/{reaction → dist/reaction}/events/onReactionAdded.d.ts.map +0 -0
- package/dist/reaction/events/onReactionRemoved.d.ts +17 -0
- package/{reaction → dist/reaction}/events/onReactionRemoved.d.ts.map +0 -0
- package/dist/reaction/utils/dispatchReactable.d.ts +3 -0
- package/{reaction → dist/reaction}/utils/dispatchReactable.d.ts.map +0 -0
- package/dist/reaction/utils/fetchReference.d.ts +3 -0
- package/{reaction → dist/reaction}/utils/fetchReference.d.ts.map +0 -0
- package/dist/reaction/utils/index.d.ts +3 -0
- package/{reaction → dist/reaction}/utils/index.d.ts.map +0 -0
- package/dist/report/api/createReport.d.ts +16 -0
- package/{report → dist/report}/api/createReport.d.ts.map +0 -0
- package/dist/report/api/deleteReport.d.ts +16 -0
- package/{report → dist/report}/api/deleteReport.d.ts.map +0 -0
- package/dist/report/api/index.d.ts +4 -0
- package/{report → dist/report}/api/index.d.ts.map +0 -0
- package/dist/report/api/isReportedByMe.d.ts +16 -0
- package/{report → dist/report}/api/isReportedByMe.d.ts.map +0 -0
- package/dist/report/constants/referenceTypes.d.ts +24 -0
- package/{report → dist/report}/constants/referenceTypes.d.ts.map +0 -0
- package/dist/role/api/getRole.d.ts +32 -0
- package/dist/role/api/getRole.d.ts.map +1 -0
- package/dist/role/api/index.d.ts +3 -0
- package/dist/role/api/index.d.ts.map +1 -0
- package/dist/role/api/queryRoles.d.ts +42 -0
- package/dist/role/api/queryRoles.d.ts.map +1 -0
- package/dist/stream/api/createStream.d.ts +18 -0
- package/{stream → dist/stream}/api/createStream.d.ts.map +0 -0
- package/dist/stream/api/deleteStream.d.ts +16 -0
- package/{stream → dist/stream}/api/deleteStream.d.ts.map +0 -0
- package/dist/stream/api/getStream.d.ts +12 -0
- package/{stream → dist/stream}/api/getStream.d.ts.map +0 -0
- package/dist/stream/api/index.d.ts +6 -0
- package/{stream → dist/stream}/api/index.d.ts.map +0 -0
- package/dist/stream/api/queryStreams.d.ts +23 -0
- package/{stream → dist/stream}/api/queryStreams.d.ts.map +0 -0
- package/dist/stream/api/updateStream.d.ts +17 -0
- package/{stream → dist/stream}/api/updateStream.d.ts.map +0 -0
- package/dist/stream/events/index.d.ts +4 -0
- package/{stream → dist/stream}/events/index.d.ts.map +0 -0
- package/dist/stream/events/onStreamRecorded.d.ts +17 -0
- package/{stream → dist/stream}/events/onStreamRecorded.d.ts.map +0 -0
- package/dist/stream/events/onStreamStarted.d.ts +17 -0
- package/{stream → dist/stream}/events/onStreamStarted.d.ts.map +0 -0
- package/dist/stream/events/onStreamStopped.d.ts +17 -0
- package/{stream → dist/stream}/events/onStreamStopped.d.ts.map +0 -0
- package/dist/user/api/getUser.d.ts +32 -0
- package/{user → dist/user}/api/getUser.d.ts.map +0 -0
- package/dist/user/api/getUsers.d.ts +32 -0
- package/{user → dist/user}/api/getUsers.d.ts.map +0 -0
- package/dist/user/api/index.d.ts +5 -0
- package/{user → dist/user}/api/index.d.ts.map +0 -0
- package/dist/user/api/queryUsers.d.ts +43 -0
- package/dist/user/api/queryUsers.d.ts.map +1 -0
- package/dist/user/api/updateUser.d.ts +17 -0
- package/{user → dist/user}/api/updateUser.d.ts.map +0 -0
- package/dist/user/events/index.d.ts +2 -0
- package/{user → dist/user}/events/index.d.ts.map +0 -0
- package/dist/user/events/onUserUpdated.d.ts +17 -0
- package/{user → dist/user}/events/onUserUpdated.d.ts.map +0 -0
- package/dist/user/observers/index.d.ts +2 -0
- package/{user → dist/user}/observers/index.d.ts.map +0 -0
- package/dist/user/observers/observeUser.d.ts +19 -0
- package/{user → dist/user}/observers/observeUser.d.ts.map +0 -0
- package/package.json +41 -10
- package/rollup.config.js +41 -0
- package/src/@types/core/cache.ts +22 -0
- package/src/@types/core/errors.ts +34 -0
- package/src/@types/core/events.ts +60 -0
- package/src/@types/core/model.ts +51 -0
- package/src/@types/core/payload.ts +102 -0
- package/src/@types/core/permissions.ts +76 -0
- package/src/@types/core/query.ts +95 -0
- package/src/@types/core/store.ts +52 -0
- package/src/@types/core/transport.ts +32 -0
- package/src/@types/domains/category.ts +15 -0
- package/src/@types/domains/channel.ts +38 -0
- package/src/@types/domains/client.ts +36 -0
- package/src/@types/domains/comment.ts +26 -0
- package/src/@types/domains/community.ts +35 -0
- package/src/@types/domains/content.ts +35 -0
- package/src/@types/domains/feed.ts +16 -0
- package/src/@types/domains/file.ts +41 -0
- package/src/@types/domains/group.ts +38 -0
- package/src/@types/domains/message.ts +27 -0
- package/src/@types/domains/partials.ts +52 -0
- package/src/@types/domains/post.ts +31 -0
- package/src/@types/domains/reaction.ts +30 -0
- package/src/@types/domains/stream.ts +57 -0
- package/src/@types/domains/user.ts +18 -0
- package/src/@types/global.ts +25 -0
- package/src/@types/index.ts +31 -0
- package/src/category/api/getCategory.ts +35 -0
- package/src/category/api/index.ts +2 -0
- package/src/category/api/queryCategories.ts +49 -0
- package/src/channel/api/addChannelMembers.ts +45 -0
- package/src/channel/api/addChannelMembersRole.ts +43 -0
- package/src/channel/api/createChannel.ts +37 -0
- package/src/channel/api/deleteChannel.ts +34 -0
- package/src/channel/api/getChannel.ts +59 -0
- package/src/channel/api/getChannels.ts +63 -0
- package/src/channel/api/index.ts +18 -0
- package/src/channel/api/joinChannel.ts +38 -0
- package/src/channel/api/leaveChannel.ts +38 -0
- package/src/channel/api/queryChannelMembers.ts +79 -0
- package/src/channel/api/queryChannels.ts +88 -0
- package/src/channel/api/removeChannelMembers.ts +45 -0
- package/src/channel/api/removeChannelMembersRole.ts +43 -0
- package/src/channel/api/updateChannel.ts +38 -0
- package/src/channel/events/index.ts +6 -0
- package/src/channel/events/onChannelCreated.ts +37 -0
- package/src/channel/events/onChannelDeleted.ts +37 -0
- package/src/channel/events/onChannelJoined.ts +37 -0
- package/src/channel/events/onChannelLeft.ts +37 -0
- package/src/channel/events/onChannelUpdated.ts +37 -0
- package/src/channel/events/onMemberAdded.ts +37 -0
- package/src/channel/events/onMemberRemoved.ts +37 -0
- package/src/channel/observers/index.ts +1 -0
- package/src/channel/observers/observeChannel.ts +80 -0
- package/src/client/api/activeClient.ts +33 -0
- package/src/client/api/clearCache.ts +23 -0
- package/src/client/api/connectClient.ts +63 -0
- package/src/client/api/createClient.ts +56 -0
- package/src/client/api/disconnectClient.ts +31 -0
- package/src/client/api/enableCache.ts +35 -0
- package/src/client/api/getToken.ts +35 -0
- package/src/client/api/index.ts +7 -0
- package/src/client/api/isConnected.ts +24 -0
- package/src/client/events/index.ts +1 -0
- package/src/client/events/onClientDisconnected.ts +29 -0
- package/src/comment/api/createComment.ts +43 -0
- package/src/comment/api/deleteComment.ts +40 -0
- package/src/comment/api/getComment.ts +59 -0
- package/src/comment/api/getComments.ts +63 -0
- package/src/comment/api/index.ts +7 -0
- package/src/comment/api/queryComments.ts +169 -0
- package/src/comment/api/updateComment.ts +41 -0
- package/src/comment/events/index.ts +3 -0
- package/src/comment/events/onCommentCreated.ts +39 -0
- package/src/comment/events/onCommentDeleted.ts +39 -0
- package/src/comment/events/onCommentUpdated.ts +39 -0
- package/src/comment/observers/index.ts +2 -0
- package/src/comment/observers/observeComment.ts +73 -0
- package/src/comment/observers/observeComments.ts +61 -0
- package/src/community/api/addCommunityMembers.ts +46 -0
- package/src/community/api/addCommunityMembersRole.ts +43 -0
- package/src/community/api/createCommunity.ts +43 -0
- package/src/community/api/deleteCommunity.ts +35 -0
- package/src/community/api/getCommunities.ts +63 -0
- package/src/community/api/getCommunity.ts +58 -0
- package/src/community/api/index.ts +17 -0
- package/src/community/api/joinCommunity.ts +41 -0
- package/src/community/api/leaveCommunity.ts +41 -0
- package/src/community/api/queryCommunities.ts +92 -0
- package/src/community/api/queryCommunityMembers.ts +78 -0
- package/src/community/api/removeCommunityMembers.ts +46 -0
- package/src/community/api/removeCommunityMembersRole.ts +43 -0
- package/src/community/api/updateCommunity.ts +40 -0
- package/src/community/events/index.ts +6 -0
- package/src/community/events/onCommunityCreated.ts +37 -0
- package/src/community/events/onCommunityDeleted.ts +37 -0
- package/src/community/events/onCommunityJoined.ts +37 -0
- package/src/community/events/onCommunityLeft.ts +37 -0
- package/src/community/events/onCommunityUpdated.ts +37 -0
- package/src/community/observers/index.ts +1 -0
- package/src/community/observers/observeCommunity.ts +74 -0
- package/src/core/cache/drop.ts +24 -0
- package/src/core/cache/index.ts +24 -0
- package/src/core/cache/ingest.ts +24 -0
- package/src/core/cache/merge.ts +19 -0
- package/src/core/cache/mutate.ts +25 -0
- package/src/core/cache/pull.ts +31 -0
- package/src/core/cache/push.ts +41 -0
- package/src/core/cache/sync.ts +41 -0
- package/src/core/debug.ts +26 -0
- package/src/core/device.ts +38 -0
- package/src/core/errors.ts +85 -0
- package/src/core/events.ts +93 -0
- package/src/core/model/idResolvers.ts +66 -0
- package/src/core/model/identifyModel.ts +32 -0
- package/src/core/model/index.ts +3 -0
- package/src/core/model/toRecord.ts +11 -0
- package/src/core/query/decorate.ts +64 -0
- package/src/core/query/filtering.ts +17 -0
- package/src/core/query/index.ts +5 -0
- package/src/core/query/paging.ts +166 -0
- package/src/core/query/query.ts +300 -0
- package/src/core/query/sorting.ts +50 -0
- package/src/core/stores/index.ts +2 -0
- package/src/core/stores/memory.ts +59 -0
- package/src/core/stores/persistent.ts +63 -0
- package/src/core/transports.ts +157 -0
- package/src/core/uuid.ts +2 -0
- package/src/feed/api/index.ts +1 -0
- package/src/feed/api/queryGlobalFeed.ts +50 -0
- package/src/file/api/createFile.ts +51 -0
- package/src/file/api/deleteFile.ts +35 -0
- package/src/file/api/fileUrlWithSize.ts +13 -0
- package/src/file/api/getFile.ts +60 -0
- package/src/file/api/index.ts +4 -0
- package/src/file/observers/index.ts +1 -0
- package/src/file/observers/observeFile.ts +57 -0
- package/src/index.ts +55 -0
- package/src/message/api/createMessage.ts +90 -0
- package/src/message/api/deleteMessage.ts +75 -0
- package/src/message/api/getMessage.ts +60 -0
- package/src/message/api/getMessages.ts +63 -0
- package/src/message/api/index.ts +6 -0
- package/src/message/api/queryMessages.ts +145 -0
- package/src/message/api/updateMessage.ts +79 -0
- package/src/message/events/index.ts +3 -0
- package/src/message/events/onMessageCreated.ts +39 -0
- package/src/message/events/onMessageDeleted.ts +39 -0
- package/src/message/events/onMessageUpdated.ts +39 -0
- package/src/message/observers/index.ts +2 -0
- package/src/message/observers/observeMessage.ts +76 -0
- package/src/message/observers/observeMessages.ts +60 -0
- package/src/post/api/createPost.ts +45 -0
- package/src/post/api/deletePost.ts +43 -0
- package/src/post/api/getPost.ts +60 -0
- package/src/post/api/getPosts.ts +63 -0
- package/src/post/api/index.ts +7 -0
- package/src/post/api/queryPosts.ts +88 -0
- package/src/post/api/updatePost.ts +42 -0
- package/src/post/events/index.ts +3 -0
- package/src/post/events/onPostCreated.ts +39 -0
- package/src/post/events/onPostDeleted.ts +39 -0
- package/src/post/events/onPostUpdated.ts +39 -0
- package/src/post/observers/index.ts +2 -0
- package/src/post/observers/observePost.ts +72 -0
- package/src/post/observers/observePosts.ts +66 -0
- package/src/reaction/api/addReaction.ts +84 -0
- package/src/reaction/api/index.ts +2 -0
- package/src/reaction/api/removeReaction.ts +84 -0
- package/src/reaction/events/index.ts +1 -0
- package/src/reaction/events/onReactionAdded.ts +43 -0
- package/src/reaction/events/onReactionRemoved.ts +41 -0
- package/src/reaction/utils/dispatchReactable.ts +19 -0
- package/src/reaction/utils/fetchReference.ts +18 -0
- package/src/reaction/utils/index.ts +2 -0
- package/src/report/api/createReport.ts +40 -0
- package/src/report/api/deleteReport.ts +40 -0
- package/src/report/api/index.ts +4 -0
- package/src/report/api/isReportedByMe.ts +37 -0
- package/src/report/constants/referenceTypes.ts +22 -0
- package/src/role/api/getRole.ts +53 -0
- package/src/role/api/index.ts +2 -0
- package/src/role/api/queryRoles.ts +79 -0
- package/src/stream/api/createStream.ts +33 -0
- package/src/stream/api/deleteStream.ts +38 -0
- package/src/stream/api/getStream.ts +29 -0
- package/src/stream/api/index.ts +7 -0
- package/src/stream/api/queryStreams.ts +44 -0
- package/src/stream/api/updateStream.ts +36 -0
- package/src/stream/events/index.ts +3 -0
- package/src/stream/events/onStreamRecorded.ts +39 -0
- package/src/stream/events/onStreamStarted.ts +39 -0
- package/src/stream/events/onStreamStopped.ts +39 -0
- package/src/user/api/getUser.ts +59 -0
- package/src/user/api/getUsers.ts +60 -0
- package/src/user/api/index.ts +5 -0
- package/src/user/api/queryUsers.ts +88 -0
- package/src/user/api/updateUser.ts +44 -0
- package/src/user/events/index.ts +1 -0
- package/src/user/events/onUserUpdated.ts +39 -0
- package/src/user/observers/index.ts +1 -0
- package/src/user/observers/observeUser.ts +64 -0
- package/tsconfig.json +28 -0
- package/@types/core/cache.d.ts +0 -21
- package/@types/core/cache.js +0 -1
- package/@types/core/errors.d.ts +0 -32
- package/@types/core/errors.js +0 -1
- package/@types/core/events.d.ts +0 -46
- package/@types/core/events.js +0 -1
- package/@types/core/model.d.ts +0 -35
- package/@types/core/model.d.ts.map +0 -1
- package/@types/core/model.js +0 -1
- package/@types/core/payload.d.ts +0 -84
- package/@types/core/payload.d.ts.map +0 -1
- package/@types/core/payload.js +0 -1
- package/@types/core/permissions.d.ts +0 -71
- package/@types/core/permissions.d.ts.map +0 -1
- package/@types/core/permissions.js +0 -1
- package/@types/core/query.d.ts +0 -71
- package/@types/core/query.d.ts.map +0 -1
- package/@types/core/query.js +0 -1
- package/@types/core/store.d.ts +0 -46
- package/@types/core/store.js +0 -1
- package/@types/core/transport.d.ts +0 -27
- package/@types/core/transport.js +0 -1
- package/@types/domains/category.d.ts +0 -11
- package/@types/domains/category.js +0 -1
- package/@types/domains/channel.d.ts +0 -26
- package/@types/domains/channel.js +0 -1
- package/@types/domains/client.d.ts +0 -31
- package/@types/domains/client.js +0 -1
- package/@types/domains/comment.d.ts +0 -17
- package/@types/domains/comment.js +0 -1
- package/@types/domains/community.d.ts +0 -24
- package/@types/domains/community.d.ts.map +0 -1
- package/@types/domains/community.js +0 -1
- package/@types/domains/content.d.ts +0 -26
- package/@types/domains/content.js +0 -1
- package/@types/domains/feed.d.ts +0 -14
- package/@types/domains/feed.js +0 -1
- package/@types/domains/file.d.ts +0 -29
- package/@types/domains/file.js +0 -1
- package/@types/domains/group.d.ts +0 -26
- package/@types/domains/group.d.ts.map +0 -1
- package/@types/domains/group.js +0 -1
- package/@types/domains/message.d.ts +0 -16
- package/@types/domains/message.js +0 -1
- package/@types/domains/partials.d.ts +0 -42
- package/@types/domains/partials.js +0 -1
- package/@types/domains/post.d.ts +0 -20
- package/@types/domains/post.d.ts.map +0 -1
- package/@types/domains/post.js +0 -1
- package/@types/domains/reaction.d.ts +0 -24
- package/@types/domains/reaction.js +0 -1
- package/@types/domains/stream.d.ts +0 -47
- package/@types/domains/stream.js +0 -1
- package/@types/domains/user.d.ts +0 -12
- package/@types/domains/user.js +0 -1
- package/@types/global.d.ts +0 -13
- package/@types/global.js +0 -1
- package/@types/index.d.ts +0 -23
- package/@types/index.js +0 -23
- package/category/api/getCategory.d.ts +0 -16
- package/category/api/getCategory.js +0 -26
- package/category/api/index.d.ts +0 -3
- package/category/api/index.js +0 -2
- package/category/api/queryCategories.d.ts +0 -23
- package/category/api/queryCategories.js +0 -44
- package/channel/api/createChannel.d.ts +0 -18
- package/channel/api/createChannel.d.ts.map +0 -1
- package/channel/api/createChannel.js +0 -27
- package/channel/api/deleteChannel.d.ts +0 -16
- package/channel/api/deleteChannel.js +0 -25
- package/channel/api/getChannel.d.ts +0 -32
- package/channel/api/getChannel.js +0 -47
- package/channel/api/getChannels.d.ts +0 -32
- package/channel/api/getChannels.js +0 -49
- package/channel/api/index.d.ts +0 -9
- package/channel/api/index.d.ts.map +0 -1
- package/channel/api/index.js +0 -8
- package/channel/api/joinChannel.d.ts +0 -16
- package/channel/api/joinChannel.js +0 -28
- package/channel/api/leaveChannel.d.ts +0 -16
- package/channel/api/leaveChannel.js +0 -28
- package/channel/api/queryChannels.d.ts +0 -42
- package/channel/api/queryChannels.d.ts.map +0 -1
- package/channel/api/queryChannels.js +0 -65
- package/channel/api/updateChannel.d.ts +0 -17
- package/channel/api/updateChannel.js +0 -28
- package/channel/events/index.d.ts +0 -7
- package/channel/events/index.js +0 -6
- package/channel/events/onChannelCreated.d.ts +0 -17
- package/channel/events/onChannelCreated.js +0 -28
- package/channel/events/onChannelDeleted.d.ts +0 -17
- package/channel/events/onChannelDeleted.js +0 -28
- package/channel/events/onChannelJoined.d.ts +0 -17
- package/channel/events/onChannelJoined.js +0 -28
- package/channel/events/onChannelLeft.d.ts +0 -17
- package/channel/events/onChannelLeft.js +0 -28
- package/channel/events/onChannelUpdated.d.ts +0 -17
- package/channel/events/onChannelUpdated.js +0 -28
- package/channel/events/onMemberAdded.d.ts +0 -17
- package/channel/events/onMemberAdded.js +0 -28
- package/channel/events/onMemberRemoved.d.ts +0 -17
- package/channel/events/onMemberRemoved.js +0 -28
- package/channel/observers/index.d.ts +0 -2
- package/channel/observers/index.js +0 -1
- package/channel/observers/observeChannel.d.ts +0 -20
- package/channel/observers/observeChannel.js +0 -44
- package/client/api/activeClient.d.ts +0 -17
- package/client/api/activeClient.js +0 -25
- package/client/api/connectClient.d.ts +0 -26
- package/client/api/connectClient.d.ts.map +0 -1
- package/client/api/connectClient.js +0 -48
- package/client/api/createClient.d.ts +0 -17
- package/client/api/createClient.js +0 -40
- package/client/api/disconnectClient.d.ts +0 -16
- package/client/api/disconnectClient.js +0 -27
- package/client/api/enableCache.d.ts +0 -15
- package/client/api/enableCache.d.ts.map +0 -1
- package/client/api/enableCache.js +0 -20
- package/client/api/getToken.d.ts +0 -19
- package/client/api/getToken.js +0 -23
- package/client/api/index.d.ts +0 -7
- package/client/api/index.d.ts.map +0 -1
- package/client/api/index.js +0 -6
- package/client/api/isConnected.d.ts +0 -14
- package/client/api/isConnected.js +0 -21
- package/client/events/index.d.ts +0 -2
- package/client/events/index.js +0 -1
- package/client/events/onClientDisconnected.d.ts +0 -17
- package/client/events/onClientDisconnected.js +0 -20
- package/comment/api/createComment.d.ts +0 -18
- package/comment/api/createComment.d.ts.map +0 -1
- package/comment/api/createComment.js +0 -43
- package/comment/api/deleteComment.d.ts +0 -16
- package/comment/api/deleteComment.js +0 -29
- package/comment/api/getComment.d.ts +0 -32
- package/comment/api/getComment.js +0 -47
- package/comment/api/getComments.d.ts +0 -32
- package/comment/api/getComments.js +0 -49
- package/comment/api/index.d.ts +0 -7
- package/comment/api/index.js +0 -6
- package/comment/api/queryComments.d.ts +0 -42
- package/comment/api/queryComments.d.ts.map +0 -1
- package/comment/api/queryComments.js +0 -72
- package/comment/api/updateComment.d.ts +0 -19
- package/comment/api/updateComment.js +0 -31
- package/comment/events/index.d.ts +0 -4
- package/comment/events/index.js +0 -3
- package/comment/events/onCommentCreated.d.ts +0 -17
- package/comment/events/onCommentCreated.js +0 -28
- package/comment/events/onCommentDeleted.d.ts +0 -17
- package/comment/events/onCommentDeleted.js +0 -28
- package/comment/events/onCommentUpdated.d.ts +0 -17
- package/comment/events/onCommentUpdated.js +0 -28
- package/comment/observers/index.d.ts +0 -3
- package/comment/observers/index.js +0 -2
- package/comment/observers/observeComment.d.ts +0 -20
- package/comment/observers/observeComment.js +0 -44
- package/comment/observers/observeComments.d.ts +0 -22
- package/comment/observers/observeComments.js +0 -38
- package/community/api/createCommunity.d.ts +0 -20
- package/community/api/createCommunity.js +0 -28
- package/community/api/deleteCommunity.d.ts +0 -16
- package/community/api/deleteCommunity.js +0 -26
- package/community/api/getCommunities.d.ts +0 -32
- package/community/api/getCommunities.js +0 -49
- package/community/api/getCommunity.d.ts +0 -32
- package/community/api/getCommunity.d.ts.map +0 -1
- package/community/api/getCommunity.js +0 -47
- package/community/api/index.d.ts +0 -9
- package/community/api/index.d.ts.map +0 -1
- package/community/api/index.js +0 -8
- package/community/api/joinCommunity.d.ts +0 -16
- package/community/api/joinCommunity.js +0 -31
- package/community/api/leaveCommunity.d.ts +0 -16
- package/community/api/leaveCommunity.js +0 -31
- package/community/api/queryCommunities.d.ts +0 -46
- package/community/api/queryCommunities.js +0 -68
- package/community/api/updateCommunity.d.ts +0 -17
- package/community/api/updateCommunity.js +0 -29
- package/community/events/index.d.ts +0 -6
- package/community/events/index.js +0 -5
- package/community/events/onCommunityCreated.d.ts +0 -17
- package/community/events/onCommunityCreated.js +0 -28
- package/community/events/onCommunityDeleted.d.ts +0 -17
- package/community/events/onCommunityDeleted.js +0 -28
- package/community/events/onCommunityJoined.d.ts +0 -17
- package/community/events/onCommunityJoined.js +0 -28
- package/community/events/onCommunityLeft.d.ts +0 -17
- package/community/events/onCommunityLeft.js +0 -28
- package/community/events/onCommunityUpdated.d.ts +0 -17
- package/community/events/onCommunityUpdated.js +0 -28
- package/community/observers/index.d.ts +0 -2
- package/community/observers/index.js +0 -1
- package/community/observers/observeCommunity.d.ts +0 -20
- package/community/observers/observeCommunity.js +0 -44
- package/core/cache/drop.d.ts +0 -11
- package/core/cache/drop.js +0 -21
- package/core/cache/index.d.ts +0 -19
- package/core/cache/index.js +0 -21
- package/core/cache/ingest.d.ts +0 -10
- package/core/cache/ingest.js +0 -19
- package/core/cache/merge.d.ts +0 -10
- package/core/cache/merge.js +0 -14
- package/core/cache/mutate.d.ts +0 -10
- package/core/cache/mutate.js +0 -19
- package/core/cache/pull.d.ts +0 -11
- package/core/cache/pull.js +0 -28
- package/core/cache/push.d.ts +0 -10
- package/core/cache/push.js +0 -30
- package/core/cache/sync.d.ts +0 -10
- package/core/cache/sync.js +0 -31
- package/core/debug.d.ts +0 -15
- package/core/debug.js +0 -20
- package/core/device.d.ts +0 -7
- package/core/device.js +0 -32
- package/core/errors.d.ts +0 -59
- package/core/errors.js +0 -70
- package/core/events.d.ts +0 -33
- package/core/events.js +0 -72
- package/core/model/createPayload.d.ts +0 -1
- package/core/model/createPayload.d.ts.map +0 -1
- package/core/model/createPayload.js +0 -1
- package/core/model/idResolvers.d.ts +0 -20
- package/core/model/idResolvers.d.ts.map +0 -1
- package/core/model/idResolvers.js +0 -36
- package/core/model/identifyModel.d.ts +0 -8
- package/core/model/identifyModel.d.ts.map +0 -1
- package/core/model/identifyModel.js +0 -28
- package/core/model/index.d.ts +0 -4
- package/core/model/index.js +0 -3
- package/core/model/toRecord.d.ts +0 -10
- package/core/model/toRecord.js +0 -9
- package/core/query/decorate.d.ts +0 -23
- package/core/query/decorate.d.ts.map +0 -1
- package/core/query/decorate.js +0 -40
- package/core/query/filtering.d.ts +0 -12
- package/core/query/filtering.js +0 -14
- package/core/query/index.d.ts +0 -6
- package/core/query/index.js +0 -5
- package/core/query/paging.d.ts +0 -58
- package/core/query/paging.d.ts.map +0 -1
- package/core/query/paging.js +0 -140
- package/core/query/query.d.ts +0 -121
- package/core/query/query.d.ts.map +0 -1
- package/core/query/query.js +0 -221
- package/core/query/sorting.d.ts +0 -33
- package/core/query/sorting.d.ts.map +0 -1
- package/core/query/sorting.js +0 -27
- package/core/stores/index.d.ts +0 -3
- package/core/stores/index.js +0 -2
- package/core/stores/memory.d.ts +0 -30
- package/core/stores/memory.d.ts.map +0 -1
- package/core/stores/memory.js +0 -47
- package/core/stores/persistent.d.ts +0 -13
- package/core/stores/persistent.js +0 -49
- package/core/transports.d.ts +0 -49
- package/core/transports.d.ts.map +0 -1
- package/core/transports.js +0 -130
- package/core/uuid.d.ts +0 -2
- package/core/uuid.js +0 -2
- package/feed/api/index.d.ts +0 -2
- package/feed/api/index.js +0 -1
- package/feed/api/queryGlobalFeed.d.ts +0 -23
- package/feed/api/queryGlobalFeed.js +0 -44
- package/file/api/createFile.d.ts +0 -16
- package/file/api/createFile.d.ts.map +0 -1
- package/file/api/createFile.js +0 -37
- package/file/api/deleteFile.d.ts +0 -16
- package/file/api/deleteFile.js +0 -25
- package/file/api/fileUrlwithSize.d.ts +0 -9
- package/file/api/fileUrlwithSize.d.ts.map +0 -1
- package/file/api/fileUrlwithSize.js +0 -10
- package/file/api/getFile.d.ts +0 -32
- package/file/api/getFile.js +0 -47
- package/file/api/index.d.ts +0 -5
- package/file/api/index.js +0 -4
- package/file/observers/index.d.ts +0 -2
- package/file/observers/index.js +0 -1
- package/file/observers/observeFile.d.ts +0 -20
- package/file/observers/observeFile.js +0 -40
- package/index.d.ts +0 -31
- package/index.d.ts.map +0 -1
- package/index.js +0 -40
- package/message/api/createMessage.d.ts +0 -38
- package/message/api/createMessage.js +0 -62
- package/message/api/deleteMessage.d.ts +0 -32
- package/message/api/deleteMessage.js +0 -52
- package/message/api/getMessage.d.ts +0 -32
- package/message/api/getMessage.js +0 -47
- package/message/api/getMessages.d.ts +0 -32
- package/message/api/getMessages.js +0 -49
- package/message/api/index.d.ts +0 -7
- package/message/api/index.js +0 -6
- package/message/api/queryMessages.d.ts +0 -55
- package/message/api/queryMessages.js +0 -109
- package/message/api/updateMessage.d.ts +0 -38
- package/message/api/updateMessage.js +0 -58
- package/message/events/index.d.ts +0 -4
- package/message/events/index.js +0 -3
- package/message/events/onMessageCreated.d.ts +0 -17
- package/message/events/onMessageCreated.js +0 -28
- package/message/events/onMessageDeleted.d.ts +0 -17
- package/message/events/onMessageDeleted.js +0 -28
- package/message/events/onMessageUpdated.d.ts +0 -17
- package/message/events/onMessageUpdated.js +0 -28
- package/message/observers/index.d.ts +0 -3
- package/message/observers/index.js +0 -2
- package/message/observers/observeMessage.d.ts +0 -22
- package/message/observers/observeMessage.js +0 -48
- package/message/observers/observeMessages.d.ts +0 -19
- package/message/observers/observeMessages.js +0 -39
- package/post/api/createPost.d.ts +0 -21
- package/post/api/createPost.js +0 -32
- package/post/api/deletePost.d.ts +0 -16
- package/post/api/deletePost.js +0 -32
- package/post/api/getPost.d.ts +0 -32
- package/post/api/getPost.js +0 -47
- package/post/api/getPosts.d.ts +0 -32
- package/post/api/getPosts.js +0 -49
- package/post/api/index.d.ts +0 -7
- package/post/api/index.js +0 -6
- package/post/api/queryPosts.d.ts +0 -45
- package/post/api/queryPosts.d.ts.map +0 -1
- package/post/api/queryPosts.js +0 -67
- package/post/api/updatePost.d.ts +0 -19
- package/post/api/updatePost.js +0 -31
- package/post/events/index.d.ts +0 -4
- package/post/events/index.js +0 -3
- package/post/events/onPostCreated.d.ts +0 -17
- package/post/events/onPostCreated.js +0 -28
- package/post/events/onPostDeleted.d.ts +0 -17
- package/post/events/onPostDeleted.js +0 -28
- package/post/events/onPostUpdated.d.ts +0 -17
- package/post/events/onPostUpdated.js +0 -28
- package/post/observers/index.d.ts +0 -3
- package/post/observers/index.js +0 -2
- package/post/observers/observePost.d.ts +0 -20
- package/post/observers/observePost.js +0 -44
- package/post/observers/observePosts.d.ts +0 -22
- package/post/observers/observePosts.d.ts.map +0 -1
- package/post/observers/observePosts.js +0 -40
- package/reaction/api/addReaction.d.ts +0 -36
- package/reaction/api/addReaction.js +0 -58
- package/reaction/api/index.d.ts +0 -3
- package/reaction/api/index.js +0 -2
- package/reaction/api/removeReaction.d.ts +0 -36
- package/reaction/api/removeReaction.js +0 -58
- package/reaction/events/index.d.ts +0 -2
- package/reaction/events/index.js +0 -1
- package/reaction/events/onReactionAdded.d.ts +0 -17
- package/reaction/events/onReactionAdded.js +0 -29
- package/reaction/events/onReactionRemoved.d.ts +0 -17
- package/reaction/events/onReactionRemoved.js +0 -28
- package/reaction/utils/dispatchReactable.d.ts +0 -3
- package/reaction/utils/dispatchReactable.js +0 -14
- package/reaction/utils/fetchReference.d.ts +0 -3
- package/reaction/utils/fetchReference.js +0 -13
- package/reaction/utils/index.d.ts +0 -3
- package/reaction/utils/index.js +0 -2
- package/report/api/createReport.d.ts +0 -16
- package/report/api/createReport.js +0 -28
- package/report/api/deleteReport.d.ts +0 -16
- package/report/api/deleteReport.js +0 -28
- package/report/api/index.d.ts +0 -4
- package/report/api/index.js +0 -3
- package/report/api/isReportedByMe.d.ts +0 -16
- package/report/api/isReportedByMe.js +0 -26
- package/report/constants/referenceTypes.d.ts +0 -24
- package/report/constants/referenceTypes.js +0 -22
- package/stream/api/createStream.d.ts +0 -18
- package/stream/api/createStream.js +0 -24
- package/stream/api/deleteStream.d.ts +0 -16
- package/stream/api/deleteStream.js +0 -26
- package/stream/api/getStream.d.ts +0 -12
- package/stream/api/getStream.js +0 -20
- package/stream/api/index.d.ts +0 -6
- package/stream/api/index.js +0 -6
- package/stream/api/queryStreams.d.ts +0 -23
- package/stream/api/queryStreams.js +0 -37
- package/stream/api/updateStream.d.ts +0 -17
- package/stream/api/updateStream.js +0 -25
- package/stream/events/index.d.ts +0 -4
- package/stream/events/index.js +0 -3
- package/stream/events/onStreamRecorded.d.ts +0 -17
- package/stream/events/onStreamRecorded.js +0 -28
- package/stream/events/onStreamStarted.d.ts +0 -17
- package/stream/events/onStreamStarted.js +0 -28
- package/stream/events/onStreamStopped.d.ts +0 -17
- package/stream/events/onStreamStopped.js +0 -28
- package/tsconfig.tsbuildinfo +0 -1
- package/user/api/getUser.d.ts +0 -32
- package/user/api/getUser.js +0 -47
- package/user/api/getUsers.d.ts +0 -32
- package/user/api/getUsers.js +0 -47
- package/user/api/index.d.ts +0 -5
- package/user/api/index.js +0 -4
- package/user/api/queryUsers.d.ts +0 -43
- package/user/api/queryUsers.d.ts.map +0 -1
- package/user/api/queryUsers.js +0 -67
- package/user/api/updateUser.d.ts +0 -17
- package/user/api/updateUser.js +0 -33
- package/user/events/index.d.ts +0 -2
- package/user/events/index.js +0 -1
- package/user/events/onUserUpdated.d.ts +0 -17
- package/user/events/onUserUpdated.js +0 -28
- package/user/observers/index.d.ts +0 -2
- package/user/observers/index.js +0 -1
- package/user/observers/observeUser.d.ts +0 -19
- package/user/observers/observeUser.js +0 -43
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { pushToCache } from './push'
|
|
2
|
+
|
|
3
|
+
import { storeInterests } from '../model/idResolvers'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Ingest a payload (v3) into the cache
|
|
7
|
+
*
|
|
8
|
+
* @param payload a "backend v3" payload object
|
|
9
|
+
* @param order the order of the keys to process (in case of need)
|
|
10
|
+
*
|
|
11
|
+
* @category Cache
|
|
12
|
+
*/
|
|
13
|
+
export const ingestInCache = (
|
|
14
|
+
payload: Record<string, any[]> = {},
|
|
15
|
+
order = Object.keys(payload),
|
|
16
|
+
) => {
|
|
17
|
+
order
|
|
18
|
+
.forEach(key => {
|
|
19
|
+
const name = storeInterests[key]
|
|
20
|
+
if (!name) return
|
|
21
|
+
|
|
22
|
+
pushToCache(name, ...payload[key])
|
|
23
|
+
})
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getResolver } from '../model/idResolvers'
|
|
2
|
+
|
|
3
|
+
import { mutateCache } from './mutate'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Apply partial mutation to objects in the cache
|
|
7
|
+
*
|
|
8
|
+
* @param name The name of the store to query
|
|
9
|
+
* @param mutation A partial view of the object to update
|
|
10
|
+
*
|
|
11
|
+
* @category Cache
|
|
12
|
+
*/
|
|
13
|
+
export const mergeInCache = <T extends Amity.Domain>(
|
|
14
|
+
name: T,
|
|
15
|
+
mutation: Amity.Minimal[T] & Partial<Amity.Model[T]>
|
|
16
|
+
) => {
|
|
17
|
+
const key = getResolver(name)(mutation)
|
|
18
|
+
mutateCache(name, key, model => ({ ...model, ...mutation }))
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { pullFromCache } from './pull'
|
|
2
|
+
import { pushToCache } from './push'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Apply partial mutation to objects in the cache
|
|
6
|
+
*
|
|
7
|
+
* @param name The name of the store to query
|
|
8
|
+
* @param mutation A partial view of the object to update
|
|
9
|
+
*
|
|
10
|
+
* @category Cache
|
|
11
|
+
*/
|
|
12
|
+
export const mutateCache = <T extends Amity.Domain>(
|
|
13
|
+
name: T,
|
|
14
|
+
key: string,
|
|
15
|
+
mutator: (model: Amity.Model[T]) => Amity.Model[T] | undefined
|
|
16
|
+
) => {
|
|
17
|
+
const [model] = pullFromCache(name, key) ?? []
|
|
18
|
+
|
|
19
|
+
if (!model) return
|
|
20
|
+
|
|
21
|
+
const mutation = mutator(model)
|
|
22
|
+
mutation && pushToCache(name, { ...model, ...mutation })
|
|
23
|
+
|
|
24
|
+
return mutation
|
|
25
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pull objects from the cache layer
|
|
5
|
+
*
|
|
6
|
+
* @param name The name of the store to query
|
|
7
|
+
* @param keys A collection of unique keys for the store
|
|
8
|
+
* @returns The collection of objects matching the keys. Keys which don't match object will be omitted
|
|
9
|
+
*
|
|
10
|
+
* @category Cache
|
|
11
|
+
*/
|
|
12
|
+
export const pullFromCache = <K extends Amity.Domain>(name: K, ...keys: string[]) => {
|
|
13
|
+
const { cache } = getActiveClient()
|
|
14
|
+
const store = cache?.[name] as unknown as Amity.Store<Amity.Model[K]>
|
|
15
|
+
|
|
16
|
+
if (!cache || !store) return
|
|
17
|
+
|
|
18
|
+
const state = store.read() ?? {}
|
|
19
|
+
|
|
20
|
+
// return all
|
|
21
|
+
if (!keys?.length)
|
|
22
|
+
return Object.values(state)
|
|
23
|
+
|
|
24
|
+
// return some
|
|
25
|
+
return keys
|
|
26
|
+
.map(key => {
|
|
27
|
+
const localId = cache.lookup[`${name}#${key}`]
|
|
28
|
+
return state[localId]
|
|
29
|
+
})
|
|
30
|
+
.filter(Boolean)
|
|
31
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient'
|
|
2
|
+
|
|
3
|
+
import { getResolver } from '../model/idResolvers'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Pull objects from the cache layer
|
|
7
|
+
*
|
|
8
|
+
* @param name The name of the store to query
|
|
9
|
+
* @param models A collection of models t store
|
|
10
|
+
*
|
|
11
|
+
* @category Cache
|
|
12
|
+
*/
|
|
13
|
+
export const pushToCache = <T extends Amity.Domain>(
|
|
14
|
+
name: T,
|
|
15
|
+
...models: (Amity.Model[T])[]
|
|
16
|
+
) => {
|
|
17
|
+
const { cache } = getActiveClient()
|
|
18
|
+
|
|
19
|
+
const store = cache?.[name] as unknown as Amity.Store<Amity.Model[T]>
|
|
20
|
+
if (!cache || !store) return
|
|
21
|
+
|
|
22
|
+
const filtered = models.filter(Boolean)
|
|
23
|
+
if (!filtered.length) return
|
|
24
|
+
|
|
25
|
+
const synced = Object.fromEntries(
|
|
26
|
+
filtered.map(model => {
|
|
27
|
+
const modelId = getResolver(name)(model)
|
|
28
|
+
const localId = (cache.lookup[`${name}#${modelId}`] ??= model.localId)
|
|
29
|
+
|
|
30
|
+
// WARNING: shallow immutable
|
|
31
|
+
return [localId, {
|
|
32
|
+
// @ts-ignore: syncedAt is before "...model" so it can be manually overridden
|
|
33
|
+
syncedAt: Date.now(),
|
|
34
|
+
...model,
|
|
35
|
+
localId,
|
|
36
|
+
}]
|
|
37
|
+
})
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
store.write(synced)
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient'
|
|
2
|
+
|
|
3
|
+
import { identifyModel } from '../model/identifyModel'
|
|
4
|
+
|
|
5
|
+
import { dropFromCache } from './drop'
|
|
6
|
+
import { pushToCache } from './push'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Sync-up local ids of objects in the cache
|
|
10
|
+
*
|
|
11
|
+
* @param original The object holding the localId to keep
|
|
12
|
+
* @param replacement The object holding the localId to discard
|
|
13
|
+
*
|
|
14
|
+
* @category Cache
|
|
15
|
+
*/
|
|
16
|
+
export const syncInCache = <T extends Amity.Domain>(
|
|
17
|
+
original: Amity.Model[T],
|
|
18
|
+
replacement: Amity.Model[T],
|
|
19
|
+
) => {
|
|
20
|
+
const { cache, log } = getActiveClient()
|
|
21
|
+
|
|
22
|
+
const name = identifyModel(original) ?? identifyModel(replacement)
|
|
23
|
+
|
|
24
|
+
if (!name) {
|
|
25
|
+
log('syncInCache', 'could not identify the models', { original, replacement })
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const store = cache?.[name] as unknown as Amity.Store<Amity.Model[T]>
|
|
30
|
+
if (!cache || !store) return
|
|
31
|
+
|
|
32
|
+
// remove the object from cache (it's cleaner this way)
|
|
33
|
+
dropFromCache(name, original)
|
|
34
|
+
dropFromCache(name, replacement)
|
|
35
|
+
|
|
36
|
+
// glue the localIds together
|
|
37
|
+
replacement.localId = original.localId
|
|
38
|
+
|
|
39
|
+
// put back the replacement after (again, it's cleaner this way)
|
|
40
|
+
pushToCache(name, replacement)
|
|
41
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import debug from 'debug'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a pre-configured logger instance
|
|
5
|
+
*
|
|
6
|
+
* @param session The name of the debug session
|
|
7
|
+
* @returns A pre-configured logger function
|
|
8
|
+
*
|
|
9
|
+
* @category Debug
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export const createLogger = (session?: string) => {
|
|
13
|
+
const active = (
|
|
14
|
+
`${session?.trim()}`.length > 0
|
|
15
|
+
&& process.env.NODE_ENV !== 'production'
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
const logger = debug(session!)
|
|
19
|
+
|
|
20
|
+
const print = (topic: string, ...args: any[]) => {
|
|
21
|
+
active && logger(topic, args)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
print.__instance__ = logger
|
|
25
|
+
return print
|
|
26
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// TODO: find a way to uniquely identify the device
|
|
2
|
+
// import { getStorage } from './storage'
|
|
3
|
+
|
|
4
|
+
/** @hidden */
|
|
5
|
+
const VERSION = '11.0.0'
|
|
6
|
+
|
|
7
|
+
/** @hidden */
|
|
8
|
+
export const getDeviceId = () => {
|
|
9
|
+
// here maybe put some auto detection of the device id based on if it's react or not?
|
|
10
|
+
// anyhow we let consumer branch out if they want, but it doesn't mean we shouldn't try to be nice
|
|
11
|
+
// and do things automatically
|
|
12
|
+
// https://www.npmjs.com/package/react-native-device-info#getuniqueid
|
|
13
|
+
// how to make sure that the react native package will not be included when build is for web
|
|
14
|
+
return `ascWebSdk#${Math.random().toString(16)}`
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @hidden */
|
|
18
|
+
export const getDeviceModel = () => {
|
|
19
|
+
if (process?.versions?.node)
|
|
20
|
+
return process.versions.node
|
|
21
|
+
|
|
22
|
+
if (navigator)
|
|
23
|
+
return `${navigator.product.toLowerCase()}#${navigator.userAgent ?? 'unknown_agent'}`
|
|
24
|
+
|
|
25
|
+
return 'unknown_model'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** @hidden */
|
|
29
|
+
export const getDeviceInfo = (): Amity.Device['deviceInfo'] => {
|
|
30
|
+
const model = getDeviceModel()
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
version: VERSION,
|
|
34
|
+
// TODO: replace with: kind: process.versions ? 'node' : 'web', when backend has fixed this
|
|
35
|
+
kind: 'web',
|
|
36
|
+
model,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic ASC error
|
|
3
|
+
* @category Errors
|
|
4
|
+
*/
|
|
5
|
+
export class ASCError extends Error {
|
|
6
|
+
readonly type: string = 'ASC'
|
|
7
|
+
readonly timestamp: number = Date.now()
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param message A custom error message
|
|
11
|
+
* @param code A normalized error code
|
|
12
|
+
* @param level A normalized failure level descriptor
|
|
13
|
+
*/
|
|
14
|
+
constructor(
|
|
15
|
+
message: string,
|
|
16
|
+
public readonly code: Amity.ClientError,
|
|
17
|
+
public readonly level: Amity.ErrorLevel,
|
|
18
|
+
) {
|
|
19
|
+
super(`Amity SDK (${code}): ${message}`)
|
|
20
|
+
|
|
21
|
+
if (Error.captureStackTrace)
|
|
22
|
+
Error.captureStackTrace(this, ASCError)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* API level error
|
|
28
|
+
* @category Errors
|
|
29
|
+
*/
|
|
30
|
+
export class ASCApiError extends ASCError {
|
|
31
|
+
/**
|
|
32
|
+
* @param code A normalized error code
|
|
33
|
+
* @param level A normalized failure level descriptor
|
|
34
|
+
*/
|
|
35
|
+
constructor(
|
|
36
|
+
message: string,
|
|
37
|
+
code: Amity.ClientError,
|
|
38
|
+
level: Amity.ErrorLevel,
|
|
39
|
+
) {
|
|
40
|
+
super(message, code, level)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Unexpected error
|
|
46
|
+
* @category Errors
|
|
47
|
+
*/
|
|
48
|
+
export class ASCUnknownError extends ASCError {
|
|
49
|
+
/**
|
|
50
|
+
* @param code A normalized error code
|
|
51
|
+
* @param level A normalized failure level descriptor
|
|
52
|
+
*/
|
|
53
|
+
constructor(
|
|
54
|
+
code: Amity.ClientError = Amity.ClientError.UNKNOWN_ERROR,
|
|
55
|
+
level: Amity.ErrorLevel = Amity.ErrorLevel.FATAL,
|
|
56
|
+
) {
|
|
57
|
+
super('Unexpected error', code, level)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Network related error
|
|
63
|
+
* @category Errors
|
|
64
|
+
*/
|
|
65
|
+
export class ASCConnectionError extends ASCError {
|
|
66
|
+
/**
|
|
67
|
+
* @param message A custom error message
|
|
68
|
+
*/
|
|
69
|
+
constructor(message: string = 'SDK client is having connection issues') {
|
|
70
|
+
super(message, Amity.ClientError.CONNECTION_ERROR, Amity.ErrorLevel.ERROR)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Input sanitization related error
|
|
76
|
+
* @category Errors
|
|
77
|
+
*/
|
|
78
|
+
export class ASCInvalidParameterError extends ASCError {
|
|
79
|
+
/**
|
|
80
|
+
* @param message A custom error message
|
|
81
|
+
*/
|
|
82
|
+
constructor(message: string) {
|
|
83
|
+
super(message, Amity.ClientError.INVALID_PARAMETERS, Amity.ErrorLevel.ERROR)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import mitt from 'mitt'
|
|
2
|
+
|
|
3
|
+
import { getActiveClient } from '~/client/api/activeClient'
|
|
4
|
+
|
|
5
|
+
// need to sync up the list
|
|
6
|
+
const EVENTS = [
|
|
7
|
+
'disconnected',
|
|
8
|
+
|
|
9
|
+
'v3.user.didUpdate',
|
|
10
|
+
|
|
11
|
+
'v3.channel.didUpdate',
|
|
12
|
+
'v3.channel.didUpdate',
|
|
13
|
+
'v3.channel.didJoin',
|
|
14
|
+
'v3.channel.didLeave',
|
|
15
|
+
'v3.channel.didAddUsers',
|
|
16
|
+
'v3.channel.didRemoveUsers',
|
|
17
|
+
'v3.channel.didBan',
|
|
18
|
+
'v3.channel.didUnban',
|
|
19
|
+
|
|
20
|
+
'v3.message.didCreate',
|
|
21
|
+
'v3.message.didUpdate',
|
|
22
|
+
'v3.message.didDelete',
|
|
23
|
+
] as const
|
|
24
|
+
|
|
25
|
+
/** @hidden */
|
|
26
|
+
export const createEventEmitter = () => {
|
|
27
|
+
return mitt<Amity.Events>()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Wraps the websocket events into the client's event emitter for
|
|
32
|
+
* abstraction of transport.
|
|
33
|
+
*
|
|
34
|
+
* @param ws A websocket connection to listen from
|
|
35
|
+
* @param emitter An event emitter to wire the events to
|
|
36
|
+
*
|
|
37
|
+
* @category Transport
|
|
38
|
+
* @hidden
|
|
39
|
+
*/
|
|
40
|
+
export const proxyWebsocketEvents = (ws: Amity.Client['ws'], emitter: Amity.Client['emitter']) => {
|
|
41
|
+
EVENTS.forEach(event => {
|
|
42
|
+
ws.on(event, (param: Amity.Events[typeof event]) => emitter.emit(event, param))
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Standardize the subscription of SSE through web sockets
|
|
48
|
+
*
|
|
49
|
+
* @param client The current client for which to subscribe the event to
|
|
50
|
+
* @param namespace A unique name for the logger
|
|
51
|
+
* @param event The websocket event name
|
|
52
|
+
* @param fn A wrapper for the callback.
|
|
53
|
+
* @returns A dispose function to unsubscribe to the event
|
|
54
|
+
*
|
|
55
|
+
* @category Transport
|
|
56
|
+
* @hidden
|
|
57
|
+
*/
|
|
58
|
+
export const createEventSubscriber = <T extends keyof Amity.Events>(
|
|
59
|
+
client: Amity.Client,
|
|
60
|
+
namespace: string,
|
|
61
|
+
event: T,
|
|
62
|
+
fn: Amity.Listener<Amity.Events[T]>,
|
|
63
|
+
): Amity.Unsubscriber => {
|
|
64
|
+
const { log, emitter } = client
|
|
65
|
+
|
|
66
|
+
const timestamp = Date.now()
|
|
67
|
+
log(`${namespace}(tmpid: ${timestamp}) > listen`)
|
|
68
|
+
|
|
69
|
+
const handler = (...payload: Parameters<typeof fn>) => {
|
|
70
|
+
log(`${namespace}(tmpid: ${timestamp}) > trigger`, payload)
|
|
71
|
+
fn(...payload)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
emitter.on(event, handler)
|
|
75
|
+
|
|
76
|
+
return () => {
|
|
77
|
+
log(`${namespace}(tmpid: ${timestamp}) > dispose`)
|
|
78
|
+
emitter.off(event, handler)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Wrapper around dispatch event
|
|
84
|
+
*
|
|
85
|
+
* @hidden
|
|
86
|
+
*/
|
|
87
|
+
export const fireEvent = <T extends keyof Amity.Events>(
|
|
88
|
+
event: T,
|
|
89
|
+
payload: Amity.Events[T],
|
|
90
|
+
) => {
|
|
91
|
+
const { emitter } = getActiveClient()
|
|
92
|
+
setTimeout(() => { emitter.emit(event, payload) }, 0)
|
|
93
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A resolver function is a function which, given a minimal version of a model T
|
|
3
|
+
* can compute a string which is capable of identifying the given model uniquely
|
|
4
|
+
* @hidden
|
|
5
|
+
*/
|
|
6
|
+
type Resolver<T extends Amity.Domain> = (model: Amity.Minimal[T]) => string
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Manually computed type to output a dictionary of { Domain: Amity.Resolver<Model> }
|
|
10
|
+
* with proper typing based on T
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
type Resolvers<T extends Amity.Domain[] = Amity.Domain[]> = {
|
|
14
|
+
[K in T[number]]: Resolver<K>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Dictionary of resolver functions for each model
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
const idResolvers: Resolvers = {
|
|
22
|
+
user: ({ userId }) => userId,
|
|
23
|
+
file: ({ fileId }) => fileId,
|
|
24
|
+
role: ({ roleId }) => roleId,
|
|
25
|
+
|
|
26
|
+
channel: ({ channelId }) => channelId,
|
|
27
|
+
channelUsers: ({ channelId, userId }) => `${channelId}#${userId}`,
|
|
28
|
+
message: ({ messageId }) => messageId,
|
|
29
|
+
|
|
30
|
+
community: ({ communityId }) => communityId,
|
|
31
|
+
communityUsers: ({ communityId, userId }) => `${communityId}#${userId}`,
|
|
32
|
+
post: ({ postId }) => postId,
|
|
33
|
+
comment: ({ commentId }) => commentId,
|
|
34
|
+
|
|
35
|
+
stream: ({ streamId }) => streamId,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Retrieve the id resolver matching a domain name
|
|
40
|
+
*
|
|
41
|
+
* @param name the domain name for the resolve
|
|
42
|
+
* @returns an idResolver for the given domain name
|
|
43
|
+
*/
|
|
44
|
+
export const getResolver = <T extends Amity.Domain>(name: T) => (
|
|
45
|
+
idResolvers[name] as Resolver<T>
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A map of v3 response keys to a store name.
|
|
50
|
+
* @hidden
|
|
51
|
+
*/
|
|
52
|
+
export const storeInterests: Record<string, Amity.Domain> = {
|
|
53
|
+
users: 'user',
|
|
54
|
+
files: 'file',
|
|
55
|
+
roles: 'role',
|
|
56
|
+
|
|
57
|
+
channels: 'channel',
|
|
58
|
+
channelUsers: 'channelUsers',
|
|
59
|
+
messages: 'message',
|
|
60
|
+
|
|
61
|
+
communities: 'community',
|
|
62
|
+
communityUsers: 'communityUsers',
|
|
63
|
+
posts: 'post',
|
|
64
|
+
postChildren: 'post',
|
|
65
|
+
comments: 'comment',
|
|
66
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** hidden */
|
|
2
|
+
/** @hidden */
|
|
3
|
+
const CRITERIAS: Record<Amity.Domain, string[]> = {
|
|
4
|
+
'file': ['fileId', 'attributes'],
|
|
5
|
+
'user': ['userId', 'avatarFileId'],
|
|
6
|
+
'role': ['roleId'],
|
|
7
|
+
'channel': ['channelId', 'rateLimit'],
|
|
8
|
+
'channelUsers': ['channelId', 'userId', 'membership'],
|
|
9
|
+
'message': ['messageId'],
|
|
10
|
+
'community': ['communityId', 'onlyAdminCanPost'],
|
|
11
|
+
'communityUsers': ['userId', 'communityId', 'communityMembership'],
|
|
12
|
+
'post': ['postId', 'feedId'],
|
|
13
|
+
'comment': ['commentId', 'referenceId'],
|
|
14
|
+
'stream': ['streamId'],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @hidden */
|
|
18
|
+
const hasKeys = (object: { [k: string]: any }, needles: string[]) => {
|
|
19
|
+
const haystack = Object.keys(object)
|
|
20
|
+
return needles.every(needle => haystack.includes(needle))
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Finds the name of the store for a given unknown model
|
|
25
|
+
*
|
|
26
|
+
* @param model one of the {@link Amity.Model} to identify
|
|
27
|
+
* @returns the name of the corresponding store
|
|
28
|
+
*/
|
|
29
|
+
export const identifyModel = (model: Amity.Model[Amity.Domain]) => {
|
|
30
|
+
const criterias = Object.entries(CRITERIAS) as [Amity.Domain, string[]][]
|
|
31
|
+
return criterias.find(([_, keys]) => hasKeys(model, keys))?.[0]
|
|
32
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* converts an array looking collection to an object collection, grouped by localId
|
|
3
|
+
*
|
|
4
|
+
* @param array array of {@link Amity.Syncable}
|
|
5
|
+
* @returns array converted to object, grouped by localId
|
|
6
|
+
*
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export const toRecord = <T extends Amity.Syncable>(array: T[]): Record<string, T> => (
|
|
10
|
+
array.reduce((acc, item) => ({ ...acc, [item.localId]: item }), {})
|
|
11
|
+
)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { uuid } from '~/core/uuid'
|
|
2
|
+
|
|
3
|
+
import { getActiveClient } from '~/client/api'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
getResolver,
|
|
7
|
+
identifyModel,
|
|
8
|
+
storeInterests,
|
|
9
|
+
} from '../model'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Set the model's syncedAt property and localId
|
|
13
|
+
*
|
|
14
|
+
* @param model the model to decorate
|
|
15
|
+
* @param timestamp the given timestamp
|
|
16
|
+
*/
|
|
17
|
+
export const decoratePayload = (
|
|
18
|
+
payload: Record<string, object[]>,
|
|
19
|
+
timestamp: number = Date.now(),
|
|
20
|
+
keyMapping: Record<string, Amity.Domain> = storeInterests,
|
|
21
|
+
) => {
|
|
22
|
+
Object.fromEntries(
|
|
23
|
+
Object.entries(payload)
|
|
24
|
+
.map(([key, models]) => ([
|
|
25
|
+
key, decorateModels(models as any[], timestamp, keyMapping[key])
|
|
26
|
+
]))
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Set the model's syncedAt property and localId
|
|
32
|
+
*
|
|
33
|
+
* @param model the model to decorate
|
|
34
|
+
* @param timestamp the given timestamp
|
|
35
|
+
*/
|
|
36
|
+
export const decorateModels = <T extends Amity.Model[Amity.Domain]>(
|
|
37
|
+
models: T[],
|
|
38
|
+
timestamp: number = Date.now(),
|
|
39
|
+
type?: Amity.Domain
|
|
40
|
+
) => {
|
|
41
|
+
models.forEach(model => decorateModel(model, timestamp, type))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Set the model's syncedAt property and localId
|
|
46
|
+
*
|
|
47
|
+
* @param model the model to decorate
|
|
48
|
+
* @param syncedAt the given timestamp
|
|
49
|
+
* @param type An opportunity to manually pass the type. If undefined, it will be smartly computed
|
|
50
|
+
*/
|
|
51
|
+
export const decorateModel = <T extends Amity.Model[Amity.Domain]>(
|
|
52
|
+
model: T,
|
|
53
|
+
timestamp: number = Date.now(),
|
|
54
|
+
type = identifyModel(model)
|
|
55
|
+
) => {
|
|
56
|
+
model.syncedAt ??= timestamp
|
|
57
|
+
|
|
58
|
+
const { cache } = getActiveClient()
|
|
59
|
+
|
|
60
|
+
if (type) {
|
|
61
|
+
const modelId = getResolver(type)(model)
|
|
62
|
+
model.localId = cache?.lookup[`${type}#${modelId}`] ?? uuid()
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Note:
|
|
2
|
+
// this file should contain a suite of filtering utilities to help the
|
|
3
|
+
// local version of the query functions.
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Filter a given collection with strict equality against a param
|
|
7
|
+
*
|
|
8
|
+
* @param collection the collection to filter
|
|
9
|
+
* @param key the key of the collection's items to challenge
|
|
10
|
+
* @param value the expected value
|
|
11
|
+
* @returns a filtered collection with items only matching the criteria
|
|
12
|
+
*
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
export const filterByPropEquality = <T = {}>(collection: T[], key: keyof T, value: any) => (
|
|
16
|
+
value !== undefined ? collection.filter(item => item[key] === value) : collection
|
|
17
|
+
)
|