@quesmed/types 2.2.88 → 2.2.90

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.
@@ -1 +1,54 @@
1
+ import { gql } from '@apollo/client';
2
+ import { NOTIFICATIONS, } from '../query/restricted';
1
3
  export const ON_NOTIFICATION_ARISE = 'ON_NOTIFICATION_ARISE';
4
+ export const NOTIFICATION_ARISE = gql `
5
+ subscription OnNotificationArise($userId: Int!) {
6
+ onNotificationArise(userId: $userId) {
7
+ userId
8
+ read
9
+ type
10
+ id
11
+ description
12
+ actionType
13
+ createdAt
14
+ fromUser {
15
+ id
16
+ displayName
17
+ }
18
+ comment {
19
+ id
20
+ comment
21
+ question {
22
+ id
23
+ concept {
24
+ id
25
+ name
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+ `;
32
+ export const onNotificationArise = ({ client, subscriptionData, }) => {
33
+ const { onNotificationArise } = subscriptionData.data || {};
34
+ if (onNotificationArise) {
35
+ const prevData = client.readQuery({
36
+ query: NOTIFICATIONS,
37
+ });
38
+ if (prevData) {
39
+ client.writeQuery({
40
+ query: NOTIFICATIONS,
41
+ data: {
42
+ ...prevData,
43
+ restricted: {
44
+ ...prevData.restricted,
45
+ notifications: [
46
+ ...onNotificationArise,
47
+ ...prevData.restricted.notifications,
48
+ ],
49
+ },
50
+ },
51
+ });
52
+ }
53
+ }
54
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.2.88",
3
+ "version": "2.2.90",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",