@quesmed/types-rn 2.6.267 → 2.6.269
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.
- package/models/OsceMarksheet.d.ts +2 -0
- package/package.json +1 -1
- package/resolvers/fragments/osce.js +2 -0
- package/resolvers/mutation/restricted/asset.d.ts +20 -0
- package/resolvers/mutation/restricted/asset.js +22 -0
- package/resolvers/mutation/restricted/index.d.ts +2 -0
- package/resolvers/mutation/restricted/index.js +2 -0
- package/resolvers/mutation/restricted/osce.d.ts +1 -0
- package/resolvers/mutation/restricted/osce.js +16 -4
- package/resolvers/mutation/restricted/station.d.ts +81 -0
- package/resolvers/mutation/restricted/station.js +90 -0
- package/resolvers/query/restricted/index.d.ts +1 -0
- package/resolvers/query/restricted/index.js +1 -0
- package/resolvers/query/restricted/station.d.ts +35 -0
- package/resolvers/query/restricted/station.js +40 -0
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FileData, IPicture, Id } from '../../../models';
|
|
2
|
+
import { AdminData, graphqlNormalize } from '../../types';
|
|
3
|
+
export interface IAssetInput {
|
|
4
|
+
file: File | FileData;
|
|
5
|
+
caption?: string | null;
|
|
6
|
+
name: string;
|
|
7
|
+
topicId?: Id;
|
|
8
|
+
sensitive: boolean;
|
|
9
|
+
overlay?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const CREATE_ASSETS: import("@apollo/client").DocumentNode;
|
|
12
|
+
export type ICreateAssetsVar = {
|
|
13
|
+
inputs: IAssetInput[];
|
|
14
|
+
};
|
|
15
|
+
export type ICreateAssetsData = AdminData<(IPicture & graphqlNormalize)[], 'createAssets'>;
|
|
16
|
+
export declare const REMOVE_ASSETS: import("@apollo/client").DocumentNode;
|
|
17
|
+
export type IRemoveAssetsVar = {
|
|
18
|
+
ids: Id[];
|
|
19
|
+
};
|
|
20
|
+
export type IRemoveAssetsData = AdminData<boolean, 'removeAssets'>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REMOVE_ASSETS = exports.CREATE_ASSETS = void 0;
|
|
4
|
+
const client_1 = require("@apollo/client");
|
|
5
|
+
const fragments_1 = require("../../fragments");
|
|
6
|
+
exports.CREATE_ASSETS = (0, client_1.gql) `
|
|
7
|
+
${fragments_1.PICTURE_FIELDS}
|
|
8
|
+
mutation CreateAssets($inputs: [CreateAssetsInput!]!) {
|
|
9
|
+
restricted {
|
|
10
|
+
createAssets(inputs: $inputs) {
|
|
11
|
+
...PictureFields
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
exports.REMOVE_ASSETS = (0, client_1.gql) `
|
|
17
|
+
mutation RemoveAssets($ids: [ID!]!) {
|
|
18
|
+
restricted {
|
|
19
|
+
removeAssets(ids: $ids)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './agora';
|
|
2
|
+
export * from './asset';
|
|
2
3
|
export * from './circuit';
|
|
3
4
|
export * from './book';
|
|
4
5
|
export * from './chapter';
|
|
@@ -9,6 +10,7 @@ export * from './notification';
|
|
|
9
10
|
export * from './osce';
|
|
10
11
|
export * from './preset';
|
|
11
12
|
export * from './questionDiscussion';
|
|
13
|
+
export * from './station';
|
|
12
14
|
export * from './stripe';
|
|
13
15
|
export * from './todo';
|
|
14
16
|
export * from './token';
|
|
@@ -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("./asset"), exports);
|
|
18
19
|
__exportStar(require("./circuit"), exports);
|
|
19
20
|
__exportStar(require("./book"), exports);
|
|
20
21
|
__exportStar(require("./chapter"), exports);
|
|
@@ -25,6 +26,7 @@ __exportStar(require("./notification"), exports);
|
|
|
25
26
|
__exportStar(require("./osce"), exports);
|
|
26
27
|
__exportStar(require("./preset"), exports);
|
|
27
28
|
__exportStar(require("./questionDiscussion"), exports);
|
|
29
|
+
__exportStar(require("./station"), exports);
|
|
28
30
|
__exportStar(require("./stripe"), exports);
|
|
29
31
|
__exportStar(require("./todo"), exports);
|
|
30
32
|
__exportStar(require("./token"), exports);
|
|
@@ -45,6 +45,7 @@ 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
|
+
secondaryMark?: number;
|
|
48
49
|
corrected?: Boolean;
|
|
49
50
|
}
|
|
50
51
|
export type IMarkOsceMarksheetMarkData = RestrictedData<graphqlNormalize & Partial<IOsceMarksheetMark>, 'markOsceMarksheetMark'>;
|
|
@@ -84,16 +84,19 @@ 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!, $corrected: Boolean) {
|
|
87
|
+
mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!, $secondaryMark: Int, $corrected: Boolean) {
|
|
88
88
|
restricted {
|
|
89
89
|
markOsceMarksheetMark(
|
|
90
90
|
osceMarksheetMarkId: $osceMarksheetMarkId
|
|
91
91
|
mark: $mark
|
|
92
|
+
secondaryMark: $secondaryMark
|
|
92
93
|
corrected: $corrected
|
|
93
94
|
) {
|
|
94
95
|
id
|
|
95
96
|
selectedChoice
|
|
96
97
|
mark
|
|
98
|
+
score
|
|
99
|
+
secondaryMark
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
}
|
|
@@ -103,10 +106,13 @@ const optimisticMarkOsceMarksheetMark = (variables, productType) => {
|
|
|
103
106
|
if (productType === models_1.EProductType.PACES) {
|
|
104
107
|
data.selectedChoice = variables.mark;
|
|
105
108
|
data.mark = null;
|
|
109
|
+
data.secondaryMark = variables.secondaryMark;
|
|
110
|
+
data.score = null;
|
|
106
111
|
}
|
|
107
112
|
else {
|
|
108
113
|
data.mark = variables.mark;
|
|
109
114
|
data.selectedChoice = null;
|
|
115
|
+
data.score = variables.mark;
|
|
110
116
|
}
|
|
111
117
|
return {
|
|
112
118
|
restricted: {
|
|
@@ -133,6 +139,8 @@ const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
|
|
|
133
139
|
fields: {
|
|
134
140
|
selectedChoice: () => markOsceMarksheetMark.selectedChoice,
|
|
135
141
|
mark: () => markOsceMarksheetMark.mark,
|
|
142
|
+
secondaryMark: () => markOsceMarksheetMark.secondaryMark,
|
|
143
|
+
score: () => markOsceMarksheetMark.score,
|
|
136
144
|
},
|
|
137
145
|
});
|
|
138
146
|
if (!variables.corrected) {
|
|
@@ -159,6 +167,8 @@ const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
|
|
|
159
167
|
fragment OsceMarksheetMarksForScore on OsceMarksheet {
|
|
160
168
|
marks {
|
|
161
169
|
mark
|
|
170
|
+
score
|
|
171
|
+
secondaryMark
|
|
162
172
|
}
|
|
163
173
|
}
|
|
164
174
|
`,
|
|
@@ -166,12 +176,14 @@ const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
|
|
|
166
176
|
if (!marksheet?.marks?.length) {
|
|
167
177
|
return;
|
|
168
178
|
}
|
|
169
|
-
const
|
|
170
|
-
const
|
|
179
|
+
const hasSecondaryMarks = marksheet.marks.some((m) => m.secondaryMark);
|
|
180
|
+
const total = hasSecondaryMarks ? 2 * marksheet.marks.length : marksheet.marks.length;
|
|
181
|
+
// const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
|
|
182
|
+
const userScore = marksheet.marks.reduce((sum, m) => sum + Number(m.score), 0);
|
|
171
183
|
cache.modify({
|
|
172
184
|
id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
|
|
173
185
|
fields: {
|
|
174
|
-
score: () =>
|
|
186
|
+
score: () => userScore / total,
|
|
175
187
|
},
|
|
176
188
|
});
|
|
177
189
|
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ApolloCache } from '@apollo/client';
|
|
2
|
+
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
|
|
3
|
+
import { IClinicalDataModule, Id, IOsceStation, IOsceStationPhaseTimer, IStationExaminerQuestion } from '../../../models';
|
|
4
|
+
import { IAssetBinding } from '../../../models/Picture';
|
|
5
|
+
import { graphqlNormalize, RestrictedData } from '../../types';
|
|
6
|
+
import { EOsceType } from '../../../models';
|
|
7
|
+
export interface IJobStationMarkInput {
|
|
8
|
+
header?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
index?: number;
|
|
11
|
+
excludeFromAi?: boolean;
|
|
12
|
+
weight?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const CREATE_STATION: import("@apollo/client").DocumentNode;
|
|
15
|
+
export type ICreateStationData = RestrictedData<graphqlNormalize & IOsceStation, 'createStation'>;
|
|
16
|
+
export interface ICreateStationVar {
|
|
17
|
+
input: {
|
|
18
|
+
name: string;
|
|
19
|
+
hiddenName?: string;
|
|
20
|
+
osceTypeId?: number;
|
|
21
|
+
enabled?: number;
|
|
22
|
+
visibility?: number;
|
|
23
|
+
entitlementIds?: number[];
|
|
24
|
+
difficulty?: number;
|
|
25
|
+
pictureId?: number;
|
|
26
|
+
candidateBrief?: string;
|
|
27
|
+
examinerBrief?: string;
|
|
28
|
+
actorBrief?: string;
|
|
29
|
+
llmActorBrief?: string;
|
|
30
|
+
explanation?: string;
|
|
31
|
+
aiEnabled?: boolean;
|
|
32
|
+
aiConfig?: Record<string, unknown>;
|
|
33
|
+
phaseTimers?: IOsceStationPhaseTimer;
|
|
34
|
+
clinicalData?: IClinicalDataModule[];
|
|
35
|
+
topicIds?: number[];
|
|
36
|
+
marks?: IJobStationMarkInput[];
|
|
37
|
+
examinerQuestions?: IStationExaminerQuestion[];
|
|
38
|
+
assets?: IAssetBinding[];
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export declare const updateCacheOnCreateStation: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<ICreateStationData>, options: ApolloUpdateOptions<ICreateStationVar>) => void;
|
|
42
|
+
export declare const UPDATE_STATION: import("@apollo/client").DocumentNode;
|
|
43
|
+
export type IUpdateStationData = RestrictedData<graphqlNormalize & IOsceStation, 'updateStation'>;
|
|
44
|
+
export interface IUpdateStationVar {
|
|
45
|
+
input: {
|
|
46
|
+
id: Id;
|
|
47
|
+
name?: string;
|
|
48
|
+
enabled?: number;
|
|
49
|
+
visibility?: number;
|
|
50
|
+
osceTypeId?: number;
|
|
51
|
+
hiddenName?: string;
|
|
52
|
+
entitlementIds?: number[];
|
|
53
|
+
difficulty?: number;
|
|
54
|
+
pictureId?: number;
|
|
55
|
+
candidateBrief?: string;
|
|
56
|
+
examinerBrief?: string;
|
|
57
|
+
actorBrief?: string;
|
|
58
|
+
llmActorBrief?: string;
|
|
59
|
+
explanation?: string;
|
|
60
|
+
aiEnabled?: boolean;
|
|
61
|
+
aiConfig?: Record<string, unknown>;
|
|
62
|
+
phaseTimers?: IOsceStationPhaseTimer;
|
|
63
|
+
clinicalData?: IClinicalDataModule[];
|
|
64
|
+
topicIds?: number[];
|
|
65
|
+
marks?: IJobStationMarkInput[];
|
|
66
|
+
assets?: IAssetBinding[];
|
|
67
|
+
examinerQuestions?: IStationExaminerQuestion[];
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export declare const updateCacheOnUpdateStation: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpdateStationData>, options: ApolloUpdateOptions<IUpdateStationVar>) => void;
|
|
71
|
+
export interface IGenerateStationSession {
|
|
72
|
+
sessionId: string;
|
|
73
|
+
}
|
|
74
|
+
export type IGenerateStationData = RestrictedData<graphqlNormalize & IGenerateStationSession, 'generateStation'>;
|
|
75
|
+
export interface IGenerateStationVar {
|
|
76
|
+
input: {
|
|
77
|
+
prompt: string;
|
|
78
|
+
osceTypeId: EOsceType;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export declare const GENERATE_STATION: import("@apollo/client").DocumentNode;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GENERATE_STATION = exports.updateCacheOnUpdateStation = exports.UPDATE_STATION = exports.updateCacheOnCreateStation = exports.CREATE_STATION = void 0;
|
|
4
|
+
const client_1 = require("@apollo/client");
|
|
5
|
+
const osce_1 = require("../../fragments/osce");
|
|
6
|
+
const restricted_1 = require("../../query/restricted");
|
|
7
|
+
exports.CREATE_STATION = (0, client_1.gql) `
|
|
8
|
+
${osce_1.OSCE_STATION_FIELDS}
|
|
9
|
+
mutation CreateStation($input: CreateStationInput!) {
|
|
10
|
+
restricted {
|
|
11
|
+
createStation(input: $input) {
|
|
12
|
+
...OsceStationFields
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
const updateCacheOnCreateStation = (cache, result, options) => {
|
|
18
|
+
const { createStation } = result?.data?.restricted || {};
|
|
19
|
+
const { variables } = options || {};
|
|
20
|
+
if (!createStation || !variables) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const prevData = cache.readQuery({
|
|
24
|
+
variables: { solo: false },
|
|
25
|
+
query: restricted_1.OSCE_STATIONS,
|
|
26
|
+
});
|
|
27
|
+
if (prevData) {
|
|
28
|
+
const { osceStations } = prevData.restricted || {};
|
|
29
|
+
cache.writeQuery({
|
|
30
|
+
query: restricted_1.OSCE_STATIONS,
|
|
31
|
+
variables: { solo: false },
|
|
32
|
+
data: {
|
|
33
|
+
...prevData,
|
|
34
|
+
restricted: {
|
|
35
|
+
...prevData.restricted,
|
|
36
|
+
osceStations: [{ ...createStation }, ...osceStations],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
cache.writeQuery({
|
|
43
|
+
query: restricted_1.OSCE_STATIONS,
|
|
44
|
+
variables: { solo: false },
|
|
45
|
+
data: {
|
|
46
|
+
restricted: {
|
|
47
|
+
__typename: 'RestrictedQuery',
|
|
48
|
+
osceStations: [{ ...createStation }],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
exports.updateCacheOnCreateStation = updateCacheOnCreateStation;
|
|
55
|
+
exports.UPDATE_STATION = (0, client_1.gql) `
|
|
56
|
+
${osce_1.OSCE_STATION_FIELDS}
|
|
57
|
+
mutation UpdateStation($input: UpdateStationInput!) {
|
|
58
|
+
restricted {
|
|
59
|
+
updateStation(input: $input) {
|
|
60
|
+
...OsceStationFields
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
const updateCacheOnUpdateStation = (cache, result, options) => {
|
|
66
|
+
const { updateStation } = result?.data?.restricted || {};
|
|
67
|
+
const { variables } = options || {};
|
|
68
|
+
if (!updateStation || !variables) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
cache.writeFragment({
|
|
72
|
+
id: cache.identify({
|
|
73
|
+
id: variables.input.id,
|
|
74
|
+
__typename: 'OsceStation',
|
|
75
|
+
}),
|
|
76
|
+
data: { ...updateStation },
|
|
77
|
+
fragment: osce_1.OSCE_STATION_FIELDS,
|
|
78
|
+
fragmentName: 'OsceStationFields',
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
exports.updateCacheOnUpdateStation = updateCacheOnUpdateStation;
|
|
82
|
+
exports.GENERATE_STATION = (0, client_1.gql) `
|
|
83
|
+
mutation GenerateStation($input: GenerateStationInput!) {
|
|
84
|
+
restricted {
|
|
85
|
+
generateStation(input: $input) {
|
|
86
|
+
sessionId
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
@@ -31,6 +31,7 @@ __exportStar(require("./qBank"), exports);
|
|
|
31
31
|
__exportStar(require("./quesBook"), exports);
|
|
32
32
|
__exportStar(require("./question"), exports);
|
|
33
33
|
__exportStar(require("./replication"), exports);
|
|
34
|
+
__exportStar(require("./station"), exports);
|
|
34
35
|
__exportStar(require("./todos"), exports);
|
|
35
36
|
__exportStar(require("./topics"), exports);
|
|
36
37
|
__exportStar(require("./ukmlaTopics"), exports);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EOsceType, IStationExaminerQuestion } from '../../../models';
|
|
2
|
+
import { graphqlNormalize, RestrictedData } from '../../types';
|
|
3
|
+
export declare enum EGenerateStationStatus {
|
|
4
|
+
PENDING = "PENDING",
|
|
5
|
+
READY = "READY",
|
|
6
|
+
FAILED = "FAILED"
|
|
7
|
+
}
|
|
8
|
+
export interface IGeneratedStationMark {
|
|
9
|
+
header?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
index?: number;
|
|
12
|
+
weight?: number;
|
|
13
|
+
excludeFromAi?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface IGeneratedStation {
|
|
16
|
+
name?: string;
|
|
17
|
+
osceTypeId?: EOsceType;
|
|
18
|
+
difficulty?: number;
|
|
19
|
+
candidateBrief?: string;
|
|
20
|
+
examinerBrief?: string;
|
|
21
|
+
actorBrief?: string;
|
|
22
|
+
explanation?: string;
|
|
23
|
+
examinerQuestions?: IStationExaminerQuestion[];
|
|
24
|
+
marks?: IGeneratedStationMark[];
|
|
25
|
+
}
|
|
26
|
+
export interface IGenerateStationResult {
|
|
27
|
+
status: EGenerateStationStatus;
|
|
28
|
+
station?: IGeneratedStation;
|
|
29
|
+
error?: string;
|
|
30
|
+
}
|
|
31
|
+
export type IGenerateStationStatusData = RestrictedData<graphqlNormalize & IGenerateStationResult, 'generateStationStatus'>;
|
|
32
|
+
export interface IGenerateStationStatusVar {
|
|
33
|
+
sessionId: string;
|
|
34
|
+
}
|
|
35
|
+
export declare const GENERATE_STATION_STATUS: import("@apollo/client").DocumentNode;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GENERATE_STATION_STATUS = exports.EGenerateStationStatus = void 0;
|
|
4
|
+
const client_1 = require("@apollo/client");
|
|
5
|
+
var EGenerateStationStatus;
|
|
6
|
+
(function (EGenerateStationStatus) {
|
|
7
|
+
EGenerateStationStatus["PENDING"] = "PENDING";
|
|
8
|
+
EGenerateStationStatus["READY"] = "READY";
|
|
9
|
+
EGenerateStationStatus["FAILED"] = "FAILED";
|
|
10
|
+
})(EGenerateStationStatus = exports.EGenerateStationStatus || (exports.EGenerateStationStatus = {}));
|
|
11
|
+
exports.GENERATE_STATION_STATUS = (0, client_1.gql) `
|
|
12
|
+
query GenerateStationStatus($sessionId: String!) {
|
|
13
|
+
restricted {
|
|
14
|
+
generateStationStatus(sessionId: $sessionId) {
|
|
15
|
+
status
|
|
16
|
+
error
|
|
17
|
+
station {
|
|
18
|
+
name
|
|
19
|
+
osceTypeId
|
|
20
|
+
difficulty
|
|
21
|
+
candidateBrief
|
|
22
|
+
examinerBrief
|
|
23
|
+
actorBrief
|
|
24
|
+
explanation
|
|
25
|
+
examinerQuestions {
|
|
26
|
+
index
|
|
27
|
+
question
|
|
28
|
+
}
|
|
29
|
+
marks {
|
|
30
|
+
header
|
|
31
|
+
name
|
|
32
|
+
index
|
|
33
|
+
weight
|
|
34
|
+
excludeFromAi
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`;
|