@hedia/types 1.1.1 → 1.1.2

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.
@@ -1,8 +1,8 @@
1
- export declare enum BloodGlucoseUnit {
2
- MMOL_L = "mmol/l",
3
- MG_DL = "mg/dl"
4
- }
5
- export declare enum BloodKetonesUnit {
6
- MMOL_L = "mmol/l",
7
- MG_DL = "mg/dl"
8
- }
1
+ export declare enum BloodGlucoseUnit {
2
+ MMOL_L = "mmol/l",
3
+ MG_DL = "mg/dl"
4
+ }
5
+ export declare enum BloodKetonesUnit {
6
+ MMOL_L = "mmol/l",
7
+ MG_DL = "mg/dl"
8
+ }
@@ -1,19 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BloodKetonesUnit = exports.BloodGlucoseUnit = void 0;
4
- var Units;
5
- (function (Units) {
6
- Units["MMOL_L"] = "mmol/l";
7
- Units["MG_DL"] = "mg/dl";
8
- })(Units || (Units = {}));
9
- var BloodGlucoseUnit;
10
- (function (BloodGlucoseUnit) {
11
- BloodGlucoseUnit["MMOL_L"] = "mmol/l";
12
- BloodGlucoseUnit["MG_DL"] = "mg/dl";
13
- })(BloodGlucoseUnit = exports.BloodGlucoseUnit || (exports.BloodGlucoseUnit = {}));
14
- var BloodKetonesUnit;
15
- (function (BloodKetonesUnit) {
16
- BloodKetonesUnit["MMOL_L"] = "mmol/l";
17
- BloodKetonesUnit["MG_DL"] = "mg/dl";
18
- })(BloodKetonesUnit = exports.BloodKetonesUnit || (exports.BloodKetonesUnit = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BloodKetonesUnit = exports.BloodGlucoseUnit = void 0;
4
+ var Units;
5
+ (function (Units) {
6
+ Units["MMOL_L"] = "mmol/l";
7
+ Units["MG_DL"] = "mg/dl";
8
+ })(Units || (Units = {}));
9
+ var BloodGlucoseUnit;
10
+ (function (BloodGlucoseUnit) {
11
+ BloodGlucoseUnit["MMOL_L"] = "mmol/l";
12
+ BloodGlucoseUnit["MG_DL"] = "mg/dl";
13
+ })(BloodGlucoseUnit = exports.BloodGlucoseUnit || (exports.BloodGlucoseUnit = {}));
14
+ var BloodKetonesUnit;
15
+ (function (BloodKetonesUnit) {
16
+ BloodKetonesUnit["MMOL_L"] = "mmol/l";
17
+ BloodKetonesUnit["MG_DL"] = "mg/dl";
18
+ })(BloodKetonesUnit = exports.BloodKetonesUnit || (exports.BloodKetonesUnit = {}));
19
19
  //# sourceMappingURL=measurements.js.map
@@ -1,76 +1,79 @@
1
- import { DiabetesType, InjectionMethod, Gender, Usage, ActivityReduction, ActivityReductionIntervals, Languages } from "./enums";
2
- import { BloodGlucoseUnit, BloodKetonesUnit } from "./measurements";
3
- export interface IUserSettings {
4
- [key: string]: unknown;
5
- diabetesType?: DiabetesType;
6
- insulinDependent?: boolean;
7
- gender?: Gender;
8
- height?: number;
9
- email?: string;
10
- weight?: number;
11
- birthday?: string;
12
- treatmentType?: InjectionMethod;
13
- bloodGlucoseUnits?: BloodGlucoseUnit;
14
- bloodKetonesUnit?: BloodKetonesUnit;
15
- parameters?: IParameters;
16
- glucoseLevelTargets?: IBGLTargets;
17
- fastActingInsulin?: string | null;
18
- longActingInsulin?: string | null;
19
- uuidOld?: string;
20
- uuid?: string;
21
- created?: string;
22
- activity?: ActivitySettings;
23
- notifications?: IUSerSettingsNotifications;
24
- }
25
- export declare type ActivitySettings = ActivityReductionSettings & {
26
- target: number;
27
- };
28
- export declare type ActivityReductionSettings = {
29
- [key in keyof typeof ActivityReduction]: ActivityReductionIntervalSettings;
30
- };
31
- export declare type ActivityReductionIntervalSettings = {
32
- [key in keyof typeof ActivityReductionIntervals]: number;
33
- };
34
- export interface IUSerSettingsNotifications {
35
- medicineNotification: IMedicineNotification;
36
- remeasurementNotification: IRemeasurementNotification;
37
- }
38
- export interface INotifications {
39
- toggle: boolean;
40
- }
41
- export interface IMedicineNotification extends INotifications {
42
- dailyReminderTime: string;
43
- }
44
- export interface IRemeasurementNotification extends INotifications {
45
- remeasurement: number;
46
- }
47
- export interface IUserDetails {
48
- name?: string;
49
- email?: string;
50
- research_consent?: Date | boolean;
51
- newsletter_consent?: Date | boolean;
52
- country?: string;
53
- language?: keyof typeof Languages;
54
- }
55
- export interface IInterval {
56
- startTime?: string;
57
- }
58
- export interface IParameters {
59
- parameterIntervals: Array<IParameterInterval>;
60
- overallParameters: IParameterInterval;
61
- use?: Usage;
62
- }
63
- export interface IParameterInterval extends IInterval {
64
- insulinSensitivity?: number;
65
- carbohydrateRatio?: number;
66
- }
67
- export interface IBGLTargets {
68
- targetBGLIntervals?: Array<IBGLInterval>;
69
- overallTargetBGL?: IBGLInterval;
70
- use?: Usage;
71
- }
72
- export interface IBGLInterval extends IInterval {
73
- low: number;
74
- target: number;
75
- high: number;
76
- }
1
+ import { DiabetesType, InjectionMethod, Gender, Usage, ActivityReduction, ActivityReductionIntervals, Languages } from "./enums";
2
+ import { BloodGlucoseUnit, BloodKetonesUnit } from "./measurements";
3
+ export interface IUserSettings {
4
+ [key: string]: unknown;
5
+ diabetesType?: DiabetesType;
6
+ insulinDependent?: boolean;
7
+ gender?: Gender;
8
+ height?: number;
9
+ email?: string;
10
+ weight?: number;
11
+ birthday?: string;
12
+ treatmentType?: InjectionMethod;
13
+ bloodGlucoseUnits?: BloodGlucoseUnit;
14
+ bloodKetonesUnit?: BloodKetonesUnit;
15
+ parameters?: IParameters;
16
+ glucoseLevelTargets?: IBGLTargets;
17
+ fastActingInsulin?: string | null;
18
+ longActingInsulin?: string | null;
19
+ uuidOld?: string;
20
+ uuid?: string;
21
+ created?: string;
22
+ activity?: ActivitySettings;
23
+ notifications?: IUSerSettingsNotifications;
24
+ }
25
+ export declare type ActivitySettings = ActivityReductionSettings & {
26
+ target: number;
27
+ };
28
+ declare type ActivityReductionKey = keyof typeof ActivityReduction;
29
+ declare type ActivityReductionIntervalsKey = keyof typeof ActivityReductionIntervals;
30
+ export declare type ActivityReductionSettings = {
31
+ [key in ActivityReductionKey]: ActivityReductionIntervalSettings<key, "hard", "fromFortysix">;
32
+ };
33
+ export declare type ActivityReductionIntervalSettings<K extends ActivityReductionKey, T extends ActivityReductionKey, U extends ActivityReductionIntervalsKey> = {
34
+ [key in ActivityReductionIntervalsKey]: K extends T ? (key extends U ? null | number : number) : number;
35
+ };
36
+ export interface IUSerSettingsNotifications {
37
+ medicineNotification: IMedicineNotification;
38
+ remeasurementNotification: IRemeasurementNotification;
39
+ }
40
+ export interface INotifications {
41
+ toggle: boolean;
42
+ }
43
+ export interface IMedicineNotification extends INotifications {
44
+ dailyReminderTime: string;
45
+ }
46
+ export interface IRemeasurementNotification extends INotifications {
47
+ remeasurement: number;
48
+ }
49
+ export interface IUserDetails {
50
+ name?: string;
51
+ email?: string;
52
+ research_consent?: Date | boolean;
53
+ newsletter_consent?: Date | boolean;
54
+ country?: string;
55
+ language?: keyof typeof Languages;
56
+ }
57
+ export interface IInterval {
58
+ startTime?: string;
59
+ }
60
+ export interface IParameters {
61
+ parameterIntervals: Array<IParameterInterval>;
62
+ overallParameters: IParameterInterval;
63
+ use?: Usage;
64
+ }
65
+ export interface IParameterInterval extends IInterval {
66
+ insulinSensitivity?: number;
67
+ carbohydrateRatio?: number;
68
+ }
69
+ export interface IBGLTargets {
70
+ targetBGLIntervals?: Array<IBGLInterval>;
71
+ overallTargetBGL?: IBGLInterval;
72
+ use?: Usage;
73
+ }
74
+ export interface IBGLInterval extends IInterval {
75
+ low: number;
76
+ target: number;
77
+ high: number;
78
+ }
79
+ export {};
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedia/types",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Enums, interfaces, and other common types for use in Hedia's software.",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
package/types/types.ts CHANGED
@@ -33,11 +33,20 @@ export interface IUserSettings {
33
33
  }
34
34
 
35
35
  export type ActivitySettings = ActivityReductionSettings & { target: number };
36
+
37
+ type ActivityReductionKey = keyof typeof ActivityReduction;
38
+ type ActivityReductionIntervalsKey = keyof typeof ActivityReductionIntervals;
39
+
36
40
  export type ActivityReductionSettings = {
37
- [key in keyof typeof ActivityReduction]: ActivityReductionIntervalSettings;
41
+ // support for nulling multiple keys, with "hard" | "light" and variants with "fromFortysix" | "fromThirty"
42
+ [key in ActivityReductionKey]: ActivityReductionIntervalSettings<key, "hard", "fromFortysix">;
38
43
  };
39
- export type ActivityReductionIntervalSettings = {
40
- [key in keyof typeof ActivityReductionIntervals]: number;
44
+ export type ActivityReductionIntervalSettings<
45
+ K extends ActivityReductionKey,
46
+ T extends ActivityReductionKey,
47
+ U extends ActivityReductionIntervalsKey
48
+ > = {
49
+ [key in ActivityReductionIntervalsKey]: K extends T ? (key extends U ? null | number : number) : number;
41
50
  };
42
51
 
43
52
  export interface IUSerSettingsNotifications {