@quesmed/types 2.6.73 → 2.6.74

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.
@@ -5,3 +5,7 @@ export declare const productMapping: Partial<Record<EProductType, {
5
5
  topicType: ETopicType[];
6
6
  mockType: EMockTestType[];
7
7
  }>>;
8
+ export declare const getEntitlementFromTopicType: (topicType: ETopicType, productType: EProductType) => {
9
+ id: number;
10
+ name: string;
11
+ };
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.productMapping = void 0;
3
+ exports.getEntitlementFromTopicType = exports.productMapping = void 0;
4
4
  const models_1 = require("../models");
5
+ const utils_1 = require("../utils");
5
6
  const enums_1 = require("./enums");
6
7
  const ALL_TOPIC_TYPE_WITHOUT_ANATOMY = [
7
8
  models_1.ETopicType.CLINICAL,
@@ -40,7 +41,7 @@ exports.productMapping = {
40
41
  },
41
42
  [models_1.EProductType.MEDICAL_SCIENCES]: {
42
43
  db: enums_1.DB_TYPE.FINALS,
43
- topicType: [models_1.ETopicType.PRE_CLINICAL],
44
+ topicType: [models_1.ETopicType.PRE_CLINICAL, models_1.ETopicType.CLINICAL],
44
45
  mockType: [models_1.EMockTestType.UNIVERSITY_SPECIFIC],
45
46
  },
46
47
  [models_1.EProductType.ANATOMY_BUNDLE]: {
@@ -102,3 +103,32 @@ exports.productMapping = {
102
103
  mockType: ALL_MOCKS,
103
104
  },
104
105
  };
106
+ const topicEntitlementMap = {
107
+ [models_1.ETopicType.PRE_CLINICAL]: models_1.EEntitlementType.PRE_CLINICAL,
108
+ [models_1.ETopicType.CLINICAL]: models_1.EEntitlementType.CLINICAL,
109
+ [models_1.ETopicType.ANATOMY]: models_1.EEntitlementType.ANATOMY,
110
+ [models_1.ETopicType.DATA_INTERPRETATION]: models_1.EEntitlementType.DATA_INTERPRETATION,
111
+ [models_1.ETopicType.SJT]: models_1.EEntitlementType.PROFESSIONAL_DILEMMA,
112
+ [models_1.ETopicType.INTERVIEW_ANAESTHETICS]: models_1.EEntitlementType.INTERVIEW_ANAESTHETICS,
113
+ [models_1.ETopicType.INTERVIEW_CST]: models_1.EEntitlementType.INTERVIEW_CST,
114
+ [models_1.ETopicType.INTERVIEW_IMT]: models_1.EEntitlementType.INTERVIEW_IMT,
115
+ [models_1.ETopicType.INTERVIEW_RADIOLOGY]: models_1.EEntitlementType.INTERVIEW_RADIOLOGY,
116
+ };
117
+ const clinicalEntitlementMap = {
118
+ [models_1.EProductType.MEDICAL_SCIENCES]: models_1.EEntitlementType.CLINICAL_SUBSET,
119
+ [models_1.EProductType.QBANK]: models_1.EEntitlementType.CLINICAL,
120
+ [models_1.EProductType.MSRA]: models_1.EEntitlementType.CLINICAL_PROBLEM_SOLVING,
121
+ [models_1.EProductType.PLAB1]: models_1.EEntitlementType.PLAB_1,
122
+ [models_1.EProductType.MRCP_PART1]: models_1.EEntitlementType.MRCP_PART_1,
123
+ [models_1.EProductType.MRCP_PART2]: models_1.EEntitlementType.MRCP_PART_2,
124
+ };
125
+ const getEntitlementFromTopicType = (topicType, productType) => {
126
+ const entitlement = topicType === models_1.ETopicType.CLINICAL
127
+ ? clinicalEntitlementMap[productType]
128
+ : topicEntitlementMap[topicType];
129
+ if (!entitlement) {
130
+ return { id: 0, name: 'Unknown' };
131
+ }
132
+ return { id: entitlement, name: (0, utils_1.titleCase)(models_1.EEntitlementType[entitlement]) };
133
+ };
134
+ exports.getEntitlementFromTopicType = getEntitlementFromTopicType;
@@ -1 +1,2 @@
1
1
  export declare function wordsToNumber(s: string, checkForDigits?: boolean): number;
2
+ export declare function titleCase(input: string): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wordsToNumber = void 0;
3
+ exports.titleCase = exports.wordsToNumber = void 0;
4
4
  const Small = {
5
5
  zero: 0,
6
6
  one: 1,
@@ -49,3 +49,12 @@ function wordsToNumber(s, checkForDigits = false) {
49
49
  return total;
50
50
  }
51
51
  exports.wordsToNumber = wordsToNumber;
52
+ function titleCase(input) {
53
+ return input
54
+ .split(' ')
55
+ .map((word) => {
56
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
57
+ })
58
+ .join(' ');
59
+ }
60
+ exports.titleCase = titleCase;
@@ -5,3 +5,7 @@ export declare const productMapping: Partial<Record<EProductType, {
5
5
  topicType: ETopicType[];
6
6
  mockType: EMockTestType[];
7
7
  }>>;
8
+ export declare const getEntitlementFromTopicType: (topicType: ETopicType, productType: EProductType) => {
9
+ id: number;
10
+ name: string;
11
+ };
@@ -1,4 +1,5 @@
1
- import { EMockTestType, EProductType, ETopicType } from '../models';
1
+ import { EEntitlementType, EMockTestType, EProductType, ETopicType, } from '../models';
2
+ import { titleCase } from '../utils';
2
3
  import { DB_TYPE } from './enums';
3
4
  const ALL_TOPIC_TYPE_WITHOUT_ANATOMY = [
4
5
  ETopicType.CLINICAL,
@@ -37,7 +38,7 @@ export const productMapping = {
37
38
  },
38
39
  [EProductType.MEDICAL_SCIENCES]: {
39
40
  db: DB_TYPE.FINALS,
40
- topicType: [ETopicType.PRE_CLINICAL],
41
+ topicType: [ETopicType.PRE_CLINICAL, ETopicType.CLINICAL],
41
42
  mockType: [EMockTestType.UNIVERSITY_SPECIFIC],
42
43
  },
43
44
  [EProductType.ANATOMY_BUNDLE]: {
@@ -99,3 +100,31 @@ export const productMapping = {
99
100
  mockType: ALL_MOCKS,
100
101
  },
101
102
  };
103
+ const topicEntitlementMap = {
104
+ [ETopicType.PRE_CLINICAL]: EEntitlementType.PRE_CLINICAL,
105
+ [ETopicType.CLINICAL]: EEntitlementType.CLINICAL,
106
+ [ETopicType.ANATOMY]: EEntitlementType.ANATOMY,
107
+ [ETopicType.DATA_INTERPRETATION]: EEntitlementType.DATA_INTERPRETATION,
108
+ [ETopicType.SJT]: EEntitlementType.PROFESSIONAL_DILEMMA,
109
+ [ETopicType.INTERVIEW_ANAESTHETICS]: EEntitlementType.INTERVIEW_ANAESTHETICS,
110
+ [ETopicType.INTERVIEW_CST]: EEntitlementType.INTERVIEW_CST,
111
+ [ETopicType.INTERVIEW_IMT]: EEntitlementType.INTERVIEW_IMT,
112
+ [ETopicType.INTERVIEW_RADIOLOGY]: EEntitlementType.INTERVIEW_RADIOLOGY,
113
+ };
114
+ const clinicalEntitlementMap = {
115
+ [EProductType.MEDICAL_SCIENCES]: EEntitlementType.CLINICAL_SUBSET,
116
+ [EProductType.QBANK]: EEntitlementType.CLINICAL,
117
+ [EProductType.MSRA]: EEntitlementType.CLINICAL_PROBLEM_SOLVING,
118
+ [EProductType.PLAB1]: EEntitlementType.PLAB_1,
119
+ [EProductType.MRCP_PART1]: EEntitlementType.MRCP_PART_1,
120
+ [EProductType.MRCP_PART2]: EEntitlementType.MRCP_PART_2,
121
+ };
122
+ export const getEntitlementFromTopicType = (topicType, productType) => {
123
+ const entitlement = topicType === ETopicType.CLINICAL
124
+ ? clinicalEntitlementMap[productType]
125
+ : topicEntitlementMap[topicType];
126
+ if (!entitlement) {
127
+ return { id: 0, name: 'Unknown' };
128
+ }
129
+ return { id: entitlement, name: titleCase(EEntitlementType[entitlement]) };
130
+ };
@@ -1 +1,2 @@
1
1
  export declare function wordsToNumber(s: string, checkForDigits?: boolean): number;
2
+ export declare function titleCase(input: string): string;
@@ -45,3 +45,11 @@ export function wordsToNumber(s, checkForDigits = false) {
45
45
  });
46
46
  return total;
47
47
  }
48
+ export function titleCase(input) {
49
+ return input
50
+ .split(' ')
51
+ .map((word) => {
52
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
53
+ })
54
+ .join(' ');
55
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.73",
3
+ "version": "2.6.74",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",