@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.cjs CHANGED
@@ -116,6 +116,7 @@ __export(index_exports, {
116
116
  MEASURABLE_GOAL_TYPES: () => MEASURABLE_GOAL_TYPES,
117
117
  MESSAGES_PAGE_SIZE: () => MESSAGES_PAGE_SIZE,
118
118
  MESSAGES_PER_MINUTE_MAX: () => MESSAGES_PER_MINUTE_MAX,
119
+ MESSAGE_ATTACHMENT_KINDS: () => MESSAGE_ATTACHMENT_KINDS,
119
120
  MESSAGE_BODY_MAX: () => MESSAGE_BODY_MAX,
120
121
  MESSAGE_PERMISSIONS: () => MESSAGE_PERMISSIONS,
121
122
  MESSAGE_PUSH_DELAY_SECONDS: () => MESSAGE_PUSH_DELAY_SECONDS,
@@ -308,6 +309,7 @@ __export(index_exports, {
308
309
  lpWorkingSets: () => lpWorkingSets,
309
310
  matchesDeletionConfirmation: () => matchesDeletionConfirmation,
310
311
  messageBodyLength: () => messageBodyLength,
312
+ messageNote: () => messageNote,
311
313
  normalizeDashboardLayout: () => normalizeDashboardLayout,
312
314
  normalizeExerciseLinks: () => normalizeExerciseLinks,
313
315
  normalizeExerciseName: () => normalizeExerciseName,
@@ -1638,7 +1640,7 @@ var ROUTINE_VISIBILITY_VALUES = [
1638
1640
  "PUBLIC"
1639
1641
  ];
1640
1642
  var ROUTINE_SHARE_MAX_ACTIVE_LINKS = 10;
1641
- var SHARED_ROUTINE_SOURCES = ["LINK", "VISIBILITY"];
1643
+ var SHARED_ROUTINE_SOURCES = ["LINK", "VISIBILITY", "MESSAGE"];
1642
1644
  var CLONE_ROUTINE_REFUSALS = {
1643
1645
  /** Neither `token` nor `routineId`, or both at once. */
1644
1646
  SOURCE_REQUIRED: "SOURCE_REQUIRED",
@@ -1926,7 +1928,7 @@ var API_ERROR_MESSAGES = {
1926
1928
  EXERCISE_GROUP_TOO_LARGE: "A superset or circuit has at most {max} exercises",
1927
1929
  ROUTINE_ACTIVE_SESSION: "Finish the active session before changing the routine structure",
1928
1930
  ROUTINE_SHARE_LINKS_MAX: "A routine keeps at most {max} active links.",
1929
- CLONE_SOURCE_REQUIRED: "SOURCE_REQUIRED: send either a share token or a routine id",
1931
+ CLONE_SOURCE_REQUIRED: "SOURCE_REQUIRED: send one of a share token, a routine id or a message id",
1930
1932
  CLONE_UNKNOWN_EXERCISE: "UNKNOWN_EXERCISE: an exercise in this routine is no longer in the catalog",
1931
1933
  ROUTINE_VERSIONS_MAX: "A routine keeps at most {max} versions; delete one first",
1932
1934
  ROUTINE_VERSION_EXERCISE_GONE: "An exercise in this version is no longer in the catalog",
@@ -2037,6 +2039,7 @@ var API_ERROR_MESSAGES = {
2037
2039
  // ── Direct messages (MSG-01) ───────────────────────────────────────────
2038
2040
  MESSAGE_SELF: "You cannot message yourself",
2039
2041
  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.",
2040
2043
  MESSAGES_PER_MINUTE: "You can send at most {max} messages a minute.",
2041
2044
  CONVERSATIONS_PER_DAY: "You can start at most {max} new conversations a day.",
2042
2045
  MESSAGE_NOT_ADMITTED: "This member is not taking messages from you.",
@@ -2145,6 +2148,13 @@ function normalizeMessageBody(body) {
2145
2148
  }
2146
2149
  return text;
2147
2150
  }
2151
+ var MESSAGE_ATTACHMENT_KINDS = ["ROUTINE", "WORKOUT"];
2152
+ function messageNote(body, hasAttachment) {
2153
+ if ((body ?? "").trim().length === 0) {
2154
+ return hasAttachment ? null : void 0;
2155
+ }
2156
+ return normalizeMessageBody(body ?? "") ?? void 0;
2157
+ }
2148
2158
  var CONVERSATION_BOXES = ["INBOX", "REQUESTS"];
2149
2159
  var MESSAGE_REQUEST_DECLINE_COOLDOWN_DAYS = 30;
2150
2160
  var MESSAGE_PUSH_DELAY_SECONDS = 30;
@@ -2250,6 +2260,7 @@ function isMessagePermission(value) {
2250
2260
  MEASURABLE_GOAL_TYPES,
2251
2261
  MESSAGES_PAGE_SIZE,
2252
2262
  MESSAGES_PER_MINUTE_MAX,
2263
+ MESSAGE_ATTACHMENT_KINDS,
2253
2264
  MESSAGE_BODY_MAX,
2254
2265
  MESSAGE_PERMISSIONS,
2255
2266
  MESSAGE_PUSH_DELAY_SECONDS,
@@ -2442,6 +2453,7 @@ function isMessagePermission(value) {
2442
2453
  lpWorkingSets,
2443
2454
  matchesDeletionConfirmation,
2444
2455
  messageBodyLength,
2456
+ messageNote,
2445
2457
  normalizeDashboardLayout,
2446
2458
  normalizeExerciseLinks,
2447
2459
  normalizeExerciseName,