@hedia/types 3.12.4-alpha.350 → 3.12.6-alpha.353
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/README.md +106 -4
- package/lib/commonjs/boluscalculator/boluscalculator.js +4 -4
- package/lib/commonjs/boluscalculator/boluscalculator.js.map +1 -1
- package/lib/typescript/boluscalculator/boluscalculator.d.ts +2 -2
- package/lib/typescript/boluscalculator/boluscalculator.d.ts.map +1 -1
- package/package.json +6 -9
- package/src/activity/activity.ts +83 -0
- package/src/boluscalculator/boluscalculator.ts +226 -0
- package/src/enums.ts +498 -0
- package/src/index.ts +6 -0
- package/src/logbook/logbook.ts +195 -0
- package/src/userdetails/userdetails.ts +9 -0
- package/src/usersettings/usersettings.ts +160 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type { ActivitySettings, LegacyActivitySettings } from "../activity/activity";
|
|
2
|
+
import type { BloodGlucoseUnit, BloodKetonesUnit } from "../enums";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Legacy user settings notifications type that includes device identifiers
|
|
6
|
+
* TODO: Can be removed when 3.5.0 is the minimum supported version.
|
|
7
|
+
*/
|
|
8
|
+
export type LegacyUserSettingsNotifications = Omit<IUserSettings, "notifications"> & {
|
|
9
|
+
medicineNotification: IMedicineNotification;
|
|
10
|
+
remeasurementNotification: IRemeasurementNotification;
|
|
11
|
+
deviceIdentifiers?: INotificationDeviceIdentifier[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Legacy BGL targets type that uses LegacyBGLInterval
|
|
16
|
+
* TODO: Can be removed when 3.5.0 is the minimum supported version.
|
|
17
|
+
*/
|
|
18
|
+
export type LegacyBGLTargets = Omit<IBGLTargets, "targetBGLIntervals" | "overallTargetBGL"> & {
|
|
19
|
+
targetBGLIntervals?: LegacyBGLInterval[];
|
|
20
|
+
overallTargetBGL?: LegacyBGLInterval;
|
|
21
|
+
use?: Usage;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Legacy BGL interval type that may contain low and high properties
|
|
26
|
+
* for backward compatibility with data saved before these fields were removed.
|
|
27
|
+
* TODO: Can be removed when 3.5.0 is the minimum supported version.
|
|
28
|
+
*/
|
|
29
|
+
export type LegacyBGLInterval = IBGLInterval & {
|
|
30
|
+
low?: number;
|
|
31
|
+
high?: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* User settings type that allows for legacy activity settings and legacy glucose targets
|
|
36
|
+
* TODO: Remove activity when 3.5.0 is minimum supported version.
|
|
37
|
+
* TODO: Remove glucoseLevelTargets when 3.5.0 is minimum supported version.
|
|
38
|
+
* TODO: Remove gender when 3.4.0 is minimum supported version.
|
|
39
|
+
* TODO: Remove insulinDependent when 3.5.0 is minimum supported version.
|
|
40
|
+
* TODO: Remove email when 3.5.0 is minimum supported version.
|
|
41
|
+
*/
|
|
42
|
+
export type LegacyUserSettings = Omit<IUserSettings, "activity" | "glucoseLevelTargets" | "notifications"> & {
|
|
43
|
+
activity?: LegacyActivitySettings;
|
|
44
|
+
glucoseLevelTargets?: LegacyBGLTargets;
|
|
45
|
+
notifications?: LegacyUserSettingsNotifications;
|
|
46
|
+
gender?: BiologicalSex;
|
|
47
|
+
insulinDependent?: boolean;
|
|
48
|
+
email?: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export interface IUserSettings {
|
|
52
|
+
activity?: ActivitySettings;
|
|
53
|
+
biologicalSex?: BiologicalSex;
|
|
54
|
+
birthday?: string; //ISO
|
|
55
|
+
bloodGlucoseUnits?: BloodGlucoseUnit;
|
|
56
|
+
bloodKetonesUnit?: BloodKetonesUnit;
|
|
57
|
+
created?: string; //ISO
|
|
58
|
+
diabetesType?: DiabetesType;
|
|
59
|
+
fastActingInsulin?: FastActingInsulin;
|
|
60
|
+
glucoseLevelTargets?: IBGLTargets;
|
|
61
|
+
height?: number; //cm
|
|
62
|
+
longActingInsulin?: LongActingInsulin;
|
|
63
|
+
notifications?: IUSerSettingsNotifications;
|
|
64
|
+
parameters?: IParameters;
|
|
65
|
+
treatmentType?: InjectionMethod;
|
|
66
|
+
uuid?: string;
|
|
67
|
+
uuidOld?: string;
|
|
68
|
+
weight?: number; //kg
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface IUSerSettingsNotifications {
|
|
72
|
+
medicineNotification: IMedicineNotification;
|
|
73
|
+
remeasurementNotification: IRemeasurementNotification;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface INotifications {
|
|
77
|
+
toggle: boolean;
|
|
78
|
+
}
|
|
79
|
+
export interface IMedicineNotification extends INotifications {
|
|
80
|
+
dailyReminderTime: string;
|
|
81
|
+
}
|
|
82
|
+
export interface IRemeasurementNotification extends INotifications {
|
|
83
|
+
remeasurement: number;
|
|
84
|
+
}
|
|
85
|
+
export interface IInterval {
|
|
86
|
+
startTime: string; // "00:00" format
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface IParameters {
|
|
90
|
+
parameterIntervals: IParameterInterval[];
|
|
91
|
+
overallParameters: IParameterInterval;
|
|
92
|
+
use?: Usage;
|
|
93
|
+
updatedAt?: string; // ISO string
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface IParameterInterval extends IInterval {
|
|
97
|
+
insulinSensitivity: number;
|
|
98
|
+
carbohydrateRatio: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface IBGLTargets {
|
|
102
|
+
targetBGLIntervals?: IBGLInterval[];
|
|
103
|
+
overallTargetBGL?: IBGLInterval;
|
|
104
|
+
use?: Usage;
|
|
105
|
+
updatedAt?: string; // ISO string
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface IBGLInterval extends IInterval {
|
|
109
|
+
target: number;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface INotificationDeviceIdentifier {
|
|
113
|
+
token: string;
|
|
114
|
+
timestamp: number;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export enum Usage {
|
|
118
|
+
Overall = "overall",
|
|
119
|
+
Intervals = "intervals",
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export enum FastActingInsulin {
|
|
123
|
+
Novorapid = "Novorapid",
|
|
124
|
+
Fiasp = "Fiasp",
|
|
125
|
+
Humalog = "Humalog",
|
|
126
|
+
Apidra = "Apidra",
|
|
127
|
+
Other = "Other",
|
|
128
|
+
None = "None",
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export enum LongActingInsulin {
|
|
132
|
+
Lantus = "Lantus",
|
|
133
|
+
Basaglar = "Basaglar",
|
|
134
|
+
Tuojeo = "Tuojeo",
|
|
135
|
+
Levemir = "Levemir",
|
|
136
|
+
Tresiba = "Tresiba",
|
|
137
|
+
Other = "Other",
|
|
138
|
+
None = "None",
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export enum DiabetesType {
|
|
142
|
+
Type1 = 1,
|
|
143
|
+
Type2 = 2,
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export enum BiologicalSex {
|
|
147
|
+
Male = "Male",
|
|
148
|
+
Female = "Female",
|
|
149
|
+
Unspecified = "Unspecified",
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* String enum for differentiating between different methods by which someone can inject insulin into the body.
|
|
154
|
+
* Mainly used to determine how insulin amounts should be rounded.
|
|
155
|
+
*/
|
|
156
|
+
export enum InjectionMethod {
|
|
157
|
+
PenHalf = "Pen-half",
|
|
158
|
+
PenWhole = "Pen-whole",
|
|
159
|
+
Pump = "Pump",
|
|
160
|
+
}
|