@quesmed/types-rn 2.0.4

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 (183) hide show
  1. package/gql_input_output_types/User.d.ts +12 -0
  2. package/gql_input_output_types/User.js +2 -0
  3. package/gql_input_output_types/index.d.ts +75 -0
  4. package/gql_input_output_types/index.js +2 -0
  5. package/index.d.ts +22 -0
  6. package/index.js +124 -0
  7. package/models/Author.d.ts +14 -0
  8. package/models/Author.js +2 -0
  9. package/models/Blog.d.ts +15 -0
  10. package/models/Blog.js +2 -0
  11. package/models/Book.d.ts +22 -0
  12. package/models/Book.js +2 -0
  13. package/models/Card.d.ts +16 -0
  14. package/models/Card.js +2 -0
  15. package/models/Chapter.d.ts +15 -0
  16. package/models/Chapter.js +2 -0
  17. package/models/Concept.d.ts +15 -0
  18. package/models/Concept.js +2 -0
  19. package/models/Difficulty.d.ts +6 -0
  20. package/models/Difficulty.js +10 -0
  21. package/models/Feedback.d.ts +8 -0
  22. package/models/Feedback.js +2 -0
  23. package/models/File.d.ts +10 -0
  24. package/models/File.js +2 -0
  25. package/models/Marksheet.d.ts +36 -0
  26. package/models/Marksheet.js +2 -0
  27. package/models/MockTest.d.ts +22 -0
  28. package/models/MockTest.js +2 -0
  29. package/models/OsceMarksheet.d.ts +105 -0
  30. package/models/OsceMarksheet.js +103 -0
  31. package/models/OsceStation.d.ts +54 -0
  32. package/models/OsceStation.js +45 -0
  33. package/models/Picture.d.ts +14 -0
  34. package/models/Picture.js +2 -0
  35. package/models/Promo.d.ts +14 -0
  36. package/models/Promo.js +2 -0
  37. package/models/Question.d.ts +115 -0
  38. package/models/Question.js +43 -0
  39. package/models/Subscription.d.ts +17 -0
  40. package/models/Subscription.js +9 -0
  41. package/models/Todo.d.ts +33 -0
  42. package/models/Todo.js +2 -0
  43. package/models/Token.d.ts +9 -0
  44. package/models/Token.js +2 -0
  45. package/models/Topic.d.ts +32 -0
  46. package/models/Topic.js +13 -0
  47. package/models/Type.d.ts +7 -0
  48. package/models/Type.js +2 -0
  49. package/models/University.d.ts +5 -0
  50. package/models/University.js +2 -0
  51. package/models/User.d.ts +119 -0
  52. package/models/User.js +70 -0
  53. package/models/Video.d.ts +26 -0
  54. package/models/Video.js +2 -0
  55. package/models/index.d.ts +24 -0
  56. package/models/index.js +36 -0
  57. package/package.json +35 -0
  58. package/resolvers/apollo.d.ts +8 -0
  59. package/resolvers/apollo.js +2 -0
  60. package/resolvers/fragments/blog.d.ts +1 -0
  61. package/resolvers/fragments/blog.js +17 -0
  62. package/resolvers/fragments/chapter.d.ts +1 -0
  63. package/resolvers/fragments/chapter.js +25 -0
  64. package/resolvers/fragments/concept.d.ts +3 -0
  65. package/resolvers/fragments/concept.js +79 -0
  66. package/resolvers/fragments/index.d.ts +7 -0
  67. package/resolvers/fragments/index.js +19 -0
  68. package/resolvers/fragments/osce.d.ts +5 -0
  69. package/resolvers/fragments/osce.js +139 -0
  70. package/resolvers/fragments/picture.d.ts +1 -0
  71. package/resolvers/fragments/picture.js +22 -0
  72. package/resolvers/fragments/user.d.ts +1 -0
  73. package/resolvers/fragments/user.js +39 -0
  74. package/resolvers/fragments/video.d.ts +2 -0
  75. package/resolvers/fragments/video.js +58 -0
  76. package/resolvers/index.d.ts +12 -0
  77. package/resolvers/index.js +38 -0
  78. package/resolvers/mutation/admin/algoliaSync.d.ts +9 -0
  79. package/resolvers/mutation/admin/algoliaSync.js +2 -0
  80. package/resolvers/mutation/admin/index.d.ts +2 -0
  81. package/resolvers/mutation/admin/index.js +14 -0
  82. package/resolvers/mutation/admin/token.d.ts +25 -0
  83. package/resolvers/mutation/admin/token.js +2 -0
  84. package/resolvers/mutation/index.d.ts +5 -0
  85. package/resolvers/mutation/index.js +30 -0
  86. package/resolvers/mutation/restricted/agora.d.ts +10 -0
  87. package/resolvers/mutation/restricted/agora.js +11 -0
  88. package/resolvers/mutation/restricted/contactUs.d.ts +17 -0
  89. package/resolvers/mutation/restricted/contactUs.js +2 -0
  90. package/resolvers/mutation/restricted/index.d.ts +10 -0
  91. package/resolvers/mutation/restricted/index.js +22 -0
  92. package/resolvers/mutation/restricted/marksheet.d.ts +41 -0
  93. package/resolvers/mutation/restricted/marksheet.js +2 -0
  94. package/resolvers/mutation/restricted/mockTest.d.ts +16 -0
  95. package/resolvers/mutation/restricted/mockTest.js +2 -0
  96. package/resolvers/mutation/restricted/osce.d.ts +87 -0
  97. package/resolvers/mutation/restricted/osce.js +222 -0
  98. package/resolvers/mutation/restricted/questionDiscussion.d.ts +24 -0
  99. package/resolvers/mutation/restricted/questionDiscussion.js +2 -0
  100. package/resolvers/mutation/restricted/todo.d.ts +32 -0
  101. package/resolvers/mutation/restricted/todo.js +2 -0
  102. package/resolvers/mutation/restricted/token.d.ts +21 -0
  103. package/resolvers/mutation/restricted/token.js +2 -0
  104. package/resolvers/mutation/restricted/users.d.ts +29 -0
  105. package/resolvers/mutation/restricted/users.js +11 -0
  106. package/resolvers/mutation/restricted/video.d.ts +6 -0
  107. package/resolvers/mutation/restricted/video.js +2 -0
  108. package/resolvers/mutation/stripe.d.ts +11 -0
  109. package/resolvers/mutation/stripe.js +2 -0
  110. package/resolvers/mutation/users.d.ts +32 -0
  111. package/resolvers/mutation/users.js +2 -0
  112. package/resolvers/mutation/validUserToken/index.d.ts +1 -0
  113. package/resolvers/mutation/validUserToken/index.js +13 -0
  114. package/resolvers/mutation/validUserToken/user.d.ts +14 -0
  115. package/resolvers/mutation/validUserToken/user.js +2 -0
  116. package/resolvers/query/admin/getUserToken.d.ts +5 -0
  117. package/resolvers/query/admin/getUserToken.js +2 -0
  118. package/resolvers/query/admin/index.d.ts +1 -0
  119. package/resolvers/query/admin/index.js +13 -0
  120. package/resolvers/query/author.d.ts +3 -0
  121. package/resolvers/query/author.js +2 -0
  122. package/resolvers/query/blog.d.ts +15 -0
  123. package/resolvers/query/blog.js +36 -0
  124. package/resolvers/query/book.d.ts +8 -0
  125. package/resolvers/query/book.js +2 -0
  126. package/resolvers/query/feedback.d.ts +3 -0
  127. package/resolvers/query/feedback.js +2 -0
  128. package/resolvers/query/index.d.ts +11 -0
  129. package/resolvers/query/index.js +36 -0
  130. package/resolvers/query/restricted/index.d.ts +10 -0
  131. package/resolvers/query/restricted/index.js +22 -0
  132. package/resolvers/query/restricted/marksheet.d.ts +47 -0
  133. package/resolvers/query/restricted/marksheet.js +2 -0
  134. package/resolvers/query/restricted/mockTests.d.ts +10 -0
  135. package/resolvers/query/restricted/mockTests.js +2 -0
  136. package/resolvers/query/restricted/osce.d.ts +45 -0
  137. package/resolvers/query/restricted/osce.js +118 -0
  138. package/resolvers/query/restricted/quesBook.d.ts +7 -0
  139. package/resolvers/query/restricted/quesBook.js +17 -0
  140. package/resolvers/query/restricted/replication.d.ts +32 -0
  141. package/resolvers/query/restricted/replication.js +184 -0
  142. package/resolvers/query/restricted/todos.d.ts +15 -0
  143. package/resolvers/query/restricted/todos.js +2 -0
  144. package/resolvers/query/restricted/topics.d.ts +10 -0
  145. package/resolvers/query/restricted/topics.js +2 -0
  146. package/resolvers/query/restricted/university.d.ts +15 -0
  147. package/resolvers/query/restricted/university.js +2 -0
  148. package/resolvers/query/restricted/user.d.ts +13 -0
  149. package/resolvers/query/restricted/user.js +2 -0
  150. package/resolvers/query/restricted/video.d.ts +11 -0
  151. package/resolvers/query/restricted/video.js +2 -0
  152. package/resolvers/query/sample.d.ts +26 -0
  153. package/resolvers/query/sample.js +98 -0
  154. package/resolvers/query/subscription.d.ts +3 -0
  155. package/resolvers/query/subscription.js +2 -0
  156. package/resolvers/query/university.d.ts +6 -0
  157. package/resolvers/query/university.js +2 -0
  158. package/resolvers/query/user.d.ts +13 -0
  159. package/resolvers/query/user.js +2 -0
  160. package/resolvers/query/video.d.ts +15 -0
  161. package/resolvers/query/video.js +2 -0
  162. package/resolvers/subscription/index.d.ts +1 -0
  163. package/resolvers/subscription/index.js +13 -0
  164. package/resolvers/subscription/osce.d.ts +66 -0
  165. package/resolvers/subscription/osce.js +108 -0
  166. package/resolvers/types.d.ts +10 -0
  167. package/resolvers/types.js +2 -0
  168. package/utils/commonFunctions.d.ts +9 -0
  169. package/utils/commonFunctions.js +256 -0
  170. package/utils/index.d.ts +9 -0
  171. package/utils/index.js +42 -0
  172. package/utils/lightgallery.d.ts +9 -0
  173. package/utils/lightgallery.js +88 -0
  174. package/utils/offlineLink.d.ts +64 -0
  175. package/utils/offlineLink.js +221 -0
  176. package/utils/random.d.ts +1 -0
  177. package/utils/random.js +20 -0
  178. package/utils/uuid4.d.ts +107 -0
  179. package/utils/uuid4.js +282 -0
  180. package/utils/webSocketLink.d.ts +7 -0
  181. package/utils/webSocketLink.js +22 -0
  182. package/utils/wordsToNumber.d.ts +1 -0
  183. package/utils/wordsToNumber.js +48 -0
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SAMPLE_OSCE_MARKSHEET = exports.SAMPLE_TODO = exports.SAMPLE_MARKSHEET = exports.SAMPLE_CONTENT = void 0;
4
+ const client_1 = require("@apollo/client");
5
+ const fragments_1 = require("../fragments");
6
+ exports.SAMPLE_CONTENT = (0, client_1.gql) `
7
+ query SampleContent {
8
+ sampleContent {
9
+ marksheets {
10
+ id
11
+ source
12
+ }
13
+ todos {
14
+ id
15
+ source
16
+ }
17
+ osceMarksheets {
18
+ id
19
+ osceStation {
20
+ name
21
+ }
22
+ }
23
+ }
24
+ }
25
+ `;
26
+ exports.SAMPLE_MARKSHEET = (0, client_1.gql) `
27
+ query SampleMarksheet($marksheetId: Int!) {
28
+ sampleMarksheet(marksheetId: $marksheetId) {
29
+ id
30
+ endedAt
31
+ source
32
+ marks {
33
+ id
34
+ index
35
+ questionChoiceId
36
+ timeTaken
37
+ question {
38
+ id
39
+ typeId
40
+ conceptId
41
+ concept {
42
+ name
43
+ chapter {
44
+ explanation
45
+ }
46
+ }
47
+ question
48
+ totalVotes
49
+ choices {
50
+ id
51
+ name
52
+ explanation
53
+ label
54
+ answer
55
+ votes
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ `;
62
+ exports.SAMPLE_TODO = (0, client_1.gql) `
63
+ query SampleTodo($todoId: Int!) {
64
+ sampleTodo(todoId: $todoId) {
65
+ id
66
+ dailyTask
67
+ source
68
+ marks {
69
+ id
70
+ cardId
71
+ score
72
+ timeTaken
73
+ card {
74
+ id
75
+ question
76
+ concept {
77
+ name
78
+ chapter {
79
+ explanation
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ `;
87
+ exports.SAMPLE_OSCE_MARKSHEET = (0, client_1.gql) `
88
+ ${fragments_1.OSCE_STATION_FIELDS}
89
+ ${fragments_1.OSCE_MARKSHEET_FIELDS}
90
+ query SampleOsceMarksheet($osceMarksheetId: Int!) {
91
+ sampleOsceMarksheet(osceMarksheetId: $osceMarksheetId) {
92
+ ...OsceMarksheetFields
93
+ osceStation {
94
+ ...OsceStationFields
95
+ }
96
+ }
97
+ }
98
+ `;
@@ -0,0 +1,3 @@
1
+ import { ISubscription } from '../../models';
2
+ import { graphqlNormalize, RootData } from '../types';
3
+ export declare type ISubscriptionsData = RootData<(graphqlNormalize & ISubscription)[], 'subscriptions'>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { Id, IUniversity } from '../../models';
2
+ import { graphqlNormalize, RootData } from '../types';
3
+ export interface IUniversitiesVar {
4
+ id: Id;
5
+ }
6
+ export declare type IUniversitiesData = RootData<graphqlNormalize & IUniversity[], 'universities'>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { RootData } from '../types';
2
+ export interface IUsernameAvailableVar {
3
+ username: string;
4
+ }
5
+ export declare type IUsernameAvailableData = RootData<boolean, 'usernameAvailable'>;
6
+ export interface IUsernameProvisionedVar {
7
+ username: string;
8
+ }
9
+ export declare type IUsernameProvisionedData = RootData<boolean, 'usernameProvisioned'>;
10
+ export interface IValidateResetPasswordTokenVar {
11
+ token: string;
12
+ }
13
+ export declare type IValidateResetPasswordTokenData = RootData<string, 'validateResetPasswordToken'>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import { Id, IVideo } from '../../models';
2
+ import { graphqlNormalize, RootData } from '../types';
3
+ export interface IVideosVar {
4
+ filter: 'new' | 'popular' | 'personal' | 'live';
5
+ limit: number;
6
+ }
7
+ export declare type IVideosData = RootData<(graphqlNormalize & IVideo)[], 'videos'>;
8
+ export interface IVideoVar {
9
+ id: Id;
10
+ }
11
+ export declare type IVideoData = RootData<graphqlNormalize & IVideo, 'video'>;
12
+ export interface IZoomSignatureVar {
13
+ meetingNumber: string;
14
+ }
15
+ export declare type IZoomSignatureData = RootData<graphqlNormalize & string, 'zoomSignature'>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './osce';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./osce"), exports);
@@ -0,0 +1,66 @@
1
+ import { EClassYearGroup, EOsceMarksheetAction, EOsceRoles, IAccessLevel, IClassYear, Id, IOsceMarksheetTimer, IOsceMarksheetUser, IUser } from '../../models';
2
+ import { RootData } from '../types';
3
+ export declare const OSCE_ROLE_CHANGE_KEY = "OSCE_ROLE_CHANGE";
4
+ export declare const OSCE_MARKSHEET_ACTION_KEY = "OSCE_MARKSHEET_ACTION";
5
+ export declare const OSCE_MARKSHEET_TIMER_KEY = "OSCE_MARKSHEET_TIMER";
6
+ export declare const OSCE_MATCHMAKING_KEY = "OSCE_MATCHMAKING";
7
+ export declare const OSCE_MATCHMAKING_USERS_KEY = "OSCE_MATCHMAKING_USERS";
8
+ export interface IOsceGroupMember {
9
+ role: EOsceRoles;
10
+ user: IUser | null;
11
+ }
12
+ export interface IOsceGroup {
13
+ osceMarksheetId: Id;
14
+ agoraId: string;
15
+ members: IOsceMarksheetUser[];
16
+ users: IUser[];
17
+ }
18
+ export declare const OsceGroupInit: (osceMarksheetId: number) => IOsceMarksheetUser[];
19
+ export declare const OSCE_ROLE_CHANGE: import("@apollo/client").DocumentNode;
20
+ export interface IOsceRoleChangedVar {
21
+ osceMarksheetId: Id;
22
+ }
23
+ export declare type IOsceRoleChangedData = RootData<IOsceGroup, 'osceRoleChange'>;
24
+ export declare const OSCE_MARKSHEET_ACTION: import("@apollo/client").DocumentNode;
25
+ export interface IOsceMarksheetActionVar {
26
+ osceMarksheetId: Id;
27
+ }
28
+ export interface IOsceMarksheetAction {
29
+ osceMarksheetId: Id;
30
+ agoraId: string;
31
+ userId: Id;
32
+ user: IUser;
33
+ startedAt: Date | null;
34
+ endedAt: Date | null;
35
+ action: EOsceMarksheetAction;
36
+ }
37
+ export declare type IOsceMarksheetActionData = RootData<IOsceMarksheetAction, 'osceMarksheetAction'>;
38
+ export declare const OSCE_MATCHMAKING: import("@apollo/client").DocumentNode;
39
+ export interface IOsceMatchmakingAction {
40
+ osceMarksheetId: Id;
41
+ agoraId: string;
42
+ matchedUsers: number;
43
+ userId: Id;
44
+ classYear: IClassYear;
45
+ classYearGroup: EClassYearGroup;
46
+ accessLevel: IAccessLevel;
47
+ lastSyncAt: number;
48
+ startedAt: number;
49
+ grouped: boolean;
50
+ completed: boolean;
51
+ }
52
+ export interface IOsceMatchmakingVar {
53
+ userId: Id;
54
+ }
55
+ export declare type IOsceMatchmakingData = RootData<IOsceMatchmakingAction, 'osceMatchmaking'>;
56
+ export declare const OSCE_MATCHMAKING_USERS: import("@apollo/client").DocumentNode;
57
+ export declare type IOsceMatchmakingUsersVar = null;
58
+ export declare type IOsceMatchmakingUsersData = RootData<[
59
+ number,
60
+ number
61
+ ], 'osceMatchmakingUsers'>;
62
+ export declare const OSCE_MARKSHEET_TIMER: import("@apollo/client").DocumentNode;
63
+ export interface IOsceMarksheetTimerVar {
64
+ osceMarksheetId: number;
65
+ }
66
+ export declare type IOsceMarksheetTimerData = RootData<IOsceMarksheetTimer, 'osceMarksheetTimer'>;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OSCE_MARKSHEET_TIMER = exports.OSCE_MATCHMAKING_USERS = exports.OSCE_MATCHMAKING = exports.OSCE_MARKSHEET_ACTION = exports.OSCE_ROLE_CHANGE = exports.OsceGroupInit = exports.OSCE_MATCHMAKING_USERS_KEY = exports.OSCE_MATCHMAKING_KEY = exports.OSCE_MARKSHEET_TIMER_KEY = exports.OSCE_MARKSHEET_ACTION_KEY = exports.OSCE_ROLE_CHANGE_KEY = void 0;
4
+ const client_1 = require("@apollo/client");
5
+ const models_1 = require("../../models");
6
+ const fragments_1 = require("../fragments");
7
+ exports.OSCE_ROLE_CHANGE_KEY = 'OSCE_ROLE_CHANGE';
8
+ exports.OSCE_MARKSHEET_ACTION_KEY = 'OSCE_MARKSHEET_ACTION';
9
+ exports.OSCE_MARKSHEET_TIMER_KEY = 'OSCE_MARKSHEET_TIMER';
10
+ exports.OSCE_MATCHMAKING_KEY = 'OSCE_MATCHMAKING';
11
+ exports.OSCE_MATCHMAKING_USERS_KEY = 'OSCE_MATCHMAKING_USERS';
12
+ const OsceGroupInit = (osceMarksheetId) => [
13
+ {
14
+ id: null,
15
+ createdAt: null,
16
+ osceMarksheetId,
17
+ userId: null,
18
+ user: null,
19
+ role: models_1.EOsceRoles.CANDIDATE,
20
+ },
21
+ {
22
+ id: null,
23
+ createdAt: null,
24
+ osceMarksheetId,
25
+ userId: null,
26
+ user: null,
27
+ role: models_1.EOsceRoles.EXAMINER,
28
+ },
29
+ {
30
+ id: null,
31
+ createdAt: null,
32
+ osceMarksheetId,
33
+ userId: null,
34
+ user: null,
35
+ role: models_1.EOsceRoles.ACTOR,
36
+ },
37
+ {
38
+ id: null,
39
+ createdAt: null,
40
+ osceMarksheetId,
41
+ userId: null,
42
+ user: null,
43
+ role: models_1.EOsceRoles.OBSERVER,
44
+ },
45
+ ];
46
+ exports.OsceGroupInit = OsceGroupInit;
47
+ exports.OSCE_ROLE_CHANGE = (0, client_1.gql) `
48
+ subscription osceRoleChangeSubscription($osceMarksheetId: Int!) {
49
+ osceRoleChange(osceMarksheetId: $osceMarksheetId) {
50
+ osceMarksheetId
51
+ agoraId
52
+ members {
53
+ osceMarksheetId
54
+ userId
55
+ user {
56
+ id
57
+ displayName
58
+ }
59
+ role
60
+ }
61
+ users {
62
+ id
63
+ displayName
64
+ }
65
+ }
66
+ }
67
+ `;
68
+ exports.OSCE_MARKSHEET_ACTION = (0, client_1.gql) `
69
+ subscription OsceMarksheetAction($osceMarksheetId: Int!) {
70
+ osceMarksheetAction(osceMarksheetId: $osceMarksheetId) {
71
+ osceMarksheetId
72
+ agoraId
73
+ userId
74
+ user {
75
+ id
76
+ displayName
77
+ universityId
78
+ }
79
+ startedAt
80
+ endedAt
81
+ action
82
+ }
83
+ }
84
+ `;
85
+ exports.OSCE_MATCHMAKING = (0, client_1.gql) `
86
+ ${fragments_1.OSCE_MATCHMAKING_ACTION_FIELDS}
87
+ subscription OsceMatchmaking($userId: Int!) {
88
+ osceMatchmaking(userId: $userId) {
89
+ ...OsceMatchmakingActionFields
90
+ }
91
+ }
92
+ `;
93
+ exports.OSCE_MATCHMAKING_USERS = (0, client_1.gql) `
94
+ subscription OsceMatchmakingUsers {
95
+ osceMatchmakingUsers
96
+ }
97
+ `;
98
+ exports.OSCE_MARKSHEET_TIMER = (0, client_1.gql) `
99
+ subscription OsceMarksheetTimer($osceMarksheetId: Int!) {
100
+ osceMarksheetTimer(osceMarksheetId: $osceMarksheetId) {
101
+ osceMarksheetId
102
+ timeRemaining
103
+ totalStationTime
104
+ stage
105
+ state
106
+ }
107
+ }
108
+ `;
@@ -0,0 +1,10 @@
1
+ export interface graphqlNormalize {
2
+ __typename?: string;
3
+ }
4
+ export declare type RestrictedData<T, K extends keyof any> = {
5
+ restricted: Record<K, T>;
6
+ };
7
+ export declare type AdminData<T, K extends keyof any> = {
8
+ admin: Record<K, T>;
9
+ };
10
+ export declare type RootData<T, K extends keyof any> = Record<K, T>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import { IMarksheetMark, IPrescribeAnswer, IPrescribeMark } from '../models';
2
+ export declare function mapPrescribeMarkToAnswer(obj: IPrescribeMark): IPrescribeAnswer;
3
+ export declare function formatPrescribeAnswer(baseAnswer: IPrescribeAnswer): IPrescribeAnswer;
4
+ export interface ICorrectMarkData {
5
+ correct: boolean;
6
+ incorrect: boolean;
7
+ correctIndex: number;
8
+ }
9
+ export declare function correctMark(mark: IMarksheetMark): ICorrectMarkData;
@@ -0,0 +1,256 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.correctMark = exports.formatPrescribeAnswer = exports.mapPrescribeMarkToAnswer = void 0;
4
+ const models_1 = require("../models");
5
+ const wordsToNumber_1 = require("./wordsToNumber");
6
+ const floatRegex = /([0-9]*[.])?[0-9]+/gm;
7
+ const ACCEPTED_FREQ = ['stat', 'od', 'bd', 'tds', 'qds'];
8
+ function mapPrescribeMarkToAnswer(obj) {
9
+ return {
10
+ drug: {
11
+ value: obj.drug,
12
+ display: false,
13
+ },
14
+ dose: {
15
+ value: parseFloat(obj.dose),
16
+ display: false,
17
+ },
18
+ units: {
19
+ value: obj.units,
20
+ display: false,
21
+ },
22
+ route: {
23
+ value: obj.route,
24
+ display: false,
25
+ },
26
+ frequency: {
27
+ value: obj.frequency,
28
+ display: false,
29
+ },
30
+ duration: {
31
+ value: obj.duration,
32
+ display: false,
33
+ },
34
+ };
35
+ }
36
+ exports.mapPrescribeMarkToAnswer = mapPrescribeMarkToAnswer;
37
+ function formatPrescribeAnswer(baseAnswer) {
38
+ const obj = {
39
+ ...baseAnswer,
40
+ drug: {
41
+ ...baseAnswer.drug,
42
+ },
43
+ dose: {
44
+ ...baseAnswer.dose,
45
+ },
46
+ units: {
47
+ ...baseAnswer.units,
48
+ },
49
+ route: {
50
+ ...baseAnswer.route,
51
+ },
52
+ frequency: {
53
+ ...baseAnswer.frequency,
54
+ },
55
+ duration: {
56
+ ...baseAnswer.duration,
57
+ },
58
+ };
59
+ obj.drug.value = obj.drug.value.toLowerCase().replace(/\s/g, '');
60
+ obj.route.value = obj.route.value
61
+ .toLowerCase()
62
+ .replace(/\s/g, '')
63
+ .replace(/\//g, '');
64
+ if (obj.route.value.includes('oral')) {
65
+ obj.route.value = 'po';
66
+ }
67
+ else if (obj.route.value.includes('intravenous')) {
68
+ obj.route.value = 'iv';
69
+ }
70
+ else if (obj.route.value.includes('intramuscular')) {
71
+ obj.route.value = 'im';
72
+ }
73
+ else if (obj.route.value.includes('subcutaneous')) {
74
+ obj.route.value = 'sc';
75
+ }
76
+ else if (obj.route.value.includes('inhale')) {
77
+ obj.route.value = 'inh';
78
+ }
79
+ else if (obj.route.value.includes('nebuli')) {
80
+ obj.route.value = 'neb';
81
+ }
82
+ else if (obj.route.value.includes('topical')) {
83
+ obj.route.value = 'top';
84
+ }
85
+ obj.units.value = obj.units.value.toLowerCase().replace(/\s/g, '');
86
+ if (obj.units.value === 'milligram' || obj.units.value === 'milligrams') {
87
+ obj.units.value = 'mg';
88
+ }
89
+ else if (obj.units.value === 'microgram' ||
90
+ obj.units.value === 'micrograms') {
91
+ obj.units.value = 'mcg';
92
+ }
93
+ else if (obj.units.value === 'gram' || obj.units.value === 'grams') {
94
+ obj.units.value = 'g';
95
+ }
96
+ else if (obj.units.value === 'unit') {
97
+ obj.units.value = 'units';
98
+ }
99
+ let m;
100
+ const durationMatches = new Set();
101
+ while ((m = floatRegex.exec(obj.duration.value)) !== null) {
102
+ if (m.index === floatRegex.lastIndex) {
103
+ floatRegex.lastIndex++;
104
+ }
105
+ m.forEach((match) => durationMatches.add(match));
106
+ }
107
+ const durationWords = (0, wordsToNumber_1.wordsToNumber)(obj.duration.value, false);
108
+ if (durationWords !== 0) {
109
+ durationMatches.add(durationWords.toString());
110
+ }
111
+ obj.duration.value = [...durationMatches].filter((x) => !!x).join(',');
112
+ const orgFrequencyValue = obj.frequency.value.toLowerCase();
113
+ obj.frequency.value = orgFrequencyValue.replace(/\s/g, '');
114
+ const frequencyIncHourly = obj.frequency.value.includes('hour');
115
+ const hourlyFreqInt = parseInt(obj.frequency.value);
116
+ if (obj.frequency.value === 'once-off') {
117
+ obj.frequency.value = 'stat';
118
+ }
119
+ else if (obj.frequency.value.includes('once') ||
120
+ (frequencyIncHourly && hourlyFreqInt === 24)) {
121
+ obj.frequency.value = 'od';
122
+ }
123
+ else if (obj.frequency.value.includes('nightly') ||
124
+ obj.frequency.value === 'on') {
125
+ obj.frequency.value = 'od';
126
+ }
127
+ else if (obj.frequency.value.includes('twice') ||
128
+ (frequencyIncHourly && hourlyFreqInt === 12)) {
129
+ obj.frequency.value = 'bd';
130
+ }
131
+ else if (obj.frequency.value.includes('trice') ||
132
+ (frequencyIncHourly && hourlyFreqInt === 8)) {
133
+ obj.frequency.value = 'tds';
134
+ }
135
+ else if (frequencyIncHourly && hourlyFreqInt === 6) {
136
+ obj.frequency.value = 'qds';
137
+ }
138
+ else if (!ACCEPTED_FREQ.includes(obj.frequency.value)) {
139
+ obj.frequency.value = (0, wordsToNumber_1.wordsToNumber)(orgFrequencyValue, true).toString();
140
+ }
141
+ return obj;
142
+ }
143
+ exports.formatPrescribeAnswer = formatPrescribeAnswer;
144
+ const answerRegex = /answer/gi;
145
+ function correctMark(mark) {
146
+ const data = {
147
+ correct: false,
148
+ incorrect: false,
149
+ correctIndex: -1,
150
+ };
151
+ if (!mark || !mark.mark) {
152
+ return data;
153
+ }
154
+ try {
155
+ const qKeys = Object.keys(mark.question);
156
+ const answerKey = qKeys.find((k) => answerRegex.exec(k)) || 'answer';
157
+ const answer = mark.question[answerKey];
158
+ const flatAnswer = answer[0];
159
+ const flatAttempt = mark.mark[0];
160
+ if (models_1.EQuestionType.SINGLE_BEST_ANSWER === mark.question.typeId) {
161
+ const answer = flatAnswer;
162
+ const attempt = flatAttempt;
163
+ if (answer === attempt) {
164
+ data.correct = true;
165
+ }
166
+ else {
167
+ data.incorrect = true;
168
+ }
169
+ }
170
+ else if (models_1.EQuestionType.QUESTION_ANSWER === mark.question.typeId) {
171
+ const answer = flatAnswer.dose
172
+ .toLowerCase()
173
+ .replace(/\s/g, '');
174
+ let attempt = '';
175
+ if (flatAttempt) {
176
+ attempt = flatAttempt.toLowerCase().replace(/\s/g, '');
177
+ }
178
+ if (answer === attempt) {
179
+ data.correct = true;
180
+ }
181
+ else {
182
+ data.incorrect = true;
183
+ }
184
+ }
185
+ else if (models_1.EQuestionType.MULTIPLE_ANSWERS === mark.question.typeId) {
186
+ const [answerA, answerB] = answer.map((x) => x.sort());
187
+ let [attemptA, attemptB] = [[], []];
188
+ if (Array.isArray(mark.mark) &&
189
+ mark.mark.length === 2 &&
190
+ Array.isArray(mark.mark[0]) &&
191
+ Array.isArray(mark.mark[1])) {
192
+ [attemptA, attemptB] = mark.mark.map((x) => x.sort());
193
+ }
194
+ if (answerA.length !== attemptA.length ||
195
+ answerB.length !== attemptB.length) {
196
+ data.incorrect = true;
197
+ }
198
+ else if (attemptA.every((x, i) => x === answerA[i]) &&
199
+ attemptB.every((x, i) => x === answerB[i])) {
200
+ data.correct = true;
201
+ }
202
+ else {
203
+ data.incorrect = true;
204
+ }
205
+ }
206
+ else if (models_1.EQuestionType.PRESCRIPTION_ANSWER === mark.question.typeId) {
207
+ const answers = answer.map(formatPrescribeAnswer);
208
+ let attempt = formatPrescribeAnswer(mapPrescribeMarkToAnswer({
209
+ drug: '',
210
+ dose: -1,
211
+ units: '',
212
+ route: '',
213
+ frequency: '',
214
+ duration: '',
215
+ }));
216
+ if (typeof flatAttempt === 'object' &&
217
+ Object.keys(flatAttempt).length === 6) {
218
+ attempt = formatPrescribeAnswer(mapPrescribeMarkToAnswer(flatAttempt));
219
+ }
220
+ let foundCorrect = false;
221
+ let index = 0;
222
+ for (const answer of answers) {
223
+ const doseCorrect = answer.dose.display || answer.dose.value === attempt.dose.value;
224
+ const drugCorrect = answer.drug.display || answer.drug.value === attempt.drug.value;
225
+ const durationCorrect = answer.duration.display ||
226
+ answer.duration.value.split(',').includes(attempt.duration.value);
227
+ const frequencyCorrect = answer.frequency.display ||
228
+ answer.frequency.value === attempt.frequency.value;
229
+ const routeCorrect = answer.route.display || answer.route.value === attempt.route.value;
230
+ const unitsCorrect = answer.units.display || answer.units.value === attempt.units.value;
231
+ if (doseCorrect &&
232
+ drugCorrect &&
233
+ durationCorrect &&
234
+ frequencyCorrect &&
235
+ routeCorrect &&
236
+ unitsCorrect) {
237
+ foundCorrect = true;
238
+ break;
239
+ }
240
+ index++;
241
+ }
242
+ if (foundCorrect) {
243
+ data.correct = true;
244
+ data.correctIndex = index;
245
+ }
246
+ else {
247
+ data.incorrect = true;
248
+ }
249
+ }
250
+ }
251
+ catch (e) {
252
+ console.error(e);
253
+ }
254
+ return data;
255
+ }
256
+ exports.correctMark = correctMark;
@@ -0,0 +1,9 @@
1
+ export * from './commonFunctions';
2
+ export * from './lightgallery';
3
+ export * from './offlineLink';
4
+ export * from './random';
5
+ export * from './webSocketLink';
6
+ export * from './wordsToNumber';
7
+ import uuid from './uuid4';
8
+ export declare const Uuid4: typeof uuid;
9
+ export declare function printDuration(duration: number): string;
package/utils/index.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.printDuration = exports.Uuid4 = void 0;
17
+ __exportStar(require("./commonFunctions"), exports);
18
+ __exportStar(require("./lightgallery"), exports);
19
+ __exportStar(require("./offlineLink"), exports);
20
+ __exportStar(require("./random"), exports);
21
+ __exportStar(require("./webSocketLink"), exports);
22
+ __exportStar(require("./wordsToNumber"), exports);
23
+ const uuid4_1 = __importDefault(require("./uuid4"));
24
+ exports.Uuid4 = uuid4_1.default;
25
+ function printDuration(duration) {
26
+ let timeRemainingMins = Math.floor(duration / 60);
27
+ if (timeRemainingMins < 0) {
28
+ timeRemainingMins = 0;
29
+ }
30
+ const timeRemainingMinsStr = timeRemainingMins >= 10
31
+ ? timeRemainingMins.toString()
32
+ : `0${timeRemainingMins}`;
33
+ let timeRemainingSecs = duration % 60;
34
+ if (timeRemainingSecs < 0) {
35
+ timeRemainingSecs = 0;
36
+ }
37
+ const timeRemainingSecsStr = timeRemainingSecs >= 10
38
+ ? timeRemainingSecs.toString()
39
+ : `0${timeRemainingSecs}`;
40
+ return `${timeRemainingMinsStr}:${timeRemainingSecsStr}`;
41
+ }
42
+ exports.printDuration = printDuration;