@quesmed/types 2.6.200 → 2.6.202

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.
@@ -70,7 +70,7 @@ export type IUpsertUserConceptStatusVar = {
70
70
  };
71
71
  export type IUpsertUserConceptStatusData = RestrictedData<graphqlNormalize & IUserConceptStatus[], 'upsertUserConceptStatus'>;
72
72
  export declare const UPSERT_USER_CONCEPT_STATUS: import("@apollo/client").DocumentNode;
73
- export declare const updateCacheOnConceptLearningStatusUpdate: (topicId: number, prevStatus?: EUserLearningStatus | null) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserConceptStatusData>, options: ApolloUpdateOptions) => void;
73
+ export declare const updateCacheOnConceptLearningStatusUpdate: (topicId: number, prevStatus?: EUserLearningStatus | null, entitlement?: number) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserConceptStatusData>, options: ApolloUpdateOptions) => void;
74
74
  export declare const optimisticConceptLearningStatus: (id: number, conceptIds: number[], userId: number, status: EUserLearningStatus) => IUpsertUserConceptStatusData;
75
75
  export type IUpsertUserStationStatusVar = {
76
76
  osceStationIds: Id[];
@@ -86,5 +86,5 @@ export type IUpsertUserVideoStatusVar = {
86
86
  };
87
87
  export type IUpsertUserVideoStatusData = RestrictedData<graphqlNormalize & IUserVideoStatus[], 'upsertUserVideoStatus'>;
88
88
  export declare const UPSERT_USER_VIDEO_STATUS: import("@apollo/client").DocumentNode;
89
- export declare const updateCacheOnVideoLearningStatusUpdate: (prevStatus?: EUserLearningStatus | null) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserVideoStatusData>, options: ApolloUpdateOptions) => void;
89
+ export declare const updateCacheOnVideoLearningStatusUpdate: (prevStatus?: EUserLearningStatus | null, entitlement?: number) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserVideoStatusData>, options: ApolloUpdateOptions) => void;
90
90
  export declare const optimisticVideoLearningStatus: (id: number, videoIds: number[], userId: number, status: EUserLearningStatus) => IUpsertUserVideoStatusData;
@@ -202,7 +202,7 @@ const getConceptUpdatedFieldNames = (newStatus, prevStatus) => [
202
202
  getConceptStatsFieldName(prevStatus),
203
203
  getConceptStatsFieldName(newStatus),
204
204
  ];
205
- const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus) => (cache, result, options) => {
205
+ const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus, entitlement) => (cache, result, options) => {
206
206
  const { upsertUserConceptStatus } = result?.data?.restricted || {};
207
207
  const { variables } = options || {};
208
208
  if (!variables || !upsertUserConceptStatus) {
@@ -212,17 +212,24 @@ const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus) => (cache
212
212
  conceptIds.forEach((id) => {
213
213
  cache.writeFragment({
214
214
  id: cache.identify({ id, __typename: 'Concept' }),
215
- data: {
216
- status,
217
- },
215
+ data: { status },
218
216
  fragment: STATUS_CONCEPT_FRAGMENT,
219
217
  });
220
218
  });
221
- const prevData = cache.readFragment({
222
- id: cache.identify({
223
- id: topicId,
224
- __typename: 'Topic',
219
+ const topicFragmentId = cache.identify({
220
+ id: topicId.toString(),
221
+ ...(entitlement && {
222
+ entitlement: {
223
+ __ref: cache.identify({
224
+ id: entitlement,
225
+ __typename: 'Entitlement',
226
+ }),
227
+ },
225
228
  }),
229
+ __typename: 'Topic',
230
+ });
231
+ const prevData = cache.readFragment({
232
+ id: topicFragmentId,
226
233
  fragment: TOPIC_CONCEPT_STATUS_STATS_FRAGMENT,
227
234
  });
228
235
  if (prevData) {
@@ -238,7 +245,7 @@ const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus) => (cache
238
245
  (prevData[prevStatName] || 0) - conceptIds.length;
239
246
  }
240
247
  cache.writeFragment({
241
- id: cache.identify({ id: topicId, __typename: 'Topic' }),
248
+ id: topicFragmentId,
242
249
  data: {
243
250
  ...newData,
244
251
  },
@@ -376,7 +383,7 @@ const getVideoUpdatedFieldNames = (newStatus, prevStatus) => [
376
383
  getVideoStatsFieldName(prevStatus),
377
384
  getVideoStatsFieldName(newStatus),
378
385
  ];
379
- const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, result, options) => {
386
+ const updateCacheOnVideoLearningStatusUpdate = (prevStatus, entitlement) => (cache, result, options) => {
380
387
  const { upsertUserVideoStatus } = result?.data?.restricted || {};
381
388
  const { variables } = options || {};
382
389
  if (!variables || !upsertUserVideoStatus) {
@@ -386,9 +393,7 @@ const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, result, o
386
393
  videoIds.forEach((id) => {
387
394
  cache.writeFragment({
388
395
  id: cache.identify({ id, __typename: 'Video' }),
389
- data: {
390
- status,
391
- },
396
+ data: { status },
392
397
  fragment: VIDEO_STATUS_FRAGMENT,
393
398
  });
394
399
  });
@@ -405,11 +410,20 @@ const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, result, o
405
410
  return;
406
411
  }
407
412
  [...topicIds].forEach((topicId) => {
408
- const prevData = cache.readFragment({
409
- id: cache.identify({
410
- id: topicId,
411
- __typename: 'Topic',
413
+ const topicFragmentId = cache.identify({
414
+ id: topicId.toString(),
415
+ ...(entitlement && {
416
+ entitlement: {
417
+ __ref: cache.identify({
418
+ id: entitlement,
419
+ __typename: 'Entitlement',
420
+ }),
421
+ },
412
422
  }),
423
+ __typename: 'Topic',
424
+ });
425
+ const prevData = cache.readFragment({
426
+ id: topicFragmentId,
413
427
  fragment: TOPIC_VIDEO_STATUS_STATS_FRAGMENT,
414
428
  });
415
429
  if (prevData) {
@@ -425,7 +439,7 @@ const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, result, o
425
439
  (prevData[prevStatName] || 0) - videoIds.length;
426
440
  }
427
441
  cache.writeFragment({
428
- id: cache.identify({ id: topicId, __typename: 'Topic' }),
442
+ id: topicFragmentId,
429
443
  data: {
430
444
  ...newData,
431
445
  },
@@ -134,8 +134,7 @@ exports.DASHBOARD_QBANK = (0, client_1.gql) `
134
134
  }
135
135
  `;
136
136
  exports.DASHBOARD = (0, client_1.gql) `
137
- ${fragments_1.PICTURE_FIELDS}
138
- query Dashboard($filter: MarksheetFilterInput!, $order: Int) {
137
+ query Dashboard {
139
138
  restricted {
140
139
  latestPastMarksheetId
141
140
  latestSessionId
@@ -149,99 +148,6 @@ exports.DASHBOARD = (0, client_1.gql) `
149
148
  }
150
149
  universityId
151
150
  classYear
152
- completedQuestionsCount
153
- completedCorrectQuestionsCount
154
- completedIncorrectQuestionsCount
155
- completedCards {
156
- id
157
- createdAt
158
- updatedAt
159
- concept {
160
- id
161
- name
162
- }
163
- lastSeen
164
- reviewDate
165
- score
166
- iteration
167
- optimalFactor
168
- cardId
169
- card {
170
- id
171
- conceptId
172
- concept {
173
- id
174
- name
175
- }
176
- topic {
177
- id
178
- name
179
- }
180
- question
181
- explanation
182
- pictures {
183
- ...PictureFields
184
- }
185
- }
186
- }
187
- completedCardsCount
188
- completedGreenCardsCount
189
- completedYellowCardsCount
190
- completedRedCardsCount
191
- marksheetsCount
192
- dailyProgress {
193
- date
194
- dateString
195
- intensity
196
- totalCorrect
197
- totalCount
198
- }
199
- userProgress {
200
- marksheetCount
201
- questionsCount
202
- daysInCurrentStreak
203
- daysInPreviousStreak
204
- daysInLongestStreak
205
- }
206
- }
207
- totalQuestions
208
- totalCards
209
- marksheets(filter: $filter) {
210
- results {
211
- id
212
- topicNames
213
- correct
214
- incorrect
215
- totalQuestions
216
- isTestMarksheet
217
- }
218
- total
219
- }
220
- topics(filter: 0, order: $order) {
221
- id
222
- name
223
- entitlement {
224
- id
225
- name
226
- index
227
- }
228
- totalQuestions
229
- correctQuestions
230
- incorrectQuestions
231
- totalCards
232
- greenCards
233
- yellowCards
234
- redCards
235
- dailyFeedCards
236
- }
237
- universityLeaderboard(limit: 3) {
238
- updatedAt
239
- month {
240
- id
241
- name
242
- speciality
243
- rank
244
- }
245
151
  }
246
152
  }
247
153
  }
@@ -70,7 +70,7 @@ export type IUpsertUserConceptStatusVar = {
70
70
  };
71
71
  export type IUpsertUserConceptStatusData = RestrictedData<graphqlNormalize & IUserConceptStatus[], 'upsertUserConceptStatus'>;
72
72
  export declare const UPSERT_USER_CONCEPT_STATUS: import("@apollo/client").DocumentNode;
73
- export declare const updateCacheOnConceptLearningStatusUpdate: (topicId: number, prevStatus?: EUserLearningStatus | null) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserConceptStatusData>, options: ApolloUpdateOptions) => void;
73
+ export declare const updateCacheOnConceptLearningStatusUpdate: (topicId: number, prevStatus?: EUserLearningStatus | null, entitlement?: number) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserConceptStatusData>, options: ApolloUpdateOptions) => void;
74
74
  export declare const optimisticConceptLearningStatus: (id: number, conceptIds: number[], userId: number, status: EUserLearningStatus) => IUpsertUserConceptStatusData;
75
75
  export type IUpsertUserStationStatusVar = {
76
76
  osceStationIds: Id[];
@@ -86,5 +86,5 @@ export type IUpsertUserVideoStatusVar = {
86
86
  };
87
87
  export type IUpsertUserVideoStatusData = RestrictedData<graphqlNormalize & IUserVideoStatus[], 'upsertUserVideoStatus'>;
88
88
  export declare const UPSERT_USER_VIDEO_STATUS: import("@apollo/client").DocumentNode;
89
- export declare const updateCacheOnVideoLearningStatusUpdate: (prevStatus?: EUserLearningStatus | null) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserVideoStatusData>, options: ApolloUpdateOptions) => void;
89
+ export declare const updateCacheOnVideoLearningStatusUpdate: (prevStatus?: EUserLearningStatus | null, entitlement?: number) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserVideoStatusData>, options: ApolloUpdateOptions) => void;
90
90
  export declare const optimisticVideoLearningStatus: (id: number, videoIds: number[], userId: number, status: EUserLearningStatus) => IUpsertUserVideoStatusData;
@@ -196,7 +196,7 @@ const getConceptUpdatedFieldNames = (newStatus, prevStatus) => [
196
196
  getConceptStatsFieldName(prevStatus),
197
197
  getConceptStatsFieldName(newStatus),
198
198
  ];
199
- export const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus) => (cache, result, options) => {
199
+ export const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus, entitlement) => (cache, result, options) => {
200
200
  const { upsertUserConceptStatus } = result?.data?.restricted || {};
201
201
  const { variables } = options || {};
202
202
  if (!variables || !upsertUserConceptStatus) {
@@ -206,17 +206,24 @@ export const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus) =>
206
206
  conceptIds.forEach((id) => {
207
207
  cache.writeFragment({
208
208
  id: cache.identify({ id, __typename: 'Concept' }),
209
- data: {
210
- status,
211
- },
209
+ data: { status },
212
210
  fragment: STATUS_CONCEPT_FRAGMENT,
213
211
  });
214
212
  });
215
- const prevData = cache.readFragment({
216
- id: cache.identify({
217
- id: topicId,
218
- __typename: 'Topic',
213
+ const topicFragmentId = cache.identify({
214
+ id: topicId.toString(),
215
+ ...(entitlement && {
216
+ entitlement: {
217
+ __ref: cache.identify({
218
+ id: entitlement,
219
+ __typename: 'Entitlement',
220
+ }),
221
+ },
219
222
  }),
223
+ __typename: 'Topic',
224
+ });
225
+ const prevData = cache.readFragment({
226
+ id: topicFragmentId,
220
227
  fragment: TOPIC_CONCEPT_STATUS_STATS_FRAGMENT,
221
228
  });
222
229
  if (prevData) {
@@ -232,7 +239,7 @@ export const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus) =>
232
239
  (prevData[prevStatName] || 0) - conceptIds.length;
233
240
  }
234
241
  cache.writeFragment({
235
- id: cache.identify({ id: topicId, __typename: 'Topic' }),
242
+ id: topicFragmentId,
236
243
  data: {
237
244
  ...newData,
238
245
  },
@@ -366,7 +373,7 @@ const getVideoUpdatedFieldNames = (newStatus, prevStatus) => [
366
373
  getVideoStatsFieldName(prevStatus),
367
374
  getVideoStatsFieldName(newStatus),
368
375
  ];
369
- export const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, result, options) => {
376
+ export const updateCacheOnVideoLearningStatusUpdate = (prevStatus, entitlement) => (cache, result, options) => {
370
377
  const { upsertUserVideoStatus } = result?.data?.restricted || {};
371
378
  const { variables } = options || {};
372
379
  if (!variables || !upsertUserVideoStatus) {
@@ -376,9 +383,7 @@ export const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, re
376
383
  videoIds.forEach((id) => {
377
384
  cache.writeFragment({
378
385
  id: cache.identify({ id, __typename: 'Video' }),
379
- data: {
380
- status,
381
- },
386
+ data: { status },
382
387
  fragment: VIDEO_STATUS_FRAGMENT,
383
388
  });
384
389
  });
@@ -395,11 +400,20 @@ export const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, re
395
400
  return;
396
401
  }
397
402
  [...topicIds].forEach((topicId) => {
398
- const prevData = cache.readFragment({
399
- id: cache.identify({
400
- id: topicId,
401
- __typename: 'Topic',
403
+ const topicFragmentId = cache.identify({
404
+ id: topicId.toString(),
405
+ ...(entitlement && {
406
+ entitlement: {
407
+ __ref: cache.identify({
408
+ id: entitlement,
409
+ __typename: 'Entitlement',
410
+ }),
411
+ },
402
412
  }),
413
+ __typename: 'Topic',
414
+ });
415
+ const prevData = cache.readFragment({
416
+ id: topicFragmentId,
403
417
  fragment: TOPIC_VIDEO_STATUS_STATS_FRAGMENT,
404
418
  });
405
419
  if (prevData) {
@@ -415,7 +429,7 @@ export const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, re
415
429
  (prevData[prevStatName] || 0) - videoIds.length;
416
430
  }
417
431
  cache.writeFragment({
418
- id: cache.identify({ id: topicId, __typename: 'Topic' }),
432
+ id: topicFragmentId,
419
433
  data: {
420
434
  ...newData,
421
435
  },
@@ -131,8 +131,7 @@ export const DASHBOARD_QBANK = gql `
131
131
  }
132
132
  `;
133
133
  export const DASHBOARD = gql `
134
- ${PICTURE_FIELDS}
135
- query Dashboard($filter: MarksheetFilterInput!, $order: Int) {
134
+ query Dashboard {
136
135
  restricted {
137
136
  latestPastMarksheetId
138
137
  latestSessionId
@@ -146,99 +145,6 @@ export const DASHBOARD = gql `
146
145
  }
147
146
  universityId
148
147
  classYear
149
- completedQuestionsCount
150
- completedCorrectQuestionsCount
151
- completedIncorrectQuestionsCount
152
- completedCards {
153
- id
154
- createdAt
155
- updatedAt
156
- concept {
157
- id
158
- name
159
- }
160
- lastSeen
161
- reviewDate
162
- score
163
- iteration
164
- optimalFactor
165
- cardId
166
- card {
167
- id
168
- conceptId
169
- concept {
170
- id
171
- name
172
- }
173
- topic {
174
- id
175
- name
176
- }
177
- question
178
- explanation
179
- pictures {
180
- ...PictureFields
181
- }
182
- }
183
- }
184
- completedCardsCount
185
- completedGreenCardsCount
186
- completedYellowCardsCount
187
- completedRedCardsCount
188
- marksheetsCount
189
- dailyProgress {
190
- date
191
- dateString
192
- intensity
193
- totalCorrect
194
- totalCount
195
- }
196
- userProgress {
197
- marksheetCount
198
- questionsCount
199
- daysInCurrentStreak
200
- daysInPreviousStreak
201
- daysInLongestStreak
202
- }
203
- }
204
- totalQuestions
205
- totalCards
206
- marksheets(filter: $filter) {
207
- results {
208
- id
209
- topicNames
210
- correct
211
- incorrect
212
- totalQuestions
213
- isTestMarksheet
214
- }
215
- total
216
- }
217
- topics(filter: 0, order: $order) {
218
- id
219
- name
220
- entitlement {
221
- id
222
- name
223
- index
224
- }
225
- totalQuestions
226
- correctQuestions
227
- incorrectQuestions
228
- totalCards
229
- greenCards
230
- yellowCards
231
- redCards
232
- dailyFeedCards
233
- }
234
- universityLeaderboard(limit: 3) {
235
- updatedAt
236
- month {
237
- id
238
- name
239
- speciality
240
- rank
241
- }
242
148
  }
243
149
  }
244
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.200",
3
+ "version": "2.6.202",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",