@quesmed/types-rn 2.2.68 → 2.2.72
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/package.json +1 -1
- package/resolvers/fragments/user.d.ts +1 -0
- package/resolvers/fragments/user.js +51 -1
- package/resolvers/mutation/restricted/marksheet.d.ts +3 -0
- package/resolvers/mutation/restricted/marksheet.js +37 -1
- package/resolvers/mutation/restricted/todo.d.ts +2 -0
- package/resolvers/mutation/restricted/todo.js +44 -1
- package/resolvers/mutation/restricted/users.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.USER_FIELDS = void 0;
|
|
3
|
+
exports.COMPLETED_CARDS = exports.USER_FIELDS = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
exports.USER_FIELDS = (0, client_1.gql) `
|
|
6
6
|
fragment UserFields on User {
|
|
@@ -34,3 +34,53 @@ exports.USER_FIELDS = (0, client_1.gql) `
|
|
|
34
34
|
# completedRedCardsCount
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
|
+
exports.COMPLETED_CARDS = (0, client_1.gql) `
|
|
38
|
+
fragment UserCompletedCards on User {
|
|
39
|
+
completedCards {
|
|
40
|
+
id
|
|
41
|
+
createdAt
|
|
42
|
+
updatedAt
|
|
43
|
+
concept {
|
|
44
|
+
id
|
|
45
|
+
name
|
|
46
|
+
}
|
|
47
|
+
lastSeen
|
|
48
|
+
reviewDate
|
|
49
|
+
score
|
|
50
|
+
iteration
|
|
51
|
+
optimalFactor
|
|
52
|
+
cardId
|
|
53
|
+
card {
|
|
54
|
+
id
|
|
55
|
+
conceptId
|
|
56
|
+
concept {
|
|
57
|
+
id
|
|
58
|
+
name
|
|
59
|
+
}
|
|
60
|
+
topic {
|
|
61
|
+
id
|
|
62
|
+
name
|
|
63
|
+
}
|
|
64
|
+
question
|
|
65
|
+
explanation
|
|
66
|
+
pictures {
|
|
67
|
+
id
|
|
68
|
+
createdAt
|
|
69
|
+
updatedAt
|
|
70
|
+
name
|
|
71
|
+
caption
|
|
72
|
+
path
|
|
73
|
+
path512
|
|
74
|
+
path256
|
|
75
|
+
topicId
|
|
76
|
+
topic {
|
|
77
|
+
id
|
|
78
|
+
name
|
|
79
|
+
typeId
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
completedCardsCount
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
@@ -73,6 +73,9 @@ export interface IRemoveFlaggedQuestionVar {
|
|
|
73
73
|
questionId: Id;
|
|
74
74
|
}
|
|
75
75
|
export declare type IRemoveFlaggedQuestionData = RestrictedData<(graphqlNormalize & IUserFlaggedQuestion)[], 'removeFlaggedQuestion'>;
|
|
76
|
+
export declare const MARK_FLAGGED_FIELD: import("@apollo/client").DocumentNode;
|
|
77
|
+
export declare const updateCacheAddFlaggedQuestion: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddFlaggedQuestionData>) => void;
|
|
78
|
+
export declare const updateCacheRemoveFlaggedQuestion: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IRemoveFlaggedQuestionData>) => void;
|
|
76
79
|
/**
|
|
77
80
|
* startOrJoinMarksheet
|
|
78
81
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TOGGLE_STRIKE_OPTIONS = exports.END_MARKSHEET = exports.LEAVE_MARKSHEET = exports.MODIFY_MARKSHEET_INFO = exports.optimisticModifyMarksheetBuilderConfig = exports.START_OR_JOIN_MARKSHEET = exports.REMOVE_FLAGGED_QUESTION = exports.ADD_FLAGGED_QUESTION = exports.optimisticSaveMarksheets = exports.updateMarksheets = exports.SAVE_MARKSHEET = exports.RE_BUILD_MARKSHEET = exports.BUILD_MARKSHEET = exports.BUILD_QUESTION_MARKSHEET = void 0;
|
|
3
|
+
exports.TOGGLE_STRIKE_OPTIONS = exports.END_MARKSHEET = exports.LEAVE_MARKSHEET = exports.MODIFY_MARKSHEET_INFO = exports.optimisticModifyMarksheetBuilderConfig = exports.START_OR_JOIN_MARKSHEET = exports.updateCacheRemoveFlaggedQuestion = exports.updateCacheAddFlaggedQuestion = exports.MARK_FLAGGED_FIELD = exports.REMOVE_FLAGGED_QUESTION = exports.ADD_FLAGGED_QUESTION = exports.optimisticSaveMarksheets = exports.updateMarksheets = exports.SAVE_MARKSHEET = exports.RE_BUILD_MARKSHEET = exports.BUILD_MARKSHEET = exports.BUILD_QUESTION_MARKSHEET = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const restricted_1 = require("../../query/restricted");
|
|
6
6
|
exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
|
|
@@ -1821,6 +1821,42 @@ exports.REMOVE_FLAGGED_QUESTION = (0, client_1.gql) `
|
|
|
1821
1821
|
}
|
|
1822
1822
|
}
|
|
1823
1823
|
`;
|
|
1824
|
+
exports.MARK_FLAGGED_FIELD = (0, client_1.gql) `
|
|
1825
|
+
fragment MarksheetMarkFlagged on MarksheetMark {
|
|
1826
|
+
flagged
|
|
1827
|
+
}
|
|
1828
|
+
`;
|
|
1829
|
+
const updateCacheAddFlaggedQuestion = (cache, result) => {
|
|
1830
|
+
const { addFlaggedQuestion } = result?.data?.restricted || {};
|
|
1831
|
+
if (!addFlaggedQuestion) {
|
|
1832
|
+
return;
|
|
1833
|
+
}
|
|
1834
|
+
const { markId } = addFlaggedQuestion;
|
|
1835
|
+
cache.writeFragment({
|
|
1836
|
+
id: cache.identify({ id: markId, __typename: 'MarksheetMark' }),
|
|
1837
|
+
data: {
|
|
1838
|
+
flagged: true,
|
|
1839
|
+
},
|
|
1840
|
+
fragment: exports.MARK_FLAGGED_FIELD,
|
|
1841
|
+
});
|
|
1842
|
+
};
|
|
1843
|
+
exports.updateCacheAddFlaggedQuestion = updateCacheAddFlaggedQuestion;
|
|
1844
|
+
const updateCacheRemoveFlaggedQuestion = (cache, result) => {
|
|
1845
|
+
const { removeFlaggedQuestion } = result?.data?.restricted || {};
|
|
1846
|
+
if (!removeFlaggedQuestion) {
|
|
1847
|
+
return;
|
|
1848
|
+
}
|
|
1849
|
+
removeFlaggedQuestion.forEach(({ markId }) => {
|
|
1850
|
+
cache.writeFragment({
|
|
1851
|
+
id: cache.identify({ id: Number(markId), __typename: 'MarksheetMark' }),
|
|
1852
|
+
data: {
|
|
1853
|
+
flagged: false,
|
|
1854
|
+
},
|
|
1855
|
+
fragment: exports.MARK_FLAGGED_FIELD,
|
|
1856
|
+
});
|
|
1857
|
+
});
|
|
1858
|
+
};
|
|
1859
|
+
exports.updateCacheRemoveFlaggedQuestion = updateCacheRemoveFlaggedQuestion;
|
|
1824
1860
|
exports.START_OR_JOIN_MARKSHEET = (0, client_1.gql) `
|
|
1825
1861
|
mutation StartOrJoinMarksheet($agoraId: String!, $solo: Boolean!) {
|
|
1826
1862
|
restricted {
|
|
@@ -37,6 +37,8 @@ export interface IRemoveFromDailyStackVar {
|
|
|
37
37
|
conceptId?: Id;
|
|
38
38
|
}
|
|
39
39
|
export declare type IRemoveFromDailyStackData = RestrictedData<(graphqlNormalize & IUserCompletedCard)[], 'removeFromDailyStack'>;
|
|
40
|
+
export declare const updateCacheRemoveFromDailyStack: (userId?: number | undefined) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IRemoveFromDailyStackData>) => void;
|
|
41
|
+
export declare const updateCacheAddToDailyStack: (userId?: number | undefined) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddToDailyStackData>) => void;
|
|
40
42
|
export declare const REFRESH_DAILY_TASK: import("@apollo/client").DocumentNode;
|
|
41
43
|
export declare type IRefreshDailyTaskVar = null;
|
|
42
44
|
export declare type IRefreshDailyTaskData = RestrictedData<graphqlNormalize & ITodo, 'refreshDailyTask'>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REFRESH_DAILY_TASK = exports.REMOVE_FROM_DAILY_STACK = exports.ADD_TO_DAILY_STACK = exports.saveTodosCache = exports.SAVE_TODO = exports.BUILD_TODO = void 0;
|
|
3
|
+
exports.REFRESH_DAILY_TASK = exports.updateCacheAddToDailyStack = exports.updateCacheRemoveFromDailyStack = exports.REMOVE_FROM_DAILY_STACK = exports.ADD_TO_DAILY_STACK = exports.saveTodosCache = exports.SAVE_TODO = exports.BUILD_TODO = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const fragments_1 = require("../../fragments");
|
|
6
6
|
exports.BUILD_TODO = (0, client_1.gql) `
|
|
@@ -134,6 +134,49 @@ exports.REMOVE_FROM_DAILY_STACK = (0, client_1.gql) `
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
`;
|
|
137
|
+
const updateCacheRemoveFromDailyStack = (userId) => (cache, result) => {
|
|
138
|
+
const { removeFromDailyStack } = result.data?.restricted || {};
|
|
139
|
+
const prevData = cache.readFragment({
|
|
140
|
+
id: cache.identify({ id: userId, __typename: 'User' }),
|
|
141
|
+
fragment: fragments_1.COMPLETED_CARDS,
|
|
142
|
+
});
|
|
143
|
+
if (prevData && removeFromDailyStack && removeFromDailyStack.length) {
|
|
144
|
+
const toRemove = new Set(removeFromDailyStack.map(({ id }) => id));
|
|
145
|
+
if (toRemove.size === 0 || !userId) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const newCompletedCards = prevData.completedCards.filter(({ id }) => !toRemove.has(id));
|
|
149
|
+
cache.writeFragment({
|
|
150
|
+
id: cache.identify({ id: userId, __typename: 'User' }),
|
|
151
|
+
data: {
|
|
152
|
+
completedCardsCount: newCompletedCards.length,
|
|
153
|
+
completedCards: newCompletedCards,
|
|
154
|
+
},
|
|
155
|
+
fragment: fragments_1.COMPLETED_CARDS,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
exports.updateCacheRemoveFromDailyStack = updateCacheRemoveFromDailyStack;
|
|
160
|
+
const updateCacheAddToDailyStack = (userId) => (cache, result) => {
|
|
161
|
+
const { addToDailyStack } = result.data?.restricted || {};
|
|
162
|
+
const prevData = cache.readFragment({
|
|
163
|
+
id: cache.identify({ id: userId, __typename: 'User' }),
|
|
164
|
+
fragment: fragments_1.COMPLETED_CARDS,
|
|
165
|
+
});
|
|
166
|
+
const { completedCards = [] } = prevData || {};
|
|
167
|
+
if (addToDailyStack) {
|
|
168
|
+
const newCompletedCards = [...completedCards, ...addToDailyStack];
|
|
169
|
+
cache.writeFragment({
|
|
170
|
+
id: cache.identify({ id: userId, __typename: 'User' }),
|
|
171
|
+
data: {
|
|
172
|
+
completedCardsCount: newCompletedCards.length,
|
|
173
|
+
completedCards: newCompletedCards,
|
|
174
|
+
},
|
|
175
|
+
fragment: fragments_1.COMPLETED_CARDS,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
exports.updateCacheAddToDailyStack = updateCacheAddToDailyStack;
|
|
137
180
|
exports.REFRESH_DAILY_TASK = (0, client_1.gql) `
|
|
138
181
|
${fragments_1.PICTURE_FIELDS}
|
|
139
182
|
mutation RefreshDailyTask {
|
|
@@ -30,3 +30,4 @@ export declare type IRenewTokenData = RestrictedData<string, 'renewToken'>;
|
|
|
30
30
|
export declare const TOC_ACCEPT: import("@apollo/client").DocumentNode;
|
|
31
31
|
export declare type ITocAcceptVar = null;
|
|
32
32
|
export declare type ITocAcceptData = RestrictedData<string, 'tocAccept'>;
|
|
33
|
+
export declare type ICompletedCardsData = Pick<IUser, 'completedCards' | 'completedCardsCount'>;
|