@sunsteel/contracts 0.91.0 → 0.93.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.js CHANGED
@@ -1303,7 +1303,7 @@ var ROUTINE_VISIBILITY_VALUES = [
1303
1303
  "PUBLIC"
1304
1304
  ];
1305
1305
  var ROUTINE_SHARE_MAX_ACTIVE_LINKS = 10;
1306
- var SHARED_ROUTINE_SOURCES = ["LINK", "VISIBILITY"];
1306
+ var SHARED_ROUTINE_SOURCES = ["LINK", "VISIBILITY", "MESSAGE"];
1307
1307
  var CLONE_ROUTINE_REFUSALS = {
1308
1308
  /** Neither `token` nor `routineId`, or both at once. */
1309
1309
  SOURCE_REQUIRED: "SOURCE_REQUIRED",
@@ -1591,7 +1591,7 @@ var API_ERROR_MESSAGES = {
1591
1591
  EXERCISE_GROUP_TOO_LARGE: "A superset or circuit has at most {max} exercises",
1592
1592
  ROUTINE_ACTIVE_SESSION: "Finish the active session before changing the routine structure",
1593
1593
  ROUTINE_SHARE_LINKS_MAX: "A routine keeps at most {max} active links.",
1594
- CLONE_SOURCE_REQUIRED: "SOURCE_REQUIRED: send either a share token or a routine id",
1594
+ CLONE_SOURCE_REQUIRED: "SOURCE_REQUIRED: send one of a share token, a routine id or a message id",
1595
1595
  CLONE_UNKNOWN_EXERCISE: "UNKNOWN_EXERCISE: an exercise in this routine is no longer in the catalog",
1596
1596
  ROUTINE_VERSIONS_MAX: "A routine keeps at most {max} versions; delete one first",
1597
1597
  ROUTINE_VERSION_EXERCISE_GONE: "An exercise in this version is no longer in the catalog",
@@ -1702,6 +1702,7 @@ var API_ERROR_MESSAGES = {
1702
1702
  // ── Direct messages (MSG-01) ───────────────────────────────────────────
1703
1703
  MESSAGE_SELF: "You cannot message yourself",
1704
1704
  MESSAGE_LENGTH: "A message must not be empty and may be at most {max} characters.",
1705
+ MESSAGE_ONE_ATTACHMENT: "A message can carry one routine or one workout.",
1705
1706
  MESSAGES_PER_MINUTE: "You can send at most {max} messages a minute.",
1706
1707
  CONVERSATIONS_PER_DAY: "You can start at most {max} new conversations a day.",
1707
1708
  MESSAGE_NOT_ADMITTED: "This member is not taking messages from you.",
@@ -1810,6 +1811,13 @@ function normalizeMessageBody(body) {
1810
1811
  }
1811
1812
  return text;
1812
1813
  }
1814
+ var MESSAGE_ATTACHMENT_KINDS = ["ROUTINE", "WORKOUT"];
1815
+ function messageNote(body, hasAttachment) {
1816
+ if ((body ?? "").trim().length === 0) {
1817
+ return hasAttachment ? null : void 0;
1818
+ }
1819
+ return normalizeMessageBody(body ?? "") ?? void 0;
1820
+ }
1813
1821
  var CONVERSATION_BOXES = ["INBOX", "REQUESTS"];
1814
1822
  var MESSAGE_REQUEST_DECLINE_COOLDOWN_DAYS = 30;
1815
1823
  var MESSAGE_PUSH_DELAY_SECONDS = 30;
@@ -1914,6 +1922,7 @@ export {
1914
1922
  MEASURABLE_GOAL_TYPES,
1915
1923
  MESSAGES_PAGE_SIZE,
1916
1924
  MESSAGES_PER_MINUTE_MAX,
1925
+ MESSAGE_ATTACHMENT_KINDS,
1917
1926
  MESSAGE_BODY_MAX,
1918
1927
  MESSAGE_PERMISSIONS,
1919
1928
  MESSAGE_PUSH_DELAY_SECONDS,
@@ -2106,6 +2115,7 @@ export {
2106
2115
  lpWorkingSets,
2107
2116
  matchesDeletionConfirmation,
2108
2117
  messageBodyLength,
2118
+ messageNote,
2109
2119
  normalizeDashboardLayout,
2110
2120
  normalizeExerciseLinks,
2111
2121
  normalizeExerciseName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunsteel/contracts",
3
- "version": "0.91.0",
3
+ "version": "0.93.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ezee969/sunsteel-contracts.git"