@quesmed/types-rn 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.
@@ -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 });
package/models/index.d.ts CHANGED
@@ -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';
package/models/index.js CHANGED
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.6.260",
3
+ "version": "2.6.262",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -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);