@quesmed/types-rn 2.4.10 → 2.4.11

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.
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.4.10",
3
+ "version": "2.4.11",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -18,6 +18,7 @@ exports.CHAPTER_FIELDS = (0, client_1.gql) `
18
18
  path
19
19
  path512
20
20
  path256
21
+ index
21
22
  topicId
22
23
  topic {
23
24
  id
@@ -86,6 +86,7 @@ exports.MARKSHEET_MARK_FIELDS = (0, client_1.gql) `
86
86
  path
87
87
  path512
88
88
  path256
89
+ index
89
90
  topicId
90
91
  topic {
91
92
  id
@@ -12,6 +12,7 @@ exports.PICTURE_FIELDS = (0, client_1.gql) `
12
12
  path
13
13
  path512
14
14
  path256
15
+ index
15
16
  topicId
16
17
  topic {
17
18
  id
@@ -129,6 +129,7 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
129
129
  path
130
130
  path512
131
131
  path256
132
+ index
132
133
  topicId
133
134
  topic {
134
135
  id
@@ -248,6 +249,7 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
248
249
  path
249
250
  path512
250
251
  path256
252
+ index
251
253
  topicId
252
254
  topic {
253
255
  id
@@ -370,6 +372,7 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
370
372
  path
371
373
  path512
372
374
  path256
375
+ index
373
376
  topicId
374
377
  topic {
375
378
  id
@@ -489,6 +492,7 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
489
492
  path
490
493
  path512
491
494
  path256
495
+ index
492
496
  topicId
493
497
  topic {
494
498
  id
@@ -703,6 +707,7 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
703
707
  path
704
708
  path512
705
709
  path256
710
+ index
706
711
  topicId
707
712
  topic {
708
713
  id
@@ -822,6 +827,7 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
822
827
  path
823
828
  path512
824
829
  path256
830
+ index
825
831
  topicId
826
832
  topic {
827
833
  id
@@ -944,6 +950,7 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
944
950
  path
945
951
  path512
946
952
  path256
953
+ index
947
954
  topicId
948
955
  topic {
949
956
  id
@@ -1063,6 +1070,7 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
1063
1070
  path
1064
1071
  path512
1065
1072
  path256
1073
+ index
1066
1074
  topicId
1067
1075
  topic {
1068
1076
  id
@@ -1282,6 +1290,7 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
1282
1290
  path
1283
1291
  path512
1284
1292
  path256
1293
+ index
1285
1294
  topicId
1286
1295
  topic {
1287
1296
  id
@@ -1401,6 +1410,7 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
1401
1410
  path
1402
1411
  path512
1403
1412
  path256
1413
+ index
1404
1414
  topicId
1405
1415
  topic {
1406
1416
  id
@@ -1523,6 +1533,7 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
1523
1533
  path
1524
1534
  path512
1525
1535
  path256
1536
+ index
1526
1537
  topicId
1527
1538
  topic {
1528
1539
  id
@@ -1642,6 +1653,7 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
1642
1653
  path
1643
1654
  path512
1644
1655
  path256
1656
+ index
1645
1657
  topicId
1646
1658
  topic {
1647
1659
  id
@@ -135,6 +135,7 @@ exports.MARKSHEET = (0, client_1.gql) `
135
135
  path
136
136
  path512
137
137
  path256
138
+ index
138
139
  topicId
139
140
  topic {
140
141
  id
@@ -254,6 +255,7 @@ exports.MARKSHEET = (0, client_1.gql) `
254
255
  path
255
256
  path512
256
257
  path256
258
+ index
257
259
  topicId
258
260
  topic {
259
261
  id
@@ -376,6 +378,7 @@ exports.MARKSHEET = (0, client_1.gql) `
376
378
  path
377
379
  path512
378
380
  path256
381
+ index
379
382
  topicId
380
383
  topic {
381
384
  id
@@ -495,6 +498,7 @@ exports.MARKSHEET = (0, client_1.gql) `
495
498
  path
496
499
  path512
497
500
  path256
501
+ index
498
502
  topicId
499
503
  topic {
500
504
  id
@@ -698,6 +702,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
698
702
  path
699
703
  path512
700
704
  path256
705
+ index
701
706
  topicId
702
707
  topic {
703
708
  id
@@ -820,6 +825,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
820
825
  path
821
826
  path512
822
827
  path256
828
+ index
823
829
  topicId
824
830
  topic {
825
831
  id
@@ -939,6 +945,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
939
945
  path
940
946
  path512
941
947
  path256
948
+ index
942
949
  topicId
943
950
  topic {
944
951
  id
@@ -1061,6 +1068,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
1061
1068
  path
1062
1069
  path512
1063
1070
  path256
1071
+ index
1064
1072
  topicId
1065
1073
  topic {
1066
1074
  id
@@ -1180,6 +1188,7 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
1180
1188
  path
1181
1189
  path512
1182
1190
  path256
1191
+ index
1183
1192
  topicId
1184
1193
  topic {
1185
1194
  id
@@ -1387,6 +1396,7 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1387
1396
  path
1388
1397
  path512
1389
1398
  path256
1399
+ index
1390
1400
  topicId
1391
1401
  topic {
1392
1402
  id
@@ -1506,6 +1516,7 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1506
1516
  path
1507
1517
  path512
1508
1518
  path256
1519
+ index
1509
1520
  topicId
1510
1521
  topic {
1511
1522
  id
@@ -1628,6 +1639,7 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1628
1639
  path
1629
1640
  path512
1630
1641
  path256
1642
+ index
1631
1643
  topicId
1632
1644
  topic {
1633
1645
  id
@@ -1747,6 +1759,7 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1747
1759
  path
1748
1760
  path512
1749
1761
  path256
1762
+ index
1750
1763
  topicId
1751
1764
  topic {
1752
1765
  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
  };