@messenger-box/platform-client 10.0.3-alpha.5 → 10.0.3-alpha.50

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/lib/graphql/fragments/post-message.gql +36 -0
  3. package/lib/graphql/policies/channel-policies.d.ts.map +1 -1
  4. package/lib/graphql/policies/channel-policies.js +63 -1
  5. package/lib/graphql/policies/channel-policies.js.map +1 -1
  6. package/lib/graphql/policies/messages-policies.d.ts.map +1 -1
  7. package/lib/graphql/policies/messages-policies.js +229 -37
  8. package/lib/graphql/policies/messages-policies.js.map +1 -1
  9. package/lib/graphql/policies/post-thread-policies.d.ts.map +1 -1
  10. package/lib/graphql/policies/post-thread-policies.js +136 -31
  11. package/lib/graphql/policies/post-thread-policies.js.map +1 -1
  12. package/lib/graphql/policies/teams-policies.d.ts.map +1 -1
  13. package/lib/graphql/policies/teams-policies.js +13 -1
  14. package/lib/graphql/policies/teams-policies.js.map +1 -1
  15. package/lib/graphql/queries/channels-by-user.gql +26 -0
  16. package/lib/graphql/queries/post-thread-message.gql +4 -0
  17. package/lib/hooks/use-upload-file.hook.d.ts.map +1 -1
  18. package/lib/hooks/use-upload-file.hook.js +1 -1
  19. package/lib/hooks/use-upload-file.hook.js.map +1 -1
  20. package/lib/hooks/use-upload-file.hook.native.d.ts.map +1 -1
  21. package/lib/hooks/use-upload-file.hook.native.js +1 -1
  22. package/lib/hooks/use-upload-file.hook.native.js.map +1 -1
  23. package/lib/hooks/use-upload-files.hook.d.ts.map +1 -1
  24. package/lib/hooks/use-upload-files.hook.js +1 -1
  25. package/lib/hooks/use-upload-files.hook.js.map +1 -1
  26. package/lib/hooks/use-upload-files.hook.native.d.ts.map +1 -1
  27. package/lib/hooks/use-upload-files.hook.native.js +1 -1
  28. package/lib/hooks/use-upload-files.hook.native.js.map +1 -1
  29. package/package.json +4 -4
  30. package/src/graphql/fragments/post-message.gql +36 -0
  31. package/src/graphql/policies/channel-policies.ts +59 -1
  32. package/src/graphql/policies/messages-policies.ts +251 -39
  33. package/src/graphql/policies/post-thread-policies.ts +151 -31
  34. package/src/graphql/policies/teams-policies.ts +13 -1
  35. package/src/graphql/queries/channels-by-user.gql +26 -0
  36. package/src/graphql/queries/post-thread-message.gql +4 -0
  37. package/src/hooks/use-upload-file.hook.native.ts +1 -4
  38. package/src/hooks/use-upload-file.hook.ts +1 -4
  39. package/src/hooks/use-upload-files.hook.native.ts +1 -4
  40. package/src/hooks/use-upload-files.hook.ts +1 -4
@@ -1,57 +1,162 @@
1
+ import {gql}from'@apollo/client/index.js';// Define the fragment we'll use for cache operations
2
+ gql`
3
+ fragment PostThreadInfo on PostThread {
4
+ replies
5
+ replyCount
6
+ lastReplyAt
7
+ updatedAt
8
+ }
9
+ `;
1
10
  const postThreadPolicies = {
2
11
  ThreadMessages: {
3
- // keyFields: ['messagesRefId'],
4
- //keyFields: [],
5
12
  keyFields: ['data', ['channel', ['id']]],
6
13
  fields: {
7
14
  data: {
8
- // keyArgs: false,
9
- // merge: (existing = [], incoming = [], { readField, mergeObjects }) => {
10
- // return existing ? [...existing, ...incoming] : incoming;
11
- // // console.log('existing', existing);
12
- // // console.log('incoming', incoming);
13
- // // const merged = [...incoming];
14
- // // const existingIds = existing.map((item) => readField<String>('id', item));
15
- // // merged.forEach((item, index) => {
16
- // // const itemId = readField<String>('id', item);
17
- // // const existingIndex = existingIds.findIndex((id) => id === itemId);
18
- // // if (existingIndex !== -1) {
19
- // // merged[index] = mergeObjects(existing[existingIndex], merged[index]);
20
- // // }
21
- // // });
22
- // // return merged;
23
- // },
15
+ merge: (existing = [], incoming = [], {
16
+ readField
17
+ }) => {
18
+ // Create a map for efficient lookups
19
+ const threadMap = new Map();
20
+ // Store existing threads
21
+ if (existing && existing.length > 0) {
22
+ for (const item of existing) {
23
+ const id = readField('id', item);
24
+ if (id) threadMap.set(id, item);
25
+ }
26
+ }
27
+ // Add or update with incoming threads
28
+ if (incoming && incoming.length > 0) {
29
+ for (const item of incoming) {
30
+ const id = readField('id', item);
31
+ if (id) threadMap.set(id, item);
32
+ }
33
+ }
34
+ // Convert back to array
35
+ return Array.from(threadMap.values());
36
+ }
24
37
  },
25
38
  totalCount: {
26
- // keyArgs: false,
27
- // merge(existing, incoming) {
28
- // return existing && existing > incoming ? existing : incoming;
29
- // },
39
+ merge(existing, incoming) {
40
+ // Take the higher of the two counts
41
+ return incoming !== undefined ? Math.max(existing || 0, incoming) : existing;
42
+ }
30
43
  }
31
44
  }
32
45
  },
33
46
  Query: {
34
47
  fields: {
35
48
  threadMessages: {
36
- // keyArgs: ['channelId', 'parentId', 'limit', 'skip'],
37
49
  keyArgs: ['channelId'],
38
- //keyArgs: false,
39
- merge(existing, incoming) {
40
- // debugger;
50
+ merge(existing, incoming, {
51
+ readField
52
+ }) {
53
+ if (!existing) return incoming;
54
+ if (!incoming) return existing;
41
55
  return {
42
56
  ...incoming,
43
- data: [...(existing?.data ?? []), ...(incoming.data ?? [])]
57
+ data: [...(existing?.data || []), ...(incoming.data || [])].filter((item, index, self) =>
58
+ // Filter out duplicates
59
+ index === self.findIndex(t => readField('id', t) === readField('id', item)))
44
60
  };
45
61
  }
46
62
  },
47
63
  getPostThread: {
48
- // keyArgs: ['channelId', 'parentId', 'limit', 'skip'],
49
- keyArgs: ['channelId', 'postParentId', 'limit', 'skip', 'role'],
64
+ keyArgs: ['channelId', 'postParentId', 'role'],
50
65
  merge(existing, incoming, {
51
66
  mergeObjects
52
67
  }) {
53
- // debugger;
54
- return mergeObjects(existing, incoming);
68
+ if (!existing) return incoming;
69
+ if (!incoming) return existing;
70
+ // Carefully merge the two objects
71
+ const result = mergeObjects(existing, incoming);
72
+ // Special handling for replies to avoid duplicates
73
+ if (existing.replies && incoming.replies) {
74
+ const uniqueReplies = new Map();
75
+ // Add existing replies
76
+ for (const reply of existing.replies) {
77
+ uniqueReplies.set(reply.id, reply);
78
+ }
79
+ // Add incoming replies, overwriting existing ones
80
+ for (const reply of incoming.replies) {
81
+ uniqueReplies.set(reply.id, reply);
82
+ }
83
+ // Replace replies with deduplicated list
84
+ result.replies = Array.from(uniqueReplies.values());
85
+ }
86
+ return result;
87
+ }
88
+ }
89
+ }
90
+ },
91
+ // Mutation: {
92
+ // fields: {
93
+ // createPostThread: {
94
+ // merge(existing, incoming, { cache, args, readField }) {
95
+ // // Early return if not enough data
96
+ // if (!incoming?.lastMessage || !incoming?.data || !args?.channelId || !args?.postParentId) {
97
+ // return incoming;
98
+ // }
99
+ // try {
100
+ // // Use type policies to handle the cache update instead of direct manipulation
101
+ // const queryRef = cache.identify({
102
+ // __typename: 'Query',
103
+ // getPostThread: {
104
+ // channelId: args.channelId,
105
+ // postParentId: args.postParentId,
106
+ // role: args.threadMessageInput?.role
107
+ // }
108
+ // });
109
+ // // Use cache.modify which doesn't require fragments
110
+ // if (queryRef) {
111
+ // cache.modify({
112
+ // id: queryRef,
113
+ // fields: {
114
+ // getPostThread(existingThread = {}) {
115
+ // if (!existingThread) return existingThread;
116
+ // // Create a new object with the updated properties
117
+ // return {
118
+ // ...existingThread,
119
+ // replies: [incoming.lastMessage, ...(existingThread.replies || [])],
120
+ // replyCount: (existingThread.replyCount || 0) + 1,
121
+ // lastReplyAt: incoming.lastMessage.createdAt,
122
+ // updatedAt: incoming.lastMessage.createdAt
123
+ // };
124
+ // }
125
+ // }
126
+ // });
127
+ // }
128
+ // } catch (error) {
129
+ // console.error('Error updating cache in createPostThread policy:', error);
130
+ // }
131
+ // return incoming;
132
+ // },
133
+ // },
134
+ // },
135
+ // },
136
+ PostThread: {
137
+ fields: {
138
+ replies: {
139
+ merge(existing = [], incoming = [], {
140
+ readField
141
+ }) {
142
+ // Use a map for fast deduplication
143
+ const replyMap = new Map();
144
+ // Add existing replies
145
+ if (existing && existing.length > 0) {
146
+ for (const reply of existing) {
147
+ const id = readField('id', reply);
148
+ if (id) replyMap.set(id, reply);
149
+ }
150
+ }
151
+ // Add or update with incoming replies
152
+ if (incoming && incoming.length > 0) {
153
+ for (const reply of incoming) {
154
+ const id = readField('id', reply);
155
+ if (id) replyMap.set(id, reply);
156
+ }
157
+ }
158
+ // Convert back to array
159
+ return Array.from(replyMap.values());
55
160
  }
56
161
  }
57
162
  }
@@ -1 +1 @@
1
- {"version":3,"file":"post-thread-policies.js","sources":["../../../src/graphql/policies/post-thread-policies.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEa,MAAA,kBAAkB,GAAiB;AAC5C,EAAA,cAAA,EAAc;;;aAGD,EAAA,CAAA,MAAG,EAAA,CAAA,SAAkB,EAAA,CAAA,IAAG,CAAA,CAAA,CAAA;AACjC,IAAA,MAAA,EAAA;AACI,MAAA,IAAA,EAAA;;;;;;;;;;;;;;;;;AAiBC,OAAA;AACD,MAAA,UAAA,EAAA;;;;;AAKC;AACJ;AACJ,GAAA;AACD,EAAA,KAAA,EAAK;AACD,IAAA,MAAA,EAAA;AACI,MAAA,cAAA,EAAA;;iBAEW,CAAA,WAAG,CAAA;;sBAEJ,EAAQ,QAAE,EAAQ;;;AAGhB,YAAA,GAAA,QAAA;AACA,YAAA,IAAA,EAAA,CAAA,IAAA,QAAO,EAAA,IAAY,IAAA,EAAA,CAAA,MAAU,QAAK,CAAA,IAAY,IAAA,EAAA,CAAA;;;AAGzD,OAAA;AACD,MAAA,aAAA,EAAA;;iBAEW,CAAA,WAAG,EAAA,cAAa,EAAA,OAAgB,EAAA,MAAO,EAAE,MAAM,CAAE;AACxD,QAAA,KAAA,CAAA,QAAM,EAAQ,QAAE;;AAEZ,SAAA,EAAA;;AAEP,UAAA,OAAA,YAAA,CAAA,QAAA,EAAA,QAAA,CAAA;AACJ;AACJ;;;"}
1
+ {"version":3,"file":"post-thread-policies.js","sources":["../../../src/graphql/policies/post-thread-policies.ts"],"sourcesContent":[null],"names":[],"mappings":"0CAGA;AAC6B,GAAG;;;;;;;;AASnB,MAAA,kBAAkB,GAAiB;AAC5C,EAAA,cAAA,EAAc;aACD,EAAA,C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Z;kCACU,CAAA,MAAc,GAAA,CAAA,EAAA;AACpB,YAAA,KAAA,MAAA,KAAA,IAAI,QAAE,EAAA;AAAE,cAAA,MAAA,EAAA,GAAA,SAAA,CAAA,IAAA,EAAS,MAAM;8BAC1B,CAAA,GAAA,CAAA,EAAA,EAAA,KAAA,CAAA;;;;AAKD,UAAA,IAAA,QAAA,IAAA,QAAW,CAAA,MAAS,GAAA,CAAA,EAAA;4BAChB,IAAM,QAAc,EAAA;AACpB,cAAA,MAAA,EAAA,GAAA,SAAM,CAAA,IAAA,EAAA,KAAA,CAAA;AAAE,cAAA,IAAA,EAAA,EAAA,QAAA,CAAA,GAAA,CAAA,EAAA,EAAA,KAAY,CAAC;;;;sBAKtB,CAAA,IAAA,CAAA,QAAU,CAAA,SAAS;;AAEjC;AACJ;AACJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"teams-policies.d.ts","sourceRoot":"","sources":["../../../src/graphql/policies/teams-policies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,eAAO,MAAM,YAAY,EAAE,YAI1B,CAAC"}
1
+ {"version":3,"file":"teams-policies.d.ts","sourceRoot":"","sources":["../../../src/graphql/policies/teams-policies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,eAAO,MAAM,YAAY,EAAE,YAgB1B,CAAC"}
@@ -1,5 +1,17 @@
1
1
  const teamPolicies = {
2
2
  Query: {
3
- fields: {}
3
+ fields: {
4
+ getOrganizationTeams: {
5
+ merge(existing = [], incoming) {
6
+ return incoming;
7
+ },
8
+ read(existing) {
9
+ return existing;
10
+ }
11
+ }
12
+ }
13
+ },
14
+ AccountTeam: {
15
+ keyFields: ['_id']
4
16
  }
5
17
  };export{teamPolicies};//# sourceMappingURL=teams-policies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"teams-policies.js","sources":["../../../src/graphql/policies/teams-policies.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEa,MAAA,YAAY,GAAiB;AACtC,EAAA,KAAA,EAAK;AACD,IAAA,MAAA,EAAA;AACH;"}
1
+ {"version":3,"file":"teams-policies.js","sources":["../../../src/graphql/policies/teams-policies.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEa,MAAA,YAAY,GAAiB;AACtC,EAAA,KAAA,EAAK;AACD,IAAA,MAAA,EAAA;AACI,MAAA,oBAAA,EAAA;AACI,QAAA,KAAA,CAAA,QAAM,GAAA,EAAA,EAAA,QAAe,EAAQ;AACzB,UAAA,OAAA,QAAA;;AAEJ,QAAA,IAAA,CAAA,QAAK,EAAQ;AACT,UAAA,OAAA,QAAA;;AAEP;AACJ;AACJ,GAAA;AACD,EAAA,WAAA,EAAW;aACE,EAAA,CAAA,KAAG;AACf;"}
@@ -14,6 +14,32 @@ query GetChannelsByUser($role: String, $criteria: AnyObject, $limit: Int, $skip:
14
14
  creator {
15
15
  ...MessengerUser
16
16
  }
17
+ lastPostAt
18
+ createdAt
19
+ updatedAt
20
+ }
21
+ }
22
+
23
+
24
+ query GetChannelsByUserWithLastMessage($role: String, $criteria: AnyObject, $limit: Int, $skip: Int, $sort: Sort) {
25
+ channelsByUser(role: $role, criteria: $criteria, limit: $limit, skip: $skip, sort: $sort) {
26
+ id
27
+ title
28
+ description
29
+ type
30
+ displayName
31
+ members {
32
+ id
33
+ user {
34
+ ...MessengerUser
35
+ }
36
+ }
37
+ creator {
38
+ ...MessengerUser
39
+ }
40
+ lastMessage {
41
+ ...Post
42
+ }
17
43
  createdAt
18
44
  updatedAt
19
45
  }
@@ -18,3 +18,7 @@ query GetPostThread($postThreadId: ID, $channelId: ID, $postParentId: ID, $role:
18
18
  }
19
19
  }
20
20
  }
21
+
22
+ query ThreadMessagesCount($channelId: ID, $postParentId: ID, $role: String, $participantsIds: [String], $selectedFields: String, $isServiceThreads: Boolean) {
23
+ threadMessagesCount(channelId: $channelId, postParentId: $postParentId, role: $role, participantsIds: $participantsIds, selectedFields: $selectedFields, isServiceThreads: $isServiceThreads)
24
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"use-upload-file.hook.d.ts","sourceRoot":"","sources":["../../src/hooks/use-upload-file.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,gEAAgE,CAAC;AAMpH,eAAO,MAAM,aAAa,QAAO,UAAU,CAAC,OAAO,iBAAiB,CAkB9D,CAAC"}
1
+ {"version":3,"file":"use-upload-file.hook.d.ts","sourceRoot":"","sources":["../../src/hooks/use-upload-file.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,gEAAgE,CAAC;AAGpH,eAAO,MAAM,aAAa,QAAO,UAAU,CAAC,OAAO,iBAAiB,CAkB9D,CAAC"}
@@ -1,4 +1,4 @@
1
- import {useUploadFile as useUploadFile$1}from'@container-stack/file-info-client/lib/hooks/use-upload-file.js';import {useAttachUploadedFileToMessageMutation,useCreateMessageFileUploadLinkMutation}from'common/lib/generated/generated.js';const useUploadFile = () => useUploadFile$1({
1
+ import {useUploadFile as useUploadFile$1}from'@container-stack/file-info-client/lib/hooks/use-upload-file.js';import {useAttachUploadedFileToMessageMutation,useCreateMessageFileUploadLinkMutation}from'common/graphql';const useUploadFile = () => useUploadFile$1({
2
2
  createUploadLink: {
3
3
  name: 'createMessageFileUploadLink',
4
4
  mutation: useCreateMessageFileUploadLinkMutation,
@@ -1 +1 @@
1
- {"version":3,"file":"use-upload-file.hook.js","sources":["../../src/hooks/use-upload-file.hook.ts"],"sourcesContent":[null],"names":["useBaseUploadFile"],"mappings":"kPAMa,aAAa,GAAG,MACzBA,eAAiB,CAAC;AACd,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,6BAAmC;AACnC,IAAA,QAAA,EAAA,sCAAgD;oBAChC,EAAA,CAAA,IAAG,EAAI,eAAa;cACxB,EAAA,KAAA,CAAE,OAAM,CAAA,IAAA,CAAO,GAAK,IAAE,CAAC,CAAC,OAAO,GAAE,IAAK,CAAC,IAAK;AACpD,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD,GAAA;AACD,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,6BAAmC;AACnC,IAAA,QAAA,EAAA,sCAAgD;oBAChC,EAAA,CAAA,IAAG,EAAI,eAAa;;AAEhC,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD;AACJ,CAAA"}
1
+ {"version":3,"file":"use-upload-file.hook.js","sources":["../../src/hooks/use-upload-file.hook.ts"],"sourcesContent":[null],"names":["useBaseUploadFile"],"mappings":"+NAGa,aAAa,GAAG,MACzBA,eAAiB,CAAC;AACd,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,6BAAmC;AACnC,IAAA,QAAA,EAAA,sCAAgD;oBAChC,EAAA,CAAA,IAAG,EAAI,eAAa;cACxB,EAAA,KAAA,CAAE,OAAM,CAAA,IAAA,CAAO,GAAK,IAAE,CAAC,CAAC,OAAO,GAAE,IAAK,CAAC,IAAK;AACpD,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD,GAAA;AACD,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,6BAAmC;AACnC,IAAA,QAAA,EAAA,sCAAgD;oBAChC,EAAA,CAAA,IAAG,EAAI,eAAa;;AAEhC,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD;AACJ,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-upload-file.hook.native.d.ts","sourceRoot":"","sources":["../../src/hooks/use-upload-file.hook.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,uEAAuE,CAAC;AAM3H,eAAO,MAAM,aAAa,QAAO,UAAU,CAAC,OAAO,iBAAiB,CAkB9D,CAAC"}
1
+ {"version":3,"file":"use-upload-file.hook.native.d.ts","sourceRoot":"","sources":["../../src/hooks/use-upload-file.hook.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,uEAAuE,CAAC;AAG3H,eAAO,MAAM,aAAa,QAAO,UAAU,CAAC,OAAO,iBAAiB,CAkB9D,CAAC"}
@@ -1,4 +1,4 @@
1
- import {useUploadFile as useUploadFile$1}from'@container-stack/file-info-client/lib/hooks/use-file-upload.native.js';import {useAttachUploadedFileToMessageMutation,useCreateMessageFileUploadLinkMutation}from'common/lib/generated/generated.js';const useUploadFile = () => useUploadFile$1({
1
+ import {useUploadFile as useUploadFile$1}from'@container-stack/file-info-client/lib/hooks/use-file-upload.native.js';import {useAttachUploadedFileToMessageMutation,useCreateMessageFileUploadLinkMutation}from'common/graphql';const useUploadFile = () => useUploadFile$1({
2
2
  createUploadLink: {
3
3
  name: 'createMessageFileUploadLink',
4
4
  mutation: useCreateMessageFileUploadLinkMutation,
@@ -1 +1 @@
1
- {"version":3,"file":"use-upload-file.hook.native.js","sources":["../../src/hooks/use-upload-file.hook.native.ts"],"sourcesContent":[null],"names":["useBaseUploadFile"],"mappings":"yPAMa,aAAa,GAAG,MACzBA,eAAiB,CAAC;AACd,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,6BAAmC;AACnC,IAAA,QAAA,EAAA,sCAAgD;oBAChC,EAAA,CAAA,IAAG,EAAI,eAAa;cACxB,EAAA,KAAA,CAAE,OAAM,CAAA,IAAA,CAAO,GAAK,IAAE,CAAC,CAAC,OAAO,GAAE,IAAK,CAAC,IAAK;AACpD,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD,GAAA;AACD,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,6BAAmC;AACnC,IAAA,QAAA,EAAA,sCAAgD;oBAChC,EAAA,CAAA,IAAG,EAAI,eAAa;;AAEhC,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD;AACJ,CAAA"}
1
+ {"version":3,"file":"use-upload-file.hook.native.js","sources":["../../src/hooks/use-upload-file.hook.native.ts"],"sourcesContent":[null],"names":["useBaseUploadFile"],"mappings":"sOAGa,aAAa,GAAG,MACzBA,eAAiB,CAAC;AACd,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,6BAAmC;AACnC,IAAA,QAAA,EAAA,sCAAgD;oBAChC,EAAA,CAAA,IAAG,EAAI,eAAa;cACxB,EAAA,KAAA,CAAE,OAAM,CAAA,IAAA,CAAO,GAAK,IAAE,CAAC,CAAC,OAAO,GAAE,IAAK,CAAC,IAAK;AACpD,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD,GAAA;AACD,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,6BAAmC;AACnC,IAAA,QAAA,EAAA,sCAAgD;oBAChC,EAAA,CAAA,IAAG,EAAI,eAAa;;AAEhC,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD;AACJ,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-upload-files.hook.d.ts","sourceRoot":"","sources":["../../src/hooks/use-upload-files.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gEAAgE,CAAC;AAM/F,eAAO,MAAM,cAAc,QAAO,UAAU,CAAC,OAAO,aAAa,CAkB3D,CAAC"}
1
+ {"version":3,"file":"use-upload-files.hook.d.ts","sourceRoot":"","sources":["../../src/hooks/use-upload-files.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gEAAgE,CAAC;AAG/F,eAAO,MAAM,cAAc,QAAO,UAAU,CAAC,OAAO,aAAa,CAkB3D,CAAC"}
@@ -1,4 +1,4 @@
1
- import {useUploadFile}from'@container-stack/file-info-client/lib/hooks/use-upload-file.js';import {useAttachUploadedFilesToMessageMutation,useCreateMessageFilesUploadLinkMutation}from'common/lib/generated/generated.js';const useUploadFiles = () => useUploadFile({
1
+ import {useUploadFile}from'@container-stack/file-info-client/lib/hooks/use-upload-file.js';import {useAttachUploadedFilesToMessageMutation,useCreateMessageFilesUploadLinkMutation}from'common/graphql';const useUploadFiles = () => useUploadFile({
2
2
  createUploadLink: {
3
3
  name: 'createMessageFilesUploadLink',
4
4
  mutation: useCreateMessageFilesUploadLinkMutation,
@@ -1 +1 @@
1
- {"version":3,"file":"use-upload-files.hook.js","sources":["../../src/hooks/use-upload-files.hook.ts"],"sourcesContent":[null],"names":[],"mappings":"iOAMa,cAAc,GAAG,MAC1B,aAAa,CAAC;AACV,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,8BAAoC;AACpC,IAAA,QAAA,EAAA,uCAAiD;oBACjC,EAAA,CAAA,KAAQ,EAAA,eAAa;AACjC,MAAA,SAAA,EAAA,KAAW,CAAA,OAAM,CAAA,KAAO,CAAC,GAAA,KAAQ,CAAC,GAAK,CAAA,QAAU,IAAA,CAAE,IAAO,CAAA,GAAC,CAAI,KAAE,CAAC,IAAO,CAAA;AACzE,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD,GAAA;AACD,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,8BAAoC;AACpC,IAAA,QAAA,EAAA,uCAAiD;oBACjC,EAAA,CAAA,KAAQ,EAAA,eAAa;;AAEjC,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD;AACJ,CAAA"}
1
+ {"version":3,"file":"use-upload-files.hook.js","sources":["../../src/hooks/use-upload-files.hook.ts"],"sourcesContent":[null],"names":[],"mappings":"8MAGa,cAAc,GAAG,MAC1B,aAAa,CAAC;AACV,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,8BAAoC;AACpC,IAAA,QAAA,EAAA,uCAAiD;oBACjC,EAAA,CAAA,KAAQ,EAAA,eAAa;AACjC,MAAA,SAAA,EAAA,KAAW,CAAA,OAAM,CAAA,KAAO,CAAC,GAAA,KAAQ,CAAC,GAAK,CAAA,QAAU,IAAA,CAAE,IAAO,CAAA,GAAC,CAAI,KAAE,CAAC,IAAO,CAAA;AACzE,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD,GAAA;AACD,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,8BAAoC;AACpC,IAAA,QAAA,EAAA,uCAAiD;oBACjC,EAAA,CAAA,KAAQ,EAAA,eAAa;;AAEjC,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD;AACJ,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-upload-files.hook.native.d.ts","sourceRoot":"","sources":["../../src/hooks/use-upload-files.hook.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uEAAuE,CAAC;AAMtG,eAAO,MAAM,cAAc,QAAO,UAAU,CAAC,OAAO,aAAa,CAkB3D,CAAC"}
1
+ {"version":3,"file":"use-upload-files.hook.native.d.ts","sourceRoot":"","sources":["../../src/hooks/use-upload-files.hook.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uEAAuE,CAAC;AAGtG,eAAO,MAAM,cAAc,QAAO,UAAU,CAAC,OAAO,aAAa,CAkB3D,CAAC"}
@@ -1,4 +1,4 @@
1
- import {useUploadFile}from'@container-stack/file-info-client/lib/hooks/use-file-upload.native.js';import {useAttachUploadedFilesToMessageMutation,useCreateMessageFilesUploadLinkMutation}from'common/lib/generated/generated.js';const useUploadFiles = () => useUploadFile({
1
+ import {useUploadFile}from'@container-stack/file-info-client/lib/hooks/use-file-upload.native.js';import {useAttachUploadedFilesToMessageMutation,useCreateMessageFilesUploadLinkMutation}from'common/graphql';const useUploadFiles = () => useUploadFile({
2
2
  createUploadLink: {
3
3
  name: 'createMessageFilesUploadLink',
4
4
  mutation: useCreateMessageFilesUploadLinkMutation,
@@ -1 +1 @@
1
- {"version":3,"file":"use-upload-files.hook.native.js","sources":["../../src/hooks/use-upload-files.hook.native.ts"],"sourcesContent":[null],"names":[],"mappings":"wOAMa,cAAc,GAAG,MAC1B,aAAa,CAAC;AACV,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,8BAAoC;AACpC,IAAA,QAAA,EAAA,uCAAiD;oBACjC,EAAA,CAAA,KAAQ,EAAA,eAAa;AACjC,MAAA,SAAA,EAAA,KAAW,CAAA,OAAM,CAAA,KAAO,CAAC,GAAA,KAAQ,CAAC,GAAK,CAAA,QAAU,IAAA,CAAE,IAAO,CAAA,GAAC,CAAI,KAAE,CAAC,IAAO,CAAA;AACzE,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD,GAAA;AACD,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,8BAAoC;AACpC,IAAA,QAAA,EAAA,uCAAiD;oBACjC,EAAA,CAAA,KAAQ,EAAA,eAAa;;AAEjC,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD;AACJ,CAAA"}
1
+ {"version":3,"file":"use-upload-files.hook.native.js","sources":["../../src/hooks/use-upload-files.hook.native.ts"],"sourcesContent":[null],"names":[],"mappings":"qNAGa,cAAc,GAAG,MAC1B,aAAa,CAAC;AACV,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,8BAAoC;AACpC,IAAA,QAAA,EAAA,uCAAiD;oBACjC,EAAA,CAAA,KAAQ,EAAA,eAAa;AACjC,MAAA,SAAA,EAAA,KAAW,CAAA,OAAM,CAAA,KAAO,CAAC,GAAA,KAAQ,CAAC,GAAK,CAAA,QAAU,IAAA,CAAE,IAAO,CAAA,GAAC,CAAI,KAAE,CAAC,IAAO,CAAA;AACzE,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD,GAAA;AACD,EAAA,gBAAA,EAAgB;AACZ,IAAA,IAAA,EAAA,8BAAoC;AACpC,IAAA,QAAA,EAAA,uCAAiD;oBACjC,EAAA,CAAA,KAAQ,EAAA,eAAa;;AAEjC,MAAA,IAAA,OAAI,SAAgB,KAAA,QAAa,GAAA,SAAY,GAAA,EAAA;;AAEpD;AACJ,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@messenger-box/platform-client",
3
- "version": "10.0.3-alpha.5",
3
+ "version": "10.0.3-alpha.50",
4
4
  "description": "Sample core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -20,8 +20,8 @@
20
20
  "watch": "yarn build:lib:watch"
21
21
  },
22
22
  "dependencies": {
23
- "@container-stack/file-info-client": "^5.4.1-alpha.3",
24
- "@messenger-box/core": "10.0.3-alpha.5",
23
+ "@container-stack/file-info-client": "^5.4.1-alpha.6",
24
+ "@messenger-box/core": "10.0.3-alpha.50",
25
25
  "key-mirror": "1.0.1",
26
26
  "moment-timezone": "0.5.33"
27
27
  },
@@ -35,5 +35,5 @@
35
35
  "typescript": {
36
36
  "definition": "lib/index.d.ts"
37
37
  },
38
- "gitHead": "c7d0623dc1a572d1809011b21c9cfcdcb093076e"
38
+ "gitHead": "04bd383c41b79ec5f5f2254d8886b8ab2761eaab"
39
39
  }
@@ -19,6 +19,18 @@ fragment Post on Post {
19
19
  # propsConfiguration {
20
20
  # ...Configuration
21
21
  # }
22
+ propsConfiguration {
23
+ contents
24
+ id
25
+ keys
26
+ resource
27
+ target
28
+ overrides {
29
+ contents
30
+ identifiers
31
+ keys
32
+ }
33
+ }
22
34
  props
23
35
  files {
24
36
  totalCount
@@ -58,6 +70,18 @@ fragment PostReplies on Messages {
58
70
  # propsConfiguration {
59
71
  # ...Configuration
60
72
  # }
73
+ propsConfiguration {
74
+ contents
75
+ id
76
+ keys
77
+ resource
78
+ target
79
+ overrides {
80
+ contents
81
+ identifiers
82
+ keys
83
+ }
84
+ }
61
85
  props
62
86
  files {
63
87
  totalCount
@@ -98,6 +122,18 @@ fragment PostWithoutReplies on Post {
98
122
  # propsConfiguration {
99
123
  # ...Configuration
100
124
  # }
125
+ propsConfiguration {
126
+ contents
127
+ id
128
+ keys
129
+ resource
130
+ target
131
+ overrides {
132
+ contents
133
+ identifiers
134
+ keys
135
+ }
136
+ }
101
137
  props
102
138
  files {
103
139
  totalCount
@@ -2,6 +2,64 @@ import { TypePolicies } from '@apollo/client';
2
2
 
3
3
  export const channelPolicies: TypePolicies = {
4
4
  Query: {
5
- fields: {},
5
+ fields: {
6
+ channelsByUser: {
7
+ merge(existing = [], incoming) {
8
+ // Use newer data from server to completely replace existing data
9
+ return incoming;
10
+ },
11
+ // Enable pagination with keyArgs to correctly identify cache entries
12
+ keyArgs: ['criteria', 'role', 'limit'],
13
+ // Add a read function for more control over cache reads
14
+ read(existing, { args }) {
15
+ // Return undefined to force a network request if data doesn't exist
16
+ if (!existing) return undefined;
17
+ return existing;
18
+ },
19
+ },
20
+ },
21
+ },
22
+ Channel: {
23
+ keyFields: ['id'],
24
+ fields: {
25
+ members: {
26
+ merge(existing = [], incoming) {
27
+ return incoming;
28
+ },
29
+ },
30
+ // Add field policies for other Channel fields if needed
31
+ title: {
32
+ read(title) {
33
+ return title || '';
34
+ },
35
+ },
36
+ displayName: {
37
+ read(displayName) {
38
+ return displayName || '';
39
+ },
40
+ },
41
+ // Add computed fields if needed
42
+ memberCount: {
43
+ read(_, { readField }) {
44
+ const members = readField('members') as any[];
45
+ return members && Array.isArray(members) ? members.length : 0;
46
+ },
47
+ },
48
+ lastMessage: {
49
+ read(lastMessage) {
50
+ return lastMessage || null;
51
+ },
52
+ },
53
+ },
54
+ },
55
+ // Add policies for ChannelMember type
56
+ ChannelMember: {
57
+ keyFields: ['id'],
58
+ fields: {
59
+ user: {
60
+ // Ensure user references are properly merged
61
+ merge: true,
62
+ },
63
+ },
6
64
  },
7
65
  };