@dofek/scoring 0.1.12 → 0.1.14
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 +3 -10
- package/dist/menstrual-cycle.d.ts +1 -17
- package/dist/menstrual-cycle.d.ts.map +1 -1
- package/dist/menstrual-cycle.js +3 -15
- package/dist/menstrual-cycle.js.map +1 -1
- package/package.json +5 -9
- package/dist/breathwork.d.ts +0 -59
- package/dist/breathwork.d.ts.map +0 -1
- package/dist/breathwork.js +0 -126
- package/dist/breathwork.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @dofek/scoring
|
|
2
2
|
|
|
3
3
|
Platform-agnostic TypeScript models for health scores, sleep and readiness
|
|
4
|
-
presentation
|
|
4
|
+
presentation and shared design tokens. The package is used
|
|
5
5
|
by both web and mobile clients but has no UI-framework dependency.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
@@ -43,9 +43,8 @@ console.log({
|
|
|
43
43
|
| `@dofek/scoring/epistemic-status` | Shared Observed / Estimated / Associated / Suggested / Unavailable status vocabulary |
|
|
44
44
|
| `@dofek/scoring/sleep-performance` | Sleep-performance components, tiers, and recommended-bedtime calculation |
|
|
45
45
|
| `@dofek/scoring/healthspan-years` | Score-to-years mapping and formatting |
|
|
46
|
-
| `@dofek/scoring/menstrual-cycle` | Cycle-phase estimation, display metadata, and shared safety copy |
|
|
47
|
-
| `@dofek/scoring/breathwork` | Built-in breathing techniques and session-duration helpers |
|
|
48
46
|
| `@dofek/scoring/loading-policy` | Blocking-loading state policy |
|
|
47
|
+
| `@dofek/scoring/menstrual-cycle` | Read-only cycle phase calculation, display metadata, and safety notice for provider-originated starts |
|
|
49
48
|
| `@dofek/scoring/query-cache` | Shared query-cache age constant |
|
|
50
49
|
|
|
51
50
|
## Model behavior
|
|
@@ -65,13 +64,7 @@ console.log({
|
|
|
65
64
|
consistency or low-stress inputs are supplied, it averages all available
|
|
66
65
|
components equally.
|
|
67
66
|
- Healthspan display deltas map scores from 0–100 onto +3 to -2 years.
|
|
68
|
-
-
|
|
69
|
-
estimate, not a clinical assessment. A primary evaluation found that
|
|
70
|
-
cycle-length-only calendar methods cannot accurately predict ovulation day
|
|
71
|
-
([Johnson et al., 2018](https://pubmed.ncbi.nlm.nih.gov/29749274/)). The
|
|
72
|
-
shared safety notice follows
|
|
73
|
-
[Apple's Cycle Tracking limitation](https://support.apple.com/en-au/120356)
|
|
74
|
-
that these estimates must not be used for birth control or diagnosis.
|
|
67
|
+
- Menstrual-cycle phases use a server-supplied cycle day and observed average cycle length; the model does not infer a period start or provide contraceptive guidance.
|
|
75
68
|
- The design-token modules contain values only; they do not install fonts or
|
|
76
69
|
render UI.
|
|
77
70
|
- `operationalStatusColors` is the light-theme presentation palette for generic
|
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Menstrual cycle phase computation.
|
|
3
|
-
*
|
|
4
|
-
* Four phases based on day within cycle:
|
|
5
|
-
* 1. Menstrual (days 1-5): period bleeding
|
|
6
|
-
* 2. Follicular (days 6 to ovulation-1): estrogen rises
|
|
7
|
-
* 3. Ovulatory (around ovulation ±1 day): peak fertility
|
|
8
|
-
* 4. Luteal (post-ovulation to end): progesterone dominant
|
|
9
|
-
*
|
|
10
|
-
* Ovulation is estimated at cycleLength - 14 (luteal phase is ~14 days).
|
|
11
|
-
*/
|
|
12
1
|
export type CyclePhase = "menstrual" | "follicular" | "ovulatory" | "luteal";
|
|
13
2
|
export declare const CYCLE_TRACKING_SAFETY_NOTICE = "Tracking estimates only. Do not use for birth control or diagnosis.";
|
|
14
|
-
/**
|
|
15
|
-
* Compute the cycle phase for a given day within a cycle.
|
|
16
|
-
* @param dayOfCycle 1-based day number within the cycle
|
|
17
|
-
* @param cycleLength Total cycle length in days (typically 21-35)
|
|
18
|
-
*/
|
|
3
|
+
/** Estimate a phase from a one-based cycle day and an observed average cycle length. */
|
|
19
4
|
export declare function computePhase(dayOfCycle: number, cycleLength: number): CyclePhase;
|
|
20
|
-
/** Display name and color for each phase */
|
|
21
5
|
export declare const PHASE_DISPLAY: Record<CyclePhase, {
|
|
22
6
|
label: string;
|
|
23
7
|
color: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menstrual-cycle.d.ts","sourceRoot":"","sources":["../src/menstrual-cycle.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"menstrual-cycle.d.ts","sourceRoot":"","sources":["../src/menstrual-cycle.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE7E,eAAO,MAAM,4BAA4B,wEAC8B,CAAC;AAExE,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,UAAU,CAShF;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,UAAU,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAK9E,CAAC"}
|
package/dist/menstrual-cycle.js
CHANGED
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
import { chartColors, statusColors } from "./colors.js";
|
|
2
2
|
export const CYCLE_TRACKING_SAFETY_NOTICE = "Tracking estimates only. Do not use for birth control or diagnosis.";
|
|
3
|
-
/**
|
|
4
|
-
* Compute the cycle phase for a given day within a cycle.
|
|
5
|
-
* @param dayOfCycle 1-based day number within the cycle
|
|
6
|
-
* @param cycleLength Total cycle length in days (typically 21-35)
|
|
7
|
-
*/
|
|
3
|
+
/** Estimate a phase from a one-based cycle day and an observed average cycle length. */
|
|
8
4
|
export function computePhase(dayOfCycle, cycleLength) {
|
|
9
|
-
|
|
10
|
-
if (dayOfCycle <= 5) {
|
|
5
|
+
if (dayOfCycle <= 5)
|
|
11
6
|
return "menstrual";
|
|
12
|
-
}
|
|
13
|
-
// Estimated ovulation day (luteal phase is roughly constant at 14 days)
|
|
14
7
|
const ovulationDay = Math.max(6, cycleLength - 14);
|
|
15
|
-
// Ovulatory window: ovulation day ± 1
|
|
16
8
|
if (dayOfCycle >= ovulationDay - 1 && dayOfCycle <= ovulationDay + 1) {
|
|
17
9
|
return "ovulatory";
|
|
18
10
|
}
|
|
19
|
-
|
|
20
|
-
if (dayOfCycle < ovulationDay - 1) {
|
|
11
|
+
if (dayOfCycle < ovulationDay - 1)
|
|
21
12
|
return "follicular";
|
|
22
|
-
}
|
|
23
|
-
// Luteal: after ovulatory window
|
|
24
13
|
return "luteal";
|
|
25
14
|
}
|
|
26
|
-
/** Display name and color for each phase */
|
|
27
15
|
export const PHASE_DISPLAY = {
|
|
28
16
|
menstrual: { label: "Menstrual", color: statusColors.danger },
|
|
29
17
|
follicular: { label: "Follicular", color: statusColors.info },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menstrual-cycle.js","sourceRoot":"","sources":["../src/menstrual-cycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"menstrual-cycle.js","sourceRoot":"","sources":["../src/menstrual-cycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIxD,MAAM,CAAC,MAAM,4BAA4B,GACvC,qEAAqE,CAAC;AAExE,wFAAwF;AACxF,MAAM,UAAU,YAAY,CAAC,UAAkB,EAAE,WAAmB;IAClE,IAAI,UAAU,IAAI,CAAC;QAAE,OAAO,WAAW,CAAC;IAExC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,EAAE,CAAC,CAAC;IACnD,IAAI,UAAU,IAAI,YAAY,GAAG,CAAC,IAAI,UAAU,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QACrE,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,IAAI,UAAU,GAAG,YAAY,GAAG,CAAC;QAAE,OAAO,YAAY,CAAC;IACvD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAyD;IACjF,SAAS,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,MAAM,EAAE;IAC7D,UAAU,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,EAAE;IAC7D,SAAS,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE;IAC5D,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE;CACtD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dofek/scoring",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Platform-agnostic health scoring models, labels, colors, and design tokens",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,18 +61,14 @@
|
|
|
61
61
|
"types": "./dist/healthspan-years.d.ts",
|
|
62
62
|
"import": "./dist/healthspan-years.js"
|
|
63
63
|
},
|
|
64
|
-
"./menstrual-cycle": {
|
|
65
|
-
"types": "./dist/menstrual-cycle.d.ts",
|
|
66
|
-
"import": "./dist/menstrual-cycle.js"
|
|
67
|
-
},
|
|
68
|
-
"./breathwork": {
|
|
69
|
-
"types": "./dist/breathwork.d.ts",
|
|
70
|
-
"import": "./dist/breathwork.js"
|
|
71
|
-
},
|
|
72
64
|
"./loading-policy": {
|
|
73
65
|
"types": "./dist/loading-policy.d.ts",
|
|
74
66
|
"import": "./dist/loading-policy.js"
|
|
75
67
|
},
|
|
68
|
+
"./menstrual-cycle": {
|
|
69
|
+
"types": "./dist/menstrual-cycle.d.ts",
|
|
70
|
+
"import": "./dist/menstrual-cycle.js"
|
|
71
|
+
},
|
|
76
72
|
"./query-cache": {
|
|
77
73
|
"types": "./dist/query-cache.d.ts",
|
|
78
74
|
"import": "./dist/query-cache.js"
|
package/dist/breathwork.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Breathwork technique definitions and session helpers.
|
|
3
|
-
*
|
|
4
|
-
* Each technique defines the breathing pattern (inhale/hold/exhale/hold durations)
|
|
5
|
-
* and default number of rounds.
|
|
6
|
-
*/
|
|
7
|
-
export interface BreathworkTechnique {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
/** Concise user-facing reason to choose this practice */
|
|
11
|
-
purpose: string;
|
|
12
|
-
description: string;
|
|
13
|
-
/** User-facing difficulty label */
|
|
14
|
-
difficulty: BreathworkDifficulty;
|
|
15
|
-
/** Possible benefit supported by technique-specific evidence, never a guarantee */
|
|
16
|
-
possibleBenefit?: string;
|
|
17
|
-
/** Material guidance that clients must show before a session starts */
|
|
18
|
-
safety: BreathworkSafetyGuidance;
|
|
19
|
-
/** Inhale duration in seconds */
|
|
20
|
-
inhaleSeconds: number;
|
|
21
|
-
/** Hold after inhale in seconds (optional) */
|
|
22
|
-
holdInSeconds?: number;
|
|
23
|
-
/** Exhale duration in seconds */
|
|
24
|
-
exhaleSeconds: number;
|
|
25
|
-
/** Hold after exhale in seconds (optional) */
|
|
26
|
-
holdOutSeconds?: number;
|
|
27
|
-
/** Default number of rounds */
|
|
28
|
-
defaultRounds: number;
|
|
29
|
-
}
|
|
30
|
-
export declare const BREATHWORK_DIFFICULTIES: readonly ["Beginner", "Intermediate", "Advanced"];
|
|
31
|
-
export type BreathworkDifficulty = (typeof BREATHWORK_DIFFICULTIES)[number];
|
|
32
|
-
export interface BreathworkTechniqueDetails extends BreathworkTechnique {
|
|
33
|
-
/** Server-computed duration for the default session */
|
|
34
|
-
durationSeconds: number;
|
|
35
|
-
}
|
|
36
|
-
export interface BreathworkSafetyGuidance {
|
|
37
|
-
position: string;
|
|
38
|
-
warnings: string[];
|
|
39
|
-
stopCriteria: string;
|
|
40
|
-
emergency: string;
|
|
41
|
-
}
|
|
42
|
-
export declare const PERCEIVED_BREATHWORK_EFFECTS: readonly ["better", "same", "worse"];
|
|
43
|
-
export type PerceivedBreathworkEffect = (typeof PERCEIVED_BREATHWORK_EFFECTS)[number];
|
|
44
|
-
export interface BreathworkOutcomeReport {
|
|
45
|
-
stressBefore: number | null;
|
|
46
|
-
stressAfter: number | null;
|
|
47
|
-
dizzinessAfter: boolean | null;
|
|
48
|
-
perceivedEffect: PerceivedBreathworkEffect | null;
|
|
49
|
-
}
|
|
50
|
-
export declare const TECHNIQUES: BreathworkTechnique[];
|
|
51
|
-
/** Look up a technique by its ID */
|
|
52
|
-
export declare function getTechniqueById(id: string): BreathworkTechnique | undefined;
|
|
53
|
-
/** Return a human-readable label without exposing a stored technique identifier. */
|
|
54
|
-
export declare function getBreathworkTechniqueLabel(techniqueId: string): string;
|
|
55
|
-
/** Compute total session duration in seconds for a given number of rounds */
|
|
56
|
-
export declare function totalSessionSeconds(technique: BreathworkTechnique, rounds: number): number;
|
|
57
|
-
/** Add the server-owned default-session duration to a technique definition. */
|
|
58
|
-
export declare function toBreathworkTechniqueDetails(technique: BreathworkTechnique): BreathworkTechniqueDetails;
|
|
59
|
-
//# sourceMappingURL=breathwork.d.ts.map
|
package/dist/breathwork.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"breathwork.d.ts","sourceRoot":"","sources":["../src/breathwork.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,CA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BAA2B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAMvE;AAED,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAO1F;AAED,+EAA+E;AAC/E,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,mBAAmB,GAC7B,0BAA0B,CAK5B"}
|
package/dist/breathwork.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Breathwork technique definitions and session helpers.
|
|
3
|
-
*
|
|
4
|
-
* Each technique defines the breathing pattern (inhale/hold/exhale/hold durations)
|
|
5
|
-
* and default number of rounds.
|
|
6
|
-
*/
|
|
7
|
-
export const BREATHWORK_DIFFICULTIES = ["Beginner", "Intermediate", "Advanced"];
|
|
8
|
-
export const PERCEIVED_BREATHWORK_EFFECTS = ["better", "same", "worse"];
|
|
9
|
-
/**
|
|
10
|
-
* Safety wording follows NHS breathing/fainting guidance:
|
|
11
|
-
* https://www.asph.nhs.uk/nervous-system-regulation
|
|
12
|
-
* https://www.nhs.uk/symptoms/fainting/
|
|
13
|
-
*/
|
|
14
|
-
const STANDARD_SAFETY = {
|
|
15
|
-
position: "Practice seated or lying down in a comfortable, safe place.",
|
|
16
|
-
warnings: ["Do not force or strain your breath."],
|
|
17
|
-
stopCriteria: "Stop and return to normal breathing if you feel dizzy or lightheaded.",
|
|
18
|
-
emergency: "Call emergency services if someone faints and is not breathing, cannot be woken within 1 minute, or has not fully recovered.",
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Safety guidance for intense breathing rounds:
|
|
22
|
-
* https://www.wimhofmethod.com/breathing-exercises
|
|
23
|
-
*/
|
|
24
|
-
const POWER_BREATHING_SAFETY = {
|
|
25
|
-
position: "Practice only while seated or lying down in a safe place.",
|
|
26
|
-
warnings: [
|
|
27
|
-
"Intense rounds can, in rare cases, cause loss of consciousness.",
|
|
28
|
-
"Never practice in or near water, while driving, or anywhere fainting could cause injury.",
|
|
29
|
-
],
|
|
30
|
-
stopCriteria: STANDARD_SAFETY.stopCriteria,
|
|
31
|
-
emergency: STANDARD_SAFETY.emergency,
|
|
32
|
-
};
|
|
33
|
-
export const TECHNIQUES = [
|
|
34
|
-
{
|
|
35
|
-
id: "box-breathing",
|
|
36
|
-
name: "Box Breathing",
|
|
37
|
-
purpose: "Calm focus",
|
|
38
|
-
description: "Breathe in for 4 seconds, hold for 4 seconds, breathe out for 4 seconds, then hold for 4 seconds.",
|
|
39
|
-
difficulty: "Beginner",
|
|
40
|
-
// RCT evidence: https://doi.org/10.1016/j.xcrm.2022.100895
|
|
41
|
-
possibleBenefit: "Regular practice may support a more positive mood.",
|
|
42
|
-
safety: STANDARD_SAFETY,
|
|
43
|
-
inhaleSeconds: 4,
|
|
44
|
-
holdInSeconds: 4,
|
|
45
|
-
exhaleSeconds: 4,
|
|
46
|
-
holdOutSeconds: 4,
|
|
47
|
-
defaultRounds: 4,
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: "4-7-8",
|
|
51
|
-
name: "4-7-8 Breathing",
|
|
52
|
-
purpose: "Wind down",
|
|
53
|
-
description: "Breathe in for 4 seconds, hold for 7 seconds, then breathe out slowly for 8 seconds.",
|
|
54
|
-
difficulty: "Intermediate",
|
|
55
|
-
safety: STANDARD_SAFETY,
|
|
56
|
-
inhaleSeconds: 4,
|
|
57
|
-
holdInSeconds: 7,
|
|
58
|
-
exhaleSeconds: 8,
|
|
59
|
-
defaultRounds: 4,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
id: "coherent",
|
|
63
|
-
name: "Coherent Breathing",
|
|
64
|
-
purpose: "Steady calm",
|
|
65
|
-
description: "Breathe in for 6 seconds and out for 6 seconds, creating an even rhythm of about 5 breaths per minute.",
|
|
66
|
-
difficulty: "Beginner",
|
|
67
|
-
safety: STANDARD_SAFETY,
|
|
68
|
-
inhaleSeconds: 6,
|
|
69
|
-
exhaleSeconds: 6,
|
|
70
|
-
defaultRounds: 10,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
id: "physiological-sigh",
|
|
74
|
-
name: "Physiological Sigh",
|
|
75
|
-
purpose: "Quick reset",
|
|
76
|
-
description: "Take two small inhales through the nose, followed by one longer exhale.",
|
|
77
|
-
difficulty: "Beginner",
|
|
78
|
-
// RCT evidence: https://doi.org/10.1016/j.xcrm.2022.100895
|
|
79
|
-
possibleBenefit: "Regular practice may support a more positive mood and slower resting breathing.",
|
|
80
|
-
safety: STANDARD_SAFETY,
|
|
81
|
-
inhaleSeconds: 3,
|
|
82
|
-
holdInSeconds: 1,
|
|
83
|
-
exhaleSeconds: 6,
|
|
84
|
-
defaultRounds: 5,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
id: "wim-hof",
|
|
88
|
-
name: "Power Breathing",
|
|
89
|
-
purpose: "Energizing practice",
|
|
90
|
-
description: "Take 30 rounds of active 2-second inhales followed by 2-second exhales.",
|
|
91
|
-
difficulty: "Advanced",
|
|
92
|
-
safety: POWER_BREATHING_SAFETY,
|
|
93
|
-
inhaleSeconds: 2,
|
|
94
|
-
exhaleSeconds: 2,
|
|
95
|
-
defaultRounds: 30,
|
|
96
|
-
},
|
|
97
|
-
];
|
|
98
|
-
/** Look up a technique by its ID */
|
|
99
|
-
export function getTechniqueById(id) {
|
|
100
|
-
return TECHNIQUES.find((t) => t.id === id);
|
|
101
|
-
}
|
|
102
|
-
const LEGACY_TECHNIQUE_LABELS = {
|
|
103
|
-
resonance: "Resonant Breathing",
|
|
104
|
-
};
|
|
105
|
-
/** Return a human-readable label without exposing a stored technique identifier. */
|
|
106
|
-
export function getBreathworkTechniqueLabel(techniqueId) {
|
|
107
|
-
return (getTechniqueById(techniqueId)?.name ??
|
|
108
|
-
LEGACY_TECHNIQUE_LABELS[techniqueId] ??
|
|
109
|
-
"Breathwork session");
|
|
110
|
-
}
|
|
111
|
-
/** Compute total session duration in seconds for a given number of rounds */
|
|
112
|
-
export function totalSessionSeconds(technique, rounds) {
|
|
113
|
-
const roundSeconds = technique.inhaleSeconds +
|
|
114
|
-
(technique.holdInSeconds ?? 0) +
|
|
115
|
-
technique.exhaleSeconds +
|
|
116
|
-
(technique.holdOutSeconds ?? 0);
|
|
117
|
-
return roundSeconds * rounds;
|
|
118
|
-
}
|
|
119
|
-
/** Add the server-owned default-session duration to a technique definition. */
|
|
120
|
-
export function toBreathworkTechniqueDetails(technique) {
|
|
121
|
-
return {
|
|
122
|
-
...technique,
|
|
123
|
-
durationSeconds: totalSessionSeconds(technique, technique.defaultRounds),
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
//# sourceMappingURL=breathwork.js.map
|
package/dist/breathwork.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"breathwork.js","sourceRoot":"","sources":["../src/breathwork.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA0BH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,CAAU,CAAC;AAezF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAUjF;;;;GAIG;AACH,MAAM,eAAe,GAA6B;IAChD,QAAQ,EAAE,6DAA6D;IACvE,QAAQ,EAAE,CAAC,qCAAqC,CAAC;IACjD,YAAY,EAAE,uEAAuE;IACrF,SAAS,EACP,8HAA8H;CACjI,CAAC;AAEF;;;GAGG;AACH,MAAM,sBAAsB,GAA6B;IACvD,QAAQ,EAAE,2DAA2D;IACrE,QAAQ,EAAE;QACR,iEAAiE;QACjE,0FAA0F;KAC3F;IACD,YAAY,EAAE,eAAe,CAAC,YAAY;IAC1C,SAAS,EAAE,eAAe,CAAC,SAAS;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAA0B;IAC/C;QACE,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,eAAe;QACrB,OAAO,E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