@quesmed/types 2.6.100 → 2.6.101

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.
@@ -1,6 +1,6 @@
1
1
  import { IChapter } from './Chapter';
2
+ import { IUserConceptChapter, IUserConceptNote } from './Note';
2
3
  import { EEntitlementType, IEntitlement } from './Product';
3
- import { IUserConceptNote } from './Note';
4
4
  import { ITopic } from './Topic';
5
5
  import { Id } from './Type';
6
6
  import { EUserLearningStatus } from './User';
@@ -29,4 +29,5 @@ export interface IConcept {
29
29
  dailyFeedCards?: number | null;
30
30
  status?: EUserLearningStatus | null;
31
31
  userNote: null | IUserConceptNote;
32
+ userChapter: null | IUserConceptChapter;
32
33
  }
@@ -16,3 +16,8 @@ export interface IUserStationNote extends IUserNote {
16
16
  stationId: Id;
17
17
  station: IOsceStation;
18
18
  }
19
+ export interface IUserConceptChapter extends Omit<IUserNote, 'note'> {
20
+ explanation: string;
21
+ conceptId: Id;
22
+ concept: IConcept;
23
+ }
@@ -1,3 +1,4 @@
1
1
  export declare const CONCEPT_FIELDS: import("@apollo/client").DocumentNode;
2
2
  export declare const STATUS_CONCEPT_FRAGMENT: import("@apollo/client").DocumentNode;
3
3
  export declare const UPSERT_CONCEPT_NOTE_FRAGMENT: import("@apollo/client").DocumentNode;
4
+ export declare const UPSERT_CONCEPT_CHAPTER_FRAGMENT: import("@apollo/client").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UPSERT_CONCEPT_NOTE_FRAGMENT = exports.STATUS_CONCEPT_FRAGMENT = exports.CONCEPT_FIELDS = void 0;
3
+ exports.UPSERT_CONCEPT_CHAPTER_FRAGMENT = exports.UPSERT_CONCEPT_NOTE_FRAGMENT = exports.STATUS_CONCEPT_FRAGMENT = exports.CONCEPT_FIELDS = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const chapter_1 = require("./chapter");
6
6
  const video_1 = require("./video");
@@ -37,6 +37,13 @@ exports.CONCEPT_FIELDS = (0, client_1.gql) `
37
37
  note
38
38
  updatedAt
39
39
  }
40
+ userChapter {
41
+ id
42
+ userId
43
+ conceptId
44
+ explanation
45
+ updatedAt
46
+ }
40
47
  }
41
48
  `;
42
49
  // used in cache updator
@@ -57,3 +64,15 @@ exports.UPSERT_CONCEPT_NOTE_FRAGMENT = (0, client_1.gql) `
57
64
  }
58
65
  }
59
66
  `;
67
+ // used in cache updator
68
+ exports.UPSERT_CONCEPT_CHAPTER_FRAGMENT = (0, client_1.gql) `
69
+ fragment UpsertConceptChapterFragment on Concept {
70
+ userChapter {
71
+ userId
72
+ explanation
73
+ conceptId
74
+ createdAt
75
+ updatedAt
76
+ }
77
+ }
78
+ `;
@@ -1,7 +1,21 @@
1
- import { ApolloCache } from "@apollo/client";
2
- import { IUserConceptNote, IUserStationNote } from "../../../models";
3
- import { ApolloUpdateResultRestricted, ApolloUpdateOptions } from "../../apollo";
4
- import { RestrictedData, graphqlNormalize } from "../../types";
1
+ import { ApolloCache } from '@apollo/client';
2
+ import { IUserConceptChapter, IUserConceptNote, IUserStationNote } from '../../../models';
3
+ import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
4
+ import { RestrictedData, graphqlNormalize } from '../../types';
5
+ /**
6
+ * upsertConceptChapter
7
+ */
8
+ export declare const UPSERT_CONCEPT_BOOK: import("@apollo/client").DocumentNode;
9
+ export interface IUpsertConceptChapterVar {
10
+ conceptId: number;
11
+ explanation: string;
12
+ marksheetId?: number;
13
+ }
14
+ export type IUpsertConceptChapterData = RestrictedData<graphqlNormalize & Omit<IUserConceptChapter, 'concept'>, 'upsertConceptChapter'>;
15
+ export declare const updateCacheOnUpsertConceptChapter: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertConceptChapterData>, options: ApolloUpdateOptions<IUpsertConceptChapterVar>) => void;
16
+ export declare const optimisticUpsertConceptChapter: (data: IUpsertConceptChapterVar & {
17
+ userId: number;
18
+ }) => IUpsertConceptChapterData;
5
19
  /**
6
20
  * upsertConceptNote
7
21
  */
@@ -1,8 +1,67 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.optimisticUpsertStationNote = exports.updateCacheOnUpsertStationNote = exports.UPSERT_STATION_NOTE = exports.optimisticUpsertConceptNote = exports.updateCacheOnUpsertConceptNote = exports.UPSERT_CONCEPT_NOTE = void 0;
3
+ exports.optimisticUpsertStationNote = exports.updateCacheOnUpsertStationNote = exports.UPSERT_STATION_NOTE = exports.optimisticUpsertConceptNote = exports.updateCacheOnUpsertConceptNote = exports.UPSERT_CONCEPT_NOTE = exports.optimisticUpsertConceptChapter = exports.updateCacheOnUpsertConceptChapter = exports.UPSERT_CONCEPT_BOOK = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const fragments_1 = require("../../fragments");
6
+ /**
7
+ * upsertConceptChapter
8
+ */
9
+ exports.UPSERT_CONCEPT_BOOK = (0, client_1.gql) `
10
+ mutation UpsertConceptChapter(
11
+ $conceptId: Int!
12
+ $explanation: String!
13
+ $marksheetId: Int
14
+ ) {
15
+ restricted {
16
+ upsertConceptChapter(
17
+ conceptId: $conceptId
18
+ explanation: $explanation
19
+ marksheetId: $marksheetId
20
+ ) {
21
+ id
22
+ conceptId
23
+ userId
24
+ explanation
25
+ createdAt
26
+ updatedAt
27
+ }
28
+ }
29
+ }
30
+ `;
31
+ const updateCacheOnUpsertConceptChapter = (cache, result, options) => {
32
+ const { upsertConceptChapter } = result?.data?.restricted || {};
33
+ const { variables } = options || {};
34
+ if (!variables || !upsertConceptChapter) {
35
+ return;
36
+ }
37
+ cache.writeFragment({
38
+ id: cache.identify({
39
+ id: variables.conceptId,
40
+ __typename: 'Concept',
41
+ }),
42
+ data: {
43
+ userChapter: upsertConceptChapter,
44
+ },
45
+ fragment: fragments_1.UPSERT_CONCEPT_CHAPTER_FRAGMENT,
46
+ });
47
+ };
48
+ exports.updateCacheOnUpsertConceptChapter = updateCacheOnUpsertConceptChapter;
49
+ const optimisticUpsertConceptChapter = (data) => {
50
+ const payload = {
51
+ restricted: {
52
+ upsertConceptChapter: {
53
+ __typename: 'UserConceptChapter',
54
+ ...data,
55
+ id: Date.now(),
56
+ conceptId: Date.now(),
57
+ createdAt: new Date(),
58
+ updatedAt: new Date(),
59
+ },
60
+ },
61
+ };
62
+ return payload;
63
+ };
64
+ exports.optimisticUpsertConceptChapter = optimisticUpsertConceptChapter;
6
65
  /**
7
66
  * upsertConceptNote
8
67
  */
@@ -1,9 +1,9 @@
1
1
  export * from './agora';
2
+ export * from './book';
2
3
  export * from './chapter';
3
4
  export * from './contactUs';
4
5
  export * from './marksheet';
5
6
  export * from './mockTest';
6
- export * from './notes';
7
7
  export * from './notification';
8
8
  export * from './osce';
9
9
  export * from './preset';
@@ -15,11 +15,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./agora"), exports);
18
+ __exportStar(require("./book"), exports);
18
19
  __exportStar(require("./chapter"), exports);
19
20
  __exportStar(require("./contactUs"), exports);
20
21
  __exportStar(require("./marksheet"), exports);
21
22
  __exportStar(require("./mockTest"), exports);
22
- __exportStar(require("./notes"), exports);
23
23
  __exportStar(require("./notification"), exports);
24
24
  __exportStar(require("./osce"), exports);
25
25
  __exportStar(require("./preset"), exports);
@@ -25,6 +25,20 @@ exports.CONCEPT = (0, client_1.gql) `
25
25
  name
26
26
  }
27
27
  }
28
+ userNote {
29
+ id
30
+ userId
31
+ conceptId
32
+ note
33
+ updatedAt
34
+ }
35
+ userChapter {
36
+ id
37
+ userId
38
+ conceptId
39
+ explanation
40
+ updatedAt
41
+ }
28
42
  chapter {
29
43
  ...ChapterFields
30
44
  }
@@ -69,12 +83,19 @@ exports.CONCEPTS = (0, client_1.gql) `
69
83
  ...ChapterFields
70
84
  }
71
85
  userNote {
72
- id
73
- userId
74
- conceptId
75
- note
76
- updatedAt
77
- }
86
+ id
87
+ userId
88
+ conceptId
89
+ note
90
+ updatedAt
91
+ }
92
+ userChapter {
93
+ id
94
+ userId
95
+ conceptId
96
+ explanation
97
+ updatedAt
98
+ }
78
99
  videos {
79
100
  id
80
101
  status
@@ -43,6 +43,13 @@ exports.QBANK_KNOWLEDGE_VIDEO_LIBRARY = (0, client_1.gql) `
43
43
  note
44
44
  updatedAt
45
45
  }
46
+ userChapter {
47
+ id
48
+ userId
49
+ conceptId
50
+ explanation
51
+ updatedAt
52
+ }
46
53
  topicId
47
54
  videos {
48
55
  id
@@ -103,6 +110,13 @@ exports.PUBLIC_QBANK_KNOWLEDGE_LIBRARY = (0, client_1.gql) `
103
110
  note
104
111
  updatedAt
105
112
  }
113
+ userChapter {
114
+ id
115
+ userId
116
+ conceptId
117
+ explanation
118
+ updatedAt
119
+ }
106
120
  videos {
107
121
  id
108
122
  demo
@@ -151,6 +165,13 @@ exports.PACE_KNOWLEDGE_LIBRARY = (0, client_1.gql) `
151
165
  note
152
166
  updatedAt
153
167
  }
168
+ userChapter {
169
+ id
170
+ userId
171
+ conceptId
172
+ explanation
173
+ updatedAt
174
+ }
154
175
  entitlement {
155
176
  id
156
177
  name
@@ -27,6 +27,13 @@ exports.VIDEO = (0, client_1.gql) `
27
27
  note
28
28
  updatedAt
29
29
  }
30
+ userChapter {
31
+ id
32
+ userId
33
+ conceptId
34
+ explanation
35
+ updatedAt
36
+ }
30
37
  topic {
31
38
  id
32
39
  name
@@ -1,6 +1,6 @@
1
1
  import { IChapter } from './Chapter';
2
+ import { IUserConceptChapter, IUserConceptNote } from './Note';
2
3
  import { EEntitlementType, IEntitlement } from './Product';
3
- import { IUserConceptNote } from './Note';
4
4
  import { ITopic } from './Topic';
5
5
  import { Id } from './Type';
6
6
  import { EUserLearningStatus } from './User';
@@ -29,4 +29,5 @@ export interface IConcept {
29
29
  dailyFeedCards?: number | null;
30
30
  status?: EUserLearningStatus | null;
31
31
  userNote: null | IUserConceptNote;
32
+ userChapter: null | IUserConceptChapter;
32
33
  }
@@ -16,3 +16,8 @@ export interface IUserStationNote extends IUserNote {
16
16
  stationId: Id;
17
17
  station: IOsceStation;
18
18
  }
19
+ export interface IUserConceptChapter extends Omit<IUserNote, 'note'> {
20
+ explanation: string;
21
+ conceptId: Id;
22
+ concept: IConcept;
23
+ }
@@ -1,3 +1,4 @@
1
1
  export declare const CONCEPT_FIELDS: import("@apollo/client").DocumentNode;
2
2
  export declare const STATUS_CONCEPT_FRAGMENT: import("@apollo/client").DocumentNode;
3
3
  export declare const UPSERT_CONCEPT_NOTE_FRAGMENT: import("@apollo/client").DocumentNode;
4
+ export declare const UPSERT_CONCEPT_CHAPTER_FRAGMENT: import("@apollo/client").DocumentNode;
@@ -34,6 +34,13 @@ export const CONCEPT_FIELDS = gql `
34
34
  note
35
35
  updatedAt
36
36
  }
37
+ userChapter {
38
+ id
39
+ userId
40
+ conceptId
41
+ explanation
42
+ updatedAt
43
+ }
37
44
  }
38
45
  `;
39
46
  // used in cache updator
@@ -54,3 +61,15 @@ export const UPSERT_CONCEPT_NOTE_FRAGMENT = gql `
54
61
  }
55
62
  }
56
63
  `;
64
+ // used in cache updator
65
+ export const UPSERT_CONCEPT_CHAPTER_FRAGMENT = gql `
66
+ fragment UpsertConceptChapterFragment on Concept {
67
+ userChapter {
68
+ userId
69
+ explanation
70
+ conceptId
71
+ createdAt
72
+ updatedAt
73
+ }
74
+ }
75
+ `;
@@ -1,7 +1,21 @@
1
- import { ApolloCache } from "@apollo/client";
2
- import { IUserConceptNote, IUserStationNote } from "../../../models";
3
- import { ApolloUpdateResultRestricted, ApolloUpdateOptions } from "../../apollo";
4
- import { RestrictedData, graphqlNormalize } from "../../types";
1
+ import { ApolloCache } from '@apollo/client';
2
+ import { IUserConceptChapter, IUserConceptNote, IUserStationNote } from '../../../models';
3
+ import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
4
+ import { RestrictedData, graphqlNormalize } from '../../types';
5
+ /**
6
+ * upsertConceptChapter
7
+ */
8
+ export declare const UPSERT_CONCEPT_BOOK: import("@apollo/client").DocumentNode;
9
+ export interface IUpsertConceptChapterVar {
10
+ conceptId: number;
11
+ explanation: string;
12
+ marksheetId?: number;
13
+ }
14
+ export type IUpsertConceptChapterData = RestrictedData<graphqlNormalize & Omit<IUserConceptChapter, 'concept'>, 'upsertConceptChapter'>;
15
+ export declare const updateCacheOnUpsertConceptChapter: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertConceptChapterData>, options: ApolloUpdateOptions<IUpsertConceptChapterVar>) => void;
16
+ export declare const optimisticUpsertConceptChapter: (data: IUpsertConceptChapterVar & {
17
+ userId: number;
18
+ }) => IUpsertConceptChapterData;
5
19
  /**
6
20
  * upsertConceptNote
7
21
  */
@@ -1,5 +1,62 @@
1
- import { gql } from "@apollo/client";
2
- import { UPSERT_CONCEPT_NOTE_FRAGMENT, UPSERT_STATION_NOTE_FRAGMENT } from "../../fragments";
1
+ import { gql } from '@apollo/client';
2
+ import { UPSERT_CONCEPT_CHAPTER_FRAGMENT, UPSERT_CONCEPT_NOTE_FRAGMENT, UPSERT_STATION_NOTE_FRAGMENT, } from '../../fragments';
3
+ /**
4
+ * upsertConceptChapter
5
+ */
6
+ export const UPSERT_CONCEPT_BOOK = gql `
7
+ mutation UpsertConceptChapter(
8
+ $conceptId: Int!
9
+ $explanation: String!
10
+ $marksheetId: Int
11
+ ) {
12
+ restricted {
13
+ upsertConceptChapter(
14
+ conceptId: $conceptId
15
+ explanation: $explanation
16
+ marksheetId: $marksheetId
17
+ ) {
18
+ id
19
+ conceptId
20
+ userId
21
+ explanation
22
+ createdAt
23
+ updatedAt
24
+ }
25
+ }
26
+ }
27
+ `;
28
+ export const updateCacheOnUpsertConceptChapter = (cache, result, options) => {
29
+ const { upsertConceptChapter } = result?.data?.restricted || {};
30
+ const { variables } = options || {};
31
+ if (!variables || !upsertConceptChapter) {
32
+ return;
33
+ }
34
+ cache.writeFragment({
35
+ id: cache.identify({
36
+ id: variables.conceptId,
37
+ __typename: 'Concept',
38
+ }),
39
+ data: {
40
+ userChapter: upsertConceptChapter,
41
+ },
42
+ fragment: UPSERT_CONCEPT_CHAPTER_FRAGMENT,
43
+ });
44
+ };
45
+ export const optimisticUpsertConceptChapter = (data) => {
46
+ const payload = {
47
+ restricted: {
48
+ upsertConceptChapter: {
49
+ __typename: 'UserConceptChapter',
50
+ ...data,
51
+ id: Date.now(),
52
+ conceptId: Date.now(),
53
+ createdAt: new Date(),
54
+ updatedAt: new Date(),
55
+ },
56
+ },
57
+ };
58
+ return payload;
59
+ };
3
60
  /**
4
61
  * upsertConceptNote
5
62
  */
@@ -1,9 +1,9 @@
1
1
  export * from './agora';
2
+ export * from './book';
2
3
  export * from './chapter';
3
4
  export * from './contactUs';
4
5
  export * from './marksheet';
5
6
  export * from './mockTest';
6
- export * from './notes';
7
7
  export * from './notification';
8
8
  export * from './osce';
9
9
  export * from './preset';
@@ -1,9 +1,9 @@
1
1
  export * from './agora';
2
+ export * from './book';
2
3
  export * from './chapter';
3
4
  export * from './contactUs';
4
5
  export * from './marksheet';
5
6
  export * from './mockTest';
6
- export * from './notes';
7
7
  export * from './notification';
8
8
  export * from './osce';
9
9
  export * from './preset';
@@ -22,6 +22,20 @@ export const CONCEPT = gql `
22
22
  name
23
23
  }
24
24
  }
25
+ userNote {
26
+ id
27
+ userId
28
+ conceptId
29
+ note
30
+ updatedAt
31
+ }
32
+ userChapter {
33
+ id
34
+ userId
35
+ conceptId
36
+ explanation
37
+ updatedAt
38
+ }
25
39
  chapter {
26
40
  ...ChapterFields
27
41
  }
@@ -66,12 +80,19 @@ export const CONCEPTS = gql `
66
80
  ...ChapterFields
67
81
  }
68
82
  userNote {
69
- id
70
- userId
71
- conceptId
72
- note
73
- updatedAt
74
- }
83
+ id
84
+ userId
85
+ conceptId
86
+ note
87
+ updatedAt
88
+ }
89
+ userChapter {
90
+ id
91
+ userId
92
+ conceptId
93
+ explanation
94
+ updatedAt
95
+ }
75
96
  videos {
76
97
  id
77
98
  status
@@ -40,6 +40,13 @@ export const QBANK_KNOWLEDGE_VIDEO_LIBRARY = gql `
40
40
  note
41
41
  updatedAt
42
42
  }
43
+ userChapter {
44
+ id
45
+ userId
46
+ conceptId
47
+ explanation
48
+ updatedAt
49
+ }
43
50
  topicId
44
51
  videos {
45
52
  id
@@ -100,6 +107,13 @@ export const PUBLIC_QBANK_KNOWLEDGE_LIBRARY = gql `
100
107
  note
101
108
  updatedAt
102
109
  }
110
+ userChapter {
111
+ id
112
+ userId
113
+ conceptId
114
+ explanation
115
+ updatedAt
116
+ }
103
117
  videos {
104
118
  id
105
119
  demo
@@ -148,6 +162,13 @@ export const PACE_KNOWLEDGE_LIBRARY = gql `
148
162
  note
149
163
  updatedAt
150
164
  }
165
+ userChapter {
166
+ id
167
+ userId
168
+ conceptId
169
+ explanation
170
+ updatedAt
171
+ }
151
172
  entitlement {
152
173
  id
153
174
  name
@@ -24,6 +24,13 @@ export const VIDEO = gql `
24
24
  note
25
25
  updatedAt
26
26
  }
27
+ userChapter {
28
+ id
29
+ userId
30
+ conceptId
31
+ explanation
32
+ updatedAt
33
+ }
27
34
  topic {
28
35
  id
29
36
  name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.100",
3
+ "version": "2.6.101",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",