@quesmed/types 2.6.53 → 2.6.55

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.
@@ -23,11 +23,13 @@ const updateCacheOnUpsertChapterNote = (cache, result, options) => {
23
23
  if (!variables || !upsertChapterNote) {
24
24
  return;
25
25
  }
26
- const { id, ...updatedData } = upsertChapterNote;
27
26
  cache.writeFragment({
28
- id: cache.identify({ id, __typename: 'UserChapterNote' }),
27
+ id: cache.identify({
28
+ id: variables.chapterId,
29
+ __typename: 'Chapter',
30
+ }),
29
31
  data: {
30
- ...updatedData,
32
+ userNote: upsertChapterNote,
31
33
  },
32
34
  fragment: fragments_1.UPSERT_CHAPTER_NOTE_FRAGMENT,
33
35
  });
@@ -53,6 +53,7 @@ export type IQuestionCommentRemoveData = RestrictedData<graphqlNormalize & IQues
53
53
  * addQuestionHighlight
54
54
  */
55
55
  export interface IAddQuestionHighlightVar {
56
+ marksheetId?: number;
56
57
  input: {
57
58
  questionId: Id;
58
59
  highlights: IHighlight[];
@@ -60,5 +61,5 @@ export interface IAddQuestionHighlightVar {
60
61
  }
61
62
  export type IAddQuestionHighlightData = RestrictedData<(graphqlNormalize & IQuestionHighlights)[], 'addQuestionHighlight'>;
62
63
  export declare const ADD_QUESTION_HIGHLIGHT: import("@apollo/client").DocumentNode;
63
- export declare const updateQuestionHighlights: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddQuestionHighlightData>, options: ApolloUpdateOptions) => void;
64
+ export declare const updateQuestionHighlights: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddQuestionHighlightData>, options: ApolloUpdateOptions<IAddQuestionHighlightVar>) => void;
64
65
  export {};
@@ -336,9 +336,12 @@ const optimisticQuestionCommentRemove = (comments, input, parentId) => {
336
336
  };
337
337
  exports.optimisticQuestionCommentRemove = optimisticQuestionCommentRemove;
338
338
  exports.ADD_QUESTION_HIGHLIGHT = (0, client_1.gql) `
339
- mutation AddHighlight($input: [AddQuestionHighlightInput!]!) {
339
+ mutation AddHighlight(
340
+ $input: [AddQuestionHighlightInput!]!
341
+ $marksheetId: Int
342
+ ) {
340
343
  restricted {
341
- addQuestionHighlight(input: $input) {
344
+ addQuestionHighlight(input: $input, marksheetId: $marksheetId) {
342
345
  id
343
346
  questionId
344
347
  userId
@@ -360,20 +363,19 @@ const updateQuestionHighlights = (typeId) => (cache, result, options) => {
360
363
  if (!variables || !addQuestionHighlight) {
361
364
  return;
362
365
  }
363
- const { input } = variables;
364
366
  try {
365
- input.forEach(({ questionId }) => {
367
+ for (const { questionId, highlights } of variables.input) {
366
368
  cache.writeFragment({
367
369
  id: cache.identify({
368
370
  id: questionId,
369
371
  __typename: (0, exports.getQuestionTypeName)(typeId),
370
372
  }),
371
373
  data: {
372
- highlights: addQuestionHighlight[0].highlights,
374
+ highlights,
373
375
  },
374
376
  fragment: fragments_1.QUESTION_WITH_HIGHLIGHT_FIELDS,
375
377
  });
376
- });
378
+ }
377
379
  }
378
380
  catch (error) {
379
381
  console.error(error);
@@ -20,11 +20,13 @@ export const updateCacheOnUpsertChapterNote = (cache, result, options) => {
20
20
  if (!variables || !upsertChapterNote) {
21
21
  return;
22
22
  }
23
- const { id, ...updatedData } = upsertChapterNote;
24
23
  cache.writeFragment({
25
- id: cache.identify({ id, __typename: 'UserChapterNote' }),
24
+ id: cache.identify({
25
+ id: variables.chapterId,
26
+ __typename: 'Chapter',
27
+ }),
26
28
  data: {
27
- ...updatedData,
29
+ userNote: upsertChapterNote,
28
30
  },
29
31
  fragment: UPSERT_CHAPTER_NOTE_FRAGMENT,
30
32
  });
@@ -53,6 +53,7 @@ export type IQuestionCommentRemoveData = RestrictedData<graphqlNormalize & IQues
53
53
  * addQuestionHighlight
54
54
  */
55
55
  export interface IAddQuestionHighlightVar {
56
+ marksheetId?: number;
56
57
  input: {
57
58
  questionId: Id;
58
59
  highlights: IHighlight[];
@@ -60,5 +61,5 @@ export interface IAddQuestionHighlightVar {
60
61
  }
61
62
  export type IAddQuestionHighlightData = RestrictedData<(graphqlNormalize & IQuestionHighlights)[], 'addQuestionHighlight'>;
62
63
  export declare const ADD_QUESTION_HIGHLIGHT: import("@apollo/client").DocumentNode;
63
- export declare const updateQuestionHighlights: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddQuestionHighlightData>, options: ApolloUpdateOptions) => void;
64
+ export declare const updateQuestionHighlights: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddQuestionHighlightData>, options: ApolloUpdateOptions<IAddQuestionHighlightVar>) => void;
64
65
  export {};
@@ -325,9 +325,12 @@ export const optimisticQuestionCommentRemove = (comments, input, parentId) => {
325
325
  };
326
326
  };
327
327
  export const ADD_QUESTION_HIGHLIGHT = gql `
328
- mutation AddHighlight($input: [AddQuestionHighlightInput!]!) {
328
+ mutation AddHighlight(
329
+ $input: [AddQuestionHighlightInput!]!
330
+ $marksheetId: Int
331
+ ) {
329
332
  restricted {
330
- addQuestionHighlight(input: $input) {
333
+ addQuestionHighlight(input: $input, marksheetId: $marksheetId) {
331
334
  id
332
335
  questionId
333
336
  userId
@@ -349,20 +352,19 @@ export const updateQuestionHighlights = (typeId) => (cache, result, options) =>
349
352
  if (!variables || !addQuestionHighlight) {
350
353
  return;
351
354
  }
352
- const { input } = variables;
353
355
  try {
354
- input.forEach(({ questionId }) => {
356
+ for (const { questionId, highlights } of variables.input) {
355
357
  cache.writeFragment({
356
358
  id: cache.identify({
357
359
  id: questionId,
358
360
  __typename: getQuestionTypeName(typeId),
359
361
  }),
360
362
  data: {
361
- highlights: addQuestionHighlight[0].highlights,
363
+ highlights,
362
364
  },
363
365
  fragment: QUESTION_WITH_HIGHLIGHT_FIELDS,
364
366
  });
365
- });
367
+ }
366
368
  }
367
369
  catch (error) {
368
370
  console.error(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.53",
3
+ "version": "2.6.55",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",