@sunsteel/contracts 0.93.0 → 0.95.0

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/dist/index.cjs CHANGED
@@ -297,6 +297,7 @@ __export(index_exports, {
297
297
  latestBodyWeight: () => latestBodyWeight,
298
298
  leadWorkingWeight: () => leadWorkingWeight,
299
299
  linearPeriodizationProblem: () => linearPeriodizationProblem,
300
+ lpAtStep: () => lpAtStep,
300
301
  lpEstimate: () => lpEstimate,
301
302
  lpLoadKg: () => lpLoadKg,
302
303
  lpPrescription: () => lpPrescription,
@@ -980,11 +981,12 @@ function lpLoadKg(referenceMaxKg, percentage, incrementKg) {
980
981
  return roundToIncrement(referenceMaxKg * percentage, incrementKg);
981
982
  }
982
983
  var LP_PHASES = ["BLOCK", "RECOVERY", "FINISHED"];
983
- function startLinearPeriodization(referenceMaxKg, cycle = 1) {
984
+ var clampStep = (step) => Math.min(Math.max(Math.trunc(step) || 1, 1), LP_BLOCK_STEPS);
985
+ function startLinearPeriodization(referenceMaxKg, cycle = 1, step = 1) {
984
986
  return {
985
987
  referenceMaxKg,
986
988
  phase: "BLOCK",
987
- step: 1,
989
+ step: clampStep(step),
988
990
  cycle,
989
991
  samples: [],
990
992
  finishedAt: null,
@@ -992,6 +994,18 @@ function startLinearPeriodization(referenceMaxKg, cycle = 1) {
992
994
  nextReferenceMaxKg: null
993
995
  };
994
996
  }
997
+ function lpAtStep(state, step) {
998
+ const at = clampStep(step);
999
+ return {
1000
+ ...state,
1001
+ phase: "BLOCK",
1002
+ step: at,
1003
+ samples: state.samples.filter((sample) => sample.step < at),
1004
+ finishedAt: null,
1005
+ estimatedMaxKg: null,
1006
+ nextReferenceMaxKg: null
1007
+ };
1008
+ }
995
1009
  function linearPeriodizationProblem(state) {
996
1010
  if (!Number.isFinite(state.referenceMaxKg) || state.referenceMaxKg <= 0 || state.referenceMaxKg > LP_REFERENCE_MAX_KG) {
997
1011
  return "The reference max must be above 0";
@@ -2039,7 +2053,7 @@ var API_ERROR_MESSAGES = {
2039
2053
  // ── Direct messages (MSG-01) ───────────────────────────────────────────
2040
2054
  MESSAGE_SELF: "You cannot message yourself",
2041
2055
  MESSAGE_LENGTH: "A message must not be empty and may be at most {max} characters.",
2042
- MESSAGE_ONE_ATTACHMENT: "A message can carry one routine or one workout.",
2056
+ MESSAGE_ONE_ATTACHMENT: "A message can carry one routine, one workout or one record.",
2043
2057
  MESSAGES_PER_MINUTE: "You can send at most {max} messages a minute.",
2044
2058
  CONVERSATIONS_PER_DAY: "You can start at most {max} new conversations a day.",
2045
2059
  MESSAGE_NOT_ADMITTED: "This member is not taking messages from you.",
@@ -2148,7 +2162,7 @@ function normalizeMessageBody(body) {
2148
2162
  }
2149
2163
  return text;
2150
2164
  }
2151
- var MESSAGE_ATTACHMENT_KINDS = ["ROUTINE", "WORKOUT"];
2165
+ var MESSAGE_ATTACHMENT_KINDS = ["ROUTINE", "WORKOUT", "RECORD"];
2152
2166
  function messageNote(body, hasAttachment) {
2153
2167
  if ((body ?? "").trim().length === 0) {
2154
2168
  return hasAttachment ? null : void 0;
@@ -2441,6 +2455,7 @@ function isMessagePermission(value) {
2441
2455
  latestBodyWeight,
2442
2456
  leadWorkingWeight,
2443
2457
  linearPeriodizationProblem,
2458
+ lpAtStep,
2444
2459
  lpEstimate,
2445
2460
  lpLoadKg,
2446
2461
  lpPrescription,