@jsb188/graphql 1.0.0
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 +56 -0
- package/cache/index.ts +861 -0
- package/cache/utils.ts +56 -0
- package/gql/fragments/authFragments.ts +8 -0
- package/gql/fragments/billingFragments.ts +25 -0
- package/gql/fragments/cardFragments.ts +15 -0
- package/gql/fragments/chatFragments.ts +98 -0
- package/gql/fragments/otherFragments.ts +21 -0
- package/gql/fragments/userFragments.ts +69 -0
- package/gql/mutations/authMutations.ts +197 -0
- package/gql/mutations/billingMutations.ts +34 -0
- package/gql/mutations/chatMutations.ts +116 -0
- package/gql/mutations/otherMutations.ts +46 -0
- package/gql/mutations/userMutations.ts +89 -0
- package/gql/queries/authQueries.ts +13 -0
- package/gql/queries/billingQueries.ts +12 -0
- package/gql/queries/cardQueries.ts +24 -0
- package/gql/queries/chatQueries.ts +86 -0
- package/gql/queries/otherQueries.ts +12 -0
- package/gql/queries/userQueries.ts +104 -0
- package/main.ts +2 -0
- package/package.json +38 -0
- package/types.d.ts +31 -0
package/cache/config.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Rules for GraphQL server that's hard-coded to this package
|
|
4
|
+
* NOTE: Allow config setup for this later
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const QUERY_EXPIRE_TIMES = {
|
|
8
|
+
__default: 3.6e+6, // 1 hour
|
|
9
|
+
// 6.48e+7, // 18 hours
|
|
10
|
+
} as {
|
|
11
|
+
[key: string]: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const RULES = {
|
|
15
|
+
// __limit: 8000, // 8000: approximately 5.15 MB; calculated at 644.666666668 bytes for 30 objects
|
|
16
|
+
__limit: 100000, // 12000: approximately 7.725 MB; calculated at 644.666666668 bytes for 30 objects
|
|
17
|
+
// __limit: 50, // 12000: approximately 7.725 MB; calculated at 644.666666668 bytes for 30 objects
|
|
18
|
+
|
|
19
|
+
// List of queries that should be cached
|
|
20
|
+
// NOTE: Fragments are always cached
|
|
21
|
+
alerts: true,
|
|
22
|
+
cardsForUser: true,
|
|
23
|
+
chat: true,
|
|
24
|
+
chatsList: true,
|
|
25
|
+
editChat: true,
|
|
26
|
+
friend: true,
|
|
27
|
+
friendsList: true,
|
|
28
|
+
friendRequests: true,
|
|
29
|
+
myChats: true,
|
|
30
|
+
platformProducts: true,
|
|
31
|
+
searchUsers: true,
|
|
32
|
+
updateNote: true,
|
|
33
|
+
userIdToChatId: true,
|
|
34
|
+
|
|
35
|
+
// All fragments are cached,
|
|
36
|
+
// but if you want to skip some, add it here
|
|
37
|
+
authFragment: false,
|
|
38
|
+
} as {
|
|
39
|
+
__limit: number;
|
|
40
|
+
[key: string]: boolean | number;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const PARTIALS_MAP = {
|
|
44
|
+
// Partial fragments are supported if you map them to its original fragment name
|
|
45
|
+
chatPartial: 'chatFragment',
|
|
46
|
+
chatStatusPartial: 'chatFragment',
|
|
47
|
+
userPartial: 'userFragment',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Set up config, so the package can use app's variables
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
export function configGraphQL(_rules: any) {
|
|
55
|
+
// Do something with rules and partials map here
|
|
56
|
+
}
|