@laplace.live/internal 1.2.18 → 1.2.20

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 +125 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -658,6 +658,131 @@ 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
+ /** Optional: URL or description of the evidence source (e.g., livestream clip, tweet) */
687
+ source?: string
688
+ }
689
+
690
+ /**
691
+ * Result of fertility status calculation
692
+ * Returned by calculateFertilityStatus utility
693
+ */
694
+ export interface CycleCalculationResult {
695
+ status: FertilityStatus
696
+ /** Current day in the menstrual cycle (1-indexed) */
697
+ dayInCycle: number
698
+ /** Calculated from history or user-stated preference */
699
+ effectiveCycleLength: number
700
+ /** Calculated from history or user-stated preference */
701
+ effectivePeriodLength: number
702
+ /** Calculated ovulation day (cycleLength - 14) */
703
+ ovulationDay: number
704
+ /** Predicted next period start date */
705
+ nextPeriod: Date
706
+ /** How many history entries used for calculation */
707
+ dataPoints: number
708
+ }
709
+
710
+ /**
711
+ * Response for GET /bilibili/fertility/:uid
712
+ */
713
+ export interface FertilityUserResponse {
714
+ uid: number
715
+ user: {
716
+ username: string
717
+ avatar: string | null
718
+ room: number | null
719
+ } | null
720
+ status: FertilityStatus
721
+ dayInCycle: number
722
+ ovulationDay: number
723
+ /** ISO date string (YYYY-MM-DD) */
724
+ nextPeriod: string
725
+ effectiveCycleLength: number
726
+ effectivePeriodLength: number
727
+ dataPoints: number
728
+ userPreferences: {
729
+ cycleLength: number
730
+ periodLength: number
731
+ }
732
+ history: CycleHistoryItem[]
733
+ }
734
+
735
+ /**
736
+ * Single user item in list response
737
+ * @example GET /bilibili/fertilities
738
+ */
739
+ export interface FertilityListItem {
740
+ uid: number
741
+ user: {
742
+ username: string
743
+ avatar: string | null
744
+ room: number | null
745
+ } | null
746
+ status: FertilityStatus
747
+ dayInCycle: number
748
+ /** ISO date string (YYYY-MM-DD) */
749
+ nextPeriod: string
750
+ }
751
+
752
+ /**
753
+ * Response for GET /bilibili/fertilities
754
+ */
755
+ export interface FertilityListResponse {
756
+ data: FertilityListItem[]
757
+ total: number
758
+ }
759
+
760
+ /**
761
+ * Request body for POST /bilibili/fertility-submit
762
+ */
763
+ export interface FertilitySubmitRequest {
764
+ /** Bilibili user ID */
765
+ uid: number
766
+ /** Unix timestamp (ms) when period started */
767
+ periodStart: number
768
+ /** Optional: How many days this period lasted (1-15) */
769
+ periodLength?: number
770
+ /** Optional: Update user's preferred cycle length (15-60) */
771
+ cycleLength?: number
772
+ /** Optional: URL or description of the evidence source */
773
+ source?: string
774
+ }
775
+
776
+ /**
777
+ * Success response for POST /bilibili/fertility-submit
778
+ */
779
+ export interface FertilitySubmitResponse {
780
+ success: true
781
+ uid: number
782
+ historyCount: number
783
+ /** ISO timestamp string */
784
+ lastPeriodStart: string
785
+ }
661
786
  }
662
787
 
663
788
  /** 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.20",
4
4
  "module": "index.d.ts",
5
5
  "devDependencies": {
6
6
  "@types/bun": "latest"