@quesmed/types 2.6.259 → 2.6.261

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.
Files changed (37) hide show
  1. package/dist/cjs/models/Circuit.d.ts +56 -0
  2. package/dist/cjs/models/Circuit.js +2 -0
  3. package/dist/cjs/models/index.d.ts +1 -0
  4. package/dist/cjs/models/index.js +1 -0
  5. package/dist/cjs/resolvers/fragments/circuit.d.ts +5 -0
  6. package/dist/cjs/resolvers/fragments/circuit.js +93 -0
  7. package/dist/cjs/resolvers/fragments/index.d.ts +1 -0
  8. package/dist/cjs/resolvers/fragments/index.js +1 -0
  9. package/dist/cjs/resolvers/mutation/restricted/circuit.d.ts +46 -0
  10. package/dist/cjs/resolvers/mutation/restricted/circuit.js +154 -0
  11. package/dist/cjs/resolvers/mutation/restricted/index.d.ts +1 -0
  12. package/dist/cjs/resolvers/mutation/restricted/index.js +1 -0
  13. package/dist/cjs/resolvers/mutation/restricted/osce.d.ts +2 -0
  14. package/dist/cjs/resolvers/mutation/restricted/osce.js +60 -2
  15. package/dist/cjs/resolvers/query/restricted/circuit.d.ts +26 -0
  16. package/dist/cjs/resolvers/query/restricted/circuit.js +82 -0
  17. package/dist/cjs/resolvers/query/restricted/index.d.ts +1 -0
  18. package/dist/cjs/resolvers/query/restricted/index.js +1 -0
  19. package/dist/mjs/models/Circuit.d.ts +56 -0
  20. package/dist/mjs/models/Circuit.js +1 -0
  21. package/dist/mjs/models/index.d.ts +1 -0
  22. package/dist/mjs/models/index.js +1 -0
  23. package/dist/mjs/resolvers/fragments/circuit.d.ts +5 -0
  24. package/dist/mjs/resolvers/fragments/circuit.js +90 -0
  25. package/dist/mjs/resolvers/fragments/index.d.ts +1 -0
  26. package/dist/mjs/resolvers/fragments/index.js +1 -0
  27. package/dist/mjs/resolvers/mutation/restricted/circuit.d.ts +46 -0
  28. package/dist/mjs/resolvers/mutation/restricted/circuit.js +146 -0
  29. package/dist/mjs/resolvers/mutation/restricted/index.d.ts +1 -0
  30. package/dist/mjs/resolvers/mutation/restricted/index.js +1 -0
  31. package/dist/mjs/resolvers/mutation/restricted/osce.d.ts +2 -0
  32. package/dist/mjs/resolvers/mutation/restricted/osce.js +58 -1
  33. package/dist/mjs/resolvers/query/restricted/circuit.d.ts +26 -0
  34. package/dist/mjs/resolvers/query/restricted/circuit.js +79 -0
  35. package/dist/mjs/resolvers/query/restricted/index.d.ts +1 -0
  36. package/dist/mjs/resolvers/query/restricted/index.js +1 -0
  37. package/package.json +1 -1
@@ -0,0 +1,56 @@
1
+ import { IOsceMarksheet } from './OsceMarksheet';
2
+ import { IOsceStation } from './OsceStation';
3
+ import { Id } from './Type';
4
+ export interface ICircuitStationInput {
5
+ osceStationId: number;
6
+ sortOrder: number;
7
+ }
8
+ export interface ICreateCircuitInput {
9
+ name: string;
10
+ stations: ICircuitStationInput[];
11
+ }
12
+ export interface IEditCircuitInput {
13
+ name?: string;
14
+ stations?: ICircuitStationInput[];
15
+ }
16
+ export interface ICircuit {
17
+ id: Id;
18
+ createdAt: number | Date;
19
+ updatedAt: number | Date;
20
+ userId: number;
21
+ name: string;
22
+ preDefined: boolean;
23
+ stations?: IOsceStation[];
24
+ circuitSession?: ICircuitSession | null;
25
+ }
26
+ export interface ICircuitSession {
27
+ id: Id;
28
+ createdAt: number | Date;
29
+ updatedAt: number | Date;
30
+ circuitId: number;
31
+ userId: number;
32
+ mode: string;
33
+ activeStationId: number | null;
34
+ completed: boolean;
35
+ completedAt: number | Date | null;
36
+ totalStations: number;
37
+ attemptedCount: number;
38
+ completedCount: number;
39
+ score: number | null;
40
+ circuit?: ICircuit;
41
+ activeStation?: IOsceStation | null;
42
+ activeMarksheet?: IOsceMarksheet | null;
43
+ marksheets?: ICircuitSessionMarksheet[];
44
+ }
45
+ export interface ICircuitSessionMarksheet {
46
+ id: Id;
47
+ createdAt: number | Date;
48
+ updatedAt: number | Date;
49
+ circuitSessionId: number;
50
+ osceStationId: number;
51
+ osceMarksheetId: number | null;
52
+ startedAt: number | Date | null;
53
+ endedAt: number | Date | null;
54
+ osceStation?: IOsceStation;
55
+ osceMarksheet?: IOsceMarksheet | null;
56
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
1
  export * from './AdminNotification';
2
+ export * from './Circuit';
2
3
  export * from './Author';
3
4
  export * from './Blog';
4
5
  export * from './Book';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./AdminNotification"), exports);
18
+ __exportStar(require("./Circuit"), exports);
18
19
  __exportStar(require("./Author"), exports);
19
20
  __exportStar(require("./Blog"), exports);
20
21
  __exportStar(require("./Book"), exports);
@@ -0,0 +1,5 @@
1
+ export declare const CIRCUIT_FIELDS: import("@apollo/client").DocumentNode;
2
+ export declare const CIRCUIT_SESSION_MARKSHEET_FIELDS: import("@apollo/client").DocumentNode;
3
+ export declare const CIRCUIT_SESSION_FIELDS: import("@apollo/client").DocumentNode;
4
+ export declare const CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS: import("@apollo/client").DocumentNode;
5
+ export declare const CIRCUIT_SESSION_WITH_MARKSHEETS_FIELDS: import("@apollo/client").DocumentNode;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CIRCUIT_SESSION_WITH_MARKSHEETS_FIELDS = exports.CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS = exports.CIRCUIT_SESSION_FIELDS = exports.CIRCUIT_SESSION_MARKSHEET_FIELDS = exports.CIRCUIT_FIELDS = void 0;
4
+ const client_1 = require("@apollo/client");
5
+ const osce_1 = require("./osce");
6
+ const picture_1 = require("./picture");
7
+ exports.CIRCUIT_FIELDS = (0, client_1.gql) `
8
+ ${picture_1.PICTURE_FIELDS}
9
+ fragment CircuitFields on Circuit {
10
+ id
11
+ createdAt
12
+ updatedAt
13
+ userId
14
+ name
15
+ preDefined
16
+ stations {
17
+ id
18
+ name
19
+ aiEnabled
20
+ phaseTimers
21
+ hiddenName
22
+ osceType {
23
+ id
24
+ name
25
+ }
26
+ picture {
27
+ ...PictureFields
28
+ }
29
+ difficulty
30
+ }
31
+ }
32
+ `;
33
+ exports.CIRCUIT_SESSION_MARKSHEET_FIELDS = (0, client_1.gql) `
34
+ fragment CircuitSessionMarksheetFields on CircuitSessionMarksheet {
35
+ id
36
+ createdAt
37
+ updatedAt
38
+ circuitSessionId
39
+ osceStationId
40
+ osceMarksheetId
41
+ startedAt
42
+ endedAt
43
+ }
44
+ `;
45
+ exports.CIRCUIT_SESSION_FIELDS = (0, client_1.gql) `
46
+ fragment CircuitSessionFields on CircuitSession {
47
+ id
48
+ createdAt
49
+ updatedAt
50
+ circuitId
51
+ userId
52
+ mode
53
+ activeStationId
54
+ completed
55
+ completedAt
56
+ totalStations
57
+ attemptedCount
58
+ completedCount
59
+ score
60
+ }
61
+ `;
62
+ exports.CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS = (0, client_1.gql) `
63
+ ${osce_1.OSCE_STATION_FIELDS}
64
+ ${osce_1.OSCE_MARKSHEET_FIELDS}
65
+ ${exports.CIRCUIT_SESSION_FIELDS}
66
+ fragment CircuitSessionWithActiveStationFields on CircuitSession {
67
+ ...CircuitSessionFields
68
+ activeStation {
69
+ ...OsceStationFields
70
+ }
71
+ activeMarksheet {
72
+ ...OsceMarksheetFields
73
+ }
74
+ }
75
+ `;
76
+ exports.CIRCUIT_SESSION_WITH_MARKSHEETS_FIELDS = (0, client_1.gql) `
77
+ ${osce_1.OSCE_STATION_FIELDS}
78
+ ${osce_1.OSCE_MARKSHEET_FIELDS}
79
+ ${exports.CIRCUIT_SESSION_FIELDS}
80
+ ${exports.CIRCUIT_SESSION_MARKSHEET_FIELDS}
81
+ fragment CircuitSessionWithMarksheetsFields on CircuitSession {
82
+ ...CircuitSessionFields
83
+ marksheets {
84
+ ...CircuitSessionMarksheetFields
85
+ osceStation {
86
+ ...OsceStationFields
87
+ }
88
+ osceMarksheet {
89
+ ...OsceMarksheetFields
90
+ }
91
+ }
92
+ }
93
+ `;
@@ -1,4 +1,5 @@
1
1
  export * from './blog';
2
+ export * from './circuit';
2
3
  export * from './chapter';
3
4
  export * from './concept';
4
5
  export * from './highlight';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./blog"), exports);
18
+ __exportStar(require("./circuit"), exports);
18
19
  __exportStar(require("./chapter"), exports);
19
20
  __exportStar(require("./concept"), exports);
20
21
  __exportStar(require("./highlight"), exports);
@@ -0,0 +1,46 @@
1
+ import { ApolloCache } from '@apollo/client';
2
+ import { ICircuit, ICircuitSession, ICreateCircuitInput, IEditCircuitInput, Id } from '../../../models';
3
+ import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
4
+ import { RestrictedData, graphqlNormalize } from '../../types';
5
+ export declare const CREATE_CIRCUIT: import("@apollo/client").DocumentNode;
6
+ export interface ICreateCircuitVar {
7
+ input: ICreateCircuitInput;
8
+ }
9
+ export type ICreateCircuitData = RestrictedData<graphqlNormalize & ICircuit, 'createCircuit'>;
10
+ export declare const EDIT_CIRCUIT: import("@apollo/client").DocumentNode;
11
+ export interface IEditCircuitVar {
12
+ circuitId: Id;
13
+ input: IEditCircuitInput;
14
+ }
15
+ export type IEditCircuitData = RestrictedData<graphqlNormalize & ICircuit, 'editCircuit'>;
16
+ export declare const DELETE_CIRCUIT: import("@apollo/client").DocumentNode;
17
+ export interface IDeleteCircuitVar {
18
+ circuitId: Id;
19
+ }
20
+ export type IDeleteCircuitData = RestrictedData<boolean, 'deleteCircuit'>;
21
+ export declare const updateCacheOnDeleteCircuit: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IDeleteCircuitData>, options: ApolloUpdateOptions<IDeleteCircuitVar>) => void;
22
+ export declare const CREATE_CIRCUIT_SESSION: import("@apollo/client").DocumentNode;
23
+ export interface ICreateCircuitSessionVar {
24
+ circuitId: Id;
25
+ mode?: string;
26
+ }
27
+ export type ICreateCircuitSessionData = RestrictedData<graphqlNormalize & ICircuitSession, 'createCircuitSession'>;
28
+ export declare const RESUME_CIRCUIT_SESSION: import("@apollo/client").DocumentNode;
29
+ export interface IResumeCircuitSessionVar {
30
+ circuitSessionId: Id;
31
+ }
32
+ export type IResumeCircuitSessionData = RestrictedData<graphqlNormalize & ICircuitSession, 'resumeCircuitSession'>;
33
+ export declare const updateCacheOnResumeCircuitSession: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IResumeCircuitSessionData>) => void;
34
+ export declare const ADVANCE_CIRCUIT_SESSION: import("@apollo/client").DocumentNode;
35
+ export interface IAdvanceCircuitSessionVar {
36
+ circuitSessionId: Id;
37
+ }
38
+ export type IAdvanceCircuitSessionData = RestrictedData<graphqlNormalize & ICircuitSession, 'advanceCircuitSession'>;
39
+ export declare const updateCacheOnAdvanceCircuitSession: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAdvanceCircuitSessionData>) => void;
40
+ export declare const END_CIRCUIT_SESSION: import("@apollo/client").DocumentNode;
41
+ export interface IEndCircuitSessionVar {
42
+ circuitSessionId: Id;
43
+ }
44
+ export type IEndCircuitSessionData = RestrictedData<graphqlNormalize & ICircuitSession, 'endCircuitSession'>;
45
+ export declare const updateCacheOnEndCircuitSession: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IEndCircuitSessionData>, options: ApolloUpdateOptions<IEndCircuitSessionVar>) => void;
46
+ export declare const optimisticEndCircuitSession: (session: ICircuitSession) => IEndCircuitSessionData;
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.optimisticEndCircuitSession = exports.updateCacheOnEndCircuitSession = exports.END_CIRCUIT_SESSION = exports.updateCacheOnAdvanceCircuitSession = exports.ADVANCE_CIRCUIT_SESSION = exports.updateCacheOnResumeCircuitSession = exports.RESUME_CIRCUIT_SESSION = exports.CREATE_CIRCUIT_SESSION = exports.updateCacheOnDeleteCircuit = exports.DELETE_CIRCUIT = exports.EDIT_CIRCUIT = exports.CREATE_CIRCUIT = void 0;
4
+ const client_1 = require("@apollo/client");
5
+ const circuit_1 = require("../../fragments/circuit");
6
+ exports.CREATE_CIRCUIT = (0, client_1.gql) `
7
+ ${circuit_1.CIRCUIT_FIELDS}
8
+ mutation CreateCircuit($input: CreateCircuitInput!) {
9
+ restricted {
10
+ createCircuit(input: $input) {
11
+ ...CircuitFields
12
+ }
13
+ }
14
+ }
15
+ `;
16
+ exports.EDIT_CIRCUIT = (0, client_1.gql) `
17
+ ${circuit_1.CIRCUIT_FIELDS}
18
+ mutation EditCircuit($circuitId: Int!, $input: EditCircuitInput!) {
19
+ restricted {
20
+ editCircuit(circuitId: $circuitId, input: $input) {
21
+ ...CircuitFields
22
+ }
23
+ }
24
+ }
25
+ `;
26
+ exports.DELETE_CIRCUIT = (0, client_1.gql) `
27
+ mutation DeleteCircuit($circuitId: Int!) {
28
+ restricted {
29
+ deleteCircuit(circuitId: $circuitId)
30
+ }
31
+ }
32
+ `;
33
+ const updateCacheOnDeleteCircuit = (cache, result, options) => {
34
+ const { deleteCircuit } = result?.data?.restricted || {};
35
+ const { variables } = options || {};
36
+ if (!variables || !deleteCircuit) {
37
+ return;
38
+ }
39
+ cache.evict({
40
+ id: cache.identify({
41
+ id: variables.circuitId,
42
+ __typename: 'Circuit',
43
+ }),
44
+ });
45
+ cache.gc();
46
+ };
47
+ exports.updateCacheOnDeleteCircuit = updateCacheOnDeleteCircuit;
48
+ exports.CREATE_CIRCUIT_SESSION = (0, client_1.gql) `
49
+ ${circuit_1.CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS}
50
+ mutation CreateCircuitSession($circuitId: Int!, $mode: String) {
51
+ restricted {
52
+ createCircuitSession(circuitId: $circuitId, mode: $mode) {
53
+ ...CircuitSessionWithActiveStationFields
54
+ }
55
+ }
56
+ }
57
+ `;
58
+ exports.RESUME_CIRCUIT_SESSION = (0, client_1.gql) `
59
+ ${circuit_1.CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS}
60
+ mutation ResumeCircuitSession($circuitSessionId: Int!) {
61
+ restricted {
62
+ resumeCircuitSession(circuitSessionId: $circuitSessionId) {
63
+ ...CircuitSessionWithActiveStationFields
64
+ }
65
+ }
66
+ }
67
+ `;
68
+ const updateCacheOnCircuitSessionProgress = (cache, session) => {
69
+ if (!session) {
70
+ return;
71
+ }
72
+ cache.modify({
73
+ id: cache.identify({
74
+ id: session.id,
75
+ __typename: 'CircuitSession',
76
+ }),
77
+ fields: {
78
+ activeStationId: () => session.activeStationId,
79
+ attemptedCount: () => session.attemptedCount,
80
+ completed: () => session.completed,
81
+ completedAt: () => session.completedAt,
82
+ completedCount: () => session.completedCount,
83
+ mode: () => session.mode,
84
+ score: () => session.score,
85
+ totalStations: () => session.totalStations,
86
+ },
87
+ });
88
+ };
89
+ const updateCacheOnResumeCircuitSession = (cache, result) => {
90
+ updateCacheOnCircuitSessionProgress(cache, result?.data?.restricted?.resumeCircuitSession);
91
+ };
92
+ exports.updateCacheOnResumeCircuitSession = updateCacheOnResumeCircuitSession;
93
+ exports.ADVANCE_CIRCUIT_SESSION = (0, client_1.gql) `
94
+ ${circuit_1.CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS}
95
+ mutation AdvanceCircuitSession($circuitSessionId: Int!) {
96
+ restricted {
97
+ advanceCircuitSession(circuitSessionId: $circuitSessionId) {
98
+ ...CircuitSessionWithActiveStationFields
99
+ }
100
+ }
101
+ }
102
+ `;
103
+ const updateCacheOnAdvanceCircuitSession = (cache, result) => {
104
+ updateCacheOnCircuitSessionProgress(cache, result?.data?.restricted?.advanceCircuitSession);
105
+ };
106
+ exports.updateCacheOnAdvanceCircuitSession = updateCacheOnAdvanceCircuitSession;
107
+ exports.END_CIRCUIT_SESSION = (0, client_1.gql) `
108
+ mutation EndCircuitSession($circuitSessionId: Int!) {
109
+ restricted {
110
+ endCircuitSession(circuitSessionId: $circuitSessionId) {
111
+ id
112
+ completed
113
+ completedAt
114
+ attemptedCount
115
+ completedCount
116
+ score
117
+ activeStationId
118
+ }
119
+ }
120
+ }
121
+ `;
122
+ const updateCacheOnEndCircuitSession = (cache, result, options) => {
123
+ const { endCircuitSession } = result?.data?.restricted || {};
124
+ const { variables } = options || {};
125
+ if (!variables || !endCircuitSession) {
126
+ return;
127
+ }
128
+ cache.modify({
129
+ id: cache.identify({
130
+ id: endCircuitSession.id,
131
+ __typename: 'CircuitSession',
132
+ }),
133
+ fields: {
134
+ completed: () => true,
135
+ completedAt: () => endCircuitSession.completedAt,
136
+ attemptedCount: () => endCircuitSession.attemptedCount,
137
+ completedCount: () => endCircuitSession.completedCount,
138
+ score: () => endCircuitSession.score,
139
+ activeStationId: () => null,
140
+ },
141
+ });
142
+ };
143
+ exports.updateCacheOnEndCircuitSession = updateCacheOnEndCircuitSession;
144
+ const optimisticEndCircuitSession = (session) => ({
145
+ restricted: {
146
+ endCircuitSession: {
147
+ __typename: 'CircuitSession',
148
+ ...session,
149
+ completed: true,
150
+ activeStationId: null,
151
+ },
152
+ },
153
+ });
154
+ exports.optimisticEndCircuitSession = optimisticEndCircuitSession;
@@ -1,4 +1,5 @@
1
1
  export * from './agora';
2
+ export * from './circuit';
2
3
  export * from './book';
3
4
  export * from './chapter';
4
5
  export * from './contactUs';
@@ -15,6 +15,7 @@ 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("./circuit"), exports);
18
19
  __exportStar(require("./book"), exports);
19
20
  __exportStar(require("./chapter"), exports);
20
21
  __exportStar(require("./contactUs"), exports);
@@ -45,9 +45,11 @@ export declare const MARK_OSCE_MARKSHEET_MARK: import("@apollo/client").Document
45
45
  export interface IMarkOsceMarksheetMarkVar {
46
46
  osceMarksheetMarkId: Id;
47
47
  mark: number | EPaceMarkType;
48
+ corrected?: Boolean;
48
49
  }
49
50
  export type IMarkOsceMarksheetMarkData = RestrictedData<graphqlNormalize & Partial<IOsceMarksheetMark>, 'markOsceMarksheetMark'>;
50
51
  export declare const optimisticMarkOsceMarksheetMark: (variables: IMarkOsceMarksheetMarkVar, productType: EProductType) => IMarkOsceMarksheetMarkData;
52
+ export declare const updateCacheOnMarkOsceMarksheetMark: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IMarkOsceMarksheetMarkData>, options: ApolloUpdateOptions<IMarkOsceMarksheetMarkVar>) => void;
51
53
  export declare const SELECT_OSCE_STATION: import("@apollo/client").DocumentNode;
52
54
  export interface ISelectOsceMarksheetStationVar {
53
55
  osceMarksheetId: Id;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.END_VOICE_SESSION = exports.CREATE_VOICE_SESSION = exports.optimisticSetOsceMarksheetFeedback = exports.updateCacheOnSetOsceMarksheetFeedback = exports.SET_OSCE_MARKSHEET_FEEDBACK = exports.updateCacheOnAutoMarkOsceMarksheet = exports.AUTO_MARK_OSCE_MARKSHEET = exports.STREAM_OSCE_CHAT_MESSAGE = 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.END_VOICE_SESSION = exports.CREATE_VOICE_SESSION = exports.optimisticSetOsceMarksheetFeedback = exports.updateCacheOnSetOsceMarksheetFeedback = exports.SET_OSCE_MARKSHEET_FEEDBACK = exports.updateCacheOnAutoMarkOsceMarksheet = exports.AUTO_MARK_OSCE_MARKSHEET = exports.STREAM_OSCE_CHAT_MESSAGE = 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.updateCacheOnMarkOsceMarksheetMark = 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
6
  const fragments_1 = require("../../fragments");
@@ -84,11 +84,12 @@ exports.CHANGE_OSCE_ROLE = (0, client_1.gql) `
84
84
  }
85
85
  `;
86
86
  exports.MARK_OSCE_MARKSHEET_MARK = (0, client_1.gql) `
87
- mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!) {
87
+ mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!, $corrected: Boolean) {
88
88
  restricted {
89
89
  markOsceMarksheetMark(
90
90
  osceMarksheetMarkId: $osceMarksheetMarkId
91
91
  mark: $mark
92
+ corrected: $corrected
92
93
  ) {
93
94
  id
94
95
  selectedChoice
@@ -118,6 +119,63 @@ const optimisticMarkOsceMarksheetMark = (variables, productType) => {
118
119
  };
119
120
  };
120
121
  exports.optimisticMarkOsceMarksheetMark = optimisticMarkOsceMarksheetMark;
122
+ const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
123
+ const { markOsceMarksheetMark } = result?.data?.restricted || {};
124
+ const { variables } = options || {};
125
+ if (!variables || !markOsceMarksheetMark) {
126
+ return;
127
+ }
128
+ cache.modify({
129
+ id: cache.identify({
130
+ id: variables.osceMarksheetMarkId,
131
+ __typename: 'OsceMarksheetMark',
132
+ }),
133
+ fields: {
134
+ selectedChoice: () => markOsceMarksheetMark.selectedChoice,
135
+ mark: () => markOsceMarksheetMark.mark,
136
+ },
137
+ });
138
+ if (!variables.corrected) {
139
+ return;
140
+ }
141
+ const markEntity = cache.readFragment({
142
+ id: cache.identify({
143
+ id: variables.osceMarksheetMarkId,
144
+ __typename: 'OsceMarksheetMark',
145
+ }),
146
+ fragment: (0, client_1.gql) `
147
+ fragment OsceMarksheetMarkForScore on OsceMarksheetMark {
148
+ osceMarksheetId
149
+ }
150
+ `,
151
+ });
152
+ if (!markEntity?.osceMarksheetId) {
153
+ return;
154
+ }
155
+ const marksheetId = markEntity.osceMarksheetId;
156
+ const marksheet = cache.readFragment({
157
+ id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
158
+ fragment: (0, client_1.gql) `
159
+ fragment OsceMarksheetMarksForScore on OsceMarksheet {
160
+ marks {
161
+ mark
162
+ }
163
+ }
164
+ `,
165
+ });
166
+ if (!marksheet?.marks?.length) {
167
+ return;
168
+ }
169
+ const total = marksheet.marks.length;
170
+ const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
171
+ cache.modify({
172
+ id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
173
+ fields: {
174
+ score: () => scored / total,
175
+ },
176
+ });
177
+ };
178
+ exports.updateCacheOnMarkOsceMarksheetMark = updateCacheOnMarkOsceMarksheetMark;
121
179
  exports.SELECT_OSCE_STATION = (0, client_1.gql) `
122
180
  ${fragments_1.OSCE_STATION_FIELDS}
123
181
  ${fragments_1.OSCE_MARKSHEET_FIELDS}
@@ -0,0 +1,26 @@
1
+ import { ICircuit, ICircuitSession } from '../../../models';
2
+ import { RestrictedData, graphqlNormalize } from '../../types';
3
+ export interface ICircuitVar {
4
+ id: number;
5
+ }
6
+ export type ICircuitData = RestrictedData<graphqlNormalize & ICircuit, 'circuit'>;
7
+ export declare const CIRCUIT: import("@apollo/client").DocumentNode;
8
+ export interface ICircuitsVar {
9
+ search?: string;
10
+ limit?: number;
11
+ offset?: number;
12
+ }
13
+ export type ICircuitsData = RestrictedData<(graphqlNormalize & ICircuit)[], 'circuits'>;
14
+ export declare const CIRCUITS: import("@apollo/client").DocumentNode;
15
+ export interface ICircuitSessionVar {
16
+ id: number;
17
+ }
18
+ export type ICircuitSessionData = RestrictedData<graphqlNormalize & ICircuitSession, 'circuitSession'>;
19
+ export declare const CIRCUIT_SESSION: import("@apollo/client").DocumentNode;
20
+ export interface ICircuitSessionsVar {
21
+ completed?: boolean;
22
+ limit?: number;
23
+ offset?: number;
24
+ }
25
+ export type ICircuitSessionsData = RestrictedData<(graphqlNormalize & ICircuitSession)[], 'circuitSessions'>;
26
+ export declare const CIRCUIT_SESSIONS: import("@apollo/client").DocumentNode;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CIRCUIT_SESSIONS = exports.CIRCUIT_SESSION = exports.CIRCUITS = exports.CIRCUIT = void 0;
4
+ const client_1 = require("@apollo/client");
5
+ const circuit_1 = require("../../fragments/circuit");
6
+ const osce_1 = require("../../fragments/osce");
7
+ exports.CIRCUIT = (0, client_1.gql) `
8
+ ${circuit_1.CIRCUIT_FIELDS}
9
+ query Circuit($id: Int!) {
10
+ restricted {
11
+ circuit(id: $id) {
12
+ ...CircuitFields
13
+ circuitSession {
14
+ id
15
+ completed
16
+ completedAt
17
+ totalStations
18
+ attemptedCount
19
+ completedCount
20
+ score
21
+ }
22
+ }
23
+ }
24
+ }
25
+ `;
26
+ exports.CIRCUITS = (0, client_1.gql) `
27
+ ${circuit_1.CIRCUIT_FIELDS}
28
+ query Circuits($search: String, $limit: Int, $offset: Int) {
29
+ restricted {
30
+ circuits(search: $search, limit: $limit, offset: $offset) {
31
+ ...CircuitFields
32
+ circuitSession {
33
+ id
34
+ completed
35
+ completedAt
36
+ totalStations
37
+ attemptedCount
38
+ completedCount
39
+ score
40
+ }
41
+ }
42
+ }
43
+ }
44
+ `;
45
+ exports.CIRCUIT_SESSION = (0, client_1.gql) `
46
+ ${circuit_1.CIRCUIT_SESSION_WITH_MARKSHEETS_FIELDS}
47
+ ${osce_1.OSCE_STATION_FIELDS}
48
+ ${osce_1.OSCE_MARKSHEET_FIELDS}
49
+ query CircuitSession($id: Int!) {
50
+ restricted {
51
+ circuitSession(id: $id) {
52
+ ...CircuitSessionWithMarksheetsFields
53
+ activeStation {
54
+ ...OsceStationFields
55
+ }
56
+ activeMarksheet {
57
+ ...OsceMarksheetFields
58
+ }
59
+ circuit {
60
+ id
61
+ name
62
+ preDefined
63
+ }
64
+ }
65
+ }
66
+ }
67
+ `;
68
+ exports.CIRCUIT_SESSIONS = (0, client_1.gql) `
69
+ ${circuit_1.CIRCUIT_SESSION_WITH_MARKSHEETS_FIELDS}
70
+ query CircuitSessions($completed: Boolean, $limit: Int, $offset: Int) {
71
+ restricted {
72
+ circuitSessions(completed: $completed, limit: $limit, offset: $offset) {
73
+ ...CircuitSessionWithMarksheetsFields
74
+ circuit {
75
+ id
76
+ name
77
+ preDefined
78
+ }
79
+ }
80
+ }
81
+ }
82
+ `;
@@ -1,4 +1,5 @@
1
1
  export * from './analytics';
2
+ export * from './circuit';
2
3
  export * from './chapter';
3
4
  export * from './concepts';
4
5
  export * from './global';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./analytics"), exports);
18
+ __exportStar(require("./circuit"), exports);
18
19
  __exportStar(require("./chapter"), exports);
19
20
  __exportStar(require("./concepts"), exports);
20
21
  __exportStar(require("./global"), exports);
@@ -0,0 +1,56 @@
1
+ import { IOsceMarksheet } from './OsceMarksheet';
2
+ import { IOsceStation } from './OsceStation';
3
+ import { Id } from './Type';
4
+ export interface ICircuitStationInput {
5
+ osceStationId: number;
6
+ sortOrder: number;
7
+ }
8
+ export interface ICreateCircuitInput {
9
+ name: string;
10
+ stations: ICircuitStationInput[];
11
+ }
12
+ export interface IEditCircuitInput {
13
+ name?: string;
14
+ stations?: ICircuitStationInput[];
15
+ }
16
+ export interface ICircuit {
17
+ id: Id;
18
+ createdAt: number | Date;
19
+ updatedAt: number | Date;
20
+ userId: number;
21
+ name: string;
22
+ preDefined: boolean;
23
+ stations?: IOsceStation[];
24
+ circuitSession?: ICircuitSession | null;
25
+ }
26
+ export interface ICircuitSession {
27
+ id: Id;
28
+ createdAt: number | Date;
29
+ updatedAt: number | Date;
30
+ circuitId: number;
31
+ userId: number;
32
+ mode: string;
33
+ activeStationId: number | null;
34
+ completed: boolean;
35
+ completedAt: number | Date | null;
36
+ totalStations: number;
37
+ attemptedCount: number;
38
+ completedCount: number;
39
+ score: number | null;
40
+ circuit?: ICircuit;
41
+ activeStation?: IOsceStation | null;
42
+ activeMarksheet?: IOsceMarksheet | null;
43
+ marksheets?: ICircuitSessionMarksheet[];
44
+ }
45
+ export interface ICircuitSessionMarksheet {
46
+ id: Id;
47
+ createdAt: number | Date;
48
+ updatedAt: number | Date;
49
+ circuitSessionId: number;
50
+ osceStationId: number;
51
+ osceMarksheetId: number | null;
52
+ startedAt: number | Date | null;
53
+ endedAt: number | Date | null;
54
+ osceStation?: IOsceStation;
55
+ osceMarksheet?: IOsceMarksheet | null;
56
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  export * from './AdminNotification';
2
+ export * from './Circuit';
2
3
  export * from './Author';
3
4
  export * from './Blog';
4
5
  export * from './Book';
@@ -1,4 +1,5 @@
1
1
  export * from './AdminNotification';
2
+ export * from './Circuit';
2
3
  export * from './Author';
3
4
  export * from './Blog';
4
5
  export * from './Book';
@@ -0,0 +1,5 @@
1
+ export declare const CIRCUIT_FIELDS: import("@apollo/client").DocumentNode;
2
+ export declare const CIRCUIT_SESSION_MARKSHEET_FIELDS: import("@apollo/client").DocumentNode;
3
+ export declare const CIRCUIT_SESSION_FIELDS: import("@apollo/client").DocumentNode;
4
+ export declare const CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS: import("@apollo/client").DocumentNode;
5
+ export declare const CIRCUIT_SESSION_WITH_MARKSHEETS_FIELDS: import("@apollo/client").DocumentNode;
@@ -0,0 +1,90 @@
1
+ import { gql } from '@apollo/client';
2
+ import { OSCE_MARKSHEET_FIELDS, OSCE_STATION_FIELDS } from './osce';
3
+ import { PICTURE_FIELDS } from './picture';
4
+ export const CIRCUIT_FIELDS = gql `
5
+ ${PICTURE_FIELDS}
6
+ fragment CircuitFields on Circuit {
7
+ id
8
+ createdAt
9
+ updatedAt
10
+ userId
11
+ name
12
+ preDefined
13
+ stations {
14
+ id
15
+ name
16
+ aiEnabled
17
+ phaseTimers
18
+ hiddenName
19
+ osceType {
20
+ id
21
+ name
22
+ }
23
+ picture {
24
+ ...PictureFields
25
+ }
26
+ difficulty
27
+ }
28
+ }
29
+ `;
30
+ export const CIRCUIT_SESSION_MARKSHEET_FIELDS = gql `
31
+ fragment CircuitSessionMarksheetFields on CircuitSessionMarksheet {
32
+ id
33
+ createdAt
34
+ updatedAt
35
+ circuitSessionId
36
+ osceStationId
37
+ osceMarksheetId
38
+ startedAt
39
+ endedAt
40
+ }
41
+ `;
42
+ export const CIRCUIT_SESSION_FIELDS = gql `
43
+ fragment CircuitSessionFields on CircuitSession {
44
+ id
45
+ createdAt
46
+ updatedAt
47
+ circuitId
48
+ userId
49
+ mode
50
+ activeStationId
51
+ completed
52
+ completedAt
53
+ totalStations
54
+ attemptedCount
55
+ completedCount
56
+ score
57
+ }
58
+ `;
59
+ export const CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS = gql `
60
+ ${OSCE_STATION_FIELDS}
61
+ ${OSCE_MARKSHEET_FIELDS}
62
+ ${CIRCUIT_SESSION_FIELDS}
63
+ fragment CircuitSessionWithActiveStationFields on CircuitSession {
64
+ ...CircuitSessionFields
65
+ activeStation {
66
+ ...OsceStationFields
67
+ }
68
+ activeMarksheet {
69
+ ...OsceMarksheetFields
70
+ }
71
+ }
72
+ `;
73
+ export const CIRCUIT_SESSION_WITH_MARKSHEETS_FIELDS = gql `
74
+ ${OSCE_STATION_FIELDS}
75
+ ${OSCE_MARKSHEET_FIELDS}
76
+ ${CIRCUIT_SESSION_FIELDS}
77
+ ${CIRCUIT_SESSION_MARKSHEET_FIELDS}
78
+ fragment CircuitSessionWithMarksheetsFields on CircuitSession {
79
+ ...CircuitSessionFields
80
+ marksheets {
81
+ ...CircuitSessionMarksheetFields
82
+ osceStation {
83
+ ...OsceStationFields
84
+ }
85
+ osceMarksheet {
86
+ ...OsceMarksheetFields
87
+ }
88
+ }
89
+ }
90
+ `;
@@ -1,4 +1,5 @@
1
1
  export * from './blog';
2
+ export * from './circuit';
2
3
  export * from './chapter';
3
4
  export * from './concept';
4
5
  export * from './highlight';
@@ -1,4 +1,5 @@
1
1
  export * from './blog';
2
+ export * from './circuit';
2
3
  export * from './chapter';
3
4
  export * from './concept';
4
5
  export * from './highlight';
@@ -0,0 +1,46 @@
1
+ import { ApolloCache } from '@apollo/client';
2
+ import { ICircuit, ICircuitSession, ICreateCircuitInput, IEditCircuitInput, Id } from '../../../models';
3
+ import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
4
+ import { RestrictedData, graphqlNormalize } from '../../types';
5
+ export declare const CREATE_CIRCUIT: import("@apollo/client").DocumentNode;
6
+ export interface ICreateCircuitVar {
7
+ input: ICreateCircuitInput;
8
+ }
9
+ export type ICreateCircuitData = RestrictedData<graphqlNormalize & ICircuit, 'createCircuit'>;
10
+ export declare const EDIT_CIRCUIT: import("@apollo/client").DocumentNode;
11
+ export interface IEditCircuitVar {
12
+ circuitId: Id;
13
+ input: IEditCircuitInput;
14
+ }
15
+ export type IEditCircuitData = RestrictedData<graphqlNormalize & ICircuit, 'editCircuit'>;
16
+ export declare const DELETE_CIRCUIT: import("@apollo/client").DocumentNode;
17
+ export interface IDeleteCircuitVar {
18
+ circuitId: Id;
19
+ }
20
+ export type IDeleteCircuitData = RestrictedData<boolean, 'deleteCircuit'>;
21
+ export declare const updateCacheOnDeleteCircuit: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IDeleteCircuitData>, options: ApolloUpdateOptions<IDeleteCircuitVar>) => void;
22
+ export declare const CREATE_CIRCUIT_SESSION: import("@apollo/client").DocumentNode;
23
+ export interface ICreateCircuitSessionVar {
24
+ circuitId: Id;
25
+ mode?: string;
26
+ }
27
+ export type ICreateCircuitSessionData = RestrictedData<graphqlNormalize & ICircuitSession, 'createCircuitSession'>;
28
+ export declare const RESUME_CIRCUIT_SESSION: import("@apollo/client").DocumentNode;
29
+ export interface IResumeCircuitSessionVar {
30
+ circuitSessionId: Id;
31
+ }
32
+ export type IResumeCircuitSessionData = RestrictedData<graphqlNormalize & ICircuitSession, 'resumeCircuitSession'>;
33
+ export declare const updateCacheOnResumeCircuitSession: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IResumeCircuitSessionData>) => void;
34
+ export declare const ADVANCE_CIRCUIT_SESSION: import("@apollo/client").DocumentNode;
35
+ export interface IAdvanceCircuitSessionVar {
36
+ circuitSessionId: Id;
37
+ }
38
+ export type IAdvanceCircuitSessionData = RestrictedData<graphqlNormalize & ICircuitSession, 'advanceCircuitSession'>;
39
+ export declare const updateCacheOnAdvanceCircuitSession: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAdvanceCircuitSessionData>) => void;
40
+ export declare const END_CIRCUIT_SESSION: import("@apollo/client").DocumentNode;
41
+ export interface IEndCircuitSessionVar {
42
+ circuitSessionId: Id;
43
+ }
44
+ export type IEndCircuitSessionData = RestrictedData<graphqlNormalize & ICircuitSession, 'endCircuitSession'>;
45
+ export declare const updateCacheOnEndCircuitSession: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IEndCircuitSessionData>, options: ApolloUpdateOptions<IEndCircuitSessionVar>) => void;
46
+ export declare const optimisticEndCircuitSession: (session: ICircuitSession) => IEndCircuitSessionData;
@@ -0,0 +1,146 @@
1
+ import { gql } from '@apollo/client';
2
+ import { CIRCUIT_FIELDS, CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS, } from '../../fragments/circuit';
3
+ export const CREATE_CIRCUIT = gql `
4
+ ${CIRCUIT_FIELDS}
5
+ mutation CreateCircuit($input: CreateCircuitInput!) {
6
+ restricted {
7
+ createCircuit(input: $input) {
8
+ ...CircuitFields
9
+ }
10
+ }
11
+ }
12
+ `;
13
+ export const EDIT_CIRCUIT = gql `
14
+ ${CIRCUIT_FIELDS}
15
+ mutation EditCircuit($circuitId: Int!, $input: EditCircuitInput!) {
16
+ restricted {
17
+ editCircuit(circuitId: $circuitId, input: $input) {
18
+ ...CircuitFields
19
+ }
20
+ }
21
+ }
22
+ `;
23
+ export const DELETE_CIRCUIT = gql `
24
+ mutation DeleteCircuit($circuitId: Int!) {
25
+ restricted {
26
+ deleteCircuit(circuitId: $circuitId)
27
+ }
28
+ }
29
+ `;
30
+ export const updateCacheOnDeleteCircuit = (cache, result, options) => {
31
+ const { deleteCircuit } = result?.data?.restricted || {};
32
+ const { variables } = options || {};
33
+ if (!variables || !deleteCircuit) {
34
+ return;
35
+ }
36
+ cache.evict({
37
+ id: cache.identify({
38
+ id: variables.circuitId,
39
+ __typename: 'Circuit',
40
+ }),
41
+ });
42
+ cache.gc();
43
+ };
44
+ export const CREATE_CIRCUIT_SESSION = gql `
45
+ ${CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS}
46
+ mutation CreateCircuitSession($circuitId: Int!, $mode: String) {
47
+ restricted {
48
+ createCircuitSession(circuitId: $circuitId, mode: $mode) {
49
+ ...CircuitSessionWithActiveStationFields
50
+ }
51
+ }
52
+ }
53
+ `;
54
+ export const RESUME_CIRCUIT_SESSION = gql `
55
+ ${CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS}
56
+ mutation ResumeCircuitSession($circuitSessionId: Int!) {
57
+ restricted {
58
+ resumeCircuitSession(circuitSessionId: $circuitSessionId) {
59
+ ...CircuitSessionWithActiveStationFields
60
+ }
61
+ }
62
+ }
63
+ `;
64
+ const updateCacheOnCircuitSessionProgress = (cache, session) => {
65
+ if (!session) {
66
+ return;
67
+ }
68
+ cache.modify({
69
+ id: cache.identify({
70
+ id: session.id,
71
+ __typename: 'CircuitSession',
72
+ }),
73
+ fields: {
74
+ activeStationId: () => session.activeStationId,
75
+ attemptedCount: () => session.attemptedCount,
76
+ completed: () => session.completed,
77
+ completedAt: () => session.completedAt,
78
+ completedCount: () => session.completedCount,
79
+ mode: () => session.mode,
80
+ score: () => session.score,
81
+ totalStations: () => session.totalStations,
82
+ },
83
+ });
84
+ };
85
+ export const updateCacheOnResumeCircuitSession = (cache, result) => {
86
+ updateCacheOnCircuitSessionProgress(cache, result?.data?.restricted?.resumeCircuitSession);
87
+ };
88
+ export const ADVANCE_CIRCUIT_SESSION = gql `
89
+ ${CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS}
90
+ mutation AdvanceCircuitSession($circuitSessionId: Int!) {
91
+ restricted {
92
+ advanceCircuitSession(circuitSessionId: $circuitSessionId) {
93
+ ...CircuitSessionWithActiveStationFields
94
+ }
95
+ }
96
+ }
97
+ `;
98
+ export const updateCacheOnAdvanceCircuitSession = (cache, result) => {
99
+ updateCacheOnCircuitSessionProgress(cache, result?.data?.restricted?.advanceCircuitSession);
100
+ };
101
+ export const END_CIRCUIT_SESSION = gql `
102
+ mutation EndCircuitSession($circuitSessionId: Int!) {
103
+ restricted {
104
+ endCircuitSession(circuitSessionId: $circuitSessionId) {
105
+ id
106
+ completed
107
+ completedAt
108
+ attemptedCount
109
+ completedCount
110
+ score
111
+ activeStationId
112
+ }
113
+ }
114
+ }
115
+ `;
116
+ export const updateCacheOnEndCircuitSession = (cache, result, options) => {
117
+ const { endCircuitSession } = result?.data?.restricted || {};
118
+ const { variables } = options || {};
119
+ if (!variables || !endCircuitSession) {
120
+ return;
121
+ }
122
+ cache.modify({
123
+ id: cache.identify({
124
+ id: endCircuitSession.id,
125
+ __typename: 'CircuitSession',
126
+ }),
127
+ fields: {
128
+ completed: () => true,
129
+ completedAt: () => endCircuitSession.completedAt,
130
+ attemptedCount: () => endCircuitSession.attemptedCount,
131
+ completedCount: () => endCircuitSession.completedCount,
132
+ score: () => endCircuitSession.score,
133
+ activeStationId: () => null,
134
+ },
135
+ });
136
+ };
137
+ export const optimisticEndCircuitSession = (session) => ({
138
+ restricted: {
139
+ endCircuitSession: {
140
+ __typename: 'CircuitSession',
141
+ ...session,
142
+ completed: true,
143
+ activeStationId: null,
144
+ },
145
+ },
146
+ });
@@ -1,4 +1,5 @@
1
1
  export * from './agora';
2
+ export * from './circuit';
2
3
  export * from './book';
3
4
  export * from './chapter';
4
5
  export * from './contactUs';
@@ -1,4 +1,5 @@
1
1
  export * from './agora';
2
+ export * from './circuit';
2
3
  export * from './book';
3
4
  export * from './chapter';
4
5
  export * from './contactUs';
@@ -45,9 +45,11 @@ export declare const MARK_OSCE_MARKSHEET_MARK: import("@apollo/client").Document
45
45
  export interface IMarkOsceMarksheetMarkVar {
46
46
  osceMarksheetMarkId: Id;
47
47
  mark: number | EPaceMarkType;
48
+ corrected?: Boolean;
48
49
  }
49
50
  export type IMarkOsceMarksheetMarkData = RestrictedData<graphqlNormalize & Partial<IOsceMarksheetMark>, 'markOsceMarksheetMark'>;
50
51
  export declare const optimisticMarkOsceMarksheetMark: (variables: IMarkOsceMarksheetMarkVar, productType: EProductType) => IMarkOsceMarksheetMarkData;
52
+ export declare const updateCacheOnMarkOsceMarksheetMark: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IMarkOsceMarksheetMarkData>, options: ApolloUpdateOptions<IMarkOsceMarksheetMarkVar>) => void;
51
53
  export declare const SELECT_OSCE_STATION: import("@apollo/client").DocumentNode;
52
54
  export interface ISelectOsceMarksheetStationVar {
53
55
  osceMarksheetId: Id;
@@ -81,11 +81,12 @@ export const CHANGE_OSCE_ROLE = gql `
81
81
  }
82
82
  `;
83
83
  export const MARK_OSCE_MARKSHEET_MARK = gql `
84
- mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!) {
84
+ mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!, $corrected: Boolean) {
85
85
  restricted {
86
86
  markOsceMarksheetMark(
87
87
  osceMarksheetMarkId: $osceMarksheetMarkId
88
88
  mark: $mark
89
+ corrected: $corrected
89
90
  ) {
90
91
  id
91
92
  selectedChoice
@@ -114,6 +115,62 @@ export const optimisticMarkOsceMarksheetMark = (variables, productType) => {
114
115
  },
115
116
  };
116
117
  };
118
+ export const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
119
+ const { markOsceMarksheetMark } = result?.data?.restricted || {};
120
+ const { variables } = options || {};
121
+ if (!variables || !markOsceMarksheetMark) {
122
+ return;
123
+ }
124
+ cache.modify({
125
+ id: cache.identify({
126
+ id: variables.osceMarksheetMarkId,
127
+ __typename: 'OsceMarksheetMark',
128
+ }),
129
+ fields: {
130
+ selectedChoice: () => markOsceMarksheetMark.selectedChoice,
131
+ mark: () => markOsceMarksheetMark.mark,
132
+ },
133
+ });
134
+ if (!variables.corrected) {
135
+ return;
136
+ }
137
+ const markEntity = cache.readFragment({
138
+ id: cache.identify({
139
+ id: variables.osceMarksheetMarkId,
140
+ __typename: 'OsceMarksheetMark',
141
+ }),
142
+ fragment: gql `
143
+ fragment OsceMarksheetMarkForScore on OsceMarksheetMark {
144
+ osceMarksheetId
145
+ }
146
+ `,
147
+ });
148
+ if (!markEntity?.osceMarksheetId) {
149
+ return;
150
+ }
151
+ const marksheetId = markEntity.osceMarksheetId;
152
+ const marksheet = cache.readFragment({
153
+ id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
154
+ fragment: gql `
155
+ fragment OsceMarksheetMarksForScore on OsceMarksheet {
156
+ marks {
157
+ mark
158
+ }
159
+ }
160
+ `,
161
+ });
162
+ if (!marksheet?.marks?.length) {
163
+ return;
164
+ }
165
+ const total = marksheet.marks.length;
166
+ const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
167
+ cache.modify({
168
+ id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
169
+ fields: {
170
+ score: () => scored / total,
171
+ },
172
+ });
173
+ };
117
174
  export const SELECT_OSCE_STATION = gql `
118
175
  ${OSCE_STATION_FIELDS}
119
176
  ${OSCE_MARKSHEET_FIELDS}
@@ -0,0 +1,26 @@
1
+ import { ICircuit, ICircuitSession } from '../../../models';
2
+ import { RestrictedData, graphqlNormalize } from '../../types';
3
+ export interface ICircuitVar {
4
+ id: number;
5
+ }
6
+ export type ICircuitData = RestrictedData<graphqlNormalize & ICircuit, 'circuit'>;
7
+ export declare const CIRCUIT: import("@apollo/client").DocumentNode;
8
+ export interface ICircuitsVar {
9
+ search?: string;
10
+ limit?: number;
11
+ offset?: number;
12
+ }
13
+ export type ICircuitsData = RestrictedData<(graphqlNormalize & ICircuit)[], 'circuits'>;
14
+ export declare const CIRCUITS: import("@apollo/client").DocumentNode;
15
+ export interface ICircuitSessionVar {
16
+ id: number;
17
+ }
18
+ export type ICircuitSessionData = RestrictedData<graphqlNormalize & ICircuitSession, 'circuitSession'>;
19
+ export declare const CIRCUIT_SESSION: import("@apollo/client").DocumentNode;
20
+ export interface ICircuitSessionsVar {
21
+ completed?: boolean;
22
+ limit?: number;
23
+ offset?: number;
24
+ }
25
+ export type ICircuitSessionsData = RestrictedData<(graphqlNormalize & ICircuitSession)[], 'circuitSessions'>;
26
+ export declare const CIRCUIT_SESSIONS: import("@apollo/client").DocumentNode;
@@ -0,0 +1,79 @@
1
+ import { gql } from '@apollo/client';
2
+ import { CIRCUIT_FIELDS, CIRCUIT_SESSION_WITH_MARKSHEETS_FIELDS, } from '../../fragments/circuit';
3
+ import { OSCE_MARKSHEET_FIELDS, OSCE_STATION_FIELDS } from '../../fragments/osce';
4
+ export const CIRCUIT = gql `
5
+ ${CIRCUIT_FIELDS}
6
+ query Circuit($id: Int!) {
7
+ restricted {
8
+ circuit(id: $id) {
9
+ ...CircuitFields
10
+ circuitSession {
11
+ id
12
+ completed
13
+ completedAt
14
+ totalStations
15
+ attemptedCount
16
+ completedCount
17
+ score
18
+ }
19
+ }
20
+ }
21
+ }
22
+ `;
23
+ export const CIRCUITS = gql `
24
+ ${CIRCUIT_FIELDS}
25
+ query Circuits($search: String, $limit: Int, $offset: Int) {
26
+ restricted {
27
+ circuits(search: $search, limit: $limit, offset: $offset) {
28
+ ...CircuitFields
29
+ circuitSession {
30
+ id
31
+ completed
32
+ completedAt
33
+ totalStations
34
+ attemptedCount
35
+ completedCount
36
+ score
37
+ }
38
+ }
39
+ }
40
+ }
41
+ `;
42
+ export const CIRCUIT_SESSION = gql `
43
+ ${CIRCUIT_SESSION_WITH_MARKSHEETS_FIELDS}
44
+ ${OSCE_STATION_FIELDS}
45
+ ${OSCE_MARKSHEET_FIELDS}
46
+ query CircuitSession($id: Int!) {
47
+ restricted {
48
+ circuitSession(id: $id) {
49
+ ...CircuitSessionWithMarksheetsFields
50
+ activeStation {
51
+ ...OsceStationFields
52
+ }
53
+ activeMarksheet {
54
+ ...OsceMarksheetFields
55
+ }
56
+ circuit {
57
+ id
58
+ name
59
+ preDefined
60
+ }
61
+ }
62
+ }
63
+ }
64
+ `;
65
+ export const CIRCUIT_SESSIONS = gql `
66
+ ${CIRCUIT_SESSION_WITH_MARKSHEETS_FIELDS}
67
+ query CircuitSessions($completed: Boolean, $limit: Int, $offset: Int) {
68
+ restricted {
69
+ circuitSessions(completed: $completed, limit: $limit, offset: $offset) {
70
+ ...CircuitSessionWithMarksheetsFields
71
+ circuit {
72
+ id
73
+ name
74
+ preDefined
75
+ }
76
+ }
77
+ }
78
+ }
79
+ `;
@@ -1,4 +1,5 @@
1
1
  export * from './analytics';
2
+ export * from './circuit';
2
3
  export * from './chapter';
3
4
  export * from './concepts';
4
5
  export * from './global';
@@ -1,4 +1,5 @@
1
1
  export * from './analytics';
2
+ export * from './circuit';
2
3
  export * from './chapter';
3
4
  export * from './concepts';
4
5
  export * from './global';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.259",
3
+ "version": "2.6.261",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",