@quesmed/types 2.6.29 → 2.6.31
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/dist/cjs/resolvers/fragments/chapter.js +3 -18
- package/dist/cjs/resolvers/fragments/concept.d.ts +1 -2
- package/dist/cjs/resolvers/fragments/concept.js +18 -57
- package/dist/cjs/resolvers/fragments/index.d.ts +2 -0
- package/dist/cjs/resolvers/fragments/index.js +2 -0
- package/dist/cjs/resolvers/fragments/marksheet.d.ts +14 -0
- package/dist/cjs/resolvers/fragments/marksheet.js +127 -127
- package/dist/cjs/resolvers/fragments/mockTest.d.ts +6 -0
- package/dist/cjs/resolvers/fragments/mockTest.js +27 -1
- package/dist/cjs/resolvers/fragments/osce.d.ts +3 -0
- package/dist/cjs/resolvers/fragments/osce.js +23 -1
- package/dist/cjs/resolvers/fragments/question.d.ts +5 -0
- package/dist/cjs/resolvers/fragments/question.js +176 -0
- package/dist/cjs/resolvers/fragments/topic.d.ts +2 -0
- package/dist/cjs/resolvers/fragments/topic.js +25 -1
- package/dist/cjs/resolvers/fragments/video.d.ts +1 -0
- package/dist/cjs/resolvers/fragments/video.js +17 -28
- package/dist/cjs/resolvers/mutation/restricted/marksheet.d.ts +0 -8
- package/dist/cjs/resolvers/mutation/restricted/marksheet.js +18 -4128
- package/dist/cjs/resolvers/mutation/restricted/mockTest.d.ts +2 -3
- package/dist/cjs/resolvers/mutation/restricted/mockTest.js +22 -13
- package/dist/cjs/resolvers/mutation/restricted/osce.d.ts +46 -2
- package/dist/cjs/resolvers/mutation/restricted/osce.js +47 -1
- package/dist/cjs/resolvers/mutation/restricted/questionDiscussion.d.ts +6 -21
- package/dist/cjs/resolvers/mutation/restricted/questionDiscussion.js +27 -532
- package/dist/cjs/resolvers/query/restricted/marksheet.js +5 -2025
- package/dist/cjs/resolvers/query/restricted/question.js +3 -932
- package/dist/mjs/resolvers/fragments/chapter.js +3 -18
- package/dist/mjs/resolvers/fragments/concept.d.ts +1 -2
- package/dist/mjs/resolvers/fragments/concept.js +18 -57
- package/dist/mjs/resolvers/fragments/index.d.ts +2 -0
- package/dist/mjs/resolvers/fragments/index.js +2 -0
- package/dist/mjs/resolvers/fragments/marksheet.d.ts +14 -0
- package/dist/mjs/resolvers/fragments/marksheet.js +126 -126
- package/dist/mjs/resolvers/fragments/mockTest.d.ts +6 -0
- package/dist/mjs/resolvers/fragments/mockTest.js +26 -0
- package/dist/mjs/resolvers/fragments/osce.d.ts +3 -0
- package/dist/mjs/resolvers/fragments/osce.js +22 -0
- package/dist/mjs/resolvers/fragments/question.d.ts +5 -0
- package/dist/mjs/resolvers/fragments/question.js +173 -0
- package/dist/mjs/resolvers/fragments/topic.d.ts +2 -0
- package/dist/mjs/resolvers/fragments/topic.js +24 -0
- package/dist/mjs/resolvers/fragments/video.d.ts +1 -0
- package/dist/mjs/resolvers/fragments/video.js +16 -27
- package/dist/mjs/resolvers/mutation/restricted/marksheet.d.ts +0 -8
- package/dist/mjs/resolvers/mutation/restricted/marksheet.js +14 -4124
- package/dist/mjs/resolvers/mutation/restricted/mockTest.d.ts +2 -3
- package/dist/mjs/resolvers/mutation/restricted/mockTest.js +20 -11
- package/dist/mjs/resolvers/mutation/restricted/osce.d.ts +46 -2
- package/dist/mjs/resolvers/mutation/restricted/osce.js +45 -1
- package/dist/mjs/resolvers/mutation/restricted/questionDiscussion.d.ts +6 -21
- package/dist/mjs/resolvers/mutation/restricted/questionDiscussion.js +26 -530
- package/dist/mjs/resolvers/query/restricted/marksheet.js +5 -2025
- package/dist/mjs/resolvers/query/restricted/question.js +3 -932
- package/package.json +6 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
2
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { IMarksheet, IMarksheetMark, Id } from '../../../models';
|
|
4
|
+
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
5
5
|
export declare const BUILD_MOCK_TEST_MARKSHEET: import("@apollo/client").DocumentNode;
|
|
6
6
|
export interface IBuildMockTestMarksheetVar {
|
|
7
7
|
mockTestId: Id;
|
|
@@ -9,7 +9,6 @@ export interface IBuildMockTestMarksheetVar {
|
|
|
9
9
|
}
|
|
10
10
|
export type IBuildMockTestMarksheetData = RestrictedData<graphqlNormalize & IMarksheet, 'buildMockTestMarksheet'>;
|
|
11
11
|
export declare const TOGGLE_FLAGGED_MARK: import("@apollo/client").DocumentNode;
|
|
12
|
-
export declare const MARK_FLAGGED_QUESTION: import("@apollo/client").DocumentNode;
|
|
13
12
|
export declare const updateCacheToggleFlaggedQuestion: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IToggleFlaggedMarkData>) => void;
|
|
14
13
|
export declare const optimisticToggleFlaggedQuestion: (mark: IMarksheetMark, flagged: boolean) => {
|
|
15
14
|
restricted: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
|
+
import { COMPLETED_MOCK_TESTS_FRAGMENT, COMPLETED_MOCK_TEST_MARKSHEET_FRAGMENT, MARK_FLAGGED_QUESTION, } from '../../fragments';
|
|
2
3
|
export const BUILD_MOCK_TEST_MARKSHEET = gql `
|
|
3
4
|
mutation BuildMockTestMarksheet($mockTestId: Int!, $duration: Int!) {
|
|
4
5
|
restricted {
|
|
@@ -26,11 +27,6 @@ export const TOGGLE_FLAGGED_MARK = gql `
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
`;
|
|
29
|
-
export const MARK_FLAGGED_QUESTION = gql `
|
|
30
|
-
fragment MarksheetMarkFlagged on MarksheetMark {
|
|
31
|
-
flagged
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
30
|
export const updateCacheToggleFlaggedQuestion = (cache, result) => {
|
|
35
31
|
const { toggleFlaggedMark } = result?.data?.restricted || {};
|
|
36
32
|
if (!toggleFlaggedMark) {
|
|
@@ -59,6 +55,9 @@ export const END_MOCK_TEST = gql `
|
|
|
59
55
|
restricted {
|
|
60
56
|
endMockTest(marksheetId: $marksheetId) {
|
|
61
57
|
id
|
|
58
|
+
startedAt
|
|
59
|
+
endedAt
|
|
60
|
+
mockTestId
|
|
62
61
|
completed
|
|
63
62
|
correct
|
|
64
63
|
incorrect
|
|
@@ -68,11 +67,6 @@ export const END_MOCK_TEST = gql `
|
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
`;
|
|
71
|
-
const COMPLETED_MOCK_TEST_FRAGMENT = gql `
|
|
72
|
-
fragment MockTestCompleted on Marksheet {
|
|
73
|
-
completed
|
|
74
|
-
}
|
|
75
|
-
`;
|
|
76
70
|
export const updateCacheOnEndMockTest = (cache, result, options) => {
|
|
77
71
|
const { endMockTest } = result?.data?.restricted || {};
|
|
78
72
|
const { variables } = options || {};
|
|
@@ -84,8 +78,23 @@ export const updateCacheOnEndMockTest = (cache, result, options) => {
|
|
|
84
78
|
id: cache.identify({ id, __typename: 'Marksheet' }),
|
|
85
79
|
data: {
|
|
86
80
|
completed: true,
|
|
81
|
+
correct: endMockTest.correct,
|
|
82
|
+
incorrect: endMockTest.incorrect,
|
|
83
|
+
duration: endMockTest.duration,
|
|
84
|
+
endedAt: endMockTest.endedAt,
|
|
85
|
+
},
|
|
86
|
+
fragment: COMPLETED_MOCK_TEST_MARKSHEET_FRAGMENT,
|
|
87
|
+
});
|
|
88
|
+
cache.writeFragment({
|
|
89
|
+
id: cache.identify({ id: endMockTest.mockTestId, __typename: 'MockTest' }),
|
|
90
|
+
data: {
|
|
91
|
+
lastMarksheetId: endMockTest.id,
|
|
92
|
+
lastMarksheetStartedAt: endMockTest.startedAt,
|
|
93
|
+
lastMarksheetEndedAt: endMockTest.endedAt,
|
|
94
|
+
correct: endMockTest.correct,
|
|
95
|
+
incorrect: endMockTest.incorrect,
|
|
87
96
|
},
|
|
88
|
-
fragment:
|
|
97
|
+
fragment: COMPLETED_MOCK_TESTS_FRAGMENT,
|
|
89
98
|
});
|
|
90
99
|
};
|
|
91
100
|
export const optimisticEndMockTest = (marksheet) => ({
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApolloCache } from '@apollo/client';
|
|
2
|
+
import { EOsceMarksheetAction, EOsceMarksheetState, EOsceRoles, EPaceMarkType, EProductType, EStudyAction, IOsceMarksheet, IOsceMarksheetMark, Id } from '../../../models';
|
|
3
|
+
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
2
4
|
import { IOsceMatchmakingAction } from '../../subscription/osce';
|
|
3
|
-
import {
|
|
5
|
+
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
4
6
|
export declare const START_OSCE_MATCHMAKING: import("@apollo/client").DocumentNode;
|
|
5
7
|
export interface IStartOsceMatchmakingVar {
|
|
6
8
|
sessionId: string;
|
|
@@ -89,6 +91,48 @@ export declare const END_OSCE_MARKSHEET: import("@apollo/client").DocumentNode;
|
|
|
89
91
|
export interface IEndOsceMarksheetVar extends ISaveOsceMarksheetVar {
|
|
90
92
|
}
|
|
91
93
|
export type IEndOsceMarksheetData = RestrictedData<graphqlNormalize & IOsceMarksheet, 'endOsceMarksheet'>;
|
|
94
|
+
export declare const updateCacheOnEndOsceMarksheet: (productType: EProductType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IEndOsceMarksheetData>, options: ApolloUpdateOptions) => void;
|
|
95
|
+
export declare const optimisticEndOsceMarksheet: (marksheet: IOsceMarksheet) => {
|
|
96
|
+
restricted: {
|
|
97
|
+
__typename: string;
|
|
98
|
+
endOsceMarksheet: {
|
|
99
|
+
completed: boolean;
|
|
100
|
+
id: number;
|
|
101
|
+
createdAt: number | Date;
|
|
102
|
+
updatedAt: number | Date;
|
|
103
|
+
deletedAt: number | Date;
|
|
104
|
+
timeTaken: number;
|
|
105
|
+
osceStationId: number;
|
|
106
|
+
osceStation?: import("../../../models").IOsceStation | undefined;
|
|
107
|
+
role?: EOsceRoles | undefined;
|
|
108
|
+
solo: boolean;
|
|
109
|
+
score: number;
|
|
110
|
+
total: number;
|
|
111
|
+
correct: number;
|
|
112
|
+
globalScore: number;
|
|
113
|
+
feedback: string;
|
|
114
|
+
agoraId: string;
|
|
115
|
+
sessionId: string;
|
|
116
|
+
readingTime: number;
|
|
117
|
+
stationTime: number;
|
|
118
|
+
feedbackTime: number;
|
|
119
|
+
startedAt: number | Date;
|
|
120
|
+
endedAt: number | Date;
|
|
121
|
+
pausedAt: number | Date;
|
|
122
|
+
timeRemaining: string;
|
|
123
|
+
totalStationTime: string;
|
|
124
|
+
stageTime: string;
|
|
125
|
+
stage: import("../../../models").EOsceStage;
|
|
126
|
+
marks: IOsceMarksheetMark[];
|
|
127
|
+
users: import("../../../models").IUser[];
|
|
128
|
+
activeUsers?: import("../../../models").IUser[] | undefined;
|
|
129
|
+
members: import("../../../models").IOsceMarksheetMember[];
|
|
130
|
+
state: EOsceMarksheetState;
|
|
131
|
+
productId: EProductType;
|
|
132
|
+
__typename: string;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
92
136
|
export declare const LEAVE_OSCE_MARKSHEET: import("@apollo/client").DocumentNode;
|
|
93
137
|
export interface ILeaveOsceMarksheetVar {
|
|
94
138
|
osceMarksheetId: Id;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
import { EProductType, } from '../../../models';
|
|
3
|
-
import { OSCE_MARKSHEET_FIELDS, OSCE_MATCHMAKING_ACTION_FIELDS, } from '../../fragments/osce';
|
|
3
|
+
import { COMPLETED_OSCE_MARKSHEET_FRAGMENT, COMPLETED_OSCE_STATION_FRAGMENT, OSCE_MARKSHEET_FIELDS, OSCE_MATCHMAKING_ACTION_FIELDS, } from '../../fragments/osce';
|
|
4
4
|
import { OSCE_STATION_FIELDS } from './../../fragments/osce';
|
|
5
5
|
export const START_OSCE_MATCHMAKING = gql `
|
|
6
6
|
mutation StartOsceMatchmaking($sessionId: String!) {
|
|
@@ -231,6 +231,50 @@ export const END_OSCE_MARKSHEET = gql `
|
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
`;
|
|
234
|
+
export const updateCacheOnEndOsceMarksheet = (productType) => (cache, result, options) => {
|
|
235
|
+
const { endOsceMarksheet } = result?.data?.restricted || {};
|
|
236
|
+
const { variables } = options || {};
|
|
237
|
+
if (!variables || !endOsceMarksheet) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const { marksheetId: id } = variables;
|
|
241
|
+
cache.writeFragment({
|
|
242
|
+
id: cache.identify({ id, __typename: 'OsceMarksheet' }),
|
|
243
|
+
data: {
|
|
244
|
+
completed: true,
|
|
245
|
+
score: endOsceMarksheet.score,
|
|
246
|
+
state: endOsceMarksheet.state,
|
|
247
|
+
globalScore: endOsceMarksheet.globalScore,
|
|
248
|
+
timeTaken: endOsceMarksheet.timeTaken,
|
|
249
|
+
endedAt: endOsceMarksheet.endedAt,
|
|
250
|
+
},
|
|
251
|
+
fragment: COMPLETED_OSCE_MARKSHEET_FRAGMENT,
|
|
252
|
+
});
|
|
253
|
+
cache.writeFragment({
|
|
254
|
+
id: cache.identify({
|
|
255
|
+
id: endOsceMarksheet.osceStationId,
|
|
256
|
+
__typename: 'OsceStation',
|
|
257
|
+
}),
|
|
258
|
+
data: {
|
|
259
|
+
completedMarks: endOsceMarksheet.marks.filter((m) => productType === EProductType.OSCE
|
|
260
|
+
? m.mark !== null
|
|
261
|
+
: m.selectedChoice !== null).length,
|
|
262
|
+
score: endOsceMarksheet.score,
|
|
263
|
+
lastOsceMarksheetId: endOsceMarksheet.id,
|
|
264
|
+
},
|
|
265
|
+
fragment: COMPLETED_OSCE_STATION_FRAGMENT,
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
export const optimisticEndOsceMarksheet = (marksheet) => ({
|
|
269
|
+
restricted: {
|
|
270
|
+
__typename: 'RestrictedMutation',
|
|
271
|
+
endOsceMarksheet: {
|
|
272
|
+
__typename: 'OsceMarksheet',
|
|
273
|
+
...marksheet,
|
|
274
|
+
completed: true,
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
});
|
|
234
278
|
export const LEAVE_OSCE_MARKSHEET = gql `
|
|
235
279
|
${OSCE_MARKSHEET_FIELDS}
|
|
236
280
|
mutation LeaveOsceMarksheet($osceMarksheetId: Int!) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApolloCache
|
|
1
|
+
import { ApolloCache } from '@apollo/client';
|
|
2
2
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
|
|
3
3
|
import { EQuestionLike, EQuestionType, IHighlight, IQuestion, IQuestionComment, IQuestionHighlights, Id } from '../../../models';
|
|
4
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
@@ -7,24 +7,9 @@ interface LikeData {
|
|
|
7
7
|
dislikes?: number;
|
|
8
8
|
isLikedByMe?: EQuestionLike;
|
|
9
9
|
}
|
|
10
|
-
export declare const QUESTION_SBA_COMMENT_FIELDS: DocumentNode;
|
|
11
|
-
export declare const QUESTION_QA_COMMENT_FIELDS: DocumentNode;
|
|
12
|
-
export declare const QUESTION_EMQ_COMMENT_FIELDS: DocumentNode;
|
|
13
|
-
export declare const QUESTION_SELECT3_COMMENT_FIELDS: DocumentNode;
|
|
14
|
-
export declare const QUESTION_RANKING_COMMENT_FIELDS: DocumentNode;
|
|
15
|
-
export declare const QUESTION_QA_HIGHLIGHT_FIELDS: DocumentNode;
|
|
16
|
-
export declare const QUESTION_SBA_HIGHLIGHT_FIELDS: DocumentNode;
|
|
17
|
-
export declare const QUESTION_MULTIA_HIGHLIGHT_FIELDS: DocumentNode;
|
|
18
|
-
export declare const QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS: DocumentNode;
|
|
19
|
-
export declare const QUESTION_EMQ_HIGHLIGHT_FIELDS: DocumentNode;
|
|
20
|
-
export declare const QUESTION_SELECT3_HIGHLIGHT_FIELDS: DocumentNode;
|
|
21
|
-
export declare const QUESTION_RANKING_HIGHLIGHT_FIELDS: DocumentNode;
|
|
22
|
-
export declare const QUESTION_MULTIA_COMMENT_FIELDS: DocumentNode;
|
|
23
|
-
export declare const QUESTION_PRESCRIPTION_COMMENT_FIELDS: DocumentNode;
|
|
24
10
|
export declare const getLikeData: (like: EQuestionLike, item: LikeData) => LikeData;
|
|
25
|
-
export declare const getQuestionHighlightsFragment: (typeId: EQuestionType) => DocumentNode;
|
|
26
11
|
export declare const getQuestionTypeName: (typeId: EQuestionType) => string;
|
|
27
|
-
export declare const QUESTION_LIKE: DocumentNode;
|
|
12
|
+
export declare const QUESTION_LIKE: import("@apollo/client").DocumentNode;
|
|
28
13
|
export declare const optimisticQuestionLike: (input: IQuestionLikeVar, question: IQuestion) => IQuestionLikeData;
|
|
29
14
|
export interface IQuestionLikeVar {
|
|
30
15
|
marksheetId?: Id;
|
|
@@ -32,7 +17,7 @@ export interface IQuestionLikeVar {
|
|
|
32
17
|
like: EQuestionLike;
|
|
33
18
|
}
|
|
34
19
|
export type IQuestionLikeData = RestrictedData<graphqlNormalize & IQuestion, 'questionLike'>;
|
|
35
|
-
export declare const QUESTION_COMMENTS: DocumentNode;
|
|
20
|
+
export declare const QUESTION_COMMENTS: import("@apollo/client").DocumentNode;
|
|
36
21
|
export declare const updateQuestionComments: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IQuestionCommentsData>, options: ApolloUpdateOptions) => void;
|
|
37
22
|
export declare const optimisticQuestionComment: (id: number, user: {
|
|
38
23
|
id: number;
|
|
@@ -45,7 +30,7 @@ export interface IQuestionCommentsVar {
|
|
|
45
30
|
comment: string;
|
|
46
31
|
}
|
|
47
32
|
export type IQuestionCommentsData = RestrictedData<graphqlNormalize & IQuestionComment, 'questionComments'>;
|
|
48
|
-
export declare const QUESTION_COMMENT_LIKE: DocumentNode;
|
|
33
|
+
export declare const QUESTION_COMMENT_LIKE: import("@apollo/client").DocumentNode;
|
|
49
34
|
export declare const optimisticCommentLike: (comments: IQuestionComment[], input: IQuestionCommentsLikeVar, parentId: number | null) => IQuestionCommentsLikeData;
|
|
50
35
|
export interface IQuestionCommentsLikeVar {
|
|
51
36
|
marksheetId?: Id;
|
|
@@ -54,7 +39,7 @@ export interface IQuestionCommentsLikeVar {
|
|
|
54
39
|
like: EQuestionLike;
|
|
55
40
|
}
|
|
56
41
|
export type IQuestionCommentsLikeData = RestrictedData<graphqlNormalize & IQuestionComment, 'questionCommentLike'>;
|
|
57
|
-
export declare const QUESTION_COMMENT_REMOVE: DocumentNode;
|
|
42
|
+
export declare const QUESTION_COMMENT_REMOVE: import("@apollo/client").DocumentNode;
|
|
58
43
|
export declare const updateQuestionCommentsRemove: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IQuestionCommentRemoveData>, options: ApolloUpdateOptions) => void;
|
|
59
44
|
export declare const optimisticQuestionCommentRemove: (comments: IQuestionComment[], input: IQuestionCommentRemoveVar, parentId?: number) => IQuestionCommentRemoveData;
|
|
60
45
|
export interface IQuestionCommentRemoveVar {
|
|
@@ -73,6 +58,6 @@ export interface IAddQuestionHighlightVar {
|
|
|
73
58
|
}[];
|
|
74
59
|
}
|
|
75
60
|
export type IAddQuestionHighlightData = RestrictedData<(graphqlNormalize & IQuestionHighlights)[], 'addQuestionHighlight'>;
|
|
76
|
-
export declare const ADD_QUESTION_HIGHLIGHT: DocumentNode;
|
|
61
|
+
export declare const ADD_QUESTION_HIGHLIGHT: import("@apollo/client").DocumentNode;
|
|
77
62
|
export declare const updateQuestionHighlights: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddQuestionHighlightData>, options: ApolloUpdateOptions) => void;
|
|
78
63
|
export {};
|