@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
package/package.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@read-frog/api-contract",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.12.6",
|
|
3
|
+
"version": "0.15.0",
|
|
5
4
|
"private": false,
|
|
6
5
|
"repository": {
|
|
7
6
|
"type": "git",
|
|
8
7
|
"url": "https://github.com/mengxi-ream/read-frog-monorepo",
|
|
9
8
|
"directory": "packages/api-contract"
|
|
10
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"src"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
11
17
|
"imports": {
|
|
12
18
|
"#/*": "./src/*.ts"
|
|
13
19
|
},
|
|
@@ -17,21 +23,14 @@
|
|
|
17
23
|
"import": "./dist/index.js"
|
|
18
24
|
}
|
|
19
25
|
},
|
|
20
|
-
"main": "./dist/index.js",
|
|
21
|
-
"types": "./dist/index.d.ts",
|
|
22
|
-
"files": [
|
|
23
|
-
"dist",
|
|
24
|
-
"src"
|
|
25
|
-
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@orpc/contract": "^1.14.6",
|
|
28
|
-
"zod": "^4.4
|
|
29
|
-
"@read-frog/definitions": "0.
|
|
28
|
+
"zod": "^4.5.4",
|
|
29
|
+
"@read-frog/definitions": "0.5.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^26.1.0",
|
|
33
|
-
"tsdown": "^0.22.
|
|
34
|
-
"@repo/eslint-config": "0.0.1",
|
|
33
|
+
"tsdown": "^0.22.14",
|
|
35
34
|
"@repo/tsdown-config": "0.0.0",
|
|
36
35
|
"@repo/typescript-config": "0.0.0"
|
|
37
36
|
},
|
|
@@ -40,7 +39,9 @@
|
|
|
40
39
|
"dev": "tsdown --watch",
|
|
41
40
|
"build:publish": "tsdown",
|
|
42
41
|
"type-check": "tsc --noEmit",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
42
|
+
"fmt": "oxfmt --config ../../.oxfmtrc.json --write --no-error-on-unmatched-pattern .",
|
|
43
|
+
"fmt:check": "oxfmt --config ../../.oxfmtrc.json --check --no-error-on-unmatched-pattern .",
|
|
44
|
+
"lint": "oxlint --config ../../.oxlintrc.json --type-aware --deny-warnings --report-unused-disable-directives-severity=error --no-error-on-unmatched-pattern .",
|
|
45
|
+
"lint:fix": "oxlint --config ../../.oxlintrc.json --type-aware --fix --deny-warnings --report-unused-disable-directives-severity=error --no-error-on-unmatched-pattern ."
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { oc } from "@orpc/contract"
|
|
2
|
-
import {
|
|
3
|
-
BetaAccessStatusInputSchema,
|
|
4
|
-
BetaAccessStatusOutputSchema,
|
|
5
|
-
} from "#/schemas/beta-access"
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { BetaAccessStatusInputSchema, BetaAccessStatusOutputSchema } from "#/schemas/beta-access";
|
|
6
3
|
|
|
7
4
|
export const betaAccessContract = {
|
|
8
5
|
status: oc
|
|
@@ -14,4 +11,4 @@ export const betaAccessContract = {
|
|
|
14
11
|
})
|
|
15
12
|
.input(BetaAccessStatusInputSchema)
|
|
16
13
|
.output(BetaAccessStatusOutputSchema),
|
|
17
|
-
}
|
|
14
|
+
};
|
package/src/contracts/billing.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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
|
billingCancelScheduledChangeOutputSchema,
|
|
5
5
|
billingCreateCheckoutSessionInputSchema,
|
|
6
6
|
billingCreateCustomerPortalSessionInputSchema,
|
|
7
7
|
billingSessionUrlOutputSchema,
|
|
8
8
|
billingStatusSchema,
|
|
9
|
-
} from "#/schemas/billing"
|
|
9
|
+
} from "#/schemas/billing";
|
|
10
10
|
|
|
11
11
|
const billingProcedure = oc.errors(
|
|
12
12
|
pickPublicErrorMap(
|
|
@@ -15,7 +15,7 @@ const billingProcedure = oc.errors(
|
|
|
15
15
|
"BILLING_PASS_ACTIVE",
|
|
16
16
|
"BILLING_CHANGE_SCHEDULED",
|
|
17
17
|
),
|
|
18
|
-
)
|
|
18
|
+
);
|
|
19
19
|
|
|
20
20
|
export const billingContract = {
|
|
21
21
|
status: billingProcedure
|
|
@@ -52,4 +52,4 @@ export const billingContract = {
|
|
|
52
52
|
tags: ["Billing"],
|
|
53
53
|
})
|
|
54
54
|
.output(billingCancelScheduledChangeOutputSchema),
|
|
55
|
-
}
|
|
55
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgentProcedure } from "./shared";
|
|
2
|
+
import { pickPublicErrorMap } from "#/public-errors";
|
|
2
3
|
import {
|
|
3
4
|
CardTemplateCreateInputSchema,
|
|
4
5
|
CardTemplateCreateOutputSchema,
|
|
@@ -10,62 +11,67 @@ import {
|
|
|
10
11
|
CardTemplateListOutputSchema,
|
|
11
12
|
CardTemplateUpdateInputSchema,
|
|
12
13
|
CardTemplateUpdateOutputSchema,
|
|
13
|
-
} from "#/schemas/card"
|
|
14
|
-
import { notebaseProcedure } from "./shared"
|
|
14
|
+
} from "#/schemas/card";
|
|
15
15
|
|
|
16
16
|
export const cardTemplateContract = {
|
|
17
|
-
list:
|
|
17
|
+
list: defineAgentProcedure({
|
|
18
|
+
method: "GET",
|
|
19
|
+
path: "/card-templates",
|
|
20
|
+
summary: "List card templates",
|
|
21
|
+
description:
|
|
22
|
+
"List owned card templates, optionally filtered by notebase. Supports limit and offset pagination.",
|
|
23
|
+
tags: ["Card Templates"],
|
|
24
|
+
})
|
|
18
25
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
19
|
-
.route({
|
|
20
|
-
method: "GET",
|
|
21
|
-
path: "/card-templates",
|
|
22
|
-
summary: "List card templates",
|
|
23
|
-
tags: ["Card Templates"],
|
|
24
|
-
})
|
|
25
26
|
.input(CardTemplateListInputSchema)
|
|
26
27
|
.output(CardTemplateListOutputSchema),
|
|
27
28
|
|
|
28
|
-
get:
|
|
29
|
+
get: defineAgentProcedure({
|
|
30
|
+
method: "GET",
|
|
31
|
+
path: "/card-templates/{id}",
|
|
32
|
+
summary: "Get card template",
|
|
33
|
+
description: "Read the complete definition and updatedAt timestamp of an owned card template.",
|
|
34
|
+
tags: ["Card Templates"],
|
|
35
|
+
})
|
|
29
36
|
.errors(pickPublicErrorMap("CARD_TEMPLATE_NOT_FOUND"))
|
|
30
|
-
.route({
|
|
31
|
-
method: "GET",
|
|
32
|
-
path: "/card-templates/{id}",
|
|
33
|
-
summary: "Get card template",
|
|
34
|
-
tags: ["Card Templates"],
|
|
35
|
-
})
|
|
36
37
|
.input(CardTemplateGetInputSchema)
|
|
37
38
|
.output(CardTemplateGetOutputSchema),
|
|
38
39
|
|
|
39
|
-
create:
|
|
40
|
+
create: defineAgentProcedure({
|
|
41
|
+
method: "POST",
|
|
42
|
+
path: "/card-templates",
|
|
43
|
+
summary: "Create card template",
|
|
44
|
+
description:
|
|
45
|
+
"Create a template in an owned notebase using existing field IDs in its patterns. This generates cards for existing notes.",
|
|
46
|
+
tags: ["Card Templates"],
|
|
47
|
+
})
|
|
40
48
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS"))
|
|
41
|
-
.
|
|
42
|
-
method: "POST",
|
|
43
|
-
path: "/card-templates",
|
|
44
|
-
summary: "Create card template",
|
|
45
|
-
tags: ["Card Templates"],
|
|
46
|
-
})
|
|
49
|
+
.errors(pickPublicErrorMap("RESOURCE_ALREADY_EXISTS"))
|
|
47
50
|
.input(CardTemplateCreateInputSchema)
|
|
48
51
|
.output(CardTemplateCreateOutputSchema),
|
|
49
52
|
|
|
50
|
-
update:
|
|
53
|
+
update: defineAgentProcedure({
|
|
54
|
+
method: "PATCH",
|
|
55
|
+
path: "/card-templates/{id}",
|
|
56
|
+
summary: "Update card template",
|
|
57
|
+
description:
|
|
58
|
+
"Change an owned template name or definition. Rendered cards reflect the saved template. expectedUpdatedAt guards against editing stale data.",
|
|
59
|
+
tags: ["Card Templates"],
|
|
60
|
+
})
|
|
51
61
|
.errors(pickPublicErrorMap("CARD_TEMPLATE_NOT_FOUND", "CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS"))
|
|
52
|
-
.
|
|
53
|
-
method: "PATCH",
|
|
54
|
-
path: "/card-templates/{id}",
|
|
55
|
-
summary: "Update card template",
|
|
56
|
-
tags: ["Card Templates"],
|
|
57
|
-
})
|
|
62
|
+
.errors(pickPublicErrorMap("RESOURCE_UPDATE_CONFLICT"))
|
|
58
63
|
.input(CardTemplateUpdateInputSchema)
|
|
59
64
|
.output(CardTemplateUpdateOutputSchema),
|
|
60
65
|
|
|
61
|
-
delete:
|
|
66
|
+
delete: defineAgentProcedure({
|
|
67
|
+
method: "DELETE",
|
|
68
|
+
path: "/card-templates/{id}",
|
|
69
|
+
summary: "Delete card template",
|
|
70
|
+
description:
|
|
71
|
+
"Permanently delete an owned template and its generated cards and review records. Source notes are preserved.",
|
|
72
|
+
tags: ["Card Templates"],
|
|
73
|
+
})
|
|
62
74
|
.errors(pickPublicErrorMap("CARD_TEMPLATE_NOT_FOUND"))
|
|
63
|
-
.route({
|
|
64
|
-
method: "DELETE",
|
|
65
|
-
path: "/card-templates/{id}",
|
|
66
|
-
summary: "Delete card template",
|
|
67
|
-
tags: ["Card Templates"],
|
|
68
|
-
})
|
|
69
75
|
.input(CardTemplateDeleteInputSchema)
|
|
70
76
|
.output(CardTemplateDeleteOutputSchema),
|
|
71
|
-
}
|
|
77
|
+
};
|
package/src/contracts/card.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgentProcedure } from "./shared";
|
|
2
|
+
import { oc } from "@orpc/contract";
|
|
3
|
+
import { pickPublicErrorMap } from "#/public-errors";
|
|
2
4
|
import {
|
|
3
5
|
CardGenerateInputSchema,
|
|
4
6
|
CardGenerateOutputSchema,
|
|
@@ -6,33 +8,34 @@ import {
|
|
|
6
8
|
CardGetOutputSchema,
|
|
7
9
|
CardListInputSchema,
|
|
8
10
|
CardListOutputSchema,
|
|
9
|
-
} from "#/schemas/card"
|
|
10
|
-
import { notebaseProcedure } from "./shared"
|
|
11
|
+
} from "#/schemas/card";
|
|
11
12
|
|
|
12
13
|
export const cardContract = {
|
|
13
|
-
list:
|
|
14
|
+
list: defineAgentProcedure({
|
|
15
|
+
method: "GET",
|
|
16
|
+
path: "/cards",
|
|
17
|
+
summary: "List cards",
|
|
18
|
+
description:
|
|
19
|
+
"Browse owned cards with rendered fronts, backs, source IDs and learning state. Optionally filter by notebase, template or scheduleStatus. Supports limit and offset pagination.",
|
|
20
|
+
tags: ["Cards"],
|
|
21
|
+
})
|
|
14
22
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
15
|
-
.route({
|
|
16
|
-
method: "GET",
|
|
17
|
-
path: "/cards",
|
|
18
|
-
summary: "List rendered cards",
|
|
19
|
-
tags: ["Cards"],
|
|
20
|
-
})
|
|
21
23
|
.input(CardListInputSchema)
|
|
22
24
|
.output(CardListOutputSchema),
|
|
23
25
|
|
|
24
|
-
get:
|
|
26
|
+
get: defineAgentProcedure({
|
|
27
|
+
method: "GET",
|
|
28
|
+
path: "/cards/{id}",
|
|
29
|
+
summary: "Get card",
|
|
30
|
+
description:
|
|
31
|
+
"Read one owned card with its rendered front, back, source IDs and learning state.",
|
|
32
|
+
tags: ["Cards"],
|
|
33
|
+
})
|
|
25
34
|
.errors(pickPublicErrorMap("CARD_NOT_FOUND"))
|
|
26
|
-
.route({
|
|
27
|
-
method: "GET",
|
|
28
|
-
path: "/cards/{id}",
|
|
29
|
-
summary: "Get rendered card",
|
|
30
|
-
tags: ["Cards"],
|
|
31
|
-
})
|
|
32
35
|
.input(CardGetInputSchema)
|
|
33
36
|
.output(CardGetOutputSchema),
|
|
34
37
|
|
|
35
|
-
generate:
|
|
38
|
+
generate: oc
|
|
36
39
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CARD_TEMPLATE_NOT_FOUND"))
|
|
37
40
|
.route({
|
|
38
41
|
method: "POST",
|
|
@@ -42,4 +45,4 @@ export const cardContract = {
|
|
|
42
45
|
})
|
|
43
46
|
.input(CardGenerateInputSchema)
|
|
44
47
|
.output(CardGenerateOutputSchema),
|
|
45
|
-
}
|
|
48
|
+
};
|
package/src/contracts/ebook.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
ebookDeleteInputSchema,
|
|
5
5
|
ebookDeleteOutputSchema,
|
|
@@ -17,9 +17,9 @@ import {
|
|
|
17
17
|
ebookRequestUploadOutputSchema,
|
|
18
18
|
ebookUpdateProgressInputSchema,
|
|
19
19
|
ebookUpdateProgressOutputSchema,
|
|
20
|
-
} from "#/schemas/ebook"
|
|
20
|
+
} from "#/schemas/ebook";
|
|
21
21
|
|
|
22
|
-
const ebookProcedure = oc
|
|
22
|
+
const ebookProcedure = oc;
|
|
23
23
|
|
|
24
24
|
export const ebookContract = {
|
|
25
25
|
list: ebookProcedure
|
|
@@ -56,12 +56,14 @@ export const ebookContract = {
|
|
|
56
56
|
.output(ebookRequestUploadOutputSchema),
|
|
57
57
|
|
|
58
58
|
finalizeUpload: ebookProcedure
|
|
59
|
-
.errors(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
.errors(
|
|
60
|
+
pickPublicErrorMap(
|
|
61
|
+
"EBOOK_BETA_RESTRICTED",
|
|
62
|
+
"EBOOK_NOT_FOUND",
|
|
63
|
+
"EBOOK_UPLOAD_NOT_COMPLETED",
|
|
64
|
+
"EBOOK_FILE_TOO_LARGE",
|
|
65
|
+
),
|
|
66
|
+
)
|
|
65
67
|
.route({
|
|
66
68
|
method: "POST",
|
|
67
69
|
path: "/ebooks/{ebookId}/finalize",
|
|
@@ -114,4 +116,4 @@ export const ebookContract = {
|
|
|
114
116
|
})
|
|
115
117
|
.input(ebookDeleteInputSchema)
|
|
116
118
|
.output(ebookDeleteOutputSchema),
|
|
117
|
-
}
|
|
119
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { eventIterator, oc } from "@orpc/contract"
|
|
2
|
-
import { pickPublicErrorMap } from "#/public-errors"
|
|
1
|
+
import { eventIterator, oc } from "@orpc/contract";
|
|
2
|
+
import { pickPublicErrorMap } from "#/public-errors";
|
|
3
3
|
import {
|
|
4
4
|
HostedAiNoteSuggestionStreamInputSchema,
|
|
5
5
|
HostedAiStatusInputSchema,
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
HostedAiStreamPartSchema,
|
|
8
8
|
HostedAiStreamStructuredObjectInputSchema,
|
|
9
9
|
HostedAiStreamTextInputSchema,
|
|
10
|
-
} from "#/schemas/hosted-ai"
|
|
10
|
+
} from "#/schemas/hosted-ai";
|
|
11
11
|
|
|
12
12
|
const hostedAiStreamErrors = pickPublicErrorMap(
|
|
13
13
|
"HOSTED_AI_TIER_RESTRICTED",
|
|
14
14
|
"HOSTED_AI_QUOTA_EXHAUSTED",
|
|
15
|
-
)
|
|
15
|
+
);
|
|
16
16
|
|
|
17
17
|
export const hostedAiContract = {
|
|
18
18
|
status: oc
|
|
@@ -130,4 +130,4 @@ export const hostedAiContract = {
|
|
|
130
130
|
.output(eventIterator(HostedAiStreamPartSchema))
|
|
131
131
|
.errors(hostedAiStreamErrors),
|
|
132
132
|
},
|
|
133
|
-
}
|
|
133
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgentProcedure } from "./shared";
|
|
2
|
+
import { oc } from "@orpc/contract";
|
|
3
|
+
import { pickPublicErrorMap } from "#/public-errors";
|
|
2
4
|
import {
|
|
3
5
|
NotebaseColumnCreateInputSchema,
|
|
4
6
|
NotebaseColumnCreateOutputSchema,
|
|
@@ -8,49 +10,55 @@ import {
|
|
|
8
10
|
NotebaseColumnReorderOutputSchema,
|
|
9
11
|
NotebaseColumnUpdateInputSchema,
|
|
10
12
|
NotebaseColumnUpdateOutputSchema,
|
|
11
|
-
} from "#/schemas/notebase-column"
|
|
12
|
-
import { notebaseProcedure } from "./shared"
|
|
13
|
+
} from "#/schemas/notebase-column";
|
|
13
14
|
|
|
14
15
|
export const notebaseColumnContract = {
|
|
15
|
-
create:
|
|
16
|
+
create: defineAgentProcedure({
|
|
17
|
+
method: "POST",
|
|
18
|
+
path: "/notebase-columns",
|
|
19
|
+
summary: "Create notebase field",
|
|
20
|
+
description:
|
|
21
|
+
"Create a field in an owned notebase. The returned field ID is used as a key in note cells.",
|
|
22
|
+
tags: ["Notebase Columns"],
|
|
23
|
+
})
|
|
16
24
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT"))
|
|
17
|
-
.
|
|
18
|
-
method: "POST",
|
|
19
|
-
path: "/notebase-columns",
|
|
20
|
-
summary: "Create notebase column",
|
|
21
|
-
tags: ["Notebase Columns"],
|
|
22
|
-
})
|
|
25
|
+
.errors(pickPublicErrorMap("RESOURCE_ALREADY_EXISTS"))
|
|
23
26
|
.input(NotebaseColumnCreateInputSchema)
|
|
24
27
|
.output(NotebaseColumnCreateOutputSchema),
|
|
25
28
|
|
|
26
|
-
update:
|
|
29
|
+
update: defineAgentProcedure({
|
|
30
|
+
method: "PATCH",
|
|
31
|
+
path: "/notebase-columns/{notebaseColumnId}",
|
|
32
|
+
summary: "Update notebase field",
|
|
33
|
+
description:
|
|
34
|
+
"Update an owned field without changing its type. Removing select options clears affected note values. expectedUpdatedAt guards against editing stale data.",
|
|
35
|
+
tags: ["Notebase Columns"],
|
|
36
|
+
})
|
|
27
37
|
.errors(pickPublicErrorMap("NOTEBASE_COLUMN_NOT_FOUND"))
|
|
28
|
-
.
|
|
29
|
-
method: "PATCH",
|
|
30
|
-
path: "/notebase-columns/{notebaseColumnId}",
|
|
31
|
-
summary: "Update notebase column",
|
|
32
|
-
tags: ["Notebase Columns"],
|
|
33
|
-
})
|
|
38
|
+
.errors(pickPublicErrorMap("RESOURCE_UPDATE_CONFLICT", "FIELD_TYPE_CHANGE_UNSUPPORTED"))
|
|
34
39
|
.input(NotebaseColumnUpdateInputSchema)
|
|
35
40
|
.output(NotebaseColumnUpdateOutputSchema),
|
|
36
41
|
|
|
37
|
-
delete:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
delete: defineAgentProcedure({
|
|
43
|
+
method: "DELETE",
|
|
44
|
+
path: "/notebase-columns/{notebaseColumnId}",
|
|
45
|
+
summary: "Delete notebase field",
|
|
46
|
+
description:
|
|
47
|
+
"Delete an owned field and remove its values from notes. Primary fields and fields referenced by templates cannot be deleted.",
|
|
48
|
+
tags: ["Notebase Columns"],
|
|
49
|
+
})
|
|
50
|
+
.errors(
|
|
51
|
+
pickPublicErrorMap(
|
|
52
|
+
"NOTEBASE_COLUMN_NOT_FOUND",
|
|
53
|
+
"PRIMARY_NOTEBASE_COLUMN_DELETE_NOT_ALLOWED",
|
|
54
|
+
"CARD_TEMPLATE_NOTEBASE_COLUMN_IN_USE",
|
|
55
|
+
"CONCURRENT_POSITION_CONFLICT",
|
|
56
|
+
),
|
|
57
|
+
)
|
|
50
58
|
.input(NotebaseColumnDeleteInputSchema)
|
|
51
59
|
.output(NotebaseColumnDeleteOutputSchema),
|
|
52
60
|
|
|
53
|
-
reorder:
|
|
61
|
+
reorder: oc
|
|
54
62
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT"))
|
|
55
63
|
.route({
|
|
56
64
|
method: "POST",
|
|
@@ -60,4 +68,4 @@ export const notebaseColumnContract = {
|
|
|
60
68
|
})
|
|
61
69
|
.input(NotebaseColumnReorderInputSchema)
|
|
62
70
|
.output(NotebaseColumnReorderOutputSchema),
|
|
63
|
-
}
|
|
71
|
+
};
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgentProcedure } from "./shared";
|
|
2
|
+
import {
|
|
3
|
+
NotebaseRowListInputSchema,
|
|
4
|
+
NotebaseRowListOutputSchema,
|
|
5
|
+
NotebaseRowGetInputSchema,
|
|
6
|
+
NotebaseRowGetOutputSchema,
|
|
7
|
+
} from "#/schemas/notebase-row";
|
|
8
|
+
import { oc } from "@orpc/contract";
|
|
9
|
+
import { pickPublicErrorMap } from "#/public-errors";
|
|
2
10
|
import {
|
|
3
11
|
NotebaseRowCreateInputSchema,
|
|
4
12
|
NotebaseRowCreateManyInputSchema,
|
|
@@ -10,65 +18,97 @@ import {
|
|
|
10
18
|
NotebaseRowReorderOutputSchema,
|
|
11
19
|
NotebaseRowUpdateInputSchema,
|
|
12
20
|
NotebaseRowUpdateOutputSchema,
|
|
13
|
-
} from "#/schemas/notebase-row"
|
|
14
|
-
import { notebaseProcedure } from "./shared"
|
|
21
|
+
} from "#/schemas/notebase-row";
|
|
15
22
|
|
|
16
23
|
export const notebaseRowContract = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
list: defineAgentProcedure({
|
|
25
|
+
method: "GET",
|
|
26
|
+
path: "/notebase-rows",
|
|
27
|
+
summary: "List or search notes",
|
|
28
|
+
description:
|
|
29
|
+
"List or search owned notes, optionally within one notebase. Supply query to search; omit it to browse, which returns every note in scope rather than a filtered set. Searching requires notebaseId and covers that one notebase, so cover several by listing them first and calling this once per notebase. The query filter is at least two characters, matches a literal case-insensitive substring, and only searches fields of type string, so values in number, boolean, date and select fields are never matched. Supports limit and offset pagination.",
|
|
30
|
+
tags: ["Notebase Rows"],
|
|
31
|
+
})
|
|
32
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
33
|
+
.input(NotebaseRowListInputSchema)
|
|
34
|
+
.output(NotebaseRowListOutputSchema),
|
|
35
|
+
get: defineAgentProcedure({
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: "/notebase-rows/{id}",
|
|
38
|
+
summary: "Get note",
|
|
39
|
+
description:
|
|
40
|
+
"Read one owned note with field-ID values and the updatedAt timestamp used for modification checks.",
|
|
41
|
+
tags: ["Notebase Rows"],
|
|
42
|
+
})
|
|
43
|
+
.errors(pickPublicErrorMap("NOTEBASE_ROW_NOT_FOUND"))
|
|
44
|
+
.input(NotebaseRowGetInputSchema)
|
|
45
|
+
.output(NotebaseRowGetOutputSchema),
|
|
46
|
+
create: defineAgentProcedure({
|
|
47
|
+
method: "POST",
|
|
48
|
+
path: "/notebase-rows",
|
|
49
|
+
summary: "Create note",
|
|
50
|
+
description:
|
|
51
|
+
"Create a note in an owned notebase using field IDs and their declared value types. Existing templates generate cards. A duplicate entity ID produces a conflict.",
|
|
52
|
+
tags: ["Notebase Rows"],
|
|
53
|
+
})
|
|
54
|
+
.errors(
|
|
55
|
+
pickPublicErrorMap(
|
|
56
|
+
"NOTEBASE_NOT_FOUND",
|
|
57
|
+
"CELL_VALIDATION_FAILED",
|
|
58
|
+
"CONCURRENT_POSITION_CONFLICT",
|
|
59
|
+
"NOTE_LIMIT_EXCEEDED",
|
|
60
|
+
),
|
|
61
|
+
)
|
|
62
|
+
.errors(pickPublicErrorMap("RESOURCE_ALREADY_EXISTS"))
|
|
30
63
|
.input(NotebaseRowCreateInputSchema)
|
|
31
64
|
.output(NotebaseRowCreateOutputSchema),
|
|
32
65
|
|
|
33
|
-
createMany:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
66
|
+
createMany: defineAgentProcedure({
|
|
67
|
+
method: "POST",
|
|
68
|
+
path: "/notebase-rows/batch",
|
|
69
|
+
summary: "Create notes",
|
|
70
|
+
description:
|
|
71
|
+
"Create 1–50 notes atomically in one owned notebase. Cells use field IDs and declared value types. Existing templates generate cards. Duplicate entity IDs roll back the whole batch.",
|
|
72
|
+
tags: ["Notebase Rows"],
|
|
73
|
+
})
|
|
74
|
+
.errors(
|
|
75
|
+
pickPublicErrorMap(
|
|
76
|
+
"NOTEBASE_NOT_FOUND",
|
|
77
|
+
"CELL_VALIDATION_FAILED",
|
|
78
|
+
"CONCURRENT_POSITION_CONFLICT",
|
|
79
|
+
"NOTE_LIMIT_EXCEEDED",
|
|
80
|
+
),
|
|
81
|
+
)
|
|
82
|
+
.errors(pickPublicErrorMap("RESOURCE_ALREADY_EXISTS"))
|
|
46
83
|
.input(NotebaseRowCreateManyInputSchema)
|
|
47
84
|
.output(NotebaseRowCreateManyOutputSchema),
|
|
48
85
|
|
|
49
|
-
update:
|
|
86
|
+
update: defineAgentProcedure({
|
|
87
|
+
method: "PATCH",
|
|
88
|
+
path: "/notebase-rows/{notebaseRowId}",
|
|
89
|
+
summary: "Update note",
|
|
90
|
+
description:
|
|
91
|
+
"Merge supplied fields into an owned note, preserving omitted fields. Use null to clear a field. expectedUpdatedAt guards against editing stale data; reread on a modification conflict.",
|
|
92
|
+
tags: ["Notebase Rows"],
|
|
93
|
+
})
|
|
50
94
|
.errors(pickPublicErrorMap("NOTEBASE_ROW_NOT_FOUND", "CELL_VALIDATION_FAILED"))
|
|
51
|
-
.
|
|
52
|
-
method: "PATCH",
|
|
53
|
-
path: "/notebase-rows/{notebaseRowId}",
|
|
54
|
-
summary: "Update notebase row cells",
|
|
55
|
-
tags: ["Notebase Rows"],
|
|
56
|
-
})
|
|
95
|
+
.errors(pickPublicErrorMap("RESOURCE_UPDATE_CONFLICT"))
|
|
57
96
|
.input(NotebaseRowUpdateInputSchema)
|
|
58
97
|
.output(NotebaseRowUpdateOutputSchema),
|
|
59
98
|
|
|
60
|
-
delete:
|
|
99
|
+
delete: defineAgentProcedure({
|
|
100
|
+
method: "DELETE",
|
|
101
|
+
path: "/notebase-rows/{notebaseRowId}",
|
|
102
|
+
summary: "Delete note",
|
|
103
|
+
description:
|
|
104
|
+
"Permanently delete an owned note and its derived cards and review records. Return the deleted note ID.",
|
|
105
|
+
tags: ["Notebase Rows"],
|
|
106
|
+
})
|
|
61
107
|
.errors(pickPublicErrorMap("NOTEBASE_ROW_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT"))
|
|
62
|
-
.route({
|
|
63
|
-
method: "DELETE",
|
|
64
|
-
path: "/notebase-rows/{notebaseRowId}",
|
|
65
|
-
summary: "Delete notebase row",
|
|
66
|
-
tags: ["Notebase Rows"],
|
|
67
|
-
})
|
|
68
108
|
.input(NotebaseRowDeleteInputSchema)
|
|
69
109
|
.output(NotebaseRowDeleteOutputSchema),
|
|
70
110
|
|
|
71
|
-
reorder:
|
|
111
|
+
reorder: oc
|
|
72
112
|
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT"))
|
|
73
113
|
.route({
|
|
74
114
|
method: "POST",
|
|
@@ -78,4 +118,4 @@ export const notebaseRowContract = {
|
|
|
78
118
|
})
|
|
79
119
|
.input(NotebaseRowReorderInputSchema)
|
|
80
120
|
.output(NotebaseRowReorderOutputSchema),
|
|
81
|
-
}
|
|
121
|
+
};
|