@quesmed/types 2.6.260 → 2.6.262

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 (33) hide show
  1. package/dist/cjs/models/Circuit.d.ts +57 -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 +94 -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/query/restricted/circuit.d.ts +26 -0
  14. package/dist/cjs/resolvers/query/restricted/circuit.js +82 -0
  15. package/dist/cjs/resolvers/query/restricted/index.d.ts +1 -0
  16. package/dist/cjs/resolvers/query/restricted/index.js +1 -0
  17. package/dist/mjs/models/Circuit.d.ts +57 -0
  18. package/dist/mjs/models/Circuit.js +1 -0
  19. package/dist/mjs/models/index.d.ts +1 -0
  20. package/dist/mjs/models/index.js +1 -0
  21. package/dist/mjs/resolvers/fragments/circuit.d.ts +5 -0
  22. package/dist/mjs/resolvers/fragments/circuit.js +91 -0
  23. package/dist/mjs/resolvers/fragments/index.d.ts +1 -0
  24. package/dist/mjs/resolvers/fragments/index.js +1 -0
  25. package/dist/mjs/resolvers/mutation/restricted/circuit.d.ts +46 -0
  26. package/dist/mjs/resolvers/mutation/restricted/circuit.js +146 -0
  27. package/dist/mjs/resolvers/mutation/restricted/index.d.ts +1 -0
  28. package/dist/mjs/resolvers/mutation/restricted/index.js +1 -0
  29. package/dist/mjs/resolvers/query/restricted/circuit.d.ts +26 -0
  30. package/dist/mjs/resolvers/query/restricted/circuit.js +79 -0
  31. package/dist/mjs/resolvers/query/restricted/index.d.ts +1 -0
  32. package/dist/mjs/resolvers/query/restricted/index.js +1 -0
  33. package/package.json +1 -1
@@ -0,0 +1,57 @@
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
+ description: string;
22
+ name: string;
23
+ preDefined: boolean;
24
+ stations?: IOsceStation[];
25
+ circuitSession?: ICircuitSession | null;
26
+ }
27
+ export interface ICircuitSession {
28
+ id: Id;
29
+ createdAt: number | Date;
30
+ updatedAt: number | Date;
31
+ circuitId: number;
32
+ userId: number;
33
+ mode: string;
34
+ activeStationId: number | null;
35
+ completed: boolean;
36
+ completedAt: number | Date | null;
37
+ totalStations: number;
38
+ attemptedCount: number;
39
+ completedCount: number;
40
+ score: number | null;
41
+ circuit?: ICircuit;
42
+ activeStation?: IOsceStation | null;
43
+ activeMarksheet?: IOsceMarksheet | null;
44
+ marksheets?: ICircuitSessionMarksheet[];
45
+ }
46
+ export interface ICircuitSessionMarksheet {
47
+ id: Id;
48
+ createdAt: number | Date;
49
+ updatedAt: number | Date;
50
+ circuitSessionId: number;
51
+ osceStationId: number;
52
+ osceMarksheetId: number | null;
53
+ startedAt: number | Date | null;
54
+ endedAt: number | Date | null;
55
+ osceStation?: IOsceStation;
56
+ osceMarksheet?: IOsceMarksheet | null;
57
+ }
@@ -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,94 @@
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
+ description
16
+ preDefined
17
+ stations {
18
+ id
19
+ name
20
+ aiEnabled
21
+ phaseTimers
22
+ hiddenName
23
+ osceType {
24
+ id
25
+ name
26
+ }
27
+ picture {
28
+ ...PictureFields
29
+ }
30
+ difficulty
31
+ }
32
+ }
33
+ `;
34
+ exports.CIRCUIT_SESSION_MARKSHEET_FIELDS = (0, client_1.gql) `
35
+ fragment CircuitSessionMarksheetFields on CircuitSessionMarksheet {
36
+ id
37
+ createdAt
38
+ updatedAt
39
+ circuitSessionId
40
+ osceStationId
41
+ osceMarksheetId
42
+ startedAt
43
+ endedAt
44
+ }
45
+ `;
46
+ exports.CIRCUIT_SESSION_FIELDS = (0, client_1.gql) `
47
+ fragment CircuitSessionFields on CircuitSession {
48
+ id
49
+ createdAt
50
+ updatedAt
51
+ circuitId
52
+ userId
53
+ mode
54
+ activeStationId
55
+ completed
56
+ completedAt
57
+ totalStations
58
+ attemptedCount
59
+ completedCount
60
+ score
61
+ }
62
+ `;
63
+ exports.CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS = (0, client_1.gql) `
64
+ ${osce_1.OSCE_STATION_FIELDS}
65
+ ${osce_1.OSCE_MARKSHEET_FIELDS}
66
+ ${exports.CIRCUIT_SESSION_FIELDS}
67
+ fragment CircuitSessionWithActiveStationFields on CircuitSession {
68
+ ...CircuitSessionFields
69
+ activeStation {
70
+ ...OsceStationFields
71
+ }
72
+ activeMarksheet {
73
+ ...OsceMarksheetFields
74
+ }
75
+ }
76
+ `;
77
+ exports.CIRCUIT_SESSION_WITH_MARKSHEETS_FIELDS = (0, client_1.gql) `
78
+ ${osce_1.OSCE_STATION_FIELDS}
79
+ ${osce_1.OSCE_MARKSHEET_FIELDS}
80
+ ${exports.CIRCUIT_SESSION_FIELDS}
81
+ ${exports.CIRCUIT_SESSION_MARKSHEET_FIELDS}
82
+ fragment CircuitSessionWithMarksheetsFields on CircuitSession {
83
+ ...CircuitSessionFields
84
+ marksheets {
85
+ ...CircuitSessionMarksheetFields
86
+ osceStation {
87
+ ...OsceStationFields
88
+ }
89
+ osceMarksheet {
90
+ ...OsceMarksheetFields
91
+ }
92
+ }
93
+ }
94
+ `;
@@ -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);
@@ -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,57 @@
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
+ description: string;
22
+ name: string;
23
+ preDefined: boolean;
24
+ stations?: IOsceStation[];
25
+ circuitSession?: ICircuitSession | null;
26
+ }
27
+ export interface ICircuitSession {
28
+ id: Id;
29
+ createdAt: number | Date;
30
+ updatedAt: number | Date;
31
+ circuitId: number;
32
+ userId: number;
33
+ mode: string;
34
+ activeStationId: number | null;
35
+ completed: boolean;
36
+ completedAt: number | Date | null;
37
+ totalStations: number;
38
+ attemptedCount: number;
39
+ completedCount: number;
40
+ score: number | null;
41
+ circuit?: ICircuit;
42
+ activeStation?: IOsceStation | null;
43
+ activeMarksheet?: IOsceMarksheet | null;
44
+ marksheets?: ICircuitSessionMarksheet[];
45
+ }
46
+ export interface ICircuitSessionMarksheet {
47
+ id: Id;
48
+ createdAt: number | Date;
49
+ updatedAt: number | Date;
50
+ circuitSessionId: number;
51
+ osceStationId: number;
52
+ osceMarksheetId: number | null;
53
+ startedAt: number | Date | null;
54
+ endedAt: number | Date | null;
55
+ osceStation?: IOsceStation;
56
+ osceMarksheet?: IOsceMarksheet | null;
57
+ }
@@ -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,91 @@
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
+ description
13
+ preDefined
14
+ stations {
15
+ id
16
+ name
17
+ aiEnabled
18
+ phaseTimers
19
+ hiddenName
20
+ osceType {
21
+ id
22
+ name
23
+ }
24
+ picture {
25
+ ...PictureFields
26
+ }
27
+ difficulty
28
+ }
29
+ }
30
+ `;
31
+ export const CIRCUIT_SESSION_MARKSHEET_FIELDS = gql `
32
+ fragment CircuitSessionMarksheetFields on CircuitSessionMarksheet {
33
+ id
34
+ createdAt
35
+ updatedAt
36
+ circuitSessionId
37
+ osceStationId
38
+ osceMarksheetId
39
+ startedAt
40
+ endedAt
41
+ }
42
+ `;
43
+ export const CIRCUIT_SESSION_FIELDS = gql `
44
+ fragment CircuitSessionFields on CircuitSession {
45
+ id
46
+ createdAt
47
+ updatedAt
48
+ circuitId
49
+ userId
50
+ mode
51
+ activeStationId
52
+ completed
53
+ completedAt
54
+ totalStations
55
+ attemptedCount
56
+ completedCount
57
+ score
58
+ }
59
+ `;
60
+ export const CIRCUIT_SESSION_WITH_ACTIVE_STATION_FIELDS = gql `
61
+ ${OSCE_STATION_FIELDS}
62
+ ${OSCE_MARKSHEET_FIELDS}
63
+ ${CIRCUIT_SESSION_FIELDS}
64
+ fragment CircuitSessionWithActiveStationFields on CircuitSession {
65
+ ...CircuitSessionFields
66
+ activeStation {
67
+ ...OsceStationFields
68
+ }
69
+ activeMarksheet {
70
+ ...OsceMarksheetFields
71
+ }
72
+ }
73
+ `;
74
+ export const CIRCUIT_SESSION_WITH_MARKSHEETS_FIELDS = gql `
75
+ ${OSCE_STATION_FIELDS}
76
+ ${OSCE_MARKSHEET_FIELDS}
77
+ ${CIRCUIT_SESSION_FIELDS}
78
+ ${CIRCUIT_SESSION_MARKSHEET_FIELDS}
79
+ fragment CircuitSessionWithMarksheetsFields on CircuitSession {
80
+ ...CircuitSessionFields
81
+ marksheets {
82
+ ...CircuitSessionMarksheetFields
83
+ osceStation {
84
+ ...OsceStationFields
85
+ }
86
+ osceMarksheet {
87
+ ...OsceMarksheetFields
88
+ }
89
+ }
90
+ }
91
+ `;
@@ -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';
@@ -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.260",
3
+ "version": "2.6.262",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",