@messenger-box/platform-client 10.0.3-alpha.17 → 10.0.3-alpha.171
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/lib/graphql/fragments/post-message.gql +36 -0
- package/lib/graphql/id-generation.js.map +1 -1
- package/lib/graphql/index.js.map +1 -1
- package/lib/graphql/mutations/channel-mutation.gql +5 -0
- package/lib/graphql/mutations/messages-mutation.gql +3 -0
- package/lib/graphql/policies/channel-policies.d.ts.map +1 -1
- package/lib/graphql/policies/channel-policies.js +150 -2
- package/lib/graphql/policies/channel-policies.js.map +1 -1
- package/lib/graphql/policies/messages-policies.d.ts.map +1 -1
- package/lib/graphql/policies/messages-policies.js +229 -37
- package/lib/graphql/policies/messages-policies.js.map +1 -1
- package/lib/graphql/policies/post-thread-policies.d.ts.map +1 -1
- package/lib/graphql/policies/post-thread-policies.js +136 -31
- package/lib/graphql/policies/post-thread-policies.js.map +1 -1
- package/lib/graphql/policies/posts-policies.js.map +1 -1
- package/lib/graphql/policies/teams-policies.d.ts.map +1 -1
- package/lib/graphql/policies/teams-policies.js +13 -1
- package/lib/graphql/policies/teams-policies.js.map +1 -1
- package/lib/graphql/policies/user-account-policies.js.map +1 -1
- package/lib/graphql/policies/user-policies.js.map +1 -1
- package/lib/graphql/queries/channels-by-user.gql +26 -0
- package/lib/graphql/queries/messages.gql +2 -2
- package/lib/graphql/queries/organization-query.gql +70 -35
- package/lib/graphql/queries/post-thread-message.gql +4 -0
- package/lib/graphql/queries/teams-query.gql +29 -29
- package/lib/graphql/queries/user-account.gql +1 -1
- package/lib/graphql/queries/users.gql +1 -1
- package/lib/graphql/schema/index.js.map +1 -1
- package/lib/graphql/subscription/fileUpdated.gql +11 -0
- package/lib/hooks/use-base-file-upload.hook.d.ts.map +1 -1
- package/lib/hooks/use-upload-file.hook.d.ts +1 -1
- package/lib/hooks/use-upload-file.hook.d.ts.map +1 -1
- package/lib/hooks/use-upload-file.hook.js +1 -1
- package/lib/hooks/use-upload-file.hook.js.map +1 -1
- package/lib/hooks/use-upload-file.hook.native.d.ts +1 -1
- package/lib/hooks/use-upload-file.hook.native.d.ts.map +1 -1
- package/lib/hooks/use-upload-file.hook.native.js +1 -1
- package/lib/hooks/use-upload-file.hook.native.js.map +1 -1
- package/lib/hooks/use-upload-files.hook.d.ts +1 -1
- package/lib/hooks/use-upload-files.hook.d.ts.map +1 -1
- package/lib/hooks/use-upload-files.hook.js +1 -1
- package/lib/hooks/use-upload-files.hook.js.map +1 -1
- package/lib/hooks/use-upload-files.hook.native.d.ts +1 -1
- package/lib/hooks/use-upload-files.hook.native.d.ts.map +1 -1
- package/lib/hooks/use-upload-files.hook.native.js +1 -1
- package/lib/hooks/use-upload-files.hook.native.js.map +1 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +4 -4
- package/CHANGELOG.md +0 -141
- package/jest.config.js +0 -25
- package/rollup.config.mjs +0 -36
- package/src/graphql/fragments/configuration.gql +0 -12
- package/src/graphql/fragments/extended-user-account.gql +0 -10
- package/src/graphql/fragments/file-info.gql +0 -12
- package/src/graphql/fragments/messenger-user.gql +0 -15
- package/src/graphql/fragments/minimal-user.gql +0 -9
- package/src/graphql/fragments/post-message.gql +0 -116
- package/src/graphql/fragments/post-thread-message.gql +0 -77
- package/src/graphql/fragments/user.gql +0 -11
- package/src/graphql/id-generation.ts +0 -8
- package/src/graphql/index.ts +0 -24
- package/src/graphql/mutations/channel-mutation.gql +0 -72
- package/src/graphql/mutations/expo-notification-token.gql +0 -13
- package/src/graphql/mutations/message-threads-mutation.gql +0 -44
- package/src/graphql/mutations/messages-mutation.gql +0 -110
- package/src/graphql/mutations/messages-mutation.gql.bk +0 -66
- package/src/graphql/mutations/organization-mutation.gql.bk +0 -14
- package/src/graphql/mutations/teams-mutation.gql.bk +0 -8
- package/src/graphql/policies/channel-policies.ts +0 -7
- package/src/graphql/policies/index.ts +0 -7
- package/src/graphql/policies/messages-policies.ts +0 -109
- package/src/graphql/policies/post-thread-policies.ts +0 -59
- package/src/graphql/policies/posts-policies.ts +0 -110
- package/src/graphql/policies/teams-policies.ts +0 -7
- package/src/graphql/policies/user-account-policies.ts +0 -15
- package/src/graphql/policies/user-policies.ts +0 -32
- package/src/graphql/queries/channel.gql +0 -57
- package/src/graphql/queries/channels-by-user.gql +0 -60
- package/src/graphql/queries/check-for-new-messages.gql +0 -5
- package/src/graphql/queries/file-url.gql +0 -5
- package/src/graphql/queries/get-device-token.gql +0 -8
- package/src/graphql/queries/messages.gql +0 -28
- package/src/graphql/queries/organization-query.gql +0 -90
- package/src/graphql/queries/post-message.gql +0 -8
- package/src/graphql/queries/post-thread-message.gql +0 -20
- package/src/graphql/queries/support-service-channels.gql +0 -18
- package/src/graphql/queries/teams-query.gql +0 -32
- package/src/graphql/queries/user-account.gql +0 -5
- package/src/graphql/queries/users.gql +0 -48
- package/src/graphql/schema/index.ts +0 -6
- package/src/graphql/schema/messages.graphql +0 -5
- package/src/graphql/schema/post.graphql +0 -44
- package/src/graphql/schema/services.graphql +0 -6
- package/src/graphql/schema/user-account.graphql +0 -3
- package/src/graphql/subscription/chat-message-added.gql +0 -6
- package/src/graphql/subscription/public-post-added.gql +0 -5
- package/src/graphql/subscription/thread-chat-message-added.gql +0 -5
- package/src/graphql/subscription/thread-created-updated.gql +0 -12
- package/src/hooks/index.ts +0 -4
- package/src/hooks/use-base-file-upload.hook.ts +0 -148
- package/src/hooks/use-upload-file.hook.native.ts +0 -22
- package/src/hooks/use-upload-file.hook.ts +0 -22
- package/src/hooks/use-upload-files.hook.native.ts +0 -22
- package/src/hooks/use-upload-files.hook.ts +0 -22
- package/src/index.ts +0 -3
- package/src/inversify-containers/index.ts +0 -1
- package/src/inversify-containers/module.ts +0 -4
- package/src/packages/constants/constants.ts +0 -1831
- package/src/packages/types/channels.ts +0 -194
- package/src/packages/types/emojis.ts +0 -41
- package/src/packages/types/files.ts +0 -43
- package/src/packages/types/posts.ts +0 -155
- package/src/packages/types/reactions.ts +0 -8
- package/src/packages/types/teams.ts +0 -109
- package/src/packages/types/utilities.ts +0 -30
- package/src/services/index.ts +0 -0
- package/src/tests/mutation/__snapshots__/set-device-token.test.ts.snap +0 -18
- package/src/tests/mutation/set-device-token.test.ts +0 -85
- package/src/utils/constants.tsx +0 -1120
- package/src/utils/i18n.tsx +0 -15
- package/src/utils/index.ts +0 -34
- package/src/utils/post_list.ts +0 -54
- package/src/utils/post_utils.ts +0 -33
- package/src/utils/user_agent.tsx +0 -153
- package/src/utils/utils.tsx +0 -54
- package/tsconfig.json +0 -14
- package/webpack.config.js +0 -58
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
mutation SendThreadMessage(
|
|
2
|
-
$channelId: ID!,
|
|
3
|
-
$postParentId: String,
|
|
4
|
-
$responderId: String,
|
|
5
|
-
$threadMessageInput: ThreadMessageInput!,
|
|
6
|
-
$postId: ID
|
|
7
|
-
$postThreadId: ID
|
|
8
|
-
) {
|
|
9
|
-
sendThreadMessage(
|
|
10
|
-
channelId: $channelId,
|
|
11
|
-
postParentId: $postParentId,
|
|
12
|
-
responderId: $responderId,
|
|
13
|
-
threadMessageInput: $threadMessageInput,
|
|
14
|
-
postId: $postId
|
|
15
|
-
postThreadId: $postThreadId
|
|
16
|
-
) {
|
|
17
|
-
...ThreadMessageSent
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
mutation CreatePostThread(
|
|
22
|
-
$channelId: ID!,
|
|
23
|
-
$postParentId: String,
|
|
24
|
-
$responderId: String,
|
|
25
|
-
$threadMessageInput: ThreadMessageInput!,
|
|
26
|
-
$postId: ID
|
|
27
|
-
$postThreadId: ID
|
|
28
|
-
) {
|
|
29
|
-
createPostThread(
|
|
30
|
-
channelId: $channelId,
|
|
31
|
-
postParentId: $postParentId,
|
|
32
|
-
responderId: $responderId,
|
|
33
|
-
threadMessageInput: $threadMessageInput,
|
|
34
|
-
postId: $postId
|
|
35
|
-
postThreadId: $postThreadId
|
|
36
|
-
) {
|
|
37
|
-
lastMessage {
|
|
38
|
-
id
|
|
39
|
-
}
|
|
40
|
-
data {
|
|
41
|
-
id
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
mutation SendMessages(
|
|
2
|
-
$channelId:String!,
|
|
3
|
-
$content:String!,
|
|
4
|
-
$files:[ID!],
|
|
5
|
-
$postId: ID,
|
|
6
|
-
$createdBy: ID,
|
|
7
|
-
$notificationParams:ExpoNotificationData,
|
|
8
|
-
){
|
|
9
|
-
sendMessage(
|
|
10
|
-
channelId: $channelId,
|
|
11
|
-
messageInput: {
|
|
12
|
-
content: $content,
|
|
13
|
-
files: $files,
|
|
14
|
-
createdBy: $createdBy
|
|
15
|
-
notificationParams: $notificationParams
|
|
16
|
-
},
|
|
17
|
-
postId: $postId
|
|
18
|
-
){
|
|
19
|
-
...Post
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
mutation SendPublicMessage(
|
|
24
|
-
$channelId: String!,
|
|
25
|
-
$messageInput: MessageInput!
|
|
26
|
-
$postId: ID
|
|
27
|
-
){
|
|
28
|
-
sendPublicMessage(
|
|
29
|
-
channelId: $channelId,
|
|
30
|
-
messageInput: $messageInput,
|
|
31
|
-
postId: $postId
|
|
32
|
-
){
|
|
33
|
-
...Post
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
mutation SendExpoNotificationOnPost($postId: ID!, $notificationData: ExpoNotificationData!) {
|
|
38
|
-
sendExpoNotificationOnPost(postId: $postId, notificationData: $notificationData)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
mutation DeleteMessage(
|
|
42
|
-
$messageId:String!,
|
|
43
|
-
$channelId:String!
|
|
44
|
-
){
|
|
45
|
-
deleteMessage(
|
|
46
|
-
messageId: {
|
|
47
|
-
messageId: $messageId,
|
|
48
|
-
channelId: $channelId
|
|
49
|
-
}
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
mutation EditMessage(
|
|
54
|
-
$messageId:String!,
|
|
55
|
-
$channelId:String!,
|
|
56
|
-
$content:String!,
|
|
57
|
-
$files:[ID!]!
|
|
58
|
-
){
|
|
59
|
-
editMessage(
|
|
60
|
-
messageId: {
|
|
61
|
-
messageId: $messageId,
|
|
62
|
-
channelId: $channelId
|
|
63
|
-
},
|
|
64
|
-
messageInput: {
|
|
65
|
-
content: $content,
|
|
66
|
-
files: $files
|
|
67
|
-
}
|
|
68
|
-
){
|
|
69
|
-
id
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
mutation CreateMessageFileUploadLink($filename:String!, $postId: ID!){
|
|
74
|
-
createMessageFileUploadLink(postId:$postId, filename: $filename )
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
mutation AttachUploadedFileToMessage($postId:ID!, $file: UploadedFileInput!){
|
|
78
|
-
attachUploadedFileToMessage(postId: $postId, file: $file){
|
|
79
|
-
...FileInfo
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
mutation CreateMessageFilesUploadLink($filenames:[String!]!, $postId: ID!){
|
|
84
|
-
createMessageFilesUploadLink(postId:$postId, filenames: $filenames )
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
mutation AttachUploadedFilesToMessage($postId:ID!, $files: [UploadedFileInput!]!){
|
|
88
|
-
attachUploadedFilesToMessage(postId: $postId, files: $files){
|
|
89
|
-
...FileInfo
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
mutation DeleteMessageFile($url:String!){
|
|
94
|
-
deleteMessageFile(url:$url)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
#mutation PinMessage($messageId:String! , $messageInput:String! , $content:String!) {
|
|
99
|
-
# pinMessage(
|
|
100
|
-
# messageId: {
|
|
101
|
-
# messageId: $messageId,
|
|
102
|
-
# channelId: $channelId
|
|
103
|
-
# },
|
|
104
|
-
# messageInput:{
|
|
105
|
-
# content: $content
|
|
106
|
-
# }
|
|
107
|
-
# ){
|
|
108
|
-
# id
|
|
109
|
-
# }
|
|
110
|
-
#}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
mutation SendMessages(
|
|
2
|
-
$channelId:String!,
|
|
3
|
-
$content:String!,
|
|
4
|
-
$files:[Upload!]!
|
|
5
|
-
){
|
|
6
|
-
sendMessage(
|
|
7
|
-
channelId: $channelId,
|
|
8
|
-
messageInput: {
|
|
9
|
-
content: $content,
|
|
10
|
-
files: $files
|
|
11
|
-
},
|
|
12
|
-
){
|
|
13
|
-
id
|
|
14
|
-
message
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
mutation DeleteMessage(
|
|
19
|
-
$messageId:String!,
|
|
20
|
-
$channelId:String!
|
|
21
|
-
){
|
|
22
|
-
deleteMessage(
|
|
23
|
-
messageId: {
|
|
24
|
-
messageId: $messageId,
|
|
25
|
-
channelId: $channelId
|
|
26
|
-
}
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
mutation EditMessage(
|
|
31
|
-
$messageId:String!,
|
|
32
|
-
$channelId:String!,
|
|
33
|
-
$content:String!,
|
|
34
|
-
$files:[Upload!]!
|
|
35
|
-
){
|
|
36
|
-
editMessage(
|
|
37
|
-
messageId: {
|
|
38
|
-
messageId: $messageId,
|
|
39
|
-
channelId: $channelId
|
|
40
|
-
},
|
|
41
|
-
messageInput: {
|
|
42
|
-
content: $content,
|
|
43
|
-
files: $files
|
|
44
|
-
}
|
|
45
|
-
){
|
|
46
|
-
id
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
#mutation UploadImg($files:[Upload!]!, $postId: String!){
|
|
51
|
-
# uploadFile(files: $files, postId: $postId)
|
|
52
|
-
#}
|
|
53
|
-
|
|
54
|
-
#mutation PinMessage($messageId:String! , $messageInput:String! , $content:String!) {
|
|
55
|
-
# pinMessage(
|
|
56
|
-
# messageId: {
|
|
57
|
-
# messageId: $messageId,
|
|
58
|
-
# channelId: $channelId
|
|
59
|
-
# },
|
|
60
|
-
# messageInput:{
|
|
61
|
-
# content: $content
|
|
62
|
-
# }
|
|
63
|
-
# ){
|
|
64
|
-
# id
|
|
65
|
-
# }
|
|
66
|
-
#}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
mutation CreateOrganization($organization: OrganizationCreateRequest!) {
|
|
2
|
-
createOrganization(organization: $organization) {
|
|
3
|
-
id
|
|
4
|
-
name
|
|
5
|
-
title
|
|
6
|
-
description
|
|
7
|
-
createdAt
|
|
8
|
-
updatedAt
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
mutation SendOrganizationInvitation($request: OrganizationInvitationRequest) {
|
|
13
|
-
sendOrganizationInvitation(request: $request)
|
|
14
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { TypePolicies } from '@apollo/client';
|
|
2
|
-
|
|
3
|
-
export const messagesPolicies: TypePolicies = {
|
|
4
|
-
Messages: {
|
|
5
|
-
// keyFields: ['messagesRefId'],
|
|
6
|
-
//keyFields: [],
|
|
7
|
-
// keyFields: ['data', ['channel', ['id']]],
|
|
8
|
-
fields: {
|
|
9
|
-
id: {
|
|
10
|
-
read(existing, { variables }) {
|
|
11
|
-
const { channelId, parentId }: any = variables;
|
|
12
|
-
return parentId ? `${channelId}-${parentId}` : `${channelId}`;
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
messagesRefId: {
|
|
16
|
-
read(existing, { variables }) {
|
|
17
|
-
const { channelId, parentId }: any = variables;
|
|
18
|
-
return parentId ? `${channelId}-${parentId}` : `${channelId}`;
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
data: {
|
|
22
|
-
keyArgs: false,
|
|
23
|
-
merge: (existing = [], incoming = [], { readField, mergeObjects }) => {
|
|
24
|
-
// console.log('existing', existing);
|
|
25
|
-
// console.log('incoming', incoming);
|
|
26
|
-
const merged = [...incoming];
|
|
27
|
-
const existingIds = existing.map((item) => readField<String>('id', item));
|
|
28
|
-
|
|
29
|
-
merged.forEach((item, index) => {
|
|
30
|
-
const itemId = readField<String>('id', item);
|
|
31
|
-
const existingIndex = existingIds.findIndex((id) => id === itemId);
|
|
32
|
-
if (existingIndex !== -1) {
|
|
33
|
-
merged[index] = mergeObjects(existing[existingIndex], merged[index]);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return merged;
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
totalCount: {
|
|
40
|
-
keyArgs: false,
|
|
41
|
-
merge(existing, incoming) {
|
|
42
|
-
return existing && existing > incoming ? existing : incoming;
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
// data: {
|
|
46
|
-
// merge(existing: any[], incoming: any[], { args }) {
|
|
47
|
-
// console.log('existing', JSON.stringify(existing), 'incoming', JSON.stringify(incoming));
|
|
48
|
-
// const merged = existing ? existing.slice(0) : [];
|
|
49
|
-
// // Insert the incoming elements in the right places, according to args.
|
|
50
|
-
// const end = args?.skip + Math.min(args?.limit, incoming.length);
|
|
51
|
-
// for (let i = args?.skip; i < end; ++i) {
|
|
52
|
-
// merged[i] = incoming[i - args?.skip];
|
|
53
|
-
// }
|
|
54
|
-
// return merged;
|
|
55
|
-
// },
|
|
56
|
-
// },
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
PostThreadMessages: {
|
|
60
|
-
// keyFields: ['threadmessagesRefId'],
|
|
61
|
-
fields: {
|
|
62
|
-
threadmessagesRefId: {
|
|
63
|
-
read(existing, { variables }) {
|
|
64
|
-
const { channelId, parentId }: any = variables;
|
|
65
|
-
return parentId ? `${channelId}-${parentId}` : `${channelId}`;
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
id: {
|
|
69
|
-
read(existing, { variables }) {
|
|
70
|
-
const { channelId, parentId }: any = variables;
|
|
71
|
-
return parentId ? `${channelId}-${parentId}` : `${channelId}`;
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
Query: {
|
|
77
|
-
fields: {
|
|
78
|
-
messages: {
|
|
79
|
-
// keyArgs: ['channelId', 'parentId', 'limit', 'skip'],
|
|
80
|
-
// keyArgs: ['channelId', 'parentId'],
|
|
81
|
-
merge(existing, incoming) {
|
|
82
|
-
return {
|
|
83
|
-
...incoming,
|
|
84
|
-
data: [...(existing?.data ?? []), ...(incoming.data ?? [])],
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
// merge(existing, incoming, { args, mergeObjects }) {
|
|
88
|
-
// console.log('existing length', existing?.data?.length);
|
|
89
|
-
// console.log('incoming length', incoming?.data?.length);
|
|
90
|
-
// // console.log('existing', JSON.stringify(existing), 'incoming', JSON.stringify(incoming));
|
|
91
|
-
// if (!incoming || incoming?.data?.length) return existing;
|
|
92
|
-
// if (!existing || existing?.data?.length) return incoming;
|
|
93
|
-
// //console.log('existing', JSON.stringify(existing), 'incoming', JSON.stringify(incoming));
|
|
94
|
-
// const mergedData = existing ? existing?.data?.slice(0) : [];
|
|
95
|
-
// // Insert the incoming elements in the right places, according to args.
|
|
96
|
-
// const end = args?.skip + Math.min(args?.limit, incoming?.data?.length);
|
|
97
|
-
// for (let i = args?.skip; i < end; ++i) {
|
|
98
|
-
// mergedData[i] = incoming?.data[i - args?.skip];
|
|
99
|
-
// }
|
|
100
|
-
|
|
101
|
-
// const merged = { ...incoming, data: mergedData };
|
|
102
|
-
// return merged;
|
|
103
|
-
// // return mergeObjects(existing, incoming);
|
|
104
|
-
// //return existing ? { ...existing, ...incoming } : incoming;
|
|
105
|
-
// },
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { TypePolicies } from '@apollo/client';
|
|
2
|
-
|
|
3
|
-
export const postThreadPolicies: TypePolicies = {
|
|
4
|
-
ThreadMessages: {
|
|
5
|
-
// keyFields: ['messagesRefId'],
|
|
6
|
-
//keyFields: [],
|
|
7
|
-
keyFields: ['data', ['channel', ['id']]],
|
|
8
|
-
fields: {
|
|
9
|
-
data: {
|
|
10
|
-
// keyArgs: false,
|
|
11
|
-
// merge: (existing = [], incoming = [], { readField, mergeObjects }) => {
|
|
12
|
-
// return existing ? [...existing, ...incoming] : incoming;
|
|
13
|
-
// // console.log('existing', existing);
|
|
14
|
-
// // console.log('incoming', incoming);
|
|
15
|
-
// // const merged = [...incoming];
|
|
16
|
-
// // const existingIds = existing.map((item) => readField<String>('id', item));
|
|
17
|
-
// // merged.forEach((item, index) => {
|
|
18
|
-
// // const itemId = readField<String>('id', item);
|
|
19
|
-
// // const existingIndex = existingIds.findIndex((id) => id === itemId);
|
|
20
|
-
// // if (existingIndex !== -1) {
|
|
21
|
-
// // merged[index] = mergeObjects(existing[existingIndex], merged[index]);
|
|
22
|
-
// // }
|
|
23
|
-
// // });
|
|
24
|
-
// // return merged;
|
|
25
|
-
// },
|
|
26
|
-
},
|
|
27
|
-
totalCount: {
|
|
28
|
-
// keyArgs: false,
|
|
29
|
-
// merge(existing, incoming) {
|
|
30
|
-
// return existing && existing > incoming ? existing : incoming;
|
|
31
|
-
// },
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
Query: {
|
|
36
|
-
fields: {
|
|
37
|
-
threadMessages: {
|
|
38
|
-
// keyArgs: ['channelId', 'parentId', 'limit', 'skip'],
|
|
39
|
-
keyArgs: ['channelId'],
|
|
40
|
-
//keyArgs: false,
|
|
41
|
-
merge(existing, incoming) {
|
|
42
|
-
// debugger;
|
|
43
|
-
return {
|
|
44
|
-
...incoming,
|
|
45
|
-
data: [...(existing?.data ?? []), ...(incoming.data ?? [])],
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
getPostThread: {
|
|
50
|
-
// keyArgs: ['channelId', 'parentId', 'limit', 'skip'],
|
|
51
|
-
keyArgs: ['channelId', 'postParentId', 'limit', 'skip', 'role'],
|
|
52
|
-
merge(existing, incoming, { mergeObjects }) {
|
|
53
|
-
// debugger;
|
|
54
|
-
return mergeObjects(existing, incoming);
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
};
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { TypePolicies } from '@apollo/client';
|
|
2
|
-
|
|
3
|
-
export const postPolicies: TypePolicies = {
|
|
4
|
-
Post: {
|
|
5
|
-
fields: {
|
|
6
|
-
isPinned: {
|
|
7
|
-
read() {
|
|
8
|
-
return false;
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
center: {
|
|
12
|
-
merge(existing = [], incoming: []) {
|
|
13
|
-
return incoming;
|
|
14
|
-
},
|
|
15
|
-
read() {
|
|
16
|
-
return true;
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
compactDisplay: {
|
|
20
|
-
merge(existing = [], incoming: []) {
|
|
21
|
-
return incoming;
|
|
22
|
-
},
|
|
23
|
-
read() {
|
|
24
|
-
return '';
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
isFirstReply: {
|
|
28
|
-
merge(existing = [], incoming: []) {
|
|
29
|
-
return incoming;
|
|
30
|
-
},
|
|
31
|
-
read() {
|
|
32
|
-
return '';
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
shouldHighlight: {
|
|
36
|
-
merge(existing = [], incoming: []) {
|
|
37
|
-
return incoming;
|
|
38
|
-
},
|
|
39
|
-
read() {
|
|
40
|
-
return '';
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
consecutivePostByUser: {
|
|
44
|
-
merge(existing = [], incoming: []) {
|
|
45
|
-
return incoming;
|
|
46
|
-
},
|
|
47
|
-
read() {
|
|
48
|
-
return '';
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
previousPostIsComment: {
|
|
52
|
-
read(_, { readField, toReference, }) {
|
|
53
|
-
const dt = readField('created_at');
|
|
54
|
-
return '';
|
|
55
|
-
},
|
|
56
|
-
merge(existing = [], incoming: []) {
|
|
57
|
-
return incoming;
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
isCommentMention: {
|
|
61
|
-
merge(existing = [], incoming: []) {
|
|
62
|
-
return incoming;
|
|
63
|
-
},
|
|
64
|
-
read() {
|
|
65
|
-
return '';
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
hasReplies: {
|
|
69
|
-
merge(existing = [], incoming: []) {
|
|
70
|
-
return incoming;
|
|
71
|
-
},
|
|
72
|
-
read() {
|
|
73
|
-
return '';
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
isLastPost: {
|
|
77
|
-
merge(existing = [], incoming: []) {
|
|
78
|
-
return incoming;
|
|
79
|
-
},
|
|
80
|
-
read() {
|
|
81
|
-
return '';
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
channelArchived: {
|
|
85
|
-
merge(existing = [], incoming: []) {
|
|
86
|
-
return incoming;
|
|
87
|
-
},
|
|
88
|
-
read() {
|
|
89
|
-
return '';
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
isFlagged: {
|
|
93
|
-
merge(existing = [], incoming: []) {
|
|
94
|
-
return incoming;
|
|
95
|
-
},
|
|
96
|
-
read() {
|
|
97
|
-
return '';
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
isCollapsedThreadsEnabled: {
|
|
101
|
-
merge(existing = [], incoming: []) {
|
|
102
|
-
return incoming;
|
|
103
|
-
},
|
|
104
|
-
read() {
|
|
105
|
-
return '';
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TypePolicies } from '@apollo/client';
|
|
2
|
-
|
|
3
|
-
export const userAccountPolicies: TypePolicies = {
|
|
4
|
-
UserAccount: {
|
|
5
|
-
fields: {
|
|
6
|
-
fullName: {
|
|
7
|
-
read(_, { readField, toReference, }) {
|
|
8
|
-
const givenName = readField('givenName');
|
|
9
|
-
const familyName = readField('familyName');
|
|
10
|
-
return `${givenName} ${familyName}`;
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { TypePolicies } from '@apollo/client';
|
|
2
|
-
|
|
3
|
-
export const userPolicies: TypePolicies = {
|
|
4
|
-
Query: {
|
|
5
|
-
fields: {
|
|
6
|
-
usersToChat: {
|
|
7
|
-
read(existing, { readField, args }) {
|
|
8
|
-
const allUsers: any = readField('getUsers');
|
|
9
|
-
return allUsers?.filter((usr) => {
|
|
10
|
-
const temp: any = readField('alias', usr);
|
|
11
|
-
if (temp.includes(args.auth0Id)) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
return true;
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
currentUser: {
|
|
19
|
-
read(existing, { readField, args }) {
|
|
20
|
-
const allUsers: any = readField('getUsers');
|
|
21
|
-
return allUsers?.filter((usr) => {
|
|
22
|
-
const temp: any = readField('alias', usr);
|
|
23
|
-
if (temp.includes(args.auth0Id)) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
})[0];
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
query GetAllChannel {
|
|
2
|
-
channels {
|
|
3
|
-
id
|
|
4
|
-
title
|
|
5
|
-
description
|
|
6
|
-
type
|
|
7
|
-
displayName
|
|
8
|
-
members {
|
|
9
|
-
id
|
|
10
|
-
user {
|
|
11
|
-
...MinimalUser
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
creator {
|
|
15
|
-
...MessengerUser
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
query ViewChannelDetail($id: String) {
|
|
21
|
-
viewChannelDetail(id: $id) {
|
|
22
|
-
id
|
|
23
|
-
title
|
|
24
|
-
description
|
|
25
|
-
type
|
|
26
|
-
displayName
|
|
27
|
-
orgName
|
|
28
|
-
topic
|
|
29
|
-
purpose
|
|
30
|
-
totalMsgCount
|
|
31
|
-
totalMsgCountRoot
|
|
32
|
-
lastPostAt
|
|
33
|
-
members {
|
|
34
|
-
id
|
|
35
|
-
user {
|
|
36
|
-
id
|
|
37
|
-
givenName
|
|
38
|
-
familyName
|
|
39
|
-
email
|
|
40
|
-
alias
|
|
41
|
-
picture
|
|
42
|
-
username
|
|
43
|
-
tokens {
|
|
44
|
-
type
|
|
45
|
-
token
|
|
46
|
-
valid
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
creator {
|
|
51
|
-
...MessengerUser
|
|
52
|
-
}
|
|
53
|
-
createdAt
|
|
54
|
-
updatedAt
|
|
55
|
-
deletedAt
|
|
56
|
-
}
|
|
57
|
-
}
|