@quesmed/types-rn 2.6.56 → 2.6.57

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,9 +1,9 @@
1
1
  import { IFile } from './File';
2
2
  import { IHighlightNode } from './Highlight';
3
+ import { IUserChapterNote } from './Note';
3
4
  import { IPicture } from './Picture';
4
5
  import { ETopicType } from './Topic';
5
6
  import { Id } from './Type';
6
- import { IUserChapterNote } from './User';
7
7
  export interface IChapter {
8
8
  id: Id;
9
9
  createdAt: number | Date;
@@ -0,0 +1,18 @@
1
+ import { IChapter } from './Chapter';
2
+ import { IOsceStation } from './OsceStation';
3
+ import { Id } from './Type';
4
+ export interface IUserNote {
5
+ id: Id;
6
+ createdAt: number | Date;
7
+ updatedAt: number | Date;
8
+ userId: Id;
9
+ note: string;
10
+ }
11
+ export interface IUserChapterNote extends IUserNote {
12
+ chapterId: Id;
13
+ chapter: IChapter;
14
+ }
15
+ export interface IUserStationNote extends IUserNote {
16
+ stationId: Id;
17
+ station: IOsceStation;
18
+ }
package/models/Note.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,6 @@
1
1
  import { IConcept } from './Concept';
2
2
  import { EDifficultyType } from './Difficulty';
3
+ import { IUserStationNote } from './Note';
3
4
  import { IPaceScore } from './Paces';
4
5
  import { IPicture } from './Picture';
5
6
  import { IEntitlement } from './Product';
@@ -70,6 +71,7 @@ export interface IOsceStation {
70
71
  score?: number;
71
72
  status?: EUserLearningStatus;
72
73
  demo?: boolean;
74
+ userNote: null | IUserStationNote;
73
75
  }
74
76
  export interface IOsceStationTopic {
75
77
  id: Id;
package/models/User.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { ExtractKeysWithPattern } from '../resolvers/types';
2
2
  import { ICard } from './Card';
3
- import { IChapter } from './Chapter';
4
3
  import { IConcept } from './Concept';
5
4
  import { IMarksheet } from './Marksheet';
6
5
  import { INotification } from './Notification';
@@ -156,15 +155,6 @@ export interface IUserCompletedQuestion {
156
155
  question: IQuestion;
157
156
  concept: IConcept;
158
157
  }
159
- export interface IUserChapterNote {
160
- id: Id;
161
- createdAt: number | Date;
162
- updatedAt: number | Date;
163
- chapterId: Id;
164
- chapter: IChapter;
165
- userId: Id;
166
- note: string;
167
- }
168
158
  export interface IUserCompletedCard {
169
159
  id: Id;
170
160
  createdAt: number | Date;
package/models/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export * from './File';
11
11
  export * from './Highlight';
12
12
  export * from './Marksheet';
13
13
  export * from './MockTest';
14
+ export * from './Note';
14
15
  export * from './Notification';
15
16
  export * from './OsceMarksheet';
16
17
  export * from './OsceStation';
package/models/index.js CHANGED
@@ -27,6 +27,7 @@ __exportStar(require("./File"), exports);
27
27
  __exportStar(require("./Highlight"), exports);
28
28
  __exportStar(require("./Marksheet"), exports);
29
29
  __exportStar(require("./MockTest"), exports);
30
+ __exportStar(require("./Note"), exports);
30
31
  __exportStar(require("./Notification"), exports);
31
32
  __exportStar(require("./OsceMarksheet"), exports);
32
33
  __exportStar(require("./OsceStation"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.6.56",
3
+ "version": "2.6.57",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -6,3 +6,4 @@ export declare const OSCE_MATCHMAKING_ACTION_FIELDS: import("@apollo/client").Do
6
6
  export declare const STATION_CONCEPT_FRAGMENT: import("@apollo/client").DocumentNode;
7
7
  export declare const COMPLETED_OSCE_MARKSHEET_FRAGMENT: import("@apollo/client").DocumentNode;
8
8
  export declare const COMPLETED_OSCE_STATION_FRAGMENT: import("@apollo/client").DocumentNode;
9
+ export declare const UPSERT_STATION_NOTE_FRAGMENT: import("@apollo/client").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.COMPLETED_OSCE_STATION_FRAGMENT = exports.COMPLETED_OSCE_MARKSHEET_FRAGMENT = exports.STATION_CONCEPT_FRAGMENT = exports.OSCE_MATCHMAKING_ACTION_FIELDS = exports.OSCE_MARKSHEET_FIELDS = exports.OSCE_MARKSHEET_MARK_FIELDS = exports.OSCE_STATION_FIELDS = exports.OSCE_STATION_MARK_FIELDS = void 0;
3
+ exports.UPSERT_STATION_NOTE_FRAGMENT = exports.COMPLETED_OSCE_STATION_FRAGMENT = exports.COMPLETED_OSCE_MARKSHEET_FRAGMENT = exports.STATION_CONCEPT_FRAGMENT = exports.OSCE_MATCHMAKING_ACTION_FIELDS = exports.OSCE_MARKSHEET_FIELDS = exports.OSCE_MARKSHEET_MARK_FIELDS = exports.OSCE_STATION_FIELDS = exports.OSCE_STATION_MARK_FIELDS = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const picture_1 = require("./picture");
6
6
  const video_1 = require("./video");
@@ -172,3 +172,15 @@ exports.COMPLETED_OSCE_STATION_FRAGMENT = (0, client_1.gql) `
172
172
  lastOsceMarksheetId
173
173
  }
174
174
  `;
175
+ // used in cache updator
176
+ exports.UPSERT_STATION_NOTE_FRAGMENT = (0, client_1.gql) `
177
+ fragment UpsertStationNoteFragment on OsceStation {
178
+ userNote {
179
+ userId
180
+ stationId
181
+ note
182
+ createdAt
183
+ updatedAt
184
+ }
185
+ }
186
+ `;
@@ -1,5 +1,5 @@
1
1
  import { ApolloCache } from '@apollo/client';
2
- import { EOsceMarksheetAction, EOsceMarksheetState, EOsceRoles, EPaceMarkType, EProductType, EStudyAction, IOsceMarksheet, IOsceMarksheetMark, Id } from '../../../models';
2
+ import { EOsceMarksheetAction, EOsceMarksheetState, EOsceRoles, EPaceMarkType, EProductType, EStudyAction, IOsceMarksheet, IOsceMarksheetMark, IUserStationNote, Id } from '../../../models';
3
3
  import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
4
4
  import { IOsceMatchmakingAction } from '../../subscription/osce';
5
5
  import { RestrictedData, graphqlNormalize } from '../../types';
@@ -140,3 +140,27 @@ export interface ILeaveOsceMarksheetVar {
140
140
  osceMarksheetId: Id;
141
141
  }
142
142
  export type ILeaveOsceMarksheetData = RestrictedData<graphqlNormalize & IOsceMarksheet, 'leaveOsceMarksheet'>;
143
+ /**
144
+ * upsertStationNote
145
+ */
146
+ export declare const UPSERT_STATION_NOTE: import("@apollo/client").DocumentNode;
147
+ export interface IUpsertStationNoteVar {
148
+ stationId: number;
149
+ note: string;
150
+ }
151
+ export type IUpsertStationNoteData = RestrictedData<IUserStationNote, 'upsertStationNote'>;
152
+ export declare const updateCacheOnUpsertStationNote: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertStationNoteData>, options: ApolloUpdateOptions<IUpsertStationNoteVar>) => void;
153
+ export declare const optimisticUpsertStationNote: (data: IUpsertStationNoteVar & {
154
+ userId: number;
155
+ }) => {
156
+ restricted: {
157
+ upsertStationNote: {
158
+ createdAt: Date;
159
+ updatedAt: Date;
160
+ stationId: number;
161
+ note: string;
162
+ userId: number;
163
+ __typename: string;
164
+ };
165
+ };
166
+ };
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LEAVE_OSCE_MARKSHEET = exports.optimisticEndOsceMarksheet = exports.updateCacheOnEndOsceMarksheet = exports.END_OSCE_MARKSHEET = exports.MODIFY_OSCE_MARKSHEET = exports.SAVE_OSCE_MARKSHEET = exports.PRESTART_OSCE_MARKSHEET = exports.START_OSCE_TIMER = exports.START_OSCE_MARKSHEET = exports.SELECT_OSCE_STATION = exports.optimisticMarkOsceMarksheetMark = exports.MARK_OSCE_MARKSHEET_MARK = exports.CHANGE_OSCE_ROLE = exports.BUILD_OSCE_MARKSHEET = exports.CREATE_OR_JOIN_OSCE_MARKSHEET = exports.CANCEL_OSCE_MATCHMAKING = exports.CHECK_OSCE_MATCHMAKING = exports.ACCEPT_OSCE_MATCHMAKING = exports.START_OSCE_MATCHMAKING = void 0;
3
+ exports.optimisticUpsertStationNote = exports.updateCacheOnUpsertStationNote = exports.UPSERT_STATION_NOTE = exports.LEAVE_OSCE_MARKSHEET = exports.optimisticEndOsceMarksheet = exports.updateCacheOnEndOsceMarksheet = exports.END_OSCE_MARKSHEET = exports.MODIFY_OSCE_MARKSHEET = exports.SAVE_OSCE_MARKSHEET = exports.PRESTART_OSCE_MARKSHEET = exports.START_OSCE_TIMER = exports.START_OSCE_MARKSHEET = exports.SELECT_OSCE_STATION = exports.optimisticMarkOsceMarksheetMark = exports.MARK_OSCE_MARKSHEET_MARK = exports.CHANGE_OSCE_ROLE = exports.BUILD_OSCE_MARKSHEET = exports.CREATE_OR_JOIN_OSCE_MARKSHEET = exports.CANCEL_OSCE_MATCHMAKING = exports.CHECK_OSCE_MATCHMAKING = exports.ACCEPT_OSCE_MATCHMAKING = exports.START_OSCE_MATCHMAKING = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const models_1 = require("../../../models");
6
- const osce_1 = require("../../fragments/osce");
7
- const osce_2 = require("./../../fragments/osce");
6
+ const fragments_1 = require("../../fragments");
8
7
  exports.START_OSCE_MATCHMAKING = (0, client_1.gql) `
9
8
  mutation StartOsceMatchmaking($sessionId: String!) {
10
9
  restricted {
@@ -20,7 +19,7 @@ exports.ACCEPT_OSCE_MATCHMAKING = (0, client_1.gql) `
20
19
  }
21
20
  `;
22
21
  exports.CHECK_OSCE_MATCHMAKING = (0, client_1.gql) `
23
- ${osce_1.OSCE_MATCHMAKING_ACTION_FIELDS}
22
+ ${fragments_1.OSCE_MATCHMAKING_ACTION_FIELDS}
24
23
  mutation CheckOsceMatchmaking {
25
24
  restricted {
26
25
  checkOsceMatchmaking {
@@ -37,8 +36,8 @@ exports.CANCEL_OSCE_MATCHMAKING = (0, client_1.gql) `
37
36
  }
38
37
  `;
39
38
  exports.CREATE_OR_JOIN_OSCE_MARKSHEET = (0, client_1.gql) `
40
- ${osce_2.OSCE_STATION_FIELDS}
41
- ${osce_1.OSCE_MARKSHEET_FIELDS}
39
+ ${fragments_1.OSCE_STATION_FIELDS}
40
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
42
41
  mutation CreateOrJoinOsceMarksheet($sessionId: String!, $action: Int!) {
43
42
  restricted {
44
43
  createOrJoinOsceMarksheet(sessionId: $sessionId, action: $action) {
@@ -51,8 +50,8 @@ exports.CREATE_OR_JOIN_OSCE_MARKSHEET = (0, client_1.gql) `
51
50
  }
52
51
  `;
53
52
  exports.BUILD_OSCE_MARKSHEET = (0, client_1.gql) `
54
- ${osce_2.OSCE_STATION_FIELDS}
55
- ${osce_1.OSCE_MARKSHEET_FIELDS}
53
+ ${fragments_1.OSCE_STATION_FIELDS}
54
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
56
55
  mutation BuildOsceMarksheet($osceStationId: Int!, $osceMarksheetId: Int) {
57
56
  restricted {
58
57
  buildOsceMarksheet(
@@ -68,7 +67,7 @@ exports.BUILD_OSCE_MARKSHEET = (0, client_1.gql) `
68
67
  }
69
68
  `;
70
69
  exports.CHANGE_OSCE_ROLE = (0, client_1.gql) `
71
- ${osce_1.OSCE_MARKSHEET_FIELDS}
70
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
72
71
  mutation ChangeOsceRole($sessionId: String!, $role: Int!) {
73
72
  restricted {
74
73
  changeOsceRole(sessionId: $sessionId, role: $role) {
@@ -113,8 +112,8 @@ const optimisticMarkOsceMarksheetMark = (variables, productType) => {
113
112
  };
114
113
  exports.optimisticMarkOsceMarksheetMark = optimisticMarkOsceMarksheetMark;
115
114
  exports.SELECT_OSCE_STATION = (0, client_1.gql) `
116
- ${osce_2.OSCE_STATION_FIELDS}
117
- ${osce_1.OSCE_MARKSHEET_FIELDS}
115
+ ${fragments_1.OSCE_STATION_FIELDS}
116
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
118
117
  mutation SelectOsceMarksheetStation(
119
118
  $osceMarksheetId: Int!
120
119
  $osceStationId: Int!
@@ -133,8 +132,8 @@ exports.SELECT_OSCE_STATION = (0, client_1.gql) `
133
132
  }
134
133
  `;
135
134
  exports.START_OSCE_MARKSHEET = (0, client_1.gql) `
136
- ${osce_2.OSCE_STATION_FIELDS}
137
- ${osce_1.OSCE_MARKSHEET_FIELDS}
135
+ ${fragments_1.OSCE_STATION_FIELDS}
136
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
138
137
  mutation StartOsceMarksheet($osceMarksheetId: Int!) {
139
138
  restricted {
140
139
  startOsceMarksheet(osceMarksheetId: $osceMarksheetId) {
@@ -162,8 +161,8 @@ exports.START_OSCE_TIMER = (0, client_1.gql) `
162
161
  }
163
162
  `;
164
163
  exports.PRESTART_OSCE_MARKSHEET = (0, client_1.gql) `
165
- ${osce_2.OSCE_STATION_FIELDS}
166
- ${osce_1.OSCE_MARKSHEET_FIELDS}
164
+ ${fragments_1.OSCE_STATION_FIELDS}
165
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
167
166
  mutation PrestartOsceMarksheet(
168
167
  $osceMarksheetId: Int!
169
168
  $readingTime: Int!
@@ -188,7 +187,7 @@ exports.PRESTART_OSCE_MARKSHEET = (0, client_1.gql) `
188
187
  }
189
188
  `;
190
189
  exports.SAVE_OSCE_MARKSHEET = (0, client_1.gql) `
191
- ${osce_1.OSCE_MARKSHEET_FIELDS}
190
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
192
191
  mutation SaveOsceMarksheet(
193
192
  $osceMarksheetId: Int!
194
193
  $feedback: String
@@ -221,7 +220,7 @@ exports.MODIFY_OSCE_MARKSHEET = (0, client_1.gql) `
221
220
  }
222
221
  `;
223
222
  exports.END_OSCE_MARKSHEET = (0, client_1.gql) `
224
- ${osce_1.OSCE_MARKSHEET_FIELDS}
223
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
225
224
  mutation EndOsceMarksheet(
226
225
  $osceMarksheetId: Int!
227
226
  $feedback: String
@@ -257,7 +256,7 @@ const updateCacheOnEndOsceMarksheet = (productType) => (cache, result, options)
257
256
  timeTaken: endOsceMarksheet.timeTaken,
258
257
  endedAt: endOsceMarksheet.endedAt,
259
258
  },
260
- fragment: osce_1.COMPLETED_OSCE_MARKSHEET_FRAGMENT,
259
+ fragment: fragments_1.COMPLETED_OSCE_MARKSHEET_FRAGMENT,
261
260
  });
262
261
  cache.writeFragment({
263
262
  id: cache.identify({
@@ -271,7 +270,7 @@ const updateCacheOnEndOsceMarksheet = (productType) => (cache, result, options)
271
270
  score: endOsceMarksheet.score,
272
271
  lastOsceMarksheetId: endOsceMarksheet.id,
273
272
  },
274
- fragment: osce_1.COMPLETED_OSCE_STATION_FRAGMENT,
273
+ fragment: fragments_1.COMPLETED_OSCE_STATION_FRAGMENT,
275
274
  });
276
275
  };
277
276
  exports.updateCacheOnEndOsceMarksheet = updateCacheOnEndOsceMarksheet;
@@ -287,7 +286,7 @@ const optimisticEndOsceMarksheet = (marksheet) => ({
287
286
  });
288
287
  exports.optimisticEndOsceMarksheet = optimisticEndOsceMarksheet;
289
288
  exports.LEAVE_OSCE_MARKSHEET = (0, client_1.gql) `
290
- ${osce_1.OSCE_MARKSHEET_FIELDS}
289
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
291
290
  mutation LeaveOsceMarksheet($osceMarksheetId: Int!) {
292
291
  restricted {
293
292
  leaveOsceMarksheet(osceMarksheetId: $osceMarksheetId) {
@@ -296,3 +295,51 @@ exports.LEAVE_OSCE_MARKSHEET = (0, client_1.gql) `
296
295
  }
297
296
  }
298
297
  `;
298
+ /**
299
+ * upsertStationNote
300
+ */
301
+ exports.UPSERT_STATION_NOTE = (0, client_1.gql) `
302
+ mutation UpsertStationNote($stationId: Int!, $note: String!) {
303
+ restricted {
304
+ upsertStationNote(stationId: $stationId, note: $note) {
305
+ id
306
+ stationId
307
+ userId
308
+ note
309
+ createdAt
310
+ updatedAt
311
+ }
312
+ }
313
+ }
314
+ `;
315
+ const updateCacheOnUpsertStationNote = (cache, result, options) => {
316
+ const { upsertStationNote } = result?.data?.restricted || {};
317
+ const { variables } = options || {};
318
+ if (!variables || !upsertStationNote) {
319
+ return;
320
+ }
321
+ cache.writeFragment({
322
+ id: cache.identify({
323
+ id: variables.stationId,
324
+ __typename: 'OsceStation',
325
+ }),
326
+ data: {
327
+ userNote: upsertStationNote,
328
+ },
329
+ fragment: fragments_1.UPSERT_STATION_NOTE_FRAGMENT,
330
+ });
331
+ };
332
+ exports.updateCacheOnUpsertStationNote = updateCacheOnUpsertStationNote;
333
+ const optimisticUpsertStationNote = (data) => {
334
+ return {
335
+ restricted: {
336
+ upsertStationNote: {
337
+ __typename: 'UserStationNote',
338
+ ...data,
339
+ createdAt: new Date(),
340
+ updatedAt: new Date(),
341
+ },
342
+ },
343
+ };
344
+ };
345
+ exports.optimisticUpsertStationNote = optimisticUpsertStationNote;