@hedia/types 1.2.5 → 1.4.33

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.
@@ -0,0 +1,41 @@
1
+ name: NPM Publish Bot
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+
9
+ env:
10
+ SSH_PRIVATE_KEY: ${{ secrets.HEDIA_BOT_PRIVATE_SSH_KEY }}
11
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+
17
+ strategy:
18
+ matrix:
19
+ node-version: [14.15] #[8.x, 10.x, 12.x]
20
+
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Use Node.js ${{ matrix.node-version }}
24
+ uses: actions/setup-node@v1.4.4
25
+ with:
26
+ node-version: ${{ matrix.node-version }}
27
+ - name: Register ssh keys
28
+ uses: webfactory/ssh-agent@v0.4.1
29
+ with:
30
+ ssh-private-key: ${{ env.SSH_PRIVATE_KEY }}
31
+ - name: Register NPM access token
32
+ run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
33
+ - id: publish
34
+ uses: JS-DevTools/npm-publish@v1
35
+ with:
36
+ token: ${{ env.NPM_TOKEN }}
37
+
38
+ - if: steps.publish.outputs.type == 'none'
39
+ run: |
40
+ echo "Failed to publish on npm, version already exists"
41
+ exit 1
@@ -0,0 +1,42 @@
1
+ name: Node.js CI
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ env:
7
+ SSH_PRIVATE_KEY: ${{ secrets.HEDIA_BOT_PRIVATE_SSH_KEY }}
8
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ matrix:
16
+ node-version: [14.15] #[8.x, 10.x, 12.x]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - name: Use Node.js ${{ matrix.node-version }}
21
+ uses: actions/setup-node@v1.4.4
22
+ with:
23
+ node-version: ${{ matrix.node-version }}
24
+ - name: Register ssh keys
25
+ uses: webfactory/ssh-agent@v0.4.1
26
+ with:
27
+ ssh-private-key: |
28
+ ${{ secrets.HEDIA_BOT_PRIVATE_SSH_KEY }}
29
+ - name: Register NPM access token
30
+ run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
31
+ env:
32
+ NPM_TOKEN: ${{ env.NPM_TOKEN }}
33
+ - id: publish
34
+ uses: JS-DevTools/npm-publish@v1
35
+ with:
36
+ token: ${{ env.NPM_TOKEN }}
37
+ dry-run: true
38
+
39
+ - if: steps.publish.outputs.type == 'none'
40
+ run: |
41
+ echo "Package JSON version is already published, please bump the version!"
42
+ exit 1
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./types/enums";
2
- export * from "./types";
1
+ export * from "./types/enums";
2
+ export * from "./types";
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
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("./types/enums"), exports);
14
- __exportStar(require("./types"), exports);
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("./types/enums"), exports);
14
+ __exportStar(require("./types"), exports);
15
15
  //# sourceMappingURL=index.js.map
@@ -1,42 +1,42 @@
1
- export declare namespace Activity {
2
- namespace Types {
3
- export type ActivitySettings = ActivityReductionSettings & ActivityTarget;
4
- export type ActivityReductionIntervals = ActivityReductionSettings[keyof ActivityReductionSettings];
5
- type ActivityIntensityKeys = keyof typeof Enums.ActivityIntensity;
6
- type ActivityReductionKeys = keyof typeof Enums.ActivityReductionIntervals;
7
- type ActivityReductionSettings = ActivityPostReduction & {
8
- [key in ActivityIntensityKeys]: ActivityReductionSettingsIntervals<key, `hard`, `fromFortysix`>;
9
- };
10
- type ActivityPostReduction = {
11
- post: {
12
- [key in ActivityReductionKeys]: number;
13
- };
14
- };
15
- type ActivityTarget = {
16
- target: number;
17
- };
18
- type ActivityReductionSettingsIntervals<K extends ActivityIntensityKeys, T extends ActivityIntensityKeys, U extends ActivityReductionKeys> = {
19
- [key in ActivityReductionKeys]: K extends T ? (key extends U ? null | number : number) : number;
20
- };
21
- export {};
22
- }
23
- namespace Enums {
24
- enum ActivityReductionIntervals {
25
- fromZero = "fromZero",
26
- fromThirty = "fromThirty",
27
- fromFortysix = "fromFortysix"
28
- }
29
- enum ActivityIntensity {
30
- light = "light",
31
- moderate = "moderate",
32
- hard = "hard"
33
- }
34
- enum ActivityEnum {
35
- Run = "Run",
36
- Walk = "Walk",
37
- Cycling = "Cycling",
38
- Swim = "Swim",
39
- Other = "Other"
40
- }
41
- }
42
- }
1
+ export declare namespace Activity {
2
+ namespace Types {
3
+ export type ActivitySettings = ActivityReductionSettings & ActivityTarget;
4
+ export type ActivityReductionIntervals = ActivityReductionSettings[keyof ActivityReductionSettings];
5
+ type ActivityIntensityKeys = keyof typeof Enums.ActivityIntensity;
6
+ type ActivityReductionKeys = keyof typeof Enums.ActivityReductionIntervals;
7
+ type ActivityReductionSettings = ActivityPostReduction & {
8
+ [key in ActivityIntensityKeys]: ActivityReductionSettingsIntervals<key, `hard`, `fromFortysix`>;
9
+ };
10
+ type ActivityPostReduction = {
11
+ post: {
12
+ [key in ActivityReductionKeys]: number;
13
+ };
14
+ };
15
+ type ActivityTarget = {
16
+ target: number;
17
+ };
18
+ type ActivityReductionSettingsIntervals<K extends ActivityIntensityKeys, T extends ActivityIntensityKeys, U extends ActivityReductionKeys> = {
19
+ [key in ActivityReductionKeys]: K extends T ? (key extends U ? null | number : number) : number;
20
+ };
21
+ export {};
22
+ }
23
+ namespace Enums {
24
+ enum ActivityReductionIntervals {
25
+ fromZero = "fromZero",
26
+ fromThirty = "fromThirty",
27
+ fromFortysix = "fromFortysix"
28
+ }
29
+ enum ActivityIntensity {
30
+ light = "light",
31
+ moderate = "moderate",
32
+ hard = "hard"
33
+ }
34
+ enum ActivityEnum {
35
+ Run = "Run",
36
+ Walk = "Walk",
37
+ Cycling = "Cycling",
38
+ Swim = "Swim",
39
+ Other = "Other"
40
+ }
41
+ }
42
+ }
@@ -1,30 +1,30 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Activity = void 0;
4
- var Activity;
5
- (function (Activity) {
6
- let Enums;
7
- (function (Enums) {
8
- let ActivityReductionIntervals;
9
- (function (ActivityReductionIntervals) {
10
- ActivityReductionIntervals["fromZero"] = "fromZero";
11
- ActivityReductionIntervals["fromThirty"] = "fromThirty";
12
- ActivityReductionIntervals["fromFortysix"] = "fromFortysix";
13
- })(ActivityReductionIntervals = Enums.ActivityReductionIntervals || (Enums.ActivityReductionIntervals = {}));
14
- let ActivityIntensity;
15
- (function (ActivityIntensity) {
16
- ActivityIntensity["light"] = "light";
17
- ActivityIntensity["moderate"] = "moderate";
18
- ActivityIntensity["hard"] = "hard";
19
- })(ActivityIntensity = Enums.ActivityIntensity || (Enums.ActivityIntensity = {}));
20
- let ActivityEnum;
21
- (function (ActivityEnum) {
22
- ActivityEnum["Run"] = "Run";
23
- ActivityEnum["Walk"] = "Walk";
24
- ActivityEnum["Cycling"] = "Cycling";
25
- ActivityEnum["Swim"] = "Swim";
26
- ActivityEnum["Other"] = "Other";
27
- })(ActivityEnum = Enums.ActivityEnum || (Enums.ActivityEnum = {}));
28
- })(Enums = Activity.Enums || (Activity.Enums = {}));
29
- })(Activity = exports.Activity || (exports.Activity = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Activity = void 0;
4
+ var Activity;
5
+ (function (Activity) {
6
+ let Enums;
7
+ (function (Enums) {
8
+ let ActivityReductionIntervals;
9
+ (function (ActivityReductionIntervals) {
10
+ ActivityReductionIntervals["fromZero"] = "fromZero";
11
+ ActivityReductionIntervals["fromThirty"] = "fromThirty";
12
+ ActivityReductionIntervals["fromFortysix"] = "fromFortysix";
13
+ })(ActivityReductionIntervals = Enums.ActivityReductionIntervals || (Enums.ActivityReductionIntervals = {}));
14
+ let ActivityIntensity;
15
+ (function (ActivityIntensity) {
16
+ ActivityIntensity["light"] = "light";
17
+ ActivityIntensity["moderate"] = "moderate";
18
+ ActivityIntensity["hard"] = "hard";
19
+ })(ActivityIntensity = Enums.ActivityIntensity || (Enums.ActivityIntensity = {}));
20
+ let ActivityEnum;
21
+ (function (ActivityEnum) {
22
+ ActivityEnum["Run"] = "Run";
23
+ ActivityEnum["Walk"] = "Walk";
24
+ ActivityEnum["Cycling"] = "Cycling";
25
+ ActivityEnum["Swim"] = "Swim";
26
+ ActivityEnum["Other"] = "Other";
27
+ })(ActivityEnum = Enums.ActivityEnum || (Enums.ActivityEnum = {}));
28
+ })(Enums = Activity.Enums || (Activity.Enums = {}));
29
+ })(Activity = exports.Activity || (exports.Activity = {}));
30
30
  //# sourceMappingURL=activity.js.map
@@ -1,42 +1,44 @@
1
- import { Activity } from "../activity/activity";
2
- export declare namespace BolusCalculator {
3
- namespace Constants {
4
- const SAFETY_INSULIN_LIMIT = 50;
5
- const SAFETY_ACTIVITY_LIMIT = 60;
6
- const REDUCTION_MAX = 1;
7
- const REDUCTION_MIN = 0;
8
- }
9
- namespace Types {
10
- interface IRecentBolus {
11
- secondsPassed: number;
12
- insulinDose: number;
13
- }
14
- enum ActivityErrors {
15
- OutOfRange = "Out of range",
16
- InvalidInterval = "Invalid activity settings interval",
17
- InvalidReduction = "Invalid activity Reduction"
18
- }
19
- interface IActivityParams {
20
- activityDuration: number;
21
- activityIntensity: Activity.Enums.ActivityIntensity;
22
- activitySettings: Activity.Types.ActivitySettings;
23
- activityDate: Date;
24
- }
25
- interface IRecommendationParams {
26
- currentBGL: number;
27
- targetBGL: number;
28
- insulinSensitivity: number;
29
- carbohydrates: number;
30
- carbohydrateRatio: number;
31
- recentBoluses: Array<IRecentBolus>;
32
- activity: IActivityParams | null;
33
- }
34
- interface IRecommendationResult {
35
- bolus: number;
36
- wasLimited: boolean;
37
- carbRecommendation: number;
38
- activityReduction: number | null;
39
- activeInsulin: number;
40
- }
41
- }
42
- }
1
+ import { Activity } from "../activity/activity";
2
+ export declare namespace BolusCalculator {
3
+ namespace Constants {
4
+ const SAFETY_INSULIN_LIMIT = 50;
5
+ const SAFETY_ACTIVITY_LIMIT = 60;
6
+ const REDUCTION_MAX = 1;
7
+ const REDUCTION_MIN = 0;
8
+ }
9
+ namespace Enums {
10
+ enum ActivityErrors {
11
+ OutOfRange = "Out of range",
12
+ InvalidInterval = "Invalid activity settings interval",
13
+ InvalidReduction = "Invalid activity Reduction"
14
+ }
15
+ }
16
+ namespace Types {
17
+ interface IRecentBolus {
18
+ secondsPassed: number;
19
+ insulinDose: number;
20
+ }
21
+ interface IActivityParams {
22
+ activityDuration: number;
23
+ activityIntensity: Activity.Enums.ActivityIntensity;
24
+ activitySettings: Activity.Types.ActivitySettings;
25
+ activityDate: Date;
26
+ }
27
+ interface IRecommendationParams {
28
+ currentBGL: number;
29
+ targetBGL: number;
30
+ insulinSensitivity: number;
31
+ carbohydrates: number;
32
+ carbohydrateRatio: number;
33
+ recentBoluses: Array<IRecentBolus>;
34
+ activity: IActivityParams | null;
35
+ }
36
+ interface IRecommendationResult {
37
+ bolus: number;
38
+ wasLimited: boolean;
39
+ carbRecommendation: number;
40
+ activityReduction: number | null;
41
+ activeInsulin: number;
42
+ }
43
+ }
44
+ }
@@ -1,23 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BolusCalculator = void 0;
4
- var BolusCalculator;
5
- (function (BolusCalculator) {
6
- let Constants;
7
- (function (Constants) {
8
- Constants.SAFETY_INSULIN_LIMIT = 50;
9
- Constants.SAFETY_ACTIVITY_LIMIT = 60;
10
- Constants.REDUCTION_MAX = 1;
11
- Constants.REDUCTION_MIN = 0;
12
- })(Constants = BolusCalculator.Constants || (BolusCalculator.Constants = {}));
13
- let Types;
14
- (function (Types) {
15
- let ActivityErrors;
16
- (function (ActivityErrors) {
17
- ActivityErrors["OutOfRange"] = "Out of range";
18
- ActivityErrors["InvalidInterval"] = "Invalid activity settings interval";
19
- ActivityErrors["InvalidReduction"] = "Invalid activity Reduction";
20
- })(ActivityErrors = Types.ActivityErrors || (Types.ActivityErrors = {}));
21
- })(Types = BolusCalculator.Types || (BolusCalculator.Types = {}));
22
- })(BolusCalculator = exports.BolusCalculator || (exports.BolusCalculator = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BolusCalculator = void 0;
4
+ var BolusCalculator;
5
+ (function (BolusCalculator) {
6
+ let Constants;
7
+ (function (Constants) {
8
+ Constants.SAFETY_INSULIN_LIMIT = 50;
9
+ Constants.SAFETY_ACTIVITY_LIMIT = 60;
10
+ Constants.REDUCTION_MAX = 1;
11
+ Constants.REDUCTION_MIN = 0;
12
+ })(Constants = BolusCalculator.Constants || (BolusCalculator.Constants = {}));
13
+ let Enums;
14
+ (function (Enums) {
15
+ let ActivityErrors;
16
+ (function (ActivityErrors) {
17
+ ActivityErrors["OutOfRange"] = "Out of range";
18
+ ActivityErrors["InvalidInterval"] = "Invalid activity settings interval";
19
+ ActivityErrors["InvalidReduction"] = "Invalid activity Reduction";
20
+ })(ActivityErrors = Enums.ActivityErrors || (Enums.ActivityErrors = {}));
21
+ })(Enums = BolusCalculator.Enums || (BolusCalculator.Enums = {}));
22
+ })(BolusCalculator = exports.BolusCalculator || (exports.BolusCalculator = {}));
23
23
  //# sourceMappingURL=boluscalculator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"boluscalculator.js","sourceRoot":"","sources":["../../../types/boluscalculator/boluscalculator.ts"],"names":[],"mappings":";;;AAEA,IAAiB,eAAe,CA4C/B;AA5CD,WAAiB,eAAe;IAC/B,IAAiB,SAAS,CAKzB;IALD,WAAiB,SAAS;QACZ,8BAAoB,GAAG,EAAE,CAAC;QAC1B,+BAAqB,GAAG,EAAE,CAAC;QAC3B,uBAAa,GAAG,CAAC,CAAC;QAClB,uBAAa,GAAG,CAAC,CAAC;IAChC,CAAC,EALgB,SAAS,GAAT,yBAAS,KAAT,yBAAS,QAKzB;IAED,IAAiB,KAAK,CAmCrB;IAnCD,WAAiB,KAAK;QAMrB,IAAY,cAIX;QAJD,WAAY,cAAc;YACzB,6CAA2B,CAAA;YAC3B,wEAAsD,CAAA;YACtD,iEAA+C,CAAA;QAChD,CAAC,EAJW,cAAc,GAAd,oBAAc,KAAd,oBAAc,QAIzB;IAyBF,CAAC,EAnCgB,KAAK,GAAL,qBAAK,KAAL,qBAAK,QAmCrB;AACF,CAAC,EA5CgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QA4C/B"}
1
+ {"version":3,"file":"boluscalculator.js","sourceRoot":"","sources":["../../../types/boluscalculator/boluscalculator.ts"],"names":[],"mappings":";;;AAEA,IAAiB,eAAe,CA8C/B;AA9CD,WAAiB,eAAe;IAC/B,IAAiB,SAAS,CAKzB;IALD,WAAiB,SAAS;QACZ,8BAAoB,GAAG,EAAE,CAAC;QAC1B,+BAAqB,GAAG,EAAE,CAAC;QAC3B,uBAAa,GAAG,CAAC,CAAC;QAClB,uBAAa,GAAG,CAAC,CAAC;IAChC,CAAC,EALgB,SAAS,GAAT,yBAAS,KAAT,yBAAS,QAKzB;IAED,IAAiB,KAAK,CAMrB;IAND,WAAiB,KAAK;QACrB,IAAY,cAIX;QAJD,WAAY,cAAc;YACzB,6CAA2B,CAAA;YAC3B,wEAAsD,CAAA;YACtD,iEAA+C,CAAA;QAChD,CAAC,EAJW,cAAc,GAAd,oBAAc,KAAd,oBAAc,QAIzB;IACF,CAAC,EANgB,KAAK,GAAL,qBAAK,KAAL,qBAAK,QAMrB;AAgCF,CAAC,EA9CgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QA8C/B"}