@messenger-box/platform-client 0.0.1-alpha.411 → 0.0.1-alpha.420
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/CHANGELOG.md +4 -0
- package/lib/generated-model.d.ts +184 -39
- package/lib/index.js +112 -59
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/generated-model.tsx +186 -51
- package/src/graphql/fragments/post-message.gql +38 -0
- package/src/graphql/fragments/post-thread-message.gql +4 -5
- package/src/graphql/mutations/message-threads-mutation.gql +28 -1
- package/src/graphql/policies/messages-policies.ts +0 -1
- package/src/graphql/policies/post-thread-policies.ts +32 -23
- package/src/graphql/queries/post-thread-message.gql +10 -1
- package/src/graphql/subscription/thread-created-updated.gql +1 -1
- package/src/graphql/queries/get-new-mongoose-objectId.gql +0 -3
|
@@ -76,3 +76,41 @@ fragment PostReplies on Messages {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
}
|
|
79
|
+
|
|
80
|
+
fragment PostWithoutReplies on Post {
|
|
81
|
+
id
|
|
82
|
+
channel {
|
|
83
|
+
id
|
|
84
|
+
}
|
|
85
|
+
author {
|
|
86
|
+
...MessengerUser
|
|
87
|
+
}
|
|
88
|
+
isPinned
|
|
89
|
+
message
|
|
90
|
+
type
|
|
91
|
+
isDelivered
|
|
92
|
+
isRead
|
|
93
|
+
parentId
|
|
94
|
+
createdAt
|
|
95
|
+
fromServer
|
|
96
|
+
updatedAt
|
|
97
|
+
|
|
98
|
+
propsConfiguration {
|
|
99
|
+
...Configuration
|
|
100
|
+
}
|
|
101
|
+
props
|
|
102
|
+
files {
|
|
103
|
+
totalCount
|
|
104
|
+
data {
|
|
105
|
+
id
|
|
106
|
+
name
|
|
107
|
+
extension
|
|
108
|
+
mimeType
|
|
109
|
+
height
|
|
110
|
+
width
|
|
111
|
+
size
|
|
112
|
+
url
|
|
113
|
+
refType
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -13,7 +13,7 @@ fragment Threads on PostThread {
|
|
|
13
13
|
updatedAt
|
|
14
14
|
}
|
|
15
15
|
post {
|
|
16
|
-
...
|
|
16
|
+
...PostWithoutReplies
|
|
17
17
|
}
|
|
18
18
|
replyCount
|
|
19
19
|
lastReplyAt
|
|
@@ -41,7 +41,7 @@ fragment PostThread on PostThread {
|
|
|
41
41
|
# ...Post
|
|
42
42
|
# }
|
|
43
43
|
replies {
|
|
44
|
-
...
|
|
44
|
+
...PostWithoutReplies
|
|
45
45
|
}
|
|
46
46
|
# replyCount
|
|
47
47
|
# lastReplyAt
|
|
@@ -59,12 +59,11 @@ fragment PostThread on PostThread {
|
|
|
59
59
|
|
|
60
60
|
fragment ThreadMessageSent on ThreadMessageSent {
|
|
61
61
|
lastMessage{
|
|
62
|
-
...
|
|
62
|
+
...PostWithoutReplies
|
|
63
63
|
}
|
|
64
|
-
data{
|
|
64
|
+
data {
|
|
65
65
|
...PostThread
|
|
66
66
|
}
|
|
67
|
-
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
fragment PostThreadWithoutReplies on PostThread {
|
|
@@ -4,6 +4,7 @@ mutation SendThreadMessage(
|
|
|
4
4
|
$responderId: String,
|
|
5
5
|
$threadMessageInput: ThreadMessageInput!,
|
|
6
6
|
$postId: ID
|
|
7
|
+
$postThreadId: ID
|
|
7
8
|
) {
|
|
8
9
|
sendThreadMessage(
|
|
9
10
|
channelId: $channelId,
|
|
@@ -11,7 +12,33 @@ mutation SendThreadMessage(
|
|
|
11
12
|
responderId: $responderId,
|
|
12
13
|
threadMessageInput: $threadMessageInput,
|
|
13
14
|
postId: $postId
|
|
15
|
+
postThreadId: $postThreadId
|
|
14
16
|
) {
|
|
15
|
-
|
|
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
|
+
}
|
|
16
43
|
}
|
|
17
44
|
}
|
|
@@ -79,7 +79,6 @@ export const messagesPolicies: TypePolicies = {
|
|
|
79
79
|
// keyArgs: ['channelId', 'parentId', 'limit', 'skip'],
|
|
80
80
|
// keyArgs: ['channelId', 'parentId'],
|
|
81
81
|
merge(existing, incoming) {
|
|
82
|
-
// debugger;
|
|
83
82
|
return {
|
|
84
83
|
...incoming,
|
|
85
84
|
data: [...(existing?.data ?? []), ...(incoming.data ?? [])],
|
|
@@ -4,31 +4,31 @@ export const postThreadPolicies: TypePolicies = {
|
|
|
4
4
|
ThreadMessages: {
|
|
5
5
|
// keyFields: ['messagesRefId'],
|
|
6
6
|
//keyFields: [],
|
|
7
|
-
|
|
7
|
+
keyFields: ['data', ['channel', ['id']]],
|
|
8
8
|
fields: {
|
|
9
9
|
data: {
|
|
10
|
-
keyArgs: false,
|
|
11
|
-
merge: (existing = [], incoming = [], { readField, mergeObjects }) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
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
26
|
},
|
|
27
27
|
totalCount: {
|
|
28
|
-
keyArgs: false,
|
|
29
|
-
merge(existing, incoming) {
|
|
30
|
-
|
|
31
|
-
},
|
|
28
|
+
// keyArgs: false,
|
|
29
|
+
// merge(existing, incoming) {
|
|
30
|
+
// return existing && existing > incoming ? existing : incoming;
|
|
31
|
+
// },
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
},
|
|
@@ -36,15 +36,24 @@ export const postThreadPolicies: TypePolicies = {
|
|
|
36
36
|
fields: {
|
|
37
37
|
threadMessages: {
|
|
38
38
|
// keyArgs: ['channelId', 'parentId', 'limit', 'skip'],
|
|
39
|
-
|
|
39
|
+
keyArgs: ['channelId'],
|
|
40
|
+
//keyArgs: false,
|
|
40
41
|
merge(existing, incoming) {
|
|
41
|
-
|
|
42
|
+
// debugger;
|
|
42
43
|
return {
|
|
43
44
|
...incoming,
|
|
44
45
|
data: [...(existing?.data ?? []), ...(incoming.data ?? [])],
|
|
45
46
|
};
|
|
46
47
|
},
|
|
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
|
+
},
|
|
48
57
|
},
|
|
49
58
|
},
|
|
50
59
|
};
|
|
@@ -4,8 +4,17 @@ query ThreadMessages($channelId: ID, $postParentId: ID,$selectedFields: String,
|
|
|
4
4
|
data {
|
|
5
5
|
...PostThreadWithoutReplies
|
|
6
6
|
replies(limit: $repliesLimit2, skip: $repliesSkip2) {
|
|
7
|
-
...
|
|
7
|
+
...PostWithoutReplies
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
query GetPostThread($postThreadId: ID, $channelId: ID, $postParentId: ID, $role: String, $participantsIds: [String], $selectedFields: String, $limit: Int, $skip: Int, $sort: Sort) {
|
|
14
|
+
getPostThread(postThreadId: $postThreadId, channelId: $channelId, postParentId: $postParentId, role: $role, participantsIds: $participantsIds, selectedFields: $selectedFields) {
|
|
15
|
+
...PostThreadWithoutReplies
|
|
16
|
+
replies(limit: $limit, skip: $skip, sort: $sort) {
|
|
17
|
+
...PostWithoutReplies
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|