@jsb188/graphql 1.1.3 → 1.1.5
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/cache/config.ts +3 -3
- package/cache/index.ts +173 -85
- package/gql/fragments/accountAuthFragments.ts +3 -9
- package/gql/fragments/accountFragments.ts +11 -0
- package/gql/fragments/logFragments.ts +25 -0
- package/gql/fragments/organizationFragments.ts +10 -2
- package/gql/mutations/accountMutations.ts +21 -0
- package/gql/mutations/aiChatMutations.ts +1 -0
- package/gql/mutations/authMutations.ts +171 -0
- package/gql/mutations/index.ts +7 -0
- package/gql/mutations/logMutations.ts +43 -0
- package/gql/mutations/userAuthMutations.ts +0 -163
- package/gql/queries/aiChatQueries.ts +1 -0
- package/gql/queries/appQueries.ts +2 -1
- package/gql/queries/logQueries.ts +37 -0
- package/gql/queries/organizationQueries.ts +1 -0
- package/hooks/index.ts +134 -75
- package/hooks/use-account-mtn.ts +43 -0
- package/hooks/use-aiChat-mtn.ts +96 -0
- package/hooks/use-aiChat-qry.ts +65 -3
- package/hooks/use-auth-mtn.ts +99 -112
- package/hooks/use-log-mtn.ts +85 -0
- package/hooks/use-log-qry.ts +77 -0
- package/package.json +10 -20
- package/types.d.ts +1 -0
- package/gql/fragments/cardFragments.ts +0 -15
- package/gql/fragments/chatFragments.ts +0 -98
- package/gql/fragments/journalFragments.ts +0 -14
- package/gql/fragments/userAuthFragments.ts +0 -8
- package/gql/fragments/userFragments.ts +0 -69
- package/gql/mutations/accountAuthMutations.ts +0 -81
- package/gql/mutations/chatMutations.ts +0 -116
- package/gql/mutations/journalMutations.ts +0 -2
- package/gql/mutations/userMutations.ts +0 -89
- package/gql/queries/cardQueries.ts +0 -24
- package/gql/queries/chatQueries.ts +0 -86
- package/gql/queries/journalQueries.ts +0 -28
- package/gql/queries/userQueries.ts +0 -104
- package/hooks/use-journal-qry.ts +0 -50
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
export const userFragment = `fragment userFragment on User {
|
|
2
|
-
id
|
|
3
|
-
username
|
|
4
|
-
displayName
|
|
5
|
-
moderator
|
|
6
|
-
deleted
|
|
7
|
-
plusStatus
|
|
8
|
-
onlineStatus
|
|
9
|
-
statusMessage
|
|
10
|
-
|
|
11
|
-
theme {
|
|
12
|
-
id
|
|
13
|
-
name
|
|
14
|
-
backgroundPhotoId
|
|
15
|
-
backgroundPhotoUri
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
profile {
|
|
19
|
-
id
|
|
20
|
-
description
|
|
21
|
-
pronouns
|
|
22
|
-
photoId
|
|
23
|
-
photoUri
|
|
24
|
-
backgroundPhotoId
|
|
25
|
-
backgroundPhotoUri
|
|
26
|
-
adult
|
|
27
|
-
}
|
|
28
|
-
}`;
|
|
29
|
-
|
|
30
|
-
export const userPartial = `fragment userPartial on User {
|
|
31
|
-
id
|
|
32
|
-
displayName
|
|
33
|
-
username
|
|
34
|
-
onlineStatus
|
|
35
|
-
plusStatus
|
|
36
|
-
statusMessage
|
|
37
|
-
|
|
38
|
-
profile {
|
|
39
|
-
id
|
|
40
|
-
photoId
|
|
41
|
-
photoUri
|
|
42
|
-
description
|
|
43
|
-
}
|
|
44
|
-
}`;
|
|
45
|
-
|
|
46
|
-
export const friendFragment = `fragment friendFragment on Friend {
|
|
47
|
-
id
|
|
48
|
-
chatId
|
|
49
|
-
myStatus
|
|
50
|
-
otherStatus
|
|
51
|
-
activityAt
|
|
52
|
-
}`;
|
|
53
|
-
|
|
54
|
-
export const plusFragment = `fragment plusFragment on UserPlus {
|
|
55
|
-
id
|
|
56
|
-
checkedAt
|
|
57
|
-
expireAt
|
|
58
|
-
cancelled
|
|
59
|
-
type
|
|
60
|
-
badge
|
|
61
|
-
}`;
|
|
62
|
-
|
|
63
|
-
export const userPersonaFragment = `fragment userPersonaFragment on UserPersona {
|
|
64
|
-
id
|
|
65
|
-
order
|
|
66
|
-
name
|
|
67
|
-
photoId
|
|
68
|
-
photoUri
|
|
69
|
-
}`;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-tag';
|
|
2
|
-
import { accountAuthFragment } from '../fragments/accountAuthFragments';
|
|
3
|
-
import { emailFragment, phoneFragment } from '../fragments/otherFragments';
|
|
4
|
-
import { accountFragment } from '../fragments/accountFragments';
|
|
5
|
-
|
|
6
|
-
const authenticateResultText = `...accountAuthFragment
|
|
7
|
-
|
|
8
|
-
account {
|
|
9
|
-
...accountFragment
|
|
10
|
-
|
|
11
|
-
email {
|
|
12
|
-
...emailFragment
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
phone {
|
|
16
|
-
...phoneFragment
|
|
17
|
-
}
|
|
18
|
-
}`;
|
|
19
|
-
|
|
20
|
-
const authenticateFragments = `
|
|
21
|
-
${accountAuthFragment}
|
|
22
|
-
${accountFragment}
|
|
23
|
-
${emailFragment}
|
|
24
|
-
${phoneFragment}
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
export const authenticateWithPasswordMtn = gql`
|
|
28
|
-
mutation authenticateWithPassword (
|
|
29
|
-
$identifier: String!
|
|
30
|
-
$password: String!
|
|
31
|
-
) {
|
|
32
|
-
authenticateWithPassword (
|
|
33
|
-
identifier: $identifier,
|
|
34
|
-
password: $password
|
|
35
|
-
) {
|
|
36
|
-
${authenticateResultText}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
${authenticateFragments}
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
|
-
export const authenticateWithTokenMtn = gql`
|
|
43
|
-
mutation authenticateWithToken (
|
|
44
|
-
$token: Token!
|
|
45
|
-
) {
|
|
46
|
-
authenticateWithToken (
|
|
47
|
-
token: $token
|
|
48
|
-
) {
|
|
49
|
-
${authenticateResultText}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
${authenticateFragments}
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
|
-
export const signInWithGoogleMtn = gql`
|
|
56
|
-
mutation signInWithGoogle (
|
|
57
|
-
$oauthToken: String!
|
|
58
|
-
) {
|
|
59
|
-
signInWithGoogle (
|
|
60
|
-
oauthToken: $oauthToken
|
|
61
|
-
) {
|
|
62
|
-
${authenticateResultText}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
${authenticateFragments}
|
|
66
|
-
`;
|
|
67
|
-
|
|
68
|
-
export const signInWithAppleMtn = gql`
|
|
69
|
-
mutation signInWithApple (
|
|
70
|
-
$code: String!
|
|
71
|
-
$idToken: String!
|
|
72
|
-
) {
|
|
73
|
-
signInWithApple (
|
|
74
|
-
code: $code
|
|
75
|
-
idToken: $idToken
|
|
76
|
-
) {
|
|
77
|
-
${authenticateResultText}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
${authenticateFragments}
|
|
81
|
-
`;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-tag';
|
|
2
|
-
import { chatPartial, chatStatusPartial, chatStickerFragment } from '../fragments/chatFragments';
|
|
3
|
-
|
|
4
|
-
export const editChatMtn = gql`
|
|
5
|
-
mutation editChat (
|
|
6
|
-
$chatId: GenericID!
|
|
7
|
-
$name: String
|
|
8
|
-
$note: String
|
|
9
|
-
$liveCategory: LiveCategory
|
|
10
|
-
$theme: ThemeInput
|
|
11
|
-
) {
|
|
12
|
-
editChat (
|
|
13
|
-
chatId: $chatId
|
|
14
|
-
name: $name
|
|
15
|
-
note: $note
|
|
16
|
-
liveCategory: $liveCategory
|
|
17
|
-
theme: $theme
|
|
18
|
-
) {
|
|
19
|
-
...chatPartial
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
${chatPartial}
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
export const editChatStatusMtn = gql`
|
|
27
|
-
mutation editChatStatus (
|
|
28
|
-
$chatId: GenericID!
|
|
29
|
-
$unread: Boolean
|
|
30
|
-
$pinned: Boolean
|
|
31
|
-
$status: ChatStatus
|
|
32
|
-
) {
|
|
33
|
-
editChatStatus (
|
|
34
|
-
chatId: $chatId
|
|
35
|
-
unread: $unread
|
|
36
|
-
pinned: $pinned
|
|
37
|
-
status: $status
|
|
38
|
-
) {
|
|
39
|
-
...chatStatusPartial
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
${chatStatusPartial}
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
export const createLiveChatMtn = gql`
|
|
47
|
-
mutation createLiveChat (
|
|
48
|
-
$name: String!
|
|
49
|
-
) {
|
|
50
|
-
createLiveChat (
|
|
51
|
-
name: $name
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
55
|
-
|
|
56
|
-
export const editCoOwnerMtn = gql`
|
|
57
|
-
mutation editCoOwner (
|
|
58
|
-
$chatId: GenericID!
|
|
59
|
-
$userId: UserID!
|
|
60
|
-
$remove: Boolean
|
|
61
|
-
) {
|
|
62
|
-
editCoOwner (
|
|
63
|
-
chatId: $chatId
|
|
64
|
-
userId: $userId
|
|
65
|
-
remove: $remove
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
`;
|
|
69
|
-
|
|
70
|
-
export const editChatStickerMtn = gql`
|
|
71
|
-
mutation editChatSticker (
|
|
72
|
-
$stickerId: GenericID!
|
|
73
|
-
$photoId: GenericID
|
|
74
|
-
$code: String
|
|
75
|
-
) {
|
|
76
|
-
editChatSticker (
|
|
77
|
-
stickerId: $stickerId
|
|
78
|
-
photoId: $photoId
|
|
79
|
-
code: $code
|
|
80
|
-
) {
|
|
81
|
-
...chatStickerFragment
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
${chatStickerFragment}
|
|
86
|
-
`;
|
|
87
|
-
|
|
88
|
-
export const deleteChatStickerMtn = gql`
|
|
89
|
-
mutation deleteChatSticker (
|
|
90
|
-
$stickerId: GenericID!
|
|
91
|
-
) {
|
|
92
|
-
deleteChatSticker (
|
|
93
|
-
stickerId: $stickerId
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
`;
|
|
97
|
-
|
|
98
|
-
export const createChatStickerMtn = gql`
|
|
99
|
-
mutation createChatSticker (
|
|
100
|
-
$chatId: GenericID!
|
|
101
|
-
$photoId: GenericID!
|
|
102
|
-
$code: String!
|
|
103
|
-
$coverPhoto: Boolean
|
|
104
|
-
) {
|
|
105
|
-
createChatSticker (
|
|
106
|
-
chatId: $chatId
|
|
107
|
-
photoId: $photoId
|
|
108
|
-
code: $code
|
|
109
|
-
coverPhoto: $coverPhoto
|
|
110
|
-
) {
|
|
111
|
-
...chatStickerFragment
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
${chatStickerFragment}
|
|
116
|
-
`;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-tag';
|
|
2
|
-
import { friendFragment, userFragment, userPersonaFragment, plusFragment } from '../fragments/userFragments';
|
|
3
|
-
|
|
4
|
-
export const editUserMtn = gql`
|
|
5
|
-
mutation editUser (
|
|
6
|
-
$photoId: GenericID
|
|
7
|
-
$backgroundPhotoId: GenericID
|
|
8
|
-
$user: UserInput
|
|
9
|
-
$profile: UserProfileInput
|
|
10
|
-
$theme: ThemeInput
|
|
11
|
-
) {
|
|
12
|
-
editUser (
|
|
13
|
-
photoId: $photoId
|
|
14
|
-
backgroundPhotoId: $backgroundPhotoId
|
|
15
|
-
user: $user
|
|
16
|
-
profile: $profile
|
|
17
|
-
theme: $theme
|
|
18
|
-
) {
|
|
19
|
-
...userFragment
|
|
20
|
-
lightMode
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
${userFragment}
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
export const editUserPlusMtn = gql`
|
|
28
|
-
mutation editUserPlus (
|
|
29
|
-
$badge: String
|
|
30
|
-
) {
|
|
31
|
-
editUserPlus (
|
|
32
|
-
badge: $badge
|
|
33
|
-
) {
|
|
34
|
-
...plusFragment
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
${plusFragment}
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
export const editUserFriendshipMtn = gql`
|
|
42
|
-
mutation editUserFriendship (
|
|
43
|
-
$userId: UserID!
|
|
44
|
-
$friendStatus: FriendStatus!
|
|
45
|
-
) {
|
|
46
|
-
editUserFriendship (
|
|
47
|
-
userId: $userId
|
|
48
|
-
friendStatus: $friendStatus
|
|
49
|
-
) {
|
|
50
|
-
...friendFragment
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
${friendFragment}
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
export const editPersonasMtn = gql`
|
|
58
|
-
mutation editPersonas (
|
|
59
|
-
$personas: [UserPersonaInput]
|
|
60
|
-
) {
|
|
61
|
-
editPersonas (
|
|
62
|
-
personas: $personas
|
|
63
|
-
) {
|
|
64
|
-
...userPersonaFragment
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
${userPersonaFragment}
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
export const addEditPersonaMtn = gql`
|
|
72
|
-
mutation addEditPersona (
|
|
73
|
-
$personaId: GenericID
|
|
74
|
-
$order: Int
|
|
75
|
-
$name: String
|
|
76
|
-
$photoId: GenericID
|
|
77
|
-
) {
|
|
78
|
-
addEditPersona(
|
|
79
|
-
personaId: $personaId
|
|
80
|
-
order: $order
|
|
81
|
-
name: $name
|
|
82
|
-
photoId: $photoId
|
|
83
|
-
) {
|
|
84
|
-
...userPersonaFragment
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
${userPersonaFragment}
|
|
89
|
-
`;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-tag';
|
|
2
|
-
import { cardFragment, linkFragment } from '../fragments/cardFragments';
|
|
3
|
-
|
|
4
|
-
export const cardsForUserQry = gql`
|
|
5
|
-
query cardsForUser (
|
|
6
|
-
$userId: UserID!
|
|
7
|
-
) {
|
|
8
|
-
cardsForUser (
|
|
9
|
-
userId: $userId
|
|
10
|
-
) {
|
|
11
|
-
id
|
|
12
|
-
cards {
|
|
13
|
-
...cardFragment
|
|
14
|
-
|
|
15
|
-
links {
|
|
16
|
-
...linkFragment
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
${cardFragment}
|
|
23
|
-
${linkFragment}
|
|
24
|
-
`;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-tag';
|
|
2
|
-
import { chatFragment, chatMessageFragment, chatPartial, chatUserStatusFragment } from '../fragments/chatFragments';
|
|
3
|
-
import { userPartial } from '../fragments/userFragments';
|
|
4
|
-
|
|
5
|
-
export const chatsListQry = gql`
|
|
6
|
-
query chatsList (
|
|
7
|
-
$cursor: Cursor
|
|
8
|
-
$after: Boolean!
|
|
9
|
-
$limit: Int!
|
|
10
|
-
) {
|
|
11
|
-
chatsList (
|
|
12
|
-
cursor: $cursor
|
|
13
|
-
after: $after
|
|
14
|
-
limit: $limit
|
|
15
|
-
) {
|
|
16
|
-
cursor
|
|
17
|
-
...chatFragment
|
|
18
|
-
|
|
19
|
-
userStatus {
|
|
20
|
-
...chatUserStatusFragment
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
${chatFragment}
|
|
26
|
-
${chatUserStatusFragment}
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
export const myChatsQry = gql`
|
|
30
|
-
query myChats (
|
|
31
|
-
$type: ChatType!
|
|
32
|
-
) {
|
|
33
|
-
myChats (
|
|
34
|
-
type: $type
|
|
35
|
-
) {
|
|
36
|
-
...chatPartial
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
${chatPartial}
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
export const chatQry = gql`
|
|
44
|
-
query chat (
|
|
45
|
-
$chatId: GenericID!
|
|
46
|
-
$cursor: Cursor
|
|
47
|
-
$after: Boolean!
|
|
48
|
-
$limit: Int!
|
|
49
|
-
) {
|
|
50
|
-
chat (
|
|
51
|
-
chatId: $chatId
|
|
52
|
-
) {
|
|
53
|
-
...chatPartial
|
|
54
|
-
|
|
55
|
-
participants {
|
|
56
|
-
...userPartial
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
messages (
|
|
60
|
-
cursor: $cursor
|
|
61
|
-
after: $after
|
|
62
|
-
limit: $limit
|
|
63
|
-
) {
|
|
64
|
-
cursor
|
|
65
|
-
...chatMessageFragment
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
${chatPartial}
|
|
71
|
-
${chatMessageFragment}
|
|
72
|
-
${userPartial}
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
export const userIdToChatIdQry = gql`
|
|
76
|
-
query userIdToChatId (
|
|
77
|
-
$userId: UserID!
|
|
78
|
-
) {
|
|
79
|
-
userIdToChatId (
|
|
80
|
-
userId: $userId
|
|
81
|
-
) {
|
|
82
|
-
id
|
|
83
|
-
friendId
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
`;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-tag';
|
|
2
|
-
import { accountFragment } from '../fragments/accountFragments';
|
|
3
|
-
import { journalEntryFragment } from '../fragments/journalFragments';
|
|
4
|
-
|
|
5
|
-
export const journalEntriesQry = gql`
|
|
6
|
-
query journalEntries (
|
|
7
|
-
$organizationId: GenericID!
|
|
8
|
-
$cursor: Cursor
|
|
9
|
-
$after: Boolean!
|
|
10
|
-
$limit: Int!
|
|
11
|
-
) {
|
|
12
|
-
journalEntries (
|
|
13
|
-
organizationId: $organizationId
|
|
14
|
-
cursor: $cursor
|
|
15
|
-
after: $after
|
|
16
|
-
limit: $limit
|
|
17
|
-
) {
|
|
18
|
-
...journalEntryFragment
|
|
19
|
-
|
|
20
|
-
account {
|
|
21
|
-
...accountFragment
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
${accountFragment}
|
|
27
|
-
${journalEntryFragment}
|
|
28
|
-
`;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-tag';
|
|
2
|
-
import { friendFragment, userFragment } from '../fragments/userFragments';
|
|
3
|
-
|
|
4
|
-
export const searchUsersQry = gql`
|
|
5
|
-
query searchUsers (
|
|
6
|
-
$searchQuery: String!
|
|
7
|
-
) {
|
|
8
|
-
searchUsers (
|
|
9
|
-
searchQuery: $searchQuery
|
|
10
|
-
) {
|
|
11
|
-
query
|
|
12
|
-
results {
|
|
13
|
-
...friendFragment
|
|
14
|
-
|
|
15
|
-
user {
|
|
16
|
-
...userFragment
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
${friendFragment}
|
|
23
|
-
${userFragment}
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
export const friendQry = gql`
|
|
27
|
-
query friend (
|
|
28
|
-
$userId: UserID!
|
|
29
|
-
) {
|
|
30
|
-
friend (
|
|
31
|
-
userId: $userId
|
|
32
|
-
) {
|
|
33
|
-
...friendFragment
|
|
34
|
-
|
|
35
|
-
user {
|
|
36
|
-
...userFragment
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
${friendFragment}
|
|
42
|
-
${userFragment}
|
|
43
|
-
`;
|
|
44
|
-
|
|
45
|
-
export const friendsListQry = gql`
|
|
46
|
-
query friendsList (
|
|
47
|
-
$cursor: Cursor
|
|
48
|
-
$after: Boolean!
|
|
49
|
-
$limit: Int!
|
|
50
|
-
) {
|
|
51
|
-
friendsList (
|
|
52
|
-
cursor: $cursor
|
|
53
|
-
after: $after
|
|
54
|
-
limit: $limit
|
|
55
|
-
) {
|
|
56
|
-
cursor
|
|
57
|
-
...friendFragment
|
|
58
|
-
|
|
59
|
-
user {
|
|
60
|
-
...userFragment
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
${friendFragment}
|
|
66
|
-
${userFragment}
|
|
67
|
-
`;
|
|
68
|
-
|
|
69
|
-
export const friendRequestsQry = gql`
|
|
70
|
-
query friendRequests (
|
|
71
|
-
$pendingOnly: Boolean
|
|
72
|
-
) {
|
|
73
|
-
friendRequests (
|
|
74
|
-
pendingOnly: $pendingOnly
|
|
75
|
-
) {
|
|
76
|
-
...friendFragment
|
|
77
|
-
|
|
78
|
-
user {
|
|
79
|
-
...userFragment
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
${friendFragment}
|
|
85
|
-
${userFragment}
|
|
86
|
-
`;
|
|
87
|
-
|
|
88
|
-
// Unused at the moment
|
|
89
|
-
// export const personasQry = gql`
|
|
90
|
-
// query personas (
|
|
91
|
-
// $userId: UserID
|
|
92
|
-
// ) {
|
|
93
|
-
// personas (
|
|
94
|
-
// userId: $userId
|
|
95
|
-
// ) {
|
|
96
|
-
// id
|
|
97
|
-
// list {
|
|
98
|
-
// ...userPersonaFragment
|
|
99
|
-
// }
|
|
100
|
-
// }
|
|
101
|
-
// }
|
|
102
|
-
|
|
103
|
-
// ${userPersonaFragment}
|
|
104
|
-
// `;
|
package/hooks/use-journal-qry.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { PaginationArgs, UseQueryParams } from '../types.d';
|
|
2
|
-
import { useQuery } from '../client';
|
|
3
|
-
import { journalEntriesQry } from '../gql/queries/journalQueries';
|
|
4
|
-
import type { FilterJournalEntriesArgs } from '@jsb188/app/types/journal.d';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Constants
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const JOURNAL_ENTRIES_LIMIT = 50;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Types
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
interface JournalEntriesVariables {
|
|
17
|
-
organizationId?: string;
|
|
18
|
-
accountId?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface JournalEntriesArgs extends PaginationArgs {
|
|
22
|
-
organizationId: string;
|
|
23
|
-
accountId?: string;
|
|
24
|
-
timeZone: string | null;
|
|
25
|
-
filter: FilterJournalEntriesArgs;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Fetch journal entries
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
export function useJournalEntries(variables: JournalEntriesArgs, params: UseQueryParams = {}) {
|
|
33
|
-
|
|
34
|
-
const { data, ...other } = useQuery(journalEntriesQry, {
|
|
35
|
-
variables: {
|
|
36
|
-
...variables,
|
|
37
|
-
cursor: null,
|
|
38
|
-
after: true,
|
|
39
|
-
limit: JOURNAL_ENTRIES_LIMIT
|
|
40
|
-
},
|
|
41
|
-
// If this query is used for virtualized list pagination, set {params.skip=true}
|
|
42
|
-
skip: !variables.organizationId,
|
|
43
|
-
...params,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
journalEntries: data?.journalEntries,
|
|
48
|
-
...other
|
|
49
|
-
};
|
|
50
|
-
}
|