@quesmed/types 2.6.33 → 2.6.35

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 (31) hide show
  1. package/dist/cjs/models/Promo.d.ts +1 -1
  2. package/dist/cjs/models/User.d.ts +5 -0
  3. package/dist/cjs/models/User.js +34 -1
  4. package/dist/cjs/resolvers/constants.d.ts +2 -7
  5. package/dist/cjs/resolvers/constants.js +4 -19
  6. package/dist/cjs/resolvers/fragments/marksheet.d.ts +1 -1
  7. package/dist/cjs/resolvers/fragments/marksheet.js +7 -2
  8. package/dist/cjs/resolvers/fragments/mockTest.js +1 -0
  9. package/dist/cjs/resolvers/fragments/question.js +2 -0
  10. package/dist/cjs/resolvers/mutation/restricted/marksheet.d.ts +1 -1
  11. package/dist/cjs/resolvers/mutation/restricted/marksheet.js +7 -1
  12. package/dist/cjs/resolvers/mutation/restricted/mockTest.js +2 -0
  13. package/dist/cjs/resolvers/mutation/restricted/questionDiscussion.js +1 -1
  14. package/dist/cjs/resolvers/mutation/restricted/stripe.js +1 -1
  15. package/dist/cjs/resolvers/types.d.ts +7 -0
  16. package/dist/mjs/models/Promo.d.ts +1 -1
  17. package/dist/mjs/models/User.d.ts +5 -0
  18. package/dist/mjs/models/User.js +33 -0
  19. package/dist/mjs/resolvers/constants.d.ts +2 -7
  20. package/dist/mjs/resolvers/constants.js +6 -21
  21. package/dist/mjs/resolvers/fragments/marksheet.d.ts +1 -1
  22. package/dist/mjs/resolvers/fragments/marksheet.js +6 -1
  23. package/dist/mjs/resolvers/fragments/mockTest.js +1 -0
  24. package/dist/mjs/resolvers/fragments/question.js +2 -0
  25. package/dist/mjs/resolvers/mutation/restricted/marksheet.d.ts +1 -1
  26. package/dist/mjs/resolvers/mutation/restricted/marksheet.js +8 -2
  27. package/dist/mjs/resolvers/mutation/restricted/mockTest.js +2 -0
  28. package/dist/mjs/resolvers/mutation/restricted/questionDiscussion.js +1 -1
  29. package/dist/mjs/resolvers/mutation/restricted/stripe.js +1 -1
  30. package/dist/mjs/resolvers/types.d.ts +7 -0
  31. package/package.json +1 -1
@@ -10,5 +10,5 @@ export interface IPromoReport {
10
10
  date: number | Date;
11
11
  couponId: Id;
12
12
  userId: Id;
13
- productId: Id;
13
+ subscriptionId: Id;
14
14
  }
@@ -1,14 +1,17 @@
1
+ import { ExtractKeysWithPattern } from '../resolvers/types';
1
2
  import { ICard } from './Card';
2
3
  import { IConcept } from './Concept';
3
4
  import { IMarksheet } from './Marksheet';
4
5
  import { INotification } from './Notification';
5
6
  import { IOsceStation } from './OsceStation';
7
+ import { EProductType } from './Product';
6
8
  import { IQuestion, IQuestionHighlights } from './Question';
7
9
  import { ISubscription } from './Subscription';
8
10
  import { ITodo } from './Todo';
9
11
  import { Id } from './Type';
10
12
  import { IUniversity } from './University';
11
13
  import { IVideo } from './Video';
14
+ export type IUserSubsriptionDates = keyof ExtractKeysWithPattern<IPayload, 'EndDate'>;
12
15
  export declare enum IAccessLevel {
13
16
  SUBSCRIBER = "subscriber",
14
17
  ADMINISTRATOR = "administrator",
@@ -18,6 +21,8 @@ export declare enum IAccessLevel {
18
21
  }
19
22
  export type IClassYear = 'Year 1' | 'Year 2' | 'Year 3' | 'Year 4' | 'Year 5' | 'Graduated' | 'PhD' | 'BSc' | 'MSc' | 'Beta Tester';
20
23
  export declare const classYears: IClassYear[];
24
+ export declare const subscriptionDates: IUserSubsriptionDates[];
25
+ export declare const dateProductMapping: Record<IUserSubsriptionDates, EProductType>;
21
26
  export declare enum EClassYearGroup {
22
27
  PRECLINICAL = 0,
23
28
  CLINICAL = 1
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.currentClassGroup = exports.currentClassYear = exports.EPracticeIntensity = exports.classYearGroup = exports.EUserLearningStatus = exports.EClassYearGroup = exports.classYears = exports.IAccessLevel = void 0;
3
+ exports.currentClassGroup = exports.currentClassYear = exports.EPracticeIntensity = exports.classYearGroup = exports.EUserLearningStatus = exports.EClassYearGroup = exports.dateProductMapping = exports.subscriptionDates = exports.classYears = exports.IAccessLevel = void 0;
4
4
  const luxon_1 = require("luxon");
5
+ const Product_1 = require("./Product");
5
6
  var IAccessLevel;
6
7
  (function (IAccessLevel) {
7
8
  IAccessLevel["SUBSCRIBER"] = "subscriber";
@@ -18,6 +19,38 @@ exports.classYears = [
18
19
  'Year 5',
19
20
  'Graduated',
20
21
  ];
22
+ exports.subscriptionDates = [
23
+ 'qbankSubscriptionEndDate',
24
+ 'osceSubscriptionEndDate',
25
+ 'bundleSubscriptionEndDate',
26
+ 'anatomySubscriptionEndDate',
27
+ 'medicalSciencesSubscriptionEndDate',
28
+ 'anatomyBundleSubscriptionEndDate',
29
+ 'mrcpPart1SubscriptionEndDate',
30
+ 'mrcpPart2SubscriptionEndDate',
31
+ 'pacesSubscriptionEndDate',
32
+ 'msraSubscriptionEndDate',
33
+ 'anaestheticsInterviewSubscriptionEndDate',
34
+ 'cstInterviewSubscriptionEndDate',
35
+ 'imtInterviewSubscriptionEndDate',
36
+ 'radiologyInterviewSubscriptionEndDate',
37
+ ];
38
+ exports.dateProductMapping = {
39
+ qbankSubscriptionEndDate: Product_1.EProductType.QBANK,
40
+ osceSubscriptionEndDate: Product_1.EProductType.OSCE,
41
+ bundleSubscriptionEndDate: Product_1.EProductType.BUNDLE,
42
+ anatomySubscriptionEndDate: Product_1.EProductType.ANATOMY,
43
+ medicalSciencesSubscriptionEndDate: Product_1.EProductType.MEDICAL_SCIENCES,
44
+ anatomyBundleSubscriptionEndDate: Product_1.EProductType.ANATOMY_BUNDLE,
45
+ mrcpPart1SubscriptionEndDate: Product_1.EProductType.MRCP_PART1,
46
+ mrcpPart2SubscriptionEndDate: Product_1.EProductType.MRCP_PART2,
47
+ pacesSubscriptionEndDate: Product_1.EProductType.PACES,
48
+ msraSubscriptionEndDate: Product_1.EProductType.MSRA,
49
+ anaestheticsInterviewSubscriptionEndDate: Product_1.EProductType.INTERVIEW_ANAESTHETICS,
50
+ cstInterviewSubscriptionEndDate: Product_1.EProductType.INTERVIEW_IMT,
51
+ imtInterviewSubscriptionEndDate: Product_1.EProductType.QBANK,
52
+ radiologyInterviewSubscriptionEndDate: Product_1.EProductType.INTERVIEW_RADIOLOGY,
53
+ };
21
54
  var EClassYearGroup;
22
55
  (function (EClassYearGroup) {
23
56
  EClassYearGroup[EClassYearGroup["PRECLINICAL"] = 0] = "PRECLINICAL";
@@ -1,12 +1,7 @@
1
- import { EMockTestType, EProductType, ETopicType } from "../models";
2
- import { DB_TYPE } from "./enums";
3
- /**
4
- * TODO:: move this config in database so that we can swap things in-out more easily
5
- * can be part of entitlement table or another
6
- */
1
+ import { EMockTestType, EProductType, ETopicType } from '../models';
2
+ import { DB_TYPE } from './enums';
7
3
  export declare const productMapping: Partial<Record<EProductType, {
8
4
  db: DB_TYPE;
9
- builderTopicType: ETopicType[];
10
5
  topicType: ETopicType[];
11
6
  mockType: EMockTestType[];
12
7
  }>>;
@@ -17,93 +17,78 @@ const ALL_MOCKS_WITHOUT_ANATOMY = [
17
17
  models_1.EMockTestType.UKMLA,
18
18
  ];
19
19
  const ALL_MOCKS = [models_1.EMockTestType.ANATOMY_SPOTTER, ...ALL_MOCKS_WITHOUT_ANATOMY];
20
- /**
21
- * TODO:: move this config in database so that we can swap things in-out more easily
22
- * can be part of entitlement table or another
23
- */
24
20
  exports.productMapping = {
25
21
  [models_1.EProductType.QBANK]: {
26
22
  db: enums_1.DB_TYPE.FINALS,
27
23
  topicType: ALL_TOPIC_TYPE_WITHOUT_ANATOMY,
28
- builderTopicType: ALL_TOPIC_TYPE_WITHOUT_ANATOMY,
29
24
  mockType: ALL_MOCKS_WITHOUT_ANATOMY,
30
25
  },
31
26
  [models_1.EProductType.OSCE]: {
32
27
  db: enums_1.DB_TYPE.FINALS,
33
28
  topicType: ALL_TOPIC_TYPE,
34
- builderTopicType: ALL_TOPIC_TYPE,
35
29
  mockType: ALL_MOCKS,
36
30
  },
37
31
  [models_1.EProductType.BUNDLE]: {
38
32
  db: enums_1.DB_TYPE.FINALS,
39
33
  topicType: ALL_TOPIC_TYPE_WITHOUT_ANATOMY,
40
- builderTopicType: ALL_TOPIC_TYPE_WITHOUT_ANATOMY,
41
34
  mockType: ALL_MOCKS_WITHOUT_ANATOMY,
42
35
  },
43
36
  [models_1.EProductType.ANATOMY]: {
44
37
  db: enums_1.DB_TYPE.FINALS,
45
38
  topicType: [models_1.ETopicType.ANATOMY],
46
- builderTopicType: [models_1.ETopicType.ANATOMY],
47
39
  mockType: [models_1.EMockTestType.ANATOMY_SPOTTER],
48
40
  },
49
41
  [models_1.EProductType.MEDICAL_SCIENCES]: {
50
42
  db: enums_1.DB_TYPE.FINALS,
51
- builderTopicType: [models_1.ETopicType.PRE_CLINICAL],
52
43
  topicType: [models_1.ETopicType.PRE_CLINICAL],
53
44
  mockType: [models_1.EMockTestType.UNIVERSITY_SPECIFIC],
54
45
  },
55
46
  [models_1.EProductType.ANATOMY_BUNDLE]: {
56
47
  db: enums_1.DB_TYPE.FINALS,
57
48
  topicType: [models_1.ETopicType.ANATOMY, models_1.ETopicType.PRE_CLINICAL],
58
- builderTopicType: [models_1.ETopicType.ANATOMY, models_1.ETopicType.PRE_CLINICAL],
59
- mockType: [models_1.EMockTestType.ANATOMY_SPOTTER, models_1.EMockTestType.UNIVERSITY_SPECIFIC],
49
+ mockType: [
50
+ models_1.EMockTestType.ANATOMY_SPOTTER,
51
+ models_1.EMockTestType.UNIVERSITY_SPECIFIC,
52
+ ],
60
53
  },
61
54
  [models_1.EProductType.MRCP_PART1]: {
62
55
  db: enums_1.DB_TYPE.MRCP,
63
56
  topicType: [models_1.ETopicType.CLINICAL],
64
- builderTopicType: [models_1.ETopicType.CLINICAL],
65
57
  mockType: [models_1.EMockTestType.MRCP],
66
58
  },
67
59
  [models_1.EProductType.MRCP_PART2]: {
68
60
  db: enums_1.DB_TYPE.MRCP,
69
61
  topicType: [models_1.ETopicType.CLINICAL],
70
- builderTopicType: [models_1.ETopicType.CLINICAL],
71
62
  mockType: [models_1.EMockTestType.MRCP],
72
63
  },
73
64
  [models_1.EProductType.PACES]: {
74
65
  db: enums_1.DB_TYPE.MRCP,
75
66
  topicType: [models_1.ETopicType.OSCE],
76
- builderTopicType: [models_1.ETopicType.OSCE],
77
67
  mockType: ALL_MOCKS,
78
68
  },
79
69
  [models_1.EProductType.MSRA]: {
80
70
  db: enums_1.DB_TYPE.FINALS,
81
71
  topicType: [models_1.ETopicType.CLINICAL],
82
- builderTopicType: [models_1.ETopicType.CLINICAL, models_1.ETopicType.SJT],
83
72
  mockType: ALL_MOCKS,
84
73
  },
85
74
  [models_1.EProductType.INTERVIEW_ANAESTHETICS]: {
86
75
  db: enums_1.DB_TYPE.FINALS,
87
76
  topicType: [models_1.ETopicType.INTERVIEW_ANAESTHETICS],
88
- builderTopicType: [models_1.ETopicType.INTERVIEW_ANAESTHETICS],
89
77
  mockType: ALL_MOCKS,
90
78
  },
91
79
  [models_1.EProductType.INTERVIEW_CST]: {
92
80
  db: enums_1.DB_TYPE.FINALS,
93
81
  topicType: [models_1.ETopicType.INTERVIEW_CST],
94
- builderTopicType: [models_1.ETopicType.INTERVIEW_CST],
95
82
  mockType: ALL_MOCKS,
96
83
  },
97
84
  [models_1.EProductType.INTERVIEW_IMT]: {
98
85
  db: enums_1.DB_TYPE.FINALS,
99
86
  topicType: [models_1.ETopicType.INTERVIEW_IMT],
100
- builderTopicType: [models_1.ETopicType.INTERVIEW_IMT],
101
87
  mockType: ALL_MOCKS,
102
88
  },
103
89
  [models_1.EProductType.INTERVIEW_RADIOLOGY]: {
104
90
  db: enums_1.DB_TYPE.FINALS,
105
91
  topicType: [models_1.ETopicType.INTERVIEW_RADIOLOGY],
106
- builderTopicType: [models_1.ETopicType.INTERVIEW_RADIOLOGY],
107
92
  mockType: ALL_MOCKS,
108
93
  },
109
94
  };
@@ -11,5 +11,5 @@ export declare const MODIFY_MARKSHEET_STATE_FRAGMENT: import("@apollo/client").D
11
11
  export declare const MODIFY_TOPIC_SELECTION_FRAGMENT: import("@apollo/client").DocumentNode;
12
12
  export declare const MODIFY_CURRENT_MARK_FRAGMENT: import("@apollo/client").DocumentNode;
13
13
  export declare const MARK_FLAGGED_FIELD: import("@apollo/client").DocumentNode;
14
- export declare const MODIFY_COMPLETED_FRAGMENT: import("@apollo/client").DocumentNode;
14
+ export declare const MODIFY_MARKSHEET_COMPLETED_FRAGMENT: import("@apollo/client").DocumentNode;
15
15
  export declare const NEW_MARK_FIELDS: import("@apollo/client").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NEW_MARK_FIELDS = exports.MODIFY_COMPLETED_FRAGMENT = exports.MARK_FLAGGED_FIELD = exports.MODIFY_CURRENT_MARK_FRAGMENT = exports.MODIFY_TOPIC_SELECTION_FRAGMENT = exports.MODIFY_MARKSHEET_STATE_FRAGMENT = exports.MODIFY_MARKSHEET_MARK_STRIKED_FRAGMENT = exports.MODIFY_MARKSHEET_MARK_QUESTIONCHOICEID_FRAGMENT = exports.MODIFY_CURRENT_MARKSHEET_MARK_FRAGMENT = exports.MARKSHEET_FIELDS = exports.BUILDER_CONFIG_FIELDS = exports.MARKSHEET_MARK_FIELDS = void 0;
3
+ exports.NEW_MARK_FIELDS = exports.MODIFY_MARKSHEET_COMPLETED_FRAGMENT = exports.MARK_FLAGGED_FIELD = exports.MODIFY_CURRENT_MARK_FRAGMENT = exports.MODIFY_TOPIC_SELECTION_FRAGMENT = exports.MODIFY_MARKSHEET_STATE_FRAGMENT = exports.MODIFY_MARKSHEET_MARK_STRIKED_FRAGMENT = exports.MODIFY_MARKSHEET_MARK_QUESTIONCHOICEID_FRAGMENT = exports.MODIFY_CURRENT_MARKSHEET_MARK_FRAGMENT = exports.MARKSHEET_FIELDS = exports.BUILDER_CONFIG_FIELDS = exports.MARKSHEET_MARK_FIELDS = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const question_1 = require("./question");
6
6
  exports.MARKSHEET_MARK_FIELDS = (0, client_1.gql) `
@@ -128,9 +128,14 @@ exports.MARK_FLAGGED_FIELD = (0, client_1.gql) `
128
128
  flagged
129
129
  }
130
130
  `;
131
- exports.MODIFY_COMPLETED_FRAGMENT = (0, client_1.gql) `
131
+ exports.MODIFY_MARKSHEET_COMPLETED_FRAGMENT = (0, client_1.gql) `
132
132
  fragment MarksheetCompleted on Marksheet {
133
+ timeTaken
133
134
  completed
135
+ correct
136
+ incorrect
137
+ duration
138
+ endedAt
134
139
  }
135
140
  `;
136
141
  exports.NEW_MARK_FIELDS = (0, client_1.gql) `
@@ -29,6 +29,7 @@ exports.COMPLETED_MOCK_TEST_MARKSHEET_FRAGMENT = (0, client_1.gql) `
29
29
  fragment MockTestCompleted on Marksheet {
30
30
  completed
31
31
  correct
32
+ timeTaken
32
33
  incorrect
33
34
  duration
34
35
  endedAt
@@ -140,6 +140,8 @@ exports.QUESTION_FIELDS = (0, client_1.gql) `
140
140
  ...QuestionCommentFields
141
141
  }
142
142
  concept {
143
+ # needed for daily stack
144
+ totalCards
143
145
  ...ConceptFields
144
146
  }
145
147
  pictures {
@@ -242,7 +242,7 @@ export interface IEndMarksheetVar {
242
242
  }
243
243
  export type IEndMarksheetData = RestrictedData<graphqlNormalize & IMarksheet, 'endMarksheet'>;
244
244
  export declare const END_MARKSHEET: import("@apollo/client").DocumentNode;
245
- export declare const updateCacheOnEndMarksheet: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IEndMarksheetData>, options: ApolloUpdateOptions) => void;
245
+ export declare const updateCacheOnEndMarksheet: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IEndMarksheetData>, options: ApolloUpdateOptions<IEndMarksheetVar>) => void;
246
246
  export declare const optimisticEndMarksheet: (marksheet: IMarksheet) => {
247
247
  restricted: {
248
248
  __typename: string;
@@ -389,6 +389,7 @@ exports.END_MARKSHEET = (0, client_1.gql) `
389
389
  endMarksheet(marksheetId: $marksheetId) {
390
390
  id
391
391
  timeTaken
392
+ startedAt
392
393
  endedAt
393
394
  completed
394
395
  passingMark
@@ -411,8 +412,13 @@ const updateCacheOnEndMarksheet = (cache, result, options) => {
411
412
  id: cache.identify({ id, __typename: 'Marksheet' }),
412
413
  data: {
413
414
  completed: true,
415
+ timeTaken: endMarksheet.timeTaken,
416
+ correct: endMarksheet.correct,
417
+ incorrect: endMarksheet.incorrect,
418
+ duration: endMarksheet.duration,
419
+ endedAt: endMarksheet.endedAt,
414
420
  },
415
- fragment: marksheet_1.MODIFY_COMPLETED_FRAGMENT,
421
+ fragment: marksheet_1.MODIFY_MARKSHEET_COMPLETED_FRAGMENT,
416
422
  });
417
423
  };
418
424
  exports.updateCacheOnEndMarksheet = updateCacheOnEndMarksheet;
@@ -60,6 +60,7 @@ exports.END_MOCK_TEST = (0, client_1.gql) `
60
60
  restricted {
61
61
  endMockTest(marksheetId: $marksheetId) {
62
62
  id
63
+ timeTaken
63
64
  startedAt
64
65
  endedAt
65
66
  mockTestId
@@ -83,6 +84,7 @@ const updateCacheOnEndMockTest = (cache, result, options) => {
83
84
  id: cache.identify({ id, __typename: 'Marksheet' }),
84
85
  data: {
85
86
  completed: true,
87
+ timeTaken: endMockTest.timeTaken,
86
88
  correct: endMockTest.correct,
87
89
  incorrect: endMockTest.incorrect,
88
90
  duration: endMockTest.duration,
@@ -279,7 +279,7 @@ const updateQuestionCommentsRemove = (typeId) => (cache, result, options) => {
279
279
  });
280
280
  if (dataFragment) {
281
281
  const { comments = [] } = dataFragment;
282
- const createdAtDate = luxon_1.DateTime.fromJSDate(createdAt);
282
+ const createdAtDate = luxon_1.DateTime.fromSeconds(createdAt);
283
283
  const diffInHours = luxon_1.DateTime.now().diff(createdAtDate, 'hours').hours;
284
284
  let updatedComments = [];
285
285
  if (diffInHours >= 24) {
@@ -4,7 +4,7 @@ exports.updateSubscriptionOnCancelOrRenew = exports.CANCEL_SUBSCRIPTION = void 0
4
4
  const client_1 = require("@apollo/client");
5
5
  const restricted_1 = require("../../query/restricted");
6
6
  exports.CANCEL_SUBSCRIPTION = (0, client_1.gql) `
7
- mutation Mutation($subscriptionId: Int!) {
7
+ mutation CancelSubscription($subscriptionId: Int!) {
8
8
  restricted {
9
9
  cancelSubscription(subscriptionId: $subscriptionId) {
10
10
  id
@@ -9,3 +9,10 @@ export type AdminData<T, K extends keyof any> = {
9
9
  };
10
10
  export type RootData<T, K extends keyof any> = Record<K, T>;
11
11
  export type Nullable<T> = T | null;
12
+ export type ExtractKeysWithPattern<U, V extends string> = {
13
+ [K in keyof U as K extends `${infer Prefix}${V}` ? K : never]: U[K];
14
+ };
15
+ export type DotPrefix<T extends string> = T extends '' ? '' : `.${T}`;
16
+ export type WithRequired<T, K extends keyof T> = T & {
17
+ [P in K]-?: T[P];
18
+ };
@@ -10,5 +10,5 @@ export interface IPromoReport {
10
10
  date: number | Date;
11
11
  couponId: Id;
12
12
  userId: Id;
13
- productId: Id;
13
+ subscriptionId: Id;
14
14
  }
@@ -1,14 +1,17 @@
1
+ import { ExtractKeysWithPattern } from '../resolvers/types';
1
2
  import { ICard } from './Card';
2
3
  import { IConcept } from './Concept';
3
4
  import { IMarksheet } from './Marksheet';
4
5
  import { INotification } from './Notification';
5
6
  import { IOsceStation } from './OsceStation';
7
+ import { EProductType } from './Product';
6
8
  import { IQuestion, IQuestionHighlights } from './Question';
7
9
  import { ISubscription } from './Subscription';
8
10
  import { ITodo } from './Todo';
9
11
  import { Id } from './Type';
10
12
  import { IUniversity } from './University';
11
13
  import { IVideo } from './Video';
14
+ export type IUserSubsriptionDates = keyof ExtractKeysWithPattern<IPayload, 'EndDate'>;
12
15
  export declare enum IAccessLevel {
13
16
  SUBSCRIBER = "subscriber",
14
17
  ADMINISTRATOR = "administrator",
@@ -18,6 +21,8 @@ export declare enum IAccessLevel {
18
21
  }
19
22
  export type IClassYear = 'Year 1' | 'Year 2' | 'Year 3' | 'Year 4' | 'Year 5' | 'Graduated' | 'PhD' | 'BSc' | 'MSc' | 'Beta Tester';
20
23
  export declare const classYears: IClassYear[];
24
+ export declare const subscriptionDates: IUserSubsriptionDates[];
25
+ export declare const dateProductMapping: Record<IUserSubsriptionDates, EProductType>;
21
26
  export declare enum EClassYearGroup {
22
27
  PRECLINICAL = 0,
23
28
  CLINICAL = 1
@@ -1,4 +1,5 @@
1
1
  import { DateTime } from 'luxon';
2
+ import { EProductType } from './Product';
2
3
  export var IAccessLevel;
3
4
  (function (IAccessLevel) {
4
5
  IAccessLevel["SUBSCRIBER"] = "subscriber";
@@ -15,6 +16,38 @@ export const classYears = [
15
16
  'Year 5',
16
17
  'Graduated',
17
18
  ];
19
+ export const subscriptionDates = [
20
+ 'qbankSubscriptionEndDate',
21
+ 'osceSubscriptionEndDate',
22
+ 'bundleSubscriptionEndDate',
23
+ 'anatomySubscriptionEndDate',
24
+ 'medicalSciencesSubscriptionEndDate',
25
+ 'anatomyBundleSubscriptionEndDate',
26
+ 'mrcpPart1SubscriptionEndDate',
27
+ 'mrcpPart2SubscriptionEndDate',
28
+ 'pacesSubscriptionEndDate',
29
+ 'msraSubscriptionEndDate',
30
+ 'anaestheticsInterviewSubscriptionEndDate',
31
+ 'cstInterviewSubscriptionEndDate',
32
+ 'imtInterviewSubscriptionEndDate',
33
+ 'radiologyInterviewSubscriptionEndDate',
34
+ ];
35
+ export const dateProductMapping = {
36
+ qbankSubscriptionEndDate: EProductType.QBANK,
37
+ osceSubscriptionEndDate: EProductType.OSCE,
38
+ bundleSubscriptionEndDate: EProductType.BUNDLE,
39
+ anatomySubscriptionEndDate: EProductType.ANATOMY,
40
+ medicalSciencesSubscriptionEndDate: EProductType.MEDICAL_SCIENCES,
41
+ anatomyBundleSubscriptionEndDate: EProductType.ANATOMY_BUNDLE,
42
+ mrcpPart1SubscriptionEndDate: EProductType.MRCP_PART1,
43
+ mrcpPart2SubscriptionEndDate: EProductType.MRCP_PART2,
44
+ pacesSubscriptionEndDate: EProductType.PACES,
45
+ msraSubscriptionEndDate: EProductType.MSRA,
46
+ anaestheticsInterviewSubscriptionEndDate: EProductType.INTERVIEW_ANAESTHETICS,
47
+ cstInterviewSubscriptionEndDate: EProductType.INTERVIEW_IMT,
48
+ imtInterviewSubscriptionEndDate: EProductType.QBANK,
49
+ radiologyInterviewSubscriptionEndDate: EProductType.INTERVIEW_RADIOLOGY,
50
+ };
18
51
  export var EClassYearGroup;
19
52
  (function (EClassYearGroup) {
20
53
  EClassYearGroup[EClassYearGroup["PRECLINICAL"] = 0] = "PRECLINICAL";
@@ -1,12 +1,7 @@
1
- import { EMockTestType, EProductType, ETopicType } from "../models";
2
- import { DB_TYPE } from "./enums";
3
- /**
4
- * TODO:: move this config in database so that we can swap things in-out more easily
5
- * can be part of entitlement table or another
6
- */
1
+ import { EMockTestType, EProductType, ETopicType } from '../models';
2
+ import { DB_TYPE } from './enums';
7
3
  export declare const productMapping: Partial<Record<EProductType, {
8
4
  db: DB_TYPE;
9
- builderTopicType: ETopicType[];
10
5
  topicType: ETopicType[];
11
6
  mockType: EMockTestType[];
12
7
  }>>;
@@ -1,5 +1,5 @@
1
- import { EMockTestType, EProductType, ETopicType } from "../models";
2
- import { DB_TYPE } from "./enums";
1
+ import { EMockTestType, EProductType, ETopicType } from '../models';
2
+ import { DB_TYPE } from './enums';
3
3
  const ALL_TOPIC_TYPE_WITHOUT_ANATOMY = [
4
4
  ETopicType.CLINICAL,
5
5
  ETopicType.DATA_INTERPRETATION,
@@ -14,93 +14,78 @@ const ALL_MOCKS_WITHOUT_ANATOMY = [
14
14
  EMockTestType.UKMLA,
15
15
  ];
16
16
  const ALL_MOCKS = [EMockTestType.ANATOMY_SPOTTER, ...ALL_MOCKS_WITHOUT_ANATOMY];
17
- /**
18
- * TODO:: move this config in database so that we can swap things in-out more easily
19
- * can be part of entitlement table or another
20
- */
21
17
  export const productMapping = {
22
18
  [EProductType.QBANK]: {
23
19
  db: DB_TYPE.FINALS,
24
20
  topicType: ALL_TOPIC_TYPE_WITHOUT_ANATOMY,
25
- builderTopicType: ALL_TOPIC_TYPE_WITHOUT_ANATOMY,
26
21
  mockType: ALL_MOCKS_WITHOUT_ANATOMY,
27
22
  },
28
23
  [EProductType.OSCE]: {
29
24
  db: DB_TYPE.FINALS,
30
25
  topicType: ALL_TOPIC_TYPE,
31
- builderTopicType: ALL_TOPIC_TYPE,
32
26
  mockType: ALL_MOCKS,
33
27
  },
34
28
  [EProductType.BUNDLE]: {
35
29
  db: DB_TYPE.FINALS,
36
30
  topicType: ALL_TOPIC_TYPE_WITHOUT_ANATOMY,
37
- builderTopicType: ALL_TOPIC_TYPE_WITHOUT_ANATOMY,
38
31
  mockType: ALL_MOCKS_WITHOUT_ANATOMY,
39
32
  },
40
33
  [EProductType.ANATOMY]: {
41
34
  db: DB_TYPE.FINALS,
42
35
  topicType: [ETopicType.ANATOMY],
43
- builderTopicType: [ETopicType.ANATOMY],
44
36
  mockType: [EMockTestType.ANATOMY_SPOTTER],
45
37
  },
46
38
  [EProductType.MEDICAL_SCIENCES]: {
47
39
  db: DB_TYPE.FINALS,
48
- builderTopicType: [ETopicType.PRE_CLINICAL],
49
40
  topicType: [ETopicType.PRE_CLINICAL],
50
41
  mockType: [EMockTestType.UNIVERSITY_SPECIFIC],
51
42
  },
52
43
  [EProductType.ANATOMY_BUNDLE]: {
53
44
  db: DB_TYPE.FINALS,
54
45
  topicType: [ETopicType.ANATOMY, ETopicType.PRE_CLINICAL],
55
- builderTopicType: [ETopicType.ANATOMY, ETopicType.PRE_CLINICAL],
56
- mockType: [EMockTestType.ANATOMY_SPOTTER, EMockTestType.UNIVERSITY_SPECIFIC],
46
+ mockType: [
47
+ EMockTestType.ANATOMY_SPOTTER,
48
+ EMockTestType.UNIVERSITY_SPECIFIC,
49
+ ],
57
50
  },
58
51
  [EProductType.MRCP_PART1]: {
59
52
  db: DB_TYPE.MRCP,
60
53
  topicType: [ETopicType.CLINICAL],
61
- builderTopicType: [ETopicType.CLINICAL],
62
54
  mockType: [EMockTestType.MRCP],
63
55
  },
64
56
  [EProductType.MRCP_PART2]: {
65
57
  db: DB_TYPE.MRCP,
66
58
  topicType: [ETopicType.CLINICAL],
67
- builderTopicType: [ETopicType.CLINICAL],
68
59
  mockType: [EMockTestType.MRCP],
69
60
  },
70
61
  [EProductType.PACES]: {
71
62
  db: DB_TYPE.MRCP,
72
63
  topicType: [ETopicType.OSCE],
73
- builderTopicType: [ETopicType.OSCE],
74
64
  mockType: ALL_MOCKS,
75
65
  },
76
66
  [EProductType.MSRA]: {
77
67
  db: DB_TYPE.FINALS,
78
68
  topicType: [ETopicType.CLINICAL],
79
- builderTopicType: [ETopicType.CLINICAL, ETopicType.SJT],
80
69
  mockType: ALL_MOCKS,
81
70
  },
82
71
  [EProductType.INTERVIEW_ANAESTHETICS]: {
83
72
  db: DB_TYPE.FINALS,
84
73
  topicType: [ETopicType.INTERVIEW_ANAESTHETICS],
85
- builderTopicType: [ETopicType.INTERVIEW_ANAESTHETICS],
86
74
  mockType: ALL_MOCKS,
87
75
  },
88
76
  [EProductType.INTERVIEW_CST]: {
89
77
  db: DB_TYPE.FINALS,
90
78
  topicType: [ETopicType.INTERVIEW_CST],
91
- builderTopicType: [ETopicType.INTERVIEW_CST],
92
79
  mockType: ALL_MOCKS,
93
80
  },
94
81
  [EProductType.INTERVIEW_IMT]: {
95
82
  db: DB_TYPE.FINALS,
96
83
  topicType: [ETopicType.INTERVIEW_IMT],
97
- builderTopicType: [ETopicType.INTERVIEW_IMT],
98
84
  mockType: ALL_MOCKS,
99
85
  },
100
86
  [EProductType.INTERVIEW_RADIOLOGY]: {
101
87
  db: DB_TYPE.FINALS,
102
88
  topicType: [ETopicType.INTERVIEW_RADIOLOGY],
103
- builderTopicType: [ETopicType.INTERVIEW_RADIOLOGY],
104
89
  mockType: ALL_MOCKS,
105
90
  },
106
91
  };
@@ -11,5 +11,5 @@ export declare const MODIFY_MARKSHEET_STATE_FRAGMENT: import("@apollo/client").D
11
11
  export declare const MODIFY_TOPIC_SELECTION_FRAGMENT: import("@apollo/client").DocumentNode;
12
12
  export declare const MODIFY_CURRENT_MARK_FRAGMENT: import("@apollo/client").DocumentNode;
13
13
  export declare const MARK_FLAGGED_FIELD: import("@apollo/client").DocumentNode;
14
- export declare const MODIFY_COMPLETED_FRAGMENT: import("@apollo/client").DocumentNode;
14
+ export declare const MODIFY_MARKSHEET_COMPLETED_FRAGMENT: import("@apollo/client").DocumentNode;
15
15
  export declare const NEW_MARK_FIELDS: import("@apollo/client").DocumentNode;
@@ -125,9 +125,14 @@ export const MARK_FLAGGED_FIELD = gql `
125
125
  flagged
126
126
  }
127
127
  `;
128
- export const MODIFY_COMPLETED_FRAGMENT = gql `
128
+ export const MODIFY_MARKSHEET_COMPLETED_FRAGMENT = gql `
129
129
  fragment MarksheetCompleted on Marksheet {
130
+ timeTaken
130
131
  completed
132
+ correct
133
+ incorrect
134
+ duration
135
+ endedAt
131
136
  }
132
137
  `;
133
138
  export const NEW_MARK_FIELDS = gql `
@@ -26,6 +26,7 @@ export const COMPLETED_MOCK_TEST_MARKSHEET_FRAGMENT = gql `
26
26
  fragment MockTestCompleted on Marksheet {
27
27
  completed
28
28
  correct
29
+ timeTaken
29
30
  incorrect
30
31
  duration
31
32
  endedAt
@@ -137,6 +137,8 @@ export const QUESTION_FIELDS = gql `
137
137
  ...QuestionCommentFields
138
138
  }
139
139
  concept {
140
+ # needed for daily stack
141
+ totalCards
140
142
  ...ConceptFields
141
143
  }
142
144
  pictures {
@@ -242,7 +242,7 @@ export interface IEndMarksheetVar {
242
242
  }
243
243
  export type IEndMarksheetData = RestrictedData<graphqlNormalize & IMarksheet, 'endMarksheet'>;
244
244
  export declare const END_MARKSHEET: import("@apollo/client").DocumentNode;
245
- export declare const updateCacheOnEndMarksheet: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IEndMarksheetData>, options: ApolloUpdateOptions) => void;
245
+ export declare const updateCacheOnEndMarksheet: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IEndMarksheetData>, options: ApolloUpdateOptions<IEndMarksheetVar>) => void;
246
246
  export declare const optimisticEndMarksheet: (marksheet: IMarksheet) => {
247
247
  restricted: {
248
248
  __typename: string;
@@ -1,5 +1,5 @@
1
1
  import { gql } from '@apollo/client';
2
- import { BUILDER_CONFIG_FIELDS, MARKSHEET_FIELDS, MARK_FLAGGED_FIELD, MODIFY_COMPLETED_FRAGMENT, NEW_MARK_FIELDS, } from '../../fragments/marksheet';
2
+ import { BUILDER_CONFIG_FIELDS, MARKSHEET_FIELDS, MARK_FLAGGED_FIELD, MODIFY_MARKSHEET_COMPLETED_FRAGMENT, NEW_MARK_FIELDS, } from '../../fragments/marksheet';
3
3
  import { MARKSHEET, } from '../../query/restricted';
4
4
  export const BUILD_QUESTION_MARKSHEET = gql `
5
5
  ${MARKSHEET_FIELDS}
@@ -379,6 +379,7 @@ export const END_MARKSHEET = gql `
379
379
  endMarksheet(marksheetId: $marksheetId) {
380
380
  id
381
381
  timeTaken
382
+ startedAt
382
383
  endedAt
383
384
  completed
384
385
  passingMark
@@ -401,8 +402,13 @@ export const updateCacheOnEndMarksheet = (cache, result, options) => {
401
402
  id: cache.identify({ id, __typename: 'Marksheet' }),
402
403
  data: {
403
404
  completed: true,
405
+ timeTaken: endMarksheet.timeTaken,
406
+ correct: endMarksheet.correct,
407
+ incorrect: endMarksheet.incorrect,
408
+ duration: endMarksheet.duration,
409
+ endedAt: endMarksheet.endedAt,
404
410
  },
405
- fragment: MODIFY_COMPLETED_FRAGMENT,
411
+ fragment: MODIFY_MARKSHEET_COMPLETED_FRAGMENT,
406
412
  });
407
413
  };
408
414
  export const optimisticEndMarksheet = (marksheet) => ({
@@ -55,6 +55,7 @@ export const END_MOCK_TEST = gql `
55
55
  restricted {
56
56
  endMockTest(marksheetId: $marksheetId) {
57
57
  id
58
+ timeTaken
58
59
  startedAt
59
60
  endedAt
60
61
  mockTestId
@@ -78,6 +79,7 @@ export const updateCacheOnEndMockTest = (cache, result, options) => {
78
79
  id: cache.identify({ id, __typename: 'Marksheet' }),
79
80
  data: {
80
81
  completed: true,
82
+ timeTaken: endMockTest.timeTaken,
81
83
  correct: endMockTest.correct,
82
84
  incorrect: endMockTest.incorrect,
83
85
  duration: endMockTest.duration,
@@ -270,7 +270,7 @@ export const updateQuestionCommentsRemove = (typeId) => (cache, result, options)
270
270
  });
271
271
  if (dataFragment) {
272
272
  const { comments = [] } = dataFragment;
273
- const createdAtDate = DateTime.fromJSDate(createdAt);
273
+ const createdAtDate = DateTime.fromSeconds(createdAt);
274
274
  const diffInHours = DateTime.now().diff(createdAtDate, 'hours').hours;
275
275
  let updatedComments = [];
276
276
  if (diffInHours >= 24) {
@@ -1,7 +1,7 @@
1
1
  import { gql } from '@apollo/client';
2
2
  import { USER } from '../../query/restricted';
3
3
  export const CANCEL_SUBSCRIPTION = gql `
4
- mutation Mutation($subscriptionId: Int!) {
4
+ mutation CancelSubscription($subscriptionId: Int!) {
5
5
  restricted {
6
6
  cancelSubscription(subscriptionId: $subscriptionId) {
7
7
  id
@@ -9,3 +9,10 @@ export type AdminData<T, K extends keyof any> = {
9
9
  };
10
10
  export type RootData<T, K extends keyof any> = Record<K, T>;
11
11
  export type Nullable<T> = T | null;
12
+ export type ExtractKeysWithPattern<U, V extends string> = {
13
+ [K in keyof U as K extends `${infer Prefix}${V}` ? K : never]: U[K];
14
+ };
15
+ export type DotPrefix<T extends string> = T extends '' ? '' : `.${T}`;
16
+ export type WithRequired<T, K extends keyof T> = T & {
17
+ [P in K]-?: T[P];
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.33",
3
+ "version": "2.6.35",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",