@laplace.live/internal 1.2.20 → 1.2.22

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 +84 -1
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -747,6 +747,8 @@ export declare namespace LaplaceInternal {
747
747
  dayInCycle: number
748
748
  /** ISO date string (YYYY-MM-DD) */
749
749
  nextPeriod: string
750
+ /** Calculated cycle length based on history (median) or user preference */
751
+ effectiveCycleLength: number
750
752
  }
751
753
 
752
754
  /**
@@ -769,7 +771,7 @@ export declare namespace LaplaceInternal {
769
771
  periodLength?: number
770
772
  /** Optional: Update user's preferred cycle length (15-60) */
771
773
  cycleLength?: number
772
- /** Optional: URL or description of the evidence source */
774
+ /** Optional: Evidence URL (must be a valid URL, max 256 chars) */
773
775
  source?: string
774
776
  }
775
777
 
@@ -783,6 +785,87 @@ export declare namespace LaplaceInternal {
783
785
  /** ISO timestamp string */
784
786
  lastPeriodStart: string
785
787
  }
788
+
789
+ // ============================================
790
+ // Fertility Contribution Types (Anonymous Submissions)
791
+ // ============================================
792
+
793
+ /**
794
+ * Status of a fertility contribution
795
+ */
796
+ export type ContributionStatus = 'pending' | 'approved' | 'rejected'
797
+
798
+ /**
799
+ * Request body for POST /laplace/fertility-contribute
800
+ * Anonymous users submit period data with Turnstile verification
801
+ */
802
+ export interface FertilityContributeRequest {
803
+ /** Bilibili user ID */
804
+ uid: number
805
+ /** Unix timestamp (ms) when period started */
806
+ periodStart: number
807
+ /** Optional: How many days this period lasted (1-15) */
808
+ periodLength?: number
809
+ /** Optional: Update user's preferred cycle length (15-60) */
810
+ cycleLength?: number
811
+ /** Optional: Evidence URL (must be a valid URL, max 500 chars) */
812
+ source?: string
813
+ /** Cloudflare Turnstile token for bot verification */
814
+ turnstileToken: string
815
+ }
816
+
817
+ /**
818
+ * A fertility contribution record
819
+ * Returned by GET /laplace/fertility-contributions
820
+ */
821
+ export interface FertilityContribution {
822
+ id: number
823
+ uid: number
824
+ periodStart: number
825
+ periodLength?: number
826
+ cycleLength?: number
827
+ source?: string
828
+ status: ContributionStatus
829
+ contributorIp?: string
830
+ /** ISO timestamp string */
831
+ createdAt: string
832
+ /** ISO timestamp string */
833
+ reviewedAt?: string
834
+ rejectReason?: string
835
+ }
836
+
837
+ /**
838
+ * Response for GET /laplace/fertility-contributions
839
+ */
840
+ export interface FertilityContributionsListResponse {
841
+ data: FertilityContribution[]
842
+ total: number
843
+ }
844
+
845
+ /**
846
+ * Success response for POST /laplace/fertility-contribute
847
+ */
848
+ export interface FertilityContributeResponse {
849
+ success: true
850
+ id: number
851
+ message: string
852
+ }
853
+
854
+ /**
855
+ * Request body for POST /laplace/fertility-contribution-reject/:id
856
+ */
857
+ export interface FertilityContributionRejectRequest {
858
+ reason?: string
859
+ }
860
+
861
+ /**
862
+ * Response for approve/reject endpoints
863
+ */
864
+ export interface FertilityContributionActionResponse {
865
+ success: true
866
+ id: number
867
+ status: ContributionStatus
868
+ }
786
869
  }
787
870
 
788
871
  /** 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.20",
3
+ "version": "1.2.22",
4
4
  "module": "index.d.ts",
5
5
  "devDependencies": {
6
6
  "@types/bun": "latest"