@read-frog/api-contract 0.18.1 → 0.19.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@read-frog/api-contract",
3
- "version": "0.18.1",
3
+ "version": "0.19.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@orpc/contract": "^1.15.2",
28
- "@read-frog/definitions": "0.7.0",
28
+ "@read-frog/definitions": "0.8.0",
29
29
  "zod": "^4.6.5"
30
30
  },
31
31
  "devDependencies": {
@@ -8,6 +8,8 @@ import {
8
8
  srsListCardRevlogsOutputSchema,
9
9
  srsListUnreadOptimizerResultsInputSchema,
10
10
  srsListUnreadOptimizerResultsOutputSchema,
11
+ srsRecentNotebaseScheduleStatusStatsInputSchema,
12
+ srsRecentNotebaseScheduleStatusStatsOutputSchema,
11
13
  srsReviewInputSchema,
12
14
  srsReviewOutputSchema,
13
15
  srsRollbackReviewInputSchema,
@@ -32,6 +34,17 @@ export const srsContract = {
32
34
  .errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
33
35
  .input(srsScheduleStatusStatsInputSchema)
34
36
  .output(srsScheduleStatusStatsOutputSchema),
37
+ recentNotebaseScheduleStatusStats: oc
38
+ .route({
39
+ method: "GET",
40
+ path: "/srs/schedule-status-stats/recent",
41
+ summary: "Get study queue counts of the most recently used notebase",
42
+ description:
43
+ "Picks the owned notebase with the latest review or content edit (notes, fields or templates) and returns its study queue counts in the supplied timezone.",
44
+ tags: ["SRS"],
45
+ })
46
+ .input(srsRecentNotebaseScheduleStatusStatsInputSchema)
47
+ .output(srsRecentNotebaseScheduleStatusStatsOutputSchema),
35
48
  listUnreadOptimizerResults: oc
36
49
  .route({
37
50
  method: "GET",
@@ -2,6 +2,7 @@ import { deletionResultSchema } from "./resource-mutation";
2
2
  import {
3
3
  notebaseColumnConfigSchema,
4
4
  schedulingParamsShape,
5
+ srsModelVersionSchema,
5
6
  srsWeightsSchema,
6
7
  } from "@read-frog/definitions";
7
8
  import { z } from "zod";
@@ -38,6 +39,8 @@ export const notebaseSchema = z.object({
38
39
  srsLeechThreshold: schedulingParamsShape.leechThreshold,
39
40
  srsEnableFuzz: schedulingParamsShape.enableFuzz,
40
41
  srsWeights: srsWeightsSchema.nullable(),
42
+ // Selects the scheduler/curve; read-only, changed only by the FSRS-7 migration.
43
+ srsModelVersion: srsModelVersionSchema,
41
44
  createdAt: z.date(),
42
45
  updatedAt: z.date(),
43
46
  });
@@ -3,6 +3,7 @@ import {
3
3
  activeScheduleStatusSchema,
4
4
  cardStateSchema,
5
5
  fsrsReviewLogSnapshotSchema,
6
+ fsrsMemoryStateSchema,
6
7
  reviewRatingSchema,
7
8
  scheduleStatusSchema,
8
9
  schedulingParamsSchema,
@@ -11,6 +12,7 @@ import {
11
12
  } from "@read-frog/definitions";
12
13
  import { z } from "zod";
13
14
  import { cardSchema } from "./card";
15
+ import { notebaseSummarySchema } from "./notebase";
14
16
  import { timezoneSchema } from "./timezone";
15
17
 
16
18
  export { reviewRatingSchema, schedulingParamsSchema, SRS_REVIEW_DURATION_MS_MAX };
@@ -73,6 +75,26 @@ export type SrsScheduleStatusStatsInput = z.infer<typeof srsScheduleStatusStatsI
73
75
  export const srsScheduleStatusStatsOutputSchema = z.record(z.uuid(), srsScheduleStatusStatsSchema);
74
76
  export type SrsScheduleStatusStatsOutput = z.infer<typeof srsScheduleStatusStatsOutputSchema>;
75
77
 
78
+ export const srsRecentNotebaseScheduleStatusStatsInputSchema = z
79
+ .object({
80
+ timezone: timezoneSchema,
81
+ })
82
+ .strict();
83
+ export type SrsRecentNotebaseScheduleStatusStatsInput = z.infer<
84
+ typeof srsRecentNotebaseScheduleStatusStatsInputSchema
85
+ >;
86
+
87
+ /** Null when the user has no notebase yet. */
88
+ export const srsRecentNotebaseScheduleStatusStatsOutputSchema = z
89
+ .object({
90
+ notebase: notebaseSummarySchema,
91
+ stats: srsScheduleStatusStatsSchema,
92
+ })
93
+ .nullable();
94
+ export type SrsRecentNotebaseScheduleStatusStatsOutput = z.infer<
95
+ typeof srsRecentNotebaseScheduleStatusStatsOutputSchema
96
+ >;
97
+
76
98
  export const srsManualCardStatusInputSchema = z
77
99
  .object({
78
100
  cardId: z.uuid(),
@@ -95,7 +117,9 @@ export const srsRevlogSchema = z.object({
95
117
  state: cardStateSchema,
96
118
  stability: z.number(),
97
119
  afterScheduleStatus: scheduleStatusSchema,
98
- afterStability: z.number(),
120
+ afterMemoryState: fsrsMemoryStateSchema,
121
+ retentionDays90: z.number().nonnegative(),
122
+ afterRetentionDays90: z.number().nonnegative(),
99
123
  reviewedAt: z.coerce.date(),
100
124
  durationMs: z.number().int(),
101
125
  fsrsReviewLogSnapshot: fsrsReviewLogSnapshotSchema,