@quesmed/types 2.4.10 → 2.4.12

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.
Files changed (35) hide show
  1. package/dist/cjs/models/Picture.d.ts +1 -0
  2. package/dist/cjs/models/Question.d.ts +20 -0
  3. package/dist/cjs/models/User.d.ts +2 -0
  4. package/dist/cjs/resolvers/fragments/chapter.js +1 -0
  5. package/dist/cjs/resolvers/fragments/marksheet.js +1 -0
  6. package/dist/cjs/resolvers/fragments/picture.js +1 -0
  7. package/dist/cjs/resolvers/mutation/restricted/marksheet.js +108 -0
  8. package/dist/cjs/resolvers/mutation/restricted/questionDiscussion.d.ts +18 -1
  9. package/dist/cjs/resolvers/mutation/restricted/questionDiscussion.js +140 -1
  10. package/dist/cjs/resolvers/query/restricted/marksheet.js +117 -0
  11. package/dist/cjs/resolvers/query/restricted/quesBook.js +1 -0
  12. package/dist/cjs/resolvers/query/restricted/question.js +4 -0
  13. package/dist/cjs/resolvers/query/restricted/todos.js +1 -0
  14. package/dist/cjs/resolvers/query/restricted/video.js +2 -0
  15. package/dist/cjs/resolvers/query/sample.js +2 -0
  16. package/dist/cjs/resolvers/query/video.js +2 -0
  17. package/dist/cjs/utils/lightgallery.js +25 -12
  18. package/dist/mjs/models/Picture.d.ts +1 -0
  19. package/dist/mjs/models/Question.d.ts +20 -0
  20. package/dist/mjs/models/User.d.ts +2 -0
  21. package/dist/mjs/resolvers/fragments/chapter.js +1 -0
  22. package/dist/mjs/resolvers/fragments/marksheet.js +1 -0
  23. package/dist/mjs/resolvers/fragments/picture.js +1 -0
  24. package/dist/mjs/resolvers/mutation/restricted/marksheet.js +108 -0
  25. package/dist/mjs/resolvers/mutation/restricted/questionDiscussion.d.ts +18 -1
  26. package/dist/mjs/resolvers/mutation/restricted/questionDiscussion.js +137 -0
  27. package/dist/mjs/resolvers/query/restricted/marksheet.js +117 -0
  28. package/dist/mjs/resolvers/query/restricted/quesBook.js +1 -0
  29. package/dist/mjs/resolvers/query/restricted/question.js +4 -0
  30. package/dist/mjs/resolvers/query/restricted/todos.js +1 -0
  31. package/dist/mjs/resolvers/query/restricted/video.js +2 -0
  32. package/dist/mjs/resolvers/query/sample.js +2 -0
  33. package/dist/mjs/resolvers/query/video.js +2 -0
  34. package/dist/mjs/utils/lightgallery.js +25 -12
  35. package/package.json +1 -1
@@ -65,6 +65,14 @@ export const BUILD_QUESTION_MARKSHEET = gql `
65
65
  question
66
66
  totalVotes
67
67
  typeId
68
+ highlights {
69
+ start
70
+ end
71
+ text
72
+ part
73
+ tag
74
+ color
75
+ }
68
76
  choices {
69
77
  id
70
78
  explanation
@@ -126,6 +134,7 @@ export const BUILD_QUESTION_MARKSHEET = gql `
126
134
  path
127
135
  path512
128
136
  path256
137
+ index
129
138
  topicId
130
139
  topic {
131
140
  id
@@ -184,6 +193,14 @@ export const BUILD_QUESTION_MARKSHEET = gql `
184
193
  question
185
194
  totalVotes
186
195
  typeId
196
+ highlights {
197
+ start
198
+ end
199
+ text
200
+ part
201
+ tag
202
+ color
203
+ }
187
204
  choices {
188
205
  id
189
206
  explanation
@@ -245,6 +262,7 @@ export const BUILD_QUESTION_MARKSHEET = gql `
245
262
  path
246
263
  path512
247
264
  path256
265
+ index
248
266
  topicId
249
267
  topic {
250
268
  id
@@ -306,6 +324,14 @@ export const BUILD_QUESTION_MARKSHEET = gql `
306
324
  question
307
325
  totalVotes
308
326
  typeId
327
+ highlights {
328
+ start
329
+ end
330
+ text
331
+ part
332
+ tag
333
+ color
334
+ }
309
335
  choices {
310
336
  id
311
337
  explanation
@@ -367,6 +393,7 @@ export const BUILD_QUESTION_MARKSHEET = gql `
367
393
  path
368
394
  path512
369
395
  path256
396
+ index
370
397
  topicId
371
398
  topic {
372
399
  id
@@ -425,6 +452,14 @@ export const BUILD_QUESTION_MARKSHEET = gql `
425
452
  question
426
453
  totalVotes
427
454
  typeId
455
+ highlights {
456
+ start
457
+ end
458
+ text
459
+ part
460
+ tag
461
+ color
462
+ }
428
463
  choices {
429
464
  id
430
465
  explanation
@@ -486,6 +521,7 @@ export const BUILD_QUESTION_MARKSHEET = gql `
486
521
  path
487
522
  path512
488
523
  path256
524
+ index
489
525
  topicId
490
526
  topic {
491
527
  id
@@ -639,6 +675,14 @@ export const BUILD_MARKSHEET = gql `
639
675
  question
640
676
  totalVotes
641
677
  typeId
678
+ highlights {
679
+ start
680
+ end
681
+ text
682
+ part
683
+ tag
684
+ color
685
+ }
642
686
  choices {
643
687
  id
644
688
  explanation
@@ -700,6 +744,7 @@ export const BUILD_MARKSHEET = gql `
700
744
  path
701
745
  path512
702
746
  path256
747
+ index
703
748
  topicId
704
749
  topic {
705
750
  id
@@ -758,6 +803,14 @@ export const BUILD_MARKSHEET = gql `
758
803
  question
759
804
  totalVotes
760
805
  typeId
806
+ highlights {
807
+ start
808
+ end
809
+ text
810
+ part
811
+ tag
812
+ color
813
+ }
761
814
  choices {
762
815
  id
763
816
  explanation
@@ -819,6 +872,7 @@ export const BUILD_MARKSHEET = gql `
819
872
  path
820
873
  path512
821
874
  path256
875
+ index
822
876
  topicId
823
877
  topic {
824
878
  id
@@ -880,6 +934,14 @@ export const BUILD_MARKSHEET = gql `
880
934
  question
881
935
  totalVotes
882
936
  typeId
937
+ highlights {
938
+ start
939
+ end
940
+ text
941
+ part
942
+ tag
943
+ color
944
+ }
883
945
  choices {
884
946
  id
885
947
  explanation
@@ -941,6 +1003,7 @@ export const BUILD_MARKSHEET = gql `
941
1003
  path
942
1004
  path512
943
1005
  path256
1006
+ index
944
1007
  topicId
945
1008
  topic {
946
1009
  id
@@ -999,6 +1062,14 @@ export const BUILD_MARKSHEET = gql `
999
1062
  question
1000
1063
  totalVotes
1001
1064
  typeId
1065
+ highlights {
1066
+ start
1067
+ end
1068
+ text
1069
+ part
1070
+ tag
1071
+ color
1072
+ }
1002
1073
  choices {
1003
1074
  id
1004
1075
  explanation
@@ -1060,6 +1131,7 @@ export const BUILD_MARKSHEET = gql `
1060
1131
  path
1061
1132
  path512
1062
1133
  path256
1134
+ index
1063
1135
  topicId
1064
1136
  topic {
1065
1137
  id
@@ -1218,6 +1290,14 @@ export const RE_BUILD_MARKSHEET = gql `
1218
1290
  question
1219
1291
  totalVotes
1220
1292
  typeId
1293
+ highlights {
1294
+ start
1295
+ end
1296
+ text
1297
+ part
1298
+ tag
1299
+ color
1300
+ }
1221
1301
  choices {
1222
1302
  id
1223
1303
  explanation
@@ -1279,6 +1359,7 @@ export const RE_BUILD_MARKSHEET = gql `
1279
1359
  path
1280
1360
  path512
1281
1361
  path256
1362
+ index
1282
1363
  topicId
1283
1364
  topic {
1284
1365
  id
@@ -1337,6 +1418,14 @@ export const RE_BUILD_MARKSHEET = gql `
1337
1418
  question
1338
1419
  totalVotes
1339
1420
  typeId
1421
+ highlights {
1422
+ start
1423
+ end
1424
+ text
1425
+ part
1426
+ tag
1427
+ color
1428
+ }
1340
1429
  choices {
1341
1430
  id
1342
1431
  explanation
@@ -1398,6 +1487,7 @@ export const RE_BUILD_MARKSHEET = gql `
1398
1487
  path
1399
1488
  path512
1400
1489
  path256
1490
+ index
1401
1491
  topicId
1402
1492
  topic {
1403
1493
  id
@@ -1459,6 +1549,14 @@ export const RE_BUILD_MARKSHEET = gql `
1459
1549
  question
1460
1550
  totalVotes
1461
1551
  typeId
1552
+ highlights {
1553
+ start
1554
+ end
1555
+ text
1556
+ part
1557
+ tag
1558
+ color
1559
+ }
1462
1560
  choices {
1463
1561
  id
1464
1562
  explanation
@@ -1520,6 +1618,7 @@ export const RE_BUILD_MARKSHEET = gql `
1520
1618
  path
1521
1619
  path512
1522
1620
  path256
1621
+ index
1523
1622
  topicId
1524
1623
  topic {
1525
1624
  id
@@ -1578,6 +1677,14 @@ export const RE_BUILD_MARKSHEET = gql `
1578
1677
  question
1579
1678
  totalVotes
1580
1679
  typeId
1680
+ highlights {
1681
+ start
1682
+ end
1683
+ text
1684
+ part
1685
+ tag
1686
+ color
1687
+ }
1581
1688
  choices {
1582
1689
  id
1583
1690
  explanation
@@ -1639,6 +1746,7 @@ export const RE_BUILD_MARKSHEET = gql `
1639
1746
  path
1640
1747
  path512
1641
1748
  path256
1749
+ index
1642
1750
  topicId
1643
1751
  topic {
1644
1752
  id
@@ -1,6 +1,6 @@
1
1
  import { ApolloCache, DocumentNode } from '@apollo/client';
2
2
  import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
3
- import { EQuestionLike, EQuestionType, Id, IQuestion, IQuestionComment } from '../../../models';
3
+ import { EQuestionLike, EQuestionType, Id, IHighlight, IQuestion, IQuestionComment, IQuestionHighlights } from '../../../models';
4
4
  import { graphqlNormalize, RestrictedData } from '../../types';
5
5
  interface LikeData {
6
6
  likes?: number;
@@ -9,9 +9,14 @@ interface LikeData {
9
9
  }
10
10
  export declare const QUESTION_SBA_COMMENT_FIELDS: DocumentNode;
11
11
  export declare const QUESTION_QA_COMMENT_FIELDS: DocumentNode;
12
+ export declare const QUESTION_QA_HIGHLIGHT_FIELDS: DocumentNode;
13
+ export declare const QUESTION_SBA_HIGHLIGHT_FIELDS: DocumentNode;
14
+ export declare const QUESTION_MULTIA_HIGHLIGHT_FIELDS: DocumentNode;
15
+ export declare const QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS: DocumentNode;
12
16
  export declare const QUESTION_MULTIA_COMMENT_FIELDS: DocumentNode;
13
17
  export declare const QUESTION_PRESCRIPTION_COMMENT_FIELDS: DocumentNode;
14
18
  export declare const getLikeData: (like: EQuestionLike, item: LikeData) => LikeData;
19
+ export declare const getQuestionHighlightsFragment: (typeId: EQuestionType) => DocumentNode;
15
20
  export declare const getQuestionTypeName: (typeId: EQuestionType) => string;
16
21
  export declare const QUESTION_LIKE: DocumentNode;
17
22
  export declare const optimisticQuestionLike: (input: IQuestionLikeVar, question: IQuestion) => IQuestionLikeData;
@@ -52,4 +57,16 @@ export interface IQuestionCommentRemoveVar {
52
57
  commentId: Id;
53
58
  }
54
59
  export declare type IQuestionCommentRemoveData = RestrictedData<graphqlNormalize & IQuestionComment, 'questionCommentRemove'>;
60
+ /**
61
+ * addQuestionHighlight
62
+ */
63
+ export interface IAddQuestionHighlightVar {
64
+ input: {
65
+ questionId: Id;
66
+ highlights: IHighlight[];
67
+ }[];
68
+ }
69
+ export declare type IAddQuestionHighlightData = RestrictedData<(graphqlNormalize & IQuestionHighlights)[], 'addQuestionHighlight'>;
70
+ export declare const ADD_QUESTION_HIGHLIGHT: DocumentNode;
71
+ export declare const updateQuestionHighlights: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddQuestionHighlightData>, options: ApolloUpdateOptions) => void;
55
72
  export {};
@@ -6,6 +6,14 @@ export const QUESTION_SBA_COMMENT_FIELDS = gql `
6
6
  likes
7
7
  dislikes
8
8
  isLikedByMe
9
+ highlights {
10
+ start
11
+ end
12
+ text
13
+ part
14
+ tag
15
+ color
16
+ }
9
17
  comments {
10
18
  id
11
19
  createdAt
@@ -42,6 +50,14 @@ export const QUESTION_QA_COMMENT_FIELDS = gql `
42
50
  likes
43
51
  dislikes
44
52
  isLikedByMe
53
+ highlights {
54
+ start
55
+ end
56
+ text
57
+ part
58
+ tag
59
+ color
60
+ }
45
61
  comments {
46
62
  id
47
63
  createdAt
@@ -72,12 +88,68 @@ export const QUESTION_QA_COMMENT_FIELDS = gql `
72
88
  }
73
89
  }
74
90
  `;
91
+ export const QUESTION_QA_HIGHLIGHT_FIELDS = gql `
92
+ fragment QuestionQAHighlights on QuestionQA {
93
+ highlights {
94
+ start
95
+ end
96
+ text
97
+ part
98
+ tag
99
+ color
100
+ }
101
+ }
102
+ `;
103
+ export const QUESTION_SBA_HIGHLIGHT_FIELDS = gql `
104
+ fragment QuestionSBAHighlights on QuestionSBA {
105
+ highlights {
106
+ start
107
+ end
108
+ text
109
+ part
110
+ tag
111
+ color
112
+ }
113
+ }
114
+ `;
115
+ export const QUESTION_MULTIA_HIGHLIGHT_FIELDS = gql `
116
+ fragment QuestionMultiAHighlights on QuestionMultiA {
117
+ highlights {
118
+ start
119
+ end
120
+ text
121
+ part
122
+ tag
123
+ color
124
+ }
125
+ }
126
+ `;
127
+ export const QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS = gql `
128
+ fragment QuestionPrescriptionHighlights on QuestionPrescription {
129
+ highlights {
130
+ start
131
+ end
132
+ text
133
+ part
134
+ tag
135
+ color
136
+ }
137
+ }
138
+ `;
75
139
  export const QUESTION_MULTIA_COMMENT_FIELDS = gql `
76
140
  fragment QuestionMultiAComments on QuestionMultiA {
77
141
  id
78
142
  likes
79
143
  dislikes
80
144
  isLikedByMe
145
+ highlights {
146
+ start
147
+ end
148
+ text
149
+ part
150
+ tag
151
+ color
152
+ }
81
153
  comments {
82
154
  id
83
155
  createdAt
@@ -114,6 +186,14 @@ export const QUESTION_PRESCRIPTION_COMMENT_FIELDS = gql `
114
186
  likes
115
187
  dislikes
116
188
  isLikedByMe
189
+ highlights {
190
+ start
191
+ end
192
+ text
193
+ part
194
+ tag
195
+ color
196
+ }
117
197
  comments {
118
198
  id
119
199
  createdAt
@@ -168,6 +248,19 @@ export const getLikeData = (like, item) => {
168
248
  }
169
249
  return { likes, dislikes, isLikedByMe: like };
170
250
  };
251
+ export const getQuestionHighlightsFragment = (typeId) => {
252
+ switch (typeId) {
253
+ case EQuestionType.QUESTION_ANSWER:
254
+ return QUESTION_QA_HIGHLIGHT_FIELDS;
255
+ case EQuestionType.PRESCRIPTION_ANSWER:
256
+ return QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS;
257
+ case EQuestionType.MULTIPLE_ANSWERS:
258
+ return QUESTION_MULTIA_HIGHLIGHT_FIELDS;
259
+ case EQuestionType.SINGLE_BEST_ANSWER:
260
+ default:
261
+ return QUESTION_SBA_HIGHLIGHT_FIELDS;
262
+ }
263
+ };
171
264
  export const getQuestionTypeName = (typeId) => {
172
265
  switch (typeId) {
173
266
  case EQuestionType.QUESTION_ANSWER:
@@ -516,3 +609,47 @@ export const optimisticQuestionCommentRemove = (comments, input, parentId) => {
516
609
  },
517
610
  };
518
611
  };
612
+ export const ADD_QUESTION_HIGHLIGHT = gql `
613
+ mutation AddHighlight($input: [AddQuestionHighlightInput!]!) {
614
+ restricted {
615
+ addQuestionHighlight(input: $input) {
616
+ id
617
+ questionId
618
+ userId
619
+ highlights {
620
+ start
621
+ end
622
+ text
623
+ part
624
+ tag
625
+ color
626
+ }
627
+ }
628
+ }
629
+ }
630
+ `;
631
+ export const updateQuestionHighlights = (typeId) => (cache, result, options) => {
632
+ const { addQuestionHighlight } = result?.data?.restricted ?? {};
633
+ const { variables } = options || {};
634
+ if (!variables || !addQuestionHighlight) {
635
+ return;
636
+ }
637
+ const { input } = variables;
638
+ try {
639
+ input.forEach(({ questionId }) => {
640
+ cache.writeFragment({
641
+ id: cache.identify({
642
+ id: questionId,
643
+ __typename: getQuestionTypeName(typeId),
644
+ }),
645
+ data: {
646
+ highlights: addQuestionHighlight[0].highlights,
647
+ },
648
+ fragment: getQuestionHighlightsFragment(typeId),
649
+ });
650
+ });
651
+ }
652
+ catch (error) {
653
+ console.error(error);
654
+ }
655
+ };