@laplace.live/internal 1.2.18 → 1.2.19

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.
Files changed (2) hide show
  1. package/index.d.ts +121 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -658,6 +658,127 @@ export declare namespace LaplaceInternal {
658
658
  uid?: number
659
659
  details?: string
660
660
  }
661
+
662
+ // ============================================
663
+ // Fertility Cycle Types
664
+ // ============================================
665
+
666
+ /**
667
+ * Fertility status enum values
668
+ *
669
+ * @since Jan 29, 2026
670
+ * @example GET /bilibili/fertility/:uid
671
+ * @example GET /bilibili/fertilities
672
+ */
673
+ export type FertilityStatus = 'menstruating' | 'fertile' | 'ovulating' | 'normal'
674
+
675
+ /**
676
+ * A single cycle history entry - tracks each period event
677
+ * Stored in the `cycleHistory` JSONB column
678
+ */
679
+ export interface CycleHistoryItem {
680
+ /** Unix timestamp (ms) - when this period started */
681
+ periodStart: number
682
+ /** Optional: days this period lasted (user may not track) */
683
+ periodLength?: number
684
+ /** Unix timestamp (ms) - when this entry was recorded */
685
+ submittedAt: number
686
+ }
687
+
688
+ /**
689
+ * Result of fertility status calculation
690
+ * Returned by calculateFertilityStatus utility
691
+ */
692
+ export interface CycleCalculationResult {
693
+ status: FertilityStatus
694
+ /** Current day in the menstrual cycle (1-indexed) */
695
+ dayInCycle: number
696
+ /** Calculated from history or user-stated preference */
697
+ effectiveCycleLength: number
698
+ /** Calculated from history or user-stated preference */
699
+ effectivePeriodLength: number
700
+ /** Calculated ovulation day (cycleLength - 14) */
701
+ ovulationDay: number
702
+ /** Predicted next period start date */
703
+ nextPeriod: Date
704
+ /** How many history entries used for calculation */
705
+ dataPoints: number
706
+ }
707
+
708
+ /**
709
+ * Response for GET /bilibili/fertility/:uid
710
+ */
711
+ export interface FertilityUserResponse {
712
+ uid: number
713
+ user: {
714
+ username: string
715
+ avatar: string | null
716
+ room: number | null
717
+ } | null
718
+ status: FertilityStatus
719
+ dayInCycle: number
720
+ ovulationDay: number
721
+ /** ISO date string (YYYY-MM-DD) */
722
+ nextPeriod: string
723
+ effectiveCycleLength: number
724
+ effectivePeriodLength: number
725
+ dataPoints: number
726
+ userPreferences: {
727
+ cycleLength: number
728
+ periodLength: number
729
+ }
730
+ history: CycleHistoryItem[]
731
+ }
732
+
733
+ /**
734
+ * Single user item in list response
735
+ * @example GET /bilibili/fertilities
736
+ */
737
+ export interface FertilityListItem {
738
+ uid: number
739
+ user: {
740
+ username: string
741
+ avatar: string | null
742
+ room: number | null
743
+ } | null
744
+ status: FertilityStatus
745
+ dayInCycle: number
746
+ /** ISO date string (YYYY-MM-DD) */
747
+ nextPeriod: string
748
+ }
749
+
750
+ /**
751
+ * Response for GET /bilibili/fertilities
752
+ */
753
+ export interface FertilityListResponse {
754
+ data: FertilityListItem[]
755
+ total: number
756
+ }
757
+
758
+ /**
759
+ * Request body for POST /bilibili/fertility-submit
760
+ */
761
+ export interface FertilitySubmitRequest {
762
+ /** Bilibili user ID */
763
+ uid: number
764
+ /** Unix timestamp (ms) when period started */
765
+ periodStart: number
766
+ /** Optional: How many days this period lasted (1-15) */
767
+ periodLength?: number
768
+ /** Optional: Update user's preferred cycle length (15-60) */
769
+ cycleLength?: number
770
+ }
771
+
772
+ /**
773
+ * Success response for POST /bilibili/fertility-submit
774
+ */
775
+ export interface FertilitySubmitResponse {
776
+ success: true
777
+ uid: number
778
+ historyCount: number
779
+ /** ISO timestamp string */
780
+ lastPeriodStart: string
781
+ }
661
782
  }
662
783
 
663
784
  /** Migrated from experiments.sparanoid.net */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laplace.live/internal",
3
- "version": "1.2.18",
3
+ "version": "1.2.19",
4
4
  "module": "index.d.ts",
5
5
  "devDependencies": {
6
6
  "@types/bun": "latest"