@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
@@ -71,6 +71,14 @@ export const MARKSHEET = gql `
71
71
  question
72
72
  totalVotes
73
73
  typeId
74
+ highlights {
75
+ start
76
+ end
77
+ text
78
+ part
79
+ tag
80
+ color
81
+ }
74
82
  choices {
75
83
  id
76
84
  explanation
@@ -132,6 +140,7 @@ export const MARKSHEET = gql `
132
140
  path
133
141
  path512
134
142
  path256
143
+ index
135
144
  topicId
136
145
  topic {
137
146
  id
@@ -190,6 +199,14 @@ export const MARKSHEET = gql `
190
199
  question
191
200
  totalVotes
192
201
  typeId
202
+ highlights {
203
+ start
204
+ end
205
+ text
206
+ part
207
+ tag
208
+ color
209
+ }
193
210
  choices {
194
211
  id
195
212
  explanation
@@ -251,6 +268,7 @@ export const MARKSHEET = gql `
251
268
  path
252
269
  path512
253
270
  path256
271
+ index
254
272
  topicId
255
273
  topic {
256
274
  id
@@ -312,6 +330,14 @@ export const MARKSHEET = gql `
312
330
  question
313
331
  totalVotes
314
332
  typeId
333
+ highlights {
334
+ start
335
+ end
336
+ text
337
+ part
338
+ tag
339
+ color
340
+ }
315
341
  choices {
316
342
  id
317
343
  explanation
@@ -373,6 +399,7 @@ export const MARKSHEET = gql `
373
399
  path
374
400
  path512
375
401
  path256
402
+ index
376
403
  topicId
377
404
  topic {
378
405
  id
@@ -431,6 +458,14 @@ export const MARKSHEET = gql `
431
458
  question
432
459
  totalVotes
433
460
  typeId
461
+ highlights {
462
+ start
463
+ end
464
+ text
465
+ part
466
+ tag
467
+ color
468
+ }
434
469
  choices {
435
470
  id
436
471
  explanation
@@ -492,6 +527,7 @@ export const MARKSHEET = gql `
492
527
  path
493
528
  path512
494
529
  path256
530
+ index
495
531
  topicId
496
532
  topic {
497
533
  id
@@ -630,6 +666,14 @@ export const FLAGGED_QUESTIONS = gql `
630
666
  question
631
667
  totalVotes
632
668
  typeId
669
+ highlights {
670
+ start
671
+ end
672
+ text
673
+ part
674
+ tag
675
+ color
676
+ }
633
677
  choices {
634
678
  id
635
679
  explanation
@@ -695,6 +739,7 @@ export const FLAGGED_QUESTIONS = gql `
695
739
  path
696
740
  path512
697
741
  path256
742
+ index
698
743
  topicId
699
744
  topic {
700
745
  id
@@ -756,6 +801,14 @@ export const FLAGGED_QUESTIONS = gql `
756
801
  question
757
802
  totalVotes
758
803
  typeId
804
+ highlights {
805
+ start
806
+ end
807
+ text
808
+ part
809
+ tag
810
+ color
811
+ }
759
812
  choices {
760
813
  id
761
814
  explanation
@@ -817,6 +870,7 @@ export const FLAGGED_QUESTIONS = gql `
817
870
  path
818
871
  path512
819
872
  path256
873
+ index
820
874
  topicId
821
875
  topic {
822
876
  id
@@ -875,6 +929,14 @@ export const FLAGGED_QUESTIONS = gql `
875
929
  question
876
930
  totalVotes
877
931
  typeId
932
+ highlights {
933
+ start
934
+ end
935
+ text
936
+ part
937
+ tag
938
+ color
939
+ }
878
940
  choices {
879
941
  id
880
942
  explanation
@@ -936,6 +998,7 @@ export const FLAGGED_QUESTIONS = gql `
936
998
  path
937
999
  path512
938
1000
  path256
1001
+ index
939
1002
  topicId
940
1003
  topic {
941
1004
  id
@@ -997,6 +1060,14 @@ export const FLAGGED_QUESTIONS = gql `
997
1060
  question
998
1061
  totalVotes
999
1062
  typeId
1063
+ highlights {
1064
+ start
1065
+ end
1066
+ text
1067
+ part
1068
+ tag
1069
+ color
1070
+ }
1000
1071
  choices {
1001
1072
  id
1002
1073
  explanation
@@ -1058,6 +1129,7 @@ export const FLAGGED_QUESTIONS = gql `
1058
1129
  path
1059
1130
  path512
1060
1131
  path256
1132
+ index
1061
1133
  topicId
1062
1134
  topic {
1063
1135
  id
@@ -1116,6 +1188,14 @@ export const FLAGGED_QUESTIONS = gql `
1116
1188
  question
1117
1189
  totalVotes
1118
1190
  typeId
1191
+ highlights {
1192
+ start
1193
+ end
1194
+ text
1195
+ part
1196
+ tag
1197
+ color
1198
+ }
1119
1199
  choices {
1120
1200
  id
1121
1201
  explanation
@@ -1177,6 +1257,7 @@ export const FLAGGED_QUESTIONS = gql `
1177
1257
  path
1178
1258
  path512
1179
1259
  path256
1260
+ index
1180
1261
  topicId
1181
1262
  topic {
1182
1263
  id
@@ -1323,6 +1404,14 @@ export const FLAGGED_QUESTIONS_MARKSHEET = gql `
1323
1404
  question
1324
1405
  totalVotes
1325
1406
  typeId
1407
+ highlights {
1408
+ start
1409
+ end
1410
+ text
1411
+ part
1412
+ tag
1413
+ color
1414
+ }
1326
1415
  choices {
1327
1416
  id
1328
1417
  explanation
@@ -1384,6 +1473,7 @@ export const FLAGGED_QUESTIONS_MARKSHEET = gql `
1384
1473
  path
1385
1474
  path512
1386
1475
  path256
1476
+ index
1387
1477
  topicId
1388
1478
  topic {
1389
1479
  id
@@ -1442,6 +1532,14 @@ export const FLAGGED_QUESTIONS_MARKSHEET = gql `
1442
1532
  question
1443
1533
  totalVotes
1444
1534
  typeId
1535
+ highlights {
1536
+ start
1537
+ end
1538
+ text
1539
+ part
1540
+ tag
1541
+ color
1542
+ }
1445
1543
  choices {
1446
1544
  id
1447
1545
  explanation
@@ -1503,6 +1601,7 @@ export const FLAGGED_QUESTIONS_MARKSHEET = gql `
1503
1601
  path
1504
1602
  path512
1505
1603
  path256
1604
+ index
1506
1605
  topicId
1507
1606
  topic {
1508
1607
  id
@@ -1564,6 +1663,14 @@ export const FLAGGED_QUESTIONS_MARKSHEET = gql `
1564
1663
  question
1565
1664
  totalVotes
1566
1665
  typeId
1666
+ highlights {
1667
+ start
1668
+ end
1669
+ text
1670
+ part
1671
+ tag
1672
+ color
1673
+ }
1567
1674
  choices {
1568
1675
  id
1569
1676
  explanation
@@ -1625,6 +1732,7 @@ export const FLAGGED_QUESTIONS_MARKSHEET = gql `
1625
1732
  path
1626
1733
  path512
1627
1734
  path256
1735
+ index
1628
1736
  topicId
1629
1737
  topic {
1630
1738
  id
@@ -1683,6 +1791,14 @@ export const FLAGGED_QUESTIONS_MARKSHEET = gql `
1683
1791
  question
1684
1792
  totalVotes
1685
1793
  typeId
1794
+ highlights {
1795
+ start
1796
+ end
1797
+ text
1798
+ part
1799
+ tag
1800
+ color
1801
+ }
1686
1802
  choices {
1687
1803
  id
1688
1804
  explanation
@@ -1744,6 +1860,7 @@ export const FLAGGED_QUESTIONS_MARKSHEET = gql `
1744
1860
  path
1745
1861
  path512
1746
1862
  path256
1863
+ index
1747
1864
  topicId
1748
1865
  topic {
1749
1866
  id
@@ -22,6 +22,7 @@ export const QUES_BOOK = gql `
22
22
  path
23
23
  path512
24
24
  path256
25
+ index
25
26
  }
26
27
  }
27
28
  topicId
@@ -75,6 +75,7 @@ export const QUESTION = gql `
75
75
  path
76
76
  path512
77
77
  path256
78
+ index
78
79
  topicId
79
80
  topic {
80
81
  id
@@ -194,6 +195,7 @@ export const QUESTION = gql `
194
195
  path
195
196
  path512
196
197
  path256
198
+ index
197
199
  topicId
198
200
  topic {
199
201
  id
@@ -316,6 +318,7 @@ export const QUESTION = gql `
316
318
  path
317
319
  path512
318
320
  path256
321
+ index
319
322
  topicId
320
323
  topic {
321
324
  id
@@ -435,6 +438,7 @@ export const QUESTION = gql `
435
438
  path
436
439
  path512
437
440
  path256
441
+ index
438
442
  topicId
439
443
  topic {
440
444
  id
@@ -62,6 +62,7 @@ export const TODO = gql `
62
62
  path
63
63
  path512
64
64
  path256
65
+ index
65
66
  }
66
67
  }
67
68
  }
@@ -24,6 +24,7 @@ export const VIDEO = gql `
24
24
  path
25
25
  path512
26
26
  path256
27
+ index
27
28
  topicId
28
29
  }
29
30
  }
@@ -166,6 +167,7 @@ export const VIDEOS = gql `
166
167
  path
167
168
  path512
168
169
  path256
170
+ index
169
171
  }
170
172
  }
171
173
  }
@@ -56,6 +56,7 @@ export const SAMPLE_MARKSHEET = gql `
56
56
  path
57
57
  path512
58
58
  path256
59
+ index
59
60
  topicId
60
61
  topic {
61
62
  id
@@ -119,6 +120,7 @@ export const SAMPLE_TODO = gql `
119
120
  path
120
121
  path512
121
122
  path256
123
+ index
122
124
  topicId
123
125
  topic {
124
126
  id
@@ -44,6 +44,7 @@ export const SAMPLE_VIDEOS = gql `
44
44
  path
45
45
  path512
46
46
  path256
47
+ index
47
48
  topicId
48
49
  topic {
49
50
  id
@@ -80,6 +81,7 @@ export const SAMPLE_VIDEO = gql `
80
81
  path
81
82
  path512
82
83
  path256
84
+ index
83
85
  topicId
84
86
  topic {
85
87
  id
@@ -1,4 +1,4 @@
1
- const lightgalleryRegex = /\[(lightgallery){1}[0-9]{0,}\]/;
1
+ const lightgalleryRegex = /\[lightgallery([0-9]{0,})\]/;
2
2
  function isOsceMarksheet(data) {
3
3
  return 'osceStationId' in data;
4
4
  }
@@ -51,7 +51,7 @@ const lightgalleryMutation = async (text, pictures, cache) => {
51
51
  if (pictures.length === 0) {
52
52
  return text;
53
53
  }
54
- const picturesHTML = [];
54
+ const picturesMdMap = {};
55
55
  for (const picture of pictures) {
56
56
  const pic = picture.path;
57
57
  const uri = `https://app.quesmed.com/${pic}`;
@@ -70,19 +70,32 @@ const lightgalleryMutation = async (text, pictures, cache) => {
70
70
  console.error(e);
71
71
  }
72
72
  }
73
+ let mdPic = `![${file}](${uri})`;
73
74
  if (picture.caption?.length > 0) {
74
- picturesHTML.push(`![${file}](${uri} "${picture.caption}")`);
75
+ mdPic = `![${file}](${uri} "${picture.caption}")`;
75
76
  }
76
- picturesHTML.push(`![${file}](${uri})`);
77
+ if (!picturesMdMap[picture.index]) {
78
+ picturesMdMap[picture.index] = [];
79
+ }
80
+ picturesMdMap[picture.index].push(mdPic);
77
81
  }
78
- if (lightgalleryRegex.test(text)) {
79
- picturesHTML.forEach((image, index) => {
80
- const lightgalleryTagToReplace = `[lightgallery${!index ? '' : index}]`;
81
- text = text.replace(lightgalleryTagToReplace, image);
82
- });
83
- return text;
82
+ const matches = text.matchAll(lightgalleryRegex);
83
+ let matchExists = false;
84
+ for (const match of matches) {
85
+ const index = parseInt(match[1]);
86
+ if (index === 0) {
87
+ matchExists = true;
88
+ }
89
+ if (!picturesMdMap[index]) {
90
+ // TODO: report to sentry or err that lightgallery pictures are missing
91
+ continue;
92
+ }
93
+ const mdPics = picturesMdMap[index].join(' ');
94
+ const lightgalleryTagToReplace = `[lightgallery${index > 0 ? index : ''}]`;
95
+ text = text.replace(lightgalleryTagToReplace, mdPics);
84
96
  }
85
- else {
86
- return text + '\n\n' + picturesHTML[0] + '\n';
97
+ if (!matchExists) {
98
+ return text + '\n\n' + picturesMdMap[0].join(' ') + '\n';
87
99
  }
100
+ return text;
88
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.4.10",
3
+ "version": "2.4.12",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",