@read-frog/api-contract 0.12.6 → 0.15.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.d.ts +1171 -480
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +301 -103
- package/dist/index.js.map +1 -1
- package/package.json +15 -14
- package/src/contracts/beta-access.ts +3 -6
- package/src/contracts/billing.ts +5 -5
- package/src/contracts/card-template.ts +45 -39
- package/src/contracts/card.ts +22 -19
- package/src/contracts/ebook.ts +13 -11
- package/src/contracts/hosted-ai.ts +5 -5
- package/src/contracts/notebase-column.ts +40 -32
- package/src/contracts/notebase-row.ts +85 -45
- package/src/contracts/notebase.ts +60 -40
- package/src/contracts/shared.ts +21 -2
- package/src/contracts/srs.ts +96 -63
- package/src/contracts/stats.ts +9 -11
- package/src/contracts/user.ts +3 -3
- package/src/contracts/video-transcript.ts +22 -7
- package/src/index.ts +37 -33
- package/src/public-errors.ts +97 -51
- package/src/schemas/beta-access.ts +12 -10
- package/src/schemas/billing.ts +77 -53
- package/src/schemas/card.ts +66 -63
- package/src/schemas/ebook.ts +165 -129
- package/src/schemas/hosted-ai.ts +84 -74
- package/src/schemas/notebase-column.ts +50 -36
- package/src/schemas/notebase-row.ts +88 -57
- package/src/schemas/notebase-stats.ts +28 -20
- package/src/schemas/notebase-view.ts +59 -49
- package/src/schemas/notebase.ts +136 -96
- package/src/schemas/pagination.ts +9 -0
- package/src/schemas/resource-mutation.ts +6 -0
- package/src/schemas/srs-stats.ts +30 -22
- package/src/schemas/srs.ts +152 -106
- package/src/schemas/stats.ts +27 -21
- package/src/schemas/timezone.ts +19 -16
- package/src/schemas/user.ts +27 -19
- package/src/schemas/video-transcript.ts +53 -24
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { pickPublicErrorMap } from "#/public-errors";
|
|
2
3
|
import {
|
|
3
4
|
NotebaseCreateInputSchema,
|
|
4
5
|
NotebaseCreateOutputSchema,
|
|
@@ -8,25 +9,39 @@ import {
|
|
|
8
9
|
NotebaseGetOutputSchema,
|
|
9
10
|
NotebaseGetSchemaInputSchema,
|
|
10
11
|
NotebaseGetSchemaOutputSchema,
|
|
12
|
+
NotebaseGetSummaryInputSchema,
|
|
13
|
+
NotebaseGetSummaryOutputSchema,
|
|
11
14
|
NotebaseListInputSchema,
|
|
12
15
|
NotebaseListOutputSchema,
|
|
13
16
|
NotebaseUpdateInputSchema,
|
|
14
17
|
NotebaseUpdateOutputSchema,
|
|
15
|
-
} from "#/schemas/notebase"
|
|
16
|
-
import {
|
|
18
|
+
} from "#/schemas/notebase";
|
|
19
|
+
import { defineAgentProcedure } from "./shared";
|
|
17
20
|
|
|
18
21
|
export const notebaseContract = {
|
|
19
|
-
list:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
list: defineAgentProcedure({
|
|
23
|
+
method: "GET",
|
|
24
|
+
path: "/notebases",
|
|
25
|
+
summary: "List notebases",
|
|
26
|
+
description: "List the notebases (word books) owned by the current user.",
|
|
27
|
+
tags: ["Notebases"],
|
|
28
|
+
})
|
|
26
29
|
.input(NotebaseListInputSchema)
|
|
27
30
|
.output(NotebaseListOutputSchema),
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
getSummary: defineAgentProcedure({
|
|
33
|
+
method: "GET",
|
|
34
|
+
path: "/notebases/{id}/summary",
|
|
35
|
+
summary: "Get notebase summary",
|
|
36
|
+
description:
|
|
37
|
+
"Read the name and public study settings of an owned notebase without loading note content.",
|
|
38
|
+
tags: ["Notebases"],
|
|
39
|
+
})
|
|
40
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
41
|
+
.input(NotebaseGetSummaryInputSchema)
|
|
42
|
+
.output(NotebaseGetSummaryOutputSchema),
|
|
43
|
+
|
|
44
|
+
get: oc
|
|
30
45
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
31
46
|
.route({
|
|
32
47
|
method: "GET",
|
|
@@ -37,47 +52,52 @@ export const notebaseContract = {
|
|
|
37
52
|
.input(NotebaseGetInputSchema)
|
|
38
53
|
.output(NotebaseGetOutputSchema),
|
|
39
54
|
|
|
40
|
-
getSchema:
|
|
55
|
+
getSchema: defineAgentProcedure({
|
|
56
|
+
method: "GET",
|
|
57
|
+
path: "/notebases/{id}/schema",
|
|
58
|
+
summary: "Get notebase schema",
|
|
59
|
+
description:
|
|
60
|
+
"Read an owned notebase name and field definitions, including field IDs, types and updatedAt timestamps. Does not return note content.",
|
|
61
|
+
tags: ["Notebases"],
|
|
62
|
+
})
|
|
41
63
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
42
|
-
.route({
|
|
43
|
-
method: "GET",
|
|
44
|
-
path: "/notebases/{id}/schema",
|
|
45
|
-
summary: "Get notebase schema",
|
|
46
|
-
tags: ["Notebases"],
|
|
47
|
-
})
|
|
48
64
|
.input(NotebaseGetSchemaInputSchema)
|
|
49
65
|
.output(NotebaseGetSchemaOutputSchema),
|
|
50
66
|
|
|
51
|
-
create:
|
|
67
|
+
create: defineAgentProcedure({
|
|
68
|
+
method: "POST",
|
|
69
|
+
path: "/notebases",
|
|
70
|
+
summary: "Create notebase",
|
|
71
|
+
description:
|
|
72
|
+
"Create an owned notebase with optional initial fields and notes. Client-provided entity IDs are supported; duplicate IDs produce a conflict.",
|
|
73
|
+
tags: ["Notebases"],
|
|
74
|
+
})
|
|
52
75
|
.errors(pickPublicErrorMap("NOTE_LIMIT_EXCEEDED", "CELL_VALIDATION_FAILED"))
|
|
53
|
-
.
|
|
54
|
-
method: "POST",
|
|
55
|
-
path: "/notebases",
|
|
56
|
-
summary: "Create notebase",
|
|
57
|
-
tags: ["Notebases"],
|
|
58
|
-
})
|
|
76
|
+
.errors(pickPublicErrorMap("RESOURCE_ALREADY_EXISTS"))
|
|
59
77
|
.input(NotebaseCreateInputSchema)
|
|
60
78
|
.output(NotebaseCreateOutputSchema),
|
|
61
79
|
|
|
62
|
-
update:
|
|
80
|
+
update: defineAgentProcedure({
|
|
81
|
+
method: "PUT",
|
|
82
|
+
path: "/notebases/{id}",
|
|
83
|
+
summary: "Update notebase",
|
|
84
|
+
description:
|
|
85
|
+
"Update the supplied name or public study settings of an owned notebase, preserving omitted properties.",
|
|
86
|
+
tags: ["Notebases"],
|
|
87
|
+
})
|
|
63
88
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
64
|
-
.route({
|
|
65
|
-
method: "PUT",
|
|
66
|
-
path: "/notebases/{id}",
|
|
67
|
-
summary: "Update notebase",
|
|
68
|
-
tags: ["Notebases"],
|
|
69
|
-
})
|
|
70
89
|
.input(NotebaseUpdateInputSchema)
|
|
71
90
|
.output(NotebaseUpdateOutputSchema),
|
|
72
91
|
|
|
73
|
-
delete:
|
|
92
|
+
delete: defineAgentProcedure({
|
|
93
|
+
method: "DELETE",
|
|
94
|
+
path: "/notebases/{id}",
|
|
95
|
+
summary: "Delete notebase",
|
|
96
|
+
description:
|
|
97
|
+
"Permanently delete an owned notebase and its fields, notes, templates, cards and review records. Return the deleted notebase ID.",
|
|
98
|
+
tags: ["Notebases"],
|
|
99
|
+
})
|
|
74
100
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
75
|
-
.route({
|
|
76
|
-
method: "DELETE",
|
|
77
|
-
path: "/notebases/{id}",
|
|
78
|
-
summary: "Delete notebase",
|
|
79
|
-
tags: ["Notebases"],
|
|
80
|
-
})
|
|
81
101
|
.input(NotebaseDeleteInputSchema)
|
|
82
102
|
.output(NotebaseDeleteOutputSchema),
|
|
83
|
-
}
|
|
103
|
+
};
|
package/src/contracts/shared.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Route } from "@orpc/contract";
|
|
2
|
+
import { oc } from "@orpc/contract";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* A documented business route shared by OpenAPI and agent-facing adapters.
|
|
6
|
+
* Both prose fields are required so adapters can reuse them without a second
|
|
7
|
+
* copy or an undefined fallback.
|
|
8
|
+
*/
|
|
9
|
+
export type AgentRoute = Route & { summary: string; description: string };
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Declares a procedure that is exposed to agents as an MCP tool, not only to
|
|
13
|
+
* the REST/OpenAPI surface.
|
|
14
|
+
*
|
|
15
|
+
* oRPC types `~orpc.route` as the widened `Route`, so `route.summary` reads back
|
|
16
|
+
* as `string | undefined` whatever is passed in. `$meta` is the only channel it
|
|
17
|
+
* keeps generic, so the prose is mirrored there and stays a required `string`
|
|
18
|
+
* for tool definitions. OpenAPI keeps reading `route`.
|
|
19
|
+
*/
|
|
20
|
+
export function defineAgentProcedure(route: AgentRoute) {
|
|
21
|
+
return oc.$meta({ summary: route.summary, description: route.description }).route(route);
|
|
22
|
+
}
|
package/src/contracts/srs.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgentProcedure } from "./shared";
|
|
2
|
+
import { oc } from "@orpc/contract";
|
|
3
|
+
import { pickPublicErrorMap } from "#/public-errors";
|
|
2
4
|
import {
|
|
5
|
+
srsAcknowledgeOptimizerResultsInputSchema,
|
|
6
|
+
srsAcknowledgeOptimizerResultsOutputSchema,
|
|
3
7
|
srsListCardRevlogsInputSchema,
|
|
4
8
|
srsListCardRevlogsOutputSchema,
|
|
9
|
+
srsListUnreadOptimizerResultsInputSchema,
|
|
10
|
+
srsListUnreadOptimizerResultsOutputSchema,
|
|
5
11
|
srsReviewInputSchema,
|
|
6
12
|
srsReviewOutputSchema,
|
|
7
13
|
srsRollbackReviewInputSchema,
|
|
@@ -12,87 +18,114 @@ import {
|
|
|
12
18
|
srsSetCardBuriedOutputSchema,
|
|
13
19
|
srsSetCardSuspendedInputSchema,
|
|
14
20
|
srsSetCardSuspendedOutputSchema,
|
|
15
|
-
} from "#/schemas/srs"
|
|
16
|
-
import { notebaseProcedure } from "./shared"
|
|
21
|
+
} from "#/schemas/srs";
|
|
17
22
|
|
|
18
23
|
export const srsContract = {
|
|
19
|
-
scheduleStatusStats:
|
|
24
|
+
scheduleStatusStats: defineAgentProcedure({
|
|
25
|
+
method: "GET",
|
|
26
|
+
path: "/srs/schedule-status-stats",
|
|
27
|
+
summary: "Get study statistics",
|
|
28
|
+
description:
|
|
29
|
+
"Read existing study queue counts for owned notebases in the supplied timezone. Does not return note content or card faces.",
|
|
30
|
+
tags: ["SRS"],
|
|
31
|
+
})
|
|
20
32
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
21
|
-
.route({
|
|
22
|
-
method: "GET",
|
|
23
|
-
path: "/srs/schedule-status-stats",
|
|
24
|
-
summary: "List today schedule status stats for notebases",
|
|
25
|
-
tags: ["SRS"],
|
|
26
|
-
})
|
|
27
33
|
.input(srsScheduleStatusStatsInputSchema)
|
|
28
34
|
.output(srsScheduleStatusStatsOutputSchema),
|
|
29
|
-
|
|
30
|
-
listCardRevlogs: notebaseProcedure
|
|
31
|
-
.errors(pickPublicErrorMap("CARD_NOT_FOUND"))
|
|
35
|
+
listUnreadOptimizerResults: oc
|
|
32
36
|
.route({
|
|
33
37
|
method: "GET",
|
|
34
|
-
path: "/srs/
|
|
35
|
-
summary: "List
|
|
38
|
+
path: "/srs/optimizer-results/unread",
|
|
39
|
+
summary: "List unread applied SRS optimizer results",
|
|
36
40
|
tags: ["SRS"],
|
|
37
41
|
})
|
|
38
|
-
.input(
|
|
39
|
-
.output(
|
|
42
|
+
.input(srsListUnreadOptimizerResultsInputSchema)
|
|
43
|
+
.output(srsListUnreadOptimizerResultsOutputSchema),
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
.errors(pickPublicErrorMap(
|
|
43
|
-
"CARD_NOT_FOUND",
|
|
44
|
-
"CARD_NOT_REVIEWABLE",
|
|
45
|
-
"CARD_REVIEW_STATE_STALE",
|
|
46
|
-
))
|
|
45
|
+
acknowledgeOptimizerResults: oc
|
|
47
46
|
.route({
|
|
48
47
|
method: "POST",
|
|
49
|
-
path: "/srs/
|
|
50
|
-
summary: "
|
|
48
|
+
path: "/srs/optimizer-results/acknowledge",
|
|
49
|
+
summary: "Acknowledge current SRS optimizer results",
|
|
51
50
|
tags: ["SRS"],
|
|
52
51
|
})
|
|
52
|
+
.input(srsAcknowledgeOptimizerResultsInputSchema)
|
|
53
|
+
.output(srsAcknowledgeOptimizerResultsOutputSchema),
|
|
54
|
+
|
|
55
|
+
listCardRevlogs: defineAgentProcedure({
|
|
56
|
+
method: "GET",
|
|
57
|
+
path: "/srs/revlogs",
|
|
58
|
+
summary: "List review history",
|
|
59
|
+
description:
|
|
60
|
+
"Read owned review records, optionally filtered by notebase or card. Supports limit and offset pagination. Note content, card faces and rollback snapshots are excluded.",
|
|
61
|
+
tags: ["SRS"],
|
|
62
|
+
})
|
|
63
|
+
.errors(pickPublicErrorMap("CARD_NOT_FOUND", "NOTEBASE_NOT_FOUND"))
|
|
64
|
+
.input(srsListCardRevlogsInputSchema)
|
|
65
|
+
.output(srsListCardRevlogsOutputSchema),
|
|
66
|
+
|
|
67
|
+
review: defineAgentProcedure({
|
|
68
|
+
method: "POST",
|
|
69
|
+
path: "/srs/review",
|
|
70
|
+
summary: "Record review",
|
|
71
|
+
description:
|
|
72
|
+
"Submit one rating for a known owned card without a queue, session or prerequisite read. Existing SRS eligibility, scheduling and sibling rules apply. The optional id is the existing state-derived review ID, not an arbitrary UUID; calls without a stable id are not guaranteed to deduplicate.",
|
|
73
|
+
tags: ["SRS"],
|
|
74
|
+
})
|
|
75
|
+
.errors(pickPublicErrorMap("CARD_NOT_FOUND", "CARD_NOT_REVIEWABLE", "CARD_REVIEW_STATE_STALE"))
|
|
53
76
|
.input(srsReviewInputSchema)
|
|
54
77
|
.output(srsReviewOutputSchema),
|
|
55
|
-
rollbackReview:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
78
|
+
rollbackReview: defineAgentProcedure({
|
|
79
|
+
method: "POST",
|
|
80
|
+
path: "/srs/review/rollback",
|
|
81
|
+
summary: "Undo review",
|
|
82
|
+
description:
|
|
83
|
+
"Undo the latest eligible review of one owned card, preserving existing SRS restrictions and sibling restoration. expectedReviewId guards against undoing an earlier review on a retry.",
|
|
84
|
+
tags: ["SRS"],
|
|
85
|
+
})
|
|
86
|
+
.errors(
|
|
87
|
+
pickPublicErrorMap(
|
|
88
|
+
"CARD_NOT_FOUND",
|
|
89
|
+
"CARD_REVIEW_ROLLBACK_UNAVAILABLE",
|
|
90
|
+
"CARD_REVIEW_STATE_STALE",
|
|
91
|
+
),
|
|
92
|
+
)
|
|
66
93
|
.input(srsRollbackReviewInputSchema)
|
|
67
94
|
.output(srsRollbackReviewOutputSchema),
|
|
68
|
-
setCardBuried:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
95
|
+
setCardBuried: defineAgentProcedure({
|
|
96
|
+
method: "POST",
|
|
97
|
+
path: "/srs/card/bury",
|
|
98
|
+
summary: "Set card buried",
|
|
99
|
+
description:
|
|
100
|
+
"Bury or unbury one owned card. enabled=true buries and enabled=false unburies it. Existing state-change rules apply.",
|
|
101
|
+
tags: ["SRS"],
|
|
102
|
+
})
|
|
103
|
+
.errors(
|
|
104
|
+
pickPublicErrorMap(
|
|
105
|
+
"CARD_NOT_FOUND",
|
|
106
|
+
"CARD_ALREADY_BURIED",
|
|
107
|
+
"CARD_NOT_BURIED",
|
|
108
|
+
"CARD_STATUS_CHANGE_UNAVAILABLE",
|
|
109
|
+
),
|
|
110
|
+
)
|
|
81
111
|
.input(srsSetCardBuriedInputSchema)
|
|
82
112
|
.output(srsSetCardBuriedOutputSchema),
|
|
83
|
-
setCardSuspended:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
113
|
+
setCardSuspended: defineAgentProcedure({
|
|
114
|
+
method: "POST",
|
|
115
|
+
path: "/srs/card/suspend",
|
|
116
|
+
summary: "Set card suspended",
|
|
117
|
+
description:
|
|
118
|
+
"Suspend or resume one owned card. enabled=true suspends and enabled=false resumes it. Existing state-change rules apply.",
|
|
119
|
+
tags: ["SRS"],
|
|
120
|
+
})
|
|
121
|
+
.errors(
|
|
122
|
+
pickPublicErrorMap(
|
|
123
|
+
"CARD_NOT_FOUND",
|
|
124
|
+
"CARD_ALREADY_SUSPENDED",
|
|
125
|
+
"CARD_NOT_SUSPENDED",
|
|
126
|
+
"CARD_STATUS_CHANGE_UNAVAILABLE",
|
|
127
|
+
),
|
|
128
|
+
)
|
|
96
129
|
.input(srsSetCardSuspendedInputSchema)
|
|
97
130
|
.output(srsSetCardSuspendedOutputSchema),
|
|
98
|
-
}
|
|
131
|
+
};
|
package/src/contracts/stats.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
} from "#/schemas/
|
|
6
|
-
import { activityStatsOutputSchema, statsInputSchema } from "#/schemas/stats"
|
|
7
|
-
import { notebaseProcedure } from "./shared"
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { pickPublicErrorMap } from "#/public-errors";
|
|
3
|
+
import { notebaseRowGrowthStatsOutputSchema } from "#/schemas/notebase-stats";
|
|
4
|
+
import { srsMemoryGrowthStatsOutputSchema } from "#/schemas/srs-stats";
|
|
5
|
+
import { activityStatsOutputSchema, statsInputSchema } from "#/schemas/stats";
|
|
8
6
|
|
|
9
7
|
export const statsContract = {
|
|
10
|
-
activity:
|
|
8
|
+
activity: oc
|
|
11
9
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
12
10
|
.route({
|
|
13
11
|
method: "GET",
|
|
@@ -18,7 +16,7 @@ export const statsContract = {
|
|
|
18
16
|
.input(statsInputSchema)
|
|
19
17
|
.output(activityStatsOutputSchema),
|
|
20
18
|
|
|
21
|
-
srsMemoryGrowth:
|
|
19
|
+
srsMemoryGrowth: oc
|
|
22
20
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
23
21
|
.route({
|
|
24
22
|
method: "GET",
|
|
@@ -29,7 +27,7 @@ export const statsContract = {
|
|
|
29
27
|
.input(statsInputSchema)
|
|
30
28
|
.output(srsMemoryGrowthStatsOutputSchema),
|
|
31
29
|
|
|
32
|
-
notebaseRowGrowth:
|
|
30
|
+
notebaseRowGrowth: oc
|
|
33
31
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
34
32
|
.route({
|
|
35
33
|
method: "GET",
|
|
@@ -39,4 +37,4 @@ export const statsContract = {
|
|
|
39
37
|
})
|
|
40
38
|
.input(statsInputSchema)
|
|
41
39
|
.output(notebaseRowGrowthStatsOutputSchema),
|
|
42
|
-
}
|
|
40
|
+
};
|
package/src/contracts/user.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { oc } from "@orpc/contract"
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
2
|
import {
|
|
3
3
|
userEnsureTimezoneInputSchema,
|
|
4
4
|
userEnsureTimezoneOutputSchema,
|
|
5
5
|
userUpdateTimezoneInputSchema,
|
|
6
6
|
userUpdateTimezoneOutputSchema,
|
|
7
|
-
} from "#/schemas/user"
|
|
7
|
+
} from "#/schemas/user";
|
|
8
8
|
|
|
9
9
|
export const userContract = {
|
|
10
10
|
ensureTimezone: oc
|
|
@@ -25,4 +25,4 @@ export const userContract = {
|
|
|
25
25
|
})
|
|
26
26
|
.input(userUpdateTimezoneInputSchema)
|
|
27
27
|
.output(userUpdateTimezoneOutputSchema),
|
|
28
|
-
}
|
|
28
|
+
};
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import { oc } from "@orpc/contract"
|
|
2
|
-
import { pickPublicErrorMap } from "#/public-errors"
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { pickPublicErrorMap } from "#/public-errors";
|
|
3
3
|
import {
|
|
4
4
|
videoTranscriptCreateInputSchema,
|
|
5
5
|
videoTranscriptGetInputSchema,
|
|
6
6
|
videoTranscriptResourceSchema,
|
|
7
7
|
videoTranscriptSubtitlesSchema,
|
|
8
8
|
videoTranscriptUsageSchema,
|
|
9
|
-
} from "#/schemas/video-transcript"
|
|
9
|
+
} from "#/schemas/video-transcript";
|
|
10
10
|
|
|
11
11
|
export const videoTranscriptContract = {
|
|
12
12
|
create: oc
|
|
13
|
-
.errors(
|
|
13
|
+
.errors(
|
|
14
|
+
pickPublicErrorMap(
|
|
15
|
+
"VIDEO_TRANSCRIPTION_QUOTA_EXCEEDED",
|
|
16
|
+
"VIDEO_TRANSCRIPTION_SUBSCRIPTION_REQUIRED",
|
|
17
|
+
"VIDEO_TRANSCRIPTION_PAYMENT_REQUIRED",
|
|
18
|
+
"VIDEO_TRANSCRIPTION_UNSUPPORTED_LENGTH",
|
|
19
|
+
),
|
|
20
|
+
)
|
|
14
21
|
.route({
|
|
15
22
|
method: "POST",
|
|
16
23
|
path: "/video-transcripts",
|
|
@@ -28,7 +35,9 @@ export const videoTranscriptContract = {
|
|
|
28
35
|
})
|
|
29
36
|
.output(videoTranscriptUsageSchema),
|
|
30
37
|
get: oc
|
|
31
|
-
.errors(
|
|
38
|
+
.errors(
|
|
39
|
+
pickPublicErrorMap("VIDEO_TRANSCRIPT_NOT_FOUND", "VIDEO_TRANSCRIPTION_SUBSCRIPTION_REQUIRED"),
|
|
40
|
+
)
|
|
32
41
|
.route({
|
|
33
42
|
method: "GET",
|
|
34
43
|
path: "/video-transcripts/{id}",
|
|
@@ -38,7 +47,13 @@ export const videoTranscriptContract = {
|
|
|
38
47
|
.input(videoTranscriptGetInputSchema)
|
|
39
48
|
.output(videoTranscriptResourceSchema),
|
|
40
49
|
getSubtitles: oc
|
|
41
|
-
.errors(
|
|
50
|
+
.errors(
|
|
51
|
+
pickPublicErrorMap(
|
|
52
|
+
"VIDEO_TRANSCRIPT_NOT_FOUND",
|
|
53
|
+
"VIDEO_TRANSCRIPT_NOT_READY",
|
|
54
|
+
"VIDEO_TRANSCRIPTION_SUBSCRIPTION_REQUIRED",
|
|
55
|
+
),
|
|
56
|
+
)
|
|
42
57
|
.route({
|
|
43
58
|
method: "GET",
|
|
44
59
|
path: "/video-transcripts/{id}/subtitles",
|
|
@@ -47,4 +62,4 @@ export const videoTranscriptContract = {
|
|
|
47
62
|
})
|
|
48
63
|
.input(videoTranscriptGetInputSchema)
|
|
49
64
|
.output(videoTranscriptSubtitlesSchema),
|
|
50
|
-
}
|
|
65
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { ContractRouterClient } from "@orpc/contract"
|
|
2
|
-
import { betaAccessContract } from "./contracts/beta-access"
|
|
3
|
-
import { billingContract } from "./contracts/billing"
|
|
4
|
-
import { cardContract } from "./contracts/card"
|
|
5
|
-
import { cardTemplateContract } from "./contracts/card-template"
|
|
6
|
-
import { ebookContract } from "./contracts/ebook"
|
|
7
|
-
import { hostedAiContract } from "./contracts/hosted-ai"
|
|
8
|
-
import { notebaseContract } from "./contracts/notebase"
|
|
9
|
-
import { notebaseColumnContract } from "./contracts/notebase-column"
|
|
10
|
-
import { notebaseRowContract } from "./contracts/notebase-row"
|
|
11
|
-
import { srsContract } from "./contracts/srs"
|
|
12
|
-
import { statsContract } from "./contracts/stats"
|
|
13
|
-
import { userContract } from "./contracts/user"
|
|
14
|
-
import { videoTranscriptContract } from "./contracts/video-transcript"
|
|
1
|
+
import type { ContractRouterClient } from "@orpc/contract";
|
|
2
|
+
import { betaAccessContract } from "./contracts/beta-access";
|
|
3
|
+
import { billingContract } from "./contracts/billing";
|
|
4
|
+
import { cardContract } from "./contracts/card";
|
|
5
|
+
import { cardTemplateContract } from "./contracts/card-template";
|
|
6
|
+
import { ebookContract } from "./contracts/ebook";
|
|
7
|
+
import { hostedAiContract } from "./contracts/hosted-ai";
|
|
8
|
+
import { notebaseContract } from "./contracts/notebase";
|
|
9
|
+
import { notebaseColumnContract } from "./contracts/notebase-column";
|
|
10
|
+
import { notebaseRowContract } from "./contracts/notebase-row";
|
|
11
|
+
import { srsContract } from "./contracts/srs";
|
|
12
|
+
import { statsContract } from "./contracts/stats";
|
|
13
|
+
import { userContract } from "./contracts/user";
|
|
14
|
+
import { videoTranscriptContract } from "./contracts/video-transcript";
|
|
15
15
|
|
|
16
16
|
export const contract = {
|
|
17
17
|
betaAccess: betaAccessContract,
|
|
@@ -27,24 +27,28 @@ export const contract = {
|
|
|
27
27
|
stats: statsContract,
|
|
28
28
|
user: userContract,
|
|
29
29
|
videoTranscript: videoTranscriptContract,
|
|
30
|
-
}
|
|
30
|
+
};
|
|
31
31
|
|
|
32
|
-
export type ORPCRouterClient = ContractRouterClient<typeof contract
|
|
32
|
+
export type ORPCRouterClient = ContractRouterClient<typeof contract>;
|
|
33
33
|
|
|
34
|
-
export
|
|
35
|
-
export * from "./
|
|
36
|
-
export * from "./schemas/
|
|
37
|
-
export * from "./schemas/
|
|
38
|
-
export * from "./schemas/
|
|
39
|
-
export * from "./schemas/
|
|
40
|
-
export * from "./schemas/
|
|
41
|
-
export * from "./schemas/notebase
|
|
42
|
-
export * from "./schemas/notebase-
|
|
43
|
-
export * from "./schemas/notebase-
|
|
44
|
-
export * from "./schemas/notebase-
|
|
45
|
-
export * from "./schemas/
|
|
46
|
-
export * from "./schemas/srs
|
|
47
|
-
export * from "./schemas/stats"
|
|
48
|
-
export * from "./schemas/
|
|
49
|
-
export * from "./schemas/
|
|
50
|
-
export * from "./schemas/
|
|
34
|
+
export { type AgentRoute, defineAgentProcedure } from "./contracts/shared";
|
|
35
|
+
export * from "./public-errors";
|
|
36
|
+
export * from "./schemas/beta-access";
|
|
37
|
+
export * from "./schemas/billing";
|
|
38
|
+
export * from "./schemas/card";
|
|
39
|
+
export * from "./schemas/ebook";
|
|
40
|
+
export * from "./schemas/hosted-ai";
|
|
41
|
+
export * from "./schemas/notebase";
|
|
42
|
+
export * from "./schemas/notebase-column";
|
|
43
|
+
export * from "./schemas/notebase-row";
|
|
44
|
+
export * from "./schemas/notebase-stats";
|
|
45
|
+
export * from "./schemas/notebase-view";
|
|
46
|
+
export * from "./schemas/srs";
|
|
47
|
+
export * from "./schemas/srs-stats";
|
|
48
|
+
export * from "./schemas/stats";
|
|
49
|
+
export * from "./schemas/timezone";
|
|
50
|
+
export * from "./schemas/user";
|
|
51
|
+
export * from "./schemas/video-transcript";
|
|
52
|
+
|
|
53
|
+
export * from "./schemas/pagination";
|
|
54
|
+
export * from "./schemas/resource-mutation";
|