@hedia/types 1.2.4 → 1.2.6
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/.github/workflows/publish.yml +41 -0
- package/.github/workflows/version-check.yml +42 -0
- package/dist/types/activity/activity.d.ts +18 -7
- package/dist/types/activity/activity.js +8 -1
- package/dist/types/activity/activity.js.map +1 -1
- package/package.json +3 -2
- package/types/activity/activity.ts +20 -8
|
@@ -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
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
export declare namespace Activity {
|
|
2
2
|
namespace Types {
|
|
3
|
+
export type ActivitySettings = ActivityReductionSettings & ActivityTarget;
|
|
4
|
+
export type ActivityReductionIntervals = ActivityReductionSettings[keyof ActivityReductionSettings];
|
|
3
5
|
type ActivityIntensityKeys = keyof typeof Enums.ActivityIntensity;
|
|
4
6
|
type ActivityReductionKeys = keyof typeof Enums.ActivityReductionIntervals;
|
|
5
|
-
type ActivityReductionSettings = {
|
|
6
|
-
[key in ActivityIntensityKeys]: ActivityReductionSettingsIntervals<key,
|
|
7
|
+
type ActivityReductionSettings = ActivityPostReduction & {
|
|
8
|
+
[key in ActivityIntensityKeys]: ActivityReductionSettingsIntervals<key, `hard`, `fromFortysix`>;
|
|
7
9
|
};
|
|
8
|
-
|
|
10
|
+
type ActivityPostReduction = {
|
|
11
|
+
post: {
|
|
12
|
+
[key in ActivityReductionKeys]: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
type ActivityTarget = {
|
|
9
16
|
target: number;
|
|
10
17
|
};
|
|
11
18
|
type ActivityReductionSettingsIntervals<K extends ActivityIntensityKeys, T extends ActivityIntensityKeys, U extends ActivityReductionKeys> = {
|
|
12
19
|
[key in ActivityReductionKeys]: K extends T ? (key extends U ? null | number : number) : number;
|
|
13
20
|
};
|
|
14
|
-
type ActivitySettingsOmitTarget = Omit<ActivitySettings, "target">;
|
|
15
|
-
export type ActivityReductionIntervals = ActivitySettingsOmitTarget[keyof ActivitySettingsOmitTarget];
|
|
16
21
|
export {};
|
|
17
22
|
}
|
|
18
23
|
namespace Enums {
|
|
@@ -24,8 +29,14 @@ export declare namespace Activity {
|
|
|
24
29
|
enum ActivityIntensity {
|
|
25
30
|
light = "light",
|
|
26
31
|
moderate = "moderate",
|
|
27
|
-
hard = "hard"
|
|
28
|
-
|
|
32
|
+
hard = "hard"
|
|
33
|
+
}
|
|
34
|
+
enum ActivityEnum {
|
|
35
|
+
Run = "Run",
|
|
36
|
+
Walk = "Walk",
|
|
37
|
+
Cycling = "Cycling",
|
|
38
|
+
Swim = "Swim",
|
|
39
|
+
Other = "Other"
|
|
29
40
|
}
|
|
30
41
|
}
|
|
31
42
|
}
|
|
@@ -16,8 +16,15 @@ var Activity;
|
|
|
16
16
|
ActivityIntensity["light"] = "light";
|
|
17
17
|
ActivityIntensity["moderate"] = "moderate";
|
|
18
18
|
ActivityIntensity["hard"] = "hard";
|
|
19
|
-
ActivityIntensity["post"] = "post";
|
|
20
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 = {}));
|
|
21
28
|
})(Enums = Activity.Enums || (Activity.Enums = {}));
|
|
22
29
|
})(Activity = exports.Activity || (exports.Activity = {}));
|
|
23
30
|
//# sourceMappingURL=activity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../../../types/activity/activity.ts"],"names":[],"mappings":";;;AAAA,IAAiB,QAAQ,
|
|
1
|
+
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../../../types/activity/activity.ts"],"names":[],"mappings":";;;AAAA,IAAiB,QAAQ,CAkDxB;AAlDD,WAAiB,QAAQ;IA6BxB,IAAiB,KAAK,CAoBrB;IApBD,WAAiB,KAAK;QACrB,IAAY,0BAIX;QAJD,WAAY,0BAA0B;YACrC,mDAAqB,CAAA;YACrB,uDAAyB,CAAA;YACzB,2DAA6B,CAAA;QAC9B,CAAC,EAJW,0BAA0B,GAA1B,gCAA0B,KAA1B,gCAA0B,QAIrC;QAED,IAAY,iBAIX;QAJD,WAAY,iBAAiB;YAC5B,oCAAe,CAAA;YACf,0CAAqB,CAAA;YACrB,kCAAa,CAAA;QACd,CAAC,EAJW,iBAAiB,GAAjB,uBAAiB,KAAjB,uBAAiB,QAI5B;QAED,IAAY,YAMX;QAND,WAAY,YAAY;YACvB,2BAAW,CAAA;YACX,6BAAa,CAAA;YACb,mCAAmB,CAAA;YACnB,6BAAa,CAAA;YACb,+BAAe,CAAA;QAChB,CAAC,EANW,YAAY,GAAZ,kBAAY,KAAZ,kBAAY,QAMvB;IACF,CAAC,EApBgB,KAAK,GAAL,cAAK,KAAL,cAAK,QAoBrB;AACF,CAAC,EAlDgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAkDxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hedia/types",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "Enums, interfaces, and other common types for use in Hedia's software.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"tsc": "tsc --build",
|
|
12
12
|
"clean": "tsc --build --clean",
|
|
13
|
-
"
|
|
13
|
+
"prepublish": "npm ci --ignore-scripts && npm run tsc",
|
|
14
|
+
"postpublish": "npm run clean"
|
|
14
15
|
},
|
|
15
16
|
"keywords": [],
|
|
16
17
|
"author": "Hedia",
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
export namespace Activity {
|
|
2
2
|
export namespace Types {
|
|
3
|
+
export type ActivitySettings = ActivityReductionSettings & ActivityTarget;
|
|
4
|
+
export type ActivityReductionIntervals = ActivityReductionSettings[keyof ActivityReductionSettings];
|
|
5
|
+
|
|
3
6
|
type ActivityIntensityKeys = keyof typeof Enums.ActivityIntensity;
|
|
4
7
|
type ActivityReductionKeys = keyof typeof Enums.ActivityReductionIntervals;
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[key in ActivityIntensityKeys]: ActivityReductionSettingsIntervals<key,
|
|
9
|
+
// prettier-ignore
|
|
10
|
+
type ActivityReductionSettings = ActivityPostReduction & {
|
|
11
|
+
[key in ActivityIntensityKeys]: ActivityReductionSettingsIntervals<key, `hard`, `fromFortysix`>;
|
|
9
12
|
};
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
type ActivityPostReduction = {
|
|
15
|
+
post: { [key in ActivityReductionKeys]: number };
|
|
16
|
+
};
|
|
17
|
+
type ActivityTarget = {
|
|
18
|
+
target: number;
|
|
19
|
+
};
|
|
12
20
|
|
|
13
21
|
type ActivityReductionSettingsIntervals<
|
|
14
22
|
K extends ActivityIntensityKeys,
|
|
@@ -17,9 +25,6 @@ export namespace Activity {
|
|
|
17
25
|
> = {
|
|
18
26
|
[key in ActivityReductionKeys]: K extends T ? (key extends U ? null | number : number) : number;
|
|
19
27
|
};
|
|
20
|
-
|
|
21
|
-
type ActivitySettingsOmitTarget = Omit<ActivitySettings, "target">;
|
|
22
|
-
export type ActivityReductionIntervals = ActivitySettingsOmitTarget[keyof ActivitySettingsOmitTarget];
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
export namespace Enums {
|
|
@@ -33,7 +38,14 @@ export namespace Activity {
|
|
|
33
38
|
light = `light`,
|
|
34
39
|
moderate = `moderate`,
|
|
35
40
|
hard = `hard`,
|
|
36
|
-
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export enum ActivityEnum {
|
|
44
|
+
Run = `Run`,
|
|
45
|
+
Walk = `Walk`,
|
|
46
|
+
Cycling = `Cycling`,
|
|
47
|
+
Swim = `Swim`,
|
|
48
|
+
Other = `Other`,
|
|
37
49
|
}
|
|
38
50
|
}
|
|
39
51
|
}
|