@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
@@ -74,6 +74,14 @@ exports.MARKSHEET = (0, client_1.gql) `
74
74
  question
75
75
  totalVotes
76
76
  typeId
77
+ highlights {
78
+ start
79
+ end
80
+ text
81
+ part
82
+ tag
83
+ color
84
+ }
77
85
  choices {
78
86
  id
79
87
  explanation
@@ -135,6 +143,7 @@ exports.MARKSHEET = (0, client_1.gql) `
135
143
  path
136
144
  path512
137
145
  path256
146
+ index
138
147
  topicId
139
148
  topic {
140
149
  id
@@ -193,6 +202,14 @@ exports.MARKSHEET = (0, client_1.gql) `
193
202
  question
194
203
  totalVotes
195
204
  typeId
205
+ highlights {
206
+ start
207
+ end
208
+ text
209
+ part
210
+ tag
211
+ color
212
+ }
196
213
  choices {
197
214
  id
198
215
  explanation
@@ -254,6 +271,7 @@ exports.MARKSHEET = (0, client_1.gql) `
254
271
  path
255
272
  path512
256
273
  path256
274
+ index
257
275
  topicId
258
276
  topic {
259
277
  id
@@ -315,6 +333,14 @@ exports.MARKSHEET = (0, client_1.gql) `
315
333
  question
316
334
  totalVotes
317
335
  typeId
336
+ highlights {
337
+ start
338
+ end
339
+ text
340
+ part
341
+ tag
342
+ color
343
+ }
318
344
  choices {
319
345
  id
320
346
  explanation
@@ -376,6 +402,7 @@ exports.MARKSHEET = (0, client_1.gql) `
376
402
  path
377
403
  path512
378
404
  path256
405
+ index
379
406
  topicId
380
407
  topic {
381
408
  id
@@ -434,6 +461,14 @@ exports.MARKSHEET = (0, client_1.gql) `
434
461
  question
435
462
  totalVotes
436
463
  typeId
464
+ highlights {
465
+ start
466
+ end
467
+ text
468
+ part
469
+ tag
470
+ color
471
+ }
437
472
  choices {
438
473
  id
439
474
  explanation
@@ -495,6 +530,7 @@ exports.MARKSHEET = (0, client_1.gql) `
495
530
  path
496
531
  path512
497
532
  path256
533
+ index
498
534
  topicId
499
535
  topic {
500
536
  id
@@ -633,6 +669,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
633
669
  question
634
670
  totalVotes
635
671
  typeId
672
+ highlights {
673
+ start
674
+ end
675
+ text
676
+ part
677
+ tag
678
+ color
679
+ }
636
680
  choices {
637
681
  id
638
682
  explanation
@@ -698,6 +742,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
698
742
  path
699
743
  path512
700
744
  path256
745
+ index
701
746
  topicId
702
747
  topic {
703
748
  id
@@ -759,6 +804,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
759
804
  question
760
805
  totalVotes
761
806
  typeId
807
+ highlights {
808
+ start
809
+ end
810
+ text
811
+ part
812
+ tag
813
+ color
814
+ }
762
815
  choices {
763
816
  id
764
817
  explanation
@@ -820,6 +873,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
820
873
  path
821
874
  path512
822
875
  path256
876
+ index
823
877
  topicId
824
878
  topic {
825
879
  id
@@ -878,6 +932,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
878
932
  question
879
933
  totalVotes
880
934
  typeId
935
+ highlights {
936
+ start
937
+ end
938
+ text
939
+ part
940
+ tag
941
+ color
942
+ }
881
943
  choices {
882
944
  id
883
945
  explanation
@@ -939,6 +1001,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
939
1001
  path
940
1002
  path512
941
1003
  path256
1004
+ index
942
1005
  topicId
943
1006
  topic {
944
1007
  id
@@ -1000,6 +1063,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
1000
1063
  question
1001
1064
  totalVotes
1002
1065
  typeId
1066
+ highlights {
1067
+ start
1068
+ end
1069
+ text
1070
+ part
1071
+ tag
1072
+ color
1073
+ }
1003
1074
  choices {
1004
1075
  id
1005
1076
  explanation
@@ -1061,6 +1132,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
1061
1132
  path
1062
1133
  path512
1063
1134
  path256
1135
+ index
1064
1136
  topicId
1065
1137
  topic {
1066
1138
  id
@@ -1119,6 +1191,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
1119
1191
  question
1120
1192
  totalVotes
1121
1193
  typeId
1194
+ highlights {
1195
+ start
1196
+ end
1197
+ text
1198
+ part
1199
+ tag
1200
+ color
1201
+ }
1122
1202
  choices {
1123
1203
  id
1124
1204
  explanation
@@ -1180,6 +1260,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
1180
1260
  path
1181
1261
  path512
1182
1262
  path256
1263
+ index
1183
1264
  topicId
1184
1265
  topic {
1185
1266
  id
@@ -1326,6 +1407,14 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1326
1407
  question
1327
1408
  totalVotes
1328
1409
  typeId
1410
+ highlights {
1411
+ start
1412
+ end
1413
+ text
1414
+ part
1415
+ tag
1416
+ color
1417
+ }
1329
1418
  choices {
1330
1419
  id
1331
1420
  explanation
@@ -1387,6 +1476,7 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1387
1476
  path
1388
1477
  path512
1389
1478
  path256
1479
+ index
1390
1480
  topicId
1391
1481
  topic {
1392
1482
  id
@@ -1445,6 +1535,14 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1445
1535
  question
1446
1536
  totalVotes
1447
1537
  typeId
1538
+ highlights {
1539
+ start
1540
+ end
1541
+ text
1542
+ part
1543
+ tag
1544
+ color
1545
+ }
1448
1546
  choices {
1449
1547
  id
1450
1548
  explanation
@@ -1506,6 +1604,7 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1506
1604
  path
1507
1605
  path512
1508
1606
  path256
1607
+ index
1509
1608
  topicId
1510
1609
  topic {
1511
1610
  id
@@ -1567,6 +1666,14 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1567
1666
  question
1568
1667
  totalVotes
1569
1668
  typeId
1669
+ highlights {
1670
+ start
1671
+ end
1672
+ text
1673
+ part
1674
+ tag
1675
+ color
1676
+ }
1570
1677
  choices {
1571
1678
  id
1572
1679
  explanation
@@ -1628,6 +1735,7 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1628
1735
  path
1629
1736
  path512
1630
1737
  path256
1738
+ index
1631
1739
  topicId
1632
1740
  topic {
1633
1741
  id
@@ -1686,6 +1794,14 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1686
1794
  question
1687
1795
  totalVotes
1688
1796
  typeId
1797
+ highlights {
1798
+ start
1799
+ end
1800
+ text
1801
+ part
1802
+ tag
1803
+ color
1804
+ }
1689
1805
  choices {
1690
1806
  id
1691
1807
  explanation
@@ -1747,6 +1863,7 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1747
1863
  path
1748
1864
  path512
1749
1865
  path256
1866
+ index
1750
1867
  topicId
1751
1868
  topic {
1752
1869
  id
@@ -25,6 +25,7 @@ exports.QUES_BOOK = (0, client_1.gql) `
25
25
  path
26
26
  path512
27
27
  path256
28
+ index
28
29
  }
29
30
  }
30
31
  topicId
@@ -78,6 +78,7 @@ exports.QUESTION = (0, client_1.gql) `
78
78
  path
79
79
  path512
80
80
  path256
81
+ index
81
82
  topicId
82
83
  topic {
83
84
  id
@@ -197,6 +198,7 @@ exports.QUESTION = (0, client_1.gql) `
197
198
  path
198
199
  path512
199
200
  path256
201
+ index
200
202
  topicId
201
203
  topic {
202
204
  id
@@ -319,6 +321,7 @@ exports.QUESTION = (0, client_1.gql) `
319
321
  path
320
322
  path512
321
323
  path256
324
+ index
322
325
  topicId
323
326
  topic {
324
327
  id
@@ -438,6 +441,7 @@ exports.QUESTION = (0, client_1.gql) `
438
441
  path
439
442
  path512
440
443
  path256
444
+ index
441
445
  topicId
442
446
  topic {
443
447
  id
@@ -65,6 +65,7 @@ exports.TODO = (0, client_1.gql) `
65
65
  path
66
66
  path512
67
67
  path256
68
+ index
68
69
  }
69
70
  }
70
71
  }
@@ -27,6 +27,7 @@ exports.VIDEO = (0, client_1.gql) `
27
27
  path
28
28
  path512
29
29
  path256
30
+ index
30
31
  topicId
31
32
  }
32
33
  }
@@ -169,6 +170,7 @@ exports.VIDEOS = (0, client_1.gql) `
169
170
  path
170
171
  path512
171
172
  path256
173
+ index
172
174
  }
173
175
  }
174
176
  }
@@ -59,6 +59,7 @@ exports.SAMPLE_MARKSHEET = (0, client_1.gql) `
59
59
  path
60
60
  path512
61
61
  path256
62
+ index
62
63
  topicId
63
64
  topic {
64
65
  id
@@ -122,6 +123,7 @@ exports.SAMPLE_TODO = (0, client_1.gql) `
122
123
  path
123
124
  path512
124
125
  path256
126
+ index
125
127
  topicId
126
128
  topic {
127
129
  id
@@ -47,6 +47,7 @@ exports.SAMPLE_VIDEOS = (0, client_1.gql) `
47
47
  path
48
48
  path512
49
49
  path256
50
+ index
50
51
  topicId
51
52
  topic {
52
53
  id
@@ -83,6 +84,7 @@ exports.SAMPLE_VIDEO = (0, client_1.gql) `
83
84
  path
84
85
  path512
85
86
  path256
87
+ index
86
88
  topicId
87
89
  topic {
88
90
  id
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.lightgalleryOsceResolve = void 0;
4
- const lightgalleryRegex = /\[(lightgallery){1}[0-9]{0,}\]/;
4
+ const lightgalleryRegex = /\[lightgallery([0-9]{0,})\]/;
5
5
  function isOsceMarksheet(data) {
6
6
  return 'osceStationId' in data;
7
7
  }
@@ -55,7 +55,7 @@ const lightgalleryMutation = async (text, pictures, cache) => {
55
55
  if (pictures.length === 0) {
56
56
  return text;
57
57
  }
58
- const picturesHTML = [];
58
+ const picturesMdMap = {};
59
59
  for (const picture of pictures) {
60
60
  const pic = picture.path;
61
61
  const uri = `https://app.quesmed.com/${pic}`;
@@ -74,19 +74,32 @@ const lightgalleryMutation = async (text, pictures, cache) => {
74
74
  console.error(e);
75
75
  }
76
76
  }
77
+ let mdPic = `![${file}](${uri})`;
77
78
  if (picture.caption?.length > 0) {
78
- picturesHTML.push(`![${file}](${uri} "${picture.caption}")`);
79
+ mdPic = `![${file}](${uri} "${picture.caption}")`;
79
80
  }
80
- picturesHTML.push(`![${file}](${uri})`);
81
+ if (!picturesMdMap[picture.index]) {
82
+ picturesMdMap[picture.index] = [];
83
+ }
84
+ picturesMdMap[picture.index].push(mdPic);
81
85
  }
82
- if (lightgalleryRegex.test(text)) {
83
- picturesHTML.forEach((image, index) => {
84
- const lightgalleryTagToReplace = `[lightgallery${!index ? '' : index}]`;
85
- text = text.replace(lightgalleryTagToReplace, image);
86
- });
87
- return text;
86
+ const matches = text.matchAll(lightgalleryRegex);
87
+ let matchExists = false;
88
+ for (const match of matches) {
89
+ const index = parseInt(match[1]);
90
+ if (index === 0) {
91
+ matchExists = true;
92
+ }
93
+ if (!picturesMdMap[index]) {
94
+ // TODO: report to sentry or err that lightgallery pictures are missing
95
+ continue;
96
+ }
97
+ const mdPics = picturesMdMap[index].join(' ');
98
+ const lightgalleryTagToReplace = `[lightgallery${index > 0 ? index : ''}]`;
99
+ text = text.replace(lightgalleryTagToReplace, mdPics);
88
100
  }
89
- else {
90
- return text + '\n\n' + picturesHTML[0] + '\n';
101
+ if (!matchExists) {
102
+ return text + '\n\n' + picturesMdMap[0].join(' ') + '\n';
91
103
  }
104
+ return text;
92
105
  };
@@ -12,6 +12,7 @@ export interface IPicture {
12
12
  path256: string;
13
13
  topicId: Id;
14
14
  topic: ITopic;
15
+ index: number;
15
16
  }
16
17
  export interface ICardPicture {
17
18
  id: Id;
@@ -79,6 +79,26 @@ export interface IQuestion {
79
79
  dislikes?: number;
80
80
  isLikedByMe?: EQuestionLike;
81
81
  comments?: IQuestionComment[];
82
+ highlights?: Array<IHighlight>;
83
+ }
84
+ export interface IHighlight {
85
+ start: number;
86
+ end: number;
87
+ text: string;
88
+ color?: string;
89
+ part?: string;
90
+ tag?: string;
91
+ }
92
+ export interface IQuestionHighlights {
93
+ id: Id;
94
+ createdAt: number | Date;
95
+ updatedAt: number | Date;
96
+ deletedAt: number | Date;
97
+ userId?: Id;
98
+ questionId?: Id;
99
+ user?: IUser;
100
+ question?: IQuestion;
101
+ highlights?: Array<IHighlight>;
82
102
  }
83
103
  export interface IQuestionChoice {
84
104
  id: Id;
@@ -1,6 +1,7 @@
1
1
  import { ICard } from './Card';
2
2
  import { IConcept } from './Concept';
3
3
  import { IMarksheet, IMarksheetMark } from './Marksheet';
4
+ import { IQuestionHighlights } from './Question';
4
5
  import { INotification } from './Notification';
5
6
  import { IQuestion } from './Question';
6
7
  import { ISubscription } from './Subscription';
@@ -93,6 +94,7 @@ export interface IUser {
93
94
  qbankSubscriptionEndDate: number | Date | null;
94
95
  osceSubscriptionEndDate: number | Date | null;
95
96
  bundleSubscriptionEndDate: number | Date | null;
97
+ questionHighlights?: IQuestionHighlights[];
96
98
  }
97
99
  export declare function currentClassYear(createdAtUnix: number, classYear: IClassYear, compareUnix?: number): IClassYear;
98
100
  export declare function currentClassGroup(createdAtUnix: number, classYear: IClassYear): EClassYearGroup;
@@ -15,6 +15,7 @@ export const CHAPTER_FIELDS = gql `
15
15
  path
16
16
  path512
17
17
  path256
18
+ index
18
19
  topicId
19
20
  topic {
20
21
  id
@@ -83,6 +83,7 @@ export const MARKSHEET_MARK_FIELDS = gql `
83
83
  path
84
84
  path512
85
85
  path256
86
+ index
86
87
  topicId
87
88
  topic {
88
89
  id
@@ -9,6 +9,7 @@ export const PICTURE_FIELDS = gql `
9
9
  path
10
10
  path512
11
11
  path256
12
+ index
12
13
  topicId
13
14
  topic {
14
15
  id