@sunsteel/contracts 0.45.0 → 0.46.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 +24 -0
- package/dist/index.d.cts +99 -1
- package/dist/index.d.ts +99 -1
- package/dist/index.js +19 -0
- package/package.json +40 -40
package/dist/index.cjs
CHANGED
|
@@ -59,12 +59,17 @@ __export(index_exports, {
|
|
|
59
59
|
PROFILE_VISIBILITY_VALUES: () => PROFILE_VISIBILITY_VALUES,
|
|
60
60
|
PROGRESSION_SCHEMES: () => PROGRESSION_SCHEMES,
|
|
61
61
|
PROGRESS_TIMELINE_EVENT_TYPES: () => PROGRESS_TIMELINE_EVENT_TYPES,
|
|
62
|
+
PUSH_PAYLOAD_KINDS: () => PUSH_PAYLOAD_KINDS,
|
|
63
|
+
PUSH_SUBSCRIPTIONS_MAX: () => PUSH_SUBSCRIPTIONS_MAX,
|
|
62
64
|
RELATIONSHIP_LIST_DEFAULT_LIMIT: () => RELATIONSHIP_LIST_DEFAULT_LIMIT,
|
|
63
65
|
RELATIONSHIP_LIST_KINDS: () => RELATIONSHIP_LIST_KINDS,
|
|
64
66
|
RELATIONSHIP_LIST_MAX_LIMIT: () => RELATIONSHIP_LIST_MAX_LIMIT,
|
|
65
67
|
RENAISSANCE_RANK_DEFINITIONS: () => RENAISSANCE_RANK_DEFINITIONS,
|
|
66
68
|
REP_TYPES: () => REP_TYPES,
|
|
67
69
|
RESERVED_USERNAMES: () => RESERVED_USERNAMES,
|
|
70
|
+
REST_ALERT_MAX_LEAD_SECONDS: () => REST_ALERT_MAX_LEAD_SECONDS,
|
|
71
|
+
REST_ALERT_MIN_LEAD_SECONDS: () => REST_ALERT_MIN_LEAD_SECONDS,
|
|
72
|
+
REST_ALERT_REFUSALS: () => REST_ALERT_REFUSALS,
|
|
68
73
|
ROUTINE_DAYS_MAX: () => ROUTINE_DAYS_MAX,
|
|
69
74
|
ROUTINE_DAY_NAME_MAX: () => ROUTINE_DAY_NAME_MAX,
|
|
70
75
|
ROUTINE_SCHEDULE_MODES: () => ROUTINE_SCHEDULE_MODES,
|
|
@@ -462,6 +467,20 @@ var NOTIFICATION_KINDS = [
|
|
|
462
467
|
var NOTIFICATIONS_LOOKBACK_DAYS = 30;
|
|
463
468
|
var NOTIFICATIONS_RETENTION_DAYS = 90;
|
|
464
469
|
var NOTIFICATIONS_LIST_LIMIT = 50;
|
|
470
|
+
|
|
471
|
+
// src/push.ts
|
|
472
|
+
var PUSH_SUBSCRIPTIONS_MAX = 10;
|
|
473
|
+
var PUSH_PAYLOAD_KINDS = ["REST_ALERT"];
|
|
474
|
+
var REST_ALERT_MAX_LEAD_SECONDS = 3600;
|
|
475
|
+
var REST_ALERT_MIN_LEAD_SECONDS = 5;
|
|
476
|
+
var REST_ALERT_REFUSALS = [
|
|
477
|
+
/** The account has no subscribed device. */
|
|
478
|
+
"NO_SUBSCRIPTION",
|
|
479
|
+
/** The server holds no VAPID key pair. */
|
|
480
|
+
"PUSH_UNAVAILABLE",
|
|
481
|
+
/** Rest ends too soon for a push to beat it. */
|
|
482
|
+
"TOO_SOON"
|
|
483
|
+
];
|
|
465
484
|
// Annotate the CommonJS export names for ESM import in node:
|
|
466
485
|
0 && (module.exports = {
|
|
467
486
|
ACHIEVEMENT_CATEGORIES,
|
|
@@ -503,12 +522,17 @@ var NOTIFICATIONS_LIST_LIMIT = 50;
|
|
|
503
522
|
PROFILE_VISIBILITY_VALUES,
|
|
504
523
|
PROGRESSION_SCHEMES,
|
|
505
524
|
PROGRESS_TIMELINE_EVENT_TYPES,
|
|
525
|
+
PUSH_PAYLOAD_KINDS,
|
|
526
|
+
PUSH_SUBSCRIPTIONS_MAX,
|
|
506
527
|
RELATIONSHIP_LIST_DEFAULT_LIMIT,
|
|
507
528
|
RELATIONSHIP_LIST_KINDS,
|
|
508
529
|
RELATIONSHIP_LIST_MAX_LIMIT,
|
|
509
530
|
RENAISSANCE_RANK_DEFINITIONS,
|
|
510
531
|
REP_TYPES,
|
|
511
532
|
RESERVED_USERNAMES,
|
|
533
|
+
REST_ALERT_MAX_LEAD_SECONDS,
|
|
534
|
+
REST_ALERT_MIN_LEAD_SECONDS,
|
|
535
|
+
REST_ALERT_REFUSALS,
|
|
512
536
|
ROUTINE_DAYS_MAX,
|
|
513
537
|
ROUTINE_DAY_NAME_MAX,
|
|
514
538
|
ROUTINE_SCHEDULE_MODES,
|
package/dist/index.d.cts
CHANGED
|
@@ -1485,4 +1485,102 @@ interface MarkNotificationsReadResponse {
|
|
|
1485
1485
|
unreadCount: number;
|
|
1486
1486
|
}
|
|
1487
1487
|
|
|
1488
|
-
|
|
1488
|
+
/**
|
|
1489
|
+
* The two keys a browser's `PushSubscription` carries. They are the encryption
|
|
1490
|
+
* material for that endpoint, not an identifier, and are never returned to a
|
|
1491
|
+
* client — only accepted.
|
|
1492
|
+
*/
|
|
1493
|
+
interface PushSubscriptionKeys {
|
|
1494
|
+
p256dh: string;
|
|
1495
|
+
auth: string;
|
|
1496
|
+
}
|
|
1497
|
+
/** One account keeps at most this many devices subscribed. */
|
|
1498
|
+
declare const PUSH_SUBSCRIPTIONS_MAX = 10;
|
|
1499
|
+
/** POST /notifications/push/subscriptions — idempotent on `endpoint`. */
|
|
1500
|
+
interface RegisterPushSubscriptionRequest {
|
|
1501
|
+
endpoint: string;
|
|
1502
|
+
/** The browser's own expiry, almost always null. */
|
|
1503
|
+
expirationTime: number | null;
|
|
1504
|
+
keys: PushSubscriptionKeys;
|
|
1505
|
+
/**
|
|
1506
|
+
* A short device label the owner can recognise in their own list. It is
|
|
1507
|
+
* derived by the client from the user agent, never the raw string.
|
|
1508
|
+
*/
|
|
1509
|
+
deviceLabel?: string;
|
|
1510
|
+
}
|
|
1511
|
+
/**
|
|
1512
|
+
* What the owner sees about one of their own subscribed devices. The endpoint
|
|
1513
|
+
* is a bearer capability for sending that device notifications, so it is
|
|
1514
|
+
* deliberately absent.
|
|
1515
|
+
*/
|
|
1516
|
+
interface PushSubscriptionSummary {
|
|
1517
|
+
id: string;
|
|
1518
|
+
deviceLabel: string | null;
|
|
1519
|
+
createdAt: IsoDateString;
|
|
1520
|
+
/** Refreshed whenever the same endpoint registers again. */
|
|
1521
|
+
lastSeenAt: IsoDateString;
|
|
1522
|
+
/** True for the subscription the requesting device just sent. */
|
|
1523
|
+
isCurrentDevice: boolean;
|
|
1524
|
+
}
|
|
1525
|
+
/** GET /notifications/push/subscriptions */
|
|
1526
|
+
interface PushSubscriptionsResponse {
|
|
1527
|
+
subscriptions: PushSubscriptionSummary[];
|
|
1528
|
+
/**
|
|
1529
|
+
* Null when the server holds no VAPID key pair. The client must treat that
|
|
1530
|
+
* as "push is unavailable" and never prompt for permission.
|
|
1531
|
+
*/
|
|
1532
|
+
vapidPublicKey: string | null;
|
|
1533
|
+
}
|
|
1534
|
+
/** DELETE /notifications/push/subscriptions */
|
|
1535
|
+
interface DeletePushSubscriptionRequest {
|
|
1536
|
+
endpoint: string;
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* What a delivered push asks the service worker to show. `kind` exists so the
|
|
1540
|
+
* worker can branch without guessing from the copy.
|
|
1541
|
+
*/
|
|
1542
|
+
declare const PUSH_PAYLOAD_KINDS: readonly ["REST_ALERT"];
|
|
1543
|
+
type PushPayloadKind = (typeof PUSH_PAYLOAD_KINDS)[number];
|
|
1544
|
+
interface RestAlertPushPayload {
|
|
1545
|
+
kind: 'REST_ALERT';
|
|
1546
|
+
title: string;
|
|
1547
|
+
/**
|
|
1548
|
+
* A static line. The Web Notifications API has no chronometer field, so this
|
|
1549
|
+
* never contains a number that ticks down — see the NOTIF-03 scope limit.
|
|
1550
|
+
*/
|
|
1551
|
+
body: string;
|
|
1552
|
+
sessionId: string;
|
|
1553
|
+
/** Where clicking the notification goes. */
|
|
1554
|
+
url: string;
|
|
1555
|
+
/** Collapses an older alert for the same session instead of stacking. */
|
|
1556
|
+
tag: string;
|
|
1557
|
+
}
|
|
1558
|
+
type PushPayload = RestAlertPushPayload;
|
|
1559
|
+
/** A rest alert is refused beyond this far ahead. */
|
|
1560
|
+
declare const REST_ALERT_MAX_LEAD_SECONDS = 3600;
|
|
1561
|
+
/**
|
|
1562
|
+
* Scheduling closer than this cannot beat the sweep interval, so the request
|
|
1563
|
+
* is accepted and reported as not scheduled rather than silently dropped.
|
|
1564
|
+
*/
|
|
1565
|
+
declare const REST_ALERT_MIN_LEAD_SECONDS = 5;
|
|
1566
|
+
/**
|
|
1567
|
+
* PUT /workouts/sessions/:id/rest-alert
|
|
1568
|
+
*
|
|
1569
|
+
* One pending alert per session: a new rest period replaces the last one, so a
|
|
1570
|
+
* session holds at most one scheduled push however many sets it logs.
|
|
1571
|
+
*/
|
|
1572
|
+
interface ScheduleRestAlertRequest {
|
|
1573
|
+
/** When the rest period ends, at second-level precision. */
|
|
1574
|
+
endsAt: IsoDateString;
|
|
1575
|
+
/** Named in the notification so the athlete knows which lift resumes. */
|
|
1576
|
+
exerciseName: string;
|
|
1577
|
+
}
|
|
1578
|
+
interface ScheduleRestAlertResponse {
|
|
1579
|
+
/** Null when nothing was scheduled; `reason` then says why. */
|
|
1580
|
+
scheduledFor: IsoDateString | null;
|
|
1581
|
+
reason: RestAlertRefusal | null;
|
|
1582
|
+
}
|
|
1583
|
+
declare const REST_ALERT_REFUSALS: readonly ["NO_SUBSCRIPTION", "PUSH_UNAVAILABLE", "TOO_SOON"];
|
|
1584
|
+
type RestAlertRefusal = (typeof REST_ALERT_REFUSALS)[number];
|
|
1585
|
+
|
|
1586
|
+
export { ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementNotification, type AchievementUnlockedEventPayload, type AchievementsResponse, type AppNotification, type Brand, COMEBACK_MIN_INACTIVE_DAYS, COMEBACK_RECOGNITION_LIMIT, COMEBACK_REQUIRED_ACTIVE_DAYS, COMEBACK_SESSION_LOOKBACK, COMEBACK_WINDOW_DAYS, type CalendarDate, type ComebackRecognition, type ComebackRecognitionSummary, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateRoutineVersionRequest, type CreateSessionShareRequest, type DeletePushSubscriptionRequest, EXERCISE_EQUIPMENT, EXERCISE_MECHANICS, type EarnedAchievement, type EarnedPersonalRecord, type Exercise, type ExerciseEquipment, type ExerciseId, type ExerciseMechanic, type ExercisePerformanceHistoryQuery, type ExercisePerformanceHistoryResponse, type ExercisePerformancePrescription, type ExercisePerformancePrescriptionSet, type ExercisePerformanceSession, type ExercisePerformanceSet, type ExercisePerformanceSummary, type ExercisePlateau, type ExerciseStrengthSummary, type ExerciseStrengthTrendPoint, type ExerciseStrengthTrendQuery, type ExerciseStrengthTrendResponse, FEATURED_PROFILE_ITEMS_MAX, FEATURED_PROFILE_ITEM_KINDS, FEATURED_PROFILE_REFERENCE_MAX_LENGTH, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FeaturedProfileAchievementItem, type FeaturedProfileItem, type FeaturedProfileItemKind, type FeaturedProfileRankItem, type FeaturedProfileRecordItem, type FeaturedProfileSelection, type FeaturedProfileSelectionInput, type FeaturedProfileSelectionsResponse, type FinishStatus, type FinishWorkoutRequest, type FinishWorkoutResponse, type FollowSuggestion, type FollowSuggestionReason, type FollowSuggestionsResponse, type IsoDateString, type ListSessionsParams, MEASURABLE_GOALS_MAX, MEASURABLE_GOAL_DIRECTIONS, MEASURABLE_GOAL_TYPES, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MarkNotificationsReadRequest, type MarkNotificationsReadResponse, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MoveOccurrenceRequest, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, NOTIFICATIONS_LIST_LIMIT, NOTIFICATIONS_LOOKBACK_DAYS, NOTIFICATIONS_RETENTION_DAYS, NOTIFICATION_KINDS, type NewFollowerNotification, type NotificationKind, type NotificationsResponse, PLATEAU_MIN_DAYS_SINCE_BEST, PLATEAU_MIN_SESSIONS, PLATEAU_MIN_SESSIONS_MAX, PLATEAU_MIN_SESSIONS_MIN, PLATEAU_RECENT_DAYS, PLATEAU_WINDOW_DAYS, PREFERRED_TRAINING_STYLE_VALUES, PROFILE_BIO_MAX_LENGTH, PROFILE_FAVORITE_EXERCISES_MAX, PROFILE_LOCATION_MAX_LENGTH, PROFILE_TRAINING_DISCIPLINES_MAX, PROFILE_TRAINING_GOALS_MAX, PROFILE_VISIBILITY_VALUES, PROGRESSION_SCHEMES, PROGRESS_TIMELINE_EVENT_TYPES, PUSH_PAYLOAD_KINDS, PUSH_SUBSCRIPTIONS_MAX, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordEntry, type PersonalRecordKind, type PlatePairInventory, type PlateauPreferences, type PlateauSet, type PlateausResponse, type PreferredTrainingStyle, type PreviousPerformanceResponse, type PreviousSessionRecap, type PreviousSetPerformance, type ProfileDiscoverySettings, type ProfileFavoriteExercise, type ProfilePrivacySettings, type ProfileViewerAccess, type ProfileVisibility, type ProgressTimelineEventType, type ProgressTimelineItem, type ProgressTimelinePersonalRecordItem, type ProgressTimelineProgressionItem, type ProgressTimelineQuery, type ProgressTimelineRecordPerformance, type ProgressTimelineRecordReason, type ProgressTimelineResponse, type ProgressTimelineSessionContext, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicProfileAchievements, type PublicTrainingSummary, type PublicUserProfile, type PushPayload, type PushPayloadKind, type PushSubscriptionKeys, type PushSubscriptionSummary, type PushSubscriptionsResponse, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REP_TYPES, RESERVED_USERNAMES, REST_ALERT_MAX_LEAD_SECONDS, REST_ALERT_MIN_LEAD_SECONDS, REST_ALERT_REFUSALS, ROUTINE_DAYS_MAX, ROUTINE_DAY_NAME_MAX, ROUTINE_SCHEDULE_MODES, ROUTINE_VERSIONS_MAX, ROUTINE_VERSION_KINDS, ROUTINE_VERSION_NAME_MAX, type RecentActivityEntry, type RegisterPushSubscriptionRequest, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceFeaturedProfileItemsRequest, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type RestAlertPushPayload, type RestAlertRefusal, type RestoreRoutineVersionResponse, type Routine, type RoutineDay, type RoutineDayId, type RoutineExercise, type RoutineId, type RoutineScheduleMode, type RoutineSet, type RoutineVersion, type RoutineVersionDay, type RoutineVersionExercise, type RoutineVersionKind, type RoutineVersionSetup, type RoutineVersionsResponse, SCHEDULE_MOVE_MAX_DAYS, SCHEDULE_OVERRIDES_MAX_RANGE_DAYS, SCHEDULE_OVERRIDE_KINDS, SCHEDULE_SKIP_PAST_DAYS, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, STARRED_EXERCISES_MAX, type ScheduleOverride, type ScheduleOverrideKind, type ScheduleOverridesQuery, type ScheduleOverridesResponse, type ScheduleRestAlertRequest, type ScheduleRestAlertResponse, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionExerciseSubstitution, type SessionProgressNotification, type SessionRecapRecord, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetLog, type Sex, type SharedSessionOwner, type SharedSessionRecap, type SkipOccurrenceRequest, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakMilestoneEventPayload, type SubstituteSessionExerciseRequest, type SubstituteSessionExerciseResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, TRAINING_DISCIPLINE_VALUES, TRAINING_EVENT_TYPES, TRAINING_EXPERIENCE_LEVEL_VALUES, TRAINING_GOAL_VALUES, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, type VolumeTrendPoint, type VolumeTrendQuery, type VolumeTrendResponse, type VolumeTrendSeries, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutAnalyticsStatus, type WorkoutProgressQuery, type WorkoutProgressResponse, type WorkoutSession, type WorkoutSessionId, type WorkoutSessionListResponse, type WorkoutSessionRecap, type WorkoutSessionSnapshotV1, type WorkoutSessionStatus, type WorkoutSessionSummary, type WorkoutStatsQuery, type WorkoutStatsResponse, routineDayLabel };
|
package/dist/index.d.ts
CHANGED
|
@@ -1485,4 +1485,102 @@ interface MarkNotificationsReadResponse {
|
|
|
1485
1485
|
unreadCount: number;
|
|
1486
1486
|
}
|
|
1487
1487
|
|
|
1488
|
-
|
|
1488
|
+
/**
|
|
1489
|
+
* The two keys a browser's `PushSubscription` carries. They are the encryption
|
|
1490
|
+
* material for that endpoint, not an identifier, and are never returned to a
|
|
1491
|
+
* client — only accepted.
|
|
1492
|
+
*/
|
|
1493
|
+
interface PushSubscriptionKeys {
|
|
1494
|
+
p256dh: string;
|
|
1495
|
+
auth: string;
|
|
1496
|
+
}
|
|
1497
|
+
/** One account keeps at most this many devices subscribed. */
|
|
1498
|
+
declare const PUSH_SUBSCRIPTIONS_MAX = 10;
|
|
1499
|
+
/** POST /notifications/push/subscriptions — idempotent on `endpoint`. */
|
|
1500
|
+
interface RegisterPushSubscriptionRequest {
|
|
1501
|
+
endpoint: string;
|
|
1502
|
+
/** The browser's own expiry, almost always null. */
|
|
1503
|
+
expirationTime: number | null;
|
|
1504
|
+
keys: PushSubscriptionKeys;
|
|
1505
|
+
/**
|
|
1506
|
+
* A short device label the owner can recognise in their own list. It is
|
|
1507
|
+
* derived by the client from the user agent, never the raw string.
|
|
1508
|
+
*/
|
|
1509
|
+
deviceLabel?: string;
|
|
1510
|
+
}
|
|
1511
|
+
/**
|
|
1512
|
+
* What the owner sees about one of their own subscribed devices. The endpoint
|
|
1513
|
+
* is a bearer capability for sending that device notifications, so it is
|
|
1514
|
+
* deliberately absent.
|
|
1515
|
+
*/
|
|
1516
|
+
interface PushSubscriptionSummary {
|
|
1517
|
+
id: string;
|
|
1518
|
+
deviceLabel: string | null;
|
|
1519
|
+
createdAt: IsoDateString;
|
|
1520
|
+
/** Refreshed whenever the same endpoint registers again. */
|
|
1521
|
+
lastSeenAt: IsoDateString;
|
|
1522
|
+
/** True for the subscription the requesting device just sent. */
|
|
1523
|
+
isCurrentDevice: boolean;
|
|
1524
|
+
}
|
|
1525
|
+
/** GET /notifications/push/subscriptions */
|
|
1526
|
+
interface PushSubscriptionsResponse {
|
|
1527
|
+
subscriptions: PushSubscriptionSummary[];
|
|
1528
|
+
/**
|
|
1529
|
+
* Null when the server holds no VAPID key pair. The client must treat that
|
|
1530
|
+
* as "push is unavailable" and never prompt for permission.
|
|
1531
|
+
*/
|
|
1532
|
+
vapidPublicKey: string | null;
|
|
1533
|
+
}
|
|
1534
|
+
/** DELETE /notifications/push/subscriptions */
|
|
1535
|
+
interface DeletePushSubscriptionRequest {
|
|
1536
|
+
endpoint: string;
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* What a delivered push asks the service worker to show. `kind` exists so the
|
|
1540
|
+
* worker can branch without guessing from the copy.
|
|
1541
|
+
*/
|
|
1542
|
+
declare const PUSH_PAYLOAD_KINDS: readonly ["REST_ALERT"];
|
|
1543
|
+
type PushPayloadKind = (typeof PUSH_PAYLOAD_KINDS)[number];
|
|
1544
|
+
interface RestAlertPushPayload {
|
|
1545
|
+
kind: 'REST_ALERT';
|
|
1546
|
+
title: string;
|
|
1547
|
+
/**
|
|
1548
|
+
* A static line. The Web Notifications API has no chronometer field, so this
|
|
1549
|
+
* never contains a number that ticks down — see the NOTIF-03 scope limit.
|
|
1550
|
+
*/
|
|
1551
|
+
body: string;
|
|
1552
|
+
sessionId: string;
|
|
1553
|
+
/** Where clicking the notification goes. */
|
|
1554
|
+
url: string;
|
|
1555
|
+
/** Collapses an older alert for the same session instead of stacking. */
|
|
1556
|
+
tag: string;
|
|
1557
|
+
}
|
|
1558
|
+
type PushPayload = RestAlertPushPayload;
|
|
1559
|
+
/** A rest alert is refused beyond this far ahead. */
|
|
1560
|
+
declare const REST_ALERT_MAX_LEAD_SECONDS = 3600;
|
|
1561
|
+
/**
|
|
1562
|
+
* Scheduling closer than this cannot beat the sweep interval, so the request
|
|
1563
|
+
* is accepted and reported as not scheduled rather than silently dropped.
|
|
1564
|
+
*/
|
|
1565
|
+
declare const REST_ALERT_MIN_LEAD_SECONDS = 5;
|
|
1566
|
+
/**
|
|
1567
|
+
* PUT /workouts/sessions/:id/rest-alert
|
|
1568
|
+
*
|
|
1569
|
+
* One pending alert per session: a new rest period replaces the last one, so a
|
|
1570
|
+
* session holds at most one scheduled push however many sets it logs.
|
|
1571
|
+
*/
|
|
1572
|
+
interface ScheduleRestAlertRequest {
|
|
1573
|
+
/** When the rest period ends, at second-level precision. */
|
|
1574
|
+
endsAt: IsoDateString;
|
|
1575
|
+
/** Named in the notification so the athlete knows which lift resumes. */
|
|
1576
|
+
exerciseName: string;
|
|
1577
|
+
}
|
|
1578
|
+
interface ScheduleRestAlertResponse {
|
|
1579
|
+
/** Null when nothing was scheduled; `reason` then says why. */
|
|
1580
|
+
scheduledFor: IsoDateString | null;
|
|
1581
|
+
reason: RestAlertRefusal | null;
|
|
1582
|
+
}
|
|
1583
|
+
declare const REST_ALERT_REFUSALS: readonly ["NO_SUBSCRIPTION", "PUSH_UNAVAILABLE", "TOO_SOON"];
|
|
1584
|
+
type RestAlertRefusal = (typeof REST_ALERT_REFUSALS)[number];
|
|
1585
|
+
|
|
1586
|
+
export { ACHIEVEMENT_CATEGORIES, ACHIEVEMENT_DEFINITIONS, type AchievementCategory, type AchievementCategoryProgress, type AchievementDefinition, type AchievementNotification, type AchievementUnlockedEventPayload, type AchievementsResponse, type AppNotification, type Brand, COMEBACK_MIN_INACTIVE_DAYS, COMEBACK_RECOGNITION_LIMIT, COMEBACK_REQUIRED_ACTIVE_DAYS, COMEBACK_SESSION_LOOKBACK, COMEBACK_WINDOW_DAYS, type CalendarDate, type ComebackRecognition, type ComebackRecognitionSummary, type CreateRoutineDayInput, type CreateRoutineExerciseInput, type CreateRoutineRequest, type CreateRoutineVersionRequest, type CreateSessionShareRequest, type DeletePushSubscriptionRequest, EXERCISE_EQUIPMENT, EXERCISE_MECHANICS, type EarnedAchievement, type EarnedPersonalRecord, type Exercise, type ExerciseEquipment, type ExerciseId, type ExerciseMechanic, type ExercisePerformanceHistoryQuery, type ExercisePerformanceHistoryResponse, type ExercisePerformancePrescription, type ExercisePerformancePrescriptionSet, type ExercisePerformanceSession, type ExercisePerformanceSet, type ExercisePerformanceSummary, type ExercisePlateau, type ExerciseStrengthSummary, type ExerciseStrengthTrendPoint, type ExerciseStrengthTrendQuery, type ExerciseStrengthTrendResponse, FEATURED_PROFILE_ITEMS_MAX, FEATURED_PROFILE_ITEM_KINDS, FEATURED_PROFILE_REFERENCE_MAX_LENGTH, FOLLOW_SUGGESTIONS_DEFAULT_LIMIT, FOLLOW_SUGGESTIONS_MAX_LIMIT, FOLLOW_SUGGESTION_REASONS, type FeaturedProfileAchievementItem, type FeaturedProfileItem, type FeaturedProfileItemKind, type FeaturedProfileRankItem, type FeaturedProfileRecordItem, type FeaturedProfileSelection, type FeaturedProfileSelectionInput, type FeaturedProfileSelectionsResponse, type FinishStatus, type FinishWorkoutRequest, type FinishWorkoutResponse, type FollowSuggestion, type FollowSuggestionReason, type FollowSuggestionsResponse, type IsoDateString, type ListSessionsParams, MEASURABLE_GOALS_MAX, MEASURABLE_GOAL_DIRECTIONS, MEASURABLE_GOAL_TYPES, MOVEMENT_PATTERNS, MUSCLE_GROUPS, type MarkNotificationsReadRequest, type MarkNotificationsReadResponse, type MeasurableGoal, type MeasurableGoalDirection, type MeasurableGoalExercise, type MeasurableGoalInput, type MeasurableGoalType, type MoveOccurrenceRequest, type MovementPattern, type MuscleGroup, type MuscleGroupHeatmapQuery, type MuscleGroupHeatmapResponse, type MuscleGroupHeatmapValue, type MuscleGroupHeatmapWeek, type MuscleVolumeTrendSeries, NOTIFICATIONS_LIST_LIMIT, NOTIFICATIONS_LOOKBACK_DAYS, NOTIFICATIONS_RETENTION_DAYS, NOTIFICATION_KINDS, type NewFollowerNotification, type NotificationKind, type NotificationsResponse, PLATEAU_MIN_DAYS_SINCE_BEST, PLATEAU_MIN_SESSIONS, PLATEAU_MIN_SESSIONS_MAX, PLATEAU_MIN_SESSIONS_MIN, PLATEAU_RECENT_DAYS, PLATEAU_WINDOW_DAYS, PREFERRED_TRAINING_STYLE_VALUES, PROFILE_BIO_MAX_LENGTH, PROFILE_FAVORITE_EXERCISES_MAX, PROFILE_LOCATION_MAX_LENGTH, PROFILE_TRAINING_DISCIPLINES_MAX, PROFILE_TRAINING_GOALS_MAX, PROFILE_VISIBILITY_VALUES, PROGRESSION_SCHEMES, PROGRESS_TIMELINE_EVENT_TYPES, PUSH_PAYLOAD_KINDS, PUSH_SUBSCRIPTIONS_MAX, type PaginatedResponse, type PersonalGoalProgress, type PersonalGoalsResponse, type PersonalRecordEntry, type PersonalRecordKind, type PlatePairInventory, type PlateauPreferences, type PlateauSet, type PlateausResponse, type PreferredTrainingStyle, type PreviousPerformanceResponse, type PreviousSessionRecap, type PreviousSetPerformance, type ProfileDiscoverySettings, type ProfileFavoriteExercise, type ProfilePrivacySettings, type ProfileViewerAccess, type ProfileVisibility, type ProgressTimelineEventType, type ProgressTimelineItem, type ProgressTimelinePersonalRecordItem, type ProgressTimelineProgressionItem, type ProgressTimelineQuery, type ProgressTimelineRecordPerformance, type ProgressTimelineRecordReason, type ProgressTimelineResponse, type ProgressTimelineSessionContext, type ProgressionChange, type ProgressionRule, type ProgressionScheme, type ProgressionSetChange, type PublicBodyMetrics, type PublicProfileAchievements, type PublicTrainingSummary, type PublicUserProfile, type PushPayload, type PushPayloadKind, type PushSubscriptionKeys, type PushSubscriptionSummary, type PushSubscriptionsResponse, RELATIONSHIP_LIST_DEFAULT_LIMIT, RELATIONSHIP_LIST_KINDS, RELATIONSHIP_LIST_MAX_LIMIT, RENAISSANCE_RANK_DEFINITIONS, REP_TYPES, RESERVED_USERNAMES, REST_ALERT_MAX_LEAD_SECONDS, REST_ALERT_MIN_LEAD_SECONDS, REST_ALERT_REFUSALS, ROUTINE_DAYS_MAX, ROUTINE_DAY_NAME_MAX, ROUTINE_SCHEDULE_MODES, ROUTINE_VERSIONS_MAX, ROUTINE_VERSION_KINDS, ROUTINE_VERSION_NAME_MAX, type RecentActivityEntry, type RegisterPushSubscriptionRequest, type RelationshipListKind, type RelationshipListQuery, type RelationshipListResponse, type RelationshipMember, type RenaissanceRankDefinition, type RenaissanceRankProgress, type RepType, type ReplaceFeaturedProfileItemsRequest, type ReplaceMeasurableGoalsRequest, type ReplaceTrainingLocationsRequest, type RestAlertPushPayload, type RestAlertRefusal, type RestoreRoutineVersionResponse, type Routine, type RoutineDay, type RoutineDayId, type RoutineExercise, type RoutineId, type RoutineScheduleMode, type RoutineSet, type RoutineVersion, type RoutineVersionDay, type RoutineVersionExercise, type RoutineVersionKind, type RoutineVersionSetup, type RoutineVersionsResponse, SCHEDULE_MOVE_MAX_DAYS, SCHEDULE_OVERRIDES_MAX_RANGE_DAYS, SCHEDULE_OVERRIDE_KINDS, SCHEDULE_SKIP_PAST_DAYS, SESSION_SHARE_DEFAULT_FIELDS, SESSION_SHARE_FIELDS, SESSION_SHARE_MAX_ACTIVE_LINKS, SEXES, STARRED_EXERCISES_MAX, type ScheduleOverride, type ScheduleOverrideKind, type ScheduleOverridesQuery, type ScheduleOverridesResponse, type ScheduleRestAlertRequest, type ScheduleRestAlertResponse, type SessionComparisonExercise, type SessionComparisonQuery, type SessionComparisonResponse, type SessionComparisonRoutineDay, type SessionComparisonSession, type SessionComparisonSet, type SessionExerciseSubstitution, type SessionProgressNotification, type SessionRecapRecord, type SessionShare, type SessionShareField, type SessionShareListResponse, type SetAccountTimeZoneRequest, type SetLog, type Sex, type SharedSessionOwner, type SharedSessionRecap, type SkipOccurrenceRequest, type StarredExercise, type StarredExercisesResponse, type StartWorkoutRequest, type StartWorkoutResponse, type StreakMilestoneEventPayload, type SubstituteSessionExerciseRequest, type SubstituteSessionExerciseResponse, type SupabaseAuthResponse, type SupabaseAuthUser, type SupabaseMigrationResponse, TRAINING_DISCIPLINE_VALUES, TRAINING_EVENT_TYPES, TRAINING_EXPERIENCE_LEVEL_VALUES, TRAINING_GOAL_VALUES, type TrainingDiscipline, type TrainingEventType, type TrainingExperienceLevel, type TrainingGoal, type TrainingIdentity, type TrainingLocationPreference, type TrainingLocationPreferenceInput, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, type UpdateProfileDiscoveryRequest, type UpdateProfilePrivacyRequest, type UpdateProfileRequest, type UpdateRoutineRequest, type UpsertSetLogRequest, type UpsertSetLogResponse, type UserId, type UserProfile, type UserSearchResponse, type VolumeTrendPoint, type VolumeTrendQuery, type VolumeTrendResponse, type VolumeTrendSeries, WEIGHT_UNITS, WORKOUT_SESSION_STATUSES, type WeightUnit, type WorkoutAnalyticsStatus, type WorkoutProgressQuery, type WorkoutProgressResponse, type WorkoutSession, type WorkoutSessionId, type WorkoutSessionListResponse, type WorkoutSessionRecap, type WorkoutSessionSnapshotV1, type WorkoutSessionStatus, type WorkoutSessionSummary, type WorkoutStatsQuery, type WorkoutStatsResponse, routineDayLabel };
|
package/dist/index.js
CHANGED
|
@@ -367,6 +367,20 @@ var NOTIFICATION_KINDS = [
|
|
|
367
367
|
var NOTIFICATIONS_LOOKBACK_DAYS = 30;
|
|
368
368
|
var NOTIFICATIONS_RETENTION_DAYS = 90;
|
|
369
369
|
var NOTIFICATIONS_LIST_LIMIT = 50;
|
|
370
|
+
|
|
371
|
+
// src/push.ts
|
|
372
|
+
var PUSH_SUBSCRIPTIONS_MAX = 10;
|
|
373
|
+
var PUSH_PAYLOAD_KINDS = ["REST_ALERT"];
|
|
374
|
+
var REST_ALERT_MAX_LEAD_SECONDS = 3600;
|
|
375
|
+
var REST_ALERT_MIN_LEAD_SECONDS = 5;
|
|
376
|
+
var REST_ALERT_REFUSALS = [
|
|
377
|
+
/** The account has no subscribed device. */
|
|
378
|
+
"NO_SUBSCRIPTION",
|
|
379
|
+
/** The server holds no VAPID key pair. */
|
|
380
|
+
"PUSH_UNAVAILABLE",
|
|
381
|
+
/** Rest ends too soon for a push to beat it. */
|
|
382
|
+
"TOO_SOON"
|
|
383
|
+
];
|
|
370
384
|
export {
|
|
371
385
|
ACHIEVEMENT_CATEGORIES,
|
|
372
386
|
ACHIEVEMENT_DEFINITIONS,
|
|
@@ -407,12 +421,17 @@ export {
|
|
|
407
421
|
PROFILE_VISIBILITY_VALUES,
|
|
408
422
|
PROGRESSION_SCHEMES,
|
|
409
423
|
PROGRESS_TIMELINE_EVENT_TYPES,
|
|
424
|
+
PUSH_PAYLOAD_KINDS,
|
|
425
|
+
PUSH_SUBSCRIPTIONS_MAX,
|
|
410
426
|
RELATIONSHIP_LIST_DEFAULT_LIMIT,
|
|
411
427
|
RELATIONSHIP_LIST_KINDS,
|
|
412
428
|
RELATIONSHIP_LIST_MAX_LIMIT,
|
|
413
429
|
RENAISSANCE_RANK_DEFINITIONS,
|
|
414
430
|
REP_TYPES,
|
|
415
431
|
RESERVED_USERNAMES,
|
|
432
|
+
REST_ALERT_MAX_LEAD_SECONDS,
|
|
433
|
+
REST_ALERT_MIN_LEAD_SECONDS,
|
|
434
|
+
REST_ALERT_REFUSALS,
|
|
416
435
|
ROUTINE_DAYS_MAX,
|
|
417
436
|
ROUTINE_DAY_NAME_MAX,
|
|
418
437
|
ROUTINE_SCHEDULE_MODES,
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@sunsteel/contracts",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"repository": {
|
|
5
|
-
"type": "git",
|
|
6
|
-
"url": "git+https://github.com/ezee969/sunsteel-contracts.git"
|
|
7
|
-
},
|
|
8
|
-
"private": false,
|
|
9
|
-
"engines": {
|
|
10
|
-
"node": ">=20.11"
|
|
11
|
-
},
|
|
12
|
-
"type": "module",
|
|
13
|
-
"sideEffects": false,
|
|
14
|
-
"main": "./dist/index.cjs",
|
|
15
|
-
"module": "./dist/index.js",
|
|
16
|
-
"types": "./dist/index.d.ts",
|
|
17
|
-
"exports": {
|
|
18
|
-
".": {
|
|
19
|
-
"types": "./dist/index.d.ts",
|
|
20
|
-
"import": "./dist/index.js",
|
|
21
|
-
"require": "./dist/index.cjs"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"files": [
|
|
25
|
-
"dist"
|
|
26
|
-
],
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
29
|
-
"dev": "tsup src/index.ts --format esm,cjs --dts --watch",
|
|
30
|
-
"typecheck": "tsc --noEmit",
|
|
31
|
-
"lint": "npm run typecheck",
|
|
32
|
-
"verify": "npm run typecheck && npm run build",
|
|
33
|
-
"verify:security": "npm audit",
|
|
34
|
-
"prepublishOnly": "npm run build"
|
|
35
|
-
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"tsup": "^8.3.5",
|
|
38
|
-
"typescript": "^5.7.3"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@sunsteel/contracts",
|
|
3
|
+
"version": "0.46.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/ezee969/sunsteel-contracts.git"
|
|
7
|
+
},
|
|
8
|
+
"private": false,
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20.11"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"sideEffects": false,
|
|
14
|
+
"main": "./dist/index.cjs",
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"require": "./dist/index.cjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
29
|
+
"dev": "tsup src/index.ts --format esm,cjs --dts --watch",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"lint": "npm run typecheck",
|
|
32
|
+
"verify": "npm run typecheck && npm run build",
|
|
33
|
+
"verify:security": "npm audit",
|
|
34
|
+
"prepublishOnly": "npm run build"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"tsup": "^8.3.5",
|
|
38
|
+
"typescript": "^5.7.3"
|
|
39
|
+
}
|
|
40
|
+
}
|